aboutsummaryrefslogtreecommitdiff
path: root/lumina-desktop/panel-plugins/clock/LClock.cpp
diff options
context:
space:
mode:
authorKen Moore <moorekou@gmail.com>2015-10-19 15:41:25 -0400
committerKen Moore <moorekou@gmail.com>2015-10-19 15:41:25 -0400
commit5604e237f29eb2cefbfbdcaaaefbce3b9576ab6c (patch)
tree89949cff9b1464a6a9e5a1d1187c6a5b51b91ea3 /lumina-desktop/panel-plugins/clock/LClock.cpp
parentFix a luminaDesktop.conf loading bug with regards to panel sizing. (diff)
downloadlumina-5604e237f29eb2cefbfbdcaaaefbce3b9576ab6c.tar.gz
lumina-5604e237f29eb2cefbfbdcaaaefbce3b9576ab6c.tar.bz2
lumina-5604e237f29eb2cefbfbdcaaaefbce3b9576ab6c.zip
Update how the PC-BSD overlay files for Lumina are installed. Now there is a special "PCBSD" qmake argument to tell Lumina to install the PC-BSD specific config/wallpaper files instead of the generic files.
Diffstat (limited to 'lumina-desktop/panel-plugins/clock/LClock.cpp')
-rw-r--r--lumina-desktop/panel-plugins/clock/LClock.cpp29
1 files changed, 10 insertions, 19 deletions
diff --git a/lumina-desktop/panel-plugins/clock/LClock.cpp b/lumina-desktop/panel-plugins/clock/LClock.cpp
index 7af36e5a..4035cd13 100644
--- a/lumina-desktop/panel-plugins/clock/LClock.cpp
+++ b/lumina-desktop/panel-plugins/clock/LClock.cpp
@@ -1,6 +1,6 @@
//===========================================
// Lumina-DE source code
-// Copyright (c) 2012, Ken Moore
+// Copyright (c) 2012-2015, Ken Moore
// Available under the 3-clause BSD license
// See the LICENSE file for full details
//===========================================
@@ -62,19 +62,15 @@ void LClock::updateTime(bool adjustformat){
else{ datelabel = CT.toString(datefmt); }
if(datetimeorder == "dateonly"){
label = datelabel;
- //labelWidget->setToolTip(timelabel);
button->setToolTip(timelabel);
}else if(datetimeorder == "timedate"){
label = timelabel + "\n" + datelabel;
- //labelWidget->setToolTip("");
button->setToolTip("");
}else if(datetimeorder == "datetime"){
label = datelabel + "\n" + timelabel;
- //labelWidget->setToolTip("");
button->setToolTip("");
}else{
label = timelabel;
- //labelWidget->setToolTip(datelabel);
button->setToolTip(datelabel);
}
if( this->layout()->direction() == QBoxLayout::TopToBottom ){
@@ -82,22 +78,15 @@ void LClock::updateTime(bool adjustformat){
label.replace(" ","\n");
}
if(adjustformat){
- /* //Check the font/spacing for the display and adjust as necessary
- int wid = button->width(); //since text always is painted horizontal - no matter the widget orientation
- //get the number of effective lines (with word wrap)
- int lines = label.count("\n")+1;
- int efflines = lines; //effective lines (with wordwrap)
- for(int i=0; i<lines; i++){
- if(button->fontMetrics().width(label.section("\n",i,i)) > wid){ efflines++; } //this line will wrap around
- }
+ //Check the font/spacing for the display and adjust as necessary
+ /*double efflines = label.count("\n")+1; //effective lines (with wordwrap)
if( (button->fontMetrics().height()*efflines) > button->height() ){
//Force a pixel metric font size to fit everything
- int szH = (button->height() - button->fontMetrics().lineSpacing() )/efflines;
+ int szH = qRound( (button->height() - button->fontMetrics().lineSpacing() )/efflines );
//Need to supply a *width* pixel, not a height metric
- int szW = (szH*button->fontMetrics().maxWidth())/button->fontMetrics().height();
- qDebug() << "Change Clock font:" << button->height() << szH << szW << efflines << lines << button->fontMetrics().height() << button->fontMetrics().lineSpacing();
+ int szW = qRound( (szH*button->fontMetrics().maxWidth())/( (double) button->fontMetrics().height()) );
+ qDebug() << "Change Clock font:" << button->height() << szH << szW << efflines << button->fontMetrics().height() << button->fontMetrics().lineSpacing();
button->setStyleSheet("font-weight: bold; font-size: "+QString::number(szW)+"px;");
-
}else{
button->setStyleSheet("font-weight: bold;");
}*/
@@ -251,9 +240,11 @@ void LClock::ThemeChange(){
void LClock::OrientationChange(){
if(this->layout()->direction()==QBoxLayout::LeftToRight){
- this->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding);
+ this->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
+ button->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
}else{
- this->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
+ this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
+ button->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
}
updateTime(true); //re-adjust the font/spacings
this->layout()->update();
bgstack15