From 7436178fe0817a4c5defac28f1a395d84cf539b5 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Fri, 6 Dec 2013 17:14:50 -0200 Subject: 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 Signed-off-by: Dirk Hohndel --- qt-ui/preferences.cpp | 7 ++++++- qt-ui/preferences.h | 1 - qt-ui/preferences.ui | 40 +++++++++++++++++++++++++++++++++++++--- 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 #include #include +#include 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 @@ - 0 + 3 @@ -828,7 +828,41 @@ - + + + + + + + System Default + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Filter + + + + + + + + @@ -1112,10 +1146,10 @@ + - -- cgit v1.2.3-70-g09d2