← Back to team overview

widelands-dev team mailing list archive

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

 

GunChleoc has proposed merging lp:~widelands-dev/widelands/bug-1174075 into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1174075 in widelands: "Clarify meaning of icons in editor terrain preview"
  https://bugs.launchpad.net/widelands/+bug/1174075

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1174075/+merge/235763

Added tooltips to terrain tool in editor with terrain names + types.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1174075/+merge/235763
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1174075 into lp:widelands.
=== modified file 'src/editor/ui_menus/editor_tool_set_terrain_options_menu.cc'
--- src/editor/ui_menus/editor_tool_set_terrain_options_menu.cc	2014-09-10 14:08:25 +0000
+++ src/editor/ui_menus/editor_tool_set_terrain_options_menu.cc	2014-09-24 08:43:32 +0000
@@ -21,6 +21,7 @@
 
 #include <memory>
 
+#include <boost/format.hpp>
 #include <SDL_keysym.h>
 
 #include "base/i18n.h"
@@ -66,6 +67,9 @@
 
 	constexpr int kSmallPicHeight = 20;
 	constexpr int kSmallPicWidth = 20;
+
+	std::string tooltip;
+
 	for (size_t checkfor = 0; check[checkfor] >= 0; ++checkfor) {
 		const TerrainDescription::Type ter_is = terrain_descr.get_is();
 		if (ter_is != check[checkfor])
@@ -80,34 +84,51 @@
 		if (ter_is == TerrainDescription::GREEN) {
 			surf->blit(pt, green->surface(), Rect(0, 0, green->width(), green->height()));
 			pt.x += kSmallPicWidth + 1;
+			/** TRANSLATORS: This is a terrain type tooltip in the editor */
+			tooltip = _("Green");
 		} else {
 			if (ter_is & TerrainDescription::WATER) {
 				surf->blit(pt, water->surface(), Rect(0, 0, water->width(), water->height()));
 				pt.x += kSmallPicWidth + 1;
+				/** TRANSLATORS: This is a terrain type tooltip in the editor */
+				tooltip = _("Water");
 			}
-			if (ter_is & TerrainDescription::MOUNTAIN) {
+			else if (ter_is & TerrainDescription::MOUNTAIN) {
 				surf->blit(pt, mountain->surface(), Rect(0, 0, mountain->width(), mountain->height()));
 				pt.x += kSmallPicWidth + 1;
+				/** TRANSLATORS: This is a terrain type tooltip in the editor */
+				tooltip = _("Mountains");
 			}
 			if (ter_is & TerrainDescription::ACID) {
 				surf->blit(pt, dead->surface(), Rect(0, 0, dead->width(), dead->height()));
 				pt.x += kSmallPicWidth + 1;
+				/** TRANSLATORS: This is a terrain type tooltip in the editor */
+				tooltip = ((boost::format("%s %s")) % tooltip % _("Dead")).str();
 			}
 			if (ter_is & TerrainDescription::UNPASSABLE) {
 				surf->blit(
 				   pt, unpassable->surface(), Rect(0, 0, unpassable->width(), unpassable->height()));
 				pt.x += kSmallPicWidth + 1;
+				/** TRANSLATORS: This is a terrain type tooltip in the editor */
+				tooltip = ((boost::format("%s %s")) % tooltip % _("Unpassable")).str();
 			}
-			if (ter_is & TerrainDescription::DRY)
+			if (ter_is & TerrainDescription::DRY) {
 				surf->blit(pt, dry->surface(), Rect(0, 0, dry->width(), dry->height()));
+				/** TRANSLATORS: This is a terrain type tooltip in the editor */
+				 tooltip = ((boost::format("%s %s")) % tooltip % _("Treeless")).str();
+			}
 		}
+
+		/** TRANSLATORS: %1% = terrain name, %2% = list of terrain types  */
+		tooltip = ((boost::format("%1%: %2%")) % terrain_descr.descname() % tooltip).str();
+
 		// Make sure we delete this later on.
 		offscreen_images->emplace_back(new_in_memory_image("dummy_hash", surf));
 		break;
 	}
 
 	std::unique_ptr<const Image>& image = offscreen_images->back();
-	UI::Checkbox* cb = new UI::Checkbox(parent, Point(0, 0), image.get());
+	UI::Checkbox* cb = new UI::Checkbox(parent, Point(0, 0), image.get(), tooltip);
 	cb->set_desired_size(image->width() + 1, image->height() + 1);
 	return cb;
 }


Follow ups