]> git.sur5r.net Git - minitube/commitdiff
Applied Compact Mode patch by Stefan Brück
authorFlavio Tordini <flavio.tordini@gmail.com>
Tue, 30 Jun 2009 15:54:28 +0000 (17:54 +0200)
committerFlavio Tordini <flavio.tordini@gmail.com>
Tue, 30 Jun 2009 15:54:28 +0000 (17:54 +0200)
src/MainWindow.cpp
src/MainWindow.h
src/MediaView.cpp
src/MediaView.h

index 17c6c8fedafaef915672212747b25303db2fe72d..88c24f03255c4c225214bab332a5210c37a666fc 100755 (executable)
@@ -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) {
index 99d7abb9c0326fbe85cfe1896b49ea3a6b706a87..400a2a270d553951a88333d3e1805a6e06a9b611 100755 (executable)
@@ -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;
 
index 64c85e2707ca30e629c280266b6a0588a255d5b6..d44bc675080cd213f599ba4a5e5dd95493dcae12 100644 (file)
@@ -74,10 +74,6 @@ MediaView::MediaView(QWidget *parent) : QWidget(parent) {
 
     splitter->addWidget(videoAreaWidget);
 
-    QList<int> 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);
+}
+
index 37433ca019ac70e2c1fb1d8d561623af10bd1c60..705d60c1049fa59486b6b2aba93c6ac08744d1b0 100644 (file)
@@ -47,6 +47,7 @@ public slots:
     void removeSelected();
     void moveUpSelected();
     void moveDownSelected();
+        void setPlaylistVisible(bool visible=true);
 
 private slots:
     // list/model