aboutsummaryrefslogtreecommitdiff
path: root/lumina-desktop/panel-plugins
diff options
context:
space:
mode:
Diffstat (limited to 'lumina-desktop/panel-plugins')
-rw-r--r--lumina-desktop/panel-plugins/clock/LClock.cpp25
-rw-r--r--lumina-desktop/panel-plugins/clock/LClock.h7
2 files changed, 21 insertions, 11 deletions
diff --git a/lumina-desktop/panel-plugins/clock/LClock.cpp b/lumina-desktop/panel-plugins/clock/LClock.cpp
index e66d83c2..e91a3a71 100644
--- a/lumina-desktop/panel-plugins/clock/LClock.cpp
+++ b/lumina-desktop/panel-plugins/clock/LClock.cpp
@@ -10,10 +10,12 @@
LClock::LClock(QWidget *parent, QString id, bool horizontal) : LPPlugin(parent, id, horizontal){
//Setup the widget
- label = new QLabel(this);
- label->setAlignment(Qt::AlignCenter);
+ labelWidget = new QLabel(this);
+ labelWidget->setAlignment(Qt::AlignCenter);
+ labelWidget->setStyleSheet("font-weight: bold;");
+ labelWidget->setWordWrap(true);
this->layout()->setContentsMargins(3,0,3,0); //reserve some space on left/right
- this->layout()->addWidget(label);
+ this->layout()->addWidget(labelWidget);
//Setup the timer
timer = new QTimer();
@@ -34,10 +36,16 @@ LClock::~LClock(){
void LClock::updateTime(){
QDateTime CT = QDateTime::currentDateTime();
//Now update the display
- if(deftime){ label->setText( "<b>"+CT.time().toString(Qt::SystemLocaleShortDate)+"</b>" ); }
- else{ label->setText( "<b>"+CT.toString(timefmt)+"</b>" ); }
- if(defdate){ label->setToolTip(CT.date().toString(Qt::SystemLocaleLongDate)); }
- else{ label->setToolTip(CT.toString(datefmt)); }
+ 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)); }
+ if( this->layout()->direction() == QBoxLayout::TopToBottom ){
+ //different routine for vertical text (need newlines instead of spaces)
+ label.replace(" ","\n");
+ }
+ labelWidget->setText(label);
}
void LClock::updateFormats(){
@@ -45,4 +53,5 @@ void LClock::updateFormats(){
datefmt = LSession::handle()->sessionSettings()->value("DateFormat","").toString();
deftime = timefmt.simplified().isEmpty();
defdate = datefmt.simplified().isEmpty();
-} \ No newline at end of file
+}
+
diff --git a/lumina-desktop/panel-plugins/clock/LClock.h b/lumina-desktop/panel-plugins/clock/LClock.h
index 8f7e38eb..1e4c8294 100644
--- a/lumina-desktop/panel-plugins/clock/LClock.h
+++ b/lumina-desktop/panel-plugins/clock/LClock.h
@@ -24,14 +24,15 @@ public:
private:
QTimer *timer;
- QLabel *label;
+ QLabel *labelWidget;
QString timefmt, datefmt;
bool deftime, defdate;
-
+
private slots:
void updateTime();
void updateFormats();
-
+
+
};
#endif
bgstack15