From 36206e8006c7db2625df69b936f9224feeb6f848 Mon Sep 17 00:00:00 2001 From: "Uwe L. Korn" Date: Fri, 31 Jan 2014 19:52:57 +0000 Subject: [PATCH] Fix indentation --- src/libtomahawk-playdarapi/Api_v1_5.cpp | 98 +++++++++++++------------ 1 file changed, 50 insertions(+), 48 deletions(-) diff --git a/src/libtomahawk-playdarapi/Api_v1_5.cpp b/src/libtomahawk-playdarapi/Api_v1_5.cpp index caec36bc9..87d48c900 100644 --- a/src/libtomahawk-playdarapi/Api_v1_5.cpp +++ b/src/libtomahawk-playdarapi/Api_v1_5.cpp @@ -46,43 +46,44 @@ Api_v1_5::ping( QxtWebRequestEvent* event ) m_service->postEvent( e ); } + void Api_v1_5::playback( QxtWebRequestEvent* event, const QString& command ) { - if ( command == "next") - { - JSON_REPLY( QMetaObject::invokeMethod( AudioEngine::instance(), "next", Qt::QueuedConnection ) , "Skipping to the next track failed." ); - } - else if ( command == "previous" ) - { - JSON_REPLY( QMetaObject::invokeMethod( AudioEngine::instance(), "previous", Qt::QueuedConnection ), "Rewinding to the previous track failed." ); - } - else if ( command == "playpause" ) - { - JSON_REPLY( QMetaObject::invokeMethod( AudioEngine::instance(), "playPause", Qt::QueuedConnection ), "Play/Pause failed." ); - } - else if ( command == "play" ) - { - JSON_REPLY( QMetaObject::invokeMethod( AudioEngine::instance(), "play", Qt::QueuedConnection ), "Starting the playback failed." ); - } - else if ( command == "pause" ) - { - JSON_REPLY( QMetaObject::invokeMethod( AudioEngine::instance(), "pause", Qt::QueuedConnection ), "Pausing the current track failed." ); - } - else if ( command == "stop" ) - { - JSON_REPLY( QMetaObject::invokeMethod( AudioEngine::instance(), "stop", Qt::QueuedConnection ), "Stopping the current track failed." ); - } - else if ( command == "lowervolume" ) - { - JSON_REPLY( QMetaObject::invokeMethod( AudioEngine::instance(), "lowerVolume", Qt::QueuedConnection ), "Lowering volume failed." ); - } - else if ( command == "raisevolume" ) - { - JSON_REPLY( QMetaObject::invokeMethod( AudioEngine::instance(), "raiseVolume", Qt::QueuedConnection ), "Raising volume failed." ); - } - else if ( command == "currenttrack" ) - { + if ( command == "next") + { + JSON_REPLY( QMetaObject::invokeMethod( AudioEngine::instance(), "next", Qt::QueuedConnection ) , "Skipping to the next track failed." ); + } + else if ( command == "previous" ) + { + JSON_REPLY( QMetaObject::invokeMethod( AudioEngine::instance(), "previous", Qt::QueuedConnection ), "Rewinding to the previous track failed." ); + } + else if ( command == "playpause" ) + { + JSON_REPLY( QMetaObject::invokeMethod( AudioEngine::instance(), "playPause", Qt::QueuedConnection ), "Play/Pause failed." ); + } + else if ( command == "play" ) + { + JSON_REPLY( QMetaObject::invokeMethod( AudioEngine::instance(), "play", Qt::QueuedConnection ), "Starting the playback failed." ); + } + else if ( command == "pause" ) + { + JSON_REPLY( QMetaObject::invokeMethod( AudioEngine::instance(), "pause", Qt::QueuedConnection ), "Pausing the current track failed." ); + } + else if ( command == "stop" ) + { + JSON_REPLY( QMetaObject::invokeMethod( AudioEngine::instance(), "stop", Qt::QueuedConnection ), "Stopping the current track failed." ); + } + else if ( command == "lowervolume" ) + { + JSON_REPLY( QMetaObject::invokeMethod( AudioEngine::instance(), "lowerVolume", Qt::QueuedConnection ), "Lowering volume failed." ); + } + else if ( command == "raisevolume" ) + { + JSON_REPLY( QMetaObject::invokeMethod( AudioEngine::instance(), "raiseVolume", Qt::QueuedConnection ), "Raising volume failed." ); + } + else if ( command == "currenttrack" ) + { QByteArray json; Tomahawk::result_ptr currentTrack = AudioEngine::instance()->currentTrack(); @@ -113,24 +114,25 @@ Api_v1_5::playback( QxtWebRequestEvent* event, const QString& command ) e->headers.insert( "Access-Control-Allow-Origin", "*" ); e->contentType = "application/json"; m_service->postEvent( e ); - } - else - { - m_service->sendJsonError( event, "No such playback command." ); - } + } + else + { + m_service->sendJsonError( event, "No such playback command." ); + } } + void Api_v1_5::jsonReply( QxtWebRequestEvent* event, const char* funcInfo, const QString& errorMessage, bool isError ) { - if ( isError ) - { - tLog( LOGVERBOSE ) << funcInfo << errorMessage; - m_service->sendJsonError( event, errorMessage ); - } - else - { - m_service->sendJsonOk( event ); - } + if ( isError ) + { + tLog( LOGVERBOSE ) << funcInfo << errorMessage; + m_service->sendJsonError( event, errorMessage ); + } + else + { + m_service->sendJsonOk( event ); + } }