mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-11 16:44:05 +02:00
* Fixed systray menu not working.
This commit is contained in:
@@ -49,7 +49,8 @@ TomahawkTrayIcon::TomahawkTrayIcon( QObject* parent )
|
|||||||
m_contextMenu = new QMenu();
|
m_contextMenu = new QMenu();
|
||||||
setContextMenu( m_contextMenu );
|
setContextMenu( m_contextMenu );
|
||||||
|
|
||||||
m_stopContinueAfterTrackAction = new QAction( tr( "&Stop Playback after current Track" ), this );
|
m_stopContinueAfterTrackAction = new QAction( this );
|
||||||
|
onStopContinueAfterTrackChanged();
|
||||||
|
|
||||||
ActionCollection *ac = ActionCollection::instance();
|
ActionCollection *ac = ActionCollection::instance();
|
||||||
m_contextMenu->addAction( ac->getAction( "playPause" ) );
|
m_contextMenu->addAction( ac->getAction( "playPause" ) );
|
||||||
@@ -61,7 +62,7 @@ TomahawkTrayIcon::TomahawkTrayIcon( QObject* parent )
|
|||||||
m_contextMenu->addSeparator();
|
m_contextMenu->addSeparator();
|
||||||
m_contextMenu->addAction( ActionCollection::instance()->getAction( "togglePrivacy" ) );
|
m_contextMenu->addAction( ActionCollection::instance()->getAction( "togglePrivacy" ) );
|
||||||
|
|
||||||
connect( m_stopContinueAfterTrackAction, SIGNAL( triggered(bool) ), this, SLOT( stopContinueAfterTrackActionTriggered() ) );
|
connect( m_stopContinueAfterTrackAction, SIGNAL( triggered() ), SLOT( stopContinueAfterTrackActionTriggered() ) );
|
||||||
|
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_WS_MAC
|
||||||
// On mac you can close the windows while leaving the app open. We then need a way to show the main window again
|
// On mac you can close the windows while leaving the app open. We then need a way to show the main window again
|
||||||
@@ -78,10 +79,10 @@ TomahawkTrayIcon::TomahawkTrayIcon( QObject* parent )
|
|||||||
|
|
||||||
connect( AudioEngine::instance(), SIGNAL( loading( Tomahawk::result_ptr ) ), SLOT( setResult( Tomahawk::result_ptr ) ) );
|
connect( AudioEngine::instance(), SIGNAL( loading( Tomahawk::result_ptr ) ), SLOT( setResult( Tomahawk::result_ptr ) ) );
|
||||||
connect( AudioEngine::instance(), SIGNAL( started( Tomahawk::result_ptr ) ), SLOT( onPlay() ) );
|
connect( AudioEngine::instance(), SIGNAL( started( Tomahawk::result_ptr ) ), SLOT( onPlay() ) );
|
||||||
connect( AudioEngine::instance(), SIGNAL( resumed() ), this, SLOT( onResume() ) );
|
connect( AudioEngine::instance(), SIGNAL( resumed() ), SLOT( onResume() ) );
|
||||||
connect( AudioEngine::instance(), SIGNAL( stopped() ), this, SLOT( onStop() ) );
|
connect( AudioEngine::instance(), SIGNAL( stopped() ), SLOT( onStop() ) );
|
||||||
connect( AudioEngine::instance(), SIGNAL( paused() ), this, SLOT( onPause() ) );
|
connect( AudioEngine::instance(), SIGNAL( paused() ), SLOT( onPause() ) );
|
||||||
connect( AudioEngine::instance(), SIGNAL( stopAfterTrack_changed() ) , this, SLOT( stopContinueAfterTrack_StatusChanged() ) );
|
connect( AudioEngine::instance(), SIGNAL( stopAfterTrackChanged() ), SLOT( onStopContinueAfterTrackChanged() ) );
|
||||||
|
|
||||||
connect( &m_animationTimer, SIGNAL( timeout() ), SLOT( onAnimationTimer() ) );
|
connect( &m_animationTimer, SIGNAL( timeout() ), SLOT( onAnimationTimer() ) );
|
||||||
connect( this, SIGNAL( activated( QSystemTrayIcon::ActivationReason ) ), SLOT( onActivated( QSystemTrayIcon::ActivationReason ) ) );
|
connect( this, SIGNAL( activated( QSystemTrayIcon::ActivationReason ) ), SLOT( onActivated( QSystemTrayIcon::ActivationReason ) ) );
|
||||||
@@ -236,7 +237,7 @@ TomahawkTrayIcon::onPlay()
|
|||||||
{
|
{
|
||||||
m_stopContinueAfterTrackAction->setEnabled( true );
|
m_stopContinueAfterTrackAction->setEnabled( true );
|
||||||
onResume();
|
onResume();
|
||||||
stopContinueAfterTrack_StatusChanged();
|
onStopContinueAfterTrackChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -256,7 +257,7 @@ TomahawkTrayIcon::onResume()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TomahawkTrayIcon::stopContinueAfterTrack_StatusChanged()
|
TomahawkTrayIcon::onStopContinueAfterTrackChanged()
|
||||||
{
|
{
|
||||||
if ( !AudioEngine::instance()->currentTrack().isNull() )
|
if ( !AudioEngine::instance()->currentTrack().isNull() )
|
||||||
{
|
{
|
||||||
|
@@ -49,8 +49,7 @@ private slots:
|
|||||||
void onStop();
|
void onStop();
|
||||||
void onResume();
|
void onResume();
|
||||||
|
|
||||||
void stopContinueAfterTrack_StatusChanged();
|
void onStopContinueAfterTrackChanged();
|
||||||
|
|
||||||
void stopContinueAfterTrackActionTriggered();
|
void stopContinueAfterTrackActionTriggered();
|
||||||
|
|
||||||
void menuAboutToShow();
|
void menuAboutToShow();
|
||||||
|
@@ -32,7 +32,7 @@ ActionCollection* ActionCollection::instance()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ActionCollection::ActionCollection( QObject *parent )
|
ActionCollection::ActionCollection( QObject* parent )
|
||||||
: QObject( parent )
|
: QObject( parent )
|
||||||
{
|
{
|
||||||
s_instance = this;
|
s_instance = this;
|
||||||
@@ -79,11 +79,11 @@ ActionCollection::initActions()
|
|||||||
m_actionCollection[ "quit" ] = new QAction( tr( "&Quit" ), this );
|
m_actionCollection[ "quit" ] = new QAction( tr( "&Quit" ), this );
|
||||||
|
|
||||||
// connect actions to AudioEngine
|
// connect actions to AudioEngine
|
||||||
// AudioEngine *ae = AudioEngine::instance();
|
AudioEngine *ae = AudioEngine::instance();
|
||||||
// connect( m_actionCollection[ "playPause" ], SIGNAL( triggered() ), ae, SLOT( playPause() ), Qt::UniqueConnection );
|
connect( m_actionCollection[ "playPause" ], SIGNAL( triggered() ), ae, SLOT( playPause() ), Qt::UniqueConnection );
|
||||||
// connect( m_actionCollection[ "stop" ], SIGNAL( triggered() ), ae, SLOT( stop() ), Qt::UniqueConnection );
|
connect( m_actionCollection[ "stop" ], SIGNAL( triggered() ), ae, SLOT( stop() ), Qt::UniqueConnection );
|
||||||
// connect( m_actionCollection[ "previousTrack" ], SIGNAL( triggered() ), ae, SLOT( previous() ), Qt::UniqueConnection );
|
connect( m_actionCollection[ "previousTrack" ], SIGNAL( triggered() ), ae, SLOT( previous() ), Qt::UniqueConnection );
|
||||||
// connect( m_actionCollection[ "nextTrack" ], SIGNAL( triggered() ), ae, SLOT( next() ), Qt::UniqueConnection );
|
connect( m_actionCollection[ "nextTrack" ], SIGNAL( triggered() ), ae, SLOT( next() ), Qt::UniqueConnection );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -38,7 +38,7 @@ public:
|
|||||||
|
|
||||||
static ActionCollection* instance();
|
static ActionCollection* instance();
|
||||||
|
|
||||||
ActionCollection( QObject *parent);
|
ActionCollection( QObject *parent );
|
||||||
~ActionCollection();
|
~ActionCollection();
|
||||||
|
|
||||||
void initActions();
|
void initActions();
|
||||||
|
@@ -783,7 +783,7 @@ AudioEngine::setStopAfterTrack( const query_ptr& query )
|
|||||||
if ( m_stopAfterTrack != query )
|
if ( m_stopAfterTrack != query )
|
||||||
{
|
{
|
||||||
m_stopAfterTrack = query;
|
m_stopAfterTrack = query;
|
||||||
emit stopAfterTrack_changed();
|
emit stopAfterTrackChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -109,7 +109,7 @@ signals:
|
|||||||
void paused();
|
void paused();
|
||||||
void resumed();
|
void resumed();
|
||||||
|
|
||||||
void stopAfterTrack_changed();
|
void stopAfterTrackChanged();
|
||||||
|
|
||||||
void seeked( qint64 ms );
|
void seeked( qint64 ms );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user