forked from qt-creator/qt-creator
Vcs: Dissolve VcsBaseOptionsPage intermediate hierarchy level
It's effectively setting only three properties nowadays, not enough to justify a case of reuse-by-inheritance anymore. Change-Id: Ia0aedbd0dc460a70bed580a3402cf928c7221a77 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -32,6 +32,8 @@
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <vcsbase/vcsbaseconstants.h>
|
||||
|
||||
#include <utils/environment.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/pathchooser.h>
|
||||
@@ -119,10 +121,11 @@ void SettingsPageWidget::apply()
|
||||
}
|
||||
|
||||
ClearCaseSettingsPage::ClearCaseSettingsPage(QObject *parent)
|
||||
: VcsBaseOptionsPage(parent)
|
||||
: Core::IOptionsPage(parent)
|
||||
{
|
||||
setId(ClearCase::Constants::VCS_ID_CLEARCASE);
|
||||
setDisplayName(tr("ClearCase"));
|
||||
setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY);
|
||||
setWidgetCreator([] { return new SettingsPageWidget; });
|
||||
}
|
||||
|
||||
|
||||
@@ -26,12 +26,12 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vcsbase/vcsbaseoptionspage.h>
|
||||
#include <coreplugin/dialogs/ioptionspage.h>
|
||||
|
||||
namespace ClearCase {
|
||||
namespace Internal {
|
||||
|
||||
class ClearCaseSettingsPage : public VcsBase::VcsBaseOptionsPage
|
||||
class ClearCaseSettingsPage final : public Core::IOptionsPage
|
||||
{
|
||||
public:
|
||||
explicit ClearCaseSettingsPage(QObject *parent);
|
||||
|
||||
@@ -92,6 +92,7 @@ SettingsPage::SettingsPage(Core::IVersionControl *control, QObject *parent) :
|
||||
{
|
||||
setId(VcsBase::Constants::VCS_ID_CVS);
|
||||
setDisplayName(SettingsPageWidget::tr("CVS"));
|
||||
setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY);
|
||||
setWidgetFactory([] { return new SettingsPageWidget; });
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
#include <coreplugin/icore.h>
|
||||
#include <utils/pathchooser.h>
|
||||
|
||||
#include <vcsbase/vcsbaseconstants.h>
|
||||
|
||||
#include <QLineEdit>
|
||||
#include <QSpinBox>
|
||||
#include <QCheckBox>
|
||||
@@ -40,11 +42,12 @@ namespace Internal {
|
||||
|
||||
GerritOptionsPage::GerritOptionsPage(const QSharedPointer<GerritParameters> &p,
|
||||
QObject *parent)
|
||||
: VcsBase::VcsBaseOptionsPage(parent)
|
||||
: Core::IOptionsPage(parent)
|
||||
, m_parameters(p)
|
||||
{
|
||||
setId("Gerrit");
|
||||
setDisplayName(tr("Gerrit"));
|
||||
setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY);
|
||||
}
|
||||
|
||||
GerritOptionsPage::~GerritOptionsPage()
|
||||
|
||||
@@ -25,9 +25,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vcsbase/vcsbaseoptionspage.h>
|
||||
#include <coreplugin/dialogs/ioptionspage.h>
|
||||
|
||||
#include <QWidget>
|
||||
#include <QSharedPointer>
|
||||
#include <QPointer>
|
||||
|
||||
@@ -61,7 +60,7 @@ private:
|
||||
QCheckBox *m_httpsCheckBox;
|
||||
};
|
||||
|
||||
class GerritOptionsPage : public VcsBase::VcsBaseOptionsPage
|
||||
class GerritOptionsPage : public Core::IOptionsPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
@@ -128,6 +128,7 @@ SettingsPage::SettingsPage(Core::IVersionControl *control, QObject *parent) :
|
||||
{
|
||||
setId(VcsBase::Constants::VCS_ID_GIT);
|
||||
setDisplayName(SettingsPageWidget::tr("Git"));
|
||||
setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY);
|
||||
setWidgetFactory([] { return new SettingsPageWidget; });
|
||||
}
|
||||
|
||||
|
||||
@@ -87,6 +87,7 @@ OptionsPage::OptionsPage(Core::IVersionControl *control, QObject *parent) :
|
||||
{
|
||||
setId(VcsBase::Constants::VCS_ID_MERCURIAL);
|
||||
setDisplayName(OptionsPageWidget::tr("Mercurial"));
|
||||
setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY);
|
||||
setWidgetFactory([] { return new OptionsPageWidget; });
|
||||
}
|
||||
|
||||
|
||||
@@ -118,10 +118,11 @@ void SettingsPageWidget::setStatusError(const QString &t)
|
||||
}
|
||||
|
||||
SettingsPage::SettingsPage(QObject *parent)
|
||||
: VcsBaseOptionsPage(parent)
|
||||
: Core::IOptionsPage(parent)
|
||||
{
|
||||
setId(VcsBase::Constants::VCS_ID_PERFORCE);
|
||||
setDisplayName(tr("Perforce"));
|
||||
setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY);
|
||||
}
|
||||
|
||||
SettingsPage::~SettingsPage()
|
||||
|
||||
@@ -25,9 +25,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include <vcsbase/vcsbaseoptionspage.h>
|
||||
#include <coreplugin/dialogs/ioptionspage.h>
|
||||
|
||||
#include "ui_settingspage.h"
|
||||
|
||||
@@ -59,7 +57,7 @@ private:
|
||||
PerforceChecker *m_checker = nullptr;
|
||||
};
|
||||
|
||||
class SettingsPage : public VcsBase::VcsBaseOptionsPage
|
||||
class SettingsPage : public Core::IOptionsPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
@@ -101,6 +101,7 @@ SettingsPage::SettingsPage(Core::IVersionControl *control, QObject *parent) :
|
||||
{
|
||||
setId(VcsBase::Constants::VCS_ID_SUBVERSION);
|
||||
setDisplayName(SettingsPageWidget::tr("Subversion"));
|
||||
setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY);
|
||||
setWidgetFactory([] { return new SettingsPageWidget; });
|
||||
}
|
||||
|
||||
|
||||
@@ -103,12 +103,16 @@ void CommonSettingsWidget::updatePath()
|
||||
|
||||
// --------------- VcsBaseSettingsPage
|
||||
CommonOptionsPage::CommonOptionsPage(QObject *parent) :
|
||||
VcsBaseOptionsPage(parent)
|
||||
Core::IOptionsPage(parent)
|
||||
{
|
||||
m_settings.fromSettings(Core::ICore::settings());
|
||||
|
||||
setId(Constants::VCS_COMMON_SETTINGS_ID);
|
||||
setDisplayName(QCoreApplication::translate("VcsBase", Constants::VCS_COMMON_SETTINGS_NAME));
|
||||
setCategory(Constants::VCS_SETTINGS_CATEGORY);
|
||||
// The following act as blueprint for other pages in the same category:
|
||||
setDisplayCategory(QCoreApplication::translate("VcsBase", "Version Control"));
|
||||
setCategoryIconPath(":/vcsbase/images/settingscategory_vcs.png");
|
||||
}
|
||||
|
||||
QWidget *CommonOptionsPage::widget()
|
||||
|
||||
@@ -27,10 +27,9 @@
|
||||
|
||||
#include "commonvcssettings.h"
|
||||
|
||||
#include "vcsbaseoptionspage.h"
|
||||
#include <coreplugin/dialogs/ioptionspage.h>
|
||||
|
||||
#include <QPointer>
|
||||
#include <QWidget>
|
||||
|
||||
namespace VcsBase {
|
||||
namespace Internal {
|
||||
@@ -54,7 +53,7 @@ private:
|
||||
Ui::CommonSettingsPage *m_ui;
|
||||
};
|
||||
|
||||
class CommonOptionsPage : public VcsBaseOptionsPage
|
||||
class CommonOptionsPage final : public Core::IOptionsPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
@@ -44,20 +44,11 @@
|
||||
|
||||
namespace VcsBase {
|
||||
|
||||
VcsBaseOptionsPage::VcsBaseOptionsPage(QObject *parent) : Core::IOptionsPage(parent)
|
||||
{
|
||||
setCategory(Constants::VCS_SETTINGS_CATEGORY);
|
||||
setDisplayCategory(QCoreApplication::translate("VcsBase", "Version Control"));
|
||||
setCategoryIconPath(":/vcsbase/images/settingscategory_vcs.png");
|
||||
}
|
||||
|
||||
VcsBaseOptionsPage::~VcsBaseOptionsPage() = default;
|
||||
|
||||
VcsClientOptionsPageWidget::VcsClientOptionsPageWidget() = default;
|
||||
|
||||
VcsClientOptionsPage::VcsClientOptionsPage(Core::IVersionControl *control, VcsBaseClientImpl *client,
|
||||
QObject *parent) :
|
||||
VcsBaseOptionsPage(parent),
|
||||
Core::IOptionsPage(parent),
|
||||
m_client(client)
|
||||
{
|
||||
QTC_CHECK(m_client);
|
||||
|
||||
@@ -39,13 +39,6 @@ namespace Core { class IVersionControl; }
|
||||
|
||||
namespace VcsBase {
|
||||
|
||||
class VCSBASE_EXPORT VcsBaseOptionsPage : public Core::IOptionsPage
|
||||
{
|
||||
public:
|
||||
explicit VcsBaseOptionsPage(QObject *parent = nullptr);
|
||||
~VcsBaseOptionsPage() override;
|
||||
};
|
||||
|
||||
class VcsBaseClientImpl;
|
||||
|
||||
class VCSBASE_EXPORT VcsClientOptionsPageWidget : public Core::IOptionsPageWidget
|
||||
@@ -61,7 +54,7 @@ public:
|
||||
virtual VcsBaseClientSettings settings() const = 0;
|
||||
};
|
||||
|
||||
class VCSBASE_EXPORT VcsClientOptionsPage : public VcsBaseOptionsPage
|
||||
class VCSBASE_EXPORT VcsClientOptionsPage : public Core::IOptionsPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
Reference in New Issue
Block a user