Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a structured way for handling menu shortcuts #196

Closed
29 tasks done
Tracked by #142
mengdaming opened this issue Dec 7, 2022 · 0 comments · Fixed by #232
Closed
29 tasks done
Tracked by #142

Add a structured way for handling menu shortcuts #196

mengdaming opened this issue Dec 7, 2022 · 0 comments · Fixed by #232
Assignees
Labels

Comments

@mengdaming
Copy link
Contributor

mengdaming commented Dec 7, 2022

To do list

  • Replace terminal main menu with a structured menu
    • Create a "Menu" type
      • Create "Menu Option" type
        • Add shortcut attribute and accessor
        • Add description attribute and accessor
        • Add enabler function attribute (to turn on/off a shortcut depending on context)
        • Add isEnabled() function
        • Add action function attribute (action(s) triggered on hitting the shortcut)
        • Add run() function
        • Add quit menu attribute associated to the shortcut used for quitting the current menu
        • Add menu option initializer
      • Add menu initializer
      • Add menu title attribute and accessor
      • Add possibility to add menu options to the menu
      • Add possibility to accept a "key press" event and trigger the associated menu option action
      • Add possibility to list the options available in the menu (enabled only)
    • Add mainMenu attribute to terminal
    • Add main menu initializer function
    • Add call to main menu initializer from terminal constructor
    • Refactor terminal's enterMainMenu() so that it uses the new structured menu instead of a switch/case
    • Refactor terminal's listMainMenuOptions() so that it uses the new structured menu
  • Replace terminal role menus (driver/navigator) with a structured menu
    • Add roleMenu attribute to terminal
    • Add role menu initializer function
    • Add call to role menu initializer from terminal constructor
    • Refactor terminal's startAs(role) function so that it uses the new structured menu instead of a switch/case
    • Refactor terminal's listRoleMenuOptions() so that it uses the new structured menu

Parking Lot

  • Refactor printMenuOption() so that it directly takes a menuOption instance as a parameter
  • Extract readKeyboardInput() function that can be used by any menu
@mengdaming mengdaming self-assigned this Jan 25, 2023
@mengdaming mengdaming mentioned this issue Feb 1, 2023
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

1 participant