Merge lp:~widelands-dev/widelands/choose-attack-soldiers into lp:widelands

Proposed by Benedikt Straub
Status: Merged
Merged at revision: 9122
Proposed branch: lp:~widelands-dev/widelands/choose-attack-soldiers
Merge into: lp:widelands
Diff against target: 59 lines (+3/-10)
2 files modified
src/wui/attack_box.cc (+3/-6)
src/wui/attack_box.h (+0/-4)
To merge this branch: bzr merge lp:~widelands-dev/widelands/choose-attack-soldiers
Reviewer Review Type Date Requested Status
GunChleoc Approve
Benedikt Straub Needs Resubmitting
Review via email: mp+367471@code.launchpad.net

Commit message

Use a MultilineTextarea for the soldier stats in the attack box

Description of the change

Now the height of the attack box changes instead of the width ;)
It´ll change whenever the mouse is moved in or out; the text line is now hidden when no soldier is pointed at, which looks more elegant than an empty space at the bottom IMHO.

To post a comment you must log in.
Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 4986. State: errored. Details: https://travis-ci.org/widelands/widelands/builds/532836861.
Appveyor build 4767. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_choose_attack_soldiers-4767.

Revision history for this message
GunChleoc (gunchleoc) wrote :

The vertical size not being fixed is a problem - the attack box can start jumping up and down.

Revision history for this message
Benedikt Straub (nordfriese) wrote :

How many lines should I set as the always visible minimum? two?

Revision history for this message
Toni Förster (stonerl) wrote :

I'd say 2. That would be 20 soldiers right?

Revision history for this message
Benedikt Straub (nordfriese) wrote :

@Toni I mean the textarea showing the soldier stats below

Alternatively, option 5: since the usage tooltip is shown only over the headers, we could remove the textarea and put the soldier stats into an own tooltip

Revision history for this message
GunChleoc (gunchleoc) wrote :

I think the last idea is the best one :)

9112. By Nordfriese

Use a tooltip instead

Revision history for this message
Benedikt Straub (nordfriese) wrote :

A tooltip it is :)

review: Needs Resubmitting
Revision history for this message
GunChleoc (gunchleoc) wrote :

Perfect :)

@bunnybot merge

review: Approve
Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 5041. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/537114220.
Appveyor build 4821. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_choose_attack_soldiers-4821.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/wui/attack_box.cc'
2--- src/wui/attack_box.cc 2019-05-11 18:19:20 +0000
3+++ src/wui/attack_box.cc 2019-05-25 09:26:45 +0000
4@@ -246,9 +246,6 @@
5 mainbox.add(remaining_soldiers_.get(), UI::Box::Resizing::kFullSize);
6 }
7
8- current_soldier_stats_.reset(new UI::Textarea(&mainbox, "", UI::Align::kCenter));
9- mainbox.add(current_soldier_stats_.get(), UI::Box::Resizing::kFullSize, UI::Align::kCenter);
10-
11 soldiers_slider_->set_enabled(max_attackers > 0);
12 more_soldiers_->set_enabled(max_attackers > 0);
13 }
14@@ -322,12 +319,12 @@
15 }
16
17 void AttackBox::ListOfSoldiers::handle_mousein(bool) {
18- attack_box_->set_soldier_info_text();
19+ set_tooltip(std::string());
20 }
21
22 bool AttackBox::ListOfSoldiers::handle_mousemove(uint8_t, int32_t x, int32_t y, int32_t, int32_t) {
23 if (const Widelands::Soldier* soldier = soldier_at(x, y)) {
24- attack_box_->set_soldier_info_text(
25+ set_tooltip(
26 (boost::format(_("HP: %1$u/%2$u AT: %3$u/%4$u DE: %5$u/%6$u EV: %7$u/%8$u")) %
27 soldier->get_health_level() % soldier->descr().get_max_health_level() %
28 soldier->get_attack_level() % soldier->descr().get_max_attack_level() %
29@@ -335,7 +332,7 @@
30 soldier->get_evade_level() % soldier->descr().get_max_evade_level())
31 .str());
32 } else {
33- attack_box_->set_soldier_info_text();
34+ set_tooltip(std::string());
35 }
36 return true;
37 }
38
39=== modified file 'src/wui/attack_box.h'
40--- src/wui/attack_box.h 2019-05-11 18:19:20 +0000
41+++ src/wui/attack_box.h 2019-05-25 09:26:45 +0000
42@@ -55,9 +55,6 @@
43
44 size_t count_soldiers() const;
45 std::vector<Widelands::Serial> soldiers() const;
46- void set_soldier_info_text(std::string text = "") {
47- current_soldier_stats_->set_text(text);
48- }
49
50 UI::Button* get_attack_button() const {
51 return attack_button_.get();
52@@ -161,7 +158,6 @@
53
54 std::unique_ptr<ListOfSoldiers> attacking_soldiers_;
55 std::unique_ptr<ListOfSoldiers> remaining_soldiers_;
56- std::unique_ptr<UI::Textarea> current_soldier_stats_;
57 std::unique_ptr<UI::Button> attack_button_;
58
59 /// The last time the information in this Panel got updated

Subscribers

People subscribed via source and target branches

to status/vote changes: