Commit fcdb286c authored by Tobias Hunger's avatar Tobias Hunger

Mercurial: Modernize

* Use pragma once
* Use override
* Use member initialization

Change-Id: Ibd4f3c65929932db0e44be70fd5915b921438564
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <orgads@gmail.com>
parent cf3c3472
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef ANNOTATIONHIGHLIGHTER_H
#define ANNOTATIONHIGHLIGHTER_H
#pragma once
#include <vcsbase/baseannotationhighlighter.h>
#include <QRegExp>
......@@ -39,10 +38,9 @@ public:
QTextDocument *document = 0);
private:
QString changeNumber(const QString &block) const;
QString changeNumber(const QString &block) const override;
mutable QRegExp changeset;
};
} //namespace Internal
}// namespace Mercurial
#endif // ANNOTATIONHIGHLIGHTER_H
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef AUTHENTICATIONDIALOG_H
#define AUTHENTICATIONDIALOG_H
#pragma once
#include <QDialog>
......@@ -39,7 +38,7 @@ class AuthenticationDialog : public QDialog
public:
explicit AuthenticationDialog(const QString &username, const QString &password, QWidget *parent = 0);
~AuthenticationDialog();
~AuthenticationDialog() override;
void setPasswordEnabled(bool enabled);
QString getUserName();
QString getPassword();
......@@ -50,5 +49,3 @@ private:
} // namespace Internal
} // namespace Mercurial
#endif // AUTHENTICATIONDIALOG_H
......@@ -36,9 +36,8 @@ using namespace VcsBase;
namespace Mercurial {
namespace Internal {
CommitEditor::CommitEditor(const VcsBaseSubmitEditorParameters *parameters)
: VcsBaseSubmitEditor(parameters, new MercurialCommitWidget),
fileModel(0)
CommitEditor::CommitEditor(const VcsBaseSubmitEditorParameters *parameters) :
VcsBaseSubmitEditor(parameters, new MercurialCommitWidget)
{
document()->setPreferredDisplayName(tr("Commit Editor"));
}
......
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef COMMITEDITOR_H
#define COMMITEDITOR_H
#pragma once
#include <vcsbase/vcsbaseclient.h>
#include <vcsbase/vcsbasesubmiteditor.h>
......@@ -54,10 +53,8 @@ public:
private:
MercurialCommitWidget *commitWidget();
VcsBase::SubmitFileModel *fileModel;
VcsBase::SubmitFileModel *fileModel = nullptr;
};
} // namespace Internal
} // namespace Mercurial
#endif // COMMITEDITOR_H
......@@ -23,8 +23,9 @@
**
****************************************************************************/
#ifndef MERCURIAL_CONSTANTS_H
#define MERCURIAL_CONSTANTS_H
#pragma once
#include <QtGlobal>
namespace Mercurial {
namespace Constants {
......@@ -90,5 +91,3 @@ const char DIFFEDITOR[] = "Mercurial.Action.Editor.Diff";
} // namespace Constants
} // namespace mercurial
#endif // MERCURIAL_CONSTANTS_H
......@@ -23,15 +23,14 @@
**
****************************************************************************/
#ifndef MERCURIALCLIENT_H
#define MERCURIALCLIENT_H
#pragma once
#include "mercurialsettings.h"
#include <vcsbase/vcsbaseclient.h>
namespace Mercurial {
namespace Internal {
struct MercurialDiffParameters;
class MercurialDiffParameters;
class MercurialClient : public VcsBase::VcsBaseClient
{
......@@ -42,10 +41,10 @@ public:
bool synchronousClone(const QString &workingDir,
const QString &srcLocation,
const QString &dstLocation,
const QStringList &extraOptions = QStringList());
const QStringList &extraOptions = QStringList()) override;
bool synchronousPull(const QString &workingDir,
const QString &srcLocation,
const QStringList &extraOptions = QStringList());
const QStringList &extraOptions = QStringList()) override;
bool manifestSync(const QString &repository, const QString &filename);
QString branchQuerySync(const QString &repositoryRoot);
QStringList parentRevisionsSync(const QString &workingDirectory,
......@@ -60,28 +59,26 @@ public:
void annotate(const QString &workingDir, const QString &file,
const QString &revision = QString(), int lineNumber = -1,
const QStringList &extraOptions = QStringList());
const QStringList &extraOptions = QStringList()) override;
void commit(const QString &repositoryRoot, const QStringList &files,
const QString &commitMessageFile,
const QStringList &extraOptions = QStringList());
const QStringList &extraOptions = QStringList()) override;
void diff(const QString &workingDir, const QStringList &files = QStringList(),
const QStringList &extraOptions = QStringList());
const QStringList &extraOptions = QStringList()) override;
void import(const QString &repositoryRoot, const QStringList &files,
const QStringList &extraOptions = QStringList());
const QStringList &extraOptions = QStringList()) override;
void revertAll(const QString &workingDir, const QString &revision = QString(),
const QStringList &extraOptions = QStringList());
const QStringList &extraOptions = QStringList()) override;
public slots:
void view(const QString &source, const QString &id,
const QStringList &extraOptions = QStringList());
const QStringList &extraOptions = QStringList()) override;
public:
QString findTopLevelForFile(const QFileInfo &file) const;
QString findTopLevelForFile(const QFileInfo &file) const override;
protected:
Core::Id vcsEditorKind(VcsCommandTag cmd) const;
QStringList revisionSpec(const QString &revision) const;
StatusItem parseStatusLine(const QString &line) const;
Core::Id vcsEditorKind(VcsCommandTag cmd) const override;
QStringList revisionSpec(const QString &revision) const override;
StatusItem parseStatusLine(const QString &line) const override;
signals:
void needUpdate();
......@@ -93,5 +90,3 @@ private:
} //namespace Internal
} //namespace Mercurial
#endif // MERCURIALCLIENT_H
......@@ -112,8 +112,8 @@ void MercurialSubmitHighlighter::highlightBlock(const QString &text)
}
MercurialCommitWidget::MercurialCommitWidget()
: mercurialCommitPanel(new QWidget)
MercurialCommitWidget::MercurialCommitWidget() :
mercurialCommitPanel(new QWidget)
{
mercurialCommitPanelUi.setupUi(mercurialCommitPanel);
insertTopWidget(mercurialCommitPanel);
......
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef MERCURIALCOMMITWIDGET_H
#define MERCURIALCOMMITWIDGET_H
#pragma once
#include "ui_mercurialcommitpanel.h"
......@@ -49,7 +48,7 @@ public:
QString repoRoot();
protected:
QString cleanupDescription(const QString &input) const;
QString cleanupDescription(const QString &input) const override;
private:
QWidget *mercurialCommitPanel;
......@@ -58,5 +57,3 @@ private:
} // namespace Internal
} // namespace Mercurial
#endif // MERCURIALCOMMITWIDGET_H
......@@ -63,11 +63,10 @@ private:
MercurialClient *m_client;
};
MercurialControl::MercurialControl(MercurialClient *client)
: Core::IVersionControl(new MercurialTopicCache(client))
, mercurialClient(client)
{
}
MercurialControl::MercurialControl(MercurialClient *client) :
Core::IVersionControl(new MercurialTopicCache(client)),
mercurialClient(client)
{ }
QString MercurialControl::displayName() const
{
......
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef MERCURIALCONTROL_H
#define MERCURIALCONTROL_H
#pragma once
#include <coreplugin/iversioncontrol.h>
......@@ -39,7 +38,7 @@ class MercurialClient;
// Implements just the basics of the Version Control Interface
// MercurialClient handles all the work.
class MercurialControl: public Core::IVersionControl
class MercurialControl : public Core::IVersionControl
{
Q_OBJECT
......@@ -73,10 +72,8 @@ public slots:
void changed(const QVariant&);
private:
MercurialClient *mercurialClient;
MercurialClient *const mercurialClient;
};
} // namespace Internal
} // namespace Mercurial
#endif // MERCURIALCONTROL_H
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef MERCURIALEDITOR_H
#define MERCURIALEDITOR_H
#pragma once
#include <vcsbase/vcsbaseeditor.h>
......@@ -55,5 +54,3 @@ private:
} // namespace Internal
} // namespace Mercurial
#endif // MERCURIALEDITOR_H
......@@ -102,16 +102,7 @@ static const VcsBaseSubmitEditorParameters submitEditorParameters = {
MercurialPlugin *MercurialPlugin::m_instance = 0;
MercurialPlugin::MercurialPlugin() :
optionsPage(0),
m_client(0),
core(0),
m_commandLocator(0),
m_addAction(0),
m_deleteAction(0),
m_createRepositoryAction(0),
m_menuAction(0),
m_submitActionTriggered(false)
MercurialPlugin::MercurialPlugin()
{
m_instance = this;
}
......@@ -120,10 +111,10 @@ MercurialPlugin::~MercurialPlugin()
{
if (m_client) {
delete m_client;
m_client = 0;
m_client = nullptr;
}
m_instance = 0;
m_instance = nullptr;
}
bool MercurialPlugin::initialize(const QStringList & /* arguments */, QString * /*errorMessage */)
......
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef MERCURIALPLUGIN_H
#define MERCURIALPLUGIN_H
#pragma once
#include "mercurialsettings.h"
......@@ -64,12 +63,17 @@ class MercurialPlugin : public VcsBase::VcsBasePlugin
public:
MercurialPlugin();
~MercurialPlugin();
bool initialize(const QStringList &arguments, QString *errorMessage);
~MercurialPlugin() override;
bool initialize(const QStringList &arguments, QString *errorMessage) override;
static MercurialPlugin *instance() { return m_instance; }
static MercurialClient *client() { return m_instance->m_client; }
protected:
void updateActions(VcsBase::VcsBasePlugin::ActionState) override;
bool submitEditorAboutToClose() override;
#ifdef WITH_TESTS
private slots:
void testDiffFileResolving_data();
......@@ -77,10 +81,6 @@ private slots:
void testLogResolving();
#endif
protected:
void updateActions(VcsBase::VcsBasePlugin::ActionState);
bool submitEditorAboutToClose();
private:
// File menu action slots
void addCurrentFile();
......@@ -131,39 +131,36 @@ private:
// Variables
static MercurialPlugin *m_instance;
OptionsPage *optionsPage;
MercurialClient *m_client;
OptionsPage *optionsPage = nullptr;
MercurialClient *m_client = nullptr;
Core::ICore *core;
Core::CommandLocator *m_commandLocator;
Core::ActionContainer *m_mercurialContainer;
Core::CommandLocator *m_commandLocator = nullptr;
Core::ActionContainer *m_mercurialContainer = nullptr;
QList<QAction *> m_repositoryActionList;
// Menu items (file actions)
Utils::ParameterAction *m_addAction;
Utils::ParameterAction *m_deleteAction;
Utils::ParameterAction *annotateFile;
Utils::ParameterAction *diffFile;
Utils::ParameterAction *logFile;
Utils::ParameterAction *renameFile;
Utils::ParameterAction *revertFile;
Utils::ParameterAction *statusFile;
QAction *m_createRepositoryAction;
Utils::ParameterAction *m_addAction = nullptr;
Utils::ParameterAction *m_deleteAction = nullptr;
Utils::ParameterAction *annotateFile = nullptr;
Utils::ParameterAction *diffFile = nullptr;
Utils::ParameterAction *logFile = nullptr;
Utils::ParameterAction *renameFile = nullptr;
Utils::ParameterAction *revertFile = nullptr;
Utils::ParameterAction *statusFile = nullptr;
QAction *m_createRepositoryAction = nullptr;
// Submit editor actions
QAction *editorCommit;
QAction *editorDiff;
QAction *editorUndo;
QAction *editorRedo;
QAction *m_menuAction;
QAction *editorCommit = nullptr;
QAction *editorDiff = nullptr;
QAction *editorUndo = nullptr;
QAction *editorRedo = nullptr;
QAction *m_menuAction = nullptr;
QString m_submitRepository;
bool m_submitActionTriggered;
bool m_submitActionTriggered = false;
};
} // namespace Internal
} // namespace Mercurial
#endif // MERCURIALPLUGIN_H
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef MERCURIALSETTINGS_H
#define MERCURIALSETTINGS_H
#pragma once
#include <vcsbase/vcsbaseclientsettings.h>
......@@ -42,5 +41,3 @@ public:
} // namespace Internal
} // namespace Mercurial
#endif // MERCURIALSETTINGS_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 Mercurial {
namespace Internal {
......@@ -47,14 +41,13 @@ class OptionsPageWidget : public VcsBase::VcsClientOptionsPageWidget
public:
explicit OptionsPageWidget(QWidget *parent = 0);
VcsBase::VcsBaseClientSettings settings() const;
void setSettings(const VcsBase::VcsBaseClientSettings &s);
VcsBase::VcsBaseClientSettings settings() const override;
void setSettings(const VcsBase::VcsBaseClientSettings &s) override;
private:
Ui::OptionsPage m_ui;
};
class OptionsPage : public VcsBase::VcsClientOptionsPage
{
Q_OBJECT
......@@ -65,5 +58,3 @@ public:
} // namespace Internal
} // namespace Mercurial
#endif // OPTIONSPAGE_H
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef MERCURIAL_REVERTDIALOG_H
#define MERCURIAL_REVERTDIALOG_H
#pragma once
#include "ui_revertdialog.h"
......@@ -39,7 +38,7 @@ class RevertDialog : public QDialog
public:
RevertDialog(QWidget *parent = 0);
~RevertDialog();
~RevertDialog() override;
QString revision() const;
......@@ -49,5 +48,3 @@ private:
} // namespace Internal
} // namespace Mercurial
#endif // MERCURIAL_REVERTDIALOG_H
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef SRCDESTDIALOG_H
#define SRCDESTDIALOG_H
#pragma once
#include <utils/pathchooser.h>
#include <QDialog>
......@@ -41,7 +40,7 @@ class SrcDestDialog : public QDialog
public:
enum Direction { outgoing, incoming };
explicit SrcDestDialog(Direction dir, QWidget *parent = 0);
~SrcDestDialog();
~SrcDestDialog() override;
void setPathChooserKind(Utils::PathChooser::Kind kind);
QString getRepositoryString() const;
......@@ -58,5 +57,3 @@ private:
} // namespace Internal
} // namespace Mercurial
#endif // SRCDESTDIALOG_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment