mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-22 16:59:58 +01: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:
parent
24f58b45d3
commit
2b408744d7
@ -18,6 +18,7 @@
|
||||
|
||||
#include "globalactionmanager.h"
|
||||
|
||||
#include "audio/audioengine.h"
|
||||
#include "utils/xspfloader.h"
|
||||
#include "sourcelist.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() ) );
|
||||
|
||||
m_toShow = pl;
|
||||
m_waitingToBookmark.clear();
|
||||
|
||||
// if nothing is playing, lets start this
|
||||
// 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
|
||||
@ -342,3 +347,14 @@ GlobalActionManager::showPlaylist()
|
||||
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:
|
||||
bool parseTomahawkLink( const QString& link );
|
||||
void waitingForResolved( bool );
|
||||
|
||||
private slots:
|
||||
void bookmarkPlaylistCreated( const Tomahawk::playlist_ptr& pl );
|
||||
@ -50,8 +51,9 @@ private:
|
||||
bool handleSearchCommand(const QUrl& url );
|
||||
bool handlePlayCommand(const QUrl& url );
|
||||
|
||||
Tomahawk::query_ptr m_waitingToBookmark;
|
||||
Tomahawk::playlist_ptr m_toShow;
|
||||
Tomahawk::query_ptr m_waitingToBookmark;
|
||||
Tomahawk::query_ptr m_waitingToPlay;
|
||||
|
||||
static GlobalActionManager* s_instance;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user