feat(el18): Add help popup showing mapping when using hats as keys (#4359)
This commit is contained in:
@@ -42,6 +42,25 @@ void MessageDialog::onClicked()
|
||||
deleteLater();
|
||||
}
|
||||
|
||||
HelpDialog::HelpDialog(Window* parent, rect_t rect, const char* title,
|
||||
const char* message,
|
||||
LcdFlags messageFlags) :
|
||||
Dialog(parent, title, rect)
|
||||
{
|
||||
messageWidget = new StaticText(
|
||||
content,
|
||||
{0, 33, content->width(), content->height() - 33},
|
||||
message, 0, messageFlags);
|
||||
messageWidget->padAll(6);
|
||||
|
||||
setCloseWhenClickOutside(true);
|
||||
}
|
||||
|
||||
void HelpDialog::onClicked()
|
||||
{
|
||||
deleteLater();
|
||||
}
|
||||
|
||||
DynamicMessageDialog::DynamicMessageDialog(
|
||||
Window* parent, const char* title, std::function<std::string()> textHandler,
|
||||
const char* message, const int lineHeight,
|
||||
|
||||
@@ -44,6 +44,22 @@ class MessageDialog : public Dialog
|
||||
void onClicked() override;
|
||||
};
|
||||
|
||||
class HelpDialog : public Dialog
|
||||
{
|
||||
public:
|
||||
HelpDialog(Window* parent, rect_t rect, const char* title, const char* message,
|
||||
LcdFlags messageFlags = CENTERED);
|
||||
|
||||
protected:
|
||||
StaticText* messageWidget;
|
||||
|
||||
#if defined(DEBUG_WINDOWS)
|
||||
std::string getName() const override { return "HelpDialog"; }
|
||||
#endif
|
||||
|
||||
void onClicked() override;
|
||||
};
|
||||
|
||||
class DynamicMessageDialog : public Dialog
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -819,8 +819,15 @@ void RadioSetupPage::build(FormWindow * window)
|
||||
#if defined(USE_HATS_AS_KEYS)
|
||||
line = window->newLine(&grid);
|
||||
new StaticText(line, rect_t{}, STR_HATSMODE, 0, COLOR_THEME_PRIMARY1);
|
||||
new Choice(line, rect_t{}, STR_HATSOPT, HATSMODE_TRIMS_ONLY, HATSMODE_SWITCHABLE,
|
||||
GET_SET_DEFAULT(g_eeGeneral.hatsMode));
|
||||
auto box = new FormWindow(line, rect_t{});
|
||||
box->setFlexLayout(LV_FLEX_FLOW_ROW, 4);
|
||||
new Choice(box, rect_t{}, STR_HATSOPT, HATSMODE_TRIMS_ONLY,
|
||||
HATSMODE_SWITCHABLE, GET_SET_DEFAULT(g_eeGeneral.hatsMode));
|
||||
new TextButton(box, rect_t{}, "?", [=]() {
|
||||
new HelpDialog(window, {50, 100, LCD_W - 100, LCD_H - 200},
|
||||
STR_HATSMODE_KEYS, STR_HATSMODE_KEYS_HELP, LEFT);
|
||||
return 0;
|
||||
});
|
||||
#endif
|
||||
|
||||
// RX channel order
|
||||
|
||||
@@ -59,8 +59,15 @@ TrimsSetup::TrimsSetup() : Page(ICON_MODEL_SETUP)
|
||||
// Hats mode for NV14/EL18
|
||||
line = body.newLine(&grid);
|
||||
new StaticText(line, rect_t{}, STR_HATSMODE, 0, COLOR_THEME_PRIMARY1);
|
||||
new Choice(line, rect_t{}, STR_HATSOPT, HATSMODE_TRIMS_ONLY, HATSMODE_GLOBAL,
|
||||
auto box = new FormWindow(line, rect_t{});
|
||||
box->setFlexLayout(LV_FLEX_FLOW_ROW, 4);
|
||||
new Choice(box, rect_t{}, STR_HATSOPT, HATSMODE_TRIMS_ONLY, HATSMODE_GLOBAL,
|
||||
GET_SET_DEFAULT(g_model.hatsMode));
|
||||
new TextButton(box, rect_t{}, "?", [=]() {
|
||||
new HelpDialog(this, {50, 100, LCD_W - 100, LCD_H - 200},
|
||||
STR_HATSMODE_KEYS, STR_HATSMODE_KEYS_HELP, LEFT);
|
||||
return 0;
|
||||
});
|
||||
#endif
|
||||
|
||||
// Trim step
|
||||
|
||||
Reference in New Issue
Block a user