1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-20 15:59:42 +01:00

Merge pull request #144 from crabmanX/resolverIcon

receive icon directly from resolvers
This commit is contained in:
Leo Franchi 2013-01-03 19:02:00 -08:00
commit 9f99156f83
2 changed files with 18 additions and 6 deletions

View File

@ -326,15 +326,21 @@ QtScriptResolver::init()
m_name = m.value( "name" ).toString();
m_weight = m.value( "weight", 0 ).toUInt();
m_timeout = m.value( "timeout", 25 ).toUInt() * 1000;
QString iconPath = QFileInfo( filePath() ).path() + "/" + m.value( "icon" ).toString();
int success = m_icon.load( iconPath );
bool compressed = m.value( "compressed", "false" ).toString() == "true";
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
loadUi();
QVariantMap config = resolverUserConfig();
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;
}

View File

@ -376,10 +376,16 @@ ScriptResolver::doSetup( const QVariantMap& m )
m_name = m.value( "name" ).toString();
m_weight = m.value( "weight", 0 ).toUInt();
m_timeout = m.value( "timeout", 5 ).toUInt() * 1000;
QString iconPath = QFileInfo( filePath() ).path() + "/" + m.value( "icon" ).toString();
int success = m_icon.load( iconPath );
bool compressed = m.value( "compressed", "false" ).toString() == "true";
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_configSent = false;