From: Flavio Date: Sat, 27 Apr 2013 13:25:18 +0000 (+0200) Subject: Better compact mode X-Git-Tag: 1.2.1~2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=296645b1b046bde76e7edfc4b042759f0ca2f4ed;p=minitube Better compact mode --- diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index bb815c0..e65b6b0 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -60,7 +60,8 @@ MainWindow::MainWindow() : regionsView(0), mediaObject(0), audioOutput(0), - m_fullscreen(false) { + m_fullscreen(false), + m_compact(false) { singleton = this; @@ -1139,7 +1140,18 @@ void MainWindow::updateUIForFullscreen() { } } +bool MainWindow::isReallyFullScreen() { +#ifdef Q_WS_MAC + WId handle = winId(); + if (mac::CanGoFullScreen(handle)) return mac::IsFullScreen(handle); + else return isFullScreen(); +#else + return isFullScreen(); +#endif +} + void MainWindow::compactView(bool enable) { + m_compact = enable; static QList compactShortcuts; static QList stopShortcuts; @@ -1152,7 +1164,7 @@ void MainWindow::compactView(bool enable) { #endif if (enable) { - setMinimumSize(160, 120); + setMinimumSize(320, 180); #ifdef Q_WS_MAC mac::RemoveFullScreenWindow(winId()); #endif @@ -1161,7 +1173,7 @@ void MainWindow::compactView(bool enable) { if (settings.contains(key)) restoreGeometry(settings.value(key).toByteArray()); else - resize(320, 240); + resize(320, 180); mainToolBar->setVisible(!enable); mediaView->setPlaylistVisible(!enable); @@ -1197,6 +1209,10 @@ void MainWindow::compactView(bool enable) { // auto float on top floatOnTop(enable); + +#ifdef Q_WS_MAC + mac::compactMode(winId(), enable); +#endif } void MainWindow::searchFocus() { diff --git a/src/mainwindow.h b/src/mainwindow.h index 1602748..7cfe7ad 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -49,6 +49,8 @@ public slots: void buy(); void hideBuyAction(); #endif + bool isReallyFullScreen(); + bool isCompact() { return m_compact; } protected: void changeEvent(QEvent *); @@ -179,6 +181,8 @@ private: bool m_fullscreen; bool m_maximized; QTimer *mouseTimer; + bool m_compact; + }; #endif