aboutsummaryrefslogtreecommitdiff
path: root/lumina-config/mainUI.cpp
diff options
context:
space:
mode:
authorKen Moore <ken@pcbsd.org>2015-03-24 08:01:29 -0400
committerKen Moore <ken@pcbsd.org>2015-03-24 08:01:29 -0400
commit120207ea7de7ca6e0973ececb4787e982feefcd1 (patch)
tree3c7dcdf0c2d182f25e5caf1531e13948376c7cd0 /lumina-config/mainUI.cpp
parentMerge branch 'master' of github.com:pcbsd/lumina (diff)
parentAdd a new information file: DeveloperGuidelines.txt (diff)
downloadlumina-120207ea7de7ca6e0973ececb4787e982feefcd1.tar.gz
lumina-120207ea7de7ca6e0973ececb4787e982feefcd1.tar.bz2
lumina-120207ea7de7ca6e0973ececb4787e982feefcd1.zip
Merge branch 'master' of github.com:pcbsd/lumina
Diffstat (limited to 'lumina-config/mainUI.cpp')
-rw-r--r--lumina-config/mainUI.cpp116
1 files changed, 95 insertions, 21 deletions
diff --git a/lumina-config/mainUI.cpp b/lumina-config/mainUI.cpp
index 34b25b3d..744d4bdf 100644
--- a/lumina-config/mainUI.cpp
+++ b/lumina-config/mainUI.cpp
@@ -11,6 +11,7 @@
#include <QImageReader>
#include <QTime>
#include <QDate>
+#include <QTimeZone>
MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI()){
ui->setupUi(this); //load the designer file
@@ -235,6 +236,7 @@ void MainUI::setupConnections(){
connect(ui->tool_help_date, SIGNAL(clicked()), this, SLOT(sessionShowDateCodes()) );
connect(ui->line_session_time, SIGNAL(textChanged(QString)), this, SLOT(sessionLoadTimeSample()) );
connect(ui->line_session_date, SIGNAL(textChanged(QString)), this, SLOT(sessionLoadDateSample()) );
+ connect(ui->combo_session_timezone, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) );
}
void MainUI::setupMenus(){
@@ -273,7 +275,28 @@ void MainUI::setupMenus(){
ui->combo_session_wtheme->addItem(fbstyles[i], fbdir.absoluteFilePath(fbstyles[i]));
}
-
+ //Available Time zones
+ ui->combo_session_timezone->clear();
+ QList<QByteArray> TZList = QTimeZone::availableTimeZoneIds();
+ QDateTime DT = QDateTime::currentDateTime();
+ QStringList tzlist; //Need to create a list which can be sorted appropriately
+ for(int i=0; i<TZList.length(); i++){
+ QTimeZone TZ(TZList[i]);
+ if(TZ.country()<=0){ continue; } //skip this one
+ QString name = QLocale::countryToString(TZ.country());
+ if(name.count() > 20){ name = name.left(20)+"..."; }
+ name = QString(tr("%1 (%2)")).arg(name, TZ.abbreviation(DT));
+ if(tzlist.filter(name).isEmpty()){
+ tzlist << name+"::::"+QString::number(i);
+ }
+ }
+ tzlist.sort();
+ for(int i=0; i<tzlist.length(); i++){
+ ui->combo_session_timezone->addItem( tzlist[i].section("::::",0,0), TZList[tzlist[i].section("::::",1,1).toInt()]);
+ }
+ //ui->combo_session_timezone->sort();
+ //Now set the default/system value
+ ui->combo_session_timezone->insertItem(0,tr("System Time"));
}
int MainUI::currentDesktop(){
@@ -486,11 +509,21 @@ void MainUI::loadCurrentSettings(bool screenonly){
ui->list_panel1_plugins->clear();
for(int i=0; i<plugs.length(); i++){
QString pid = plugs[i].section("---",0,0);
- LPI info = PINFO->panelPluginInfo(pid);
- if(!info.ID.isEmpty()){
- QListWidgetItem *it = new QListWidgetItem( LXDG::findIcon(info.icon,""), info.name );
+ if(pid.startsWith("applauncher")){
+ bool ok = false;
+ XDGDesktop desk = LXDG::loadDesktopFile(pid.section("::",1,1),ok);
+ if(ok){
+ QListWidgetItem *it = new QListWidgetItem( LXDG::findIcon(desk.icon,""), desk.name );
+ it->setWhatsThis(plugs[i]); //make sure to preserve the entire plugin ID (is the unique version)
+ ui->list_panel1_plugins->addItem(it);
+ }
+ }else{
+ LPI info = PINFO->panelPluginInfo(pid);
+ if(!info.ID.isEmpty()){
+ QListWidgetItem *it = new QListWidgetItem( LXDG::findIcon(info.icon,""), info.name );
it->setWhatsThis(plugs[i]); //make sure to preserve the entire plugin ID (is the unique version)
- ui->list_panel1_plugins->addItem(it);
+ ui->list_panel1_plugins->addItem(it);
+ }
}
}
QString color = settings->value(PPrefix+"color","rgba(255,255,255,160)").toString();
@@ -951,14 +984,26 @@ void MainUI::addpanel1plugin(){
dlg.exec();
if(!dlg.selected){ return; } //cancelled
QString pan = dlg.plugID; //getNewPanelPlugin();
- if(pan.isEmpty()){ return; } //nothing selected
- //Add the new plugin to the list
- LPI info = PINFO->panelPluginInfo(pan);
- QListWidgetItem *it = new QListWidgetItem( LXDG::findIcon(info.icon,""), info.name);
- it->setWhatsThis(info.ID);
- ui->list_panel1_plugins->addItem(it);
- ui->list_panel1_plugins->setCurrentItem(it);
- ui->list_panel1_plugins->scrollToItem(it);
+ if(pan == "applauncher"){
+ //Prompt for the application to add
+ XDGDesktop app = getSysApp();
+ if(app.filePath.isEmpty()){ return; } //cancelled
+ pan.append("::"+app.filePath);
+ QListWidgetItem *it = new QListWidgetItem( LXDG::findIcon(app.icon,""), app.name);
+ it->setWhatsThis(pan);
+ ui->list_panel1_plugins->addItem(it);
+ ui->list_panel1_plugins->setCurrentItem(it);
+ ui->list_panel1_plugins->scrollToItem(it);
+ }else{
+ if(pan.isEmpty()){ return; } //nothing selected
+ //Add the new plugin to the list
+ LPI info = PINFO->panelPluginInfo(pan);
+ QListWidgetItem *it = new QListWidgetItem( LXDG::findIcon(info.icon,""), info.name);
+ it->setWhatsThis(info.ID);
+ ui->list_panel1_plugins->addItem(it);
+ ui->list_panel1_plugins->setCurrentItem(it);
+ ui->list_panel1_plugins->scrollToItem(it);
+ }
checkpanels(); //update buttons
if(!loading){ ui->push_save->setEnabled(true); modpan = true; }
}
@@ -969,14 +1014,26 @@ void MainUI::addpanel2plugin(){
dlg.exec();
if(!dlg.selected){ return; } //cancelled
QString pan = dlg.plugID; //getNewPanelPlugin();
- if(pan.isEmpty()){ return; } //nothing selected
- //Add the new plugin to the list
- LPI info = PINFO->panelPluginInfo(pan);
- QListWidgetItem *it = new QListWidgetItem( LXDG::findIcon(info.icon,""), info.name);
- it->setWhatsThis(info.ID);
- ui->list_panel2_plugins->addItem(it);
- ui->list_panel2_plugins->setCurrentItem(it);
- ui->list_panel2_plugins->scrollToItem(it);
+ if(pan == "applauncher"){
+ //Prompt for the application to add
+ XDGDesktop app = getSysApp();
+ if(app.filePath.isEmpty()){ return; } //cancelled
+ pan.append("::"+app.filePath);
+ QListWidgetItem *it = new QListWidgetItem( LXDG::findIcon(app.icon,""), app.name);
+ it->setWhatsThis(pan);
+ ui->list_panel2_plugins->addItem(it);
+ ui->list_panel2_plugins->setCurrentItem(it);
+ ui->list_panel2_plugins->scrollToItem(it);
+ }else{
+ if(pan.isEmpty()){ return; } //nothing selected
+ //Add the new plugin to the list
+ LPI info = PINFO->panelPluginInfo(pan);
+ QListWidgetItem *it = new QListWidgetItem( LXDG::findIcon(info.icon,""), info.name);
+ it->setWhatsThis(info.ID);
+ ui->list_panel2_plugins->addItem(it);
+ ui->list_panel2_plugins->setCurrentItem(it);
+ ui->list_panel2_plugins->scrollToItem(it);
+ }
checkpanels(); //update buttons
if(!loading){ ui->push_save->setEnabled(true); modpan = true; }
}
@@ -1745,6 +1802,14 @@ void MainUI::loadSessionSettings(){
ui->push_session_setUserIcon->setIcon( LXDG::findIcon(QDir::homePath()+"/.loginIcon.png", "user-identity") );
ui->line_session_time->setText( sessionsettings->value("TimeFormat","").toString() );
ui->line_session_date->setText( sessionsettings->value("DateFormat","").toString() );
+ if( !sessionsettings->value("CustomTimeZone", false).toBool() ){
+ //System Time selected
+ ui->combo_session_timezone->setCurrentIndex(0);
+ }else{
+ int index = ui->combo_session_timezone->findData( sessionsettings->value("TimeZoneByteCode",QByteArray()).toByteArray() );
+ if(index>0){ ui->combo_session_timezone->setCurrentIndex(index); }
+ else{ ui->combo_session_timezone->setCurrentIndex(0); }
+ }
//Now do the session theme options
ui->combo_session_themefile->clear();
@@ -1837,6 +1902,14 @@ void MainUI::saveSessionSettings(){
sessionsettings->setValue("PlayLogoutAudio", ui->check_session_playlogoutaudio->isChecked());
sessionsettings->setValue("TimeFormat", ui->line_session_time->text());
sessionsettings->setValue("DateFormat", ui->line_session_date->text());
+ if( ui->combo_session_timezone->currentIndex()==0){
+ //System Time selected
+ sessionsettings->setValue("CustomTimeZone", false);
+ sessionsettings->setValue("TimeZoneByteCode", QByteArray()); //clear the value
+ }else{
+ sessionsettings->setValue("CustomTimeZone", true);
+ sessionsettings->setValue("TimeZoneByteCode", ui->combo_session_timezone->currentData().toByteArray()); //clear the value
+ }
//Now do the theme options
QString themefile = ui->combo_session_themefile->itemData( ui->combo_session_themefile->currentIndex() ).toString();
@@ -1844,6 +1917,7 @@ void MainUI::saveSessionSettings(){
QString iconset = ui->combo_session_icontheme->currentText();
QString font = ui->font_session_theme->currentFont().family();
QString fontsize = QString::number(ui->spin_session_fontsize->value())+"pt";
+ //qDebug() << "Saving theme options:" << themefile << colorfile << iconset << font << fontsize;
LTHEME::setCurrentSettings( themefile, colorfile, iconset, font, fontsize);
}
bgstack15