From: Flavio Tordini Date: Thu, 2 Jul 2009 10:38:33 +0000 (+0200) Subject: Better full screen impl X-Git-Tag: 0.4~7 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=44748ee72d3695b352d17e52277026de221d2c0a;p=minitube Better full screen impl --- diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index f4fff96..a0944b8 100755 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -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 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; } diff --git a/src/MainWindow.h b/src/MainWindow.h index 400a2a2..e1a055c 100755 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -108,6 +108,7 @@ private: QLabel *totalTime; bool m_fullscreen; + bool m_maximized; }; #endif diff --git a/src/MediaView.cpp b/src/MediaView.cpp index e372bb2..1f178bd 100644 --- a/src/MediaView.cpp +++ b/src/MediaView.cpp @@ -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(); diff --git a/src/MediaView.h b/src/MediaView.h index 80a60c3..0419cb8 100644 --- a/src/MediaView.h +++ b/src/MediaView.h @@ -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;