summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFriedrich W. H. Kossebau <kossebau@kde.org>2016-08-15 16:48:40 (GMT)
committerFriedrich W. H. Kossebau <kossebau@kde.org>2016-08-15 16:48:40 (GMT)
commit4eb9d675faba8cc872c13c8f6f611fc48364985f (patch)
tree27809ca7a8eebd81dfede78769f6ca83cc1cb343
parentebc5572a3f7b4fc4491f8950c75a934499708482 (diff)
Use more QStringLiteral for raw strings
-rw-r--r--src/lib/marble/declarative/DeclarativeDataPlugin.cpp10
-rw-r--r--src/lib/marble/declarative/DeclarativeDataPluginModel.cpp2
-rw-r--r--src/lib/marble/declarative/MarbleDeclarativeObject.cpp2
-rw-r--r--src/lib/marble/declarative/MarbleDeclarativePlugin.cpp25
-rw-r--r--src/lib/marble/declarative/MarbleQuickItem.cpp18
-rw-r--r--src/lib/marble/declarative/Navigation.cpp38
-rw-r--r--src/lib/marble/declarative/RouteRequestModel.cpp2
-rw-r--r--src/lib/marble/declarative/Routing.cpp16
-rw-r--r--src/lib/marble/declarative/SearchBackend.cpp2
9 files changed, 61 insertions, 54 deletions
diff --git a/src/lib/marble/declarative/DeclarativeDataPlugin.cpp b/src/lib/marble/declarative/DeclarativeDataPlugin.cpp
index 6c5a0f3..dfbecd0 100644
--- a/src/lib/marble/declarative/DeclarativeDataPlugin.cpp
+++ b/src/lib/marble/declarative/DeclarativeDataPlugin.cpp
@@ -60,7 +60,7 @@ public:
int DeclarativeDataPluginPrivate::m_global_counter = 0;
DeclarativeDataPluginPrivate::DeclarativeDataPluginPrivate( DeclarativeDataPlugin* parent ) :
- q( parent ), m_planet( "earth"), m_isInitialized( false ), m_delegate( 0 ), m_counter( m_global_counter )
+ q(parent), m_planet(QStringLiteral("earth")), m_isInitialized(false), m_delegate(0), m_counter(m_global_counter)
{
++m_global_counter;
}
@@ -202,7 +202,7 @@ void DeclarativeDataPlugin::setPlanet( const QString &planet )
QString DeclarativeDataPlugin::name() const
{
- return d->m_name.isEmpty() ? "Anonymous DeclarativeDataPlugin" : d->m_name;
+ return d->m_name.isEmpty() ? QStringLiteral("Anonymous DeclarativeDataPlugin") : d->m_name;
}
QString DeclarativeDataPlugin::guiString() const
@@ -212,12 +212,12 @@ QString DeclarativeDataPlugin::guiString() const
QString DeclarativeDataPlugin::nameId() const
{
- return d->m_nameId.isEmpty() ? QString( "DeclarativeDataPlugin_%1" ).arg( d->m_counter ) : d->m_nameId;
+ return d->m_nameId.isEmpty() ? QStringLiteral("DeclarativeDataPlugin_%1").arg(d->m_counter) : d->m_nameId;
}
QString DeclarativeDataPlugin::version() const
{
- return d->m_version.isEmpty() ? "1.0" : d->m_version;
+ return d->m_version.isEmpty() ? QStringLiteral("1.0") : d->m_version;
}
QString DeclarativeDataPlugin::description() const
@@ -351,7 +351,7 @@ bool DeclarativeDataPlugin::isInitialized() const
RenderState DeclarativeDataPlugin::renderState() const
{
- return RenderState( "Declarative Data" );
+ return RenderState(QStringLiteral("Declarative Data"));
}
void DeclarativeDataPlugin::setDeclarativeModel( const QVariant &model )
diff --git a/src/lib/marble/declarative/DeclarativeDataPluginModel.cpp b/src/lib/marble/declarative/DeclarativeDataPluginModel.cpp
index 6e1d283..cbfbc4d 100644
--- a/src/lib/marble/declarative/DeclarativeDataPluginModel.cpp
+++ b/src/lib/marble/declarative/DeclarativeDataPluginModel.cpp
@@ -17,7 +17,7 @@
using namespace Marble;
DeclarativeDataPluginModel::DeclarativeDataPluginModel( const MarbleModel *marbleModel, QObject *parent )
- : AbstractDataPluginModel( "QMLDataPluginModel", marbleModel, parent )
+ : AbstractDataPluginModel(QStringLiteral("QMLDataPluginModel"), marbleModel, parent)
{
// nothing to do
}
diff --git a/src/lib/marble/declarative/MarbleDeclarativeObject.cpp b/src/lib/marble/declarative/MarbleDeclarativeObject.cpp
index 233842f..fbb3fbc 100644
--- a/src/lib/marble/declarative/MarbleDeclarativeObject.cpp
+++ b/src/lib/marble/declarative/MarbleDeclarativeObject.cpp
@@ -45,7 +45,7 @@ QString MarbleDeclarativeObject::resolvePath(const QString &path) const
bool MarbleDeclarativeObject::canExecute(const QString &program) const
{
- QString path = QProcessEnvironment::systemEnvironment().value( "PATH", "/usr/local/bin:/usr/bin:/bin" );
+ QString path = QProcessEnvironment::systemEnvironment().value(QStringLiteral("PATH"), QStringLiteral("/usr/local/bin:/usr/bin:/bin"));
foreach( const QString &dir, path.split( QLatin1Char( ':' ) ) ) {
QFileInfo const executable( QDir( dir ), program );
if ( executable.exists() && executable.isExecutable() ) {
diff --git a/src/lib/marble/declarative/MarbleDeclarativePlugin.cpp b/src/lib/marble/declarative/MarbleDeclarativePlugin.cpp
index e7c9a02..afe6b89 100644
--- a/src/lib/marble/declarative/MarbleDeclarativePlugin.cpp
+++ b/src/lib/marble/declarative/MarbleDeclarativePlugin.cpp
@@ -64,20 +64,27 @@ void MarbleDeclarativePlugin::registerTypes( const char *uri )
qRegisterMetaType<Marble::MarblePlacemarkModel*>("MarblePlacemarkModel*");
qmlRegisterType<Marble::MarbleQuickItem>(uri, 0, 20, "MarbleItem");
- qmlRegisterUncreatableType<Marble::MarblePlacemarkModel>(uri, 1, 0, "MarblePlacemarkModel", "MarblePlacemarkModel is not instantiable");
- qmlRegisterUncreatableType<Marble::RoutingModel>(uri, 0, 20, "RoutingModel", "RoutingModel is not instantiable");
- qmlRegisterUncreatableType<Marble::BookmarksModel>( uri, 0, 20, "BookmarksModel", "Do not create" );
- qmlRegisterUncreatableType<Marble::AbstractFloatItem>( uri, 0, 20, "FloatItem", "Do not create" );
- qmlRegisterUncreatableType<Marble::RenderPlugin>( uri, 0, 20, "RenderPlugin", "Do not create" );
- qmlRegisterUncreatableType<Marble::MarbleMap>( uri, 0, 20, "MarbleMap", "Do not create" );
+ qmlRegisterUncreatableType<Marble::MarblePlacemarkModel>(uri, 1, 0, "MarblePlacemarkModel",
+ QStringLiteral("MarblePlacemarkModel is not instantiable"));
+ qmlRegisterUncreatableType<Marble::RoutingModel>(uri, 0, 20, "RoutingModel",
+ QStringLiteral("RoutingModel is not instantiable"));
+ qmlRegisterUncreatableType<Marble::BookmarksModel>(uri, 0, 20, "BookmarksModel",
+ QStringLiteral("Do not create"));
+ qmlRegisterUncreatableType<Marble::AbstractFloatItem>(uri, 0, 20, "FloatItem",
+ QStringLiteral("Do not create"));
+ qmlRegisterUncreatableType<Marble::RenderPlugin>(uri, 0, 20, "RenderPlugin",
+ QStringLiteral("Do not create"));
+ qmlRegisterUncreatableType<Marble::MarbleMap>(uri, 0, 20, "MarbleMap",
+ QStringLiteral("Do not create"));
}
void MarbleDeclarativePlugin::initializeEngine( QQmlEngine *engine, const char *)
{
- engine->addImageProvider( "maptheme", new MapThemeImageProvider );
+ engine->addImageProvider(QStringLiteral("maptheme"), new MapThemeImageProvider );
// Register the global Marble object. Can be used in .qml files for requests like Marble.resolvePath("some/icon.png")
- if ( !engine->rootContext()->contextProperty( "Marble").isValid() ) {
- engine->rootContext()->setContextProperty( "Marble", new MarbleDeclarativeObject( this ) );
+ const QString marbleObjectName = QStringLiteral("Marble");
+ if (!engine->rootContext()->contextProperty(marbleObjectName).isValid()) {
+ engine->rootContext()->setContextProperty(marbleObjectName, new MarbleDeclarativeObject(this));
}
}
diff --git a/src/lib/marble/declarative/MarbleQuickItem.cpp b/src/lib/marble/declarative/MarbleQuickItem.cpp
index b9e0a50..11ce7d7 100644
--- a/src/lib/marble/declarative/MarbleQuickItem.cpp
+++ b/src/lib/marble/declarative/MarbleQuickItem.cpp
@@ -906,27 +906,27 @@ namespace Marble
void MarbleQuickItem::loadSettings()
{
QSettings settings;
- settings.beginGroup("MarbleQuickItem");
- double lon = settings.value("centerLon", QVariant(0.0)).toDouble();
- double lat = settings.value("centerLat", QVariant(0.0)).toDouble();
+ settings.beginGroup(QStringLiteral("MarbleQuickItem"));
+ double lon = settings.value(QStringLiteral("centerLon"), QVariant(0.0)).toDouble();
+ double lat = settings.value(QStringLiteral("centerLat"), QVariant(0.0)).toDouble();
centerOn(lon, lat);
- int const zoom = settings.value("zoom", QVariant(0)).toInt();
+ int const zoom = settings.value(QStringLiteral("zoom"), QVariant(0)).toInt();
if (zoom > 0) {
setZoom(zoom);
}
settings.endGroup();
d->m_model.routingManager()->readSettings();
- d->m_model.bookmarkManager()->loadFile( "bookmarks/bookmarks.kml" );
+ d->m_model.bookmarkManager()->loadFile(QStringLiteral("bookmarks/bookmarks.kml"));
d->m_model.bookmarkManager()->setShowBookmarks(true);
}
void MarbleQuickItem::writeSettings()
{
QSettings settings;
- settings.beginGroup("MarbleQuickItem");
- settings.setValue("centerLon", QVariant(d->m_map.centerLongitude()));
- settings.setValue("centerLat", QVariant(d->m_map.centerLatitude()));
- settings.setValue("zoom", QVariant(zoom()));
+ settings.beginGroup(QStringLiteral("MarbleQuickItem"));
+ settings.setValue(QStringLiteral("centerLon"), QVariant(d->m_map.centerLongitude()));
+ settings.setValue(QStringLiteral("centerLat"), QVariant(d->m_map.centerLatitude()));
+ settings.setValue(QStringLiteral("zoom"), QVariant(zoom()));
settings.endGroup();
d->m_model.routingManager()->writeSettings();
}
diff --git a/src/lib/marble/declarative/Navigation.cpp b/src/lib/marble/declarative/Navigation.cpp
index 78ffc79..bc445ea 100644
--- a/src/lib/marble/declarative/Navigation.cpp
+++ b/src/lib/marble/declarative/Navigation.cpp
@@ -167,26 +167,26 @@ QString Navigation::nextRoad() const
QString Navigation::nextInstructionImage() const
{
switch ( d->nextRouteSegment().maneuver().direction() ) {
- case Maneuver::Unknown: return "";
- case Maneuver::Continue: return "qrc:/marble/turn-continue.svg";
- case Maneuver::Merge: return "qrc:/marble/turn-merge.svg";
- case Maneuver::Straight: return "qrc:/marble/turn-continue.svg";
- case Maneuver::SlightRight: return "qrc:/marble/turn-slight-right.svg";
- case Maneuver::Right: return "qrc:/marble/turn-right.svg";
- case Maneuver::SharpRight: return "qrc:/marble/turn-sharp-right.svg";
- case Maneuver::TurnAround: return "qrc:/marble/turn-around.svg";
- case Maneuver::SharpLeft: return "qrc:/marble/turn-sharp-left.svg";
- case Maneuver::Left: return "qrc:/marble/turn-left.svg";
- case Maneuver::SlightLeft: return "qrc:/marble/turn-slight-left.svg";
- case Maneuver::RoundaboutFirstExit: return "qrc:/marble/turn-roundabout-first.svg";
- case Maneuver::RoundaboutSecondExit: return "qrc:/marble/turn-roundabout-second.svg";
- case Maneuver::RoundaboutThirdExit: return "qrc:/marble/turn-roundabout-third.svg";
- case Maneuver::RoundaboutExit: return "qrc:/marble/turn-roundabout-far.svg";
- case Maneuver::ExitLeft: return "qrc:/marble/turn-exit-left.svg";
- case Maneuver::ExitRight: return "qrc:/marble/turn-exit-right.svg";
+ case Maneuver::Continue: return QStringLiteral("qrc:/marble/turn-continue.svg");
+ case Maneuver::Merge: return QStringLiteral("qrc:/marble/turn-merge.svg");
+ case Maneuver::Straight: return QStringLiteral("qrc:/marble/turn-continue.svg");
+ case Maneuver::SlightRight: return QStringLiteral("qrc:/marble/turn-slight-right.svg");
+ case Maneuver::Right: return QStringLiteral("qrc:/marble/turn-right.svg");
+ case Maneuver::SharpRight: return QStringLiteral("qrc:/marble/turn-sharp-right.svg");
+ case Maneuver::TurnAround: return QStringLiteral("qrc:/marble/turn-around.svg");
+ case Maneuver::SharpLeft: return QStringLiteral("qrc:/marble/turn-sharp-left.svg");
+ case Maneuver::Left: return QStringLiteral("qrc:/marble/turn-left.svg");
+ case Maneuver::SlightLeft: return QStringLiteral("qrc:/marble/turn-slight-left.svg");
+ case Maneuver::RoundaboutFirstExit: return QStringLiteral("qrc:/marble/turn-roundabout-first.svg");
+ case Maneuver::RoundaboutSecondExit: return QStringLiteral("qrc:/marble/turn-roundabout-second.svg");
+ case Maneuver::RoundaboutThirdExit: return QStringLiteral("qrc:/marble/turn-roundabout-third.svg");
+ case Maneuver::RoundaboutExit: return QStringLiteral("qrc:/marble/turn-roundabout-far.svg");
+ case Maneuver::ExitLeft: return QStringLiteral("qrc:/marble/turn-exit-left.svg");
+ case Maneuver::ExitRight: return QStringLiteral("qrc:/marble/turn-exit-right.svg");
+ case Maneuver::Unknown:
+ default:
+ return QString();
}
-
- return "";
}
qreal Navigation::nextInstructionDistance() const
diff --git a/src/lib/marble/declarative/RouteRequestModel.cpp b/src/lib/marble/declarative/RouteRequestModel.cpp
index d85690d..81d8709 100644
--- a/src/lib/marble/declarative/RouteRequestModel.cpp
+++ b/src/lib/marble/declarative/RouteRequestModel.cpp
@@ -51,7 +51,7 @@ QHash<int, QByteArray> RouteRequestModel::roleNames() const
QVariant RouteRequestModel::headerData ( int section, Qt::Orientation orientation, int role ) const
{
if ( orientation == Qt::Horizontal && role == Qt::DisplayRole && section == 0 ) {
- return QString( "Waypoint" );
+ return QStringLiteral("Waypoint");
}
return QVariant();
diff --git a/src/lib/marble/declarative/Routing.cpp b/src/lib/marble/declarative/Routing.cpp
index 4029bb0..f17e609 100644
--- a/src/lib/marble/declarative/Routing.cpp
+++ b/src/lib/marble/declarative/Routing.cpp
@@ -156,16 +156,16 @@ void Routing::updateWaypointItems()
item->setProperty("xPos", QVariant::fromValue(x));
item->setProperty("yPos", QVariant::fromValue(y));
if (iter.key() == 0 && waypointCount() == 1) {
- item->setProperty("type", QVariant::fromValue(QString("departure")));
+ item->setProperty("type", QVariant(QStringLiteral("departure")));
}
else if (iter.key() == d->m_waypointItems.keys().size()-1) {
- item->setProperty("type", QVariant::fromValue(QString("destination")));
+ item->setProperty("type", QVariant(QStringLiteral("destination")));
}
else if (iter.key() > 0) {
- item->setProperty("type", QVariant::fromValue(QString("waypoint")));
+ item->setProperty("type", QVariant(QStringLiteral("waypoint")));
}
else {
- item->setProperty("type", QVariant::fromValue(QString("departure")));
+ item->setProperty("type", QVariant(QStringLiteral("departure")));
}
}
}
@@ -213,7 +213,7 @@ void Routing::updateSearchResultPlacemarks()
if ( item ) {
item->setParentItem( this );
item->setProperty("index", i);
- item->setProperty("type", QVariant::fromValue(QString("searchResult")));
+ item->setProperty("type", QVariant(QStringLiteral("searchResult")));
item->setProperty("placemark", QVariant::fromValue(d->m_searchResultPlacemarks[i]));
d->m_searchResultItems[i] = item;
} else {
@@ -276,9 +276,9 @@ void Routing::setMarbleMap( MarbleMap* marbleMap )
QList<Marble::RoutingProfile> profiles = routingManager->profilesModel()->profiles();
if ( profiles.size() == 4 ) {
/** @todo FIXME: Restrictive assumptions on available plugins and certain profile loading implementation */
- d->m_profiles["Motorcar"] = profiles.at( 0 );
- d->m_profiles["Bicycle"] = profiles.at( 2 );
- d->m_profiles["Pedestrian"] = profiles.at( 3 );
+ d->m_profiles[QStringLiteral("Motorcar")] = profiles.at( 0 );
+ d->m_profiles[QStringLiteral("Bicycle")] = profiles.at( 2 );
+ d->m_profiles[QStringLiteral("Pedestrian")] = profiles.at( 3 );
} else {
qDebug() << "Unexpected size of default routing profiles: " << profiles.size();
}
diff --git a/src/lib/marble/declarative/SearchBackend.cpp b/src/lib/marble/declarative/SearchBackend.cpp
index 7077d4e..730ab5f 100644
--- a/src/lib/marble/declarative/SearchBackend.cpp
+++ b/src/lib/marble/declarative/SearchBackend.cpp
@@ -51,7 +51,7 @@ void SearchBackend::setCompletionPrefix(const QString &prefix)
return;
}
- m_completionModel->removePlacemarks(QString("Completion model"), 0, m_completionModel->rowCount());
+ m_completionModel->removePlacemarks(QStringLiteral("Completion model"), 0, m_completionModel->rowCount());
m_completionContainer->clear();
QString const lastPrefix = m_completer->completionPrefix();
m_completer->setCompletionPrefix(prefix);