Commit 2481e71d authored by hjk's avatar hjk
Browse files

Vcs: Move editor construction over to new scheme



Change-Id: I491b9f37bfe15ebc800fedd5c683bfaf24e63889
Reviewed-by: default avatarChristian Stenger <christian.stenger@digia.com>
parent 461a54bd
...@@ -41,8 +41,7 @@ ...@@ -41,8 +41,7 @@
using namespace Bazaar::Internal; using namespace Bazaar::Internal;
using namespace Bazaar; using namespace Bazaar;
BazaarEditor::BazaarEditor(const VcsBase::VcsBaseEditorParameters *type, QWidget *parent) BazaarEditor::BazaarEditor() :
: VcsBase::VcsBaseEditorWidget(type, parent),
m_changesetId(QLatin1String(Constants::CHANGESET_ID)), m_changesetId(QLatin1String(Constants::CHANGESET_ID)),
m_exactChangesetId(QLatin1String(Constants::CHANGESET_ID_EXACT)) m_exactChangesetId(QLatin1String(Constants::CHANGESET_ID_EXACT))
{ {
......
...@@ -41,7 +41,7 @@ class BazaarEditor : public VcsBase::VcsBaseEditorWidget ...@@ -41,7 +41,7 @@ class BazaarEditor : public VcsBase::VcsBaseEditorWidget
Q_OBJECT Q_OBJECT
public: public:
explicit BazaarEditor(const VcsBase::VcsBaseEditorParameters *type, QWidget *parent); BazaarEditor();
private: private:
QSet<QString> annotationChanges() const; QSet<QString> annotationChanges() const;
......
...@@ -166,8 +166,6 @@ bool BazaarPlugin::initialize(const QStringList &arguments, QString *errorMessag ...@@ -166,8 +166,6 @@ bool BazaarPlugin::initialize(const QStringList &arguments, QString *errorMessag
Q_UNUSED(arguments); Q_UNUSED(arguments);
Q_UNUSED(errorMessage); Q_UNUSED(errorMessage);
typedef VcsEditorFactory<BazaarEditor> BazaarEditorFactory;
m_client = new BazaarClient(&m_bazaarSettings); m_client = new BazaarClient(&m_bazaarSettings);
initializeVcs(new BazaarControl(m_client)); initializeVcs(new BazaarControl(m_client));
...@@ -179,8 +177,9 @@ bool BazaarPlugin::initialize(const QStringList &arguments, QString *errorMessag ...@@ -179,8 +177,9 @@ bool BazaarPlugin::initialize(const QStringList &arguments, QString *errorMessag
static const char *describeSlot = SLOT(view(QString,QString)); static const char *describeSlot = SLOT(view(QString,QString));
const int editorCount = sizeof(editorParameters) / sizeof(VcsBaseEditorParameters); const int editorCount = sizeof(editorParameters) / sizeof(VcsBaseEditorParameters);
const auto widgetCreator = []() { return new BazaarEditor; };
for (int i = 0; i < editorCount; i++) for (int i = 0; i < editorCount; i++)
addAutoReleasedObject(new BazaarEditorFactory(editorParameters + i, m_client, describeSlot)); addAutoReleasedObject(new VcsEditorFactory(editorParameters + i, widgetCreator, m_client, describeSlot));
addAutoReleasedObject(new VcsSubmitEditorFactory<CommitEditor>(&submitEditorParameters)); addAutoReleasedObject(new VcsSubmitEditorFactory<CommitEditor>(&submitEditorParameters));
...@@ -657,7 +656,8 @@ void BazaarPlugin::testDiffFileResolving_data() ...@@ -657,7 +656,8 @@ void BazaarPlugin::testDiffFileResolving_data()
void BazaarPlugin::testDiffFileResolving() void BazaarPlugin::testDiffFileResolving()
{ {
BazaarEditor editor(editorParameters + 2, 0); BazaarEditor editor;
editor.setParameters(editorParameters + 2);
editor.testDiffFileResolving(); editor.testDiffFileResolving();
} }
...@@ -681,7 +681,8 @@ void BazaarPlugin::testLogResolving() ...@@ -681,7 +681,8 @@ void BazaarPlugin::testLogResolving()
" (gz) Set approved revision and vote \"Approve\" when using lp-propose\n" " (gz) Set approved revision and vote \"Approve\" when using lp-propose\n"
" --approve (Jonathan Lange)\n" " --approve (Jonathan Lange)\n"
); );
BazaarEditor editor(editorParameters, 0); BazaarEditor editor;
editor.setParameters(editorParameters);
editor.testLogResolving(data, "6572", "6571"); editor.testLogResolving(data, "6572", "6571");
} }
#endif #endif
......
...@@ -44,9 +44,7 @@ ...@@ -44,9 +44,7 @@
using namespace ClearCase; using namespace ClearCase;
using namespace ClearCase::Internal; using namespace ClearCase::Internal;
ClearCaseEditor::ClearCaseEditor(const VcsBase::VcsBaseEditorParameters *type, ClearCaseEditor::ClearCaseEditor() :
QWidget *parent) :
VcsBase::VcsBaseEditorWidget(type, parent),
m_versionNumberPattern(QLatin1String("[\\\\/]main[\\\\/][^ \t\n\"]*")) m_versionNumberPattern(QLatin1String("[\\\\/]main[\\\\/][^ \t\n\"]*"))
{ {
QTC_ASSERT(m_versionNumberPattern.isValid(), return); QTC_ASSERT(m_versionNumberPattern.isValid(), return);
......
...@@ -43,8 +43,7 @@ class ClearCaseEditor : public VcsBase::VcsBaseEditorWidget ...@@ -43,8 +43,7 @@ class ClearCaseEditor : public VcsBase::VcsBaseEditorWidget
Q_OBJECT Q_OBJECT
public: public:
explicit ClearCaseEditor(const VcsBase::VcsBaseEditorParameters *type, ClearCaseEditor();
QWidget *parent);
private: private:
QSet<QString> annotationChanges() const; QSet<QString> annotationChanges() const;
......
...@@ -437,7 +437,6 @@ static const VcsBase::VcsBaseSubmitEditorParameters submitParameters = { ...@@ -437,7 +437,6 @@ static const VcsBase::VcsBaseSubmitEditorParameters submitParameters = {
bool ClearCasePlugin::initialize(const QStringList & /*arguments */, QString *errorMessage) bool ClearCasePlugin::initialize(const QStringList & /*arguments */, QString *errorMessage)
{ {
typedef VcsBase::VcsSubmitEditorFactory<ClearCaseSubmitEditor> ClearCaseSubmitEditorFactory; typedef VcsBase::VcsSubmitEditorFactory<ClearCaseSubmitEditor> ClearCaseSubmitEditorFactory;
typedef VcsBase::VcsEditorFactory<ClearCaseEditor> ClearCaseEditorFactory;
using namespace Constants; using namespace Constants;
using namespace Core::Constants; using namespace Core::Constants;
...@@ -466,8 +465,9 @@ bool ClearCasePlugin::initialize(const QStringList & /*arguments */, QString *er ...@@ -466,8 +465,9 @@ bool ClearCasePlugin::initialize(const QStringList & /*arguments */, QString *er
// any editor responds to describe (when clicking a version) // any editor responds to describe (when clicking a version)
static const char *describeSlot = SLOT(describe(QString,QString)); static const char *describeSlot = SLOT(describe(QString,QString));
const int editorCount = sizeof(editorParameters)/sizeof(VcsBase::VcsBaseEditorParameters); const int editorCount = sizeof(editorParameters)/sizeof(VcsBase::VcsBaseEditorParameters);
const auto widgetCreator = []() { return new ClearCaseEditor; };
for (int i = 0; i < editorCount; i++) for (int i = 0; i < editorCount; i++)
addAutoReleasedObject(new ClearCaseEditorFactory(editorParameters + i, this, describeSlot)); addAutoReleasedObject(new VcsBase::VcsEditorFactory(editorParameters + i, widgetCreator, this, describeSlot));
const QString description = QLatin1String("ClearCase"); const QString description = QLatin1String("ClearCase");
const QString prefix = QLatin1String("cc"); const QString prefix = QLatin1String("cc");
...@@ -2229,7 +2229,8 @@ void ClearCasePlugin::testDiffFileResolving_data() ...@@ -2229,7 +2229,8 @@ void ClearCasePlugin::testDiffFileResolving_data()
void ClearCasePlugin::testDiffFileResolving() void ClearCasePlugin::testDiffFileResolving()
{ {
ClearCaseEditor editor(editorParameters + 2, 0); ClearCaseEditor editor;
editor.setParameters(editorParameters + 2);
editor.testDiffFileResolving(); editor.testDiffFileResolving();
} }
...@@ -2239,7 +2240,8 @@ void ClearCasePlugin::testLogResolving() ...@@ -2239,7 +2240,8 @@ void ClearCasePlugin::testLogResolving()
"13-Sep.17:41 user1 create version \"src/plugins/clearcase/clearcaseeditor.h@@/main/branch1/branch2/9\" (baseline1, baseline2, ...)\n" "13-Sep.17:41 user1 create version \"src/plugins/clearcase/clearcaseeditor.h@@/main/branch1/branch2/9\" (baseline1, baseline2, ...)\n"
"22-Aug.14:13 user2 create version \"src/plugins/clearcase/clearcaseeditor.h@@/main/branch1/branch2/8\" (baseline3, baseline4, ...)\n" "22-Aug.14:13 user2 create version \"src/plugins/clearcase/clearcaseeditor.h@@/main/branch1/branch2/8\" (baseline3, baseline4, ...)\n"
); );
ClearCaseEditor editor(editorParameters, 0); ClearCaseEditor editor;
editor.setParameters(editorParameters);
editor.testLogResolving(data, editor.testLogResolving(data,
"src/plugins/clearcase/clearcaseeditor.h@@/main/branch1/branch2/9", "src/plugins/clearcase/clearcaseeditor.h@@/main/branch1/branch2/9",
"src/plugins/clearcase/clearcaseeditor.h@@/main/branch1/branch2/8"); "src/plugins/clearcase/clearcaseeditor.h@@/main/branch1/branch2/8");
......
...@@ -47,9 +47,7 @@ namespace Internal { ...@@ -47,9 +47,7 @@ namespace Internal {
#define CVS_REVISION_PATTERN "[\\d\\.]+" #define CVS_REVISION_PATTERN "[\\d\\.]+"
#define CVS_REVISION_AT_START_PATTERN "^(" CVS_REVISION_PATTERN ") " #define CVS_REVISION_AT_START_PATTERN "^(" CVS_REVISION_PATTERN ") "
CvsEditor::CvsEditor(const VcsBase::VcsBaseEditorParameters *type, CvsEditor::CvsEditor() :
QWidget *parent) :
VcsBase::VcsBaseEditorWidget(type, parent),
m_revisionAnnotationPattern(QLatin1String(CVS_REVISION_AT_START_PATTERN ".*$")), m_revisionAnnotationPattern(QLatin1String(CVS_REVISION_AT_START_PATTERN ".*$")),
m_revisionLogPattern(QLatin1String("^revision *(" CVS_REVISION_PATTERN ")$")) m_revisionLogPattern(QLatin1String("^revision *(" CVS_REVISION_PATTERN ")$"))
{ {
......
...@@ -42,8 +42,7 @@ class CvsEditor : public VcsBase::VcsBaseEditorWidget ...@@ -42,8 +42,7 @@ class CvsEditor : public VcsBase::VcsBaseEditorWidget
Q_OBJECT Q_OBJECT
public: public:
explicit CvsEditor(const VcsBase::VcsBaseEditorParameters *type, CvsEditor();
QWidget *parent);
private: private:
QSet<QString> annotationChanges() const; QSet<QString> annotationChanges() const;
......
...@@ -231,7 +231,6 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage) ...@@ -231,7 +231,6 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
{ {
Q_UNUSED(arguments); Q_UNUSED(arguments);
typedef VcsSubmitEditorFactory<CvsSubmitEditor> CVSSubmitEditorFactory; typedef VcsSubmitEditorFactory<CvsSubmitEditor> CVSSubmitEditorFactory;
typedef VcsEditorFactory<CvsEditor> CVSEditorFactory;
using namespace Constants; using namespace Constants;
using namespace Core::Constants; using namespace Core::Constants;
...@@ -254,8 +253,9 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage) ...@@ -254,8 +253,9 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
static const char *describeSlotC = SLOT(slotDescribe(QString,QString)); static const char *describeSlotC = SLOT(slotDescribe(QString,QString));
const int editorCount = sizeof(editorParameters) / sizeof(editorParameters[0]); const int editorCount = sizeof(editorParameters) / sizeof(editorParameters[0]);
const auto widgetCreator = []() { return new CvsEditor; };
for (int i = 0; i < editorCount; i++) for (int i = 0; i < editorCount; i++)
addAutoReleasedObject(new CVSEditorFactory(editorParameters + i, this, describeSlotC)); addAutoReleasedObject(new VcsEditorFactory(editorParameters + i, widgetCreator, this, describeSlotC));
auto checkoutWizardFactory = new BaseCheckoutWizardFactory; auto checkoutWizardFactory = new BaseCheckoutWizardFactory;
checkoutWizardFactory->setId(QLatin1String(VcsBase::Constants::VCS_ID_CVS)); checkoutWizardFactory->setId(QLatin1String(VcsBase::Constants::VCS_ID_CVS));
...@@ -1318,7 +1318,8 @@ void CvsPlugin::testDiffFileResolving_data() ...@@ -1318,7 +1318,8 @@ void CvsPlugin::testDiffFileResolving_data()
void CvsPlugin::testDiffFileResolving() void CvsPlugin::testDiffFileResolving()
{ {
CvsEditor editor(editorParameters + 3, 0); CvsEditor editor;
editor.setParameters(editorParameters + 3);
editor.testDiffFileResolving(); editor.testDiffFileResolving();
} }
...@@ -1345,7 +1346,8 @@ void CvsPlugin::testLogResolving() ...@@ -1345,7 +1346,8 @@ void CvsPlugin::testLogResolving()
"added latest commentary\n" "added latest commentary\n"
"----------------------------\n" "----------------------------\n"
); );
CvsEditor editor(editorParameters + 1, 0); CvsEditor editor;
editor.setParameters(editorParameters + 1);
editor.testLogResolving(data, "1.3", "1.2"); editor.testLogResolving(data, "1.3", "1.2");
} }
#endif #endif
......
...@@ -58,8 +58,7 @@ ...@@ -58,8 +58,7 @@
namespace Git { namespace Git {
namespace Internal { namespace Internal {
GitEditorWidget::GitEditorWidget(const VcsBase::VcsBaseEditorParameters *type, QWidget *parent) : GitEditorWidget::GitEditorWidget() :
VcsBase::VcsBaseEditorWidget(type, parent),
m_changeNumberPattern(QLatin1String(CHANGE_PATTERN)) m_changeNumberPattern(QLatin1String(CHANGE_PATTERN))
{ {
QTC_ASSERT(m_changeNumberPattern.isValid(), return); QTC_ASSERT(m_changeNumberPattern.isValid(), return);
......
...@@ -46,8 +46,7 @@ class GitEditorWidget : public VcsBase::VcsBaseEditorWidget ...@@ -46,8 +46,7 @@ class GitEditorWidget : public VcsBase::VcsBaseEditorWidget
Q_OBJECT Q_OBJECT
public: public:
GitEditorWidget(const VcsBase::VcsBaseEditorParameters *type, GitEditorWidget();
QWidget *parent);
public slots: public slots:
void setPlainTextFiltered(const QString &text); void setPlainTextFiltered(const QString &text);
......
...@@ -280,7 +280,6 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage) ...@@ -280,7 +280,6 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
m_gitClient = new GitClient(&m_settings); m_gitClient = new GitClient(&m_settings);
typedef VcsEditorFactory<GitEditorWidget> GitEditorFactory;
typedef VcsSubmitEditorFactory<GitSubmitEditor> GitSubmitEditorFactory; typedef VcsSubmitEditorFactory<GitSubmitEditor> GitSubmitEditorFactory;
initializeVcs(new GitVersionControl(m_gitClient)); initializeVcs(new GitVersionControl(m_gitClient));
...@@ -293,8 +292,9 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage) ...@@ -293,8 +292,9 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
static const char *describeSlot = SLOT(show(QString,QString)); static const char *describeSlot = SLOT(show(QString,QString));
const int editorCount = sizeof(editorParameters) / sizeof(editorParameters[0]); const int editorCount = sizeof(editorParameters) / sizeof(editorParameters[0]);
const auto widgetCreator = []() { return new GitEditorWidget; };
for (int i = 0; i < editorCount; i++) for (int i = 0; i < editorCount; i++)
addAutoReleasedObject(new GitEditorFactory(editorParameters + i, m_gitClient, describeSlot)); addAutoReleasedObject(new VcsEditorFactory(editorParameters + i, widgetCreator, m_gitClient, describeSlot));
addAutoReleasedObject(new GitSubmitEditorFactory(&submitParameters)); addAutoReleasedObject(new GitSubmitEditorFactory(&submitParameters));
...@@ -1523,7 +1523,8 @@ void GitPlugin::testDiffFileResolving_data() ...@@ -1523,7 +1523,8 @@ void GitPlugin::testDiffFileResolving_data()
void GitPlugin::testDiffFileResolving() void GitPlugin::testDiffFileResolving()
{ {
GitEditorWidget editor(editorParameters + 3, 0); GitEditorWidget editor;
editor.setParameters(editorParameters + 3);
editor.testDiffFileResolving(); editor.testDiffFileResolving();
} }
...@@ -1549,7 +1550,8 @@ void GitPlugin::testLogResolving() ...@@ -1549,7 +1550,8 @@ void GitPlugin::testLogResolving()
" \n" " \n"
" Signed-off-by: Junio C Hamano <gitster@pobox.com>\n" " Signed-off-by: Junio C Hamano <gitster@pobox.com>\n"
); );
GitEditorWidget editor(editorParameters + 1, 0); GitEditorWidget editor;
editor.setParameters(editorParameters + 1);
editor.testLogResolving(data, editor.testLogResolving(data,
"50a6b54c - Merge branch 'for-junio' of git://bogomips.org/git-svn", "50a6b54c - Merge branch 'for-junio' of git://bogomips.org/git-svn",
"3587b513 - Update draft release notes to 1.8.2"); "3587b513 - Update draft release notes to 1.8.2");
......
...@@ -46,8 +46,7 @@ ...@@ -46,8 +46,7 @@
using namespace Mercurial::Internal; using namespace Mercurial::Internal;
using namespace Mercurial; using namespace Mercurial;
MercurialEditor::MercurialEditor(const VcsBase::VcsBaseEditorParameters *type, QWidget *parent) MercurialEditor::MercurialEditor() :
: VcsBase::VcsBaseEditorWidget(type, parent),
exactIdentifier12(QLatin1String(Constants::CHANGEIDEXACT12)), exactIdentifier12(QLatin1String(Constants::CHANGEIDEXACT12)),
exactIdentifier40(QLatin1String(Constants::CHANGEIDEXACT40)), exactIdentifier40(QLatin1String(Constants::CHANGEIDEXACT40)),
changesetIdentifier12(QLatin1String(Constants::CHANGESETID12)), changesetIdentifier12(QLatin1String(Constants::CHANGESETID12)),
......
...@@ -41,7 +41,7 @@ class MercurialEditor : public VcsBase::VcsBaseEditorWidget ...@@ -41,7 +41,7 @@ class MercurialEditor : public VcsBase::VcsBaseEditorWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit MercurialEditor(const VcsBase::VcsBaseEditorParameters *type, QWidget *parent); MercurialEditor();
private: private:
QSet<QString> annotationChanges() const; QSet<QString> annotationChanges() const;
......
...@@ -139,8 +139,6 @@ MercurialPlugin::~MercurialPlugin() ...@@ -139,8 +139,6 @@ MercurialPlugin::~MercurialPlugin()
bool MercurialPlugin::initialize(const QStringList & /* arguments */, QString * /*errorMessage */) bool MercurialPlugin::initialize(const QStringList & /* arguments */, QString * /*errorMessage */)
{ {
typedef VcsEditorFactory<MercurialEditor> MercurialEditorFactory;
m_client = new MercurialClient(&mercurialSettings); m_client = new MercurialClient(&mercurialSettings);
initializeVcs(new MercurialControl(m_client)); initializeVcs(new MercurialControl(m_client));
...@@ -153,8 +151,9 @@ bool MercurialPlugin::initialize(const QStringList & /* arguments */, QString * ...@@ -153,8 +151,9 @@ bool MercurialPlugin::initialize(const QStringList & /* arguments */, QString *
static const char *describeSlot = SLOT(view(QString,QString)); static const char *describeSlot = SLOT(view(QString,QString));
const int editorCount = sizeof(editorParameters)/sizeof(editorParameters[0]); const int editorCount = sizeof(editorParameters)/sizeof(editorParameters[0]);
const auto widgetCreator = []() { return new MercurialEditor; };
for (int i = 0; i < editorCount; i++) for (int i = 0; i < editorCount; i++)
addAutoReleasedObject(new MercurialEditorFactory(editorParameters + i, m_client, describeSlot)); addAutoReleasedObject(new VcsEditorFactory(editorParameters + i, widgetCreator, m_client, describeSlot));
addAutoReleasedObject(new VcsSubmitEditorFactory<CommitEditor>(&submitEditorParameters)); addAutoReleasedObject(new VcsSubmitEditorFactory<CommitEditor>(&submitEditorParameters));
...@@ -726,7 +725,8 @@ void MercurialPlugin::testDiffFileResolving_data() ...@@ -726,7 +725,8 @@ void MercurialPlugin::testDiffFileResolving_data()
void MercurialPlugin::testDiffFileResolving() void MercurialPlugin::testDiffFileResolving()
{ {
MercurialEditor editor(editorParameters + 2, 0); MercurialEditor editor;
editor.setParameters(editorParameters + 2);
editor.testDiffFileResolving(); editor.testDiffFileResolving();
} }
...@@ -747,7 +747,8 @@ void MercurialPlugin::testLogResolving() ...@@ -747,7 +747,8 @@ void MercurialPlugin::testLogResolving()
"date: Sat Jan 19 04:08:16 2013 +0100\n" "date: Sat Jan 19 04:08:16 2013 +0100\n"
"summary: test-rebase: add another test for rebase with multiple roots\n" "summary: test-rebase: add another test for rebase with multiple roots\n"
); );
MercurialEditor editor(editorParameters, 0); MercurialEditor editor;
editor.setParameters(editorParameters);
editor.testLogResolving(data, "18473:692cbda1eb50", "18472:37100f30590f"); editor.testLogResolving(data, "18473:692cbda1eb50", "18472:37100f30590f");
} }
#endif #endif
......
...@@ -56,9 +56,7 @@ namespace Perforce { ...@@ -56,9 +56,7 @@ namespace Perforce {
namespace Internal { namespace Internal {
// ------------ PerforceEditor // ------------ PerforceEditor
PerforceEditor::PerforceEditor(const VcsBase::VcsBaseEditorParameters *type, PerforceEditor::PerforceEditor() :
QWidget *parent) :
VcsBase::VcsBaseEditorWidget(type, parent),
m_changeNumberPattern(QLatin1String("^\\d+$")) m_changeNumberPattern(QLatin1String("^\\d+$"))
{ {
QTC_CHECK(m_changeNumberPattern.isValid()); QTC_CHECK(m_changeNumberPattern.isValid());
...@@ -70,8 +68,6 @@ PerforceEditor::PerforceEditor(const VcsBase::VcsBaseEditorParameters *type, ...@@ -70,8 +68,6 @@ PerforceEditor::PerforceEditor(const VcsBase::VcsBaseEditorParameters *type,
setDiffFilePattern(QRegExp(QLatin1String("^(?:={4}|\\+{3}) (.+)(?:\\t|#\\d)"))); setDiffFilePattern(QRegExp(QLatin1String("^(?:={4}|\\+{3}) (.+)(?:\\t|#\\d)")));
setLogEntryPattern(QRegExp(QLatin1String("^... #\\d change (\\d+) "))); setLogEntryPattern(QRegExp(QLatin1String("^... #\\d change (\\d+) ")));
setAnnotateRevisionTextFormat(tr("Annotate change list \"%1\"")); setAnnotateRevisionTextFormat(tr("Annotate change list \"%1\""));
if (Perforce::Constants::debug)
qDebug() << "PerforceEditor::PerforceEditor" << type->type << type->id;
} }
QSet<QString> PerforceEditor::annotationChanges() const QSet<QString> PerforceEditor::annotationChanges() const
......
...@@ -37,15 +37,12 @@ ...@@ -37,15 +37,12 @@
namespace Perforce { namespace Perforce {
namespace Internal { namespace Internal {
class PerforcePlugin;
class PerforceEditor : public VcsBase::VcsBaseEditorWidget class PerforceEditor : public VcsBase::VcsBaseEditorWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit PerforceEditor(const VcsBase::VcsBaseEditorParameters *type, PerforceEditor();
QWidget *parent);
private: private:
QSet<QString> annotationChanges() const; QSet<QString> annotationChanges() const;
......
...@@ -227,7 +227,6 @@ static const VcsBaseSubmitEditorParameters submitParameters = { ...@@ -227,7 +227,6 @@ static const VcsBaseSubmitEditorParameters submitParameters = {
bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *errorMessage) bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *errorMessage)
{ {
typedef VcsEditorFactory<PerforceEditor> PerforceEditorFactory;
typedef VcsSubmitEditorFactory<PerforceSubmitEditor> PerforceSubmitEditorFactory; typedef VcsSubmitEditorFactory<PerforceSubmitEditor> PerforceSubmitEditorFactory;
initializeVcs(new PerforceVersionControl(this)); initializeVcs(new PerforceVersionControl(this));
...@@ -245,8 +244,9 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er ...@@ -245,8 +244,9 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er
static const char *describeSlot = SLOT(describe(QString,QString)); static const char *describeSlot = SLOT(describe(QString,QString));
const int editorCount = sizeof(editorParameters) / sizeof(editorParameters[0]); const int editorCount = sizeof(editorParameters) / sizeof(editorParameters[0]);
const auto widgetCreator = []() { return new PerforceEditor; };
for (int i = 0; i < editorCount; i++) for (int i = 0; i < editorCount; i++)
addAutoReleasedObject(new PerforceEditorFactory(editorParameters + i, this, describeSlot)); addAutoReleasedObject(new VcsEditorFactory(editorParameters + i, widgetCreator, this, describeSlot));
const QString prefix = QLatin1String("p4"); const QString prefix = QLatin1String("p4");
m_commandLocator = new CommandLocator("Perforce", prefix, prefix); m_commandLocator = new CommandLocator("Perforce", prefix, prefix);
...@@ -1557,13 +1557,14 @@ void PerforcePlugin::testLogResolving() ...@@ -1557,13 +1557,14 @@ void PerforcePlugin::testLogResolving()
"\n" "\n"
" Comment\n" " Comment\n"
); );
PerforceEditor editor(editorParameters, 0); PerforceEditor editor;
editor.setParameters(editorParameters);
editor.testLogResolving(data, "12345", "12344"); editor.testLogResolving(data, "12345", "12344");
} }
#endif #endif
} } // namespace Internal
} } // namespace Perforce
Q_EXPORT_PLUGIN(Perforce::Internal::PerforcePlugin) Q_EXPORT_PLUGIN(Perforce::Internal::PerforcePlugin)
......
...@@ -44,9 +44,7 @@ ...@@ -44,9 +44,7 @@
using namespace Subversion; using namespace Subversion;
using namespace Subversion::Internal; using namespace Subversion::Internal;
SubversionEditor::SubversionEditor(const VcsBase::VcsBaseEditorParameters *type, SubversionEditor::SubversionEditor() :
QWidget *parent) :
VcsBase::VcsBaseEditorWidget(type, parent),
m_changeNumberPattern(QLatin1String("^\\d+$")), m_changeNumberPattern(QLatin1String("^\\d+$")),
m_revisionNumberPattern(QLatin1String("^r\\d+$")) m_revisionNumberPattern(QLatin1String("^r\\d+$"))
{ {
......
...@@ -42,8 +42,7 @@ class SubversionEditor : public VcsBase::VcsBaseEditorWidget ...@@ -42,8 +42,7 @@ class SubversionEditor : public VcsBase::VcsBaseEditorWidget
Q_OBJECT Q_OBJECT
public: public:
explicit SubversionEditor(const VcsBase::VcsBaseEditorParameters *type, SubversionEditor();
QWidget *parent);
private: private:
QSet<QString> annotationChanges() const; <