[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [marble] /: Several EBN Krazy fixes
From:       Kevin Krammer <krammer () kde ! org>
Date:       2012-12-28 15:56:53
Message-ID: 20121228155653.C4411A6091 () git ! kde ! org
[Download RAW message or body]

Git commit 5f70481eebe9f53f073265b5c5f6aad8c08f0a7e by Kevin Krammer.
Committed on 28/12/2012 at 16:51.
Pushed by krake into branch 'master'.

Several EBN Krazy fixes

Fixing various issues found by the EnglishBreakfastNetwork's
code checker Krazy.

Submitted by Mohammed Nafees <nafees.technocool@gmail.com>, completing
a Google Code-in task.

CCMAIL: nafees.technocool@gmail.com
REVIEW: 107980
DIGEST: Google Code-in contribution

M  +2    -2    src/QtMainWindow.cpp
M  +1    -1    src/lib/CurrentLocationWidget.cpp
M  +5    -5    src/lib/FileStoragePolicy.cpp
M  +5    -5    src/lib/FileStorageWatcher.cpp
M  +2    -2    src/lib/MarbleLegendBrowser.cpp
M  +2    -2    src/lib/NewstuffModel.cpp
M  +1    -1    src/lib/routing/RoutingLayer.cpp
M  +1    -1    src/lib/routing/instructions/WaypointParser.cpp
M  +2    -2    src/marble_part.cpp
M  +2    -2    src/plugins/declarative/MapThemeModel.cpp
M  +2    -2    src/plugins/declarative/Routing.cpp
M  +2    -2    src/plugins/declarative/Tracking.cpp
M  +2    -2    src/plugins/positionprovider/flightgear/FlightGearPositionProviderPlugin.cpp
 M  +1    -1    src/plugins/render/opencachingcom/OpenCachingComItem.cpp
M  +1    -1    src/plugins/render/satellites/SatellitesModel.cpp
M  +1    -1    src/plugins/render/weather/BBCWeatherService.cpp
M  +1    -1    src/plugins/render/weather/GeoNamesWeatherService.cpp
M  +1    -1    src/plugins/runner/local-osm-search/LocalOsmSearchPlugin.cpp
M  +3    -3    src/plugins/runner/monav/MonavConfigWidget.cpp
M  +1    -1    src/plugins/runner/open-source-routing-machine/OSRMRunner.cpp
M  +13   -13   src/qtmain.cpp
M  +2    -2    tools/iau2kml/iau2kml.cpp
M  +2    -2    tools/osm-addresses/main.cpp
M  +1    -1    tools/osm-sisyphus/upload.cpp
M  +1    -1    tools/poly2kml/main.cpp
M  +4    -4    tools/translations/merge_ts_po.cpp

http://commits.kde.org/marble/5f70481eebe9f53f073265b5c5f6aad8c08f0a7e

diff --git a/src/QtMainWindow.cpp b/src/QtMainWindow.cpp
index 6fa7ab6..cd28bac 100644
--- a/src/QtMainWindow.cpp
+++ b/src/QtMainWindow.cpp
@@ -680,8 +680,8 @@ void MainWindow::exportMapScreenShot()
     {
         // Take the case into account where no file format is indicated
         const char * format = 0;
-        if ( !fileName.endsWith("png", Qt::CaseInsensitive)
-           | !fileName.endsWith("jpg", Qt::CaseInsensitive) )
+        if ( !fileName.endsWith(QLatin1String( "png" ), Qt::CaseInsensitive)
+           | !fileName.endsWith(QLatin1String( "jpg" ), Qt::CaseInsensitive) )
         {
             format = "JPG";
         }
diff --git a/src/lib/CurrentLocationWidget.cpp b/src/lib/CurrentLocationWidget.cpp
index e828275..acd68e7 100644
--- a/src/lib/CurrentLocationWidget.cpp
+++ b/src/lib/CurrentLocationWidget.cpp
@@ -366,7 +366,7 @@ void CurrentLocationWidgetPrivate::saveTrack()
     if ( fileName.isEmpty() ) {
         return;
     }
-    if ( !fileName.endsWith(".kml", Qt::CaseInsensitive) ) {
+    if ( !fileName.endsWith(QLatin1String( ".kml" ), Qt::CaseInsensitive) ) {
         fileName.append( ".kml" );
     }
     QFileInfo file( fileName );
diff --git a/src/lib/FileStoragePolicy.cpp b/src/lib/FileStoragePolicy.cpp
index ce92d10..ca22b11 100644
--- a/src/lib/FileStoragePolicy.cpp
+++ b/src/lib/FileStoragePolicy.cpp
@@ -85,7 +85,7 @@ bool FileStoragePolicy::updateFile( const QString &fileName, const \
QByteArray &d  
 void FileStoragePolicy::clearCache()
 {
-    if ( m_dataDirectory.isEmpty() || !m_dataDirectory.endsWith("data") )
+    if ( m_dataDirectory.isEmpty() || !m_dataDirectory.endsWith(QLatin1String( \
"data" )) )  {
         mDebug() << "Error: Refusing to erase files under unknown conditions for \
safety reasons!";  return;
@@ -120,10 +120,10 @@ void FileStoragePolicy::clearCache()
                     // We try to be very careful and just delete images
                     // FIXME, when vectortiling I suppose also vector tiles will \
have  // to be deleted
-                    if ( lowerCase.endsWith( ".jpg" ) 
-                      || lowerCase.endsWith( ".png" )
-                      || lowerCase.endsWith( ".gif" )
-                      || lowerCase.endsWith( ".svg" )
+                    if ( lowerCase.endsWith( QLatin1String( ".jpg" ) ) 
+                      || lowerCase.endsWith( QLatin1String( ".png" ) )
+                      || lowerCase.endsWith( QLatin1String( ".gif" ) )
+                      || lowerCase.endsWith( QLatin1String( ".svg" ) )
                     )
                     {
                         // We cannot emit clear, because we don't make a full clear
diff --git a/src/lib/FileStorageWatcher.cpp b/src/lib/FileStorageWatcher.cpp
index 4bc56b2..1ab0e23 100644
--- a/src/lib/FileStorageWatcher.cpp
+++ b/src/lib/FileStorageWatcher.cpp
@@ -134,7 +134,7 @@ void FileStorageWatcherThread::ensureCacheSize()
 	
 	// Make sure that we are in the right directory
 	if ( m_dataDirectory.isEmpty() ||
-	    !m_dataDirectory.endsWith("data") )
+	    !m_dataDirectory.endsWith(QLatin1String( "data" )) )
 	{
 	    mDebug()
 	     << "Error: Refusing to erase files under"
@@ -276,10 +276,10 @@ void FileStorageWatcherThread::ensureSizePerTheme( const \
QString &themeDirectory  // Do not delete files younger than two minutes.
         // FIXME, when vectortiling I suppose also vector tiles will have
         // to be deleted
-	    if (   (    lowerCase.endsWith( ".jpg" ) 
-	             || lowerCase.endsWith( ".png" )
-	             || lowerCase.endsWith( ".gif" )
-	             || lowerCase.endsWith( ".svg" ) )
+	    if (   (    lowerCase.endsWith( QLatin1String( ".jpg" ) ) 
+	             || lowerCase.endsWith( QLatin1String( ".png" ) )
+	             || lowerCase.endsWith( QLatin1String( ".gif" ) )
+	             || lowerCase.endsWith( QLatin1String( ".svg" ) ) )
 		&& ( info.lastModified().secsTo( QDateTime::currentDateTime() )
 		     > deleteOnlyFilesOlderThan ) )
 	    {
diff --git a/src/lib/MarbleLegendBrowser.cpp b/src/lib/MarbleLegendBrowser.cpp
index 1b85898..d11469f 100644
--- a/src/lib/MarbleLegendBrowser.cpp
+++ b/src/lib/MarbleLegendBrowser.cpp
@@ -298,7 +298,7 @@ QVariant MarbleLegendBrowser::loadResource ( int type, const QUrl \
& name )  QString  newName;
 
     if ( type == QTextDocument::ImageResource
-         && name.toString().startsWith("checkbox:", Qt::CaseInsensitive) )
+         && name.toString().startsWith(QLatin1String( "checkbox:" ), \
Qt::CaseInsensitive) )  {
         QStyleOptionButton option;
         option.initFrom(this);
@@ -327,7 +327,7 @@ QVariant MarbleLegendBrowser::loadResource ( int type, const QUrl \
& name )  }
 
     if ( type == QTextDocument::ImageResource
-         && name.toString().startsWith("pixmap:", Qt::CaseInsensitive) )
+         && name.toString().startsWith(QLatin1String( "pixmap:" ), \
Qt::CaseInsensitive) )  {
         QString pixmapName = name.toString().section(':', 1, -1);
         if ( d->m_symbolMap.contains( pixmapName ) ) {
diff --git a/src/lib/NewstuffModel.cpp b/src/lib/NewstuffModel.cpp
index 0606096..2273edc 100644
--- a/src/lib/NewstuffModel.cpp
+++ b/src/lib/NewstuffModel.cpp
@@ -244,7 +244,7 @@ void NewstuffModelPrivate::installMap()
         m_unpackProcess->close();
         delete m_unpackProcess;
         m_unpackProcess = 0;
-    } else if ( m_currentFile->fileName().endsWith( "tar.gz" ) && canExecute( "tar" \
) ) { +    } else if ( m_currentFile->fileName().endsWith( QLatin1String( "tar.gz" ) \
) && canExecute( "tar" ) ) {  m_unpackProcess = new QProcess;
         QObject::connect( m_unpackProcess, SIGNAL( finished( int ) ),
                           m_parent, SLOT( contentsListed( int ) ) );
@@ -252,7 +252,7 @@ void NewstuffModelPrivate::installMap()
         m_unpackProcess->setWorkingDirectory( m_targetDirectory );
         m_unpackProcess->start( "tar", arguments );
     } else {
-        if ( !m_currentFile->fileName().endsWith( "tar.gz" ) ) {
+        if ( !m_currentFile->fileName().endsWith( QLatin1String( "tar.gz" ) ) ) {
             mDebug() << "Can only handle tar.gz files";
         } else {
             mDebug() << "Cannot extract archive: tar executable not found in PATH.";
diff --git a/src/lib/routing/RoutingLayer.cpp b/src/lib/routing/RoutingLayer.cpp
index e5e803c..c31aa5f 100644
--- a/src/lib/routing/RoutingLayer.cpp
+++ b/src/lib/routing/RoutingLayer.cpp
@@ -819,7 +819,7 @@ void RoutingLayer::exportRoute()
                        tr( "GPX and KML files (*.gpx *.kml)" ) );
 
     if ( d->m_routingModel && !fileName.isEmpty() ) {
-        if ( fileName.endsWith( ".gpx", Qt::CaseInsensitive ) ) {
+        if ( fileName.endsWith( QLatin1String( ".gpx" ), Qt::CaseInsensitive ) ) {
             QFile gpx( fileName );
             if ( gpx.open( QFile::WriteOnly) ) {
                 d->m_routingModel->exportGpx( &gpx );
diff --git a/src/lib/routing/instructions/WaypointParser.cpp \
b/src/lib/routing/instructions/WaypointParser.cpp index 1a49f68..453e30a 100644
--- a/src/lib/routing/instructions/WaypointParser.cpp
+++ b/src/lib/routing/instructions/WaypointParser.cpp
@@ -64,7 +64,7 @@ RoutingWaypoints WaypointParser::parse( QTextStream &stream ) const
     foreach( const QString &line, lines ) {
         if ( !line.trimmed().isEmpty() &&
              !line.trimmed().startsWith('#') &&
-             !line.startsWith( "Content-Type: text/plain") ) {
+             !line.startsWith( QLatin1String( "Content-Type: text/plain" ) ) ) {
             QStringList entries = line.split( m_fieldSeparator );
             if ( entries.size() >= 1 + m_fieldIndices[RoadName] ) {
                 qreal lon = readField<qreal>( Longitude, entries );
diff --git a/src/marble_part.cpp b/src/marble_part.cpp
index c61e4d3..6ac544e 100644
--- a/src/marble_part.cpp
+++ b/src/marble_part.cpp
@@ -268,8 +268,8 @@ void MarblePart::exportMapScreenShot()
     if ( !fileName.isEmpty() ) {
         // Take the case into account where no file format is indicated
         const char * format = 0;
-        if ( !fileName.endsWith("png", Qt::CaseInsensitive)
-           && !fileName.endsWith("jpg", Qt::CaseInsensitive) )
+        if ( !fileName.endsWith(QLatin1String( "png" ), Qt::CaseInsensitive)
+           && !fileName.endsWith(QLatin1String( "jpg" ), Qt::CaseInsensitive) )
         {
             format = "JPG";
         }
diff --git a/src/plugins/declarative/MapThemeModel.cpp \
b/src/plugins/declarative/MapThemeModel.cpp index 6449696..47bc226 100644
--- a/src/plugins/declarative/MapThemeModel.cpp
+++ b/src/plugins/declarative/MapThemeModel.cpp
@@ -77,11 +77,11 @@ bool MapThemeModel::filterAcceptsRow( int sourceRow, const \
QModelIndex &sourcePa  return false;
      }
 
-     if ( m_mapThemeFilters & MapThemeModel::Terrestrial && themeId.startsWith( \
"earth/" ) ) { +     if ( m_mapThemeFilters & MapThemeModel::Terrestrial && \
themeId.startsWith( QLatin1String( "earth/" ) ) ) {  return false;
      }
 
-     if ( m_mapThemeFilters & MapThemeModel::Extraterrestrial && \
!themeId.startsWith( "earth/" ) ) { +     if ( m_mapThemeFilters & \
MapThemeModel::Extraterrestrial && !themeId.startsWith( QLatin1String( "earth/" ) ) ) \
{  return false;
      }
 
diff --git a/src/plugins/declarative/Routing.cpp \
b/src/plugins/declarative/Routing.cpp index 5f2c15a..7147d47 100644
--- a/src/plugins/declarative/Routing.cpp
+++ b/src/plugins/declarative/Routing.cpp
@@ -174,7 +174,7 @@ void Routing::openRoute( const QString &fileName )
         Marble::RoutingManager * const routingManager = \
d->m_marbleWidget->model()->routingManager();  /** @todo FIXME: replace the file:// \
prefix on QML side */  routingManager->clearRoute();
-        QString target = fileName.startsWith( "file://" ) ? fileName.mid( 7 ) : \
fileName; +        QString target = fileName.startsWith( QLatin1String( "file://" ) ) \
? fileName.mid( 7 ) : fileName;  routingManager->loadRoute( target );
         Marble::GeoDataDocument* route = \
routingManager->alternativeRoutesModel()->currentRoute();  if ( route ) {
@@ -190,7 +190,7 @@ void Routing::saveRoute( const QString &fileName )
 {
     if ( d->m_marbleWidget ) {
         /** @todo FIXME: replace the file:// prefix on QML side */
-        QString target = fileName.startsWith( "file://" ) ? fileName.mid( 7 ) : \
fileName; +        QString target = fileName.startsWith( QLatin1String( "file://" ) ) \
                ? fileName.mid( 7 ) : fileName;
         d->m_marbleWidget->model()->routingManager()->saveRoute( target );
     }
 }
diff --git a/src/plugins/declarative/Tracking.cpp \
b/src/plugins/declarative/Tracking.cpp index f908833..d5b0704 100644
--- a/src/plugins/declarative/Tracking.cpp
+++ b/src/plugins/declarative/Tracking.cpp
@@ -274,7 +274,7 @@ void Tracking::saveTrack( const QString &fileName )
 {
     if ( m_marbleWidget ) {
         /** @todo FIXME: replace the file:// prefix on QML side */
-        QString target = fileName.startsWith( "file://" ) ? fileName.mid( 7 ) : \
fileName; +        QString target = fileName.startsWith( QLatin1String( "file://" ) ) \
? fileName.mid( 7 ) : fileName;  \
m_marbleWidget->model()->positionTracking()->saveTrack( target );  }
 }
@@ -283,7 +283,7 @@ void Tracking::openTrack(const QString &fileName)
 {
     if ( m_marbleWidget ) {
         /** @todo FIXME: replace the file:// prefix on QML side */
-        QString target = fileName.startsWith( "file://" ) ? fileName.mid( 7 ) : \
fileName; +        QString target = fileName.startsWith( QLatin1String( "file://" ) ) \
? fileName.mid( 7 ) : fileName;  m_marbleWidget->model()->addGeoDataFile( target );
     }
 }
diff --git a/src/plugins/positionprovider/flightgear/FlightGearPositionProviderPlugin.cpp \
b/src/plugins/positionprovider/flightgear/FlightGearPositionProviderPlugin.cpp index \
                3a21ee4..9865342 100644
--- a/src/plugins/positionprovider/flightgear/FlightGearPositionProviderPlugin.cpp
+++ b/src/plugins/positionprovider/flightgear/FlightGearPositionProviderPlugin.cpp
@@ -132,7 +132,7 @@ void FlightGearPositionProviderPlugin::parseNmeaSentence( const \
QString &sentenc  PositionProviderStatus oldStatus = m_status;
     GeoDataCoordinates oldPosition = m_position;
 
-    if ( sentence.startsWith( "$GPRMC" ) ) {
+    if ( sentence.startsWith( QLatin1String( "$GPRMC" ) ) ) {
         QStringList const values = sentence.split( ',' );
         if ( values.size() > 9 ) {
             if ( values[2] == "A" ) {
@@ -147,7 +147,7 @@ void FlightGearPositionProviderPlugin::parseNmeaSentence( const \
QString &sentenc  // Flightgear submits geoposition twice in one datagram, once
             // in GPRMC and once in GPGGA. Parsing one is sufficient
         }
-    } else if ( sentence.startsWith( "$GPGGA" ) ) {
+    } else if ( sentence.startsWith( QLatin1String( "$GPGGA" ) ) ) {
         QStringList const values = sentence.split( ',' );
         if ( values.size() > 10 ) {
             if ( values[6] == 0 ) {
diff --git a/src/plugins/render/opencachingcom/OpenCachingComItem.cpp \
b/src/plugins/render/opencachingcom/OpenCachingComItem.cpp index 8a3032b..2e0e8c8 \
                100644
--- a/src/plugins/render/opencachingcom/OpenCachingComItem.cpp
+++ b/src/plugins/render/opencachingcom/OpenCachingComItem.cpp
@@ -304,7 +304,7 @@ void OpenCachingComItem::addDownloadedFile( const QString &url, \
const QString &t  
     // ### images does not work, opencaching.com redirects them to
     // a localized location and can not return them.
-    else if (type.startsWith("image"))
+    else if (type.startsWith(QLatin1String("image")))
     {
         int index = type.mid(6).toInt();
         m_images << url;
diff --git a/src/plugins/render/satellites/SatellitesModel.cpp \
b/src/plugins/render/satellites/SatellitesModel.cpp index a6a6f59..f4489fc 100644
--- a/src/plugins/render/satellites/SatellitesModel.cpp
+++ b/src/plugins/render/satellites/SatellitesModel.cpp
@@ -114,7 +114,7 @@ void SatellitesModel::parseCatalog( const QString &id,
     QString line = ts.readLine();
     for( ; !line.isNull(); line = ts.readLine() ) {
 
-        if( line.trimmed().startsWith( "#" ) ) {
+        if( line.trimmed().startsWith( QLatin1String( "#" ) ) ) {
             continue;
         }
 
diff --git a/src/plugins/render/weather/BBCWeatherService.cpp \
b/src/plugins/render/weather/BBCWeatherService.cpp index 67dfff1..02898c1 100644
--- a/src/plugins/render/weather/BBCWeatherService.cpp
+++ b/src/plugins/render/weather/BBCWeatherService.cpp
@@ -72,7 +72,7 @@ void BBCWeatherService::getAdditionalItems( const \
GeoDataLatLonAltBox& box,  
 void BBCWeatherService::getItem( const QString &id, const MarbleModel * )
 {
-    if ( id.startsWith( "bbc" ) ) {
+    if ( id.startsWith( QLatin1String( "bbc" ) ) ) {
         BBCStation const station = m_itemGetter->station( id );
         if ( station.bbcId() > 0 ) {
             createItem( station );
diff --git a/src/plugins/render/weather/GeoNamesWeatherService.cpp \
b/src/plugins/render/weather/GeoNamesWeatherService.cpp index 697b8ed..202a9c3 100644
--- a/src/plugins/render/weather/GeoNamesWeatherService.cpp
+++ b/src/plugins/render/weather/GeoNamesWeatherService.cpp
@@ -62,7 +62,7 @@ void GeoNamesWeatherService::getItem( const QString &id, const \
MarbleModel *mode  return;
     }
 
-    if ( id.startsWith("geonames_" ) ) {
+    if ( id.startsWith(QLatin1String("geonames_") ) ) {
         QUrl geonamesUrl( "http://ws.geonames.org/weatherIcaoJSON" );
         geonamesUrl.addQueryItem( "ICAO", id.mid( 9 ) );
         emit downloadDescriptionFileRequested( geonamesUrl );
diff --git a/src/plugins/runner/local-osm-search/LocalOsmSearchPlugin.cpp \
b/src/plugins/runner/local-osm-search/LocalOsmSearchPlugin.cpp index d29b298..35454c6 \
                100644
--- a/src/plugins/runner/local-osm-search/LocalOsmSearchPlugin.cpp
+++ b/src/plugins/runner/local-osm-search/LocalOsmSearchPlugin.cpp
@@ -91,7 +91,7 @@ void LocalOsmSearchPlugin::updateDirectory( const QString & ) const
 
 void LocalOsmSearchPlugin::updateFile( const QString &file ) const
 {
-    if ( file.endsWith( ".sqlite" ) ) {
+    if ( file.endsWith( QLatin1String( ".sqlite" ) ) ) {
         m_databaseLoaded = false;
     }
 }
diff --git a/src/plugins/runner/monav/MonavConfigWidget.cpp \
b/src/plugins/runner/monav/MonavConfigWidget.cpp index cacbc63..8802208 100644
--- a/src/plugins/runner/monav/MonavConfigWidget.cpp
+++ b/src/plugins/runner/monav/MonavConfigWidget.cpp
@@ -193,7 +193,7 @@ QString MonavStuffEntry::transport() const
 
 bool MonavStuffEntry::isValid() const
 {
-    return !m_continent.isEmpty() && !m_state.isEmpty() && m_payload.startsWith( \
"http://" ); +    return !m_continent.isEmpty() && !m_state.isEmpty() && \
m_payload.startsWith( QLatin1String( "http://" ) );  }
 
 MonavConfigWidgetPrivate::MonavConfigWidgetPrivate( MonavConfigWidget* parent, \
MonavPlugin* plugin ) : @@ -513,7 +513,7 @@ void \
MonavConfigWidgetPrivate::installMap()  delete m_unpackProcess;
         m_unpackProcess = 0;
         m_parent->m_installButton->setEnabled( true );
-    } else if ( m_currentFile.fileName().endsWith( "tar.gz" ) && canExecute( "tar" ) \
) { +    } else if ( m_currentFile.fileName().endsWith( QLatin1String( "tar.gz" ) ) \
&& canExecute( "tar" ) ) {  QFileInfo file( m_currentFile );
         QString message = QObject::tr( "Installing %1" ).arg( file.fileName() );
         setBusy( true, message );
@@ -527,7 +527,7 @@ void MonavConfigWidgetPrivate::installMap()
             m_unpackProcess->start( "tar", arguments );
         }
     } else {
-        if ( !m_currentFile.fileName().endsWith( "tar.gz" ) ) {
+        if ( !m_currentFile.fileName().endsWith( QLatin1String( "tar.gz" ) ) ) {
             mDebug() << "Can only handle tar.gz files";
         } else {
             mDebug() << "Cannot extract archive: tar executable not found in PATH.";
diff --git a/src/plugins/runner/open-source-routing-machine/OSRMRunner.cpp \
b/src/plugins/runner/open-source-routing-machine/OSRMRunner.cpp index \
                b48c0f9..59b0c0e 100644
--- a/src/plugins/runner/open-source-routing-machine/OSRMRunner.cpp
+++ b/src/plugins/runner/open-source-routing-machine/OSRMRunner.cpp
@@ -170,7 +170,7 @@ RoutingInstruction::TurnType OSRMRunner::parseTurnType( const \
QString &instructi  return RoutingInstruction::SlightLeft;
     } else if ( instruction == "10" ) {
         return RoutingInstruction::Continue;
-    } else if ( instruction.startsWith( "11-" ) ) {
+    } else if ( instruction.startsWith( QLatin1String( "11-" ) ) ) {
         int const exit = instruction.mid( 3 ).toInt();
         switch ( exit ) {
         case 1: return RoutingInstruction::RoundaboutFirstExit; break;
diff --git a/src/qtmain.cpp b/src/qtmain.cpp
index ebfbac9..127db7a 100644
--- a/src/qtmain.cpp
+++ b/src/qtmain.cpp
@@ -140,56 +140,56 @@ int main(int argc, char *argv[])
     for ( int i = 1; i < args.count(); ++i ) {
         const QString arg = args.at(i);
 
-        if ( arg == "--debug-info" )
+        if ( arg == QLatin1String( "--debug-info" ) )
         {
             MarbleDebug::enable = true;
         }
-        else if ( arg.startsWith( "--marbledatapath=", Qt::CaseInsensitive ) )
+        else if ( arg.startsWith( QLatin1String( "--marbledatapath=" ), \
Qt::CaseInsensitive ) )  {
             marbleDataPath = args.at(i).mid(17);
         }
-        else if ( arg.compare( "--marbledatapath", Qt::CaseInsensitive ) == 0 ) {
+        else if ( arg.compare( QLatin1String( "--marbledatapath" ), \
Qt::CaseInsensitive ) == 0 ) {  dataPathIndex = i + 1;
             marbleDataPath = args.value( dataPathIndex );
             ++i;
         }
-        else if ( arg == "--smallscreen" ) {
+        else if ( arg == QLatin1String( "--smallscreen" ) ) {
             profiles |= MarbleGlobal::SmallScreen;
         }
-        else if ( arg == "--nosmallscreen" ) {
+        else if ( arg == QLatin1String( "--nosmallscreen" ) ) {
             profiles &= ~MarbleGlobal::SmallScreen;
         }
-        else if ( arg == "--highresolution" ) {
+        else if ( arg == QLatin1String( "--highresolution" ) ) {
             profiles |= MarbleGlobal::HighResolution;
         }
-        else if ( arg == "--nohighresolution" ) {
+        else if ( arg == QLatin1String( "--nohighresolution" ) ) {
             profiles &= ~MarbleGlobal::HighResolution;
         }
-        else if ( arg.startsWith( "--latlon=", Qt::CaseInsensitive ) )
+        else if ( arg.startsWith( QLatin1String( "--latlon=" ), Qt::CaseInsensitive \
) )  {
             coordinatesString = arg.mid(9);
         }
-        else if ( arg.compare( "--latlon", Qt::CaseInsensitive ) == 0 ) {
+        else if ( arg.compare( QLatin1String( "--latlon" ), Qt::CaseInsensitive ) == \
0 ) {  ++i;
             // TODO: misses an error check if there is a value at all
             // and error reporting to user (problem also exists with marbledatapath)
             coordinatesString = args.value( i );
         }
-        else if ( arg.startsWith( "--distance=", Qt::CaseInsensitive ) )
+        else if ( arg.startsWith( QLatin1String( "--distance=" ), \
Qt::CaseInsensitive ) )  {
             distanceString = arg.mid(11);
         }
-        else if ( arg.compare( "--distance", Qt::CaseInsensitive ) == 0 ) {
+        else if ( arg.compare( QLatin1String( "--distance" ), Qt::CaseInsensitive ) \
== 0 ) {  ++i;
             // TODO: misses an error check if there is a value at all
             // and error reporting to user (problem also exists with marbledatapath)
             distanceString = args.value( i );
         }
-        else if ( arg.startsWith( "--map=", Qt::CaseInsensitive ) )
+        else if ( arg.startsWith( QLatin1String( "--map=" ), Qt::CaseInsensitive ) )
         {
             mapThemeId = arg.mid(6);
         }
-        else if ( arg.compare( "--map", Qt::CaseInsensitive ) == 0 ) {
+        else if ( arg.compare( QLatin1String( "--map" ), Qt::CaseInsensitive ) == 0 \
) {  ++i;
             // TODO: misses an error check if there is a value at all
             // and error reporting to user (problem also exists with marbledatapath)
diff --git a/tools/iau2kml/iau2kml.cpp b/tools/iau2kml/iau2kml.cpp
index e61674d..3a3f7d5 100644
--- a/tools/iau2kml/iau2kml.cpp
+++ b/tools/iau2kml/iau2kml.cpp
@@ -91,7 +91,7 @@ int main(int argc, char *argv[])
 
             rawline = sourcestream.readLine();
 //            if ( !rawline.startsWith("\"E\"|\"m\"|\"" ) ) {
-            if ( !rawline.startsWith("\"V\"|\"V\"|\"" ) ) {
+            if ( !rawline.startsWith(QLatin1String( "\"V\"|\"V\"|\"" ) ) ) {
                 continue;
             }
             rawline = rawline.replace( "\"|", "|" );
@@ -126,7 +126,7 @@ int main(int argc, char *argv[])
 
             if ( lon > 180.0 ) lon = lon - 360.0;
 
-            if ( rawline.startsWith("\"M\"|\"M\"|\"" ) || \
rawline.startsWith("\"V\"|\"V\"|\"" ) ) { +            if ( \
rawline.startsWith(QLatin1String( "\"M\"|\"M\"|\"" ) ) || \
rawline.startsWith("\"V\"|\"V\"|\"" ) ) {  lon = -lon;
             }
 
diff --git a/tools/osm-addresses/main.cpp b/tools/osm-addresses/main.cpp
index aa6749d..75f6a4f 100644
--- a/tools/osm-addresses/main.cpp
+++ b/tools/osm-addresses/main.cpp
@@ -112,9 +112,9 @@ int main( int argc, char *argv[] )
     }
 
     OsmParser* parser = 0;
-    if ( file.fileName().endsWith( ".osm" ) ) {
+    if ( file.fileName().endsWith( QLatin1String( ".osm" ) ) ) {
         parser = new XmlParser;
-    } else if ( file.fileName().endsWith( ".pbf" ) ) {
+    } else if ( file.fileName().endsWith( QLatin1String( ".pbf" ) ) ) {
         parser = new PbfParser;
     } else {
         qDebug() << "Unsupported file format: " << file.fileName();
diff --git a/tools/osm-sisyphus/upload.cpp b/tools/osm-sisyphus/upload.cpp
index 3dc7f9e..a7cc109 100644
--- a/tools/osm-sisyphus/upload.cpp
+++ b/tools/osm-sisyphus/upload.cpp
@@ -234,7 +234,7 @@ bool Upload::deleteRemoteFile(const QString &filename)
         return true;
     }
 
-    if (!filename.startsWith("/home/marble/")) {
+    if (!filename.startsWith(QLatin1String( "/home/marble/" ))) {
         return false;
     }
 
diff --git a/tools/poly2kml/main.cpp b/tools/poly2kml/main.cpp
index bc7e237..f4d3b02 100644
--- a/tools/poly2kml/main.cpp
+++ b/tools/poly2kml/main.cpp
@@ -77,7 +77,7 @@ void parseBoundingBox( const QFileInfo &file, const QString &name,
                     }
                 } else if ( entries.first() == "END" && !inside ) {
                     qDebug() << "END not expected here";
-                } else if ( entries.first().startsWith( "!" ) ) {
+                } else if ( entries.first().startsWith( QLatin1String( "!" ) ) ) {
                     skip = true;
                     qDebug() << "Warning: Negative polygons not supported, \
skipping";  } else {
diff --git a/tools/translations/merge_ts_po.cpp b/tools/translations/merge_ts_po.cpp
index ce51967..989fabc 100644
--- a/tools/translations/merge_ts_po.cpp
+++ b/tools/translations/merge_ts_po.cpp
@@ -49,11 +49,11 @@ int main( int argc, char** argv )
     bool ignore = false;
     while( !poStream.atEnd() ) {
         QString line = poStream.readLine();
-        if ( line.startsWith( "#, fuzzy" ) ) {
+        if ( line.startsWith( QLatin1String( "#, fuzzy" ) ) ) {
             ignore = true;
-        } else if ( line.startsWith( "msgid " ) ) {
+        } else if ( line.startsWith( QLatin1String( "msgid " ) ) ) {
             source = line.mid( 7, line.size() - 8 );
-        } else if ( !source.isEmpty() && line.startsWith( "msgstr " ) ) {
+        } else if ( !source.isEmpty() && line.startsWith( QLatin1String( "msgstr " ) \
) ) {  if ( ignore ) {
                 ignore = false;
             } else {
@@ -84,7 +84,7 @@ int main( int argc, char** argv )
     source.clear();
     while( !tsStream.atEnd() ) {
         QString line = tsStream.readLine().trimmed();
-        if ( line.startsWith( "<source>" ) ) {
+        if ( line.startsWith( QLatin1String( "<source>" ) ) ) {
             source = line.mid( 8, line.size() - 17 );
             console << line << "\n";
         } else if ( !source.isEmpty() &&


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic