From 0501ab1e2b7e6cc03b2b09289f333d56dd88bcc9 Mon Sep 17 00:00:00 2001 From: Anton Romanov Date: Thu, 10 Sep 2015 16:34:53 -0700 Subject: [PATCH] [0.9 api]Support non-relative icon paths --- src/libtomahawk/resolvers/ScriptCollection.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/libtomahawk/resolvers/ScriptCollection.cpp b/src/libtomahawk/resolvers/ScriptCollection.cpp index 80fc46b05..57a89bd12 100644 --- a/src/libtomahawk/resolvers/ScriptCollection.cpp +++ b/src/libtomahawk/resolvers/ScriptCollection.cpp @@ -252,6 +252,20 @@ ScriptCollection::parseMetaData( const QVariantMap& metadata ) bool ok = iconPixmap.load( iconPath ); if ( ok && !iconPixmap.isNull() ) setIcon( iconPixmap ); + else + { + //see if it is a new way of specifying path + //like "contents/images/icon.png" + iconPath = QFileInfo( scriptAccount()->filePath() ).path(); + for(int i = 0; i < 3 && !ok ; ++i) + { + iconPath += "/../"; + ok = iconPixmap.load(iconPath + metadata.value("iconfile").toString()); + } + + if ( ok && !iconPixmap.isNull() ) + setIcon( iconPixmap ); + } fetchIcon( metadata.value( "iconurl" ).toString() ); }