diff options
-rw-r--r-- | lumina-config/mainUI.cpp | 39 | ||||
-rw-r--r-- | lumina-config/mainUI.ui | 27 | ||||
-rw-r--r-- | lumina-desktop/panel-plugins/clock/LClock.cpp | 4 | ||||
-rw-r--r-- | lumina-desktop/panel-plugins/clock/LClock.h | 4 | ||||
-rw-r--r-- | lumina-fm/MainUI.cpp | 7 |
5 files changed, 73 insertions, 8 deletions
diff --git a/lumina-config/mainUI.cpp b/lumina-config/mainUI.cpp index 99576376..e5b277a9 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,26 @@ 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; + for(int i=0; i<TZList.length(); i++){ + QTimeZone TZ(TZList[i]); + if(TZ.country()<=0){ continue; } //skip this one + QString name = QString(tr("%1 (%2)")).arg(QLocale::countryToString(TZ.country()), 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(){ @@ -1734,6 +1755,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(); @@ -1826,6 +1855,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(); diff --git a/lumina-config/mainUI.ui b/lumina-config/mainUI.ui index fcebaff7..92ebf47d 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,23 @@ </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> + </widget> + </item> </layout> </item> <item row="6" column="0" colspan="2"> diff --git a/lumina-desktop/panel-plugins/clock/LClock.cpp b/lumina-desktop/panel-plugins/clock/LClock.cpp index e91a3a71..79cae84b 100644 --- a/lumina-desktop/panel-plugins/clock/LClock.cpp +++ b/lumina-desktop/panel-plugins/clock/LClock.cpp @@ -35,6 +35,7 @@ LClock::~LClock(){ void LClock::updateTime(){ QDateTime CT = QDateTime::currentDateTime(); + if(useTZ){ CT = CT.toTimeZone(TZ); } //Now update the display QString label; if(deftime){ label = CT.time().toString(Qt::SystemLocaleShortDate) ; } @@ -53,5 +54,8 @@ void LClock::updateFormats(){ datefmt = LSession::handle()->sessionSettings()->value("DateFormat","").toString(); deftime = timefmt.simplified().isEmpty(); defdate = datefmt.simplified().isEmpty(); + useTZ = LSession::handle()->sessionSettings()->value("CustomTimeZone",false).toBool(); + if(useTZ){ TZ = QTimeZone( LSession::handle()->sessionSettings()->value("TimeZoneByteCode", QByteArray()).toByteArray() ); } + } diff --git a/lumina-desktop/panel-plugins/clock/LClock.h b/lumina-desktop/panel-plugins/clock/LClock.h index 1e4c8294..8156e7d8 100644 --- a/lumina-desktop/panel-plugins/clock/LClock.h +++ b/lumina-desktop/panel-plugins/clock/LClock.h @@ -13,6 +13,7 @@ #include <QWidget> #include <QString> #include <QLocale> +#include <QTimeZone> #include "../LPPlugin.h" @@ -26,7 +27,8 @@ private: QTimer *timer; QLabel *labelWidget; QString timefmt, datefmt; - bool deftime, defdate; + bool deftime, defdate, useTZ; + QTimeZone TZ; private slots: void updateTime(); diff --git a/lumina-fm/MainUI.cpp b/lumina-fm/MainUI.cpp index 56288a80..8ac468a0 100644 --- a/lumina-fm/MainUI.cpp +++ b/lumina-fm/MainUI.cpp @@ -1480,8 +1480,13 @@ void MainUI::ChecksumItems(){ qDebug() << " - Info:" << info; if(info.isEmpty() || (info.length() != files.length()) ){ return; } for(int i=0; i<info.length(); i++){ - info[i] = QString("%2\t(%1)").arg(files[i].section("/",-1), info[i]); + info[i] = QString("%2 \t(%1)").arg(files[i].section("/",-1), info[i]); } + /*QMessageBox dlg(this); + dlg.setWindowFlags( Qt::Dialog ); + dlg.setWindowTitle( tr("File Checksums") ); + dlg.setInformativeText(info.join("\n")); + dlg.exec();*/ QMessageBox::information(this, tr("File Checksums"), info.join("\n") ); } |