widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #06969
[Merge] lp:~widelands-dev/widelands/fix_actionconfirm into lp:widelands
GunChleoc has proposed merging lp:~widelands-dev/widelands/fix_actionconfirm into lp:widelands.
Commit message:
Consistent ActionConfirm with improved messages.
Requested reviews:
Widelands Developers (widelands-dev)
For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/fix_actionconfirm/+merge/290280
The button order was inconsistent when sinking a ship, so there is only 1 constructor now. Also, improved/fixed the ship cancel expedition/sink messages.
--
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/fix_actionconfirm into lp:widelands.
=== modified file 'src/wui/actionconfirm.cc'
--- src/wui/actionconfirm.cc 2016-03-19 18:40:05 +0000
+++ src/wui/actionconfirm.cc 2016-03-29 08:24:29 +0000
@@ -38,13 +38,7 @@
(InteractivePlayer & parent,
const std::string & windowtitle,
const std::string & message,
- Widelands::Building & building);
-
- ActionConfirm
- (InteractivePlayer & parent,
- const std::string & windowtitle,
- const std::string & message,
- Widelands::Ship & ship);
+ Widelands::MapObject& map_object);
InteractivePlayer & iaplayer() const {
return dynamic_cast<InteractivePlayer&>(*get_parent());
@@ -139,17 +133,13 @@
(InteractivePlayer & parent,
const std::string & windowtitle,
const std::string & message,
- Widelands::Building & building)
+ Widelands::MapObject & map_object)
:
UI::Window
(&parent, "building_action_confirm", 0, 0, 200, 120, windowtitle),
- object_ (&building)
+ object_ (&map_object)
{
- new UI::MultilineTextarea
- (this,
- 0, 0, 200, 74,
- (boost::format(message) % building.descr().descname()).str(),
- UI::Align::kCenter);
+ new UI::MultilineTextarea(this, 0, 0, 200, 74, message, UI::Align::kCenter);
UI::Button * okbtn =
new UI::Button
@@ -172,42 +162,6 @@
}
-ActionConfirm::ActionConfirm
- (InteractivePlayer & parent,
- const std::string & windowtitle,
- const std::string & message,
- Widelands::Ship & ship)
- :
- UI::Window(&parent, "ship_action_confirm", 0, 0, 200, 120, windowtitle),
- object_ (&ship)
-{
- new UI::MultilineTextarea
- (this,
- 0, 0, 200, 74,
- message,
- UI::Align::kCenter);
-
- UI::Button * okbtn =
- new UI::Button
- (this, "ok",
- 6, 80, 80, 34,
- g_gr->images().get("images/ui_basic/but4.png"),
- g_gr->images().get("images/wui/menu_okay.png"));
- okbtn->sigclicked.connect(boost::bind(&ActionConfirm::ok, this));
-
- UI::Button * cancelbtn =
- new UI::Button
- (this, "abort",
- 114, 80, 80, 34,
- g_gr->images().get("images/ui_basic/but4.png"),
- g_gr->images().get("images/wui/menu_abort.png"));
- cancelbtn->sigclicked.connect(boost::bind(&ActionConfirm::die, this));
-
- center_to_parent();
- cancelbtn->center_mouse();
-}
-
-
/*
===============
Create the panels for bulldoze confirmation.
@@ -221,7 +175,7 @@
ActionConfirm
(parent,
_("Destroy building?"),
- _("Do you really want to destroy this %s?"),
+ (boost::format(_("Do you really want to destroy this %s?")) % building.descr().descname()).str(),
building),
todestroy_(todestroy ? todestroy : &building)
{
@@ -285,7 +239,7 @@
ActionConfirm
(parent,
_("Dismantle building?"),
- _("Do you really want to dismantle this %s?"),
+ (boost::format(_("Do you really want to dismantle this %s?")) % building.descr().descname()).str(),
building)
{
// Nothing special to do
@@ -345,7 +299,7 @@
ActionConfirm
(parent,
_("Enhance building?"),
- _("Do you really want to enhance this %s?"),
+ (boost::format(_("Do you really want to enhance this %s?")) % building.descr().descname()).str(),
building),
id_(id)
{
@@ -396,7 +350,11 @@
*/
ShipSinkConfirm::ShipSinkConfirm(InteractivePlayer & parent, Widelands::Ship & ship)
:
- ActionConfirm(parent, _("Sink the ship?"), _("Do you really want to sink this ship?"), ship)
+ ActionConfirm(parent,
+ _("Sink the ship?"),
+ /** TRANSLATORS: %s is a ship name */
+ (boost::format(_("Do you really want to sink %s?")) % ship.get_shipname()).str(),
+ ship)
{
// Nothing special to do
}
@@ -436,7 +394,10 @@
*/
ShipCancelExpeditionConfirm::ShipCancelExpeditionConfirm(InteractivePlayer & parent, Widelands::Ship & ship)
:
- ActionConfirm(parent, _("Sink the ship?"), _("Do you really want to cancel the active expedition?"), ship)
+ ActionConfirm(parent,
+ _("Cancel expedition?"),
+ _("Do you really want to cancel the active expedition?"),
+ ship)
{
// Nothing special to do
}
Follow ups