mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-10-06 18:41:41 +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:
committed by
Dominik Schmidt
parent
d89ebffc05
commit
42b1f8f6ee
@@ -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
|
||||
|
Reference in New Issue
Block a user