[haiku-commits] Re: r39732 - haiku/trunk/src/apps/powerstatus

  • From: "Stephan Assmus" <superstippi@xxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 05 Dec 2010 12:06:35 +0100

Hi,

> Author: czeidler
> Modified: haiku/trunk/src/apps/powerstatus/PowerStatusView.cpp

[...]

> +     fHasBattery = (fBatteryInfo.state & BATTERY_CRITICAL_STATE) == 0;
> +
> +     if (fBatteryInfo.full_capacity > 0 && fHasBattery) {
>               fPercent = (100 * fBatteryInfo.capacity) / 
> fBatteryInfo.full_capacity;
> -
> -     fTimeLeft = fBatteryInfo.time_left;
> -     if ((fBatteryInfo.state & BATTERY_CHARGING) != 0)
> -             fOnline = true;
> -     else
> +             fOnline = (fBatteryInfo.state & BATTERY_CHARGING) != 0;
> +             fTimeLeft = fBatteryInfo.time_left;
> +     } else {
> +             fPercent = 0;
>               fOnline = false;
> +             fTimeLeft = false;
> +     }
>  
> -     // TODO: if critical really means that, its name should be changed...
> -     fHasBattery = (fBatteryInfo.state & BATTERY_CRITICAL_STATE) == 0
> -             && fPercent >= 0;

You removed a valid TODO when you moved this code. BATTERY_CRITICAL_STATE is 
still misnamed if it simply means there is no battery.

Best regards,
-Stephan

Other related posts: