forked from qt-creator/qt-creator
Utils: Make aspect settings access implicit
Generally, aspects should use fromMap/toMap, but some older pages
use {from,to}Settings with always the same ICore::settings().
To make that less intrusive on the user code side, make that globally
implicit.
Task-number: QTCREATORBUG-29167
Change-Id: I29a8e23a31eb8061bb143e93931a07c6741eb7f9
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/appinfo.h>
|
||||
#include <utils/aspects.h>
|
||||
#include <utils/environment.h>
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/fsengine/fsengine.h>
|
||||
@@ -654,6 +655,8 @@ int main(int argc, char **argv)
|
||||
PluginManager::setGlobalSettings(globalSettings);
|
||||
PluginManager::setSettings(settings);
|
||||
|
||||
Utils::BaseAspect::setGlobalSettings(globalSettings);
|
||||
|
||||
using namespace Core;
|
||||
Utils::AppInfo info;
|
||||
info.author = Constants::IDE_AUTHOR;
|
||||
|
||||
@@ -34,6 +34,19 @@
|
||||
using namespace Layouting;
|
||||
|
||||
namespace Utils {
|
||||
|
||||
static QSettings *theSettings = nullptr;
|
||||
|
||||
void BaseAspect::setGlobalSettings(QSettings *settings)
|
||||
{
|
||||
theSettings = settings;
|
||||
}
|
||||
|
||||
QSettings *BaseAspect::settings()
|
||||
{
|
||||
return theSettings;
|
||||
}
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class BaseAspectPrivate
|
||||
@@ -552,19 +565,19 @@ void BaseAspect::toMap(QVariantMap &map) const
|
||||
saveToMap(map, toSettingsValue(variantValue()), toSettingsValue(defaultVariantValue()), settingsKey());
|
||||
}
|
||||
|
||||
void BaseAspect::readSettings(const QSettings *settings)
|
||||
void BaseAspect::readSettings()
|
||||
{
|
||||
if (settingsKey().isEmpty())
|
||||
return;
|
||||
const QVariant &val = settings->value(settingsKey());
|
||||
const QVariant val = settings()->value(settingsKey());
|
||||
setVariantValue(val.isValid() ? fromSettingsValue(val) : defaultVariantValue());
|
||||
}
|
||||
|
||||
void BaseAspect::writeSettings(QSettings *settings) const
|
||||
void BaseAspect::writeSettings() const
|
||||
{
|
||||
if (settingsKey().isEmpty())
|
||||
return;
|
||||
QtcSettings::setValueWithDefault(settings,
|
||||
QtcSettings::setValueWithDefault(settings(),
|
||||
settingsKey(),
|
||||
toSettingsValue(variantValue()),
|
||||
toSettingsValue(defaultVariantValue()));
|
||||
@@ -2314,28 +2327,30 @@ void AspectContainer::toMap(QVariantMap &map) const
|
||||
aspect->toMap(map);
|
||||
}
|
||||
|
||||
void AspectContainer::readSettings(QSettings *settings)
|
||||
void AspectContainer::readSettings()
|
||||
{
|
||||
QTC_ASSERT(theSettings, return);
|
||||
for (const QString &group : d->m_settingsGroup)
|
||||
settings->beginGroup(group);
|
||||
theSettings->beginGroup(group);
|
||||
|
||||
for (BaseAspect *aspect : std::as_const(d->m_items))
|
||||
aspect->readSettings(settings);
|
||||
aspect->readSettings();
|
||||
|
||||
for (int i = 0; i != d->m_settingsGroup.size(); ++i)
|
||||
settings->endGroup();
|
||||
theSettings->endGroup();
|
||||
}
|
||||
|
||||
void AspectContainer::writeSettings(QSettings *settings) const
|
||||
void AspectContainer::writeSettings() const
|
||||
{
|
||||
QTC_ASSERT(theSettings, return);
|
||||
for (const QString &group : d->m_settingsGroup)
|
||||
settings->beginGroup(group);
|
||||
theSettings->beginGroup(group);
|
||||
|
||||
for (BaseAspect *aspect : std::as_const(d->m_items))
|
||||
aspect->writeSettings(settings);
|
||||
aspect->writeSettings();
|
||||
|
||||
for (int i = 0; i != d->m_settingsGroup.size(); ++i)
|
||||
settings->endGroup();
|
||||
theSettings->endGroup();
|
||||
}
|
||||
|
||||
void AspectContainer::setSettingsGroup(const QString &groupKey)
|
||||
|
||||
@@ -100,8 +100,8 @@ public:
|
||||
|
||||
virtual void addToLayout(Layouting::LayoutItem &parent);
|
||||
|
||||
virtual void readSettings(const QSettings *settings);
|
||||
virtual void writeSettings(QSettings *settings) const;
|
||||
virtual void readSettings();
|
||||
virtual void writeSettings() const;
|
||||
|
||||
using SavedValueTransformation = std::function<QVariant(const QVariant &)>;
|
||||
void setFromSettingsTransformation(const SavedValueTransformation &transform);
|
||||
@@ -159,6 +159,9 @@ public:
|
||||
|
||||
Data::Ptr extractData() const;
|
||||
|
||||
static void setGlobalSettings(QSettings *settings);
|
||||
static QSettings *settings();
|
||||
|
||||
signals:
|
||||
void changed();
|
||||
void volatileValueChanged();
|
||||
@@ -713,8 +716,8 @@ public:
|
||||
void fromMap(const QVariantMap &map);
|
||||
void toMap(QVariantMap &map) const;
|
||||
|
||||
void readSettings(QSettings *settings);
|
||||
void writeSettings(QSettings *settings) const;
|
||||
void readSettings();
|
||||
void writeSettings() const;
|
||||
|
||||
void setSettingsGroup(const QString &groupKey);
|
||||
void setSettingsGroups(const QString &groupKey, const QString &subGroupKey);
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#include <coreplugin/actionmanager/command.h>
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/icontext.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/messagemanager.h>
|
||||
|
||||
#include <cplusplus/CppDocument.h>
|
||||
@@ -138,7 +137,7 @@ AutotestPluginPrivate::AutotestPluginPrivate()
|
||||
|
||||
m_frameworkManager.registerTestTool(new CTestTool);
|
||||
|
||||
m_frameworkManager.synchronizeSettings(ICore::settings());
|
||||
m_frameworkManager.synchronizeSettings();
|
||||
m_resultsPane = TestResultsPane::instance();
|
||||
|
||||
auto panelFactory = new ProjectExplorer::ProjectPanelFactory();
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QSettings>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
namespace Autotest {
|
||||
@@ -95,16 +93,16 @@ ITestTool *TestFrameworkManager::testToolForBuildSystemId(Id buildSystemId)
|
||||
});
|
||||
}
|
||||
|
||||
void TestFrameworkManager::synchronizeSettings(QSettings *s)
|
||||
void TestFrameworkManager::synchronizeSettings()
|
||||
{
|
||||
Internal::TestSettings::instance()->fromSettings(s);
|
||||
Internal::TestSettings::instance()->fromSettings();
|
||||
for (ITestFramework *framework : std::as_const(m_registeredFrameworks)) {
|
||||
if (ITestSettings *fSettings = framework->testSettings())
|
||||
fSettings->readSettings(s);
|
||||
fSettings->readSettings();
|
||||
}
|
||||
for (ITestTool *testTool : std::as_const(m_registeredTestTools)) {
|
||||
if (ITestSettings *tSettings = testTool->testSettings())
|
||||
tSettings->readSettings(s);
|
||||
tSettings->readSettings();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,10 +5,6 @@
|
||||
|
||||
#include "itestframework.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QSettings;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Autotest {
|
||||
namespace Internal {
|
||||
class TestSettings;
|
||||
@@ -23,7 +19,7 @@ public:
|
||||
|
||||
bool registerTestFramework(ITestFramework *framework);
|
||||
bool registerTestTool(ITestTool *testTool);
|
||||
void synchronizeSettings(QSettings *s);
|
||||
void synchronizeSettings();
|
||||
|
||||
static ITestFramework *frameworkForId(Utils::Id frameworkId);
|
||||
static ITestTool *testToolForId(Utils::Id testToolId);
|
||||
|
||||
@@ -108,10 +108,11 @@ TestSettings::TestSettings()
|
||||
runAfterBuild.addOption(Tr::tr("Selected"));
|
||||
}
|
||||
|
||||
void TestSettings::toSettings(QSettings *s) const
|
||||
void TestSettings::toSettings() const
|
||||
{
|
||||
AspectContainer::writeSettings(s);
|
||||
AspectContainer::writeSettings();
|
||||
|
||||
QSettings *s = Utils::BaseAspect::settings();
|
||||
s->beginGroup(Constants::SETTINGSGROUP);
|
||||
|
||||
// store frameworks and their current active and grouping state
|
||||
@@ -126,10 +127,11 @@ void TestSettings::toSettings(QSettings *s) const
|
||||
s->endGroup();
|
||||
}
|
||||
|
||||
void TestSettings::fromSettings(QSettings *s)
|
||||
void TestSettings::fromSettings()
|
||||
{
|
||||
AspectContainer::readSettings(s);
|
||||
AspectContainer::readSettings();
|
||||
|
||||
QSettings *s = Utils::BaseAspect::settings();
|
||||
s->beginGroup(Constants::SETTINGSGROUP);
|
||||
|
||||
// try to get settings for registered frameworks
|
||||
|
||||
@@ -29,8 +29,8 @@ public:
|
||||
|
||||
static TestSettings *instance();
|
||||
|
||||
void toSettings(QSettings *s) const;
|
||||
void fromSettings(QSettings *s);
|
||||
void toSettings() const;
|
||||
void fromSettings();
|
||||
|
||||
Utils::IntegerAspect scanThreadLimit{this};
|
||||
Utils::IntegerAspect timeout{this};
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include "testsettings.h"
|
||||
#include "testtreemodel.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/id.h>
|
||||
#include <utils/infolabel.h>
|
||||
@@ -137,7 +136,7 @@ TestSettingsWidget::TestSettingsWidget()
|
||||
|
||||
testSettings(s);
|
||||
testToolsSettings(s);
|
||||
s.toSettings(Core::ICore::settings());
|
||||
s.toSettings();
|
||||
|
||||
for (ITestFramework *framework : TestFrameworkManager::registeredFrameworks()) {
|
||||
framework->setActive(s.frameworks.value(framework->id(), false));
|
||||
|
||||
@@ -117,7 +117,7 @@ bool AxivionPlugin::initialize(const QStringList &arguments, QString *errorMessa
|
||||
Q_UNUSED(errorMessage)
|
||||
|
||||
dd = new AxivionPluginPrivate;
|
||||
dd->m_axivionSettings.fromSettings(Core::ICore::settings());
|
||||
dd->m_axivionSettings.fromSettings();
|
||||
|
||||
auto panelFactory = new ProjectExplorer::ProjectPanelFactory;
|
||||
panelFactory->setPriority(250);
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
|
||||
#include "axiviontr.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <utils/filepath.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
|
||||
@@ -81,9 +83,9 @@ AxivionSettings::AxivionSettings()
|
||||
curl.setExpectedKind(Utils::PathChooser::ExistingCommand);
|
||||
}
|
||||
|
||||
static Utils::FilePath tokensFilePath(const QSettings *s)
|
||||
static Utils::FilePath tokensFilePath()
|
||||
{
|
||||
return Utils::FilePath::fromString(s->fileName()).parentDir()
|
||||
return Utils::FilePath::fromString(Core::ICore::settings()->fileName()).parentDir()
|
||||
.pathAppended("qtcreator/axivion.json");
|
||||
}
|
||||
|
||||
@@ -109,16 +111,16 @@ static AxivionServer readTokenFile(const Utils::FilePath &filePath)
|
||||
return AxivionServer::fromJson(doc.object());
|
||||
}
|
||||
|
||||
void AxivionSettings::toSettings(QSettings *s) const
|
||||
void AxivionSettings::toSettings() const
|
||||
{
|
||||
writeTokenFile(tokensFilePath(s), server);
|
||||
Utils::AspectContainer::writeSettings(s);
|
||||
writeTokenFile(tokensFilePath(), server);
|
||||
Utils::AspectContainer::writeSettings();
|
||||
}
|
||||
|
||||
void AxivionSettings::fromSettings(QSettings *s)
|
||||
void AxivionSettings::fromSettings()
|
||||
{
|
||||
Utils::AspectContainer::readSettings(s);
|
||||
server = readTokenFile(tokensFilePath(s));
|
||||
Utils::AspectContainer::readSettings();
|
||||
server = readTokenFile(tokensFilePath());
|
||||
|
||||
if (curl().isEmpty() || !curl().exists()) {
|
||||
const QString curlPath = QStandardPaths::findExecutable(
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QJsonObject;
|
||||
class QSettings;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Axivion::Internal {
|
||||
@@ -41,8 +40,8 @@ class AxivionSettings : public Utils::AspectContainer
|
||||
{
|
||||
public:
|
||||
AxivionSettings();
|
||||
void toSettings(QSettings *s) const;
|
||||
void fromSettings(QSettings *s);
|
||||
void toSettings() const;
|
||||
void fromSettings();
|
||||
|
||||
AxivionServer server; // shall we have more than one?
|
||||
Utils::FilePathAspect curl{this};
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "axivionsettings.h"
|
||||
#include "axiviontr.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <utils/aspects.h>
|
||||
#include <utils/id.h>
|
||||
#include <utils/layoutbuilder.h>
|
||||
@@ -170,7 +169,7 @@ AxivionSettingsWidget::AxivionSettingsWidget(AxivionSettings *settings)
|
||||
void AxivionSettingsWidget::apply()
|
||||
{
|
||||
m_settings->server = m_dashboardDisplay->dashboardServer();
|
||||
m_settings->toSettings(Core::ICore::settings());
|
||||
m_settings->toSettings();
|
||||
emit AxivionPlugin::instance()->settingsChanged();
|
||||
}
|
||||
|
||||
|
||||
@@ -228,9 +228,7 @@ QString AbstractSettings::documentation(const QString &option) const
|
||||
void AbstractSettings::save()
|
||||
{
|
||||
// Save settings, except styles
|
||||
QSettings *s = Core::ICore::settings();
|
||||
|
||||
AspectContainer::writeSettings(s);
|
||||
AspectContainer::writeSettings();
|
||||
|
||||
// Save styles
|
||||
if (m_stylesToRemove.isEmpty() && m_styles.isEmpty())
|
||||
@@ -287,8 +285,7 @@ void AbstractSettings::createDocumentationFile() const
|
||||
void AbstractSettings::read()
|
||||
{
|
||||
// Read settings, except styles
|
||||
QSettings *s = Core::ICore::settings();
|
||||
AspectContainer::readSettings(s);
|
||||
AspectContainer::readSettings();
|
||||
|
||||
m_styles.clear();
|
||||
m_changedStyles.clear();
|
||||
|
||||
@@ -598,7 +598,7 @@ void CMakeBuildSettingsWidget::reconfigureWithInitialParameters()
|
||||
QMessageBox::Yes | QMessageBox::No,
|
||||
QMessageBox::Yes);
|
||||
|
||||
settings->writeSettings(Core::ICore::settings());
|
||||
settings->writeSettings();
|
||||
|
||||
if (reply != QMessageBox::Yes) {
|
||||
return;
|
||||
|
||||
@@ -146,7 +146,7 @@ void CMakeToolManager::restoreCMakeTools()
|
||||
if (settings->autorunCMake.value() == settings->autorunCMake.defaultValue()) {
|
||||
CMakeTool *cmake = defaultCMakeTool();
|
||||
settings->autorunCMake.setValue(cmake ? cmake->isAutoRun() : true);
|
||||
settings->writeSettings(Core::ICore::settings());
|
||||
settings->writeSettings();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
|
||||
#include "conansettings.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <utils/hostosinfo.h>
|
||||
|
||||
using namespace Utils;
|
||||
@@ -26,7 +24,7 @@ ConanSettings::ConanSettings()
|
||||
conanFilePath.setExpectedKind(PathChooser::ExistingCommand);
|
||||
conanFilePath.setDefaultValue(FilePath::fromString(HostOsInfo::withExecutableSuffix("conan")));
|
||||
|
||||
readSettings(Core::ICore::settings());
|
||||
readSettings();
|
||||
}
|
||||
|
||||
} // Conan::Internal
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
#include "copilotsettings.h"
|
||||
#include "copilottr.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <utils/layoutbuilder.h>
|
||||
#include <utils/pathchooser.h>
|
||||
|
||||
@@ -95,7 +93,7 @@ public:
|
||||
|
||||
setOnApply([] {
|
||||
CopilotSettings::instance().apply();
|
||||
CopilotSettings::instance().writeSettings(Core::ICore::settings());
|
||||
CopilotSettings::instance().writeSettings();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
#include <coreplugin/actionmanager/actionmanager.h>
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/statusbarmanager.h>
|
||||
|
||||
#include <languageclient/languageclientmanager.h>
|
||||
@@ -58,7 +57,7 @@ void cycleSuggestion(TextEditor::TextEditorWidget *editor, Direction direction)
|
||||
|
||||
void CopilotPlugin::initialize()
|
||||
{
|
||||
CopilotSettings::instance().readSettings(ICore::settings());
|
||||
CopilotSettings::instance().readSettings();
|
||||
|
||||
restartClient();
|
||||
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
|
||||
#include "ioptionspage.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/aspects.h>
|
||||
#include <utils/layoutbuilder.h>
|
||||
@@ -167,7 +165,7 @@ void IOptionsPage::apply()
|
||||
AspectContainer *container = m_settingsProvider();
|
||||
if (container->isDirty()) {
|
||||
container->apply();
|
||||
container->writeSettings(ICore::settings());
|
||||
container->writeSettings();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -323,9 +321,4 @@ PagedSettings::PagedSettings()
|
||||
setAutoApply(false);
|
||||
}
|
||||
|
||||
void PagedSettings::readSettings()
|
||||
{
|
||||
return AspectContainer::readSettings(Core::ICore::settings());
|
||||
}
|
||||
|
||||
} // Core
|
||||
|
||||
@@ -133,9 +133,6 @@ class CORE_EXPORT PagedSettings : public Utils::AspectContainer, public IOptions
|
||||
{
|
||||
public:
|
||||
PagedSettings();
|
||||
|
||||
using AspectContainer::readSettings; // FIXME: Remove.
|
||||
void readSettings(); // Intentionally hides AspectContainer::readSettings()
|
||||
};
|
||||
|
||||
} // namespace Core
|
||||
|
||||
@@ -132,7 +132,7 @@ CodePasterPluginPrivate::CodePasterPluginPrivate()
|
||||
}
|
||||
|
||||
// Create the settings Page
|
||||
m_settings.readSettings(ICore::settings());
|
||||
m_settings.readSettings();
|
||||
|
||||
connect(&m_urlOpen, &Protocol::fetchDone, this, &CodePasterPluginPrivate::finishFetch);
|
||||
|
||||
@@ -251,7 +251,7 @@ void CodePasterPluginPrivate::post(QString data, const QString &mimeType)
|
||||
// Save new protocol in case user changed it.
|
||||
if (dialogResult == QDialog::Accepted && m_settings.protocols.value() != view.protocol()) {
|
||||
m_settings.protocols.setValue(view.protocol());
|
||||
m_settings.writeSettings(ICore::settings());
|
||||
m_settings.writeSettings();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -282,7 +282,7 @@ void CodePasterPluginPrivate::fetch()
|
||||
// Save new protocol in case user changed it.
|
||||
if (m_settings.protocols.value() != dialog.protocol()) {
|
||||
m_settings.protocols.setValue(dialog.protocol());
|
||||
m_settings.writeSettings(ICore::settings());
|
||||
m_settings.writeSettings();
|
||||
}
|
||||
|
||||
const QString pasteID = dialog.pasteId();
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
#include <debugger/debuggertr.h>
|
||||
#include <debugger/shared/cdbsymbolpathlisteditor.h>
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <utils/aspects.h>
|
||||
#include <utils/layoutbuilder.h>
|
||||
|
||||
@@ -215,7 +213,8 @@ CdbOptionsPageWidget::CdbOptionsPageWidget()
|
||||
|
||||
void CdbOptionsPageWidget::apply()
|
||||
{
|
||||
m_group.apply(); m_group.writeSettings(Core::ICore::settings());
|
||||
m_group.apply();
|
||||
m_group.writeSettings();
|
||||
debuggerSettings()->cdbBreakEvents.setValue(m_breakEventWidget->breakEvents());
|
||||
}
|
||||
|
||||
@@ -269,7 +268,7 @@ void CdbPathsPageWidget::apply()
|
||||
{
|
||||
debuggerSettings()->cdbSymbolPaths.setValue(m_symbolPaths->pathList());
|
||||
debuggerSettings()->cdbSourcePaths.setValue(m_sourcePaths->pathList());
|
||||
m_group.writeSettings(Core::ICore::settings());
|
||||
m_group.writeSettings();
|
||||
}
|
||||
|
||||
void CdbPathsPageWidget::finish()
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
#include "debuggerinternalconstants.h"
|
||||
#include "debuggertr.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <utils/layoutbuilder.h>
|
||||
|
||||
using namespace Core;
|
||||
@@ -37,7 +35,7 @@ public:
|
||||
if (originalPostMortem != currentPostMortem)
|
||||
s.registerForPostMortem->setValue(currentPostMortem);
|
||||
s.page1.apply();
|
||||
s.page1.writeSettings(ICore::settings());
|
||||
s.page1.writeSettings();
|
||||
});
|
||||
|
||||
setOnFinish([&s] { s.page1.finish(); });
|
||||
@@ -116,7 +114,7 @@ public:
|
||||
LocalsAndExpressionsOptionsPageWidget()
|
||||
{
|
||||
DebuggerSettings &s = *debuggerSettings();
|
||||
setOnApply([&s] { s.page4.apply(); s.page4.writeSettings(ICore::settings()); });
|
||||
setOnApply([&s] { s.page4.apply(); s.page4.writeSettings(); });
|
||||
setOnFinish([&s] { s.page4.finish(); });
|
||||
|
||||
auto label = new QLabel; //(useHelperGroup);
|
||||
|
||||
@@ -202,10 +202,9 @@ bool Console::canNavigate() const
|
||||
|
||||
void Console::readSettings()
|
||||
{
|
||||
QSettings *settings = Core::ICore::settings();
|
||||
m_showDebug.readSettings(settings);
|
||||
m_showWarning.readSettings(settings);
|
||||
m_showError.readSettings(settings);
|
||||
m_showDebug.readSettings();
|
||||
m_showWarning.readSettings();
|
||||
m_showError.readSettings();
|
||||
}
|
||||
|
||||
void Console::setContext(const QString &context)
|
||||
@@ -215,10 +214,9 @@ void Console::setContext(const QString &context)
|
||||
|
||||
void Console::writeSettings() const
|
||||
{
|
||||
QSettings *settings = Core::ICore::settings();
|
||||
m_showDebug.writeSettings(settings);
|
||||
m_showWarning.writeSettings(settings);
|
||||
m_showError.writeSettings(settings);
|
||||
m_showDebug.writeSettings();
|
||||
m_showWarning.writeSettings();
|
||||
m_showError.writeSettings();
|
||||
}
|
||||
|
||||
void Console::setScriptEvaluator(const ScriptEvaluator &evaluator)
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#endif
|
||||
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/qtcassert.h>
|
||||
@@ -471,14 +470,14 @@ DebuggerSettings::~DebuggerSettings()
|
||||
|
||||
void DebuggerSettings::readSettings()
|
||||
{
|
||||
all.readSettings(Core::ICore::settings());
|
||||
GdbSettings::readSettings(Core::ICore::settings());
|
||||
all.readSettings();
|
||||
GdbSettings::readSettings();
|
||||
}
|
||||
|
||||
void DebuggerSettings::writeSettings() const
|
||||
{
|
||||
all.writeSettings(Core::ICore::settings());
|
||||
GdbSettings::writeSettings(Core::ICore::settings());
|
||||
all.writeSettings();
|
||||
GdbSettings::writeSettings();
|
||||
}
|
||||
|
||||
QString DebuggerSettings::dump()
|
||||
|
||||
@@ -32,8 +32,8 @@ public:
|
||||
|
||||
void addToLayout(Layouting::LayoutItem &parent) override;
|
||||
|
||||
void readSettings(const QSettings *settings) override;
|
||||
void writeSettings(QSettings *settings) const override;
|
||||
void readSettings() override;
|
||||
void writeSettings() const override;
|
||||
|
||||
private:
|
||||
void guiToInternal() override;
|
||||
|
||||
@@ -486,9 +486,10 @@ const char sourcePathMappingArrayNameC[] = "SourcePathMappings";
|
||||
const char sourcePathMappingSourceKeyC[] = "Source";
|
||||
const char sourcePathMappingTargetKeyC[] = "Target";
|
||||
|
||||
void SourcePathMapAspect::writeSettings(QSettings *s) const
|
||||
void SourcePathMapAspect::writeSettings() const
|
||||
{
|
||||
const SourcePathMap sourcePathMap = value();
|
||||
QSettings *s = settings();
|
||||
s->beginWriteArray(sourcePathMappingArrayNameC);
|
||||
if (!sourcePathMap.isEmpty()) {
|
||||
const QString sourcePathMappingSourceKey(sourcePathMappingSourceKeyC);
|
||||
@@ -505,10 +506,9 @@ void SourcePathMapAspect::writeSettings(QSettings *s) const
|
||||
s->endArray();
|
||||
}
|
||||
|
||||
void SourcePathMapAspect::readSettings(const QSettings *settings)
|
||||
void SourcePathMapAspect::readSettings()
|
||||
{
|
||||
// Eeks. But legitimate, this operates on ICore::settings();
|
||||
QSettings *s = const_cast<QSettings *>(settings);
|
||||
QSettings *s = settings();
|
||||
SourcePathMap sourcePathMap;
|
||||
if (const int count = s->beginReadArray(sourcePathMappingArrayNameC)) {
|
||||
const QString sourcePathMappingSourceKey(sourcePathMappingSourceKeyC);
|
||||
|
||||
@@ -49,7 +49,7 @@ RegisterPostMortemAction::RegisterPostMortemAction()
|
||||
connect(this, &BaseAspect::changed, this, [this] { registerNow(value()); });
|
||||
}
|
||||
|
||||
void RegisterPostMortemAction::readSettings(const QSettings *)
|
||||
void RegisterPostMortemAction::readSettings()
|
||||
{
|
||||
Q_UNUSED(debuggerRegistryValueNameC) // avoid warning from MinGW
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ class RegisterPostMortemAction : public Utils::BoolAspect
|
||||
{
|
||||
public:
|
||||
RegisterPostMortemAction();
|
||||
void readSettings(const QSettings *settings = nullptr) override;
|
||||
void writeSettings(QSettings *) const override {}
|
||||
void readSettings() override;
|
||||
void writeSettings() const override {}
|
||||
|
||||
private:
|
||||
void registerNow(bool value);
|
||||
|
||||
@@ -379,7 +379,7 @@ PerforcePluginPrivate::PerforcePluginPrivate()
|
||||
|
||||
dd = this;
|
||||
|
||||
m_settings.readSettings(ICore::settings());
|
||||
m_settings.readSettings();
|
||||
|
||||
const QString prefix = QLatin1String("p4");
|
||||
m_commandLocator = new CommandLocator("Perforce", prefix, prefix, this);
|
||||
@@ -1678,7 +1678,7 @@ void PerforcePluginPrivate::setTopLevel(const FilePath &topLevel)
|
||||
|
||||
void PerforcePluginPrivate::applySettings()
|
||||
{
|
||||
m_settings.writeSettings(ICore::settings());
|
||||
m_settings.writeSettings();
|
||||
m_managedDirectoryCache.clear();
|
||||
getTopLevel();
|
||||
emit configurationChanged();
|
||||
|
||||
@@ -1681,7 +1681,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
||||
= s->value(Constants::LOW_BUILD_PRIORITY_SETTINGS_KEY, defaultSettings.lowBuildPriority)
|
||||
.toBool();
|
||||
|
||||
dd->m_buildPropertiesSettings.readSettings(s);
|
||||
dd->m_buildPropertiesSettings.readSettings();
|
||||
|
||||
const int customParserCount = s->value(Constants::CUSTOM_PARSER_COUNT_KEY).toInt();
|
||||
for (int i = 0; i < customParserCount; ++i) {
|
||||
@@ -2255,7 +2255,7 @@ void ProjectExplorerPluginPrivate::savePersistentSettings()
|
||||
int(dd->m_projectExplorerSettings.stopBeforeBuild),
|
||||
int(defaultSettings.stopBeforeBuild));
|
||||
|
||||
dd->m_buildPropertiesSettings.writeSettings(s);
|
||||
dd->m_buildPropertiesSettings.writeSettings();
|
||||
|
||||
s->setValueWithDefault(Constants::CUSTOM_PARSER_COUNT_KEY, int(dd->m_customParsers.count()), 0);
|
||||
for (int i = 0; i < dd->m_customParsers.count(); ++i) {
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "qmakeprojectmanagertr.h"
|
||||
|
||||
#include <coreplugin/dialogs/ioptionspage.h>
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
|
||||
@@ -59,7 +58,7 @@ QmakeSettings::QmakeSettings()
|
||||
};
|
||||
});
|
||||
|
||||
readSettings(Core::ICore::settings());
|
||||
readSettings();
|
||||
}
|
||||
|
||||
class QmakeSettingsPage : public Core::IOptionsPage
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
#include "qmlprofilersettings.h"
|
||||
#include "qmlprofilertr.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <debugger/analyzer/analyzericons.h>
|
||||
#include <debugger/debuggertr.h>
|
||||
|
||||
@@ -76,12 +74,12 @@ QmlProfilerSettings::QmlProfilerSettings()
|
||||
"the program."));
|
||||
|
||||
// Read stored values
|
||||
readSettings(Core::ICore::settings());
|
||||
readSettings();
|
||||
}
|
||||
|
||||
void QmlProfilerSettings::writeGlobalSettings() const
|
||||
{
|
||||
writeSettings(Core::ICore::settings());
|
||||
writeSettings();
|
||||
}
|
||||
|
||||
// QmlProfilerOptionsPage
|
||||
|
||||
@@ -94,7 +94,7 @@ TerminalPane::TerminalPane(QObject *parent)
|
||||
|
||||
connect(m_escSettingButton, &QToolButton::toggled, this, [this, updateEscButton] {
|
||||
TerminalSettings::instance().sendEscapeToTerminal.setValue(m_escSettingButton->isChecked());
|
||||
TerminalSettings::instance().writeSettings(ICore::settings());
|
||||
TerminalSettings::instance().writeSettings();
|
||||
updateEscButton();
|
||||
});
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ VcpkgSettings::VcpkgSettings()
|
||||
// clang-format on
|
||||
});
|
||||
|
||||
readSettings(Core::ICore::settings());
|
||||
readSettings();
|
||||
}
|
||||
|
||||
class VcpkgSettingsPage : public Core::IOptionsPage
|
||||
|
||||
@@ -246,7 +246,7 @@ VcsBaseEditorWidget *VcsBaseClientImpl::createVcsEditor(Id kind, QString title,
|
||||
|
||||
void VcsBaseClientImpl::saveSettings()
|
||||
{
|
||||
m_baseSettings->writeSettings(ICore::settings());
|
||||
m_baseSettings->writeSettings();
|
||||
}
|
||||
|
||||
VcsBaseClient::VcsBaseClient(VcsBaseSettings *baseSettings)
|
||||
|
||||
Reference in New Issue
Block a user