diff options
author | Ken Moore <moorekou@gmail.com> | 2015-07-28 15:42:32 -0400 |
---|---|---|
committer | Ken Moore <moorekou@gmail.com> | 2015-07-28 15:42:32 -0400 |
commit | 29a03a5a65a950da49222f4753ace60050dcb285 (patch) | |
tree | 0d44e903a5a13c7f9f4a76181dd91050012b9144 /lumina-config | |
parent | Add some work that make the Lumina desktop/panels appear in the proper locati... (diff) | |
download | lumina-29a03a5a65a950da49222f4753ace60050dcb285.tar.gz lumina-29a03a5a65a950da49222f4753ace60050dcb285.tar.bz2 lumina-29a03a5a65a950da49222f4753ace60050dcb285.zip |
Expose the new "InitLocale" session options in lumina-config, and also fix a bug with the panel widget display.
Diffstat (limited to 'lumina-config')
-rw-r--r-- | lumina-config/mainUI.cpp | 78 | ||||
-rw-r--r-- | lumina-config/mainUI.ui | 94 |
2 files changed, 166 insertions, 6 deletions
diff --git a/lumina-config/mainUI.cpp b/lumina-config/mainUI.cpp index 4c1bd4a4..9ef3c665 100644 --- a/lumina-config/mainUI.cpp +++ b/lumina-config/mainUI.cpp @@ -32,7 +32,7 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI()){ ui->spin_screen->setMinimum(1); //Make sure this is only allows the current number of screens ui->spin_screen->setMaximum(desktop->screenCount()); - ui->spin_screen->setValue(desktop->primaryScreen()+1); //have the current screen auto-selected + ui->spin_screen->setValue(desktop->screenNumber(this->mapToGlobal(this->geometry().center()))+1); //have the current screen auto-selected //qDebug() << "Number of Screens:" << desktop->screenCount(); sysApps = LXDG::sortDesktopNames( LXDG::systemDesktopFiles() ); @@ -49,6 +49,7 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI()){ ui->tabWidget_panels->setCurrentIndex(0); slotChangePage(false); + QTimer::singleShot(10, this, SLOT(loadCurrentSettings()) ); //Disable the incomplete pages/items at the moment @@ -202,6 +203,13 @@ void MainUI::setupConnections(){ connect(ui->line_session_date, SIGNAL(textChanged(QString)), this, SLOT(sessionLoadDateSample()) ); connect(ui->combo_session_timezone, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) ); connect(ui->combo_session_datetimeorder, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) ); + connect(ui->combo_locale_lang, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) ); + connect(ui->combo_locale_collate, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) ); + connect(ui->combo_locale_ctype, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) ); + connect(ui->combo_locale_message, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) ); + connect(ui->combo_locale_monetary, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) ); + connect(ui->combo_locale_numeric, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) ); + connect(ui->combo_locale_time, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) ); } void MainUI::setupMenus(){ @@ -252,6 +260,28 @@ void MainUI::setupMenus(){ //ui->combo_session_timezone->sort(); //Now set the default/system value ui->combo_session_timezone->insertItem(0,tr("System Time")); + + //Available localizations + QStringList langs = LUtils::knownLocales(); + langs.sort(); + QString def = tr("System Default"); + ui->combo_locale_lang->addItem(def,""); + ui->combo_locale_collate->addItem(def,""); + ui->combo_locale_ctype->addItem(def,""); + ui->combo_locale_message->addItem(def,""); + ui->combo_locale_monetary->addItem(def,""); + ui->combo_locale_numeric->addItem(def,""); + ui->combo_locale_time->addItem(def,""); + for(int i=0; i<langs.length(); i++){ + QString lan = QLocale(langs[i]).nativeLanguageName(); + ui->combo_locale_lang->addItem(lan,langs[i]); + ui->combo_locale_collate->addItem(lan,langs[i]); + ui->combo_locale_ctype->addItem(lan,langs[i]); + ui->combo_locale_message->addItem(lan,langs[i]); + ui->combo_locale_monetary->addItem(lan,langs[i]); + ui->combo_locale_numeric->addItem(lan,langs[i]); + ui->combo_locale_time->addItem(lan,langs[i]); + } } int MainUI::currentDesktop(){ @@ -789,6 +819,10 @@ void MainUI::loadPanels(){ int dnum = currentDesktop(); if(ui->scroll_panels->widget()->layout()==0){ ui->scroll_panels->widget()->setLayout( new QHBoxLayout() ); } ui->scroll_panels->widget()->layout()->setAlignment(Qt::AlignLeft); + //Clear anything left over in the layout + for(int i=0; i<ui->scroll_panels->widget()->layout()->count(); i++){ + delete ui->scroll_panels->widget()->layout()->takeAt(i); + } for(int i=0; i<panelnumber; i++){ PanelWidget *tmp = new PanelWidget(ui->scroll_panels->widget(), this, PINFO); tmp->LoadSettings(settings, dnum, i); @@ -1550,6 +1584,36 @@ void MainUI::loadSessionSettings(){ else{ ui->combo_session_timezone->setCurrentIndex(0); } } + //Now do the localization settings + val = sessionsettings->value("InitLocale/LANG", "").toString(); + index = ui->combo_locale_lang->findData(val); + if(index<0){ index = 0; } //system default + ui->combo_locale_lang->setCurrentIndex(index); + val = sessionsettings->value("InitLocale/LC_MESSAGES", "").toString(); + index = ui->combo_locale_message->findData(val); + if(index<0){ index = 0; } //system default + ui->combo_locale_message->setCurrentIndex(index); + val = sessionsettings->value("InitLocale/LC_TIME", "").toString(); + index = ui->combo_locale_time->findData(val); + if(index<0){ index = 0; } //system default + ui->combo_locale_time->setCurrentIndex(index); + val = sessionsettings->value("InitLocale/NUMERIC", "").toString(); + index = ui->combo_locale_numeric->findData(val); + if(index<0){ index = 0; } //system default + ui->combo_locale_numeric->setCurrentIndex(index); + val = sessionsettings->value("InitLocale/MONETARY", "").toString(); + index = ui->combo_locale_monetary->findData(val); + if(index<0){ index = 0; } //system default + ui->combo_locale_monetary->setCurrentIndex(index); + val = sessionsettings->value("InitLocale/COLLATE", "").toString(); + index = ui->combo_locale_collate->findData(val); + if(index<0){ index = 0; } //system default + ui->combo_locale_collate->setCurrentIndex(index); + val = sessionsettings->value("InitLocale/CTYPE", "").toString(); + index = ui->combo_locale_ctype->findData(val); + if(index<0){ index = 0; } //system default + ui->combo_locale_ctype->setCurrentIndex(index); + //Now do the session theme options ui->combo_session_themefile->clear(); ui->combo_session_colorfile->clear(); @@ -1691,6 +1755,18 @@ void MainUI::saveSessionSettings(){ sessionsettings->setValue("CustomTimeZone", true); sessionsettings->setValue("TimeZoneByteCode", ui->combo_session_timezone->currentData().toByteArray()); //clear the value } + + //Now do the locale settings + sessionsettings->setValue("InitLocale/LANG", ui->combo_locale_lang->currentData().toString() ); + sessionsettings->setValue("InitLocale/LC_MESSAGES", ui->combo_locale_message->currentData().toString() ); + sessionsettings->setValue("InitLocale/LC_TIME", ui->combo_locale_time->currentData().toString() ); + sessionsettings->setValue("InitLocale/LC_NUMERIC", ui->combo_locale_numeric->currentData().toString() ); + sessionsettings->setValue("InitLocale/LC_MONETARY", ui->combo_locale_monetary->currentData().toString() ); + sessionsettings->setValue("InitLocale/LC_COLLATE", ui->combo_locale_collate->currentData().toString() ); + sessionsettings->setValue("InitLocale/LC_CTYPE", ui->combo_locale_ctype->currentData().toString() ); + + + //Now do the theme options QString themefile = ui->combo_session_themefile->itemData( ui->combo_session_themefile->currentIndex() ).toString(); QString colorfile = ui->combo_session_colorfile->itemData( ui->combo_session_colorfile->currentIndex() ).toString(); diff --git a/lumina-config/mainUI.ui b/lumina-config/mainUI.ui index db944804..eee44aa5 100644 --- a/lumina-config/mainUI.ui +++ b/lumina-config/mainUI.ui @@ -109,7 +109,7 @@ <enum>QFrame::StyledPanel</enum> </property> <property name="currentIndex"> - <number>1</number> + <number>4</number> </property> <widget class="QWidget" name="page_desktop"> <layout class="QVBoxLayout" name="verticalLayout_3"> @@ -570,8 +570,8 @@ <rect> <x>0</x> <y>0</y> - <width>498</width> - <height>292</height> + <width>27</width> + <height>16</height> </rect> </property> </widget> @@ -1285,6 +1285,90 @@ </item> </layout> </widget> + <widget class="QWidget" name="tab_locale"> + <attribute name="title"> + <string>Locale</string> + </attribute> + <layout class="QFormLayout" name="formLayout"> + <item row="1" column="0"> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string>Language</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QComboBox" name="combo_locale_lang"/> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_4"> + <property name="text"> + <string>Messages</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QComboBox" name="combo_locale_message"/> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_5"> + <property name="text"> + <string>Time</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QComboBox" name="combo_locale_time"/> + </item> + <item row="4" column="0"> + <widget class="QLabel" name="label_7"> + <property name="text"> + <string>Numeric</string> + </property> + </widget> + </item> + <item row="4" column="1"> + <widget class="QComboBox" name="combo_locale_numeric"/> + </item> + <item row="5" column="0"> + <widget class="QLabel" name="label_8"> + <property name="text"> + <string>Monetary</string> + </property> + </widget> + </item> + <item row="5" column="1"> + <widget class="QComboBox" name="combo_locale_monetary"/> + </item> + <item row="6" column="0"> + <widget class="QLabel" name="label_9"> + <property name="text"> + <string>Collate</string> + </property> + </widget> + </item> + <item row="6" column="1"> + <widget class="QComboBox" name="combo_locale_collate"/> + </item> + <item row="7" column="0"> + <widget class="QLabel" name="label_23"> + <property name="text"> + <string>CType</string> + </property> + </widget> + </item> + <item row="7" column="1"> + <widget class="QComboBox" name="combo_locale_ctype"/> + </item> + <item row="0" column="0" colspan="2"> + <widget class="QLabel" name="label_30"> + <property name="text"> + <string>System localization settings (restart required)</string> + </property> + </widget> + </item> + </layout> + </widget> <widget class="QWidget" name="tab_fluxbox"> <attribute name="title"> <string>Window System</string> @@ -1363,8 +1447,8 @@ <rect> <x>0</x> <y>0</y> - <width>117</width> - <height>17</height> + <width>518</width> + <height>139</height> </rect> </property> <property name="sizePolicy"> |