diff options
author | Ken Moore <moorekou@gmail.com> | 2015-07-21 16:18:56 -0400 |
---|---|---|
committer | Ken Moore <moorekou@gmail.com> | 2015-07-21 16:18:56 -0400 |
commit | 9563e097f85d862aa3647e2d4ede759fd6048df1 (patch) | |
tree | 9d3728ffbe2075861a7fe4fb5bb05588be19a616 /lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.cpp | |
parent | Change a bit more of the localization/translation mechanisms: Now it is possi... (diff) | |
download | lumina-9563e097f85d862aa3647e2d4ede759fd6048df1.tar.gz lumina-9563e097f85d862aa3647e2d4ede759fd6048df1.tar.bz2 lumina-9563e097f85d862aa3647e2d4ede759fd6048df1.zip |
Finish cleaning up the new localization configuration settings in libLumina, and put a combobox in the system dashboard plugin which allows the user to (temporarily) change their session locale.
Still need to finish up the active re-translation of the desktop session though.
Diffstat (limited to 'lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.cpp')
-rw-r--r-- | lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.cpp | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.cpp b/lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.cpp index 0cf053fa..0e5867c2 100644 --- a/lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.cpp +++ b/lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.cpp @@ -16,8 +16,9 @@ LSysMenuQuick::LSysMenuQuick(QWidget *parent) : QWidget(parent), ui(new Ui::LSys brighttimer->setSingleShot(true); brighttimer->setInterval(50); //50ms delay in setting the new value //Now reset the initial saved settings (this is handles by the LOS/session now - 4/22/15) + firstrun = true; UpdateMenu(); //do this once before all the signals/slots are connected below - + firstrun = false; //Now setup the connections connect(ui->slider_volume, SIGNAL(valueChanged(int)), this, SLOT(volSliderChanged()) ); connect(ui->slider_brightness, SIGNAL(valueChanged(int)), this, SLOT(brightSliderChanged()) ); @@ -26,6 +27,7 @@ LSysMenuQuick::LSysMenuQuick(QWidget *parent) : QWidget(parent), ui(new Ui::LSys connect(ui->tool_logout, SIGNAL(clicked()), this, SLOT(startLogout()) ); connect(ui->tool_vol_mixer, SIGNAL(clicked()), this, SLOT(startMixer()) ); connect(brighttimer, SIGNAL(timeout()), this, SLOT(setCurrentBrightness()) ); + connect(ui->combo_locale, SIGNAL(currentIndexChanged(int)), this, SLOT(changeLocale()) ); //And setup the default icons ui->label_bright_icon->setPixmap( LXDG::findIcon("preferences-system-power-management","").pixmap(ui->label_bright_icon->maximumSize()) ); ui->tool_wk_prev->setIcon( LXDG::findIcon("go-previous-view","")); @@ -66,8 +68,27 @@ void LSysMenuQuick::UpdateMenu(){ ui->label_bright_text->setText(txt); if(ui->slider_brightness->value()!=val){ ui->slider_brightness->setValue(val); } } + + //Do any one-time checks + if(firstrun){ + hasBat = LOS::hasBattery(); //No need to check this more than once - will not change in the middle of a session + //Current Locale + QStringList locales = LUtils::knownLocales(); + ui->combo_locale->clear(); + QLocale curr; + for(int i=0; i<locales.length(); i++){ + QLocale loc(locales[i]); + ui->combo_locale->addItem(loc.nativeLanguageName(), locales[i]); //Make the display text prettier later + if(locales[i] == curr.name() || locales[i] == curr.name().section("_",0,0) ){ + //Current Locale + ui->combo_locale->setCurrentIndex(ui->combo_locale->count()-1); //the last item in the list right now + } + } + ui->group_locale->setVisible(locales.length() > 1); + } + //Battery Status - if(LOS::hasBattery()){ + if(hasBat){ ui->group_battery->setVisible(true); val = LOS::batteryCharge(); if(LOS::batteryIsCharging()){ @@ -178,3 +199,10 @@ void LSysMenuQuick::startLogout(){ emit CloseMenu(); LSession::handle()->systemWindow(); } + +void LSysMenuQuick::changeLocale(){ + //Get the currently selected Locale + QString locale = ui->combo_locale->currentData().toString(); + emit CloseMenu(); + LSession::handle()->switchLocale(locale); +}
\ No newline at end of file |