diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2019-05-09 21:43:18 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-05-11 12:06:19 -0700 |
commit | ae6f17af0c15ec3d9907a4ba9ca8846dbb0e2721 (patch) | |
tree | 5cea7a91f23cc8241735510c8f2d4671594a4f33 /map-widget/qmlmapwidgethelper.cpp | |
parent | 44c65fec8855315d322b84b4c4207713b90328d3 (diff) | |
download | subsurface-ae6f17af0c15ec3d9907a4ba9ca8846dbb0e2721.tar.gz |
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>
Diffstat (limited to 'map-widget/qmlmapwidgethelper.cpp')
-rw-r--r-- | map-widget/qmlmapwidgethelper.cpp | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/map-widget/qmlmapwidgethelper.cpp b/map-widget/qmlmapwidgethelper.cpp index 7d752cc63..96db063ae 100644 --- a/map-widget/qmlmapwidgethelper.cpp +++ b/map-widget/qmlmapwidgethelper.cpp @@ -244,23 +244,19 @@ void MapWidgetHelper::enterEditMode() 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('_', '-'); - str.replace("%lang%", lang); - QString cacheFolder = QString(system_default_directory()).append("/googlemaps"); - str.replace("%cacheFolder%", cacheFolder.replace("\\", "/")); - return str; + QString cacheFolder = QString(system_default_directory()).append("/googlemaps").replace("\\", "/"); + return QStringLiteral("import QtQuick 2.0;" + "import QtLocation 5.3;" + "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); } |