DebuggerRunConfigurationAspect: Suppress widgets as necessary

Suppress widgets of the DebuggerRunConfigurationAspect widget as
required.

Change-Id: I4e384d4e725bd95bea51465e28e26ece3e2f5cc8
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
Tobias Hunger
2013-04-05 13:20:52 +02:00
parent fd1f284892
commit ace6829742
5 changed files with 18 additions and 62 deletions

View File

@@ -34,6 +34,7 @@
#include <coreplugin/icontext.h> #include <coreplugin/icontext.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/helpmanager.h> #include <coreplugin/helpmanager.h>
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/project.h> #include <projectexplorer/project.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/runconfiguration.h> #include <projectexplorer/runconfiguration.h>
@@ -125,9 +126,6 @@ DebuggerRunConfigWidget::DebuggerRunConfigWidget(DebuggerRunConfigurationAspect
connect(m_useMultiProcess, SIGNAL(toggled(bool)), connect(m_useMultiProcess, SIGNAL(toggled(bool)),
SLOT(useMultiProcessToggled(bool))); SLOT(useMultiProcessToggled(bool)));
if (m_aspect->isDisplaySuppressed())
hide();
if (m_aspect->areQmlDebuggingOptionsSuppressed()) { if (m_aspect->areQmlDebuggingOptionsSuppressed()) {
m_debugServerPortLabel->hide(); m_debugServerPortLabel->hide();
m_debugServerPort->hide(); m_debugServerPort->hide();
@@ -199,11 +197,7 @@ DebuggerRunConfigurationAspect::DebuggerRunConfigurationAspect(
m_useCppDebugger(true), m_useCppDebugger(true),
m_useQmlDebugger(AutoEnableQmlDebugger), m_useQmlDebugger(AutoEnableQmlDebugger),
m_qmlDebugServerPort(Constants::QML_DEFAULT_DEBUG_SERVER_PORT), m_qmlDebugServerPort(Constants::QML_DEFAULT_DEBUG_SERVER_PORT),
m_useMultiProcess(false), m_useMultiProcess(false)
m_suppressDisplay(false),
m_suppressQmlDebuggingOptions(false),
m_suppressCppDebuggingOptions(false),
m_suppressQmlDebuggingSpinbox(false)
{ {
ctor(); ctor();
} }
@@ -215,11 +209,7 @@ DebuggerRunConfigurationAspect::DebuggerRunConfigurationAspect(
m_useCppDebugger(other->m_useCppDebugger), m_useCppDebugger(other->m_useCppDebugger),
m_useQmlDebugger(other->m_useQmlDebugger), m_useQmlDebugger(other->m_useQmlDebugger),
m_qmlDebugServerPort(other->m_qmlDebugServerPort), m_qmlDebugServerPort(other->m_qmlDebugServerPort),
m_useMultiProcess(other->m_useMultiProcess), m_useMultiProcess(other->m_useMultiProcess)
m_suppressDisplay(other->m_suppressDisplay),
m_suppressQmlDebuggingOptions(other->m_suppressQmlDebuggingOptions),
m_suppressCppDebuggingOptions(other->m_suppressCppDebuggingOptions),
m_suppressQmlDebuggingSpinbox(other->m_suppressQmlDebuggingSpinbox)
{ {
ctor(); ctor();
} }
@@ -274,44 +264,25 @@ void DebuggerRunConfigurationAspect::setUseMultiProcess(bool value)
m_useMultiProcess = value; m_useMultiProcess = value;
} }
void DebuggerRunConfigurationAspect::suppressDisplay()
{
m_suppressDisplay = true;
}
void DebuggerRunConfigurationAspect::suppressQmlDebuggingOptions()
{
m_suppressQmlDebuggingOptions = true;
}
void DebuggerRunConfigurationAspect::suppressCppDebuggingOptions()
{
m_suppressCppDebuggingOptions = true;
}
void DebuggerRunConfigurationAspect::suppressQmlDebuggingSpinbox()
{
m_suppressQmlDebuggingSpinbox = true;
}
bool DebuggerRunConfigurationAspect::isDisplaySuppressed() const
{
return m_suppressDisplay;
}
bool DebuggerRunConfigurationAspect::areQmlDebuggingOptionsSuppressed() const bool DebuggerRunConfigurationAspect::areQmlDebuggingOptionsSuppressed() const
{ {
return m_suppressQmlDebuggingOptions; return !m_runConfiguration->target()->project()
->projectLanguages().contains(ProjectExplorer::Constants::LANG_QMLJS);
} }
bool DebuggerRunConfigurationAspect::areCppDebuggingOptionsSuppressed() const bool DebuggerRunConfigurationAspect::areCppDebuggingOptionsSuppressed() const
{ {
return m_suppressCppDebuggingOptions; return !m_runConfiguration->target()->project()
->projectLanguages().contains(ProjectExplorer::Constants::LANG_CXX);
} }
bool DebuggerRunConfigurationAspect::isQmlDebuggingSpinboxSuppressed() const bool DebuggerRunConfigurationAspect::isQmlDebuggingSpinboxSuppressed() const
{ {
return m_suppressQmlDebuggingSpinbox; ProjectExplorer::Kit *k = m_runConfiguration->target()->kit();
ProjectExplorer::IDevice::ConstPtr dev = ProjectExplorer::DeviceKitInformation::device(k);
if (dev.isNull())
return false;
return dev->portsGatheringMethod().isNull(); // We know the free ports...
} }
QString DebuggerRunConfigurationAspect::displayName() const QString DebuggerRunConfigurationAspect::displayName() const
@@ -350,6 +321,9 @@ DebuggerRunConfigurationAspect *DebuggerRunConfigurationAspect::clone(
ProjectExplorer::RunConfigWidget *DebuggerRunConfigurationAspect::createConfigurationWidget() ProjectExplorer::RunConfigWidget *DebuggerRunConfigurationAspect::createConfigurationWidget()
{ {
if (areCppDebuggingOptionsSuppressed() && areQmlDebuggingOptionsSuppressed())
return 0;
else
return new Internal::DebuggerRunConfigWidget(this); return new Internal::DebuggerRunConfigWidget(this);
} }
@@ -357,6 +331,8 @@ void DebuggerRunConfigurationAspect::ctor()
{ {
connect(this, SIGNAL(debuggersChanged()), connect(this, SIGNAL(debuggersChanged()),
m_runConfiguration, SIGNAL(requestRunActionsUpdate())); m_runConfiguration, SIGNAL(requestRunActionsUpdate()));
setUseCppDebugger(!areCppDebuggingOptionsSuppressed());
setUseQmlDebugger(!areQmlDebuggingOptionsSuppressed());
} }
} // namespace Debugger } // namespace Debugger

View File

@@ -70,11 +70,6 @@ public:
void setQmllDebugServerPort(uint port); void setQmllDebugServerPort(uint port);
bool useMultiProcess() const; bool useMultiProcess() const;
void setUseMultiProcess(bool on); void setUseMultiProcess(bool on);
void suppressDisplay();
void suppressQmlDebuggingOptions();
void suppressCppDebuggingOptions();
void suppressQmlDebuggingSpinbox();
bool isDisplaySuppressed() const;
bool areQmlDebuggingOptionsSuppressed() const; bool areQmlDebuggingOptionsSuppressed() const;
bool areCppDebuggingOptionsSuppressed() const; bool areCppDebuggingOptionsSuppressed() const;
bool isQmlDebuggingSpinboxSuppressed() const; bool isQmlDebuggingSpinboxSuppressed() const;
@@ -92,11 +87,6 @@ private:
uint m_qmlDebugServerPort; uint m_qmlDebugServerPort;
bool m_useMultiProcess; bool m_useMultiProcess;
bool m_suppressDisplay;
bool m_suppressQmlDebuggingOptions;
bool m_suppressCppDebuggingOptions;
bool m_suppressQmlDebuggingSpinbox;
friend class Internal::DebuggerRunConfigWidget; friend class Internal::DebuggerRunConfigWidget;
}; };

View File

@@ -77,9 +77,6 @@ void MaemoRunConfiguration::init()
connect(m_remoteMounts, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, connect(m_remoteMounts, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this,
SLOT(handleRemoteMountsChanged())); SLOT(handleRemoteMountsChanged()));
connect(m_remoteMounts, SIGNAL(modelReset()), SLOT(handleRemoteMountsChanged())); connect(m_remoteMounts, SIGNAL(modelReset()), SLOT(handleRemoteMountsChanged()));
if (DeviceTypeKitInformation::deviceTypeId(target()->kit()) != HarmattanOsType)
extraAspect<Debugger::DebuggerRunConfigurationAspect>()->suppressQmlDebuggingOptions();
} }
bool MaemoRunConfiguration::isEnabled() const bool MaemoRunConfiguration::isEnabled() const

View File

@@ -92,12 +92,6 @@ QString QmlProjectRunConfiguration::disabledReason() const
void QmlProjectRunConfiguration::ctor() void QmlProjectRunConfiguration::ctor()
{ {
// reset default settings in constructor // reset default settings in constructor
Debugger::DebuggerRunConfigurationAspect *aspect
= extraAspect<Debugger::DebuggerRunConfigurationAspect>();
aspect->setUseCppDebugger(false);
aspect->setUseQmlDebugger(true);
aspect->suppressQmlDebuggingSpinbox();
EditorManager *em = Core::EditorManager::instance(); EditorManager *em = Core::EditorManager::instance();
connect(em, SIGNAL(currentEditorChanged(Core::IEditor*)), connect(em, SIGNAL(currentEditorChanged(Core::IEditor*)),
this, SLOT(changeCurrentFile(Core::IEditor*))); this, SLOT(changeCurrentFile(Core::IEditor*)));

View File

@@ -118,7 +118,6 @@ RemoteLinuxRunConfiguration::~RemoteLinuxRunConfiguration()
void RemoteLinuxRunConfiguration::init() void RemoteLinuxRunConfiguration::init()
{ {
setDefaultDisplayName(defaultDisplayName()); setDefaultDisplayName(defaultDisplayName());
extraAspect<Debugger::DebuggerRunConfigurationAspect>()->suppressQmlDebuggingSpinbox();
connect(target(), SIGNAL(deploymentDataChanged()), SLOT(handleBuildSystemDataUpdated())); connect(target(), SIGNAL(deploymentDataChanged()), SLOT(handleBuildSystemDataUpdated()));
connect(target(), SIGNAL(applicationTargetsChanged()), SLOT(handleBuildSystemDataUpdated())); connect(target(), SIGNAL(applicationTargetsChanged()), SLOT(handleBuildSystemDataUpdated()));