1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-30 09:10:53 +02:00

Pass UrlType to canParse

This commit is contained in:
Uwe L. Korn
2013-07-07 21:38:29 +02:00
parent 65e1c530cf
commit 4fec697d83
5 changed files with 8 additions and 7 deletions

View File

@@ -100,7 +100,7 @@ public:
virtual QMap< QString, Tomahawk::collection_ptr > collections() { return m_collections; } virtual QMap< QString, Tomahawk::collection_ptr > collections() { return m_collections; }
// UrlLookup, sync call // UrlLookup, sync call
virtual bool canParseUrl( const QString& url ) = 0; virtual bool canParseUrl( const QString& url, UrlType type ) = 0;
virtual void enqueue( const QSharedPointer< ScriptCommand >& req ) virtual void enqueue( const QSharedPointer< ScriptCommand >& req )
{ m_commandQueue->enqueue( req ); } { m_commandQueue->enqueue( req ); }

View File

@@ -424,7 +424,7 @@ JSResolver::tracks( const Tomahawk::collection_ptr& collection, const Tomahawk::
tDebug() << errorMessage << m; tDebug() << errorMessage << m;
} }
bool JSResolver::canParseUrl( const QString& url ) bool JSResolver::canParseUrl( const QString& url, UrlType type )
{ {
Q_D( JSResolver ); Q_D( JSResolver );
@@ -438,8 +438,9 @@ bool JSResolver::canParseUrl( const QString& url )
if ( d->capabilities.testFlag( UrlLookup ) ) if ( d->capabilities.testFlag( UrlLookup ) )
{ {
QString eval = QString( "resolver.canParseUrl( '%1' );" ) QString eval = QString( "resolver.canParseUrl( '%1', %2 );" )
.arg( QString( url ).replace( "'", "\\'" ) ); .arg( QString( url ).replace( "'", "\\'" ) )
.arg( (int) type );
return d->engine->mainFrame()->evaluateJavaScript( eval ).toBool(); return d->engine->mainFrame()->evaluateJavaScript( eval ).toBool();
} }
else else

View File

@@ -58,7 +58,7 @@ public:
virtual void setIcon( const QPixmap& icon ); virtual void setIcon( const QPixmap& icon );
virtual bool canParseUrl( const QString& url ); virtual bool canParseUrl( const QString& url, UrlType type );
public slots: public slots:
virtual void resolve( const Tomahawk::query_ptr& query ); virtual void resolve( const Tomahawk::query_ptr& query );

View File

@@ -64,7 +64,7 @@ public:
void sendMessage( const QVariantMap& map ); void sendMessage( const QVariantMap& map );
virtual bool canParseUrl( const QString& ) { return false; } virtual bool canParseUrl( const QString&, UrlType ) { return false; }
signals: signals:
void terminated(); void terminated();

View File

@@ -839,7 +839,7 @@ TomahawkApp::loadUrl( const QString& url )
QList< QPointer< ExternalResolver > > possibleResolvers; QList< QPointer< ExternalResolver > > possibleResolvers;
foreach ( QPointer<ExternalResolver> resolver, Pipeline::instance()->scriptResolvers() ) foreach ( QPointer<ExternalResolver> resolver, Pipeline::instance()->scriptResolvers() )
{ {
if ( resolver->canParseUrl( url ) ) if ( resolver->canParseUrl( url, ExternalResolver::Any ) )
{ {
canParse = true; canParse = true;
possibleResolvers << resolver; possibleResolvers << resolver;