From 88b43d54c3bda1f232d0d15707acd340875e86aa Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Wed, 14 Nov 2018 01:41:46 +0100 Subject: MacrosPlugin: Modernize modernize-* Change-Id: Iffb1bdc9b2b7e89e4744ceaef35f7bcaad418797 Reviewed-by: Orgad Shaneh --- src/plugins/macros/actionmacrohandler.h | 4 ++-- src/plugins/macros/findmacrohandler.cpp | 7 +++---- src/plugins/macros/findmacrohandler.h | 6 +++--- src/plugins/macros/macroevent.h | 2 +- src/plugins/macros/macrolocatorfilter.cpp | 4 +--- src/plugins/macros/macrolocatorfilter.h | 2 +- src/plugins/macros/macromanager.cpp | 4 ++-- src/plugins/macros/macromanager.h | 4 ++-- src/plugins/macros/macrooptionspage.h | 8 ++++---- src/plugins/macros/macrooptionswidget.cpp | 2 +- src/plugins/macros/macrooptionswidget.h | 4 ++-- src/plugins/macros/macrosconstants.h | 2 ++ src/plugins/macros/macrosplugin.h | 6 +++--- src/plugins/macros/macrotextfind.cpp | 6 +++--- src/plugins/macros/macrotextfind.h | 28 +++++++++++++-------------- src/plugins/macros/savedialog.h | 4 ++-- src/plugins/macros/texteditormacrohandler.cpp | 2 +- src/plugins/macros/texteditormacrohandler.h | 10 +++++----- 18 files changed, 52 insertions(+), 53 deletions(-) (limited to 'src/plugins/macros') diff --git a/src/plugins/macros/actionmacrohandler.h b/src/plugins/macros/actionmacrohandler.h index 28077b2013..84735203a6 100644 --- a/src/plugins/macros/actionmacrohandler.h +++ b/src/plugins/macros/actionmacrohandler.h @@ -42,8 +42,8 @@ class ActionMacroHandler : public IMacroHandler public: ActionMacroHandler(); - bool canExecuteEvent(const MacroEvent ¯oEvent); - bool executeEvent(const MacroEvent ¯oEvent); + bool canExecuteEvent(const MacroEvent ¯oEvent) override; + bool executeEvent(const MacroEvent ¯oEvent) override; private: void registerCommand(Core::Id id); diff --git a/src/plugins/macros/findmacrohandler.cpp b/src/plugins/macros/findmacrohandler.cpp index ee5cc6ade5..1baeb546de 100644 --- a/src/plugins/macros/findmacrohandler.cpp +++ b/src/plugins/macros/findmacrohandler.cpp @@ -74,7 +74,7 @@ bool FindMacroHandler::executeEvent(const MacroEvent ¯oEvent) if (!aggregate) return false; - Core::IFindSupport *currentFind = aggregate->component(); + auto currentFind = aggregate->component(); if (!currentFind) return false; @@ -190,9 +190,8 @@ void FindMacroHandler::changeEditor(Core::IEditor *editor) Aggregation::Aggregate *aggregate = Aggregation::Aggregate::parentAggregate(editor->widget()); if (aggregate) { - Core::IFindSupport *currentFind = aggregate->component(); - if (currentFind) { - MacroTextFind *macroFind = qobject_cast(currentFind); + if (auto currentFind = aggregate->component()) { + auto macroFind = qobject_cast(currentFind); if (macroFind) return; diff --git a/src/plugins/macros/findmacrohandler.h b/src/plugins/macros/findmacrohandler.h index b36d8f9eb3..c75125edd7 100644 --- a/src/plugins/macros/findmacrohandler.h +++ b/src/plugins/macros/findmacrohandler.h @@ -41,10 +41,10 @@ class FindMacroHandler : public IMacroHandler public: FindMacroHandler(); - void startRecording(Macro* macro); + void startRecording(Macro* macro) override; - bool canExecuteEvent(const MacroEvent ¯oEvent); - bool executeEvent(const MacroEvent ¯oEvent); + bool canExecuteEvent(const MacroEvent ¯oEvent) override; + bool executeEvent(const MacroEvent ¯oEvent) override; void findIncremental(const QString &txt, Core::FindFlags findFlags); void findStep(const QString &txt, Core::FindFlags findFlags); diff --git a/src/plugins/macros/macroevent.h b/src/plugins/macros/macroevent.h index 9cf82ac28f..b5f69f94f8 100644 --- a/src/plugins/macros/macroevent.h +++ b/src/plugins/macros/macroevent.h @@ -40,7 +40,7 @@ namespace Internal { class MacroEvent { public: - MacroEvent() {} + MacroEvent() = default; Core::Id id() const; void setId(Core::Id id); diff --git a/src/plugins/macros/macrolocatorfilter.cpp b/src/plugins/macros/macrolocatorfilter.cpp index ddeb98ba6b..0296e4fe08 100644 --- a/src/plugins/macros/macrolocatorfilter.cpp +++ b/src/plugins/macros/macrolocatorfilter.cpp @@ -45,9 +45,7 @@ MacroLocatorFilter::MacroLocatorFilter(QObject *parent) setShortcutString("rm"); } -MacroLocatorFilter::~MacroLocatorFilter() -{ -} +MacroLocatorFilter::~MacroLocatorFilter() = default; QList MacroLocatorFilter::matchesFor(QFutureInterface &future, const QString &entry) { diff --git a/src/plugins/macros/macrolocatorfilter.h b/src/plugins/macros/macrolocatorfilter.h index 6105122db4..78bf5ae938 100644 --- a/src/plugins/macros/macrolocatorfilter.h +++ b/src/plugins/macros/macrolocatorfilter.h @@ -38,7 +38,7 @@ class MacroLocatorFilter : public Core::ILocatorFilter public: explicit MacroLocatorFilter(QObject *parent); - ~MacroLocatorFilter(); + ~MacroLocatorFilter() override; QList matchesFor(QFutureInterface &future, const QString &entry) override; diff --git a/src/plugins/macros/macromanager.cpp b/src/plugins/macros/macromanager.cpp index 8b6e5b0117..acea717722 100644 --- a/src/plugins/macros/macromanager.cpp +++ b/src/plugins/macros/macromanager.cpp @@ -135,7 +135,7 @@ void MacroManager::MacroManagerPrivate::initialize() foreach (const QString &name, files) { QString fileName = dir.absolutePath() + QLatin1Char('/') + name; - Macro *macro = new Macro; + auto macro = new Macro; if (macro->loadHeader(fileName)) addMacro(macro); else @@ -152,7 +152,7 @@ void MacroManager::MacroManagerPrivate::addMacro(Macro *macro) { // Add sortcut Core::Context context(TextEditor::Constants::C_TEXTEDITOR); - QAction *action = new QAction(macro->description(), q); + auto action = new QAction(macro->description(), q); Core::Command *command = Core::ActionManager::registerAction( action, makeId(macro->displayName()), context); command->setAttribute(Core::Command::CA_UpdateText); diff --git a/src/plugins/macros/macromanager.h b/src/plugins/macros/macromanager.h index 18779b7df3..d2b876300f 100644 --- a/src/plugins/macros/macromanager.h +++ b/src/plugins/macros/macromanager.h @@ -61,8 +61,8 @@ protected: void changeMacro(const QString &name, const QString &description); private: - explicit MacroManager(QObject *parent = 0); - ~MacroManager(); + explicit MacroManager(QObject *parent = nullptr); + ~MacroManager() override; static MacroManager *m_instance; diff --git a/src/plugins/macros/macrooptionspage.h b/src/plugins/macros/macrooptionspage.h index 88b44f32f5..846e700df1 100644 --- a/src/plugins/macros/macrooptionspage.h +++ b/src/plugins/macros/macrooptionspage.h @@ -39,12 +39,12 @@ class MacroOptionsPage : public Core::IOptionsPage Q_OBJECT public: - MacroOptionsPage(QObject *parent = 0); + MacroOptionsPage(QObject *parent = nullptr); // IOptionsPage implementation - QWidget *widget(); - void apply(); - void finish(); + QWidget *widget() override; + void apply() override; + void finish() override; private: QPointer m_widget; diff --git a/src/plugins/macros/macrooptionswidget.cpp b/src/plugins/macros/macrooptionswidget.cpp index b49d6eeab0..96c1adb13e 100644 --- a/src/plugins/macros/macrooptionswidget.cpp +++ b/src/plugins/macros/macrooptionswidget.cpp @@ -94,7 +94,7 @@ void MacroOptionsWidget::createTable() Macro *macro = it.value(); QFileInfo fileInfo(macro->fileName()); if (fileInfo.absoluteDir() == dir.absolutePath()) { - QTreeWidgetItem *macroItem = new QTreeWidgetItem(m_ui->treeWidget); + auto macroItem = new QTreeWidgetItem(m_ui->treeWidget); macroItem->setText(0, macro->displayName()); macroItem->setText(1, macro->description()); macroItem->setData(0, NAME_ROLE, macro->displayName()); diff --git a/src/plugins/macros/macrooptionswidget.h b/src/plugins/macros/macrooptionswidget.h index 2e570c2a08..bb8a5101d5 100644 --- a/src/plugins/macros/macrooptionswidget.h +++ b/src/plugins/macros/macrooptionswidget.h @@ -44,8 +44,8 @@ namespace Ui { class MacroOptionsWidget; } class MacroOptionsWidget : public QWidget { Q_OBJECT public: - explicit MacroOptionsWidget(QWidget *parent = 0); - ~MacroOptionsWidget(); + explicit MacroOptionsWidget(QWidget *parent = nullptr); + ~MacroOptionsWidget() override; void initialize(); diff --git a/src/plugins/macros/macrosconstants.h b/src/plugins/macros/macrosconstants.h index 056677b2b7..402095d806 100644 --- a/src/plugins/macros/macrosconstants.h +++ b/src/plugins/macros/macrosconstants.h @@ -25,6 +25,8 @@ #pragma once +#include + namespace Macros { namespace Constants { diff --git a/src/plugins/macros/macrosplugin.h b/src/plugins/macros/macrosplugin.h index 2b1263c824..02a2dd33da 100644 --- a/src/plugins/macros/macrosplugin.h +++ b/src/plugins/macros/macrosplugin.h @@ -38,10 +38,10 @@ class MacrosPlugin : public ExtensionSystem::IPlugin Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Macros.json") public: - ~MacrosPlugin(); + ~MacrosPlugin() override; - bool initialize(const QStringList &arguments, QString *errorMessage); - void extensionsInitialized(); + bool initialize(const QStringList &arguments, QString *errorMessage) override; + void extensionsInitialized() override; private: MacroManager *m_macroManager = nullptr; diff --git a/src/plugins/macros/macrotextfind.cpp b/src/plugins/macros/macrotextfind.cpp index 712ed26179..00e30a393c 100644 --- a/src/plugins/macros/macrotextfind.cpp +++ b/src/plugins/macros/macrotextfind.cpp @@ -44,7 +44,7 @@ bool MacroTextFind::supportsReplace() const Core::FindFlags MacroTextFind::supportedFindFlags() const { - QTC_ASSERT(m_currentFind, return 0); + QTC_ASSERT(m_currentFind, return {}); return m_currentFind->supportedFindFlags(); } @@ -63,13 +63,13 @@ void MacroTextFind::clearHighlights() QString MacroTextFind::currentFindString() const { - QTC_ASSERT(m_currentFind, return QString()); + QTC_ASSERT(m_currentFind, return {}); return m_currentFind->currentFindString(); } QString MacroTextFind::completedFindString() const { - QTC_ASSERT(m_currentFind, return QString()); + QTC_ASSERT(m_currentFind, return {}); return m_currentFind->completedFindString(); } diff --git a/src/plugins/macros/macrotextfind.h b/src/plugins/macros/macrotextfind.h index fd1f9d1638..27ec06355b 100644 --- a/src/plugins/macros/macrotextfind.h +++ b/src/plugins/macros/macrotextfind.h @@ -39,22 +39,22 @@ class MacroTextFind : public Core::IFindSupport public: MacroTextFind(Core::IFindSupport *currentFind); - bool supportsReplace() const; - Core::FindFlags supportedFindFlags() const; - void resetIncrementalSearch(); - void clearHighlights(); - QString currentFindString() const; - QString completedFindString() const; + bool supportsReplace() const override; + Core::FindFlags supportedFindFlags() const override; + void resetIncrementalSearch() override; + void clearHighlights() override; + QString currentFindString() const override; + QString completedFindString() const override; - void highlightAll(const QString &txt, Core::FindFlags findFlags); - Core::IFindSupport::Result findIncremental(const QString &txt, Core::FindFlags findFlags); - Core::IFindSupport::Result findStep(const QString &txt, Core::FindFlags findFlags); - void replace(const QString &before, const QString &after, Core::FindFlags findFlags); - bool replaceStep(const QString &before, const QString &after, Core::FindFlags findFlags); - int replaceAll(const QString &before, const QString &after, Core::FindFlags findFlags); + void highlightAll(const QString &txt, Core::FindFlags findFlags) override; + Core::IFindSupport::Result findIncremental(const QString &txt, Core::FindFlags findFlags) override; + Core::IFindSupport::Result findStep(const QString &txt, Core::FindFlags findFlags) override; + void replace(const QString &before, const QString &after, Core::FindFlags findFlags) override; + bool replaceStep(const QString &before, const QString &after, Core::FindFlags findFlags) override; + int replaceAll(const QString &before, const QString &after, Core::FindFlags findFlags) override; - void defineFindScope(); - void clearFindScope(); + void defineFindScope() override; + void clearFindScope() override; signals: void incrementalSearchReseted(); diff --git a/src/plugins/macros/savedialog.h b/src/plugins/macros/savedialog.h index a45c04dcfc..b5ed2336f2 100644 --- a/src/plugins/macros/savedialog.h +++ b/src/plugins/macros/savedialog.h @@ -37,8 +37,8 @@ class SaveDialog : public QDialog Q_OBJECT public: - explicit SaveDialog(QWidget *parent = 0); - ~SaveDialog(); + explicit SaveDialog(QWidget *parent = nullptr); + ~SaveDialog() override; QString name() const; QString description() const; diff --git a/src/plugins/macros/texteditormacrohandler.cpp b/src/plugins/macros/texteditormacrohandler.cpp index 0dc766d9ed..c1e06c76bf 100644 --- a/src/plugins/macros/texteditormacrohandler.cpp +++ b/src/plugins/macros/texteditormacrohandler.cpp @@ -110,7 +110,7 @@ bool TextEditorMacroHandler::eventFilter(QObject *watched, QEvent *event) return false; if (event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease) { - QKeyEvent *keyEvent = dynamic_cast(event); + auto keyEvent = dynamic_cast(event); MacroEvent e; e.setId(KEYEVENTNAME); e.setValue(TEXT, keyEvent->text()); diff --git a/src/plugins/macros/texteditormacrohandler.h b/src/plugins/macros/texteditormacrohandler.h index 251986a3e2..9be01185da 100644 --- a/src/plugins/macros/texteditormacrohandler.h +++ b/src/plugins/macros/texteditormacrohandler.h @@ -41,13 +41,13 @@ class TextEditorMacroHandler : public IMacroHandler public: TextEditorMacroHandler(); - void startRecording(Macro *macro); - void endRecordingMacro(Macro *macro); + void startRecording(Macro *macro) override; + void endRecordingMacro(Macro *macro) override; - bool canExecuteEvent(const MacroEvent ¯oEvent); - bool executeEvent(const MacroEvent ¯oEvent); + bool canExecuteEvent(const MacroEvent ¯oEvent) override; + bool executeEvent(const MacroEvent ¯oEvent) override; - bool eventFilter(QObject *watched, QEvent *event); + bool eventFilter(QObject *watched, QEvent *event) override; void changeEditor(Core::IEditor *editor); void closeEditor(Core::IEditor *editor); -- cgit v1.2.1