mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 21:57:41 +02:00
Use LinkGenerator in AdiumPlugin too
This commit is contained in:
@@ -26,7 +26,7 @@
|
|||||||
#include "Artist.h"
|
#include "Artist.h"
|
||||||
#include "Result.h"
|
#include "Result.h"
|
||||||
#include "TomahawkSettings.h"
|
#include "TomahawkSettings.h"
|
||||||
#include "GlobalActionManager.h"
|
#include "utils/LinkGenerator.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
|
|
||||||
#include "AdiumPlugin.h"
|
#include "AdiumPlugin.h"
|
||||||
@@ -161,11 +161,19 @@ AdiumPlugin::audioStarted( const Tomahawk::InfoSystem::PushInfoPair pushInfoPair
|
|||||||
m_currentArtist = hash["artist"];
|
m_currentArtist = hash["artist"];
|
||||||
|
|
||||||
// Request a short URL
|
// Request a short URL
|
||||||
m_currentLongUrl = GlobalActionManager::instance()->openLink( hash.value( "title" ), hash.value( "artist" ), hash.value( "album" ) );
|
ScriptJob* job = Utils::LinkGenerator::instance()->openLink( hash.value( "title" ), hash.value( "artist" ), hash.value( "album" ) );
|
||||||
|
connect( job, SIGNAL( done( QVariantMap ) ), SLOT ( onQueryLinkReady( QVariantMap ) ) );
|
||||||
|
job->start();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
AdiumPlugin::onQueryLinkReady( const QVariantMap& data )
|
||||||
|
{
|
||||||
|
|
||||||
|
m_currentLongUrl = data[ "url" ].toUrl();
|
||||||
|
|
||||||
QUrl shortUrl = m_currentLongUrl;
|
QUrl shortUrl = m_currentLongUrl;
|
||||||
if ( pushInfoPair.first.contains( "shortUrl" ) )
|
|
||||||
shortUrl = pushInfoPair.first[ "shortUrl" ].toUrl();
|
|
||||||
|
|
||||||
QString nowPlaying = "";
|
QString nowPlaying = "";
|
||||||
nowPlaying.append( m_currentArtist );
|
nowPlaying.append( m_currentArtist );
|
||||||
@@ -184,8 +192,11 @@ AdiumPlugin::audioStarted( const Tomahawk::InfoSystem::PushInfoPair pushInfoPair
|
|||||||
nowPlaying.append( " " );
|
nowPlaying.append( " " );
|
||||||
nowPlaying.append( shortUrl.toEncoded() );
|
nowPlaying.append( shortUrl.toEncoded() );
|
||||||
setStatus( nowPlaying );
|
setStatus( nowPlaying );
|
||||||
|
|
||||||
|
sender()->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AdiumPlugin::audioFinished( const QVariant &input )
|
AdiumPlugin::audioFinished( const QVariant &input )
|
||||||
{
|
{
|
||||||
|
@@ -65,6 +65,7 @@ public slots:
|
|||||||
private slots:
|
private slots:
|
||||||
void clearStatus();
|
void clearStatus();
|
||||||
void settingsChanged();
|
void settingsChanged();
|
||||||
|
void onQueryLinkReady( const QVariantMap& data );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void audioStarted( const Tomahawk::InfoSystem::PushInfoPair pushInfoPair );
|
void audioStarted( const Tomahawk::InfoSystem::PushInfoPair pushInfoPair );
|
||||||
|
Reference in New Issue
Block a user