forked from qt-creator/qt-creator
Debugger mode for simultaneous QML and C++ debugging (with plugins)
If you have plugins that extend qml, you probably want to debug them too. This is now possible with the "Start debugging QML and C++ Simultaneously" debug menu entry. Just select a QML project which uses c++ plugins and start debugging in this mode.
This commit is contained in:
@@ -229,8 +229,6 @@ QString ObjectPropertiesView::propertyBaseClass(const QDeclarativeDebugObjectRef
|
|||||||
QmlJSEditor::ModelManagerInterface *modelManager = pluginManager->getObject<QmlJSEditor::ModelManagerInterface>();
|
QmlJSEditor::ModelManagerInterface *modelManager = pluginManager->getObject<QmlJSEditor::ModelManagerInterface>();
|
||||||
QmlJS::Snapshot snapshot = modelManager->snapshot();
|
QmlJS::Snapshot snapshot = modelManager->snapshot();
|
||||||
|
|
||||||
//qDebug() << property.name() << object.source().url().path();
|
|
||||||
|
|
||||||
QmlJS::Document::Ptr document = snapshot.document(object.source().url().path());
|
QmlJS::Document::Ptr document = snapshot.document(object.source().url().path());
|
||||||
if (document.isNull()) {
|
if (document.isNull()) {
|
||||||
|
|
||||||
@@ -241,7 +239,6 @@ QString ObjectPropertiesView::propertyBaseClass(const QDeclarativeDebugObjectRef
|
|||||||
contents = ins.readAll();
|
contents = ins.readAll();
|
||||||
inFile.close();
|
inFile.close();
|
||||||
}
|
}
|
||||||
//qDebug() << contents;
|
|
||||||
|
|
||||||
document = QmlJS::Document::create(object.source().url().path());
|
document = QmlJS::Document::create(object.source().url().path());
|
||||||
document->setSource(contents);
|
document->setSource(contents);
|
||||||
@@ -301,7 +298,6 @@ void ObjectPropertiesView::setObject(const QDeclarativeDebugObjectReference &obj
|
|||||||
|
|
||||||
baseClassItems.insert(baseClassName, baseClassItem);
|
baseClassItems.insert(baseClassName, baseClassItem);
|
||||||
|
|
||||||
qDebug() << "Baseclass" << baseClassName;
|
|
||||||
}
|
}
|
||||||
currentParentItem = baseClassItems.value(baseClassName);
|
currentParentItem = baseClassItems.value(baseClassName);
|
||||||
item = new PropertiesViewItem(currentParentItem);
|
item = new PropertiesViewItem(currentParentItem);
|
||||||
|
|||||||
@@ -184,8 +184,6 @@ void ObjectTree::buildTree(const QDeclarativeDebugObjectReference &obj, QTreeWid
|
|||||||
if (!parent)
|
if (!parent)
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
qDebug() << obj.className();
|
|
||||||
|
|
||||||
if (obj.contextDebugId() < 0 && !m_showUninspectableItems)
|
if (obj.contextDebugId() < 0 && !m_showUninspectableItems)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -162,7 +162,8 @@ QmlInspector::QmlInspector(QObject *parent)
|
|||||||
m_inspectorOutputDock(0),
|
m_inspectorOutputDock(0),
|
||||||
m_connectionTimer(new QTimer(this)),
|
m_connectionTimer(new QTimer(this)),
|
||||||
m_connectionAttempts(0),
|
m_connectionAttempts(0),
|
||||||
m_simultaneousCppAndQmlDebugMode(false)
|
m_simultaneousCppAndQmlDebugMode(false),
|
||||||
|
m_debugMode(StandaloneMode)
|
||||||
{
|
{
|
||||||
m_instance = this;
|
m_instance = this;
|
||||||
m_watchTableModel = new Internal::WatchTableModel(0, this);
|
m_watchTableModel = new Internal::WatchTableModel(0, this);
|
||||||
@@ -174,6 +175,8 @@ QmlInspector::QmlInspector(QObject *parent)
|
|||||||
// m_frameRateWidget = new Internal::CanvasFrameRate;
|
// m_frameRateWidget = new Internal::CanvasFrameRate;
|
||||||
// m_frameRateWidget->setObjectName(QLatin1String("QmlDebugFrameRate"));
|
// m_frameRateWidget->setObjectName(QLatin1String("QmlDebugFrameRate"));
|
||||||
|
|
||||||
|
Debugger::DebuggerManager *debugManager = Debugger::DebuggerManager::instance();
|
||||||
|
connect(debugManager, SIGNAL(stateChanged(int)), this, SLOT(debuggerStateChanged(int)));
|
||||||
|
|
||||||
m_editablePropertyTypes = QStringList() << "qreal" << "bool" << "QString"
|
m_editablePropertyTypes = QStringList() << "qreal" << "bool" << "QString"
|
||||||
<< "int" << "QVariant" << "QUrl" << "QColor";
|
<< "int" << "QVariant" << "QUrl" << "QColor";
|
||||||
@@ -202,6 +205,7 @@ void QmlInspector::pollInspector()
|
|||||||
tr("Failed to connect to debugger"),
|
tr("Failed to connect to debugger"),
|
||||||
tr("Could not connect to debugger server.") );
|
tr("Could not connect to debugger server.") );
|
||||||
}
|
}
|
||||||
|
updateMenuActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QmlInspector::setDebugConfigurationDataFromProject(ProjectExplorer::Project *projectToDebug)
|
bool QmlInspector::setDebugConfigurationDataFromProject(ProjectExplorer::Project *projectToDebug)
|
||||||
@@ -227,11 +231,6 @@ bool QmlInspector::setDebugConfigurationDataFromProject(ProjectExplorer::Project
|
|||||||
void QmlInspector::startQmlProjectDebugger()
|
void QmlInspector::startQmlProjectDebugger()
|
||||||
{
|
{
|
||||||
m_simultaneousCppAndQmlDebugMode = false;
|
m_simultaneousCppAndQmlDebugMode = false;
|
||||||
startConnectionTimer();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QmlInspector::startConnectionTimer()
|
|
||||||
{
|
|
||||||
m_connectionTimer->start();
|
m_connectionTimer->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -269,6 +268,7 @@ bool QmlInspector::connectToViewer()
|
|||||||
void QmlInspector::disconnectFromViewer()
|
void QmlInspector::disconnectFromViewer()
|
||||||
{
|
{
|
||||||
m_conn->disconnectFromHost();
|
m_conn->disconnectFromHost();
|
||||||
|
updateMenuActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlInspector::connectionStateChanged()
|
void QmlInspector::connectionStateChanged()
|
||||||
@@ -285,6 +285,8 @@ void QmlInspector::connectionStateChanged()
|
|||||||
|
|
||||||
resetViews();
|
resetViews();
|
||||||
|
|
||||||
|
updateMenuActions();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case QAbstractSocket::HostLookupState:
|
case QAbstractSocket::HostLookupState:
|
||||||
@@ -445,14 +447,14 @@ void QmlInspector::createDockWidgets()
|
|||||||
core->addContextObject(m_propWatcherContext);
|
core->addContextObject(m_propWatcherContext);
|
||||||
core->addContextObject(m_context);
|
core->addContextObject(m_context);
|
||||||
|
|
||||||
QAction *attachToExternalAction = new QAction(this);
|
m_simultaneousDebugAction = new QAction(this);
|
||||||
attachToExternalAction->setText(tr("Start Debugging C++ and QML Simultaneously..."));
|
m_simultaneousDebugAction->setText(tr("Start Debugging C++ and QML Simultaneously..."));
|
||||||
connect(attachToExternalAction, SIGNAL(triggered()),
|
connect(m_simultaneousDebugAction, SIGNAL(triggered()),
|
||||||
this, SLOT(attachToExternalQmlApplication()));
|
this, SLOT(simultaneouslyDebugQmlCppApplication()));
|
||||||
|
|
||||||
Core::ActionManager *am = core->actionManager();
|
Core::ActionManager *am = core->actionManager();
|
||||||
Core::ActionContainer *mstart = am->actionContainer(ProjectExplorer::Constants::M_DEBUG_STARTDEBUGGING);
|
Core::ActionContainer *mstart = am->actionContainer(ProjectExplorer::Constants::M_DEBUG_STARTDEBUGGING);
|
||||||
Core::Command *cmd = am->registerAction(attachToExternalAction, Constants::M_ATTACH_TO_EXTERNAL,
|
Core::Command *cmd = am->registerAction(m_simultaneousDebugAction, Constants::M_DEBUG_SIMULTANEOUSLY,
|
||||||
QList<int>() << m_context->context());
|
QList<int>() << m_context->context());
|
||||||
cmd->setAttribute(Core::Command::CA_Hide);
|
cmd->setAttribute(Core::Command::CA_Hide);
|
||||||
mstart->addAction(cmd, Core::Constants::G_DEFAULT_ONE);
|
mstart->addAction(cmd, Core::Constants::G_DEFAULT_ONE);
|
||||||
@@ -471,34 +473,95 @@ void QmlInspector::createDockWidgets()
|
|||||||
SLOT(setContextHelpId(QString)));
|
SLOT(setContextHelpId(QString)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlInspector::attachToExternalQmlApplication()
|
void QmlInspector::simultaneouslyDebugQmlCppApplication()
|
||||||
{
|
{
|
||||||
|
QString errorMessage;
|
||||||
ProjectExplorer::ProjectExplorerPlugin *pex = ProjectExplorer::ProjectExplorerPlugin::instance();
|
ProjectExplorer::ProjectExplorerPlugin *pex = ProjectExplorer::ProjectExplorerPlugin::instance();
|
||||||
ProjectExplorer::Project *project = pex->startupProject();
|
ProjectExplorer::Project *project = pex->startupProject();
|
||||||
ProjectExplorer::LocalApplicationRunConfiguration* runConfig =
|
|
||||||
qobject_cast<ProjectExplorer::LocalApplicationRunConfiguration*>(project->activeTarget()->activeRunConfiguration());
|
|
||||||
|
|
||||||
QString errorMessage;
|
|
||||||
|
|
||||||
if (!project)
|
if (!project)
|
||||||
errorMessage = QString(tr("No project was found."));
|
errorMessage = QString(tr("No project was found."));
|
||||||
else if (!project->activeTarget() || !project->activeTarget()->activeRunConfiguration())
|
else {
|
||||||
errorMessage = QString(tr("No run configurations were found for the project '%1'.").arg(project->displayName()));
|
if (project->id() == "QmlProjectManager.QmlProject")
|
||||||
|
errorMessage = attachToQmlViewerAsExternalApp(project);
|
||||||
|
else {
|
||||||
|
errorMessage = attachToExternalCppAppWithQml(project);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!errorMessage.isEmpty())
|
||||||
|
QMessageBox::warning(Core::ICore::instance()->mainWindow(), "Failed to debug C++ and QML", errorMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString QmlInspector::attachToQmlViewerAsExternalApp(ProjectExplorer::Project *project)
|
||||||
|
{
|
||||||
|
m_debugMode = QmlProjectWithCppPlugins;
|
||||||
|
|
||||||
|
QmlProjectManager::QmlProjectRunConfiguration* runConfig =
|
||||||
|
qobject_cast<QmlProjectManager::QmlProjectRunConfiguration*>(project->activeTarget()->activeRunConfiguration());
|
||||||
|
|
||||||
|
if (!runConfig)
|
||||||
|
return QString(tr("No run configurations were found for the project '%1'.").arg(project->displayName()));
|
||||||
|
|
||||||
|
Internal::StartExternalQmlDialog dlg(Debugger::DebuggerUISwitcher::instance()->mainWindow());
|
||||||
|
|
||||||
|
QString importPathArgument = "-I";
|
||||||
|
QString execArgs;
|
||||||
|
if (runConfig->viewerArguments().contains(importPathArgument))
|
||||||
|
execArgs = runConfig->viewerArguments().join(" ");
|
||||||
|
else {
|
||||||
|
QFileInfo qmlFileInfo(runConfig->viewerArguments().last());
|
||||||
|
importPathArgument.append(" " + qmlFileInfo.absolutePath() + " ");
|
||||||
|
execArgs = importPathArgument + runConfig->viewerArguments().join(" ");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
dlg.setPort(runConfig->debugServerPort());
|
||||||
|
dlg.setDebuggerUrl(runConfig->debugServerAddress());
|
||||||
|
dlg.setProjectDisplayName(project->displayName());
|
||||||
|
dlg.setDebugMode(Internal::StartExternalQmlDialog::QmlProjectWithCppPlugins);
|
||||||
|
dlg.setQmlViewerArguments(execArgs);
|
||||||
|
dlg.setQmlViewerPath(runConfig->viewerPath());
|
||||||
|
|
||||||
|
if (dlg.exec() != QDialog::Accepted)
|
||||||
|
return QString();
|
||||||
|
|
||||||
|
m_runConfigurationDebugData.serverAddress = dlg.debuggerUrl();
|
||||||
|
m_runConfigurationDebugData.serverPort = dlg.port();
|
||||||
|
m_settings.setExternalPort(dlg.port());
|
||||||
|
m_settings.setExternalUrl(dlg.debuggerUrl());
|
||||||
|
|
||||||
|
ProjectExplorer::Environment customEnv = ProjectExplorer::Environment::systemEnvironment(); // empty env by default
|
||||||
|
customEnv.set(QmlProjectManager::Constants::E_QML_DEBUG_SERVER_PORT, QString::number(m_settings.externalPort()));
|
||||||
|
|
||||||
|
Debugger::Internal::DebuggerRunControl *debuggableRunControl = createDebuggerRunControl(runConfig,
|
||||||
|
dlg.qmlViewerPath(), dlg.qmlViewerArguments());
|
||||||
|
|
||||||
|
return executeDebuggerRunControl(debuggableRunControl, &customEnv);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString QmlInspector::attachToExternalCppAppWithQml(ProjectExplorer::Project *project)
|
||||||
|
{
|
||||||
|
m_debugMode = CppProjectWithQmlEngines;
|
||||||
|
|
||||||
|
ProjectExplorer::LocalApplicationRunConfiguration* runConfig =
|
||||||
|
qobject_cast<ProjectExplorer::LocalApplicationRunConfiguration*>(project->activeTarget()->activeRunConfiguration());
|
||||||
|
|
||||||
|
if (!project->activeTarget() || !project->activeTarget()->activeRunConfiguration())
|
||||||
|
return QString(tr("No run configurations were found for the project '%1'.").arg(project->displayName()));
|
||||||
else if (!runConfig)
|
else if (!runConfig)
|
||||||
errorMessage = QString(tr("No valid run configuration was found for the project %1. "
|
return QString(tr("No valid run configuration was found for the project %1. "
|
||||||
"Only locally runnable configurations are supported.\n"
|
"Only locally runnable configurations are supported.\n"
|
||||||
"Please check your project settings.").arg(project->displayName()));
|
"Please check your project settings.").arg(project->displayName()));
|
||||||
|
|
||||||
|
|
||||||
if (errorMessage.isEmpty()) {
|
|
||||||
|
|
||||||
Internal::StartExternalQmlDialog dlg(Debugger::DebuggerUISwitcher::instance()->mainWindow());
|
Internal::StartExternalQmlDialog dlg(Debugger::DebuggerUISwitcher::instance()->mainWindow());
|
||||||
|
|
||||||
dlg.setPort(m_settings.externalPort());
|
dlg.setPort(m_settings.externalPort());
|
||||||
dlg.setDebuggerUrl(m_settings.externalUrl());
|
dlg.setDebuggerUrl(m_settings.externalUrl());
|
||||||
dlg.setProjectDisplayName(project->displayName());
|
dlg.setProjectDisplayName(project->displayName());
|
||||||
|
dlg.setDebugMode(Internal::StartExternalQmlDialog::CppProjectWithQmlEngine);
|
||||||
if (dlg.exec() != QDialog::Accepted)
|
if (dlg.exec() != QDialog::Accepted)
|
||||||
return;
|
return QString();
|
||||||
|
|
||||||
m_runConfigurationDebugData.serverAddress = dlg.debuggerUrl();
|
m_runConfigurationDebugData.serverAddress = dlg.debuggerUrl();
|
||||||
m_runConfigurationDebugData.serverPort = dlg.port();
|
m_runConfigurationDebugData.serverPort = dlg.port();
|
||||||
@@ -507,39 +570,70 @@ void QmlInspector::attachToExternalQmlApplication()
|
|||||||
|
|
||||||
ProjectExplorer::Environment customEnv = runConfig->environment();
|
ProjectExplorer::Environment customEnv = runConfig->environment();
|
||||||
customEnv.set(QmlProjectManager::Constants::E_QML_DEBUG_SERVER_PORT, QString::number(m_settings.externalPort()));
|
customEnv.set(QmlProjectManager::Constants::E_QML_DEBUG_SERVER_PORT, QString::number(m_settings.externalPort()));
|
||||||
|
Debugger::Internal::DebuggerRunControl *debuggableRunControl = createDebuggerRunControl(runConfig);
|
||||||
|
return executeDebuggerRunControl(debuggableRunControl, &customEnv);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString QmlInspector::executeDebuggerRunControl(Debugger::Internal::DebuggerRunControl *debuggableRunControl, ProjectExplorer::Environment *environment)
|
||||||
|
{
|
||||||
|
ProjectExplorer::ProjectExplorerPlugin *pex = ProjectExplorer::ProjectExplorerPlugin::instance();
|
||||||
|
|
||||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
|
||||||
const QList<Debugger::Internal::DebuggerRunControlFactory *> factories = pm->getObjects<Debugger::Internal::DebuggerRunControlFactory>();
|
|
||||||
// to make sure we have a valid, debuggable run control, find the correct factory for it
|
// to make sure we have a valid, debuggable run control, find the correct factory for it
|
||||||
if (factories.length() && factories.first()->canRun(runConfig, ProjectExplorer::Constants::DEBUGMODE)) {
|
if (debuggableRunControl) {
|
||||||
|
|
||||||
|
|
||||||
ProjectExplorer::RunControl *runControl = factories.first()->create(runConfig, ProjectExplorer::Constants::DEBUGMODE);
|
|
||||||
Debugger::Internal::DebuggerRunControl *debuggableRunControl = qobject_cast<Debugger::Internal::DebuggerRunControl *>(runControl);
|
|
||||||
// modify the env
|
// modify the env
|
||||||
debuggableRunControl->setCustomEnvironment(customEnv);
|
debuggableRunControl->setCustomEnvironment(*environment);
|
||||||
|
|
||||||
Debugger::DebuggerManager *debugManager = Debugger::DebuggerManager::instance();
|
|
||||||
connect(debugManager, SIGNAL(stateChanged(int)), this, SLOT(debuggerStateChanged(int)));
|
|
||||||
|
|
||||||
pex->startRunControl(debuggableRunControl, ProjectExplorer::Constants::DEBUGMODE);
|
pex->startRunControl(debuggableRunControl, ProjectExplorer::Constants::DEBUGMODE);
|
||||||
m_simultaneousCppAndQmlDebugMode = true;
|
m_simultaneousCppAndQmlDebugMode = true;
|
||||||
|
|
||||||
} else {
|
return QString();
|
||||||
errorMessage = QString(tr("A valid run control was not registered in Qt Creator for this project run configuration."));
|
}
|
||||||
|
return QString(tr("A valid run control was not registered in Qt Creator for this project run configuration."));;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Debugger::Internal::DebuggerRunControl *QmlInspector::createDebuggerRunControl(ProjectExplorer::RunConfiguration *runConfig,
|
||||||
|
const QString &executableFile, const QString &executableArguments)
|
||||||
|
{
|
||||||
|
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||||
|
const QList<Debugger::Internal::DebuggerRunControlFactory *> factories = pm->getObjects<Debugger::Internal::DebuggerRunControlFactory>();
|
||||||
|
ProjectExplorer::RunControl *runControl = 0;
|
||||||
|
if (m_debugMode == QmlProjectWithCppPlugins) {
|
||||||
|
|
||||||
|
const Debugger::DebuggerStartParametersPtr sp(new Debugger::DebuggerStartParameters);
|
||||||
|
sp->startMode = Debugger::StartExternal;
|
||||||
|
sp->executable = executableFile;
|
||||||
|
sp->processArgs = executableArguments.split(QLatin1Char(' '));
|
||||||
|
|
||||||
|
runControl = factories.first()->create(sp);
|
||||||
|
return qobject_cast<Debugger::Internal::DebuggerRunControl *>(runControl);
|
||||||
|
|
||||||
|
} else if (m_debugMode == CppProjectWithQmlEngines) {
|
||||||
|
if (factories.length() && factories.first()->canRun(runConfig, ProjectExplorer::Constants::DEBUGMODE)) {
|
||||||
|
runControl = factories.first()->create(runConfig, ProjectExplorer::Constants::DEBUGMODE);
|
||||||
|
return qobject_cast<Debugger::Internal::DebuggerRunControl *>(runControl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!errorMessage.isEmpty())
|
return 0;
|
||||||
QMessageBox::warning(Core::ICore::instance()->mainWindow(), "Failed to debug C++ and QML", errorMessage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QmlInspector::updateMenuActions()
|
||||||
|
{
|
||||||
|
|
||||||
|
bool enabled = true;
|
||||||
|
if (m_simultaneousCppAndQmlDebugMode)
|
||||||
|
enabled = (m_cppDebuggerState == Debugger::DebuggerNotReady && (!m_conn || m_conn->state() == QAbstractSocket::UnconnectedState));
|
||||||
|
else
|
||||||
|
enabled = (!m_conn || m_conn->state() == QAbstractSocket::UnconnectedState);
|
||||||
|
|
||||||
|
m_simultaneousDebugAction->setEnabled(enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void QmlInspector::debuggerStateChanged(int newState)
|
void QmlInspector::debuggerStateChanged(int newState)
|
||||||
{
|
{
|
||||||
if (!m_simultaneousCppAndQmlDebugMode)
|
if (m_simultaneousCppAndQmlDebugMode) {
|
||||||
return;
|
|
||||||
|
|
||||||
switch(newState) {
|
switch(newState) {
|
||||||
case Debugger::EngineStarting:
|
case Debugger::EngineStarting:
|
||||||
@@ -549,7 +643,6 @@ void QmlInspector::debuggerStateChanged(int newState)
|
|||||||
}
|
}
|
||||||
case Debugger::AdapterStartFailed:
|
case Debugger::AdapterStartFailed:
|
||||||
case Debugger::InferiorStartFailed:
|
case Debugger::InferiorStartFailed:
|
||||||
disconnect(Debugger::DebuggerManager::instance(), SIGNAL(stateChanged(int)), this, SLOT(debuggerStateChanged(int)));
|
|
||||||
emit statusMessage(QString(tr("Debugging failed: could not start C++ debugger.")));
|
emit statusMessage(QString(tr("Debugging failed: could not start C++ debugger.")));
|
||||||
break;
|
break;
|
||||||
case Debugger::InferiorRunningRequested:
|
case Debugger::InferiorRunningRequested:
|
||||||
@@ -567,7 +660,7 @@ void QmlInspector::debuggerStateChanged(int newState)
|
|||||||
if (!m_connectionInitialized) {
|
if (!m_connectionInitialized) {
|
||||||
m_connectionInitialized = true;
|
m_connectionInitialized = true;
|
||||||
m_connectionTimer->setInterval(ConnectionAttemptSimultaneousInterval);
|
m_connectionTimer->setInterval(ConnectionAttemptSimultaneousInterval);
|
||||||
startConnectionTimer();
|
m_connectionTimer->start();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -592,7 +685,10 @@ void QmlInspector::debuggerStateChanged(int newState)
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_cppDebuggerState = newState;
|
m_cppDebuggerState = newState;
|
||||||
|
updateMenuActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -56,11 +56,17 @@ QT_END_NAMESPACE
|
|||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
class Project;
|
class Project;
|
||||||
|
class Environment;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
class IContext;
|
class IContext;
|
||||||
}
|
}
|
||||||
|
namespace Debugger {
|
||||||
|
namespace Internal {
|
||||||
|
class DebuggerRunControl;
|
||||||
|
} // Internal
|
||||||
|
} // Debugger
|
||||||
|
|
||||||
namespace Qml {
|
namespace Qml {
|
||||||
|
|
||||||
@@ -85,6 +91,12 @@ class QMLINSPECTOR_EXPORT QmlInspector : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
enum DebugMode {
|
||||||
|
StandaloneMode,
|
||||||
|
CppProjectWithQmlEngines,
|
||||||
|
QmlProjectWithCppPlugins
|
||||||
|
};
|
||||||
|
|
||||||
QmlInspector(QObject *parent = 0);
|
QmlInspector(QObject *parent = 0);
|
||||||
~QmlInspector();
|
~QmlInspector();
|
||||||
|
|
||||||
@@ -109,7 +121,6 @@ public slots:
|
|||||||
void setSimpleDockWidgetArrangement();
|
void setSimpleDockWidgetArrangement();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void startConnectionTimer();
|
|
||||||
void connectionStateChanged();
|
void connectionStateChanged();
|
||||||
void connectionError();
|
void connectionError();
|
||||||
void reloadEngines();
|
void reloadEngines();
|
||||||
@@ -117,12 +128,20 @@ private slots:
|
|||||||
void queryEngineContext(int);
|
void queryEngineContext(int);
|
||||||
void contextChanged();
|
void contextChanged();
|
||||||
void treeObjectActivated(const QDeclarativeDebugObjectReference &obj);
|
void treeObjectActivated(const QDeclarativeDebugObjectReference &obj);
|
||||||
void attachToExternalQmlApplication();
|
void simultaneouslyDebugQmlCppApplication();
|
||||||
|
|
||||||
void debuggerStateChanged(int newState);
|
void debuggerStateChanged(int newState);
|
||||||
void pollInspector();
|
void pollInspector();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void updateMenuActions();
|
||||||
|
Debugger::Internal::DebuggerRunControl *createDebuggerRunControl(ProjectExplorer::RunConfiguration *runConfig,
|
||||||
|
const QString &executableFile = QString(),
|
||||||
|
const QString &executableArguments = QString());
|
||||||
|
QString executeDebuggerRunControl(Debugger::Internal::DebuggerRunControl *debuggableRunControl, ProjectExplorer::Environment *environment);
|
||||||
|
QString attachToQmlViewerAsExternalApp(ProjectExplorer::Project *project);
|
||||||
|
QString attachToExternalCppAppWithQml(ProjectExplorer::Project *project);
|
||||||
|
|
||||||
bool addQuotesForData(const QVariant &value) const;
|
bool addQuotesForData(const QVariant &value) const;
|
||||||
void resetViews();
|
void resetViews();
|
||||||
|
|
||||||
@@ -151,6 +170,8 @@ private:
|
|||||||
Internal::InspectorContext *m_context;
|
Internal::InspectorContext *m_context;
|
||||||
Internal::InspectorContext *m_propWatcherContext;
|
Internal::InspectorContext *m_propWatcherContext;
|
||||||
|
|
||||||
|
QAction *m_simultaneousDebugAction;
|
||||||
|
|
||||||
QTimer *m_connectionTimer;
|
QTimer *m_connectionTimer;
|
||||||
int m_connectionAttempts;
|
int m_connectionAttempts;
|
||||||
|
|
||||||
@@ -159,9 +180,11 @@ private:
|
|||||||
|
|
||||||
QStringList m_editablePropertyTypes;
|
QStringList m_editablePropertyTypes;
|
||||||
|
|
||||||
|
// simultaneous debug mode stuff
|
||||||
int m_cppDebuggerState;
|
int m_cppDebuggerState;
|
||||||
bool m_connectionInitialized;
|
bool m_connectionInitialized;
|
||||||
bool m_simultaneousCppAndQmlDebugMode;
|
bool m_simultaneousCppAndQmlDebugMode;
|
||||||
|
DebugMode m_debugMode;
|
||||||
|
|
||||||
static QmlInspector *m_instance;
|
static QmlInspector *m_instance;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace Qml {
|
|||||||
const char * const C_INSPECTOR = "QmlInspector";
|
const char * const C_INSPECTOR = "QmlInspector";
|
||||||
const char * const COMPLETE_THIS = "QmlInspector.CompleteThis";
|
const char * const COMPLETE_THIS = "QmlInspector.CompleteThis";
|
||||||
|
|
||||||
const char * const M_ATTACH_TO_EXTERNAL = "QmlInspector.Menu.AttachToExternal";
|
const char * const M_DEBUG_SIMULTANEOUSLY = "QmlInspector.Menu.SimultaneousDebug";
|
||||||
|
|
||||||
const char * const LANG_QML = "QML";
|
const char * const LANG_QML = "QML";
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace Internal {
|
|||||||
|
|
||||||
|
|
||||||
StartExternalQmlDialog::StartExternalQmlDialog(QWidget *parent)
|
StartExternalQmlDialog::StartExternalQmlDialog(QWidget *parent)
|
||||||
: QDialog(parent), m_ui(new Ui::StartExternalQmlDialog)
|
: QDialog(parent), m_ui(new Ui::StartExternalQmlDialog), m_debugMode(QmlProjectWithCppPlugins)
|
||||||
{
|
{
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
|
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
|
||||||
@@ -50,5 +50,45 @@ void StartExternalQmlDialog::setProjectDisplayName(const QString &projectName)
|
|||||||
m_ui->projectDisplayName->setText(projectName);
|
m_ui->projectDisplayName->setText(projectName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void StartExternalQmlDialog::setQmlViewerPath(const QString &path)
|
||||||
|
{
|
||||||
|
m_ui->viewerPathLineEdit->setText(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString StartExternalQmlDialog::qmlViewerPath() const
|
||||||
|
{
|
||||||
|
return m_ui->viewerPathLineEdit->text();
|
||||||
|
}
|
||||||
|
|
||||||
|
void StartExternalQmlDialog::setQmlViewerArguments(const QString &arguments)
|
||||||
|
{
|
||||||
|
m_ui->viewerArgumentsLineEdit->setText(arguments);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString StartExternalQmlDialog::qmlViewerArguments() const
|
||||||
|
{
|
||||||
|
return m_ui->viewerArgumentsLineEdit->text();
|
||||||
|
}
|
||||||
|
|
||||||
|
void StartExternalQmlDialog::setDebugMode(DebugMode mode)
|
||||||
|
{
|
||||||
|
m_debugMode = mode;
|
||||||
|
if (m_debugMode == QmlProjectWithCppPlugins) {
|
||||||
|
m_ui->labelViewerPath->show();
|
||||||
|
m_ui->viewerPathLineEdit->show();
|
||||||
|
m_ui->labelViewerArguments->show();
|
||||||
|
m_ui->viewerArgumentsLineEdit->show();
|
||||||
|
setMinimumHeight(270);
|
||||||
|
resize(width(), 270);
|
||||||
|
} else {
|
||||||
|
m_ui->labelViewerPath->hide();
|
||||||
|
m_ui->viewerPathLineEdit->hide();
|
||||||
|
m_ui->labelViewerArguments->hide();
|
||||||
|
m_ui->viewerArgumentsLineEdit->hide();
|
||||||
|
setMinimumHeight(200);
|
||||||
|
resize(width(), 200);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // Internal
|
} // Internal
|
||||||
} // Qml
|
} // Qml
|
||||||
|
|||||||
@@ -21,6 +21,19 @@ public:
|
|||||||
explicit StartExternalQmlDialog(QWidget *parent);
|
explicit StartExternalQmlDialog(QWidget *parent);
|
||||||
~StartExternalQmlDialog();
|
~StartExternalQmlDialog();
|
||||||
|
|
||||||
|
enum DebugMode {
|
||||||
|
QmlProjectWithCppPlugins,
|
||||||
|
CppProjectWithQmlEngine
|
||||||
|
};
|
||||||
|
|
||||||
|
void setDebugMode(DebugMode mode);
|
||||||
|
|
||||||
|
void setQmlViewerPath(const QString &path);
|
||||||
|
QString qmlViewerPath() const;
|
||||||
|
|
||||||
|
void setQmlViewerArguments(const QString &arguments);
|
||||||
|
QString qmlViewerArguments() const;
|
||||||
|
|
||||||
void setDebuggerUrl(const QString &url);
|
void setDebuggerUrl(const QString &url);
|
||||||
QString debuggerUrl() const;
|
QString debuggerUrl() const;
|
||||||
|
|
||||||
@@ -33,6 +46,7 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::StartExternalQmlDialog *m_ui;
|
Ui::StartExternalQmlDialog *m_ui;
|
||||||
|
DebugMode m_debugMode;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // Internal
|
} // Internal
|
||||||
|
|||||||
@@ -7,11 +7,17 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>425</width>
|
<width>425</width>
|
||||||
<height>198</height>
|
<height>278</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>425</width>
|
||||||
|
<height>278</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Start Debugging QML and C++ simultaneously</string>
|
<string>Start Simultaneous QML and C++ Debugging </string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout">
|
<layout class="QVBoxLayout">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
@@ -73,6 +79,26 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<widget class="QLabel" name="labelViewerPath">
|
||||||
|
<property name="text">
|
||||||
|
<string>Viewer path:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1">
|
||||||
|
<widget class="QLineEdit" name="viewerPathLineEdit"/>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="0">
|
||||||
|
<widget class="QLabel" name="labelViewerArguments">
|
||||||
|
<property name="text">
|
||||||
|
<string>Viewer arguments:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="1">
|
||||||
|
<widget class="QLineEdit" name="viewerArgumentsLineEdit"/>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|||||||
Reference in New Issue
Block a user