forked from qt-creator/qt-creator
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:
@@ -306,14 +306,6 @@ 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,8 +99,6 @@ enum DebuggerActionCode
|
||||
CustomDebuggingHelperLocation,
|
||||
DebugDebuggingHelpers,
|
||||
|
||||
UseQmlObserver,
|
||||
|
||||
UseCodeModel,
|
||||
|
||||
UseToolTipsInMainEditor,
|
||||
|
||||
@@ -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
|
||||
{
|
||||
if (theDebuggerAction(UseCustomDebuggingHelperLocation)->value().toBool())
|
||||
|
||||
@@ -84,7 +84,6 @@ public:
|
||||
quint16 qmlServerPort;
|
||||
QString projectBuildDir;
|
||||
QString projectDir;
|
||||
bool qmlObserverAvailable;
|
||||
// for cpp+qml debugging
|
||||
DebuggerEngineType cppEngineType;
|
||||
|
||||
@@ -265,7 +264,6 @@ public:
|
||||
QString qtDumperLibraryName() const;
|
||||
QStringList qtDumperLibraryLocations() const;
|
||||
void showQtDumperLibraryWarning(const QString &details);
|
||||
void showQmlObserverToolWarning();
|
||||
|
||||
static const char *stateName(int s);
|
||||
|
||||
|
||||
@@ -668,9 +668,6 @@ 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);
|
||||
@@ -694,8 +691,7 @@ QWidget *DebuggingHelperOptionPage::createPage(QWidget *parent)
|
||||
<< ' ' << m_ui.customLocationGroupBox->title()
|
||||
<< ' ' << m_ui.dumperLocationLabel->text()
|
||||
<< ' ' << m_ui.checkBoxUseCodeModel->text()
|
||||
<< ' ' << m_ui.checkBoxDebugDebuggingHelpers->text()
|
||||
<< ' ' << m_ui.checkBoxUseQmlObserver->text();
|
||||
<< ' ' << m_ui.checkBoxDebugDebuggingHelpers->text();
|
||||
m_searchKeywords.remove(QLatin1Char('&'));
|
||||
}
|
||||
return w;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>529</width>
|
||||
<height>411</height>
|
||||
<height>303</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
@@ -83,25 +83,6 @@
|
||||
</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">
|
||||
@@ -123,6 +104,10 @@ It is not strictly necessary for debugging with Qt Creator.</string>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global">utils/pathchooser.h</header>
|
||||
<container>1</container>
|
||||
<slots>
|
||||
<signal>editingFinished()</signal>
|
||||
<signal>browsingFinished()</signal>
|
||||
</slots>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
|
||||
@@ -322,13 +322,6 @@ 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)),
|
||||
|
||||
@@ -43,10 +43,13 @@
|
||||
#include <debugger/debuggeruiswitcher.h>
|
||||
#include <debugger/debuggerengine.h>
|
||||
#include <qmljsinspector/qmljsinspectorconstants.h>
|
||||
#include <qt4projectmanager/qt4projectmanagerconstants.h>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDir>
|
||||
#include <QLabel>
|
||||
#include <QMessageBox>
|
||||
#include <QPushButton>
|
||||
|
||||
using ProjectExplorer::RunConfiguration;
|
||||
using ProjectExplorer::RunControl;
|
||||
@@ -62,7 +65,11 @@ QmlRunControl::QmlRunControl(QmlProjectRunConfiguration *runConfiguration, QStri
|
||||
m_applicationLauncher.setEnvironment(environment.toStringList());
|
||||
m_applicationLauncher.setWorkingDirectory(runConfiguration->workingDirectory());
|
||||
|
||||
if (mode == ProjectExplorer::Constants::RUNMODE) {
|
||||
m_executable = runConfiguration->viewerPath();
|
||||
} else {
|
||||
m_executable = runConfiguration->observerPath();
|
||||
}
|
||||
m_commandLineArguments = runConfiguration->viewerArguments();
|
||||
|
||||
connect(&m_applicationLauncher, SIGNAL(appendMessage(QString,bool)),
|
||||
@@ -137,10 +144,12 @@ bool QmlRunControlFactory::canRun(RunConfiguration *runConfiguration,
|
||||
{
|
||||
QmlProjectRunConfiguration *config = qobject_cast<QmlProjectRunConfiguration*>(runConfiguration);
|
||||
if (mode == ProjectExplorer::Constants::RUNMODE) {
|
||||
return config != 0;
|
||||
} else if (mode == ProjectExplorer::Constants::DEBUGMODE) {
|
||||
return config != 0 && !config->viewerPath().isEmpty();
|
||||
} else {
|
||||
bool qmlDebugSupportInstalled = Debugger::DebuggerUISwitcher::instance()->supportedLanguages()
|
||||
& 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;
|
||||
}
|
||||
|
||||
@@ -156,7 +165,7 @@ RunControl *QmlRunControlFactory::create(RunConfiguration *runConfiguration,
|
||||
RunControl *runControl = 0;
|
||||
if (mode == ProjectExplorer::Constants::RUNMODE) {
|
||||
runControl = new QmlRunControl(config, mode);
|
||||
} else {
|
||||
} else if (mode == ProjectExplorer::Constants::DEBUGMODE) {
|
||||
runControl = createDebugRunControl(config);
|
||||
}
|
||||
return runControl;
|
||||
@@ -178,20 +187,46 @@ ProjectExplorer::RunControl *QmlRunControlFactory::createDebugRunControl(QmlProj
|
||||
Utils::Environment environment = Utils::Environment::systemEnvironment();
|
||||
Debugger::DebuggerStartParameters params;
|
||||
params.startMode = Debugger::StartInternal;
|
||||
params.executable = runConfig->viewerPath();
|
||||
params.executable = runConfig->observerPath();
|
||||
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();
|
||||
params.environment = environment.toStringList();
|
||||
params.displayName = runConfig->displayName();
|
||||
|
||||
if (params.executable.isEmpty()) {
|
||||
showQmlObserverToolWarning();
|
||||
return 0;
|
||||
}
|
||||
|
||||
Debugger::DebuggerRunControl *debuggerRunControl = Debugger::DebuggerPlugin::createDebugger(params, runConfig);
|
||||
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 QmlProjectManager
|
||||
|
||||
|
||||
@@ -78,6 +78,7 @@ public:
|
||||
|
||||
private:
|
||||
ProjectExplorer::RunControl *createDebugRunControl(QmlProjectRunConfiguration *runConfig);
|
||||
static void showQmlObserverToolWarning();
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
Reference in New Issue
Block a user