From 5cfbcae95e5834d53234ecb25ea0918f02dc6e94 Mon Sep 17 00:00:00 2001 From: Leo Franchi Date: Sat, 11 Jun 2011 13:32:33 -0400 Subject: [PATCH] Generate toma.hk urls instead of tomahawk://, so they can be shortened --- src/libtomahawk/globalactionmanager.cpp | 12 ++++++++---- src/libtomahawk/globalactionmanager.h | 3 ++- src/libtomahawk/playlist/trackview.cpp | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/libtomahawk/globalactionmanager.cpp b/src/libtomahawk/globalactionmanager.cpp index bf60833f6..ad85da31c 100644 --- a/src/libtomahawk/globalactionmanager.cpp +++ b/src/libtomahawk/globalactionmanager.cpp @@ -78,9 +78,9 @@ GlobalActionManager::openLinkFromQuery( const Tomahawk::query_ptr& query ) const } QUrl -GlobalActionManager::openLink( const QString& title, const QString& artist, const QString& album, bool tomahk ) const +GlobalActionManager::openLink( const QString& title, const QString& artist, const QString& album ) const { - QUrl link( tomahk ? "http://toma.hk/open/track/" : "tomahawk://open/track/" ); + QUrl link( QString( "%1/open/track/" ).arg( hostname() ) ); if( !title.isEmpty() ) link.addQueryItem( "title", title ); @@ -95,7 +95,7 @@ GlobalActionManager::openLink( const QString& title, const QString& artist, cons QString GlobalActionManager::copyPlaylistToClipboard( const Tomahawk::dynplaylist_ptr& playlist ) { - QUrl link( QString( "tomahawk://%1/create/" ).arg( playlist->mode() == Tomahawk::OnDemand ? "station" : "autoplaylist" ) ); + QUrl link( QString( "%1/%2/create/" ).arg( hostname() ).arg( playlist->mode() == Tomahawk::OnDemand ? "station" : "autoplaylist" ) ); if( playlist->generator()->type() != "echonest" ) { qDebug() << "Only echonest generators are supported"; @@ -676,4 +676,8 @@ GlobalActionManager::waitingForResolved( bool success ) m_waitingToPlay.clear(); } - +QString +GlobalActionManager::hostname() const +{ + return QString( "http://toma.hk" ); +} diff --git a/src/libtomahawk/globalactionmanager.h b/src/libtomahawk/globalactionmanager.h index d8186559a..f54605da8 100644 --- a/src/libtomahawk/globalactionmanager.h +++ b/src/libtomahawk/globalactionmanager.h @@ -36,7 +36,7 @@ public: virtual ~GlobalActionManager(); QUrl openLinkFromQuery( const Tomahawk::query_ptr& query ) const; - QUrl openLink( const QString& title, const QString& artist, const QString& album, bool tomahk=false ) 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 ); @@ -68,6 +68,7 @@ private: bool handleOpenCommand(const QUrl& url ); bool doQueueAdd( const QStringList& parts, const QList< QPair< QString, QString > >& queryItems ); + QString hostname() const; Tomahawk::playlist_ptr m_toShow; Tomahawk::query_ptr m_waitingToBookmark; diff --git a/src/libtomahawk/playlist/trackview.cpp b/src/libtomahawk/playlist/trackview.cpp index daf3627f0..729394e4a 100644 --- a/src/libtomahawk/playlist/trackview.cpp +++ b/src/libtomahawk/playlist/trackview.cpp @@ -78,7 +78,7 @@ TrackView::TrackView( QWidget* parent ) setFont( f ); #endif - QAction* createLinkAction = new QAction( tr( "Copy track link" ), this ); + QAction* createLinkAction = new QAction( tr( "Copy Track Link" ), this ); connect( createLinkAction, SIGNAL( triggered( bool ) ), this, SLOT( copyLink() ) ); addAction( createLinkAction );