1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-19 23:39:42 +01:00

Pull link generation out of GlobalActionManager

This commit is contained in:
Dominik Schmidt 2014-11-29 17:58:10 +01:00 committed by Dominik Schmidt
parent fb26cc5dd4
commit 9542aaffb4
11 changed files with 297 additions and 190 deletions

View File

@ -20,7 +20,7 @@
#include "XmppInfoPlugin.h"
#include "GlobalActionManager.h"
#include "utils/LinkGenerator.h"
#include "sip/XmppSip.h"
#include "utils/Logger.h"
#include "TomahawkSettings.h"
@ -122,7 +122,7 @@ Tomahawk::InfoSystem::XmppInfoPlugin::audioStarted( const Tomahawk::InfoSystem::
if ( pushInfoPair.first.contains( "shorturl" ) )
url = pushInfoPair.first[ "shorturl" ].toUrl();
else
url = GlobalActionManager::instance()->openLink( info.value( "title" ), info.value( "artist" ), info.value( "album" ) );
url = Utils::LinkGenerator::instance()->openLink( info.value( "title" ), info.value( "artist" ), info.value( "album" ) );
emit publishTune( url, info );
}

View File

@ -117,6 +117,7 @@ set( libGuiSources
utils/NetworkProxyFactory.cpp
utils/NetworkAccessManager.cpp
utils/ShortLinkHelper.cpp
utils/LinkGenerator.cpp
viewpages/SearchViewPage.cpp
viewpages/SourceViewPage.cpp

View File

@ -24,7 +24,7 @@
#include "playlist/TrackView.h"
#include "playlist/PlayableModel.h"
#include "filemetadata/MetadataEditor.h"
#include "GlobalActionManager.h"
#include "utils/LinkGenerator.h"
#include "ViewManager.h"
#include "Query.h"
#include "Result.h"
@ -421,15 +421,15 @@ ContextMenu::copyLink()
{
if ( m_queries.count() )
{
GlobalActionManager::instance()->copyToClipboard( m_queries.first() );
Utils::LinkGenerator::instance()->copyToClipboard( m_queries.first() );
}
else if ( m_albums.count() )
{
GlobalActionManager::instance()->copyOpenLink( m_albums.first() );
Utils::LinkGenerator::instance()->copyOpenLink( m_albums.first() );
}
else if ( m_artists.count() )
{
GlobalActionManager::instance()->copyOpenLink( m_artists.first() );
Utils::LinkGenerator::instance()->copyOpenLink( m_artists.first() );
}
}

View File

@ -25,9 +25,7 @@
#include "accounts/AccountManager.h"
#include "accounts/spotify/SpotifyAccount.h"
#include "accounts/ResolverAccount.h"
#include "audio/AudioEngine.h"
#include "database/LocalCollection.h"
#include "jobview/ErrorStatusMessage.h"
#include "jobview/JobStatusModel.h"
#include "jobview/JobStatusView.h"
@ -40,29 +38,19 @@
#include "resolvers/ScriptCommand_LookupUrl.h"
#include "utils/JspfLoader.h"
#include "utils/Logger.h"
#include "utils/NetworkAccessManager.h"
#include "utils/ShortenedLinkParser.h"
#include "utils/ShortLinkHelper.h"
#include "utils/SpotifyParser.h"
#include "utils/TomahawkUtils.h"
#include "utils/XspfLoader.h"
#include "utils/XspfGenerator.h"
#include "viewpages/SearchViewPage.h"
#include "Album.h"
#include "Artist.h"
#include "Pipeline.h"
#include "PlaylistEntry.h"
#include "SourceList.h"
#include "TomahawkSettings.h"
#include "ViewManager.h"
#include <QApplication>
#include <QClipboard>
#include <QMessageBox>
#include <echonest/Playlist.h>
#include <QMessageBox>
#include <QFileInfo>
GlobalActionManager* GlobalActionManager::s_instance = 0;
@ -91,61 +79,6 @@ GlobalActionManager::~GlobalActionManager()
}
QUrl
GlobalActionManager::openLinkFromQuery( const query_ptr& query ) const
{
QString title = query->track()->track();
QString artist = query->track()->artist();
QString album = query->track()->album();
return openLink( title, artist, album );
}
QUrl
GlobalActionManager::copyOpenLink( const artist_ptr& artist ) const
{
const QUrl link( QString( "%1/artist/%2" ).arg( hostname() ).arg( artist->name() ) );
QClipboard* cb = QApplication::clipboard();
QByteArray data = percentEncode( link );
cb->setText( data );
return link;
}
QUrl
GlobalActionManager::copyOpenLink( const album_ptr& album ) const
{
const QUrl link = QUrl::fromUserInput( QString( "%1/album/%2/%3" ).arg( hostname() ).arg( album->artist().isNull() ? QString() : album->artist()->name() ).arg( album->name() ) );
QClipboard* cb = QApplication::clipboard();
QByteArray data = percentEncode( link );
cb->setText( data );
return link;
}
QUrl
GlobalActionManager::openLink( const QString& title, const QString& artist, const QString& album ) const
{
QUrl link( QString( "%1/open/track/" ).arg( hostname() ) );
if ( !artist.isEmpty() )
TomahawkUtils::urlAddQueryItem( link, "artist", artist );
if ( !title.isEmpty() )
TomahawkUtils::urlAddQueryItem( link, "title", title );
if ( !album.isEmpty() )
TomahawkUtils::urlAddQueryItem( link, "album", album );
return link;
}
void
GlobalActionManager::installResolverFromFile( const QString& resolverPath )
{
@ -252,57 +185,6 @@ GlobalActionManager::openUrl( const QString& url )
}
QString
GlobalActionManager::copyPlaylistToClipboard( const dynplaylist_ptr& playlist )
{
QUrl link( QString( "%1/%2/create/" ).arg( hostname() ).arg( playlist->mode() == OnDemand ? "station" : "autoplaylist" ) );
if ( playlist->generator()->type() != "echonest" )
{
tLog() << "Only echonest generators are supported";
return QString();
}
TomahawkUtils::urlAddQueryItem( link, "type", "echonest" );
TomahawkUtils::urlAddQueryItem( link, "title", playlist->title() );
QList< dyncontrol_ptr > controls = playlist->generator()->controls();
foreach ( const dyncontrol_ptr& c, controls )
{
if ( c->selectedType() == "Artist" )
{
if ( c->match().toInt() == Echonest::DynamicPlaylist::ArtistType )
TomahawkUtils::urlAddQueryItem( link, "artist_limitto", c->input() );
else
TomahawkUtils::urlAddQueryItem( link, "artist", c->input() );
}
else if ( c->selectedType() == "Artist Description" )
{
TomahawkUtils::urlAddQueryItem( link, "description", c->input() );
}
else
{
QString name = c->selectedType().toLower().replace( " ", "_" );
Echonest::DynamicPlaylist::PlaylistParam p = static_cast< Echonest::DynamicPlaylist::PlaylistParam >( c->match().toInt() );
// if it is a max, set that too
if ( p == Echonest::DynamicPlaylist::MaxTempo || p == Echonest::DynamicPlaylist::MaxDuration || p == Echonest::DynamicPlaylist::MaxLoudness
|| p == Echonest::DynamicPlaylist::MaxDanceability || p == Echonest::DynamicPlaylist::MaxEnergy || p == Echonest::DynamicPlaylist::ArtistMaxFamiliarity
|| p == Echonest::DynamicPlaylist::ArtistMaxHotttnesss || p == Echonest::DynamicPlaylist::SongMaxHotttnesss || p == Echonest::DynamicPlaylist::ArtistMaxLatitude
|| p == Echonest::DynamicPlaylist::ArtistMaxLongitude )
name += "_max";
TomahawkUtils::urlAddQueryItem( link, name, c->input() );
}
}
QClipboard* cb = QApplication::clipboard();
QByteArray data = percentEncode( link );
cb->setText( data );
return link.toString();
}
void
GlobalActionManager::savePlaylistToFile( const playlist_ptr& playlist, const QString& filename )
{
@ -332,20 +214,6 @@ GlobalActionManager::xspfCreated( const QByteArray& xspf )
}
void
GlobalActionManager::copyToClipboard( const query_ptr& query )
{
m_clipboardLongUrl = openLinkFromQuery( query );
Tomahawk::Utils::ShortLinkHelper* slh = new Tomahawk::Utils::ShortLinkHelper();
connect( slh, SIGNAL( shortLinkReady( QUrl, QUrl, QVariant ) ),
SLOT( copyToClipboardReady( QUrl, QUrl, QVariant ) ) );
connect( slh, SIGNAL( done() ),
slh, SLOT( deleteLater() ),
Qt::QueuedConnection );
slh->shortenLink( m_clipboardLongUrl );
}
bool
GlobalActionManager::parseTomahawkLink( const QString& urlIn )
{
@ -741,22 +609,6 @@ GlobalActionManager::informationForUrl(const QString& url, const QSharedPointer<
}
void
GlobalActionManager::copyToClipboardReady( const QUrl& longUrl, const QUrl& shortUrl, const QVariant& )
{
// Copy resulting url to clipboard
if ( m_clipboardLongUrl == longUrl )
{
QClipboard* cb = QApplication::clipboard();
QByteArray data = TomahawkUtils::percentEncode( shortUrl.isEmpty() ? longUrl : shortUrl );
cb->setText( data );
m_clipboardLongUrl.clear();
}
}
bool
GlobalActionManager::handleQueueCommand( const QUrl& url )
{
@ -1352,10 +1204,3 @@ GlobalActionManager::openSpotifyLink( const QString& link )
return true;
}
QString
GlobalActionManager::hostname() const
{
return QString( "http://toma.hk" );
}

View File

@ -39,13 +39,6 @@ public:
static GlobalActionManager* instance();
virtual ~GlobalActionManager();
QUrl openLinkFromQuery( const Tomahawk::query_ptr& query ) const;
QUrl copyOpenLink( const Tomahawk::artist_ptr& artist ) const;
QUrl copyOpenLink( const Tomahawk::album_ptr& album ) const;
QUrl openLink( const QString& title, const QString& artist, const QString& album ) const;
void installResolverFromFile( const QString& resolverPath );
public slots:
@ -58,11 +51,6 @@ public slots:
/// Takes a spotify link and performs the default open action on it
bool openSpotifyLink( const QString& link );
/// Creates a link from the requested data and copies it to the clipboard
void copyToClipboard( const Tomahawk::query_ptr& query );
QString copyPlaylistToClipboard( const Tomahawk::dynplaylist_ptr& playlist );
void savePlaylistToFile( const Tomahawk::playlist_ptr& playlist, const QString& filename );
bool parseTomahawkLink( const QString& link );
@ -77,7 +65,6 @@ public slots:
private slots:
void informationForUrl( const QString& url, const QSharedPointer<QObject>& information );
void copyToClipboardReady( const QUrl& longUrl, const QUrl& shortUrl, const QVariant& callbackObj );
void showPlaylist();
@ -112,11 +99,8 @@ private:
void createPlaylistFromUrl( const QString& type, const QString& url, const QString& title );
QString hostname() const;
Tomahawk::playlist_ptr m_toShow;
Tomahawk::query_ptr m_waitingToPlay;
QUrl m_clipboardLongUrl;
QString m_queuedUrl;
static GlobalActionManager* s_instance;

View File

@ -24,7 +24,7 @@
#include "utils/ShortLinkHelper.h"
#include "utils/TomahawkUtils.h"
#include "config.h"
#include "GlobalActionManager.h"
#include "utils/LinkGenerator.h"
#include "InfoSystemCache.h"
#include "PlaylistEntry.h"
#include "utils/TomahawkUtils.h"
@ -337,7 +337,7 @@ InfoSystemWorker::getShortUrl( Tomahawk::InfoSystem::InfoPushData pushData )
if( hash.contains( "album" ) )
album = hash[ "album" ];
QUrl longUrl = GlobalActionManager::instance()->openLink( title, artist, album );
QUrl longUrl = Utils::LinkGenerator::instance()->openLink( title, artist, album );
Tomahawk::Utils::ShortLinkHelper* slh = new Tomahawk::Utils::ShortLinkHelper();
connect( slh, SIGNAL( shortLinkReady( QUrl, QUrl, QVariant ) ),
@ -356,7 +356,7 @@ InfoSystemWorker::shortLinkReady( QUrl longUrl, QUrl shortUrl, QVariant callback
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "long url = " << longUrl << ", shortUrl = " << shortUrl;
m_shortLinksWaiting--;
if ( !m_shortLinksWaiting )
disconnect( GlobalActionManager::instance(), SIGNAL( shortLinkReady( QUrl, QUrl, QVariant ) ) );
disconnect( Utils::LinkGenerator::instance(), SIGNAL( shortLinkReady( QUrl, QUrl, QVariant ) ) );
if ( !callbackObj.isValid() )
{

View File

@ -0,0 +1,208 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright (C) 2011 Leo Franchi <lfranchi@kde.org>
* Copyright (C) 2011, Jeff Mitchell <jeff@tomahawk-player.org>
* Copyright (C) 2011-2014, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright (C) 2013, Uwe L. Korn <uwelk@xhochy.com>
* Copyright (C) 2013, Teo Mrnjavac <teo@kde.org>
* Copyright (C) 2014, Dominik Schmidt <domme@tomahawk-player.org>
*
* Tomahawk is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Tomahawk is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/
#include "LinkGenerator.h"
#include "TomahawkUtils.h"
#include "Logger.h"
#include "ShortLinkHelper.h"
#include "playlist/dynamic/GeneratorInterface.h"
#include "playlist/dynamic/DynamicPlaylist.h"
#include "../Track.h"
#include "../Artist.h"
#include "../Album.h"
#include <echonest/Playlist.h>
#include <QClipboard>
#include <QApplication>
using namespace Tomahawk;
using namespace Tomahawk::Utils;
LinkGenerator* LinkGenerator::s_instance = 0;
LinkGenerator*
LinkGenerator::instance()
{
if ( !s_instance )
s_instance = new LinkGenerator;
return s_instance;
}
LinkGenerator::LinkGenerator( QObject* parent )
: QObject( parent )
{
}
LinkGenerator::~LinkGenerator()
{
}
QString
LinkGenerator::hostname() const
{
return QString( "http://toma.hk" );
}
QUrl
LinkGenerator::openLinkFromQuery( const query_ptr& query ) const
{
QString title = query->track()->track();
QString artist = query->track()->artist();
QString album = query->track()->album();
return openLink( title, artist, album );
}
QUrl
LinkGenerator::copyOpenLink( const artist_ptr& artist ) const
{
const QUrl link( QString( "%1/artist/%2" ).arg( hostname() ).arg( artist->name() ) );
QClipboard* cb = QApplication::clipboard();
QByteArray data = TomahawkUtils::percentEncode( link );
cb->setText( data );
return link;
}
QUrl
LinkGenerator::copyOpenLink( const album_ptr& album ) const
{
const QUrl link = QUrl::fromUserInput( QString( "%1/album/%2/%3" ).arg( hostname() ).arg( album->artist().isNull() ? QString() : album->artist()->name() ).arg( album->name() ) );
QClipboard* cb = QApplication::clipboard();
QByteArray data = TomahawkUtils::percentEncode( link );
cb->setText( data );
return link;
}
QUrl
LinkGenerator::openLink( const QString& title, const QString& artist, const QString& album ) const
{
QUrl link( QString( "%1/open/track/" ).arg( hostname() ) );
if ( !artist.isEmpty() )
TomahawkUtils::urlAddQueryItem( link, "artist", artist );
if ( !title.isEmpty() )
TomahawkUtils::urlAddQueryItem( link, "title", title );
if ( !album.isEmpty() )
TomahawkUtils::urlAddQueryItem( link, "album", album );
return link;
}
QString
LinkGenerator::copyPlaylistToClipboard( const dynplaylist_ptr& playlist )
{
QUrl link( QString( "%1/%2/create/" ).arg( hostname() ).arg( playlist->mode() == OnDemand ? "station" : "autoplaylist" ) );
if ( playlist->generator()->type() != "echonest" )
{
tLog() << "Only echonest generators are supported";
return QString();
}
TomahawkUtils::urlAddQueryItem( link, "type", "echonest" );
TomahawkUtils::urlAddQueryItem( link, "title", playlist->title() );
QList< dyncontrol_ptr > controls = playlist->generator()->controls();
foreach ( const dyncontrol_ptr& c, controls )
{
if ( c->selectedType() == "Artist" )
{
if ( c->match().toInt() == Echonest::DynamicPlaylist::ArtistType )
TomahawkUtils::urlAddQueryItem( link, "artist_limitto", c->input() );
else
TomahawkUtils::urlAddQueryItem( link, "artist", c->input() );
}
else if ( c->selectedType() == "Artist Description" )
{
TomahawkUtils::urlAddQueryItem( link, "description", c->input() );
}
else
{
QString name = c->selectedType().toLower().replace( " ", "_" );
Echonest::DynamicPlaylist::PlaylistParam p = static_cast< Echonest::DynamicPlaylist::PlaylistParam >( c->match().toInt() );
// if it is a max, set that too
if ( p == Echonest::DynamicPlaylist::MaxTempo || p == Echonest::DynamicPlaylist::MaxDuration || p == Echonest::DynamicPlaylist::MaxLoudness
|| p == Echonest::DynamicPlaylist::MaxDanceability || p == Echonest::DynamicPlaylist::MaxEnergy || p == Echonest::DynamicPlaylist::ArtistMaxFamiliarity
|| p == Echonest::DynamicPlaylist::ArtistMaxHotttnesss || p == Echonest::DynamicPlaylist::SongMaxHotttnesss || p == Echonest::DynamicPlaylist::ArtistMaxLatitude
|| p == Echonest::DynamicPlaylist::ArtistMaxLongitude )
name += "_max";
TomahawkUtils::urlAddQueryItem( link, name, c->input() );
}
}
QClipboard* cb = QApplication::clipboard();
QByteArray data = TomahawkUtils::percentEncode( link );
cb->setText( data );
return link.toString();
}
void
LinkGenerator::copyToClipboard( const query_ptr& query )
{
m_clipboardLongUrl = openLinkFromQuery( query );
Tomahawk::Utils::ShortLinkHelper* slh = new Tomahawk::Utils::ShortLinkHelper();
connect( slh, SIGNAL( shortLinkReady( QUrl, QUrl, QVariant ) ),
SLOT( copyToClipboardReady( QUrl, QUrl, QVariant ) ) );
connect( slh, SIGNAL( done() ),
slh, SLOT( deleteLater() ),
Qt::QueuedConnection );
slh->shortenLink( m_clipboardLongUrl );
}
void
LinkGenerator::copyToClipboardReady( const QUrl& longUrl, const QUrl& shortUrl, const QVariant& )
{
// Copy resulting url to clipboard
if ( m_clipboardLongUrl == longUrl )
{
QClipboard* cb = QApplication::clipboard();
QByteArray data = TomahawkUtils::percentEncode( shortUrl.isEmpty() ? longUrl : shortUrl );
cb->setText( data );
m_clipboardLongUrl.clear();
}
}

View File

@ -0,0 +1,68 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright (C) 2011 Leo Franchi <lfranchi@kde.org>
* Copyright (C) 2014 Dominik Schmidt <domme@tomahawk-player.org>
*
* Tomahawk is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Tomahawk is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#ifndef TOMAHAWK_UTILS_LINKGENERATOR_H
#define TOMAHAWK_UTILS_LINKGENERATOR_H
#include "DllMacro.h"
#include "Typedefs.h"
namespace Tomahawk {
namespace Utils {
class ShortLinkHelperPrivate;
class DLLEXPORT LinkGenerator : public QObject
{
Q_OBJECT
public:
static LinkGenerator* instance();
virtual ~LinkGenerator();
QUrl openLinkFromQuery( const Tomahawk::query_ptr& query ) const;
QUrl copyOpenLink( const Tomahawk::artist_ptr& artist ) const;
QUrl copyOpenLink( const Tomahawk::album_ptr& album ) const;
QUrl openLink( const QString& title, const QString& artist, const QString& album ) const;
QString copyPlaylistToClipboard( const Tomahawk::dynplaylist_ptr& playlist );
public slots:
/// Creates a link from the requested data and copies it to the clipboard
void copyToClipboard( const Tomahawk::query_ptr& query );
private slots:
void copyToClipboardReady( const QUrl& longUrl, const QUrl& shortUrl, const QVariant& callbackObj );
private:
explicit LinkGenerator( QObject* parent = 0 );
QString hostname() const;
QUrl m_clipboardLongUrl;
static LinkGenerator* s_instance;
};
} // namespace Utils
} // namespace Tomahawk
#endif // TOMAHAWK_UTILS_LINKGENERATOR_H

View File

@ -38,6 +38,7 @@
#include "database/Database.h"
#include "LatchManager.h"
#include "GlobalActionManager.h"
#include "utils/LinkGenerator.h"
#include "utils/Closure.h"
#include "utils/Logger.h"
#include "utils/ShortLinkHelper.h"
@ -502,7 +503,7 @@ SourceTreeView::copyPlaylistLink()
{
DynamicPlaylistItem* item = itemFromIndex< DynamicPlaylistItem >( m_contextMenuIndex );
dynplaylist_ptr playlist = item->dynPlaylist();
GlobalActionManager::instance()->copyPlaylistToClipboard( playlist );
Utils::LinkGenerator::instance()->copyPlaylistToClipboard( playlist );
}
else if ( type == SourcesModel::StaticPlaylist )
{
@ -562,7 +563,7 @@ SourceTreeView::addToLocal()
// copy to a link and then generate a new playlist from that
// this way we cheaply regenerate the needed controls
QString link = GlobalActionManager::instance()->copyPlaylistToClipboard( playlist );
QString link = Utils::LinkGenerator::instance()->copyPlaylistToClipboard( playlist );
GlobalActionManager::instance()->parseTomahawkLink( link );
}
else if ( type == SourcesModel::StaticPlaylist )

View File

@ -19,7 +19,7 @@
#include "TemporaryPageItem.h"
#include "GlobalActionManager.h"
#include "utils/LinkGenerator.h"
#include "ViewManager.h"
#include "viewpages/AlbumViewPage.h"
#include "viewpages/ArtistViewPage.h"
@ -139,7 +139,7 @@ TemporaryPageItem::linkActionTriggered( QAction* action )
{
ArtistInfoWidget* aPage = dynamic_cast< ArtistInfoWidget* >( m_page );
Q_ASSERT( aPage );
GlobalActionManager::instance()->copyOpenLink( aPage->artist() );
Utils::LinkGenerator::instance()->copyOpenLink( aPage->artist() );
break;
}
@ -147,7 +147,7 @@ TemporaryPageItem::linkActionTriggered( QAction* action )
{
AlbumInfoWidget* aPage = dynamic_cast< AlbumInfoWidget* >( m_page );
Q_ASSERT( aPage );
GlobalActionManager::instance()->copyOpenLink( aPage->album() );
Utils::LinkGenerator::instance()->copyOpenLink( aPage->album() );
break;
}
@ -155,7 +155,7 @@ TemporaryPageItem::linkActionTriggered( QAction* action )
{
TrackInfoWidget* tPage = dynamic_cast< TrackInfoWidget* >( m_page );
Q_ASSERT( tPage );
GlobalActionManager::instance()->copyToClipboard( tPage->query() );
Utils::LinkGenerator::instance()->copyToClipboard( tPage->query() );
break;
}

View File

@ -25,7 +25,7 @@
#include "utils/TomahawkUtilsGui.h"
#include "utils/Logger.h"
#include "GlobalActionManager.h"
#include "utils/LinkGenerator.h"
#include "Source.h"
#include "Track.h"
@ -180,7 +180,7 @@ SocialWidget::setQuery( const Tomahawk::query_ptr& query )
onShortLinkReady( QString(), QString(), QVariant() );
onChanged();
QUrl longUrl = GlobalActionManager::instance()->openLinkFromQuery( query );
QUrl longUrl = Tomahawk::Utils::LinkGenerator::instance()->openLinkFromQuery( query );
m_slh.shortenLink( longUrl );
}