diff options
author | Christopher Roy Bratusek <nano@jpberlin.de> | 2015-04-19 10:15:19 +0200 |
---|---|---|
committer | Christopher Roy Bratusek <nano@jpberlin.de> | 2015-04-19 10:15:19 +0200 |
commit | d7ff36cb030fb6798d352998d645ab85c5d0fc62 (patch) | |
tree | d6063a41d6e3b9547a08f55bba90f9cafa03e458 /lumina-desktop | |
parent | Merge pull request #87 from william-os4y/search (diff) | |
download | lumina-d7ff36cb030fb6798d352998d645ab85c5d0fc62.tar.gz lumina-d7ff36cb030fb6798d352998d645ab85c5d0fc62.tar.bz2 lumina-d7ff36cb030fb6798d352998d645ab85c5d0fc62.zip |
4 time display modes for panel clock:
timeonly (default): display time, date as tooltip
dateonly : display date, time as tooltip
datetime : display date first then time
timedate : display time first then date
LSession option: DateTimeOrder (no UI yet)
Diffstat (limited to 'lumina-desktop')
-rw-r--r-- | lumina-desktop/panel-plugins/clock/LClock.cpp | 21 | ||||
-rw-r--r-- | lumina-desktop/panel-plugins/clock/LClock.h | 2 |
2 files changed, 18 insertions, 5 deletions
diff --git a/lumina-desktop/panel-plugins/clock/LClock.cpp b/lumina-desktop/panel-plugins/clock/LClock.cpp index 79cae84b..c3eb1451 100644 --- a/lumina-desktop/panel-plugins/clock/LClock.cpp +++ b/lumina-desktop/panel-plugins/clock/LClock.cpp @@ -38,10 +38,22 @@ void LClock::updateTime(){ if(useTZ){ CT = CT.toTimeZone(TZ); } //Now update the display QString label; - if(deftime){ label = CT.time().toString(Qt::SystemLocaleShortDate) ; } - else{ label=CT.toString(timefmt); } - if(defdate){ labelWidget->setToolTip(CT.date().toString(Qt::SystemLocaleLongDate)); } - else{ labelWidget->setToolTip(CT.toString(datefmt)); } + QString timelabel; + QString datelabel; + if(deftime){ timelabel = CT.time().toString(Qt::SystemLocaleShortDate) ; } + else{ timelabel=CT.toString(timefmt); } + if(defdate){ datelabel = CT.date().toString(Qt::SystemLocaleLongDate); } + else{ datelabel = CT.toString(datefmt); } + if(datetimeorder == "dateonly"){ + label = datelabel; + labelWidget->setToolTip(timelabel); + }else if(datetimeorder == "timedate"){ + label = timelabel + " " + datelabel; + }else if(datetimeorder == "datetime"){ + label = datelabel + " " + timelabel; + }else{ label = timelabel; + labelWidget->setToolTip(datelabel); + } if( this->layout()->direction() == QBoxLayout::TopToBottom ){ //different routine for vertical text (need newlines instead of spaces) label.replace(" ","\n"); @@ -54,6 +66,7 @@ void LClock::updateFormats(){ datefmt = LSession::handle()->sessionSettings()->value("DateFormat","").toString(); deftime = timefmt.simplified().isEmpty(); defdate = datefmt.simplified().isEmpty(); + datetimeorder = LSession::handle()->sessionSettings()->value("DateTimeOrder", "timeonly").toString(); 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 8156e7d8..31bf13d6 100644 --- a/lumina-desktop/panel-plugins/clock/LClock.h +++ b/lumina-desktop/panel-plugins/clock/LClock.h @@ -26,7 +26,7 @@ public: private: QTimer *timer; QLabel *labelWidget; - QString timefmt, datefmt; + QString timefmt, datefmt, datetimeorder; bool deftime, defdate, useTZ; QTimeZone TZ; |