From 62541cbe2e9508ea510431b826ac03db2d78fd52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sun, 1 Apr 2012 10:49:39 +0200 Subject: [PATCH] Fix a bug : bad selected language in PreferencesPanel --- INSTALL | 3 ++- TODO | 2 -- src/view/PreferencesPanel.cpp | 18 +++++++++++++----- src/view/SupportedLanguages.hpp | 4 ++-- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/INSTALL b/INSTALL index 0bc464b..f484880 100644 --- a/INSTALL +++ b/INSTALL @@ -7,11 +7,12 @@ g++ make gettext -Optionnal : +Optional : git poeditor xgettext qt4-dev-tools +debhelper, devscripts, dh-make, fakeroot php5 diff --git a/TODO b/TODO index 6bb01b5..a4c053d 100644 --- a/TODO +++ b/TODO @@ -37,5 +37,3 @@ it's not taken in account by UpdateStats it will not be displayed. In this case we must load whole meta. This bug can't be resolved without use of hashtable because of complexity in searching this issue. - -* Français not correctly spelled (cause UTF-8) in StatsPanel \ No newline at end of file diff --git a/src/view/PreferencesPanel.cpp b/src/view/PreferencesPanel.cpp index 6618986..bcf470a 100644 --- a/src/view/PreferencesPanel.cpp +++ b/src/view/PreferencesPanel.cpp @@ -159,8 +159,6 @@ PreferencesPanel::PreferencesPanel(KissCount* kiss, wxUI *parent) : KissPanel(ki _language = new QListWidget(); //_language->SetWindowStyle(wxCB_READONLY); - InitLanguage(user); - connect(_language, SIGNAL(currentRowChanged(int)), this, SLOT(OnLanguageChange(int))); staticBoxSizer->addWidget(_language); @@ -452,17 +450,23 @@ void PreferencesPanel::InitLanguage(User* user) int i, select=0; QListWidgetItem* item; + _inModification = true; + + _language->clear(); + for (i=0; isetIcon(QIcon(SupportedLanguages::languages[i].icon)), _language->addItem(item); - if (SupportedLanguages::languages[i].name == _wxUI->_language) + if (SupportedLanguages::languages[i].name == _wxUI->_curLanguage.name) select = i; } - _language->setCurrentItem(_language->item(select)); + _language->setCurrentRow(select); + + _inModification = false; } void PreferencesPanel::InitOperationOrder(User* user) @@ -1068,6 +1072,8 @@ void PreferencesPanel::OnLanguageChange(int index) int language = SupportedLanguages::languages[index].language; QString name_lang = SupportedLanguages::languages[index].name; + if (_inModification) return; + if (_wxUI->SetLanguage(name_lang) || language == SupportedLanguages::English) { _wxUI->NeedReload(); @@ -1081,6 +1087,8 @@ void PreferencesPanel::OnLanguageChange(int index) void PreferencesPanel::OnShow() { _wxUI->setWindowTitle(_kiss->GetUser()->_name + " - " + _("Preferences")); + + InitLanguage(_kiss->GetUser()); } void PreferencesPanel::OnKillMe() diff --git a/src/view/SupportedLanguages.hpp b/src/view/SupportedLanguages.hpp index 93b58e2..f4a97c0 100644 --- a/src/view/SupportedLanguages.hpp +++ b/src/view/SupportedLanguages.hpp @@ -34,8 +34,8 @@ namespace SupportedLanguages { } language ; static const language languages[NB_SUPPORTED_LANGUAGES] = { - { QString::fromUtf8("English"), ICONS_PATH "/United Kingdom.png", QLocale::English, "english", "yyyy/MM/dd"}, - { QString::fromUtf8("Français"),ICONS_PATH "/France.png", QLocale::French, "french", "dd/MM/yyyy"} + { "English", ICONS_PATH "/United Kingdom.png", QLocale::English, "english", "yyyy/MM/dd"}, + { "Français",ICONS_PATH "/France.png", QLocale::French, "french", "dd/MM/yyyy"} }; }