forked from qt-creator/qt-creator
FakeVim: Delay settings creation until actual use
Task-number: QTCREATORBUG-29167 Change-Id: I3a6f1330922f3840cb7e99d8adb60a728d36eb4b Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -45,29 +45,15 @@ void setAutoApply(bool ) {}
|
||||
#endif
|
||||
|
||||
|
||||
static FakeVimSettings *s_settings;
|
||||
|
||||
FakeVimSettings &settings()
|
||||
{
|
||||
return *s_settings;
|
||||
static FakeVimSettings theSettings;
|
||||
return theSettings;
|
||||
}
|
||||
|
||||
FakeVimSettings::FakeVimSettings()
|
||||
{
|
||||
s_settings = this;
|
||||
|
||||
#ifndef FAKEVIM_STANDALONE
|
||||
const char SETTINGS_CATEGORY[] = "D.FakeVim";
|
||||
const char SETTINGS_ID[] = "A.FakeVim.General";
|
||||
|
||||
setId(SETTINGS_ID);
|
||||
setDisplayName(Tr::tr("General"));
|
||||
setCategory(SETTINGS_CATEGORY);
|
||||
setDisplayCategory(Tr::tr("FakeVim"));
|
||||
setCategoryIconPath(":/fakevim/images/settingscategory_fakevim.png");
|
||||
|
||||
setup(&useFakeVim, false, "UseFakeVim", {}, Tr::tr("Use FakeVim"));
|
||||
#endif
|
||||
|
||||
// Specific FakeVim settings
|
||||
setup(&readVimRc, false, "ReadVimRc", {}, Tr::tr("Read .vimrc from location:"));
|
||||
@@ -303,4 +289,27 @@ void FakeVimSettings::setup(FvBaseAspect *aspect,
|
||||
m_nameToAspect[shortName] = aspect;
|
||||
}
|
||||
|
||||
#ifndef FAKEVIM_STANDALONE
|
||||
|
||||
class FakeVimSettingsPage final : public Core::IOptionsPage
|
||||
{
|
||||
public:
|
||||
FakeVimSettingsPage()
|
||||
{
|
||||
const char SETTINGS_CATEGORY[] = "D.FakeVim";
|
||||
const char SETTINGS_ID[] = "A.FakeVim.General";
|
||||
|
||||
setId(SETTINGS_ID);
|
||||
setDisplayName(Tr::tr("General"));
|
||||
setCategory(SETTINGS_CATEGORY);
|
||||
setDisplayCategory(Tr::tr("FakeVim"));
|
||||
setCategoryIconPath(":/fakevim/images/settingscategory_fakevim.png");
|
||||
setSettingsProvider([] { return &settings(); });
|
||||
}
|
||||
};
|
||||
|
||||
const FakeVimSettingsPage settingsPage;
|
||||
|
||||
#endif
|
||||
|
||||
} // FakeVim::Internal
|
||||
|
||||
Reference in New Issue
Block a user