Bug 200961 - Battery plasmoid isn't fully implemented
Summary: Battery plasmoid isn't fully implemented
Status: RESOLVED INTENTIONAL
Alias: None
Product: plasma4
Classification: Plasma
Component: widget-battery (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
: 205707 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-07-21 08:49 UTC by Mike Bridge
Modified: 2010-06-01 09:40 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
patch against trunk #1065250 (11.08 KB, patch)
2009-12-30 15:19 UTC, Manuel Mommertz
Details
modified svg using the new features (6.46 KB, image/svg+xml-compressed)
2009-12-30 15:20 UTC, Manuel Mommertz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Bridge 2009-07-21 08:49:58 UTC
Version:            (using KDE 4.2.96)
OS:                Linux
Installed from:    Ubuntu Packages

The battery plasmoid in KDE 4.3 currently has six "fill states". The readme shows 11 fill states. I recommend changing the code to use all available states, which with the expected layout should provide finer grained (10%) versus the current (30%) information. The fill_element QString should be changed to match the below. (I'm still pretty new mucking around in code and have neither SVN access or a dev system available, sorry.)

if (batteryPercent > 95) {
	fill_element = "Fill010";
} elseif (batteryPercent > 90) {
	fill_element = "Fill90";
} elseif (batteryPercent > 80) {
	fill_element = "Fill80";
} elseif (batteryPercent > 70) {
	fill_element = "Fill70";
} elseif (batteryPercent > 60) {
	fill_element = "Fill60";
} elseif (batteryPercent > 50) {
	fill_element = "Fill50";
} elseif (batteryPercent > 40) {
	fill_element = "Fill40";
} elseif (batteryPercent > 30) {
	fill_element = "Fill30";
} elseif (batteryPercent > 20) {
	fill_element = "Fill20";
} elseif (batteryPercent > 10) {
	fill_element = "Fill10";
}

As an aside, I tried to check the SVGZ to ensure all 11 states listed were implemented but I couldn't figure it out. If someone wants to shoot me an email and tell me what i'm doing wrong, i'd appreciate it.
Comment 1 Manuel Mommertz 2009-07-21 09:39:37 UTC
Since they changed from the 'old' battery icon to the new oxygen, they use only 6 states. in 4.1 (or so) it was possible to select wether you want to use the old oder the new style. But now, there is only the new one.
But I vote for changing the code to use whatever states are available. So a the person who creates a battery-svg can say how many states he wants.
Comment 2 Beat Wolf 2009-08-31 10:14:35 UTC
*** Bug 205707 has been marked as a duplicate of this bug. ***
Comment 3 Sebastian Kügler 2009-10-05 14:51:41 UTC
The readme is wrong then. :-)
Comment 4 Stefan Endrullis 2009-10-05 16:23:15 UTC
"The readme is wrong"? That's all?

Have you also read the second post?
I think this issue is not only about the exact implementation of the plasmoid description in the readme. It addresses the more general problem that this plasmoid is currently only capable of displaying 5 different charging states. That's a bit sparsely, IMO. And for a lot of people it's one of the major reasons not to upgrade to KDE4.

Just compare it to KLaptop which was capable of displaying 81 charging states. When I compare it to the the 4 times larger KDE4 version I can't describe my dismay.
http://www.blogcdn.com/nintendo.joystiq.com/media/2008/09/double_facepalm_lg.jpg
Comment 5 Sebastian Kügler 2009-10-05 17:04:05 UTC
The number of charge states doesn't equal quality of the plasmoid. The bars are just a rough indicator for the charge rate, meant to get a quick impression. Remember that the default size of the battery applet is currently 22px. If you want the exact percentage visible all the time, that's already possible wit the current applet. Hover over the applet, and you'll know exactly what HAL reports. In this light, I'd argue that the battery applet can show 100 * 2 charge states.

If you post artwork (instead of funny pictures) which makes it clear that having more charge states is beneficial (not only to a very small group of users, but to a majority), we can think of improving the applet like that. Right now, that's not the case. Sorry for not making this clear in my previous post.

What are your exact use cases that make it critical to have very fine-grained display in the artwork (not only in the hover thing)?
Comment 6 Mike Bridge 2009-10-05 17:18:09 UTC
Sebas-

I am also slightly offended by your off-hand manner. I've come here trying to help. The only reason why I tried filing a bug instead of just attempting to wrench on it myself is because I apparently can't figure out inkscape.

Re Bug 197055, the battery plasmoid is always 128px, no matter what I do. This makes it an ugly waste of space that I have to hover on pretty much all the time because it has ABSOLUTELY NO useful information displayed on it.

Bottom line, 10% accuracy isn't too much to ask. Feel free to fix it, or show me how to screw with the SVGZ like I originally asked. I will then fix it myself.
Comment 7 Stefan Endrullis 2009-10-06 14:43:56 UTC
Hm, you're talking about svgs? Is it possible to make the battery plasmoid showing a continuous progress instead of a small number of different states by just assigning a new style (svg) file to it? That would be great. I worked already a bit with inkscape and I think it's not that difficulty. I can try to create such an svg, but I have no idea how to adapt the plasmoid afterwards. Are there any examples on the web or a documentation on how to create a new battery theme?

BTW, 22px as the default size of the plasmoid sound OK. Unfortunately, the KDE4 panel does not care about those values. It always scales up the plasmoids to the boundaries of the panel. That's how it look like in a 2-rows panel:
http://stefan.endrullis.de/kde/waste_of_space/kde4_kicker.png
And that's how it looked like in KDE3 with KLaptop:
http://stefan.endrullis.de/kde/waste_of_space/kde3_kicker.png

The are 2 reasons why I'm interested in more details about the charging state:
- the current battery theme doesn't even allow you to distinguish between 38% and 62%, since both values are represented by 2 green bars
- forcing users to take their hands from the keyboard and to use the touch pad to hover over the battery icon just to see a more detailed charging state of the battery is, is not very pleasant (since this is wasted time if it could be much easier)
Comment 8 Sebastian Kügler 2009-10-06 14:54:14 UTC
@Thomas: I'm sorry I offended you, it wasn't meant that way.

Re: Bug 197055, this is a different bug. Let's keep those separate as to not lose information. (I've looked into it but need to do some more testing in order to get it right.)

@Stefan: Just dropping in a new version of the SVG won't work, but if you're able and willing to wrestle with inkscape to improve the current theme (or create a new, better one), I'm more than happy to implement the code changes needed (it's pretty trivial). Just contact me in private (sebas-kde-org) then.

In KDE 4.4, the battery will always be 22px since we moved it into the system tray. (Of course you can put another one in the panel, or on the desktop, but the common case will be 22px.)

There's an option to always show the charge percentage, btw, for those that want the info shown continuously and not use mouse/touchpad to hover the battery.
Comment 9 Stefan Endrullis 2009-10-06 22:38:57 UTC
> @Stefan: Just dropping in a new version of the SVG won't work, but if you're
> able and willing to wrestle with inkscape to improve the current theme (or
> create a new, better one), I'm more than happy to implement the code changes
> needed (it's pretty trivial). Just contact me in private (sebas-kde-org) then.

OK, thanks for this offer. I'll try to create a theme when I have more spare time.

> In KDE 4.4, the battery will always be 22px since we moved it into the system
> tray. (Of course you can put another one in the panel, or on the desktop, but
> the common case will be 22px.)

Oh, that sounds good.

> There's an option to always show the charge percentage, btw, for those that
> want the info shown continuously and not use mouse/touchpad to hover the
> battery.

Very good. Thanks.
Comment 10 Sebastian Kügler 2009-10-06 22:54:31 UTC
Hi,

On Tuesday 06 October 2009 22:39:29 Stefan Endrullis wrote:
> https://bugs.kde.org/show_bug.cgi?id=200961
> 
> --- Comment #9 from Stefan Endrullis <stefan endrullis de>  2009-10-06
>  22:38:57 ---
> 
> > @Stefan: Just dropping in a new version of the SVG won't work, but if
> > you're able and willing to wrestle with inkscape to improve the current
> > theme (or create a new, better one), I'm more than happy to implement the
> > code changes needed (it's pretty trivial). Just contact me in private
> > (sebas-kde-org) then.
> 
> OK, thanks for this offer. I'll try to create a theme when I have more
>  spare time.

Make sure you drop by on the #oxygen IRC channel to ask for direction. Pinheiro is 
there most of the time and he can help you visually fitting the SVG into the rest of 
the desktop.

From a more technical point of view, if you look at the XML tree of the SVG (there's 
an option in inkscape to show it), you'll notice that the elements in the SVG are all 
in 'full size' containers. I've done this to make it possible to just paint the whole 
layer onto the plasmoids rect and don't have to deal with positioning inside the 
applet. It's all in the SVG and gives the artist full control.

Thanks for taking it up!

> > In KDE 4.4, the battery will always be 22px since we moved it into the
> > system tray. (Of course you can put another one in the panel, or on the
> > desktop, but the common case will be 22px.)
> 
> Oh, that sounds good.
> 
> > There's an option to always show the charge percentage, btw, for those
> > that want the info shown continuously and not use mouse/touchpad to hover
> > the battery.
> 
> Very good. Thanks.

Cheers, and let me know how it goes.
Comment 11 Manuel Mommertz 2009-12-30 15:17:07 UTC
After some work, here is a patch that allows to interpolate between fill states. Also it allows to move the Battery to one site if powersupply is plugged in. (Current SVG's should be painted as before)
Comment 12 Manuel Mommertz 2009-12-30 15:19:14 UTC
Created attachment 39457 [details]
patch against trunk #1065250
Comment 13 Manuel Mommertz 2009-12-30 15:20:58 UTC
Created attachment 39458 [details]
modified svg using the new features
Comment 14 Stefan Endrullis 2010-01-05 17:43:13 UTC
The svg looks good.  That's exactly what I wanted to have - a continuous battery state.  Thanks Manuel Mommertz.
Comment 15 Beat Wolf 2010-05-18 10:45:47 UTC
What is going on with this patch? please submitt it to the plasma mailing list or reviewboard.kde.org to get it into trunk. thank you. (in bugzilla patches tend to get lost)
Comment 16 Aaron J. Seigo 2010-05-31 20:14:25 UTC
from the visual designer:

"I am of the opinion that trying to give precise values on the battery status 
is more misleading that rough ones.

+ think the current design works better visually with all the other systemtry 
items, sound is incremental, same as wireless"

my concern is that we make this plasmoid even more complex, this code will end up in there and not really be maintained in the long term (a "drive by patching", which tends to be the norm for these kinds of things :).

the design goals of the current battery seem pretty clear to me ... so here's what i would suggest: provide a new / alternate battery plasmoid. all the data comes from the data engine, so the plasmoid really just provides the visualization. (it may even be possible to write the whole thing in javascript in 4.4/4.5, given what this plasmoid does...). but i'm not particularly comfortable with trying to accomodate such different ideas on the visualization by making the code more complex.

i'd recommend that the patch author (and THANK YOU, btw, for your work and efforts on that!) create a "smooth battery" plasmoid based on this work and upload it to kde-apps.org for others to use. i'd even be open to hosting it in kde's wn svn in extragear if that would be helpful and the patch author is interested in doing long term maintenance of the alternate battery plasmoid.
Comment 17 Manuel Mommertz 2010-06-01 09:40:24 UTC
Providing a seperate plasmoid would be no problem (indeed I have uploaded a patched version to kde-look.org already). The main problem is that I have to keep the popup in sync with the original plasmoid. Would it be possible to somehow share this dialog?