battery applet - charge time instead of charge percentage.

Sebastian Kügler sebas at kde.org
Tue Jan 6 03:32:04 CET 2009


Hi Marcos,

On Tuesday 06 January 2009 01:14:03 Marcos Dione wrote:
>     as I mentioned in IRC, I have a patch for this. as sebas and aseigo
> suggested, I'm sending it here.
>
>     now, right now there are 3 bugs: the remaining time, either for
> total discharge when the AC is plugged off and the complete recharge
> time when the AC is plugged back in.
>
>     the first one is that the time jumps a lot depending on the laptop's
> laod. just IRC'ing and lkistening to music makes it change from 3h to
> 2:50. not a big gap, but misleading anyways.

It might not be misleading, the number depends on how much energy your machine 
sucks at that -more or less- moment. It doesn't take into account usage 
patterns, of course. Playing MP3 can make quite a difference, btw. In order to 
provide a decoded audio stream, you need the CPU all the time, so it cannot be 
put to sleep. Even if it doesn't do much, it still can't really sleep, and 
eats battery.

> I haven't tested yet what
> happens when the charge is really low. the second one is that the time
> 'till the battery is fully recharged starts very big, like 6h, then
> settles to more real time, like 10m. both problems lay deeper than this
> applet, they come from powerdevil or even deeper, I just didn't check.

From HAL, actually...

>     the third one is avoidable, really. I coded it so when the battery
> is fully charged it shows 'Charged' instead of 0:00. the problem is that
> right now it doesn't set its width (not again!) so the tect fits. this
> can be 'solved' just removing an simple if until I hack the final code.

Hm, are you sure it makes sense to show the time when it's plugged in? Is that 
actually the "time remaining until fully charged"? I looked at getting this 
information some time ago, but I think I couldn't find it ...

>     so, whithout further addo, here it is. as always, comments are more
> than welcome.

A couple of things that struck me:

- the changes in updateStatus() seem a bit random, and I don't grok all of 
  them, would be good if it was removed.
- Making the label wider than 4 chars starts to randomly stretch it. We need a 
  way to keep that label small and clean. Definitely no localized string 
  though. Remember that the applet as such is supposed to work at small sizes 
  like 22x22 pixels (maybe you can make it display more information only when 
  there's enough space?)
- Cleanup of commented stuff and debugging 

Looks good already, though. Thanks.
-- 
sebas

 http://www.kde.org | http://vizZzion.org |  GPG Key ID: 9119 0EF9 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 489 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20090106/2ea29333/attachment.sig 


More information about the Plasma-devel mailing list