forked from qt-creator/qt-creator
Debugger: Move aspect data into separate structure
For easier copying to DebuggerStartParameter later Change-Id: I41672af7e8540393a6bf32c6644f6e56020503b4 Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
@@ -176,14 +176,12 @@ void DebuggerRunConfigWidget::update()
|
|||||||
|
|
||||||
void DebuggerRunConfigWidget::qmlDebugServerPortChanged(int port)
|
void DebuggerRunConfigWidget::qmlDebugServerPortChanged(int port)
|
||||||
{
|
{
|
||||||
m_aspect->m_qmlDebugServerPort = port;
|
m_aspect->d.qmlDebugServerPort = port;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerRunConfigWidget::useCppDebuggerClicked(bool on)
|
void DebuggerRunConfigWidget::useCppDebuggerClicked(bool on)
|
||||||
{
|
{
|
||||||
m_aspect->m_useCppDebugger = on
|
m_aspect->d.useCppDebugger = on ? EnabledLanguage : DisabledLanguage;
|
||||||
? DebuggerRunConfigurationAspect::EnabledLanguage
|
|
||||||
: DebuggerRunConfigurationAspect::DisabledLanguage;
|
|
||||||
if (!on && !m_useQmlDebugger->isChecked()) {
|
if (!on && !m_useQmlDebugger->isChecked()) {
|
||||||
m_useQmlDebugger->setChecked(true);
|
m_useQmlDebugger->setChecked(true);
|
||||||
useQmlDebuggerClicked(true);
|
useQmlDebuggerClicked(true);
|
||||||
@@ -198,9 +196,7 @@ void DebuggerRunConfigWidget::useQmlDebuggerToggled(bool on)
|
|||||||
|
|
||||||
void DebuggerRunConfigWidget::useQmlDebuggerClicked(bool on)
|
void DebuggerRunConfigWidget::useQmlDebuggerClicked(bool on)
|
||||||
{
|
{
|
||||||
m_aspect->m_useQmlDebugger = on
|
m_aspect->d.useQmlDebugger = on ? EnabledLanguage : DisabledLanguage;
|
||||||
? DebuggerRunConfigurationAspect::EnabledLanguage
|
|
||||||
: DebuggerRunConfigurationAspect::DisabledLanguage;
|
|
||||||
if (!on && !m_useCppDebugger->isChecked()) {
|
if (!on && !m_useCppDebugger->isChecked()) {
|
||||||
m_useCppDebugger->setChecked(true);
|
m_useCppDebugger->setChecked(true);
|
||||||
useCppDebuggerClicked(true);
|
useCppDebuggerClicked(true);
|
||||||
@@ -209,7 +205,7 @@ void DebuggerRunConfigWidget::useQmlDebuggerClicked(bool on)
|
|||||||
|
|
||||||
void DebuggerRunConfigWidget::useMultiProcessToggled(bool on)
|
void DebuggerRunConfigWidget::useMultiProcessToggled(bool on)
|
||||||
{
|
{
|
||||||
m_aspect->m_useMultiProcess = on;
|
m_aspect->d.useMultiProcess = on;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
@@ -220,11 +216,7 @@ void DebuggerRunConfigWidget::useMultiProcessToggled(bool on)
|
|||||||
|
|
||||||
DebuggerRunConfigurationAspect::DebuggerRunConfigurationAspect(
|
DebuggerRunConfigurationAspect::DebuggerRunConfigurationAspect(
|
||||||
RunConfiguration *rc) :
|
RunConfiguration *rc) :
|
||||||
IRunConfigurationAspect(rc),
|
IRunConfigurationAspect(rc)
|
||||||
m_useCppDebugger(AutoEnabledLanguage),
|
|
||||||
m_useQmlDebugger(AutoEnabledLanguage),
|
|
||||||
m_qmlDebugServerPort(Constants::QML_DEFAULT_DEBUG_SERVER_PORT),
|
|
||||||
m_useMultiProcess(false)
|
|
||||||
{
|
{
|
||||||
setId("DebuggerAspect");
|
setId("DebuggerAspect");
|
||||||
setDisplayName(tr("Debugger settings"));
|
setDisplayName(tr("Debugger settings"));
|
||||||
@@ -232,27 +224,27 @@ DebuggerRunConfigurationAspect::DebuggerRunConfigurationAspect(
|
|||||||
|
|
||||||
void DebuggerRunConfigurationAspect::setUseQmlDebugger(bool value)
|
void DebuggerRunConfigurationAspect::setUseQmlDebugger(bool value)
|
||||||
{
|
{
|
||||||
m_useQmlDebugger = value ? EnabledLanguage : DisabledLanguage;
|
d.useQmlDebugger = value ? EnabledLanguage : DisabledLanguage;
|
||||||
runConfiguration()->requestRunActionsUpdate();
|
runConfiguration()->requestRunActionsUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerRunConfigurationAspect::setUseCppDebugger(bool value)
|
void DebuggerRunConfigurationAspect::setUseCppDebugger(bool value)
|
||||||
{
|
{
|
||||||
m_useCppDebugger = value ? EnabledLanguage : DisabledLanguage;
|
d.useCppDebugger = value ? EnabledLanguage : DisabledLanguage;
|
||||||
runConfiguration()->requestRunActionsUpdate();
|
runConfiguration()->requestRunActionsUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DebuggerRunConfigurationAspect::useCppDebugger() const
|
bool DebuggerRunConfigurationAspect::useCppDebugger() const
|
||||||
{
|
{
|
||||||
if (m_useCppDebugger == DebuggerRunConfigurationAspect::AutoEnabledLanguage)
|
if (d.useCppDebugger == AutoEnabledLanguage)
|
||||||
return runConfiguration()->target()->project()->projectLanguages().contains(
|
return runConfiguration()->target()->project()->projectLanguages().contains(
|
||||||
ProjectExplorer::Constants::LANG_CXX);
|
ProjectExplorer::Constants::LANG_CXX);
|
||||||
return m_useCppDebugger == DebuggerRunConfigurationAspect::EnabledLanguage;
|
return d.useCppDebugger == EnabledLanguage;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DebuggerRunConfigurationAspect::useQmlDebugger() const
|
bool DebuggerRunConfigurationAspect::useQmlDebugger() const
|
||||||
{
|
{
|
||||||
if (m_useQmlDebugger == DebuggerRunConfigurationAspect::AutoEnabledLanguage) {
|
if (d.useQmlDebugger == AutoEnabledLanguage) {
|
||||||
//
|
//
|
||||||
// Try to find a build step (qmake) to check whether qml debugging is enabled there
|
// Try to find a build step (qmake) to check whether qml debugging is enabled there
|
||||||
// (Using the Qt metatype system to avoid a hard qt4projectmanager dependency)
|
// (Using the Qt metatype system to avoid a hard qt4projectmanager dependency)
|
||||||
@@ -271,27 +263,27 @@ bool DebuggerRunConfigurationAspect::useQmlDebugger() const
|
|||||||
return languages.contains(ProjectExplorer::Constants::LANG_QMLJS)
|
return languages.contains(ProjectExplorer::Constants::LANG_QMLJS)
|
||||||
&& !languages.contains(ProjectExplorer::Constants::LANG_CXX);
|
&& !languages.contains(ProjectExplorer::Constants::LANG_CXX);
|
||||||
}
|
}
|
||||||
return m_useQmlDebugger == DebuggerRunConfigurationAspect::EnabledLanguage;
|
return d.useQmlDebugger == EnabledLanguage;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint DebuggerRunConfigurationAspect::qmlDebugServerPort() const
|
uint DebuggerRunConfigurationAspect::qmlDebugServerPort() const
|
||||||
{
|
{
|
||||||
return m_qmlDebugServerPort;
|
return d.qmlDebugServerPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerRunConfigurationAspect::setQmllDebugServerPort(uint port)
|
void DebuggerRunConfigurationAspect::setQmllDebugServerPort(uint port)
|
||||||
{
|
{
|
||||||
m_qmlDebugServerPort = port;
|
d.qmlDebugServerPort = port;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DebuggerRunConfigurationAspect::useMultiProcess() const
|
bool DebuggerRunConfigurationAspect::useMultiProcess() const
|
||||||
{
|
{
|
||||||
return m_useMultiProcess;
|
return d.useMultiProcess;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerRunConfigurationAspect::setUseMultiProcess(bool value)
|
void DebuggerRunConfigurationAspect::setUseMultiProcess(bool value)
|
||||||
{
|
{
|
||||||
m_useMultiProcess = value;
|
d.useMultiProcess = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DebuggerRunConfigurationAspect::isQmlDebuggingSpinboxSuppressed() const
|
bool DebuggerRunConfigurationAspect::isQmlDebuggingSpinboxSuppressed() const
|
||||||
@@ -305,29 +297,29 @@ bool DebuggerRunConfigurationAspect::isQmlDebuggingSpinboxSuppressed() const
|
|||||||
|
|
||||||
void DebuggerRunConfigurationAspect::toMap(QVariantMap &map) const
|
void DebuggerRunConfigurationAspect::toMap(QVariantMap &map) const
|
||||||
{
|
{
|
||||||
map.insert(QLatin1String(USE_CPP_DEBUGGER_KEY), m_useCppDebugger == EnabledLanguage);
|
map.insert(QLatin1String(USE_CPP_DEBUGGER_KEY), d.useCppDebugger == EnabledLanguage);
|
||||||
map.insert(QLatin1String(USE_CPP_DEBUGGER_AUTO_KEY), m_useCppDebugger == AutoEnabledLanguage);
|
map.insert(QLatin1String(USE_CPP_DEBUGGER_AUTO_KEY), d.useCppDebugger == AutoEnabledLanguage);
|
||||||
map.insert(QLatin1String(USE_QML_DEBUGGER_KEY), m_useQmlDebugger == EnabledLanguage);
|
map.insert(QLatin1String(USE_QML_DEBUGGER_KEY), d.useQmlDebugger == EnabledLanguage);
|
||||||
map.insert(QLatin1String(USE_QML_DEBUGGER_AUTO_KEY), m_useQmlDebugger == AutoEnabledLanguage);
|
map.insert(QLatin1String(USE_QML_DEBUGGER_AUTO_KEY), d.useQmlDebugger == AutoEnabledLanguage);
|
||||||
map.insert(QLatin1String(QML_DEBUG_SERVER_PORT_KEY), m_qmlDebugServerPort);
|
map.insert(QLatin1String(QML_DEBUG_SERVER_PORT_KEY), d.qmlDebugServerPort);
|
||||||
map.insert(QLatin1String(USE_MULTIPROCESS_KEY), m_useMultiProcess);
|
map.insert(QLatin1String(USE_MULTIPROCESS_KEY), d.useMultiProcess);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerRunConfigurationAspect::fromMap(const QVariantMap &map)
|
void DebuggerRunConfigurationAspect::fromMap(const QVariantMap &map)
|
||||||
{
|
{
|
||||||
if (map.value(QLatin1String(USE_CPP_DEBUGGER_AUTO_KEY), false).toBool()) {
|
if (map.value(QLatin1String(USE_CPP_DEBUGGER_AUTO_KEY), false).toBool()) {
|
||||||
m_useCppDebugger = AutoEnabledLanguage;
|
d.useCppDebugger = AutoEnabledLanguage;
|
||||||
} else {
|
} else {
|
||||||
bool useCpp = map.value(QLatin1String(USE_CPP_DEBUGGER_KEY), false).toBool();
|
bool useCpp = map.value(QLatin1String(USE_CPP_DEBUGGER_KEY), false).toBool();
|
||||||
m_useCppDebugger = useCpp ? EnabledLanguage : DisabledLanguage;
|
d.useCppDebugger = useCpp ? EnabledLanguage : DisabledLanguage;
|
||||||
}
|
}
|
||||||
if (map.value(QLatin1String(USE_QML_DEBUGGER_AUTO_KEY), false).toBool()) {
|
if (map.value(QLatin1String(USE_QML_DEBUGGER_AUTO_KEY), false).toBool()) {
|
||||||
m_useQmlDebugger = AutoEnabledLanguage;
|
d.useQmlDebugger = AutoEnabledLanguage;
|
||||||
} else {
|
} else {
|
||||||
bool useQml = map.value(QLatin1String(USE_QML_DEBUGGER_KEY), false).toBool();
|
bool useQml = map.value(QLatin1String(USE_QML_DEBUGGER_KEY), false).toBool();
|
||||||
m_useQmlDebugger = useQml ? EnabledLanguage : DisabledLanguage;
|
d.useQmlDebugger = useQml ? EnabledLanguage : DisabledLanguage;
|
||||||
}
|
}
|
||||||
m_useMultiProcess = map.value(QLatin1String(USE_MULTIPROCESS_KEY), false).toBool();
|
d.useMultiProcess = map.value(QLatin1String(USE_MULTIPROCESS_KEY), false).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
DebuggerRunConfigurationAspect *DebuggerRunConfigurationAspect::create
|
DebuggerRunConfigurationAspect *DebuggerRunConfigurationAspect::create
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
#define DEBUGGERRUNCONFIGURATIONASPECT_H
|
#define DEBUGGERRUNCONFIGURATIONASPECT_H
|
||||||
|
|
||||||
#include "debugger_global.h"
|
#include "debugger_global.h"
|
||||||
|
#include "debuggerconstants.h"
|
||||||
|
|
||||||
#include <projectexplorer/runconfiguration.h>
|
#include <projectexplorer/runconfiguration.h>
|
||||||
|
|
||||||
@@ -39,6 +40,21 @@ namespace Debugger {
|
|||||||
|
|
||||||
namespace Internal { class DebuggerRunConfigWidget; }
|
namespace Internal { class DebuggerRunConfigWidget; }
|
||||||
|
|
||||||
|
enum DebuggerLanguageStatus {
|
||||||
|
DisabledLanguage = 0,
|
||||||
|
EnabledLanguage,
|
||||||
|
AutoEnabledLanguage
|
||||||
|
};
|
||||||
|
|
||||||
|
class DEBUGGER_EXPORT DebuggerRunConfigurationAspectData
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DebuggerLanguageStatus useCppDebugger = AutoEnabledLanguage;
|
||||||
|
DebuggerLanguageStatus useQmlDebugger = AutoEnabledLanguage;
|
||||||
|
uint qmlDebugServerPort = Constants::QML_DEFAULT_DEBUG_SERVER_PORT;
|
||||||
|
bool useMultiProcess = false;
|
||||||
|
};
|
||||||
|
|
||||||
class DEBUGGER_EXPORT DebuggerRunConfigurationAspect
|
class DEBUGGER_EXPORT DebuggerRunConfigurationAspect
|
||||||
: public ProjectExplorer::IRunConfigurationAspect
|
: public ProjectExplorer::IRunConfigurationAspect
|
||||||
{
|
{
|
||||||
@@ -48,12 +64,6 @@ public:
|
|||||||
DebuggerRunConfigurationAspect(ProjectExplorer::RunConfiguration *runConfiguration);
|
DebuggerRunConfigurationAspect(ProjectExplorer::RunConfiguration *runConfiguration);
|
||||||
DebuggerRunConfigurationAspect *create(ProjectExplorer::RunConfiguration *runConfiguration) const;
|
DebuggerRunConfigurationAspect *create(ProjectExplorer::RunConfiguration *runConfiguration) const;
|
||||||
|
|
||||||
enum DebuggerLanguageStatus {
|
|
||||||
DisabledLanguage = 0,
|
|
||||||
EnabledLanguage,
|
|
||||||
AutoEnabledLanguage
|
|
||||||
};
|
|
||||||
|
|
||||||
void fromMap(const QVariantMap &map);
|
void fromMap(const QVariantMap &map);
|
||||||
void toMap(QVariantMap &map) const;
|
void toMap(QVariantMap &map) const;
|
||||||
|
|
||||||
@@ -70,12 +80,8 @@ public:
|
|||||||
bool isQmlDebuggingSpinboxSuppressed() const;
|
bool isQmlDebuggingSpinboxSuppressed() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DebuggerLanguageStatus m_useCppDebugger;
|
|
||||||
DebuggerLanguageStatus m_useQmlDebugger;
|
|
||||||
uint m_qmlDebugServerPort;
|
|
||||||
bool m_useMultiProcess;
|
|
||||||
|
|
||||||
friend class Internal::DebuggerRunConfigWidget;
|
friend class Internal::DebuggerRunConfigWidget;
|
||||||
|
DebuggerRunConfigurationAspectData d;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Debugger
|
} // namespace Debugger
|
||||||
|
|||||||
Reference in New Issue
Block a user