diff options
author | Tobias Hunger <tobias.hunger@theqtcompany.com> | 2016-02-03 17:35:54 +0100 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@theqtcompany.com> | 2016-02-04 10:45:13 +0000 |
commit | 74849134f4f44c88616311b89c37516c53510e08 (patch) | |
tree | c64166bfff72f3c76eae1ac0d04ce15654d22187 | |
parent | 063b9775a9d0404cae84417895ccb966750b5b55 (diff) | |
download | qt-creator-74849134f4f44c88616311b89c37516c53510e08.tar.gz |
Bazaar: Modernize
* Use pragma once
* Remove unused member variables
* Use overrides
Change-Id: I190262143e6a51cf6882aceab64e8461202c74a3
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
22 files changed, 66 insertions, 125 deletions
diff --git a/src/plugins/bazaar/annotationhighlighter.cpp b/src/plugins/bazaar/annotationhighlighter.cpp index 7084671028..5980470a6f 100644 --- a/src/plugins/bazaar/annotationhighlighter.cpp +++ b/src/plugins/bazaar/annotationhighlighter.cpp @@ -33,8 +33,7 @@ BazaarAnnotationHighlighter::BazaarAnnotationHighlighter(const ChangeNumbers &ch QTextDocument *document) : VcsBase::BaseAnnotationHighlighter(changeNumbers, document), m_changeset(QLatin1String(Constants::ANNOTATE_CHANGESET_ID)) -{ -} +{ } QString BazaarAnnotationHighlighter::changeNumber(const QString &block) const { diff --git a/src/plugins/bazaar/annotationhighlighter.h b/src/plugins/bazaar/annotationhighlighter.h index 6fbdf2a687..bd89f0fc39 100644 --- a/src/plugins/bazaar/annotationhighlighter.h +++ b/src/plugins/bazaar/annotationhighlighter.h @@ -23,8 +23,7 @@ ** ****************************************************************************/ -#ifndef ANNOTATIONHIGHLIGHTER_H -#define ANNOTATIONHIGHLIGHTER_H +#pragma once #include <vcsbase/baseannotationhighlighter.h> #include <QRegExp> @@ -36,7 +35,7 @@ class BazaarAnnotationHighlighter : public VcsBase::BaseAnnotationHighlighter { public: explicit BazaarAnnotationHighlighter(const ChangeNumbers &changeNumbers, - QTextDocument *document = 0); + QTextDocument *document = nullptr); private: QString changeNumber(const QString &block) const; @@ -45,5 +44,3 @@ private: } // namespace Internal } // namespace Bazaar - -#endif // ANNOTATIONHIGHLIGHTER_H diff --git a/src/plugins/bazaar/bazaarclient.h b/src/plugins/bazaar/bazaarclient.h index 37794edad0..d996856af9 100644 --- a/src/plugins/bazaar/bazaarclient.h +++ b/src/plugins/bazaar/bazaarclient.h @@ -23,8 +23,7 @@ ** ****************************************************************************/ -#ifndef BAZAARCLIENT_H -#define BAZAARCLIENT_H +#pragma once #include "bazaarsettings.h" #include "branchinfo.h" @@ -72,5 +71,3 @@ private: } // namespace Internal } // namespace Bazaar - -#endif // BAZAARCLIENT_H diff --git a/src/plugins/bazaar/bazaarcommitwidget.cpp b/src/plugins/bazaar/bazaarcommitwidget.cpp index d8688556b1..ad426d5f54 100644 --- a/src/plugins/bazaar/bazaarcommitwidget.cpp +++ b/src/plugins/bazaar/bazaarcommitwidget.cpp @@ -109,8 +109,7 @@ void BazaarSubmitHighlighter::highlightBlock(const QString &text) } -BazaarCommitWidget::BazaarCommitWidget() - : m_bazaarCommitPanel(new QWidget) +BazaarCommitWidget::BazaarCommitWidget() : m_bazaarCommitPanel(new QWidget) { m_bazaarCommitPanelUi.setupUi(m_bazaarCommitPanel); insertTopWidget(m_bazaarCommitPanel); diff --git a/src/plugins/bazaar/bazaarcommitwidget.h b/src/plugins/bazaar/bazaarcommitwidget.h index 9332cca7b8..795b04943d 100644 --- a/src/plugins/bazaar/bazaarcommitwidget.h +++ b/src/plugins/bazaar/bazaarcommitwidget.h @@ -23,8 +23,7 @@ ** ****************************************************************************/ -#ifndef BAZAARCOMMITWIDGET_H -#define BAZAARCOMMITWIDGET_H +#pragma once #include "ui_bazaarcommitpanel.h" @@ -58,5 +57,3 @@ private: } // namespace Internal } // namespace Bazaar - -#endif // BAZAARCOMMITWIDGET_H diff --git a/src/plugins/bazaar/bazaarcontrol.cpp b/src/plugins/bazaar/bazaarcontrol.cpp index bf28d04ce4..35269f622c 100644 --- a/src/plugins/bazaar/bazaarcontrol.cpp +++ b/src/plugins/bazaar/bazaarcontrol.cpp @@ -39,10 +39,8 @@ using namespace Bazaar::Internal; -BazaarControl::BazaarControl(BazaarClient *client) - : m_bazaarClient(client) -{ -} +BazaarControl::BazaarControl(BazaarClient *client) : m_bazaarClient(client) +{ } QString BazaarControl::displayName() const { diff --git a/src/plugins/bazaar/bazaarcontrol.h b/src/plugins/bazaar/bazaarcontrol.h index d50e575b45..b894ba9f55 100644 --- a/src/plugins/bazaar/bazaarcontrol.h +++ b/src/plugins/bazaar/bazaarcontrol.h @@ -23,8 +23,7 @@ ** ****************************************************************************/ -#ifndef BAZAARCONTROL_H -#define BAZAARCONTROL_H +#pragma once #include <coreplugin/iversioncontrol.h> @@ -72,10 +71,8 @@ public slots: void changed(const QVariant &); private: - BazaarClient *m_bazaarClient; + BazaarClient *const m_bazaarClient; }; } // namespace Internal } // namespace Bazaar - -#endif // BAZAARCONTROL_H diff --git a/src/plugins/bazaar/bazaareditor.cpp b/src/plugins/bazaar/bazaareditor.cpp index 60e998ad81..4087bd987c 100644 --- a/src/plugins/bazaar/bazaareditor.cpp +++ b/src/plugins/bazaar/bazaareditor.cpp @@ -39,8 +39,8 @@ using namespace Bazaar::Internal; using namespace Bazaar; BazaarEditorWidget::BazaarEditorWidget() : - m_changesetId(QLatin1String(Constants::CHANGESET_ID)), - m_exactChangesetId(QLatin1String(Constants::CHANGESET_ID_EXACT)) + m_changesetId(QLatin1String(Constants::CHANGESET_ID)), + m_exactChangesetId(QLatin1String(Constants::CHANGESET_ID_EXACT)) { setAnnotateRevisionTextFormat(tr("&Annotate %1")); setAnnotatePreviousRevisionTextFormat(tr("Annotate &parent revision %1")); diff --git a/src/plugins/bazaar/bazaareditor.h b/src/plugins/bazaar/bazaareditor.h index 9d14888c16..09584462a1 100644 --- a/src/plugins/bazaar/bazaareditor.h +++ b/src/plugins/bazaar/bazaareditor.h @@ -23,8 +23,7 @@ ** ****************************************************************************/ -#ifndef BAZAAREDITOR_H -#define BAZAAREDITOR_H +#pragma once #include <vcsbase/vcsbaseeditor.h> @@ -52,5 +51,3 @@ private: } // namespace Internal } // namespace Bazaar - -#endif // BAZAAREDITOR_H diff --git a/src/plugins/bazaar/bazaarplugin.cpp b/src/plugins/bazaar/bazaarplugin.cpp index 92becfabeb..f8516d9778 100644 --- a/src/plugins/bazaar/bazaarplugin.cpp +++ b/src/plugins/bazaar/bazaarplugin.cpp @@ -135,12 +135,6 @@ const VcsBaseSubmitEditorParameters submitEditorParameters = { BazaarPlugin *BazaarPlugin::m_instance = 0; BazaarPlugin::BazaarPlugin() - : m_client(0), - m_commandLocator(0), - m_addAction(0), - m_deleteAction(0), - m_menuAction(0), - m_submitActionTriggered(false) { m_instance = this; } diff --git a/src/plugins/bazaar/bazaarplugin.h b/src/plugins/bazaar/bazaarplugin.h index 2299cf60aa..8e8c9dbfba 100644 --- a/src/plugins/bazaar/bazaarplugin.h +++ b/src/plugins/bazaar/bazaarplugin.h @@ -23,8 +23,7 @@ ** ****************************************************************************/ -#ifndef BAZAARPLUGIN_H -#define BAZAARPLUGIN_H +#pragma once #include "bazaarsettings.h" @@ -65,7 +64,18 @@ public: static BazaarPlugin *instance(); BazaarClient *client() const; +protected: + void updateActions(VcsBase::VcsBasePlugin::ActionState); + bool submitEditorAboutToClose(); + +#ifdef WITH_TESTS private slots: + void testDiffFileResolving_data(); + void testDiffFileResolving(); + void testLogResolving(); +#endif + +private: // File menu action slots void addCurrentFile(); void annotateCurrentFile(); @@ -89,17 +99,7 @@ private slots: void commitFromEditor(); void uncommit(); void diffFromEditorSelected(const QStringList &files); -#ifdef WITH_TESTS - void testDiffFileResolving_data(); - void testDiffFileResolving(); - void testLogResolving(); -#endif -protected: - void updateActions(VcsBase::VcsBasePlugin::ActionState); - bool submitEditorAboutToClose(); - -private: // Functions void createMenu(const Core::Context &context); void createSubmitEditorActions(); @@ -109,37 +109,34 @@ private: // Variables static BazaarPlugin *m_instance; + BazaarSettings m_bazaarSettings; - OptionsPage *m_optionsPage; - BazaarClient *m_client; + BazaarClient *m_client = nullptr; - Core::CommandLocator *m_commandLocator; - Core::ActionContainer *m_bazaarContainer; + Core::CommandLocator *m_commandLocator = nullptr; + Core::ActionContainer *m_bazaarContainer = nullptr; QList<QAction *> m_repositoryActionList; // Menu Items (file actions) - Utils::ParameterAction *m_addAction; - Utils::ParameterAction *m_deleteAction; - Utils::ParameterAction *m_annotateFile; - Utils::ParameterAction *m_diffFile; - Utils::ParameterAction *m_logFile; - Utils::ParameterAction *m_renameFile; - Utils::ParameterAction *m_revertFile; - Utils::ParameterAction *m_statusFile; + Utils::ParameterAction *m_addAction = nullptr; + Utils::ParameterAction *m_deleteAction = nullptr; + Utils::ParameterAction *m_annotateFile = nullptr; + Utils::ParameterAction *m_diffFile = nullptr; + Utils::ParameterAction *m_logFile = nullptr; + Utils::ParameterAction *m_revertFile = nullptr; + Utils::ParameterAction *m_statusFile = nullptr; // Submit editor actions - QAction *m_editorCommit; - QAction *m_editorDiff; - QAction *m_editorUndo; - QAction *m_editorRedo; - QAction *m_menuAction; + QAction *m_editorCommit = nullptr; + QAction *m_editorDiff = nullptr; + QAction *m_editorUndo = nullptr; + QAction *m_editorRedo = nullptr; + QAction *m_menuAction = nullptr; QString m_submitRepository; - bool m_submitActionTriggered; + bool m_submitActionTriggered = false; }; } // namespace Internal } // namespace Bazaar - -#endif // BAZAARPLUGIN_H diff --git a/src/plugins/bazaar/bazaarsettings.h b/src/plugins/bazaar/bazaarsettings.h index 354b4e737c..2bc1adc022 100644 --- a/src/plugins/bazaar/bazaarsettings.h +++ b/src/plugins/bazaar/bazaarsettings.h @@ -23,8 +23,7 @@ ** ****************************************************************************/ -#ifndef BAZAARSETTINGS_H -#define BAZAARSETTINGS_H +#pragma once #include <vcsbase/vcsbaseclientsettings.h> @@ -47,5 +46,3 @@ public: } // namespace Internal } // namespace Bazaar - -#endif // BAZAARSETTINGS_H diff --git a/src/plugins/bazaar/branchinfo.cpp b/src/plugins/bazaar/branchinfo.cpp index 7a5b5da601..9e5940e8df 100644 --- a/src/plugins/bazaar/branchinfo.cpp +++ b/src/plugins/bazaar/branchinfo.cpp @@ -28,11 +28,9 @@ namespace Bazaar { namespace Internal { -BranchInfo::BranchInfo(const QString &branchLoc, bool isBound) - : branchLocation(branchLoc), - isBoundToBranch(isBound) -{ -} +BranchInfo::BranchInfo(const QString &branchLoc, bool isBound) : branchLocation(branchLoc), + isBoundToBranch(isBound) +{ } } // namespace Internal } // namespace Bazaar diff --git a/src/plugins/bazaar/branchinfo.h b/src/plugins/bazaar/branchinfo.h index f97d60aa78..09fdff4f0d 100644 --- a/src/plugins/bazaar/branchinfo.h +++ b/src/plugins/bazaar/branchinfo.h @@ -23,8 +23,7 @@ ** ****************************************************************************/ -#ifndef BRANCHINFO_H -#define BRANCHINFO_H +#pragma once #include <QString> @@ -41,5 +40,3 @@ public: } // namespace Internal } // namespace Bazaar - -#endif // BRANCHINFO_H diff --git a/src/plugins/bazaar/commiteditor.cpp b/src/plugins/bazaar/commiteditor.cpp index 5fde51edb4..3460bbc303 100644 --- a/src/plugins/bazaar/commiteditor.cpp +++ b/src/plugins/bazaar/commiteditor.cpp @@ -35,9 +35,8 @@ using namespace Bazaar::Internal; -CommitEditor::CommitEditor(const VcsBase::VcsBaseSubmitEditorParameters *parameters) - : VcsBase::VcsBaseSubmitEditor(parameters, new BazaarCommitWidget), - m_fileModel(0) +CommitEditor::CommitEditor(const VcsBase::VcsBaseSubmitEditorParameters *parameters) : + VcsBase::VcsBaseSubmitEditor(parameters, new BazaarCommitWidget) { document()->setPreferredDisplayName(tr("Commit Editor")); } diff --git a/src/plugins/bazaar/commiteditor.h b/src/plugins/bazaar/commiteditor.h index 33b3cfc98e..a6b090f791 100644 --- a/src/plugins/bazaar/commiteditor.h +++ b/src/plugins/bazaar/commiteditor.h @@ -23,8 +23,7 @@ ** ****************************************************************************/ -#ifndef COMMITEDITOR_H -#define COMMITEDITOR_H +#pragma once #include <vcsbase/vcsbaseclient.h> #include <vcsbase/vcsbasesubmiteditor.h> @@ -51,10 +50,8 @@ public: BazaarCommitWidget *commitWidget(); private: - VcsBase::SubmitFileModel *m_fileModel; + VcsBase::SubmitFileModel *m_fileModel = nullptr; }; -} -} - -#endif // COMMITEDITOR_H +} // namespace Internal +} // namespace Bazaar diff --git a/src/plugins/bazaar/constants.h b/src/plugins/bazaar/constants.h index 83fbf66e9a..fad825097e 100644 --- a/src/plugins/bazaar/constants.h +++ b/src/plugins/bazaar/constants.h @@ -23,8 +23,7 @@ ** ****************************************************************************/ -#ifndef BAZAARCONSTANTS_H -#define BAZAARCONSTANTS_H +#pragma once namespace Bazaar { namespace Constants { @@ -64,5 +63,3 @@ const char FSTATUS_RENAMED[] = "Renamed"; } // namespace Constants } // namespace Bazaar - -#endif // BAZAARCONSTANTS_H diff --git a/src/plugins/bazaar/optionspage.h b/src/plugins/bazaar/optionspage.h index 39781caf68..246a277eb3 100644 --- a/src/plugins/bazaar/optionspage.h +++ b/src/plugins/bazaar/optionspage.h @@ -23,19 +23,13 @@ ** ****************************************************************************/ -#ifndef OPTIONSPAGE_H -#define OPTIONSPAGE_H +#pragma once #include "ui_optionspage.h" #include <vcsbase/vcsbaseoptionspage.h> -#include <QWidget> -#include <QPointer> - -namespace VcsBase { -class VcsBaseClientSettings; -} // namespace VcsBase +namespace VcsBase { class VcsBaseClientSettings; } namespace Bazaar { namespace Internal { @@ -65,5 +59,3 @@ public: } // namespace Internal } // namespace Bazaar - -#endif // OPTIONSPAGE_H diff --git a/src/plugins/bazaar/pullorpushdialog.cpp b/src/plugins/bazaar/pullorpushdialog.cpp index 30fd69b70f..691dbca0db 100644 --- a/src/plugins/bazaar/pullorpushdialog.cpp +++ b/src/plugins/bazaar/pullorpushdialog.cpp @@ -30,10 +30,9 @@ using namespace Bazaar::Internal; -PullOrPushDialog::PullOrPushDialog(Mode mode, QWidget *parent) - : QDialog(parent), - m_mode(mode), - m_ui(new Ui::PullOrPushDialog) +PullOrPushDialog::PullOrPushDialog(Mode mode, QWidget *parent) : QDialog(parent), + m_mode(mode), + m_ui(new Ui::PullOrPushDialog) { m_ui->setupUi(this); m_ui->localPathChooser->setExpectedKind(Utils::PathChooser::Directory); diff --git a/src/plugins/bazaar/pullorpushdialog.h b/src/plugins/bazaar/pullorpushdialog.h index c1f46a340b..380139c2d3 100644 --- a/src/plugins/bazaar/pullorpushdialog.h +++ b/src/plugins/bazaar/pullorpushdialog.h @@ -23,8 +23,7 @@ ** ****************************************************************************/ -#ifndef PULLORPUSHDIALOG_H -#define PULLORPUSHDIALOG_H +#pragma once #include <QDialog> @@ -44,7 +43,7 @@ public: }; explicit PullOrPushDialog(Mode mode, QWidget *parent = 0); - ~PullOrPushDialog(); + ~PullOrPushDialog() override; // Common parameters and options QString branchLocation() const; @@ -60,7 +59,7 @@ public: bool isCreatePrefixOptionEnabled() const; protected: - void changeEvent(QEvent *e); + void changeEvent(QEvent *e) override; private: Mode m_mode; @@ -69,5 +68,3 @@ private: } // namespace Internal } // namespace Bazaar - -#endif // PULLORPUSHDIALOG_H diff --git a/src/plugins/bazaar/uncommitdialog.cpp b/src/plugins/bazaar/uncommitdialog.cpp index 77e20e24d4..9b18413b73 100644 --- a/src/plugins/bazaar/uncommitdialog.cpp +++ b/src/plugins/bazaar/uncommitdialog.cpp @@ -35,9 +35,8 @@ namespace Bazaar { namespace Internal { -UnCommitDialog::UnCommitDialog(QWidget *parent) - : QDialog(parent), - m_ui(new Ui::UnCommitDialog) +UnCommitDialog::UnCommitDialog(QWidget *parent) : QDialog(parent), + m_ui(new Ui::UnCommitDialog) { m_ui->setupUi(this); diff --git a/src/plugins/bazaar/uncommitdialog.h b/src/plugins/bazaar/uncommitdialog.h index cba727867c..c28e32ce66 100644 --- a/src/plugins/bazaar/uncommitdialog.h +++ b/src/plugins/bazaar/uncommitdialog.h @@ -23,8 +23,7 @@ ** ****************************************************************************/ -#ifndef UNCOMMITDIALOG_H -#define UNCOMMITDIALOG_H +#pragma once #include <QDialog> @@ -39,7 +38,7 @@ class UnCommitDialog : public QDialog public: explicit UnCommitDialog(QWidget *parent = 0); - ~UnCommitDialog(); + ~UnCommitDialog() override; QStringList extraOptions() const; QString revision() const; @@ -53,5 +52,3 @@ private: } // namespace Internal } // namespace Bazaar - -#endif // UNCOMMITDIALOG_H |