Skip to content

Added category filtering for hotkeys in settings window - #9957

Open
pazam-h2 wants to merge 8 commits into
ihhub:masterfrom
Dorel-M:hotkey-category-filter
Open

pazam-h2 wants to merge 8 commits into
ihhub:masterfrom
Dorel-M:hotkey-category-filter

Conversation

@pazam-h2

@pazam-h2 pazam-h2 commented Jul 1, 2025

Copy link
Copy Markdown
Contributor

This PR adds a visual category selector to the Hotkeys settings dialog, allowing users to filter hotkeys by category.
The category names are displayed in a 2-line layout above the hotkey list. Selecting a category filters the list accordingly.

EDIT 1: the placement of the categories have been changed to be on the left side as an organized list.

EDIT 2: added an 'All' button to have the hotkeys list unfiltered.

EDIT 3: added Category sub-title

from:
image

To:
image

Closes #9940

@pazam-h2

This comment was marked as outdated.

@ihhub

ihhub commented Jul 2, 2025

Copy link
Copy Markdown
Owner

Hi @pazam-h2 , this implementation contradicts the overall UX design of the game: none of text elements are clickable. An ideal solution it to embed these categories into the list itself.

@pazam-h2

pazam-h2 commented Jul 2, 2025

Copy link
Copy Markdown
Contributor Author

Changed from text elements to just a list.
Image updated on opening post.

@zenseii zenseii added improvement New feature, request or improvement ui UI/GUI related stuff labels Jul 6, 2025
@zenseii zenseii added this to the 1.1.10 milestone Jul 6, 2025
@ihhub ihhub modified the milestones: 1.1.10, 1.1.11 Jul 20, 2025
@ihhub

ihhub commented Jul 27, 2025

Copy link
Copy Markdown
Owner

Hi @pazam-h2 , could you please provide a screenshot of the window for the original 640x480 resolution?

@ihhub ihhub left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @pazam-h2 , I added several comments in this pull request. Could you please take a look?

Comment thread src/fheroes2/game/game_hotkeys.h Outdated
Comment thread src/fheroes2/game/game_hotkeys.cpp Outdated
Comment thread src/fheroes2/dialog/dialog_hotkeys.cpp Outdated
Comment thread src/fheroes2/dialog/dialog_hotkeys.cpp
Comment thread src/fheroes2/dialog/dialog_hotkeys.cpp Outdated
Comment thread src/fheroes2/dialog/dialog_hotkeys.cpp Outdated
Comment thread src/fheroes2/dialog/dialog_hotkeys.cpp Outdated
Comment thread src/fheroes2/dialog/dialog_hotkeys.cpp Outdated
Comment thread src/fheroes2/dialog/dialog_hotkeys.cpp Outdated
Comment thread src/fheroes2/dialog/dialog_hotkeys.cpp Outdated
@ihhub
ihhub marked this pull request as draft July 29, 2025 11:45
@ihhub

ihhub commented Aug 30, 2025

Copy link
Copy Markdown
Owner

I don't think that this is a good design solution for the original resolution:

image

@ihhub ihhub modified the milestones: 1.1.11, 1.1.12 Sep 14, 2025
@ihhub ihhub modified the milestones: 1.1.12, 1.1.13 Nov 9, 2025
@ihhub ihhub modified the milestones: 1.1.13, 1.2.0 Dec 20, 2025
@pazam-h2
pazam-h2 force-pushed the hotkey-category-filter branch from 58aa00c to 7efc094 Compare June 10, 2026 21:49
@pazam-h2

Copy link
Copy Markdown
Contributor Author

Addressed the review comments:

  • Removed std::set and unique category extraction.
  • Removed the temporary ALL enum value.
  • Added "All" only inside the hotkeys dialog.
  • Iterates directly over HotKeyCategory enum values.
  • Moved category drawing into a helper function.
  • Updates the hotkey list only when selecting a different category.
  • Shortened the visible category labels.

Attached is an image with resolution 640x480 after adjusted values (keeping it the exact same window size):

Screenshot 2026-06-11 003932

@ihhub ihhub left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @pazam-h2 , I added several comments here. Can you please check them?

Comment thread src/fheroes2/dialog/dialog_hotkeys.cpp
Comment thread src/fheroes2/dialog/dialog_hotkeys.cpp Outdated
Comment thread src/fheroes2/dialog/dialog_hotkeys.cpp Outdated
Comment thread src/fheroes2/dialog/dialog_hotkeys.cpp Outdated
Comment on lines +63 to +79
const char * getHotKeyCategoryDisplayName( const Game::HotKeyCategory category )
{
switch ( category ) {
case Game::HotKeyCategory::DEFAULT:
return "Default";
case Game::HotKeyCategory::GLOBAL:
return "Global";
case Game::HotKeyCategory::BATTLE:
return "Battle";
case Game::HotKeyCategory::TOWN:
return "Town";
case Game::HotKeyCategory::ARMY:
return "Army";
default:
return Game::getHotKeyCategoryName( category );
}
}

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please explain why we don't use Game::getHotKeyCategoryName(0 function instead?

@pazam-h2 pazam-h2 Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used a separate display-name helper here because the category list has much less horizontal space than the popup/title text, and some of the existing names from Game::getHotKeyCategoryName() overlap the next column.

For example, labels like "Default Action", "Global Action", "Battle Screen", "Town Screen" and "Army Action" are clear in a popup, but in the left-side category list they make the dialog feel more crowded. The shorter labels "Default", "Global", "Battle", "Town" and "Army" seem easier to scan as filter names.

I understand that duplicating names is not ideal, but that's the solution I found. If you still prefer I can keep using Game::getHotKeyCategoryName() and adjust this in another way.
My intention was only to make the category list more compact and readable.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pazam-h2 and @ihhub We should uGame::getHotKeyCategoryName() because the category name will have to be shortened anyway in case there's a translation that is too long. Take Danish for instance ( Verdenskor should be Verdenskort ):
image

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zenseii
Makes sense. I see @ihhub has now switched it to Game::getHotKeyCategoryName() and adjusted the dialog width accordingly, which should handle this more consistently across translations.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ihhub -
Widening the dialog was a fix I tried at the start of this PR, and it got rejected for the reason that the dialog cuts off at 640x480 resolution with that width.

I don't mind it at all, just making sure it won't be overlooked.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @pazam-h2 , I am still making the changes so please wait for the end result :)

@ihhub
ihhub marked this pull request as ready for review June 22, 2026 04:05
@pazam-h2
pazam-h2 requested a review from ihhub June 27, 2026 23:40
@zenseii

zenseii commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

@ihhub and @pazam-h2. Personally I think Pazam's implementation is convenient because it requires less use of the scroll bar and as such it gives quicker access to the desired category.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement New feature, request or improvement ui UI/GUI related stuff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Categories in the Hotkey Options Screen

3 participants