mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 05:37:29 +02:00
receive icon directly from resolvers
Dont let external resolvers send a (probably faulty) path to an image file, but receive the image itself directly. This is consistent with the way the config _msgtype works, so comression is supported, too.
This commit is contained in:
@@ -326,15 +326,21 @@ QtScriptResolver::init()
|
|||||||
m_name = m.value( "name" ).toString();
|
m_name = m.value( "name" ).toString();
|
||||||
m_weight = m.value( "weight", 0 ).toUInt();
|
m_weight = m.value( "weight", 0 ).toUInt();
|
||||||
m_timeout = m.value( "timeout", 25 ).toUInt() * 1000;
|
m_timeout = m.value( "timeout", 25 ).toUInt() * 1000;
|
||||||
QString iconPath = QFileInfo( filePath() ).path() + "/" + m.value( "icon" ).toString();
|
bool compressed = m.value( "compressed", "false" ).toString() == "true";
|
||||||
int success = m_icon.load( iconPath );
|
|
||||||
|
QByteArray icoData = m.value( "icon" ).toByteArray();
|
||||||
|
if( compressed )
|
||||||
|
icoData = qUncompress( QByteArray::fromBase64( icoData ) );
|
||||||
|
else
|
||||||
|
icoData = QByteArray::fromBase64( icoData );
|
||||||
|
bool success = m_icon.loadFromData( icoData );
|
||||||
|
|
||||||
// load config widget and apply settings
|
// load config widget and apply settings
|
||||||
loadUi();
|
loadUi();
|
||||||
QVariantMap config = resolverUserConfig();
|
QVariantMap config = resolverUserConfig();
|
||||||
fillDataInWidgets( config );
|
fillDataInWidgets( config );
|
||||||
|
|
||||||
qDebug() << "JS" << filePath() << "READY," << "name" << m_name << "weight" << m_weight << "timeout" << m_timeout << "icon" << iconPath << "icon found" << success;
|
qDebug() << "JS" << filePath() << "READY," << "name" << m_name << "weight" << m_weight << "timeout" << m_timeout << "icon found" << success;
|
||||||
|
|
||||||
m_ready = true;
|
m_ready = true;
|
||||||
}
|
}
|
||||||
|
@@ -376,10 +376,16 @@ ScriptResolver::doSetup( const QVariantMap& m )
|
|||||||
m_name = m.value( "name" ).toString();
|
m_name = m.value( "name" ).toString();
|
||||||
m_weight = m.value( "weight", 0 ).toUInt();
|
m_weight = m.value( "weight", 0 ).toUInt();
|
||||||
m_timeout = m.value( "timeout", 5 ).toUInt() * 1000;
|
m_timeout = m.value( "timeout", 5 ).toUInt() * 1000;
|
||||||
QString iconPath = QFileInfo( filePath() ).path() + "/" + m.value( "icon" ).toString();
|
bool compressed = m.value( "compressed", "false" ).toString() == "true";
|
||||||
int success = m_icon.load( iconPath );
|
|
||||||
|
|
||||||
qDebug() << "SCRIPT" << filePath() << "READY," << "name" << m_name << "weight" << m_weight << "timeout" << m_timeout << "icon" << iconPath << "icon found" << success;
|
QByteArray icoData = m.value( "icon" ).toByteArray();
|
||||||
|
if( compressed )
|
||||||
|
icoData = qUncompress( QByteArray::fromBase64( icoData ) );
|
||||||
|
else
|
||||||
|
icoData = QByteArray::fromBase64( icoData );
|
||||||
|
bool success = m_icon.loadFromData( icoData );
|
||||||
|
|
||||||
|
qDebug() << "SCRIPT" << filePath() << "READY," << "name" << m_name << "weight" << m_weight << "timeout" << m_timeout << "icon found" << success;
|
||||||
|
|
||||||
m_ready = true;
|
m_ready = true;
|
||||||
m_configSent = false;
|
m_configSent = false;
|
||||||
|
Reference in New Issue
Block a user