forked from qt-creator/qt-creator
Nim: Convert tool settings to latest style
Change-Id: I206b7d10531a9a3053a68eae522896971c9f1423 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
#include "../nimtr.h"
|
#include "../nimtr.h"
|
||||||
#include "nimcodestylepreferencesfactory.h"
|
#include "nimcodestylepreferencesfactory.h"
|
||||||
|
|
||||||
|
#include <coreplugin/dialogs/ioptionspage.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
|
|
||||||
#include <texteditor/codestylepool.h>
|
#include <texteditor/codestylepool.h>
|
||||||
@@ -24,14 +25,16 @@ namespace Nim {
|
|||||||
|
|
||||||
static SimpleCodeStylePreferences *m_globalCodeStyle = nullptr;
|
static SimpleCodeStylePreferences *m_globalCodeStyle = nullptr;
|
||||||
|
|
||||||
|
NimSettings &settings()
|
||||||
|
{
|
||||||
|
static NimSettings theSettings;
|
||||||
|
return theSettings;
|
||||||
|
}
|
||||||
|
|
||||||
NimSettings::NimSettings()
|
NimSettings::NimSettings()
|
||||||
{
|
{
|
||||||
setSettingsGroups("Nim", "NimSuggest");
|
setSettingsGroups("Nim", "NimSuggest");
|
||||||
setId(Nim::Constants::C_NIMTOOLSSETTINGSPAGE_ID);
|
setAutoApply(false);
|
||||||
setDisplayName(Tr::tr("Tools"));
|
|
||||||
setCategory(Nim::Constants::C_NIMTOOLSSETTINGSPAGE_CATEGORY);
|
|
||||||
setDisplayCategory(Tr::tr("Nim"));
|
|
||||||
setCategoryIconPath(":/nim/images/settingscategory_nim.png");
|
|
||||||
|
|
||||||
setLayouter([this] {
|
setLayouter([this] {
|
||||||
using namespace Layouting;
|
using namespace Layouting;
|
||||||
@@ -105,7 +108,26 @@ NimSettings::~NimSettings()
|
|||||||
|
|
||||||
SimpleCodeStylePreferences *NimSettings::globalCodeStyle()
|
SimpleCodeStylePreferences *NimSettings::globalCodeStyle()
|
||||||
{
|
{
|
||||||
|
QTC_ASSERT(m_globalCodeStyle, settings()); // Ensure creation
|
||||||
return m_globalCodeStyle;
|
return m_globalCodeStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NimSettingsPage
|
||||||
|
|
||||||
|
class NimSettingsPage final : public Core::IOptionsPage
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
NimSettingsPage()
|
||||||
|
{
|
||||||
|
setId(Nim::Constants::C_NIMTOOLSSETTINGSPAGE_ID);
|
||||||
|
setDisplayName(Tr::tr("Tools"));
|
||||||
|
setCategory(Nim::Constants::C_NIMTOOLSSETTINGSPAGE_CATEGORY);
|
||||||
|
setDisplayCategory(Tr::tr("Nim"));
|
||||||
|
setCategoryIconPath(":/nim/images/settingscategory_nim.png");
|
||||||
|
setSettingsProvider([] { return &settings(); });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const NimSettingsPage settingsPage;
|
||||||
|
|
||||||
} // namespace Nim
|
} // namespace Nim
|
||||||
|
@@ -3,13 +3,13 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <coreplugin/dialogs/ioptionspage.h>
|
#include <utils/aspects.h>
|
||||||
|
|
||||||
namespace TextEditor { class SimpleCodeStylePreferences; }
|
namespace TextEditor { class SimpleCodeStylePreferences; }
|
||||||
|
|
||||||
namespace Nim {
|
namespace Nim {
|
||||||
|
|
||||||
class NimSettings : public Core::PagedSettings
|
class NimSettings final : public Utils::AspectContainer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NimSettings();
|
NimSettings();
|
||||||
@@ -20,5 +20,7 @@ public:
|
|||||||
static TextEditor::SimpleCodeStylePreferences *globalCodeStyle();
|
static TextEditor::SimpleCodeStylePreferences *globalCodeStyle();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
NimSettings &settings();
|
||||||
|
|
||||||
} // Nim
|
} // Nim
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user