From e904c1deda48f005ea0f447df6942523dff35d9f Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Sun, 1 Dec 2013 15:36:28 +0400 Subject: [PATCH 01/16] gui/widget/menue.cpp: fix 15b2b2ec050f23dc09c93c34c389ccba013b118b --- src/gui/widget/menue.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 0c991e369..b6e59d197 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -1220,7 +1220,7 @@ int CMenuOptionNumberChooser::getWidth(void) int w1 = 0; if (_lower_bound < 0) { w1 += g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth("-", true); - lower_bound *= -1; + _lower_bound *= -1; } while (_lower_bound > 0) { w1 += m; From 101fe3a4b80caa6ad5ab5955ce7d869254ae2163 Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Mon, 11 Nov 2013 10:02:32 +0100 Subject: [PATCH 02/16] CScanSetup: Remove duplicate separator line from cable scanmenu --- src/gui/scan_setup.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/scan_setup.cpp b/src/gui/scan_setup.cpp index 735a4f437..28fec9539 100644 --- a/src/gui/scan_setup.cpp +++ b/src/gui/scan_setup.cpp @@ -435,7 +435,7 @@ int CScanSetup::showScanMenu() r_system = DVB_C; //-------------------------------------------------------------- - settings->addItem(GenericMenuSeparatorLine); + //settings->addItem(GenericMenuSeparatorLine); //-------------------------------------------------------------- //tune timeout if(CFEManager::getInstance()->getFrontendCount() <= 1) { From cbfd0970601d1cb2e9012d2fb46f67508a03c294 Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Sun, 1 Dec 2013 13:46:42 +0100 Subject: [PATCH 03/16] neutrino: disable infoclock while eventlist is displayed via usermenu --- src/neutrino.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index be6e57fe9..014b184b7 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -2237,9 +2237,11 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) // eventlist if (g_settings.personalize[SNeutrinoSettings::P_MAIN_RED_BUTTON] == CPersonalizeGui::PERSONALIZE_ACTIVE_MODE_ENABLED)// EventList Menu - Personalization Check { + InfoClock->enableInfoClock(false); StopSubtitles(); usermenu.showUserMenu(SNeutrinoSettings::BUTTON_RED); StartSubtitles(); + InfoClock->enableInfoClock(true); } else ShowHintUTF(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_PERSONALIZE_MENUDISABLEDHINT),450, 10); From fcb7b88ff0433ab5f3e16a037df4115b05874d7e Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 1 Dec 2013 22:37:43 +0100 Subject: [PATCH 04/16] CInfoViewer: use correct corners and text color for time display Assigning of these properties are required after theme or color changes. --- src/gui/infoviewer.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index 4517a8e0b..04c26de48 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -256,14 +256,16 @@ void CInfoViewer::paintTime (bool show_dot) if (clock == NULL){ clock = new CComponentsFrmClock(); - clock->setCorner(RADIUS_LARGE, CORNER_TOP_RIGHT); clock->doPaintBg(false); } + clock->setColorBody(COL_INFOBAR_PLUS_0); + clock->setCorner(RADIUS_LARGE, CORNER_TOP_RIGHT); clock->setDimensionsAll(clock_x, clock_y, clock_w, clock_h); clock->setClockFont(SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME); clock->setClockFormat(show_dot ? "%H:%M" : "%H.%M"); - + clock->setTextColor(COL_INFOBAR_TEXT); + clock->paint(CC_SAVE_SCREEN_NO); } From afe8427b2b6dd175ed141b197db17b66e14e73e2 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Mon, 2 Dec 2013 11:49:39 +0400 Subject: [PATCH 05/16] gui/scan.cpp: fix memleak --- src/gui/scan.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/scan.cpp b/src/gui/scan.cpp index a2f9c6654..9c49918b2 100644 --- a/src/gui/scan.cpp +++ b/src/gui/scan.cpp @@ -452,10 +452,10 @@ int CScanTs::handleMsg(neutrino_msg_t msg, neutrino_msg_data_t data) CVolume::getInstance()->setVolume(msg); break; default: - if ((msg >= CRCInput::RC_WithData) && (msg < CRCInput::RC_WithData + 0x10000000)) - delete[] (unsigned char*) data; break; } + if ((msg >= CRCInput::RC_WithData) && (msg < CRCInput::RC_WithData + 0x10000000)) + delete[] (unsigned char*) data; return msg; } From be142c1e4af38bf8a21321b4d4601ebf3c383641 Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Tue, 3 Dec 2013 08:57:03 +0100 Subject: [PATCH 06/16] CTimeOSD: Restoring infoclock after hiding osdtime --- src/gui/timeosd.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/timeosd.cpp b/src/gui/timeosd.cpp index c7ea16720..beb571812 100644 --- a/src/gui/timeosd.cpp +++ b/src/gui/timeosd.cpp @@ -139,13 +139,13 @@ void CTimeOSD::hide() if(!visible) return; - InfoClock->enableInfoClock(true); - //GetDimensions(); frameBuffer->paintBackgroundBoxRel(m_xend - m_width - t1, m_y, m_width, m_height); timescale->reset(); frameBuffer->paintBackgroundBoxRel(m_xstart-2, m_y, 2+BARLEN+2, m_height); //clear border visible=false; + + InfoClock->enableInfoClock(true); } void CTimeOSD::switchMode(int position, int duration) From 32661dd6fc3fa76a7fb3be3d910dcdd5dd3ce083 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Mon, 2 Dec 2013 00:52:55 +0100 Subject: [PATCH 07/16] paintButtons: fix auto-spacing of buttins / labels in space-restricted setups, buttons would be painted outside of the assigned space due to errors in position calculations --- src/gui/widget/buttons.cpp | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/src/gui/widget/buttons.cpp b/src/gui/widget/buttons.cpp index 647bcc80b..0143c6d76 100644 --- a/src/gui/widget/buttons.cpp +++ b/src/gui/widget/buttons.cpp @@ -99,7 +99,8 @@ int paintButtons( const int &x, int w_text = 0; int h_max_text = font->getHeight(); - int count_items = 0; + int count_icons = 0; + int count_labels = 0; /* more than 16 buttons? noooooo*/ int iconw[16]; int iconh[16]; @@ -133,16 +134,18 @@ int paintButtons( const int &x, h_max_icon = std::max(h_max_icon, h); w_icons += w; if (w) - count_items++; + count_icons++; - //text - buttontext[i] = (content[i].locale ? g_Locale->getText(content[i].locale) : ""); - - //text width - fwidth[i] = font->getRenderWidth(buttontext[i], true); - w_text += fwidth[i]; - if (fwidth[i]) - count_items++; + if (content[i].locale) { + buttontext[i] = g_Locale->getText(content[i].locale); + //text width + fwidth[i] = font->getRenderWidth(buttontext[i], true); + w_text += fwidth[i]; + count_labels++; + } else { + buttontext[i] = ""; + fwidth[i] = 0; + } } //calculate button heigth @@ -161,23 +164,24 @@ int paintButtons( const int &x, //baseline int y_base = y_footer + h_footer/2; - int spacing = maxwidth - w_space * 2 - w_text - w_icons - (count_items - 1) * h_space; + int spacing = maxwidth - w_space * 2 - w_text - w_icons - (count_icons + count_labels - 1) * h_space; #if 0 /* debug */ fprintf(stderr, "PB: sp %d mw %d w_t %d w_i %d w_s %d c_i %d\n", spacing, maxwidth, w_text, w_icons, w_space, count_items); #endif + if (fwidth[cnt - 1] == 0) /* divisor needs to be labels+1 unless rightmost icon has a label */ + count_labels++; /* side effect: we don't try to divide by 0 :-) */ if (spacing >= 0) { /* add half of the inter-object space to the */ - spacing /= (int)count; /* left and right (this might break vertical */ + spacing /= count_labels; /* left and right (this might break vertical */ x_button += spacing / 2; /* alignment, but nobody is using this (yet) */ } /* and I'm don't know how it should work. */ else { - spacing /= (int)(count - 1); /* one space less than buttons */ - /* shorten captions */ + /* shorten captions relative to their length */ for (i = 0; i < cnt; i++) - fwidth[i] += spacing; /* spacing is negative...*/ + fwidth[i] = (fwidth[i] * (w_text + spacing)) / w_text; /* spacing is negative...*/ spacing = 0; } @@ -221,7 +225,9 @@ int paintButtons( const int &x, else { /* increase x position */ - x_button = x_caption + fwidth[j] + spacing + h_space; + x_button = x_caption; + if (fwidth[j]) + x_button += fwidth[j] + spacing + h_space; } } From ef78791ec2fef35cab2889b025395922dcc69508 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Tue, 3 Dec 2013 12:38:28 +0100 Subject: [PATCH 08/16] - cc_frm_clock.cpp: add space as a possible seperator --- src/gui/components/cc_frm_clock.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gui/components/cc_frm_clock.cpp b/src/gui/components/cc_frm_clock.cpp index 5ffa37582..ad0d17d9f 100644 --- a/src/gui/components/cc_frm_clock.cpp +++ b/src/gui/components/cc_frm_clock.cpp @@ -151,11 +151,10 @@ void CComponentsFrmClock::initCCLockItems() } } - int w_tmp; - int minSepWidth = (*getClockFont())->getRenderWidth(":", true); - w_tmp = (*getClockFont())->getRenderWidth(".", true); - if (w_tmp > minSepWidth) - minSepWidth = w_tmp; + int minSepWidth = 0; + minSepWidth = std::max((*getClockFont())->getRenderWidth(" ", true), minSepWidth); + minSepWidth = std::max((*getClockFont())->getRenderWidth(".", true), minSepWidth); + minSepWidth = std::max((*getClockFont())->getRenderWidth(":", true), minSepWidth); //modify available label items with current segment chars for (size_t i = 0; i < v_cc_items.size(); i++) @@ -183,6 +182,7 @@ void CComponentsFrmClock::initCCLockItems() case '0' ... '9': wtmp = (*getClockFont())->getMaxDigitWidth(); break; + case ' ': case '.': case ':': wtmp = minSepWidth; From ce7bad6e163accf681e360ffb522be595c80e902 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Tue, 3 Dec 2013 12:41:41 +0100 Subject: [PATCH 09/16] - infoviewer: use space instead of dot as seperator for clock --- src/gui/infoviewer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index 04c26de48..ab7880295 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -263,7 +263,7 @@ void CInfoViewer::paintTime (bool show_dot) clock->setCorner(RADIUS_LARGE, CORNER_TOP_RIGHT); clock->setDimensionsAll(clock_x, clock_y, clock_w, clock_h); clock->setClockFont(SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME); - clock->setClockFormat(show_dot ? "%H:%M" : "%H.%M"); + clock->setClockFormat(show_dot ? "%H:%M" : "%H %M"); clock->setTextColor(COL_INFOBAR_TEXT); clock->paint(CC_SAVE_SCREEN_NO); From c5b9786df4cd27da84e8a60d979613a92440c872 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 2 Dec 2013 21:06:20 +0100 Subject: [PATCH 10/16] color.cpp: use variable br_ Variable 'br_' is assigned a value that is never used --- src/gui/color.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/color.cpp b/src/gui/color.cpp index 4a64c54ac..d0f28b7f4 100644 --- a/src/gui/color.cpp +++ b/src/gui/color.cpp @@ -120,7 +120,7 @@ void changeBrightnessRGBRel2(RgbColor *rgb, int br) HsvColor hsv; Rgb2Hsv(rgb, &hsv); - hsv.v = br; + hsv.v = br_; Hsv2Rgb(&hsv, rgb); } From 7e4bdebba13d31e2149a161d9faed347ed1c4fe2 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 2 Dec 2013 21:20:20 +0100 Subject: [PATCH 11/16] CAudioPlayerSetup: remove redundant parent->hide() Possible null pointer dereference: parent - otherwise it is redundant to check it against null. --- src/gui/audioplayer_setup.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/audioplayer_setup.cpp b/src/gui/audioplayer_setup.cpp index 5ebee8d9a..1d952128a 100644 --- a/src/gui/audioplayer_setup.cpp +++ b/src/gui/audioplayer_setup.cpp @@ -73,7 +73,6 @@ int CAudioPlayerSetup::exec(CMenuTarget* parent, const std::string &actionKey) if(actionKey == "audioplayerdir") { - parent->hide(); CFileBrowser b; b.Dir_Mode=true; if (b.exec(g_settings.network_nfs_audioplayerdir)) From 074713bb2917db5567a760966c0b3e95be451fac Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 2 Dec 2013 21:29:31 +0100 Subject: [PATCH 12/16] CAudioPlayerGui: assign value of variable 'step' with current value Variable 'step' is reassigned a value before the old one has been used. --- src/gui/audioplayer.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index af11e3cab..3180513c9 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -511,10 +511,9 @@ int CAudioPlayerGui::show() { if (m_show_playlist && !m_playlist.empty() ) { - int step = 0; int prevselected = m_selected; + int step = msg == CRCInput::RC_page_up ? m_listmaxshow : 1; - step = msg == CRCInput::RC_page_up ? m_listmaxshow : 1; m_selected -= step; if ((prevselected-step) < 0) m_selected = m_playlist.size()-1; From 4d213e9ed930bf86ffa644cd0bfd3e23f79bf6c7 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 2 Dec 2013 21:51:41 +0100 Subject: [PATCH 13/16] CAudioPlayerGui: move scope of char *type scope can be reduced --- src/gui/audioplayer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index 3180513c9..ceae77bee 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -1195,7 +1195,6 @@ void CAudioPlayerGui::scanXmlData(xmlDocPtr answer_parser, const char *nametag, char *ptr = NULL; char *name = NULL; char *url = NULL; - char *type = NULL; time_t bitrate = 0; bool skip = true; listPos++; @@ -1208,6 +1207,7 @@ void CAudioPlayerGui::scanXmlData(xmlDocPtr answer_parser, const char *nametag, #endif // LCD_UPDATE if (usechild) { + char *type = NULL; xmlNodePtr child = element->xmlChildrenNode; while (child) { if (strcmp(xmlGetName(child), nametag) == 0) From e2d920660e523ff354bf080da85651c8893c34d2 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 2 Dec 2013 22:01:48 +0100 Subject: [PATCH 14/16] CMenuForwarder: declare some members as const Technically some member functions can be const --- src/gui/widget/menue.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gui/widget/menue.h b/src/gui/widget/menue.h index 4134bf051..6ee0da92f 100644 --- a/src/gui/widget/menue.h +++ b/src/gui/widget/menue.h @@ -217,8 +217,8 @@ class CMenuForwarder : public CMenuItem int getHeight(void) const; int getWidth(void); void setTextLocale(const neutrino_locale_t Text); - neutrino_locale_t getTextLocale(){return text;}; - CMenuTarget* getTarget(){return jumpTarget;}; + neutrino_locale_t getTextLocale() const {return text;}; + CMenuTarget* getTarget() const {return jumpTarget;}; std::string getActionKey(){return actionKey;}; int exec(CMenuTarget* parent); @@ -356,7 +356,7 @@ class CMenuOptionChooser : public CAbstractMenuOptionChooser int getWidth(void); int paint(bool selected); - std::string getOptionName() {return optionNameString;}; + std::string getOptionName()const {return optionNameString;}; int exec(CMenuTarget* parent); int isMenueOptionChooser(void) const{return 1;} @@ -502,16 +502,16 @@ class CMenuWidget : public CMenuTarget void insertItem(const uint& item_id, CMenuItem* menuItem); void removeItem(const uint& item_id); int getItemId(CMenuItem* menuItem); - int getItemsCount(){return items.size();}; + int getItemsCount()const{return items.size();}; CMenuItem* getItem(const uint& item_id); virtual void paint(); virtual void hide(); virtual int exec(CMenuTarget* parent, const std::string & actionKey); virtual std::string getName(); void setSelected(const int &Preselected){ preselected = Preselected; }; - int getSelected(){ return selected; }; + int getSelected()const { return selected; }; void move(int xoff, int yoff); - int getSelectedLine(void){return exit_pressed ? -1 : selected;}; + int getSelectedLine(void)const {return exit_pressed ? -1 : selected;}; void setWizardMode(bool _from_wizard) { from_wizard = _from_wizard;}; void enableFade(bool _enable) { fade = _enable; }; void enableSaveScreen(bool enable); From 08fed0f5d6080403551528c3b460735584bf7502 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 3 Dec 2013 20:43:35 +0100 Subject: [PATCH 15/16] CComponentsFrmClock: use only space char for minimal separator width Calculate of minimal separator width by a space char should be enough in all cases. A switch statement should be also unnecessary, if we check for digits. --- src/gui/components/cc_frm_clock.cpp | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/src/gui/components/cc_frm_clock.cpp b/src/gui/components/cc_frm_clock.cpp index ad0d17d9f..9b960aae7 100644 --- a/src/gui/components/cc_frm_clock.cpp +++ b/src/gui/components/cc_frm_clock.cpp @@ -36,6 +36,7 @@ #include #include #include +#include using namespace std; @@ -151,10 +152,9 @@ void CComponentsFrmClock::initCCLockItems() } } + //calculate minimal separator width, we use a space char...should be enough int minSepWidth = 0; - minSepWidth = std::max((*getClockFont())->getRenderWidth(" ", true), minSepWidth); - minSepWidth = std::max((*getClockFont())->getRenderWidth(".", true), minSepWidth); - minSepWidth = std::max((*getClockFont())->getRenderWidth(":", true), minSepWidth); + minSepWidth = max((*getClockFont())->getRenderWidth("\x20", true), minSepWidth); //modify available label items with current segment chars for (size_t i = 0; i < v_cc_items.size(); i++) @@ -176,20 +176,11 @@ void CComponentsFrmClock::initCCLockItems() string stmp = s_time.substr(i, 1); //get width of current segment - int wtmp; - char c = stmp.at(0); - switch (c) { - case '0' ... '9': - wtmp = (*getClockFont())->getMaxDigitWidth(); - break; - case ' ': - case '.': - case ':': - wtmp = minSepWidth; - break; - default: - wtmp = (*getClockFont())->getRenderWidth(stmp, true); - } + int wtmp = 0; + if (isdigit(stmp.at(0)) ) //check for digits, if true, we use digit width + wtmp = (*getClockFont())->getMaxDigitWidth(); + else //not digit found, we use render width or minimal width + wtmp = max((*getClockFont())->getRenderWidth(stmp, true), minSepWidth); //set size, text, color of current item lbl->setDimensionsAll(cl_x, cl_y, wtmp, cl_h); From a8f7668a9c3de1d393fbca9c54dafeefa385f3b5 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Fri, 6 Dec 2013 13:30:52 +0100 Subject: [PATCH 16/16] - yWeb: use same order in search for channellogos as neutrino --- src/nhttpd/tuxboxapi/coolstream/neutrinoapi.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.cpp b/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.cpp index e81b881c4..9fd3bf171 100644 --- a/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.cpp +++ b/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.cpp @@ -483,18 +483,18 @@ std::string CNeutrinoAPI::getLogoFile(std::string _logoURL, t_channel_id channel std::string channelName = GetServiceName(channelId); // replace(channelName, " ", "_"); _logoURL+="/"; - if(access((_logoURL + channelIdAsString + ".jpg").c_str(), 4) == 0) - return _logoURL + channelIdAsString + ".jpg"; - else if (access((_logoURL + channelIdAsString + ".png").c_str(), 4) == 0) - return _logoURL + channelIdAsString + ".png"; - else if (access((_logoURL + channelIdAsString + ".gif").c_str(), 4) == 0) - return _logoURL + channelIdAsString + ".gif"; + if (access((_logoURL + channelName + ".png").c_str(), 4) == 0) + return _logoURL + channelName + ".png"; else if (access((_logoURL + channelName + ".jpg").c_str(), 4) == 0) return _logoURL + channelName + ".jpg"; - else if (access((_logoURL + channelName + ".png").c_str(), 4) == 0) - return _logoURL + channelName + ".png"; else if (access((_logoURL + channelName + ".gif").c_str(), 4) == 0) return _logoURL + channelName + ".gif"; + else if(access((_logoURL + channelIdAsString + ".png").c_str(), 4) == 0) + return _logoURL + channelIdAsString + ".png"; + else if (access((_logoURL + channelIdAsString + ".jpg").c_str(), 4) == 0) + return _logoURL + channelIdAsString + ".jpg"; + else if (access((_logoURL + channelIdAsString + ".gif").c_str(), 4) == 0) + return _logoURL + channelIdAsString + ".gif"; else return ""; }