From 9ebb7ff0756813c16e10060cd80f33acb29cddf1 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 18 Feb 2023 19:39:17 +0100 Subject: [PATCH] widget/menu: add setSubheadText() to set sub header text Makes it possible to set text for sub headers without addIntroItems() --- src/gui/widget/menue.cpp | 11 +++++++++++ src/gui/widget/menue.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 39faf4fc8..6855edc59 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -1620,6 +1620,17 @@ void CMenuWidget::addIntroItems(neutrino_locale_t l_subhead_text, neutrino_local addIntroItems(str, section_text, buttontype, brief_hint, separatorline); } +void CMenuWidget::setSubheadText(const std::string &s_subhead_text) +{ + subhead_text = s_subhead_text; + +} + +void CMenuWidget::setSubheadText(neutrino_locale_t l_subhead_text) +{ + setSubheadText(g_Locale->getText(l_subhead_text)); +} + void CMenuWidget::saveScreen() { if(!savescreen) diff --git a/src/gui/widget/menue.h b/src/gui/widget/menue.h index f048d2fe5..869779d86 100644 --- a/src/gui/widget/menue.h +++ b/src/gui/widget/menue.h @@ -635,6 +635,8 @@ class CMenuWidget : public CMenuTarget, public CComponentsSignals }; void addIntroItems(neutrino_locale_t l_subhead_text = NONEXISTANT_LOCALE, neutrino_locale_t section_text = NONEXISTANT_LOCALE, int buttontype = BTN_TYPE_BACK, bool brief_hint = BRIEF_HINT_NO, bool separatorline = true); void addIntroItems(const std::string &s_subhead_text, neutrino_locale_t section_text = NONEXISTANT_LOCALE, int buttontype = BTN_TYPE_BACK, bool brief_hint = BRIEF_HINT_NO, bool separatorline = true); + void setSubheadText(const std::string &s_subhead_text); + void setSubheadText(neutrino_locale_t l_subhead_text); bool hasItem(); void resetWidget(bool delete_items = false); void insertItem(const uint& item_id, CMenuItem* menuItem);