forked from qt-creator/qt-creator
Vcs: Unify options pages for VcsBaseClientImpl based VCSes
Change-Id: Ia5dd7746f5857e7254251e3510c0987737cfad6d Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -254,10 +254,7 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
|
||||
m_client = new CvsClient;
|
||||
|
||||
auto options = new SettingsPage;
|
||||
connect(options, &SettingsPage::settingsChanged,
|
||||
versionControl(), &IVersionControl::configurationChanged);
|
||||
addAutoReleasedObject(new SettingsPage);
|
||||
addAutoReleasedObject(new SettingsPage(versionControl()));
|
||||
|
||||
addAutoReleasedObject(new VcsSubmitEditorFactory(&submitParameters,
|
||||
[]() { return new CvsSubmitEditor(&submitParameters); }));
|
||||
|
||||
@@ -47,8 +47,7 @@ using namespace Cvs::Internal;
|
||||
using namespace Utils;
|
||||
using namespace VcsBase;
|
||||
|
||||
SettingsPageWidget::SettingsPageWidget(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
SettingsPageWidget::SettingsPageWidget(QWidget *parent) : VcsClientOptionsPageWidget(parent)
|
||||
{
|
||||
m_ui.setupUi(this);
|
||||
m_ui.commandPathChooser->setExpectedKind(PathChooser::ExistingCommand);
|
||||
@@ -78,33 +77,10 @@ void SettingsPageWidget::setSettings(const VcsBaseClientSettings &s)
|
||||
m_ui.describeByCommitIdCheckBox->setChecked(s.boolValue(CvsSettings::describeByCommitIdKey));
|
||||
}
|
||||
|
||||
SettingsPage::SettingsPage()
|
||||
SettingsPage::SettingsPage(Core::IVersionControl *control) :
|
||||
VcsClientOptionsPage(control, CvsPlugin::instance()->client())
|
||||
{
|
||||
setId(VcsBase::Constants::VCS_ID_CVS);
|
||||
setDisplayName(tr("CVS"));
|
||||
}
|
||||
|
||||
QWidget *SettingsPage::widget()
|
||||
{
|
||||
if (!m_widget) {
|
||||
m_widget = new SettingsPageWidget;
|
||||
m_widget->setSettings(CvsPlugin::instance()->client()->settings());
|
||||
}
|
||||
return m_widget;
|
||||
}
|
||||
|
||||
void SettingsPage::apply()
|
||||
{
|
||||
VcsBaseClientSettings &s = CvsPlugin::instance()->client()->settings();
|
||||
const VcsBaseClientSettings newSettings = m_widget->settings();
|
||||
if (s != newSettings) {
|
||||
s = newSettings;
|
||||
s.writeSettings(Core::ICore::settings());
|
||||
emit settingsChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsPage::finish()
|
||||
{
|
||||
delete m_widget;
|
||||
setWidgetFactory([]() { return new SettingsPageWidget; });
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ class VcsBaseClientSettings;
|
||||
namespace Cvs {
|
||||
namespace Internal {
|
||||
|
||||
class SettingsPageWidget : public QWidget
|
||||
class SettingsPageWidget : public VcsBase::VcsClientOptionsPageWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -65,22 +65,12 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class SettingsPage : public VcsBase::VcsBaseOptionsPage
|
||||
class SettingsPage : public VcsBase::VcsClientOptionsPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SettingsPage();
|
||||
|
||||
QWidget *widget();
|
||||
void apply();
|
||||
void finish();
|
||||
|
||||
signals:
|
||||
void settingsChanged();
|
||||
|
||||
private:
|
||||
QPointer<SettingsPageWidget> m_widget;
|
||||
SettingsPage(Core::IVersionControl *control);
|
||||
};
|
||||
|
||||
} // namespace Cvs
|
||||
|
||||
Reference in New Issue
Block a user