QmlProject: Always use qmlobserver for debugging projects

Also only warn about missing qmlobserver when actually trying to
debug a .qmlproject.

Reviewed-by: Christiaan Janssen
This commit is contained in:
Kai Koehne
2010-10-04 15:13:31 +02:00
parent 0c054bed77
commit 325af72012
9 changed files with 48 additions and 79 deletions

View File

@@ -306,14 +306,6 @@ DebuggerSettings *DebuggerSettings::instance()
item->setValue(false); item->setValue(false);
instance->insertItem(DebugDebuggingHelpers, item); 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 = new SavedAction(instance);
item->setSettingsKey(debugModeGroup, QLatin1String("UseCodeModel")); item->setSettingsKey(debugModeGroup, QLatin1String("UseCodeModel"));
item->setText(tr("Use Code Model")); item->setText(tr("Use Code Model"));

View File

@@ -99,8 +99,6 @@ enum DebuggerActionCode
CustomDebuggingHelperLocation, CustomDebuggingHelperLocation,
DebugDebuggingHelpers, DebugDebuggingHelpers,
UseQmlObserver,
UseCodeModel, UseCodeModel,
UseToolTipsInMainEditor, UseToolTipsInMainEditor,

View File

@@ -1053,35 +1053,6 @@ void DebuggerEngine::showQtDumperLibraryWarning(const QString &details)
} }
} }
void DebuggerEngine::showQmlObserverToolWarning()
{
QMessageBox dialog(plugin()->mainWindow());
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 QString DebuggerEngine::qtDumperLibraryName() const
{ {
if (theDebuggerAction(UseCustomDebuggingHelperLocation)->value().toBool()) if (theDebuggerAction(UseCustomDebuggingHelperLocation)->value().toBool())

View File

@@ -84,7 +84,6 @@ public:
quint16 qmlServerPort; quint16 qmlServerPort;
QString projectBuildDir; QString projectBuildDir;
QString projectDir; QString projectDir;
bool qmlObserverAvailable;
// for cpp+qml debugging // for cpp+qml debugging
DebuggerEngineType cppEngineType; DebuggerEngineType cppEngineType;
@@ -265,7 +264,6 @@ public:
QString qtDumperLibraryName() const; QString qtDumperLibraryName() const;
QStringList qtDumperLibraryLocations() const; QStringList qtDumperLibraryLocations() const;
void showQtDumperLibraryWarning(const QString &details); void showQtDumperLibraryWarning(const QString &details);
void showQmlObserverToolWarning();
static const char *stateName(int s); static const char *stateName(int s);

View File

@@ -668,9 +668,6 @@ QWidget *DebuggingHelperOptionPage::createPage(QWidget *parent)
m_group.insert(theDebuggerAction(UseCodeModel), m_group.insert(theDebuggerAction(UseCodeModel),
m_ui.checkBoxUseCodeModel); m_ui.checkBoxUseCodeModel);
m_group.insert(theDebuggerAction(UseQmlObserver),
m_ui.checkBoxUseQmlObserver);
#ifdef QT_DEBUG #ifdef QT_DEBUG
m_group.insert(theDebuggerAction(DebugDebuggingHelpers), m_group.insert(theDebuggerAction(DebugDebuggingHelpers),
m_ui.checkBoxDebugDebuggingHelpers); m_ui.checkBoxDebugDebuggingHelpers);
@@ -694,8 +691,7 @@ QWidget *DebuggingHelperOptionPage::createPage(QWidget *parent)
<< ' ' << m_ui.customLocationGroupBox->title() << ' ' << m_ui.customLocationGroupBox->title()
<< ' ' << m_ui.dumperLocationLabel->text() << ' ' << m_ui.dumperLocationLabel->text()
<< ' ' << m_ui.checkBoxUseCodeModel->text() << ' ' << m_ui.checkBoxUseCodeModel->text()
<< ' ' << m_ui.checkBoxDebugDebuggingHelpers->text() << ' ' << m_ui.checkBoxDebugDebuggingHelpers->text();
<< ' ' << m_ui.checkBoxUseQmlObserver->text();
m_searchKeywords.remove(QLatin1Char('&')); m_searchKeywords.remove(QLatin1Char('&'));
} }
return w; return w;

View File

@@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>529</width> <width>529</width>
<height>411</height> <height>303</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_3"> <layout class="QVBoxLayout" name="verticalLayout_3">
@@ -83,25 +83,6 @@
</layout> </layout>
</widget> </widget>
</item> </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> <item>
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">
@@ -123,6 +104,10 @@ It is not strictly necessary for debugging with Qt Creator.</string>
<extends>QWidget</extends> <extends>QWidget</extends>
<header location="global">utils/pathchooser.h</header> <header location="global">utils/pathchooser.h</header>
<container>1</container> <container>1</container>
<slots>
<signal>editingFinished()</signal>
<signal>browsingFinished()</signal>
</slots>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<resources/> <resources/>

View File

@@ -322,13 +322,6 @@ void QmlEngine::shutdownEngine()
void QmlEngine::setupEngine() void QmlEngine::setupEngine()
{ {
if (!d->m_attachToRunningExternalApp
&& !startParameters().qmlObserverAvailable
&& Internal::theDebuggerBoolSetting(Internal::UseQmlObserver))
{
showQmlObserverToolWarning();
}
d->m_adapter->setMaxConnectionAttempts(MaxConnectionAttempts); d->m_adapter->setMaxConnectionAttempts(MaxConnectionAttempts);
d->m_adapter->setConnectionAttemptInterval(ConnectionAttemptDefaultInterval); d->m_adapter->setConnectionAttemptInterval(ConnectionAttemptDefaultInterval);
connect(d->m_adapter, SIGNAL(connectionError(QAbstractSocket::SocketError)), connect(d->m_adapter, SIGNAL(connectionError(QAbstractSocket::SocketError)),

View File

@@ -43,10 +43,13 @@
#include <debugger/debuggeruiswitcher.h> #include <debugger/debuggeruiswitcher.h>
#include <debugger/debuggerengine.h> #include <debugger/debuggerengine.h>
#include <qmljsinspector/qmljsinspectorconstants.h> #include <qmljsinspector/qmljsinspectorconstants.h>
#include <qt4projectmanager/qt4projectmanagerconstants.h>
#include <QApplication>
#include <QDir> #include <QDir>
#include <QLabel> #include <QLabel>
#include <QMessageBox> #include <QMessageBox>
#include <QPushButton>
using ProjectExplorer::RunConfiguration; using ProjectExplorer::RunConfiguration;
using ProjectExplorer::RunControl; using ProjectExplorer::RunControl;
@@ -62,7 +65,11 @@ QmlRunControl::QmlRunControl(QmlProjectRunConfiguration *runConfiguration, QStri
m_applicationLauncher.setEnvironment(environment.toStringList()); m_applicationLauncher.setEnvironment(environment.toStringList());
m_applicationLauncher.setWorkingDirectory(runConfiguration->workingDirectory()); m_applicationLauncher.setWorkingDirectory(runConfiguration->workingDirectory());
if (mode == ProjectExplorer::Constants::RUNMODE) {
m_executable = runConfiguration->viewerPath(); m_executable = runConfiguration->viewerPath();
} else {
m_executable = runConfiguration->observerPath();
}
m_commandLineArguments = runConfiguration->viewerArguments(); m_commandLineArguments = runConfiguration->viewerArguments();
connect(&m_applicationLauncher, SIGNAL(appendMessage(QString,bool)), connect(&m_applicationLauncher, SIGNAL(appendMessage(QString,bool)),
@@ -137,10 +144,12 @@ bool QmlRunControlFactory::canRun(RunConfiguration *runConfiguration,
{ {
QmlProjectRunConfiguration *config = qobject_cast<QmlProjectRunConfiguration*>(runConfiguration); QmlProjectRunConfiguration *config = qobject_cast<QmlProjectRunConfiguration*>(runConfiguration);
if (mode == ProjectExplorer::Constants::RUNMODE) { if (mode == ProjectExplorer::Constants::RUNMODE) {
return config != 0; return config != 0 && !config->viewerPath().isEmpty();
} else if (mode == ProjectExplorer::Constants::DEBUGMODE) { } else {
bool qmlDebugSupportInstalled = Debugger::DebuggerUISwitcher::instance()->supportedLanguages() bool qmlDebugSupportInstalled = Debugger::DebuggerUISwitcher::instance()->supportedLanguages()
& Debugger::QmlLanguage; & Debugger::QmlLanguage;
// don't check for qmlobserver already here because we can't update the run buttons
// if it has been built in the meantime
return (config != 0) && qmlDebugSupportInstalled; return (config != 0) && qmlDebugSupportInstalled;
} }
@@ -156,7 +165,7 @@ RunControl *QmlRunControlFactory::create(RunConfiguration *runConfiguration,
RunControl *runControl = 0; RunControl *runControl = 0;
if (mode == ProjectExplorer::Constants::RUNMODE) { if (mode == ProjectExplorer::Constants::RUNMODE) {
runControl = new QmlRunControl(config, mode); runControl = new QmlRunControl(config, mode);
} else { } else if (mode == ProjectExplorer::Constants::DEBUGMODE) {
runControl = createDebugRunControl(config); runControl = createDebugRunControl(config);
} }
return runControl; return runControl;
@@ -178,20 +187,46 @@ ProjectExplorer::RunControl *QmlRunControlFactory::createDebugRunControl(QmlProj
Utils::Environment environment = Utils::Environment::systemEnvironment(); Utils::Environment environment = Utils::Environment::systemEnvironment();
Debugger::DebuggerStartParameters params; Debugger::DebuggerStartParameters params;
params.startMode = Debugger::StartInternal; params.startMode = Debugger::StartInternal;
params.executable = runConfig->viewerPath(); params.executable = runConfig->observerPath();
params.qmlServerAddress = "127.0.0.1"; params.qmlServerAddress = "127.0.0.1";
params.qmlServerPort = runConfig->qmlDebugServerPort(); params.qmlServerPort = runConfig->qmlDebugServerPort();
params.qmlObserverAvailable = runConfig->qmlObserverAvailable();
params.processArgs = runConfig->viewerArguments(); params.processArgs = runConfig->viewerArguments();
params.processArgs.append(QLatin1String("-qmljsdebugger=port:") + QString::number(runConfig->qmlDebugServerPort())); params.processArgs.append(QLatin1String("-qmljsdebugger=port:") + QString::number(runConfig->qmlDebugServerPort()));
params.workingDirectory = runConfig->workingDirectory(); params.workingDirectory = runConfig->workingDirectory();
params.environment = environment.toStringList(); params.environment = environment.toStringList();
params.displayName = runConfig->displayName(); params.displayName = runConfig->displayName();
if (params.executable.isEmpty()) {
showQmlObserverToolWarning();
return 0;
}
Debugger::DebuggerRunControl *debuggerRunControl = Debugger::DebuggerPlugin::createDebugger(params, runConfig); Debugger::DebuggerRunControl *debuggerRunControl = Debugger::DebuggerPlugin::createDebugger(params, runConfig);
return debuggerRunControl; return debuggerRunControl;
} }
void QmlRunControlFactory::showQmlObserverToolWarning() {
QMessageBox dialog(QApplication::activeWindow());
QPushButton *qtPref = dialog.addButton(tr("Open Qt4 Options"),
QMessageBox::ActionRole);
dialog.addButton(tr("Cancel"), QMessageBox::ActionRole);
dialog.setDefaultButton(qtPref);
dialog.setWindowTitle(tr("QML Observer Missing"));
dialog.setText(tr("QML Observer could not be found."));
dialog.setInformativeText(tr(
"QML Observer is used to offer 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 the current 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);
}
}
} // namespace Internal } // namespace Internal
} // namespace QmlProjectManager } // namespace QmlProjectManager

View File

@@ -78,6 +78,7 @@ public:
private: private:
ProjectExplorer::RunControl *createDebugRunControl(QmlProjectRunConfiguration *runConfig); ProjectExplorer::RunControl *createDebugRunControl(QmlProjectRunConfiguration *runConfig);
static void showQmlObserverToolWarning();
}; };
} // namespace Internal } // namespace Internal