CMake: Use current pattern to access main settings page

Change-Id: I95c556bebe1d583879b6702f727d9a859b9a4bcb
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
hjk
2023-07-06 17:06:20 +02:00
parent 0822f28998
commit 3e155919eb
12 changed files with 43 additions and 48 deletions

View File

@@ -7,6 +7,8 @@
#include "cmakeprojectmanagertr.h"
#include <coreplugin/icore.h>
#include <coreplugin/dialogs/ioptionspage.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <utils/layoutbuilder.h>
@@ -15,23 +17,14 @@ using namespace Utils;
namespace CMakeProjectManager::Internal {
static CMakeSpecificSettings *theSettings;
CMakeSpecificSettings *CMakeSpecificSettings::instance()
CMakeSpecificSettings &settings()
{
static CMakeSpecificSettings theSettings;
return theSettings;
}
CMakeSpecificSettings::CMakeSpecificSettings()
{
theSettings = this;
setId(Constants::Settings::GENERAL_ID);
setDisplayName(::CMakeProjectManager::Tr::tr("General"));
setDisplayCategory("CMake");
setCategory(Constants::Settings::CATEGORY);
setCategoryIconPath(Constants::Icons::SETTINGS_CATEGORY);
setLayouter([this] {
using namespace Layouting;
return Column {
@@ -91,4 +84,20 @@ CMakeSpecificSettings::CMakeSpecificSettings()
readSettings();
}
class CMakeSpecificSettingsPage final : public Core::IOptionsPage
{
public:
CMakeSpecificSettingsPage()
{
setId(Constants::Settings::GENERAL_ID);
setDisplayName(::CMakeProjectManager::Tr::tr("General"));
setDisplayCategory("CMake");
setCategory(Constants::Settings::CATEGORY);
setCategoryIconPath(Constants::Icons::SETTINGS_CATEGORY);
setSettingsProvider([] { return &settings(); });
}
};
const CMakeSpecificSettingsPage settingsPage;
} // CMakeProjectManager::Internal