From 3c2c889a584f96916ab86023165410e5f7dbae15 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 17 Sep 2017 13:49:56 +0200 Subject: [PATCH 1/7] CMenuItem: add members set/get info icon inside menu items Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/f0660dc66c1b8be35d9ab7e70af8522b468fe8c4 Author: Thilo Graf Date: 2017-09-17 (Sun, 17 Sep 2017) --- src/gui/widget/menue.cpp | 12 ++++++++---- src/gui/widget/menue.h | 3 ++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index a0b0d24ff..558e21b02 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -69,10 +69,7 @@ CMenuItem::CMenuItem(bool Active, neutrino_msg_t DirectKey, const char * const I else setIconName(); - if (IconName_Info_right && *IconName_Info_right) - iconName_Info_right = IconName_Info_right; - else - iconName_Info_right = NULL; + setInfoIconRight(IconName_Info_right); hintIcon = NULL; @@ -156,6 +153,13 @@ void CMenuItem::disableByCondition(const menu_item_disable_cond_t& condition) } } +void CMenuItem::setInfoIconRight(const char * const IconName_Info_right){ + if (IconName_Info_right && *IconName_Info_right) + iconName_Info_right = IconName_Info_right; + else + iconName_Info_right = NULL; +} + void CMenuItem::setMarked(const bool Marked) { marked = Marked; diff --git a/src/gui/widget/menue.h b/src/gui/widget/menue.h index 28b90282d..7e78de2ab 100644 --- a/src/gui/widget/menue.h +++ b/src/gui/widget/menue.h @@ -197,6 +197,8 @@ class CMenuItem : public CComponentsSignals void activateNotify(void); virtual void disableByCondition(const menu_item_disable_cond_t& condition); void setParentWidget(CMenuWidget* parent){parent_widget = parent;} + void setInfoIconRight(const char * const IconName_Info_right); + const char* getInfoIconRight(){return iconName_Info_right;} }; class CMenuSeparator : public CMenuItem @@ -689,7 +691,6 @@ class CLockedMenuForwarder : public CMenuForwarder, public CPINProtection : CMenuForwarder(Text, Active, Option, Target, ActionKey, DirectKey, IconName, IconName_Info_right) ,CPINProtection(_validPIN) { Ask = ask; - //if we in ask mode then show NEUTRINO_ICON_SCRAMBLED as default info icon or no icon, //but use always an info icon if defined in parameter 'IconName_Info_right' if (IconName_Info_right || ask) From 7d4e64e8f80bd9dbf44e1504bb6b61cfb5cb3fd9 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 17 Sep 2017 13:51:30 +0200 Subject: [PATCH 2/7] CPersonalizeGui: fix visualize of passive and active locked items Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/7c0d0b06d02fb5788dec1dd7585f92dacf6f7fe1 Author: Thilo Graf Date: 2017-09-17 (Sun, 17 Sep 2017) --- src/gui/personalize.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/gui/personalize.cpp b/src/gui/personalize.cpp index 8eb87b935..f43ac6e54 100644 --- a/src/gui/personalize.cpp +++ b/src/gui/personalize.cpp @@ -927,12 +927,13 @@ void CPersonalizeGui::addPersonalizedItems() use_pin = true; //set pinmode for personalize menu or for settings manager menu and if any item is pin protected - if (in_pinmode && !use_pin) + if ((in_pinmode && !use_pin)){ if (v_item[i].personalize_mode == &g_settings.personalize[SNeutrinoSettings::P_MAIN_PINSTATUS] || v_item[i].personalize_mode == &g_settings.personalize[SNeutrinoSettings::P_MSET_SETTINGS_MANAGER]) { use_pin = true; lock_icon = NEUTRINO_ICON_LOCK_PASSIVE; } + } //convert item to locked forwarder and use generated pin mode for usage as ask parameter v_item[i].menuItem = new CLockedMenuForwarder(fw->getTextLocale(), @@ -941,6 +942,15 @@ void CPersonalizeGui::addPersonalizedItems() v_item[i].menuItem->hintIcon = fw->hintIcon; v_item[i].menuItem->hint = fw->hint; + /* + * assign of visualized lock mode with lock icons for 'personalize menu' itself, + * required menu item is identified with relatetd locale that is used inside the settings menu + */ + if (fw->getTextLocale() == LOCALE_PERSONALIZE_HEAD){ + lock_icon = g_settings.personalize[SNeutrinoSettings::P_MAIN_PINSTATUS] ? NEUTRINO_ICON_LOCK : (in_pinmode ? NEUTRINO_ICON_LOCK_PASSIVE : NULL); + v_item[i].menuItem->setInfoIconRight(lock_icon); + } + //assign slot for items, causes disable/enable by condition eg: receiver mode if (v_item[i].condition != DCOND_MODE_NONE ){ sigc::slot0 sl = sigc::bind<0>(sigc::mem_fun1(v_item[i].menuItem, &CMenuForwarder::disableByCondition), v_item[i].condition); From 6603d1126e42803e7d5c72bb7f280c05a1337f4f Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 17 Sep 2017 21:50:59 +0200 Subject: [PATCH 3/7] CHintBox: fix possible unintended cut of text Last line size was not considered. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/87b53a85979678979679b93d88383d504ea2e455 Author: Thilo Graf Date: 2017-09-17 (Sun, 17 Sep 2017) --- src/gui/widget/hintbox.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/widget/hintbox.cpp b/src/gui/widget/hintbox.cpp index e0b6bfd4c..c08b31be5 100644 --- a/src/gui/widget/hintbox.cpp +++ b/src/gui/widget/hintbox.cpp @@ -268,7 +268,8 @@ void CHintBox::addHintItem(const std::string& Text, const int& text_mode, const /* pre define required info height depends of lines and minimal needed height*/ int line_breaks = CTextBox::getLines(Text); int h_font = item_font->getHeight(); - int h_lines = h_font * line_breaks; + int h_lines = h_font; + h_lines += h_font * line_breaks; /* get required height depends of possible lines and max height */ h_hint_obj = min(HINTBOX_MAX_HEIGHT - (ccw_head ? ccw_head->getHeight() : 0), h_lines + 2*w_indentation); From 41a81c11e57b6ead496a2e7a34359b4b9560c3d1 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 17 Sep 2017 22:24:44 +0200 Subject: [PATCH 4/7] CKeyChooserItem: fix possible memleak Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/5a48398bb4133b09edecfaced3aa05a112fa877b Author: Thilo Graf Date: 2017-09-17 (Sun, 17 Sep 2017) --- src/gui/widget/keychooser.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/widget/keychooser.cpp b/src/gui/widget/keychooser.cpp index 8cbf96e75..6d8f712ab 100644 --- a/src/gui/widget/keychooser.cpp +++ b/src/gui/widget/keychooser.cpp @@ -67,9 +67,9 @@ int CKeyChooserItem::exec(CMenuTarget* parent, const std::string &) // 10 seconds to choose a new key int timeout = 10; - CHintBox * hintbox = new CHintBox(name, LOCALE_KEYCHOOSER_TEXT, HINTBOX_MIN_WIDTH, NEUTRINO_ICON_SETTINGS, NEUTRINO_ICON_HINT_KEYS); - //hintbox->setTimeOut(timeout); - hintbox->paint(); + CHintBox hintbox(name, LOCALE_KEYCHOOSER_TEXT, HINTBOX_MIN_WIDTH, NEUTRINO_ICON_SETTINGS, NEUTRINO_ICON_HINT_KEYS); + //hintbox.setTimeOut(timeout); + hintbox.paint(); CFrameBuffer::getInstance()->blit(); @@ -92,7 +92,7 @@ int CKeyChooserItem::exec(CMenuTarget* parent, const std::string &) } g_RCInput->setLongPressAny(false); - hintbox->hide(); + hintbox.hide(); return res; } From 14145554aacd8c1a01e8583ce5cd5bfc900cac92 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Mon, 18 Sep 2017 08:56:02 +0200 Subject: [PATCH 5/7] fix mem leak Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/a7942c9987928990349270845f6e5a1ac12f6bfa Author: Jacek Jendrzej Date: 2017-09-18 (Mon, 18 Sep 2017) --- src/nhttpd/tuxboxapi/controlapi.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/nhttpd/tuxboxapi/controlapi.cpp b/src/nhttpd/tuxboxapi/controlapi.cpp index 215ca5d17..847bdada0 100644 --- a/src/nhttpd/tuxboxapi/controlapi.cpp +++ b/src/nhttpd/tuxboxapi/controlapi.cpp @@ -2080,18 +2080,21 @@ void CControlAPI::ScreenshotCGI(CyhookHandler *hh) if(!hh->ParamList["name"].empty()) filename = hh->ParamList["name"]; - CScreenShot * sc = new CScreenShot("/tmp/" + filename + ".png", (CScreenShot::screenshot_format_t)0 /*PNG*/); - sc->EnableOSD(enableOSD); - sc->EnableVideo(enableVideo); + CScreenShot * screenshot = new CScreenShot("/tmp/" + filename + ".png", (CScreenShot::screenshot_format_t)0 /*PNG*/); + if(screenshot){ + screenshot->EnableOSD(enableOSD); + screenshot->EnableVideo(enableVideo); #if 0 - sc->Start(); - hh->SendOk(); // FIXME what if sc->Start() failed? + screenshot->Start(); + hh->SendOk(); // FIXME what if screenshot->Start() failed? #else - if (sc->StartSync()) - hh->SendOk(); - else - hh->SendError(); + if (screenshot->StartSync()) + hh->SendOk(); + else + hh->SendError(); #endif + delete screenshot; + } } //----------------------------------------------------------------------------- From b34c510658c2d67142aa5bb3d709c87cb679475e Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Mon, 18 Sep 2017 14:11:34 +0200 Subject: [PATCH 6/7] fix memleak Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/511d953a1876e330c794559313923275ea6ce1c6 Author: Jacek Jendrzej Date: 2017-09-18 (Mon, 18 Sep 2017) --- src/neutrino.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 55b296ad5..4d3a93b59 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -3823,6 +3823,7 @@ void CNeutrinoApp::saveEpg(bool cvfd_mode) //printf("Msg %x timeout %d EVT_SI_FINISHED %x\n", msg, CRCInput::RC_timeout, NeutrinoMessages::EVT_SI_FINISHED); CVFD::getInstance()->Clear(); CVFD::getInstance()->setMode(cvfd_mode ? CVFD::MODE_SHUTDOWN : CVFD::MODE_STANDBY);// true CVFD::MODE_SHUTDOWN , false CVFD::MODE_STANDBY + delete [] (unsigned char*) data; break; } else if (!cvfd_mode){ printf("wait for epg saving, Msg %x \n", (int) msg); From 48cf627494ca422ac83326bcfa462753a4668ba2 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Mon, 18 Sep 2017 14:57:11 +0200 Subject: [PATCH 7/7] osd_setup.cpp fix memleak Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/82a0cdeb685035d99e6e6d75f1e572a50ecc85d0 Author: Jacek Jendrzej Date: 2017-09-18 (Mon, 18 Sep 2017) --- src/gui/osd_setup.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/osd_setup.cpp b/src/gui/osd_setup.cpp index 1dd760c9b..736c7f417 100644 --- a/src/gui/osd_setup.cpp +++ b/src/gui/osd_setup.cpp @@ -1516,6 +1516,7 @@ int COsdSetup::showContextChanlistMenu(CChannelList *parent_channellist) int res = menu_chanlist->exec(NULL, ""); cselected = menu_chanlist->getSelected(); + delete channellistNotifier; delete menu_chanlist; return res; }