summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFriedrich W. H. Kossebau <kossebau@kde.org>2016-08-25 18:11:22 (GMT)
committerFriedrich W. H. Kossebau <kossebau@kde.org>2016-08-25 18:11:22 (GMT)
commit39d2b3d5e31425813c1ac0e159325bc70f397665 (patch)
tree0a79af2bf1c1fa864d45deb0c70fe99ca6c0f3aa
parent2192d61c101bee9da808005398bc9f7fd1f2e38c (diff)
Use QLatin1String with QString::contains/startsWith/endsWith/indexOf/compare
-rw-r--r--src/lib/marble/MapWizard.cpp8
-rw-r--r--src/lib/marble/MarbleDirs.cpp6
-rw-r--r--src/lib/marble/MarbleLegendBrowser.cpp3
-rw-r--r--src/lib/marble/MovieCapture.cpp2
-rw-r--r--src/lib/marble/cloudsync/CloudSyncManager.cpp4
-rw-r--r--src/lib/marble/cloudsync/OwncloudSyncBackend.cpp2
-rw-r--r--src/lib/marble/declarative/OfflineDataModel.cpp6
-rw-r--r--src/lib/marble/geodata/handlers/dgml/DgmlBrushTagHandler.cpp2
-rw-r--r--src/plugins/render/annotate/AnnotatePlugin.cpp4
-rw-r--r--src/plugins/render/panoramio/PanoramioParser.cpp28
-rw-r--r--src/plugins/render/weather/BBCParser.cpp15
-rw-r--r--src/plugins/render/wikipedia/GeonamesParser.cpp2
-rw-r--r--src/plugins/runner/kml/KmzHandler.cpp2
-rw-r--r--src/plugins/runner/pn2/Pn2Runner.cpp2
-rw-r--r--src/plugins/runner/pnt/PntRunner.cpp2
-rw-r--r--src/plugins/runner/shp/ShpRunner.cpp2
-rw-r--r--tools/speaker-files/main.cpp2
17 files changed, 47 insertions, 45 deletions
diff --git a/src/lib/marble/MapWizard.cpp b/src/lib/marble/MapWizard.cpp
index af7dbdc..83727e9 100644
--- a/src/lib/marble/MapWizard.cpp
+++ b/src/lib/marble/MapWizard.cpp
@@ -138,7 +138,7 @@ PreviewDialog::PreviewDialog( QWidget* parent, const QString& mapThemeId ) : QDi
void PreviewDialog::closeEvent(QCloseEvent* e)
{
const QString dgmlPath = MarbleDirs::localPath() + QLatin1String("/maps/") + m_mapThemeId;
- QString directory = dgmlPath.left( dgmlPath.lastIndexOf("/") );
+ const QString directory = dgmlPath.left(dgmlPath.lastIndexOf(QLatin1Char('/')));
this->deleteTheme( directory );
QDialog::closeEvent( e );
}
@@ -474,9 +474,9 @@ void MapWizard::downloadLevelZero()
QString server = d->uiWidget.comboBoxStaticUrlServer->currentText();
QUrl downloadUrl;
- server.replace( server.indexOf( "{x}" ), 3, QString::number( 0 ) );
- server.replace( server.indexOf( "{y}" ), 3, QString::number( 0 ) );
- server.replace( server.indexOf( "{zoomLevel}" ), 11, QString::number( 0 ) );
+ server.replace(server.indexOf(QLatin1String("{x}")), 3, QString::number(0));
+ server.replace(server.indexOf(QLatin1String("{y}")), 3, QString::number(0));
+ server.replace(server.indexOf(QLatin1String("{zoomLevel}")), 11, QString::number(0));
downloadUrl.setUrl( server );
QNetworkRequest request( downloadUrl );
diff --git a/src/lib/marble/MarbleDirs.cpp b/src/lib/marble/MarbleDirs.cpp
index 0cd265c..76ed565 100644
--- a/src/lib/marble/MarbleDirs.cpp
+++ b/src/lib/marble/MarbleDirs.cpp
@@ -143,8 +143,7 @@ QString MarbleDirs::systemPath()
CFRelease(myMacPath);
//do some magick so that we can still find data dir if
//marble was not built as a bundle
- if (myPath.contains(".app")) //its a bundle!
- {
+ if (myPath.contains(QLatin1String(".app"))) { //its a bundle!
systempath = myPath + QLatin1String("/Contents/Resources/data");
}
@@ -197,8 +196,7 @@ QString MarbleDirs::pluginSystemPath()
QString myPath(mypPathPtr);
//do some magick so that we can still find data dir if
//marble was not built as a bundle
- if (myPath.contains(".app")) //its a bundle!
- {
+ if (myPath.contains(QLatin1String(".app"))) { //its a bundle!
systempath = myPath + QLatin1String("/Contents/Resources/plugins");
}
diff --git a/src/lib/marble/MarbleLegendBrowser.cpp b/src/lib/marble/MarbleLegendBrowser.cpp
index 853033f..c83a7fc 100644
--- a/src/lib/marble/MarbleLegendBrowser.cpp
+++ b/src/lib/marble/MarbleLegendBrowser.cpp
@@ -241,7 +241,8 @@ QString MarbleLegendBrowser::readHtml( const QUrl & name )
void MarbleLegendBrowser::translateHtml( QString & html )
{
// must match string extraction in Messages.sh
- QString s = html.remove( 0, html.indexOf( "<body>" ) );
+ // TODO: html.remove also changes html, is that intended?
+ QString s = html.remove(0, html.indexOf(QLatin1String("<body>")));
QRegExp rx( "</?\\w+((\\s+\\w+(\\s*=\\s*(?:\".*\"|'.*'|[^'\">\\s]+))?)+\\s*|\\s*)/?>" );
rx.setMinimal( true );
s.replace( rx, "\n" );
diff --git a/src/lib/marble/MovieCapture.cpp b/src/lib/marble/MovieCapture.cpp
index 962414b..4fec336 100644
--- a/src/lib/marble/MovieCapture.cpp
+++ b/src/lib/marble/MovieCapture.cpp
@@ -122,7 +122,7 @@ QVector<MovieFormat> MovieCapture::availableFormats()
encoder.start( d->encoderExec, args );
encoder.waitForFinished();
QString output = encoder.readAll();
- bool isFormatAvailable = !output.contains( "Unknown format" );
+ bool isFormatAvailable = !output.contains(QLatin1String("Unknown format"));
if( isFormatAvailable ) {
availableFormats << format;
}
diff --git a/src/lib/marble/cloudsync/CloudSyncManager.cpp b/src/lib/marble/cloudsync/CloudSyncManager.cpp
index 1fa28a1..c496b87 100644
--- a/src/lib/marble/cloudsync/CloudSyncManager.cpp
+++ b/src/lib/marble/cloudsync/CloudSyncManager.cpp
@@ -126,10 +126,10 @@ void CloudSyncManager::setOwncloudServer( const QString &server )
QString const oldProtocol = d->m_owncloudProtocol;
QString const oldServer = d->m_ownloudServer;
- if ( server.startsWith( "http://" ) ) {
+ if (server.startsWith(QLatin1String("http://"))) {
d->m_owncloudProtocol = "http://";
d->m_ownloudServer = server.mid( 7 );
- } else if ( server.startsWith( "https://" ) ) {
+ } else if (server.startsWith(QLatin1String("https://"))) {
d->m_owncloudProtocol = "https://";
d->m_ownloudServer = server.mid ( 8 );
} else {
diff --git a/src/lib/marble/cloudsync/OwncloudSyncBackend.cpp b/src/lib/marble/cloudsync/OwncloudSyncBackend.cpp
index e7a77f4..eaa8543 100644
--- a/src/lib/marble/cloudsync/OwncloudSyncBackend.cpp
+++ b/src/lib/marble/cloudsync/OwncloudSyncBackend.cpp
@@ -315,7 +315,7 @@ void OwncloudSyncBackend::checkAuthReply()
if (!result.startsWith(QLatin1Char('{'))) {
// not a JSON result
- if ( result.contains("http://owncloud.org") ) {
+ if (result.contains(QLatin1String("http://owncloud.org"))) {
// an owncloud login page was returned, marble app is not installed
d->m_cloudSyncManager->setStatus( tr( "The Marble app is not installed on the ownCloud server" ), CloudSyncManager::Error);
} else {
diff --git a/src/lib/marble/declarative/OfflineDataModel.cpp b/src/lib/marble/declarative/OfflineDataModel.cpp
index 664e7d2..99fb569 100644
--- a/src/lib/marble/declarative/OfflineDataModel.cpp
+++ b/src/lib/marble/declarative/OfflineDataModel.cpp
@@ -128,11 +128,11 @@ bool OfflineDataModel::filterAcceptsRow( int source_row, const QModelIndex &sour
if ( QSortFilterProxyModel::filterAcceptsRow( source_row, source_parent ) ) {
QModelIndex const index = sourceModel()->index( source_row, 0, source_parent );
QString const data = sourceModel()->data( index, Qt::DisplayRole ).toString();
- if ( ( m_vehicleTypeFilter & Motorcar ) && data.contains( "(Motorcar)" ) ) {
+ if ((m_vehicleTypeFilter & Motorcar) && data.contains(QLatin1String("(Motorcar)"))) {
return true;
- } else if ( ( m_vehicleTypeFilter & Bicycle ) && data.contains( "(Bicycle)" ) ) {
+ } else if ((m_vehicleTypeFilter & Bicycle) && data.contains(QLatin1String("(Bicycle)"))) {
return true;
- } else if ( ( m_vehicleTypeFilter & Pedestrian ) && data.contains( "(Pedestrian)" ) ) {
+ } else if ((m_vehicleTypeFilter & Pedestrian) && data.contains(QLatin1String("(Pedestrian)"))) {
return true;
}
}
diff --git a/src/lib/marble/geodata/handlers/dgml/DgmlBrushTagHandler.cpp b/src/lib/marble/geodata/handlers/dgml/DgmlBrushTagHandler.cpp
index 5931e1c..54b88f3 100644
--- a/src/lib/marble/geodata/handlers/dgml/DgmlBrushTagHandler.cpp
+++ b/src/lib/marble/geodata/handlers/dgml/DgmlBrushTagHandler.cpp
@@ -50,7 +50,7 @@ GeoNode* DgmlBrushTagHandler::parse(GeoParser& parser) const
if ( !color.isEmpty() && QColor( color ).isValid() ) {
QColor brushColor( color );
- if (color.contains("transparent")) {
+ if (color.contains(QLatin1String("transparent"))) {
brushColor.setAlphaF( 0.0 );
}
else {
diff --git a/src/plugins/render/annotate/AnnotatePlugin.cpp b/src/plugins/render/annotate/AnnotatePlugin.cpp
index d846e49..1f137b9 100644
--- a/src/plugins/render/annotate/AnnotatePlugin.cpp
+++ b/src/plugins/render/annotate/AnnotatePlugin.cpp
@@ -368,10 +368,10 @@ void AnnotatePlugin::saveAnnotationFile()
if ( !filename.isNull() ) {
GeoWriter writer;
// FIXME: This should be consistent with the way the loading is done.
- if ( filename.endsWith( ".kml", Qt::CaseInsensitive ) ) {
+ if (filename.endsWith(QLatin1String(".kml"), Qt::CaseInsensitive)) {
writer.setDocumentType( kml::kmlTag_nameSpaceOgc22 );
}
- else if ( filename.endsWith( ".osm", Qt::CaseInsensitive ) ) {
+ else if (filename.endsWith(QLatin1String(".osm"), Qt::CaseInsensitive)) {
// "0.6" is the current version of osm, it is used to identify the osm writer
// The reference value is kept in plugins/runner/osm/OsmElementDictionary.hz
writer.setDocumentType( "0.6" );
diff --git a/src/plugins/render/panoramio/PanoramioParser.cpp b/src/plugins/render/panoramio/PanoramioParser.cpp
index f7b668b..5feca5e 100644
--- a/src/plugins/render/panoramio/PanoramioParser.cpp
+++ b/src/plugins/render/panoramio/PanoramioParser.cpp
@@ -52,32 +52,34 @@ panoramioDataStructure PanoramioParser::parseObjectOnPosition(const QString &con
QStringList date = upload_date_string.split(QLatin1Char(' '));
if( date.size() == 3 ) {
unsigned int day = date.at( 0 ).toUInt();
+ const QString &monthString = date.at(1);
unsigned int month = 1;
- if( date.at( 1 ).contains( "January" ) )
+ if (monthString.contains(QLatin1String("January"))) {
month = 1;
- else if ( date.at( 1 ).contains( "February" ) )
+ } else if (monthString.contains(QLatin1String("February"))) {
month = 2;
- else if ( date.at( 1 ).contains( "March" ) )
+ } else if (monthString.contains(QLatin1String("March"))) {
month = 3;
- else if ( date.at( 1 ).contains( "April" ) )
+ } else if (monthString.contains(QLatin1String("April"))) {
month = 4;
- else if ( date.at( 1 ).contains( "May" ) )
+ } else if (monthString.contains(QLatin1String("May"))) {
month = 5;
- else if ( date.at( 1 ).contains( "June" ) )
+ } else if (monthString.contains(QLatin1String("June"))) {
month = 6;
- else if ( date.at( 1 ).contains( "July" ) )
+ } else if (monthString.contains(QLatin1String("July"))) {
month = 7;
- else if ( date.at( 1 ).contains( "August" ) )
+ } else if (monthString.contains(QLatin1String("August"))) {
month = 8;
- else if ( date.at( 1 ).contains( "September" ) )
+ } else if (monthString.contains(QLatin1String("September"))) {
month = 9;
- else if ( date.at( 1 ).contains( "October" ) )
+ } else if (monthString.contains(QLatin1String("October"))) {
month = 10;
- else if ( date.at( 1 ).contains( "November" ) )
+ } else if (monthString.contains(QLatin1String("November"))) {
month = 11;
- else if ( date.at( 1 ).contains( "December" ) )
+ } else if (monthString.contains(QLatin1String("December"))) {
month = 12;
-
+ }
+
unsigned int year = date.at( 2 ).toUInt();
dataStorage.upload_date = QDate( year, month, day );
diff --git a/src/plugins/render/weather/BBCParser.cpp b/src/plugins/render/weather/BBCParser.cpp
index 3be63e4..b0014a6 100644
--- a/src/plugins/render/weather/BBCParser.cpp
+++ b/src/plugins/render/weather/BBCParser.cpp
@@ -482,20 +482,21 @@ void BBCParser::readTitle( WeatherData *data )
QString dayString = regExp.cap( 1 );
Qt::DayOfWeek dayOfWeek = (Qt::DayOfWeek) 0;
- if ( dayString.contains( "Monday" ) )
+ if (dayString.contains(QLatin1String("Monday"))) {
dayOfWeek = Qt::Monday;
- else if ( dayString.contains( "Tuesday" ) )
+ } else if (dayString.contains(QLatin1String("Tuesday"))) {
dayOfWeek = Qt::Tuesday;
- else if ( dayString.contains( "Wednesday" ) )
+ } else if (dayString.contains(QLatin1String("Wednesday"))) {
dayOfWeek = Qt::Wednesday;
- else if ( dayString.contains( "Thursday" ) )
+ } else if (dayString.contains(QLatin1String("Thursday"))) {
dayOfWeek = Qt::Thursday;
- else if ( dayString.contains( "Friday" ) )
+ } else if (dayString.contains(QLatin1String("Friday"))) {
dayOfWeek = Qt::Friday;
- else if ( dayString.contains( "Saturday" ) )
+ } else if (dayString.contains(QLatin1String("Saturday"))) {
dayOfWeek = Qt::Saturday;
- else if ( dayString.contains( "Sunday" ) )
+ } else if (dayString.contains(QLatin1String("Sunday"))) {
dayOfWeek = Qt::Sunday;
+ }
QDate date = QDate::currentDate();
date = date.addDays( -1 );
diff --git a/src/plugins/render/wikipedia/GeonamesParser.cpp b/src/plugins/render/wikipedia/GeonamesParser.cpp
index 76bde66..02b6574 100644
--- a/src/plugins/render/wikipedia/GeonamesParser.cpp
+++ b/src/plugins/render/wikipedia/GeonamesParser.cpp
@@ -184,7 +184,7 @@ void GeonamesParser::readUrl( WikipediaItem *item )
// Try to switch to the mobile version, geonames
// lacks API for that unfortunately
QString url = text().toString();
- if ( !url.contains( "m.wikipedia.org" ) ) {
+ if (!url.contains(QLatin1String("m.wikipedia.org"))) {
url.replace( "wikipedia.org", "m.wikipedia.org" );
}
item->setUrl( QUrl::fromEncoded( url.toUtf8() ) );
diff --git a/src/plugins/runner/kml/KmzHandler.cpp b/src/plugins/runner/kml/KmzHandler.cpp
index f7bf807..88e39b2 100644
--- a/src/plugins/runner/kml/KmzHandler.cpp
+++ b/src/plugins/runner/kml/KmzHandler.cpp
@@ -47,7 +47,7 @@ bool KmzHandler::open(const QString &kmz, QString &error)
//}
QString file = filename + QLatin1Char('/') + fileInfo.filePath;
m_kmzFiles << fileInfo.filePath;
- if (file.endsWith(".kml", Qt::CaseInsensitive)) {
+ if (file.endsWith(QLatin1String(".kml"), Qt::CaseInsensitive)) {
if ( !m_kmlFile.isEmpty() ) {
mDebug() << "File" << kmz << "contains more than one .kml files";
}
diff --git a/src/plugins/runner/pn2/Pn2Runner.cpp b/src/plugins/runner/pn2/Pn2Runner.cpp
index df3c497..9070bc6 100644
--- a/src/plugins/runner/pn2/Pn2Runner.cpp
+++ b/src/plugins/runner/pn2/Pn2Runner.cpp
@@ -119,7 +119,7 @@ bool Pn2Runner::importPolygon( QDataStream &stream, GeoDataLineString* linestrin
GeoDataDocument *Pn2Runner::parseFile(const QString &fileName, DocumentRole role, QString &error)
{
QFileInfo fileinfo( fileName );
- if( fileinfo.suffix().compare( "pn2", Qt::CaseInsensitive ) != 0 ) {
+ if (fileinfo.suffix().compare(QLatin1String("pn2"), Qt::CaseInsensitive) != 0) {
error = QString("File %1 does not have a pn2 suffix").arg(fileName);
mDebug() << error;
return nullptr;
diff --git a/src/plugins/runner/pnt/PntRunner.cpp b/src/plugins/runner/pnt/PntRunner.cpp
index 042eea5..ebcc129 100644
--- a/src/plugins/runner/pnt/PntRunner.cpp
+++ b/src/plugins/runner/pnt/PntRunner.cpp
@@ -39,7 +39,7 @@ PntRunner::~PntRunner()
GeoDataDocument *PntRunner::parseFile(const QString &fileName, DocumentRole role, QString &errorString)
{
QFileInfo fileinfo( fileName );
- if( fileinfo.suffix().compare( "pnt", Qt::CaseInsensitive ) != 0 ) {
+ if (fileinfo.suffix().compare(QLatin1String("pnt"), Qt::CaseInsensitive) != 0) {
errorString = QString("File %1 does not have a pnt suffix").arg(fileName);
mDebug() << errorString;
return nullptr;
diff --git a/src/plugins/runner/shp/ShpRunner.cpp b/src/plugins/runner/shp/ShpRunner.cpp
index 2b3b687..fd6800e 100644
--- a/src/plugins/runner/shp/ShpRunner.cpp
+++ b/src/plugins/runner/shp/ShpRunner.cpp
@@ -37,7 +37,7 @@ ShpRunner::~ShpRunner()
GeoDataDocument *ShpRunner::parseFile(const QString &fileName, DocumentRole role, QString &error)
{
QFileInfo fileinfo( fileName );
- if( fileinfo.suffix().compare( "shp", Qt::CaseInsensitive ) != 0 ) {
+ if (fileinfo.suffix().compare(QLatin1String("shp"), Qt::CaseInsensitive) != 0) {
error = QString("File %1 does not have a shp suffix").arg(fileName);
mDebug() << error;
return nullptr;
diff --git a/tools/speaker-files/main.cpp b/tools/speaker-files/main.cpp
index 31e6229..9b29884 100644
--- a/tools/speaker-files/main.cpp
+++ b/tools/speaker-files/main.cpp
@@ -269,7 +269,7 @@ int process( const QDir &input, const QDir &output, const QString &xml )
QString const nick = query.value(3).toString();
QString const gender = query.value(4).toString();
QString const language = query.value(5).toString();
- QString const lang = language.mid( 0, language.indexOf( "(" )-1 ).replace( QLatin1Char(' '), QLatin1Char('-') );
+ QString const lang = language.mid(0, language.indexOf(QLatin1Char('(')) - 1).replace(QLatin1Char(' '), QLatin1Char('-'));
QString const description = query.value(6).toString();
QString const token = query.value(7).toString();
QString const date = query.value(8).toString();