QmlPuppet: enable reset the default puppet button

Also fix the logic that empty means that it should use the
default fallback puppet.

Task-number: QTCREATORBUG-19511
Change-Id: Ia36907523281386a1ed56362a76e37aaa9ee16b2
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Tim Jenssen
2018-03-14 14:45:13 +01:00
parent 1f3a106025
commit 710b459e35

View File

@@ -36,6 +36,8 @@
#include <qmljseditor/qmljseditorconstants.h>
#include <qmljstools/qmljstoolsconstants.h>
#include <utils/qtcassert.h>
#include <QLineEdit>
#include <QTextStream>
#include <QMessageBox>
@@ -62,12 +64,14 @@ SettingsPageWidget::SettingsPageWidget(QWidget *parent) :
m_ui.designerShowDebuggerCheckBox->setChecked(true);
}
);
m_ui.resetFallbackPuppetPathButton->hide();
connect(m_ui.resetFallbackPuppetPathButton, &QPushButton::clicked, [=]() {
m_ui.fallbackPuppetPathLineEdit->setPath(
PuppetCreator::defaultPuppetFallbackDirectory());
}
);
m_ui.fallbackPuppetPathLineEdit->setPath(PuppetCreator::defaultPuppetFallbackDirectory());
m_ui.fallbackPuppetPathLineEdit->lineEdit()->setPlaceholderText(PuppetCreator::defaultPuppetFallbackDirectory());
connect(m_ui.resetQmlPuppetBuildPathButton, &QPushButton::clicked, [=]() {
m_ui.puppetBuildPathLineEdit->setPath(
PuppetCreator::defaultPuppetToplevelBuildDirectory());
@@ -129,10 +133,16 @@ DesignerSettings SettingsPageWidget::settings() const
settings.insert(DesignerSettingsKey::DEBUG_PUPPET,
m_ui.debugPuppetComboBox->currentText());
if (!m_ui.fallbackPuppetPathLineEdit->path().isEmpty() &&
m_ui.fallbackPuppetPathLineEdit->path() != PuppetCreator::defaultPuppetFallbackDirectory()) {
QString newFallbackPuppetPath = m_ui.fallbackPuppetPathLineEdit->path();
QTC_CHECK(PuppetCreator::defaultPuppetFallbackDirectory() ==
m_ui.fallbackPuppetPathLineEdit->lineEdit()->placeholderText());
if (newFallbackPuppetPath.isEmpty())
newFallbackPuppetPath = m_ui.fallbackPuppetPathLineEdit->lineEdit()->placeholderText();
QString oldFallbackPuppetPath = settings.value(DesignerSettingsKey::PUPPET_FALLBACK_DIRECTORY,
PuppetCreator::defaultPuppetFallbackDirectory()).toString();
if (oldFallbackPuppetPath != newFallbackPuppetPath) {
settings.insert(DesignerSettingsKey::PUPPET_FALLBACK_DIRECTORY,
m_ui.fallbackPuppetPathLineEdit->path());
newFallbackPuppetPath);
}
if (!m_ui.puppetBuildPathLineEdit->path().isEmpty() &&