Add setting to display the itemstring after the tooltip in the inventory. (#6413)
authorDTA7 <dta7e@t-online.de>
Fri, 15 Sep 2017 12:31:32 +0000 (14:31 +0200)
committerLoïc Blot <nerzhul@users.noreply.github.com>
Fri, 15 Sep 2017 12:31:32 +0000 (14:31 +0200)
* Add setting to display the itemstring after the tooltip in the inventory.

builtin/settingtypes.txt
src/defaultsettings.cpp
src/guiFormSpecMenu.cpp
src/guiFormSpecMenu.h

index bb618741b538b67fc5f74f3c5756f4aa2234d5f4..5af146895f8bb6879a7b657523fd4f90b0bfb8c1 100644 (file)
@@ -710,6 +710,9 @@ gui_scaling_filter_txr2img (GUI scaling filter txr2img) bool true
 #    Delay showing tooltips, stated in milliseconds.
 tooltip_show_delay (Tooltip delay) int 400
 
+#    Append itemstring to tooltip
+tooltip_append_itemstring (Append itemstring) bool false
+
 #    Whether freetype fonts are used, requires freetype support to be compiled in.
 freetype (Freetype fonts) bool true
 
index 5e4cf526c9ef8e30f4987cca96155fd881ed9963..5f3c97e9d955049edc4d98837fcec957b13e4d2e 100644 (file)
@@ -123,15 +123,6 @@ void set_default_settings(Settings *settings)
        settings->setDefault("keymap_slot21", "");
        settings->setDefault("keymap_slot22", "");
        settings->setDefault("keymap_slot23", "");
-       settings->setDefault("enable_build_where_you_stand", "false" );
-       settings->setDefault("3d_mode", "none");
-       settings->setDefault("3d_paralax_strength", "0.025");
-       settings->setDefault("aux1_descends", "false");
-       settings->setDefault("doubletap_jump", "false");
-       settings->setDefault("always_fly_fast", "true");
-       settings->setDefault("directional_colored_fog", "true");
-       settings->setDefault("tooltip_show_delay", "400");
-       settings->setDefault("zoom_fov", "15");
 
        // Some (temporary) keys for debugging
        settings->setDefault("keymap_quicktune_prev", "KEY_HOME");
@@ -152,6 +143,7 @@ void set_default_settings(Settings *settings)
        settings->setDefault("3d_mode", "none");
        settings->setDefault("3d_paralax_strength", "0.025");
        settings->setDefault("tooltip_show_delay", "400");
+       settings->setDefault("tooltip_append_itemstring", "false");
        settings->setDefault("zoom_fov", "15");
        settings->setDefault("fps_max", "60");
        settings->setDefault("pause_fps_max", "20");
index 7b7bd7c29d2329ac2d8b3c8d48bca0a7d896e692..ef26374002562f4d9b34f0bc14fe37599c219603 100644 (file)
@@ -112,6 +112,7 @@ GUIFormSpecMenu::GUIFormSpecMenu(JoystickController *joystick,
        m_doubleclickdetect[1].pos = v2s32(0, 0);
 
        m_tooltip_show_delay = (u32)g_settings->getS32("tooltip_show_delay");
+       m_tooltip_append_itemstring = g_settings->getBool("tooltip_append_itemstring");
 }
 
 GUIFormSpecMenu::~GUIFormSpecMenu()
@@ -2388,9 +2389,13 @@ void GUIFormSpecMenu::drawList(const ListDrawSpec &s, int phase,
                                                utf8_to_wide(item.getDefinition(m_client->idef()).description);
                                else
                                        tooltip_text = utf8_to_wide(desc);
-                               // Show itemstring as fallback for easier debugging
-                               if (!item.name.empty() && tooltip_text.empty())
-                                       tooltip_text = utf8_to_wide(item.name);
+
+                               if (!item.name.empty()) {
+                                       if (tooltip_text.empty())
+                                               tooltip_text = utf8_to_wide(item.name);
+                                       if (m_tooltip_append_itemstring)
+                                               tooltip_text += utf8_to_wide(" [" + item.name + "]");
+                               }
                        }
                        if (!tooltip_text.empty()) {
                                showTooltip(tooltip_text, m_default_tooltip_color,
index c86d596b7df1e140abbebe049a23a637b127e85c..902f86ce180a10a585313eb2d6cc1ac4500ac464 100644 (file)
@@ -407,6 +407,7 @@ protected:
        gui::IGUIStaticText *m_tooltip_element = nullptr;
 
        u64 m_tooltip_show_delay;
+       bool m_tooltip_append_itemstring;
        u64 m_hovered_time = 0;
        s32 m_old_tooltip_id = -1;