Include battery percentage into GUI and add 2 versions of battery icon
This commit is contained in:
parent
0dfa4421ea
commit
de183eeb2d
9 changed files with 77 additions and 1 deletions
BIN
data/core/images/themes/battery-bw-lighting-bolt.png
Normal file
BIN
data/core/images/themes/battery-bw-lighting-bolt.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 197 B |
BIN
data/core/images/themes/battery-bw.png
Normal file
BIN
data/core/images/themes/battery-bw.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 176 B |
BIN
data/core/images/themes/battery-lighting-bolt.png
Normal file
BIN
data/core/images/themes/battery-lighting-bolt.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 233 B |
BIN
data/core/images/themes/battery.png
Normal file
BIN
data/core/images/themes/battery.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 208 B |
|
@ -386,7 +386,7 @@
|
|||
#enddef
|
||||
|
||||
#define COUNTDOWN_THEME
|
||||
{STATUS_BOX_BORDERLESS +3 =+0 +90 +15 timeout income-box-topright fixed fixed}
|
||||
{STATUS_BOX_BORDERLESS +3 =+0 +90 +15 timeout battery-box-topright fixed fixed}
|
||||
[label]
|
||||
id=time-icon
|
||||
#icon=themes/units.png
|
||||
|
|
|
@ -169,6 +169,13 @@
|
|||
xanchor=fixed
|
||||
yanchor=fixed
|
||||
[/panel]
|
||||
[panel]
|
||||
id=battery-panel
|
||||
image=themes/legacy/status-bg.png
|
||||
rect="+5,=,+85,="
|
||||
xanchor=fixed
|
||||
yanchor=fixed
|
||||
[/panel]
|
||||
|
||||
# {COUNTDOWN_THEME}
|
||||
[panel]
|
||||
|
@ -253,6 +260,15 @@
|
|||
xanchor=fixed
|
||||
yanchor=fixed
|
||||
[/label]
|
||||
[label]
|
||||
id=battery-icon
|
||||
icon=themes/battery.png
|
||||
text= _ "battery"
|
||||
ref=battery-panel
|
||||
rect="=+5,=+1,+25,+17"
|
||||
xanchor=fixed
|
||||
yanchor=fixed
|
||||
[/label]
|
||||
|
||||
[status]
|
||||
# the time of day image
|
||||
|
@ -333,6 +349,16 @@
|
|||
prefix="" #wmllint: ignore
|
||||
prefix_literal=""
|
||||
[/income]
|
||||
[battery]
|
||||
id=status-battery
|
||||
font_size={DEFAULT_FONT_SMALL}
|
||||
ref=battery-icon
|
||||
rect="+4,=,+50,+16"
|
||||
xanchor=fixed
|
||||
yanchor=fixed
|
||||
prefix="" #wmllint: ignore
|
||||
prefix_literal=""
|
||||
[/battery]
|
||||
|
||||
{COUNTDOWN_THEME_STATUS {DEFAULT_FONT_SMALL}}
|
||||
|
||||
|
@ -597,6 +623,10 @@
|
|||
id=income-panel
|
||||
rect="+5,=,+55,="
|
||||
[/change]
|
||||
[change]
|
||||
id=battery-panel
|
||||
rect="+5,=,+55,="
|
||||
[/change]
|
||||
[change]
|
||||
id=turn
|
||||
rect="+4,=,+55,+16"
|
||||
|
@ -627,6 +657,11 @@
|
|||
rect="+4,=,+50,+16"
|
||||
font_size={DEFAULT_FONT_TINY}
|
||||
[/change]
|
||||
[change]
|
||||
id=status-battery
|
||||
rect="+4,=,+40,+16"
|
||||
font_size={DEFAULT_FONT_TINY}
|
||||
[/change]
|
||||
[change]
|
||||
id=timeout-panel
|
||||
rect="+5,=,+75,="
|
||||
|
|
|
@ -108,6 +108,7 @@
|
|||
{STATUS_BOX_BORDERLESS +3 =+0 +65 +15 units villages-box-topright fixed fixed}
|
||||
{STATUS_BOX_BORDERLESS +3 =+0 +85 +15 upkeep units-box-topright fixed fixed}
|
||||
{STATUS_BOX_BORDERLESS +3 =+0 +85 +15 income upkeep-box-topright fixed fixed}
|
||||
{STATUS_BOX_BORDERLESS +3 =+0 +85 +15 battery income-box-topright fixed fixed}
|
||||
{COUNTDOWN_THEME}
|
||||
[menu]
|
||||
is_context_menu=true
|
||||
|
@ -216,6 +217,15 @@
|
|||
xanchor=fixed
|
||||
yanchor=fixed
|
||||
[/label]
|
||||
[label]
|
||||
id=battery-icon
|
||||
icon=themes/battery.png
|
||||
text= _ "battery"
|
||||
ref=battery-box-center
|
||||
rect="=+1,=-1,+17,+17"
|
||||
xanchor=fixed
|
||||
yanchor=fixed
|
||||
[/label]
|
||||
|
||||
[status]
|
||||
# The size of these rectangles only accommodates hex coordinates
|
||||
|
@ -345,6 +355,16 @@
|
|||
prefix="" #wmllint: ignore
|
||||
prefix_literal=""
|
||||
[/income]
|
||||
[battery]
|
||||
id=status-battery
|
||||
font_size={DEFAULT_FONT_SMALL}
|
||||
ref=battery-icon
|
||||
rect="+4,=-2,+60,+16"
|
||||
xanchor=fixed
|
||||
yanchor=fixed
|
||||
prefix="" #wmllint: ignore
|
||||
prefix_literal=""
|
||||
[/battery]
|
||||
|
||||
{COUNTDOWN_THEME_STATUS {DEFAULT_FONT_SMALL}}
|
||||
|
||||
|
@ -569,6 +589,7 @@
|
|||
{CHANGE_STATUS_BOX +1 =+0 +45 +15 units villages-box-topright}
|
||||
{CHANGE_STATUS_BOX +1 =+0 +60 +15 upkeep units-box-topright}
|
||||
{CHANGE_STATUS_BOX +1 =+0 +55 +15 income upkeep-box-topright}
|
||||
{CHANGE_STATUS_BOX +1 =+0 +55 +15 battery income-box-topright}
|
||||
|
||||
[change]
|
||||
id=menu-main
|
||||
|
@ -612,6 +633,11 @@
|
|||
rect="+4,=+1,+50,+{DEFAULT_FONT_TINY_HEIGHT}"
|
||||
font_size={DEFAULT_FONT_TINY}
|
||||
[/change]
|
||||
[change]
|
||||
id=status-battery
|
||||
rect="+4,=+1,+40,+{DEFAULT_FONT_TINY_HEIGHT}"
|
||||
font_size={DEFAULT_FONT_TINY}
|
||||
[/change]
|
||||
[change]
|
||||
id=timeout-panel
|
||||
rect="+5,=,+75,="
|
||||
|
|
|
@ -370,6 +370,7 @@ void game_display::draw_sidebar()
|
|||
return;
|
||||
|
||||
refresh_report("report_clock");
|
||||
refresh_report("report_battery");
|
||||
refresh_report("report_countdown");
|
||||
|
||||
if (invalidateGameStatus_)
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
#include "actions/attack.hpp"
|
||||
#include "attack_prediction.hpp"
|
||||
#include "desktop/battery_info.hpp"
|
||||
#include "font/pango/escape.hpp"
|
||||
#include "font/text_formatting.hpp"
|
||||
#include "formatter.hpp"
|
||||
|
@ -35,6 +36,7 @@
|
|||
#include <ctime>
|
||||
#include <iomanip>
|
||||
#include <boost/dynamic_bitset.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
static void add_text(config &report, const std::string &text,
|
||||
const std::string &tooltip, const std::string &help = "")
|
||||
|
@ -1552,6 +1554,18 @@ REPORT_GENERATOR(report_clock, /*rc*/)
|
|||
return text_report(ss.str(), _("Clock"));
|
||||
}
|
||||
|
||||
|
||||
REPORT_GENERATOR(battery, /*rc*/)
|
||||
{
|
||||
std::ostringstream ss;
|
||||
std::string battery = "";
|
||||
if (desktop::battery_info::does_device_have_battery()) {
|
||||
ss << boost::lexical_cast<std::string>(desktop::battery_info::get_battery_percentage()) + "%";
|
||||
}
|
||||
|
||||
return text_report(ss.str(), _("Battery"));
|
||||
}
|
||||
|
||||
REPORT_GENERATOR(report_countdown, rc)
|
||||
{
|
||||
int viewing_side = rc.screen().viewing_side();
|
||||
|
|
Loading…
Add table
Reference in a new issue