Commit 9da7aef4 authored by hjk's avatar hjk
Browse files

re-organizize gdb location selection again

parent 65d48ce4
......@@ -88,11 +88,15 @@ QWidget *GdbOptionPage::createPage(QWidget *parent)
{
QWidget *w = new QWidget(parent);
m_ui.setupUi(w);
m_ui.gdbLocationEdit->setText(m_settings->m_gdbCmd);
m_ui.gdbLocationChooser->setExpectedKind(Core::Utils::PathChooser::Command);
m_ui.gdbLocationChooser->setPromptDialogTitle(tr("Choose Gdb Location"));
m_ui.gdbLocationChooser->setPath(m_settings->m_gdbCmd);
m_ui.scriptFileChooser->setExpectedKind(Core::Utils::PathChooser::File);
m_ui.scriptFileChooser->setPromptDialogTitle(tr("Choose Location of Startup Script File"));
m_ui.scriptFileChooser->setPath(m_settings->m_scriptFile);
m_ui.environmentEdit->setText(m_settings->m_gdbEnv);
m_ui.autoStartBox->setChecked(m_settings->m_autoRun);
m_ui.autoQuitBox->setChecked(m_settings->m_autoQuit);
m_ui.gdbStartupScriptEdit->setText(m_settings->m_scriptFile);
// FIXME
m_ui.autoStartBox->hide();
......@@ -100,32 +104,22 @@ QWidget *GdbOptionPage::createPage(QWidget *parent)
m_ui.environmentEdit->hide();
m_ui.labelEnvironment->hide();
connect(m_ui.browseForGdbButton, SIGNAL(clicked()),
this, SLOT(browseForGdb()));
connect(m_ui.browseForScriptButton, SIGNAL(clicked()),
this, SLOT(browseForScript()));
connect(m_ui.gdbLocationChooser, SIGNAL(changed()),
this, SLOT(onGdbLocationChanged()));
connect(m_ui.scriptFileChooser, SIGNAL(changed()),
this, SLOT(onScriptFileChanged()));
return w;
}
void GdbOptionPage::browseForGdb()
void GdbOptionPage::onGdbLocationChanged()
{
QString fileName = QFileDialog::getOpenFileName(m_ui.browseForGdbButton,
"Browse for gdb executable");
if (fileName.isEmpty())
return;
m_settings->m_gdbCmd = fileName;
m_ui.gdbLocationEdit->setText(fileName);
m_settings->m_gdbCmd = m_ui.gdbLocationChooser->path();
}
void GdbOptionPage::browseForScript()
void GdbOptionPage::onScriptFileChanged()
{
QString fileName = QFileDialog::getOpenFileName(m_ui.browseForGdbButton,
"Browse for gdb startup script");
if (fileName.isEmpty())
return;
m_settings->m_scriptFile = fileName;
m_ui.gdbStartupScriptEdit->setText(fileName);
m_settings->m_scriptFile = m_ui.scriptFileChooser->path();
}
void GdbOptionPage::finished(bool accepted)
......@@ -133,11 +127,11 @@ void GdbOptionPage::finished(bool accepted)
if (!accepted)
return;
m_settings->m_gdbCmd = m_ui.gdbLocationEdit->text();
m_settings->m_gdbCmd = m_ui.gdbLocationChooser->path();
m_settings->m_gdbEnv = m_ui.environmentEdit->text();
m_settings->m_autoRun = m_ui.autoStartBox->isChecked();
m_settings->m_autoQuit = m_ui.autoQuitBox->isChecked();
m_settings->m_scriptFile = m_ui.gdbStartupScriptEdit->text();
m_settings->m_scriptFile = m_ui.scriptFileChooser->path();
Core::ICore *coreIFace = m_pm->getObject<Core::ICore>();
if (!coreIFace || !coreIFace->settings())
......
......@@ -62,8 +62,8 @@ public:
void finished(bool accepted);
public slots:
void browseForGdb();
void browseForScript();
void onGdbLocationChanged();
void onScriptFileChanged();
private:
ExtensionSystem::PluginManager *m_pm;
......
......@@ -32,10 +32,7 @@
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="1">
<widget class="QLineEdit" name="gdbLocationEdit"/>
</item>
<item row="1" column="1" colspan="2">
<item row="1" column="1">
<widget class="QLineEdit" name="environmentEdit"/>
</item>
<item row="0" column="0">
......@@ -46,9 +43,6 @@
<property name="text">
<string>Gdb Location:</string>
</property>
<property name="buddy">
<cstring>gdbLocationEdit</cstring>
</property>
</widget>
</item>
<item row="1" column="0">
......@@ -61,40 +55,6 @@
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="browseForGdbButton">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../coreplugin/core.qrc">
<normaloff>:/qworkbench/images/fileopen.png</normaloff>:/qworkbench/images/fileopen.png</iconset>
</property>
<property name="checkable">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="gdbStartupScriptEdit"/>
</item>
<item row="2" column="2">
<widget class="QToolButton" name="browseForScriptButton">
<property name="minimumSize">
<size>
<width>21</width>
<height>23</height>
</size>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../coreplugin/core.qrc">
<normaloff>:/qworkbench/images/fileopen.png</normaloff>:/qworkbench/images/fileopen.png</iconset>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelGdbStartupScript">
<property name="toolTip">
......@@ -105,6 +65,12 @@
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="Core::Utils::PathChooser" name="scriptFileChooser" native="true"/>
</item>
<item row="0" column="1">
<widget class="Core::Utils::PathChooser" name="gdbLocationChooser" native="true"/>
</item>
</layout>
</widget>
</item>
......@@ -137,6 +103,14 @@
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Core::Utils::PathChooser</class>
<extends>QWidget</extends>
<header location="global">utils/pathchooser.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="../coreplugin/core.qrc"/>
</resources>
......
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