forked from qt-creator/qt-creator
CMake: Use new PagedSettings
More compact. Change-Id: Ie800e52b98d23e1acd1deba9d6b6e5f778c016bb Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -23,7 +23,6 @@
|
||||
|
||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||
#include <coreplugin/actionmanager/actionmanager.h>
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/projectmanager.h>
|
||||
@@ -74,7 +73,7 @@ public:
|
||||
};
|
||||
|
||||
CMakeSettingsPage settingsPage;
|
||||
CMakeSpecificSettingsPage specificSettings;
|
||||
CMakeSpecificSettings specificSettings;
|
||||
|
||||
CMakeManager manager;
|
||||
CMakeBuildStepFactory buildStepFactory;
|
||||
@@ -146,7 +145,6 @@ CMakeProjectPlugin::~CMakeProjectPlugin()
|
||||
void CMakeProjectPlugin::initialize()
|
||||
{
|
||||
d = new CMakeProjectPluginPrivate;
|
||||
CMakeSpecificSettings::instance()->readSettings(ICore::settings());
|
||||
|
||||
const Context projectContext{CMakeProjectManager::Constants::CMAKE_PROJECT_ID};
|
||||
|
||||
|
||||
@@ -15,8 +15,36 @@ using namespace Utils;
|
||||
|
||||
namespace CMakeProjectManager::Internal {
|
||||
|
||||
static CMakeSpecificSettings *theSettings;
|
||||
|
||||
CMakeSpecificSettings *CMakeSpecificSettings::instance()
|
||||
{
|
||||
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);
|
||||
setSettings(this);
|
||||
|
||||
setLayouter([this](QWidget *widget) {
|
||||
using namespace Layouting;
|
||||
Column {
|
||||
autorunCMake,
|
||||
packageManagerAutoSetup,
|
||||
askBeforeReConfigureInitialParams,
|
||||
showSourceSubFolders,
|
||||
showAdvancedOptionsByDefault,
|
||||
st
|
||||
}.attachTo(widget);
|
||||
});
|
||||
|
||||
// TODO: fixup of QTCREATORBUG-26289 , remove in Qt Creator 7 or so
|
||||
Core::ICore::settings()->remove("CMakeSpecificSettings/NinjaPath");
|
||||
|
||||
@@ -61,38 +89,8 @@ CMakeSpecificSettings::CMakeSpecificSettings()
|
||||
showAdvancedOptionsByDefault.setDefaultValue(false);
|
||||
showAdvancedOptionsByDefault.setLabelText(
|
||||
::CMakeProjectManager::Tr::tr("Show advanced options by default"));
|
||||
}
|
||||
|
||||
CMakeSpecificSettings *CMakeSpecificSettings::instance()
|
||||
{
|
||||
static CMakeSpecificSettings theSettings;
|
||||
return &theSettings;
|
||||
}
|
||||
|
||||
// CMakeSpecificSettingsPage
|
||||
|
||||
CMakeSpecificSettingsPage::CMakeSpecificSettingsPage()
|
||||
{
|
||||
CMakeSpecificSettings *settings = CMakeSpecificSettings::instance();
|
||||
setId(Constants::Settings::GENERAL_ID);
|
||||
setDisplayName(::CMakeProjectManager::Tr::tr("General"));
|
||||
setDisplayCategory("CMake");
|
||||
setCategory(Constants::Settings::CATEGORY);
|
||||
setCategoryIconPath(Constants::Icons::SETTINGS_CATEGORY);
|
||||
setSettings(settings);
|
||||
|
||||
setLayouter([settings](QWidget *widget) {
|
||||
CMakeSpecificSettings &s = *settings;
|
||||
using namespace Layouting;
|
||||
Column {
|
||||
s.autorunCMake,
|
||||
s.packageManagerAutoSetup,
|
||||
s.askBeforeReConfigureInitialParams,
|
||||
s.showSourceSubFolders,
|
||||
s.showAdvancedOptionsByDefault,
|
||||
st
|
||||
}.attachTo(widget);
|
||||
});
|
||||
readSettings(Core::ICore::settings());
|
||||
}
|
||||
|
||||
} // CMakeProjectManager::Internal
|
||||
|
||||
@@ -5,11 +5,9 @@
|
||||
|
||||
#include <coreplugin/dialogs/ioptionspage.h>
|
||||
|
||||
#include <utils/aspects.h>
|
||||
|
||||
namespace CMakeProjectManager::Internal {
|
||||
|
||||
class CMakeSpecificSettings final : public Utils::AspectContainer
|
||||
class CMakeSpecificSettings final : public Core::PagedSettings
|
||||
{
|
||||
public:
|
||||
CMakeSpecificSettings();
|
||||
@@ -24,10 +22,4 @@ public:
|
||||
Utils::BoolAspect showAdvancedOptionsByDefault;
|
||||
};
|
||||
|
||||
class CMakeSpecificSettingsPage final : public Core::IOptionsPage
|
||||
{
|
||||
public:
|
||||
CMakeSpecificSettingsPage();
|
||||
};
|
||||
|
||||
} // CMakeProjectManager::Internal
|
||||
|
||||
Reference in New Issue
Block a user