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 <coreplugin/icore.h>
|
||||||
|
|
||||||
|
#include <vcsbase/vcsbaseconstants.h>
|
||||||
|
|
||||||
#include <utils/environment.h>
|
#include <utils/environment.h>
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
#include <utils/pathchooser.h>
|
#include <utils/pathchooser.h>
|
||||||
@@ -119,10 +121,11 @@ void SettingsPageWidget::apply()
|
|||||||
}
|
}
|
||||||
|
|
||||||
ClearCaseSettingsPage::ClearCaseSettingsPage(QObject *parent)
|
ClearCaseSettingsPage::ClearCaseSettingsPage(QObject *parent)
|
||||||
: VcsBaseOptionsPage(parent)
|
: Core::IOptionsPage(parent)
|
||||||
{
|
{
|
||||||
setId(ClearCase::Constants::VCS_ID_CLEARCASE);
|
setId(ClearCase::Constants::VCS_ID_CLEARCASE);
|
||||||
setDisplayName(tr("ClearCase"));
|
setDisplayName(tr("ClearCase"));
|
||||||
|
setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY);
|
||||||
setWidgetCreator([] { return new SettingsPageWidget; });
|
setWidgetCreator([] { return new SettingsPageWidget; });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,12 +26,12 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <vcsbase/vcsbaseoptionspage.h>
|
#include <coreplugin/dialogs/ioptionspage.h>
|
||||||
|
|
||||||
namespace ClearCase {
|
namespace ClearCase {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class ClearCaseSettingsPage : public VcsBase::VcsBaseOptionsPage
|
class ClearCaseSettingsPage final : public Core::IOptionsPage
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit ClearCaseSettingsPage(QObject *parent);
|
explicit ClearCaseSettingsPage(QObject *parent);
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ SettingsPage::SettingsPage(Core::IVersionControl *control, QObject *parent) :
|
|||||||
{
|
{
|
||||||
setId(VcsBase::Constants::VCS_ID_CVS);
|
setId(VcsBase::Constants::VCS_ID_CVS);
|
||||||
setDisplayName(SettingsPageWidget::tr("CVS"));
|
setDisplayName(SettingsPageWidget::tr("CVS"));
|
||||||
|
setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY);
|
||||||
setWidgetFactory([] { return new SettingsPageWidget; });
|
setWidgetFactory([] { return new SettingsPageWidget; });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,8 @@
|
|||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <utils/pathchooser.h>
|
#include <utils/pathchooser.h>
|
||||||
|
|
||||||
|
#include <vcsbase/vcsbaseconstants.h>
|
||||||
|
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QSpinBox>
|
#include <QSpinBox>
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
@@ -40,11 +42,12 @@ namespace Internal {
|
|||||||
|
|
||||||
GerritOptionsPage::GerritOptionsPage(const QSharedPointer<GerritParameters> &p,
|
GerritOptionsPage::GerritOptionsPage(const QSharedPointer<GerritParameters> &p,
|
||||||
QObject *parent)
|
QObject *parent)
|
||||||
: VcsBase::VcsBaseOptionsPage(parent)
|
: Core::IOptionsPage(parent)
|
||||||
, m_parameters(p)
|
, m_parameters(p)
|
||||||
{
|
{
|
||||||
setId("Gerrit");
|
setId("Gerrit");
|
||||||
setDisplayName(tr("Gerrit"));
|
setDisplayName(tr("Gerrit"));
|
||||||
|
setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
GerritOptionsPage::~GerritOptionsPage()
|
GerritOptionsPage::~GerritOptionsPage()
|
||||||
|
|||||||
@@ -25,9 +25,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <vcsbase/vcsbaseoptionspage.h>
|
#include <coreplugin/dialogs/ioptionspage.h>
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
#include <QSharedPointer>
|
#include <QSharedPointer>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
|
||||||
@@ -61,7 +60,7 @@ private:
|
|||||||
QCheckBox *m_httpsCheckBox;
|
QCheckBox *m_httpsCheckBox;
|
||||||
};
|
};
|
||||||
|
|
||||||
class GerritOptionsPage : public VcsBase::VcsBaseOptionsPage
|
class GerritOptionsPage : public Core::IOptionsPage
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
|||||||
@@ -128,6 +128,7 @@ SettingsPage::SettingsPage(Core::IVersionControl *control, QObject *parent) :
|
|||||||
{
|
{
|
||||||
setId(VcsBase::Constants::VCS_ID_GIT);
|
setId(VcsBase::Constants::VCS_ID_GIT);
|
||||||
setDisplayName(SettingsPageWidget::tr("Git"));
|
setDisplayName(SettingsPageWidget::tr("Git"));
|
||||||
|
setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY);
|
||||||
setWidgetFactory([] { return new SettingsPageWidget; });
|
setWidgetFactory([] { return new SettingsPageWidget; });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ OptionsPage::OptionsPage(Core::IVersionControl *control, QObject *parent) :
|
|||||||
{
|
{
|
||||||
setId(VcsBase::Constants::VCS_ID_MERCURIAL);
|
setId(VcsBase::Constants::VCS_ID_MERCURIAL);
|
||||||
setDisplayName(OptionsPageWidget::tr("Mercurial"));
|
setDisplayName(OptionsPageWidget::tr("Mercurial"));
|
||||||
|
setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY);
|
||||||
setWidgetFactory([] { return new OptionsPageWidget; });
|
setWidgetFactory([] { return new OptionsPageWidget; });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -118,10 +118,11 @@ void SettingsPageWidget::setStatusError(const QString &t)
|
|||||||
}
|
}
|
||||||
|
|
||||||
SettingsPage::SettingsPage(QObject *parent)
|
SettingsPage::SettingsPage(QObject *parent)
|
||||||
: VcsBaseOptionsPage(parent)
|
: Core::IOptionsPage(parent)
|
||||||
{
|
{
|
||||||
setId(VcsBase::Constants::VCS_ID_PERFORCE);
|
setId(VcsBase::Constants::VCS_ID_PERFORCE);
|
||||||
setDisplayName(tr("Perforce"));
|
setDisplayName(tr("Perforce"));
|
||||||
|
setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsPage::~SettingsPage()
|
SettingsPage::~SettingsPage()
|
||||||
|
|||||||
@@ -25,9 +25,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QWidget>
|
#include <coreplugin/dialogs/ioptionspage.h>
|
||||||
|
|
||||||
#include <vcsbase/vcsbaseoptionspage.h>
|
|
||||||
|
|
||||||
#include "ui_settingspage.h"
|
#include "ui_settingspage.h"
|
||||||
|
|
||||||
@@ -59,7 +57,7 @@ private:
|
|||||||
PerforceChecker *m_checker = nullptr;
|
PerforceChecker *m_checker = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SettingsPage : public VcsBase::VcsBaseOptionsPage
|
class SettingsPage : public Core::IOptionsPage
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ SettingsPage::SettingsPage(Core::IVersionControl *control, QObject *parent) :
|
|||||||
{
|
{
|
||||||
setId(VcsBase::Constants::VCS_ID_SUBVERSION);
|
setId(VcsBase::Constants::VCS_ID_SUBVERSION);
|
||||||
setDisplayName(SettingsPageWidget::tr("Subversion"));
|
setDisplayName(SettingsPageWidget::tr("Subversion"));
|
||||||
|
setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY);
|
||||||
setWidgetFactory([] { return new SettingsPageWidget; });
|
setWidgetFactory([] { return new SettingsPageWidget; });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -103,12 +103,16 @@ void CommonSettingsWidget::updatePath()
|
|||||||
|
|
||||||
// --------------- VcsBaseSettingsPage
|
// --------------- VcsBaseSettingsPage
|
||||||
CommonOptionsPage::CommonOptionsPage(QObject *parent) :
|
CommonOptionsPage::CommonOptionsPage(QObject *parent) :
|
||||||
VcsBaseOptionsPage(parent)
|
Core::IOptionsPage(parent)
|
||||||
{
|
{
|
||||||
m_settings.fromSettings(Core::ICore::settings());
|
m_settings.fromSettings(Core::ICore::settings());
|
||||||
|
|
||||||
setId(Constants::VCS_COMMON_SETTINGS_ID);
|
setId(Constants::VCS_COMMON_SETTINGS_ID);
|
||||||
setDisplayName(QCoreApplication::translate("VcsBase", Constants::VCS_COMMON_SETTINGS_NAME));
|
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()
|
QWidget *CommonOptionsPage::widget()
|
||||||
|
|||||||
@@ -27,10 +27,9 @@
|
|||||||
|
|
||||||
#include "commonvcssettings.h"
|
#include "commonvcssettings.h"
|
||||||
|
|
||||||
#include "vcsbaseoptionspage.h"
|
#include <coreplugin/dialogs/ioptionspage.h>
|
||||||
|
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
#include <QWidget>
|
|
||||||
|
|
||||||
namespace VcsBase {
|
namespace VcsBase {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -54,7 +53,7 @@ private:
|
|||||||
Ui::CommonSettingsPage *m_ui;
|
Ui::CommonSettingsPage *m_ui;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CommonOptionsPage : public VcsBaseOptionsPage
|
class CommonOptionsPage final : public Core::IOptionsPage
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
|||||||
@@ -44,20 +44,11 @@
|
|||||||
|
|
||||||
namespace VcsBase {
|
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;
|
VcsClientOptionsPageWidget::VcsClientOptionsPageWidget() = default;
|
||||||
|
|
||||||
VcsClientOptionsPage::VcsClientOptionsPage(Core::IVersionControl *control, VcsBaseClientImpl *client,
|
VcsClientOptionsPage::VcsClientOptionsPage(Core::IVersionControl *control, VcsBaseClientImpl *client,
|
||||||
QObject *parent) :
|
QObject *parent) :
|
||||||
VcsBaseOptionsPage(parent),
|
Core::IOptionsPage(parent),
|
||||||
m_client(client)
|
m_client(client)
|
||||||
{
|
{
|
||||||
QTC_CHECK(m_client);
|
QTC_CHECK(m_client);
|
||||||
|
|||||||
@@ -39,13 +39,6 @@ namespace Core { class IVersionControl; }
|
|||||||
|
|
||||||
namespace VcsBase {
|
namespace VcsBase {
|
||||||
|
|
||||||
class VCSBASE_EXPORT VcsBaseOptionsPage : public Core::IOptionsPage
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit VcsBaseOptionsPage(QObject *parent = nullptr);
|
|
||||||
~VcsBaseOptionsPage() override;
|
|
||||||
};
|
|
||||||
|
|
||||||
class VcsBaseClientImpl;
|
class VcsBaseClientImpl;
|
||||||
|
|
||||||
class VCSBASE_EXPORT VcsClientOptionsPageWidget : public Core::IOptionsPageWidget
|
class VCSBASE_EXPORT VcsClientOptionsPageWidget : public Core::IOptionsPageWidget
|
||||||
@@ -61,7 +54,7 @@ public:
|
|||||||
virtual VcsBaseClientSettings settings() const = 0;
|
virtual VcsBaseClientSettings settings() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class VCSBASE_EXPORT VcsClientOptionsPage : public VcsBaseOptionsPage
|
class VCSBASE_EXPORT VcsClientOptionsPage : public Core::IOptionsPage
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user