Skip to content
Snippets Groups Projects
Commit 5ad396cf authored by hjk's avatar hjk Committed by hjk
Browse files

debugger: merge DebuggerLanguageChooser into DebuggerRunConfigWidget


This also lets runconfigurations like Maemo suppress the QML parts
completely.

Change-Id: I19573053b565b21be4407f1e0ea024c07ffd4d73
Reviewed-by: default avatarChristian Kandeler <christian.kandeler@nokia.com>
parent b266472a
No related branches found
No related tags found
No related merge requests found
......@@ -158,33 +158,22 @@ static inline QString msgEngineNotAvailable(DebuggerEngineType et)
//
////////////////////////////////////////////////////////////////////////
class DebuggerLanguageChooser : public QWidget
class DebuggerRunConfigWidget : public ProjectExplorer::RunConfigWidget
{
Q_OBJECT
public:
explicit DebuggerLanguageChooser(QWidget *parent = 0);
bool cppChecked() const;
bool qmlChecked() const;
uint qmlDebugServerPort() const;
void setCppChecked(bool value);
void setQmlChecked(bool value);
void setQmlDebugServerPort(uint port);
signals:
void cppLanguageToggled(bool value);
void qmlLanguageToggled(bool value);
void qmlDebugServerPortChanged(uint port);
void openHelpUrl(const QString &url);
explicit DebuggerRunConfigWidget(RunConfiguration *runConfiguration);
QString displayName() const { return tr("Debugger Settings"); }
private slots:
void useCppDebuggerToggled(bool toggled);
void useQmlDebuggerToggled(bool toggled);
void onDebugServerPortChanged(int port);
void qmlDebugServerPortChanged(int port);
public:
DebuggerProjectSettings *m_settings; // not owned
private:
QCheckBox *m_useCppDebugger;
QCheckBox *m_useQmlDebugger;
QSpinBox *m_debugServerPort;
......@@ -192,36 +181,42 @@ private:
QLabel *m_qmlDebuggerInfoLabel;
};
DebuggerLanguageChooser::DebuggerLanguageChooser(QWidget *parent)
: QWidget(parent)
DebuggerRunConfigWidget::DebuggerRunConfigWidget(RunConfiguration *runConfiguration)
{
m_useCppDebugger = new QCheckBox(tr("C++"), this);
m_useQmlDebugger = new QCheckBox(tr("QML"), this);
m_settings = runConfiguration->debuggerAspect();
connect(m_useCppDebugger, SIGNAL(toggled(bool)),
this, SLOT(useCppDebuggerToggled(bool)));
connect(m_useQmlDebugger, SIGNAL(toggled(bool)),
this, SLOT(useQmlDebuggerToggled(bool)));
m_useCppDebugger = new QCheckBox(tr("Enable C++"), this);
m_useQmlDebugger = new QCheckBox(tr("Enable QML"), this);
m_debugServerPortLabel = new QLabel(tr("Debug port:"), this);
m_debugServerPort = new QSpinBox(this);
m_debugServerPort->setMinimum(1);
m_debugServerPort->setMaximum(65535);
m_debugServerPortLabel = new QLabel(tr("Debug port:"), this);
m_debugServerPortLabel->setBuddy(m_debugServerPort);
m_qmlDebuggerInfoLabel = new QLabel(tr("<a href=\""
"qthelp://com.nokia.qtcreator/doc/creator-debugging-qml.html"
"\">What are the prerequisites?</a>"));
useCppDebuggerToggled(m_settings->useCppDebugger());
useQmlDebuggerToggled(m_settings->useQmlDebugger());
m_debugServerPort->setValue(m_settings->qmlDebugServerPort());
connect(m_qmlDebuggerInfoLabel, SIGNAL(linkActivated(QString)),
this, SIGNAL(openHelpUrl(QString)));
connect(m_useQmlDebugger, SIGNAL(toggled(bool)),
m_debugServerPort, SLOT(setEnabled(bool)));
Core::HelpManager::instance(), SLOT(handleHelpRequest(QString)));
connect(m_useQmlDebugger, SIGNAL(toggled(bool)),
m_debugServerPortLabel, SLOT(setEnabled(bool)));
SLOT(useQmlDebuggerToggled(bool)));
connect(m_useCppDebugger, SIGNAL(toggled(bool)),
SLOT(useCppDebuggerToggled(bool)));
connect(m_debugServerPort, SIGNAL(valueChanged(int)),
this, SLOT(onDebugServerPortChanged(int)));
SLOT(qmlDebugServerPortChanged(int)));
if (m_settings->areQmlDebuggingOptionsSuppressed()) {
m_debugServerPortLabel->hide();
m_debugServerPort->hide();
m_useQmlDebugger->hide();
}
QHBoxLayout *qmlLayout = new QHBoxLayout;
qmlLayout->setMargin(0);
......@@ -235,120 +230,33 @@ DebuggerLanguageChooser::DebuggerLanguageChooser(QWidget *parent)
layout->setMargin(0);
layout->addWidget(m_useCppDebugger);
layout->addLayout(qmlLayout);
setLayout(layout);
}
bool DebuggerLanguageChooser::cppChecked() const
{
return m_useCppDebugger->isChecked();
}
bool DebuggerLanguageChooser::qmlChecked() const
{
return m_useQmlDebugger->isChecked();
}
uint DebuggerLanguageChooser::qmlDebugServerPort() const
void DebuggerRunConfigWidget::qmlDebugServerPortChanged(int port)
{
return m_debugServerPort->value();
m_settings->m_qmlDebugServerPort = port;
}
void DebuggerLanguageChooser::setCppChecked(bool value)
void DebuggerRunConfigWidget::useCppDebuggerToggled(bool toggled)
{
m_useCppDebugger->setChecked(value);
}
void DebuggerLanguageChooser::setQmlChecked(bool value)
{
m_useQmlDebugger->setChecked(value);
m_debugServerPortLabel->setEnabled(value);
m_debugServerPort->setEnabled(value);
}
void DebuggerLanguageChooser::setQmlDebugServerPort(uint port)
{
m_debugServerPort->setValue(port);
}
void DebuggerLanguageChooser::useCppDebuggerToggled(bool toggled)
{
emit cppLanguageToggled(toggled);
m_settings->m_useCppDebugger = toggled;
if (!toggled && !m_useQmlDebugger->isChecked())
m_useQmlDebugger->setChecked(true);
}
void DebuggerLanguageChooser::useQmlDebuggerToggled(bool toggled)
void DebuggerRunConfigWidget::useQmlDebuggerToggled(bool toggled)
{
emit qmlLanguageToggled(toggled);
m_debugServerPort->setEnabled(toggled);
m_debugServerPortLabel->setEnabled(toggled);
m_settings->m_useQmlDebugger = toggled
? DebuggerProjectSettings::EnableQmlDebugger
: DebuggerProjectSettings::DisableQmlDebugger;
if (!toggled && !m_useCppDebugger->isChecked())
m_useCppDebugger->setChecked(true);
}
void DebuggerLanguageChooser::onDebugServerPortChanged(int port)
{
emit qmlDebugServerPortChanged((uint)port);
}
class DebuggerRunConfigWidget : public ProjectExplorer::RunConfigWidget
{
Q_OBJECT
public:
explicit DebuggerRunConfigWidget(RunConfiguration *runConfiguration)
{
m_settings = runConfiguration->debuggerAspect();
QLabel *debuggerLabel = new QLabel(tr("Languages:"), this);
debuggerLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::MinimumExpanding);
m_debuggerLanguageChooser = new DebuggerLanguageChooser(this);
m_debuggerLanguageChooser->setCppChecked(m_settings->useCppDebugger());
m_debuggerLanguageChooser->setQmlChecked(runConfiguration->useQmlDebugger());
m_debuggerLanguageChooser->setQmlDebugServerPort(m_settings->qmlDebugServerPort());
QFormLayout *layout = new QFormLayout(this);
layout->addRow(debuggerLabel, m_debuggerLanguageChooser);
setLayout(layout);
connect(m_debuggerLanguageChooser, SIGNAL(cppLanguageToggled(bool)),
this, SLOT(useCppDebuggerToggled(bool)));
connect(m_debuggerLanguageChooser, SIGNAL(qmlLanguageToggled(bool)),
this, SLOT(useQmlDebuggerToggled(bool)));
connect(m_debuggerLanguageChooser, SIGNAL(qmlDebugServerPortChanged(uint)),
this, SLOT(qmlDebugServerPortChanged(uint)));
connect(m_debuggerLanguageChooser, SIGNAL(openHelpUrl(QString)),
Core::HelpManager::instance(), SLOT(handleHelpRequest(QString)));
}
QString displayName() const
{
return tr("Debugger Settings");
}
public slots:
void useCppDebuggerToggled(bool toggled)
{
m_settings->m_useCppDebugger = toggled;
}
void useQmlDebuggerToggled(bool toggled)
{
m_settings->m_useQmlDebugger = toggled
? DebuggerProjectSettings::EnableQmlDebugger
: DebuggerProjectSettings::DisableQmlDebugger;
}
void qmlDebugServerPortChanged(uint port)
{
m_settings->m_qmlDebugServerPort = port;
}
public:
DebuggerProjectSettings *m_settings; // not owned
DebuggerLanguageChooser *m_debuggerLanguageChooser; // owned
};
////////////////////////////////////////////////////////////////////////
//
// DebuggerRunControlPrivate
......
......@@ -80,7 +80,7 @@ void MaemoRunConfiguration::init()
connect(m_remoteMounts, SIGNAL(modelReset()), SLOT(handleRemoteMountsChanged()));
if (!maemoTarget()->allowsQmlDebugging())
debuggerAspect()->setUseQmlDebugger(false);
debuggerAspect()->suppressQmlDebuggingOptions();
}
bool MaemoRunConfiguration::isEnabled() const
......
......@@ -91,8 +91,6 @@ MaemoRunConfigurationWidget::MaemoRunConfigurationWidget(
const AbstractQt4MaemoTarget * const maemoTarget
= qobject_cast<AbstractQt4MaemoTarget *>(runConfiguration->target());
m_mountDetailsContainer->setVisible(maemoTarget->allowsRemoteMounts());
if (!maemoTarget->allowsQmlDebugging())
m_remoteLinuxRunConfigWidget->suppressQmlDebuggingOptions();
connect(m_runConfiguration, SIGNAL(isEnabledChanged(bool)),
this, SLOT(runConfigurationEnabledChange(bool)));
......
......@@ -201,7 +201,8 @@ bool ProcessHandle::equals(const ProcessHandle &rhs) const
DebuggerProjectSettings::DebuggerProjectSettings() :
m_useCppDebugger(true),
m_useQmlDebugger(AutoEnableQmlDebugger),
m_qmlDebugServerPort(Constants::QML_DEFAULT_DEBUG_SERVER_PORT)
m_qmlDebugServerPort(Constants::QML_DEFAULT_DEBUG_SERVER_PORT),
m_suppressQmlDebuggingOptions(false)
{}
DebuggerProjectSettings::DebuggerProjectSettings(DebuggerProjectSettings *other) :
......@@ -260,7 +261,12 @@ void DebuggerProjectSettings::setQmlDebugServerPort(uint port)
void DebuggerProjectSettings::suppressQmlDebuggingOptions()
{
m_useQmlDebugger = SuppressQmlDebugger;
m_suppressQmlDebuggingOptions = true;
}
bool DebuggerProjectSettings::areQmlDebuggingOptionsSuppressed() const
{
return m_suppressQmlDebuggingOptions;
}
QString DebuggerProjectSettings::displayName() const
......
......@@ -99,7 +99,6 @@ public:
enum QmlDebuggerStatus {
DisableQmlDebugger = 0,
EnableQmlDebugger,
SuppressQmlDebugger,
AutoEnableQmlDebugger
};
......@@ -115,6 +114,7 @@ public:
uint qmlDebugServerPort() const;
void setQmlDebugServerPort(uint port);
void suppressQmlDebuggingOptions();
bool areQmlDebuggingOptionsSuppressed() const;
signals:
void debuggersChanged();
......@@ -124,6 +124,7 @@ public:
bool m_useCppDebugger;
QmlDebuggerStatus m_useQmlDebugger;
uint m_qmlDebugServerPort;
bool m_suppressQmlDebuggingOptions;
};
......
......@@ -141,11 +141,6 @@ void RemoteLinuxRunConfigurationWidget::addDisabledLabel(QVBoxLayout *topLayout)
topLayout->addLayout(hl);
}
void RemoteLinuxRunConfigurationWidget::suppressQmlDebuggingOptions()
{
d->runConfiguration->debuggerAspect()->suppressQmlDebuggingOptions();
}
void RemoteLinuxRunConfigurationWidget::runConfigurationEnabledChange(bool enabled)
{
d->topWidget.setEnabled(enabled);
......
......@@ -60,7 +60,6 @@ public:
void addFormLayoutRow(QWidget *label, QWidget *field);
void addDisabledLabel(QVBoxLayout *topLayout);
void suppressQmlDebuggingOptions();
Q_SLOT void runConfigurationEnabledChange(bool enabled);
private slots:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment