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

View File

@@ -6,29 +6,23 @@
#include "mesonpluginconstants.h"
#include "mesonprojectmanagertr.h"
#include <coreplugin/dialogs/ioptionspage.h>
#include <utils/layoutbuilder.h>
namespace MesonProjectManager::Internal {
static Settings *s_instance;
Settings &settings()
MesonSettings &settings()
{
return *s_instance;
static MesonSettings theSettings;
return theSettings;
}
Settings::Settings()
MesonSettings::MesonSettings()
{
s_instance = this;
setAutoApply(false);
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.setLabelText(Tr::tr("Autorun Meson"));
autorunMeson.setToolTip(Tr::tr("Automatically run Meson when needed."));
@@ -49,4 +43,20 @@ Settings::Settings()
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

View File

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