mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-02 12:20:45 +02:00
* Forgot to add new Query class, too.
This commit is contained in:
@@ -26,6 +26,7 @@
|
|||||||
#include "database/databasecommand_playbackhistory.h"
|
#include "database/databasecommand_playbackhistory.h"
|
||||||
#include "database/databasecommand_loadplaylistentries.h"
|
#include "database/databasecommand_loadplaylistentries.h"
|
||||||
#include "pipeline.h"
|
#include "pipeline.h"
|
||||||
|
#include "resolver.h"
|
||||||
#include "sourcelist.h"
|
#include "sourcelist.h"
|
||||||
|
|
||||||
using namespace Tomahawk;
|
using namespace Tomahawk;
|
||||||
@@ -219,6 +220,30 @@ Query::resultSorter( const result_ptr& left, const result_ptr& right )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
Query::setCurrentResolver( Tomahawk::Resolver* resolver )
|
||||||
|
{
|
||||||
|
m_resolvers << resolver;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Tomahawk::Resolver*
|
||||||
|
Query::currentResolver() const
|
||||||
|
{
|
||||||
|
int x = m_resolvers.count();
|
||||||
|
while ( --x )
|
||||||
|
{
|
||||||
|
QWeakPointer< Resolver > r = m_resolvers.at( x );
|
||||||
|
if ( r.isNull() )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
return r.data();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Query::clearResults()
|
Query::clearResults()
|
||||||
{
|
{
|
||||||
|
@@ -36,6 +36,8 @@ class DatabaseCommand_LoadPlaylistEntries;
|
|||||||
namespace Tomahawk
|
namespace Tomahawk
|
||||||
{
|
{
|
||||||
|
|
||||||
|
class Resolver;
|
||||||
|
|
||||||
class DLLEXPORT Query : public QObject
|
class DLLEXPORT Query : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -43,6 +45,7 @@ Q_OBJECT
|
|||||||
friend class ::DatabaseCommand_LogPlayback;
|
friend class ::DatabaseCommand_LogPlayback;
|
||||||
friend class ::DatabaseCommand_PlaybackHistory;
|
friend class ::DatabaseCommand_PlaybackHistory;
|
||||||
friend class ::DatabaseCommand_LoadPlaylistEntries;
|
friend class ::DatabaseCommand_LoadPlaylistEntries;
|
||||||
|
friend class Pipeline;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static query_ptr get( const QString& artist, const QString& track, const QString& album, const QID& qid = QString() );
|
static query_ptr get( const QString& artist, const QString& track, const QString& album, const QID& qid = QString() );
|
||||||
@@ -67,18 +70,19 @@ public:
|
|||||||
/// true when any result has been found (score may be less than 1.0)
|
/// true when any result has been found (score may be less than 1.0)
|
||||||
bool playable() const { return m_playable; }
|
bool playable() const { return m_playable; }
|
||||||
|
|
||||||
|
QString fullTextQuery() const { return m_fullTextQuery; }
|
||||||
bool isFullTextQuery() const { return !m_fullTextQuery.isEmpty(); }
|
bool isFullTextQuery() const { return !m_fullTextQuery.isEmpty(); }
|
||||||
bool resolvingFinished() const { return m_resolveFinished; }
|
bool resolvingFinished() const { return m_resolveFinished; }
|
||||||
|
|
||||||
unsigned int lastPipelineWeight() const { return m_lastpipelineweight; }
|
Tomahawk::source_ptr playedBy() const { return m_playedBy; }
|
||||||
void setLastPipelineWeight( unsigned int w ) { m_lastpipelineweight = w; }
|
Tomahawk::Resolver* currentResolver() const;
|
||||||
|
QList< QWeakPointer< Tomahawk::Resolver > > resolvedBy() const { return m_resolvers; }
|
||||||
|
|
||||||
void setArtist( const QString& artist ) { m_artist = artist; }
|
void setArtist( const QString& artist ) { m_artist = artist; }
|
||||||
void setAlbum( const QString& album ) { m_album = album; }
|
void setAlbum( const QString& album ) { m_album = album; }
|
||||||
void setTrack( const QString& track ) { m_track = track; }
|
void setTrack( const QString& track ) { m_track = track; }
|
||||||
void setResultHint( const QString& resultHint ) { m_resultHint = resultHint; }
|
void setResultHint( const QString& resultHint ) { m_resultHint = resultHint; }
|
||||||
void setDuration( int duration ) { m_duration = duration; }
|
void setDuration( int duration ) { m_duration = duration; }
|
||||||
void setResolveFinished( bool resolved ) { m_resolveFinished = resolved; }
|
|
||||||
|
|
||||||
QVariant toVariant() const;
|
QVariant toVariant() const;
|
||||||
QString toString() const;
|
QString toString() const;
|
||||||
@@ -87,9 +91,11 @@ public:
|
|||||||
QString artist() const { return m_artist; }
|
QString artist() const { return m_artist; }
|
||||||
QString album() const { return m_album; }
|
QString album() const { return m_album; }
|
||||||
QString track() const { return m_track; }
|
QString track() const { return m_track; }
|
||||||
QString fullTextQuery() const { return m_fullTextQuery; }
|
|
||||||
int duration() const { return m_duration; }
|
int duration() const { return m_duration; }
|
||||||
|
|
||||||
|
void setResolveFinished( bool resolved ) { m_resolveFinished = resolved; }
|
||||||
|
void setPlayedBy( const Tomahawk::source_ptr& source ) { m_playedBy = source; }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void resultsAdded( const QList<Tomahawk::result_ptr>& );
|
void resultsAdded( const QList<Tomahawk::result_ptr>& );
|
||||||
void resultsRemoved( const Tomahawk::result_ptr& );
|
void resultsRemoved( const Tomahawk::result_ptr& );
|
||||||
@@ -114,6 +120,8 @@ private slots:
|
|||||||
void refreshResults();
|
void refreshResults();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void setCurrentResolver( Tomahawk::Resolver* resolver );
|
||||||
|
|
||||||
void clearResults();
|
void clearResults();
|
||||||
void checkResults();
|
void checkResults();
|
||||||
|
|
||||||
@@ -122,7 +130,6 @@ private:
|
|||||||
bool m_playable;
|
bool m_playable;
|
||||||
bool m_resolveFinished;
|
bool m_resolveFinished;
|
||||||
mutable QID m_qid;
|
mutable QID m_qid;
|
||||||
unsigned int m_lastpipelineweight;
|
|
||||||
|
|
||||||
QString m_artist;
|
QString m_artist;
|
||||||
QString m_album;
|
QString m_album;
|
||||||
@@ -132,6 +139,9 @@ private:
|
|||||||
int m_duration;
|
int m_duration;
|
||||||
QString m_resultHint;
|
QString m_resultHint;
|
||||||
|
|
||||||
|
Tomahawk::source_ptr m_playedBy;
|
||||||
|
QList< QWeakPointer< Tomahawk::Resolver > > m_resolvers;
|
||||||
|
|
||||||
mutable QMutex m_mutex;
|
mutable QMutex m_mutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user