forked from qt-creator/qt-creator
Vcs: Drop VcsBaseOptionsPage hierarchy level
Adapt the remaining users: Cvs,Git,Svn. Change-Id: Idd730a33e5c64d18002b1a21b5f5c715b7fa5ffb Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -25,7 +25,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vcsbase/vcsbaseoptionspage.h>
|
||||
#include <coreplugin/dialogs/ioptionspage.h>
|
||||
|
||||
namespace Core { class IVersionControl; }
|
||||
|
||||
namespace Bazaar {
|
||||
namespace Internal {
|
||||
|
@@ -221,7 +221,7 @@ CvsPluginPrivate::CvsPluginPrivate()
|
||||
|
||||
m_client = new CvsClient(&m_settings);
|
||||
|
||||
new SettingsPage(vcsCtrl, &m_settings, this);
|
||||
new CvsSettingsPage(vcsCtrl, &m_settings, this);
|
||||
|
||||
new VcsSubmitEditorFactory(&submitParameters,
|
||||
[]() { return new CvsSubmitEditor(&submitParameters); }, this);
|
||||
|
@@ -43,42 +43,30 @@ using namespace VcsBase;
|
||||
namespace Cvs {
|
||||
namespace Internal {
|
||||
|
||||
class SettingsPageWidget final : public VcsBase::VcsClientOptionsPageWidget
|
||||
class CvsSettingsPageWidget final : public Core::IOptionsPageWidget
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(Cvs::Internal::SettingsPageWidget)
|
||||
|
||||
public:
|
||||
SettingsPageWidget();
|
||||
CvsSettingsPageWidget(Core::IVersionControl *control, CvsSettings *settings);
|
||||
|
||||
VcsBase::VcsBaseClientSettings settings() const final;
|
||||
void setSettings(const VcsBase::VcsBaseClientSettings &) final;
|
||||
void apply() final;
|
||||
|
||||
private:
|
||||
Ui::SettingsPage m_ui;
|
||||
Core::IVersionControl *m_control;
|
||||
CvsSettings *m_settings;
|
||||
};
|
||||
|
||||
SettingsPageWidget::SettingsPageWidget()
|
||||
CvsSettingsPageWidget::CvsSettingsPageWidget(Core::IVersionControl *control, CvsSettings *settings)
|
||||
: m_control(control), m_settings(settings)
|
||||
{
|
||||
m_ui.setupUi(this);
|
||||
m_ui.commandPathChooser->setExpectedKind(PathChooser::ExistingCommand);
|
||||
m_ui.commandPathChooser->setHistoryCompleter(QLatin1String("Cvs.Command.History"));
|
||||
m_ui.commandPathChooser->setPromptDialogTitle(tr("CVS Command"));
|
||||
}
|
||||
|
||||
VcsBaseClientSettings SettingsPageWidget::settings() const
|
||||
{
|
||||
CvsSettings rc;
|
||||
rc.setValue(CvsSettings::binaryPathKey, m_ui.commandPathChooser->rawPath());
|
||||
rc.setValue(CvsSettings::cvsRootKey, m_ui.rootLineEdit->text());
|
||||
rc.setValue(CvsSettings::diffOptionsKey, m_ui.diffOptionsLineEdit->text());
|
||||
rc.setValue(CvsSettings::timeoutKey, m_ui.timeOutSpinBox->value());
|
||||
rc.setValue(CvsSettings::promptOnSubmitKey, m_ui.promptToSubmitCheckBox->isChecked());
|
||||
rc.setValue(CvsSettings::describeByCommitIdKey, m_ui.describeByCommitIdCheckBox->isChecked());
|
||||
return rc;
|
||||
}
|
||||
|
||||
void SettingsPageWidget::setSettings(const VcsBaseClientSettings &s)
|
||||
{
|
||||
const VcsBaseClientSettings &s = *settings;
|
||||
m_ui.commandPathChooser->setFileName(s.binaryPath());
|
||||
m_ui.rootLineEdit->setText(s.stringValue(CvsSettings::cvsRootKey));
|
||||
m_ui.diffOptionsLineEdit->setText(s.stringValue(CvsSettings::diffOptionsKey));
|
||||
@@ -87,13 +75,30 @@ void SettingsPageWidget::setSettings(const VcsBaseClientSettings &s)
|
||||
m_ui.describeByCommitIdCheckBox->setChecked(s.boolValue(CvsSettings::describeByCommitIdKey));
|
||||
}
|
||||
|
||||
SettingsPage::SettingsPage(Core::IVersionControl *control, CvsSettings *settings, QObject *parent) :
|
||||
VcsClientOptionsPage(control, settings, parent)
|
||||
void CvsSettingsPageWidget::apply()
|
||||
{
|
||||
CvsSettings rc = *m_settings;
|
||||
rc.setValue(CvsSettings::binaryPathKey, m_ui.commandPathChooser->rawPath());
|
||||
rc.setValue(CvsSettings::cvsRootKey, m_ui.rootLineEdit->text());
|
||||
rc.setValue(CvsSettings::diffOptionsKey, m_ui.diffOptionsLineEdit->text());
|
||||
rc.setValue(CvsSettings::timeoutKey, m_ui.timeOutSpinBox->value());
|
||||
rc.setValue(CvsSettings::promptOnSubmitKey, m_ui.promptToSubmitCheckBox->isChecked());
|
||||
rc.setValue(CvsSettings::describeByCommitIdKey, m_ui.describeByCommitIdCheckBox->isChecked());
|
||||
|
||||
if (rc == *m_settings)
|
||||
return;
|
||||
|
||||
*m_settings = rc;
|
||||
m_control->configurationChanged();
|
||||
}
|
||||
|
||||
CvsSettingsPage::CvsSettingsPage(Core::IVersionControl *control, CvsSettings *settings, QObject *parent) :
|
||||
Core::IOptionsPage( parent)
|
||||
{
|
||||
setId(VcsBase::Constants::VCS_ID_CVS);
|
||||
setDisplayName(SettingsPageWidget::tr("CVS"));
|
||||
setDisplayName(CvsSettingsPageWidget::tr("CVS"));
|
||||
setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY);
|
||||
setWidgetFactory([] { return new SettingsPageWidget; });
|
||||
setWidgetCreator([control, settings] { return new CvsSettingsPageWidget(control, settings); });
|
||||
}
|
||||
|
||||
} // Internal
|
||||
|
@@ -25,17 +25,19 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vcsbase/vcsbaseoptionspage.h>
|
||||
#include <coreplugin/dialogs/ioptionspage.h>
|
||||
|
||||
namespace Core { class IVersionControl; }
|
||||
|
||||
namespace Cvs {
|
||||
namespace Internal {
|
||||
|
||||
class CvsSettings;
|
||||
|
||||
class SettingsPage final : public VcsBase::VcsClientOptionsPage
|
||||
class CvsSettingsPage final : public Core::IOptionsPage
|
||||
{
|
||||
public:
|
||||
SettingsPage(Core::IVersionControl *control, CvsSettings *settings, QObject *parent);
|
||||
CvsSettingsPage(Core::IVersionControl *control, CvsSettings *settings, QObject *parent);
|
||||
};
|
||||
|
||||
} // namespace Cvs
|
||||
|
@@ -325,9 +325,16 @@ GitPluginPrivate::GitPluginPrivate()
|
||||
initializeVcs(vc, context);
|
||||
|
||||
// Create the settings Page
|
||||
auto settingsPage = new SettingsPage(vc, &m_settings, this);
|
||||
connect(settingsPage, &SettingsPage::settingsChanged,
|
||||
this, &GitPluginPrivate::updateRepositoryBrowserAction);
|
||||
auto onApply = [this, vc] {
|
||||
vc->configurationChanged();
|
||||
updateRepositoryBrowserAction();
|
||||
bool gitFoundOk;
|
||||
QString errorMessage;
|
||||
m_settings.gitExecutable(&gitFoundOk, &errorMessage);
|
||||
if (!gitFoundOk)
|
||||
Core::AsynchronousMessageBox::warning(tr("Git Settings"), errorMessage);
|
||||
};
|
||||
new GitSettingsPage(&m_settings, onApply, this);
|
||||
|
||||
new GitGrep(this);
|
||||
m_branchViewFactory = new BranchViewFactory;
|
||||
|
@@ -92,11 +92,5 @@ Utils::FilePath GitSettings::gitExecutable(bool *ok, QString *errorMessage) cons
|
||||
return binPath;
|
||||
}
|
||||
|
||||
GitSettings &GitSettings::operator = (const GitSettings &s)
|
||||
{
|
||||
VcsBaseClientSettings::operator =(s);
|
||||
return *this;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Git
|
||||
|
@@ -61,7 +61,7 @@ public:
|
||||
|
||||
Utils::FilePath gitExecutable(bool *ok = nullptr, QString *errorMessage = nullptr) const;
|
||||
|
||||
GitSettings &operator = (const GitSettings &s);
|
||||
GitSettings &operator=(const GitSettings &s) = default;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -44,23 +44,25 @@ using namespace VcsBase;
|
||||
namespace Git {
|
||||
namespace Internal {
|
||||
|
||||
class SettingsPageWidget final : public VcsBase::VcsClientOptionsPageWidget
|
||||
class GitSettingsPageWidget final : public Core::IOptionsPageWidget
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(Git::Internal::SettingsPageWidget)
|
||||
|
||||
public:
|
||||
SettingsPageWidget();
|
||||
GitSettingsPageWidget(GitSettings *settings, const std::function<void()> &onChange);
|
||||
|
||||
VcsBase::VcsBaseClientSettings settings() const final;
|
||||
void setSettings(const VcsBase::VcsBaseClientSettings &s) final;
|
||||
void apply() final;
|
||||
|
||||
private:
|
||||
void updateNoteField();
|
||||
|
||||
std::function<void()> m_onChange;
|
||||
GitSettings *m_settings;
|
||||
Ui::SettingsPage m_ui;
|
||||
};
|
||||
|
||||
SettingsPageWidget::SettingsPageWidget()
|
||||
GitSettingsPageWidget::GitSettingsPageWidget(GitSettings *settings, const std::function<void()> &onChange)
|
||||
: m_onChange(onChange), m_settings(settings)
|
||||
{
|
||||
m_ui.setupUi(this);
|
||||
if (Utils::HostOsInfo::isWindowsHost()) {
|
||||
@@ -82,25 +84,9 @@ SettingsPageWidget::SettingsPageWidget()
|
||||
m_ui.repBrowserCommandPathChooser->setHistoryCompleter("Git.RepoCommand.History");
|
||||
m_ui.repBrowserCommandPathChooser->setPromptDialogTitle(tr("Git Repository Browser Command"));
|
||||
|
||||
connect(m_ui.pathLineEdit, &QLineEdit::textChanged, this, &SettingsPageWidget::updateNoteField);
|
||||
}
|
||||
connect(m_ui.pathLineEdit, &QLineEdit::textChanged, this, &GitSettingsPageWidget::updateNoteField);
|
||||
|
||||
VcsBaseClientSettings SettingsPageWidget::settings() const
|
||||
{
|
||||
GitSettings rc;
|
||||
rc.setValue(GitSettings::pathKey, m_ui.pathLineEdit->text());
|
||||
rc.setValue(GitSettings::logCountKey, m_ui.logCountSpinBox->value());
|
||||
rc.setValue(GitSettings::timeoutKey, m_ui.timeoutSpinBox->value());
|
||||
rc.setValue(GitSettings::pullRebaseKey, m_ui.pullRebaseCheckBox->isChecked());
|
||||
rc.setValue(GitSettings::winSetHomeEnvironmentKey, m_ui.winHomeCheckBox->isChecked());
|
||||
rc.setValue(GitSettings::gitkOptionsKey, m_ui.gitkOptionsLineEdit->text().trimmed());
|
||||
rc.setValue(GitSettings::repositoryBrowserCmd, m_ui.repBrowserCommandPathChooser->path().trimmed());
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
void SettingsPageWidget::setSettings(const VcsBaseClientSettings &s)
|
||||
{
|
||||
GitSettings &s = *m_settings;
|
||||
m_ui.pathLineEdit->setText(s.stringValue(GitSettings::pathKey));
|
||||
m_ui.logCountSpinBox->setValue(s.intValue(GitSettings::logCountKey));
|
||||
m_ui.timeoutSpinBox->setValue(s.intValue(GitSettings::timeoutKey));
|
||||
@@ -110,7 +96,24 @@ void SettingsPageWidget::setSettings(const VcsBaseClientSettings &s)
|
||||
m_ui.repBrowserCommandPathChooser->setPath(s.stringValue(GitSettings::repositoryBrowserCmd));
|
||||
}
|
||||
|
||||
void SettingsPageWidget::updateNoteField()
|
||||
void GitSettingsPageWidget::apply()
|
||||
{
|
||||
GitSettings rc = *m_settings;
|
||||
rc.setValue(GitSettings::pathKey, m_ui.pathLineEdit->text());
|
||||
rc.setValue(GitSettings::logCountKey, m_ui.logCountSpinBox->value());
|
||||
rc.setValue(GitSettings::timeoutKey, m_ui.timeoutSpinBox->value());
|
||||
rc.setValue(GitSettings::pullRebaseKey, m_ui.pullRebaseCheckBox->isChecked());
|
||||
rc.setValue(GitSettings::winSetHomeEnvironmentKey, m_ui.winHomeCheckBox->isChecked());
|
||||
rc.setValue(GitSettings::gitkOptionsKey, m_ui.gitkOptionsLineEdit->text().trimmed());
|
||||
rc.setValue(GitSettings::repositoryBrowserCmd, m_ui.repBrowserCommandPathChooser->path().trimmed());
|
||||
|
||||
if (rc != *m_settings) {
|
||||
*m_settings = rc;
|
||||
m_onChange();
|
||||
}
|
||||
}
|
||||
|
||||
void GitSettingsPageWidget::updateNoteField()
|
||||
{
|
||||
Utils::Environment env = Utils::Environment::systemEnvironment();
|
||||
env.prependOrSetPath(m_ui.pathLineEdit->text());
|
||||
@@ -123,28 +126,13 @@ void SettingsPageWidget::updateNoteField()
|
||||
|
||||
// -------- SettingsPage
|
||||
|
||||
SettingsPage::SettingsPage(Core::IVersionControl *control, GitSettings *settings, QObject *parent) :
|
||||
VcsClientOptionsPage(control, settings, parent)
|
||||
GitSettingsPage::GitSettingsPage(GitSettings *settings, const std::function<void()> &onChange, QObject *parent) :
|
||||
Core::IOptionsPage(parent)
|
||||
{
|
||||
setId(VcsBase::Constants::VCS_ID_GIT);
|
||||
setDisplayName(SettingsPageWidget::tr("Git"));
|
||||
setDisplayName(GitSettingsPageWidget::tr("Git"));
|
||||
setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY);
|
||||
setWidgetFactory([] { return new SettingsPageWidget; });
|
||||
}
|
||||
|
||||
void SettingsPage::apply()
|
||||
{
|
||||
VcsClientOptionsPage::apply();
|
||||
|
||||
if (widget()->isVisible()) {
|
||||
const VcsBaseClientSettings settings = widget()->settings();
|
||||
auto rc = static_cast<const GitSettings *>(&settings);
|
||||
bool gitFoundOk;
|
||||
QString errorMessage;
|
||||
rc->gitExecutable(&gitFoundOk, &errorMessage);
|
||||
if (!gitFoundOk)
|
||||
Core::AsynchronousMessageBox::warning(tr("Git Settings"), errorMessage);
|
||||
}
|
||||
setWidgetCreator([settings, onChange] { return new GitSettingsPageWidget(settings, onChange); });
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -25,18 +25,17 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vcsbase/vcsbaseoptionspage.h>
|
||||
#include <coreplugin/dialogs/ioptionspage.h>
|
||||
|
||||
namespace Git {
|
||||
namespace Internal {
|
||||
|
||||
class GitSettings;
|
||||
|
||||
class SettingsPage final : public VcsBase::VcsClientOptionsPage
|
||||
class GitSettingsPage final : public Core::IOptionsPage
|
||||
{
|
||||
public:
|
||||
SettingsPage(Core::IVersionControl *control, GitSettings *settings, QObject *parent);
|
||||
void apply() final;
|
||||
GitSettingsPage(GitSettings *settings, const std::function<void()> &onChange, QObject *parent);
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -44,47 +44,30 @@ using namespace VcsBase;
|
||||
namespace Subversion {
|
||||
namespace Internal {
|
||||
|
||||
class SettingsPageWidget final : public VcsBase::VcsClientOptionsPageWidget
|
||||
class SubversionSettingsPageWidget final : public Core::IOptionsPageWidget
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(Subversion::Internal::SettingsPageWidget)
|
||||
|
||||
public:
|
||||
SettingsPageWidget();
|
||||
SubversionSettingsPageWidget(Core::IVersionControl *control, SubversionSettings *settings);
|
||||
|
||||
VcsBase::VcsBaseClientSettings settings() const final;
|
||||
void setSettings(const VcsBase::VcsBaseClientSettings &s) final;
|
||||
void apply() final;
|
||||
|
||||
private:
|
||||
Ui::SettingsPage m_ui;
|
||||
Core::IVersionControl *m_control;
|
||||
SubversionSettings *m_settings;
|
||||
};
|
||||
|
||||
SettingsPageWidget::SettingsPageWidget()
|
||||
SubversionSettingsPageWidget::SubversionSettingsPageWidget(Core::IVersionControl *control, SubversionSettings *settings)
|
||||
: m_control(control), m_settings(settings)
|
||||
{
|
||||
m_ui.setupUi(this);
|
||||
m_ui.pathChooser->setExpectedKind(PathChooser::ExistingCommand);
|
||||
m_ui.pathChooser->setHistoryCompleter(QLatin1String("Subversion.Command.History"));
|
||||
m_ui.pathChooser->setPromptDialogTitle(tr("Subversion Command"));
|
||||
}
|
||||
|
||||
VcsBase::VcsBaseClientSettings SettingsPageWidget::settings() const
|
||||
{
|
||||
SubversionSettings rc;
|
||||
rc.setValue(SubversionSettings::binaryPathKey, m_ui.pathChooser->rawPath());
|
||||
rc.setValue(SubversionSettings::useAuthenticationKey, m_ui.userGroupBox->isChecked());
|
||||
rc.setValue(SubversionSettings::userKey, m_ui.usernameLineEdit->text());
|
||||
rc.setValue(SubversionSettings::passwordKey, m_ui.passwordLineEdit->text());
|
||||
rc.setValue(SubversionSettings::timeoutKey, m_ui.timeOutSpinBox->value());
|
||||
if (rc.stringValue(SubversionSettings::userKey).isEmpty())
|
||||
rc.setValue(SubversionSettings::useAuthenticationKey, false);
|
||||
rc.setValue(SubversionSettings::promptOnSubmitKey, m_ui.promptToSubmitCheckBox->isChecked());
|
||||
rc.setValue(SubversionSettings::spaceIgnorantAnnotationKey,
|
||||
m_ui.spaceIgnorantAnnotationCheckBox->isChecked());
|
||||
rc.setValue(SubversionSettings::logCountKey, m_ui.logCountSpinBox->value());
|
||||
return rc;
|
||||
}
|
||||
|
||||
void SettingsPageWidget::setSettings(const VcsBaseClientSettings &s)
|
||||
{
|
||||
SubversionSettings &s = *m_settings;
|
||||
m_ui.pathChooser->setFileName(s.binaryPath());
|
||||
m_ui.usernameLineEdit->setText(s.stringValue(SubversionSettings::userKey));
|
||||
m_ui.passwordLineEdit->setText(s.stringValue(SubversionSettings::passwordKey));
|
||||
@@ -96,13 +79,35 @@ void SettingsPageWidget::setSettings(const VcsBaseClientSettings &s)
|
||||
m_ui.logCountSpinBox->setValue(s.intValue(SubversionSettings::logCountKey));
|
||||
}
|
||||
|
||||
SettingsPage::SettingsPage(Core::IVersionControl *control, SubversionSettings *settings, QObject *parent) :
|
||||
VcsClientOptionsPage(control, settings, parent)
|
||||
void SubversionSettingsPageWidget::apply()
|
||||
{
|
||||
SubversionSettings rc = *m_settings;
|
||||
rc.setValue(SubversionSettings::binaryPathKey, m_ui.pathChooser->rawPath());
|
||||
rc.setValue(SubversionSettings::useAuthenticationKey, m_ui.userGroupBox->isChecked());
|
||||
rc.setValue(SubversionSettings::userKey, m_ui.usernameLineEdit->text());
|
||||
rc.setValue(SubversionSettings::passwordKey, m_ui.passwordLineEdit->text());
|
||||
rc.setValue(SubversionSettings::timeoutKey, m_ui.timeOutSpinBox->value());
|
||||
if (rc.stringValue(SubversionSettings::userKey).isEmpty())
|
||||
rc.setValue(SubversionSettings::useAuthenticationKey, false);
|
||||
rc.setValue(SubversionSettings::promptOnSubmitKey, m_ui.promptToSubmitCheckBox->isChecked());
|
||||
rc.setValue(SubversionSettings::spaceIgnorantAnnotationKey,
|
||||
m_ui.spaceIgnorantAnnotationCheckBox->isChecked());
|
||||
rc.setValue(SubversionSettings::logCountKey, m_ui.logCountSpinBox->value());
|
||||
|
||||
if (rc == *m_settings)
|
||||
return;
|
||||
|
||||
*m_settings = rc;
|
||||
m_control->configurationChanged();
|
||||
}
|
||||
|
||||
SubversionSettingsPage::SubversionSettingsPage(Core::IVersionControl *control, SubversionSettings *settings, QObject *parent) :
|
||||
Core::IOptionsPage(parent)
|
||||
{
|
||||
setId(VcsBase::Constants::VCS_ID_SUBVERSION);
|
||||
setDisplayName(SettingsPageWidget::tr("Subversion"));
|
||||
setDisplayName(SubversionSettingsPageWidget::tr("Subversion"));
|
||||
setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY);
|
||||
setWidgetFactory([] { return new SettingsPageWidget; });
|
||||
setWidgetCreator([control, settings] { return new SubversionSettingsPageWidget(control, settings); });
|
||||
}
|
||||
|
||||
} // Internal
|
||||
|
@@ -25,17 +25,19 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vcsbase/vcsbaseoptionspage.h>
|
||||
#include <coreplugin/dialogs/ioptionspage.h>
|
||||
|
||||
namespace Core { class IVersionControl; }
|
||||
|
||||
namespace Subversion {
|
||||
namespace Internal {
|
||||
|
||||
class SubversionSettings;
|
||||
|
||||
class SettingsPage final : public VcsBase::VcsClientOptionsPage
|
||||
class SubversionSettingsPage final : public Core::IOptionsPage
|
||||
{
|
||||
public:
|
||||
SettingsPage(Core::IVersionControl *control, SubversionSettings *settings, QObject *parent);
|
||||
SubversionSettingsPage(Core::IVersionControl *control, SubversionSettings *settings, QObject *parent);
|
||||
};
|
||||
|
||||
} // namespace Subversion
|
||||
|
@@ -231,7 +231,7 @@ SubversionPluginPrivate::SubversionPluginPrivate() :
|
||||
|
||||
m_client = new SubversionClient(&m_settings);
|
||||
|
||||
new SettingsPage(versionControl(), &m_settings, this);
|
||||
new SubversionSettingsPage(versionControl(), &m_settings, this);
|
||||
|
||||
new VcsSubmitEditorFactory(&submitParameters,
|
||||
[]() { return new SubversionSubmitEditor(&submitParameters); }, this);
|
||||
|
@@ -22,7 +22,6 @@ add_qtc_plugin(VcsBase
|
||||
vcsbasediffeditorcontroller.cpp vcsbasediffeditorcontroller.h
|
||||
vcsbaseeditor.cpp vcsbaseeditor.h
|
||||
vcsbaseeditorconfig.cpp vcsbaseeditorconfig.h
|
||||
vcsbaseoptionspage.cpp vcsbaseoptionspage.h
|
||||
vcsbaseplugin.cpp vcsbaseplugin.h
|
||||
vcsbasesubmiteditor.cpp vcsbasesubmiteditor.h
|
||||
vcscommand.cpp vcscommand.h
|
||||
|
@@ -20,7 +20,6 @@ HEADERS += vcsbase_global.h \
|
||||
nicknamedialog.h \
|
||||
vcsoutputwindow.h \
|
||||
cleandialog.h \
|
||||
vcsbaseoptionspage.h \
|
||||
vcscommand.h \
|
||||
vcsbaseclient.h \
|
||||
vcsbaseclientsettings.h \
|
||||
@@ -47,7 +46,6 @@ SOURCES += vcsplugin.cpp \
|
||||
nicknamedialog.cpp \
|
||||
vcsoutputwindow.cpp \
|
||||
cleandialog.cpp \
|
||||
vcsbaseoptionspage.cpp \
|
||||
vcscommand.cpp \
|
||||
vcsbaseclient.cpp \
|
||||
vcsbaseclientsettings.cpp \
|
||||
|
@@ -60,8 +60,6 @@ QtcPlugin {
|
||||
"vcsbaseeditor.h",
|
||||
"vcsbaseeditorconfig.cpp",
|
||||
"vcsbaseeditorconfig.h",
|
||||
"vcsbaseoptionspage.cpp",
|
||||
"vcsbaseoptionspage.h",
|
||||
"vcsbaseplugin.cpp",
|
||||
"vcsbaseplugin.h",
|
||||
"vcsbasesubmiteditor.cpp",
|
||||
|
@@ -1,91 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "vcsbaseoptionspage.h"
|
||||
|
||||
#include "vcsbaseclient.h"
|
||||
#include "vcsbaseconstants.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/iversioncontrol.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
|
||||
/*!
|
||||
\class VcsBase::VcsBaseOptionsPage
|
||||
|
||||
\brief The VcsBaseOptionsPage class is the base class for VCS options pages
|
||||
providing a common category and icon.
|
||||
*/
|
||||
|
||||
namespace VcsBase {
|
||||
|
||||
VcsClientOptionsPageWidget::VcsClientOptionsPageWidget() = default;
|
||||
|
||||
VcsClientOptionsPage::VcsClientOptionsPage(Core::IVersionControl *control, VcsBaseClientSettings *settings,
|
||||
QObject *parent) :
|
||||
Core::IOptionsPage(parent),
|
||||
m_settings(settings)
|
||||
{
|
||||
QTC_CHECK(m_settings);
|
||||
connect(this, &VcsClientOptionsPage::settingsChanged,
|
||||
control, &Core::IVersionControl::configurationChanged);
|
||||
}
|
||||
|
||||
void VcsClientOptionsPage::setWidgetFactory(VcsClientOptionsPage::WidgetFactory factory)
|
||||
{
|
||||
QTC_ASSERT(!m_factory, return);
|
||||
m_factory = factory;
|
||||
}
|
||||
|
||||
VcsClientOptionsPageWidget *VcsClientOptionsPage::widget()
|
||||
{
|
||||
QTC_ASSERT(m_factory, return nullptr);
|
||||
if (!m_widget)
|
||||
m_widget = m_factory();
|
||||
QTC_ASSERT(m_widget, return nullptr);
|
||||
m_widget->setSettings(*m_settings);
|
||||
return m_widget;
|
||||
}
|
||||
|
||||
void VcsClientOptionsPage::apply()
|
||||
{
|
||||
QTC_ASSERT(m_widget, return);
|
||||
const VcsBaseClientSettings newSettings = m_widget->settings();
|
||||
if (*m_settings != newSettings) {
|
||||
*m_settings = newSettings;
|
||||
emit settingsChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void VcsClientOptionsPage::finish()
|
||||
{
|
||||
delete m_widget;
|
||||
m_widget = nullptr;
|
||||
}
|
||||
|
||||
} // namespace VcsBase
|
@@ -1,78 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "vcsbase_global.h"
|
||||
|
||||
#include "vcsbaseclientsettings.h"
|
||||
|
||||
#include <coreplugin/dialogs/ioptionspage.h>
|
||||
|
||||
#include <functional>
|
||||
|
||||
namespace Core { class IVersionControl; }
|
||||
|
||||
namespace VcsBase {
|
||||
|
||||
class VCSBASE_EXPORT VcsClientOptionsPageWidget : public Core::IOptionsPageWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
VcsClientOptionsPageWidget();
|
||||
|
||||
void apply() override {}
|
||||
|
||||
virtual void setSettings(const VcsBaseClientSettings &s) = 0;
|
||||
virtual VcsBaseClientSettings settings() const = 0;
|
||||
};
|
||||
|
||||
class VCSBASE_EXPORT VcsClientOptionsPage : public Core::IOptionsPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
using WidgetFactory = std::function<VcsClientOptionsPageWidget *()>;
|
||||
|
||||
explicit VcsClientOptionsPage(Core::IVersionControl *control, VcsBaseClientSettings *settings, QObject *parent = nullptr);
|
||||
|
||||
VcsClientOptionsPageWidget *widget() override;
|
||||
void apply() override;
|
||||
void finish() override;
|
||||
|
||||
signals:
|
||||
void settingsChanged();
|
||||
|
||||
protected:
|
||||
void setWidgetFactory(WidgetFactory factory);
|
||||
|
||||
private:
|
||||
WidgetFactory m_factory;
|
||||
VcsClientOptionsPageWidget *m_widget = nullptr;
|
||||
VcsBaseClientSettings *const m_settings;
|
||||
};
|
||||
|
||||
} // namespace VcsBase
|
Reference in New Issue
Block a user