Connect signal for language change in PreferencesPanel

This commit is contained in:
Grégory Soutadé 2012-02-11 12:48:19 +01:00
parent 1675b9abee
commit b533ac0578
4 changed files with 12 additions and 6 deletions

View File

@ -161,6 +161,8 @@ PreferencesPanel::PreferencesPanel(KissCount* kiss, wxUI *parent) : KissPanel(ki
InitLanguage(user);
connect(_language, SIGNAL(currentRowChanged(int)), this, SLOT(OnLanguageChange(int)));
staticBoxSizer->addWidget(_language);
hbox2->addWidget(staticLanguage);
@ -456,7 +458,7 @@ void PreferencesPanel::InitLanguage(User* user)
item->setIcon(QIcon(SupportedLanguages::languages[i].icon)),
_language->addItem(item);
if (SupportedLanguages::languages[i].language == _wxUI->_language)
if (SupportedLanguages::languages[i].name == _wxUI->_language)
select = i;
}
@ -1061,10 +1063,10 @@ void PreferencesPanel::OnOperationOrderChange(int index)
_wxUI->NeedReload();
}
void PreferencesPanel::OnLanguageChange()
void PreferencesPanel::OnLanguageChange(int index)
{
SupportedLanguages::wxLanguage language = SupportedLanguages::languages[_language->currentRow()].language;
QString name_lang = SupportedLanguages::languages[_language->currentRow()].name;
SupportedLanguages::wxLanguage language = SupportedLanguages::languages[index].language;
QString name_lang = SupportedLanguages::languages[index].name;
if (_wxUI->SetLanguage(name_lang) || language == SupportedLanguages::wxLANGUAGE_ENGLISH)
{

View File

@ -57,7 +57,7 @@ private slots:
void OnChangeName();
void OnChangePassword();
void OnOperationOrderChange(int index);
void OnLanguageChange();
void OnLanguageChange(int);
void OnKillMe();
private:

View File

@ -128,6 +128,8 @@ bool wxUI::SetLanguage(QString language)
// res = false;
// }
_language = language;
months[0] = _("january");
months[1] = _("february");
months[2] = _("march");
@ -203,6 +205,8 @@ void wxUI::LoadUser()
if (user->_preferences["language"].size())
SetLanguage(user->GetLanguage());
else
SetLanguage(SupportedLanguages::languages[0].name);
LoadPanels();

View File

@ -72,7 +72,7 @@ public:
void ShowPanel(KissPanel* panel);
void NeedReload();
int _language;
QString _language;
private slots:
void OnButtonClicked(int id);