QmlJsEditor: Avoid unneeded exports of constants

Change-Id: I332ff9a01963fe4d37dce9ecd0586d8f0fa6573c
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Eike Ziller
2019-07-18 14:17:25 +02:00
parent d20c738919
commit e9272d848b
6 changed files with 43 additions and 60 deletions

View File

@@ -33,6 +33,10 @@
#include <QTextStream>
#include <QCheckBox>
const char AUTO_FORMAT_ON_SAVE[] = "QmlJSEditor.AutoFormatOnSave";
const char AUTO_FORMAT_ONLY_CURRENT_PROJECT[] = "QmlJSEditor.AutoFormatOnlyCurrentProject";
const char QML_CONTEXTPANE_KEY[] = "QmlJSEditor.ContextPaneEnabled";
const char QML_CONTEXTPANEPIN_KEY[] = "QmlJSEditor.ContextPanePinned";
using namespace QmlJSEditor;
using namespace QmlJSEditor::Internal;
@@ -52,33 +56,22 @@ void QmlJsEditingSettings::set()
void QmlJsEditingSettings::fromSettings(QSettings *settings)
{
settings->beginGroup(QLatin1String(QmlJSEditor::Constants::SETTINGS_CATEGORY_QML));
m_enableContextPane = settings->value(
QLatin1String(QmlJSEditor::Constants::QML_CONTEXTPANE_KEY),
QVariant(false)).toBool();
m_pinContextPane = settings->value(
QLatin1String(QmlJSEditor::Constants::QML_CONTEXTPANEPIN_KEY),
QVariant(false)).toBool();
m_autoFormatOnSave = settings->value(
QLatin1String(QmlJSEditor::Constants::AUTO_FORMAT_ON_SAVE),
QVariant(false)).toBool();
m_autoFormatOnlyCurrentProject = settings->value(
QLatin1String(QmlJSEditor::Constants::AUTO_FORMAT_ONLY_CURRENT_PROJECT),
QVariant(false)).toBool();
settings->beginGroup(QmlJSEditor::Constants::SETTINGS_CATEGORY_QML);
m_enableContextPane = settings->value(QML_CONTEXTPANE_KEY, QVariant(false)).toBool();
m_pinContextPane = settings->value(QML_CONTEXTPANEPIN_KEY, QVariant(false)).toBool();
m_autoFormatOnSave = settings->value(AUTO_FORMAT_ON_SAVE, QVariant(false)).toBool();
m_autoFormatOnlyCurrentProject
= settings->value(AUTO_FORMAT_ONLY_CURRENT_PROJECT, QVariant(false)).toBool();
settings->endGroup();
}
void QmlJsEditingSettings::toSettings(QSettings *settings) const
{
settings->beginGroup(QLatin1String(QmlJSEditor::Constants::SETTINGS_CATEGORY_QML));
settings->setValue(QLatin1String(QmlJSEditor::Constants::QML_CONTEXTPANE_KEY),
m_enableContextPane);
settings->setValue(QLatin1String(QmlJSEditor::Constants::QML_CONTEXTPANEPIN_KEY),
m_pinContextPane);
settings->setValue(QLatin1String(QmlJSEditor::Constants::AUTO_FORMAT_ON_SAVE),
m_autoFormatOnSave);
settings->setValue(QLatin1String(QmlJSEditor::Constants::AUTO_FORMAT_ONLY_CURRENT_PROJECT),
m_autoFormatOnlyCurrentProject);
settings->beginGroup(QmlJSEditor::Constants::SETTINGS_CATEGORY_QML);
settings->setValue(QML_CONTEXTPANE_KEY, m_enableContextPane);
settings->setValue(QML_CONTEXTPANEPIN_KEY, m_pinContextPane);
settings->setValue(AUTO_FORMAT_ON_SAVE, m_autoFormatOnSave);
settings->setValue(AUTO_FORMAT_ONLY_CURRENT_PROJECT, m_autoFormatOnlyCurrentProject);
settings->endGroup();
}