Commit 4eb9d675 authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau
Browse files

Use more QStringLiteral for raw strings

parent ebc5572a
......@@ -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 )
......
......@@ -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
}
......
......@@ -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() ) {
......
......@@ -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));
}
}
......
......@@ -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();
}
......
......@@ -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
......
......@@ -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();
......
......@@ -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();
}
......
......@@ -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);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment