forked from qt-creator/qt-creator
Vcpkg: Delay VcpkgSettings creation until first use
Task-number: QTCREATORBUG-29167 Change-Id: I249aed1661a6435d9c4bf1e1be1f7750cca4fce8 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
#include "vcpkg_test.h"
|
||||
#endif // WITH_TESTS
|
||||
#include "vcpkgmanifesteditor.h"
|
||||
#include "vcpkgsettings.h"
|
||||
|
||||
#include <projectexplorer/jsonwizard/jsonwizardfactory.h>
|
||||
|
||||
@@ -17,7 +16,6 @@ class VcpkgPluginPrivate
|
||||
{
|
||||
public:
|
||||
VcpkgManifestEditorFactory manifestEditorFactory;
|
||||
VcpkgSettings settings;
|
||||
};
|
||||
|
||||
VcpkgPlugin::~VcpkgPlugin()
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
#include "vcpkgconstants.h"
|
||||
#include "vcpkgtr.h"
|
||||
|
||||
#include <coreplugin/dialogs/ioptionspage.h>
|
||||
|
||||
#include <cmakeprojectmanager/cmakeprojectconstants.h>
|
||||
|
||||
#include <utils/environment.h>
|
||||
@@ -19,21 +21,15 @@ using namespace Utils;
|
||||
|
||||
namespace Vcpkg::Internal {
|
||||
|
||||
static VcpkgSettings *theSettings = nullptr;
|
||||
|
||||
VcpkgSettings &settings()
|
||||
{
|
||||
return *theSettings;
|
||||
static VcpkgSettings theSettings;
|
||||
return theSettings;
|
||||
}
|
||||
|
||||
VcpkgSettings::VcpkgSettings()
|
||||
{
|
||||
theSettings = this;
|
||||
|
||||
setSettingsGroup("Vcpkg");
|
||||
setId(Constants::TOOLSSETTINGSPAGE_ID);
|
||||
setDisplayName("Vcpkg");
|
||||
setCategory(CMakeProjectManager::Constants::Settings::CATEGORY);
|
||||
|
||||
vcpkgRoot.setSettingsKey("VcpkgRoot");
|
||||
vcpkgRoot.setExpectedKind(PathChooser::ExistingDirectory);
|
||||
@@ -72,4 +68,18 @@ VcpkgSettings::VcpkgSettings()
|
||||
readSettings();
|
||||
}
|
||||
|
||||
class VcpkgSettingsPage : public Core::IOptionsPage
|
||||
{
|
||||
public:
|
||||
VcpkgSettingsPage()
|
||||
{
|
||||
setId(Constants::TOOLSSETTINGSPAGE_ID);
|
||||
setDisplayName("Vcpkg");
|
||||
setCategory(CMakeProjectManager::Constants::Settings::CATEGORY);
|
||||
setSettingsProvider([] { return &settings(); });
|
||||
}
|
||||
};
|
||||
|
||||
static const VcpkgSettingsPage settingsPage;
|
||||
|
||||
} // Vcpkg::Internal
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <coreplugin/dialogs/ioptionspage.h>
|
||||
#include <utils/aspects.h>
|
||||
|
||||
namespace Vcpkg::Internal {
|
||||
|
||||
class VcpkgSettings : public Core::PagedSettings
|
||||
class VcpkgSettings : public Utils::AspectContainer
|
||||
{
|
||||
public:
|
||||
VcpkgSettings();
|
||||
|
||||
Reference in New Issue
Block a user