Haskell: Delay settings creation

Change-Id: I45666aa8aab1caa776d2f9f23455dc6a92384018
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
hjk
2023-07-18 12:05:36 +02:00
parent 5d67ad37cf
commit 45aa708e89
3 changed files with 25 additions and 14 deletions

View File

@@ -9,7 +9,6 @@
#include "haskellmanager.h"
#include "haskellproject.h"
#include "haskellrunconfiguration.h"
#include "haskellsettings.h"
#include "haskelltr.h"
#include "stackbuildstep.h"
@@ -31,7 +30,6 @@ namespace Internal {
class HaskellPluginPrivate
{
public:
HaskellSettings settings;
HaskellEditorFactory editorFactory;
HaskellBuildConfigurationFactory buildConfigFactory;
StackBuildStepFactory stackBuildStepFactory;

View File

@@ -6,6 +6,8 @@
#include "haskellconstants.h"
#include "haskelltr.h"
#include <coreplugin/dialogs/ioptionspage.h>
#include <utils/hostosinfo.h>
#include <utils/layoutbuilder.h>
@@ -13,22 +15,15 @@ using namespace Utils;
namespace Haskell::Internal {
static HaskellSettings *theSettings;
HaskellSettings &settings()
{
return *theSettings;
static HaskellSettings theSettings;
return theSettings;
}
HaskellSettings::HaskellSettings()
{
theSettings = this;
setId(Constants::OPTIONS_GENERAL);
setDisplayName(Tr::tr("General"));
setCategory("J.Z.Haskell");
setDisplayCategory(Tr::tr("Haskell"));
setCategoryIconPath(":/haskell/images/settingscategory_haskell.png");
setAutoApply(false);
stackPath.setSettingsKey("Haskell/StackExecutable");
stackPath.setExpectedKind(PathChooser::ExistingCommand);
@@ -55,4 +50,22 @@ HaskellSettings::HaskellSettings()
readSettings();
}
// HaskellSettingsPage
class HaskellSettingsPage final : public Core::IOptionsPage
{
public:
HaskellSettingsPage()
{
setId(Constants::OPTIONS_GENERAL);
setDisplayName(Tr::tr("General"));
setCategory("J.Z.Haskell");
setDisplayCategory(Tr::tr("Haskell"));
setCategoryIconPath(":/haskell/images/settingscategory_haskell.png");
setSettingsProvider([] { return &settings(); });
}
};
const HaskellSettingsPage settingsPage;
} // Haskell::Internal

View File

@@ -3,11 +3,11 @@
#pragma once
#include <coreplugin/dialogs/ioptionspage.h>
#include <utils/aspects.h>
namespace Haskell::Internal {
class HaskellSettings : public Core::PagedSettings
class HaskellSettings final : public Utils::AspectContainer
{
public:
HaskellSettings();