← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/bug-1616661_messagebox_hotkeys into lp:widelands

 

kaputtnik has proposed merging lp:~widelands-dev/widelands/bug-1616661_messagebox_hotkeys into lp:widelands.

Commit message:
Change the hotkeys used in message box to filter messages from [1..5] to Alt + [1...5]

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1616661 in widelands: "Hotkeys of messagebox are in conflict with saved position"
  https://bugs.launchpad.net/widelands/+bug/1616661

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1616661_messagebox_hotkeys/+merge/305381

Fixes conflict with hotkeys of saved positions of map.

Change the hotkeys used in message box to filter messages from [1..5] to Alt + [1...5]. The Tooltips and the help texts are also changed accordingly.

There is a NOCOMM left. I didn't found any tooltip which correspond to this code. So maybe it could be removed.
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1616661_messagebox_hotkeys into lp:widelands.
=== modified file 'data/tribes/scripting/help/controls.lua'
--- data/tribes/scripting/help/controls.lua	2016-05-17 16:40:22 +0000
+++ data/tribes/scripting/help/controls.lua	2016-09-09 20:10:42 +0000
@@ -73,17 +73,17 @@
          h3(_"In the message window, the following additional shortcuts are available:") ..
          p(
                -- TRANSLATORS: This is the helptext for an access key combination.
-               dl(help_format_hotkey("0"), _"Show all messages") ..
-               -- TRANSLATORS: This is the helptext for an access key combination.
-               dl(help_format_hotkey("1"), _"Show geologists’ messages only") ..
-               -- TRANSLATORS: This is the helptext for an access key combination.
-               dl(help_format_hotkey("2"), _"Show economy messages only") ..
-               -- TRANSLATORS: This is the helptext for an access key combination.
-               dl(help_format_hotkey("3"), _"Show seafaring messages only") ..
-               -- TRANSLATORS: This is the helptext for an access key combination.
-               dl(help_format_hotkey("4"), _"Show warfare messages only") ..
-               -- TRANSLATORS: This is the helptext for an access key combination.
-               dl(help_format_hotkey("5"), _"Show scenario messages only") ..
+               dl(help_format_hotkey("Alt + 0"), _"Show all messages") ..
+               -- TRANSLATORS: This is the helptext for an access key combination.
+               dl(help_format_hotkey("Alt + 1"), _"Show geologists’ messages only") ..
+               -- TRANSLATORS: This is the helptext for an access key combination.
+               dl(help_format_hotkey("Alt + 2"), _"Show economy messages only") ..
+               -- TRANSLATORS: This is the helptext for an access key combination.
+               dl(help_format_hotkey("Alt + 3"), _"Show seafaring messages only") ..
+               -- TRANSLATORS: This is the helptext for an access key combination.
+               dl(help_format_hotkey("Alt + 4"), _"Show warfare messages only") ..
+               -- TRANSLATORS: This is the helptext for an access key combination.
+               dl(help_format_hotkey("Alt + 5"), _"Show scenario messages only") ..
                -- TRANSLATORS: This is the helptext for an access key combination.
                dl(help_format_hotkey("G"), _"Jump to the location corresponding to the current message") ..
                -- TRANSLATORS: This is an access key combination. Localize, but do not change the key.

=== modified file 'src/wui/game_message_menu.cc'
--- src/wui/game_message_menu.cc	2016-08-04 15:49:05 +0000
+++ src/wui/game_message_menu.cc	2016-09-09 20:10:42 +0000
@@ -349,6 +349,7 @@
  * Handle message menu hotkeys.
  */
 bool GameMessageMenu::handle_key(bool down, SDL_Keysym code) {
+
 	if (down) {
 		switch (code.sym) {
 		// Don't forget to change the tooltips if any of these get reassigned
@@ -357,23 +358,41 @@
 				center_view();
 			return true;
 		case SDLK_0:
-			filter_messages(Widelands::Message::Type::kAllMessages);
-			return true;
+			if (code.mod & KMOD_LALT) {
+				filter_messages(Widelands::Message::Type::kAllMessages);
+				return true;
+			}
+			return false;
 		case SDLK_1:
-			filter_messages(Widelands::Message::Type::kGeologists);
-			return true;
+			if (code.mod & KMOD_LALT) {
+				filter_messages(Widelands::Message::Type::kGeologists);
+				return true;
+			}
+			return false;
 		case SDLK_2:
-			filter_messages(Widelands::Message::Type::kEconomy);
-			return true;
+			if (code.mod & KMOD_LALT) {
+				filter_messages(Widelands::Message::Type::kEconomy);
+				return true;
+			}
+			return false;
 		case SDLK_3:
-			filter_messages(Widelands::Message::Type::kSeafaring);
-			return true;
+			if (code.mod & KMOD_LALT) {
+				filter_messages(Widelands::Message::Type::kSeafaring);
+				return true;
+			}
+			return false;
 		case SDLK_4:
-			filter_messages(Widelands::Message::Type::kWarfare);
-			return true;
+			if (code.mod & KMOD_LALT) {
+				filter_messages(Widelands::Message::Type::kWarfare);
+				return true;
+			}
+			return false;
 		case SDLK_5:
-			filter_messages(Widelands::Message::Type::kScenario);
-			return true;
+			if (code.mod & KMOD_LALT) {
+				filter_messages(Widelands::Message::Type::kScenario);
+				return true;
+			}
+			return false;
 		case SDLK_DELETE:
 			archive_or_restore();
 			return true;
@@ -494,11 +513,13 @@
 		scenariobtn_->set_perm_pressed(false);
 		button.set_perm_pressed(true);
 		message_filter_ = msgtype;
+
+		// NOCOMM franku: Please check if this is used anywhere
 		/** TRANSLATORS: %1% is a tooltip, %2% is the corresponding hotkey */
 		button.set_tooltip((boost::format(_("%1% (Hotkey: %2%)"))
-		                    /** TRANSLATORS: Tooltip in the messages window */
-		                    % _("Show all messages") % "0")
-		                      .str());
+							/** TRANSLATORS: Tooltip in the messages window */
+							% _("Show all messages") % "0")
+							  .str());
 	}
 }
 
@@ -506,23 +527,23 @@
  * Helper for filter_messages
  */
 void GameMessageMenu::set_filter_messages_tooltips() {
-	geologistsbtn_->set_tooltip((boost::format(_("%1% (Hotkey: %2%)"))
+	geologistsbtn_->set_tooltip((boost::format(_("%1% (Alt + %2%)"))
 	                             /** TRANSLATORS: Tooltip in the messages window */
 	                             % _("Show geologists' messages only") % "1")
 	                               .str());
-	economybtn_->set_tooltip((boost::format(_("%1% (Hotkey: %2%)"))
+	economybtn_->set_tooltip((boost::format(_("%1% (Alt + %2%)"))
 	                          /** TRANSLATORS: Tooltip in the messages window */
 	                          % _("Show economy messages only") % "2")
 	                            .str());
-	seafaringbtn_->set_tooltip((boost::format(_("%1% (Hotkey: %2%)"))
+	seafaringbtn_->set_tooltip((boost::format(_("%1% (Alt + %2%)"))
 	                            /** TRANSLATORS: Tooltip in the messages window */
 	                            % _("Show seafaring messages only") % "3")
 	                              .str());
-	warfarebtn_->set_tooltip((boost::format(_("%1% (Hotkey: %2%)"))
+	warfarebtn_->set_tooltip((boost::format(_("%1% (Alt + %2%)"))
 	                          /** TRANSLATORS: Tooltip in the messages window */
 	                          % _("Show warfare messages only") % "4")
 	                            .str());
-	scenariobtn_->set_tooltip((boost::format(_("%1% (Hotkey: %2%)"))
+	scenariobtn_->set_tooltip((boost::format(_("%1% (Alt + %2%)"))
 	                           /** TRANSLATORS: Tooltip in the messages window */
 	                           % _("Show scenario messages only") % "5")
 	                             .str());


References