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/subversion | |
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/subversion')
-rw-r--r-- | src/plugins/subversion/settingspage.cpp | 34 | ||||
-rw-r--r-- | src/plugins/subversion/settingspage.h | 10 |
2 files changed, 10 insertions, 34 deletions
diff --git a/src/plugins/subversion/settingspage.cpp b/src/plugins/subversion/settingspage.cpp index ea5d21f04d..80a7f6cfdb 100644 --- a/src/plugins/subversion/settingspage.cpp +++ b/src/plugins/subversion/settingspage.cpp @@ -82,26 +82,6 @@ void SettingsPageWidget::setSettings(const SubversionSettings &s) m_ui.logCountSpinBox->setValue(s.intValue(SubversionSettings::logCountKey)); } -QString SettingsPageWidget::searchKeywords() const -{ - QString rc; - QLatin1Char sep(' '); - QTextStream(&rc) - << sep << m_ui.generalGroupBox->title() - << sep << m_ui.commandLabel->text() - << sep << m_ui.userGroupBox->title() - << sep << m_ui.usernameLabel->text() - << sep << m_ui.passwordLabel->text() - << sep << m_ui.miscGroupBox->title() - << sep << m_ui.logCountLabel->text() - << sep << m_ui.timeOutLabel->text() - << sep << m_ui.promptToSubmitCheckBox->text() - << sep << m_ui.spaceIgnorantAnnotationCheckBox->text() - ; - rc.remove(QLatin1Char('&')); - return rc; -} - SettingsPage::SettingsPage() : m_widget(0) { @@ -109,12 +89,12 @@ SettingsPage::SettingsPage() : setDisplayName(tr("Subversion")); } -QWidget *SettingsPage::createPage(QWidget *parent) +QWidget *SettingsPage::widget() { - m_widget = new SettingsPageWidget(parent); - m_widget->setSettings(SubversionPlugin::instance()->settings()); - if (m_searchKeywords.isEmpty()) - m_searchKeywords = m_widget->searchKeywords(); + if (!m_widget) { + m_widget = new SettingsPageWidget; + m_widget->setSettings(SubversionPlugin::instance()->settings()); + } return m_widget; } @@ -123,7 +103,7 @@ void SettingsPage::apply() SubversionPlugin::instance()->setSettings(m_widget->settings()); } -bool SettingsPage::matches(const QString &s) const +void SettingsPage::finish() { - return m_searchKeywords.contains(s, Qt::CaseInsensitive); + delete m_widget; } diff --git a/src/plugins/subversion/settingspage.h b/src/plugins/subversion/settingspage.h index 71438eea73..a902ccc34b 100644 --- a/src/plugins/subversion/settingspage.h +++ b/src/plugins/subversion/settingspage.h @@ -57,8 +57,6 @@ public: SubversionSettings settings() const; void setSettings(const SubversionSettings &); - QString searchKeywords() const; - private: Ui::SettingsPage m_ui; }; @@ -71,14 +69,12 @@ class SettingsPage : public VcsBase::VcsBaseOptionsPage public: SettingsPage(); - QWidget *createPage(QWidget *parent); + QWidget *widget(); void apply(); - void finish() { } - bool matches(const QString &) const; + void finish(); private: - QString m_searchKeywords; - SettingsPageWidget* m_widget; + QPointer<SettingsPageWidget> m_widget; }; } // namespace Subversion |