diff --git a/src/tomahawkapp.cpp b/src/tomahawkapp.cpp index 5855a2b37..9b48e1723 100644 --- a/src/tomahawkapp.cpp +++ b/src/tomahawkapp.cpp @@ -139,6 +139,7 @@ TomahawkApp::init() ::exit( 0 ); } + qDebug() << "TomahawkApp thread:" << thread(); Logger::setupLogfile(); qsrand( QTime( 0, 0, 0 ).secsTo( QTime::currentTime() ) ); @@ -349,6 +350,13 @@ TomahawkApp::printHelp() echo( " --testdb Use a test database instead of real collection\n" ); echo( " --noupnp Disable UPnP\n" ); echo( " --nosip Disable SIP\n" ); + echo( "Playback Controls:" ); + echo( " --playpause Toggle playing/paused state" ); + echo( " --play Start/resume playback" ); + echo( " --pause Pause playback" ); + echo( " --stop Stop playback" ); + echo( " --next Advances to the next track (if available)" ); + echo( " --prev Returns to the previous track (if available)" ); echo( "\nurl is a tomahawk:// command or alternatively a url that Tomahawk can recognize.\n" ); echo( "For more documentation, see http://wiki.tomahawk-player.org/mediawiki/index.php/Tomahawk://_Links\n" ); } @@ -604,4 +612,38 @@ TomahawkApp::instanceStarted( KDSingleApplicationGuard::Instance instance ) QString arg1 = instance.arguments[ 1 ]; loadUrl( arg1 ); + + if ( instance.arguments.contains( "--next" ) || instance.arguments.contains( "--prev" ) || instance.arguments.contains( "--playpause" ) || instance.arguments.contains( "--play" ) || instance.arguments.contains( "--pause" ) || instance.arguments.contains( "--stop" ) ) + { + if ( instance.arguments.contains( "--next" ) ) + { + AudioEngine::instance()->next(); + } + + if ( instance.arguments.contains( "--prev" ) ) + { + AudioEngine::instance()->previous(); + } + + if ( instance.arguments.contains( "--playpause" ) ) + { + AudioEngine::instance()->playPause(); + } + + if ( instance.arguments.contains( "--play" ) ) + { + AudioEngine::instance()->play(); + } + + if ( instance.arguments.contains( "--pause" ) ) + { + AudioEngine::instance()->pause(); + } + + if ( instance.arguments.contains( "--stop" ) ) + { + AudioEngine::instance()->stop(); + } + + } }