mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Cleanup: construct MapWidgetHelper::pluginObject()
Instead of multiple string-concatenations, create the string object from a single string literal. Yes, this is a mostly pointless "optimization". But it saves a few bytes. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
44c65fec88
commit
ae6f17af0c
1 changed files with 14 additions and 18 deletions
|
@ -244,23 +244,19 @@ void MapWidgetHelper::enterEditMode()
|
||||||
|
|
||||||
QString MapWidgetHelper::pluginObject()
|
QString MapWidgetHelper::pluginObject()
|
||||||
{
|
{
|
||||||
QString str;
|
|
||||||
str += "import QtQuick 2.0;";
|
|
||||||
str += "import QtLocation 5.3;";
|
|
||||||
str += "Plugin {";
|
|
||||||
str += " id: mapPlugin;";
|
|
||||||
str += " name: 'googlemaps';";
|
|
||||||
str += " PluginParameter { name: 'googlemaps.maps.language'; value: '%lang%' }";
|
|
||||||
str += " PluginParameter { name: 'googlemaps.cachefolder'; value: '%cacheFolder%' }";
|
|
||||||
str += " Component.onCompleted: {";
|
|
||||||
str += " if (availableServiceProviders.indexOf(name) === -1) {";
|
|
||||||
str += " console.warn('MapWidget.qml: cannot find a plugin named: ' + name);";
|
|
||||||
str += " }";
|
|
||||||
str += " }";
|
|
||||||
str += "}";
|
|
||||||
QString lang = uiLanguage(NULL).replace('_', '-');
|
QString lang = uiLanguage(NULL).replace('_', '-');
|
||||||
str.replace("%lang%", lang);
|
QString cacheFolder = QString(system_default_directory()).append("/googlemaps").replace("\\", "/");
|
||||||
QString cacheFolder = QString(system_default_directory()).append("/googlemaps");
|
return QStringLiteral("import QtQuick 2.0;"
|
||||||
str.replace("%cacheFolder%", cacheFolder.replace("\\", "/"));
|
"import QtLocation 5.3;"
|
||||||
return str;
|
"Plugin {"
|
||||||
|
" id: mapPlugin;"
|
||||||
|
" name: 'googlemaps';"
|
||||||
|
" PluginParameter { name: 'googlemaps.maps.language'; value: '%1' }"
|
||||||
|
" PluginParameter { name: 'googlemaps.cachefolder'; value: '%2' }"
|
||||||
|
" Component.onCompleted: {"
|
||||||
|
" if (availableServiceProviders.indexOf(name) === -1) {"
|
||||||
|
" console.warn('MapWidget.qml: cannot find a plugin named: ' + name);"
|
||||||
|
" }"
|
||||||
|
" }"
|
||||||
|
"}").arg(lang, cacheFolder);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue