Merge lp:~widelands-dev/widelands/can_act into lp:widelands

Proposed by GunChleoc
Status: Merged
Merged at revision: 8525
Proposed branch: lp:~widelands-dev/widelands/can_act
Merge into: lp:widelands
Diff against target: 36 lines (+3/-3)
1 file modified
src/wui/economy_options_window.cc (+3/-3)
To merge this branch: bzr merge lp:~widelands-dev/widelands/can_act
Reviewer Review Type Date Requested Status
SirVer Approve
GunChleoc Needs Resubmitting
Review via email: mp+334633@code.launchpad.net

Commit message

Remove buttons from economy options window for spectators.

Description of the change

A small cosmetic change.

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

Make the diff smaller with an early return?

If (!canact) {Return;}

> Am 02.12.2017 um 12:17 schrieb GunChleoc <email address hidden>:
>
> GunChleoc has proposed merging lp:~widelands-dev/widelands/can_act into lp:widelands.
>
> Commit message:
> Remove buttons from economy options window for spectators.
>
> Requested reviews:
> Widelands Developers (widelands-dev)
> Related bugs:
> Bug #1735090 in widelands: "Replays crash when a training site construction window is open"
> https://bugs.launchpad.net/widelands/+bug/1735090
>
> For more details, see:
> https://code.launchpad.net/~widelands-dev/widelands/can_act/+merge/334633
>
> A small cosmetic change.
> --
> You are subscribed to branch lp:widelands.
> === modified file 'src/wui/economy_options_window.cc' --- src/wui/economy_options_window.cc 2017-11-29 21:40:56 +0000 +++ src/wui/economy_options_window.cc 2017-12-02 11:16:37 +0000 @@ -128,31 +128,30 @@ display_(this, 0, 0, type_, can_act_, economy) { add(&display_, UI::Box::Resizing::kFullSize); - UI::Box* buttons = new UI::Box(this, 0, 0, UI::Box::Horizontal); - add(buttons); - - UI::Button* b = - new UI::Button(buttons, "decrease_target", 0, 0, 34, 34, - g_gr->images().get("images/ui_basic/but4.png"), "-", _("Decrease target")); - b->set_enabled(can_act_); - b->sigclicked.connect(boost::bind(&EconomyOptionsPanel::change_target, this, -1)); - buttons->add(b); - b->set_repeating(true); - buttons->add_space(8); - - b = new UI::Button(buttons, "increase_target", 0, 0, 34, 34, - g_gr->images().get("images/ui_basic/but4.png"), "+", _("Increase target")); - b->set_enabled(can_act_); - b->sigclicked.connect(boost::bind(&EconomyOptionsPanel::change_target, this, 1)); - buttons->add(b); - b->set_repeating(true); - buttons->add_space(8); - - b = new UI::Button(buttons, "reset_target", 0, 0, 34, 34, - g_gr->images().get("images/ui_basic/but4.png"), "R", _("Reset to default")); - b->set_enabled(can_act_); - b->sigclicked.connect(boost::bind(&EconomyOptionsPanel::reset_target, this)); - buttons->add(b); + if (can_act_) { + UI::Box* buttons = new UI::Box(this, 0, 0, UI::Box::Horizontal); + add(buttons); + + UI::Button* b = + new UI::Button(buttons, "decrease_target", 0, 0, 34, 34, + g_gr->images().get("images/ui_basic/but4.png"), "-", _("Decrease target")); + b->sigclicked.connect(boost::bind(&EconomyOptionsPanel::change_target, this, -1)); + buttons->add(b); + b->set_repeating(true); + buttons->add_space(8); + + b = new UI::Button(buttons, "increase_target", 0, 0, 34, 34, + g_gr->images().get("images/ui_basic/but4.png"), "+", _("Increase target")); + b->sigclicked.connect(boost::bind(&EconomyOptionsPanel::change_target, this, 1)); + buttons->add(b); + b->set_repeating(true); + buttons->add_space(8); + + b = new UI::Button(buttons, "reset_target", 0, 0, 34, 34, + g_gr->images().get("images/ui_basic/but4.png"), "R", _("Reset to default")); + b->sigclicked.connect(boost::bind(&EconomyOptionsPanel::reset_target, this)); + buttons->add(b); + } } void EconomyOptionsWindow::EconomyOptionsPanel::set_economy(Widelands::Economy* economy) {

Revision history for this message
GunChleoc (gunchleoc) wrote :

Done.

review: Needs Resubmitting
Revision history for this message
SirVer (sirver) wrote :

very nice.

@bunnybot merge

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

Continuous integration builds have changed state:

Travis build 2918. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/310548701.
Appveyor build 2727. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_can_act-2727.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/wui/economy_options_window.cc'
2--- src/wui/economy_options_window.cc 2017-11-29 21:40:56 +0000
3+++ src/wui/economy_options_window.cc 2017-12-02 16:19:57 +0000
4@@ -128,13 +128,15 @@
5 display_(this, 0, 0, type_, can_act_, economy) {
6 add(&display_, UI::Box::Resizing::kFullSize);
7
8+ if (!can_act_) {
9+ return;
10+ }
11 UI::Box* buttons = new UI::Box(this, 0, 0, UI::Box::Horizontal);
12 add(buttons);
13
14 UI::Button* b =
15 new UI::Button(buttons, "decrease_target", 0, 0, 34, 34,
16 g_gr->images().get("images/ui_basic/but4.png"), "-", _("Decrease target"));
17- b->set_enabled(can_act_);
18 b->sigclicked.connect(boost::bind(&EconomyOptionsPanel::change_target, this, -1));
19 buttons->add(b);
20 b->set_repeating(true);
21@@ -142,7 +144,6 @@
22
23 b = new UI::Button(buttons, "increase_target", 0, 0, 34, 34,
24 g_gr->images().get("images/ui_basic/but4.png"), "+", _("Increase target"));
25- b->set_enabled(can_act_);
26 b->sigclicked.connect(boost::bind(&EconomyOptionsPanel::change_target, this, 1));
27 buttons->add(b);
28 b->set_repeating(true);
29@@ -150,7 +151,6 @@
30
31 b = new UI::Button(buttons, "reset_target", 0, 0, 34, 34,
32 g_gr->images().get("images/ui_basic/but4.png"), "R", _("Reset to default"));
33- b->set_enabled(can_act_);
34 b->sigclicked.connect(boost::bind(&EconomyOptionsPanel::reset_target, this));
35 buttons->add(b);
36 }

Subscribers

People subscribed via source and target branches

to status/vote changes: