From: Flavio Tordini Date: Tue, 30 Jun 2009 15:54:28 +0000 (+0200) Subject: Applied Compact Mode patch by Stefan Brück X-Git-Tag: 0.4~23 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=47cd713d1bb5cce48ae1faf75e08646ef9572d88;p=minitube Applied Compact Mode patch by Stefan Brück --- diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 17c6c8f..88c24f0 100755 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -120,6 +120,15 @@ void MainWindow::createActions() { actions->insert("fullscreen", fullscreenAct); connect(fullscreenAct, SIGNAL(triggered()), this, SLOT(fullscreen())); + compactViewAct = new QAction(tr("&Compact View"), this); + compactViewAct->setStatusTip(tr("Go compact view")); + compactViewAct->setShortcut(QKeySequence(Qt::ALT + Qt::Key_M)); + compactViewAct->setCheckable(true); + compactViewAct->setChecked(false); + compactViewAct->setEnabled(false); + actions->insert("compactView", compactViewAct); + connect(compactViewAct, SIGNAL(toggled(bool)), this, SLOT(compactView(bool))); + /* // icon should be document-save but it is ugly downloadAct = new QAction(QtIconLoader::icon("go-down", QIcon(":/images/go-down.png")), tr("&Download"), this); @@ -237,6 +246,7 @@ void MainWindow::createMenus() { viewMenu->addAction(webPageAct); viewMenu->addSeparator(); viewMenu->addAction(fullscreenAct); + viewMenu->addAction(compactViewAct); helpMenu = menuBar()->addMenu(tr("&Help")); helpMenu->addAction(siteAct); @@ -330,6 +340,7 @@ void MainWindow::showWidget ( QWidget* widget ) { // settingsAct->setEnabled(widget != settingsView); stopAct->setEnabled(widget == mediaView); fullscreenAct->setEnabled(widget == mediaView); + compactViewAct->setEnabled(widget == mediaView); webPageAct->setEnabled(widget == mediaView); aboutAct->setEnabled(widget != aboutView); @@ -474,6 +485,11 @@ void MainWindow::fullscreen() { m_fullscreen = !m_fullscreen; } +void MainWindow::compactView(bool enable) { + mediaView->setPlaylistVisible(!enable); + mainToolBar->setVisible(!enable); +} + void MainWindow::searchFocus() { QWidget *view = views->currentWidget(); if (view == mediaView) { diff --git a/src/MainWindow.h b/src/MainWindow.h index 99d7abb..400a2a2 100755 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -36,6 +36,7 @@ private slots: void about(); void quit(); void fullscreen(); + void compactView(bool enable); void stop(); void stateChanged(Phonon::State newState, Phonon::State oldState); void searchFocus(); @@ -78,6 +79,7 @@ private: QAction *pauseAct; QAction *stopAct; QAction *fullscreenAct; + QAction *compactViewAct; QAction *webPageAct; QAction *downloadAct; diff --git a/src/MediaView.cpp b/src/MediaView.cpp index 64c85e2..d44bc67 100644 --- a/src/MediaView.cpp +++ b/src/MediaView.cpp @@ -74,10 +74,6 @@ MediaView::MediaView(QWidget *parent) : QWidget(parent) { splitter->addWidget(videoAreaWidget); - QList sizes; - sizes << 320 << 640; - splitter->setSizes(sizes); - layout->addWidget(splitter); setLayout(layout); } @@ -178,7 +174,7 @@ void MediaView::fullscreen() { void MediaView::exitFullscreen() { videoAreaWidget->setParent(this); splitter->addWidget(videoAreaWidget); - videoAreaWidget->showNormal(); + videoAreaWidget->show(); splitter->restoreState(splitterState); } @@ -307,3 +303,8 @@ void MediaView::searchMostViewed() { searchParams->setSortBy(SearchParams::SortByViewCount); search(searchParams); } + +void MediaView::setPlaylistVisible(bool visible) { + playlistWidget->setVisible(visible); +} + diff --git a/src/MediaView.h b/src/MediaView.h index 37433ca..705d60c 100644 --- a/src/MediaView.h +++ b/src/MediaView.h @@ -47,6 +47,7 @@ public slots: void removeSelected(); void moveUpSelected(); void moveDownSelected(); + void setPlaylistVisible(bool visible=true); private slots: // list/model