1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (info@qt.nokia.com)
10 ** GNU Lesser General Public License Usage
12 ** This file may be used under the terms of the GNU Lesser General Public
13 ** License version 2.1 as published by the Free Software Foundation and
14 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
15 ** Please review the following information to ensure the GNU Lesser General
16 ** Public License version 2.1 requirements will be met:
17 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
19 ** In addition, as a special exception, Nokia gives you certain additional
20 ** rights. These rights are described in the Nokia Qt LGPL Exception
21 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
25 ** Alternatively, this file may be used in accordance with the terms and
26 ** conditions contained in a signed written agreement between you and Nokia.
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at info@qt.nokia.com.
31 **************************************************************************/
33 #include "qmlengine.h"
34 #include "qmladapter.h"
36 #include "debuggerstartparameters.h"
37 #include "debuggeractions.h"
38 #include "debuggerconstants.h"
39 #include "debuggercore.h"
40 #include "debuggerdialogs.h"
41 #include "debuggermainwindow.h"
42 #include "debuggerrunner.h"
43 #include "debuggerstringutils.h"
44 #include "debuggertooltipmanager.h"
46 #include "breakhandler.h"
47 #include "moduleshandler.h"
48 #include "registerhandler.h"
49 #include "stackhandler.h"
50 #include "watchhandler.h"
51 #include "watchutils.h"
53 #include <extensionsystem/pluginmanager.h>
54 #include <projectexplorer/applicationlauncher.h>
56 #include <utils/environment.h>
57 #include <utils/qtcassert.h>
58 #include <utils/fileinprojectfinder.h>
60 #include <coreplugin/icore.h>
61 #include <coreplugin/helpmanager.h>
63 #include <QtCore/QDateTime>
64 #include <QtCore/QDebug>
65 #include <QtCore/QDir>
66 #include <QtCore/QFileInfo>
67 #include <QtCore/QTimer>
69 #include <QtGui/QAction>
70 #include <QtGui/QApplication>
71 #include <QtGui/QMainWindow>
72 #include <QtGui/QMessageBox>
73 #include <QtGui/QToolTip>
74 #include <QtGui/QTextDocument>
76 #include <QtNetwork/QTcpSocket>
77 #include <QtNetwork/QHostAddress>
81 # define SDEBUG(s) qDebug() << s
85 # define XSDEBUG(s) qDebug() << s
87 using namespace ProjectExplorer;
92 class QmlEnginePrivate
95 explicit QmlEnginePrivate(QmlEngine *q);
98 friend class QmlEngine;
100 ApplicationLauncher m_applicationLauncher;
101 Utils::FileInProjectFinder fileFinder;
102 QTimer m_noDebugOutputTimer;
105 QmlEnginePrivate::QmlEnginePrivate(QmlEngine *q)
110 ///////////////////////////////////////////////////////////////////////
114 ///////////////////////////////////////////////////////////////////////
116 QmlEngine::QmlEngine(const DebuggerStartParameters &startParameters,
117 DebuggerEngine *masterEngine)
118 : DebuggerEngine(startParameters, masterEngine),
119 d(new QmlEnginePrivate(this))
121 setObjectName(QLatin1String("QmlEngine"));
123 ExtensionSystem::PluginManager *pluginManager =
124 ExtensionSystem::PluginManager::instance();
125 pluginManager->addObject(this);
127 connect(&d->m_adapter, SIGNAL(connectionError(QAbstractSocket::SocketError)),
128 SLOT(connectionError(QAbstractSocket::SocketError)));
129 connect(&d->m_adapter, SIGNAL(serviceConnectionError(QString)),
130 SLOT(serviceConnectionError(QString)));
131 connect(&d->m_adapter, SIGNAL(connected()),
132 SLOT(connectionEstablished()));
133 connect(&d->m_adapter, SIGNAL(connectionStartupFailed()),
134 SLOT(connectionStartupFailed()));
136 connect(&d->m_applicationLauncher,
137 SIGNAL(processExited(int)),
138 SLOT(disconnected()));
139 connect(&d->m_applicationLauncher,
140 SIGNAL(appendMessage(QString, Utils::OutputFormat)),
141 SLOT(appendMessage(QString, Utils::OutputFormat)));
142 connect(&d->m_applicationLauncher,
143 SIGNAL(processStarted()),
144 &d->m_noDebugOutputTimer,
147 // Only wait 8 seconds for the 'Waiting for connection' on application ouput, then just try to connect
148 // (application output might be redirected / blocked)
149 d->m_noDebugOutputTimer.setSingleShot(true);
150 d->m_noDebugOutputTimer.setInterval(8000);
151 connect(&d->m_noDebugOutputTimer, SIGNAL(timeout()), this, SLOT(beginConnection()));
154 QmlEngine::~QmlEngine()
156 ExtensionSystem::PluginManager *pluginManager =
157 ExtensionSystem::PluginManager::instance();
159 if (pluginManager->allObjects().contains(this)) {
160 pluginManager->removeObject(this);
166 void QmlEngine::setupInferior()
168 QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
170 if (startParameters().startMode == AttachToRemoteServer) {
171 emit requestRemoteSetup();
172 if (startParameters().qmlServerPort != quint16(-1))
173 notifyInferiorSetupOk();
174 } if (startParameters().startMode == AttachToQmlPort) {
175 notifyInferiorSetupOk();
178 d->m_applicationLauncher.setEnvironment(startParameters().environment);
179 d->m_applicationLauncher.setWorkingDirectory(startParameters().workingDirectory);
181 notifyInferiorSetupOk();
185 void QmlEngine::appendMessage(const QString &msg, Utils::OutputFormat /* format */)
187 showMessage(msg, AppOutput); // FIXME: Redirect to RunControl
190 void QmlEngine::connectionEstablished()
192 attemptBreakpointSynchronization();
194 showMessage(tr("QML Debugger connected."), StatusBar);
196 if (!watchHandler()->watcherNames().isEmpty()) {
197 synchronizeWatchers();
199 connect(watchersModel(),SIGNAL(layoutChanged()),this,SLOT(synchronizeWatchers()));
201 notifyEngineRunAndInferiorRunOk();
204 void QmlEngine::beginConnection()
206 d->m_noDebugOutputTimer.stop();
207 showMessage(tr("QML Debugger connecting..."), StatusBar);
208 d->m_adapter.beginConnection();
211 void QmlEngine::connectionStartupFailed()
213 Core::ICore * const core = Core::ICore::instance();
214 QMessageBox *infoBox = new QMessageBox(core->mainWindow());
215 infoBox->setIcon(QMessageBox::Critical);
216 infoBox->setWindowTitle(tr("Qt Creator"));
217 infoBox->setText(tr("Could not connect to the in-process QML debugger.\n"
218 "Do you want to retry?"));
219 infoBox->setStandardButtons(QMessageBox::Retry | QMessageBox::Cancel | QMessageBox::Help);
220 infoBox->setDefaultButton(QMessageBox::Retry);
221 infoBox->setModal(true);
223 connect(infoBox, SIGNAL(finished(int)),
224 this, SLOT(retryMessageBoxFinished(int)));
229 void QmlEngine::retryMessageBoxFinished(int result)
232 case QMessageBox::Retry: {
236 case QMessageBox::Help: {
237 Core::HelpManager *helpManager = Core::HelpManager::instance();
238 helpManager->handleHelpRequest("qthelp://com.nokia.qtcreator/doc/creator-debugging-qml.html");
242 notifyEngineRunFailed();
247 void QmlEngine::connectionError(QAbstractSocket::SocketError socketError)
249 if (socketError == QAbstractSocket::RemoteHostClosedError)
250 showMessage(tr("QML Debugger: Remote host closed connection."), StatusBar);
252 if (!isSlaveEngine()) { // normal flow for slave engine when gdb exits
253 notifyInferiorSpontaneousStop();
258 void QmlEngine::serviceConnectionError(const QString &serviceName)
260 showMessage(tr("QML Debugger: Could not connect to service '%1'.")
261 .arg(serviceName), StatusBar);
264 bool QmlEngine::canDisplayTooltip() const
266 return state() == InferiorRunOk || state() == InferiorStopOk;
269 void QmlEngine::filterApplicationMessage(const QString &msg, int /*channel*/)
271 static const QString qddserver = QLatin1String("QDeclarativeDebugServer: ");
272 static const QString cannotRetrieveDebuggingOutput = ApplicationLauncher::msgWinCannotRetrieveDebuggingOutput();
274 const int index = msg.indexOf(qddserver);
276 // we're actually getting debug output
277 d->m_noDebugOutputTimer.stop();
279 QString status = msg;
280 status.remove(0, index + qddserver.length()); // chop of 'QDeclarativeDebugServer: '
282 static QString waitingForConnection = QLatin1String("Waiting for connection ");
283 static QString unableToListen = QLatin1String("Unable to listen ");
284 static QString debuggingNotEnabled = QLatin1String("Ignoring \"-qmljsdebugger=");
285 static QString debuggingNotEnabled2 = QLatin1String("Ignoring\"-qmljsdebugger="); // There is (was?) a bug in one of the error strings - safest to handle both
286 static QString connectionEstablished = QLatin1String("Connection established");
288 QString errorMessage;
289 if (status.startsWith(waitingForConnection)) {
291 } else if (status.startsWith(unableToListen)) {
292 //: Error message shown after 'Could not connect ... debugger:"
293 errorMessage = tr("The port seems to be in use.");
294 } else if (status.startsWith(debuggingNotEnabled) || status.startsWith(debuggingNotEnabled2)) {
295 //: Error message shown after 'Could not connect ... debugger:"
296 errorMessage = tr("The application is not set up for QML/JS debugging.");
297 } else if (status.startsWith(connectionEstablished)) {
300 qWarning() << "Unknown QDeclarativeDebugServer status message: " << status;
303 if (!errorMessage.isEmpty()) {
304 notifyEngineRunFailed();
306 Core::ICore * const core = Core::ICore::instance();
307 QMessageBox *infoBox = new QMessageBox(core->mainWindow());
308 infoBox->setIcon(QMessageBox::Critical);
309 infoBox->setWindowTitle(tr("Qt Creator"));
310 //: %1 is detailed error message
311 infoBox->setText(tr("Could not connect to the in-process QML debugger:\n%1")
313 infoBox->setStandardButtons(QMessageBox::Ok | QMessageBox::Help);
314 infoBox->setDefaultButton(QMessageBox::Ok);
315 infoBox->setModal(true);
317 connect(infoBox, SIGNAL(finished(int)),
318 this, SLOT(wrongSetupMessageBoxFinished(int)));
322 } else if (msg.contains(cannotRetrieveDebuggingOutput)) {
323 // we won't get debugging output, so just try to connect ...
328 void QmlEngine::showMessage(const QString &msg, int channel, int timeout) const
330 if (channel == AppOutput || channel == AppError) {
331 const_cast<QmlEngine*>(this)->filterApplicationMessage(msg, channel);
333 DebuggerEngine::showMessage(msg, channel, timeout);
336 void QmlEngine::closeConnection()
338 disconnect(watchersModel(),SIGNAL(layoutChanged()),this,SLOT(synchronizeWatchers()));
339 d->m_adapter.closeConnection();
342 void QmlEngine::runEngine()
344 QTC_ASSERT(state() == EngineRunRequested, qDebug() << state());
346 if (!isSlaveEngine() && startParameters().startMode != AttachToRemoteServer
347 && startParameters().startMode != AttachToQmlPort)
348 startApplicationLauncher();
350 if (startParameters().startMode == AttachToQmlPort)
354 void QmlEngine::startApplicationLauncher()
356 if (!d->m_applicationLauncher.isRunning()) {
357 appendMessage(tr("Starting %1 %2").arg(
358 QDir::toNativeSeparators(startParameters().executable),
359 startParameters().processArgs)
361 , Utils::NormalMessageFormat);
362 d->m_applicationLauncher.start(ApplicationLauncher::Gui,
363 startParameters().executable,
364 startParameters().processArgs);
368 void QmlEngine::stopApplicationLauncher()
370 if (d->m_applicationLauncher.isRunning()) {
371 disconnect(&d->m_applicationLauncher, SIGNAL(processExited(int)), this, SLOT(disconnected()));
372 d->m_applicationLauncher.stop();
376 void QmlEngine::handleRemoteSetupDone(int gdbServerPort, int qmlPort)
378 Q_UNUSED(gdbServerPort);
380 startParameters().qmlServerPort = qmlPort;
381 notifyInferiorSetupOk();
384 void QmlEngine::handleRemoteSetupFailed(const QString &message)
386 QMessageBox::critical(0,tr("Failed to start application"),
387 tr("Application startup failed: %1").arg(message));
388 notifyInferiorSetupFailed();
391 void QmlEngine::shutdownInferior()
393 d->m_noDebugOutputTimer.stop();
395 if (d->m_adapter.activeDebuggerClient())
396 d->m_adapter.activeDebuggerClient()->endSession();
398 if (isSlaveEngine()) {
401 stopApplicationLauncher();
403 notifyInferiorShutdownOk();
406 void QmlEngine::shutdownEngine()
410 // double check (ill engine?):
411 stopApplicationLauncher();
413 notifyEngineShutdownOk();
414 if (!isSlaveEngine())
415 showMessage(QString(), StatusBar);
418 void QmlEngine::setupEngine()
420 connect(&d->m_applicationLauncher, SIGNAL(bringToForegroundRequested(qint64)),
421 runControl(), SLOT(bringApplicationToForeground(qint64)),
422 Qt::UniqueConnection);
424 notifyEngineSetupOk();
427 void QmlEngine::continueInferior()
429 QTC_ASSERT(state() == InferiorStopOk, qDebug() << state());
430 if (d->m_adapter.activeDebuggerClient()) {
431 logMessage(LogSend, "CONTINUE");
432 d->m_adapter.activeDebuggerClient()->continueInferior();
435 notifyInferiorRunRequested();
436 notifyInferiorRunOk();
439 void QmlEngine::interruptInferior()
441 if (d->m_adapter.activeDebuggerClient()) {
442 logMessage(LogSend, "INTERRUPT");
443 d->m_adapter.activeDebuggerClient()->interruptInferior();
445 notifyInferiorStopOk();
448 void QmlEngine::executeStep()
450 if (d->m_adapter.activeDebuggerClient()) {
451 logMessage(LogSend, "STEPINTO");
452 d->m_adapter.activeDebuggerClient()->executeStep();
455 notifyInferiorRunRequested();
456 notifyInferiorRunOk();
459 void QmlEngine::executeStepI()
461 if (d->m_adapter.activeDebuggerClient()) {
462 logMessage(LogSend, "STEPINTO");
463 d->m_adapter.activeDebuggerClient()->executeStepI();
466 notifyInferiorRunRequested();
467 notifyInferiorRunOk();
470 void QmlEngine::executeStepOut()
472 if (d->m_adapter.activeDebuggerClient()) {
473 logMessage(LogSend, "STEPOUT");
474 d->m_adapter.activeDebuggerClient()->executeStepOut();
477 notifyInferiorRunRequested();
478 notifyInferiorRunOk();
481 void QmlEngine::executeNext()
483 if (d->m_adapter.activeDebuggerClient()) {
484 logMessage(LogSend, "STEPOVER");
485 d->m_adapter.activeDebuggerClient()->executeNext();
488 notifyInferiorRunRequested();
489 notifyInferiorRunOk();
492 void QmlEngine::executeNextI()
494 SDEBUG("QmlEngine::executeNextI()");
497 void QmlEngine::executeRunToLine(const ContextData &data)
500 SDEBUG("FIXME: QmlEngine::executeRunToLine()");
503 void QmlEngine::executeRunToFunction(const QString &functionName)
505 Q_UNUSED(functionName)
506 XSDEBUG("FIXME: QmlEngine::executeRunToFunction()");
509 void QmlEngine::executeJumpToLine(const ContextData &data)
512 XSDEBUG("FIXME: QmlEngine::executeJumpToLine()");
515 void QmlEngine::activateFrame(int index)
517 if (d->m_adapter.activeDebuggerClient()) {
518 logMessage(LogSend, QString("%1 %2").arg(QString("ACTIVATE_FRAME"), QString::number(index)));
519 d->m_adapter.activeDebuggerClient()->activateFrame(index);
521 gotoLocation(stackHandler()->frames().value(index));
524 void QmlEngine::selectThread(int index)
529 void QmlEngine::insertBreakpoint(BreakpointModelId id)
531 BreakHandler *handler = breakHandler();
532 BreakpointState state = handler->state(id);
533 QTC_ASSERT(state == BreakpointInsertRequested, qDebug() << id << this << state);
534 handler->notifyBreakpointInsertProceeding(id);
536 if (d->m_adapter.activeDebuggerClient()) {
537 d->m_adapter.activeDebuggerClient()->insertBreakpoint(id);
539 foreach (QmlDebuggerClient *client, d->m_adapter.debuggerClients()) {
540 client->insertBreakpoint(id);
545 void QmlEngine::removeBreakpoint(BreakpointModelId id)
547 BreakHandler *handler = breakHandler();
548 BreakpointState state = handler->state(id);
549 QTC_ASSERT(state == BreakpointRemoveRequested, qDebug() << id << this << state);
550 handler->notifyBreakpointRemoveProceeding(id);
552 if (d->m_adapter.activeDebuggerClient()) {
553 d->m_adapter.activeDebuggerClient()->removeBreakpoint(id);
555 foreach (QmlDebuggerClient *client, d->m_adapter.debuggerClients()) {
556 client->removeBreakpoint(id);
560 if (handler->state(id) == BreakpointRemoveProceeding) {
561 handler->notifyBreakpointRemoveOk(id);
565 void QmlEngine::changeBreakpoint(BreakpointModelId id)
567 BreakHandler *handler = breakHandler();
568 BreakpointState state = handler->state(id);
569 QTC_ASSERT(state == BreakpointChangeRequested, qDebug() << id << this << state);
570 handler->notifyBreakpointChangeProceeding(id);
572 if (d->m_adapter.activeDebuggerClient()) {
573 d->m_adapter.activeDebuggerClient()->changeBreakpoint(id);
575 foreach (QmlDebuggerClient *client, d->m_adapter.debuggerClients()) {
576 client->changeBreakpoint(id);
580 if (handler->state(id) == BreakpointChangeProceeding) {
581 handler->notifyBreakpointChangeOk(id);
585 void QmlEngine::attemptBreakpointSynchronization()
587 if (!stateAcceptsBreakpointChanges()) {
588 showMessage(_("BREAKPOINT SYNCHRONIZATION NOT POSSIBLE IN CURRENT STATE"));
592 BreakHandler *handler = breakHandler();
594 foreach (BreakpointModelId id, handler->unclaimedBreakpointIds()) {
595 // Take ownership of the breakpoint. Requests insertion.
596 if (acceptsBreakpoint(id))
597 handler->setEngine(id, this);
600 foreach (BreakpointModelId id, handler->engineBreakpointIds(this)) {
601 switch (handler->state(id)) {
603 // Should not happen once claimed.
606 case BreakpointInsertRequested:
607 insertBreakpoint(id);
609 case BreakpointChangeRequested:
610 changeBreakpoint(id);
612 case BreakpointRemoveRequested:
613 removeBreakpoint(id);
615 case BreakpointChangeProceeding:
616 case BreakpointInsertProceeding:
617 case BreakpointRemoveProceeding:
618 case BreakpointInserted:
622 QTC_ASSERT(false, qDebug() << "UNKNOWN STATE" << id << state());
625 DebuggerEngine::attemptBreakpointSynchronization();
627 if (d->m_adapter.activeDebuggerClient()) {
628 d->m_adapter.activeDebuggerClient()->updateBreakpoints();
630 foreach (QmlDebuggerClient *client, d->m_adapter.debuggerClients()) {
631 client->updateBreakpoints();
636 bool QmlEngine::acceptsBreakpoint(BreakpointModelId id) const
638 if (!DebuggerEngine::isCppBreakpoint(breakHandler()->breakpointData(id)))
641 //If it is a Cpp Breakpoint query if the type can be also handled by the debugger client
642 //TODO: enable setting of breakpoints before start of debug session
643 //For now, the event breakpoint can be set after the activeDebuggerClient is known
644 //This is because the older client does not support BreakpointOnQmlSignalHandler
645 bool acceptBreakpoint = false;
646 if (d->m_adapter.activeDebuggerClient()) {
647 acceptBreakpoint = d->m_adapter.activeDebuggerClient()->acceptsBreakpoint(id);
649 return acceptBreakpoint;
652 void QmlEngine::loadSymbols(const QString &moduleName)
657 void QmlEngine::loadAllSymbols()
661 void QmlEngine::reloadModules()
665 void QmlEngine::requestModuleSymbols(const QString &moduleName)
670 //////////////////////////////////////////////////////////////////////
672 // Tooltip specific stuff
674 //////////////////////////////////////////////////////////////////////
676 bool QmlEngine::setToolTipExpression(const QPoint &mousePos,
677 TextEditor::ITextEditor *editor, const DebuggerToolTipContext &ctx)
679 // This is processed by QML inspector, which has dependencies to
680 // the qml js editor. Makes life easier.
681 emit tooltipRequested(mousePos, editor, ctx.position);
685 //////////////////////////////////////////////////////////////////////
687 // Watch specific stuff
689 //////////////////////////////////////////////////////////////////////
691 void QmlEngine::assignValueInDebugger(const WatchData *data,
692 const QString &expression, const QVariant &valueV)
694 quint64 objectId = data->id;
695 if (objectId > 0 && !expression.isEmpty() && d->m_adapter.activeDebuggerClient()) {
696 logMessage(LogSend, QString("%1 %2 %3 %4 %5").arg(
697 QString("SET_PROPERTY"), QString::number(objectId), QString(expression),
699 d->m_adapter.activeDebuggerClient()->assignValueInDebugger(expression.toUtf8(), objectId, expression, valueV.toString());
703 void QmlEngine::updateWatchData(const WatchData &data,
704 const WatchUpdateFlags &)
706 // qDebug() << "UPDATE WATCH DATA" << data.toString();
707 //watchHandler()->rebuildModel();
708 showStatusMessage(tr("Stopped."), 5000);
710 if (!data.name.isEmpty() && d->m_adapter.activeDebuggerClient()) {
711 if (data.isValueNeeded()) {
712 logMessage(LogSend, QString("%1 %2 %3").arg(QString("EXEC"), QString(data.iname),
713 QString(data.name)));
714 d->m_adapter.activeDebuggerClient()->updateWatchData(&data);
716 if (data.isChildrenNeeded()
717 && watchHandler()->isExpandedIName(data.iname)) {
718 d->m_adapter.activeDebuggerClient()->expandObject(data.iname, data.id);
722 synchronizeWatchers();
724 if (!data.isSomethingNeeded())
725 watchHandler()->insertData(data);
728 void QmlEngine::synchronizeWatchers()
730 QStringList watchedExpressions = watchHandler()->watchedExpressions();
731 // send watchers list
732 logMessage(LogSend, QString("%1 %2").arg(
733 QString("WATCH_EXPRESSIONS"), watchedExpressions.join(", ")));
734 if (d->m_adapter.activeDebuggerClient()) {
735 d->m_adapter.activeDebuggerClient()->synchronizeWatchers(watchedExpressions);
737 foreach (QmlDebuggerClient *client, d->m_adapter.debuggerClients())
738 client->synchronizeWatchers(watchedExpressions);
742 unsigned QmlEngine::debuggerCapabilities() const
744 return AddWatcherCapability|AddWatcherWhileRunningCapability;
745 /*ReverseSteppingCapability | SnapshotCapability
746 | AutoDerefPointersCapability | DisassemblerCapability
747 | RegisterCapability | ShowMemoryCapability
748 | JumpToLineCapability | ReloadModuleCapability
749 | ReloadModuleSymbolsCapability | BreakOnThrowAndCatchCapability
750 | ReturnFromFunctionCapability
751 | CreateFullBacktraceCapability
752 | WatchpointCapability
753 | AddWatcherCapability;*/
756 QString QmlEngine::toFileInProject(const QUrl &fileUrl)
758 if (startParameters().startMode != AttachToQmlPort) {
759 if (d->fileFinder.projectDirectory().isEmpty()) {
760 d->fileFinder.setProjectDirectory(startParameters().projectSourceDirectory);
761 d->fileFinder.setProjectFiles(startParameters().projectSourceFiles);
765 return d->fileFinder.findFile(fileUrl);
768 void QmlEngine::inferiorSpontaneousStop()
770 if (state() == InferiorRunOk)
771 notifyInferiorSpontaneousStop();
774 void QmlEngine::disconnected()
776 showMessage(tr("QML Debugger disconnected."), StatusBar);
777 notifyInferiorExited();
780 void QmlEngine::wrongSetupMessageBoxFinished(int result)
782 if (result == QMessageBox::Help) {
783 Core::HelpManager *helpManager = Core::HelpManager::instance();
784 helpManager->handleHelpRequest(
785 QLatin1String("qthelp://com.nokia.qtcreator/doc/creator-debugging-qml.html"));
789 void QmlEngine::executeDebuggerCommand(const QString& command)
791 if (d->m_adapter.activeDebuggerClient()) {
792 logMessage(LogSend, QString("%1 %2 %3").arg(QString("EXEC"), QString("console"),
794 d->m_adapter.activeDebuggerClient()->executeDebuggerCommand(command);
799 QString QmlEngine::qmlImportPath() const
801 return startParameters().environment.value("QML_IMPORT_PATH");
804 void QmlEngine::logMessage(LogDirection direction, const QString &message)
806 QString msg = "QmlDebugger";
807 if (direction == LogSend) {
810 msg += " receiving ";
813 showMessage(msg, LogDebug);
816 QmlEngine *createQmlEngine(const DebuggerStartParameters &sp,
817 DebuggerEngine *masterEngine)
819 return new QmlEngine(sp, masterEngine);
822 } // namespace Internal
823 } // namespace Debugger