diff --git a/CMakeLists.txt b/CMakeLists.txt index 941ff39a0..16daac05f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -135,6 +135,10 @@ if( NOT BUILD_WITH_QT4 ) # We need this to find the paths to qdbusxml2cpp and co find_package(Qt5DBus REQUIRED) endif() + + if(WIN32) + find_package(Qt5WinExtras REQUIRED) + endif() macro(qt_wrap_ui) qt5_wrap_ui(${ARGN}) diff --git a/src/libtomahawk/utils/TomahawkUtilsGui.cpp b/src/libtomahawk/utils/TomahawkUtilsGui.cpp index 747c2515c..cc6183ce6 100644 --- a/src/libtomahawk/utils/TomahawkUtilsGui.cpp +++ b/src/libtomahawk/utils/TomahawkUtilsGui.cpp @@ -300,8 +300,8 @@ bringToFront() int idActive = GetWindowThreadProcessId(hwndActiveWin, NULL); if ( AttachThreadInput(GetCurrentThreadId(), idActive, TRUE) ) { - SetForegroundWindow( wid ); - SetFocus( wid ); + SetForegroundWindow( (HWND)wid ); + SetFocus( (HWND)wid ); AttachThreadInput(GetCurrentThreadId(), idActive, FALSE); } } diff --git a/src/tomahawk/CMakeLists.txt b/src/tomahawk/CMakeLists.txt index 5d28fa846..281fe9344 100644 --- a/src/tomahawk/CMakeLists.txt +++ b/src/tomahawk/CMakeLists.txt @@ -166,6 +166,9 @@ SET_TARGET_PROPERTIES(tomahawk_bin qt5_use_modules(tomahawk_bin Core Widgets Network Sql WebKitWidgets) +if(WIN32) + qt5_use_modules(tomahawk_bin WinExtras) +endif() MESSAGE( STATUS "OS_SPECIFIC_LINK_LIBRARIES: ${OS_SPECIFIC_LINK_LIBRARIES}" ) diff --git a/src/tomahawk/CMakeLists.win32.cmake b/src/tomahawk/CMakeLists.win32.cmake index 3567b5e90..795bcbade 100644 --- a/src/tomahawk/CMakeLists.win32.cmake +++ b/src/tomahawk/CMakeLists.win32.cmake @@ -7,9 +7,6 @@ ADD_DEFINITIONS( -DUNICODE ) SET( OS_SPECIFIC_LINK_LIBRARIES ${OS_SPECIFIC_LINK_LIBRARIES} - - ${QTSPARKLE_LIBRARIES} - # third party shipped with tomahawk # system libs @@ -22,3 +19,7 @@ SET( OS_SPECIFIC_LINK_LIBRARIES "winmm.dll" "advapi32.dll" ) + +if(QTSPARKLE_FOUND) + list(APPEND OS_SPECIFIC_LINK_LIBRARIES ${QTSPARKLE_LIBRARIES}) +endif() diff --git a/src/tomahawk/Config.h.in b/src/tomahawk/Config.h.in index 18bf256b3..34453ff8c 100644 --- a/src/tomahawk/Config.h.in +++ b/src/tomahawk/Config.h.in @@ -15,7 +15,7 @@ #cmakedefine WITH_BREAKPAD #cmakedefine WITH_CRASHREPORTER #cmakedefine WITH_BINARY_ATTICA -#cmakedefine WITH_QtSparkle +#cmakedefine WITH_QTSPARKLE #cmakedefine WITH_UPOWER #cmakedefine WITH_GNOMESHORTCUTHANDLER diff --git a/src/tomahawk/TomahawkWindow.cpp b/src/tomahawk/TomahawkWindow.cpp index e061354a1..32007fa39 100644 --- a/src/tomahawk/TomahawkWindow.cpp +++ b/src/tomahawk/TomahawkWindow.cpp @@ -83,10 +83,12 @@ #include "config.h" #if defined( Q_OS_WIN ) - #if defined ( WITH_QtSparkle ) + #if defined ( WITH_QTSPARKLE ) #include #endif - + #if QT_VERSION >= QT_VERSION_CHECK(5,2,0) + #include + #endif #include #include @@ -484,7 +486,7 @@ TomahawkWindow::setupUpdateCheck() #if defined( Q_OS_MAC ) && defined( HAVE_SPARKLE ) connect( ActionCollection::instance()->getAction( "checkForUpdates" ), SIGNAL( triggered( bool ) ), SLOT( checkForUpdates() ) ); - #elif defined( Q_OS_WIN ) && defined( WITH_QtSparkle ) + #elif defined( Q_OS_WIN ) && defined( WITH_QTSPARKLE ) QUrl updaterUrl; if ( qApp->arguments().contains( "--debug" ) ) @@ -546,7 +548,7 @@ TomahawkWindow::setupWindowsButtons() hr = m_taskbarList->HrInit(); if ( SUCCEEDED( hr ) ) { - hr = m_taskbarList->ThumbBarAddButtons( winId(), ARRAYSIZE( m_thumbButtons ), m_thumbButtons ); + hr = m_taskbarList->ThumbBarAddButtons( (HWND)winId(), ARRAYSIZE( m_thumbButtons ), m_thumbButtons ); } else { @@ -566,7 +568,11 @@ TomahawkWindow::thumbIcon( TomahawkUtils::ImageType type ) if ( !thumbIcons.contains( type ) ) { QPixmap pix ( TomahawkUtils::defaultPixmap(type , TomahawkUtils::Original, QSize( 20, 20 ) ) ); +#if QT_VERSION >= QT_VERSION_CHECK(5,2,0) + thumbIcons[type] = QtWin::toHICON(pix); +#else thumbIcons[type] = pix.toWinHICON(); +#endif } return thumbIcons[type]; } @@ -820,7 +826,7 @@ TomahawkWindow::audioStateChanged( AudioState newState, AudioState oldState ) return; } - m_taskbarList->ThumbBarUpdateButtons( winId(), ARRAYSIZE( m_thumbButtons ), m_thumbButtons ); + m_taskbarList->ThumbBarUpdateButtons( (HWND)winId(), ARRAYSIZE( m_thumbButtons ), m_thumbButtons ); } @@ -841,7 +847,7 @@ TomahawkWindow::updateWindowsLoveButton() } m_thumbButtons[TP_LOVE].dwFlags = THBF_ENABLED; - m_taskbarList->ThumbBarUpdateButtons( winId(), ARRAYSIZE( m_thumbButtons ), m_thumbButtons ); + m_taskbarList->ThumbBarUpdateButtons( (HWND)winId(), ARRAYSIZE( m_thumbButtons ), m_thumbButtons ); } #endif // Q_OS_WIN diff --git a/src/tomahawk/main.cpp b/src/tomahawk/main.cpp index 41e35e08f..88fab099b 100644 --- a/src/tomahawk/main.cpp +++ b/src/tomahawk/main.cpp @@ -77,7 +77,7 @@ LRESULT QT_WIN_CALLBACK qt_LowLevelKeyboardHookProc( int nCode, WPARAM wParam, L if ( QApplication::activeWindow() == widget ) continue; - hWnd = widget->winId(); + hWnd = (HWND)widget->winId(); // generate message and post it to the message queue LPKBDLLHOOKSTRUCT pKeyboardHookStruct = reinterpret_cast(lParam);