mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-11 08:34:34 +02:00
play the track if nothing is playing. doesn't select in the playlist yet, thinking of an elegant solution
This commit is contained in:
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include "globalactionmanager.h"
|
#include "globalactionmanager.h"
|
||||||
|
|
||||||
|
#include "audio/audioengine.h"
|
||||||
#include "utils/xspfloader.h"
|
#include "utils/xspfloader.h"
|
||||||
#include "sourcelist.h"
|
#include "sourcelist.h"
|
||||||
#include "playlist/dynamic/GeneratorInterface.h"
|
#include "playlist/dynamic/GeneratorInterface.h"
|
||||||
@@ -324,11 +325,15 @@ GlobalActionManager::doBookmark( const Tomahawk::playlist_ptr& pl, const Tomahaw
|
|||||||
connect( pl.data(), SIGNAL( revisionLoaded( Tomahawk::PlaylistRevision ) ), this, SLOT( showPlaylist() ) );
|
connect( pl.data(), SIGNAL( revisionLoaded( Tomahawk::PlaylistRevision ) ), this, SLOT( showPlaylist() ) );
|
||||||
|
|
||||||
m_toShow = pl;
|
m_toShow = pl;
|
||||||
m_waitingToBookmark.clear();
|
|
||||||
|
|
||||||
// if nothing is playing, lets start this
|
// if nothing is playing, lets start this
|
||||||
// TODO
|
// TODO
|
||||||
// if( !AudioEngine::instance()->isPlaying() )
|
if( !AudioEngine::instance()->isPlaying() ) {
|
||||||
|
connect( q.data(), SIGNAL( resolvingFinished( bool ) ), this, SLOT( waitingForResolved( bool ) ) );
|
||||||
|
m_waitingToPlay = q;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_waitingToBookmark.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -342,3 +347,14 @@ GlobalActionManager::showPlaylist()
|
|||||||
m_toShow.clear();
|
m_toShow.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
GlobalActionManager::waitingForResolved( bool success )
|
||||||
|
{
|
||||||
|
if( success && !m_waitingToPlay.isNull() && !m_waitingToPlay->results().isEmpty() ) { // play it!
|
||||||
|
AudioEngine::instance()->playItem( AudioEngine::instance()->playlist(), m_waitingToPlay->results().first() );
|
||||||
|
}
|
||||||
|
|
||||||
|
m_waitingToPlay.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -34,6 +34,7 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
bool parseTomahawkLink( const QString& link );
|
bool parseTomahawkLink( const QString& link );
|
||||||
|
void waitingForResolved( bool );
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void bookmarkPlaylistCreated( const Tomahawk::playlist_ptr& pl );
|
void bookmarkPlaylistCreated( const Tomahawk::playlist_ptr& pl );
|
||||||
@@ -50,8 +51,9 @@ private:
|
|||||||
bool handleSearchCommand(const QUrl& url );
|
bool handleSearchCommand(const QUrl& url );
|
||||||
bool handlePlayCommand(const QUrl& url );
|
bool handlePlayCommand(const QUrl& url );
|
||||||
|
|
||||||
Tomahawk::query_ptr m_waitingToBookmark;
|
|
||||||
Tomahawk::playlist_ptr m_toShow;
|
Tomahawk::playlist_ptr m_toShow;
|
||||||
|
Tomahawk::query_ptr m_waitingToBookmark;
|
||||||
|
Tomahawk::query_ptr m_waitingToPlay;
|
||||||
|
|
||||||
static GlobalActionManager* s_instance;
|
static GlobalActionManager* s_instance;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user