From e76ca1fdef5fee31d31b2932ac217b4a799c869d Mon Sep 17 00:00:00 2001 From: Tieg Zaharia Date: Tue, 12 Apr 2011 20:25:47 -0400 Subject: [PATCH 1/3] OSX: adds 'Window' menu with 'Minimize'/'Zoom' actions --- src/tomahawkwindow.cpp | 51 +++++++++++++++++++++++++++++++++++++++++- src/tomahawkwindow.h | 5 +++++ src/tomahawkwindow.ui | 24 ++++++++++++++++++++ 3 files changed, 79 insertions(+), 1 deletion(-) diff --git a/src/tomahawkwindow.cpp b/src/tomahawkwindow.cpp index 62a442946..31499bd14 100644 --- a/src/tomahawkwindow.cpp +++ b/src/tomahawkwindow.cpp @@ -21,6 +21,8 @@ #include #include +#include +#include #include #include #include @@ -263,6 +265,13 @@ TomahawkWindow::setupSignals() connect( ui->actionCreate_New_Station, SIGNAL( triggered() ), SLOT( createStation() )); connect( ui->actionAboutTomahawk, SIGNAL( triggered() ), SLOT( showAboutTomahawk() ) ); connect( ui->actionExit, SIGNAL( triggered() ), APP, SLOT( quit() ) ); +#if defined( Q_OS_DARWIN ) + connect( ui->actionMinimize, SIGNAL( triggered() ), SLOT( minimize() ) ); + connect( ui->actionZoom, SIGNAL( triggered() ), SLOT( maximize() ) ); +#else + ui->menuWindow->clear(); + ui->menuWindow->menuAction()->setVisible( false ); +#endif // connect( APP->sipHandler(), SIGNAL( connected() ), SLOT( onSipConnected() ) ); @@ -290,7 +299,6 @@ TomahawkWindow::changeEvent( QEvent* e ) } } - void TomahawkWindow::closeEvent( QCloseEvent* e ) { @@ -306,6 +314,27 @@ TomahawkWindow::closeEvent( QCloseEvent* e ) e->accept(); } +void +TomahawkWindow::showEvent( QShowEvent* e ) +{ + QMainWindow::showEvent( e ); + +#if defined( Q_OS_DARWIN ) + ui->actionMinimize->setDisabled( false ); + ui->actionZoom->setDisabled( false ); +#endif +} + +void +TomahawkWindow::hideEvent( QHideEvent* e ) +{ + QMainWindow::hideEvent( e ); + +#if defined( Q_OS_DARWIN ) + ui->actionMinimize->setDisabled( true ); + ui->actionZoom->setDisabled( true ); +#endif +} void TomahawkWindow::showSettingsDialog() @@ -513,3 +542,23 @@ TomahawkWindow::checkForUpdates() Tomahawk::checkForUpdates(); #endif } + +void +TomahawkWindow::minimize() +{ + if (isMinimized()) { + showNormal(); + } else { + showMinimized(); + } +} + +void +TomahawkWindow::maximize() +{ + if (isMaximized()) { + showNormal(); + } else { + showMaximized(); + } +} diff --git a/src/tomahawkwindow.h b/src/tomahawkwindow.h index e8211fbb6..d09db919d 100644 --- a/src/tomahawkwindow.h +++ b/src/tomahawkwindow.h @@ -54,6 +54,8 @@ public: protected: void changeEvent( QEvent* e ); void closeEvent( QCloseEvent* e ); + void showEvent( QShowEvent* e ); + void hideEvent( QHideEvent* e ); public slots: void createAutomaticPlaylist(); @@ -79,6 +81,9 @@ private slots: void showAboutTomahawk(); void checkForUpdates(); + void minimize(); + void maximize(); + private: void loadSettings(); void saveSettings(); diff --git a/src/tomahawkwindow.ui b/src/tomahawkwindow.ui index 6b142c616..c4fee4d69 100644 --- a/src/tomahawkwindow.ui +++ b/src/tomahawkwindow.ui @@ -72,6 +72,13 @@ + + + &Window + + + + &Help @@ -82,6 +89,7 @@ + @@ -157,6 +165,22 @@ Hide Offline Sources + + + Minimize + + + Ctrl+M + + + + + Zoom + + + Meta+Ctrl+Z + + From 2d2426732ceb0399d5d6e8747275236b534441f3 Mon Sep 17 00:00:00 2001 From: Leo Franchi Date: Sat, 30 Apr 2011 09:24:51 -0400 Subject: [PATCH 2/3] fix whitespace --- src/tomahawkwindow.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/tomahawkwindow.cpp b/src/tomahawkwindow.cpp index 20c2142e4..da137c8a5 100644 --- a/src/tomahawkwindow.cpp +++ b/src/tomahawkwindow.cpp @@ -548,7 +548,8 @@ TomahawkWindow::checkForUpdates() void TomahawkWindow::minimize() { - if (isMinimized()) { + if ( isMinimized() ) + { showNormal(); } else { showMinimized(); @@ -558,7 +559,8 @@ TomahawkWindow::minimize() void TomahawkWindow::maximize() { - if (isMaximized()) { + if ( isMaximized() ) + { showNormal(); } else { showMaximized(); From 63b1f4eae7a3b79f929c2bef92424b7d18baaa0c Mon Sep 17 00:00:00 2001 From: Jeff Mitchell Date: Sat, 30 Apr 2011 11:25:28 -0400 Subject: [PATCH 3/3] Don't allow a phonon version less than 4.5.0 as it causes problems --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index e0fdfaa29..b43598761 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,6 +39,11 @@ INCLUDE( MacroLogFeature ) set(LIBLASTFM_FOUND true) find_package(Phonon REQUIRED) +if(PHONON_VERSION STRLESS "4.5.0") + message(FATAL_ERROR "Phonon version 4.5.0 or higher is required, you have version ${PHONON_VERSION}") +else() + message(STATUS "Phonon found; ensure that phonon-vlc is at least 0.4") +endif() macro_optional_find_package(LibEchonest 1.1.1) macro_log_feature(LIBECHONEST_FOUND "Echonest" "Qt library for communicating with The Echo Nest" "http://projects.kde.org/libechonest" TRUE "" "libechonest is needed for dynamic playlists and the infosystem")