diff options
author | Ken Moore <ken@ixsystems.com> | 2016-12-23 11:47:30 -0500 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2016-12-23 11:47:30 -0500 |
commit | c880254cf13ba16697a948e4ac0478ebfd602ac5 (patch) | |
tree | 8386ffca6de834f7d5287793a9b4d6d8bb85d2e6 /src-qt5/core/lumina-desktop | |
parent | Merge branch 'master' of github.com:trueos/lumina (diff) | |
download | lumina-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')
6 files changed, 32 insertions, 10 deletions
diff --git a/src-qt5/core/lumina-desktop/LPanel.cpp b/src-qt5/core/lumina-desktop/LPanel.cpp index 2330d6b5..5df1fcb6 100644 --- a/src-qt5/core/lumina-desktop/LPanel.cpp +++ b/src-qt5/core/lumina-desktop/LPanel.cpp @@ -367,6 +367,7 @@ void LPanel::paintEvent(QPaintEvent *event){ //qDebug() << " - Adjusted Window Rec:" << rec; painter->drawPixmap(event->rect().adjusted(-1,-1,2,2), bgWindow->grab(rec)); //painter->drawPixmap(event->rect().adjusted(-1,-1,2,2), QApplication::screens().at(Screen())->grabWindow(QX11Info::appRootWindow(), rec.x(), rec.y(), rec.width(), rec.height()) ); + delete(painter); } QWidget::paintEvent(event); //now pass the event along to the normal painting event } 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; diff --git a/src-qt5/core/lumina-desktop/panel-plugins/panel-plugins.pri b/src-qt5/core/lumina-desktop/panel-plugins/panel-plugins.pri index 9db23968..c40c4725 100644 --- a/src-qt5/core/lumina-desktop/panel-plugins/panel-plugins.pri +++ b/src-qt5/core/lumina-desktop/panel-plugins/panel-plugins.pri @@ -23,7 +23,8 @@ SOURCES += $$PWD/userbutton/LUserButton.cpp \ $$PWD/audioplayer/PPlayerWidget.cpp \ $$PWD/jsonmenu/PPJsonMenu.cpp -HEADERS += $$PWD/userbutton/LUserButton.h \ +HEADERS += $$PWD/RotateToolButton.h \ + $$PWD/userbutton/LUserButton.h \ $$PWD/userbutton/UserWidget.h \ $$PWD/userbutton/UserItemWidget.h \ $$PWD/desktopbar/LDeskBar.h \ diff --git a/src-qt5/core/lumina-desktop/panel-plugins/systemtray/LSysTray.cpp b/src-qt5/core/lumina-desktop/panel-plugins/systemtray/LSysTray.cpp index b6af4451..a71fd57e 100644 --- a/src-qt5/core/lumina-desktop/panel-plugins/systemtray/LSysTray.cpp +++ b/src-qt5/core/lumina-desktop/panel-plugins/systemtray/LSysTray.cpp @@ -117,10 +117,14 @@ void LSysTray::checkAll(){ LI->addWidget(cont); //qDebug() << " - Update tray layout"; if(this->layout()->direction()==QBoxLayout::LeftToRight){ - cont->setSizeSquare(this->height()-2-2*frame->frameWidth()); //horizontal tray + int sz = this->height()-2-2*frame->frameWidth(); + if(sz>64){ sz = 64; } + cont->setSizeSquare(sz); //horizontal tray this->setMaximumSize( trayIcons.length()*this->height(), 10000); }else{ - cont->setSizeSquare(this->width()-2-2*frame->frameWidth()); //vertical tray + int sz = this->width()-2-2*frame->frameWidth(); + if(sz>64){ sz = 64; } + cont->setSizeSquare(sz); //vertical tray this->setMaximumSize(10000, trayIcons.length()*this->width()); } //LSession::processEvents(); @@ -161,4 +165,3 @@ void LSysTray::UpdateTrayWindow(WId win){ QTimer::singleShot(0,this, SLOT(checkAll()) ); } - diff --git a/src-qt5/core/lumina-desktop/panel-plugins/systemtray/LSysTray.h b/src-qt5/core/lumina-desktop/panel-plugins/systemtray/LSysTray.h index 84cde5c9..7db307c6 100644 --- a/src-qt5/core/lumina-desktop/panel-plugins/systemtray/LSysTray.h +++ b/src-qt5/core/lumina-desktop/panel-plugins/systemtray/LSysTray.h @@ -62,6 +62,7 @@ public slots: this->setMaximumSize(10000, trayIcons.length()*this->width()); sz = this->width()-2*frame->frameWidth(); } + if(sz>64){ sz = 64; } //many tray icons can't go larger than this anyway for(int i=0; i<trayIcons.length(); i++){ trayIcons[i]->setSizeSquare(sz); trayIcons[i]->repaint(); |