Page MenuHomeWildfire Games

Set a tooltip for switching tabs and generalize coloredHotkey to allow multiple hotkeys
AbandonedPublic

Authored by bb on Dec 27 2017, 8:54 PM.

Details

Reviewers
None
Summary

Give the tabs a hotkey tooltip, this needs several hotkeys colored in the same string, thus extending support for that.

Test Plan

Trigger all changed hotkeys

Event Timeline

bb created this revision.Dec 27 2017, 8:54 PM
Owners added a subscriber: Restricted Owners Package.Dec 27 2017, 8:54 PM
bb added inline comments.Dec 27 2017, 8:56 PM
binaries/data/mods/public/gui/common/color.js
145–146

adding that 0 everywhere and the arrays are a bit meh, but holding support for without that even more so imo

binaries/data/mods/public/gui/common/tab_buttons.js
46

Looks a bit ugly when no tab specific hotkey is set, can be solved by setting those everywhere

binaries/data/mods/public/gui/session/unit_actions.js
1029–1030

Do not merge since then the sting gets fully removed when the hotkey isn't set, which shouldn't happen

elexis added a subscriber: elexis.Dec 27 2017, 9:03 PM
elexis added inline comments.
binaries/data/mods/public/gui/common/tab_buttons.js
47

What if the user didn't assign a key to one of them?

Vulcan added a subscriber: Vulcan.Dec 27 2017, 9:41 PM
Executing section Default...
Executing section Source...
Executing section JS...

Successful build - Chance fights ever on the side of the prudent.

Updating workspaces...
Build (release)...
Build (debug)...
Running release tests...
Running cxxtest tests (308 tests)....................................................................................................................................................................................................................................................................................................................OK!
Running debug tests...
Running cxxtest tests (308 tests)....................................................................................................................................................................................................................................................................................................................OK!
Checking XML files...

Don't really see the problem with this:

Press MouseWheelUp to select the previous tab.
Press MouseWheelDown to select the next tab.

since there are usually 1, sometimes 3, rarely 5 hotkeys per tooltip shown.

But indeed this looks nicer:

Press MouseWheelDown / MouseWheelUp to select the next / previous tab.

The former however seems a bit easier to compare (h1->k1, h2>k2 easier to read than k1/k2 assigned to h1/h2).

The 0/1 ugliness could be solved by passing { "hotkey_foo": "...", "hotkey_bar": ... }.
Then you don't have to change all of the strings either.

Every assigned key should be displayed.

Displaying "Press Unused / MouseWheelUp to select the previous / next tab" seems slightly wrong, since there is no unused key.

(Tutorial got a new call in D1184)

ffffffff added a comment.EditedFeb 6 2018, 10:59 AM

Ah didn't know you made also a patch for this. (D1264)

How we get along with this?

D1264 got less changes in overall code by keeping the %(hotkey)s option as first hotkey object in colorizeHotkey function and then continue counting for further hotkey strings as %(hotkey1)s, %(hotkey2)s and so forth.

Further more it unifies summary tabs tooltip and tab buttons tooltip. But that can be done in a seperate patch or in this patch.

So i can either review this patch or one review mine and we take mine..

Ah and btw it seems @vladislavbelov can not finally review my patch D856 at the moment. Do you can have a look on it? Thx :)

ffffffff added inline comments.Feb 6 2018, 11:29 AM
binaries/data/mods/public/gui/common/tab_buttons.js
47

return empty string by colorizeHotkeys instead of unassigned hotkey string

bb abandoned this revision.Apr 27 2018, 4:31 PM

Got lesser and lesser convinced of this patch over time...