From 803206d5b527f291deb3ee963d2092d7e1b1bd10 Mon Sep 17 00:00:00 2001 From: Christian Kandeler <christian.kandeler@nokia.com> Date: Wed, 6 Oct 2010 16:26:19 +0200 Subject: [PATCH] Maemo: QML debugging is not possible on Fremantle ... ... so disable the respective widgets if the active build configuration has a Fremantle toolchain. Reviewed-by: kh1 --- .../qt-maemo/maemodebugsupport.cpp | 12 ++++++---- .../qt-maemo/maemorunconfiguration.cpp | 24 +++++++++++++++++++ .../qt-maemo/maemorunconfiguration.h | 5 +++- .../qt-maemo/maemorunconfigurationwidget.cpp | 8 ++++++- .../qt-maemo/maemorunconfigurationwidget.h | 1 + .../qt-maemo/maemosshrunner.cpp | 7 ++++-- .../qt-maemo/maemotoolchain.h | 1 + 7 files changed, 49 insertions(+), 9 deletions(-) diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.cpp index bc3938f8838..d67de573fdc 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.cpp @@ -63,11 +63,13 @@ RunControl *MaemoDebugSupport::createDebugRunControl(MaemoRunConfiguration *runC DebuggerStartParameters params; const MaemoDeviceConfig &devConf = runConfig->deviceConfig(); - if (runConfig->useQmlDebugger()) { + const MaemoRunConfiguration::DebuggingType debuggingType + = runConfig->debuggingType(); + if (debuggingType != MaemoRunConfiguration::DebugCppOnly) { params.qmlServerAddress = runConfig->deviceConfig().server.host; params.qmlServerPort = qmlServerPort(runConfig); } - if (runConfig->useCppDebugger()) { + if (debuggingType != MaemoRunConfiguration::DebugQmlOnly) { params.processArgs = runConfig->arguments(); params.sysRoot = runConfig->sysRoot(); params.toolChainType = ToolChain::GCC_MAEMO; @@ -113,7 +115,7 @@ MaemoDebugSupport::MaemoDebugSupport(MaemoRunConfiguration *runConfig, : QObject(runControl), m_runControl(runControl), m_runConfig(runConfig), m_deviceConfig(m_runConfig->deviceConfig()), m_runner(new MaemoSshRunner(this, m_runConfig, true)), - m_qmlOnlyDebugging(m_runConfig->useQmlDebugger() && !m_runConfig->useCppDebugger()) + m_qmlOnlyDebugging(m_runConfig->debuggingType() == MaemoRunConfiguration::DebugQmlOnly) { connect(m_runControl, SIGNAL(engineRequestSetup()), this, SLOT(handleAdapterSetupRequested())); @@ -305,7 +307,7 @@ int MaemoDebugSupport::gdbServerPort(const MaemoRunConfiguration *rc) int MaemoDebugSupport::qmlServerPort(const MaemoRunConfiguration *rc) { MaemoPortList portList = rc->freePorts(); - if (rc->useCppDebugger()) + if (rc->debuggingType() != MaemoRunConfiguration::DebugQmlOnly) portList.getNext(); return portList.getNext(); } @@ -314,7 +316,7 @@ QString MaemoDebugSupport::environment(const MaemoRunConfiguration *rc) { QList<Utils::EnvironmentItem> env = rc->userEnvironmentChanges(); // FIXME: this must use command line argument instead: -qmljsdebugger=port:1234. - if (rc->useQmlDebugger()) { + if (rc->debuggingType() != MaemoRunConfiguration::DebugCppOnly) { // env << Utils::EnvironmentItem(QLatin1String(Debugger::Constants::E_QML_DEBUG_SERVER_PORT), // QString::number(qmlServerPort(rc))); } diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp index 724d2d191e0..18e734f2656 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp @@ -304,6 +304,30 @@ void MaemoRunConfiguration::setArguments(const QStringList &args) m_arguments = args; } +MaemoRunConfiguration::DebuggingType MaemoRunConfiguration::debuggingType() const +{ + if (!toolchain() || !toolchain()->allowsQmlDebugging()) + return DebugCppOnly; + if (useCppDebugger()) { + if (useQmlDebugger()) + return DebugCppAndQml; + return DebugCppOnly; + } + return DebugQmlOnly; +} + +int MaemoRunConfiguration::portsUsedByDebuggers() const +{ + switch (debuggingType()) { + case DebugCppOnly: + case DebugQmlOnly: + return 1; + case DebugCppAndQml: + default: + return 2; + } +} + void MaemoRunConfiguration::updateDeviceConfigurations() { emit deviceConfigurationChanged(target()); diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.h b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.h index b25848b92a4..42e32835944 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.h @@ -71,6 +71,8 @@ public: SystemEnvironmentBase = 1 }; + enum DebuggingType { DebugCppOnly, DebugQmlOnly, DebugCppAndQml }; + MaemoRunConfiguration(Qt4Target *parent, const QString &proFilePath); virtual ~MaemoRunConfiguration(); @@ -96,6 +98,7 @@ public: bool useRemoteGdb() const; void setUseRemoteGdb(bool useRemoteGdb) { m_useRemoteGdb = useRemoteGdb; } void updateFactoryState() { emit isEnabledChanged(true); } + DebuggingType debuggingType() const; const QString gdbCmd() const; const QString dumperLib() const; @@ -116,7 +119,7 @@ public: Utils::Environment systemEnvironment() const; void setSystemEnvironment(const Utils::Environment &environment); - int portsUsedByDebuggers() const { return useCppDebugger() + useQmlDebugger(); } + int portsUsedByDebuggers() const; signals: void deviceConfigurationChanged(ProjectExplorer::Target *target); diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.cpp index 8d2279bf9ce..c2f8e57e624 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.cpp @@ -126,10 +126,11 @@ void MaemoRunConfigurationWidget::addGenericWidgets(QVBoxLayout *mainLayout) m_debugCppOnlyButton = new QRadioButton(tr("C++ only")); m_debugQmlOnlyButton = new QRadioButton(tr("QML only")); m_debugCppAndQmlButton = new QRadioButton(tr("C++ and QML")); + m_debuggingLanguagesLabel = new QLabel(tr("Debugging type:")); debugButtonsLayout->addWidget(m_debugCppOnlyButton); debugButtonsLayout->addWidget(m_debugQmlOnlyButton); debugButtonsLayout->addWidget(m_debugCppAndQmlButton); - formLayout->addRow(tr("Debugging type:"), debugButtonsLayout); + formLayout->addRow(m_debuggingLanguagesLabel, debugButtonsLayout); if (m_runConfiguration->useCppDebugger()) { if (m_runConfiguration->useQmlDebugger()) m_debugCppAndQmlButton->setChecked(true); @@ -304,6 +305,11 @@ void MaemoRunConfigurationWidget::handleToolchainChanged() const bool remoteMountsAvailable = toolChain->allowsRemoteMounts(); m_debugDetailsContainer->setVisible(remoteMountsAvailable); m_mountDetailsContainer->setVisible(remoteMountsAvailable); + const bool qmlDebuggingAvailable = toolChain->allowsQmlDebugging(); + m_debuggingLanguagesLabel->setVisible(qmlDebuggingAvailable); + m_debugCppOnlyButton->setVisible(qmlDebuggingAvailable); + m_debugQmlOnlyButton->setVisible(qmlDebuggingAvailable); + m_debugCppAndQmlButton->setVisible(qmlDebuggingAvailable); } m_runConfiguration->updateFactoryState(); } diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.h b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.h index 2fb92edefde..be686ac0000 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.h @@ -107,6 +107,7 @@ private: QLabel *m_localExecutableLabel; QLabel *m_remoteExecutableLabel; QLabel *m_devConfLabel; + QLabel *m_debuggingLanguagesLabel; QRadioButton *m_debugCppOnlyButton; QRadioButton *m_debugQmlOnlyButton; QRadioButton *m_debugCppAndQmlButton; diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemosshrunner.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemosshrunner.cpp index 15d1f432e4a..16db4f43869 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemosshrunner.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemosshrunner.cpp @@ -193,9 +193,12 @@ void MaemoSshRunner::handleUnmounted() m_mounter->resetMountSpecifications(); MaemoPortList portList = m_devConfig.freePorts(); if (m_debugging) { // gdbserver and QML inspector need one port each. - if (m_runConfig->useCppDebugger() && !m_runConfig->useRemoteGdb()) + MaemoRunConfiguration::DebuggingType debuggingType + = m_runConfig->debuggingType(); + if (debuggingType != MaemoRunConfiguration::DebugQmlOnly + && !m_runConfig->useRemoteGdb()) portList.getNext(); - if (m_runConfig->useQmlDebugger()) + if (debuggingType != MaemoRunConfiguration::DebugCppOnly) portList.getNext(); } m_mounter->setToolchain(m_runConfig->toolchain()); diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemotoolchain.h b/src/plugins/qt4projectmanager/qt-maemo/maemotoolchain.h index 7589b1e2425..edda2c25d71 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemotoolchain.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemotoolchain.h @@ -56,6 +56,7 @@ public: MaemoVersion version() const; bool allowsRemoteMounts() const { return version() == Maemo5; } bool allowsPackagingDisabling() const { return version() == Maemo5; } + bool allowsQmlDebugging() const { return version() == Maemo6; } protected: bool equals(const ToolChain *other) const; -- GitLab