diff options
author | Tim Jenssen <tim.jenssen@qt.io> | 2017-04-26 13:51:48 +0200 |
---|---|---|
committer | Tim Jenssen <tim.jenssen@qt.io> | 2017-04-26 14:16:23 +0000 |
commit | 7ed0385e1baf23723625e9a1189837b215abfa89 (patch) | |
tree | d927e098ccc8fb098747da9ff53fbb42d097deaa | |
parent | 59535078285d46d88ca4287a9edae803a1b9150d (diff) |
QmlDesigner: fix pathes -> paths and use initializer_lists
Change-Id: Ifa155bebd982e798d3ac576cd07ee54d816f5aae
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
-rw-r--r-- | src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp | 31 | ||||
-rw-r--r-- | src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp | 6 |
2 files changed, 19 insertions, 18 deletions
diff --git a/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp b/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp index b21e45ef79..eff35688c5 100644 --- a/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp +++ b/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp @@ -111,23 +111,24 @@ QDateTime PuppetCreator::qtLastModified() const QDateTime PuppetCreator::puppetSourceLastModified() const { - QString basePuppetSourcePath = puppetSourceDirectoryPath(); - QStringList sourceDirectoryPathes; - QDateTime lastModified; + const QString basePuppetSourcePath = puppetSourceDirectoryPath(); + + const QStringList sourceDirectoryPaths = { + basePuppetSourcePath + "/commands", + basePuppetSourcePath + "/container", + basePuppetSourcePath + "/instances", + basePuppetSourcePath + "/interfaces", + basePuppetSourcePath + "/types", + basePuppetSourcePath + "/qmlpuppet", + basePuppetSourcePath + "/qmlpuppet/instances", + basePuppetSourcePath + "/qml2puppet", + basePuppetSourcePath + "/qml2puppet/instances" + }; - sourceDirectoryPathes.append(basePuppetSourcePath + QStringLiteral("/commands")); - sourceDirectoryPathes.append(basePuppetSourcePath + QStringLiteral("/container")); - sourceDirectoryPathes.append(basePuppetSourcePath + QStringLiteral("/instances")); - sourceDirectoryPathes.append(basePuppetSourcePath + QStringLiteral("/interfaces")); - sourceDirectoryPathes.append(basePuppetSourcePath + QStringLiteral("/types")); - sourceDirectoryPathes.append(basePuppetSourcePath + QStringLiteral("/qmlpuppet")); - sourceDirectoryPathes.append(basePuppetSourcePath + QStringLiteral("/qmlpuppet/instances")); - sourceDirectoryPathes.append(basePuppetSourcePath + QStringLiteral("/qml2puppet")); - sourceDirectoryPathes.append(basePuppetSourcePath + QStringLiteral("/qml2puppet/instances")); - - foreach (const QString directoryPath, sourceDirectoryPathes) { + QDateTime lastModified; + foreach (const QString directoryPath, sourceDirectoryPaths) { foreach (const QFileInfo fileEntry, QDir(directoryPath).entryInfoList()) { - QDateTime filePathLastModified = fileEntry.lastModified(); + const QDateTime filePathLastModified = fileEntry.lastModified(); if (lastModified < filePathLastModified) lastModified = filePathLastModified; } diff --git a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp index af2d24ce95..637e23ddc4 100644 --- a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp +++ b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp @@ -2029,9 +2029,9 @@ void TextToModelMerger::populateQrcMapping(const QString &filePath) const QString fileName = fileForFullQrcPath(filePath); path.remove(QLatin1String("qrc:")); QMap<QString,QStringList> map = ModelManagerInterface::instance()->filesInQrcPath(path); - const QStringList qrcFilePathes = map.value(fileName, QStringList()); - if (!qrcFilePathes.isEmpty()) { - QString fileSystemPath = qrcFilePathes.first(); + const QStringList qrcFilePaths = map.value(fileName, {}); + if (!qrcFilePaths.isEmpty()) { + QString fileSystemPath = qrcFilePaths.first(); fileSystemPath.remove(fileName); if (path.isEmpty()) path.prepend(QLatin1String("/")); |