mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 13:47:26 +02:00
* Cleaned up QtScriptResolver and added vital debug output.
This commit is contained in:
@@ -68,14 +68,14 @@ QtScriptResolverHelper::compress( const QString& data )
|
|||||||
|
|
||||||
|
|
||||||
QString
|
QString
|
||||||
QtScriptResolverHelper::readCompressed(const QString& fileName)
|
QtScriptResolverHelper::readCompressed( const QString& fileName )
|
||||||
{
|
{
|
||||||
return compress( readRaw( fileName ) );
|
return compress( readRaw( fileName ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString
|
QString
|
||||||
QtScriptResolverHelper::readBase64(const QString& fileName)
|
QtScriptResolverHelper::readBase64( const QString& fileName )
|
||||||
{
|
{
|
||||||
return readRaw( fileName ).toBase64();
|
return readRaw( fileName ).toBase64();
|
||||||
}
|
}
|
||||||
@@ -91,7 +91,8 @@ QtScriptResolverHelper::resolverData()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void QtScriptResolverHelper::log(const QString& message)
|
void
|
||||||
|
QtScriptResolverHelper::log( const QString& message )
|
||||||
{
|
{
|
||||||
qDebug() << m_scriptPath << ":" << message;
|
qDebug() << m_scriptPath << ":" << message;
|
||||||
}
|
}
|
||||||
@@ -104,6 +105,14 @@ QtScriptResolverHelper::setResolverConfig( QVariantMap config )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
ScriptEngine::javaScriptConsoleMessage( const QString& message, int lineNumber, const QString& sourceID )
|
||||||
|
{
|
||||||
|
qDebug() << "JAVASCRIPT:" << m_scriptPath << message << lineNumber << sourceID;
|
||||||
|
Q_ASSERT( false );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QtScriptResolver::QtScriptResolver( const QString& scriptPath )
|
QtScriptResolver::QtScriptResolver( const QString& scriptPath )
|
||||||
: Tomahawk::ExternalResolver( scriptPath )
|
: Tomahawk::ExternalResolver( scriptPath )
|
||||||
, m_ready( false )
|
, m_ready( false )
|
||||||
@@ -118,7 +127,8 @@ QtScriptResolver::QtScriptResolver( const QString& scriptPath )
|
|||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO << "Failed loading JavaScript resolver:" << scriptPath;
|
qDebug() << Q_FUNC_INFO << "Failed loading JavaScript resolver:" << scriptPath;
|
||||||
m_error = Tomahawk::ExternalResolver::FileNotFound;
|
m_error = Tomahawk::ExternalResolver::FileNotFound;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
@@ -132,6 +142,7 @@ QtScriptResolver::~QtScriptResolver()
|
|||||||
delete m_engine;
|
delete m_engine;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
QtScriptResolver::reload()
|
QtScriptResolver::reload()
|
||||||
{
|
{
|
||||||
@@ -145,6 +156,7 @@ QtScriptResolver::reload()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
QtScriptResolver::init()
|
QtScriptResolver::init()
|
||||||
{
|
{
|
||||||
@@ -191,12 +203,14 @@ QtScriptResolver::init()
|
|||||||
Tomahawk::Pipeline::instance()->addResolver( this );
|
Tomahawk::Pipeline::instance()->addResolver( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Tomahawk::ExternalResolver::ErrorState
|
Tomahawk::ExternalResolver::ErrorState
|
||||||
QtScriptResolver::error() const
|
QtScriptResolver::error() const
|
||||||
{
|
{
|
||||||
return m_error;
|
return m_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
QtScriptResolver::resolve( const Tomahawk::query_ptr& query )
|
QtScriptResolver::resolve( const Tomahawk::query_ptr& query )
|
||||||
{
|
{
|
||||||
@@ -207,7 +221,7 @@ QtScriptResolver::resolve( const Tomahawk::query_ptr& query )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// qDebug() << Q_FUNC_INFO << query->toString();
|
qDebug() << Q_FUNC_INFO << "Resolving now with" << m_name << "-" << query->toString();
|
||||||
QString eval;
|
QString eval;
|
||||||
|
|
||||||
if ( !query->isFullTextQuery() )
|
if ( !query->isFullTextQuery() )
|
||||||
|
@@ -50,7 +50,7 @@ public slots:
|
|||||||
QString compress( const QString& data );
|
QString compress( const QString& data );
|
||||||
QVariantMap resolverData();
|
QVariantMap resolverData();
|
||||||
|
|
||||||
void log( const QString& message);
|
void log( const QString& message );
|
||||||
bool fakeEnv() { return false; }
|
bool fakeEnv() { return false; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -86,8 +86,7 @@ public slots:
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void javaScriptConsoleMessage( const QString & message, int lineNumber, const QString & sourceID )
|
virtual void javaScriptConsoleMessage( const QString& message, int lineNumber, const QString& sourceID );
|
||||||
{ qDebug() << "JAVASCRIPT:" << m_scriptPath << message << lineNumber << sourceID; Q_ASSERT(false);}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QtScriptResolver* m_parent;
|
QtScriptResolver* m_parent;
|
||||||
|
Reference in New Issue
Block a user