summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Zotti <Georg.Zotti@univie.ac.at>2022-03-21 10:27:17 +0100
committerGeorg Zotti <Georg.Zotti@univie.ac.at>2022-03-21 10:34:20 +0100
commit644c24c8d9a6a93fa41d03598dfc9267318a3219 (patch)
tree83c560dff35c951459817591088dd270b5ec455e
parent3bebc966fa849477a1b18b88c56cce84cbcd10a2 (diff)
Fix a few clazy warnings and cosmetics
-rw-r--r--src/core/StelModuleMgr.cpp4
-rw-r--r--src/core/modules/LandscapeMgr.cpp10
-rw-r--r--src/main.cpp10
-rw-r--r--src/tests/testStelFileMgr.cpp10
4 files changed, 17 insertions, 17 deletions
diff --git a/src/core/StelModuleMgr.cpp b/src/core/StelModuleMgr.cpp
index 2f5ca7e1c5..ca400c010f 100644
--- a/src/core/StelModuleMgr.cpp
+++ b/src/core/StelModuleMgr.cpp
@@ -212,7 +212,7 @@ void StelModuleMgr::generateCallingLists()
// Flush previous call orders
mc.value().clear();
// and init them with modules in creation order
- for (auto* m : getAllModules())
+ for (auto& m : getAllModules())
{
mc.value().push_back(m);
}
@@ -232,7 +232,7 @@ QList<StelModuleMgr::PluginDescriptor> StelModuleMgr::getPluginsList()
// First list all static plugins.
// If a dynamic plugin with the same ID exists, it will take precedence on the static one.
- for (auto* plugin : QPluginLoader::staticInstances())
+ for (auto& plugin : QPluginLoader::staticInstances())
{
StelPluginInterface* pluginInterface = qobject_cast<StelPluginInterface*>(plugin);
if (pluginInterface)
diff --git a/src/core/modules/LandscapeMgr.cpp b/src/core/modules/LandscapeMgr.cpp
index 6cc3b8fa2e..b3de3d9b73 100644
--- a/src/core/modules/LandscapeMgr.cpp
+++ b/src/core/modules/LandscapeMgr.cpp
@@ -985,12 +985,12 @@ QStringList LandscapeMgr::getAllLandscapeIDs() const
QStringList LandscapeMgr::getUserLandscapeIDs() const
{
QStringList result;
- for (auto &id : getNameToDirMap().values())
+ QMapIterator<QString, QString> it(getNameToDirMap());
+ while (it.hasNext())
{
- if(!packagedLandscapeIDs.contains(id))
- {
- result.append(id);
- }
+ it.next();
+ if(!packagedLandscapeIDs.contains(it.value()))
+ result.append(it.value());
}
return result;
}
diff --git a/src/main.cpp b/src/main.cpp
index bc544d398d..86c492bd80 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -87,17 +87,17 @@ class CustomQTranslator : public QTranslator
{
using QTranslator::translate;
public:
- virtual bool isEmpty() const { return false; }
+ virtual bool isEmpty() const Q_DECL_OVERRIDE { return false; }
//! Overrides QTranslator::translate().
//! Calls StelTranslator::qtranslate().
//! @param context Qt context string - IGNORED.
//! @param sourceText the source message.
//! @param comment optional parameter
- virtual QString translate(const char *context, const char *sourceText, const char *disambiguation = Q_NULLPTR, int n = -1) const
+ virtual QString translate(const char *context, const char *sourceText, const char *disambiguation = Q_NULLPTR, int n = -1) const Q_DECL_OVERRIDE
{
- Q_UNUSED(context);
- Q_UNUSED(n);
+ Q_UNUSED(context)
+ Q_UNUSED(n)
return StelTranslator::globalTranslator->qtranslate(sourceText, disambiguation);
}
};
@@ -318,7 +318,7 @@ int main(int argc, char **argv)
delete confSettings;
QString backupFile(configFileFullPath.left(configFileFullPath.length()-3) + QString("old"));
- if (QFileInfo(backupFile).exists())
+ if (QFileInfo::exists(backupFile))
QFile(backupFile).remove();
QFile(configFileFullPath).rename(backupFile);
diff --git a/src/tests/testStelFileMgr.cpp b/src/tests/testStelFileMgr.cpp
index 8982140ad1..9653694e5b 100644
--- a/src/tests/testStelFileMgr.cpp
+++ b/src/tests/testStelFileMgr.cpp
@@ -68,7 +68,7 @@ void TestStelFileMgr::initTestCase()
<< partialPath2+"/landscapes/ls3/landscape.ini"
<< partialPath2+"/inboth.txt";
- for (const auto& path : testDirs)
+ for (const auto& path : qAsConst(testDirs))
{
if (!QDir().mkdir(path))
{
@@ -77,7 +77,7 @@ void TestStelFileMgr::initTestCase()
}
// create test files as empty files...
- for (const auto& path : testFiles)
+ for (const auto& path : qAsConst(testFiles))
{
QFile f(path);
if (!f.open(QIODevice::WriteOnly))
@@ -180,11 +180,11 @@ void TestStelFileMgr::testFindFileNew()
//QVERIFY(existsInBoth.isEmpty());
QVERIFY(!notExistsInOne.isEmpty());
- QVERIFY(!QFileInfo(notExistsInOne).exists());
+ QVERIFY(!QFileInfo::exists(notExistsInOne));
QVERIFY(QFileInfo(notExistsInOne).fileName()=="config.ini");
QVERIFY(!notExistsInBoth.isEmpty());
- QVERIFY(!QFileInfo(notExistsInBoth).exists());
+ QVERIFY(!QFileInfo::exists(notExistsInBoth));
QVERIFY(QFileInfo(notExistsInBoth).fileName()=="notexists");
}
@@ -197,7 +197,7 @@ void TestStelFileMgr::testFindFileNewAbs()
QVERIFY(existsInBoth.isEmpty());
QVERIFY(!notExistsInOne.isEmpty());
- QVERIFY(!QFileInfo(notExistsInOne).exists());
+ QVERIFY(!QFileInfo::exists(notExistsInOne));
QVERIFY(QFileInfo(notExistsInOne).fileName()=="config.ini");
}