diff --git a/src/CMakeLists.win32.cmake b/src/CMakeLists.win32.cmake index 6455ae8bc..eac4a788c 100644 --- a/src/CMakeLists.win32.cmake +++ b/src/CMakeLists.win32.cmake @@ -7,6 +7,16 @@ ADD_DEFINITIONS( -DUNICODE ) SET( QXTWEB_LIBRARIES qxtweb-standalone ) +# Check for the availability of the Thumbbutton + +check_cxx_source_compiles( " + #include + int main() { + THUMBBUTTON foo; + return 0; + } + " + HAVE_THUMBBUTTON ) SET( OS_SPECIFIC_LINK_LIBRARIES ${OS_SPECIFIC_LINK_LIBRARIES} diff --git a/src/Config.h.in b/src/Config.h.in index 1aa764c96..1b1eb4af3 100644 --- a/src/Config.h.in +++ b/src/Config.h.in @@ -16,6 +16,7 @@ #cmakedefine SNOW_LEOPARD #cmakedefine LEOPARD #cmakedefine HAVE_SPARKLE +#cmakedefine HAVE_THUMBBUTTON #cmakedefine WITH_BREAKPAD #cmakedefine WITH_CRASHREPORTER diff --git a/src/TomahawkWindow.cpp b/src/TomahawkWindow.cpp index 8a6de5d8c..22dcdd22a 100644 --- a/src/TomahawkWindow.cpp +++ b/src/TomahawkWindow.cpp @@ -92,7 +92,9 @@ TomahawkWindow::TomahawkWindow( QWidget* parent ) : QMainWindow( parent ) #ifdef Q_OS_WIN , m_buttonCreatedID( RegisterWindowMessage( L"TaskbarButtonCreated" ) ) +# ifdef HAVE_THUMBBUTTON , m_taskbarList(0) +# endif #endif , ui( new Ui::TomahawkWindow ) , m_searchWidget( 0 ) @@ -426,6 +428,7 @@ TomahawkWindow::setupUpdateCheck() bool TomahawkWindow::setupWindowsButtons() { +#ifdef HAVE_THUMBBUTTON const GUID IID_ITaskbarList3 = { 0xea1afb91,0x9e28,0x4b86, { 0x90,0xe9,0x9e,0x9f,0x8a,0x5e,0xef,0xaf } }; HRESULT hr = S_OK; @@ -483,6 +486,9 @@ TomahawkWindow::setupWindowsButtons() } return SUCCEEDED( hr ); +#else // HAVE_THUMBBUTTON + return false; +#endif } #endif @@ -714,6 +720,7 @@ TomahawkWindow::winEvent( MSG* msg, long* result ) void TomahawkWindow::audioStateChanged( AudioState newState, AudioState oldState ) { +#ifdef HAVE_THUMBBUTTON if ( m_taskbarList == 0 ) return; @@ -758,11 +765,13 @@ TomahawkWindow::audioStateChanged( AudioState newState, AudioState oldState ) } m_taskbarList->ThumbBarUpdateButtons( winId(), ARRAYSIZE( m_thumbButtons ), m_thumbButtons ); +#endif // HAVE_THUMBBUTTON } void TomahawkWindow::updateWindowsLoveButton() { +#ifdef HAVE_THUMBBUTTON if ( !AudioEngine::instance()->currentTrack().isNull() && AudioEngine::instance()->currentTrack()->toQuery()->loved() ) { QPixmap loved( RESPATH "images/loved.png" ); @@ -777,6 +786,7 @@ TomahawkWindow::updateWindowsLoveButton() } m_thumbButtons[TP_LOVE].dwFlags = THBF_ENABLED; m_taskbarList->ThumbBarUpdateButtons( winId(), ARRAYSIZE( m_thumbButtons ), m_thumbButtons ); +#endif // HAVE_THUMBBUTTON } #endif diff --git a/src/TomahawkWindow.h b/src/TomahawkWindow.h index 28adc20cf..0b0f130c7 100644 --- a/src/TomahawkWindow.h +++ b/src/TomahawkWindow.h @@ -167,8 +167,10 @@ private: #ifdef Q_OS_WIN bool setupWindowsButtons(); const unsigned int m_buttonCreatedID; +# ifdef HAVE_THUMBBUTTON ITaskbarList3 *m_taskbarList; THUMBBUTTON m_thumbButtons[5]; +# endif enum TB_STATES{ TP_PREVIOUS = 0,TP_PLAY_PAUSE = 1,TP_NEXT = 2,TP_LOVE = 4 }; #endif