Commit 33eff9bc authored by Dennis Nienhüser's avatar Dennis Nienhüser
Browse files

Port away from Q_FOREACH

See https://www.kdab.com/goodbye-q_foreach/
parent 7a90178c
......@@ -433,7 +433,7 @@ int main ( int argc, char *argv[] )
}
// Read the files that are given on the command line.
foreach( const QString &file, parser.positionalArguments() ) {
for( const QString &file: parser.positionalArguments() ) {
// FIXME: Use openUrl( args->url(i) ) instead?
if ( QFile::exists( file ) ) {
window->marbleControl()->addGeoDataFile( file );
......
......@@ -239,7 +239,7 @@ bool MarblePart::openFile()
QStringList allFileExtensions;
QStringList filters;
foreach ( const ParseRunnerPlugin *plugin, pluginManager->parsingRunnerPlugins() ) {
for ( const ParseRunnerPlugin *plugin: pluginManager->parsingRunnerPlugins() ) {
if (plugin->nameId() == QLatin1String("Cache"))
continue;
......@@ -264,7 +264,7 @@ bool MarblePart::openFile()
m_lastFileOpenPath = QFileInfo( firstFile ).absolutePath();
}
foreach( const QString &fileName, fileNames ) {
for( const QString &fileName: fileNames ) {
openUrl( QUrl::fromLocalFile(fileName) );
}
......@@ -482,10 +482,10 @@ void MarblePart::readSettings()
KConfigGroup profileGroup = profilesGroup.group( QString( "Profile %0" ).arg(i) );
QString name = profileGroup.readEntry( "Name", i18n( "Unnamed" ) );
RoutingProfile profile( name );
foreach ( const QString& pluginName, profileGroup.groupList() ) {
for ( const QString& pluginName: profileGroup.groupList() ) {
KConfigGroup pluginGroup = profileGroup.group( pluginName );
profile.pluginSettings().insert( pluginName, QHash<QString, QVariant>() );
foreach ( const QString& key, pluginGroup.keyList() ) {
for ( const QString& key: pluginGroup.keyList() ) {
if (key != QLatin1String("Enabled")) {
profile.pluginSettings()[ pluginName ].insert( key, pluginGroup.readEntry( key ) );
}
......@@ -508,7 +508,7 @@ void MarblePart::readSettings()
QString positionProvider = MarbleSettings::activePositionTrackingPlugin();
if ( !positionProvider.isEmpty() ) {
const PluginManager* pluginManager = m_controlView->marbleModel()->pluginManager();
foreach( const PositionProviderPlugin* plugin, pluginManager->positionProviderPlugins() ) {
for( const PositionProviderPlugin* plugin: pluginManager->positionProviderPlugins() ) {
if ( plugin->nameId() == positionProvider ) {
PositionProviderPlugin* instance = plugin->newInstance();
tracking->setPositionProviderPlugin( instance );
......@@ -1083,7 +1083,7 @@ void MarblePart::createPluginMenus()
// menus
const QList<QActionGroup*> *tmp_actionGroups = (*i)->actionGroups();
if( (*i)->enabled() && tmp_actionGroups ) {
foreach( QActionGroup *ag, *tmp_actionGroups ) {
for( QActionGroup *ag: *tmp_actionGroups ) {
plugActionList( "plugins_menuactionlist", ag->actions() );
}
}
......@@ -1092,7 +1092,7 @@ void MarblePart::createPluginMenus()
const QList<QActionGroup*> *tmp_toolbarActionGroups = (*i)->toolbarActionGroups();
if ( (*i)->enabled() && tmp_toolbarActionGroups ) {
foreach( QActionGroup* ag, *tmp_toolbarActionGroups ) {
for( QActionGroup* ag: *tmp_toolbarActionGroups ) {
plugActionList( "plugins_actionlist", ag->actions() );
}
}
......@@ -1502,13 +1502,13 @@ void MarblePart::applyPluginState()
KConfigGroup profileGroup = profilesGroup.group( QString( "Profile %0" ).arg(i) );
RoutingProfile profile = profiles.at( i );
profileGroup.writeEntry( "Name", profile.name() );
foreach ( const QString &pluginName, profileGroup.groupList() ) {
for ( const QString &pluginName: profileGroup.groupList() ) {
profileGroup.group( pluginName ).deleteGroup();
}
foreach ( const QString &key, profile.pluginSettings().keys() ) {
for ( const QString &key: profile.pluginSettings().keys() ) {
KConfigGroup pluginGroup = profileGroup.group( key );
pluginGroup.writeEntry( "Enabled", true );
foreach ( const QString& settingKey, profile.pluginSettings()[ key ].keys() ) {
for ( const QString& settingKey: profile.pluginSettings()[ key ].keys() ) {
Q_ASSERT(settingKey != QLatin1String("Enabled"));
pluginGroup.writeEntry( settingKey, profile.pluginSettings()[ key ][ settingKey ] );
}
......@@ -1623,7 +1623,7 @@ void MarblePart::writePluginSettings()
{
KSharedConfig::Ptr sharedConfig = KSharedConfig::openConfig();
foreach( RenderPlugin *plugin, m_controlView->marbleWidget()->renderPlugins() ) {
for( RenderPlugin *plugin: m_controlView->marbleWidget()->renderPlugins() ) {
KConfigGroup group = sharedConfig->group( QString( "plugin_" ) + plugin->nameId() );
const QHash<QString,QVariant> hash = plugin->settings();
......@@ -1644,12 +1644,12 @@ void MarblePart::readPluginSettings()
KSharedConfig::Ptr sharedConfig = KSharedConfig::openConfig();
foreach( RenderPlugin *plugin, m_controlView->marbleWidget()->renderPlugins() ) {
for( RenderPlugin *plugin: m_controlView->marbleWidget()->renderPlugins() ) {
KConfigGroup group = sharedConfig->group( QString( "plugin_" ) + plugin->nameId() );
QHash<QString,QVariant> hash;
foreach ( const QString& key, group.keyList() ) {
for ( const QString& key: group.keyList() ) {
hash.insert( key, group.readEntry( key ) );
}
......
......@@ -244,7 +244,7 @@ void MainWindow::initObject(const QVariantMap& cmdLineSettings)
setupStatusBar();
readSettings(cmdLineSettings);
foreach ( const QString &path, m_commandlineFilePaths ) {
for ( const QString &path: m_commandlineFilePaths ) {
m_controlView->marbleModel()->addGeoDataFile( path );
}
......@@ -473,7 +473,7 @@ void MainWindow::createMenus( const QList<QAction*> &panelActions )
connect( m_bookmarkMenu, SIGNAL(aboutToShow()), this, SLOT(createBookmarkMenu()) );
m_panelMenu = new QMenu(tr("&Panels"), this);
foreach( QAction* action, panelActions ) {
for( QAction* action: panelActions ) {
m_panelMenu->addAction( action );
}
......@@ -564,7 +564,7 @@ void MainWindow::createBookmarksListMenu( QMenu *bookmarksListMenu, const GeoDat
QVector<GeoDataPlacemark*> bookmarks = container->placemarkList();
foreach ( const GeoDataPlacemark *placemark, bookmarks ) {
for ( const GeoDataPlacemark *placemark: bookmarks ) {
QAction *bookmarkAction = new QAction( placemark->name(), this );
QVariant var;
......@@ -607,7 +607,7 @@ void MainWindow::createFolderList( QMenu *bookmarksListMenu, const GeoDataContai
createBookmarksListMenu( bookmarksListMenu, folders.first() );
}
else {
foreach ( const GeoDataFolder *folder, folders ) {
for ( const GeoDataFolder *folder: folders ) {
QMenu *subMenu = bookmarksListMenu->addMenu(QIcon(QStringLiteral(":/icons/folder-bookmark.png")), folder->name());
createFolderList( subMenu, folder );
connect( subMenu, SIGNAL(triggered(QAction*)),
......@@ -693,11 +693,11 @@ void MainWindow::createPluginMenus()
// menus
const QList<QActionGroup*> *tmp_actionGroups = (*i)->actionGroups();
if ((*i)->enabled() && tmp_actionGroups && (*i)->nameId() != QLatin1String("annotation")) {
foreach( QActionGroup *ag, *tmp_actionGroups ) {
for( QActionGroup *ag: *tmp_actionGroups ) {
if( !ag->actions().isEmpty() ) {
m_pluginMenus.append( m_viewMenu->addSeparator() );
}
foreach( QAction *action, ag->actions() ) {
for( QAction *action: ag->actions() ) {
m_viewMenu->addAction( action );
m_pluginMenus.append( action );
}
......@@ -710,7 +710,7 @@ void MainWindow::createPluginMenus()
QToolBar* toolbar = new QToolBar(this);
toolbar->setObjectName(QLatin1String("plugin-toolbar-") + (*i)->nameId());
foreach( QActionGroup* ag, *tmp_toolbarActionGroups ) {
for( QActionGroup* ag: *tmp_toolbarActionGroups ) {
toolbar->addActions( ag->actions() );
if ( tmp_toolbarActionGroups->last() != ag ) {
toolbar->addSeparator();
......@@ -974,7 +974,7 @@ void MainWindow::openFile()
QStringList allFileExtensions;
QStringList filters;
foreach ( const ParseRunnerPlugin *plugin, pluginManager->parsingRunnerPlugins() ) {
for ( const ParseRunnerPlugin *plugin: pluginManager->parsingRunnerPlugins() ) {
if (plugin->nameId() == QLatin1String("Cache"))
continue;
......@@ -998,7 +998,7 @@ void MainWindow::openFile()
m_lastFileOpenPath = QFileInfo( firstFile ).absolutePath();
}
foreach( const QString &fileName, fileNames ) {
for( const QString &fileName: fileNames ) {
m_controlView->marbleModel()->addGeoDataFile( fileName );
}
}
......@@ -1264,10 +1264,10 @@ void MainWindow::readSettings(const QVariantMap& overrideSettings)
settings.beginGroup( QString( "Profile %0" ).arg(i) );
QString name = settings.value( "Name", tr( "Unnamed" ) ).toString();
RoutingProfile profile( name );
foreach ( const QString& pluginName, settings.childGroups() ) {
for ( const QString& pluginName: settings.childGroups() ) {
settings.beginGroup( pluginName );
profile.pluginSettings().insert( pluginName, QHash<QString, QVariant>() );
foreach ( const QString& key, settings.childKeys() ) {
for ( const QString& key: settings.childKeys() ) {
if (key != QLatin1String("Enabled")) {
profile.pluginSettings()[ pluginName ].insert( key, settings.value( key ) );
}
......@@ -1295,7 +1295,7 @@ void MainWindow::readSettings(const QVariantMap& overrideSettings)
QString positionProvider = settings.value( "activePositionTrackingPlugin", QString() ).toString();
if ( !positionProvider.isEmpty() ) {
const PluginManager* pluginManager = m_controlView->marbleModel()->pluginManager();
foreach( const PositionProviderPlugin* plugin, pluginManager->positionProviderPlugins() ) {
for( const PositionProviderPlugin* plugin: pluginManager->positionProviderPlugins() ) {
if ( plugin->nameId() == positionProvider ) {
PositionProviderPlugin* instance = plugin->newInstance();
tracking->setPositionProviderPlugin( instance );
......@@ -1401,15 +1401,15 @@ void MainWindow::writeSettings()
settings.beginGroup( QString( "Profile %0" ).arg(i) );
const RoutingProfile& profile = profiles.at( i );
settings.setValue( "Name", profile.name() );
foreach ( const QString& pluginName, settings.childGroups() ) {
for ( const QString& pluginName: settings.childGroups() ) {
settings.beginGroup( pluginName );
settings.remove(QString()); //remove all keys
settings.endGroup();
}
foreach ( const QString &key, profile.pluginSettings().keys() ) {
for ( const QString &key: profile.pluginSettings().keys() ) {
settings.beginGroup( key );
settings.setValue( "Enabled", true );
foreach ( const QString& settingKey, profile.pluginSettings()[ key ].keys() ) {
for ( const QString& settingKey: profile.pluginSettings()[ key ].keys() ) {
Q_ASSERT(settingKey != QLatin1String("Enabled"));
settings.setValue( settingKey, profile.pluginSettings()[ key ][ settingKey ] );
}
......
......@@ -179,7 +179,7 @@ QString ControlView::defaultMapThemeId() const
const QStringList installedThemes = m_mapThemeManager->mapThemeIds();
foreach(const QString &fallback, fallBackThemes) {
for(const QString &fallback: fallBackThemes) {
if (installedThemes.contains(fallback)) {
return fallback;
}
......@@ -260,7 +260,7 @@ bool ControlView::openGeoUri( const QString& geoUriString )
if ( success ) {
if ( uriParser.planet().id() != marbleModel()->planet()->id() ) {
MapThemeManager *manager = mapThemeManager();
foreach( const QString& planetName, manager->mapThemeIds()) {
for( const QString& planetName: manager->mapThemeIds()) {
if ( planetName.startsWith(uriParser.planet().id(), Qt::CaseInsensitive)) {
m_marbleWidget->setMapThemeId(planetName);
break;
......@@ -729,7 +729,7 @@ QList<QAction*> ControlView::setupDockWidgets( QMainWindow *mainWindow )
m_panelActions << m_annotationDock->toggleViewAction();
m_panelActions << legendDock->toggleViewAction();
m_panelActions << tourDock->toggleViewAction();
foreach( QAction* action, m_panelActions ) {
for( QAction* action: m_panelActions ) {
m_panelVisibility << action->isVisible();
}
......@@ -748,7 +748,7 @@ QList<QAction*> ControlView::setupDockWidgets( QMainWindow *mainWindow )
QList<QAction*> panelMenuActions;
panelMenuActions << m_togglePanelVisibilityAction;
panelMenuActions << panelSeparatorAct;
foreach( QAction* action, m_panelActions ) {
for( QAction* action: m_panelActions ) {
panelMenuActions << action;
}
......@@ -828,7 +828,7 @@ void ControlView::updateAnnotationDock()
QSpacerItem *spacer = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding);
if( !tmp_actionGroups->isEmpty() ) {
bool firstToolbarFilled = false;
foreach( QAction *action, tmp_actionGroups->first()->actions() ) {
for( QAction *action: tmp_actionGroups->first()->actions() ) {
if (action->objectName() == QLatin1String("toolbarSeparator")) {
firstToolbarFilled = true;
} else {
......@@ -916,7 +916,7 @@ void ControlView::dragEnterEvent(QDragEnterEvent *event)
// prefer urls
if (mimeData->hasUrls()) {
// be generous and take the first usable url
foreach(const QUrl& url, mimeData->urls()) {
for(const QUrl& url: mimeData->urls()) {
uriParser.setGeoUri(url.url());
success = uriParser.parse();
if (success) {
......@@ -951,7 +951,7 @@ void ControlView::dropEvent(QDropEvent *event)
// prefer urls
if (mimeData->hasUrls()) {
// be generous and take the first usable url
foreach(const QUrl& url, mimeData->urls()) {
for(const QUrl& url: mimeData->urls()) {
success = openGeoUri(url.url());
if (success) {
break;
......
......@@ -153,7 +153,7 @@ AbstractDataPluginModelPrivate::~AbstractDataPluginModelPrivate() {
void AbstractDataPluginModelPrivate::updateFavoriteItems()
{
if ( m_favoriteItemsOnly ) {
foreach( const QString &id, m_favoriteItems ) {
for( const QString &id: m_favoriteItems ) {
if ( !m_parent->findItem( id ) ) {
m_parent->getItem( id );
}
......@@ -210,7 +210,7 @@ int FavoritesModel::rowCount ( const QModelIndex &parent ) const
}
int count = 0;
foreach( AbstractDataPluginItem* item, d->m_itemSet ) {
for( AbstractDataPluginItem* item: d->m_itemSet ) {
if ( item->initialized() && item->isFavorite() ) {
++count;
}
......@@ -224,7 +224,7 @@ QVariant FavoritesModel::data( const QModelIndex &index, int role ) const
int const row = index.row();
if ( row >= 0 && row < rowCount() ) {
int count = 0;
foreach( AbstractDataPluginItem* item, d->m_itemSet ) {
for( AbstractDataPluginItem* item: d->m_itemSet ) {
if ( item->initialized() && item->isFavorite() ) {
if ( count == row ) {
QString const roleName = roleNames().value( role );
......@@ -328,8 +328,8 @@ QList<AbstractDataPluginItem*> AbstractDataPluginModel::items( const ViewportPar
bool collides = false;
int const length = list.length();
for ( int j=0; !collides && j<length; ++j ) {
foreach( const QRectF &rect, list[j]->boundingRects() ) {
foreach( const QRectF &itemRect, (*i)->boundingRects() ) {
for( const QRectF &rect: list[j]->boundingRects() ) {
for( const QRectF &itemRect: (*i)->boundingRects() ) {
if ( rect.intersects( itemRect ) )
collides = true;
}
......@@ -360,7 +360,7 @@ QList<AbstractDataPluginItem *> AbstractDataPluginModel::whichItemAt( const QPoi
QList<AbstractDataPluginItem *> itemsAt;
const QPointF curposF(curpos);
foreach( AbstractDataPluginItem* item, d->m_displayedItems ) {
for( AbstractDataPluginItem* item: d->m_displayedItems ) {
if (item && item->contains(curposF)) {
itemsAt.append( item );
}
......@@ -408,7 +408,7 @@ void AbstractDataPluginModel::addItemsToList( const QList<AbstractDataPluginItem
{
bool needsUpdate = false;
bool favoriteChanged = false;
foreach( AbstractDataPluginItem *item, items ) {
for( AbstractDataPluginItem *item: items ) {
if( !item ) {
continue;
}
......@@ -540,7 +540,7 @@ QString AbstractDataPluginModelPrivate::generateFilepath( const QString& id, con
AbstractDataPluginItem *AbstractDataPluginModel::findItem( const QString& id ) const
{
foreach ( AbstractDataPluginItem *item, d->m_itemSet ) {
for ( AbstractDataPluginItem *item: d->m_itemSet ) {
if( item->id() == id ) {
return item;
}
......
......@@ -65,10 +65,10 @@ void BookmarkManagerPrivate::resetBookmarkDocument()
}
void BookmarkManagerPrivate::setVisualCategory( GeoDataContainer *container ) {
foreach( GeoDataFolder* folder, container->folderList() ) {
for( GeoDataFolder* folder: container->folderList() ) {
setVisualCategory( folder );
}
foreach( GeoDataPlacemark* placemark, container->placemarkList() ) {
for( GeoDataPlacemark* placemark: container->placemarkList() ) {
placemark->setVisualCategory(GeoDataPlacemark::Bookmark);
placemark->setZoomLevel( 1 );
}
......@@ -163,13 +163,13 @@ void BookmarkManager::removeBookmark( GeoDataPlacemark *bookmark )
GeoDataPlacemark* BookmarkManager::bookmarkAt(GeoDataContainer *container, const GeoDataCoordinates &coordinate)
{
foreach ( GeoDataFolder *folder, container->folderList() ) {
for ( GeoDataFolder *folder: container->folderList() ) {
GeoDataPlacemark *placemark = bookmarkAt(folder, coordinate);
if ( placemark )
return placemark;
}
foreach ( GeoDataPlacemark *placemark, container->placemarkList() ) {
for ( GeoDataPlacemark *placemark: container->placemarkList() ) {
if ( placemark->coordinate() == coordinate )
return placemark;
}
......@@ -310,7 +310,7 @@ GeoDataDocument* BookmarkManager::openFile( const QString &fileName )
}
result->setDocumentRole( BookmarkDocument );
foreach( GeoDataFolder* folder, result->folderList() ) {
for( GeoDataFolder* folder: result->folderList() ) {
BookmarkManagerPrivate::setVisualCategory( folder );
}
......
......@@ -446,10 +446,10 @@ void BookmarkManagerDialog::importBookmarks()
void BookmarkManagerDialogPrivate::importBookmarksRecursively( GeoDataContainer *source, GeoDataContainer *destination, bool &replaceAll, bool &skipAll )
{
foreach( GeoDataFolder *newFolder, source->folderList() ) {
for( GeoDataFolder *newFolder: source->folderList() ) {
GeoDataFolder *existingFolder = m_manager->addNewBookmarkFolder(destination, newFolder->name());
importBookmarksRecursively(newFolder, existingFolder, skipAll, replaceAll);
foreach( GeoDataPlacemark* newPlacemark, newFolder->placemarkList() ) {
for( GeoDataPlacemark* newPlacemark: newFolder->placemarkList() ) {
bool added = skipAll;
GeoDataCoordinates newCoordinate = newPlacemark->coordinate();
......
......@@ -144,7 +144,7 @@ void ClipPainter::drawPolygon ( const QPolygonF & polygon,
d->clipPolyObject( polygon, clippedPolyObjects, true );
foreach( const QPolygonF & clippedPolyObject, clippedPolyObjects ) {
for( const QPolygonF & clippedPolyObject: clippedPolyObjects ) {
if ( clippedPolyObject.size() > 2 ) {
// mDebug() << "Size: " << clippedPolyObject.size();
if (d->m_debugPolygonsLevel) {
......@@ -196,7 +196,7 @@ void ClipPainter::drawPolyline( const QPolygonF & polygon )
d->clipPolyObject( polygon, clippedPolyObjects, false );
foreach( const QPolygonF & clippedPolyObject, clippedPolyObjects ) {
for( const QPolygonF & clippedPolyObject: clippedPolyObjects ) {
if ( clippedPolyObject.size() > 1 ) {
if (d->m_debugPolygonsLevel) {
QPen pen = QPainter::pen();
......@@ -248,7 +248,7 @@ void ClipPainter::drawPolyline(const QPolygonF & polygon, QVector<QPointF>& labe
d->clipPolyObject( polygon, clippedPolyObjects, false );
foreach( const QPolygonF & clippedPolyObject, clippedPolyObjects ) {
for( const QPolygonF & clippedPolyObject: clippedPolyObjects ) {
if (d->m_debugPolygonsLevel) {
QPen pen = QPainter::pen();
QPen originalPen = pen;
......
......@@ -111,7 +111,7 @@ void CurrentLocationWidget::setMarbleWidget( MarbleWidget *widget )
const PluginManager* pluginManager = d->m_widget->model()->pluginManager();
d->m_positionProviderPlugins = pluginManager->positionProviderPlugins();
foreach( const PositionProviderPlugin *plugin, d->m_positionProviderPlugins ) {
for( const PositionProviderPlugin *plugin: d->m_positionProviderPlugins ) {
d->m_currentLocationUi.positionTrackingComboBox->addItem( plugin->guiString() );
}
if ( d->m_positionProviderPlugins.isEmpty() ) {
......@@ -318,7 +318,7 @@ void CurrentLocationWidgetPrivate::receiveGpsCoordinates( const GeoDataCoordinat
void CurrentLocationWidgetPrivate::changePositionProvider( const QString &provider )
{
foreach( const PositionProviderPlugin* plugin, m_positionProviderPlugins ) {
for( const PositionProviderPlugin* plugin: m_positionProviderPlugins ) {
if ( plugin->guiString() == provider ) {
m_currentLocationUi.locationLabel->setEnabled( true );
PositionProviderPlugin* instance = plugin->newInstance();
......
......@@ -54,7 +54,7 @@ void DataMigration::exec()
return;
}
foreach( const QString& oldLocalPath, oldLocalPaths ) {
for( const QString& oldLocalPath: oldLocalPaths ) {
QDir oldLocalDir( oldLocalPath );
if( oldLocalDir.entryList( QDir::AllEntries | QDir::NoDotAndDotDot ).size() == 0 ) {
......@@ -151,7 +151,7 @@ void DataMigration::moveFiles( const QString& source, const QString& target )
}
else {
// Add child directories to the stack
foreach( const QString& childDir, childDirs ) {
for( const QString& childDir: childDirs ) {
dirs.push(sourceDirPath + QLatin1Char('/') + childDir);
progressSliceSizeStack.push( childSliceSize );
}
......@@ -163,7 +163,7 @@ void DataMigration::moveFiles( const QString& source, const QString& target )
QDir().mkpath( targetDirPath );
// Copying contents
foreach( const QString& file, files ) {
for( const QString& file: files ) {
if( progressDialog.wasCanceled() ) {
return;
}
......
......@@ -86,7 +86,7 @@ void EditBookmarkDialogPrivate::initialize()
void EditBookmarkDialogPrivate::initComboBox( const GeoDataContainer* const container, int level )
{
m_bookmarkManager->ensureDefaultFolder();
foreach( GeoDataFolder *folder, container->folderList() ) {
for( GeoDataFolder *folder: container->folderList() ) {
QVariant folderVariant;
folderVariant.setValue(folder);
QString name = QString(' ').repeated(4*level) + folder->name();
......
......@@ -36,10 +36,11 @@ ExternalEditorDialogPrivate::ExternalEditorDialogPrivate() :
m_defaultEditor( potlatch )
{
QString path = QProcessEnvironment::systemEnvironment().value(QStringLiteral("PATH"), QStringLiteral("/usr/local/bin:/usr/bin:/bin"));
foreach( const QString &application, QStringList() << merkaartor << josm ) {
auto const applications = QStringList() << merkaartor << josm;
for( const QString &application: applications ) {
m_installedEditors[application] = false;
/** @todo: what's the qt way to get the path entry separator? Will be a semicolon on Windows */
foreach( const QString &dir, path.split( QLatin1Char( ':' ) ) ) {
for( const QString &dir: path.split( QLatin1Char( ':' ) ) ) {
QFileInfo executable( QDir( dir ), application );
if ( executable.exists() ) {
m_installedEditors[application] = true;
......
......@@ -223,7 +223,7 @@ void FileLoaderPrivate::documentParsed( GeoDataDocument* doc, const QString& err
}
if (m_renderOrder != 0) {
foreach (GeoDataPlacemark* placemark, doc->placemarkList()) {
for (GeoDataPlacemark* placemark: doc->placemarkList()) {
if (placemark->geometry() && placemark->geometry()->nodeType() == GeoDataTypes::GeoDataPolygonType) {
GeoDataPolygon *polygon = static_cast<GeoDataPolygon*>(placemark->geometry());
polygon->setRenderOrder(m_renderOrder);
......
......@@ -43,7 +43,7 @@ public:
~FileManagerPrivate()
{
foreach ( FileLoader *loader, m_loaderList ) {
for ( FileLoader *loader: m_loaderList ) {
if ( loader ) {
loader->wait();
}
......@@ -83,7 +83,7 @@ void FileManager::addFile( const QString& filepath, const QString& property, con
return; // already loaded
}
foreach ( const FileLoader *loader, d->m_loaderList ) {
for ( const FileLoader *loader: d->m_loaderList ) {
if ( loader->path() == filepath )
return; // currently loading
}
......@@ -112,7 +112,7 @@ void FileManagerPrivate::appendLoader( FileLoader *loader )
void FileManager::removeFile( const QString& key )
{
foreach ( FileLoader *loader, d->m_loaderList ) {
for ( FileLoader *loader: d->m_loaderList ) {
if ( loader->path() == key ) {
disconnect( loader, 0, this, 0 );
loader->wait();
......
......@@ -93,7 +93,7 @@ void GeoDataTreeModel::Private::checkParenting( GeoDataObject *object )
if( object->nodeType() == GeoDataTypes::GeoDataDocumentType
|| object->nodeType() == GeoDataTypes::GeoDataFolderType ) {
GeoDataContainer *container = static_cast<GeoDataContainer*>( object );
foreach( GeoDataFeature *child, container->featureList() ) {
for( GeoDataFeature *child: container->featureList() ) {
if ( child->parent() != container ) {
qWarning() << "Parenting mismatch for " << child->name();
Q_ASSERT( 0 );
......
......@@ -138,7 +138,7 @@ QList< GeoGraphicsItem* > GeoGraphicsScene::items( const GeoDataLatLonBox &box,
for ( int y = y1; y <= y2; ++y ) {
bool const isBorder = isBorderX || y == y1 || y == y2;
const TileId tileId = TileId( 0, level, x, y );
foreach(GeoGraphicsItem *object, d->m_tiledItems.value( tileId )) {
for(GeoGraphicsItem *object: d->m_tiledItems.value( tileId )) {
if (object->minZoomLevel() <= zoomLevel && object->visible()) {
if (!isBorder || object->latLonAltBox().intersects(box)) {
result.push_back(object);
......@@ -173,7 +173,7 @@ void GeoGraphicsScene::applyHighlight( const QVector< GeoDataPlacemark* > &selec
* First set the items, which were selected previously, to
* use normal style
*/
foreach ( GeoGraphicsItem *item, d->m_selectedItems ) {
for ( GeoGraphicsItem *item: d->m_selectedItems ) {
item->setHighlighted( false );
}
......@@ -185,7 +185,7 @@ void GeoGraphicsScene::applyHighlight( const QVector< GeoDataPlacemark* > &selec
* while clicking, and update corresponding graphics
* items to use highlight style
*/
foreach( const GeoDataPlacemark *placemark, selectedPlacemarks ) {
for( const GeoDataPlacemark *placemark: selectedPlacemarks ) {
for (auto tileIter = d->m_features.find(placemark); tileIter != d->m_features.end(); ++tileIter) {
auto const & clickedItems = d->m_tiledItems[*tileIter];
auto iter = clickedItems.find(placemark);
......@@ -213,7 +213,7 @@ void GeoGraphicsScene::applyHighlight( const QVector< GeoDataPlacemark* > &selec
* highlight styleId
*/
else {
foreach ( const GeoDataStyleMap &styleMap, doc->styleMaps() ) {
for ( const GeoDataStyleMap &styleMap: doc->styleMaps() ) {
GeoDataStyle::Ptr style = d->highlightStyle( doc, styleMap );
if ( style ) {