From a556ddada831c97c43d5c74bd1cb975b3da36fbc Mon Sep 17 00:00:00 2001 From: hjk <qtc-committer@nokia.com> Date: Thu, 11 Dec 2008 14:01:53 +0100 Subject: [PATCH] start sanitizing gdb options dialog --- src/plugins/debugger/debugger.pro | 2 - src/plugins/debugger/debuggerplugin.cpp | 8 -- src/plugins/debugger/debuggerplugin.h | 2 - src/plugins/debugger/gdbengine.h | 2 +- src/plugins/debugger/gdboptionpage.cpp | 47 ++++++-- src/plugins/debugger/gdboptionpage.h | 6 +- src/plugins/debugger/gdboptionpage.ui | 51 +++++++-- src/plugins/debugger/gdbtypemacros.ui | 144 +++++++++--------------- src/plugins/git/settingspage.cpp | 2 +- 9 files changed, 140 insertions(+), 124 deletions(-) diff --git a/src/plugins/debugger/debugger.pro b/src/plugins/debugger/debugger.pro index 3d67e19c6aa..7308fb441c2 100644 --- a/src/plugins/debugger/debugger.pro +++ b/src/plugins/debugger/debugger.pro @@ -58,7 +58,6 @@ SOURCES += attachexternaldialog.cpp \ gdbengine.cpp \ gdbmi.cpp \ gdboptionpage.cpp \ - gdbtypemacros.cpp \ gdbengine.h \ moduleshandler.cpp \ moduleswindow.cpp \ @@ -79,7 +78,6 @@ FORMS += attachexternaldialog.ui \ breakcondition.ui \ mode.ui \ gdboptionpage.ui \ - gdbtypemacros.ui \ startexternaldialog.ui \ RESOURCES += debugger.qrc diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 37406f70cc1..d9217069c68 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -183,7 +183,6 @@ DebuggerPlugin::DebuggerPlugin() { m_pm = 0; m_generalOptionPage = 0; - m_typeMacroPage = 0; m_locationMark = 0; m_manager = 0; } @@ -202,7 +201,6 @@ void DebuggerPlugin::shutdown() //qDebug() << "DebuggerPlugin::~DebuggerPlugin"; removeObject(m_debugMode); removeObject(m_generalOptionPage); - removeObject(m_typeMacroPage); // FIXME: when using the line below, BreakWindow etc gets deleted twice. // so better leak for now... @@ -212,9 +210,6 @@ void DebuggerPlugin::shutdown() delete m_generalOptionPage; m_generalOptionPage = 0; - delete m_typeMacroPage; - m_typeMacroPage = 0; - delete m_locationMark; m_locationMark = 0; @@ -409,13 +404,10 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *error_mes mdebug->addAction(cmd); m_generalOptionPage = 0; - m_typeMacroPage = 0; // FIXME: m_generalOptionPage = new GdbOptionPage(&theGdbSettings()); addObject(m_generalOptionPage); - m_typeMacroPage = new TypeMacroPage(&theGdbSettings()); - addObject(m_typeMacroPage); m_locationMark = 0; diff --git a/src/plugins/debugger/debuggerplugin.h b/src/plugins/debugger/debuggerplugin.h index 91ffe4dbf77..ebf12b5e123 100644 --- a/src/plugins/debugger/debuggerplugin.h +++ b/src/plugins/debugger/debuggerplugin.h @@ -54,7 +54,6 @@ namespace Internal { class DebuggerManager; class DebugMode; class GdbOptionPage; -class TypeMacroPage; class LocationMark; class DebuggerPlugin : public ExtensionSystem::IPlugin @@ -103,7 +102,6 @@ private: ExtensionSystem::PluginManager *m_pm; GdbOptionPage *m_generalOptionPage; - TypeMacroPage *m_typeMacroPage; QString m_previousMode; LocationMark *m_locationMark; diff --git a/src/plugins/debugger/gdbengine.h b/src/plugins/debugger/gdbengine.h index 56106a75244..6b3cbb15fee 100644 --- a/src/plugins/debugger/gdbengine.h +++ b/src/plugins/debugger/gdbengine.h @@ -80,7 +80,7 @@ enum DataDumperState DataDumperUnavailable, }; -// FIXME: Move to extra file? + class GdbSettings { public: diff --git a/src/plugins/debugger/gdboptionpage.cpp b/src/plugins/debugger/gdboptionpage.cpp index e05b811889a..8bf1b22a0fc 100644 --- a/src/plugins/debugger/gdboptionpage.cpp +++ b/src/plugins/debugger/gdboptionpage.cpp @@ -58,7 +58,11 @@ GdbOptionPage::GdbOptionPage(GdbSettings *settings) #if defined(Q_OS_WIN32) defaultCommand.append(".exe"); #endif + QString defaultScript = coreIFace->resourcePath() + + QLatin1String("/gdb/qt4macros"); + m_settings->m_gdbCmd = s->value("Location", defaultCommand).toString(); + m_settings->m_scriptFile= s->value("ScriptFile", defaultScript).toString(); m_settings->m_gdbEnv = s->value("Environment", "").toString(); m_settings->m_autoRun = s->value("AutoRun", true).toBool(); m_settings->m_autoQuit = s->value("AutoQuit", true).toBool(); @@ -72,36 +76,56 @@ QString GdbOptionPage::name() const QString GdbOptionPage::category() const { - return "Debugger|Gdb"; + return "Debugger"; } QString GdbOptionPage::trCategory() const { - return tr("Debugger|Gdb"); + return tr("Debugger"); } QWidget *GdbOptionPage::createPage(QWidget *parent) { QWidget *w = new QWidget(parent); m_ui.setupUi(w); - m_ui.gdbEdit->setText(m_settings->m_gdbCmd); - m_ui.envEdit->setText(m_settings->m_gdbEnv); + m_ui.gdbLocationEdit->setText(m_settings->m_gdbCmd); + m_ui.environmentEdit->setText(m_settings->m_gdbEnv); m_ui.autoStartBox->setChecked(m_settings->m_autoRun); m_ui.autoQuitBox->setChecked(m_settings->m_autoQuit); - connect(m_ui.pushButtonBrowse, SIGNAL(clicked()), - this, SLOT(browse())); + m_ui.gdbStartupScriptEdit->setText(m_settings->m_scriptFile); + + // FIXME + m_ui.autoStartBox->hide(); + m_ui.autoQuitBox->hide(); + 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())); return w; } -void GdbOptionPage::browse() +void GdbOptionPage::browseForGdb() { - QString fileName = QFileDialog::getOpenFileName(m_ui.pushButtonBrowse, + QString fileName = QFileDialog::getOpenFileName(m_ui.browseForGdbButton, "Browse for gdb executable"); if (fileName.isEmpty()) return; m_settings->m_gdbCmd = fileName; - m_ui.gdbEdit->setText(fileName); + m_ui.gdbLocationEdit->setText(fileName); +} + +void GdbOptionPage::browseForScript() +{ + 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); } void GdbOptionPage::finished(bool accepted) @@ -109,10 +133,11 @@ void GdbOptionPage::finished(bool accepted) if (!accepted) return; - m_settings->m_gdbCmd = m_ui.gdbEdit->text(); - m_settings->m_gdbEnv = m_ui.envEdit->text(); + m_settings->m_gdbCmd = m_ui.gdbLocationEdit->text(); + 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(); Core::ICore *coreIFace = m_pm->getObject<Core::ICore>(); if (!coreIFace || !coreIFace->settings()) diff --git a/src/plugins/debugger/gdboptionpage.h b/src/plugins/debugger/gdboptionpage.h index 1d71024bac1..684bd789771 100644 --- a/src/plugins/debugger/gdboptionpage.h +++ b/src/plugins/debugger/gdboptionpage.h @@ -35,7 +35,6 @@ #define GDBOPTIONPAGE_H #include "ui_gdboptionpage.h" -#include "ui_gdbtypemacros.h" #include <coreplugin/dialogs/ioptionspage.h> @@ -63,7 +62,8 @@ public: void finished(bool accepted); public slots: - void browse(); + void browseForGdb(); + void browseForScript(); private: ExtensionSystem::PluginManager *m_pm; @@ -72,6 +72,7 @@ private: GdbSettings *m_settings; }; +#if 0 class TypeMacroPage : public Core::IOptionsPage { Q_OBJECT @@ -100,6 +101,7 @@ private: GdbSettings *m_settings; QWidget *m_widget; }; +#endif } // namespace Internal } // namespace Debugger diff --git a/src/plugins/debugger/gdboptionpage.ui b/src/plugins/debugger/gdboptionpage.ui index 4b58d5d7140..a7496851188 100644 --- a/src/plugins/debugger/gdboptionpage.ui +++ b/src/plugins/debugger/gdboptionpage.ui @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>433</width> - <height>216</height> + <height>233</height> </rect> </property> <property name="windowTitle"> @@ -23,7 +23,7 @@ <item> <widget class="QGroupBox" name="groupBox"> <property name="title"> - <string>Gdb Debug Options</string> + <string>Locations</string> </property> <layout class="QGridLayout"> <property name="margin"> @@ -33,33 +33,36 @@ <number>6</number> </property> <item row="0" column="1"> - <widget class="QLineEdit" name="gdbEdit"/> + <widget class="QLineEdit" name="gdbLocationEdit"/> </item> <item row="1" column="1" colspan="2"> - <widget class="QLineEdit" name="envEdit"/> + <widget class="QLineEdit" name="environmentEdit"/> </item> <item row="0" column="0"> - <widget class="QLabel" name="label"> + <widget class="QLabel" name="labelGdbLocaltion"> + <property name="toolTip"> + <string>This is either a full abolute path leading to the gdb binary you intend to use or the name of a gdb binary that wiull be searched in your PATH.</string> + </property> <property name="text"> <string>Gdb Location:</string> </property> <property name="buddy"> - <cstring>gdbEdit</cstring> + <cstring>gdbLocationEdit</cstring> </property> </widget> </item> <item row="1" column="0"> - <widget class="QLabel" name="label_2"> + <widget class="QLabel" name="labelEnvironment"> <property name="text"> <string>Environment:</string> </property> <property name="buddy"> - <cstring>envEdit</cstring> + <cstring>environmentEdit</cstring> </property> </widget> </item> <item row="0" column="2"> - <widget class="QPushButton" name="pushButtonBrowse"> + <widget class="QPushButton" name="browseForGdbButton"> <property name="text"> <string/> </property> @@ -72,6 +75,36 @@ </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"> + <string>This is either empty or points to a file containing gdb commands that will be executed immediately after gdb starts up.</string> + </property> + <property name="text"> + <string>Gdb Startup Script:</string> + </property> + </widget> + </item> </layout> </widget> </item> diff --git a/src/plugins/debugger/gdbtypemacros.ui b/src/plugins/debugger/gdbtypemacros.ui index aa7215577b4..f42514e4e49 100644 --- a/src/plugins/debugger/gdbtypemacros.ui +++ b/src/plugins/debugger/gdbtypemacros.ui @@ -1,146 +1,115 @@ -<ui version="4.0" > - <author></author> - <comment></comment> - <exportmacro></exportmacro> +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> <class>TypeMacroPage</class> - <widget class="QWidget" name="TypeMacroPage" > - <property name="geometry" > + <widget class="QWidget" name="TypeMacroPage"> + <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>519</width> - <height>238</height> + <height>263</height> </rect> </property> - <property name="windowTitle" > + <property name="windowTitle"> <string>Form</string> </property> - <layout class="QVBoxLayout" > - <property name="margin" > - <number>9</number> - </property> - <property name="spacing" > + <layout class="QVBoxLayout"> + <property name="spacing"> <number>6</number> </property> + <property name="margin"> + <number>9</number> + </property> <item> - <widget class="QGroupBox" name="groupBox" > - <property name="title" > - <string>Script File</string> - </property> - <layout class="QHBoxLayout" > - <property name="margin" > - <number>9</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLineEdit" name="scriptEdit" /> - </item> - <item> - <widget class="QToolButton" name="scriptButton" > - <property name="minimumSize" > - <size> - <width>21</width> - <height>23</height> - </size> - </property> - <property name="text" > - <string>...</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <layout class="QGridLayout" > - <property name="margin" > + <layout class="QGridLayout"> + <property name="margin"> <number>0</number> </property> - <property name="spacing" > + <property name="spacing"> <number>6</number> </property> - <item row="0" column="0" colspan="2" > - <widget class="QTreeWidget" name="treeWidget" > - <property name="rootIsDecorated" > + <item row="0" column="0" colspan="2"> + <widget class="QTreeWidget" name="treeWidget"> + <property name="rootIsDecorated"> <bool>false</bool> </property> <column> - <property name="text" > + <property name="text"> <string>Type</string> </property> </column> <column> - <property name="text" > + <property name="text"> <string>Macro</string> </property> </column> </widget> </item> - <item row="1" column="2" > - <widget class="QToolButton" name="addButton" > - <property name="minimumSize" > + <item row="1" column="2"> + <widget class="QToolButton" name="addButton"> + <property name="minimumSize"> <size> <width>21</width> <height>23</height> </size> </property> - <property name="text" > + <property name="text"> <string>+</string> </property> - <property name="icon" > - <iconset resource="gdbdebugger.qrc" >:/gdbdebugger/images/newitem.png</iconset> + <property name="icon"> + <iconset> + <normaloff>:/gdbdebugger/images/newitem.png</normaloff>:/gdbdebugger/images/newitem.png</iconset> </property> </widget> </item> - <item row="2" column="0" > - <widget class="QLabel" name="label_2" > - <property name="text" > + <item row="2" column="0"> + <widget class="QLabel" name="label_2"> + <property name="text"> <string>Macro Name:</string> </property> </widget> </item> - <item row="3" column="0" > - <widget class="QLabel" name="label_3" > - <property name="text" > + <item row="3" column="0"> + <widget class="QLabel" name="label_3"> + <property name="text"> <string>Parse as:</string> </property> </widget> </item> - <item row="2" column="1" > - <widget class="QLineEdit" name="macroEdit" /> + <item row="2" column="1"> + <widget class="QLineEdit" name="macroEdit"/> </item> - <item row="0" column="2" > - <layout class="QVBoxLayout" > - <property name="margin" > + <item row="0" column="2"> + <layout class="QVBoxLayout"> + <property name="spacing"> <number>0</number> </property> - <property name="spacing" > + <property name="margin"> <number>0</number> </property> <item> - <widget class="QToolButton" name="delButton" > - <property name="minimumSize" > + <widget class="QToolButton" name="delButton"> + <property name="minimumSize"> <size> <width>21</width> <height>23</height> </size> </property> - <property name="text" > + <property name="text"> <string>-</string> </property> - <property name="icon" > - <iconset resource="gdbdebugger.qrc" >:/gdbdebugger/images/delete.png</iconset> + <property name="icon"> + <iconset> + <normaloff>:/gdbdebugger/images/delete.png</normaloff>:/gdbdebugger/images/delete.png</iconset> </property> </widget> </item> <item> <spacer> - <property name="orientation" > + <property name="orientation"> <enum>Qt::Vertical</enum> </property> - <property name="sizeHint" > + <property name="sizeHint" stdset="0"> <size> <width>20</width> <height>40</height> @@ -150,25 +119,25 @@ </item> </layout> </item> - <item row="1" column="1" > - <widget class="QLineEdit" name="typeEdit" /> + <item row="1" column="1"> + <widget class="QLineEdit" name="typeEdit"/> </item> - <item row="1" column="0" > - <widget class="QLabel" name="label" > - <property name="text" > + <item row="1" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> <string>Type:</string> </property> </widget> </item> - <item row="3" column="1" > - <widget class="QComboBox" name="parseAsBox" > + <item row="3" column="1"> + <widget class="QComboBox" name="parseAsBox"> <item> - <property name="text" > + <property name="text"> <string>ASCII (char *)</string> </property> </item> <item> - <property name="text" > + <property name="text"> <string>Unicode (short)</string> </property> </item> @@ -178,9 +147,8 @@ </item> </layout> </widget> - <pixmapfunction></pixmapfunction> <resources> - <include location="gdbdebugger.qrc" /> + <include location="gdbdebugger.qrc"/> </resources> <connections/> </ui> diff --git a/src/plugins/git/settingspage.cpp b/src/plugins/git/settingspage.cpp index e1b14cb9ccc..7f0581fc3c3 100644 --- a/src/plugins/git/settingspage.cpp +++ b/src/plugins/git/settingspage.cpp @@ -77,7 +77,7 @@ QString SettingsPage::name() const return tr("General"); } - QString SettingsPage::category() const +QString SettingsPage::category() const { return QLatin1String("Git"); } -- GitLab