diff options
9 files changed, 28 insertions, 31 deletions
diff --git a/src/plugins/qmlprojectmanager/fileformat/filefilteritems.cpp b/src/plugins/qmlprojectmanager/fileformat/filefilteritems.cpp index 21863b48d3..233712dc06 100644 --- a/src/plugins/qmlprojectmanager/fileformat/filefilteritems.cpp +++ b/src/plugins/qmlprojectmanager/fileformat/filefilteritems.cpp @@ -37,9 +37,7 @@ namespace QmlProjectManager { FileFilterBaseItem::FileFilterBaseItem(QObject *parent) : - QmlProjectContentItem(parent), - m_recurse(RecurseDefault), - m_dirWatcher(0) + QmlProjectContentItem(parent) { m_updateFileListTimer.setSingleShot(true); m_updateFileListTimer.setInterval(50); diff --git a/src/plugins/qmlprojectmanager/fileformat/filefilteritems.h b/src/plugins/qmlprojectmanager/fileformat/filefilteritems.h index 3b44d8b06c..c10d7405ef 100644 --- a/src/plugins/qmlprojectmanager/fileformat/filefilteritems.h +++ b/src/plugins/qmlprojectmanager/fileformat/filefilteritems.h @@ -48,7 +48,7 @@ class FileFilterBaseItem : public QmlProjectContentItem { Q_PROPERTY(QStringList files READ files NOTIFY filesChanged DESIGNABLE false) public: - FileFilterBaseItem(QObject *parent = 0); + FileFilterBaseItem(QObject *parent = nullptr); QString directory() const; void setDirectory(const QString &directoryPath); @@ -81,7 +81,7 @@ private: QString absoluteDir() const; bool fileMatches(const QString &fileName) const; - QSet<QString> filesInSubTree(const QDir &rootDir, const QDir &dir, QSet<QString> *parsedDirs = 0); + QSet<QString> filesInSubTree(const QDir &rootDir, const QDir &dir, QSet<QString> *parsedDirs = nullptr); Utils::FileSystemWatcher *dirWatcher(); QStringList watchedDirectories() const; @@ -99,12 +99,12 @@ private: RecurseDefault // not set explicitly }; - RecursiveOption m_recurse; + RecursiveOption m_recurse = RecurseDefault; QStringList m_explicitFiles; QSet<QString> m_files; - Utils::FileSystemWatcher *m_dirWatcher; + Utils::FileSystemWatcher *m_dirWatcher = nullptr; QTimer m_updateFileListTimer; @@ -115,7 +115,7 @@ class QmlFileFilterItem : public FileFilterBaseItem { Q_OBJECT public: - QmlFileFilterItem(QObject *parent = 0); + QmlFileFilterItem(QObject *parent = nullptr); }; class JsFileFilterItem : public FileFilterBaseItem { @@ -128,7 +128,7 @@ signals: void filterChanged(); public: - JsFileFilterItem(QObject *parent = 0); + JsFileFilterItem(QObject *parent = nullptr); }; class ImageFileFilterItem : public FileFilterBaseItem { @@ -141,7 +141,7 @@ signals: void filterChanged(); public: - ImageFileFilterItem(QObject *parent = 0); + ImageFileFilterItem(QObject *parent = nullptr); }; class CssFileFilterItem : public FileFilterBaseItem { @@ -154,7 +154,7 @@ signals: void filterChanged(); public: - CssFileFilterItem(QObject *parent = 0); + CssFileFilterItem(QObject *parent = nullptr); }; class OtherFileFilterItem : public FileFilterBaseItem { @@ -167,7 +167,7 @@ signals: void filterChanged(); public: - OtherFileFilterItem(QObject *parent = 0); + OtherFileFilterItem(QObject *parent = nullptr); }; } // namespace QmlProjectManager diff --git a/src/plugins/qmlprojectmanager/fileformat/qmlprojectfileformat.cpp b/src/plugins/qmlprojectmanager/fileformat/qmlprojectfileformat.cpp index 01054df127..9947f2f7d5 100644 --- a/src/plugins/qmlprojectmanager/fileformat/qmlprojectfileformat.cpp +++ b/src/plugins/qmlprojectmanager/fileformat/qmlprojectfileformat.cpp @@ -74,11 +74,11 @@ QmlProjectItem *QmlProjectFileFormat::parseProjectFile(const Utils::FileName &fi qWarning() << simpleQmlJSReader.errors(); if (errorMessage) *errorMessage = simpleQmlJSReader.errors().join(QLatin1String(", ")); - return 0; + return nullptr; } if (rootNode->name() == QLatin1String("Project")) { - QmlProjectItem *projectItem = new QmlProjectItem(); + auto projectItem = new QmlProjectItem; const QVariant mainFileProperty = rootNode->property(QLatin1String("mainFile")); if (mainFileProperty.isValid()) @@ -99,32 +99,32 @@ QmlProjectItem *QmlProjectFileFormat::parseProjectFile(const Utils::FileName &fi if (childNode->name() == QLatin1String("QmlFiles")) { if (debug) qDebug() << "QmlFiles"; - QmlFileFilterItem *qmlFileFilterItem = new QmlFileFilterItem(projectItem); + auto qmlFileFilterItem = new QmlFileFilterItem(projectItem); setupFileFilterItem(qmlFileFilterItem, childNode); projectItem->appendContent(qmlFileFilterItem); } else if (childNode->name() == QLatin1String("JavaScriptFiles")) { if (debug) qDebug() << "JavaScriptFiles"; - JsFileFilterItem *jsFileFilterItem = new JsFileFilterItem(projectItem); + auto jsFileFilterItem = new JsFileFilterItem(projectItem); setupFileFilterItem(jsFileFilterItem, childNode); projectItem->appendContent(jsFileFilterItem); } else if (childNode->name() == QLatin1String("ImageFiles")) { if (debug) qDebug() << "ImageFiles"; - ImageFileFilterItem *imageFileFilterItem = new ImageFileFilterItem(projectItem); + auto imageFileFilterItem = new ImageFileFilterItem(projectItem); setupFileFilterItem(imageFileFilterItem, childNode); projectItem->appendContent(imageFileFilterItem); } else if (childNode->name() == QLatin1String("CssFiles")) { if (debug) qDebug() << "CssFiles"; - CssFileFilterItem *cssFileFilterItem = new CssFileFilterItem(projectItem); + auto cssFileFilterItem = new CssFileFilterItem(projectItem); setupFileFilterItem(cssFileFilterItem, childNode); projectItem->appendContent(cssFileFilterItem); } else if (childNode->name() == QLatin1String("Files")) { if (debug) qDebug() << "Files"; - OtherFileFilterItem *otherFileFilterItem = new OtherFileFilterItem(projectItem); + auto otherFileFilterItem = new OtherFileFilterItem(projectItem); setupFileFilterItem(otherFileFilterItem, childNode); projectItem->appendContent(otherFileFilterItem); } else if (childNode->name() == "Environment") { @@ -144,7 +144,7 @@ QmlProjectItem *QmlProjectFileFormat::parseProjectFile(const Utils::FileName &fi if (errorMessage) *errorMessage = tr("Invalid root element: %1").arg(rootNode->name()); - return 0; + return nullptr; } } // namespace QmlProjectManager diff --git a/src/plugins/qmlprojectmanager/fileformat/qmlprojectfileformat.h b/src/plugins/qmlprojectmanager/fileformat/qmlprojectfileformat.h index 12a152b125..70c5870347 100644 --- a/src/plugins/qmlprojectmanager/fileformat/qmlprojectfileformat.h +++ b/src/plugins/qmlprojectmanager/fileformat/qmlprojectfileformat.h @@ -39,7 +39,8 @@ class QmlProjectFileFormat Q_DECLARE_TR_FUNCTIONS(QmlProjectManager::QmlProjectFileFormat) public: - static QmlProjectItem *parseProjectFile(const Utils::FileName &fileName, QString *errorMessage = 0); + static QmlProjectItem *parseProjectFile(const Utils::FileName &fileName, + QString *errorMessage = nullptr); }; } // namespace QmlProjectManager diff --git a/src/plugins/qmlprojectmanager/fileformat/qmlprojectitem.cpp b/src/plugins/qmlprojectmanager/fileformat/qmlprojectitem.cpp index 426db64df1..514a5bdff3 100644 --- a/src/plugins/qmlprojectmanager/fileformat/qmlprojectitem.cpp +++ b/src/plugins/qmlprojectmanager/fileformat/qmlprojectitem.cpp @@ -38,9 +38,8 @@ void QmlProjectItem::setSourceDirectory(const QString &directoryPath) m_sourceDirectory = directoryPath; - for (int i = 0; i < m_content.size(); ++i) { - QmlProjectContentItem *contentElement = m_content.at(i); - FileFilterBaseItem *fileFilter = qobject_cast<FileFilterBaseItem*>(contentElement); + for (auto contentElement : qAsConst(m_content)) { + auto fileFilter = qobject_cast<FileFilterBaseItem*>(contentElement); if (fileFilter) { fileFilter->setDefaultDirectory(directoryPath); connect(fileFilter, &FileFilterBaseItem::filesChanged, diff --git a/src/plugins/qmlprojectmanager/fileformat/qmlprojectitem.h b/src/plugins/qmlprojectmanager/fileformat/qmlprojectitem.h index 2fcbe5de40..086b34a7b8 100644 --- a/src/plugins/qmlprojectmanager/fileformat/qmlprojectitem.h +++ b/src/plugins/qmlprojectmanager/fileformat/qmlprojectitem.h @@ -38,7 +38,7 @@ class QmlProjectContentItem : public QObject { Q_OBJECT public: - QmlProjectContentItem(QObject *parent = 0) : QObject(parent) {} + QmlProjectContentItem(QObject *parent = nullptr) : QObject(parent) {} }; class QmlProjectItem : public QObject diff --git a/src/plugins/qmlprojectmanager/qmlprojectenvironmentaspect.cpp b/src/plugins/qmlprojectmanager/qmlprojectenvironmentaspect.cpp index 8c85c0553e..0a81e39bf4 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectenvironmentaspect.cpp +++ b/src/plugins/qmlprojectmanager/qmlprojectenvironmentaspect.cpp @@ -47,7 +47,7 @@ Environment QmlProjectEnvironmentAspect::baseEnvironment() const ? Environment::systemEnvironment() : Environment(); - if (QmlProject *project = qobject_cast<QmlProject *>(m_target->project())) + if (auto project = qobject_cast<const QmlProject *>(m_target->project())) env.modify(project->environment()); return env; diff --git a/src/plugins/qmlprojectmanager/qmlprojectnodes.h b/src/plugins/qmlprojectmanager/qmlprojectnodes.h index 35ebf428f8..6a3f688b3d 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectnodes.h +++ b/src/plugins/qmlprojectmanager/qmlprojectnodes.h @@ -40,7 +40,7 @@ public: bool showInSimpleTree() const override; bool supportsAction(ProjectExplorer::ProjectAction action, const Node *node) const override; - bool addFiles(const QStringList &filePaths, QStringList *notAdded = 0) override; + bool addFiles(const QStringList &filePaths, QStringList *notAdded = nullptr) override; bool deleteFiles(const QStringList &filePaths) override; bool renameFile(const QString &filePath, const QString &newFilePath) override; diff --git a/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp b/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp index 65616389af..3078531bcd 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp +++ b/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp @@ -72,7 +72,7 @@ class MainQmlFileAspect : public ProjectConfigurationAspect { public: explicit MainQmlFileAspect(QmlProject *project); - ~MainQmlFileAspect() { delete m_fileListCombo; } + ~MainQmlFileAspect() override { delete m_fileListCombo; } enum MainScriptSource { FileInEditor, @@ -107,9 +107,8 @@ public: MainQmlFileAspect::MainQmlFileAspect(QmlProject *project) : m_project(project) + , m_scriptFile(M_CURRENT_FILE) { - m_scriptFile = M_CURRENT_FILE; - connect(EditorManager::instance(), &EditorManager::currentEditorChanged, this, &MainQmlFileAspect::changeCurrentFile); connect(EditorManager::instance(), &EditorManager::currentDocumentStateChanged, @@ -189,7 +188,7 @@ void MainQmlFileAspect::updateFileComboBox() if (fileInfo.suffix() != QLatin1String("qml")) continue; - QStandardItem *item = new QStandardItem(fn); + auto item = new QStandardItem(fn); m_fileListModel.appendRow(item); if (mainScriptPath == fn) |