1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-05 13:47:26 +02:00

Some qt5 fixes for Windows

This commit is contained in:
Patrick von Reth
2014-03-31 16:54:48 +02:00
parent fb02c08a55
commit 8573d8fb42
6 changed files with 29 additions and 11 deletions

View File

@@ -135,6 +135,10 @@ if( NOT BUILD_WITH_QT4 )
# We need this to find the paths to qdbusxml2cpp and co # We need this to find the paths to qdbusxml2cpp and co
find_package(Qt5DBus REQUIRED) find_package(Qt5DBus REQUIRED)
endif() endif()
if(WIN32)
find_package(Qt5WinExtras REQUIRED)
endif()
macro(qt_wrap_ui) macro(qt_wrap_ui)
qt5_wrap_ui(${ARGN}) qt5_wrap_ui(${ARGN})

View File

@@ -166,6 +166,9 @@ SET_TARGET_PROPERTIES(tomahawk_bin
qt5_use_modules(tomahawk_bin Core Widgets Network Sql WebKitWidgets) 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}" ) MESSAGE( STATUS "OS_SPECIFIC_LINK_LIBRARIES: ${OS_SPECIFIC_LINK_LIBRARIES}" )

View File

@@ -7,9 +7,6 @@ ADD_DEFINITIONS( -DUNICODE )
SET( OS_SPECIFIC_LINK_LIBRARIES SET( OS_SPECIFIC_LINK_LIBRARIES
${OS_SPECIFIC_LINK_LIBRARIES} ${OS_SPECIFIC_LINK_LIBRARIES}
${QTSPARKLE_LIBRARIES}
# third party shipped with tomahawk # third party shipped with tomahawk
# system libs # system libs
@@ -22,3 +19,11 @@ SET( OS_SPECIFIC_LINK_LIBRARIES
"winmm.dll" "winmm.dll"
"advapi32.dll" "advapi32.dll"
) )
if(QTSPARKLE_FOUND)
SET( OS_SPECIFIC_LINK_LIBRARIES
${OS_SPECIFIC_LINK_LIBRARIES}
${QTSPARKLE_LIBRARIES}
)
endif()

View File

@@ -15,7 +15,7 @@
#cmakedefine WITH_BREAKPAD #cmakedefine WITH_BREAKPAD
#cmakedefine WITH_CRASHREPORTER #cmakedefine WITH_CRASHREPORTER
#cmakedefine WITH_BINARY_ATTICA #cmakedefine WITH_BINARY_ATTICA
#cmakedefine WITH_QtSparkle #cmakedefine QTSPARKLE_FOUND
#cmakedefine WITH_UPOWER #cmakedefine WITH_UPOWER
#cmakedefine WITH_GNOMESHORTCUTHANDLER #cmakedefine WITH_GNOMESHORTCUTHANDLER

View File

@@ -83,10 +83,12 @@
#include "config.h" #include "config.h"
#if defined( Q_OS_WIN ) #if defined( Q_OS_WIN )
#if defined ( WITH_QtSparkle ) #if defined ( QTSPARKLE_FOUND )
#include <qtsparkle/Updater> #include <qtsparkle/Updater>
#endif #endif
#if QT_VERSION >= QT_VERSION_CHECK(5,2,0)
#include <QtWin>
#endif
#include <windows.h> #include <windows.h>
#include <shellapi.h> #include <shellapi.h>
@@ -484,7 +486,7 @@ TomahawkWindow::setupUpdateCheck()
#if defined( Q_OS_MAC ) && defined( HAVE_SPARKLE ) #if defined( Q_OS_MAC ) && defined( HAVE_SPARKLE )
connect( ActionCollection::instance()->getAction( "checkForUpdates" ), SIGNAL( triggered( bool ) ), connect( ActionCollection::instance()->getAction( "checkForUpdates" ), SIGNAL( triggered( bool ) ),
SLOT( checkForUpdates() ) ); SLOT( checkForUpdates() ) );
#elif defined( Q_OS_WIN ) && defined( WITH_QtSparkle ) #elif defined( Q_OS_WIN ) && defined( QTSPARKLE_FOUND )
QUrl updaterUrl; QUrl updaterUrl;
if ( qApp->arguments().contains( "--debug" ) ) if ( qApp->arguments().contains( "--debug" ) )
@@ -546,7 +548,7 @@ TomahawkWindow::setupWindowsButtons()
hr = m_taskbarList->HrInit(); hr = m_taskbarList->HrInit();
if ( SUCCEEDED( hr ) ) 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 else
{ {
@@ -566,7 +568,11 @@ TomahawkWindow::thumbIcon( TomahawkUtils::ImageType type )
if ( !thumbIcons.contains( type ) ) if ( !thumbIcons.contains( type ) )
{ {
QPixmap pix ( TomahawkUtils::defaultPixmap(type , TomahawkUtils::Original, QSize( 20, 20 ) ) ); 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(); thumbIcons[type] = pix.toWinHICON();
#endif
} }
return thumbIcons[type]; return thumbIcons[type];
} }
@@ -820,7 +826,7 @@ TomahawkWindow::audioStateChanged( AudioState newState, AudioState oldState )
return; 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_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 #endif // Q_OS_WIN

View File

@@ -77,7 +77,7 @@ LRESULT QT_WIN_CALLBACK qt_LowLevelKeyboardHookProc( int nCode, WPARAM wParam, L
if ( QApplication::activeWindow() == widget ) if ( QApplication::activeWindow() == widget )
continue; continue;
hWnd = widget->winId(); hWnd = (HWND)widget->winId();
// generate message and post it to the message queue // generate message and post it to the message queue
LPKBDLLHOOKSTRUCT pKeyboardHookStruct = reinterpret_cast<LPKBDLLHOOKSTRUCT>(lParam); LPKBDLLHOOKSTRUCT pKeyboardHookStruct = reinterpret_cast<LPKBDLLHOOKSTRUCT>(lParam);