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 notifyInferiorSpontaneousStop();
256 void QmlEngine::serviceConnectionError(const QString &serviceName)
258 showMessage(tr("QML Debugger: Could not connect to service '%1'.")
259 .arg(serviceName), StatusBar);
262 bool QmlEngine::canDisplayTooltip() const
264 return state() == InferiorRunOk || state() == InferiorStopOk;
267 void QmlEngine::filterApplicationMessage(const QString &msg, int /*channel*/)
269 static const QString qddserver = QLatin1String("QDeclarativeDebugServer: ");
270 static const QString cannotRetrieveDebuggingOutput = ApplicationLauncher::msgWinCannotRetrieveDebuggingOutput();
272 const int index = msg.indexOf(qddserver);
274 // we're actually getting debug output
275 d->m_noDebugOutputTimer.stop();
277 QString status = msg;
278 status.remove(0, index + qddserver.length()); // chop of 'QDeclarativeDebugServer: '
280 static QString waitingForConnection = QLatin1String("Waiting for connection ");
281 static QString unableToListen = QLatin1String("Unable to listen ");
282 static QString debuggingNotEnabled = QLatin1String("Ignoring \"-qmljsdebugger=");
283 static QString debuggingNotEnabled2 = QLatin1String("Ignoring\"-qmljsdebugger="); // There is (was?) a bug in one of the error strings - safest to handle both
284 static QString connectionEstablished = QLatin1String("Connection established");
286 QString errorMessage;
287 if (status.startsWith(waitingForConnection)) {
289 } else if (status.startsWith(unableToListen)) {
290 //: Error message shown after 'Could not connect ... debugger:"
291 errorMessage = tr("The port seems to be in use.");
292 } else if (status.startsWith(debuggingNotEnabled) || status.startsWith(debuggingNotEnabled2)) {
293 //: Error message shown after 'Could not connect ... debugger:"
294 errorMessage = tr("The application is not set up for QML/JS debugging.");
295 } else if (status.startsWith(connectionEstablished)) {
298 qWarning() << "Unknown QDeclarativeDebugServer status message: " << status;
301 if (!errorMessage.isEmpty()) {
302 notifyEngineRunFailed();
304 Core::ICore * const core = Core::ICore::instance();
305 QMessageBox *infoBox = new QMessageBox(core->mainWindow());
306 infoBox->setIcon(QMessageBox::Critical);
307 infoBox->setWindowTitle(tr("Qt Creator"));
308 //: %1 is detailed error message
309 infoBox->setText(tr("Could not connect to the in-process QML debugger:\n%1")
311 infoBox->setStandardButtons(QMessageBox::Ok | QMessageBox::Help);
312 infoBox->setDefaultButton(QMessageBox::Ok);
313 infoBox->setModal(true);
315 connect(infoBox, SIGNAL(finished(int)),
316 this, SLOT(wrongSetupMessageBoxFinished(int)));
320 } else if (msg.contains(cannotRetrieveDebuggingOutput)) {
321 // we won't get debugging output, so just try to connect ...
326 void QmlEngine::showMessage(const QString &msg, int channel, int timeout) const
328 if (channel == AppOutput || channel == AppError) {
329 const_cast<QmlEngine*>(this)->filterApplicationMessage(msg, channel);
331 DebuggerEngine::showMessage(msg, channel, timeout);
334 void QmlEngine::closeConnection()
336 disconnect(watchersModel(),SIGNAL(layoutChanged()),this,SLOT(synchronizeWatchers()));
337 d->m_adapter.closeConnection();
340 void QmlEngine::runEngine()
342 QTC_ASSERT(state() == EngineRunRequested, qDebug() << state());
344 if (!isSlaveEngine() && startParameters().startMode != AttachToRemoteServer
345 && startParameters().startMode != AttachToQmlPort)
346 startApplicationLauncher();
348 if (startParameters().startMode == AttachToQmlPort)
352 void QmlEngine::startApplicationLauncher()
354 if (!d->m_applicationLauncher.isRunning()) {
355 appendMessage(tr("Starting %1 %2").arg(
356 QDir::toNativeSeparators(startParameters().executable),
357 startParameters().processArgs)
359 , Utils::NormalMessageFormat);
360 d->m_applicationLauncher.start(ApplicationLauncher::Gui,
361 startParameters().executable,
362 startParameters().processArgs);
366 void QmlEngine::stopApplicationLauncher()
368 if (d->m_applicationLauncher.isRunning()) {
369 disconnect(&d->m_applicationLauncher, SIGNAL(processExited(int)), this, SLOT(disconnected()));
370 d->m_applicationLauncher.stop();
374 void QmlEngine::handleRemoteSetupDone(int gdbServerPort, int qmlPort)
376 Q_UNUSED(gdbServerPort);
378 startParameters().qmlServerPort = qmlPort;
379 notifyInferiorSetupOk();
382 void QmlEngine::handleRemoteSetupFailed(const QString &message)
384 QMessageBox::critical(0,tr("Failed to start application"),
385 tr("Application startup failed: %1").arg(message));
386 notifyInferiorSetupFailed();
389 void QmlEngine::shutdownInferior()
391 d->m_noDebugOutputTimer.stop();
393 if (d->m_adapter.activeDebuggerClient())
394 d->m_adapter.activeDebuggerClient()->endSession();
396 if (isSlaveEngine()) {
399 stopApplicationLauncher();
401 notifyInferiorShutdownOk();
404 void QmlEngine::shutdownEngine()
408 // double check (ill engine?):
409 stopApplicationLauncher();
411 notifyEngineShutdownOk();
412 if (!isSlaveEngine())
413 showMessage(QString(), StatusBar);
416 void QmlEngine::setupEngine()
418 connect(&d->m_applicationLauncher, SIGNAL(bringToForegroundRequested(qint64)),
419 runControl(), SLOT(bringApplicationToForeground(qint64)),
420 Qt::UniqueConnection);
422 notifyEngineSetupOk();
425 void QmlEngine::continueInferior()
427 QTC_ASSERT(state() == InferiorStopOk, qDebug() << state());
428 if (d->m_adapter.activeDebuggerClient()) {
429 logMessage(LogSend, "CONTINUE");
430 d->m_adapter.activeDebuggerClient()->continueInferior();
433 notifyInferiorRunRequested();
434 notifyInferiorRunOk();
437 void QmlEngine::interruptInferior()
439 if (d->m_adapter.activeDebuggerClient()) {
440 logMessage(LogSend, "INTERRUPT");
441 d->m_adapter.activeDebuggerClient()->interruptInferior();
443 notifyInferiorStopOk();
446 void QmlEngine::executeStep()
448 if (d->m_adapter.activeDebuggerClient()) {
449 logMessage(LogSend, "STEPINTO");
450 d->m_adapter.activeDebuggerClient()->executeStep();
453 notifyInferiorRunRequested();
454 notifyInferiorRunOk();
457 void QmlEngine::executeStepI()
459 if (d->m_adapter.activeDebuggerClient()) {
460 logMessage(LogSend, "STEPINTO");
461 d->m_adapter.activeDebuggerClient()->executeStepI();
464 notifyInferiorRunRequested();
465 notifyInferiorRunOk();
468 void QmlEngine::executeStepOut()
470 if (d->m_adapter.activeDebuggerClient()) {
471 logMessage(LogSend, "STEPOUT");
472 d->m_adapter.activeDebuggerClient()->executeStepOut();
475 notifyInferiorRunRequested();
476 notifyInferiorRunOk();
479 void QmlEngine::executeNext()
481 if (d->m_adapter.activeDebuggerClient()) {
482 logMessage(LogSend, "STEPOVER");
483 d->m_adapter.activeDebuggerClient()->executeNext();
486 notifyInferiorRunRequested();
487 notifyInferiorRunOk();
490 void QmlEngine::executeNextI()
492 SDEBUG("QmlEngine::executeNextI()");
495 void QmlEngine::executeRunToLine(const ContextData &data)
498 SDEBUG("FIXME: QmlEngine::executeRunToLine()");
501 void QmlEngine::executeRunToFunction(const QString &functionName)
503 Q_UNUSED(functionName)
504 XSDEBUG("FIXME: QmlEngine::executeRunToFunction()");
507 void QmlEngine::executeJumpToLine(const ContextData &data)
510 XSDEBUG("FIXME: QmlEngine::executeJumpToLine()");
513 void QmlEngine::activateFrame(int index)
515 if (d->m_adapter.activeDebuggerClient()) {
516 logMessage(LogSend, QString("%1 %2").arg(QString("ACTIVATE_FRAME"), QString::number(index)));
517 d->m_adapter.activeDebuggerClient()->activateFrame(index);
519 gotoLocation(stackHandler()->frames().value(index));
522 void QmlEngine::selectThread(int index)
527 void QmlEngine::insertBreakpoint(BreakpointModelId id)
529 BreakHandler *handler = breakHandler();
530 BreakpointState state = handler->state(id);
531 QTC_ASSERT(state == BreakpointInsertRequested, qDebug() << id << this << state);
532 handler->notifyBreakpointInsertProceeding(id);
534 if (d->m_adapter.activeDebuggerClient()) {
535 d->m_adapter.activeDebuggerClient()->insertBreakpoint(id);
537 foreach (QmlDebuggerClient *client, d->m_adapter.debuggerClients()) {
538 client->insertBreakpoint(id);
543 void QmlEngine::removeBreakpoint(BreakpointModelId id)
545 BreakHandler *handler = breakHandler();
546 BreakpointState state = handler->state(id);
547 QTC_ASSERT(state == BreakpointRemoveRequested, qDebug() << id << this << state);
548 handler->notifyBreakpointRemoveProceeding(id);
550 if (d->m_adapter.activeDebuggerClient()) {
551 d->m_adapter.activeDebuggerClient()->removeBreakpoint(id);
553 foreach (QmlDebuggerClient *client, d->m_adapter.debuggerClients()) {
554 client->removeBreakpoint(id);
558 if (handler->state(id) == BreakpointRemoveProceeding) {
559 handler->notifyBreakpointRemoveOk(id);
563 void QmlEngine::changeBreakpoint(BreakpointModelId id)
565 BreakHandler *handler = breakHandler();
566 BreakpointState state = handler->state(id);
567 QTC_ASSERT(state == BreakpointChangeRequested, qDebug() << id << this << state);
568 handler->notifyBreakpointChangeProceeding(id);
570 if (d->m_adapter.activeDebuggerClient()) {
571 d->m_adapter.activeDebuggerClient()->changeBreakpoint(id);
573 foreach (QmlDebuggerClient *client, d->m_adapter.debuggerClients()) {
574 client->changeBreakpoint(id);
578 if (handler->state(id) == BreakpointChangeProceeding) {
579 handler->notifyBreakpointChangeOk(id);
583 void QmlEngine::attemptBreakpointSynchronization()
585 if (!stateAcceptsBreakpointChanges()) {
586 showMessage(_("BREAKPOINT SYNCHRONIZATION NOT POSSIBLE IN CURRENT STATE"));
590 BreakHandler *handler = breakHandler();
592 foreach (BreakpointModelId id, handler->unclaimedBreakpointIds()) {
593 // Take ownership of the breakpoint. Requests insertion.
594 if (acceptsBreakpoint(id))
595 handler->setEngine(id, this);
598 foreach (BreakpointModelId id, handler->engineBreakpointIds(this)) {
599 switch (handler->state(id)) {
601 // Should not happen once claimed.
604 case BreakpointInsertRequested:
605 insertBreakpoint(id);
607 case BreakpointChangeRequested:
608 changeBreakpoint(id);
610 case BreakpointRemoveRequested:
611 removeBreakpoint(id);
613 case BreakpointChangeProceeding:
614 case BreakpointInsertProceeding:
615 case BreakpointRemoveProceeding:
616 case BreakpointInserted:
620 QTC_ASSERT(false, qDebug() << "UNKNOWN STATE" << id << state());
623 DebuggerEngine::attemptBreakpointSynchronization();
625 if (d->m_adapter.activeDebuggerClient()) {
626 d->m_adapter.activeDebuggerClient()->updateBreakpoints();
628 foreach (QmlDebuggerClient *client, d->m_adapter.debuggerClients()) {
629 client->updateBreakpoints();
634 bool QmlEngine::acceptsBreakpoint(BreakpointModelId id) const
636 if (!DebuggerEngine::isCppBreakpoint(breakHandler()->breakpointData(id)))
639 //If it is a Cpp Breakpoint query if the type can be also handled by the debugger client
640 //TODO: enable setting of breakpoints before start of debug session
641 //For now, the event breakpoint can be set after the activeDebuggerClient is known
642 //This is because the older client does not support BreakpointOnQmlSignalHandler
643 bool acceptBreakpoint = false;
644 if (d->m_adapter.activeDebuggerClient()) {
645 acceptBreakpoint = d->m_adapter.activeDebuggerClient()->acceptsBreakpoint(id);
647 return acceptBreakpoint;
650 void QmlEngine::loadSymbols(const QString &moduleName)
655 void QmlEngine::loadAllSymbols()
659 void QmlEngine::reloadModules()
663 void QmlEngine::requestModuleSymbols(const QString &moduleName)
668 //////////////////////////////////////////////////////////////////////
670 // Tooltip specific stuff
672 //////////////////////////////////////////////////////////////////////
674 bool QmlEngine::setToolTipExpression(const QPoint &mousePos,
675 TextEditor::ITextEditor *editor, const DebuggerToolTipContext &ctx)
677 // This is processed by QML inspector, which has dependencies to
678 // the qml js editor. Makes life easier.
679 emit tooltipRequested(mousePos, editor, ctx.position);
683 //////////////////////////////////////////////////////////////////////
685 // Watch specific stuff
687 //////////////////////////////////////////////////////////////////////
689 void QmlEngine::assignValueInDebugger(const WatchData *data,
690 const QString &expression, const QVariant &valueV)
692 quint64 objectId = data->id;
693 if (objectId > 0 && !expression.isEmpty() && d->m_adapter.activeDebuggerClient()) {
694 logMessage(LogSend, QString("%1 %2 %3 %4 %5").arg(
695 QString("SET_PROPERTY"), QString::number(objectId), QString(expression),
697 d->m_adapter.activeDebuggerClient()->assignValueInDebugger(expression.toUtf8(), objectId, expression, valueV.toString());
701 void QmlEngine::updateWatchData(const WatchData &data,
702 const WatchUpdateFlags &)
704 // qDebug() << "UPDATE WATCH DATA" << data.toString();
705 //watchHandler()->rebuildModel();
706 showStatusMessage(tr("Stopped."), 5000);
708 if (!data.name.isEmpty() && d->m_adapter.activeDebuggerClient()) {
709 if (data.isValueNeeded()) {
710 logMessage(LogSend, QString("%1 %2 %3").arg(QString("EXEC"), QString(data.iname),
711 QString(data.name)));
712 d->m_adapter.activeDebuggerClient()->updateWatchData(&data);
714 if (data.isChildrenNeeded()
715 && watchHandler()->isExpandedIName(data.iname)) {
716 d->m_adapter.activeDebuggerClient()->expandObject(data.iname, data.id);
720 synchronizeWatchers();
722 if (!data.isSomethingNeeded())
723 watchHandler()->insertData(data);
726 void QmlEngine::synchronizeWatchers()
728 QStringList watchedExpressions = watchHandler()->watchedExpressions();
729 // send watchers list
730 logMessage(LogSend, QString("%1 %2").arg(
731 QString("WATCH_EXPRESSIONS"), watchedExpressions.join(", ")));
732 if (d->m_adapter.activeDebuggerClient()) {
733 d->m_adapter.activeDebuggerClient()->synchronizeWatchers(watchedExpressions);
735 foreach (QmlDebuggerClient *client, d->m_adapter.debuggerClients())
736 client->synchronizeWatchers(watchedExpressions);
740 unsigned QmlEngine::debuggerCapabilities() const
742 return AddWatcherCapability|AddWatcherWhileRunningCapability;
743 /*ReverseSteppingCapability | SnapshotCapability
744 | AutoDerefPointersCapability | DisassemblerCapability
745 | RegisterCapability | ShowMemoryCapability
746 | JumpToLineCapability | ReloadModuleCapability
747 | ReloadModuleSymbolsCapability | BreakOnThrowAndCatchCapability
748 | ReturnFromFunctionCapability
749 | CreateFullBacktraceCapability
750 | WatchpointCapability
751 | AddWatcherCapability;*/
754 QString QmlEngine::toFileInProject(const QUrl &fileUrl)
756 if (startParameters().startMode != AttachToQmlPort) {
757 if (d->fileFinder.projectDirectory().isEmpty()) {
758 d->fileFinder.setProjectDirectory(startParameters().projectSourceDirectory);
759 d->fileFinder.setProjectFiles(startParameters().projectSourceFiles);
763 return d->fileFinder.findFile(fileUrl);
766 void QmlEngine::inferiorSpontaneousStop()
768 if (state() == InferiorRunOk)
769 notifyInferiorSpontaneousStop();
772 void QmlEngine::disconnected()
774 showMessage(tr("QML Debugger disconnected."), StatusBar);
775 notifyInferiorExited();
778 void QmlEngine::wrongSetupMessageBoxFinished(int result)
780 if (result == QMessageBox::Help) {
781 Core::HelpManager *helpManager = Core::HelpManager::instance();
782 helpManager->handleHelpRequest(
783 QLatin1String("qthelp://com.nokia.qtcreator/doc/creator-debugging-qml.html"));
787 void QmlEngine::executeDebuggerCommand(const QString& command)
789 if (d->m_adapter.activeDebuggerClient()) {
790 logMessage(LogSend, QString("%1 %2 %3").arg(QString("EXEC"), QString("console"),
792 d->m_adapter.activeDebuggerClient()->executeDebuggerCommand(command);
797 QString QmlEngine::qmlImportPath() const
799 return startParameters().environment.value("QML_IMPORT_PATH");
802 void QmlEngine::logMessage(LogDirection direction, const QString &message)
804 QString msg = "QmlDebugger";
805 if (direction == LogSend) {
808 msg += " receiving ";
811 showMessage(msg, LogDebug);
814 QmlEngine *createQmlEngine(const DebuggerStartParameters &sp,
815 DebuggerEngine *masterEngine)
817 return new QmlEngine(sp, masterEngine);
820 } // namespace Internal
821 } // namespace Debugger