From ae6f17af0c15ec3d9907a4ba9ca8846dbb0e2721 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Thu, 9 May 2019 21:43:18 +0200 Subject: 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 --- map-widget/qmlmapwidgethelper.cpp | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) (limited to 'map-widget') 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); } -- cgit v1.2.3-70-g09d2