Index: binaries/data/mods/public/gui/common/color.js
===================================================================
--- binaries/data/mods/public/gui/common/color.js (revision 18746)
+++ binaries/data/mods/public/gui/common/color.js (working copy)
@@ -142,5 +142,19 @@ function colorizeHotkey(text, hotkey)
"[color=\"" + g_HotkeyColor + "\"]" +
"\\[" + key + "]" +
"[/color]"
});
}
+
+/**
+ * The autocomplete hotkey is hardcoded in SDLK_TAB of CInput.cpp,
+ * as we don't want hotkeys interfering with typing text.
+ */
+function colorizeAutocompleteHotkey()
+{
+ return sprintf(translate("Press %(hotkey)s to autocomplete playernames."), {
+ "hotkey":
+ "[color=\"" + g_HotkeyColor + "\"]" +
+ "\\[" + translateWithContext("hotkey", "Tab") + "]" +
+ "[/color]"
+ });
+}
Index: binaries/data/mods/public/gui/common/functions_utility_loadsave.js
===================================================================
--- binaries/data/mods/public/gui/common/functions_utility_loadsave.js (revision 18746)
+++ binaries/data/mods/public/gui/common/functions_utility_loadsave.js (working copy)
@@ -73,5 +73,19 @@ function reallyDeleteGame(gameID)
error("Could not delete saved game: " + gameID);
// Run init again to refresh saved game list
init();
}
+
+function deleteTooltip()
+{
+ let deleteTooltip = colorizeHotkey(
+ translate("Delete the selected entry using %(hotkey)s."),
+ "session.savedgames.delete");
+
+ if (deleteTooltip)
+ deleteTooltip += colorizeHotkey(
+ " " + translate("Hold %(hotkey)s to delete without confirmation."),
+ "session.savedgames.noconfirmation");
+
+ return deleteTooltip;
+}
Index: binaries/data/mods/public/gui/gamesetup/gamesetup.js
===================================================================
--- binaries/data/mods/public/gui/gamesetup/gamesetup.js (revision 18746)
+++ binaries/data/mods/public/gui/gamesetup/gamesetup.js (working copy)
@@ -292,10 +292,12 @@ function initGUIObjects()
initMultiplayerSettings();
initPlayerAssignments();
resizeMoreOptionsWindow();
+ Engine.GetGUIObjectByName("chatInput").tooltip = colorizeAutocompleteHotkey();
+
if (g_IsNetworked)
Engine.GetGUIObjectByName("chatInput").focus();
if (g_IsController)
{
Index: binaries/data/mods/public/gui/lobby/lobby.js
===================================================================
--- binaries/data/mods/public/gui/lobby/lobby.js (revision 18746)
+++ binaries/data/mods/public/gui/lobby/lobby.js (working copy)
@@ -222,10 +222,12 @@ function init(attribs)
// When rejoining the lobby after a game, we don't need to process presence changes
Engine.LobbyClearPresenceUpdates();
updatePlayerList();
updateSubject(Engine.LobbyGetRoomSubject());
+
+ Engine.GetGUIObjectByName("chatInput").tooltip = colorizeAutocompleteHotkey();
}
function returnToMainMenu()
{
Engine.StopXmppClient();
Index: binaries/data/mods/public/gui/replaymenu/replay_menu.js
===================================================================
--- binaries/data/mods/public/gui/replaymenu/replay_menu.js (revision 18746)
+++ binaries/data/mods/public/gui/replaymenu/replay_menu.js (working copy)
@@ -65,10 +65,11 @@ function init(data)
{
Engine.SwitchGuiPage("page_pregame.xml");
return;
}
+ initHotkeyTooltips();
displayReplayList();
}
/**
* Store the list of replays loaded in C++ in g_Replays.
@@ -183,10 +184,19 @@ function sanitizeGameAttributes(attribs)
if (!pData.Name)
pData.Name = "";
});
}
+function initHotkeyTooltips()
+{
+ Engine.GetGUIObjectByName("playersFilter").tooltip =
+ translate("Filter replays by typing one or more, partial or complete playernames.") +
+ " " + colorizeAutocompleteHotkey();
+
+ Engine.GetGUIObjectByName("deleteReplayButton").tooltip = deleteTooltip();
+}
+
/**
* Filter g_Replays, fill the GUI list with that data and show the description of the current replay.
*/
function displayReplayList()
{
Index: binaries/data/mods/public/gui/replaymenu/replay_menu.xml
===================================================================
--- binaries/data/mods/public/gui/replaymenu/replay_menu.xml (revision 18746)
+++ binaries/data/mods/public/gui/replaymenu/replay_menu.xml (working copy)
@@ -10,11 +10,11 @@
-
+
Index: binaries/data/mods/public/gui/savedgames/load.js
===================================================================
--- binaries/data/mods/public/gui/savedgames/load.js (revision 18746)
+++ binaries/data/mods/public/gui/savedgames/load.js (working copy)
@@ -32,10 +32,12 @@ function init()
gameSelection.selected = 0;
else if (gameSelection.selected >= savedGames.length) // happens when deleting the last saved game
gameSelection.selected = savedGames.length - 1;
else
selectionChanged();
+
+ Engine.GetGUIObjectByName("deleteGameButton").tooltip = deleteTooltip();
}
function selectionChanged()
{
let gameSelection = Engine.GetGUIObjectByName("gameSelection");
Index: binaries/data/mods/public/gui/savedgames/save.js
===================================================================
--- binaries/data/mods/public/gui/savedgames/save.js (revision 18746)
+++ binaries/data/mods/public/gui/savedgames/save.js (working copy)
@@ -35,10 +35,12 @@ function init(data)
g_Descriptions[game.id] = game.metadata.description || "";
gameSelection.list = savedGames.map(game => generateLabel(game.metadata));
gameSelection.list_data = savedGames.map(game => game.id);
gameSelection.selected = -1;
+
+ Engine.GetGUIObjectByName("deleteGameButton").tooltip = deleteTooltip();
}
function saveGame()
{
let gameSelection = Engine.GetGUIObjectByName("gameSelection");
Index: binaries/data/mods/public/gui/savedgames/save.xml
===================================================================
--- binaries/data/mods/public/gui/savedgames/save.xml (revision 18746)
+++ binaries/data/mods/public/gui/savedgames/save.xml (working copy)
@@ -1,9 +1,10 @@
+
Index: binaries/data/mods/public/gui/session/session.js
===================================================================
--- binaries/data/mods/public/gui/session/session.js (revision 18746)
+++ binaries/data/mods/public/gui/session/session.js (working copy)
@@ -291,12 +291,10 @@ function init(initData, hotloadData)
// If in Atlas editor, disable the exit button
if (Engine.IsAtlasRunning())
Engine.GetGUIObjectByName("menuExitButton").enabled = false;
- initHotkeyTooltips();
-
if (hotloadData)
g_Selection.selected = hotloadData.selection;
sendLobbyPlayerlistUpdate();
onSimulationUpdate();
@@ -311,12 +309,23 @@ function init(initData, hotloadData)
// and it generates a massive amount of data to transmit and store
//setTimeout(function() { reportPerformance(5); }, 5000);
//setTimeout(function() { reportPerformance(60); }, 60000);
}
-function initHotkeyTooltips()
+/**
+ * Depends on the current player (g_IsObserver).
+ */
+function updateHotkeyTooltips()
{
+ Engine.GetGUIObjectByName("chatInput").tooltip = colorizeAutocompleteHotkey() +
+ colorizeHotkey("\n" + translate("Press %(hotkey)s to open the public chat."), "chat") +
+ colorizeHotkey(
+ "\n" + (g_IsObserver ?
+ translate("Press %(hotkey)s to open the observer chat.") :
+ translate("Press %(hotkey)s to open the ally chat.")),
+ "teamchat");
+
Engine.GetGUIObjectByName("idleWorkerButton").tooltip =
colorizeHotkey("%(hotkey)s" + " ", "selection.idleworker") +
translate("Find idle worker");
Engine.GetGUIObjectByName("tradeHelp").tooltip =
@@ -387,12 +396,12 @@ function selectViewPlayer(playerID)
}
Engine.SetViewedPlayer(g_ViewedPlayer);
updateTopPanel();
-
updateChatAddressees();
+ updateHotkeyTooltips();
// Update GUI and clear player-dependent cache
onSimulationUpdate();
if (g_IsDiplomacyOpen)