r22669 by jghali - remove a few more Qt foreach and replace them by C++11 range-for
scribus-commit
scribus-commit at lists.scribus.net
Wed Sep 5 00:43:13 UTC 2018
Author: jghali
Date: Wed Sep 5 00:43:12 2018
New Revision: 22669
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22669
Log:
remove a few more Qt foreach and replace them by C++11 range-for
Modified:
trunk/Scribus/scribus/scpaths.cpp
trunk/Scribus/scribus/ui/smpstylewidget.cpp
Modified: trunk/Scribus/scribus/scpaths.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22669&path=/trunk/Scribus/scribus/scpaths.cpp
==============================================================================
--- trunk/Scribus/scribus/scpaths.cpp (original)
+++ trunk/Scribus/scribus/scpaths.cpp Wed Sep 5 00:43:12 2018
@@ -274,18 +274,16 @@
if (d.exists())
{
QStringList dictDirFilters("dict-*");
- QStringList dictDirList(d.entryList(dictDirFilters, QDir::Dirs, QDir::Name));
- QString dir;
- foreach (dir, dictDirList)
+ const QStringList dictDirList(d.entryList(dictDirFilters, QDir::Dirs, QDir::Name));
+ for (const QString& dir : dictDirList)
spellDirs.append(osxLibreOfficePath + "/" + dir + "/");
}
d.setPath(osxUserLibreOfficePath);
if (d.exists())
{
QStringList dictDirFilters("dict-*");
- QStringList dictDirList(d.entryList(dictDirFilters, QDir::Dirs, QDir::Name));
- QString dir;
- foreach (dir, dictDirList)
+ const QStringList dictDirList(d.entryList(dictDirFilters, QDir::Dirs, QDir::Name));
+ for (const QString& dir : dictDirList)
spellDirs.append(osxUserLibreOfficePath + "/" + dir + "/");
}
@@ -296,9 +294,8 @@
if (d.exists())
{
QStringList dictDirFilters("dict-*");
- QStringList dictDirList(d.entryList(dictDirFilters, QDir::Dirs, QDir::Name));
- QString dir;
- foreach (dir, dictDirList)
+ const QStringList dictDirList(d.entryList(dictDirFilters, QDir::Dirs, QDir::Name));
+ for (const QString& dir : dictDirList)
spellDirs.append(progFiles+windowsLOPath + "/" + dir + "/");
}
#elif defined(Q_OS_LINUX)
@@ -339,18 +336,16 @@
if (d.exists())
{
QStringList dictDirFilters("dict-*");
- QStringList dictDirList(d.entryList(dictDirFilters, QDir::Dirs, QDir::Name));
- QString dir;
- foreach (dir, dictDirList)
+ const QStringList dictDirList(d.entryList(dictDirFilters, QDir::Dirs, QDir::Name));
+ for (const QString& dir : dictDirList)
hyphDirs.append(osxLibreOfficePath + "/" + dir + "/");
}
d.setPath(osxUserLibreOfficePath);
if (d.exists())
{
QStringList dictDirFilters("dict-*");
- QStringList dictDirList(d.entryList(dictDirFilters, QDir::Dirs, QDir::Name));
- QString dir;
- foreach (dir, dictDirList)
+ const QStringList dictDirList(d.entryList(dictDirFilters, QDir::Dirs, QDir::Name));
+ for (const QString& dir : dictDirList)
hyphDirs.append(osxUserLibreOfficePath + "/" + dir + "/");
}
@@ -361,9 +356,8 @@
if (d.exists())
{
QStringList dictDirFilters("dict-*");
- QStringList dictDirList(d.entryList(dictDirFilters, QDir::Dirs, QDir::Name));
- QString dir;
- foreach (dir, dictDirList)
+ const QStringList dictDirList(d.entryList(dictDirFilters, QDir::Dirs, QDir::Name));
+ for (const QString& dir : dictDirList)
hyphDirs.append(progFiles+windowsLOPath + "/" + dir + "/");
}
#elif defined(Q_OS_LINUX)
@@ -442,21 +436,18 @@
QStringList ScPaths::dirsFromEnvVar(const QString& envVar, const QString& dirToFind)
{
- QChar sep(':');
-#ifdef _WIN32
- sep=';';
-#endif
+ QChar sep(ScPaths::envPathSeparator);
QStringList dirs;
#if defined(Q_OS_MAC) || defined(Q_OS_UNIX)
- QStringList env(QProcess::systemEnvironment());
+ const QStringList env(QProcess::systemEnvironment());
QString path_data;
- foreach (QString line, env)
+ for (const QString& line : env)
{
if (line.indexOf(envVar) == 0)
path_data = line.mid(envVar.length()+1); //eg, Strip "XDG_DATA_DIRS="
}
- QStringList splitpath_data(path_data.split(sep, QString::SkipEmptyParts));
- foreach (QString dir, splitpath_data)
+ const QStringList splitpath_data(path_data.split(sep, QString::SkipEmptyParts));
+ for (QString dir : splitpath_data)
{
QFileInfo info(dir+dirToFind);
if (info.exists())
Modified: trunk/Scribus/scribus/ui/smpstylewidget.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22669&path=/trunk/Scribus/scribus/ui/smpstylewidget.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/smpstylewidget.cpp (original)
+++ trunk/Scribus/scribus/ui/smpstylewidget.cpp Wed Sep 5 00:43:12 2018
@@ -198,7 +198,8 @@
void SMPStyleWidget::fillNumerationsCombo()
{
QStringList numNames;
- foreach (const QString& numName, m_Doc->numerations.keys())
+ const auto numerationKeys = m_Doc->numerations.keys();
+ foreach (const QString& numName, numerationKeys)
numNames.append(numName);
numNames.sort();
numComboBox->clear();
More information about the scribus-commit
mailing list