forked from qt-creator/qt-creator
CVS: Use the new AspectContainer::applied signal
Change-Id: Icd86026a22f730fb5c7a460d5b1e38c16c5768b9 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -364,7 +364,7 @@ private:
|
|||||||
QAction *m_menuAction = nullptr;
|
QAction *m_menuAction = nullptr;
|
||||||
bool m_submitActionTriggered = false;
|
bool m_submitActionTriggered = false;
|
||||||
|
|
||||||
CvsSettingsPage m_settingsPage{[this] { configurationChanged(); }, &m_settings};
|
CvsSettingsPage m_settingsPage{&m_settings};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
VcsSubmitEditorFactory submitEditorFactory {
|
VcsSubmitEditorFactory submitEditorFactory {
|
||||||
@@ -736,6 +736,8 @@ CvsPluginPrivate::CvsPluginPrivate()
|
|||||||
connect(m_revertRepositoryAction, &QAction::triggered, this, &CvsPluginPrivate::revertAll);
|
connect(m_revertRepositoryAction, &QAction::triggered, this, &CvsPluginPrivate::revertAll);
|
||||||
cvsMenu->addAction(command);
|
cvsMenu->addAction(command);
|
||||||
m_commandLocator->appendCommand(command);
|
m_commandLocator->appendCommand(command);
|
||||||
|
|
||||||
|
connect(&m_settings, &AspectContainer::applied, this, &IVersionControl::configurationChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CvsPluginPrivate::vcsDescribe(const QString &source, const QString &changeNr)
|
void CvsPluginPrivate::vcsDescribe(const QString &source, const QString &changeNr)
|
||||||
|
|||||||
@@ -33,7 +33,6 @@
|
|||||||
#include <vcsbase/vcsbaseconstants.h>
|
#include <vcsbase/vcsbaseconstants.h>
|
||||||
|
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
using namespace VcsBase;
|
|
||||||
|
|
||||||
namespace Cvs {
|
namespace Cvs {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -91,38 +90,27 @@ QStringList CvsSettings::addOptions(const QStringList &args) const
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
// CvsSettingsPage
|
CvsSettingsPage::CvsSettingsPage(CvsSettings *settings)
|
||||||
|
|
||||||
class CvsSettingsPageWidget final : public Core::IOptionsPageWidget
|
|
||||||
{
|
{
|
||||||
Q_DECLARE_TR_FUNCTIONS(Cvs::Internal::SettingsPageWidget)
|
setId(VcsBase::Constants::VCS_ID_CVS);
|
||||||
|
setDisplayName(CvsSettings::tr("CVS"));
|
||||||
|
setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY);
|
||||||
|
setSettings(settings);
|
||||||
|
|
||||||
public:
|
setLayouter([settings](QWidget *widget) {
|
||||||
CvsSettingsPageWidget(const std::function<void()> & onApply, CvsSettings *settings);
|
|
||||||
|
|
||||||
void apply() final;
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::function<void()> m_onApply;
|
|
||||||
CvsSettings *m_settings;
|
|
||||||
};
|
|
||||||
|
|
||||||
CvsSettingsPageWidget::CvsSettingsPageWidget(const std::function<void()> &onApply, CvsSettings *settings)
|
|
||||||
: m_onApply(onApply), m_settings(settings)
|
|
||||||
{
|
|
||||||
CvsSettings &s = *settings;
|
CvsSettings &s = *settings;
|
||||||
using namespace Layouting;
|
using namespace Layouting;
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
Group {
|
Group {
|
||||||
Title(tr("Configuration")),
|
Title(CvsSettings::tr("Configuration")),
|
||||||
Form {
|
Form {
|
||||||
s.binaryPath,
|
s.binaryPath,
|
||||||
s.cvsRoot
|
s.cvsRoot
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Group {
|
Group {
|
||||||
Title(tr("Miscellaneous")),
|
Title(CvsSettings::tr("Miscellaneous")),
|
||||||
Form {
|
Form {
|
||||||
s.timeout,
|
s.timeout,
|
||||||
s.diffOptions,
|
s.diffOptions,
|
||||||
@@ -131,23 +119,8 @@ CvsSettingsPageWidget::CvsSettingsPageWidget(const std::function<void()> &onAppl
|
|||||||
s.describeByCommitId,
|
s.describeByCommitId,
|
||||||
},
|
},
|
||||||
Stretch()
|
Stretch()
|
||||||
}.attachTo(this);
|
}.attachTo(widget);
|
||||||
}
|
});
|
||||||
|
|
||||||
void CvsSettingsPageWidget::apply()
|
|
||||||
{
|
|
||||||
if (m_settings->isDirty()) {
|
|
||||||
m_settings->apply();
|
|
||||||
m_onApply();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CvsSettingsPage::CvsSettingsPage(const std::function<void()> &onApply, CvsSettings *settings)
|
|
||||||
{
|
|
||||||
setId(VcsBase::Constants::VCS_ID_CVS);
|
|
||||||
setDisplayName(CvsSettingsPageWidget::tr("CVS"));
|
|
||||||
setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY);
|
|
||||||
setWidgetCreator([onApply, settings] { return new CvsSettingsPageWidget(onApply, settings); });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // Internal
|
} // Internal
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public:
|
|||||||
class CvsSettingsPage final : public Core::IOptionsPage
|
class CvsSettingsPage final : public Core::IOptionsPage
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CvsSettingsPage(const std::function<void()> &onApply, CvsSettings *settings);
|
explicit CvsSettingsPage(CvsSettings *settings);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
Reference in New Issue
Block a user