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"
|
#include "vcpkg_test.h"
|
||||||
#endif // WITH_TESTS
|
#endif // WITH_TESTS
|
||||||
#include "vcpkgmanifesteditor.h"
|
#include "vcpkgmanifesteditor.h"
|
||||||
#include "vcpkgsettings.h"
|
|
||||||
|
|
||||||
#include <projectexplorer/jsonwizard/jsonwizardfactory.h>
|
#include <projectexplorer/jsonwizard/jsonwizardfactory.h>
|
||||||
|
|
||||||
@@ -17,7 +16,6 @@ class VcpkgPluginPrivate
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VcpkgManifestEditorFactory manifestEditorFactory;
|
VcpkgManifestEditorFactory manifestEditorFactory;
|
||||||
VcpkgSettings settings;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
VcpkgPlugin::~VcpkgPlugin()
|
VcpkgPlugin::~VcpkgPlugin()
|
||||||
|
|||||||
@@ -6,6 +6,8 @@
|
|||||||
#include "vcpkgconstants.h"
|
#include "vcpkgconstants.h"
|
||||||
#include "vcpkgtr.h"
|
#include "vcpkgtr.h"
|
||||||
|
|
||||||
|
#include <coreplugin/dialogs/ioptionspage.h>
|
||||||
|
|
||||||
#include <cmakeprojectmanager/cmakeprojectconstants.h>
|
#include <cmakeprojectmanager/cmakeprojectconstants.h>
|
||||||
|
|
||||||
#include <utils/environment.h>
|
#include <utils/environment.h>
|
||||||
@@ -19,21 +21,15 @@ using namespace Utils;
|
|||||||
|
|
||||||
namespace Vcpkg::Internal {
|
namespace Vcpkg::Internal {
|
||||||
|
|
||||||
static VcpkgSettings *theSettings = nullptr;
|
|
||||||
|
|
||||||
VcpkgSettings &settings()
|
VcpkgSettings &settings()
|
||||||
{
|
{
|
||||||
return *theSettings;
|
static VcpkgSettings theSettings;
|
||||||
|
return theSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
VcpkgSettings::VcpkgSettings()
|
VcpkgSettings::VcpkgSettings()
|
||||||
{
|
{
|
||||||
theSettings = this;
|
|
||||||
|
|
||||||
setSettingsGroup("Vcpkg");
|
setSettingsGroup("Vcpkg");
|
||||||
setId(Constants::TOOLSSETTINGSPAGE_ID);
|
|
||||||
setDisplayName("Vcpkg");
|
|
||||||
setCategory(CMakeProjectManager::Constants::Settings::CATEGORY);
|
|
||||||
|
|
||||||
vcpkgRoot.setSettingsKey("VcpkgRoot");
|
vcpkgRoot.setSettingsKey("VcpkgRoot");
|
||||||
vcpkgRoot.setExpectedKind(PathChooser::ExistingDirectory);
|
vcpkgRoot.setExpectedKind(PathChooser::ExistingDirectory);
|
||||||
@@ -72,4 +68,18 @@ VcpkgSettings::VcpkgSettings()
|
|||||||
readSettings();
|
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
|
} // Vcpkg::Internal
|
||||||
|
|||||||
@@ -3,11 +3,11 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <coreplugin/dialogs/ioptionspage.h>
|
#include <utils/aspects.h>
|
||||||
|
|
||||||
namespace Vcpkg::Internal {
|
namespace Vcpkg::Internal {
|
||||||
|
|
||||||
class VcpkgSettings : public Core::PagedSettings
|
class VcpkgSettings : public Utils::AspectContainer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VcpkgSettings();
|
VcpkgSettings();
|
||||||
|
|||||||
Reference in New Issue
Block a user