Commit ace68297 authored by Tobias Hunger's avatar Tobias Hunger
Browse files

DebuggerRunConfigurationAspect: Suppress widgets as necessary



Suppress widgets of the DebuggerRunConfigurationAspect widget as
required.

Change-Id: I4e384d4e725bd95bea51465e28e26ece3e2f5cc8
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent fd1f2848
......@@ -34,6 +34,7 @@
#include <coreplugin/icontext.h>
#include <coreplugin/icore.h>
#include <coreplugin/helpmanager.h>
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/runconfiguration.h>
......@@ -125,9 +126,6 @@ DebuggerRunConfigWidget::DebuggerRunConfigWidget(DebuggerRunConfigurationAspect
connect(m_useMultiProcess, SIGNAL(toggled(bool)),
SLOT(useMultiProcessToggled(bool)));
if (m_aspect->isDisplaySuppressed())
hide();
if (m_aspect->areQmlDebuggingOptionsSuppressed()) {
m_debugServerPortLabel->hide();
m_debugServerPort->hide();
......@@ -199,11 +197,7 @@ DebuggerRunConfigurationAspect::DebuggerRunConfigurationAspect(
m_useCppDebugger(true),
m_useQmlDebugger(AutoEnableQmlDebugger),
m_qmlDebugServerPort(Constants::QML_DEFAULT_DEBUG_SERVER_PORT),
m_useMultiProcess(false),
m_suppressDisplay(false),
m_suppressQmlDebuggingOptions(false),
m_suppressCppDebuggingOptions(false),
m_suppressQmlDebuggingSpinbox(false)
m_useMultiProcess(false)
{
ctor();
}
......@@ -215,11 +209,7 @@ DebuggerRunConfigurationAspect::DebuggerRunConfigurationAspect(
m_useCppDebugger(other->m_useCppDebugger),
m_useQmlDebugger(other->m_useQmlDebugger),
m_qmlDebugServerPort(other->m_qmlDebugServerPort),
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)
m_useMultiProcess(other->m_useMultiProcess)
{
ctor();
}
......@@ -274,44 +264,25 @@ void DebuggerRunConfigurationAspect::setUseMultiProcess(bool 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
{
return m_suppressQmlDebuggingOptions;
return !m_runConfiguration->target()->project()
->projectLanguages().contains(ProjectExplorer::Constants::LANG_QMLJS);
}
bool DebuggerRunConfigurationAspect::areCppDebuggingOptionsSuppressed() const
{
return m_suppressCppDebuggingOptions;
return !m_runConfiguration->target()->project()
->projectLanguages().contains(ProjectExplorer::Constants::LANG_CXX);
}
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
......@@ -350,13 +321,18 @@ DebuggerRunConfigurationAspect *DebuggerRunConfigurationAspect::clone(
ProjectExplorer::RunConfigWidget *DebuggerRunConfigurationAspect::createConfigurationWidget()
{
return new Internal::DebuggerRunConfigWidget(this);
if (areCppDebuggingOptionsSuppressed() && areQmlDebuggingOptionsSuppressed())
return 0;
else
return new Internal::DebuggerRunConfigWidget(this);
}
void DebuggerRunConfigurationAspect::ctor()
{
connect(this, SIGNAL(debuggersChanged()),
m_runConfiguration, SIGNAL(requestRunActionsUpdate()));
setUseCppDebugger(!areCppDebuggingOptionsSuppressed());
setUseQmlDebugger(!areQmlDebuggingOptionsSuppressed());
}
} // namespace Debugger
......
......@@ -70,11 +70,6 @@ public:
void setQmllDebugServerPort(uint port);
bool useMultiProcess() const;
void setUseMultiProcess(bool on);
void suppressDisplay();
void suppressQmlDebuggingOptions();
void suppressCppDebuggingOptions();
void suppressQmlDebuggingSpinbox();
bool isDisplaySuppressed() const;
bool areQmlDebuggingOptionsSuppressed() const;
bool areCppDebuggingOptionsSuppressed() const;
bool isQmlDebuggingSpinboxSuppressed() const;
......@@ -92,11 +87,6 @@ private:
uint m_qmlDebugServerPort;
bool m_useMultiProcess;
bool m_suppressDisplay;
bool m_suppressQmlDebuggingOptions;
bool m_suppressCppDebuggingOptions;
bool m_suppressQmlDebuggingSpinbox;
friend class Internal::DebuggerRunConfigWidget;
};
......
......@@ -77,9 +77,6 @@ void MaemoRunConfiguration::init()
connect(m_remoteMounts, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this,
SLOT(handleRemoteMountsChanged()));
connect(m_remoteMounts, SIGNAL(modelReset()), SLOT(handleRemoteMountsChanged()));
if (DeviceTypeKitInformation::deviceTypeId(target()->kit()) != HarmattanOsType)
extraAspect<Debugger::DebuggerRunConfigurationAspect>()->suppressQmlDebuggingOptions();
}
bool MaemoRunConfiguration::isEnabled() const
......
......@@ -92,12 +92,6 @@ QString QmlProjectRunConfiguration::disabledReason() const
void QmlProjectRunConfiguration::ctor()
{
// reset default settings in constructor
Debugger::DebuggerRunConfigurationAspect *aspect
= extraAspect<Debugger::DebuggerRunConfigurationAspect>();
aspect->setUseCppDebugger(false);
aspect->setUseQmlDebugger(true);
aspect->suppressQmlDebuggingSpinbox();
EditorManager *em = Core::EditorManager::instance();
connect(em, SIGNAL(currentEditorChanged(Core::IEditor*)),
this, SLOT(changeCurrentFile(Core::IEditor*)));
......
......@@ -118,7 +118,6 @@ RemoteLinuxRunConfiguration::~RemoteLinuxRunConfiguration()
void RemoteLinuxRunConfiguration::init()
{
setDefaultDisplayName(defaultDisplayName());
extraAspect<Debugger::DebuggerRunConfigurationAspect>()->suppressQmlDebuggingSpinbox();
connect(target(), SIGNAL(deploymentDataChanged()), SLOT(handleBuildSystemDataUpdated()));
connect(target(), SIGNAL(applicationTargetsChanged()), SLOT(handleBuildSystemDataUpdated()));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment