mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-24 01:39:42 +01:00
update windows love button if the track is loved inside of tomahawk
This commit is contained in:
parent
9c0a3496a4
commit
6626c7f877
@ -600,20 +600,7 @@ TomahawkWindow::winEvent( MSG* msg, long* result )
|
||||
if ( !AudioEngine::instance()->currentTrack().isNull() )
|
||||
{
|
||||
AudioEngine::instance()->currentTrack()->toQuery()->setLoved( !AudioEngine::instance()->currentTrack()->toQuery()->loved() );
|
||||
if ( AudioEngine::instance()->currentTrack()->toQuery()->loved())
|
||||
{
|
||||
QPixmap loved( RESPATH "images/loved.png" );
|
||||
m_thumbButtons[TP_LOVE].hIcon = loved.toWinHICON();
|
||||
m_thumbButtons[TP_LOVE].szTip[ tr( "Unlove" ).toWCharArray( m_thumbButtons[TP_LOVE].szTip ) ] = 0;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
QPixmap not_loved( RESPATH "images/not-loved.png" );
|
||||
m_thumbButtons[TP_LOVE].hIcon = not_loved.toWinHICON();
|
||||
m_thumbButtons[TP_LOVE].szTip[ tr( "Love" ).toWCharArray( m_thumbButtons[TP_LOVE].szTip ) ] = 0;
|
||||
}
|
||||
m_taskbarList->ThumbBarUpdateButtons( winId(), ARRAYSIZE( m_thumbButtons ), m_thumbButtons );
|
||||
updateWindowsLoveButton();
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -639,23 +626,15 @@ TomahawkWindow::audioStateChanged( AudioState newState, AudioState oldState )
|
||||
{
|
||||
case AudioEngine::Playing:
|
||||
{
|
||||
if ( !AudioEngine::instance()->currentTrack().isNull() )
|
||||
{
|
||||
connect(AudioEngine::instance()->currentTrack()->toQuery().data(),SIGNAL(socialActionsLoaded()),this,SLOT(updateWindowsLoveButton()));
|
||||
}
|
||||
QPixmap pause( RESPATH "images/pause-rest.png" );
|
||||
m_thumbButtons[TP_PLAY_PAUSE].hIcon = pause.toWinHICON();
|
||||
m_thumbButtons[TP_PLAY_PAUSE].szTip[ tr( "Pause" ).toWCharArray( m_thumbButtons[TP_PLAY_PAUSE].szTip ) ] = 0;
|
||||
updateWindowsLoveButton();
|
||||
|
||||
if ( !AudioEngine::instance()->currentTrack().isNull() && AudioEngine::instance()->currentTrack()->toQuery()->loved() )
|
||||
{
|
||||
QPixmap loved( RESPATH "images/loved.png" );
|
||||
m_thumbButtons[TP_LOVE].hIcon = loved.toWinHICON();
|
||||
m_thumbButtons[TP_LOVE].szTip[ tr( "Unlove" ).toWCharArray( m_thumbButtons[TP_LOVE].szTip ) ] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
QPixmap not_loved( RESPATH "images/not-loved.png" );
|
||||
m_thumbButtons[TP_LOVE].hIcon = not_loved.toWinHICON();
|
||||
m_thumbButtons[TP_LOVE].szTip[ tr( "Love" ).toWCharArray( m_thumbButtons[TP_LOVE].szTip ) ] = 0;
|
||||
}
|
||||
m_thumbButtons[TP_LOVE].dwFlags = THBF_ENABLED;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -669,6 +648,10 @@ TomahawkWindow::audioStateChanged( AudioState newState, AudioState oldState )
|
||||
|
||||
case AudioEngine::Stopped:
|
||||
{
|
||||
if ( !AudioEngine::instance()->currentTrack().isNull() )
|
||||
{
|
||||
disconnect(AudioEngine::instance()->currentTrack()->toQuery().data(),SIGNAL(socialActionsLoaded()),this,SLOT(updateWindowsLoveButton()));
|
||||
}
|
||||
QPixmap play( RESPATH "images/play-rest.png" );
|
||||
m_thumbButtons[TP_PLAY_PAUSE].hIcon = play.toWinHICON();
|
||||
m_thumbButtons[TP_PLAY_PAUSE].szTip[ tr( "Play" ).toWCharArray( m_thumbButtons[TP_PLAY_PAUSE].szTip ) ] = 0;
|
||||
@ -685,6 +668,26 @@ TomahawkWindow::audioStateChanged( AudioState newState, AudioState oldState )
|
||||
|
||||
m_taskbarList->ThumbBarUpdateButtons( winId(), ARRAYSIZE( m_thumbButtons ), m_thumbButtons );
|
||||
}
|
||||
|
||||
void
|
||||
TomahawkWindow::updateWindowsLoveButton()
|
||||
{
|
||||
if ( !AudioEngine::instance()->currentTrack().isNull() && AudioEngine::instance()->currentTrack()->toQuery()->loved() )
|
||||
{
|
||||
QPixmap loved( RESPATH "images/loved.png" );
|
||||
m_thumbButtons[TP_LOVE].hIcon = loved.toWinHICON();
|
||||
m_thumbButtons[TP_LOVE].szTip[ tr( "Unlove" ).toWCharArray( m_thumbButtons[TP_LOVE].szTip ) ] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
QPixmap not_loved( RESPATH "images/not-loved.png" );
|
||||
m_thumbButtons[TP_LOVE].hIcon = not_loved.toWinHICON();
|
||||
m_thumbButtons[TP_LOVE].szTip[ tr( "Love" ).toWCharArray( m_thumbButtons[TP_LOVE].szTip ) ] = 0;
|
||||
}
|
||||
m_thumbButtons[TP_LOVE].dwFlags = THBF_ENABLED;
|
||||
m_taskbarList->ThumbBarUpdateButtons( winId(), ARRAYSIZE( m_thumbButtons ), m_thumbButtons );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -144,6 +144,7 @@ private slots:
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
void audioStateChanged( AudioState newState, AudioState oldState );
|
||||
void updateWindowsLoveButton();
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
Loading…
x
Reference in New Issue
Block a user