1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-12 09:04:33 +02:00

Use just openLink in GAM to avoid including InfoSystem, and deal with the InfoCriteriaHash in the plguin.

This commit is contained in:
Alejandro Wainzinger
2011-06-07 18:50:27 -07:00
parent 23a9be18c6
commit 8ca84e9ba2
5 changed files with 24 additions and 25 deletions

View File

@@ -77,22 +77,6 @@ GlobalActionManager::openLinkFromQuery( const Tomahawk::query_ptr& query ) const
return openLink( title, artist, album );
}
QUrl
GlobalActionManager::openLinkFromHash( const Tomahawk::InfoSystem::InfoCriteriaHash& hash ) const
{
QString title, artist, album;
if( !hash.isEmpty() && hash.contains( "title" ) && hash.contains( "artist" ) )
{
title = hash["title"];
artist = hash["artist"];
if( hash.contains( "album" ) )
album = hash["album"];
}
return openLink( title, artist, album );
}
QUrl
GlobalActionManager::openLink( const QString& title, const QString& artist, const QString& album ) const
{

View File

@@ -23,7 +23,6 @@
#include "playlist.h"
#include "query.h"
#include "playlist/dynamic/DynamicPlaylist.h"
#include "infosystem/infosystem.h"
#include "dllmacro.h"
#include <QObject>
@@ -37,7 +36,7 @@ public:
virtual ~GlobalActionManager();
QUrl openLinkFromQuery( const Tomahawk::query_ptr& query ) const;
QUrl openLinkFromHash( const Tomahawk::InfoSystem::InfoCriteriaHash& hash ) const;
QUrl openLink( const QString& title, const QString& artist, const QString& album ) const;
void copyToClipboard( const Tomahawk::query_ptr& query ) const;
QString copyPlaylistToClipboard( const Tomahawk::dynplaylist_ptr& playlist );
@@ -70,8 +69,6 @@ private:
bool doQueueAdd( const QStringList& parts, const QList< QPair< QString, QString > >& queryItems );
QUrl openLink( const QString& title, const QString& artist, const QString& album ) const;
Tomahawk::playlist_ptr m_toShow;
Tomahawk::query_ptr m_waitingToBookmark;
Tomahawk::query_ptr m_waitingToPlay;

View File

@@ -140,10 +140,26 @@ AdiumPlugin::audioStarted( const QVariant &input )
nowPlaying.append(" - ");
nowPlaying.append( hash["artist"] );
nowPlaying.append( " " );
nowPlaying.append( GlobalActionManager::instance()->openLinkFromHash( hash ).toEncoded() );
nowPlaying.append( openLinkFromHash( hash ).toEncoded() );
setStatus( nowPlaying );
}
QUrl
AdiumPlugin::openLinkFromHash( const Tomahawk::InfoSystem::InfoCriteriaHash& hash ) const
{
QString title, artist, album;
if( !hash.isEmpty() && hash.contains( "title" ) && hash.contains( "artist" ) )
{
title = hash["title"];
artist = hash["artist"];
if( hash.contains( "album" ) )
album = hash["album"];
}
return GlobalActionManager::instance()->openLink( title, artist, album );
}
void
AdiumPlugin::audioFinished( const QVariant &input )
{

View File

@@ -41,6 +41,10 @@ protected slots:
void pushInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input );
public slots:
void namChangedSlot( QNetworkAccessManager *nam ) {} // unused
void notInCacheSlot( const Tomahawk::InfoSystem::InfoCriteriaHash criteria, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const Tomahawk::InfoSystem::InfoCustomData customData ) {} // unused
private:
void settingsChanged();
void audioStarted( const QVariant &input );
@@ -49,10 +53,8 @@ public slots:
void audioPaused();
void audioResumed( const QVariant &input );
void namChangedSlot( QNetworkAccessManager *nam ) {} // unused
void notInCacheSlot( const Tomahawk::InfoSystem::InfoCriteriaHash criteria, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const Tomahawk::InfoSystem::InfoCustomData customData ) {} // unused
QUrl openLinkFromHash( const InfoCriteriaHash& hash ) const;
private:
bool m_active;
QString m_beforeStatus;
QString m_afterStatus;