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/commonoptionspage.cpp | |
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/commonoptionspage.cpp')
-rw-r--r-- | src/plugins/debugger/commonoptionspage.cpp | 98 |
1 files changed, 29 insertions, 69 deletions
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 |