mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 21:57:41 +02:00
Generate toma.hk urls instead of tomahawk://, so they can be shortened
This commit is contained in:
@@ -78,9 +78,9 @@ GlobalActionManager::openLinkFromQuery( const Tomahawk::query_ptr& query ) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
QUrl
|
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() )
|
if( !title.isEmpty() )
|
||||||
link.addQueryItem( "title", title );
|
link.addQueryItem( "title", title );
|
||||||
@@ -95,7 +95,7 @@ GlobalActionManager::openLink( const QString& title, const QString& artist, cons
|
|||||||
QString
|
QString
|
||||||
GlobalActionManager::copyPlaylistToClipboard( const Tomahawk::dynplaylist_ptr& playlist )
|
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" ) {
|
if( playlist->generator()->type() != "echonest" ) {
|
||||||
qDebug() << "Only echonest generators are supported";
|
qDebug() << "Only echonest generators are supported";
|
||||||
@@ -676,4 +676,8 @@ GlobalActionManager::waitingForResolved( bool success )
|
|||||||
m_waitingToPlay.clear();
|
m_waitingToPlay.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString
|
||||||
|
GlobalActionManager::hostname() const
|
||||||
|
{
|
||||||
|
return QString( "http://toma.hk" );
|
||||||
|
}
|
||||||
|
@@ -36,7 +36,7 @@ public:
|
|||||||
virtual ~GlobalActionManager();
|
virtual ~GlobalActionManager();
|
||||||
|
|
||||||
QUrl openLinkFromQuery( const Tomahawk::query_ptr& query ) const;
|
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;
|
void copyToClipboard( const Tomahawk::query_ptr& query ) const;
|
||||||
QString copyPlaylistToClipboard( const Tomahawk::dynplaylist_ptr& playlist );
|
QString copyPlaylistToClipboard( const Tomahawk::dynplaylist_ptr& playlist );
|
||||||
@@ -68,6 +68,7 @@ private:
|
|||||||
bool handleOpenCommand(const QUrl& url );
|
bool handleOpenCommand(const QUrl& url );
|
||||||
|
|
||||||
bool doQueueAdd( const QStringList& parts, const QList< QPair< QString, QString > >& queryItems );
|
bool doQueueAdd( const QStringList& parts, const QList< QPair< QString, QString > >& queryItems );
|
||||||
|
QString hostname() const;
|
||||||
|
|
||||||
Tomahawk::playlist_ptr m_toShow;
|
Tomahawk::playlist_ptr m_toShow;
|
||||||
Tomahawk::query_ptr m_waitingToBookmark;
|
Tomahawk::query_ptr m_waitingToBookmark;
|
||||||
|
@@ -78,7 +78,7 @@ TrackView::TrackView( QWidget* parent )
|
|||||||
setFont( f );
|
setFont( f );
|
||||||
#endif
|
#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() ) );
|
connect( createLinkAction, SIGNAL( triggered( bool ) ), this, SLOT( copyLink() ) );
|
||||||
addAction( createLinkAction );
|
addAction( createLinkAction );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user