From c49bed119986350efa577876efc855d6d5f0d293 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint <Friedemann.Kleint@nokia.com> Date: Tue, 24 Nov 2009 15:00:55 +0100 Subject: [PATCH] Mercurial: Polish settings dialog. Task-number: QTCREATOR-26 --- src/plugins/mercurial/optionspage.cpp | 21 +++ src/plugins/mercurial/optionspage.h | 3 + src/plugins/mercurial/optionspage.ui | 224 +++++++++++++++----------- 3 files changed, 150 insertions(+), 98 deletions(-) diff --git a/src/plugins/mercurial/optionspage.cpp b/src/plugins/mercurial/optionspage.cpp index 538dd77275c..e4c50d68910 100644 --- a/src/plugins/mercurial/optionspage.cpp +++ b/src/plugins/mercurial/optionspage.cpp @@ -35,6 +35,8 @@ #include <utils/pathchooser.h> #include <vcsbase/vcsbaseconstants.h> +#include <QtCore/QTextStream> + using namespace Mercurial::Internal; using namespace Mercurial; @@ -68,6 +70,19 @@ void OptionsPageWidget::setSettings(const MercurialSettings &s) m_ui.promptOnSubmitCheckBox->setChecked(s.prompt()); } +QString OptionsPageWidget::searchKeywords() const +{ + QString rc; + QTextStream(&rc) << ' ' << m_ui.mercurialCommandLabel->text() + << ' ' << m_ui.showLogEntriesLabel->text() + << ' ' << m_ui.timeoutSecondsLabel->text() + << ' ' << m_ui.promptOnSubmitCheckBox->text() + << ' ' << m_ui.defaultUsernameLabel->text() + << ' ' << m_ui.defaultEmailLabel->text(); + rc.remove(QLatin1Char('&')); + return rc; +} + OptionsPage::OptionsPage() { } @@ -97,6 +112,8 @@ QWidget *OptionsPage::createPage(QWidget *parent) if (!optionsPageWidget) optionsPageWidget = new OptionsPageWidget(parent); optionsPageWidget->setSettings(MercurialPlugin::instance()->settings()); + if (m_searchKeywords.isEmpty()) + m_searchKeywords = optionsPageWidget->searchKeywords(); return optionsPageWidget; } @@ -114,3 +131,7 @@ void OptionsPage::apply() } } +bool OptionsPage::matches(const QString &s) const +{ + return m_searchKeywords.contains(s, Qt::CaseInsensitive); +} diff --git a/src/plugins/mercurial/optionspage.h b/src/plugins/mercurial/optionspage.h index 362a435a07a..0143fea1e05 100644 --- a/src/plugins/mercurial/optionspage.h +++ b/src/plugins/mercurial/optionspage.h @@ -50,6 +50,7 @@ public: MercurialSettings settings() const; void setSettings(const MercurialSettings &s); + QString searchKeywords() const; private: Ui::OptionsPage m_ui; @@ -70,11 +71,13 @@ public: QWidget *createPage(QWidget *parent); void apply(); void finish() { } + bool matches(const QString &s) const; signals: void settingsChanged(); private: + QString m_searchKeywords; QPointer<OptionsPageWidget> optionsPageWidget; }; diff --git a/src/plugins/mercurial/optionspage.ui b/src/plugins/mercurial/optionspage.ui index 591aa03e7c5..98d7266a674 100644 --- a/src/plugins/mercurial/optionspage.ui +++ b/src/plugins/mercurial/optionspage.ui @@ -6,110 +6,138 @@ <rect> <x>0</x> <y>0</y> - <width>400</width> - <height>300</height> + <width>392</width> + <height>359</height> </rect> </property> <property name="windowTitle"> <string>Form</string> </property> - <layout class="QHBoxLayout" name="horizontalLayout"> + <layout class="QVBoxLayout" name="verticalLayout"> <item> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <layout class="QFormLayout" name="formLayout"> - <property name="fieldGrowthPolicy"> - <enum>QFormLayout::AllNonFixedFieldsGrow</enum> - </property> - <item row="0" column="0"> - <widget class="QLabel" name="mercurialCommandLabel"> - <property name="text"> - <string>Mercurial Command:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="Utils::PathChooser" name="commandChooser" native="true"/> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="showLogEntriesLabel"> - <property name="text"> - <string>Show Log Entries:</string> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QSpinBox" name="logEntriesCount"> - <property name="toolTip"> - <string>The number of recent commit logs to show, choose 0 to see all enteries</string> - </property> - </widget> - </item> - <item row="4" column="0"> - <widget class="QLabel" name="timeoutSecondsLabel"> - <property name="text"> - <string>Timeout (Seconds):</string> - </property> - </widget> - </item> - <item row="4" column="1"> - <widget class="QSpinBox" name="timeout"> - <property name="value"> - <number>30</number> - </property> - </widget> - </item> - <item row="5" column="0"> - <widget class="QLabel" name="promptOnSubmitLabel"> - <property name="text"> - <string>Prompt On Submit</string> - </property> - </widget> - </item> - <item row="5" column="1"> - <widget class="QCheckBox" name="promptOnSubmitCheckBox"> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="defaultUsernameLabel"> - <property name="toolTip"> - <string>Username to use by default on commit.</string> - </property> - <property name="text"> - <string>Default Username:</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLineEdit" name="defaultUsernameLineEdit"> - <property name="toolTip"> - <string>Username to use by default on commit.</string> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="defaultEmailLabel"> - <property name="toolTip"> - <string>Email to use by default on commit.</string> - </property> - <property name="text"> - <string>Default Email:</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QLineEdit" name="defaultEmailLineEdit"> - <property name="toolTip"> - <string>Email to use by default on commit.</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> + <widget class="QGroupBox" name="configgroupBox"> + <property name="title"> + <string>Configuration</string> + </property> + <layout class="QFormLayout" name="formLayout_3"> + <item row="0" column="0"> + <widget class="QLabel" name="mercurialCommandLabel"> + <property name="text"> + <string>Command:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="Utils::PathChooser" name="commandChooser"/> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="userGroupBox"> + <property name="title"> + <string>User</string> + </property> + <layout class="QFormLayout" name="formLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="defaultUsernameLabel"> + <property name="toolTip"> + <string>Username to use by default on commit.</string> + </property> + <property name="text"> + <string>Default username:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLineEdit" name="defaultUsernameLineEdit"> + <property name="toolTip"> + <string>Username to use by default on commit.</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="defaultEmailLabel"> + <property name="toolTip"> + <string>Email to use by default on commit.</string> + </property> + <property name="text"> + <string>Default Email:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLineEdit" name="defaultEmailLineEdit"> + <property name="toolTip"> + <string>Email to use by default on commit.</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="miscGroupBox"> + <property name="title"> + <string>Miscellaneous</string> + </property> + <layout class="QFormLayout" name="formLayout_2"> + <item row="0" column="0"> + <widget class="QLabel" name="showLogEntriesLabel"> + <property name="text"> + <string>Show log entries:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QSpinBox" name="logEntriesCount"> + <property name="toolTip"> + <string>The number of recent commit logs to show, choose 0 to see all enteries</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="timeoutSecondsLabel"> + <property name="text"> + <string>Timeout:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QSpinBox" name="timeout"> + <property name="suffix"> + <string>s</string> + </property> + <property name="value"> + <number>30</number> + </property> + </widget> + </item> + <item row="2" column="0" colspan="2"> + <widget class="QCheckBox" name="promptOnSubmitCheckBox"> + <property name="text"> + <string>Prompt on submit</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> </item> </layout> </widget> -- GitLab