diff options
Diffstat (limited to 'lumina-desktop/panel-plugins/systemdashboard')
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/> |