mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-04-22 00:42:04 +02:00
Make thumbbuttons optional
Thumbbuttons are a feature that is not supported by older MINGW libraries. So check if the feature is available before using it.
This commit is contained in:
parent
d89ebffc05
commit
42b1f8f6ee
@ -7,6 +7,16 @@ ADD_DEFINITIONS( -DUNICODE )
|
||||
|
||||
SET( QXTWEB_LIBRARIES qxtweb-standalone )
|
||||
|
||||
# Check for the availability of the Thumbbutton
|
||||
|
||||
check_cxx_source_compiles( "
|
||||
#include <shobjidl.h>
|
||||
int main() {
|
||||
THUMBBUTTON foo;
|
||||
return 0;
|
||||
}
|
||||
"
|
||||
HAVE_THUMBBUTTON )
|
||||
|
||||
SET( OS_SPECIFIC_LINK_LIBRARIES
|
||||
${OS_SPECIFIC_LINK_LIBRARIES}
|
||||
|
@ -16,6 +16,7 @@
|
||||
#cmakedefine SNOW_LEOPARD
|
||||
#cmakedefine LEOPARD
|
||||
#cmakedefine HAVE_SPARKLE
|
||||
#cmakedefine HAVE_THUMBBUTTON
|
||||
|
||||
#cmakedefine WITH_BREAKPAD
|
||||
#cmakedefine WITH_CRASHREPORTER
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user