aboutsummaryrefslogtreecommitdiff
path: root/lumina-desktop/panel-plugins/systemdashboard
diff options
context:
space:
mode:
authorKen Moore <moorekou@gmail.com>2015-07-21 16:18:56 -0400
committerKen Moore <moorekou@gmail.com>2015-07-21 16:18:56 -0400
commit9563e097f85d862aa3647e2d4ede759fd6048df1 (patch)
tree9d3728ffbe2075861a7fe4fb5bb05588be19a616 /lumina-desktop/panel-plugins/systemdashboard
parentChange a bit more of the localization/translation mechanisms: Now it is possi... (diff)
downloadlumina-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')
-rw-r--r--lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.cpp32
-rw-r--r--lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.h3
-rw-r--r--lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.ui74
3 files changed, 71 insertions, 38 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
diff --git a/lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.h b/lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.h
index a9580cce..a300b5b1 100644
--- a/lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.h
+++ b/lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.h
@@ -32,7 +32,7 @@ public:
private:
Ui::LSysMenuQuick *ui;
QTimer *brighttimer;
-
+ bool firstrun, hasBat;
QString getRemainingTime(); //battery time left
private slots:
@@ -43,6 +43,7 @@ private slots:
void nextWorkspace();
void prevWorkspace();
void startLogout();
+ void changeLocale();
signals:
diff --git a/lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.ui b/lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.ui
index 8f58cae9..67e83a45 100644
--- a/lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.ui
+++ b/lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.ui
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>169</width>
- <height>240</height>
+ <width>171</width>
+ <height>317</height>
</rect>
</property>
<property name="windowTitle">
@@ -336,56 +336,60 @@ font: bold;
</widget>
</item>
<item>
- <widget class="QGroupBox" name="groupBox">
- <property name="styleSheet">
- <string notr="true">QGroupBox{ border: none; }</string>
- </property>
+ <widget class="QGroupBox" name="group_locale">
<property name="title">
- <string/>
- </property>
- <property name="flat">
- <bool>true</bool>
+ <string>Locale</string>
</property>
- <layout class="QHBoxLayout" name="horizontalLayout_5">
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <property name="spacing">
+ <number>2</number>
+ </property>
<property name="leftMargin">
- <number>1</number>
+ <number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
- <number>1</number>
+ <number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
- <widget class="QToolButton" name="tool_logout">
- <property name="font">
- <font>
- <pointsize>9</pointsize>
- </font>
- </property>
- <property name="text">
- <string>Log Out</string>
- </property>
- <property name="iconSize">
- <size>
- <width>22</width>
- <height>22</height>
- </size>
- </property>
- <property name="toolButtonStyle">
- <enum>Qt::ToolButtonTextBesideIcon</enum>
- </property>
- <property name="autoRaise">
- <bool>false</bool>
- </property>
- </widget>
+ <widget class="QComboBox" name="combo_locale"/>
</item>
</layout>
</widget>
</item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_6">
+ <item>
+ <widget class="QToolButton" name="tool_logout">
+ <property name="font">
+ <font>
+ <pointsize>9</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string>Log Out</string>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>22</width>
+ <height>22</height>
+ </size>
+ </property>
+ <property name="toolButtonStyle">
+ <enum>Qt::ToolButtonTextBesideIcon</enum>
+ </property>
+ <property name="autoRaise">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
</layout>
</widget>
<resources/>
bgstack15