Skip to content

Commit

Permalink
fix(color): Don't display long press widget menu if no options (#4263)
Browse files Browse the repository at this point in the history
Co-authored-by: philmoz <[email protected]>
  • Loading branch information
philmoz and philmoz authored Oct 30, 2023
1 parent f6b119b commit b6a691f
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions radio/src/gui/colorlcd/widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,18 @@ Widget::Widget(const WidgetFactory* factory, Window* parent,

void Widget::openMenu()
{
// Widgets are placed on a full screen window which is underneath the main view menu bar
// Find the parent of this so that when the popup loads it covers the main view menu
Window* w = parent->getFullScreenWindow()->getParent();
Menu* menu = new Menu(w ? w : this);
if (fsAllowed) {
menu->addLine(STR_WIDGET_FULLSCREEN, [&]() { setFullscreen(true); });
}
if (getOptions() && getOptions()->name) {
menu->addLine(STR_WIDGET_SETTINGS,
[=]() { new WidgetSettings(this, this); });
if (getOptions() || fsAllowed) {
// Widgets are placed on a full screen window which is underneath the main view menu bar
// Find the parent of this so that when the popup loads it covers the main view menu
Window* w = parent->getFullScreenWindow()->getParent();
Menu* menu = new Menu(w ? w : this);
if (fsAllowed) {
menu->addLine(STR_WIDGET_FULLSCREEN, [&]() { setFullscreen(true); });
}
if (getOptions() && getOptions()->name) {
menu->addLine(STR_WIDGET_SETTINGS,
[=]() { new WidgetSettings(this, this); });
}
}
}

Expand Down

0 comments on commit b6a691f

Please sign in to comment.