]> git.sur5r.net Git - minitube/commitdiff
Fix fullscreen, fix download action
authorFlavio Tordini <flavio.tordini@gmail.com>
Wed, 2 Sep 2015 09:19:49 +0000 (11:19 +0200)
committerFlavio Tordini <flavio.tordini@gmail.com>
Wed, 2 Sep 2015 09:19:49 +0000 (11:19 +0200)
src/mainwindow.cpp
src/mainwindow.h

index 198079d598694adc5d0a033372bd2f8992f0e75f..5a50548663e3b10650315c084878b570f3b608f8 100644 (file)
@@ -96,7 +96,8 @@ MainWindow::MainWindow() :
     audioOutput(0),
     #endif
     fullscreenFlag(false),
-    m_compact(false) {
+    m_compact(false),
+    initialized(false) {
 
     singleton = this;
 
@@ -232,6 +233,8 @@ void MainWindow::lazyInit() {
     ChannelAggregator::instance()->start();
 
     checkForUpdate();
+
+    initialized = true;
 }
 
 void MainWindow::changeEvent(QEvent *e) {
@@ -496,7 +499,6 @@ void MainWindow::createActions() {
     action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_J));
     action->setCheckable(true);
     action->setIcon(IconUtils::icon("document-save"));
-    action->setVisible(false);
     connect(action, SIGNAL(toggled(bool)), SLOT(toggleDownloads(bool)));
     actions->insert("downloads", action);
 
@@ -845,7 +847,6 @@ void MainWindow::createStatusBar() {
     statusToolBar = new QToolBar(this);
     statusToolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
     statusToolBar->setIconSize(QSize(16, 16));
-    // statusToolBar->addAction(The::globalActions()->value("downloads"));
 
     regionAction = new QAction(this);
     regionAction->setStatusTip(tr("Choose your content location"));
@@ -888,8 +889,7 @@ void MainWindow::showActionInStatusBar(QAction* action, bool show) {
     } else {
         statusToolBar->removeAction(action);
         if (statusBar()->isVisible() && !needStatusBar())
-            if (fullscreenFlag && views->currentWidget() == mediaView)
-                setStatusBarVisibility(false);
+            setStatusBarVisibility(false);
     }
 }
 
@@ -931,7 +931,8 @@ void MainWindow::readSettings() {
 void MainWindow::writeSettings() {
     QSettings settings;
 
-    settings.setValue("geometry", saveGeometry());
+    if (!isReallyFullScreen())
+        settings.setValue("geometry", saveGeometry());
     mediaView->saveSplitterState();
 
 #ifdef APP_PHONON
@@ -1181,11 +1182,12 @@ void MainWindow::stop() {
     mediaView->stop();
 }
 
-void MainWindow::resizeEvent(QResizeEvent*e) {
+void MainWindow::resizeEvent(QResizeEvent *e) {
     Q_UNUSED(e);
 #ifdef APP_MAC
-    if (mac::CanGoFullScreen(winId())) {
+    if (initialized && mac::CanGoFullScreen(winId())) {
         bool isFullscreen = mac::IsFullScreen(winId());
+        qDebug() << __PRETTY_FUNCTION__ << isFullscreen << fullscreenFlag;
         if (isFullscreen != fullscreenFlag) {
             if (compactViewAct->isChecked()) {
                 compactViewAct->setChecked(false);
@@ -1212,8 +1214,6 @@ void MainWindow::fullscreen() {
     if (compactViewAct->isChecked())
         compactViewAct->toggle();
 
-    fullscreenFlag = !fullscreenFlag;
-
 #ifdef APP_MAC
     WId handle = winId();
     if (mac::CanGoFullScreen(handle)) {
@@ -1223,6 +1223,8 @@ void MainWindow::fullscreen() {
     }
 #endif
 
+    fullscreenFlag = !fullscreenFlag;
+
     if (fullscreenFlag) {
         // Enter full screen
 
index 18e734d72961d8f9feb5c17001fd32653c196874..eb1058f4874a7828603b5a928e8a6c67b2e407b4 100644 (file)
@@ -243,6 +243,7 @@ private:
     bool m_maximized;
     QTimer *mouseTimer;
     bool m_compact;
+    bool initialized;
 
     QLabel *messageLabel;
     QTimer *messageTimer;