Skip to content

fix(color): fix issues with quick menu, favorites and key shortcuts#7351

Open
philmoz wants to merge 3 commits into
mainfrom
philmoz/fix-qm-nav
Open

fix(color): fix issues with quick menu, favorites and key shortcuts#7351
philmoz wants to merge 3 commits into
mainfrom
philmoz/fix-qm-nav

Conversation

@philmoz
Copy link
Copy Markdown
Collaborator

@philmoz philmoz commented May 9, 2026

Fixes:

3.0 only.

Summary by CodeRabbit

  • New Features

    • Improved Quick Menu layout with consistent button sizing and spacing.
  • Bug Fixes

    • Fixed Quick Menu favorites validation to prevent access to removed or changed selections.
    • Improved hardware key handling for more consistent navigation behavior.
  • UI/UX Updates

    • Updated page titles and labels across Model Settings and Radio Settings menus for clearer navigation hierarchy.

Review Change Stack

@philmoz philmoz added this to the 3.0 milestone May 9, 2026
@philmoz philmoz added color Related generally to color LCD radios UX-UI Related to user experience (UX) or user interface (UI) behaviour bug/regression ↩️ A new version of EdgeTX broke something labels May 9, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 17, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 05314340-00c1-4994-9f81-fbaec35aa2ae

📥 Commits

Reviewing files that changed from the base of the PR and between c0c57ff and 954f908.

📒 Files selected for processing (2)
  • radio/src/gui/colorlcd/libui/page.cpp
  • radio/src/gui/colorlcd/model/model_select.cpp
🚧 Files skipped from review as they are similar to previous changes (2)
  • radio/src/gui/colorlcd/libui/page.cpp
  • radio/src/gui/colorlcd/model/model_select.cpp

📝 Walkthrough

Walkthrough

This PR refactors hardware key event handling across the UI framework by consolidating per-button press/long-press handlers into a unified doKeyShortcut(event_t) virtual dispatch method. It updates Quick Menu layout constants and adds favorites validation to prevent crashes, plus refreshes UI string labels across model and radio setup pages.

Changes

Hardware Key Shortcut Dispatch and Quick Menu Updates

Layer / File(s) Summary
NavWindow virtual dispatch hook and key delegation
radio/src/gui/colorlcd/libui/window.h, radio/src/gui/colorlcd/libui/window.cpp
NavWindow introduces doKeyShortcut(event_t) virtual hook, converts per-button handlers from inline no-ops to out-of-line declarations, and implements them to forward key events using EVT_KEY_BREAK/EVT_KEY_LONG constants.
Page key shortcut override implementation
radio/src/gui/colorlcd/libui/page.h, radio/src/gui/colorlcd/libui/page.cpp
Page replaces six per-button handler declarations with single doKeyShortcut(event_t) override that queries shortcuts, opens Quick Menu when indicated, or cancels and forwards to active NavWindow.
ViewMain and PageGroup key shortcut consolidation
radio/src/gui/colorlcd/mainview/view_main.h, radio/src/gui/colorlcd/mainview/view_main.cpp, radio/src/gui/colorlcd/setup_menus/pagegroup.h, radio/src/gui/colorlcd/setup_menus/pagegroup.cpp, radio/src/gui/colorlcd/model/model_select.h, radio/src/gui/colorlcd/model/model_select.cpp
ViewMain, PageGroupBase, and ModelLabelsWindow each remove per-button handlers and declare doKeyShortcut(event_t) override; ModelLabelsWindow conditionally forwards non-favorites shortcuts to navWindow().
Quick Menu sizing migration and layout consolidation
radio/src/gui/colorlcd/setup_menus/quick_menu.h, radio/src/gui/colorlcd/setup_menus/quick_menu.cpp, radio/src/gui/colorlcd/setup_menus/quick_menu_group.h, radio/src/gui/colorlcd/setup_menus/quick_menu_group.cpp, radio/src/gui/colorlcd/radio/preview_window.cpp
Layout constants (GRP_W, GRP_H) now derive from QuickMenu button sizing rather than QuickMenuGroup; new isInMenu() and isFavoritesMenu() helpers added; QuickMenuGroup sizing constants removed; layout calculations across components updated.
Quick Menu favorites validation and reset logic
radio/src/gui/colorlcd/setup_menus/quick_menu.h, radio/src/gui/colorlcd/setup_menus/quick_menu.cpp, radio/src/gui/colorlcd/setup_menus/quick_menu_favorites.cpp
openQM validates favorites entries still exist in list before opening; QMFavoritesPage calls resetFavorites() on changes and uses conditional reset logic guarded by isFavoritesMenu(). Prevents crash when deleted shortcuts are accessed.
UI label string constant updates
radio/src/gui/colorlcd/model/function_switches.cpp, radio/src/gui/colorlcd/model/model_heli.cpp, radio/src/gui/colorlcd/model/model_setup.cpp, radio/src/gui/colorlcd/model/model_usbjoystick.cpp, radio/src/gui/colorlcd/model/preflight_checks.cpp, radio/src/gui/colorlcd/model/throttle_params.cpp, radio/src/gui/colorlcd/model/timer_setup.cpp, radio/src/gui/colorlcd/model/trainer_setup.cpp, radio/src/gui/colorlcd/module/module_setup.cpp, radio/src/gui/colorlcd/radio/radio_setup.cpp, radio/src/gui/colorlcd/setup_menus/key_shortcuts.cpp
Replaces STR_MAIN_MENU_MODEL_SETTINGS with STR_MAIN_MODEL_SETTINGS and STR_MAIN_MENU_RADIO_SETTINGS with STR_MAIN_RADIO_SETTINGS across page title/label arguments. Affects model, radio, and key shortcuts setup pages.
Debug cleanup
radio/src/edgetx.cpp
Removes debug TRACE logging statement from validateLSV2Range(); surrounding logic unchanged.

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 6.52% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The description covers the key fixes but lacks a formatted 'Fixes #' section and detailed summary structure per the template. Add 'Fixes #7336' at the top in the template format and expand summary with more structured detail.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main changes: fixing quick menu navigation, favorites handling, key shortcuts, and layout issues.
Linked Issues check ✅ Passed The PR addresses issue #7336 by preventing crashes when deleted favorites are clicked, making Quick Menu state consistent, and updating UI immediately.
Out of Scope Changes check ✅ Passed All changes focus on quick menu refactoring, key shortcut consolidation, and string constant updates directly related to the stated objectives.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch philmoz/fix-qm-nav

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
radio/src/gui/colorlcd/model/model_select.cpp (1)

546-549: ⚡ Quick win

Avoid forwarding through the page being closed.

Line 546 snapshots navWindow() before onCancel(), so Line 549 can dispatch back through the current ModelLabelsWindow after it has already been marked _deleted. Re-resolve the active nav window after closing instead of using the stale pointer.

Proposed change
   QMPage pg = g_eeGeneral.getKeyShortcut(event);
   if (pg != QM_MANAGE_MODELS) {
-    auto p = navWindow();
-    if (p) {
-      onCancel();
-      p->doKeyShortcut(event);
-    }
+    onCancel();
+    auto top = Window::topWindow();
+    if (top && top->isNavWindow()) {
+      static_cast<NavWindow*>(top)->doKeyShortcut(event);
+    }
   }
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@radio/src/gui/colorlcd/model/model_select.cpp` around lines 546 - 549, The
code captures navWindow() into p before calling onCancel(), which may mark the
current ModelLabelsWindow as _deleted and cause p->doKeyShortcut(event) to
dispatch through a stale window; instead, call onCancel() first and then
re-query navWindow() (e.g., auto p2 = navWindow()) and call
p2->doKeyShortcut(event) only if p2 is non-null, ensuring you do not forward
events through the page that was just closed (references: navWindow(),
onCancel(), doKeyShortcut(event), ModelLabelsWindow, _deleted).
radio/src/gui/colorlcd/libui/page.cpp (1)

142-145: ⚡ Quick win

Resolve the target nav window after closing the page.

Line 142 captures the current NavWindow before onCancel(), so on a regular page this is usually this. Line 145 then re-enters doKeyShortcut() on a window already marked _deleted, which currently works only because deleteLater() is deferred.

Proposed change
   if (pg == QM_OPEN_QUICK_MENU) {
     QuickMenu::openQuickMenu();
   } else {
-    auto p = navWindow();
-    if (p) {
-      onCancel();
-      p->doKeyShortcut(event);
-    }
+    onCancel();
+    auto top = Window::topWindow();
+    if (top && top->isNavWindow()) {
+      static_cast<NavWindow*>(top)->doKeyShortcut(event);
+    }
   }
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@radio/src/gui/colorlcd/libui/page.cpp` around lines 142 - 145, The code
captures the NavWindow via navWindow() into p before calling onCancel(), which
can mark the page deleted and leave p pointing to a deleted window; instead,
call onCancel() first and then re-resolve the target NavWindow by calling
navWindow() again (e.g., p = navWindow()) and only then invoke
p->doKeyShortcut(event); also guard the re-resolved pointer for
null/invalid/_deleted state before calling doKeyShortcut to avoid re-entering a
deleted window.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@radio/src/gui/colorlcd/setup_menus/quick_menu.cpp`:
- Around line 325-335: The favorites validation is comparing against the stale
instance state curPage instead of the requested page newCurPage; change the loop
check to compare favoritesMenuItems[i].qmPage to newCurPage (the page being
opened) and, if not found, clear the pending group and reset newCurPage to
QM_NONE (instead of mutating curPage). Update the block that touches
newPageGroup/ICON_QM_FAVORITES/favoritesMenuItems so validation uses newCurPage
and only assign curPage after this validation passes.

---

Nitpick comments:
In `@radio/src/gui/colorlcd/libui/page.cpp`:
- Around line 142-145: The code captures the NavWindow via navWindow() into p
before calling onCancel(), which can mark the page deleted and leave p pointing
to a deleted window; instead, call onCancel() first and then re-resolve the
target NavWindow by calling navWindow() again (e.g., p = navWindow()) and only
then invoke p->doKeyShortcut(event); also guard the re-resolved pointer for
null/invalid/_deleted state before calling doKeyShortcut to avoid re-entering a
deleted window.

In `@radio/src/gui/colorlcd/model/model_select.cpp`:
- Around line 546-549: The code captures navWindow() into p before calling
onCancel(), which may mark the current ModelLabelsWindow as _deleted and cause
p->doKeyShortcut(event) to dispatch through a stale window; instead, call
onCancel() first and then re-query navWindow() (e.g., auto p2 = navWindow()) and
call p2->doKeyShortcut(event) only if p2 is non-null, ensuring you do not
forward events through the page that was just closed (references: navWindow(),
onCancel(), doKeyShortcut(event), ModelLabelsWindow, _deleted).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f0c4c83a-a332-4063-8ce1-3c8b431e692f

📥 Commits

Reviewing files that changed from the base of the PR and between 00d7544 and c0c57ff.

📒 Files selected for processing (28)
  • radio/src/edgetx.cpp
  • radio/src/gui/colorlcd/libui/page.cpp
  • radio/src/gui/colorlcd/libui/page.h
  • radio/src/gui/colorlcd/libui/window.cpp
  • radio/src/gui/colorlcd/libui/window.h
  • radio/src/gui/colorlcd/mainview/view_main.cpp
  • radio/src/gui/colorlcd/mainview/view_main.h
  • radio/src/gui/colorlcd/model/function_switches.cpp
  • radio/src/gui/colorlcd/model/model_heli.cpp
  • radio/src/gui/colorlcd/model/model_select.cpp
  • radio/src/gui/colorlcd/model/model_select.h
  • radio/src/gui/colorlcd/model/model_setup.cpp
  • radio/src/gui/colorlcd/model/model_usbjoystick.cpp
  • radio/src/gui/colorlcd/model/preflight_checks.cpp
  • radio/src/gui/colorlcd/model/throttle_params.cpp
  • radio/src/gui/colorlcd/model/timer_setup.cpp
  • radio/src/gui/colorlcd/model/trainer_setup.cpp
  • radio/src/gui/colorlcd/module/module_setup.cpp
  • radio/src/gui/colorlcd/radio/preview_window.cpp
  • radio/src/gui/colorlcd/radio/radio_setup.cpp
  • radio/src/gui/colorlcd/setup_menus/key_shortcuts.cpp
  • radio/src/gui/colorlcd/setup_menus/pagegroup.cpp
  • radio/src/gui/colorlcd/setup_menus/pagegroup.h
  • radio/src/gui/colorlcd/setup_menus/quick_menu.cpp
  • radio/src/gui/colorlcd/setup_menus/quick_menu.h
  • radio/src/gui/colorlcd/setup_menus/quick_menu_favorites.cpp
  • radio/src/gui/colorlcd/setup_menus/quick_menu_group.cpp
  • radio/src/gui/colorlcd/setup_menus/quick_menu_group.h
💤 Files with no reviewable changes (4)
  • radio/src/gui/colorlcd/setup_menus/quick_menu_group.h
  • radio/src/edgetx.cpp
  • radio/src/gui/colorlcd/mainview/view_main.cpp
  • radio/src/gui/colorlcd/setup_menus/pagegroup.cpp

Comment thread radio/src/gui/colorlcd/setup_menus/quick_menu.cpp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug/regression ↩️ A new version of EdgeTX broke something color Related generally to color LCD radios UX-UI Related to user experience (UX) or user interface (UI) behaviour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Quick Menu Favorites not been updated in QM until page exit

1 participant