> On March 15, 2016, 5:48 p.m., Martin Klapetek wrote: > > applets/digital-clock/package/contents/ui/DigitalClock.qml, lines 565-568 > > <https://git.reviewboard.kde.org/r/127102/diff/3/?file=448492#file448492line565> > > > > Can't we just compare "A" and "P" width's and use that? Would spare > > creating two Date objects and two calls to Qt.formatTime > > Daniel Faust wrote: > No, because eg. in german the strings for am and pm are "vorm." and > "nachm.". > > Martin Klapetek wrote: > Ah, good. Haven't thought of that. Those germans... > > (on the other hand, I wouldn't expect anyone in Germany to actually not > use 24h clock format, but oh well) > > One other thing - create just a single Date object and then call > setHours(13) on it for the second format. > > Daniel Faust wrote: > As you wish. But keep in mind that this is not a performance bottleneck. > I added some debug outputs to see where setupLabels is called from and it > gets called 10 times when initializing the applet, including 3 times in the > onCompleted method. > Even if it is a little bit off topic, here is the log (indentation was > done manually and is somewhat guessed): > > ``` > onShowDateChanged > timeFormatCorrection > onShowSecondsChanged > timeFormatCorrection > setupLabels > 00:00:00 NACHM. > setupLabels > 00:00:00 NACHM. > > onDateFormatChanged > setupLabels > 00:00:00 NACHM. > > onLastSelectedTimezoneChanged > timeFormatCorrection > setupLabels > 00:00:00 NACHM. > > onDisplayTimezoneAsCodeChanged > setupLabels > 00:00:00 NACHM. > > onUse24hFormatChanged > timeFormatCorrection > setupLabels > 00:00:00 > > onStateChanged > setupLabels > 00:00:00 > > onCompleted > onSelectedTimeZonesChanged > setupLabels > 00:00:00 > dateTimeChanged > timeFormatCorrection > setupLabels > 00:00:00 > timeFormatCorrection > setupLabels > 00:00:00 > ```
> But keep in mind that this is not a performance bottleneck I didn't claim it is. But there's no reason to not write new code in an efficient way ;) About the call numbers, yes, I'm aware of that. I wanted to go over the whole applet and fix it, but then I was assigned a different project and time was lacking. Patches welcome for that too, of course :) - Martin ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://git.reviewboard.kde.org/r/127102/#review93561 ----------------------------------------------------------- On March 16, 2016, 4:35 p.m., Daniel Faust wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://git.reviewboard.kde.org/r/127102/ > ----------------------------------------------------------- > > (Updated March 16, 2016, 4:35 p.m.) > > > Review request for kde-workspace and Plasma. > > > Bugs: 347724 > https://bugs.kde.org/show_bug.cgi?id=347724 > > > Repository: plasma-workspace > > > Description > ------- > > Currently the width of the date label is not fixed but changes depending on > the text. This causes the entire applet to change its width (if the time is > the widest displayed item). This in turn can cause all other applets in the > same panel to move whenever the displayed time changes. > > This patch uses FontMetrics to iterate over all possible time strings (with > different width) and chooses the widest of them as reference for the fixed > width of the time label. > > This way the width of the applet stays the same (unless the date is displayed > and changes). The text remains centered though, which means that it can still > move within the applet when the time changes. > > > Diffs > ----- > > applets/digital-clock/package/contents/ui/DigitalClock.qml 95bb071 > > Diff: https://git.reviewboard.kde.org/r/127102/diff/ > > > Testing > ------- > > Works with horizontal and vertical panel. > Also displaying different combinations of "seconds", "date" and "timezone" > works. > > > File Attachments > ---------------- > > 0001-Use-fixed-width-for-digital-clock-applet.patch > > https://git.reviewboard.kde.org/media/uploaded/files/2016/03/16/81b4a902-1454-4155-9fda-552b8acba1a8__0001-Use-fixed-width-for-digital-clock-applet.patch > > > Thanks, > > Daniel Faust > >
_______________________________________________ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel