From 47cd713d1bb5cce48ae1faf75e08646ef9572d88 Mon Sep 17 00:00:00 2001 From: Flavio Tordini Date: Tue, 30 Jun 2009 17:54:28 +0200 Subject: [PATCH] =?utf8?q?Applied=20Compact=20Mode=20patch=20by=20Stefan?= =?utf8?q?=20Br=C3=BCck?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/MainWindow.cpp | 16 ++++++++++++++++ src/MainWindow.h | 2 ++ src/MediaView.cpp | 11 ++++++----- src/MediaView.h | 1 + 4 files changed, 25 insertions(+), 5 deletions(-) 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 -- 2.39.5