forked from qt-creator/qt-creator
Added debugging mode for simultaneous QML and C++ debugging
It's not yet possible to attach to an external app running a qml debugging server, because the server is only started on startup if an env variable is set. Changing this requires action from Brisbane, but even the current solution works for C++ apps with QML in them. Task-number: BAUHAUS-585 Reviewed-by: dt
This commit is contained in:
@@ -1771,6 +1771,8 @@ void DebuggerManager::setState(DebuggerState state, bool forced)
|
|||||||
|
|
||||||
d->m_state = state;
|
d->m_state = state;
|
||||||
|
|
||||||
|
emit stateChanged(state);
|
||||||
|
|
||||||
//if (d->m_state == InferiorStopped)
|
//if (d->m_state == InferiorStopped)
|
||||||
// resetLocation();
|
// resetLocation();
|
||||||
|
|
||||||
|
@@ -169,6 +169,11 @@ DebuggerRunControl::DebuggerRunControl(DebuggerManager *manager, const DebuggerS
|
|||||||
m_startParameters->useTerminal = false;
|
m_startParameters->useTerminal = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DebuggerRunControl::setCustomEnvironment(ProjectExplorer::Environment env)
|
||||||
|
{
|
||||||
|
m_startParameters->environment = env.toStringList();
|
||||||
|
}
|
||||||
|
|
||||||
void DebuggerRunControl::init()
|
void DebuggerRunControl::init()
|
||||||
{
|
{
|
||||||
connect(m_manager, SIGNAL(debuggingFinished()),
|
connect(m_manager, SIGNAL(debuggingFinished()),
|
||||||
|
@@ -31,14 +31,14 @@
|
|||||||
#define DEBUGGERRUNNER_H
|
#define DEBUGGERRUNNER_H
|
||||||
|
|
||||||
#include "debuggermanager.h"
|
#include "debuggermanager.h"
|
||||||
|
#include "debugger_global.h"
|
||||||
#include <projectexplorer/runconfiguration.h>
|
#include <projectexplorer/runconfiguration.h>
|
||||||
#include <projectexplorer/applicationrunconfiguration.h>
|
#include <projectexplorer/applicationrunconfiguration.h>
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class DebuggerRunControlFactory
|
class DEBUGGER_EXPORT DebuggerRunControlFactory
|
||||||
: public ProjectExplorer::IRunControlFactory
|
: public ProjectExplorer::IRunControlFactory
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -63,7 +63,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
// This is a job description
|
// This is a job description
|
||||||
class DebuggerRunControl
|
class DEBUGGER_EXPORT DebuggerRunControl
|
||||||
: public ProjectExplorer::RunControl
|
: public ProjectExplorer::RunControl
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -73,6 +73,7 @@ public:
|
|||||||
ProjectExplorer::LocalApplicationRunConfiguration *runConfiguration);
|
ProjectExplorer::LocalApplicationRunConfiguration *runConfiguration);
|
||||||
DebuggerRunControl(DebuggerManager *manager, const DebuggerStartParametersPtr &startParameters);
|
DebuggerRunControl(DebuggerManager *manager, const DebuggerStartParametersPtr &startParameters);
|
||||||
|
|
||||||
|
void setCustomEnvironment(ProjectExplorer::Environment env);
|
||||||
|
|
||||||
// ProjectExplorer::RunControl
|
// ProjectExplorer::RunControl
|
||||||
virtual void start();
|
virtual void start();
|
||||||
|
@@ -263,9 +263,12 @@ void DebuggerUISwitcher::addLanguage(const QString &langName, const QList<int> &
|
|||||||
|
|
||||||
d->m_languageActionGroup->addAction(langChange);
|
d->m_languageActionGroup->addAction(langChange);
|
||||||
|
|
||||||
|
QString prefix = tr("Alt+L");
|
||||||
connect(langChange, SIGNAL(triggered()), SLOT(langChangeTriggered()));
|
connect(langChange, SIGNAL(triggered()), SLOT(langChangeTriggered()));
|
||||||
Core::Command *cmd = am->registerAction(langChange,
|
Core::Command *cmd = am->registerAction(langChange,
|
||||||
"Debugger.Language." + langName, d->m_globalContext);
|
"Debugger.Language." + langName, d->m_globalContext);
|
||||||
|
cmd->setDefaultKeySequence(QKeySequence(QString("%1,%2").arg(prefix, QString::number(d->m_languages.count()))));
|
||||||
|
|
||||||
d->m_languageMenu->addAction(cmd);
|
d->m_languageMenu->addAction(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -178,7 +178,7 @@ bool WatchTableModel::setData ( const QModelIndex & index, const QVariant & valu
|
|||||||
Qt::ItemFlags WatchTableModel::flags ( const QModelIndex & index ) const
|
Qt::ItemFlags WatchTableModel::flags ( const QModelIndex & index ) const
|
||||||
{
|
{
|
||||||
if (index.column() == C_VALUE)
|
if (index.column() == C_VALUE)
|
||||||
return Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled;
|
return Qt::ItemIsSelectable | Qt::ItemIsEnabled; // Qt::ItemIsEditable | <- disabled for now
|
||||||
|
|
||||||
return Qt::ItemIsSelectable | Qt::ItemIsEnabled;
|
return Qt::ItemIsSelectable | Qt::ItemIsEnabled;
|
||||||
}
|
}
|
||||||
|
50
src/plugins/qmlinspector/inspectorsettings.cpp
Normal file
50
src/plugins/qmlinspector/inspectorsettings.cpp
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
#include "inspectorsettings.h"
|
||||||
|
#include "qmlinspectorconstants.h"
|
||||||
|
#include <QtCore/QSettings>
|
||||||
|
|
||||||
|
namespace Qml {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
|
InspectorSettings::InspectorSettings() : m_externalPort(3768), m_externalUrl("127.0.0.1")
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void InspectorSettings::readSettings(QSettings *settings)
|
||||||
|
{
|
||||||
|
settings->beginGroup(QLatin1String(Qml::Constants::S_QML_INSPECTOR));
|
||||||
|
m_externalPort= settings->value(QLatin1String(Qml::Constants::S_EXTERNALPORT_KEY), 3768).toUInt();
|
||||||
|
m_externalUrl = settings->value(QLatin1String(Qml::Constants::S_EXTERNALURL_KEY), "127.0.0.1").toString();
|
||||||
|
settings->endGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
void InspectorSettings::saveSettings(QSettings *settings) const
|
||||||
|
{
|
||||||
|
settings->beginGroup(QLatin1String(Qml::Constants::S_QML_INSPECTOR));
|
||||||
|
settings->setValue(QLatin1String(Qml::Constants::S_EXTERNALPORT_KEY), m_externalPort);
|
||||||
|
settings->setValue(QLatin1String(Qml::Constants::S_EXTERNALURL_KEY), m_externalUrl);
|
||||||
|
settings->endGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
quint16 InspectorSettings::externalPort() const
|
||||||
|
{
|
||||||
|
return m_externalPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString InspectorSettings::externalUrl() const
|
||||||
|
{
|
||||||
|
return m_externalUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void InspectorSettings::setExternalPort(quint16 port)
|
||||||
|
{
|
||||||
|
m_externalPort = port;
|
||||||
|
}
|
||||||
|
|
||||||
|
void InspectorSettings::setExternalUrl(const QString &url)
|
||||||
|
{
|
||||||
|
m_externalUrl = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // Internal
|
||||||
|
} // Qml
|
34
src/plugins/qmlinspector/inspectorsettings.h
Normal file
34
src/plugins/qmlinspector/inspectorsettings.h
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
#ifndef INSPECTORSETTINGS_H
|
||||||
|
#define INSPECTORSETTINGS_H
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
#include "inspectorsettings.h"
|
||||||
|
|
||||||
|
QT_FORWARD_DECLARE_CLASS(QSettings)
|
||||||
|
|
||||||
|
namespace Qml {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
|
class InspectorSettings
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
InspectorSettings();
|
||||||
|
|
||||||
|
void readSettings(QSettings *settings);
|
||||||
|
void saveSettings(QSettings *settings) const;
|
||||||
|
|
||||||
|
void setExternalPort(quint16 port);
|
||||||
|
void setExternalUrl(const QString &url);
|
||||||
|
quint16 externalPort() const;
|
||||||
|
QString externalUrl() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
quint16 m_externalPort;
|
||||||
|
QString m_externalUrl;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
} // Internal
|
||||||
|
} // Qml
|
||||||
|
|
||||||
|
#endif // INSPECTORSETTINGS_H
|
@@ -31,15 +31,17 @@
|
|||||||
#include "qmlinspector.h"
|
#include "qmlinspector.h"
|
||||||
#include "inspectoroutputwidget.h"
|
#include "inspectoroutputwidget.h"
|
||||||
#include "inspectorcontext.h"
|
#include "inspectorcontext.h"
|
||||||
|
#include "startexternalqmldialog.h"
|
||||||
#include "components/objecttree.h"
|
#include "components/objecttree.h"
|
||||||
#include "components/watchtable.h"
|
#include "components/watchtable.h"
|
||||||
#include "components/canvasframerate.h"
|
#include "components/canvasframerate.h"
|
||||||
#include "components/expressionquerywidget.h"
|
#include "components/expressionquerywidget.h"
|
||||||
#include "components/objectpropertiesview.h"
|
#include "components/objectpropertiesview.h"
|
||||||
|
|
||||||
|
#include <debugger/debuggerrunner.h>
|
||||||
#include <debugger/debuggermainwindow.h>
|
#include <debugger/debuggermainwindow.h>
|
||||||
#include <debugger/debuggeruiswitcher.h>
|
#include <debugger/debuggeruiswitcher.h>
|
||||||
|
#include <debugger/debuggerconstants.h>
|
||||||
|
|
||||||
#include <utils/styledbar.h>
|
#include <utils/styledbar.h>
|
||||||
#include <utils/fancymainwindow.h>
|
#include <utils/fancymainwindow.h>
|
||||||
@@ -54,7 +56,9 @@
|
|||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
#include <coreplugin/uniqueidmanager.h>
|
#include <coreplugin/uniqueidmanager.h>
|
||||||
|
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||||
|
#include <coreplugin/actionmanager/actionmanager.h>
|
||||||
|
#include <coreplugin/actionmanager/command.h>
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
|
|
||||||
#include <texteditor/itexteditor.h>
|
#include <texteditor/itexteditor.h>
|
||||||
@@ -64,9 +68,12 @@
|
|||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
#include <projectexplorer/target.h>
|
#include <projectexplorer/target.h>
|
||||||
|
#include <projectexplorer/applicationrunconfiguration.h>
|
||||||
|
#include <qmlprojectmanager/qmlprojectconstants.h>
|
||||||
#include <qmlprojectmanager/qmlprojectrunconfiguration.h>
|
#include <qmlprojectmanager/qmlprojectrunconfiguration.h>
|
||||||
|
|
||||||
|
#include <extensionsystem/pluginmanager.h>
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/QStringList>
|
#include <QtCore/QStringList>
|
||||||
#include <QtCore/QTimer>
|
#include <QtCore/QTimer>
|
||||||
@@ -81,6 +88,7 @@
|
|||||||
#include <QtGui/QLineEdit>
|
#include <QtGui/QLineEdit>
|
||||||
#include <QtGui/QLabel>
|
#include <QtGui/QLabel>
|
||||||
#include <QtGui/QSpinBox>
|
#include <QtGui/QSpinBox>
|
||||||
|
#include <QtGui/QMessageBox>
|
||||||
|
|
||||||
#include <QtNetwork/QHostAddress>
|
#include <QtNetwork/QHostAddress>
|
||||||
|
|
||||||
@@ -168,7 +176,9 @@ QmlInspector::QmlInspector(QObject *parent)
|
|||||||
m_objectTreeDock(0),
|
m_objectTreeDock(0),
|
||||||
m_frameRateDock(0),
|
m_frameRateDock(0),
|
||||||
m_propertyWatcherDock(0),
|
m_propertyWatcherDock(0),
|
||||||
m_inspectorOutputDock(0)
|
m_inspectorOutputDock(0),
|
||||||
|
m_connectionTimer(new QTimer(this)),
|
||||||
|
m_connectionAttempts(0)
|
||||||
{
|
{
|
||||||
m_watchTableModel = new Internal::WatchTableModel(0, this);
|
m_watchTableModel = new Internal::WatchTableModel(0, this);
|
||||||
|
|
||||||
@@ -178,6 +188,55 @@ QmlInspector::QmlInspector(QObject *parent)
|
|||||||
m_frameRateWidget = new Internal::CanvasFrameRate;
|
m_frameRateWidget = new Internal::CanvasFrameRate;
|
||||||
m_frameRateWidget->setObjectName(QLatin1String("QmlDebugFrameRate"));
|
m_frameRateWidget->setObjectName(QLatin1String("QmlDebugFrameRate"));
|
||||||
m_expressionWidget = new Internal::ExpressionQueryWidget(Internal::ExpressionQueryWidget::SeparateEntryMode);
|
m_expressionWidget = new Internal::ExpressionQueryWidget(Internal::ExpressionQueryWidget::SeparateEntryMode);
|
||||||
|
|
||||||
|
connect(m_connectionTimer, SIGNAL(timeout()), SLOT(pollInspector()));
|
||||||
|
}
|
||||||
|
|
||||||
|
QmlInspector::~QmlInspector()
|
||||||
|
{
|
||||||
|
m_settings.saveSettings(Core::ICore::instance()->settings());
|
||||||
|
}
|
||||||
|
|
||||||
|
void QmlInspector::pollInspector()
|
||||||
|
{
|
||||||
|
++m_connectionAttempts;
|
||||||
|
if (connectToViewer()) {
|
||||||
|
m_connectionTimer->stop();
|
||||||
|
m_connectionAttempts = 0;
|
||||||
|
} else if (m_connectionAttempts == MaxConnectionAttempts) {
|
||||||
|
m_connectionTimer->stop();
|
||||||
|
m_connectionAttempts = 0;
|
||||||
|
|
||||||
|
QMessageBox::critical(0,
|
||||||
|
tr("Failed to connect to debugger"),
|
||||||
|
tr("Could not connect to debugger server.") );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QmlInspector::setDebugConfigurationDataFromProject(ProjectExplorer::Project *projectToDebug)
|
||||||
|
{
|
||||||
|
//ProjectExplorer::Project *project = ProjectExplorer::ProjectExplorerPlugin::instance()->startupProject();
|
||||||
|
if (!projectToDebug) {
|
||||||
|
emit statusMessage(tr("Invalid project, debugging canceled."));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
QmlProjectManager::QmlProjectRunConfiguration* config =
|
||||||
|
qobject_cast<QmlProjectManager::QmlProjectRunConfiguration*>(projectToDebug->activeTarget()->activeRunConfiguration());
|
||||||
|
if (!config) {
|
||||||
|
emit statusMessage(tr("Cannot find project run configuration, debugging canceled."));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
m_runConfigurationDebugData.serverAddress = config->debugServerAddress();
|
||||||
|
m_runConfigurationDebugData.serverPort = config->debugServerPort();
|
||||||
|
m_connectionTimer->setInterval(ConnectionAttemptDefaultInterval);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QmlInspector::startConnectionTimer()
|
||||||
|
{
|
||||||
|
m_connectionTimer->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QmlInspector::connectToViewer()
|
bool QmlInspector::connectToViewer()
|
||||||
@@ -193,23 +252,8 @@ bool QmlInspector::connectToViewer()
|
|||||||
m_conn = 0;
|
m_conn = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectExplorer::Project *project = ProjectExplorer::ProjectExplorerPlugin::instance()->startupProject();
|
QString host = m_runConfigurationDebugData.serverAddress;
|
||||||
if (!project) {
|
quint16 port = quint16(m_runConfigurationDebugData.serverPort);
|
||||||
emit statusMessage(tr("No active project, debugging canceled."));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIXME if we have c++ project with qml files in it, it would make sense to be able to start
|
|
||||||
// the qml inspector simultaneously for that project. however, now it's not possible.
|
|
||||||
QmlProjectManager::QmlProjectRunConfiguration* config =
|
|
||||||
qobject_cast<QmlProjectManager::QmlProjectRunConfiguration*>(project->activeTarget()->activeRunConfiguration());
|
|
||||||
if (!config) {
|
|
||||||
emit statusMessage(tr("Cannot find project run configuration, debugging canceled."));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString host = config->debugServerAddress();
|
|
||||||
quint16 port = quint16(config->debugServerPort());
|
|
||||||
|
|
||||||
m_conn = new QDeclarativeDebugConnection(this);
|
m_conn = new QDeclarativeDebugConnection(this);
|
||||||
connect(m_conn, SIGNAL(stateChanged(QAbstractSocket::SocketState)),
|
connect(m_conn, SIGNAL(stateChanged(QAbstractSocket::SocketState)),
|
||||||
@@ -399,6 +443,20 @@ void QmlInspector::createDockWidgets()
|
|||||||
core->addContextObject(m_propWatcherContext);
|
core->addContextObject(m_propWatcherContext);
|
||||||
core->addContextObject(m_context);
|
core->addContextObject(m_context);
|
||||||
|
|
||||||
|
QAction *attachToExternalAction = new QAction(this);
|
||||||
|
attachToExternalAction->setText(tr("Start Debugging C++ and QML Simultaneously..."));
|
||||||
|
connect(attachToExternalAction, SIGNAL(triggered()),
|
||||||
|
this, SLOT(attachToExternalQmlApplication()));
|
||||||
|
|
||||||
|
Core::ActionManager *am = core->actionManager();
|
||||||
|
Core::ActionContainer *mstart = am->actionContainer(ProjectExplorer::Constants::M_DEBUG_STARTDEBUGGING);
|
||||||
|
Core::Command *cmd = am->registerAction(attachToExternalAction, Constants::M_ATTACH_TO_EXTERNAL,
|
||||||
|
QList<int>() << m_context->context());
|
||||||
|
cmd->setAttribute(Core::Command::CA_Hide);
|
||||||
|
mstart->addAction(cmd, Core::Constants::G_DEFAULT_ONE);
|
||||||
|
|
||||||
|
m_settings.readSettings(core->settings());
|
||||||
|
|
||||||
connect(m_objectTreeWidget, SIGNAL(contextHelpIdChanged(QString)), m_context,
|
connect(m_objectTreeWidget, SIGNAL(contextHelpIdChanged(QString)), m_context,
|
||||||
SLOT(setContextHelpId(QString)));
|
SLOT(setContextHelpId(QString)));
|
||||||
connect(m_watchTableView, SIGNAL(contextHelpIdChanged(QString)), m_propWatcherContext,
|
connect(m_watchTableView, SIGNAL(contextHelpIdChanged(QString)), m_propWatcherContext,
|
||||||
@@ -409,6 +467,91 @@ void QmlInspector::createDockWidgets()
|
|||||||
SLOT(setContextHelpId(QString)));
|
SLOT(setContextHelpId(QString)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QmlInspector::attachToExternalQmlApplication()
|
||||||
|
{
|
||||||
|
ProjectExplorer::ProjectExplorerPlugin *pex = ProjectExplorer::ProjectExplorerPlugin::instance();
|
||||||
|
ProjectExplorer::Project *project = pex->startupProject();
|
||||||
|
ProjectExplorer::LocalApplicationRunConfiguration* runConfig =
|
||||||
|
qobject_cast<ProjectExplorer::LocalApplicationRunConfiguration*>(project->activeTarget()->activeRunConfiguration());
|
||||||
|
|
||||||
|
QString errorMessage;
|
||||||
|
|
||||||
|
if (!project)
|
||||||
|
errorMessage = QString(tr("No project was found."));
|
||||||
|
else if (!project->activeTarget() || !project->activeTarget()->activeRunConfiguration())
|
||||||
|
errorMessage = QString(tr("No run configurations were found for the project '%1'.").arg(project->displayName()));
|
||||||
|
else if (!runConfig)
|
||||||
|
errorMessage = QString(tr("No valid run configuration was found for the project %1. "
|
||||||
|
"Only locally runnable configurations are supported.\n"
|
||||||
|
"Please check your project settings.").arg(project->displayName()));
|
||||||
|
|
||||||
|
|
||||||
|
if (errorMessage.isEmpty()) {
|
||||||
|
|
||||||
|
Internal::StartExternalQmlDialog dlg(Debugger::DebuggerUISwitcher::instance()->mainWindow());
|
||||||
|
|
||||||
|
dlg.setPort(m_settings.externalPort());
|
||||||
|
dlg.setDebuggerUrl(m_settings.externalUrl());
|
||||||
|
dlg.setProjectDisplayName(project->displayName());
|
||||||
|
if (dlg.exec() != QDialog::Accepted)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_runConfigurationDebugData.serverAddress = dlg.debuggerUrl();
|
||||||
|
m_runConfigurationDebugData.serverPort = dlg.port();
|
||||||
|
m_settings.setExternalPort(dlg.port());
|
||||||
|
m_settings.setExternalUrl(dlg.debuggerUrl());
|
||||||
|
|
||||||
|
ProjectExplorer::Environment customEnv = runConfig->environment();
|
||||||
|
customEnv.set(QmlProjectManager::Constants::E_QML_DEBUG_SERVER_PORT, QString::number(m_settings.externalPort()));
|
||||||
|
|
||||||
|
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
|
||||||
|
if (factories.length() && factories.first()->canRun(runConfig, ProjectExplorer::Constants::DEBUGMODE)) {
|
||||||
|
|
||||||
|
|
||||||
|
ProjectExplorer::RunControl *runControl = factories.first()->create(runConfig, ProjectExplorer::Constants::DEBUGMODE);
|
||||||
|
Debugger::Internal::DebuggerRunControl *debuggableRunControl = qobject_cast<Debugger::Internal::DebuggerRunControl *>(runControl);
|
||||||
|
// modify the env
|
||||||
|
debuggableRunControl->setCustomEnvironment(customEnv);
|
||||||
|
|
||||||
|
Debugger::DebuggerManager *debugManager = Debugger::DebuggerManager::instance();
|
||||||
|
connect(debugManager, SIGNAL(stateChanged(int)), this, SLOT(debuggerStateChanged(int)));
|
||||||
|
|
||||||
|
pex->startRunControl(debuggableRunControl, ProjectExplorer::Constants::DEBUGMODE);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
errorMessage = QString(tr("A valid run control was not registered in Qt Creator for this project run configuration."));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!errorMessage.isEmpty())
|
||||||
|
QMessageBox::warning(Core::ICore::instance()->mainWindow(), "Failed to debug C++ and QML", errorMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QmlInspector::debuggerStateChanged(int newState)
|
||||||
|
{
|
||||||
|
switch(newState) {
|
||||||
|
case Debugger::AdapterStartFailed:
|
||||||
|
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.")));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newState == Debugger::InferiorRunning) {
|
||||||
|
disconnect(Debugger::DebuggerManager::instance(), SIGNAL(stateChanged(int)), this, SLOT(debuggerStateChanged(int)));
|
||||||
|
m_connectionTimer->setInterval(ConnectionAttemptSimultaneousInterval);
|
||||||
|
startConnectionTimer();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void QmlInspector::setSimpleDockWidgetArrangement()
|
void QmlInspector::setSimpleDockWidgetArrangement()
|
||||||
{
|
{
|
||||||
Utils::FancyMainWindow *mainWindow = Debugger::DebuggerUISwitcher::instance()->mainWindow();
|
Utils::FancyMainWindow *mainWindow = Debugger::DebuggerUISwitcher::instance()->mainWindow();
|
||||||
|
@@ -30,7 +30,9 @@
|
|||||||
#define QMLINSPECTORMODE_H
|
#define QMLINSPECTORMODE_H
|
||||||
|
|
||||||
#include "qmlinspector_global.h"
|
#include "qmlinspector_global.h"
|
||||||
|
#include "inspectorsettings.h"
|
||||||
#include <coreplugin/basemode.h>
|
#include <coreplugin/basemode.h>
|
||||||
|
#include <qmlprojectmanager/qmlprojectrunconfiguration.h>
|
||||||
|
|
||||||
#include <QtGui/QAction>
|
#include <QtGui/QAction>
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
@@ -51,6 +53,9 @@ class QDeclarativeDebugObjectReference;
|
|||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
|
||||||
|
namespace ProjectExplorer {
|
||||||
|
class Project;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
class IContext;
|
class IContext;
|
||||||
@@ -70,17 +75,27 @@ namespace Qml {
|
|||||||
class EngineSpinBox;
|
class EngineSpinBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const int MaxConnectionAttempts = 50;
|
||||||
|
const int ConnectionAttemptDefaultInterval = 75;
|
||||||
|
// used when debugging with c++ - connection can take a lot of time
|
||||||
|
const int ConnectionAttemptSimultaneousInterval = 500;
|
||||||
|
|
||||||
class QMLINSPECTOR_EXPORT QmlInspector : public QObject
|
class QMLINSPECTOR_EXPORT QmlInspector : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QmlInspector(QObject *parent = 0);
|
QmlInspector(QObject *parent = 0);
|
||||||
|
~QmlInspector();
|
||||||
|
|
||||||
void createDockWidgets();
|
void createDockWidgets();
|
||||||
bool connectToViewer(); // using host, port from widgets
|
bool connectToViewer(); // using host, port from widgets
|
||||||
Core::IContext *context() const;
|
Core::IContext *context() const;
|
||||||
|
|
||||||
|
// returns false if project is not debuggable.
|
||||||
|
bool setDebugConfigurationDataFromProject(ProjectExplorer::Project *projectToDebug);
|
||||||
|
void startConnectionTimer();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void statusMessage(const QString &text);
|
void statusMessage(const QString &text);
|
||||||
|
|
||||||
@@ -96,6 +111,10 @@ 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 debuggerStateChanged(int newState);
|
||||||
|
void pollInspector();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void resetViews();
|
void resetViews();
|
||||||
@@ -124,8 +143,14 @@ private:
|
|||||||
Internal::InspectorContext *m_context;
|
Internal::InspectorContext *m_context;
|
||||||
Internal::InspectorContext *m_propWatcherContext;
|
Internal::InspectorContext *m_propWatcherContext;
|
||||||
|
|
||||||
|
QTimer *m_connectionTimer;
|
||||||
|
int m_connectionAttempts;
|
||||||
|
|
||||||
|
Internal::InspectorSettings m_settings;
|
||||||
|
QmlProjectManager::QmlProjectRunConfigurationDebugData m_runConfigurationDebugData;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
} // Qml
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -14,16 +14,23 @@ HEADERS += qmlinspectorplugin.h \
|
|||||||
qmlinspector.h \
|
qmlinspector.h \
|
||||||
inspectoroutputwidget.h \
|
inspectoroutputwidget.h \
|
||||||
qmlinspector_global.h \
|
qmlinspector_global.h \
|
||||||
inspectorcontext.h
|
inspectorcontext.h \
|
||||||
|
startexternalqmldialog.h \
|
||||||
|
inspectorsettings.h
|
||||||
|
|
||||||
SOURCES += qmlinspectorplugin.cpp \
|
SOURCES += qmlinspectorplugin.cpp \
|
||||||
qmlinspector.cpp \
|
qmlinspector.cpp \
|
||||||
inspectoroutputwidget.cpp \
|
inspectoroutputwidget.cpp \
|
||||||
inspectorcontext.cpp
|
inspectorcontext.cpp \
|
||||||
|
startexternalqmldialog.cpp \
|
||||||
|
inspectorsettings.cpp
|
||||||
|
|
||||||
OTHER_FILES += QmlInspector.pluginspec
|
OTHER_FILES += QmlInspector.pluginspec
|
||||||
RESOURCES += qmlinspector.qrc
|
RESOURCES += qmlinspector.qrc
|
||||||
|
|
||||||
|
FORMS += \
|
||||||
|
startexternalqmldialog.ui
|
||||||
|
|
||||||
include(../../qtcreatorplugin.pri)
|
include(../../qtcreatorplugin.pri)
|
||||||
include(../../plugins/projectexplorer/projectexplorer.pri)
|
include(../../plugins/projectexplorer/projectexplorer.pri)
|
||||||
include(../../plugins/qmlprojectmanager/qmlprojectmanager.pri)
|
include(../../plugins/qmlprojectmanager/qmlprojectmanager.pri)
|
||||||
|
@@ -39,18 +39,17 @@ 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 LANG_QML = "QML";
|
const char * const LANG_QML = "QML";
|
||||||
|
|
||||||
|
// settings
|
||||||
|
const char * const S_QML_INSPECTOR = "QML.Inspector";
|
||||||
|
const char * const S_EXTERNALPORT_KEY = "ExternalPort";
|
||||||
|
const char * const S_EXTERNALURL_KEY = "ExternalUrl";
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class StartParameters
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
StartParameters() : port(0) {}
|
|
||||||
~StartParameters() {}
|
|
||||||
|
|
||||||
QString address;
|
|
||||||
quint16 port;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -57,7 +57,6 @@
|
|||||||
|
|
||||||
#include <QtGui/QHBoxLayout>
|
#include <QtGui/QHBoxLayout>
|
||||||
#include <QtGui/QToolButton>
|
#include <QtGui/QToolButton>
|
||||||
#include <QtGui/QMessageBox>
|
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
|
|
||||||
@@ -73,10 +72,9 @@ static QToolButton *createToolButton(QAction *action)
|
|||||||
}
|
}
|
||||||
|
|
||||||
QmlInspectorPlugin::QmlInspectorPlugin()
|
QmlInspectorPlugin::QmlInspectorPlugin()
|
||||||
: m_inspector(0), m_connectionTimer(new QTimer(this)),
|
: m_inspector(0)
|
||||||
m_connectionAttempts(0)
|
|
||||||
{
|
{
|
||||||
m_connectionTimer->setInterval(75);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlInspectorPlugin::~QmlInspectorPlugin()
|
QmlInspectorPlugin::~QmlInspectorPlugin()
|
||||||
@@ -107,8 +105,6 @@ bool QmlInspectorPlugin::initialize(const QStringList &arguments, QString *error
|
|||||||
m_inspector->createDockWidgets();
|
m_inspector->createDockWidgets();
|
||||||
addObject(m_inspector);
|
addObject(m_inspector);
|
||||||
|
|
||||||
connect(m_connectionTimer, SIGNAL(timeout()), SLOT(pollInspector()));
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,26 +144,11 @@ void QmlInspectorPlugin::activateDebuggerForProject(ProjectExplorer::Project *pr
|
|||||||
// FIXME we probably want to activate the debugger for other projects than QmlProjects,
|
// FIXME we probably want to activate the debugger for other projects than QmlProjects,
|
||||||
// if they contain Qml files. Some kind of options should exist for this behavior.
|
// if they contain Qml files. Some kind of options should exist for this behavior.
|
||||||
QmlProjectManager::QmlProject *qmlproj = qobject_cast<QmlProjectManager::QmlProject*>(project);
|
QmlProjectManager::QmlProject *qmlproj = qobject_cast<QmlProjectManager::QmlProject*>(project);
|
||||||
if (qmlproj)
|
if (qmlproj && m_inspector->setDebugConfigurationDataFromProject(qmlproj))
|
||||||
m_connectionTimer->start();
|
m_inspector->startConnectionTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
void QmlInspectorPlugin::pollInspector()
|
|
||||||
{
|
|
||||||
++m_connectionAttempts;
|
|
||||||
if (m_inspector->connectToViewer()) {
|
|
||||||
m_connectionTimer->stop();
|
|
||||||
m_connectionAttempts = 0;
|
|
||||||
} else if (m_connectionAttempts == MaxConnectionAttempts) {
|
|
||||||
m_connectionTimer->stop();
|
|
||||||
m_connectionAttempts = 0;
|
|
||||||
|
|
||||||
QMessageBox::critical(0,
|
|
||||||
tr("Failed to connect to debugger"),
|
|
||||||
tr("Could not connect to debugger server. Please check your settings from Projects pane.") );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void QmlInspectorPlugin::prepareDebugger(Core::IMode *mode)
|
void QmlInspectorPlugin::prepareDebugger(Core::IMode *mode)
|
||||||
{
|
{
|
||||||
|
@@ -48,8 +48,6 @@ namespace ProjectExplorer {
|
|||||||
namespace Qml {
|
namespace Qml {
|
||||||
class QmlInspector;
|
class QmlInspector;
|
||||||
|
|
||||||
const int MaxConnectionAttempts = 20;
|
|
||||||
|
|
||||||
class QmlInspectorPlugin : public ExtensionSystem::IPlugin
|
class QmlInspectorPlugin : public ExtensionSystem::IPlugin
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -67,15 +65,12 @@ public slots:
|
|||||||
void setDockWidgetArrangement(const QString &activeLanguage);
|
void setDockWidgetArrangement(const QString &activeLanguage);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void pollInspector();
|
|
||||||
void prepareDebugger(Core::IMode *mode);
|
void prepareDebugger(Core::IMode *mode);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QmlInspector *m_inspector;
|
QmlInspector *m_inspector;
|
||||||
QTimer *m_connectionTimer;
|
|
||||||
int m_connectionAttempts;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
} // Qml
|
||||||
|
|
||||||
#endif // QMLINSPECTORPLUGIN_H
|
#endif // QMLINSPECTORPLUGIN_H
|
||||||
|
54
src/plugins/qmlinspector/startexternalqmldialog.cpp
Normal file
54
src/plugins/qmlinspector/startexternalqmldialog.cpp
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
#include "startexternalqmldialog.h"
|
||||||
|
#include "ui_startexternalqmldialog.h"
|
||||||
|
|
||||||
|
#include <utils/pathchooser.h>
|
||||||
|
#include <QPushButton>
|
||||||
|
|
||||||
|
|
||||||
|
namespace Qml {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
|
|
||||||
|
StartExternalQmlDialog::StartExternalQmlDialog(QWidget *parent)
|
||||||
|
: QDialog(parent), m_ui(new Ui::StartExternalQmlDialog)
|
||||||
|
{
|
||||||
|
m_ui->setupUi(this);
|
||||||
|
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
|
||||||
|
m_ui->projectDisplayName->setText(tr("<No project>"));
|
||||||
|
|
||||||
|
connect(m_ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
||||||
|
connect(m_ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
||||||
|
}
|
||||||
|
|
||||||
|
StartExternalQmlDialog::~StartExternalQmlDialog()
|
||||||
|
{
|
||||||
|
delete m_ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void StartExternalQmlDialog::setDebuggerUrl(const QString &str)
|
||||||
|
{
|
||||||
|
m_ui->urlLine->setText(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString StartExternalQmlDialog::debuggerUrl() const
|
||||||
|
{
|
||||||
|
return m_ui->urlLine->text();
|
||||||
|
}
|
||||||
|
|
||||||
|
void StartExternalQmlDialog::setPort(quint16 str)
|
||||||
|
{
|
||||||
|
m_ui->portSpinBox->setValue(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
quint16 StartExternalQmlDialog::port() const
|
||||||
|
{
|
||||||
|
return m_ui->portSpinBox->value();
|
||||||
|
}
|
||||||
|
|
||||||
|
void StartExternalQmlDialog::setProjectDisplayName(const QString &projectName)
|
||||||
|
{
|
||||||
|
m_ui->projectDisplayName->setText(projectName);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // Internal
|
||||||
|
} // Qml
|
39
src/plugins/qmlinspector/startexternalqmldialog.h
Normal file
39
src/plugins/qmlinspector/startexternalqmldialog.h
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
#ifndef STARTEXTERNALQMLDIALOG_H
|
||||||
|
#define STARTEXTERNALQMLDIALOG_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class StartExternalQmlDialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Qml {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
|
|
||||||
|
class StartExternalQmlDialog : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit StartExternalQmlDialog(QWidget *parent);
|
||||||
|
~StartExternalQmlDialog();
|
||||||
|
|
||||||
|
void setDebuggerUrl(const QString &url);
|
||||||
|
QString debuggerUrl() const;
|
||||||
|
|
||||||
|
void setPort(quint16 port);
|
||||||
|
quint16 port() const;
|
||||||
|
|
||||||
|
void setProjectDisplayName(const QString &projectName);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::StartExternalQmlDialog *m_ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // Internal
|
||||||
|
} // Qml
|
||||||
|
|
||||||
|
#endif // STARTEXTERNALQMLDIALOG_H
|
122
src/plugins/qmlinspector/startexternalqmldialog.ui
Normal file
122
src/plugins/qmlinspector/startexternalqmldialog.ui
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>StartExternalQmlDialog</class>
|
||||||
|
<widget class="QDialog" name="StartExternalQmlDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>425</width>
|
||||||
|
<height>198</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Start Debugging QML and C++ simultaneously</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<property name="margin">
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<layout class="QGridLayout">
|
||||||
|
<property name="margin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="spacing">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="labelBreakAtMain">
|
||||||
|
<property name="text">
|
||||||
|
<string>Debugging address:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Debugging port:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QSpinBox" name="portSpinBox">
|
||||||
|
<property name="maximum">
|
||||||
|
<number>65535</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>3768</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QLineEdit" name="urlLine">
|
||||||
|
<property name="text">
|
||||||
|
<string>127.0.0.1</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Project:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLabel" name="projectDisplayName">
|
||||||
|
<property name="text">
|
||||||
|
<string><No project></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>To switch languages while debugging, go to Debug->Language menu.</string>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>407</width>
|
||||||
|
<height>16</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="Line" name="line">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
@@ -54,6 +54,9 @@ const char * const QML_WIZARD_CATEGORY = "F.Projects"; // (after Qt)
|
|||||||
const char * const QML_WIZARD_TR_SCOPE = "QmlProjectManager";
|
const char * const QML_WIZARD_TR_SCOPE = "QmlProjectManager";
|
||||||
const char * const QML_WIZARD_TR_CATEGORY = QT_TRANSLATE_NOOP("QmlProjectManager", "Qt Quick Project");
|
const char * const QML_WIZARD_TR_CATEGORY = QT_TRANSLATE_NOOP("QmlProjectManager", "Qt Quick Project");
|
||||||
|
|
||||||
|
// Env variables for inspector
|
||||||
|
const char * const E_QML_DEBUG_SERVER_PORT = "QML_DEBUG_SERVER_PORT";
|
||||||
|
|
||||||
} // namespace Constants
|
} // namespace Constants
|
||||||
} // namespace QmlProjectManager
|
} // namespace QmlProjectManager
|
||||||
|
|
||||||
|
@@ -52,10 +52,14 @@
|
|||||||
|
|
||||||
namespace QmlProjectManager {
|
namespace QmlProjectManager {
|
||||||
|
|
||||||
|
|
||||||
|
QmlProjectRunConfigurationDebugData::QmlProjectRunConfigurationDebugData() :
|
||||||
|
serverAddress("127.0.0.1"), serverPort(Constants::QML_DEFAULT_DEBUG_SERVER_PORT)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
QmlProjectRunConfiguration::QmlProjectRunConfiguration(Internal::QmlProjectTarget *parent) :
|
QmlProjectRunConfiguration::QmlProjectRunConfiguration(Internal::QmlProjectTarget *parent) :
|
||||||
ProjectExplorer::RunConfiguration(parent, QLatin1String(Constants::QML_RC_ID)),
|
ProjectExplorer::RunConfiguration(parent, QLatin1String(Constants::QML_RC_ID)),
|
||||||
m_debugServerAddress("127.0.0.1"),
|
|
||||||
m_debugServerPort(Constants::QML_DEFAULT_DEBUG_SERVER_PORT),
|
|
||||||
m_fileListModel(new QStringListModel(this)),
|
m_fileListModel(new QStringListModel(this)),
|
||||||
m_projectTarget(parent),
|
m_projectTarget(parent),
|
||||||
m_usingCurrentFile(true),
|
m_usingCurrentFile(true),
|
||||||
@@ -68,10 +72,10 @@ QmlProjectRunConfiguration::QmlProjectRunConfiguration(Internal::QmlProjectTarge
|
|||||||
ProjectExplorer::RunConfiguration(parent, source),
|
ProjectExplorer::RunConfiguration(parent, source),
|
||||||
m_scriptFile(source->m_scriptFile),
|
m_scriptFile(source->m_scriptFile),
|
||||||
m_qmlViewerCustomPath(source->m_qmlViewerCustomPath),
|
m_qmlViewerCustomPath(source->m_qmlViewerCustomPath),
|
||||||
m_qmlViewerArgs(source->m_qmlViewerArgs),
|
m_qmlViewerArgs(source->m_qmlViewerArgs)
|
||||||
m_debugServerAddress(source->m_debugServerAddress),
|
|
||||||
m_debugServerPort(source->m_debugServerPort)
|
|
||||||
{
|
{
|
||||||
|
m_debugData.serverAddress = source->m_debugData.serverAddress;
|
||||||
|
m_debugData.serverPort = source->m_debugData.serverPort;
|
||||||
ctor();
|
ctor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,7 +112,7 @@ QmlProjectRunConfiguration::~QmlProjectRunConfiguration()
|
|||||||
|
|
||||||
QString QmlProjectRunConfiguration::debugServerAddress() const
|
QString QmlProjectRunConfiguration::debugServerAddress() const
|
||||||
{
|
{
|
||||||
return m_debugServerAddress;
|
return m_debugData.serverAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
Internal::QmlProjectTarget *QmlProjectRunConfiguration::qmlTarget() const
|
Internal::QmlProjectTarget *QmlProjectRunConfiguration::qmlTarget() const
|
||||||
@@ -151,7 +155,7 @@ QString QmlProjectRunConfiguration::workingDirectory() const
|
|||||||
|
|
||||||
uint QmlProjectRunConfiguration::debugServerPort() const
|
uint QmlProjectRunConfiguration::debugServerPort() const
|
||||||
{
|
{
|
||||||
return m_debugServerPort;
|
return m_debugData.serverPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool caseInsensitiveLessThan(const QString &s1, const QString &s2)
|
static bool caseInsensitiveLessThan(const QString &s1, const QString &s2)
|
||||||
@@ -181,13 +185,13 @@ QWidget *QmlProjectRunConfiguration::configurationWidget()
|
|||||||
connect(qmlViewerArgs, SIGNAL(textChanged(QString)), this, SLOT(onViewerArgsChanged()));
|
connect(qmlViewerArgs, SIGNAL(textChanged(QString)), this, SLOT(onViewerArgsChanged()));
|
||||||
|
|
||||||
QLineEdit *debugServer = new QLineEdit;
|
QLineEdit *debugServer = new QLineEdit;
|
||||||
debugServer->setText(m_debugServerAddress);
|
debugServer->setText(m_debugData.serverAddress);
|
||||||
connect(debugServer, SIGNAL(textChanged(QString)), this, SLOT(onDebugServerAddressChanged()));
|
connect(debugServer, SIGNAL(textChanged(QString)), this, SLOT(onDebugServerAddressChanged()));
|
||||||
|
|
||||||
QSpinBox *debugPort = new QSpinBox;
|
QSpinBox *debugPort = new QSpinBox;
|
||||||
debugPort->setMinimum(1024); // valid registered/dynamic/free ports according to http://www.iana.org/assignments/port-numbers
|
debugPort->setMinimum(1024); // valid registered/dynamic/free ports according to http://www.iana.org/assignments/port-numbers
|
||||||
debugPort->setMaximum(65535);
|
debugPort->setMaximum(65535);
|
||||||
debugPort->setValue(m_debugServerPort);
|
debugPort->setValue(m_debugData.serverPort);
|
||||||
connect(debugPort, SIGNAL(valueChanged(int)), this, SLOT(onDebugServerPortChanged()));
|
connect(debugPort, SIGNAL(valueChanged(int)), this, SLOT(onDebugServerPortChanged()));
|
||||||
|
|
||||||
form->addRow(tr("QML Runtime"), qmlViewer);
|
form->addRow(tr("QML Runtime"), qmlViewer);
|
||||||
@@ -243,7 +247,7 @@ void QmlProjectRunConfiguration::updateFileComboBox()
|
|||||||
void QmlProjectRunConfiguration::onDebugServerAddressChanged()
|
void QmlProjectRunConfiguration::onDebugServerAddressChanged()
|
||||||
{
|
{
|
||||||
if (QLineEdit *lineEdit = qobject_cast<QLineEdit*>(sender()))
|
if (QLineEdit *lineEdit = qobject_cast<QLineEdit*>(sender()))
|
||||||
m_debugServerAddress = lineEdit->text();
|
m_debugData.serverAddress = lineEdit->text();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProjectRunConfiguration::setMainScript(const QString &scriptFile)
|
void QmlProjectRunConfiguration::setMainScript(const QString &scriptFile)
|
||||||
@@ -279,7 +283,7 @@ void QmlProjectRunConfiguration::onViewerArgsChanged()
|
|||||||
void QmlProjectRunConfiguration::onDebugServerPortChanged()
|
void QmlProjectRunConfiguration::onDebugServerPortChanged()
|
||||||
{
|
{
|
||||||
if (QSpinBox *spinBox = qobject_cast<QSpinBox*>(sender())) {
|
if (QSpinBox *spinBox = qobject_cast<QSpinBox*>(sender())) {
|
||||||
m_debugServerPort = spinBox->value();
|
m_debugData.serverPort = spinBox->value();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -290,8 +294,8 @@ QVariantMap QmlProjectRunConfiguration::toMap() const
|
|||||||
map.insert(QLatin1String(Constants::QML_VIEWER_KEY), m_qmlViewerCustomPath);
|
map.insert(QLatin1String(Constants::QML_VIEWER_KEY), m_qmlViewerCustomPath);
|
||||||
map.insert(QLatin1String(Constants::QML_VIEWER_ARGUMENTS_KEY), m_qmlViewerArgs);
|
map.insert(QLatin1String(Constants::QML_VIEWER_ARGUMENTS_KEY), m_qmlViewerArgs);
|
||||||
map.insert(QLatin1String(Constants::QML_MAINSCRIPT_KEY), m_scriptFile);
|
map.insert(QLatin1String(Constants::QML_MAINSCRIPT_KEY), m_scriptFile);
|
||||||
map.insert(QLatin1String(Constants::QML_DEBUG_SERVER_PORT_KEY), m_debugServerPort);
|
map.insert(QLatin1String(Constants::QML_DEBUG_SERVER_PORT_KEY), m_debugData.serverPort);
|
||||||
map.insert(QLatin1String(Constants::QML_DEBUG_SERVER_ADDRESS_KEY), m_debugServerAddress);
|
map.insert(QLatin1String(Constants::QML_DEBUG_SERVER_ADDRESS_KEY), m_debugData.serverAddress);
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -300,8 +304,8 @@ bool QmlProjectRunConfiguration::fromMap(const QVariantMap &map)
|
|||||||
m_qmlViewerCustomPath = map.value(QLatin1String(Constants::QML_VIEWER_KEY)).toString();
|
m_qmlViewerCustomPath = map.value(QLatin1String(Constants::QML_VIEWER_KEY)).toString();
|
||||||
m_qmlViewerArgs = map.value(QLatin1String(Constants::QML_VIEWER_ARGUMENTS_KEY)).toString();
|
m_qmlViewerArgs = map.value(QLatin1String(Constants::QML_VIEWER_ARGUMENTS_KEY)).toString();
|
||||||
m_scriptFile = map.value(QLatin1String(Constants::QML_MAINSCRIPT_KEY), M_CURRENT_FILE).toString();
|
m_scriptFile = map.value(QLatin1String(Constants::QML_MAINSCRIPT_KEY), M_CURRENT_FILE).toString();
|
||||||
m_debugServerPort = map.value(QLatin1String(Constants::QML_DEBUG_SERVER_PORT_KEY), Constants::QML_DEFAULT_DEBUG_SERVER_PORT).toUInt();
|
m_debugData.serverPort = map.value(QLatin1String(Constants::QML_DEBUG_SERVER_PORT_KEY), Constants::QML_DEFAULT_DEBUG_SERVER_PORT).toUInt();
|
||||||
m_debugServerAddress = map.value(QLatin1String(Constants::QML_DEBUG_SERVER_ADDRESS_KEY), QLatin1String("127.0.0.1")).toString();
|
m_debugData.serverAddress = map.value(QLatin1String(Constants::QML_DEBUG_SERVER_ADDRESS_KEY), QLatin1String("127.0.0.1")).toString();
|
||||||
setMainScript(m_scriptFile);
|
setMainScript(m_scriptFile);
|
||||||
|
|
||||||
return RunConfiguration::fromMap(map);
|
return RunConfiguration::fromMap(map);
|
||||||
|
@@ -52,6 +52,14 @@ class QmlProjectRunConfigurationFactory;
|
|||||||
const char * const CURRENT_FILE = QT_TRANSLATE_NOOP("QmlManager", "<Current File>");
|
const char * const CURRENT_FILE = QT_TRANSLATE_NOOP("QmlManager", "<Current File>");
|
||||||
const char * const M_CURRENT_FILE = "CurrentFile";
|
const char * const M_CURRENT_FILE = "CurrentFile";
|
||||||
|
|
||||||
|
|
||||||
|
class QMLPROJECTMANAGER_EXPORT QmlProjectRunConfigurationDebugData {
|
||||||
|
public:
|
||||||
|
QmlProjectRunConfigurationDebugData();
|
||||||
|
QString serverAddress;
|
||||||
|
quint16 serverPort;
|
||||||
|
};
|
||||||
|
|
||||||
class QMLPROJECTMANAGER_EXPORT QmlProjectRunConfiguration : public ProjectExplorer::RunConfiguration
|
class QMLPROJECTMANAGER_EXPORT QmlProjectRunConfiguration : public ProjectExplorer::RunConfiguration
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -108,8 +116,8 @@ private:
|
|||||||
QString m_qmlViewerCustomPath;
|
QString m_qmlViewerCustomPath;
|
||||||
QString m_qmlViewerDefaultPath;
|
QString m_qmlViewerDefaultPath;
|
||||||
QString m_qmlViewerArgs;
|
QString m_qmlViewerArgs;
|
||||||
QString m_debugServerAddress;
|
QmlProjectRunConfigurationDebugData m_debugData;
|
||||||
uint m_debugServerPort;
|
|
||||||
QStringListModel *m_fileListModel;
|
QStringListModel *m_fileListModel;
|
||||||
// weakpointer is used to make sure we don't try to manipulate
|
// weakpointer is used to make sure we don't try to manipulate
|
||||||
// widget which was deleted already, as can be the case here.
|
// widget which was deleted already, as can be the case here.
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
#include "qmlprojectruncontrol.h"
|
#include "qmlprojectruncontrol.h"
|
||||||
#include "qmlprojectrunconfiguration.h"
|
#include "qmlprojectrunconfiguration.h"
|
||||||
|
#include "qmlprojectconstants.h"
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/modemanager.h>
|
#include <coreplugin/modemanager.h>
|
||||||
#include <projectexplorer/environment.h>
|
#include <projectexplorer/environment.h>
|
||||||
@@ -56,7 +56,7 @@ QmlRunControl::QmlRunControl(QmlProjectRunConfiguration *runConfiguration, bool
|
|||||||
{
|
{
|
||||||
ProjectExplorer::Environment environment = ProjectExplorer::Environment::systemEnvironment();
|
ProjectExplorer::Environment environment = ProjectExplorer::Environment::systemEnvironment();
|
||||||
if (debugMode)
|
if (debugMode)
|
||||||
environment.set("QML_DEBUG_SERVER_PORT", QString::number(runConfiguration->debugServerPort()));
|
environment.set(QmlProjectManager::Constants::E_QML_DEBUG_SERVER_PORT, QString::number(runConfiguration->debugServerPort()));
|
||||||
|
|
||||||
m_applicationLauncher.setEnvironment(environment.toStringList());
|
m_applicationLauncher.setEnvironment(environment.toStringList());
|
||||||
m_applicationLauncher.setWorkingDirectory(runConfiguration->workingDirectory());
|
m_applicationLauncher.setWorkingDirectory(runConfiguration->workingDirectory());
|
||||||
|
Reference in New Issue
Block a user