diff options
author | Eike Ziller <eike.ziller@digia.com> | 2013-12-03 14:17:03 +0100 |
---|---|---|
committer | Eike Ziller <eike.ziller@digia.com> | 2013-12-10 13:31:48 +0100 |
commit | deb43b4c8a261855252aeee09fd6df283576932e (patch) | |
tree | a844379f47974fd681b86aa2187735e03639b567 /src/plugins/debugger | |
parent | ea1a92484ac99057b06130a012164bf9788650e9 (diff) | |
download | qt-creator-deb43b4c8a261855252aeee09fd6df283576932e.tar.gz |
Preferences: Add default implementation for filtering
The default "matches" method now takes the widget and looks for all
child labels, checkboxes, push buttons and group boxes.
Because of that, the former "createWidget" method
can be called multiple times without creating a new widget
(-->widget()), and the "finished" method must ensure that the created
widget gets deleted, since not all widgets that were created are added
to the UI anymore.
Change-Id: Ia231c7c78dd8819146668e6447d36d22e7836904
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
Diffstat (limited to 'src/plugins/debugger')
-rw-r--r-- | src/plugins/debugger/cdb/cdboptionspage.cpp | 52 | ||||
-rw-r--r-- | src/plugins/debugger/cdb/cdboptionspage.h | 10 | ||||
-rw-r--r-- | src/plugins/debugger/commonoptionspage.cpp | 98 | ||||
-rw-r--r-- | src/plugins/debugger/commonoptionspage.h | 10 | ||||
-rw-r--r-- | src/plugins/debugger/debuggeroptionspage.cpp | 119 | ||||
-rw-r--r-- | src/plugins/debugger/debuggeroptionspage.h | 7 | ||||
-rw-r--r-- | src/plugins/debugger/gdb/gdboptionspage.cpp | 57 | ||||
-rw-r--r-- | src/plugins/debugger/gdb/gdboptionspage.h | 6 |
8 files changed, 121 insertions, 238 deletions
diff --git a/src/plugins/debugger/cdb/cdboptionspage.cpp b/src/plugins/debugger/cdb/cdboptionspage.cpp index e3b6c4cd33..5f9e419737 100644 --- a/src/plugins/debugger/cdb/cdboptionspage.cpp +++ b/src/plugins/debugger/cdb/cdboptionspage.cpp @@ -198,22 +198,6 @@ QStringList CdbOptionsPageWidget::breakEvents() const return m_breakEventWidget->breakEvents(); } -static QString stripColon(QString s) -{ - const int lastColon = s.lastIndexOf(QLatin1Char(':')); - if (lastColon != -1) - s.truncate(lastColon); - return s; -} - -QString CdbOptionsPageWidget::searchKeywords() const -{ - QString rc; - QTextStream(&rc) << stripColon(m_ui.additionalArgumentsLabel->text()); - rc.remove(QLatin1Char('&')); - return rc; -} - // ---------- CdbOptionsPage CdbOptionsPage::CdbOptionsPage() @@ -230,11 +214,10 @@ CdbOptionsPage::~CdbOptionsPage() { } -QWidget *CdbOptionsPage::createPage(QWidget *parent) +QWidget *CdbOptionsPage::widget() { - m_widget = new CdbOptionsPageWidget(parent); - if (m_searchKeywords.isEmpty()) - m_searchKeywords = m_widget->searchKeywords(); + if (!m_widget) + m_widget = new CdbOptionsPageWidget; return m_widget; } @@ -248,13 +231,10 @@ void CdbOptionsPage::apply() void CdbOptionsPage::finish() { - if (m_widget) + if (m_widget) { m_widget->group.finish(); -} - -bool CdbOptionsPage::matches(const QString &s) const -{ - return m_searchKeywords.contains(s, Qt::CaseInsensitive); + delete m_widget; + } } // ---------- CdbPathsPage @@ -266,8 +246,6 @@ public: Utils::SavedActionSet group; // CdbPaths m_paths; - QString m_searchKeywords; - CdbSymbolPathListEditor *m_symbolPathListEditor; Utils::PathListEditor *m_sourcePathListEditor; @@ -280,7 +258,6 @@ CdbPathsPageWidget::CdbPathsPageWidget(QWidget *parent) : QVBoxLayout *layout = new QVBoxLayout(this); QString title = tr("Symbol Paths"); - m_searchKeywords.append(title); QGroupBox* gbSymbolPath = new QGroupBox(this); gbSymbolPath->setTitle(title); QVBoxLayout *gbSymbolPathLayout = new QVBoxLayout(gbSymbolPath); @@ -288,7 +265,6 @@ CdbPathsPageWidget::CdbPathsPageWidget(QWidget *parent) : gbSymbolPathLayout->addWidget(m_symbolPathListEditor); title = tr("Source Paths"); - m_searchKeywords.append(title); QGroupBox* gbSourcePath = new QGroupBox(this); gbSourcePath->setTitle(title); QVBoxLayout *gbSourcePathLayout = new QVBoxLayout(gbSourcePath); @@ -318,12 +294,10 @@ CdbPathsPage::~CdbPathsPage() { } -QWidget *CdbPathsPage::createPage(QWidget *parent) +QWidget *CdbPathsPage::widget() { if (!m_widget) - m_widget = new CdbPathsPageWidget(parent); - else - m_widget->setParent(parent); + m_widget = new CdbPathsPageWidget; return m_widget; } @@ -335,14 +309,10 @@ void CdbPathsPage::apply() void CdbPathsPage::finish() { - if (m_widget) + if (m_widget) { m_widget->group.finish(); -} - -bool CdbPathsPage::matches(const QString &searchKeyWord) const -{ - return m_widget && - m_widget->m_searchKeywords.contains(searchKeyWord, Qt::CaseInsensitive); + delete m_widget; + } } } // namespace Internal diff --git a/src/plugins/debugger/cdb/cdboptionspage.h b/src/plugins/debugger/cdb/cdboptionspage.h index a84a703c73..ac1e7155ee 100644 --- a/src/plugins/debugger/cdb/cdboptionspage.h +++ b/src/plugins/debugger/cdb/cdboptionspage.h @@ -78,9 +78,8 @@ class CdbOptionsPageWidget : public QWidget Q_OBJECT public: - explicit CdbOptionsPageWidget(QWidget *parent); + explicit CdbOptionsPageWidget(QWidget *parent = 0); QStringList breakEvents() const; - QString searchKeywords() const; Utils::SavedActionSet group; @@ -103,17 +102,15 @@ public: virtual ~CdbOptionsPage(); // IOptionsPage - QWidget *createPage(QWidget *parent); + QWidget *widget(); void apply(); void finish(); - bool matches(const QString &) const; static const char *crtDbgReport; private: Utils::SavedActionSet group; QPointer<CdbOptionsPageWidget> m_widget; - QString m_searchKeywords; }; class CdbPathsPage : public Core::IOptionsPage @@ -127,10 +124,9 @@ public: static CdbPathsPage *instance(); // IOptionsPage - QWidget *createPage(QWidget *parent); + QWidget *widget(); void apply(); void finish(); - bool matches(const QString &searchKeyWord) const; private: QPointer<CdbPathsPageWidget> m_widget; diff --git a/src/plugins/debugger/commonoptionspage.cpp b/src/plugins/debugger/commonoptionspage.cpp index 3aede9b0e5..ebf526c0f4 100644 --- a/src/plugins/debugger/commonoptionspage.cpp +++ b/src/plugins/debugger/commonoptionspage.cpp @@ -202,29 +202,6 @@ CommonOptionsPageWidget::CommonOptionsPageWidget } } -QString CommonOptionsPageWidget::searchKeyWords() const -{ - QString rc; - const QLatin1Char sep(' '); - QTextStream stream(&rc); - stream << sep << checkBoxUseAlternatingRowColors->text() - << sep << checkBoxFontSizeFollowsEditor->text() - << sep << checkBoxUseToolTipsInMainEditor->text() - << sep << checkBoxListSourceFiles->text() - << sep << checkBoxBreakpointsFullPath->text() - << sep << checkBoxCloseBuffersOnExit->text() - << sep << checkBoxSwitchModeOnExit->text() - << sep << labelMaximalStackDepth->text() - << sep << checkBoxBringToForegroundOnInterrrupt->text() - << sep << checkBoxShowQmlObjectTree->text() - << sep << checkBoxWarnOnReleaseBuilds->text(); - if (Utils::HostOsInfo::isWindowsHost()) - stream << sep << checkBoxRegisterForPostMortem->text(); - - rc.remove(QLatin1Char('&')); - return rc; -} - GlobalDebuggerOptions CommonOptionsPageWidget::globalOptions() const { GlobalDebuggerOptions o; @@ -274,22 +251,19 @@ void CommonOptionsPage::finish() { if (!m_group.isNull()) m_group->finish(); + delete m_widget; } -QWidget *CommonOptionsPage::createPage(QWidget *parent) +QWidget *CommonOptionsPage::widget() { if (m_group.isNull()) m_group = QSharedPointer<Utils::SavedActionSet>(new Utils::SavedActionSet); - m_widget = new CommonOptionsPageWidget(m_group, parent); - m_widget->setGlobalOptions(*m_options); - if (m_searchKeywords.isEmpty()) - m_searchKeywords = m_widget->searchKeyWords(); - return m_widget; -} -bool CommonOptionsPage::matches(const QString &s) const -{ - return m_searchKeywords.contains(s, Qt::CaseInsensitive); + if (!m_widget) { + m_widget = new CommonOptionsPageWidget(m_group); + m_widget->setGlobalOptions(*m_options); + } + return m_widget; } QString CommonOptionsPage::msgSetBreakpointAtFunction(const char *function) @@ -334,57 +308,43 @@ void LocalsAndExpressionsOptionsPage::apply() void LocalsAndExpressionsOptionsPage::finish() { m_group.finish(); + delete m_widget; } -QWidget *LocalsAndExpressionsOptionsPage::createPage(QWidget *parent) +QWidget *LocalsAndExpressionsOptionsPage::widget() { - QWidget *w = new QWidget(parent); - m_ui.setupUi(w); + if (!m_widget) { + m_widget = new QWidget; + m_ui.setupUi(m_widget); - m_group.clear(); - DebuggerCore *dc = debuggerCore(); + m_group.clear(); + DebuggerCore *dc = debuggerCore(); - m_group.insert(dc->action(UseDebuggingHelpers), - m_ui.debuggingHelperGroupBox); + m_group.insert(dc->action(UseDebuggingHelpers), + m_ui.debuggingHelperGroupBox); - m_group.insert(dc->action(UseCodeModel), - m_ui.checkBoxUseCodeModel); - m_ui.checkBoxUseCodeModel->setToolTip(dc->action(UseCodeModel)->toolTip()); + m_group.insert(dc->action(UseCodeModel), + m_ui.checkBoxUseCodeModel); + m_ui.checkBoxUseCodeModel->setToolTip(dc->action(UseCodeModel)->toolTip()); - m_group.insert(dc->action(ShowThreadNames), - m_ui.checkBoxShowThreadNames); - m_group.insert(dc->action(ShowStdNamespace), m_ui.checkBoxShowStdNamespace); - m_group.insert(dc->action(ShowQtNamespace), m_ui.checkBoxShowQtNamespace); + m_group.insert(dc->action(ShowThreadNames), + m_ui.checkBoxShowThreadNames); + m_group.insert(dc->action(ShowStdNamespace), m_ui.checkBoxShowStdNamespace); + m_group.insert(dc->action(ShowQtNamespace), m_ui.checkBoxShowQtNamespace); #ifndef QT_DEBUG #if 0 - cmd = am->registerAction(m_dumpLogAction, - DUMP_LOG, globalcontext); - //cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+D,Ctrl+L"))); - cmd->setDefaultKeySequence(QKeySequence(QCoreApplication::translate("Debugger", "Ctrl+Shift+F11"))); - mdebug->addAction(cmd); + cmd = am->registerAction(m_dumpLogAction, + DUMP_LOG, globalcontext); + //cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+D,Ctrl+L"))); + cmd->setDefaultKeySequence(QKeySequence(QCoreApplication::translate("Debugger", "Ctrl+Shift+F11"))); + mdebug->addAction(cmd); #endif #endif - - if (m_searchKeywords.isEmpty()) { - QTextStream(&m_searchKeywords) - << ' ' << m_ui.debuggingHelperGroupBox->title() - << ' ' << m_ui.checkBoxUseCodeModel->text() - << ' ' << m_ui.checkBoxShowThreadNames->text() - << ' ' << m_ui.checkBoxShowStdNamespace->text() - << ' ' << m_ui.checkBoxShowQtNamespace->text(); - - m_searchKeywords.remove(QLatin1Char('&')); } - return w; -} - -bool LocalsAndExpressionsOptionsPage::matches(const QString &s) const -{ - return m_searchKeywords.contains(s, Qt::CaseInsensitive); + return m_widget; } - } // namespace Internal } // namespace Debugger diff --git a/src/plugins/debugger/commonoptionspage.h b/src/plugins/debugger/commonoptionspage.h index c09d1ccde4..bb5464abf3 100644 --- a/src/plugins/debugger/commonoptionspage.h +++ b/src/plugins/debugger/commonoptionspage.h @@ -60,7 +60,6 @@ class CommonOptionsPageWidget : public QWidget public: explicit CommonOptionsPageWidget(const QSharedPointer<Utils::SavedActionSet> &group, QWidget *parent = 0); - QString searchKeyWords() const; GlobalDebuggerOptions globalOptions() const; void setGlobalOptions(const GlobalDebuggerOptions &go); @@ -94,10 +93,9 @@ public: ~CommonOptionsPage(); // IOptionsPage - QWidget *createPage(QWidget *parent); + QWidget *widget(); void apply(); void finish(); - bool matches(const QString &s) const; static QString msgSetBreakpointAtFunction(const char *function); static QString msgSetBreakpointAtFunctionToolTip(const char *function, @@ -106,7 +104,6 @@ public: private: const QSharedPointer<GlobalDebuggerOptions> m_options; QSharedPointer<Utils::SavedActionSet> m_group; - QString m_searchKeywords; QPointer<CommonOptionsPageWidget> m_widget; }; @@ -123,15 +120,14 @@ public: LocalsAndExpressionsOptionsPage(); // IOptionsPage - QWidget *createPage(QWidget *parent); + QWidget *widget(); void apply(); void finish(); - bool matches(const QString &s) const; private: + QPointer<QWidget> m_widget; Ui::DebuggingHelperOptionPage m_ui; Utils::SavedActionSet m_group; - QString m_searchKeywords; }; } // namespace Internal diff --git a/src/plugins/debugger/debuggeroptionspage.cpp b/src/plugins/debugger/debuggeroptionspage.cpp index bd0b8d2916..1bf5718872 100644 --- a/src/plugins/debugger/debuggeroptionspage.cpp +++ b/src/plugins/debugger/debuggeroptionspage.cpp @@ -217,63 +217,61 @@ DebuggerOptionsPage::DebuggerOptionsPage() setCategoryIcon(QLatin1String(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY_ICON)); } -QWidget *DebuggerOptionsPage::createPage(QWidget *parent) +QWidget *DebuggerOptionsPage::widget() { - m_configWidget = new QWidget(parent); - - m_addButton = new QPushButton(tr("Add"), m_configWidget); - m_cloneButton = new QPushButton(tr("Clone"), m_configWidget); - m_delButton = new QPushButton(tr("Remove"), m_configWidget); - - m_container = new DetailsWidget(m_configWidget); - m_container->setState(DetailsWidget::NoSummary); - m_container->setVisible(false); - - m_model = new DebuggerItemModel(parent); - - m_debuggerView = new QTreeView(m_configWidget); - m_debuggerView->setModel(m_model); - m_debuggerView->setUniformRowHeights(true); - m_debuggerView->setSelectionMode(QAbstractItemView::SingleSelection); - m_debuggerView->setSelectionBehavior(QAbstractItemView::SelectRows); - m_debuggerView->expandAll(); - - QHeaderView *header = m_debuggerView->header(); - header->setStretchLastSection(false); - header->setResizeMode(0, QHeaderView::ResizeToContents); - header->setResizeMode(1, QHeaderView::ResizeToContents); - header->setResizeMode(2, QHeaderView::Stretch); - - QVBoxLayout *buttonLayout = new QVBoxLayout(); - buttonLayout->setSpacing(6); - buttonLayout->setContentsMargins(0, 0, 0, 0); - buttonLayout->addWidget(m_addButton); - buttonLayout->addWidget(m_cloneButton); - buttonLayout->addWidget(m_delButton); - buttonLayout->addItem(new QSpacerItem(10, 40, QSizePolicy::Minimum, QSizePolicy::Expanding)); - - QVBoxLayout *verticalLayout = new QVBoxLayout(); - verticalLayout->addWidget(m_debuggerView); - verticalLayout->addWidget(m_container); - - QHBoxLayout *horizontalLayout = new QHBoxLayout(m_configWidget); - horizontalLayout->addLayout(verticalLayout); - horizontalLayout->addLayout(buttonLayout); - - connect(m_debuggerView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), - this, SLOT(debuggerSelectionChanged())); - - connect(m_addButton, SIGNAL(clicked()), this, SLOT(addDebugger()), Qt::QueuedConnection); - connect(m_cloneButton, SIGNAL(clicked()), this, SLOT(cloneDebugger()), Qt::QueuedConnection); - connect(m_delButton, SIGNAL(clicked()), this, SLOT(removeDebugger()), Qt::QueuedConnection); - - m_searchKeywords = tr("Debuggers"); - - m_itemConfigWidget = new DebuggerItemConfigWidget(m_model); - m_container->setWidget(m_itemConfigWidget); - - updateState(); - + if (!m_configWidget) { + m_configWidget = new QWidget; + + m_addButton = new QPushButton(tr("Add"), m_configWidget); + m_cloneButton = new QPushButton(tr("Clone"), m_configWidget); + m_delButton = new QPushButton(tr("Remove"), m_configWidget); + + m_container = new DetailsWidget(m_configWidget); + m_container->setState(DetailsWidget::NoSummary); + m_container->setVisible(false); + + m_debuggerView = new QTreeView(m_configWidget); + m_model = new DebuggerItemModel(m_debuggerView); + m_debuggerView->setModel(m_model); + m_debuggerView->setUniformRowHeights(true); + m_debuggerView->setSelectionMode(QAbstractItemView::SingleSelection); + m_debuggerView->setSelectionBehavior(QAbstractItemView::SelectRows); + m_debuggerView->expandAll(); + + QHeaderView *header = m_debuggerView->header(); + header->setStretchLastSection(false); + header->setResizeMode(0, QHeaderView::ResizeToContents); + header->setResizeMode(1, QHeaderView::ResizeToContents); + header->setResizeMode(2, QHeaderView::Stretch); + + QVBoxLayout *buttonLayout = new QVBoxLayout(); + buttonLayout->setSpacing(6); + buttonLayout->setContentsMargins(0, 0, 0, 0); + buttonLayout->addWidget(m_addButton); + buttonLayout->addWidget(m_cloneButton); + buttonLayout->addWidget(m_delButton); + buttonLayout->addItem(new QSpacerItem(10, 40, QSizePolicy::Minimum, QSizePolicy::Expanding)); + + QVBoxLayout *verticalLayout = new QVBoxLayout(); + verticalLayout->addWidget(m_debuggerView); + verticalLayout->addWidget(m_container); + + QHBoxLayout *horizontalLayout = new QHBoxLayout(m_configWidget); + horizontalLayout->addLayout(verticalLayout); + horizontalLayout->addLayout(buttonLayout); + + connect(m_debuggerView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), + this, SLOT(debuggerSelectionChanged())); + + connect(m_addButton, SIGNAL(clicked()), this, SLOT(addDebugger()), Qt::QueuedConnection); + connect(m_cloneButton, SIGNAL(clicked()), this, SLOT(cloneDebugger()), Qt::QueuedConnection); + connect(m_delButton, SIGNAL(clicked()), this, SLOT(removeDebugger()), Qt::QueuedConnection); + + m_itemConfigWidget = new DebuggerItemConfigWidget(m_model); + m_container->setWidget(m_itemConfigWidget); + + updateState(); + } return m_configWidget; } @@ -322,10 +320,10 @@ void DebuggerOptionsPage::removeDebugger() void DebuggerOptionsPage::finish() { - // Deleted by settingsdialog. - m_configWidget = 0; + delete m_configWidget; // Children of m_configWidget. + m_model = 0; m_container = 0; m_debuggerView = 0; m_addButton = 0; @@ -333,11 +331,6 @@ void DebuggerOptionsPage::finish() m_delButton = 0; } -bool DebuggerOptionsPage::matches(const QString &s) const -{ - return m_searchKeywords.contains(s, Qt::CaseInsensitive); -} - void DebuggerOptionsPage::debuggerSelectionChanged() { QTC_ASSERT(m_container, return); diff --git a/src/plugins/debugger/debuggeroptionspage.h b/src/plugins/debugger/debuggeroptionspage.h index 29089b4f52..683054b801 100644 --- a/src/plugins/debugger/debuggeroptionspage.h +++ b/src/plugins/debugger/debuggeroptionspage.h @@ -34,6 +34,7 @@ #include <coreplugin/dialogs/ioptionspage.h> +#include <QPointer> #include <QWidget> QT_BEGIN_NAMESPACE @@ -97,10 +98,9 @@ class DebuggerOptionsPage : public Core::IOptionsPage public: DebuggerOptionsPage(); - QWidget *createPage(QWidget *parent); + QWidget *widget(); void apply(); void finish(); - bool matches(const QString &) const; private slots: void debuggerSelectionChanged(); @@ -111,8 +111,7 @@ private slots: void removeDebugger(); private: - QWidget *m_configWidget; - QString m_searchKeywords; + QPointer<QWidget> m_configWidget; DebuggerItemModel *m_model; DebuggerItemConfigWidget *m_itemConfigWidget; diff --git a/src/plugins/debugger/gdb/gdboptionspage.cpp b/src/plugins/debugger/gdb/gdboptionspage.cpp index 6651f59a65..8823face49 100644 --- a/src/plugins/debugger/gdb/gdboptionspage.cpp +++ b/src/plugins/debugger/gdb/gdboptionspage.cpp @@ -54,7 +54,7 @@ namespace Internal { class GdbOptionsPageWidget : public QWidget { public: - explicit GdbOptionsPageWidget(QWidget *parent); + explicit GdbOptionsPageWidget(QWidget *parent = 0); QGroupBox *groupBoxGeneral; QLabel *labelGdbWatchdogTimeout; @@ -83,7 +83,6 @@ public: //QLineEdit *lineEditSelectedPluginBreakpointsPattern; Utils::SavedActionSet group; - QString searchKeywords; }; GdbOptionsPageWidget::GdbOptionsPageWidget(QWidget *parent) @@ -297,19 +296,6 @@ GdbOptionsPageWidget::GdbOptionsPageWidget(QWidget *parent) // setEnabled(dc->action(SelectedPluginBreakpoints)->value().toBool()); //connect(radioButtonSelectedPluginBreakpoints, SIGNAL(toggled(bool)), // lineEditSelectedPluginBreakpointsPattern, SLOT(setEnabled(bool))); - - const QLatin1Char sep(' '); - QTextStream(&searchKeywords) - << sep << groupBoxGeneral->title() - << sep << checkBoxLoadGdbInit->text() - << sep << checkBoxLoadGdbDumpers->text() - << sep << checkBoxUseDynamicType->text() - << sep << labelGdbWatchdogTimeout->text() - << sep << checkBoxSkipKnownFrames->text() - << sep << checkBoxUseMessageBoxForSignals->text() - << sep << checkBoxAdjustBreakpointLocations->text(); - ; - searchKeywords.remove(QLatin1Char('&')); } GdbOptionsPage::GdbOptionsPage() @@ -325,9 +311,10 @@ GdbOptionsPage::~GdbOptionsPage() { } -QWidget *GdbOptionsPage::createPage(QWidget *parent) +QWidget *GdbOptionsPage::widget() { - m_widget = new GdbOptionsPageWidget(parent); + if (!m_widget) + m_widget = new GdbOptionsPageWidget; return m_widget; } @@ -339,13 +326,10 @@ void GdbOptionsPage::apply() void GdbOptionsPage::finish() { - if (m_widget) + if (m_widget) { m_widget->group.finish(); -} - -bool GdbOptionsPage::matches(const QString &s) const -{ - return m_widget && m_widget->searchKeywords.contains(s, Qt::CaseInsensitive); + delete m_widget; + } } ///////////////////////////////////////////////////////////////////////// @@ -357,7 +341,7 @@ bool GdbOptionsPage::matches(const QString &s) const class GdbOptionsPageWidget2 : public QWidget { public: - explicit GdbOptionsPageWidget2(QWidget *parent); + explicit GdbOptionsPageWidget2(QWidget *parent = 0); QGroupBox *groupBoxDangerous; QLabel *labelDangerous; @@ -371,7 +355,6 @@ public: QCheckBox *checkBoxMultiInferior; Utils::SavedActionSet group; - QString searchKeywords; }; GdbOptionsPageWidget2::GdbOptionsPageWidget2(QWidget *parent) @@ -460,16 +443,6 @@ GdbOptionsPageWidget2::GdbOptionsPageWidget2(QWidget *parent) group.insert(dc->action(AttemptQuickStart), checkBoxAttemptQuickStart); group.insert(dc->action(MultiInferior), checkBoxMultiInferior); group.insert(dc->action(EnableReverseDebugging), checkBoxEnableReverseDebugging); - - const QLatin1Char sep(' '); - QTextStream(&searchKeywords) - << sep << groupBoxDangerous->title() - << sep << checkBoxTargetAsync->text() - << sep << checkBoxEnableReverseDebugging->text() - << sep << checkBoxAttemptQuickStart->text() - << sep << checkBoxMultiInferior->text() - ; - searchKeywords.remove(QLatin1Char('&')); } GdbOptionsPage2::GdbOptionsPage2() @@ -485,9 +458,10 @@ GdbOptionsPage2::~GdbOptionsPage2() { } -QWidget *GdbOptionsPage2::createPage(QWidget *parent) +QWidget *GdbOptionsPage2::widget() { - m_widget = new GdbOptionsPageWidget2(parent); + if (!m_widget) + m_widget = new GdbOptionsPageWidget2; return m_widget; } @@ -499,13 +473,10 @@ void GdbOptionsPage2::apply() void GdbOptionsPage2::finish() { - if (m_widget) + if (m_widget) { m_widget->group.finish(); -} - -bool GdbOptionsPage2::matches(const QString &s) const -{ - return m_widget && m_widget->searchKeywords.contains(s, Qt::CaseInsensitive); + delete m_widget; + } } } // namespace Internal diff --git a/src/plugins/debugger/gdb/gdboptionspage.h b/src/plugins/debugger/gdb/gdboptionspage.h index 29387f82c2..915834d1e9 100644 --- a/src/plugins/debugger/gdb/gdboptionspage.h +++ b/src/plugins/debugger/gdb/gdboptionspage.h @@ -46,10 +46,9 @@ class GdbOptionsPage : public Core::IOptionsPage public: GdbOptionsPage(); ~GdbOptionsPage(); - QWidget *createPage(QWidget *parent); + QWidget *widget(); void apply(); void finish(); - bool matches(const QString &) const; private: QPointer<GdbOptionsPageWidget> m_widget; @@ -63,10 +62,9 @@ class GdbOptionsPage2 : public Core::IOptionsPage public: GdbOptionsPage2(); ~GdbOptionsPage2(); - QWidget *createPage(QWidget *parent); + QWidget *widget(); void apply(); void finish(); - bool matches(const QString &) const; private: QPointer<GdbOptionsPageWidget2> m_widget; |