aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/lumina-desktop/panel-plugins/clock
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2016-12-23 11:47:30 -0500
committerKen Moore <ken@ixsystems.com>2016-12-23 11:47:30 -0500
commitc880254cf13ba16697a948e4ac0478ebfd602ac5 (patch)
tree8386ffca6de834f7d5287793a9b4d6d8bb85d2e6 /src-qt5/core/lumina-desktop/panel-plugins/clock
parentMerge branch 'master' of github.com:trueos/lumina (diff)
downloadlumina-c880254cf13ba16697a948e4ac0478ebfd602ac5.tar.gz
lumina-c880254cf13ba16697a948e4ac0478ebfd602ac5.tar.bz2
lumina-c880254cf13ba16697a948e4ac0478ebfd602ac5.zip
Clean up some vertical-panel issues with the clock plugin and the system tray.
Diffstat (limited to 'src-qt5/core/lumina-desktop/panel-plugins/clock')
-rw-r--r--src-qt5/core/lumina-desktop/panel-plugins/clock/LClock.cpp24
-rw-r--r--src-qt5/core/lumina-desktop/panel-plugins/clock/LClock.h4
2 files changed, 22 insertions, 6 deletions
diff --git a/src-qt5/core/lumina-desktop/panel-plugins/clock/LClock.cpp b/src-qt5/core/lumina-desktop/panel-plugins/clock/LClock.cpp
index 1b23607a..b370c536 100644
--- a/src-qt5/core/lumina-desktop/panel-plugins/clock/LClock.cpp
+++ b/src-qt5/core/lumina-desktop/panel-plugins/clock/LClock.cpp
@@ -10,7 +10,7 @@
#include <LuminaXDG.h>
LClock::LClock(QWidget *parent, QString id, bool horizontal) : LPPlugin(parent, id, horizontal){
- button = new QToolButton(this);
+ button = new QToolButton(this); //RotateToolButton(this);
button->setAutoRaise(true);
button->setToolButtonStyle(Qt::ToolButtonTextOnly);
button->setStyleSheet("font-weight: bold;");
@@ -77,7 +77,13 @@ void LClock::updateTime(bool adjustformat){
}
if( this->layout()->direction() == QBoxLayout::TopToBottom ){
//different routine for vertical text (need newlines instead of spaces)
- label.replace(" ","\n");
+ for(int i=0; i<label.count("\n")+1; i++){
+ if(this->size().width() < (this->fontMetrics().width(label.section("\n",i,i))+10 )&& label.section("\n",i,i).contains(" ")){
+ label.replace(label.section("\n",i,i), label.section("\n",i,i).replace(" ", "\n"));
+ i--;
+ }
+ }
+ //label.replace(" ","\n");
}else if( this->size().height() < 2*this->fontMetrics().height() ){
label.replace("\n",", ");
}
@@ -94,7 +100,13 @@ void LClock::updateTime(bool adjustformat){
}else{
button->setStyleSheet("font-weight: bold;");
}*/
- this->setFixedWidth( this->sizeHint().width() +6);
+ if(this->layout()->direction()==QBoxLayout::LeftToRight){
+ //horizontal layout
+ this->setFixedWidth( this->sizeHint().width() +6);
+ }else{
+ //vertical layout
+ this->setMaximumWidth(100000);
+ }
}
button->setText(label);
}
@@ -204,10 +216,12 @@ void LClock::ThemeChange(){
}
void LClock::OrientationChange(){
- if(this->layout()->direction()==QBoxLayout::LeftToRight){
+ if(this->layout()->direction()==QBoxLayout::LeftToRight){ //horizontal panel
+ //button->setRotation(0); //no rotation of text
this->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
button->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
- }else{
+ }else{ //vertical panel
+ //button->setRotation(90); //90 degree rotation
this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
button->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
}
diff --git a/src-qt5/core/lumina-desktop/panel-plugins/clock/LClock.h b/src-qt5/core/lumina-desktop/panel-plugins/clock/LClock.h
index 8131375d..eddf782c 100644
--- a/src-qt5/core/lumina-desktop/panel-plugins/clock/LClock.h
+++ b/src-qt5/core/lumina-desktop/panel-plugins/clock/LClock.h
@@ -22,6 +22,8 @@
#include "../LPPlugin.h"
+//#include "../RotateToolButton.h"
+
class LClock : public LPPlugin{
Q_OBJECT
public:
@@ -30,7 +32,7 @@ public:
private:
QTimer *timer;
- QToolButton *button;
+ QToolButton *button; //RotateToolButton
QString timefmt, datefmt, datetimeorder;
bool deftime, defdate;
QMenu *TZMenu;
bgstack15