From 419a0c806f0e5ca88be663c663b333b40b6a5cb4 Mon Sep 17 00:00:00 2001 From: Leo Franchi Date: Sat, 11 Jun 2011 13:10:16 -0400 Subject: [PATCH] Add Play/Next/Prev to menu and make space a global shortcut --- src/tomahawkwindow.cpp | 23 +++++++++++++++++++++++ src/tomahawkwindow.h | 4 +++- src/tomahawkwindow.ui | 24 +++++++++++++++++++++++- 3 files changed, 49 insertions(+), 2 deletions(-) diff --git a/src/tomahawkwindow.cpp b/src/tomahawkwindow.cpp index ea513d8b8..8137bf2ef 100644 --- a/src/tomahawkwindow.cpp +++ b/src/tomahawkwindow.cpp @@ -293,6 +293,16 @@ TomahawkWindow::setupSignals() connect( ui->actionCreate_New_Station, SIGNAL( triggered() ), SLOT( createStation() )); connect( ui->actionAboutTomahawk, SIGNAL( triggered() ), SLOT( showAboutTomahawk() ) ); connect( ui->actionExit, SIGNAL( triggered() ), qApp, SLOT( quit() ) ); + + connect( ui->actionPlay, SIGNAL( triggered() ), AudioEngine::instance(), SLOT( playPause() ) ); + connect( ui->actionNext, SIGNAL( triggered() ), AudioEngine::instance(), SLOT( previous() ) ); + connect( ui->actionPrevious, SIGNAL( triggered() ), AudioEngine::instance(), SLOT( next() ) ); + + connect( AudioEngine::instance(), SIGNAL( started( Tomahawk::result_ptr ) ), this, SLOT( audioStarted() ) ); + connect( AudioEngine::instance(), SIGNAL( resumed()), this, SLOT( audioStarted() ) ); + connect( AudioEngine::instance(), SIGNAL( paused() ), this, SLOT( audioStopped() ) ); + connect( AudioEngine::instance(), SIGNAL( stopped() ), this, SLOT( audioStopped() ) ); + #if defined( Q_OS_DARWIN ) connect( ui->actionMinimize, SIGNAL( triggered() ), SLOT( minimize() ) ); connect( ui->actionZoom, SIGNAL( triggered() ), SLOT( maximize() ) ); @@ -519,6 +529,19 @@ TomahawkWindow::createPlaylist() } } +void +TomahawkWindow::audioStarted() +{ + ui->actionPlay->setText( tr( "Pause" ) ); +} + +void +TomahawkWindow::audioStopped() +{ + + ui->actionPlay->setText( tr( "Play" ) ); +} + void TomahawkWindow::onPlaybackLoading( const Tomahawk::result_ptr& result ) diff --git a/src/tomahawkwindow.h b/src/tomahawkwindow.h index 2720a4cfd..0d58a5b75 100644 --- a/src/tomahawkwindow.h +++ b/src/tomahawkwindow.h @@ -50,7 +50,6 @@ public: ~TomahawkWindow(); AudioControls* audioControls() { return m_audioControls; } - QStackedWidget* playlistStack(); SourceTreeView* sourceTreeView() const { return m_sourcetree; } void setWindowTitle( const QString& title ); @@ -83,6 +82,9 @@ private slots: void onHistoryBackAvailable( bool avail ); void onHistoryForwardAvailable( bool avail ); + void audioStarted(); + void audioStopped(); + void showAboutTomahawk(); void checkForUpdates(); diff --git a/src/tomahawkwindow.ui b/src/tomahawkwindow.ui index b770211cd..2005cdd5f 100644 --- a/src/tomahawkwindow.ui +++ b/src/tomahawkwindow.ui @@ -35,7 +35,7 @@ 0 0 1000 - 21 + 20 @@ -48,6 +48,10 @@ &Music Player + + + + @@ -189,6 +193,24 @@ QAction::ApplicationSpecificRole + + + Play + + + Space + + + + + Previous + + + + + Next + +