Commit 9c152fce authored by hjk's avatar hjk
Browse files

Vcs: Collapse VcsSubmitEditorFactory hierarchy



Same pattern as for VcsSubmitFactory.

Change-Id: I7adb8868a83842c1b6c642db372a3624dd2e879e
Reviewed-by: default avatarChristian Stenger <christian.stenger@digia.com>
parent 8b5bca72
......@@ -111,9 +111,8 @@ void BazaarSubmitHighlighter::highlightBlock(const QString &text)
}
BazaarCommitWidget::BazaarCommitWidget(QWidget *parent) :
VcsBase::SubmitEditorWidget(parent),
m_bazaarCommitPanel(new QWidget)
BazaarCommitWidget::BazaarCommitWidget()
: m_bazaarCommitPanel(new QWidget)
{
m_bazaarCommitPanelUi.setupUi(m_bazaarCommitPanel);
insertTopWidget(m_bazaarCommitPanel);
......
......@@ -44,9 +44,8 @@ class BranchInfo;
class BazaarCommitWidget : public VcsBase::SubmitEditorWidget
{
public:
explicit BazaarCommitWidget(QWidget *parent = 0);
BazaarCommitWidget();
void setFields(const BranchInfo &branch,
const QString &userName, const QString &email);
......
......@@ -143,8 +143,7 @@ const VcsBaseSubmitEditorParameters submitEditorParameters = {
BazaarPlugin *BazaarPlugin::m_instance = 0;
BazaarPlugin::BazaarPlugin()
: m_optionsPage(0),
m_client(0),
: m_client(0),
m_commandLocator(0),
m_addAction(0),
m_deleteAction(0),
......@@ -169,8 +168,7 @@ bool BazaarPlugin::initialize(const QStringList &arguments, QString *errorMessag
m_client = new BazaarClient(&m_bazaarSettings);
initializeVcs(new BazaarControl(m_client));
m_optionsPage = new OptionsPage();
addAutoReleasedObject(m_optionsPage);
addAutoReleasedObject(new OptionsPage);
m_bazaarSettings.readSettings(ICore::settings());
connect(m_client, SIGNAL(changed(QVariant)), versionControl(), SLOT(changed(QVariant)));
......@@ -181,7 +179,8 @@ bool BazaarPlugin::initialize(const QStringList &arguments, QString *errorMessag
for (int i = 0; i < editorCount; i++)
addAutoReleasedObject(new VcsEditorFactory(editorParameters + i, widgetCreator, m_client, describeSlot));
addAutoReleasedObject(new VcsSubmitEditorFactory<CommitEditor>(&submitEditorParameters));
addAutoReleasedObject(new VcsSubmitEditorFactory(&submitEditorParameters,
[]() { return new CommitEditor(&submitEditorParameters); }));
auto cloneWizardFactory = new BaseCheckoutWizardFactory;
cloneWizardFactory->setId(QLatin1String(VcsBase::Constants::VCS_ID_BAZAAR));
......
......@@ -37,8 +37,8 @@
using namespace Bazaar::Internal;
CommitEditor::CommitEditor(const VcsBase::VcsBaseSubmitEditorParameters *parameters, QWidget *parent)
: VcsBase::VcsBaseSubmitEditor(parameters, new BazaarCommitWidget(parent)),
CommitEditor::CommitEditor(const VcsBase::VcsBaseSubmitEditorParameters *parameters)
: VcsBase::VcsBaseSubmitEditor(parameters, new BazaarCommitWidget),
m_fileModel(0)
{
document()->setDisplayName(tr("Commit Editor"));
......
......@@ -45,8 +45,7 @@ class CommitEditor : public VcsBase::VcsBaseSubmitEditor
Q_OBJECT
public:
explicit CommitEditor(const VcsBase::VcsBaseSubmitEditorParameters *parameters,
QWidget *parent);
explicit CommitEditor(const VcsBase::VcsBaseSubmitEditorParameters *parameters);
void setFields(const QString &repositoryRoot, const BranchInfo &branch,
const QString &userName, const QString &email,
......
......@@ -437,9 +437,7 @@ static const VcsBaseSubmitEditorParameters submitParameters = {
bool ClearCasePlugin::initialize(const QStringList & /*arguments */, QString *errorMessage)
{
typedef VcsSubmitEditorFactory<ClearCaseSubmitEditor> ClearCaseSubmitEditorFactory;
using namespace Constants;
using namespace Core::Constants;
initializeVcs(new ClearCaseControl(this));
......@@ -460,7 +458,8 @@ bool ClearCasePlugin::initialize(const QStringList & /*arguments */, QString *er
addAutoReleasedObject(new SettingsPage);
addAutoReleasedObject(new ClearCaseSubmitEditorFactory(&submitParameters));
addAutoReleasedObject(new VcsSubmitEditorFactory(&submitParameters,
[]() { return new ClearCaseSubmitEditor(&submitParameters); }));
// any editor responds to describe (when clicking a version)
static const char *describeSlot = SLOT(describe(QString,QString));
......
......@@ -37,9 +37,8 @@
using namespace ClearCase::Internal;
ClearCaseSubmitEditor::ClearCaseSubmitEditor(const VcsBase::VcsBaseSubmitEditorParameters *parameters,
QWidget *parentWidget) :
VcsBase::VcsBaseSubmitEditor(parameters, new ClearCaseSubmitEditorWidget(parentWidget))
ClearCaseSubmitEditor::ClearCaseSubmitEditor(const VcsBase::VcsBaseSubmitEditorParameters *parameters) :
VcsBase::VcsBaseSubmitEditor(parameters, new ClearCaseSubmitEditorWidget)
{
document()->setDisplayName(tr("ClearCase Check In"));
}
......
......@@ -33,8 +33,6 @@
#include <vcsbase/vcsbasesubmiteditor.h>
QT_FORWARD_DECLARE_CLASS(QStringList)
namespace ClearCase {
namespace Internal {
......@@ -43,9 +41,9 @@ class ClearCaseSubmitEditorWidget;
class ClearCaseSubmitEditor : public VcsBase::VcsBaseSubmitEditor
{
Q_OBJECT
public:
explicit ClearCaseSubmitEditor(const VcsBase::VcsBaseSubmitEditorParameters *parameters,
QWidget *parentWidget = 0);
explicit ClearCaseSubmitEditor(const VcsBase::VcsBaseSubmitEditorParameters *parameters);
static QString fileFromStatusLine(const QString &statusLine);
......
......@@ -39,9 +39,8 @@
using namespace ClearCase::Internal;
ClearCaseSubmitEditorWidget::ClearCaseSubmitEditorWidget(QWidget *parent) :
VcsBase::SubmitEditorWidget(parent),
m_actSelector(0)
ClearCaseSubmitEditorWidget::ClearCaseSubmitEditorWidget()
: m_actSelector(0)
{
setDescriptionMandatory(false);
QWidget *checkInWidget = new QWidget(this);
......
......@@ -48,7 +48,8 @@ class ClearCaseSubmitEditorWidget : public VcsBase::SubmitEditorWidget
Q_OBJECT
public:
explicit ClearCaseSubmitEditorWidget(QWidget *parent = 0);
ClearCaseSubmitEditorWidget();
QString activity() const;
bool isIdentical() const;
bool isPreserve() const;
......
......@@ -230,12 +230,8 @@ static const VcsBaseSubmitEditorParameters submitParameters = {
bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
{
Q_UNUSED(arguments);
typedef VcsSubmitEditorFactory<CvsSubmitEditor> CVSSubmitEditorFactory;
using namespace Constants;
using namespace Core::Constants;
using namespace ExtensionSystem;
using Core::Command;
initializeVcs(new CvsControl(this));
......@@ -249,7 +245,8 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
addAutoReleasedObject(new SettingsPage);
addAutoReleasedObject(new CVSSubmitEditorFactory(&submitParameters));
addAutoReleasedObject(new VcsSubmitEditorFactory(&submitParameters,
[]() { return new CvsSubmitEditor(&submitParameters); }));
static const char *describeSlotC = SLOT(slotDescribe(QString,QString));
const int editorCount = sizeof(editorParameters) / sizeof(editorParameters[0]);
......
......@@ -36,9 +36,8 @@
using namespace Cvs::Internal;
using namespace VcsBase;
CvsSubmitEditor::CvsSubmitEditor(const VcsBaseSubmitEditorParameters *parameters,
QWidget *parentWidget) :
VcsBaseSubmitEditor(parameters, new VcsBase::SubmitEditorWidget(parentWidget)),
CvsSubmitEditor::CvsSubmitEditor(const VcsBaseSubmitEditorParameters *parameters) :
VcsBaseSubmitEditor(parameters, new VcsBase::SubmitEditorWidget),
m_msgAdded(tr("Added")),
m_msgRemoved(tr("Removed")),
m_msgModified(tr("Modified"))
......
......@@ -48,8 +48,7 @@ public:
typedef QPair<State, QString> StateFilePair;
typedef QList<StateFilePair> StateFilePairs;
explicit CvsSubmitEditor(const VcsBase::VcsBaseSubmitEditorParameters *parameters,
QWidget *parentWidget = 0);
explicit CvsSubmitEditor(const VcsBase::VcsBaseSubmitEditorParameters *parameters);
void setStateList(const StateFilePairs &statusOutput);
......
......@@ -280,8 +280,6 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
m_gitClient = new GitClient(&m_settings);
typedef VcsSubmitEditorFactory<GitSubmitEditor> GitSubmitEditorFactory;
initializeVcs(new GitVersionControl(m_gitClient));
// Create the globalcontext list to register actions accordingly
......@@ -296,7 +294,8 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
for (int i = 0; i < editorCount; i++)
addAutoReleasedObject(new VcsEditorFactory(editorParameters + i, widgetCreator, m_gitClient, describeSlot));
addAutoReleasedObject(new GitSubmitEditorFactory(&submitParameters));
addAutoReleasedObject(new VcsSubmitEditorFactory(&submitParameters,
[]() { return new GitSubmitEditor(&submitParameters); }));
auto cloneWizardFactory = new VcsBase::BaseCheckoutWizardFactory;
cloneWizardFactory->setId(QLatin1String(VcsBase::Constants::VCS_ID_GIT));
......
......@@ -123,8 +123,8 @@ private:
* option for staged files. So, we sort apart the diff file lists
* according to a type flag we add to the model. */
GitSubmitEditor::GitSubmitEditor(const VcsBase::VcsBaseSubmitEditorParameters *parameters, QWidget *parent) :
VcsBaseSubmitEditor(parameters, new GitSubmitEditorWidget(parent)),
GitSubmitEditor::GitSubmitEditor(const VcsBase::VcsBaseSubmitEditorParameters *parameters) :
VcsBaseSubmitEditor(parameters, new GitSubmitEditorWidget),
m_model(0),
m_commitEncoding(0),
m_commitType(SimpleCommit),
......
......@@ -50,7 +50,7 @@ class GitSubmitEditor : public VcsBase::VcsBaseSubmitEditor
{
Q_OBJECT
public:
explicit GitSubmitEditor(const VcsBase::VcsBaseSubmitEditorParameters *parameters, QWidget *parent);
explicit GitSubmitEditor(const VcsBase::VcsBaseSubmitEditorParameters *parameters);
~GitSubmitEditor();
void setCommitData(const CommitData &);
......
......@@ -45,8 +45,7 @@ namespace Git {
namespace Internal {
// ------------------
GitSubmitEditorWidget::GitSubmitEditorWidget(QWidget *parent) :
VcsBase::SubmitEditorWidget(parent),
GitSubmitEditorWidget::GitSubmitEditorWidget() :
m_pushAction(NoPush),
m_gitSubmitPanel(new QWidget),
m_logChangeWidget(0),
......
......@@ -64,7 +64,7 @@ class GitSubmitEditorWidget : public VcsBase::SubmitEditorWidget
Q_OBJECT
public:
explicit GitSubmitEditorWidget(QWidget *parent = 0);
GitSubmitEditorWidget();
GitSubmitEditorPanelData panelData() const;
QString amendSHA1() const;
......
......@@ -39,8 +39,8 @@
using namespace Mercurial::Internal;
using namespace VcsBase;
CommitEditor::CommitEditor(const VcsBaseSubmitEditorParameters *parameters, QWidget *parent)
: VcsBaseSubmitEditor(parameters, new MercurialCommitWidget(parent)),
CommitEditor::CommitEditor(const VcsBaseSubmitEditorParameters *parameters)
: VcsBaseSubmitEditor(parameters, new MercurialCommitWidget),
fileModel(0)
{
document()->setDisplayName(tr("Commit Editor"));
......
......@@ -45,9 +45,9 @@ class MercurialCommitWidget;
class CommitEditor : public VcsBase::VcsBaseSubmitEditor
{
Q_OBJECT
public:
explicit CommitEditor(const VcsBase::VcsBaseSubmitEditorParameters *parameters,
QWidget *parent);
explicit CommitEditor(const VcsBase::VcsBaseSubmitEditorParameters *parameters);
void setFields(const QFileInfo &repositoryRoot, const QString &branch,
const QString &userName, const QString &email,
......@@ -56,13 +56,12 @@ public:
QString committerInfo();
QString repoRoot();
private:
inline MercurialCommitWidget *commitWidget();
MercurialCommitWidget *commitWidget();
VcsBase::SubmitFileModel *fileModel;
};
}
}
} // namespace Internal
} // namespace Mercurial
#endif // COMMITEDITOR_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