diff options
author | hjk <qthjk@ovi.com> | 2012-08-14 10:16:53 +0200 |
---|---|---|
committer | hjk <qthjk@ovi.com> | 2012-08-14 14:03:14 +0200 |
commit | 98a5fefb9a07de15a49fc324ce03002d6dfac493 (patch) | |
tree | 8929948cfef39111b7429760a3f126e01c8160d8 /src/plugins/debugger | |
parent | d42b9b026a8c982b7c1e56e0b5a9c9c50c664bd3 (diff) | |
download | qt-creator-98a5fefb9a07de15a49fc324ce03002d6dfac493.tar.gz |
debugger: simplify the handling of the start script option
Script will be used if and only if there is one given. No extra bool.
Change-Id: I095e01b2243f0fa1f7ba2ce9591e3d67b6de5241
Reviewed-by: hjk <qthjk@ovi.com>
Diffstat (limited to 'src/plugins/debugger')
-rw-r--r-- | src/plugins/debugger/debuggerdialogs.cpp | 49 | ||||
-rw-r--r-- | src/plugins/debugger/debuggerdialogs.h | 2 | ||||
-rw-r--r-- | src/plugins/debugger/debuggerengine.cpp | 1 | ||||
-rw-r--r-- | src/plugins/debugger/debuggerplugin.cpp | 3 | ||||
-rw-r--r-- | src/plugins/debugger/debuggerstartparameters.h | 2 | ||||
-rw-r--r-- | src/plugins/debugger/gdb/remotegdbserveradapter.cpp | 10 | ||||
-rw-r--r-- | src/plugins/debugger/gdb/startgdbserverdialog.cpp | 3 | ||||
-rw-r--r-- | src/plugins/debugger/loadcoredialog.cpp | 2 |
8 files changed, 26 insertions, 46 deletions
diff --git a/src/plugins/debugger/debuggerdialogs.cpp b/src/plugins/debugger/debuggerdialogs.cpp index b3b1b7e9d5..1d0a7decda 100644 --- a/src/plugins/debugger/debuggerdialogs.cpp +++ b/src/plugins/debugger/debuggerdialogs.cpp @@ -95,7 +95,6 @@ public: QCheckBox *breakAtMainCheckBox; QCheckBox *runInTerminalCheckBox; PathChooser *debuginfoPathChooser; - QCheckBox *useServerStartScriptCheckBox; QLabel *serverStartScriptLabel; PathChooser *serverStartScriptPathChooser; QComboBox *historyComboBox; @@ -134,13 +133,12 @@ public: QString workingDirectory; bool breakAtMain; bool runInTerminal; - bool useServerStartScript; QString serverStartScript; QString debugInfoLocation; }; StartApplicationParameters::StartApplicationParameters() : - breakAtMain(false), runInTerminal(false), useServerStartScript(false) + breakAtMain(false), runInTerminal(false) { } @@ -151,7 +149,6 @@ bool StartApplicationParameters::equals(const StartApplicationParameters &rhs) c && workingDirectory == rhs.workingDirectory && breakAtMain == rhs.breakAtMain && runInTerminal == rhs.runInTerminal - && useServerStartScript == rhs.useServerStartScript && serverStartScript == rhs.serverStartScript && profileId == rhs.profileId && debugInfoLocation == rhs.debugInfoLocation; @@ -184,7 +181,6 @@ void StartApplicationParameters::toSettings(QSettings *settings) const settings->setValue(_("LastExternalWorkingDirectory"), workingDirectory); settings->setValue(_("LastExternalBreakAtMain"), breakAtMain); settings->setValue(_("LastExternalRunInTerminal"), runInTerminal); - settings->setValue(_("LastUseServerStartScript"), useServerStartScript); settings->setValue(_("LastServerStartScript"), serverStartScript); settings->setValue(_("LastDebugInfoLocation"), debugInfoLocation); } @@ -199,7 +195,6 @@ void StartApplicationParameters::fromSettings(const QSettings *settings) breakAtMain = settings->value(_("LastExternalBreakAtMain")).toBool(); runInTerminal = settings->value(_("LastExternalRunInTerminal")).toBool(); serverStartScript = settings->value(_("LastServerStartScript")).toString(); - useServerStartScript = settings->value(_("LastUseServerStartScript")).toBool(); debugInfoLocation = settings->value(_("LastDebugInfoLocation")).toString(); } @@ -239,15 +234,22 @@ StartApplicationDialog::StartApplicationDialog(QWidget *parent) d->breakAtMainCheckBox = new QCheckBox(this); d->breakAtMainCheckBox->setText(QString()); - d->debuginfoPathChooser = new PathChooser(this); - d->debuginfoPathChooser->setPromptDialogTitle(tr("Select Location of Debugging Information")); - - d->useServerStartScriptCheckBox = new QCheckBox(this); d->serverStartScriptPathChooser = new PathChooser(this); d->serverStartScriptPathChooser->setExpectedKind(PathChooser::File); d->serverStartScriptPathChooser->setPromptDialogTitle(tr("Select Server Start Script")); + d->serverStartScriptPathChooser->setToolTip(tr( + "This option can be used to point to a script that will be used " + "to start a debug server. If the field is empty, Qt Creator's " + "default methods to set up debug servers will be used.")); d->serverStartScriptLabel = new QLabel(tr("&Server start script:"), this); d->serverStartScriptLabel->setBuddy(d->serverStartScriptPathChooser); + d->serverStartScriptLabel->setToolTip(d->serverStartScriptPathChooser->toolTip()); + + d->debuginfoPathChooser = new PathChooser(this); + d->debuginfoPathChooser->setPromptDialogTitle(tr("Select Location of Debugging Information")); + d->debuginfoPathChooser->setToolTip(tr( + "Base path for external debug information and debug sources." + "If empty, $SYSROOT/usr/lib/debug will be chosen.")); QFrame *line = new QFrame(this); line->setFrameShape(QFrame::HLine); @@ -271,21 +273,18 @@ StartApplicationDialog::StartApplicationDialog(QWidget *parent) formLayout->addRow(tr("&Working directory:"), d->workingDirectory); formLayout->addRow(tr("Run in &terminal:"), d->runInTerminalCheckBox); formLayout->addRow(tr("Break at \"&main\":"), d->breakAtMainCheckBox); - formLayout->addRow(tr("Use external script to start debug server"), d->useServerStartScriptCheckBox); formLayout->addRow(d->serverStartScriptLabel, d->serverStartScriptPathChooser); - formLayout->addRow(tr("Location of debugging &information:"), d->debuginfoPathChooser); - formLayout->addRow(line); - formLayout->addRow(tr("&Recent:"), d->historyComboBox); + formLayout->addRow(tr("Debug &information:"), d->debuginfoPathChooser); formLayout->addRow(line2); + formLayout->addRow(tr("&Recent:"), d->historyComboBox); QVBoxLayout *verticalLayout = new QVBoxLayout(this); verticalLayout->addLayout(formLayout); - verticalLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding)); - verticalLayout->addWidget(line); + verticalLayout->addStretch(); + verticalLayout->addRow(line); verticalLayout->addWidget(d->buttonBox); connect(d->localExecutablePathChooser, SIGNAL(changed(QString)), SLOT(updateState())); - connect(d->useServerStartScriptCheckBox, SIGNAL(toggled(bool)), SLOT(updateState())); connect(d->buttonBox, SIGNAL(accepted()), SLOT(accept())); connect(d->buttonBox, SIGNAL(rejected()), SLOT(reject())); connect(d->historyComboBox, SIGNAL(currentIndexChanged(int)), @@ -309,11 +308,10 @@ void StartApplicationDialog::setHistory(const QList<StartApplicationParameters> } } -void StartApplicationDialog::setScriptVisible(bool on) +void StartApplicationDialog::hideStartScript() { - d->useServerStartScriptCheckBox->setVisible(on); - d->serverStartScriptPathChooser->setVisible(on); - d->serverStartScriptLabel->setVisible(on); + d->serverStartScriptPathChooser->setVisible(false); + d->serverStartScriptLabel->setVisible(false); } void StartApplicationDialog::historyIndexChanged(int index) @@ -334,9 +332,6 @@ void StartApplicationDialog::updateState() { bool okEnabled = d->localExecutablePathChooser->isValid(); d->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(okEnabled); - bool startScriptEnabled = d->useServerStartScriptCheckBox->isChecked(); - d->serverStartScriptLabel->setEnabled(startScriptEnabled); - d->serverStartScriptPathChooser->setEnabled(startScriptEnabled); } bool StartApplicationDialog::run(QWidget *parent, QSettings *settings, DebuggerStartParameters *sp) @@ -362,7 +357,8 @@ bool StartApplicationDialog::run(QWidget *parent, QSettings *settings, DebuggerS StartApplicationDialog dialog(parent); dialog.setHistory(history); dialog.setParameters(history.back()); - dialog.setScriptVisible(sp->startMode != AttachToRemoteServer); + if (sp->startMode == AttachToRemoteServer) + dialog.hideStartScript(); if (dialog.exec() != QDialog::Accepted) return false; @@ -391,7 +387,6 @@ bool StartApplicationDialog::run(QWidget *parent, QSettings *settings, DebuggerS if (!newParameters.processArgs.isEmpty()) sp->processArgs = newParameters.processArgs; sp->breakOnMain = newParameters.breakAtMain; - sp->useServerStartScript = newParameters.useServerStartScript; sp->serverStartScript = newParameters.serverStartScript; sp->debugInfoLocation = newParameters.debugInfoLocation; @@ -405,7 +400,6 @@ StartApplicationParameters StartApplicationDialog::parameters() const { StartApplicationParameters result; result.localExecutable = d->localExecutablePathChooser->path(); - result.useServerStartScript = d->useServerStartScriptCheckBox->isChecked(); result.serverStartScript = d->serverStartScriptPathChooser->path(); result.profileId = d->profileChooser->currentProfileId(); result.debugInfoLocation = d->debuginfoPathChooser->path(); @@ -420,7 +414,6 @@ void StartApplicationDialog::setParameters(const StartApplicationParameters &p) { d->profileChooser->setCurrentProfileId(p.profileId); d->localExecutablePathChooser->setPath(p.localExecutable); - d->useServerStartScriptCheckBox->setChecked(p.useServerStartScript); d->serverStartScriptPathChooser->setPath(p.serverStartScript); d->debuginfoPathChooser->setPath(p.debugInfoLocation); d->arguments->setText(p.processArgs); diff --git a/src/plugins/debugger/debuggerdialogs.h b/src/plugins/debugger/debuggerdialogs.h index 24122b9b9d..d68e25f00a 100644 --- a/src/plugins/debugger/debuggerdialogs.h +++ b/src/plugins/debugger/debuggerdialogs.h @@ -76,7 +76,7 @@ private: StartApplicationParameters parameters() const; void setParameters(const StartApplicationParameters &p); void setHistory(const QList<StartApplicationParameters> &l); - void setScriptVisible(bool on); + void hideStartScript(); Core::Id profileId() const; StartApplicationDialogPrivate *d; diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index 42189d0a02..969474966b 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -127,7 +127,6 @@ QDebug operator<<(QDebug str, const DebuggerStartParameters &sp) << " useTerminal=" << sp.useTerminal << " remoteChannel=" << sp.remoteChannel << " symbolFileName=" << sp.symbolFileName - << " useServerStartScript=" << sp.useServerStartScript << " serverStartScript=" << sp.serverStartScript << " abi=" << sp.toolChainAbi.toString() << '\n'; return str; diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index e0e1c20861..0fe1bf0e5f 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -1567,7 +1567,6 @@ void DebuggerPluginPrivate::attachToRemoteServer() sp.startMode = AttachToRemoteServer; if (StartApplicationDialog::run(mainWindow(), m_coreSettings, &sp)) { sp.closeMode = KillAtClose; - sp.useServerStartScript = false; sp.serverStartScript.clear(); if (RunControl *rc = createDebugger(sp)) startDebugger(rc); @@ -2576,8 +2575,6 @@ static QString formatStartParameters(DebuggerStartParameters &sp) str << "Sysroot: " << sp.sysRoot << '\n'; str << "Debug Source Location: " << sp.debugSourceLocation.join(QLatin1String(":")) << '\n'; str << "Symbol file: " << sp.symbolFileName << '\n'; - if (sp.useServerStartScript) - str << "Using server start script: " << sp.serverStartScript; str << "Dumper libraries: " << QDir::toNativeSeparators(sp.dumperLibrary); foreach (const QString &dl, sp.dumperLibraryLocations) str << ' ' << QDir::toNativeSeparators(dl); diff --git a/src/plugins/debugger/debuggerstartparameters.h b/src/plugins/debugger/debuggerstartparameters.h index 21452f8ad5..7a2165f162 100644 --- a/src/plugins/debugger/debuggerstartparameters.h +++ b/src/plugins/debugger/debuggerstartparameters.h @@ -65,7 +65,6 @@ public: languages(AnyLanguage), qmlServerAddress(QLatin1String("127.0.0.1")), qmlServerPort(ProjectExplorer::Constants::QML_DEFAULT_DEBUG_SERVER_PORT), - useServerStartScript(false), remoteSetupNeeded(false), startMode(NoStartMode), closeMode(KillAtClose), @@ -112,7 +111,6 @@ public: // Used by remote debugging. QString remoteChannel; QString symbolFileName; - bool useServerStartScript; QString serverStartScript; QString searchPath; // Gdb "set solib-search-path" QString debugInfoLocation; // Gdb "set-debug-file-directory". diff --git a/src/plugins/debugger/gdb/remotegdbserveradapter.cpp b/src/plugins/debugger/gdb/remotegdbserveradapter.cpp index 61b0343447..c4d8505eea 100644 --- a/src/plugins/debugger/gdb/remotegdbserveradapter.cpp +++ b/src/plugins/debugger/gdb/remotegdbserveradapter.cpp @@ -86,13 +86,9 @@ void GdbRemoteServerEngine::setupEngine() { QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state()); showMessage(_("TRYING TO START ADAPTER")); - if (startParameters().useServerStartScript) { - if (startParameters().serverStartScript.isEmpty()) { - showMessage(_("No server start script given. "), StatusBar); - } else { - m_uploadProc.start(_("/bin/sh ") + startParameters().serverStartScript); - m_uploadProc.waitForStarted(); - } + if (!startParameters().serverStartScript.isEmpty()) { + m_uploadProc.start(_("/bin/sh ") + startParameters().serverStartScript); + m_uploadProc.waitForStarted(); } if (startParameters().remoteSetupNeeded) notifyEngineRequestRemoteSetup(); diff --git a/src/plugins/debugger/gdb/startgdbserverdialog.cpp b/src/plugins/debugger/gdb/startgdbserverdialog.cpp index a1f3019480..355b53e72e 100644 --- a/src/plugins/debugger/gdb/startgdbserverdialog.cpp +++ b/src/plugins/debugger/gdb/startgdbserverdialog.cpp @@ -213,9 +213,6 @@ void GdbServerStarter::attach(int port) sp.executable = localExecutable; sp.startMode = AttachToRemoteServer; sp.closeMode = KillAtClose; - sp.overrideStartScript.clear(); - sp.useServerStartScript = false; - sp.serverStartScript.clear(); sp.sysRoot = SysRootProfileInformation::sysRoot(d->profile).toString(); sp.debuggerCommand = DebuggerProfileInformation::debuggerCommand(d->profile).toString(); sp.connParams = d->device->sshParameters(); diff --git a/src/plugins/debugger/loadcoredialog.cpp b/src/plugins/debugger/loadcoredialog.cpp index 20854de7e3..257c141519 100644 --- a/src/plugins/debugger/loadcoredialog.cpp +++ b/src/plugins/debugger/loadcoredialog.cpp @@ -290,7 +290,7 @@ AttachCoreDialog::AttachCoreDialog(QWidget *parent) QVBoxLayout *vboxLayout = new QVBoxLayout(this); vboxLayout->addLayout(formLayout); - vboxLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding)); + vboxLayout->addStretch(); vboxLayout->addWidget(line); vboxLayout->addWidget(d->buttonBox); |