Commit 74849134 authored by Tobias Hunger's avatar Tobias Hunger

Bazaar: Modernize

* Use pragma once
* Remove unused member variables
* Use overrides

Change-Id: I190262143e6a51cf6882aceab64e8461202c74a3
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <orgads@gmail.com>
parent 063b9775
......@@ -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
{
......
......@@ -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
......@@ -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
......@@ -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);
......
......@@ -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
......@@ -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
{
......
......@@ -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
......@@ -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"));
......
......@@ -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
......@@ -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;
}
......
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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"));
}
......
......@@ -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
......@@ -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
......@@ -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
......@@ -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);
......
......@@ -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
......@@ -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);
......
......@@ -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
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