forked from qt-creator/qt-creator
VcsPlugin: shift signalling of settings changes
To allow removing the QObject ineritance of IOptionPage Change-Id: Id230ee9230dd1bee094b19b5a22d61d37e650d27 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -127,11 +127,11 @@ public:
|
|||||||
connect(cacheResetButton, &QPushButton::clicked,
|
connect(cacheResetButton, &QPushButton::clicked,
|
||||||
Core::VcsManager::instance(), &Core::VcsManager::clearVersionControlCache);
|
Core::VcsManager::instance(), &Core::VcsManager::clearVersionControlCache);
|
||||||
|
|
||||||
setOnApply([&s, page] {
|
setOnApply([&s] {
|
||||||
if (s.isDirty()) {
|
if (s.isDirty()) {
|
||||||
s.apply();
|
s.apply();
|
||||||
s.writeSettings(Core::ICore::settings());
|
s.writeSettings(Core::ICore::settings());
|
||||||
emit page->settingsChanged();
|
emit s.settingsChanged();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ namespace Internal {
|
|||||||
|
|
||||||
class CommonVcsSettings : public Utils::AspectContainer
|
class CommonVcsSettings : public Utils::AspectContainer
|
||||||
{
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CommonVcsSettings();
|
CommonVcsSettings();
|
||||||
|
|
||||||
@@ -27,20 +29,18 @@ public:
|
|||||||
|
|
||||||
Utils::BoolAspect lineWrap;
|
Utils::BoolAspect lineWrap;
|
||||||
Utils::IntegerAspect lineWrapWidth;
|
Utils::IntegerAspect lineWrapWidth;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void settingsChanged();
|
||||||
};
|
};
|
||||||
|
|
||||||
class CommonOptionsPage final : public Core::IOptionsPage
|
class CommonOptionsPage final : public Core::IOptionsPage
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CommonOptionsPage();
|
CommonOptionsPage();
|
||||||
|
|
||||||
CommonVcsSettings &settings() { return m_settings; }
|
CommonVcsSettings &settings() { return m_settings; }
|
||||||
|
|
||||||
signals:
|
|
||||||
void settingsChanged();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CommonVcsSettings m_settings;
|
CommonVcsSettings m_settings;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public:
|
|||||||
explicit VcsPluginPrivate(VcsPlugin *plugin)
|
explicit VcsPluginPrivate(VcsPlugin *plugin)
|
||||||
: q(plugin)
|
: q(plugin)
|
||||||
{
|
{
|
||||||
QObject::connect(&m_settingsPage, &CommonOptionsPage::settingsChanged,
|
QObject::connect(&m_settingsPage.settings(), &CommonVcsSettings::settingsChanged,
|
||||||
[this] { slotSettingsChanged(); });
|
[this] { slotSettingsChanged(); });
|
||||||
slotSettingsChanged();
|
slotSettingsChanged();
|
||||||
}
|
}
|
||||||
@@ -101,7 +101,7 @@ void VcsPlugin::initialize()
|
|||||||
return result;
|
return result;
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(&d->m_settingsPage, &CommonOptionsPage::settingsChanged,
|
connect(&d->m_settingsPage.settings(), &CommonVcsSettings::settingsChanged,
|
||||||
this, &VcsPlugin::settingsChanged);
|
this, &VcsPlugin::settingsChanged);
|
||||||
|
|
||||||
JsonWizardFactory::registerPageFactory(new Internal::VcsConfigurationPageFactory);
|
JsonWizardFactory::registerPageFactory(new Internal::VcsConfigurationPageFactory);
|
||||||
|
|||||||
Reference in New Issue
Block a user