From 2dda93ed2b5cdb9a7fd9ca9a9d05944ba4a4ecdc Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 9 Feb 2017 15:52:39 +0100 Subject: [PATCH 1/3] CMenuWidget: use only nameString as container for widget name neutrino_locale_t name could be transformed always to real string to unify this container --- src/gui/widget/menue.cpp | 7 +------ src/gui/widget/menue.h | 2 +- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index cb83c00f5..d3c5d2266 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -534,8 +534,7 @@ CMenuGlobal* CMenuGlobal::getInstance() CMenuWidget::CMenuWidget() { - nameString = g_Locale->getText(NONEXISTANT_LOCALE); - name = NONEXISTANT_LOCALE; + nameString = ""; iconfile = ""; selected = -1; iconOffset = 0; @@ -555,7 +554,6 @@ CMenuWidget::CMenuWidget() CMenuWidget::CMenuWidget(const neutrino_locale_t Name, const std::string & Icon, const int mwidth, const mn_widget_id_t &w_index) { - name = Name; nameString = g_Locale->getText(Name); preselected = -1; Init(Icon, mwidth, w_index); @@ -563,7 +561,6 @@ CMenuWidget::CMenuWidget(const neutrino_locale_t Name, const std::string & Icon, CMenuWidget::CMenuWidget(const std::string &Name, const std::string & Icon, const int mwidth, const mn_widget_id_t &w_index) { - name = NONEXISTANT_LOCALE; nameString = Name; preselected = -1; Init(Icon, mwidth, w_index); @@ -729,8 +726,6 @@ CMenuItem* CMenuWidget::getItem(const uint& item_id) const char *CMenuWidget::getName() { - if (name != NONEXISTANT_LOCALE) - return g_Locale->getText(name); return nameString.c_str(); } diff --git a/src/gui/widget/menue.h b/src/gui/widget/menue.h index 5cfa58da2..6c60eef90 100644 --- a/src/gui/widget/menue.h +++ b/src/gui/widget/menue.h @@ -504,7 +504,7 @@ class CMenuWidget : public CMenuTarget, public CComponentsSignals unsigned int saveScreen_x; protected: std::string nameString; - neutrino_locale_t name; + CFrameBuffer *frameBuffer; std::vector items; std::vector page_start; From 0435ca20a322483adc1f30951841a07d0a242c38 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 9 Feb 2017 16:35:03 +0100 Subject: [PATCH 2/3] CMenuWidget: remove dub code from init --- src/gui/widget/menue.cpp | 98 ++++++++++++++++++---------------------- src/gui/widget/menue.h | 2 +- 2 files changed, 44 insertions(+), 56 deletions(-) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index d3c5d2266..d859c966b 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -534,47 +534,57 @@ CMenuGlobal* CMenuGlobal::getInstance() CMenuWidget::CMenuWidget() { - nameString = ""; - iconfile = ""; - selected = -1; + Init("", "", 0, 0); +} + +CMenuWidget::CMenuWidget(const neutrino_locale_t Name, const std::string & Icon, const int mwidth, const mn_widget_id_t &w_index) +{ + Init(g_Locale->getText(Name), Icon, mwidth, w_index); +} + +CMenuWidget::CMenuWidget(const std::string &Name, const std::string & Icon, const int mwidth, const mn_widget_id_t &w_index) +{ + Init(Name, Icon, mwidth, w_index); +} + +void CMenuWidget::Init(const std::string &NameString, const std::string &Icon, const int mwidth, const mn_widget_id_t &w_index) +{ + //pos + x = y = 0; + + //caption and icon + nameString = NameString; + iconfile = Icon; + + //basic attributes iconOffset = 0; offx = offy = 0; from_wizard = SNeutrinoSettings::WIZARD_OFF; fade = true; sb_width = 0; savescreen = false; - background = NULL; preselected = -1; + nextShortcut = 1; + current_page = 0; + has_hints = false; + brief_hints = BRIEF_HINT_NO; + hint_painted = false; + hint_height = 0; + fbutton_count = 0; + fbutton_labels = NULL; + fbutton_width = 0; + fbutton_height = 0; + saveScreen_width = 0; + saveScreen_height = 0; + + //objects + background = NULL; details_line = NULL; info_box = NULL; header = NULL; - nextShortcut = 1; - x = y = 0; -} + frameBuffer = CFrameBuffer::getInstance(); + mglobal = CMenuGlobal::getInstance(); //create CMenuGlobal instance only here -CMenuWidget::CMenuWidget(const neutrino_locale_t Name, const std::string & Icon, const int mwidth, const mn_widget_id_t &w_index) -{ - nameString = g_Locale->getText(Name); - preselected = -1; - Init(Icon, mwidth, w_index); -} - -CMenuWidget::CMenuWidget(const std::string &Name, const std::string & Icon, const int mwidth, const mn_widget_id_t &w_index) -{ - nameString = Name; - preselected = -1; - Init(Icon, mwidth, w_index); -} - -void CMenuWidget::Init(const std::string &Icon, const int mwidth, const mn_widget_id_t &w_index) -{ - mglobal = CMenuGlobal::getInstance(); //create CMenuGlobal instance only here - frameBuffer = CFrameBuffer::getInstance(); - iconfile = Icon; - details_line = NULL; - - info_box = NULL; - header = NULL; //handle select values if(w_index > MN_WIDGET_ID_MAX){ //error @@ -589,40 +599,18 @@ void CMenuWidget::Init(const std::string &Icon, const int mwidth, const mn_widge //overwrite preselected value with global select value selected = (widget_index == NO_WIDGET_ID ? preselected : mglobal->v_selected[widget_index]); - + //dimension min_width = 0; width = 0; /* is set in paint() */ - - if (mwidth > 100) - { + if (mwidth > 100){ /* warn about abuse until we found all offenders... */ fprintf(stderr, "Warning: %s (%s) (%s) mwidth over 100%%: %d\n", __FUNCTION__, nameString.c_str(), Icon.c_str(), mwidth); } - else - { + else{ min_width = frameBuffer->getScreenWidth(true) * mwidth / 100; if(min_width > (int) frameBuffer->getScreenWidth()) min_width = frameBuffer->getScreenWidth(); } - - current_page = 0; - offx = offy = 0; - from_wizard = SNeutrinoSettings::WIZARD_OFF; - fade = true; - savescreen = false; - background = NULL; - has_hints = false; - brief_hints = BRIEF_HINT_NO; - hint_painted = false; - hint_height = 0; - fbutton_count = 0; - fbutton_labels = NULL; - fbutton_width = 0; - fbutton_height = 0; - nextShortcut = 1; - saveScreen_width = 0; - saveScreen_height = 0; - x = y = 0; } void CMenuWidget::move(int xoff, int yoff) diff --git a/src/gui/widget/menue.h b/src/gui/widget/menue.h index 6c60eef90..bc58f3d9b 100644 --- a/src/gui/widget/menue.h +++ b/src/gui/widget/menue.h @@ -544,7 +544,7 @@ class CMenuWidget : public CMenuTarget, public CComponentsSignals bool washidden; int nextShortcut; - void Init(const std::string & Icon, const int mwidth, const mn_widget_id_t &w_index); + void Init(const std::string &NameString, const std::string & Icon, const int mwidth, const mn_widget_id_t &w_index); virtual void paintItems(); void checkHints(); void calcSize(); From a56bb97b50c59be5dc71bf7703c8bec8f2edf8d4 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 9 Feb 2017 22:40:38 +0100 Subject: [PATCH 3/3] Revert "CChannelList: delete with red yes button" This reverts commit 36896849689c552989cf365984de546a4ed5282a. User request: Is not desired --- src/gui/channellist.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index efa09a771..c28a6bbe5 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -2660,7 +2660,7 @@ void CChannelList::deleteChannel(bool ask) if (!bouquet || !bouquet->zapitBouquet) return; - if (ask && ShowMsg(LOCALE_FILEBROWSER_DELETE, (*chanlist)[selected]->getName(), CMsgBox::mbrYes, CMsgBox::mbNoYes)!=CMsgBox::mbrYes) + if (ask && ShowMsg(LOCALE_FILEBROWSER_DELETE, (*chanlist)[selected]->getName(), CMsgBox::mbrNo, CMsgBox::mbYes|CMsgBox::mbNo)!=CMsgBox::mbrYes) return; bouquet->zapitBouquet->removeService((*chanlist)[selected]->getChannelID());