Commit 992d544e authored by Tim Jenssen's avatar Tim Jenssen Committed by Thomas Hartmann

QmlDesigner: add new debug settings

Change-Id: I737324016d3f2defc7e04f5e628e0f04cd34dd1a
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@theqtcompany.com>
parent bf22f230
......@@ -28,6 +28,7 @@
#include "propertyeditorvalue.h"
#include "propertyeditortransaction.h"
#include <qmldesignerconstants.h>
#include <qmldesignerplugin.h>
#include <qmlobjectnode.h>
#include <nodemetainfo.h>
......@@ -90,8 +91,8 @@ PropertyEditorQmlBackend::PropertyEditorQmlBackend(PropertyEditorView *propertyE
{
Q_ASSERT(QFileInfo(QLatin1String(":/images/button_normal.png")).exists());
m_view->engine()->setOutputWarningsToStandardError(
!qgetenv("QTCREATOR_QTQUICKDESIGNER_PROPERTYEDITOR_SHOW_WARNINGS").isEmpty());
m_view->engine()->setOutputWarningsToStandardError(QmlDesignerPlugin::instance()
->settings().value(DesignerSettingsKey::SHOW_PROPERTYEDITOR_WARNINGS).toBool());
m_view->engine()->addImportPath(propertyEditorResourcesPath());
m_dummyPropertyEditorValue->setValue("#000000");
......
......@@ -33,6 +33,7 @@
#include <QCoreApplication>
#include <coreplugin/messagebox.h>
#include <qmldesignerplugin.h>
/*!
\defgroup CoreExceptions
......@@ -85,7 +86,8 @@ bool Exception::shouldAssert()
bool Exception::warnAboutException()
{
static bool warnException = !qgetenv("QTCREATOR_QTQUICKDESIGNER_WARN_EXCEPTION").isEmpty();
static bool warnException = !QmlDesignerPlugin::instance()->settings().value(
DesignerSettingsKey::ENABLE_MODEL_EXCEPTION_OUTPUT).toBool();
return warnException;
}
......
......@@ -197,11 +197,14 @@ NodeInstanceServerProxy::NodeInstanceServerProxy(NodeInstanceView *nodeInstanceV
qDebug() << "file is open: " << isOpen;
}
m_firstTimer.setInterval(3000);
m_secondTimer.setInterval(3000);
m_thirdTimer.setInterval(3000);
if (qgetenv("DEBUG_QML_PUPPET").isEmpty()) {
DesignerSettings settings = QmlDesignerPlugin::instance()->settings();
int timeOutTime = settings.value(DesignerSettingsKey::PUPPET_KILL_TIMEOUT).toInt();
m_firstTimer.setInterval(timeOutTime);
m_secondTimer.setInterval(timeOutTime);
m_thirdTimer.setInterval(timeOutTime);
if (QmlDesignerPlugin::instance()->settings().value(DesignerSettingsKey::
DEBUG_PUPPET).toString().isEmpty()) {
connect(&m_firstTimer, SIGNAL(timeout()), this, SLOT(processFinished()));
connect(&m_secondTimer, SIGNAL(timeout()), this, SLOT(processFinished()));
connect(&m_thirdTimer, SIGNAL(timeout()), this, SLOT(processFinished()));
......
......@@ -148,22 +148,27 @@ QProcess *PuppetCreator::puppetProcess(const QString &puppetPath,
QProcess *puppetProcess = new QProcess;
puppetProcess->setObjectName(puppetMode);
puppetProcess->setProcessEnvironment(processEnvironment());
QObject::connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), puppetProcess, SLOT(kill()));
QObject::connect(puppetProcess, SIGNAL(finished(int,QProcess::ExitStatus)), handlerObject, finishSlot);
QString forwardOutputMode = QString::fromLatin1(qgetenv("FORWARD_QML_PUPPET_OUTPUT").toLower());
bool fowardQmlpuppetOutput = forwardOutputMode == puppetMode || forwardOutputMode == QLatin1String("true");
if (fowardQmlpuppetOutput) {
QString forwardOutput = m_designerSettings.value(DesignerSettingsKey::
FORWARD_PUPPET_OUTPUT).toString();
if (forwardOutput == puppetMode || forwardOutput == QLatin1String("all")) {
puppetProcess->setProcessChannelMode(QProcess::MergedChannels);
QObject::connect(puppetProcess, SIGNAL(readyRead()), handlerObject, outputSlot);
}
puppetProcess->setWorkingDirectory(workingDirectory);
puppetProcess->start(puppetPath, QStringList() << socketToken << puppetMode << QLatin1String("-graphicssystem raster"));
if (!qgetenv("DEBUG_QML_PUPPET").isEmpty())
QString debugPuppet = m_designerSettings.value(DesignerSettingsKey::
DEBUG_PUPPET).toString();
if (debugPuppet == puppetMode || debugPuppet == QLatin1String("all")) {
QMessageBox::information(Core::ICore::dialogParent(),
QStringLiteral("Puppet is starting ..."),
QStringLiteral("You can now attach your debugger to the %1 puppet with process id: %2.").arg(
puppetMode, QString::number(puppetProcess->processId())));
QStringLiteral("Puppet is starting ..."),
QStringLiteral("You can now attach your debugger to the %1 puppet with process id: %2."
).arg(puppetMode, QString::number(puppetProcess->processId())));
}
return puppetProcess;
}
......
......@@ -62,6 +62,11 @@ void DesignerSettings::fromSettings(QSettings *settings)
restoreValue(settings, DesignerSettingsKey::PUPPET_FALLBACK_DIRECTORY);
restoreValue(settings, DesignerSettingsKey::PUPPET_TOPLEVEL_BUILD_DIRECTORY);
restoreValue(settings, DesignerSettingsKey::CONTROLS_STYLE);
restoreValue(settings, DesignerSettingsKey::SHOW_PROPERTYEDITOR_WARNINGS, false);
restoreValue(settings, DesignerSettingsKey::ENABLE_MODEL_EXCEPTION_OUTPUT, false);
restoreValue(settings, DesignerSettingsKey::PUPPET_KILL_TIMEOUT, 3000); // this has no ui at the moment
restoreValue(settings, DesignerSettingsKey::DEBUG_PUPPET, QString());
restoreValue(settings, DesignerSettingsKey::FORWARD_PUPPET_OUTPUT, QString());
settings->endGroup();
settings->endGroup();
......
......@@ -52,6 +52,12 @@ const char PUPPET_TOPLEVEL_BUILD_DIRECTORY[] = "PuppetToplevelBuildDirectory";
const char PUPPET_FALLBACK_DIRECTORY[] = "PuppetFallbackDirectory";
const char CONTROLS_STYLE[] = "ControlsStyle";
const char USE_QSTR_FUNCTION[] = "UseQsTrFunction";
const char SHOW_PROPERTYEDITOR_WARNINGS[] = "ShowPropertyEditorWarnings";
const char ENABLE_MODEL_EXCEPTION_OUTPUT[] = "WarnException";
const char PUPPET_KILL_TIMEOUT[] = "PuppetKillTimeout";
const char DEBUG_PUPPET[] = "DebugPuppet";
const char FORWARD_PUPPET_OUTPUT[] = "ForwardPuppetOutput";
}
class DesignerSettings : public QHash<QByteArray, QVariant>
......
......@@ -41,6 +41,15 @@
using namespace QmlDesigner;
using namespace QmlDesigner::Internal;
namespace {
QStringList puppetModes()
{
static QStringList puppetModeList{QLatin1String(""), QLatin1String("all"),
QLatin1String("editormode"), QLatin1String("rendermode"), QLatin1String("previewmode")};
return puppetModeList;
}
}
SettingsPageWidget::SettingsPageWidget(QWidget *parent) :
QWidget(parent)
{
......@@ -67,6 +76,9 @@ SettingsPageWidget::SettingsPageWidget(QWidget *parent) :
m_ui.puppetBuildPathLineEdit, &QLineEdit::setEnabled);
connect(m_ui.resetStyle, &QPushButton::clicked,
m_ui.styleLineEdit, &QLineEdit::clear);
m_ui.forwardPuppetOutputComboBox->addItems(puppetModes());
m_ui.debugPuppetComboBox->addItems(puppetModes());
}
DesignerSettings SettingsPageWidget::settings() const
......@@ -89,6 +101,10 @@ DesignerSettings SettingsPageWidget::settings() const
settings.insert(DesignerSettingsKey::USE_QSTR_FUNCTION,
m_ui.useQsTrFunctionRadioButton->isChecked());
settings.insert(DesignerSettingsKey::CONTROLS_STYLE, m_ui.styleLineEdit->text());
settings.insert(DesignerSettingsKey::FORWARD_PUPPET_OUTPUT,
m_ui.forwardPuppetOutputComboBox->currentText());
settings.insert(DesignerSettingsKey::DEBUG_PUPPET,
m_ui.debugPuppetComboBox->currentText());
if (!m_ui.fallbackPuppetPathLineEdit->path().isEmpty() &&
m_ui.fallbackPuppetPathLineEdit->path() != PuppetCreator::defaultPuppetFallbackDirectory()) {
......@@ -103,6 +119,10 @@ DesignerSettings SettingsPageWidget::settings() const
}
settings.insert(DesignerSettingsKey::ALWAYS_SAFE_IN_CRUMBLEBAR,
m_ui.alwaysSaveSubcomponentsCheckBox->isChecked());
settings.insert(DesignerSettingsKey::SHOW_PROPERTYEDITOR_WARNINGS,
m_ui.showPropertyEditorWarningsCheckBox->isChecked());
settings.insert(DesignerSettingsKey::ENABLE_MODEL_EXCEPTION_OUTPUT,
m_ui.showWarnExceptionsCheckBox->isChecked());
return settings;
}
......@@ -145,8 +165,18 @@ void SettingsPageWidget::setSettings(const DesignerSettings &settings)
DesignerSettingsKey::PUPPET_TOPLEVEL_BUILD_DIRECTORY,
PuppetCreator::defaultPuppetToplevelBuildDirectory()).toString();
m_ui.puppetBuildPathLineEdit->setPath(puppetToplevelBuildDirectory);
m_ui.forwardPuppetOutputComboBox->setCurrentText(settings.value(
DesignerSettingsKey::FORWARD_PUPPET_OUTPUT).toString());
m_ui.debugPuppetComboBox->setCurrentText(settings.value(
DesignerSettingsKey::DEBUG_PUPPET).toString());
m_ui.alwaysSaveSubcomponentsCheckBox->setChecked(settings.value(
DesignerSettingsKey::ALWAYS_SAFE_IN_CRUMBLEBAR).toBool());
m_ui.showPropertyEditorWarningsCheckBox->setChecked(settings.value(
DesignerSettingsKey::SHOW_PROPERTYEDITOR_WARNINGS).toBool());
m_ui.showWarnExceptionsCheckBox->setChecked(settings.value(
DesignerSettingsKey::ENABLE_MODEL_EXCEPTION_OUTPUT).toBool());
}
SettingsPage::SettingsPage() :
......@@ -179,12 +209,17 @@ void SettingsPage::apply()
QList<QByteArray> restartNecessaryKeys;
restartNecessaryKeys << DesignerSettingsKey::PUPPET_FALLBACK_DIRECTORY
<< DesignerSettingsKey::PUPPET_TOPLEVEL_BUILD_DIRECTORY;
<< DesignerSettingsKey::PUPPET_TOPLEVEL_BUILD_DIRECTORY
<< DesignerSettingsKey::ENABLE_MODEL_EXCEPTION_OUTPUT
<< DesignerSettingsKey::PUPPET_KILL_TIMEOUT
<< DesignerSettingsKey::FORWARD_PUPPET_OUTPUT
<< DesignerSettingsKey::DEBUG_PUPPET
<< DesignerSettingsKey::ENABLE_MODEL_EXCEPTION_OUTPUT;
foreach (const QByteArray &key, restartNecessaryKeys) {
if (currentSettings.value(key) != newSettings.value(key)) {
QMessageBox::information(Core::ICore::mainWindow(), tr("Restart Required"),
tr("The QML emulation layer path changes will take effect after a "
tr("The made changes will take effect after a "
"restart of the QML Emulation layer or Qt Creator."));
break;
}
......
......@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>629</width>
<height>468</height>
<height>472</height>
</rect>
</property>
<property name="windowTitle">
......@@ -331,6 +331,40 @@
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="showPropertyEditorWarningsCheckBox">
<property name="text">
<string>Show property editor warnings</string>
</property>
</widget>
</item>
<item row="0" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>Forward puppet output:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="forwardPuppetOutputComboBox">
<property name="minimumSize">
<size>
<width>110</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>110</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="designerEnableDebuggerCheckBox">
<property name="text">
......@@ -338,6 +372,40 @@
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="showWarnExceptionsCheckBox">
<property name="text">
<string>Show warn exceptions</string>
</property>
</widget>
</item>
<item row="1" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>Debug puppet:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="debugPuppetComboBox">
<property name="minimumSize">
<size>
<width>110</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>110</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment