forked from qt-creator/qt-creator
QmlDesigner: use better settings names
The name is better and we avoid problems if the default was saved by wrong old code which is fixed in the current code. (The fix does not save the path if it is the default path) Change-Id: Ifd1d4fc7931fed976de12e3e256915458ffc762a Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -142,7 +142,7 @@ bool PuppetCreator::useOnlyFallbackPuppet() const
|
|||||||
#ifndef QMLDESIGNER_TEST
|
#ifndef QMLDESIGNER_TEST
|
||||||
if (!m_kit || !m_kit->isValid())
|
if (!m_kit || !m_kit->isValid())
|
||||||
qWarning() << "Invalid kit for QML puppet";
|
qWarning() << "Invalid kit for QML puppet";
|
||||||
return m_designerSettings.value(DesignerSettingsKey::USE_ONLY_FALLBACK_PUPPET
|
return m_designerSettings.value(DesignerSettingsKey::USE_DEFAULT_PUPPET
|
||||||
).toBool() || m_kit == nullptr || !m_kit->isValid();
|
).toBool() || m_kit == nullptr || !m_kit->isValid();
|
||||||
#else
|
#else
|
||||||
return true;
|
return true;
|
||||||
@@ -390,7 +390,7 @@ QString PuppetCreator::qmlPuppetFallbackDirectory(const DesignerSettings &settin
|
|||||||
{
|
{
|
||||||
#ifndef QMLDESIGNER_TEST
|
#ifndef QMLDESIGNER_TEST
|
||||||
QString puppetFallbackDirectory = settings.value(
|
QString puppetFallbackDirectory = settings.value(
|
||||||
DesignerSettingsKey::PUPPET_FALLBACK_DIRECTORY).toString();
|
DesignerSettingsKey::PUPPET_DEFAULT_DIRECTORY).toString();
|
||||||
if (puppetFallbackDirectory.isEmpty() || !QFileInfo::exists(puppetFallbackDirectory))
|
if (puppetFallbackDirectory.isEmpty() || !QFileInfo::exists(puppetFallbackDirectory))
|
||||||
return defaultPuppetFallbackDirectory();
|
return defaultPuppetFallbackDirectory();
|
||||||
return puppetFallbackDirectory;
|
return puppetFallbackDirectory;
|
||||||
|
@@ -60,9 +60,9 @@ void DesignerSettings::fromSettings(QSettings *settings)
|
|||||||
restoreValue(settings, DesignerSettingsKey::SHOW_DEBUGVIEW, false);
|
restoreValue(settings, DesignerSettingsKey::SHOW_DEBUGVIEW, false);
|
||||||
restoreValue(settings, DesignerSettingsKey::ENABLE_DEBUGVIEW, false);
|
restoreValue(settings, DesignerSettingsKey::ENABLE_DEBUGVIEW, false);
|
||||||
restoreValue(settings, DesignerSettingsKey::ALWAYS_SAFE_IN_CRUMBLEBAR, false);
|
restoreValue(settings, DesignerSettingsKey::ALWAYS_SAFE_IN_CRUMBLEBAR, false);
|
||||||
restoreValue(settings, DesignerSettingsKey::USE_ONLY_FALLBACK_PUPPET, true);
|
restoreValue(settings, DesignerSettingsKey::USE_DEFAULT_PUPPET, true);
|
||||||
restoreValue(settings, DesignerSettingsKey::TYPE_OF_QSTR_FUNCTION, 0);
|
restoreValue(settings, DesignerSettingsKey::TYPE_OF_QSTR_FUNCTION, 0);
|
||||||
restoreValue(settings, DesignerSettingsKey::PUPPET_FALLBACK_DIRECTORY);
|
restoreValue(settings, DesignerSettingsKey::PUPPET_DEFAULT_DIRECTORY);
|
||||||
restoreValue(settings, DesignerSettingsKey::PUPPET_TOPLEVEL_BUILD_DIRECTORY);
|
restoreValue(settings, DesignerSettingsKey::PUPPET_TOPLEVEL_BUILD_DIRECTORY);
|
||||||
restoreValue(settings, DesignerSettingsKey::CONTROLS_STYLE);
|
restoreValue(settings, DesignerSettingsKey::CONTROLS_STYLE);
|
||||||
restoreValue(settings, DesignerSettingsKey::SHOW_PROPERTYEDITOR_WARNINGS, false);
|
restoreValue(settings, DesignerSettingsKey::SHOW_PROPERTYEDITOR_WARNINGS, false);
|
||||||
|
@@ -49,9 +49,9 @@ const char WARNING_FOR_DESIGNER_FEATURES_IN_EDITOR[] = "WarnAboutQtQuickDesigner
|
|||||||
const char SHOW_DEBUGVIEW[] = "ShowQtQuickDesignerDebugView";
|
const char SHOW_DEBUGVIEW[] = "ShowQtQuickDesignerDebugView";
|
||||||
const char ENABLE_DEBUGVIEW[] = "EnableQtQuickDesignerDebugView";
|
const char ENABLE_DEBUGVIEW[] = "EnableQtQuickDesignerDebugView";
|
||||||
const char ALWAYS_SAFE_IN_CRUMBLEBAR[] = "AlwaysSafeInCrumbleBar";
|
const char ALWAYS_SAFE_IN_CRUMBLEBAR[] = "AlwaysSafeInCrumbleBar";
|
||||||
const char USE_ONLY_FALLBACK_PUPPET[] = "UseOnlyFallbackPuppet";
|
const char USE_DEFAULT_PUPPET[] = "UseDefaultPuppet";
|
||||||
const char PUPPET_TOPLEVEL_BUILD_DIRECTORY[] = "PuppetToplevelBuildDirectory";
|
const char PUPPET_TOPLEVEL_BUILD_DIRECTORY[] = "PuppetToplevelBuildDirectory";
|
||||||
const char PUPPET_FALLBACK_DIRECTORY[] = "PuppetFallbackDirectory";
|
const char PUPPET_DEFAULT_DIRECTORY[] = "PuppetDefaultDirectory";
|
||||||
const char CONTROLS_STYLE[] = "ControlsStyle";
|
const char CONTROLS_STYLE[] = "ControlsStyle";
|
||||||
const char TYPE_OF_QSTR_FUNCTION[] = "TypeOfQsTrFunction";
|
const char TYPE_OF_QSTR_FUNCTION[] = "TypeOfQsTrFunction";
|
||||||
const char SHOW_PROPERTYEDITOR_WARNINGS[] = "ShowPropertyEditorWarnings";
|
const char SHOW_PROPERTYEDITOR_WARNINGS[] = "ShowPropertyEditorWarnings";
|
||||||
|
@@ -111,7 +111,7 @@ DesignerSettings SettingsPageWidget::settings() const
|
|||||||
m_ui.designerShowDebuggerCheckBox->isChecked());
|
m_ui.designerShowDebuggerCheckBox->isChecked());
|
||||||
settings.insert(DesignerSettingsKey::ENABLE_DEBUGVIEW,
|
settings.insert(DesignerSettingsKey::ENABLE_DEBUGVIEW,
|
||||||
m_ui.designerEnableDebuggerCheckBox->isChecked());
|
m_ui.designerEnableDebuggerCheckBox->isChecked());
|
||||||
settings.insert(DesignerSettingsKey::USE_ONLY_FALLBACK_PUPPET,
|
settings.insert(DesignerSettingsKey::USE_DEFAULT_PUPPET,
|
||||||
m_ui.useDefaultPuppetRadioButton->isChecked());
|
m_ui.useDefaultPuppetRadioButton->isChecked());
|
||||||
|
|
||||||
int typeOfQsTrFunction;
|
int typeOfQsTrFunction;
|
||||||
@@ -141,11 +141,11 @@ DesignerSettings SettingsPageWidget::settings() const
|
|||||||
|
|
||||||
if (oldFallbackPuppetPath != newFallbackPuppetPath && QFileInfo::exists(newFallbackPuppetPath)) {
|
if (oldFallbackPuppetPath != newFallbackPuppetPath && QFileInfo::exists(newFallbackPuppetPath)) {
|
||||||
if (newFallbackPuppetPath == PuppetCreator::defaultPuppetFallbackDirectory())
|
if (newFallbackPuppetPath == PuppetCreator::defaultPuppetFallbackDirectory())
|
||||||
settings.insert(DesignerSettingsKey::PUPPET_FALLBACK_DIRECTORY, QString());
|
settings.insert(DesignerSettingsKey::PUPPET_DEFAULT_DIRECTORY, QString());
|
||||||
else
|
else
|
||||||
settings.insert(DesignerSettingsKey::PUPPET_FALLBACK_DIRECTORY, newFallbackPuppetPath);
|
settings.insert(DesignerSettingsKey::PUPPET_DEFAULT_DIRECTORY, newFallbackPuppetPath);
|
||||||
} else if (!QFileInfo::exists(oldFallbackPuppetPath) || !QFileInfo::exists(newFallbackPuppetPath)){
|
} else if (!QFileInfo::exists(oldFallbackPuppetPath) || !QFileInfo::exists(newFallbackPuppetPath)){
|
||||||
settings.insert(DesignerSettingsKey::PUPPET_FALLBACK_DIRECTORY, QString());
|
settings.insert(DesignerSettingsKey::PUPPET_DEFAULT_DIRECTORY, QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_ui.puppetBuildPathLineEdit->path().isEmpty() &&
|
if (!m_ui.puppetBuildPathLineEdit->path().isEmpty() &&
|
||||||
@@ -188,9 +188,9 @@ void SettingsPageWidget::setSettings(const DesignerSettings &settings)
|
|||||||
m_ui.designerEnableDebuggerCheckBox->setChecked(settings.value(
|
m_ui.designerEnableDebuggerCheckBox->setChecked(settings.value(
|
||||||
DesignerSettingsKey::ENABLE_DEBUGVIEW).toBool());
|
DesignerSettingsKey::ENABLE_DEBUGVIEW).toBool());
|
||||||
m_ui.useDefaultPuppetRadioButton->setChecked(settings.value(
|
m_ui.useDefaultPuppetRadioButton->setChecked(settings.value(
|
||||||
DesignerSettingsKey::USE_ONLY_FALLBACK_PUPPET).toBool());
|
DesignerSettingsKey::USE_DEFAULT_PUPPET).toBool());
|
||||||
m_ui.useQtRelatedPuppetRadioButton->setChecked(!settings.value(
|
m_ui.useQtRelatedPuppetRadioButton->setChecked(!settings.value(
|
||||||
DesignerSettingsKey::USE_ONLY_FALLBACK_PUPPET).toBool());
|
DesignerSettingsKey::USE_DEFAULT_PUPPET).toBool());
|
||||||
m_ui.useQsTrFunctionRadioButton->setChecked(settings.value(
|
m_ui.useQsTrFunctionRadioButton->setChecked(settings.value(
|
||||||
DesignerSettingsKey::TYPE_OF_QSTR_FUNCTION).toInt() == 0);
|
DesignerSettingsKey::TYPE_OF_QSTR_FUNCTION).toInt() == 0);
|
||||||
m_ui.useQsTrIdFunctionRadioButton->setChecked(settings.value(
|
m_ui.useQsTrIdFunctionRadioButton->setChecked(settings.value(
|
||||||
@@ -201,7 +201,7 @@ void SettingsPageWidget::setSettings(const DesignerSettings &settings)
|
|||||||
DesignerSettingsKey::CONTROLS_STYLE).toString());
|
DesignerSettingsKey::CONTROLS_STYLE).toString());
|
||||||
|
|
||||||
QString puppetFallbackDirectory = settings.value(
|
QString puppetFallbackDirectory = settings.value(
|
||||||
DesignerSettingsKey::PUPPET_FALLBACK_DIRECTORY,
|
DesignerSettingsKey::PUPPET_DEFAULT_DIRECTORY,
|
||||||
PuppetCreator::defaultPuppetFallbackDirectory()).toString();
|
PuppetCreator::defaultPuppetFallbackDirectory()).toString();
|
||||||
m_ui.fallbackPuppetPathLineEdit->setPath(puppetFallbackDirectory);
|
m_ui.fallbackPuppetPathLineEdit->setPath(puppetFallbackDirectory);
|
||||||
|
|
||||||
@@ -256,7 +256,7 @@ void SettingsPage::apply()
|
|||||||
DesignerSettings newSettings(m_widget->settings());
|
DesignerSettings newSettings(m_widget->settings());
|
||||||
|
|
||||||
QList<QByteArray> restartNecessaryKeys;
|
QList<QByteArray> restartNecessaryKeys;
|
||||||
restartNecessaryKeys << DesignerSettingsKey::PUPPET_FALLBACK_DIRECTORY
|
restartNecessaryKeys << DesignerSettingsKey::PUPPET_DEFAULT_DIRECTORY
|
||||||
<< DesignerSettingsKey::PUPPET_TOPLEVEL_BUILD_DIRECTORY
|
<< DesignerSettingsKey::PUPPET_TOPLEVEL_BUILD_DIRECTORY
|
||||||
<< DesignerSettingsKey::ENABLE_MODEL_EXCEPTION_OUTPUT
|
<< DesignerSettingsKey::ENABLE_MODEL_EXCEPTION_OUTPUT
|
||||||
<< DesignerSettingsKey::PUPPET_KILL_TIMEOUT
|
<< DesignerSettingsKey::PUPPET_KILL_TIMEOUT
|
||||||
|
Reference in New Issue
Block a user