Commit d191b22d authored by hjk's avatar hjk Committed by hjk

debugger: split the 'start and debug remote' and 'attach to remote' cases ui-wise

Change-Id: I229ba996bfe2b38fb30891cdad5f62b6fe430443
Reviewed-on: http://codereview.qt-project.org/4898Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent 71a9d811
......@@ -656,7 +656,7 @@ void StartExternalDialog::changed()
//
///////////////////////////////////////////////////////////////////////
StartRemoteDialog::StartRemoteDialog(QWidget *parent)
StartRemoteDialog::StartRemoteDialog(QWidget *parent, bool enableStartScript)
: QDialog(parent),
m_ui(new Ui::StartRemoteDialog)
{
......@@ -670,14 +670,17 @@ StartRemoteDialog::StartRemoteDialog(QWidget *parent)
m_ui->sysrootPathChooser->setPromptDialogTitle(tr("Select Sysroot"));
m_ui->overrideStartScriptPathChooser->setExpectedKind(PathChooser::File);
m_ui->overrideStartScriptPathChooser->setPromptDialogTitle(tr("Select GDB Start Script"));
m_ui->serverStartScript->setExpectedKind(PathChooser::File);
m_ui->serverStartScript->setPromptDialogTitle(tr("Select Server Start Script"));
m_ui->serverStartScriptPathChooser->setExpectedKind(PathChooser::File);
m_ui->serverStartScriptPathChooser->setPromptDialogTitle(tr("Select Server Start Script"));
m_ui->serverStartScriptPathChooser->setVisible(enableStartScript);
m_ui->serverStartScriptLabel->setVisible(enableStartScript);
m_ui->useServerStartScriptCheckBox->setVisible(enableStartScript);
m_ui->useServerStartScriptLabel->setVisible(enableStartScript);
connect(m_ui->useServerStartScriptCheckBox, SIGNAL(toggled(bool)),
this, SLOT(updateState()));
connect(m_ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(m_ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
SLOT(updateState()));
connect(m_ui->buttonBox, SIGNAL(accepted()), SLOT(accept()));
connect(m_ui->buttonBox, SIGNAL(rejected()), SLOT(reject()));
updateState();
}
......@@ -771,12 +774,12 @@ void StartRemoteDialog::setOverrideStartScript(const QString &scriptName)
void StartRemoteDialog::setServerStartScript(const QString &scriptName)
{
m_ui->serverStartScript->setPath(scriptName);
m_ui->serverStartScriptPathChooser->setPath(scriptName);
}
QString StartRemoteDialog::serverStartScript() const
{
return m_ui->serverStartScript->path();
return m_ui->serverStartScriptPathChooser->path();
}
void StartRemoteDialog::setUseServerStartScript(bool on)
......@@ -803,7 +806,7 @@ void StartRemoteDialog::updateState()
{
bool enabled = m_ui->useServerStartScriptCheckBox->isChecked();
m_ui->serverStartScriptLabel->setEnabled(enabled);
m_ui->serverStartScript->setEnabled(enabled);
m_ui->serverStartScriptPathChooser->setEnabled(enabled);
}
///////////////////////////////////////////////////////////////////////
......
......@@ -179,7 +179,7 @@ class StartRemoteDialog : public QDialog
Q_OBJECT
public:
explicit StartRemoteDialog(QWidget *parent);
explicit StartRemoteDialog(QWidget *parent, bool enableStartScript);
~StartRemoteDialog();
QString localExecutable() const;
......
......@@ -723,6 +723,8 @@ public slots:
void startExternalApplication();
void startRemoteCdbSession();
void startRemoteApplication();
bool queryRemoteParameters(DebuggerStartParameters &sp, bool useScript);
void attachRemoteApplication();
void attachToQmlPort();
void startRemoteEngine();
void attachExternalApplication();
......@@ -1023,6 +1025,7 @@ public:
QAction *m_startExternalAction;
QAction *m_startRemoteAction;
QAction *m_attachToQmlPortAction;
QAction *m_attachRemoteAction;
QAction *m_startRemoteCdbAction;
QAction *m_startRemoteLldbAction;
QAction *m_attachExternalAction;
......@@ -1139,6 +1142,7 @@ DebuggerPluginPrivate::DebuggerPluginPrivate(DebuggerPlugin *plugin) :
m_startAction = 0;
m_startExternalAction = 0;
m_startRemoteAction = 0;
m_attachRemoteAction = 0;
m_attachToQmlPortAction = 0;
m_startRemoteCdbAction = 0;
m_startRemoteLldbAction = 0;
......@@ -1375,6 +1379,7 @@ void DebuggerPluginPrivate::languagesChanged()
m_attachExternalAction->setVisible(debuggerIsCPP);
m_attachCoreAction->setVisible(debuggerIsCPP);
m_startRemoteAction->setVisible(debuggerIsCPP);
m_attachRemoteAction->setVisible(debuggerIsCPP);
m_detachAction->setVisible(debuggerIsCPP);
m_attachToQmlPortAction->setVisible(m_mainWindow->activeDebugLanguages() & QmlLanguage);
}
......@@ -1546,10 +1551,9 @@ void DebuggerPluginPrivate::startRemoteCdbSession()
startDebugger(rc);
}
void DebuggerPluginPrivate::startRemoteApplication()
bool DebuggerPluginPrivate::queryRemoteParameters(DebuggerStartParameters &sp, bool useScript)
{
DebuggerStartParameters sp;
StartRemoteDialog dlg(mainWindow());
StartRemoteDialog dlg(mainWindow(), useScript);
QStringList arches;
arches.append(_("i386:x86-64:intel"));
arches.append(_("i386"));
......@@ -1582,7 +1586,7 @@ void DebuggerPluginPrivate::startRemoteApplication()
configValue(_("LastUseServerStartScript")).toBool());
dlg.setSysroot(configValue(_("LastSysroot")).toString());
if (dlg.exec() != QDialog::Accepted)
return;
return false;
setConfigValue(_("LastRemoteChannel"), dlg.remoteChannel());
setConfigValue(_("LastLocalExecutable"), dlg.localExecutable());
setConfigValue(_("LastDebugger"), dlg.debugger());
......@@ -1605,6 +1609,24 @@ void DebuggerPluginPrivate::startRemoteApplication()
sp.useServerStartScript = dlg.useServerStartScript();
sp.serverStartScript = dlg.serverStartScript();
sp.sysroot = dlg.sysroot();
return true;
}
void DebuggerPluginPrivate::startRemoteApplication()
{
DebuggerStartParameters sp;
if (queryRemoteParameters(sp, true))
if (RunControl *rc = createDebugger(sp))
startDebugger(rc);
}
void DebuggerPluginPrivate::attachRemoteApplication()
{
DebuggerStartParameters sp;
if (!queryRemoteParameters(sp, false))
return;
sp.useServerStartScript = false;
sp.serverStartScript.clear();
if (RunControl *rc = createDebugger(sp))
startDebugger(rc);
}
......@@ -2011,6 +2033,7 @@ void DebuggerPluginPrivate::setInitialState()
m_attachToQmlPortAction->setEnabled(true);
m_attachCoreAction->setEnabled(true);
m_startRemoteAction->setEnabled(true);
m_attachRemoteAction->setEnabled(true);
m_detachAction->setEnabled(false);
m_watchAction1->setEnabled(true);
......@@ -2128,6 +2151,7 @@ void DebuggerPluginPrivate::updateState(DebuggerEngine *engine)
m_attachExternalAction->setEnabled(true);
m_attachCoreAction->setEnabled(true);
m_startRemoteAction->setEnabled(true);
m_attachRemoteAction->setEnabled(true);
const bool isCore = engine->startParameters().startMode == AttachCore;
const bool stopped = state == InferiorStopOk;
......@@ -2869,9 +2893,13 @@ void DebuggerPluginPrivate::extensionsInitialized()
connect(act, SIGNAL(triggered()), SLOT(attachCore()));
act = m_startRemoteAction = new QAction(this);
act->setText(tr("Start and Attach to Remote Application..."));
act->setText(tr("Start and Debug Remote Application..."));
connect(act, SIGNAL(triggered()), SLOT(startRemoteApplication()));
act = m_attachRemoteAction = new QAction(this);
act->setText(tr("Attach to Remote Debug Server..."));
connect(act, SIGNAL(triggered()), SLOT(attachRemoteApplication()));
act = m_attachToQmlPortAction = new QAction(this);
act->setText(tr("Attach to QML Port..."));
connect(act, SIGNAL(triggered()), SLOT(attachToQmlPort()));
......@@ -2921,6 +2949,11 @@ void DebuggerPluginPrivate::extensionsInitialized()
mstart->addAction(cmd, CC::G_DEFAULT_ONE);
cmd = am->registerAction(m_startRemoteAction,
"Debugger.StartRemote", globalcontext);
cmd->setAttribute(Command::CA_Hide);
mstart->addAction(cmd, CC::G_DEFAULT_ONE);
cmd = am->registerAction(m_attachRemoteAction,
"Debugger.AttachRemote", globalcontext);
cmd->setAttribute(Command::CA_Hide);
mstart->addAction(cmd, CC::G_DEFAULT_ONE);
......
......@@ -109,7 +109,7 @@
<item row="6" column="0">
<widget class="QLabel" name="overrideStartScriptLabel">
<property name="text">
<string>Override s&amp;tart script:</string>
<string>Override host GDB s&amp;tart script:</string>
</property>
<property name="buddy">
<cstring>overrideStartScriptPathChooser</cstring>
......@@ -138,12 +138,12 @@
<string>&amp;Server start script:</string>
</property>
<property name="buddy">
<cstring>serverStartScript</cstring>
<cstring>serverStartScriptPathChooser</cstring>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="Utils::PathChooser" name="serverStartScript"/>
<widget class="Utils::PathChooser" name="serverStartScriptPathChooser"/>
</item>
</layout>
</item>
......
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