[haiku-commits] haiku: hrev49565 - src/apps/powerstatus

  • From: pulkomandy@xxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 22 Aug 2015 15:46:11 +0200 (CEST)

hrev49565 adds 1 changeset to branch 'master'
old head: 6b6288a6de70a4b80d9c53db5b3fc4743a2b5ee7
new head: 4b26da642b959ca65d926b52c64b369b9a61b021
overview:
http://cgit.haiku-os.org/haiku/log/?qt=range&q=4b26da642b95+%5E6b6288a6de70

----------------------------------------------------------------------------

4b26da642b95: PowerStatus: show when the battery is charging.

[ Adrien Destugues <pulkomandy@xxxxxxxxxxxxx> ]

----------------------------------------------------------------------------

Revision: hrev49565
Commit: 4b26da642b959ca65d926b52c64b369b9a61b021
URL: http://cgit.haiku-os.org/haiku/commit/?id=4b26da642b95
Author: Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date: Sat Aug 22 13:08:24 2015 UTC

----------------------------------------------------------------------------

1 file changed, 21 insertions(+)
src/apps/powerstatus/PowerStatusView.cpp | 21 +++++++++++++++++++++

----------------------------------------------------------------------------

diff --git a/src/apps/powerstatus/PowerStatusView.cpp
b/src/apps/powerstatus/PowerStatusView.cpp
index 3b9d26c..ca46b46 100644
--- a/src/apps/powerstatus/PowerStatusView.cpp
+++ b/src/apps/powerstatus/PowerStatusView.cpp
@@ -11,6 +11,7 @@

#include "PowerStatusView.h"

+#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -222,6 +223,26 @@ PowerStatusView::_DrawBattery(BRect rect)
}
}

+ if (fOnline) {
+ // When charging, draw a lightning symbol over the battery.
+ SetHighColor(255, 255, 0, 180);
+ SetDrawingMode(B_OP_ALPHA);
+ SetScale(std::min(Bounds().Width(), Bounds().Height()) / 16);
+
+ static const BPoint points[] = {
+ BPoint(2,13),
+ BPoint(9,5),
+ BPoint(9,7),
+ BPoint(16,2),
+ BPoint(8,11),
+ BPoint(8,9)
+ };
+ FillPolygon(points,6);
+
+ SetScale(1);
+ SetDrawingMode(B_OP_OVER);
+ }
+
SetHighColor(0, 0, 0);
}



Other related posts: