YearProgress

Plasma 5 Calendars plasma plasmoid

Source (required if based on other people's work):

0
Score 54%
Description:

A simple progress bar, in pure QML, indicating the time elapsed since the beginning of the year, as a percentage (inspired by https://twitter.com/ProgressBar201X)
Last changelog:

Less CPU intensive 1 month ago

Date check done only when the day actually changes

avlas

2 months ago

It doesn't seem to update the percentage automatically, does it? I mean, if plasma is running for days, one needs to restart plasma manually to get the % updated...

Report

C

Refused

2 months ago

Yes it does: the day is checked one every hour.

You can try it by yourself (don't forget to revert the canges, rebuild and reinstall):

- edit src/yearprogressplasmoid.cpp replacing 60000 with 2000 at row 47, so it will be updated every two seconds,

- make && sudo make install && plasmoidviewer -a org.kde.yearprogressplasmoid.

- change the system date by some weeks ahead and you will see the percentage changing.

Report

avlas

2 months ago

Sounds great! It was few days since I used my laptop last time, and realized of this. Now I understand that less than an hour passed and that explains it wasn't updated (yet).

Report

Zren

1 month ago

Every 2 seconds seems excessive. The "time" dataengine, which the Digital Clock, Fuzzy Clock, etc uses, has a property to show the current time. It also has the ability to AlignToHour, which means it only updates when the hour changes.

You ought to look into the fuzzyclock widget for a simple example.
https://github.com/KDE/kdeplasma-addons/blob/master/applets/fuzzy-clock/package/contents/ui/main.qml

Here's where AlignToSecond, AlignToMinute, and AlignToHour is defined if you're interested in that enum.
https://github.com/KDE/plasma-framework/blob/38431eebfa1286c11d5bb716f7d65c1a660b535d/src/plasma/plasma.h#L207

You could bind to:
onCurrentDateTimeChanged: {
updateYearProgressSlider()
}

Report

C

Refused

1 month ago

Thanks for your feedback!
2 seconds were suggested just for testing. It is actually one hour.
I've already tried the time dataengine but I could not find the currentDateTimeChanged signal: I believe that just newData is available and I should do the "date check" manually.
I could anyway use the current timer and correct just the first cycle.

Hints are welcome!

Report

Zren

1 month ago

Notice how fuzzyclock has a property named currentDateTime? Every property you define has a on_____Changed signal you can bind to. Since currentDateTime has a binding to dataSource.data.Local.DateTime, every time the dataengine updates, it will update currentDateTime too.

Here's an example you can use to test the differences between AlignToHour, AlignToMinute and AlignToSecond.
https://gist.github.com/Zren/01d81eb74037fd038358b0fa426243c4

Report

C

Refused

1 month ago

Oh well, it was quite easy :D Thanks for your support!

Report

avlas

2 months ago

+ Nice minimalistic year progress bar!

Report

C

Refused

2 months ago

Thank you!

Report

avlas

2 months ago

Thanks! Very nice and minimalistic plasmoid :)

May I suggest a tiny improvement? Please add +0.5 to properly round l_result -> in yearprogressplasmoid.cpp (line 69) -> l_result = ((qreal)l_days_elapsed/(qreal)l_days_total) * 100 + 0.5;

Report

C

Refused

2 months ago

Thanks for your feedback. Actually, the value was just truncated to integer, now it shows the first digit as well (so, no need to add 0.5)

Report

Less CPU intensive 1 month ago

Date check done only when the day actually changes

product-maker avlas Aug 10 2018

+ Nice minimalistic year progress bar!
File (click to download) Version Description Packagetype Architecture Downloads Date Filesize DL OCS-Install
Pling
Details
license
GPLv2 or later
version
1.0.4
updated Sep 13 2018
added Aug 08 2018
downloads today
0
page views today 5