aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-12-06 17:14:50 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-12-06 11:56:00 -0800
commit7436178fe0817a4c5defac28f1a395d84cf539b5 (patch)
tree88baa9df79e504a0e36c426f4ba197bb663d5cee
parent32264cf393d6e9e617f97b2b242845111291a576 (diff)
downloadsubsurface-7436178fe0817a4c5defac28f1a395d84cf539b5.tar.gz
Added a filter option to the Language Chooser
This patch adds a filter option to the Language Chooser. if you choose filter, only the filtered options will appear. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/preferences.cpp7
-rw-r--r--qt-ui/preferences.h1
-rw-r--r--qt-ui/preferences.ui40
3 files changed, 43 insertions, 5 deletions
diff --git a/qt-ui/preferences.cpp b/qt-ui/preferences.cpp
index 9d8aa061c..45777d320 100644
--- a/qt-ui/preferences.cpp
+++ b/qt-ui/preferences.cpp
@@ -4,6 +4,7 @@
#include <QDebug>
#include <QFileDialog>
#include <QMessageBox>
+#include <QSortFilterProxyModel>
PreferencesDialog* PreferencesDialog::instance()
{
@@ -105,7 +106,11 @@ void PreferencesDialog::setUiFromPrefs()
ui.vertical_speed_minutes->setChecked(prefs.units.vertical_speed_time == units::MINUTES);
ui.vertical_speed_seconds->setChecked(prefs.units.vertical_speed_time == units::SECONDS);
- ui.languageView->setModel( LanguageModel::instance() );
+ QSortFilterProxyModel *filterModel = new QSortFilterProxyModel();
+ filterModel->setSourceModel(LanguageModel::instance());
+ filterModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
+ ui.languageView->setModel(filterModel);
+ connect(ui.languageFilter, SIGNAL(textChanged(QString)), filterModel, SLOT(setFilterFixedString(QString)));
QSettings s;
s.beginGroup("Language");
diff --git a/qt-ui/preferences.h b/qt-ui/preferences.h
index dbc17cb9f..d75cf4bfd 100644
--- a/qt-ui/preferences.h
+++ b/qt-ui/preferences.h
@@ -25,7 +25,6 @@ public slots:
void gflowChanged(int gf);
void gfhighChanged(int gf);
-
private:
explicit PreferencesDialog(QWidget* parent = 0, Qt::WindowFlags f = 0);
void setUiFromPrefs();
diff --git a/qt-ui/preferences.ui b/qt-ui/preferences.ui
index 73632dc72..50a0f7ab0 100644
--- a/qt-ui/preferences.ui
+++ b/qt-ui/preferences.ui
@@ -131,7 +131,7 @@
</sizepolicy>
</property>
<property name="currentIndex">
- <number>0</number>
+ <number>3</number>
</property>
<widget class="QWidget" name="page_2">
<layout class="QVBoxLayout" name="verticalLayout_3">
@@ -828,7 +828,41 @@
</layout>
</widget>
<widget class="QWidget" name="page_4">
- <layout class="QHBoxLayout" name="horizontalLayout_6">
+ <layout class="QVBoxLayout" name="verticalLayout_6">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_6">
+ <item>
+ <widget class="QCheckBox" name="languageSystemDefault">
+ <property name="text">
+ <string>System Default</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_14">
+ <property name="text">
+ <string>Filter</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="languageFilter"/>
+ </item>
+ </layout>
+ </item>
<item>
<widget class="QListView" name="languageView"/>
</item>
@@ -1112,10 +1146,10 @@
</connection>
</connections>
<buttongroups>
+ <buttongroup name="buttonGroup"/>
<buttongroup name="verticalSpeed"/>
<buttongroup name="buttonGroup_2"/>
<buttongroup name="buttonGroup_3"/>
- <buttongroup name="buttonGroup"/>
<buttongroup name="buttonGroup_4"/>
<buttongroup name="buttonGroup_5"/>
<buttongroup name="buttonGroup_6"/>