diff options
Diffstat (limited to 'lumina-config')
-rw-r--r-- | lumina-config/LPlugins.cpp | 9 | ||||
-rw-r--r-- | lumina-config/mainUI.cpp | 127 | ||||
-rw-r--r-- | lumina-config/mainUI.h | 2 | ||||
-rw-r--r-- | lumina-config/mainUI.ui | 30 |
4 files changed, 137 insertions, 31 deletions
diff --git a/lumina-config/LPlugins.cpp b/lumina-config/LPlugins.cpp index 55a5ee9e..94b61f34 100644 --- a/lumina-config/LPlugins.cpp +++ b/lumina-config/LPlugins.cpp @@ -135,13 +135,20 @@ void LPlugins::LoadPanelPlugins(){ info.ID = "homebutton"; info.icon = "go-home"; PANEL.insert(info.ID, info); - //Desktop Bar + //Start Menu info = LPI(); //clear it info.name = QObject::tr("Start Menu"); info.description = QObject::tr("This provides instant-access to application that are installed on the system."); info.ID = "appmenu"; info.icon = "Lumina-DE"; PANEL.insert(info.ID, info); + //Application Launcher + info = LPI(); //clear it + info.name = QObject::tr("Application Launcher"); + info.description = QObject::tr("Pin an application shortcut directly to the panel"); + info.ID = "applauncher"; + info.icon = "quickopen"; + PANEL.insert(info.ID, info); } void LPlugins::LoadDesktopPlugins(){ diff --git a/lumina-config/mainUI.cpp b/lumina-config/mainUI.cpp index c633e866..8bcb4f40 100644 --- a/lumina-config/mainUI.cpp +++ b/lumina-config/mainUI.cpp @@ -11,11 +11,13 @@ #include <QImageReader> #include <QTime> #include <QDate> +#include <QTimeZone> MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI()){ ui->setupUi(this); //load the designer file this->setWindowIcon( LXDG::findIcon("preferences-desktop-display","") ); PINFO = new LPlugins(); //load the info class + panadjust = false; DEFAULTBG = LOS::LuminaShare()+"desktop-background.jpg"; //Be careful about the QSettings setup, it must match the lumina-desktop setup QSettings::setPath(QSettings::NativeFormat, QSettings::UserScope, QDir::homePath()+"/.lumina"); @@ -234,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(){ @@ -272,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(){ @@ -485,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(); @@ -864,7 +898,8 @@ void MainUI::checkpanels(){ void MainUI::adjustpanel1(){ //Adjust panel 1 to complement a panel 2 change - if(loading){ return; } + if(loading || panadjust){ return; } + panadjust = true; qDebug() << "Adjust Panel 1:"; ui->toolBox_panel1->setCurrentIndex( ui->toolBox_panel2->currentIndex() ); bool changed = false; @@ -883,11 +918,13 @@ void MainUI::adjustpanel1(){ changed = true; ui->combo_panel1_loc->setCurrentIndex(newindex); } + panadjust = false; if(!loading){ ui->push_save->setEnabled(true); modpan = true; } } void MainUI::adjustpanel2(){ - if(loading){ return; } + if(loading || panadjust){ return; } + panadjust = true; //Adjust panel 2 to complement a panel 1 change qDebug() << "Adjust Panel 2:"; ui->toolBox_panel2->setCurrentIndex( ui->toolBox_panel1->currentIndex() ); @@ -907,7 +944,8 @@ void MainUI::adjustpanel2(){ changed = true; ui->combo_panel2_loc->setCurrentIndex(newindex); } - if(!loading){ ui->push_save->setEnabled(true); modpan = true; } + panadjust = false; + if(!loading && changed){ ui->push_save->setEnabled(true); modpan = true; } } @@ -935,14 +973,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; } } @@ -953,14 +1003,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; } } @@ -1729,6 +1791,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(); @@ -1821,6 +1891,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(); @@ -1828,6 +1906,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); } diff --git a/lumina-config/mainUI.h b/lumina-config/mainUI.h index 93400d93..2593d648 100644 --- a/lumina-config/mainUI.h +++ b/lumina-config/mainUI.h @@ -57,7 +57,7 @@ private: QString panelcolor; QString DEFAULTBG; QList<XDGDesktop> sysApps; - bool loading; + bool loading, panadjust; bool moddesk, modpan, modmenu, modshort, moddef, modses; //page modified flags int panelnumber; diff --git a/lumina-config/mainUI.ui b/lumina-config/mainUI.ui index fcebaff7..07abacab 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"> @@ -602,8 +602,8 @@ <rect> <x>0</x> <y>0</y> - <width>263</width> - <height>178</height> + <width>233</width> + <height>150</height> </rect> </property> <attribute name="label"> @@ -799,8 +799,8 @@ <rect> <x>0</x> <y>0</y> - <width>263</width> - <height>178</height> + <width>233</width> + <height>150</height> </rect> </property> <attribute name="label"> @@ -1634,6 +1634,26 @@ </property> </widget> </item> + <item row="4" column="0"> + <widget class="QLabel" name="label_26"> + <property name="text"> + <string>Time Zone:</string> + </property> + </widget> + </item> + <item row="4" column="1"> + <widget class="QComboBox" name="combo_session_timezone"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="sizeAdjustPolicy"> + <enum>QComboBox::AdjustToMinimumContentsLength</enum> + </property> + </widget> + </item> </layout> </item> <item row="6" column="0" colspan="2"> |