Commit 89443cfb authored by Lasse Holmstedt's avatar Lasse Holmstedt

QML Observer: Complain about not having it if debugging .qmlprojects

Reviewed-by: hjk
parent 96d991bb
......@@ -306,6 +306,14 @@ DebuggerSettings *DebuggerSettings::instance()
item->setValue(false);
instance->insertItem(DebugDebuggingHelpers, item);
item = new SavedAction(instance);
item->setSettingsKey(debugModeGroup, QLatin1String("UseQmlObserver"));
item->setText(tr("Use QML Observer"));
item->setCheckable(true);
item->setDefaultValue(true);
item->setValue(true);
instance->insertItem(UseQmlObserver, item);
item = new SavedAction(instance);
item->setSettingsKey(debugModeGroup, QLatin1String("UseCodeModel"));
item->setText(tr("Use Code Model"));
......
......@@ -99,6 +99,8 @@ enum DebuggerActionCode
CustomDebuggingHelperLocation,
DebugDebuggingHelpers,
UseQmlObserver,
UseCodeModel,
UseToolTipsInMainEditor,
......
......@@ -1054,6 +1054,35 @@ void DebuggerEngine::showQtDumperLibraryWarning(const QString &details)
}
}
void DebuggerEngine::showQmlObserverToolWarning()
{
QMessageBox dialog;
QPushButton *qtPref = dialog.addButton(tr("Open Qt4 Options"),
QMessageBox::ActionRole);
QPushButton *helperOff = dialog.addButton(tr("Turn off QML Observer Usage"),
QMessageBox::ActionRole);
QPushButton *justContinue = dialog.addButton(tr("Continue Anyway"),
QMessageBox::AcceptRole);
dialog.setDefaultButton(justContinue);
dialog.setWindowTitle(tr("QML Observer Missing"));
dialog.setText(tr("QML Observer could not be found."));
dialog.setInformativeText(tr(
"QML Observer is used to offer additional debugging features for "
"QML applications, such as interactive debugging and inspection tools."
"It must be compiled for each used Qt version separately. "
"On the Qt4 options page, select a Qt installation "
"and click Rebuild."));
dialog.exec();
if (dialog.clickedButton() == qtPref) {
Core::ICore::instance()->showOptionsDialog(
_(Qt4ProjectManager::Constants::QT_SETTINGS_CATEGORY),
_(Qt4ProjectManager::Constants::QTVERSION_SETTINGS_PAGE_ID));
} else if (dialog.clickedButton() == helperOff) {
theDebuggerAction(UseQmlObserver)
->setValue(qVariantFromValue(false), false);
}
}
QString DebuggerEngine::qtDumperLibraryName() const
{
if (theDebuggerAction(UseCustomDebuggingHelperLocation)->value().toBool())
......
......@@ -84,6 +84,7 @@ public:
quint16 qmlServerPort;
QString projectBuildDir;
QString projectDir;
bool qmlObserverAvailable;
// for cpp+qml debugging
DebuggerEngineType cppEngineType;
......@@ -264,6 +265,7 @@ public:
QString qtDumperLibraryName() const;
QStringList qtDumperLibraryLocations() const;
void showQtDumperLibraryWarning(const QString &details);
void showQmlObserverToolWarning();
static const char *stateName(int s);
......
......@@ -669,6 +669,9 @@ QWidget *DebuggingHelperOptionPage::createPage(QWidget *parent)
m_group.insert(theDebuggerAction(UseCodeModel),
m_ui.checkBoxUseCodeModel);
m_group.insert(theDebuggerAction(UseQmlObserver),
m_ui.checkBoxUseQmlObserver);
#ifdef QT_DEBUG
m_group.insert(theDebuggerAction(DebugDebuggingHelpers),
m_ui.checkBoxDebugDebuggingHelpers);
......@@ -692,7 +695,8 @@ QWidget *DebuggingHelperOptionPage::createPage(QWidget *parent)
<< ' ' << m_ui.customLocationGroupBox->title()
<< ' ' << m_ui.dumperLocationLabel->text()
<< ' ' << m_ui.checkBoxUseCodeModel->text()
<< ' ' << m_ui.checkBoxDebugDebuggingHelpers->text();
<< ' ' << m_ui.checkBoxDebugDebuggingHelpers->text()
<< ' ' << m_ui.checkBoxUseQmlObserver->text();
m_searchKeywords.remove(QLatin1Char('&'));
}
return w;
......
......@@ -2,7 +2,15 @@
<ui version="4.0">
<class>DebuggingHelperOptionPage</class>
<widget class="QWidget" name="DebuggingHelperOptionPage">
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>529</width>
<height>411</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="label">
<property name="text">
......@@ -47,7 +55,7 @@
</widget>
</item>
<item row="0" column="1">
<widget class="Utils::PathChooser" name="dumperLocationChooser"/>
<widget class="Utils::PathChooser" name="dumperLocationChooser" native="true"/>
</item>
</layout>
</widget>
......@@ -75,6 +83,25 @@
</layout>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>QML Observer is used to offer additional debugging facilities to QML applications, such as interactive preview of code changes and inspection tools.
It is not strictly necessary for debugging with Qt Creator.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxUseQmlObserver">
<property name="text">
<string>Use QML Observer</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
......
......@@ -30,6 +30,7 @@
#include "qmlengine.h"
#include "qmladapter.h"
#include "debuggeractions.h"
#include "debuggertooltip.h"
#include "debuggerconstants.h"
#include "debuggerplugin.h"
......@@ -315,6 +316,13 @@ void QmlEngine::shutdownEngine()
void QmlEngine::setupEngine()
{
if (!d->m_attachToRunningExternalApp
&& !startParameters().qmlObserverAvailable
&& Internal::theDebuggerBoolSetting(Internal::UseQmlObserver))
{
showQmlObserverToolWarning();
}
d->m_adapter->setMaxConnectionAttempts(MaxConnectionAttempts);
d->m_adapter->setConnectionAttemptInterval(ConnectionAttemptDefaultInterval);
connect(d->m_adapter, SIGNAL(connectionError(QAbstractSocket::SocketError)),
......
......@@ -110,6 +110,11 @@ Internal::QmlProjectTarget *QmlProjectRunConfiguration::qmlTarget() const
return static_cast<Internal::QmlProjectTarget *>(target());
}
bool QmlProjectRunConfiguration::qmlObserverAvailable() const
{
return m_qmlObserverAvailable;
}
QString QmlProjectRunConfiguration::viewerPath() const
{
if (!m_qmlViewerCustomPath.isEmpty())
......@@ -376,9 +381,9 @@ QString QmlProjectRunConfiguration::viewerDefaultPath() const
foreach (Qt4ProjectManager::QtVersion *version, qtVersions->validVersions()) {
if (version->supportsTargetId(Qt4ProjectManager::Constants::DESKTOP_TARGET_ID)) {
// Search for QmlObserver
const QString qtInstallData = version->versionInfo().value("QT_INSTALL_DATA");
path = Qt4ProjectManager::QmlObserverTool::toolByInstallData(qtInstallData);
m_qmlObserverAvailable = !path.isEmpty();
if (path.isEmpty() && !version->qmlviewerCommand().isEmpty()) {
path = version->qmlviewerCommand();
......
......@@ -67,6 +67,7 @@ public:
bool isEnabled(ProjectExplorer::BuildConfiguration *bc) const;
bool qmlObserverAvailable() const;
QString viewerPath() const;
QStringList viewerArguments() const;
QString workingDirectory() const;
......@@ -120,6 +121,7 @@ private:
bool m_usingCurrentFile;
bool m_isEnabled;
mutable bool m_qmlObserverAvailable;
};
......
......@@ -46,6 +46,7 @@
#include <QDir>
#include <QLabel>
#include <QMessageBox>
using ProjectExplorer::RunConfiguration;
using ProjectExplorer::RunControl;
......@@ -179,6 +180,7 @@ ProjectExplorer::RunControl *QmlRunControlFactory::createDebugRunControl(QmlProj
params.executable = runConfig->viewerPath();
params.qmlServerAddress = "127.0.0.1";
params.qmlServerPort = runConfig->qmlDebugServerPort();
params.qmlObserverAvailable = runConfig->qmlObserverAvailable();
params.processArgs = runConfig->viewerArguments();
params.processArgs.append(QLatin1String("-qmljsdebugger=port:") + QString::number(runConfig->qmlDebugServerPort()));
params.workingDirectory = runConfig->workingDirectory();
......
......@@ -57,7 +57,7 @@ bool QmlDumpTool::canBuild(const QString &installHeadersDir)
QString QmlDumpTool::toolForProject(ProjectExplorer::Project *project)
{
if (project->id() == Qt4ProjectManager::Constants::QT4PROJECT_ID) {
if (project && project->id() == Qt4ProjectManager::Constants::QT4PROJECT_ID) {
Qt4Project *qt4Project = static_cast<Qt4Project*>(project);
if (qt4Project && qt4Project->activeTarget()
&& qt4Project->activeTarget()->activeBuildConfiguration()) {
......
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