]> git.sur5r.net Git - minitube/commitdiff
Better full screen impl
authorFlavio Tordini <flavio.tordini@gmail.com>
Thu, 2 Jul 2009 10:38:33 +0000 (12:38 +0200)
committerFlavio Tordini <flavio.tordini@gmail.com>
Thu, 2 Jul 2009 10:38:33 +0000 (12:38 +0200)
src/MainWindow.cpp
src/MainWindow.h
src/MediaView.cpp
src/MediaView.h

index f4fff9633e85cc710321bb5e2f97e3029d810a89..a0944b8e5514c8d58ee86833384863bf05aa4d22 100755 (executable)
@@ -200,6 +200,11 @@ void MainWindow::createActions() {
 
     // common action properties
     foreach (QAction *action, actions->values()) {
+
+        // add actions to the MainWindow so that they work
+        // when the menu is hidden
+        addAction(action);
+
         // never autorepeat.
         // unexperienced users tend to keep keys pressed for a "long" time
         action->setAutoRepeat(false);
@@ -478,21 +483,27 @@ void MainWindow::stop() {
 void MainWindow::fullscreen() {
 
     if (m_fullscreen) {
-        mediaView->exitFullscreen();
         fullscreenAct->setShortcut(QKeySequence(Qt::ALT + Qt::Key_Return));
         fullscreenAct->setText(tr("&Full Screen"));
         stopAct->setShortcut(QKeySequence(Qt::Key_Escape));
+        if (m_maximized) showMaximized();
+        else showNormal();
     } else {
-        mediaView->fullscreen();
         stopAct->setShortcut(QString(""));
         QList<QKeySequence> shortcuts;
-        // for some reason it is importante that ESC comes first
+        // for some reason it is important that ESC comes first
         shortcuts << QKeySequence(Qt::Key_Escape) << QKeySequence(Qt::ALT + Qt::Key_Return);
         fullscreenAct->setShortcuts(shortcuts);
         fullscreenAct->setText(tr("Exit &Full Screen"));
+        m_maximized = isMaximized();
+        showFullScreen();
     }
     compactViewAct->setVisible(m_fullscreen);
-
+    mediaView->setPlaylistVisible(m_fullscreen);
+    mainToolBar->setVisible(m_fullscreen);
+    statusBar()->setVisible(m_fullscreen);
+    menuBar()->setVisible(m_fullscreen);
+    menuBar()->setEnabled(true);
     m_fullscreen = !m_fullscreen;
 
 }
index 400a2a270d553951a88333d3e1805a6e06a9b611..e1a055c18a34c239a7c5db0af27447273ee79dd5 100755 (executable)
@@ -108,6 +108,7 @@ private:
     QLabel *totalTime;
 
     bool m_fullscreen;
+    bool m_maximized;
 };
 
 #endif
index e372bb21bb4ae414da2f98b4cf9b6fede5207588..1f178bd98480ad649c1913c4edd193fb6c9b9166 100644 (file)
@@ -171,20 +171,6 @@ void MediaView::pause() {
     }
 }
 
-void MediaView::fullscreen() {
-    splitterState = splitter->saveState();
-    videoAreaWidget->setParent(0);
-    videoAreaWidget->showFullScreen();
-}
-
-void MediaView::exitFullscreen() {
-    // videoAreaWidget->setParent(this);
-    splitter->addWidget(videoAreaWidget);
-    // Just calling show() on the Mac won't work
-    videoAreaWidget->showNormal();
-    splitter->restoreState(splitterState);
-}
-
 void MediaView::stop() {
     listModel->abortSearch();
     mediaObject->stop();
index 80a60c3c171ba843c43d35bc49e9b1814577a81b..0419cb8eb3abe94ba9c0f2da09a97170549908d6 100644 (file)
@@ -41,13 +41,11 @@ public slots:
     void pause();
     void stop();
     void skip();
-    void fullscreen();
-    void exitFullscreen();
     void openWebPage();
     void removeSelected();
     void moveUpSelected();
     void moveDownSelected();
-        void setPlaylistVisible(bool visible=true);
+    void setPlaylistVisible(bool visible=true);
 
 private slots:
     // list/model
@@ -73,7 +71,6 @@ private:
     SearchParams *searchParams;
 
     QSplitter *splitter;
-    QByteArray splitterState;
 
     PlaylistWidget *playlistWidget;
     QListView *listView;