From 2cf149f0733000f45ac912736d64c4a5e5474b2c Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 18 Mar 2019 15:53:03 +0100 Subject: [PATCH] CMenuOptionStringChooser: remember last item useful for some cases if needed, default off Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/d41b2ce0bc9989e154e77cb6b5c5ba6230c9e57a Author: Thilo Graf Date: 2019-03-18 (Mon, 18 Mar 2019) --- src/gui/widget/menue.cpp | 3 ++- src/gui/widget/menue.h | 3 ++- src/neutrino_menue.h | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 34d7a4132..a5fb99261 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -2156,6 +2156,7 @@ void CMenuOptionStringChooser::init( const std::string &OptionName, optionValuePtr = pOptionValue ? pOptionValue : &optionValue; observ = Observ; pulldown = Pulldown; + hold_last_item = false; } @@ -2197,7 +2198,7 @@ int CMenuOptionStringChooser::exec(CMenuTarget* parent) std::string title_str = title.empty() ? getName() : title; - CMenuWidget* menu = new CMenuWidget(title_str, NEUTRINO_ICON_SETTINGS); + CMenuWidget* menu = new CMenuWidget(title_str, NEUTRINO_ICON_SETTINGS, 20, hold_last_item ? MN_WIDGET_ID_MENU_SELECT_STRING : -1); menu->addIntroItems(NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, CMenuWidget::BTN_TYPE_CANCEL); //if(parent) menu->move(20, 0); CMenuSelectorTarget * selector = new CMenuSelectorTarget(&select); diff --git a/src/gui/widget/menue.h b/src/gui/widget/menue.h index af1af7e85..a3deb3b24 100644 --- a/src/gui/widget/menue.h +++ b/src/gui/widget/menue.h @@ -503,7 +503,7 @@ class CMenuOptionStringChooser : public CMenuItem std::string* pOptionValue, CChangeObserver * const Observ, bool Pulldown ); - + bool hold_last_item; public: CMenuOptionStringChooser(const neutrino_locale_t Name, std::string* OptionValue, bool Active = false, CChangeObserver* Observ = NULL, const neutrino_msg_t DirectKey = RC_NOKEY, @@ -529,6 +529,7 @@ class CMenuOptionStringChooser : public CMenuItem } std::string getOptionValue() { return *optionValuePtr; } sigc::signal OnAfterChangeOption; + void rememberLastItem(bool remember = true) {hold_last_item = remember;} }; class CMenuGlobal diff --git a/src/neutrino_menue.h b/src/neutrino_menue.h index 5e788a08d..20ae98e59 100644 --- a/src/neutrino_menue.h +++ b/src/neutrino_menue.h @@ -208,6 +208,9 @@ enum MN_WIDGET_ID //network services MN_WIDGET_ID_NETWORKSETUP_SERVICES, + //options select menue + MN_WIDGET_ID_MENU_SELECT_STRING, + MN_WIDGET_ID_MAX };