Meson: Delay settings creation

Change-Id: Ib4de981670c9f70e5ddd4c6e0b31bfd4b6a61851
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
hjk
2023-07-18 11:43:54 +02:00
parent 481d301c5c
commit 3e2e0d9393
3 changed files with 26 additions and 20 deletions

View File

@@ -11,7 +11,6 @@
#include "mesontoolkitaspect.h" #include "mesontoolkitaspect.h"
#include "ninjabuildstep.h" #include "ninjabuildstep.h"
#include "ninjatoolkitaspect.h" #include "ninjatoolkitaspect.h"
#include "settings.h"
#include "toolssettingsaccessor.h" #include "toolssettingsaccessor.h"
#include "toolssettingspage.h" #include "toolssettingspage.h"
@@ -45,7 +44,6 @@ public:
~MesonProjectPluginPrivate() {} ~MesonProjectPluginPrivate() {}
private: private:
Settings m_settings;
ToolsSettingsPage m_toolslSettingsPage; ToolsSettingsPage m_toolslSettingsPage;
ToolsSettingsAccessor m_toolsSettings; ToolsSettingsAccessor m_toolsSettings;
MesonToolKitAspect m_mesonKitAspect; MesonToolKitAspect m_mesonKitAspect;

View File

@@ -6,29 +6,23 @@
#include "mesonpluginconstants.h" #include "mesonpluginconstants.h"
#include "mesonprojectmanagertr.h" #include "mesonprojectmanagertr.h"
#include <coreplugin/dialogs/ioptionspage.h>
#include <utils/layoutbuilder.h> #include <utils/layoutbuilder.h>
namespace MesonProjectManager::Internal { namespace MesonProjectManager::Internal {
static Settings *s_instance; MesonSettings &settings()
Settings &settings()
{ {
return *s_instance; static MesonSettings theSettings;
return theSettings;
} }
Settings::Settings() MesonSettings::MesonSettings()
{ {
s_instance = this; setAutoApply(false);
setSettingsGroup("MesonProjectManager"); setSettingsGroup("MesonProjectManager");
setId("A.MesonProjectManager.SettingsPage.General");
setDisplayName(Tr::tr("General"));
setDisplayCategory("Meson");
setCategory(Constants::SettingsPage::CATEGORY);
setCategoryIconPath(Constants::Icons::MESON_BW);
autorunMeson.setSettingsKey("meson.autorun"); autorunMeson.setSettingsKey("meson.autorun");
autorunMeson.setLabelText(Tr::tr("Autorun Meson")); autorunMeson.setLabelText(Tr::tr("Autorun Meson"));
autorunMeson.setToolTip(Tr::tr("Automatically run Meson when needed.")); autorunMeson.setToolTip(Tr::tr("Automatically run Meson when needed."));
@@ -49,4 +43,20 @@ Settings::Settings()
readSettings(); readSettings();
} }
class MesonSettingsPage final : public Core::IOptionsPage
{
public:
MesonSettingsPage()
{
setId("A.MesonProjectManager.SettingsPage.General");
setDisplayName(Tr::tr("General"));
setDisplayCategory("Meson");
setCategory(Constants::SettingsPage::CATEGORY);
setCategoryIconPath(Constants::Icons::MESON_BW);
setSettingsProvider([] { return &settings(); });
}
};
const MesonSettingsPage settingsPage;
} // MesonProjectManager::Internal } // MesonProjectManager::Internal

View File

@@ -3,21 +3,19 @@
#pragma once #pragma once
#include <coreplugin/dialogs/ioptionspage.h>
#include <utils/aspects.h> #include <utils/aspects.h>
namespace MesonProjectManager::Internal { namespace MesonProjectManager::Internal {
class Settings : public Core::PagedSettings class MesonSettings final : public Utils::AspectContainer
{ {
public: public:
Settings(); MesonSettings();
Utils::BoolAspect autorunMeson{this}; Utils::BoolAspect autorunMeson{this};
Utils::BoolAspect verboseNinja{this}; Utils::BoolAspect verboseNinja{this};
}; };
Settings &settings(); MesonSettings &settings();
} // MesonProjectManager::Internal } // MesonProjectManager::Internal