aboutsummaryrefslogtreecommitdiff
path: root/lumina-desktop/panel-plugins
diff options
context:
space:
mode:
authorKen Moore <moorekou@gmail.com>2016-02-18 08:04:39 -0500
committerKen Moore <moorekou@gmail.com>2016-02-18 08:04:39 -0500
commitb41c03fe782d3cfbab12a9f63e7053fa750f8ec1 (patch)
tree1caa7f47370e5f77d914edf72d93f36111678148 /lumina-desktop/panel-plugins
parentMerge branch 'master' of github.com:pcbsd/lumina (diff)
downloadlumina-b41c03fe782d3cfbab12a9f63e7053fa750f8ec1.tar.gz
lumina-b41c03fe782d3cfbab12a9f63e7053fa750f8ec1.tar.bz2
lumina-b41c03fe782d3cfbab12a9f63e7053fa750f8ec1.zip
For the clock plugin, add a smarter minimum width based on the time format chosen. This should prevent the clock from changing sizes regularly if the font is not mono-spaced or non-padded seconds/minutes is desired.
Diffstat (limited to 'lumina-desktop/panel-plugins')
-rw-r--r--lumina-desktop/panel-plugins/clock/LClock.cpp43
1 files changed, 1 insertions, 42 deletions
diff --git a/lumina-desktop/panel-plugins/clock/LClock.cpp b/lumina-desktop/panel-plugins/clock/LClock.cpp
index 4035cd13..9f392831 100644
--- a/lumina-desktop/panel-plugins/clock/LClock.cpp
+++ b/lumina-desktop/panel-plugins/clock/LClock.cpp
@@ -101,6 +101,7 @@ void LClock::updateFormats(){
datefmt = LSession::handle()->sessionSettings()->value("DateFormat","").toString();
deftime = timefmt.simplified().isEmpty();
defdate = datefmt.simplified().isEmpty();
+ this->setMinimumSize(button->fontMetrics().width(timefmt+"MMM")+10, 5);
//Adjust the timer interval based on the smallest unit displayed
if(deftime){ timer->setInterval(500); } //1/2 second
else if(timefmt.contains("z")){ timer->setInterval(1); } //every millisecond (smallest unit)
@@ -190,48 +191,6 @@ void LClock::LocaleChange(){
}
}
- //qDebug() << "Found Time Zones:" << TZList.length();
- /*QDateTime cur = QDateTime::currentDateTime();
-
- QMenu *tmpCM = 0;
- QString ccat; //current category
- QStringList catAbb;
- for(int i=0; i<TZList.length(); i++){
- QTimeZone tmp(TZList[i]);
- QString abbr = tmp.abbreviation(cur);
- if(abbr.startsWith("UTC")){ continue; } //skip all the manual options at the end of the list
- if(QString(tmp.id()).section("/",0,0)!=ccat){
- //New category - save the old one and start a new one
- if(!catAbb.isEmpty()){
- catAbb.sort();
- QMenu *tmpM = new QMenu(this);
- tmpM->setTitle(ccat);
- for(int j=0; j<catAbb.length(); j++){
- QAction *act = new QAction(catAbb[j].section("::::",3,3)+" ("+catAbb[j].section("::::",1,1)+")",this);
- act->setWhatsThis(catAbb[j].section("::::",2,2));
- tmpM->addAction(act);
- }
- TZMenu->addMenu(tmpM);
- }
- ccat = QString(tmp.id()).section("/",0,0);
- catAbb.clear();
- }
- if(!catAbb.filter("::::"+abbr+"::::").isEmpty()){ continue; } //duplicate timezone/abbreviation for this cat
- catAbb << "::::"+abbr+"::::"+tmp.id()+"::::"+tmp.displayName(QTimeZone::GenericTime, QTimeZone::LongName); //add new abbreviation to the list
- }
- //Now add the last category to the menu
- if(tmpCM!=0 && !catAbb.isEmpty()){
- catAbb.sort();
- QMenu *tmpM = new QMenu(this);
- tmpM->setTitle(ccat);
- for(int j=0; j<catAbb.length(); j++){
- QAction *act = new QAction(catAbb[j].section("::::",3,3)+" ("+catAbb[j].section("::::",1,1)+")",this);
- act->setWhatsThis(catAbb[j].section("::::",2,2));
- tmpM->addAction(act);
- }
- TZMenu->addMenu(tmpM);
- }*/
-
}
void LClock::ThemeChange(){
bgstack15