From: terencehill Date: Sat, 14 Nov 2015 18:53:51 +0000 (+0100) Subject: Show a tooltip when the cursor is over the server icons in the serverlist X-Git-Tag: xonotic-v0.8.2~1657^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=159625c0fdea6be3cdb97d02d2c4c345881c8602;p=xonotic%2Fxonotic-data.pk3dir.git Show a tooltip when the cursor is over the server icons in the serverlist --- diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_join_serverinfo.qc b/qcsrc/menu/xonotic/dialog_multiplayer_join_serverinfo.qc index 8638ab14b..b45972859 100644 --- a/qcsrc/menu/xonotic/dialog_multiplayer_join_serverinfo.qc +++ b/qcsrc/menu/xonotic/dialog_multiplayer_join_serverinfo.qc @@ -192,7 +192,7 @@ void XonoticServerInfoDialog_loadServerInfo(entity me, float i) me.currentServerNumFreeSlots = strzone(s); me.numFreeSlotsLabel.setText(me.numFreeSlotsLabel, me.currentServerNumFreeSlots); - me.currentServerMod = ((modname == "Xonotic") ? _("Default") : modname); + me.currentServerMod = ((modname == "Xonotic") ? ZCTX(_("MOD^Default")) : modname); me.currentServerMod = strzone(me.currentServerMod); me.modLabel.setText(me.modLabel, me.currentServerMod); diff --git a/qcsrc/menu/xonotic/serverlist.qc b/qcsrc/menu/xonotic/serverlist.qc index 3819036ad..071e2ba24 100644 --- a/qcsrc/menu/xonotic/serverlist.qc +++ b/qcsrc/menu/xonotic/serverlist.qc @@ -12,6 +12,9 @@ CLASS(XonoticServerList, XonoticListBox) METHOD(XonoticServerList, toggleFavorite, void(entity, string)); ATTRIB(XonoticServerList, iconsSizeFactor, float, 0.85) + METHOD(XonoticServerList, mouseMove, float(entity, vector)); + ATTRIB(XonoticServerList, mouseOverIcons, bool, false) + METHOD(XonoticServerList, focusedItemChangeNotify, void(entity)); ATTRIB(XonoticServerList, realFontSize, vector, '0 0 0') ATTRIB(XonoticServerList, realUpperMargin, float, 0) @@ -1077,9 +1080,10 @@ void XonoticServerList_drawListBoxItem(entity me, int i, vector absSize, bool is #ifdef COMPAT_NO_MOD_IS_XONOTIC if(modname == "") - modname = "xonotic"; + modname = "Xonotic"; #endif + string original_modname = modname; modname = strtolower(modname); /* @@ -1232,6 +1236,19 @@ void XonoticServerList_drawListBoxItem(entity me, int i, vector absSize, bool is if(sflags >= 0 && (sflags & SERVERFLAG_PLAYERSTATS)) draw_Picture(iconPos, "icon_stats1", iconSize, '1 1 1', 1); + if(isFocused && me.mouseOverIcons && !me.tooltip) + { + string t = ""; + if(me.seenIPv4 && me.seenIPv6) + t = strcat(t, (isv6) ? "IPv6, " : "IPv4, "); + t = strcat(t, _("encryption:"), " ", (q ? sprintf(_("AES level %d"), q) : ZCTX(_("ENC^none"))), ", "); + t = strcat(t, sprintf(_("mod: %s"), ((modname == "xonotic") ? ZCTX(_("MOD^Default")) : original_modname))); + if(pure_available) + t = strcat(t, sprintf(_(" (%s)"), (pure) ? _("official settings") : _("modified settings"))); + t = strcat(t, ", "); + t = strcat(t, ((sflags >= 0 && (sflags & SERVERFLAG_PLAYERSTATS)) ? _("stats enabled") : _("stats disabled"))); + setZonedTooltip(me, t, string_null); + } // -------------- // RENDER TEXT // -------------- @@ -1257,6 +1274,26 @@ void XonoticServerList_drawListBoxItem(entity me, int i, vector absSize, bool is draw_Text(me.realUpperMargin * eY + (me.columnPlayersOrigin + (me.columnPlayersSize - draw_TextWidth(s, 0, me.realFontSize)) * 0.5) * eX, s, me.realFontSize, theColor, theAlpha, 0); } +void XonoticServerList_focusedItemChangeNotify(entity me) +{ + clearTooltip(me); +} + +float XonoticServerList_mouseMove(entity me, vector pos) +{ + if(!SUPER(XonoticServerList).mouseMove(me, pos)) + { + me.mouseOverIcons = false; + clearTooltip(me); + return 1; + } + + me.mouseOverIcons = (pos_x <= me.columnIconsSize); + if(!me.mouseOverIcons) + clearTooltip(me); + return 1; +} + bool XonoticServerList_keyDown(entity me, int scan, bool ascii, bool shift) { vector org, sz;