forked from qt-creator/qt-creator
Fossil: Make settings more directly accessible
I am still not sure how the final pattern may ideally look like but it looks like some kind of singleton access to a plugin's settings helps with clarity. Change-Id: I6a6a5f5b7cfdfb062f5b5231a79086f34e09487f Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -101,9 +101,9 @@ FossilSettings::FossilSettings()
|
||||
class OptionsPageWidget final : public Core::IOptionsPageWidget
|
||||
{
|
||||
public:
|
||||
OptionsPageWidget(FossilSettings *settings)
|
||||
OptionsPageWidget()
|
||||
{
|
||||
FossilSettings &s = *settings;
|
||||
FossilSettings &s = settings();
|
||||
|
||||
using namespace Layouting;
|
||||
|
||||
@@ -141,16 +141,22 @@ public:
|
||||
|
||||
}.attachTo(this);
|
||||
|
||||
setOnApply([settings] { settings->apply(); });
|
||||
setOnApply([] { settings().apply(); });
|
||||
}
|
||||
};
|
||||
|
||||
OptionsPage::OptionsPage(FossilSettings *settings)
|
||||
OptionsPage::OptionsPage()
|
||||
{
|
||||
setId(Constants::VCS_ID_FOSSIL);
|
||||
setDisplayName(Tr::tr("Fossil"));
|
||||
setWidgetCreator([settings] { return new OptionsPageWidget(settings); });
|
||||
setWidgetCreator([] { return new OptionsPageWidget; });
|
||||
setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY);
|
||||
}
|
||||
|
||||
FossilSettings &settings()
|
||||
{
|
||||
static FossilSettings theSettings;
|
||||
return theSettings;
|
||||
}
|
||||
|
||||
} // Fossil::Internal
|
||||
|
||||
Reference in New Issue
Block a user