From 25909c10b626d39a462a1a421a1b61759da71fa4 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 13 Nov 2013 11:52:12 +0100 Subject: [PATCH 01/77] CTestMenu: fix build, add missing include supplement to 3845feb0e40a9d67d4bd4901def78beaf32b2611 Signed-off-by: Thilo Graf --- src/gui/test_menu.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index d2380fdd3..5e6138207 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -37,6 +37,7 @@ #include #include +#include #include #include From 9f563d720953909ff97c6870bf22d8b1f67e14ae Mon Sep 17 00:00:00 2001 From: martii Date: Sat, 9 Nov 2013 16:28:41 +0100 Subject: [PATCH 02/77] system/localize: change memory allocation, no user-visible changes --- src/system/localize.cpp | 86 ++++++++++++++++++++++------------------- src/system/localize.h | 3 ++ 2 files changed, 49 insertions(+), 40 deletions(-) diff --git a/src/system/localize.cpp b/src/system/localize.cpp index 220f0b3d4..61c67b8af 100644 --- a/src/system/localize.cpp +++ b/src/system/localize.cpp @@ -43,6 +43,9 @@ #include #include #include +#include +#include +#include //static const char * iso639filename = "/usr/share/iso-codes/iso-639.tab"; static const char * iso639filename = "/share/iso-codes/iso-639.tab"; @@ -86,80 +89,80 @@ const char * getISO639Description(const char * const iso) CLocaleManager::CLocaleManager() { localeData = new char * [sizeof(locale_real_names)/sizeof(const char *)]; - for (unsigned int i = 0; i < (sizeof(locale_real_names)/sizeof(const char *)); i++) - localeData[i] = (char *)locale_real_names[i]; - defaultData = new char * [sizeof(locale_real_names)/sizeof(const char *)]; - for (unsigned int i = 0; i < (sizeof(locale_real_names)/sizeof(const char *)); i++) - defaultData[i] = (char *)locale_real_names[i]; + memcpy(localeData, locale_real_names, sizeof(locale_real_names)); + memcpy(defaultData, locale_real_names, sizeof(locale_real_names)); + defaultDataMem = localeDataMem = NULL; loadLocale(DEFAULT_LOCALE, true); } CLocaleManager::~CLocaleManager() { - for (unsigned j = 0; j < (sizeof(locale_real_names)/sizeof(const char *)); j++) - if (localeData[j] != locale_real_names[j] && localeData[j] != defaultData[j]) - ::free(localeData[j]); - delete[] localeData; - - for (unsigned j = 0; j < (sizeof(locale_real_names)/sizeof(const char *)); j++) - if (defaultData[j] != locale_real_names[j]) - ::free(defaultData[j]); - delete[] defaultData; + + if (localeDataMem) + ::free(localeDataMem); + if (defaultDataMem) + ::free(defaultDataMem); } const char * path[2] = { CONFIGDIR "/locale/", DATADIR "/neutrino/locale/"}; CLocaleManager::loadLocale_ret_t CLocaleManager::loadLocale(const char * const locale, bool asdefault) { - unsigned int i; - FILE * fd; + FILE * fd = NULL; char ** loadData = asdefault ? defaultData : localeData; + char **mem = asdefault ? &defaultDataMem : &localeDataMem; + if(!asdefault && !strcmp(locale, DEFAULT_LOCALE)) { - for (unsigned j = 0; j < (sizeof(locale_real_names)/sizeof(const char *)); j++) { - if (loadData[j] != locale_real_names[j] && loadData[j] != defaultData[j]) - free(loadData[j]); - loadData[j] = defaultData[j]; + if (*mem) { + free(*mem); + *mem = NULL; } + memcpy(loadData, defaultData, sizeof(locale_real_names)); return UNICODE_FONT; } - for (i = 0; i < 2; i++) + struct stat st; + for (unsigned int i = 0; i < 2; i++) { std::string filename = path[i]; filename += locale; filename += ".locale"; + ::stat(filename.c_str(), &st); fd = fopen(filename.c_str(), "r"); if (fd) break; } - if (i == 2) + if (!fd) { perror("cannot read locale"); return NO_SUCH_LOCALE; } - if(!asdefault) { - for (unsigned j = 0; j < (sizeof(locale_real_names)/sizeof(const char *)); j++) { - if (loadData[j] != locale_real_names[j] && loadData[j] != defaultData[j]) - { - free(loadData[j]); - } - loadData[j] = (char *)locale_real_names[j]; - } + if (*mem) { + free (*mem); + *mem = NULL; } + memcpy(loadData, locale_real_names, sizeof(locale_real_names)); + + *mem = (char *) malloc(st.st_size); + if (!*mem) + { + perror("loadLocale"); + return NO_SUCH_LOCALE; + } + char *memp = *mem; + char *buf=NULL; size_t len = 0; - i = 1; - while(!feof(fd)) { if(getline(&buf, &len, fd)!=-1) @@ -192,13 +195,19 @@ CLocaleManager::loadLocale_ret_t CLocaleManager::loadLocale(const char * const l } } while ( ( pos != -1 ) ); + unsigned int i; for(i = 1; i < sizeof(locale_real_names)/sizeof(const char *); i++) { //printf("[%s] [%s]\n", buf,locale_real_names[i]); if(!strcmp(buf,locale_real_names[i])) { if(loadData[i] == locale_real_names[i]) - loadData[i] = strdup(text.c_str()); + { + loadData[i] = memp; + size_t l = text.length() + 1; + memcpy(memp, text.c_str(), l); + memp += l; + } else printf("[%s.locale] dup entry: %s\n", locale, locale_real_names[i]); break; @@ -212,6 +221,9 @@ CLocaleManager::loadLocale_ret_t CLocaleManager::loadLocale(const char * const l fclose(fd); if(buf) free(buf); + char *_mem = (char *) realloc(*mem, memp - *mem); + if (_mem) // I see no reason for realloc to fail here, but anyways ... + *mem = _mem; for (unsigned j = 1; j < (sizeof(locale_real_names)/sizeof(const char *)); j++) if (loadData[j] == locale_real_names[j]) @@ -221,13 +233,7 @@ CLocaleManager::loadLocale_ret_t CLocaleManager::loadLocale(const char * const l loadData[j] = defaultData[j]; } - return ( - (strcmp(locale, "bosanski") == 0) || - (strcmp(locale, "ellinika") == 0) || - (strcmp(locale, "russkij") == 0) || - (strcmp(locale, "utf8") == 0) - /* utf8.locale is a generic name that can be used for new locales which need characters outside the ISO-8859-1 character set */ - ) ? UNICODE_FONT : ISO_8859_1_FONT; + return UNICODE_FONT; } const char * CLocaleManager::getText(const neutrino_locale_t keyName) const diff --git a/src/system/localize.h b/src/system/localize.h index ad8bedb81..b12b430fd 100644 --- a/src/system/localize.h +++ b/src/system/localize.h @@ -51,6 +51,9 @@ class CLocaleManager private: char * * localeData; char * * defaultData; + + char * localeDataMem; + char * defaultDataMem; public: enum loadLocale_ret_t From 60705383eb4c2952c2500604198e489781865e69 Mon Sep 17 00:00:00 2001 From: martii Date: Sat, 9 Nov 2013 17:07:53 +0100 Subject: [PATCH 03/77] system/localize: change memory allocation, no user-visible changes (continued) --- src/system/localize.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/system/localize.cpp b/src/system/localize.cpp index 61c67b8af..6a3f2cb1d 100644 --- a/src/system/localize.cpp +++ b/src/system/localize.cpp @@ -222,8 +222,15 @@ CLocaleManager::loadLocale_ret_t CLocaleManager::loadLocale(const char * const l if(buf) free(buf); char *_mem = (char *) realloc(*mem, memp - *mem); - if (_mem) // I see no reason for realloc to fail here, but anyways ... - *mem = _mem; + if (_mem) { + if (_mem != *mem) { + // most likely doesn't happen + for(unsigned int i = 1; i < sizeof(locale_real_names)/sizeof(const char *); i++) + if (loadData[i] != locale_real_names[i]) + loadData[i] -= *mem - _mem; + *mem = _mem; + } + } for (unsigned j = 1; j < (sizeof(locale_real_names)/sizeof(const char *)); j++) if (loadData[j] == locale_real_names[j]) From fd5f9f118deb61cdda8df0824ffe1dc36eeba2c0 Mon Sep 17 00:00:00 2001 From: martii Date: Sun, 6 Oct 2013 12:11:20 +0200 Subject: [PATCH 04/77] yt: make search order selectable --- data/locale/deutsch.locale | 5 +++++ data/locale/english.locale | 5 +++++ src/gui/moviebrowser.cpp | 16 +++++++++++++++- src/gui/moviebrowser.h | 1 + src/system/locals.h | 5 +++++ src/system/locals_intern.h | 5 +++++ src/system/ytparser.cpp | 4 +++- src/system/ytparser.h | 9 ++++++++- 8 files changed, 47 insertions(+), 3 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 74700bf24..100acd626 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -1429,6 +1429,11 @@ moviebrowser.yt_most_responded Feeds mit den meisten Reaktionen moviebrowser.yt_most_shared Am häufigsten wiedergegebe Videos moviebrowser.yt_next_results Nächste Ergebnisse moviebrowser.yt_on_the_web Trendvideos +moviebrowser.yt_orderby Sortierung nach +moviebrowser.yt_orderby.published Veröffentlichungszeitpunkt +moviebrowser.yt_orderby.rating Bewertung +moviebrowser.yt_orderby.relevance Relevanz +moviebrowser.yt_orderby.viewcount Zahl der Views moviebrowser.yt_pref_quality Bevorzugte Qualität moviebrowser.yt_prev_results Vorherige Ergebnisse moviebrowser.yt_recently_featured Vor kurzem empfohlen diff --git a/data/locale/english.locale b/data/locale/english.locale index 1767bd4fb..a70d08722 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -1429,6 +1429,11 @@ moviebrowser.yt_most_responded Most responded moviebrowser.yt_most_shared Most shared moviebrowser.yt_next_results Next results moviebrowser.yt_on_the_web Trending videos +moviebrowser.yt_orderby Order by +moviebrowser.yt_orderby.published publishing date +moviebrowser.yt_orderby.rating rating +moviebrowser.yt_orderby.relevance relevance +moviebrowser.yt_orderby.viewcount view count moviebrowser.yt_pref_quality Prefered quality moviebrowser.yt_prev_results Previous results moviebrowser.yt_recently_featured Recently featured diff --git a/src/gui/moviebrowser.cpp b/src/gui/moviebrowser.cpp index 43bf819a2..a53b55afe 100644 --- a/src/gui/moviebrowser.cpp +++ b/src/gui/moviebrowser.cpp @@ -606,6 +606,7 @@ void CMovieBrowser::initGlobalSettings(void) m_settings.browserRowWidth[5] = m_defaultRowWidth[m_settings.browserRowItem[5]]; //30; m_settings.ytmode = cYTFeedParser::MOST_POPULAR; + m_settings.ytorderby = cYTFeedParser::ORDERBY_PUBLISHED; m_settings.ytresults = 10; m_settings.ytregion = "default"; m_settings.ytquality = 37; @@ -772,6 +773,7 @@ bool CMovieBrowser::loadSettings(MB_SETTINGS* settings) settings->browserRowWidth[i] = configfile.getInt32(cfg_key, 50); } settings->ytmode = configfile.getInt32("mb_ytmode", cYTFeedParser::MOST_POPULAR); + settings->ytorderby = configfile.getInt32("mb_ytorderby", cYTFeedParser::ORDERBY_PUBLISHED); settings->ytresults = configfile.getInt32("mb_ytresults", 10); settings->ytquality = configfile.getInt32("mb_ytquality", 37); // itag value (MP4, 1080p) settings->ytconcconn = configfile.getInt32("mb_ytconcconn", 4); // concurrent connections @@ -839,6 +841,7 @@ bool CMovieBrowser::saveSettings(MB_SETTINGS* settings) configfile.setInt32(cfg_key, settings->browserRowWidth[i]); } configfile.setInt32("mb_ytmode", settings->ytmode); + configfile.setInt32("mb_ytorderby", settings->ytorderby); configfile.setInt32("mb_ytresults", settings->ytresults); configfile.setInt32("mb_ytquality", settings->ytquality); configfile.setInt32("mb_ytconcconn", settings->ytconcconn); @@ -3593,7 +3596,7 @@ void CMovieBrowser::loadYTitles(int mode, std::string search, std::string id) ytparser.SetConcurrentDownloads(m_settings.ytconcconn); if (!ytparser.Parsed() || (ytparser.GetFeedMode() != mode)) { - if (ytparser.ParseFeed((cYTFeedParser::yt_feed_mode_t)mode, search, id)) { + if (ytparser.ParseFeed((cYTFeedParser::yt_feed_mode_t)mode, search, id, (cYTFeedParser::yt_feed_orderby_t)m_settings.ytorderby)) { ytparser.DownloadThumbnails(); } else { //FIXME show error @@ -3642,6 +3645,16 @@ const CMenuOptionChooser::keyval YT_FEED_OPTIONS[] = #define YT_FEED_OPTION_COUNT (sizeof(YT_FEED_OPTIONS)/sizeof(CMenuOptionChooser::keyval)) +const CMenuOptionChooser::keyval YT_ORDERBY_OPTIONS[] = +{ + { cYTFeedParser::ORDERBY_PUBLISHED, LOCALE_MOVIEBROWSER_YT_ORDERBY_PUBLISHED }, + { cYTFeedParser::ORDERBY_RELEVANCE, LOCALE_MOVIEBROWSER_YT_ORDERBY_RELEVANCE }, + { cYTFeedParser::ORDERBY_VIEWCOUNT, LOCALE_MOVIEBROWSER_YT_ORDERBY_VIEWCOUNT }, + { cYTFeedParser::ORDERBY_RATING, LOCALE_MOVIEBROWSER_YT_ORDERBY_RATING }, +}; + +#define YT_ORDERBY_OPTION_COUNT (sizeof(YT_ORDERBY_OPTIONS)/sizeof(CMenuOptionChooser::keyval)) + neutrino_locale_t CMovieBrowser::getFeedLocale(void) { neutrino_locale_t ret = LOCALE_MOVIEBROWSER_YT_MOST_POPULAR; @@ -3739,6 +3752,7 @@ bool CMovieBrowser::showYTMenu() std::string search = m_settings.ytsearch; CStringInputSMS stringInput(LOCALE_MOVIEBROWSER_YT_SEARCH, &search, 20, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789 -_/()<>=+.,:!?\\'"); mainMenu.addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_YT_SEARCH, true, search, &stringInput, NULL, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW)); + mainMenu.addItem(new CMenuOptionChooser(LOCALE_MOVIEBROWSER_YT_ORDERBY, &m_settings.ytorderby, YT_ORDERBY_OPTIONS, YT_ORDERBY_OPTION_COUNT, true, NULL, CRCInput::RC_nokey, "", true)); sprintf(cnt, "%d", cYTFeedParser::SEARCH); mainMenu.addItem(new CMenuForwarder(LOCALE_EVENTFINDER_START_SEARCH, true, NULL, selector, cnt, CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE)); diff --git a/src/gui/moviebrowser.h b/src/gui/moviebrowser.h index 2486bf0e5..e543ee303 100644 --- a/src/gui/moviebrowser.h +++ b/src/gui/moviebrowser.h @@ -229,6 +229,7 @@ typedef struct MB_INFO_ITEM lastRecordRow[MB_MAX_ROWS]; int lastRecordRowWidth[MB_MAX_ROWS]; int ytmode; + int ytorderby; int ytresults; int ytquality; int ytconcconn; diff --git a/src/system/locals.h b/src/system/locals.h index 1fd8f82cb..1dc09f87c 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -1456,6 +1456,11 @@ typedef enum LOCALE_MOVIEBROWSER_YT_MOST_SHARED, LOCALE_MOVIEBROWSER_YT_NEXT_RESULTS, LOCALE_MOVIEBROWSER_YT_ON_THE_WEB, + LOCALE_MOVIEBROWSER_YT_ORDERBY, + LOCALE_MOVIEBROWSER_YT_ORDERBY_PUBLISHED, + LOCALE_MOVIEBROWSER_YT_ORDERBY_RATING, + LOCALE_MOVIEBROWSER_YT_ORDERBY_RELEVANCE, + LOCALE_MOVIEBROWSER_YT_ORDERBY_VIEWCOUNT, LOCALE_MOVIEBROWSER_YT_PREF_QUALITY, LOCALE_MOVIEBROWSER_YT_PREV_RESULTS, LOCALE_MOVIEBROWSER_YT_RECENTLY_FEATURED, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 18924eac2..214f61001 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -1456,6 +1456,11 @@ const char * locale_real_names[] = "moviebrowser.yt_most_shared", "moviebrowser.yt_next_results", "moviebrowser.yt_on_the_web", + "moviebrowser.yt_orderby", + "moviebrowser.yt_orderby.published", + "moviebrowser.yt_orderby.rating", + "moviebrowser.yt_orderby.relevance", + "moviebrowser.yt_orderby.viewcount", "moviebrowser.yt_pref_quality", "moviebrowser.yt_prev_results", "moviebrowser.yt_recently_featured", diff --git a/src/system/ytparser.cpp b/src/system/ytparser.cpp index 7bdfc8535..5837f51fb 100644 --- a/src/system/ytparser.cpp +++ b/src/system/ytparser.cpp @@ -472,7 +472,7 @@ bool cYTFeedParser::ParseFeed(std::string &url) return parseFeedXml(answer); } -bool cYTFeedParser::ParseFeed(yt_feed_mode_t mode, std::string search, std::string vid) +bool cYTFeedParser::ParseFeed(yt_feed_mode_t mode, std::string search, std::string vid, yt_feed_orderby_t orderby) { std::string url = "http://gdata.youtube.com/feeds/api/standardfeeds/"; bool append_res = true; @@ -540,6 +540,8 @@ bool cYTFeedParser::ParseFeed(yt_feed_mode_t mode, std::string search, std::stri url = "http://gdata.youtube.com/feeds/api/videos?q="; url += search; url += "&"; + const char *orderby_values[] = { "published", "relevance", "viewCount", "rating" }; + url += "orderby=" + std::string(orderby_values[orderby & 3]) + "&"; } feedmode = mode; diff --git a/src/system/ytparser.h b/src/system/ytparser.h index fb97d65d1..5e4d6f12d 100644 --- a/src/system/ytparser.h +++ b/src/system/ytparser.h @@ -129,10 +129,17 @@ class cYTFeedParser SEARCH, MODE_LAST }; + enum yt_feed_orderby_t + { + ORDERBY_PUBLISHED = 0, + ORDERBY_RELEVANCE, + ORDERBY_VIEWCOUNT, + ORDERBY_RATING + }; cYTFeedParser(); ~cYTFeedParser(); - bool ParseFeed(yt_feed_mode_t mode = MOST_POPULAR, std::string search = "", std::string vid = ""); + bool ParseFeed(yt_feed_mode_t mode = MOST_POPULAR, std::string search = "", std::string vid = "", yt_feed_orderby_t orderby = ORDERBY_PUBLISHED); bool ParseVideoInfo(cYTVideoInfo &vinfo, CURL *_curl_handle = NULL); bool DownloadThumbnail(cYTVideoInfo &vinfo, CURL *_curl_handle = NULL); bool GetVideoUrls(); From 633278a532af2da7c63654e6e4a3981cd1801ecb Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Wed, 13 Nov 2013 23:39:37 +0100 Subject: [PATCH 05/77] Revert "CTestMenu: fix build, add missing include" This reverts commit 25909c10b626d39a462a1a421a1b61759da71fa4. --- src/gui/test_menu.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index 5e6138207..d2380fdd3 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -37,7 +37,6 @@ #include #include -#include #include #include From 014dd3ac7b75963f9ff136d231ae072d9fff2902 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Wed, 13 Nov 2013 23:39:55 +0100 Subject: [PATCH 06/77] Revert "- add missing include of vfd header" This reverts commit 3845feb0e40a9d67d4bd4901def78beaf32b2611. --- src/driver/audiodec/mp3dec.cpp | 1 - src/driver/volume.cpp | 1 - src/gui/audiomute.cpp | 2 -- src/gui/audioplayer.cpp | 1 - src/gui/bookmarkmanager.cpp | 1 - src/gui/bouquetlist.cpp | 2 -- src/gui/eventlist.cpp | 1 - src/gui/filebrowser.cpp | 1 - src/gui/pictureviewer.cpp | 1 - src/gui/rc_lock.cpp | 2 -- src/gui/settings_manager.cpp | 2 -- src/gui/streaminfo2.cpp | 1 - src/gui/vfd_setup.cpp | 1 - src/gui/videosettings.cpp | 1 - src/gui/widget/menue.cpp | 1 - src/gui/widget/progresswindow.cpp | 1 - src/gui/widget/stringinput.cpp | 1 - src/gui/widget/stringinput_ext.cpp | 1 - src/system/flashtool.cpp | 1 - src/system/setting_helpers.cpp | 1 - 20 files changed, 24 deletions(-) diff --git a/src/driver/audiodec/mp3dec.cpp b/src/driver/audiodec/mp3dec.cpp index a5c3e9282..f64d3956a 100644 --- a/src/driver/audiodec/mp3dec.cpp +++ b/src/driver/audiodec/mp3dec.cpp @@ -54,7 +54,6 @@ #include #include "mp3dec.h" #include -#include extern cAudio * audioDecoder; diff --git a/src/driver/volume.cpp b/src/driver/volume.cpp index 8c230291b..a8fe704a3 100644 --- a/src/driver/volume.cpp +++ b/src/driver/volume.cpp @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include diff --git a/src/gui/audiomute.cpp b/src/gui/audiomute.cpp index d956cbea8..90ef21734 100644 --- a/src/gui/audiomute.cpp +++ b/src/gui/audiomute.cpp @@ -34,8 +34,6 @@ #include #include -#include - CAudioMute::CAudioMute():CComponentsPicture(0, 0, 0, 0, NEUTRINO_ICON_BUTTON_MUTE) { y_old = -1; diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index 25d0f6f53..63e9171c0 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -46,7 +46,6 @@ #include #include #include -#include #include diff --git a/src/gui/bookmarkmanager.cpp b/src/gui/bookmarkmanager.cpp index 56dec6813..228b136fb 100644 --- a/src/gui/bookmarkmanager.cpp +++ b/src/gui/bookmarkmanager.cpp @@ -36,7 +36,6 @@ #include #include -#include #include #include #include diff --git a/src/gui/bouquetlist.cpp b/src/gui/bouquetlist.cpp index 9cb87ea97..594de4822 100644 --- a/src/gui/bouquetlist.cpp +++ b/src/gui/bouquetlist.cpp @@ -50,8 +50,6 @@ #include #include #include -#include - #include #include diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index 93e5902fe..59d175789 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -47,7 +47,6 @@ #include #include -#include #include #include diff --git a/src/gui/filebrowser.cpp b/src/gui/filebrowser.cpp index 009ba9a3a..01614f2fc 100644 --- a/src/gui/filebrowser.cpp +++ b/src/gui/filebrowser.cpp @@ -40,7 +40,6 @@ #include #include #include -#include #include #include diff --git a/src/gui/pictureviewer.cpp b/src/gui/pictureviewer.cpp index d6fab95dd..58ef0afe8 100644 --- a/src/gui/pictureviewer.cpp +++ b/src/gui/pictureviewer.cpp @@ -43,7 +43,6 @@ #include #include -#include #include diff --git a/src/gui/rc_lock.cpp b/src/gui/rc_lock.cpp index a5839af49..2b7177692 100644 --- a/src/gui/rc_lock.cpp +++ b/src/gui/rc_lock.cpp @@ -37,8 +37,6 @@ #include #include -#include - const std::string CRCLock::NO_USER_INPUT = "noUserInput"; bool CRCLock::locked = false; diff --git a/src/gui/settings_manager.cpp b/src/gui/settings_manager.cpp index 49a80835f..9bb0d2bf5 100644 --- a/src/gui/settings_manager.cpp +++ b/src/gui/settings_manager.cpp @@ -40,8 +40,6 @@ #include #include -#include - #include #include diff --git a/src/gui/streaminfo2.cpp b/src/gui/streaminfo2.cpp index de08f2fbe..c487d274e 100644 --- a/src/gui/streaminfo2.cpp +++ b/src/gui/streaminfo2.cpp @@ -36,7 +36,6 @@ #include #include #include -#include #include #include #include diff --git a/src/gui/vfd_setup.cpp b/src/gui/vfd_setup.cpp index 2e782ca82..ecfc2f891 100644 --- a/src/gui/vfd_setup.cpp +++ b/src/gui/vfd_setup.cpp @@ -44,7 +44,6 @@ #include #include -#include #include #include diff --git a/src/gui/videosettings.cpp b/src/gui/videosettings.cpp index 5800ad320..90a6fe3d3 100644 --- a/src/gui/videosettings.cpp +++ b/src/gui/videosettings.cpp @@ -46,7 +46,6 @@ #include #include -#include #include diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index d66fa50b5..988bd6ff0 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -39,7 +39,6 @@ #include #include -#include #include diff --git a/src/gui/widget/progresswindow.cpp b/src/gui/widget/progresswindow.cpp index d014fd829..59b29f8a9 100644 --- a/src/gui/widget/progresswindow.cpp +++ b/src/gui/widget/progresswindow.cpp @@ -35,7 +35,6 @@ #include #include #include -#include #include diff --git a/src/gui/widget/stringinput.cpp b/src/gui/widget/stringinput.cpp index d83d803fa..59a5e8be8 100644 --- a/src/gui/widget/stringinput.cpp +++ b/src/gui/widget/stringinput.cpp @@ -31,7 +31,6 @@ #include #include #include -#include #include diff --git a/src/gui/widget/stringinput_ext.cpp b/src/gui/widget/stringinput_ext.cpp index c5b510f6f..af6c9b410 100644 --- a/src/gui/widget/stringinput_ext.cpp +++ b/src/gui/widget/stringinput_ext.cpp @@ -31,7 +31,6 @@ #include #include #include -#include #include diff --git a/src/system/flashtool.cpp b/src/system/flashtool.cpp index c7f7aa352..d3c3ce5c6 100644 --- a/src/system/flashtool.cpp +++ b/src/system/flashtool.cpp @@ -28,7 +28,6 @@ #include #include #include -#include #include #include diff --git a/src/system/setting_helpers.cpp b/src/system/setting_helpers.cpp index 0dd096d27..b01c3226e 100644 --- a/src/system/setting_helpers.cpp +++ b/src/system/setting_helpers.cpp @@ -55,7 +55,6 @@ #include #include #include -#include #include // obsolete #include From 3c8d47fa49b6a45e1606c015fd193af7b5d9b8b9 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Wed, 13 Nov 2013 23:40:16 +0100 Subject: [PATCH 07/77] Revert "global.h: Use forward-declarations to reduce number of dependencies" This reverts commit 4bc6e43ad478857453c64bbe9c46dffae7e525e1. --- src/driver/rcinput.cpp | 1 - src/driver/record.cpp | 1 - src/global.h | 43 ++++++++++++++++++++++++---------- src/gui/channellist.cpp | 4 +--- src/gui/epgplus.cpp | 1 - src/gui/epgview.cpp | 1 - src/gui/eventlist.cpp | 1 - src/gui/infoviewer.cpp | 1 - src/gui/movieplayer.cpp | 4 ---- src/gui/osd_setup.cpp | 1 - src/gui/screensetup.cpp | 1 - src/gui/sleeptimer.cpp | 1 - src/gui/start_wizard.cpp | 1 - src/gui/timerlist.cpp | 1 - src/gui/user_menue.cpp | 3 --- src/neutrino.cpp | 1 - src/neutrino_menue.cpp | 1 - src/system/fsmounter.cpp | 1 - src/system/httptool.cpp | 3 ++- src/system/setting_helpers.cpp | 1 - 20 files changed, 33 insertions(+), 39 deletions(-) diff --git a/src/driver/rcinput.cpp b/src/driver/rcinput.cpp index aa98e6c4c..a961282bc 100644 --- a/src/driver/rcinput.cpp +++ b/src/driver/rcinput.cpp @@ -53,7 +53,6 @@ #include #include #include -#include #include //#define RCDEBUG diff --git a/src/driver/record.cpp b/src/driver/record.cpp index 9984e143e..c10d2e924 100644 --- a/src/driver/record.cpp +++ b/src/driver/record.cpp @@ -51,7 +51,6 @@ #include -#include #include #include #include diff --git a/src/global.h b/src/global.h index c05a44822..73322e913 100644 --- a/src/global.h +++ b/src/global.h @@ -6,6 +6,14 @@ Copyright (C) 2001 Steffen Hehn 'McClean' Homepage: http://dbox.cyberphoria.org/ + Kommentar: + + Diese GUI wurde von Grund auf neu programmiert und sollte nun vom + Aufbau und auch den Ausbaumoeglichkeiten gut aussehen. Neutrino basiert + auf der Client-Server Idee, diese GUI ist also von der direkten DBox- + Steuerung getrennt. Diese wird dann von Daemons uebernommen. + + License: GPL This program is free software; you can redistribute it and/or modify @@ -23,8 +31,30 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#include +#include + +#include +#include +#include +#if HAVE_COOL_HARDWARE +#include +#endif +#if HAVE_TRIPLEDRAGON +#include +#define CVFD CLCD +#endif + +#include #include +#include +#include +#include +#include + + #ifndef NEUTRINO_CPP #define NEUTRINO_CPP extern #endif @@ -50,39 +80,26 @@ NEUTRINO_CPP SNeutrinoSettings g_settings; NEUTRINO_CPP SglobalInfo g_info; #ifdef HAVE_CONTROLD -class CControldClient; NEUTRINO_CPP CControldClient *g_Controld; #endif -class CZapitClient; NEUTRINO_CPP CZapitClient *g_Zapit; -class CSectionsdClient; NEUTRINO_CPP CSectionsdClient *g_Sectionsd; -class CTimerdClient; NEUTRINO_CPP CTimerdClient *g_Timerd; -class FBFontRenderClass; NEUTRINO_CPP FBFontRenderClass *g_fontRenderer; NEUTRINO_CPP FBFontRenderClass *g_dynFontRenderer; -class Font; NEUTRINO_CPP Font * g_Font[SNeutrinoSettings::FONT_TYPE_COUNT]; NEUTRINO_CPP Font * g_SignalFont; -class CRCInput; NEUTRINO_CPP CRCInput *g_RCInput; -class CEpgData; NEUTRINO_CPP CEpgData *g_EpgData; -class CInfoViewer; NEUTRINO_CPP CInfoViewer *g_InfoViewer; -class CNeutrinoEventList; NEUTRINO_CPP CNeutrinoEventList *g_EventList; -class CLocaleManager; NEUTRINO_CPP CLocaleManager *g_Locale; -class CVideoSettings; NEUTRINO_CPP CVideoSettings *g_videoSettings; -class CRadioText; NEUTRINO_CPP CRadioText *g_Radiotext; #ifndef DISABLE_GUI_MOUNT diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index a7eca53df..6864276e2 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -46,10 +46,8 @@ #include #include #include -#include - + #include -#include #include #include #include diff --git a/src/gui/epgplus.cpp b/src/gui/epgplus.cpp index 2988692e2..3ee640c51 100644 --- a/src/gui/epgplus.cpp +++ b/src/gui/epgplus.cpp @@ -31,7 +31,6 @@ #include #include -#include #include #include diff --git a/src/gui/epgview.cpp b/src/gui/epgview.cpp index 1a9142f8d..747633e61 100644 --- a/src/gui/epgview.cpp +++ b/src/gui/epgview.cpp @@ -27,7 +27,6 @@ #include #include -#include #include #include diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index 59d175789..8ac359e87 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -31,7 +31,6 @@ #include #include #include -#include #include #include diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index a2a1eb94a..f0f91474c 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -62,7 +62,6 @@ #include #include #include -#include #include #include diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index ed8c8aeab..4e3d16160 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -32,16 +32,12 @@ #include #include -#include -#include -#include #include #include #include #include #include #include -#include #include #include #include diff --git a/src/gui/osd_setup.cpp b/src/gui/osd_setup.cpp index 0a7b8a0e4..9760ea225 100644 --- a/src/gui/osd_setup.cpp +++ b/src/gui/osd_setup.cpp @@ -54,7 +54,6 @@ #include #include #include -#include #include #include diff --git a/src/gui/screensetup.cpp b/src/gui/screensetup.cpp index 4109a3d9b..b1662e478 100644 --- a/src/gui/screensetup.cpp +++ b/src/gui/screensetup.cpp @@ -36,7 +36,6 @@ #include #include -#include #include #include diff --git a/src/gui/sleeptimer.cpp b/src/gui/sleeptimer.cpp index 936355f3c..02c847b78 100644 --- a/src/gui/sleeptimer.cpp +++ b/src/gui/sleeptimer.cpp @@ -27,7 +27,6 @@ #endif #include -#include #include diff --git a/src/gui/start_wizard.cpp b/src/gui/start_wizard.cpp index 676cfd182..827781abf 100644 --- a/src/gui/start_wizard.cpp +++ b/src/gui/start_wizard.cpp @@ -46,7 +46,6 @@ #include "osd_setup.h" #include "osdlang_setup.h" #include "scan_setup.h" -#include "videosettings.h" #include #include diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index ab5dbd095..0aeeaed11 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -48,7 +48,6 @@ #include #include -#include #include #include #include diff --git a/src/gui/user_menue.cpp b/src/gui/user_menue.cpp index e7859b8d8..123066d18 100644 --- a/src/gui/user_menue.cpp +++ b/src/gui/user_menue.cpp @@ -48,8 +48,6 @@ #include "audio_select.h" #include "streaminfo2.h" #include "epgplus.h" -#include "epgview.h" -#include "eventlist.h" #include "movieplayer.h" #include "timerlist.h" #include "plugins.h" @@ -64,7 +62,6 @@ #include -#include #include #include diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 7fd10575a..559ea61fa 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -58,7 +58,6 @@ #include #include #include -#include #include #include "gui/audiomute.h" diff --git a/src/neutrino_menue.cpp b/src/neutrino_menue.cpp index 327efc425..72c476b93 100644 --- a/src/neutrino_menue.cpp +++ b/src/neutrino_menue.cpp @@ -76,7 +76,6 @@ #endif #include "gui/update.h" #include "gui/vfd_setup.h" -#include "gui/videosettings.h" #include "driver/record.h" diff --git a/src/system/fsmounter.cpp b/src/system/fsmounter.cpp index d8d384220..a6bfb93b3 100644 --- a/src/system/fsmounter.cpp +++ b/src/system/fsmounter.cpp @@ -36,7 +36,6 @@ #include #include -#include #include #include diff --git a/src/system/httptool.cpp b/src/system/httptool.cpp index c23cd0a08..20bd5fba7 100644 --- a/src/system/httptool.cpp +++ b/src/system/httptool.cpp @@ -18,7 +18,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA */ -#include + #include #include @@ -30,6 +30,7 @@ #include + CHTTPTool::CHTTPTool() { statusViewer = NULL; diff --git a/src/system/setting_helpers.cpp b/src/system/setting_helpers.cpp index b01c3226e..b2ca12c00 100644 --- a/src/system/setting_helpers.cpp +++ b/src/system/setting_helpers.cpp @@ -53,7 +53,6 @@ #include #include #include -#include #include #include // obsolete #include From 22c3cec0ca3c665f3fc3ed3c788510836fe2612a Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Thu, 14 Nov 2013 23:52:21 +0100 Subject: [PATCH 08/77] - audioplayer: fix cover handling --- src/driver/audiodec/mp3dec.cpp | 18 ++++++++---- src/gui/audioplayer.cpp | 51 +++++++++++++--------------------- 2 files changed, 33 insertions(+), 36 deletions(-) diff --git a/src/driver/audiodec/mp3dec.cpp b/src/driver/audiodec/mp3dec.cpp index f64d3956a..c1241db15 100644 --- a/src/driver/audiodec/mp3dec.cpp +++ b/src/driver/audiodec/mp3dec.cpp @@ -41,6 +41,7 @@ #endif #include +#include #include #include #include @@ -1345,10 +1346,11 @@ void CMP3Dec::GetID3(FILE* in, CAudioMetaData* const m) } } +static int cover_count = 0; + bool CMP3Dec::SaveCover(FILE * in, CAudioMetaData * const m) { struct id3_frame const *frame; - const char * coverfile = "/tmp/cover.jpg"; /* text information */ struct id3_file *id3file = id3_file_fdopen(fileno(in), ID3_FILE_MODE_READONLY); @@ -1383,11 +1385,17 @@ bool CMP3Dec::SaveCover(FILE * in, CAudioMetaData * const m) data = id3_field_getbinarydata(field, &size); if ( data ) { - m->cover = coverfile; + std::ostringstream cover; + cover.str(""); + cover << "/tmp/cover_" << cover_count++ << ".jpg"; FILE * pFile; - pFile = fopen ( coverfile , "wb" ); - fwrite (data , 1 , size , pFile ); - fclose (pFile); + pFile = fopen ( cover.str().c_str() , "wb" ); + if (pFile) + { + fwrite (data , 1 , size , pFile ); + fclose (pFile); + m->cover = cover.str().c_str(); + } } break; diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index 63e9171c0..af11e3cab 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -965,6 +965,10 @@ bool CAudioPlayerGui::clearPlaylist(void) { bool result = false; + CAudioPlayList::const_iterator it; + for (it = m_playlist.begin(); it!=m_playlist.end(); ++it) + unlink(it->MetaData.cover.c_str()); + if (!(m_playlist.empty())) { m_playlist.clear(); @@ -1777,21 +1781,25 @@ void CAudioPlayerGui::paintInfo() return; int c_rad_mid = RADIUS_MID; + int title_height = m_title_height; + if (m_state == CAudioPlayerGui::STOP && m_show_playlist) m_frameBuffer->paintBackgroundBoxRel(m_x, m_y, m_width, m_title_height); else { - if (!m_show_playlist) - { - // no playlist -> smaller Info-Box - m_frameBuffer->paintBoxRel(m_x + 1, m_y + 1 , m_width - 2, m_title_height - 12 - m_fheight, COL_MENUCONTENTSELECTED_PLUS_0, c_rad_mid); - m_frameBuffer->paintBoxFrame(m_x, m_y, m_width, m_title_height - 10 - m_fheight, 2, COL_MENUCONTENT_PLUS_6, c_rad_mid); - } - else - { - m_frameBuffer->paintBoxRel(m_x + 1, m_y + 1 , m_width - 2, m_title_height - 12, COL_MENUCONTENTSELECTED_PLUS_0, c_rad_mid); - m_frameBuffer->paintBoxFrame(m_x, m_y, m_width, m_title_height - 10, 2, COL_MENUCONTENT_PLUS_6, c_rad_mid); - } + if (!m_show_playlist) // no playlist -> smaller Info-Box + title_height -= m_fheight; + + m_frameBuffer->paintBoxRel(m_x + 1, m_y + 1 , m_width - 2, title_height - 12, COL_MENUCONTENTSELECTED_PLUS_0, c_rad_mid); + m_frameBuffer->paintBoxFrame(m_x, m_y, m_width, title_height - 10, 2, COL_MENUCONTENT_PLUS_6, c_rad_mid); + + std::string cover = m_curr_audiofile.Filename.substr(0, m_curr_audiofile.Filename.rfind('/')) + "/folder.jpg"; + + if (!m_curr_audiofile.MetaData.cover.empty()) + cover = m_curr_audiofile.MetaData.cover; + + if (access(cover.c_str(), F_OK) == 0) + g_PicViewer->DisplayImage(cover, m_x + 2 + c_rad_mid/2, m_y + 2 + c_rad_mid/2, title_height - 14 - c_rad_mid, title_height - 14 - c_rad_mid, m_frameBuffer->TM_NONE); // first line (Track number) std::string tmp; @@ -2170,25 +2178,6 @@ void CAudioPlayerGui::updateMetaData(bool screen_saver) m_curr_audiofile.MetaData.album = meta.sc_station; updateLcd = true; } - - std::string cover = m_curr_audiofile.Filename.substr(0, m_curr_audiofile.Filename.rfind('/')) + "/folder.jpg"; - - if (!meta.cover.empty()) - cover = "/tmp/cover.jpg"; - - if ((access(cover.c_str(), F_OK) == 0) && !screen_saver) - { - g_PicViewer->DisplayImage(cover, m_x + 2, m_y + 2, m_title_height - 14, m_title_height - 14, m_frameBuffer->TM_NONE); - - if(g_settings.rounded_corners) - { - //repaint frame to cover up the corners of the cover; FIXME - if (!m_show_playlist) - m_frameBuffer->paintBoxFrame(m_x, m_y, m_width, m_title_height - 10 - m_fheight, 2, COL_MENUCONTENT_PLUS_6, RADIUS_MID); - else - m_frameBuffer->paintBoxFrame(m_x, m_y, m_width, m_title_height - 10, 2, COL_MENUCONTENT_PLUS_6, RADIUS_MID); - } - } } //if (CAudioPlayer::getInstance()->getScBuffered() != 0) if (CAudioPlayer::getInstance()->hasMetaDataChanged() != 0) @@ -2484,7 +2473,7 @@ void CAudioPlayerGui::removeFromPlaylist(long pos) // must be called before m_playlist.erase() firstChar = getFirstChar(m_playlist[pos]); } - + unlink(m_playlist[pos].MetaData.cover.c_str()); m_playlist.erase(m_playlist.begin() + pos); m_playlistHasChanged = true; From 00b4303765b21fa54024f39b0bd5bd7960e0b023 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Fri, 15 Nov 2013 09:08:14 +0100 Subject: [PATCH 09/77] - movieplayer: show infobar at every start of a movie --- src/gui/movieplayer.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index 4e3d16160..c7768c71a 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -493,7 +493,7 @@ void CMoviePlayerGui::PlayFile(void) neutrino_msg_data_t data; menu_ret = menu_return::RETURN_REPAINT; - bool first_start_timeshift = false; + bool first_start = true; bool time_forced = false; bool update_lcd = true; int eof = 0; @@ -536,7 +536,6 @@ void CMoviePlayerGui::PlayFile(void) playstate = CMoviePlayerGui::PLAY; CVFD::getInstance()->ShowIcon(FP_ICON_PLAY, true); if(timeshift) { - first_start_timeshift = true; startposition = -1; int i; int towait = (timeshift == 1) ? TIMESHIFT_SECONDS+1 : TIMESHIFT_SECONDS; @@ -581,9 +580,9 @@ void CMoviePlayerGui::PlayFile(void) update_lcd = false; updateLcd(); } - if (first_start_timeshift) { + if (first_start) { callInfoViewer(/*duration, position*/); - first_start_timeshift = false; + first_start = false; } g_RCInput->getMsg(&msg, &data, 10); // 1 secs.. From 37e3502fb059f22518bcedacd1087ecf68c67ec7 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Fri, 15 Nov 2013 09:18:18 +0100 Subject: [PATCH 10/77] - movieplayer: show progress in VFD (thx Satbaby) --- src/driver/vfd.cpp | 2 +- src/gui/movieplayer.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/driver/vfd.cpp b/src/driver/vfd.cpp index f2f95dac9..da15d7467 100644 --- a/src/driver/vfd.cpp +++ b/src/driver/vfd.cpp @@ -385,7 +385,7 @@ void CVFD::showPercentOver(const unsigned char perc, const bool /*perform_update { if(!has_lcd) return; - if ((mode == MODE_TVRADIO) && !(g_settings.lcd_setting[SNeutrinoSettings::LCD_SHOW_VOLUME])) { + if (((mode == MODE_TVRADIO) || (mode == MODE_MENU_UTF8)) && !(g_settings.lcd_setting[SNeutrinoSettings::LCD_SHOW_VOLUME])) { //if (g_settings.lcd_setting[SNeutrinoSettings::LCD_SHOW_VOLUME] == 0) { ShowIcon(FP_ICON_FRAME, true); diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index c7768c71a..557430a97 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -593,6 +593,8 @@ void CMoviePlayerGui::PlayFile(void) file_prozent = (unsigned char) (position / (duration / 100)); #if HAVE_TRIPLEDRAGON CVFD::getInstance()->showPercentOver(file_prozent, true, CVFD::MODE_MOVIE); +#else + CVFD::getInstance()->showPercentOver(file_prozent); #endif playback->GetSpeed(speed); From 5ce5730f84a48dae569c55cb8d13c8f0369164ac Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Fri, 15 Nov 2013 09:22:12 +0100 Subject: [PATCH 11/77] - movieplayer: show channellogo in infobar --- src/gui/infoviewer.cpp | 10 +++++++--- src/gui/infoviewer.h | 2 +- src/gui/movieplayer.cpp | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index f0f91474c..c8c581a0a 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -472,7 +472,7 @@ void CInfoViewer::show_current_next(bool new_chan, int epgpos) } } -void CInfoViewer::showMovieTitle(const int playState, const std::string &Channel, +void CInfoViewer::showMovieTitle(const int playState, const t_channel_id &Channel_Id, const std::string &Channel, const std::string &g_file_epg, const std::string &g_file_epg1, const int duration, const int curr_pos) { @@ -506,7 +506,7 @@ void CInfoViewer::showMovieTitle(const int playState, const std::string &Channel infoViewerBB->is_visible = true; ChannelName = Channel; - channel_id = 0; + channel_id = Channel_Id; /* showChannelLogo() changes this, so better reset it every time... */ ChanNameX = BoxStartX + ChanWidth + SHADOW_OFFSET; @@ -520,7 +520,11 @@ void CInfoViewer::showMovieTitle(const int playState, const std::string &Channel infoViewerBB->paintshowButtonBar(); - g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->RenderString(ChanNameX + 10 , ChanNameY + time_height,BoxEndX - (ChanNameX + 20) - time_width - LEFT_OFFSET - 5 ,ChannelName, COL_INFOBAR_TEXT, 0, true); // UTF-8 + int ChannelLogoMode = 0; + if (g_settings.infobar_show_channellogo > 1) + ChannelLogoMode = showChannelLogo(channel_id, 0); + if (ChannelLogoMode == 0 || ChannelLogoMode == 3 || ChannelLogoMode == 4) + g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->RenderString(ChanNameX + 10 , ChanNameY + time_height,BoxEndX - (ChanNameX + 20) - time_width - LEFT_OFFSET - 5 ,ChannelName, COL_INFOBAR_TEXT, 0, true); // UTF-8 // show_Data if (CMoviePlayerGui::getInstance().file_prozent > 100) diff --git a/src/gui/infoviewer.h b/src/gui/infoviewer.h index 340298f30..367d609c3 100644 --- a/src/gui/infoviewer.h +++ b/src/gui/infoviewer.h @@ -157,7 +157,7 @@ class CInfoViewer CInfoViewer(); ~CInfoViewer(); - void showMovieTitle(const int playState, const std::string &title, + void showMovieTitle(const int playState, const t_channel_id &channel_id, const std::string &title, const std::string &g_file_epg, const std::string &g_file_epg1, const int duration, const int curr_pos); diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index 557430a97..1b9ae1f4a 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -853,13 +853,13 @@ void CMoviePlayerGui::callInfoViewer(/*const int duration, const int curr_pos*/) getCurrentAudioName( is_file_player, currentaudioname); if (isMovieBrowser && p_movie_info) { - g_InfoViewer->showMovieTitle(playstate, p_movie_info->epgChannel, p_movie_info->epgTitle, p_movie_info->epgInfo1, + g_InfoViewer->showMovieTitle(playstate, p_movie_info->epgEpgId >>16, p_movie_info->epgChannel, p_movie_info->epgTitle, p_movie_info->epgInfo1, duration, position); return; } /* not moviebrowser => use the filename as title */ - g_InfoViewer->showMovieTitle(playstate, file_name, "", "", duration, position); + g_InfoViewer->showMovieTitle(playstate, 0, file_name, "", "", duration, position); } bool CMoviePlayerGui::getAudioName(int apid, std::string &apidtitle) From fb6dea6e2d65dc5a1ca38875b74d98ebf09cb18e Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Fri, 15 Nov 2013 15:55:23 +0400 Subject: [PATCH 12/77] lib/libcoolstream2: apollo headers update --- lib/libcoolstream2/audio_cs.h | 27 +++++++++++++++++---------- lib/libcoolstream2/playback_cs.h | 1 + lib/libcoolstream2/video_cs.h | 5 +++-- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/lib/libcoolstream2/audio_cs.h b/lib/libcoolstream2/audio_cs.h index a5aa5d866..0574eb588 100644 --- a/lib/libcoolstream2/audio_cs.h +++ b/lib/libcoolstream2/audio_cs.h @@ -44,20 +44,26 @@ typedef enum { HDMI_ENCODED_FORCED } HDMI_ENCODED_MODE; -typedef enum -{ +typedef enum { HDMI_AUDIO_FMT_LPCM = 0x1, - HDMI_AUDIO_FMT_AC3 , - HDMI_AUDIO_FMT_MPEG1 , - HDMI_AUDIO_FMT_MP3 , - HDMI_AUDIO_FMT_MPEG2 , - HDMI_AUDIO_FMT_AAC , - HDMI_AUDIO_FMT_DTS , - HDMI_AUDIO_FMT_ATRAC + HDMI_AUDIO_FMT_AC3, + HDMI_AUDIO_FMT_MPEG1, + HDMI_AUDIO_FMT_MP3, + HDMI_AUDIO_FMT_MPEG2, + HDMI_AUDIO_FMT_AAC, + HDMI_AUDIO_FMT_DTS, + HDMI_AUDIO_FMT_ATRAC, + HDMI_AUDIO_FMT_ONE_BIT, + HDMI_AUDIO_FMT_DD_PLUS, + HDMI_AUDIO_FMT_DTS_HD, + HDMI_AUDIO_FMT_MAT, + HDMI_AUDIO_FMT_DST, + HDMI_AUDIO_FMT_WMA_PRO, + HDMI_AUDIO_FMT_LAST = HDMI_AUDIO_FMT_WMA_PRO } HDMI_AUDIO_FORMAT; #define CS_MAX_AUDIO_DECODERS 1 -#define CS_MAX_AUDIO_FORMATS 10 +#define CS_MAX_AUDIO_FORMATS HDMI_AUDIO_FMT_LAST typedef struct cs_audio_format { HDMI_AUDIO_FORMAT format; @@ -73,6 +79,7 @@ class cDemux; class cVideo; class cAudio { +friend class cVideo; private: static cAudio *instance[CS_MAX_AUDIO_DECODERS]; unsigned int unit; diff --git a/lib/libcoolstream2/playback_cs.h b/lib/libcoolstream2/playback_cs.h index 5a5c61fb6..1f7ded7bd 100644 --- a/lib/libcoolstream2/playback_cs.h +++ b/lib/libcoolstream2/playback_cs.h @@ -12,6 +12,7 @@ #include #include +#include #include typedef enum { diff --git a/lib/libcoolstream2/video_cs.h b/lib/libcoolstream2/video_cs.h index e7aba1ba8..07310e313 100644 --- a/lib/libcoolstream2/video_cs.h +++ b/lib/libcoolstream2/video_cs.h @@ -223,10 +223,10 @@ public: /* get play state */ int getPlayState(void); - void SetVPPDelay(unsigned int delay) { uVPPDisplayDelay = delay;}; + void SetVPPDelay(unsigned int delay) { uVPPDisplayDelay = delay; } void SetVideoDelay(unsigned int delay) { uVideoPTSDelay = delay;}; /* Notification handlers */ - void HandleVPPMessage(int Event, void *pData); + void HandleVPPMessage(void *hHandle, int Event, void *pData); void HandleVideoMessage(void * hHandle, int Event, void *pData); void HandleEncoderMessage(void *hHandle, int Event, void *pData); VIDEO_DEFINITION GetVideoDef(void) { return VideoDefinition; } @@ -270,6 +270,7 @@ public: bool GetScreenImage(unsigned char * &data, int &xres, int &yres, bool get_video = true, bool get_osd = false, bool scale_to_video = false); void SetDemux(cDemux *Demux); static cVideo *GetDecoder(unsigned int Unit); + bool SyncSTC(void); }; #endif // __VIDEO_CS_H_ From a7379d6cee9dfe57f4ec3d73be33df65eb5f032d Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 12 Nov 2013 11:20:27 +0100 Subject: [PATCH 13/77] CComponents: use DEBUG_CC for debug output --- src/gui/components/cc_base.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/gui/components/cc_base.cpp b/src/gui/components/cc_base.cpp index e6ebe16cb..2853b1211 100644 --- a/src/gui/components/cc_base.cpp +++ b/src/gui/components/cc_base.cpp @@ -108,14 +108,15 @@ void CComponents::paintFbItems(bool do_save_bg) for(size_t i=0; i< v_fbdata.size() ;i++){ // Don't paint if dx or dy are 0 if ((v_fbdata[i].dx == 0) || (v_fbdata[i].dy == 0)){ -// printf(" [CComponents] WARNING:\n [%s - %d], dx = %d\n dy = %d\n", __FUNCTION__, __LINE__, v_fbdata[i].dx, v_fbdata[i].dy); +#ifdef DEBUG_CC + printf(" [CComponents] WARNING: [%s - %d], dx = %d dy = %d\n", __FUNCTION__, __LINE__, v_fbdata[i].dx, v_fbdata[i].dy); +#endif continue; } -#if 0 if ((v_fbdata[i].x == 0) || (v_fbdata[i].y == 0)){ - printf(" [CComponents] WARNING:\n [%s - %d], x = %d\n y = %d\n", __FUNCTION__, __LINE__, v_fbdata[i].x, v_fbdata[i].y); + printf(" [CComponents] WARNING: [%s - %d], x = %d y = %d\n", __FUNCTION__, __LINE__, v_fbdata[i].x, v_fbdata[i].y); } -#endif + int fbtype = v_fbdata[i].fbdata_type; #ifdef DEBUG_CC From b8bd8c3704c8f1f574d05cacf38c7f9f9d7961df Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 17 Nov 2013 14:59:09 +0100 Subject: [PATCH 14/77] CComponents: move debug enable switch to cc_types.h --- src/gui/components/cc_base.h | 2 +- src/gui/components/cc_types.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/components/cc_base.h b/src/gui/components/cc_base.h index 0f69bbe40..52dffe735 100644 --- a/src/gui/components/cc_base.h +++ b/src/gui/components/cc_base.h @@ -33,7 +33,7 @@ #include #include -//#define DEBUG_CC + /// Basic component class. /*! diff --git a/src/gui/components/cc_types.h b/src/gui/components/cc_types.h index 59fc34243..5a5fb5fe9 100644 --- a/src/gui/components/cc_types.h +++ b/src/gui/components/cc_types.h @@ -30,6 +30,8 @@ #include #include +// #define DEBUG_CC + ///cc item types typedef enum { From cf32badb1027782ce1df1aeaac44a8c3b6e5972e Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 17 Nov 2013 15:16:59 +0100 Subject: [PATCH 15/77] CComponentsExtTextForm: use correct declared type --- src/gui/components/cc_frm_ext_text.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/components/cc_frm_ext_text.cpp b/src/gui/components/cc_frm_ext_text.cpp index 149786e28..ce7c83c4e 100644 --- a/src/gui/components/cc_frm_ext_text.cpp +++ b/src/gui/components/cc_frm_ext_text.cpp @@ -135,7 +135,7 @@ void CComponentsExtTextForm::initText() { //initialize text object if (ccx_text_obj == NULL){ - ccx_text_obj = new CComponentsLabel(); + ccx_text_obj = new CComponentsText(); ccx_text_obj->doPaintBg(false); } From b12ae030731ab443c5581412a753280c042de393 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 17 Nov 2013 16:58:41 +0100 Subject: [PATCH 16/77] CSignalBox: add unified label mode and add member to get value label object defaul mode for value is now CTextBox::NO_AUTO_LINEBREAK | CTextBox::RIGHT --- src/gui/components/cc_frm_signalbars.cpp | 5 +++-- src/gui/components/cc_frm_signalbars.h | 10 +++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/gui/components/cc_frm_signalbars.cpp b/src/gui/components/cc_frm_signalbars.cpp index ea7949519..b2e40f79e 100644 --- a/src/gui/components/cc_frm_signalbars.cpp +++ b/src/gui/components/cc_frm_signalbars.cpp @@ -107,6 +107,7 @@ void CSignalBar::initVarSigBar() dy_font = CNeutrinoFonts::getInstance(); sb_caption_color= COL_INFOBAR_TEXT; + sb_val_mode = CTextBox::NO_AUTO_LINEBREAK | CTextBox::RIGHT; sb_lastsig = 0; sb_signal = 0; @@ -144,7 +145,7 @@ void CSignalBar::initSBarValue() if (sb_vlbl == NULL){ sb_vlbl = new CComponentsLabel(); sb_vlbl->doPaintBg(false); - sb_vlbl->setText("0%", CTextBox::NO_AUTO_LINEBREAK, sb_font); + sb_vlbl->setText(" 0%", sb_val_mode, sb_font); } //move and set dimensions @@ -217,7 +218,7 @@ void CSignalBar::paintScale() i_str << sig; string percent(i_str.str()); percent += "%"; - sb_vlbl->setText(percent, CTextBox::NO_AUTO_LINEBREAK | CTextBox::CENTER, sb_font); + sb_vlbl->setText(percent, sb_val_mode, sb_font); //we must force paint backround, because of changing values sb_vlbl->doPaintBg(true); diff --git a/src/gui/components/cc_frm_signalbars.h b/src/gui/components/cc_frm_signalbars.h index 460270f12..a5730e785 100644 --- a/src/gui/components/cc_frm_signalbars.h +++ b/src/gui/components/cc_frm_signalbars.h @@ -82,6 +82,8 @@ class CSignalBar : public CComponentsForm int sb_vlbl_width; ///property: width of caption int sb_lbl_width; + ///property: text mode of value, predefined type = CTextBox::NO_AUTO_LINEBREAK | CTextBox::CENTER + int sb_val_mode; ///cache last assingned signal value int sb_lastsig; @@ -131,8 +133,10 @@ class CSignalBar : public CComponentsForm ///returns the scale object, type = CProgressBar* virtual CProgressBar* getScaleObject(){return sb_scale;}; - ///returns the caption object, type = CComponentsLabel* - virtual CComponentsLabel* getLabelObject(){return sb_lbl;}; + ///returns the value label object, type = CComponentsLabel* + virtual CComponentsLabel* getLabelValObject(){return sb_vlbl;}; + ///returns the name label object, type = CComponentsLabel* + virtual CComponentsLabel* getLabelNameObject(){return sb_lbl;}; ///paint this items virtual void paint(bool do_save_bg); @@ -278,7 +282,7 @@ class CSignalBox : public CComponentsForm ///get caption color of signalbars, see also property 'sbx_caption_color' fb_pixel_t getTextColor(){return sbx_caption_color;}; - ///assigns the width of scale + ///assigns the width of scale in percent related of full width of signal box, the rest is reserved for text void setScaleWidth(const short & scale_width_percent){sbx_scale_w_percent = scale_width_percent;}; ///paint items From 1feec4714a4f52f48aeb589ad8c8a3de716a322f Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 17 Nov 2013 17:05:05 +0100 Subject: [PATCH 17/77] CStreamInfo2: reduce scale width of signal bars If the value is 100%, some parts of text was not displayed. --- src/gui/streaminfo2.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/streaminfo2.cpp b/src/gui/streaminfo2.cpp index c487d274e..9447241d0 100644 --- a/src/gui/streaminfo2.cpp +++ b/src/gui/streaminfo2.cpp @@ -885,8 +885,8 @@ int CStreamInfo2::ts_close () void CStreamInfo2::showSNR () { if (signalbox == NULL){ - signalbox = new CSignalBox(x + 10, yypos, 240/*statusbox->getWidth()-2*/, 50, frontend); - signalbox->setScaleWidth(66); + signalbox = new CSignalBox(x + 10, yypos, 240, 50, frontend); + signalbox->setScaleWidth(60); /*%*/ signalbox->setColorBody(COL_MENUHEAD_PLUS_0); signalbox->setTextColor(COL_INFOBAR_TEXT); signalbox->doPaintBg(true); From 0ae3d34ceb0e5391bcb39dfc8205f8c8f463eb08 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 17 Nov 2013 20:53:45 +0100 Subject: [PATCH 18/77] CComponentsWindow: add missing member paint() This is a partial revert of cbeb9f3ac655788bbda40c835cb4930ad726332e --- src/gui/components/cc_frm.h | 3 +++ src/gui/components/cc_frm_window.cpp | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/src/gui/components/cc_frm.h b/src/gui/components/cc_frm.h index e3cb101d6..9b92e1645 100644 --- a/src/gui/components/cc_frm.h +++ b/src/gui/components/cc_frm.h @@ -317,6 +317,9 @@ class CComponentsWindow : public CComponentsForm ///refresh position and dimension and reinitialize elemenatary properties void Refresh(){initCCWItems();}; + + ///paint all window items, this overwriting paint() from CComponentsForm + virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); }; diff --git a/src/gui/components/cc_frm_window.cpp b/src/gui/components/cc_frm_window.cpp index eef2f81ee..beb623906 100644 --- a/src/gui/components/cc_frm_window.cpp +++ b/src/gui/components/cc_frm_window.cpp @@ -254,3 +254,11 @@ void CComponentsWindow::initCCWItems() addCCItem(ccw_footer); } +void CComponentsWindow::paint(bool do_save_bg) +{ + //prepare items before paint + initCCWItems(); + + //paint form contents + paintForm(do_save_bg); +} From e1f721a8dbec84f34900da66f3571e6f826e7a31 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Mon, 21 Oct 2013 23:00:48 +0200 Subject: [PATCH 19/77] only recreate rcsim.h if necessary TODO: move it from source to object tree --- src/Makefile.am | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 3d3c29d6b..5d1b40ff3 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,8 +1,7 @@ BUILT_SOURCES = rcsim.h -rcsim.h: - pushd $(top_srcdir)/src/ && ./create_rcsim_h.sh > $@ - -.PHONY: rcsim.h +# ugly: this is in the source tree, but belongs into the build dir :-( +rcsim.h: $(srcdir)/driver/rcinput.h $(srcdir)/create_rcsim_h.sh + pushd $(srcdir) && sh ./create_rcsim_h.sh > $@ AM_CXXFLAGS = -fno-rtti -fno-exceptions -D__STDC_FORMAT_MACROS From 80d656e3627323aa6af35469c69ac2de383d3c34 Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Tue, 12 Nov 2013 01:48:48 +0100 Subject: [PATCH 20/77] deutsch.locale: Fix sort order --- data/locale/deutsch.locale | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 100acd626..a69f02516 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -1418,9 +1418,9 @@ moviebrowser.use_dir Verzeichnis verwenden moviebrowser.use_movie_dir Wiedergabeverzeichnis verwenden moviebrowser.use_rec_dir Aufnahmeverzeichnis verwenden moviebrowser.yt_concurrent_connections Gleichzeitige Verbindungen +moviebrowser.yt_error Fehler beim laden des Youtube Feed moviebrowser.yt_history Frühere Suchen moviebrowser.yt_max_history Max. Anzahl früherer Suchen -moviebrowser.yt_error Fehler beim laden des Youtube Feed moviebrowser.yt_max_results Max. Anzahl der zu holenden Feeds moviebrowser.yt_most_discussed Am meisten diskutiert moviebrowser.yt_most_popular Beliebteste Videos From b8b61684df93a6efc4eba0210a21bf118c082218 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 12 Nov 2013 12:19:41 +0100 Subject: [PATCH 21/77] CInfoClock: rework infocklock --- src/gui/components/cc_frm_clock.cpp | 3 +- src/gui/infoclock.cpp | 115 +++++++++++----------------- src/gui/infoclock.h | 72 +++++++++-------- src/gui/volumebar.cpp | 3 +- src/gui/volumebar.h | 2 +- src/neutrino.cpp | 2 +- 6 files changed, 92 insertions(+), 105 deletions(-) diff --git a/src/gui/components/cc_frm_clock.cpp b/src/gui/components/cc_frm_clock.cpp index efc190194..26afa3ea7 100644 --- a/src/gui/components/cc_frm_clock.cpp +++ b/src/gui/components/cc_frm_clock.cpp @@ -60,12 +60,11 @@ CComponentsFrmClock::CComponentsFrmClock( const int x_pos, const int y_pos, cons col_body = color_body; col_shadow = color_shadow; + cl_format_str = format_str; paintClock = false; activeClock = activ; if (activeClock) startThread(); - - cl_format_str = format_str; } void CComponentsFrmClock::initVarClock() diff --git a/src/gui/infoclock.cpp b/src/gui/infoclock.cpp index 9ea868ce9..621c9f9cc 100644 --- a/src/gui/infoclock.cpp +++ b/src/gui/infoclock.cpp @@ -1,41 +1,45 @@ +/* + Based up Neutrino-GUI - Tuxbox-Project + Copyright (C) 2001 by Steffen Hehn 'McClean' + + Info Clock Window + based up CComponentsFrmClock + Copyright (C) 2013, Thilo Graf 'dbt' + Copyright (C) 2013, Michael Liebmann 'micha-bbg' + + License: GPL + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + #ifdef HAVE_CONFIG_H #include #endif #include #include -#include -#include - -#include -#include -#include -#include -#include +// #include #include #include -#define YOFF 0 -CInfoClock::CInfoClock() -{ - frameBuffer = CFrameBuffer::getInstance(); - x = y = clock_x = 0; - time_height = time_width = thrTimer = 0; - Init(); -} -CInfoClock::~CInfoClock() +CInfoClock::CInfoClock():CComponentsFrmClock( 0, 0, 0, 50, "%H:%M:%S", true, CC_SHADOW_OFF, COL_LIGHT_GRAY, COL_MENUCONTENT_PLUS_0,COL_MENUCONTENTDARK_PLUS_0) { - if(thrTimer) - pthread_cancel(thrTimer); - thrTimer = 0; -} - -void CInfoClock::Init() -{ - CVolumeHelper::getInstance()->refresh(); - CVolumeHelper::getInstance()->getInfoClockDimensions(&clock_x, &y, &time_width, &time_height, &digit_h, &digit_offset); + initVarInfoClock(); } CInfoClock* CInfoClock::getInstance() @@ -46,64 +50,35 @@ CInfoClock* CInfoClock::getInstance() return InfoClock; } -void CInfoClock::paintTime( bool show_dot) +void CInfoClock::initVarInfoClock() { - char timestr[20]; - int dummy, mute_dx, h_spacer; - time_t tm = time(0); - strftime((char*) ×tr, sizeof(timestr), "%H:%M:%S", localtime(&tm)); - timestr[2] = show_dot ? ':':'.'; - - CVolumeHelper *cvh = CVolumeHelper::getInstance(); - cvh->getInfoClockDimensions(&clock_x, &y, &time_width, &time_height, &digit_h, &digit_offset); - cvh->getMuteIconDimensions(&dummy, &dummy, &mute_dx, &dummy); - cvh->getSpacer(&h_spacer, &dummy); - if (CNeutrinoApp::getInstance()->isMuted()) - clock_x -= (mute_dx + h_spacer); - - int x_diff = (time_width - g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->getRenderWidth(timestr)) / 2; - frameBuffer->paintBoxRel(clock_x, y, time_width, time_height, COL_MENUCONTENT_PLUS_0, RADIUS_SMALL); - g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->RenderString(clock_x + x_diff, y + digit_h + digit_offset + ((time_height - digit_h) / 2), time_width, timestr, COL_MENUCONTENT_TEXT); + cl_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]; + Init(); } -void* CInfoClock::TimerProc(void *arg) +void CInfoClock::Init() { - - bool show_dot = false; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE,0); - pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS,0); - - CInfoClock *InfoClock = static_cast(arg); - InfoClock->paintTime(show_dot); - while(1) { - sleep(1); - show_dot = !show_dot; - InfoClock->paintTime(show_dot); - } - return 0; + CVolumeHelper::getInstance()->refresh(); + CVolumeHelper::getInstance()->getInfoClockDimensions(&x, &y, &width, &height); + initCCLockItems(); } void CInfoClock::ClearDisplay() { - frameBuffer->paintBackgroundBoxRel(clock_x, y, time_width, time_height); + kill(); Init(); } -void CInfoClock::StartClock() +bool CInfoClock::StartClock() { Init(); - - if(!thrTimer) { - pthread_create (&thrTimer, NULL, TimerProc, (void*) this) ; - pthread_detach(thrTimer); - } + return Start(); } -void CInfoClock::StopClock() +bool CInfoClock::StopClock() { - if(thrTimer) { - pthread_cancel(thrTimer); - thrTimer = 0; - frameBuffer->paintBackgroundBoxRel(clock_x, y, time_width, time_height); - } + bool ret = Stop(); + kill(); + + return ret; } diff --git a/src/gui/infoclock.h b/src/gui/infoclock.h index 8d578181d..18899e2b4 100644 --- a/src/gui/infoclock.h +++ b/src/gui/infoclock.h @@ -1,39 +1,51 @@ -#ifndef __infoclock__ -#define __infoclock__ +/* + Based up Neutrino-GUI - Tuxbox-Project + Copyright (C) 2001 by Steffen Hehn 'McClean' + + Info Clock Window + based up CComponentsFrmClock + Copyright (C) 2013, Thilo Graf 'dbt' + Copyright (C) 2013, Michael Liebmann 'micha-bbg' + + License: GPL + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef __INFOCLOCK__ +#define __INFOCLOCK__ -#include -#include -#include - -#include - -#include +#include -class CInfoClock +class CInfoClock : public CComponentsFrmClock { - private: - CFrameBuffer * frameBuffer; + protected: + void initVarInfoClock(); + private: + void Init(); + public: + CInfoClock(); + // ~CInfoClock(); // inherited from CComponentsFrmClock + static CInfoClock* getInstance(); - pthread_t thrTimer; - void paintTime( bool show_dot); - int time_offset, digit_offset, digit_h; - int x, y, clock_x; - void Init(); - static void CleanUpProc(void* arg); - static void* TimerProc(void *arg); - - public: - CInfoClock(); - ~CInfoClock(); - static CInfoClock* getInstance(); - - void StartClock(); - void StopClock(); - void ClearDisplay(); - - int time_width, time_height; + bool StartClock(); + bool StopClock(); + void ClearDisplay(); }; #endif diff --git a/src/gui/volumebar.cpp b/src/gui/volumebar.cpp index f2c1ade75..3b8445fe7 100644 --- a/src/gui/volumebar.cpp +++ b/src/gui/volumebar.cpp @@ -101,7 +101,7 @@ void CVolumeBar::initVolumeBarSize() cvh->getMuteIconDimensions(&mute_ax, &mute_ay, &mute_dx, &mute_dy); // info clock int dummy; - cvh->getInfoClockDimensions(&dummy, &clock_y, &clock_width, &clock_height, &dummy, &dummy); + cvh->getInfoClockDimensions(&dummy, &clock_y, &clock_width, &clock_height); int mute_corrY = 0; if (mute_dy < height) mute_corrY = (height - mute_dy) / 2; @@ -111,6 +111,7 @@ void CVolumeBar::initVolumeBarSize() CInfoClock::getInstance()->ClearDisplay(); vb_pbh = height-8; + vb_pby = height/2-vb_pbh/2; } diff --git a/src/gui/volumebar.h b/src/gui/volumebar.h index c19b04424..d6a43b4e8 100644 --- a/src/gui/volumebar.h +++ b/src/gui/volumebar.h @@ -123,7 +123,7 @@ class CVolumeHelper int getVolIconHeight() {return icon_height;} void getDimensions(int *_x, int *_y, int *_sw, int *_sh, int *_iw, int *_dw) { *_x = x; *_y = y; *_sw = sw; *_sh = sh; *_iw = icon_width; *_dw = digit_width; } void getMuteIconDimensions(int *_x, int *_y, int *w, int *h) { *_x = mute_ax; *_y = mute_ay+mute_corrY; *w = mute_dx; *h = mute_dy; } - void getInfoClockDimensions(int *_x, int *_y, int *w, int *h, int *d_h, int *d_o) { *_x = clock_ax; *_y = clock_ay; *w = clock_dx; *h = clock_dy, *d_h = digit_h, *d_o = digit_offset; } + void getInfoClockDimensions(int *_x, int *_y, int *w, int *h/*, int *d_h, int *d_o*/) { *_x = clock_ax; *_y = clock_ay; *w = clock_dx; *h = clock_dy/*, *d_h = digit_h, *d_o = digit_offset*/; } void getVolBarDimensions(int *_y, int *_dy) { *_y = vol_ay; *_dy = vol_height; } void setMuteIconCorrY(int corr) { mute_corrY = corr; } void refresh(); diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 559ea61fa..2fcb1463e 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -2028,7 +2028,7 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) InfoClock = CInfoClock::getInstance(); if(g_settings.mode_clock) - InfoClock->StartClock(); + g_settings.mode_clock = InfoClock->StartClock(); //cCA::GetInstance()->Ready(true); From 6a5d335430fc8432c8af303fc4c005d73fda7c49 Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Wed, 20 Nov 2013 05:49:44 +0100 Subject: [PATCH 22/77] CInfoClock: Fix paint info clock when mute icon is displayed --- src/gui/infoclock.cpp | 14 +++++++++++++- src/gui/infoclock.h | 1 + src/gui/volumebar.cpp | 8 ++++++++ src/gui/volumebar.h | 3 ++- 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/gui/infoclock.cpp b/src/gui/infoclock.cpp index 621c9f9cc..876cce7b7 100644 --- a/src/gui/infoclock.cpp +++ b/src/gui/infoclock.cpp @@ -31,7 +31,6 @@ #include #include -// #include #include #include @@ -82,3 +81,16 @@ bool CInfoClock::StopClock() return ret; } + +void CInfoClock::paint(bool do_save_bg) +{ + // calculate current x-position of clock (mute icon on/off) + x = CVolumeHelper::getInstance()->getInfoClockX(); + setXPos(x); + + //prepare items before paint + initCCLockItems(); + + //paint the clock + paintForm(do_save_bg); +} diff --git a/src/gui/infoclock.h b/src/gui/infoclock.h index 18899e2b4..ffa67fb20 100644 --- a/src/gui/infoclock.h +++ b/src/gui/infoclock.h @@ -46,6 +46,7 @@ class CInfoClock : public CComponentsFrmClock bool StartClock(); bool StopClock(); void ClearDisplay(); + void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); }; #endif diff --git a/src/gui/volumebar.cpp b/src/gui/volumebar.cpp index 3b8445fe7..755489e93 100644 --- a/src/gui/volumebar.cpp +++ b/src/gui/volumebar.cpp @@ -340,6 +340,14 @@ void CVolumeHelper::initVolBarSize() } } +int CVolumeHelper::getInfoClockX() +{ + if (CNeutrinoApp::getInstance()->isMuted()) + return clock_ax - mute_dx - h_spacer; + else + return clock_ax; +} + void CVolumeHelper::refresh() { Init(); diff --git a/src/gui/volumebar.h b/src/gui/volumebar.h index d6a43b4e8..ccf7901e3 100644 --- a/src/gui/volumebar.h +++ b/src/gui/volumebar.h @@ -123,7 +123,8 @@ class CVolumeHelper int getVolIconHeight() {return icon_height;} void getDimensions(int *_x, int *_y, int *_sw, int *_sh, int *_iw, int *_dw) { *_x = x; *_y = y; *_sw = sw; *_sh = sh; *_iw = icon_width; *_dw = digit_width; } void getMuteIconDimensions(int *_x, int *_y, int *w, int *h) { *_x = mute_ax; *_y = mute_ay+mute_corrY; *w = mute_dx; *h = mute_dy; } - void getInfoClockDimensions(int *_x, int *_y, int *w, int *h/*, int *d_h, int *d_o*/) { *_x = clock_ax; *_y = clock_ay; *w = clock_dx; *h = clock_dy/*, *d_h = digit_h, *d_o = digit_offset*/; } + int getInfoClockX(); + void getInfoClockDimensions(int *_x, int *_y, int *w, int *h) { *_x = getInfoClockX(); *_y = clock_ay; *w = clock_dx; *h = clock_dy; } void getVolBarDimensions(int *_y, int *_dy) { *_y = vol_ay; *_dy = vol_height; } void setMuteIconCorrY(int corr) { mute_corrY = corr; } void refresh(); From 7466d6f19c08aa0d90ba5aca02897c6783d73570 Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Fri, 22 Nov 2013 08:52:08 +0100 Subject: [PATCH 23/77] InfoClock: Fix display clock in movie browser, file browser etc. --- src/gui/components/cc_frm_clock.cpp | 3 +-- src/gui/infoclock.cpp | 16 +++++++++++ src/gui/infoclock.h | 1 + src/gui/mediaplayer.cpp | 4 +++ src/gui/movieplayer.cpp | 12 ++++++--- src/gui/pictureviewer.cpp | 4 +++ src/gui/timeosd.cpp | 8 ++---- src/gui/upnpbrowser.cpp | 4 +++ src/gui/volumebar.cpp | 3 --- src/neutrino.cpp | 42 ++++++++++++----------------- 10 files changed, 57 insertions(+), 40 deletions(-) diff --git a/src/gui/components/cc_frm_clock.cpp b/src/gui/components/cc_frm_clock.cpp index 26afa3ea7..7e0493176 100644 --- a/src/gui/components/cc_frm_clock.cpp +++ b/src/gui/components/cc_frm_clock.cpp @@ -251,8 +251,6 @@ void* CComponentsFrmClock::initClockThread(void *arg) time_t count = time(0); //start loop for paint while(1) { - sleep(clock->cl_interval); - if (clock->paintClock) { //refresh item property values clock->refresh(); @@ -265,6 +263,7 @@ void* CComponentsFrmClock::initClockThread(void *arg) clock->cl_thread = 0; break; } + sleep(clock->cl_interval); } return 0; } diff --git a/src/gui/infoclock.cpp b/src/gui/infoclock.cpp index 876cce7b7..fd58fccd3 100644 --- a/src/gui/infoclock.cpp +++ b/src/gui/infoclock.cpp @@ -94,3 +94,19 @@ void CInfoClock::paint(bool do_save_bg) //paint the clock paintForm(do_save_bg); } + +bool CInfoClock::enableInfoClock(bool enable) +{ + bool ret = false; + if (g_settings.mode_clock) { + if (enable) { + if (!paintClock) + ret = StartClock(); + } + else { + if (paintClock) + ret = StopClock(); + } + } + return ret; +} diff --git a/src/gui/infoclock.h b/src/gui/infoclock.h index ffa67fb20..ebefb2686 100644 --- a/src/gui/infoclock.h +++ b/src/gui/infoclock.h @@ -45,6 +45,7 @@ class CInfoClock : public CComponentsFrmClock bool StartClock(); bool StopClock(); + bool enableInfoClock(bool enable); void ClearDisplay(); void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); }; diff --git a/src/gui/mediaplayer.cpp b/src/gui/mediaplayer.cpp index f3ce226ce..fd577a8ab 100644 --- a/src/gui/mediaplayer.cpp +++ b/src/gui/mediaplayer.cpp @@ -39,6 +39,7 @@ #include #include +#include #include #include #if ENABLE_UPNP @@ -52,6 +53,7 @@ #include #include extern cVideo * videoDecoder; +extern CInfoClock *InfoClock; CMediaPlayerMenu::CMediaPlayerMenu() { @@ -106,6 +108,7 @@ int CMediaPlayerMenu::exec(CMenuTarget* parent, const std::string &actionKey) else if (actionKey == "movieplayer") { audiomute->enableMuteIcon(false); + InfoClock->enableInfoClock(false); int mode = CNeutrinoApp::getInstance()->getMode(); if( mode == NeutrinoMessages::mode_radio ) videoDecoder->StopPicture(); @@ -113,6 +116,7 @@ int CMediaPlayerMenu::exec(CMenuTarget* parent, const std::string &actionKey) if( mode == NeutrinoMessages::mode_radio ) videoDecoder->ShowPicture(DATADIR "/neutrino/icons/radiomode.jpg"); audiomute->enableMuteIcon(true); + InfoClock->enableInfoClock(true); return res; } diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index 1b9ae1f4a..05a1349a6 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -203,6 +203,7 @@ int CMoviePlayerGui::exec(CMenuTarget * parent, const std::string & actionKey) } else if (actionKey == "ytplayback") { CAudioMute::getInstance()->enableMuteIcon(false); + InfoClock->enableInfoClock(false); isMovieBrowser = true; moviebrowser->setMode(MB_SHOW_YT); } @@ -245,8 +246,10 @@ int CMoviePlayerGui::exec(CMenuTarget * parent, const std::string & actionKey) CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO); - if (moviebrowser->getMode() == MB_SHOW_YT) + if (moviebrowser->getMode() == MB_SHOW_YT) { CAudioMute::getInstance()->enableMuteIcon(true); + InfoClock->enableInfoClock(true); + } if (timeshift){ timeshift = 0; @@ -399,6 +402,7 @@ bool CMoviePlayerGui::SelectFile() } else { // filebrowser CAudioMute::getInstance()->enableMuteIcon(false); + InfoClock->enableInfoClock(false); if (filebrowser->exec(Path_local.c_str()) == true) { Path_local = filebrowser->getCurrentDir(); CFile *file; @@ -437,6 +441,7 @@ bool CMoviePlayerGui::SelectFile() } else menu_ret = filebrowser->getMenuRet(); CAudioMute::getInstance()->enableMuteIcon(true); + InfoClock->enableInfoClock(true); } if(ret && file_name.empty()) { std::string::size_type pos = full_name.find_last_of('/'); @@ -573,6 +578,7 @@ void CMoviePlayerGui::PlayFile(void) } CAudioMute::getInstance()->enableMuteIcon(true); + InfoClock->enableInfoClock(true); while (playstate >= CMoviePlayerGui::PLAY) { @@ -835,9 +841,7 @@ void CMoviePlayerGui::PlayFile(void) restoreNeutrino(); CAudioMute::getInstance()->enableMuteIcon(false); - - if (g_settings.mode_clock) - InfoClock->StartClock(); + InfoClock->enableInfoClock(false); } void CMoviePlayerGui::callInfoViewer(/*const int duration, const int curr_pos*/) diff --git a/src/gui/pictureviewer.cpp b/src/gui/pictureviewer.cpp index 58ef0afe8..fcf8292ef 100644 --- a/src/gui/pictureviewer.cpp +++ b/src/gui/pictureviewer.cpp @@ -53,6 +53,7 @@ #include #include #include +#include #include #include @@ -72,6 +73,7 @@ #include extern cVideo * videoDecoder; +extern CInfoClock *InfoClock; //------------------------------------------------------------------------ bool comparePictureByDate (const CPicture& a, const CPicture& b) @@ -254,6 +256,7 @@ int CPictureViewerGui::show() m_currentTitle = m_audioPlayer->getAudioPlayerM_current(); CAudioMute::getInstance()->enableMuteIcon(false); + InfoClock->enableInfoClock(false); while (loop) { @@ -638,6 +641,7 @@ int CPictureViewerGui::show() hide(); CAudioMute::getInstance()->enableMuteIcon(true); + InfoClock->enableInfoClock(true); return(res); } diff --git a/src/gui/timeosd.cpp b/src/gui/timeosd.cpp index 0978e927d..dedbfc780 100644 --- a/src/gui/timeosd.cpp +++ b/src/gui/timeosd.cpp @@ -54,8 +54,7 @@ CTimeOSD::~CTimeOSD() void CTimeOSD::show(time_t time_show) { - if (g_settings.mode_clock) - InfoClock->StartClock(); + InfoClock->enableInfoClock(false); GetDimensions(); visible = true; @@ -77,8 +76,6 @@ void CTimeOSD::GetDimensions() m_width = g_Font[TIMEOSD_FONT]->getRenderWidth("00:00:00"); t1 = g_Font[TIMEOSD_FONT]->getRenderWidth(widest_number); m_width += t1; - if(g_settings.mode_clock) - m_xend = m_xend - m_width - (m_width/4); } void CTimeOSD::update(time_t time_show) @@ -142,8 +139,7 @@ void CTimeOSD::hide() if(!visible) return; - if (g_settings.mode_clock) - InfoClock->StopClock(); + InfoClock->enableInfoClock(true); //GetDimensions(); frameBuffer->paintBackgroundBoxRel(m_xend - m_width - t1, m_y, m_width, m_height); diff --git a/src/gui/upnpbrowser.cpp b/src/gui/upnpbrowser.cpp index ef771c75b..f5ea2e49d 100644 --- a/src/gui/upnpbrowser.cpp +++ b/src/gui/upnpbrowser.cpp @@ -51,6 +51,7 @@ #include #include +#include #include #include @@ -66,6 +67,7 @@ extern cVideo * videoDecoder; extern CPictureViewer * g_PicViewer; +extern CInfoClock *InfoClock; const struct button_label RescanButton = {NEUTRINO_ICON_BUTTON_BLUE , LOCALE_UPNPBROWSER_RESCAN}; const struct button_label BrowseButtons[4] = @@ -453,6 +455,7 @@ void CUpnpBrowserGui::selectDevice() return; CAudioMute::getInstance()->enableMuteIcon(false); + InfoClock->enableInfoClock(false); while (loop) { @@ -542,6 +545,7 @@ printf("msg: %x\n", (int) msg); } } CAudioMute::getInstance()->enableMuteIcon(true); + InfoClock->enableInfoClock(true); } void CUpnpBrowserGui::playnext(void) diff --git a/src/gui/volumebar.cpp b/src/gui/volumebar.cpp index 755489e93..0f55401f5 100644 --- a/src/gui/volumebar.cpp +++ b/src/gui/volumebar.cpp @@ -107,9 +107,6 @@ void CVolumeBar::initVolumeBarSize() mute_corrY = (height - mute_dy) / 2; cvh->setMuteIconCorrY(mute_corrY); - if ((g_settings.mode_clock) && (!CNeutrinoApp::getInstance()->isMuted())) - CInfoClock::getInstance()->ClearDisplay(); - vb_pbh = height-8; vb_pby = height/2-vb_pbh/2; diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 2fcb1463e..175f9e988 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -2056,8 +2056,7 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) else if( msg == CRCInput::RC_text) { g_RCInput->clearRCMsg(); - if(g_settings.mode_clock) - InfoClock->StopClock(); + InfoClock->enableInfoClock(false); StopSubtitles(); tuxtx_stop_subtitle(); @@ -2067,19 +2066,16 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) //if(!g_settings.cacheTXT) // tuxtxt_stop(); g_RCInput->clearRCMsg(); - if(g_settings.mode_clock) - InfoClock->StartClock(); + InfoClock->enableInfoClock(true); StartSubtitles(); } else if( msg == CRCInput::RC_setup ) { if(!g_settings.minimode) { StopSubtitles(); - if(g_settings.mode_clock) - InfoClock->StopClock(); + InfoClock->enableInfoClock(false); int old_ttx = g_settings.cacheTXT; mainMenu.exec(NULL, ""); - if(g_settings.mode_clock) - InfoClock->StartClock(); + InfoClock->enableInfoClock(true); StartSubtitles(); saveSetup(NEUTRINO_SETTINGS_FILE); if (!g_settings.epg_scan) @@ -2146,8 +2142,8 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) else if( msg == (neutrino_msg_t) g_settings.key_zaphistory ) { // Zap-History "Bouquet" if(g_settings.mode_clock && g_settings.key_zaphistory == CRCInput::RC_home) { - g_settings.mode_clock=false; - InfoClock->StopClock(); + InfoClock->enableInfoClock(false); + g_settings.mode_clock = false; } else { numericZap( msg ); } @@ -2306,8 +2302,8 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) else { if (msg == CRCInput::RC_home) { if(g_settings.mode_clock && g_settings.key_zaphistory == CRCInput::RC_home) { - g_settings.mode_clock=false; - InfoClock->StopClock(); + InfoClock->enableInfoClock(false); + g_settings.mode_clock = false; } CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO); } @@ -2332,8 +2328,7 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) int CNeutrinoApp::showChannelList(const neutrino_msg_t _msg, bool from_menu) { neutrino_msg_t msg = _msg; - if(g_settings.mode_clock) - InfoClock->StopClock(); + InfoClock->enableInfoClock(false); StopSubtitles(); @@ -2417,8 +2412,8 @@ _repeat: goto _show; } - if(!from_menu && g_settings.mode_clock) - InfoClock->StartClock(); + if (!from_menu) + InfoClock->enableInfoClock(true); return ((nNewChannel >= 0) ? menu_return::RETURN_EXIT_ALL : menu_return::RETURN_REPAINT); } @@ -3308,9 +3303,7 @@ void CNeutrinoApp::standbyMode( bool bOnOff, bool fromDeepStandby ) } CVFD::getInstance()->setBacklight(g_settings.backlight_standby); - if(g_settings.mode_clock) { - InfoClock->StopClock(); - } + InfoClock->enableInfoClock(false); //remember tuned channel-id standby_channel_id = CZapit::getInstance()->GetCurrentChannelID(); @@ -3389,8 +3382,7 @@ void CNeutrinoApp::standbyMode( bool bOnOff, bool fromDeepStandby ) g_Sectionsd->setPauseScanning(false); //g_Sectionsd->setServiceChanged(live_channel_id, true ); - if(g_settings.mode_clock) - InfoClock->StartClock(); + InfoClock->enableInfoClock(true); g_audioMute->AudioMute(current_muted, true); StartSubtitles(); @@ -3454,11 +3446,11 @@ void CNeutrinoApp::switchTvRadioMode(const int prev_mode) void CNeutrinoApp::switchClockOnOff() { if(g_settings.mode_clock) { - g_settings.mode_clock=false; - InfoClock->StopClock(); + InfoClock->enableInfoClock(false); + g_settings.mode_clock = false; } else { - g_settings.mode_clock=true; - InfoClock->StartClock(); + g_settings.mode_clock = true; + InfoClock->enableInfoClock(true); } } From 44cddc05d92bf12ab909b2d92cd5e7389cdde57d Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Fri, 22 Nov 2013 12:10:26 +0100 Subject: [PATCH 24/77] - helpers.cpp: simplify check_dir(); ported from martii --- src/system/helpers.cpp | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp index 2c5285058..1c7542108 100644 --- a/src/system/helpers.cpp +++ b/src/system/helpers.cpp @@ -212,30 +212,15 @@ int check_dir(const char * dir, bool allow_tmp) int ret = -1; struct statfs s; if (::statfs(dir, &s) == 0) { - switch (s.f_type) /* f_type is long */ - { - case 0xEF53L: /*EXT2 & EXT3*/ - case 0x6969L: /*NFS*/ - case 0xFF534D42L: /*CIFS*/ - case 0x517BL: /*SMB*/ - case 0x52654973L: /*REISERFS*/ - case 0x65735546L: /*fuse for ntfs*/ - case 0x58465342L: /*xfs*/ - case 0x4d44L: /*msdos*/ - case 0x0187: /* AUTOFS_SUPER_MAGIC */ -#if 0 - case 0x72b6L: /*jffs2*/ -#endif - ret = 0;//ok - break; - case 0x858458f6L: /*ramfs*/ - case 0x1021994: /*TMPFS_MAGIC*/ + switch (s.f_type) { + case 0x858458f6L: // ramfs + case 0x1021994L: // tmpfs if(allow_tmp) ret = 0;//ok + case 0x72b6L: // jffs2 break; default: - fprintf(stderr, "%s Unknown filesystem type: 0x%x\n", dir, (int)s.f_type); - break; // error + ret = 0; // ok } } return ret; From 57267a28aa0d8a730d6c3cfc4dcb4b4b9799d5ed Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Fri, 22 Nov 2013 12:35:20 +0100 Subject: [PATCH 25/77] - helpers.cpp: port safe_mkdir() from martii --- src/gui/hdd_menu.cpp | 12 ++++++------ src/system/helpers.cpp | 31 ++++++++++++++++++++----------- src/system/helpers.h | 4 +++- 3 files changed, 29 insertions(+), 18 deletions(-) diff --git a/src/gui/hdd_menu.cpp b/src/gui/hdd_menu.cpp index 79a68614e..beeeda119 100644 --- a/src/gui/hdd_menu.cpp +++ b/src/gui/hdd_menu.cpp @@ -494,17 +494,17 @@ _remount: if(!res) { snprintf(cmd, sizeof(cmd), "%s/movies", dst); - safe_mkdir((char *) cmd); + safe_mkdir(cmd); snprintf(cmd, sizeof(cmd), "%s/pictures", dst); - safe_mkdir((char *) cmd); + safe_mkdir(cmd); snprintf(cmd, sizeof(cmd), "%s/epg", dst); - safe_mkdir((char *) cmd); + safe_mkdir(cmd); snprintf(cmd, sizeof(cmd), "%s/music", dst); - safe_mkdir((char *) cmd); + safe_mkdir(cmd); snprintf(cmd, sizeof(cmd), "%s/logos", dst); - safe_mkdir((char *) cmd); + safe_mkdir(cmd); snprintf(cmd, sizeof(cmd), "%s/plugins", dst); - safe_mkdir((char *) cmd); + safe_mkdir(cmd); sync(); } _return: diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp index 1c7542108..9b67a0f34 100644 --- a/src/system/helpers.cpp +++ b/src/system/helpers.cpp @@ -190,19 +190,28 @@ FILE* my_popen( pid_t& pid, const char *cmdstring, const char *type) return(fp); } -int safe_mkdir(char * path) +int safe_mkdir(const char * path) { struct statfs s; - int ret = 0; - if(!strncmp(path, "/hdd", 4)) { - ret = statfs("/hdd", &s); - if((ret != 0) || (s.f_type == 0x72b6)) - ret = -1; - else - mkdir(path, 0755); - } else - mkdir(path, 0755); - return ret; + size_t l = strlen(path); + char d[l + 3]; + strncpy(d, path, l); + + // skip trailing slashes + while (l > 0 && d[l - 1] == '/') + l--; + // find last slash + while (l > 0 && d[l - 1] != '/') + l--; + if (!l) + return -1; + // append a single dot + d[l++] = '.'; + d[l] = 0; + + if(statfs(d, &s) || (s.f_type == 0x72b6 /* jffs2 */)) + return -1; + return mkdir(path, 0755); } /* function used to check is this dir writable, i.e. not flash, for record etc */ diff --git a/src/system/helpers.h b/src/system/helpers.h index d9d4b6108..9639c39bf 100644 --- a/src/system/helpers.h +++ b/src/system/helpers.h @@ -30,7 +30,9 @@ int my_system(const char * cmd); int my_system(int argc, const char *arg, ...); /* argc is number of arguments including command */ FILE* my_popen( pid_t& pid, const char *cmdstring, const char *type); -int safe_mkdir(char * path); + +int safe_mkdir(const char * path); +inline int safe_mkdir(std::string path) { return safe_mkdir(path.c_str()); } off_t file_size(const char *filename); bool file_exists(const char *filename); void wakeup_hdd(const char *hdd_dir); From 97cb0248f8f9ac53b98212714f5cc18d4cb5a8d6 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Fri, 22 Nov 2013 12:44:05 +0100 Subject: [PATCH 26/77] - hdd_menu: create destination before mount --- src/gui/hdd_menu.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/hdd_menu.cpp b/src/gui/hdd_menu.cpp index beeeda119..5e5904c1f 100644 --- a/src/gui/hdd_menu.cpp +++ b/src/gui/hdd_menu.cpp @@ -478,9 +478,11 @@ _remount: switch(g_settings.hdd_fs) { case 0: + safe_mkdir(dst); res = mount(src, dst, "ext3", 0, NULL); break; case 1: + safe_mkdir(dst); res = mount(src, dst, "reiserfs", 0, NULL); break; default: @@ -602,9 +604,11 @@ printf("CHDDChkExec: key %s\n", key.c_str()); ret1: switch(g_settings.hdd_fs) { case 0: + safe_mkdir(dst); res = mount(src, dst, "ext3", 0, NULL); break; case 1: + safe_mkdir(dst); res = mount(src, dst, "reiserfs", 0, NULL); break; default: From d52e750de7b89a9c5eadd374d0b94580541fa52e Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Fri, 22 Nov 2013 13:12:55 +0100 Subject: [PATCH 27/77] - data/locale/Makefile.am: remove circular dependency --- data/locale/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/locale/Makefile.am b/data/locale/Makefile.am index 845a8b4f4..1ba27fe77 100644 --- a/data/locale/Makefile.am +++ b/data/locale/Makefile.am @@ -31,7 +31,7 @@ master.locale=english.locale locals: sort-locals work-locals locals.h locals_intern.h $(master.locale) \ -sort-locals: $(top_srcdir)/data/locale/$(master.locale) +sort-locals: for locale in $(locale); do \ cat $(top_srcdir)/data/locale/$${locale} | LC_ALL=C sort | uniq > $${locale}; \ done From 68bb453a35a9be909803d1afcc07604072164fe1 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Sat, 23 Nov 2013 00:22:12 +0100 Subject: [PATCH 28/77] - infoviewer_bb: enable radiotext-icons --- src/gui/infoviewer_bb.cpp | 26 ++++++++++---------------- src/gui/widget/icons.h | 3 +++ 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/gui/infoviewer_bb.cpp b/src/gui/infoviewer_bb.cpp index 305d57939..362a22af9 100644 --- a/src/gui/infoviewer_bb.cpp +++ b/src/gui/infoviewer_bb.cpp @@ -62,7 +62,6 @@ extern CRemoteControl *g_RemoteControl; /* neutrino.cpp */ extern cVideo * videoDecoder; -//#define SHOW_RADIOTEXT_ICON #define COL_INFOBAR_BUTTONS_BACKGROUND (COL_INFOBAR_SHADOW_PLUS_1) CInfoViewerBB::CInfoViewerBB() @@ -173,12 +172,10 @@ void CInfoViewerBB::getBBIconInfo() if (neutrino->getMode() != NeutrinoMessages::mode_radio) iconView = checkBBIcon(NEUTRINO_ICON_VTXT, &w, &h); break; -#ifdef SHOW_RADIOTEXT_ICON case CInfoViewerBB::ICON_RT: if (neutrino->getMode() == NeutrinoMessages::mode_radio) - iconView = checkBBIcon(NEUTRINO_ICON_RT, &w, &h); + iconView = checkBBIcon(NEUTRINO_ICON_RADIOTEXTGET, &w, &h); break; -#endif case CInfoViewerBB::ICON_DD: if( g_settings.infobar_show_dd_available ) iconView = checkBBIcon(NEUTRINO_ICON_DD, &w, &h); @@ -478,22 +475,19 @@ void CInfoViewerBB::showIcon_DD() showBBIcons(CInfoViewerBB::ICON_DD, dd_icon); } -#ifdef SHOW_RADIOTEXT_ICON void CInfoViewerBB::showIcon_RadioText(bool rt_available) { - // TODO: display radiotext icon - if ((showButtonBar) && (is_visible)) - { - int mode = CNeutrinoApp::getInstance()->getMode(); + if (!is_visible || !g_settings.radiotext_enable) + return; - showBBIcons(CInfoViewerBB::ICON_RT, rt_icon); - } + std::string rt_icon; + if (rt_available) + rt_icon = (g_Radiotext->S_RtOsd) ? NEUTRINO_ICON_RADIOTEXTGET : NEUTRINO_ICON_RADIOTEXTWAIT; + else + rt_icon = NEUTRINO_ICON_RADIOTEXTOFF; + + showBBIcons(CInfoViewerBB::ICON_RT, rt_icon); } -#else -void CInfoViewerBB::showIcon_RadioText(bool /*rt_available*/) -{ -} -#endif void CInfoViewerBB::showIcon_16_9() { diff --git a/src/gui/widget/icons.h b/src/gui/widget/icons.h index c74164a90..772528232 100644 --- a/src/gui/widget/icons.h +++ b/src/gui/widget/icons.h @@ -110,6 +110,9 @@ #define NEUTRINO_ICON_FF "mp_f-skip" #define NEUTRINO_ICON_PROTECTING "protecting" #define NEUTRINO_ICON_QUESTION "question" +#define NEUTRINO_ICON_RADIOTEXTGET "radiotextget" +#define NEUTRINO_ICON_RADIOTEXTWAIT "radiotextwait" +#define NEUTRINO_ICON_RADIOTEXTOFF "radiotextoff" #define NEUTRINO_ICON_RADIOMODE "radiomode" #define NEUTRINO_ICON_RECORDING "recording" #define NEUTRINO_ICON_REC "rec" From 98e48a76a83c5d34c74b71ac0f0bc91530721dfb Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 20 Nov 2013 21:56:35 +0100 Subject: [PATCH 29/77] CInfoClock: remove not required call of setXPos() CInfoClock is derived from class ComponentsFrmClock, so we can use already available members. --- src/gui/infoclock.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/infoclock.cpp b/src/gui/infoclock.cpp index fd58fccd3..b7e5c4c8e 100644 --- a/src/gui/infoclock.cpp +++ b/src/gui/infoclock.cpp @@ -86,7 +86,6 @@ void CInfoClock::paint(bool do_save_bg) { // calculate current x-position of clock (mute icon on/off) x = CVolumeHelper::getInstance()->getInfoClockX(); - setXPos(x); //prepare items before paint initCCLockItems(); From 15e6203ca2b1e578b1ae073943394b807c164235 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 22 Nov 2013 21:42:50 +0100 Subject: [PATCH 30/77] widget: add -D__STDC_FORMAT_MACROS --- src/gui/widget/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widget/Makefile.am b/src/gui/widget/Makefile.am index 33dd69179..d119ced33 100644 --- a/src/gui/widget/Makefile.am +++ b/src/gui/widget/Makefile.am @@ -1,4 +1,4 @@ -AM_CPPFLAGS = -fno-rtti -fno-exceptions +AM_CPPFLAGS = -fno-rtti -fno-exceptions -D__STDC_FORMAT_MACROS AM_CPPFLAGS += \ -I$(top_builddir) \ From 9b07942f3fc47df42dcea05bb52960958f320b00 Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Sat, 23 Nov 2013 13:40:27 +0100 Subject: [PATCH 31/77] CInfoViewerBB: No blank space for radiotext icon when radiotext is off --- src/gui/infoviewer_bb.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/infoviewer_bb.cpp b/src/gui/infoviewer_bb.cpp index 362a22af9..e1dc4a586 100644 --- a/src/gui/infoviewer_bb.cpp +++ b/src/gui/infoviewer_bb.cpp @@ -173,7 +173,7 @@ void CInfoViewerBB::getBBIconInfo() iconView = checkBBIcon(NEUTRINO_ICON_VTXT, &w, &h); break; case CInfoViewerBB::ICON_RT: - if (neutrino->getMode() == NeutrinoMessages::mode_radio) + if ((neutrino->getMode() == NeutrinoMessages::mode_radio) && g_settings.radiotext_enable) iconView = checkBBIcon(NEUTRINO_ICON_RADIOTEXTGET, &w, &h); break; case CInfoViewerBB::ICON_DD: From 024bb0bbc9cabc09a48984c58859a33370b274a9 Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Sun, 24 Nov 2013 20:38:27 +0100 Subject: [PATCH 32/77] No display info clock when radio text is shown --- src/gui/infoviewer_bb.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/gui/infoviewer_bb.cpp b/src/gui/infoviewer_bb.cpp index e1dc4a586..9b7e2800b 100644 --- a/src/gui/infoviewer_bb.cpp +++ b/src/gui/infoviewer_bb.cpp @@ -43,6 +43,7 @@ #include #include +#include #include #include #include @@ -61,6 +62,7 @@ extern CRemoteControl *g_RemoteControl; /* neutrino.cpp */ extern cVideo * videoDecoder; +extern CInfoClock *InfoClock; #define COL_INFOBAR_BUTTONS_BACKGROUND (COL_INFOBAR_SHADOW_PLUS_1) @@ -481,10 +483,20 @@ void CInfoViewerBB::showIcon_RadioText(bool rt_available) return; std::string rt_icon; - if (rt_available) - rt_icon = (g_Radiotext->S_RtOsd) ? NEUTRINO_ICON_RADIOTEXTGET : NEUTRINO_ICON_RADIOTEXTWAIT; - else + if (rt_available) { + if (g_Radiotext->S_RtOsd) { + rt_icon = NEUTRINO_ICON_RADIOTEXTGET; + InfoClock->enableInfoClock(false); + } + else { + rt_icon = NEUTRINO_ICON_RADIOTEXTWAIT; + InfoClock->enableInfoClock(true); + } + } + else { rt_icon = NEUTRINO_ICON_RADIOTEXTOFF; + InfoClock->enableInfoClock(true); + } showBBIcons(CInfoViewerBB::ICON_RT, rt_icon); } From 9056504555854290998073b6adaddcfa51fe5bfe Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 25 Nov 2013 12:31:58 +0100 Subject: [PATCH 33/77] CInfoViewerBB: revert 024bb0bbc9cabc09a48984c58859a33370b274a9 This changes has only effect with button bar. Infoviewer is ignored or collide with Virtual_Zap. --- src/gui/infoviewer_bb.cpp | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/src/gui/infoviewer_bb.cpp b/src/gui/infoviewer_bb.cpp index 9b7e2800b..e1dc4a586 100644 --- a/src/gui/infoviewer_bb.cpp +++ b/src/gui/infoviewer_bb.cpp @@ -43,7 +43,6 @@ #include #include -#include #include #include #include @@ -62,7 +61,6 @@ extern CRemoteControl *g_RemoteControl; /* neutrino.cpp */ extern cVideo * videoDecoder; -extern CInfoClock *InfoClock; #define COL_INFOBAR_BUTTONS_BACKGROUND (COL_INFOBAR_SHADOW_PLUS_1) @@ -483,20 +481,10 @@ void CInfoViewerBB::showIcon_RadioText(bool rt_available) return; std::string rt_icon; - if (rt_available) { - if (g_Radiotext->S_RtOsd) { - rt_icon = NEUTRINO_ICON_RADIOTEXTGET; - InfoClock->enableInfoClock(false); - } - else { - rt_icon = NEUTRINO_ICON_RADIOTEXTWAIT; - InfoClock->enableInfoClock(true); - } - } - else { + if (rt_available) + rt_icon = (g_Radiotext->S_RtOsd) ? NEUTRINO_ICON_RADIOTEXTGET : NEUTRINO_ICON_RADIOTEXTWAIT; + else rt_icon = NEUTRINO_ICON_RADIOTEXTOFF; - InfoClock->enableInfoClock(true); - } showBBIcons(CInfoViewerBB::ICON_RT, rt_icon); } From 837b8b71adec6a81abafe8bd3eddd44eb7858b5f Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Mon, 25 Nov 2013 13:02:45 +0100 Subject: [PATCH 34/77] - infoviewer_bb: align icons on right side with text above --- src/gui/infoviewer_bb.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/infoviewer_bb.cpp b/src/gui/infoviewer_bb.cpp index e1dc4a586..cdb770fed 100644 --- a/src/gui/infoviewer_bb.cpp +++ b/src/gui/infoviewer_bb.cpp @@ -157,7 +157,7 @@ void CInfoViewerBB::getBBIconInfo() bbIconMaxH = 0; BBarY = g_InfoViewer->BoxEndY + bottom_bar_offset; BBarFontY = BBarY + InfoHeightY_Info - (InfoHeightY_Info - g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()) / 2; /* center in buttonbar */ - bbIconMinX = g_InfoViewer->BoxEndX; + bbIconMinX = g_InfoViewer->BoxEndX - 8; //should be 10px, but 2px will be reduced for each icon CNeutrinoApp* neutrino = CNeutrinoApp::getInstance(); for (int i = 0; i < CInfoViewerBB::ICON_MAX; i++) { @@ -680,7 +680,7 @@ void CInfoViewerBB::showBarHdd(int percent) void CInfoViewerBB::paint_ca_icons(int caid, char * icon, int &icon_space_offset) { char buf[20]; - int endx = g_InfoViewer->BoxEndX -3; + int endx = g_InfoViewer->BoxEndX - 10; int py = g_InfoViewer->BoxEndY + 2; /* hand-crafted, should be automatic */ int px = 0; static map > icon_map; From dcffcfdb07d3b8bba713552e9e657b733130fa4f Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Mon, 25 Nov 2013 13:03:24 +0100 Subject: [PATCH 35/77] - neutrino: disable infoclock while epgview and eventlist --- src/neutrino.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 175f9e988..e16438298 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -2037,15 +2037,19 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) if( ( mode == mode_tv ) || ( ( mode == mode_radio ) ) ) { if( (msg == NeutrinoMessages::SHOW_EPG) /* || (msg == CRCInput::RC_info) */ ) { + InfoClock->enableInfoClock(false); StopSubtitles(); t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); g_EpgData->show(live_channel_id); + InfoClock->enableInfoClock(true); StartSubtitles(); } else if( msg == CRCInput::RC_epg ) { + InfoClock->enableInfoClock(false); StopSubtitles(); t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); g_EventList->exec(live_channel_id, channelList->getActiveChannelName()); + InfoClock->enableInfoClock(true); StartSubtitles(); } else if( ( msg == (neutrino_msg_t) g_settings.key_quickzap_up ) || ( msg == (neutrino_msg_t) g_settings.key_quickzap_down ) ) @@ -2053,7 +2057,6 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) //quickzap quickZap(msg); } - else if( msg == CRCInput::RC_text) { g_RCInput->clearRCMsg(); InfoClock->enableInfoClock(false); From c83263d5cddeba3be187204e43a4c30354a31453 Mon Sep 17 00:00:00 2001 From: martii Date: Sat, 23 Nov 2013 12:47:30 +0100 Subject: [PATCH 36/77] gui/infoviewer: disable infoclock if radiotext is active --- src/gui/infoviewer.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index c8c581a0a..da32cc8c5 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -55,6 +55,7 @@ #include #include #include +#include #include #include @@ -73,6 +74,7 @@ extern CRemoteControl *g_RemoteControl; /* neutrino.cpp */ extern CBouquetList * bouquetList; /* neutrino.cpp */ extern CPictureViewer * g_PicViewer; extern cVideo * videoDecoder; +extern CInfoClock *InfoClock; #define LEFT_OFFSET 5 @@ -1097,6 +1099,7 @@ void CInfoViewer::killRadiotext() if (g_Radiotext->S_RtOsd) frameBuffer->paintBackgroundBox(rt_x, rt_y, rt_w, rt_h); rt_x = rt_y = rt_h = rt_w = 0; + InfoClock->enableInfoClock(true); } void CInfoViewer::showRadiotext() @@ -1108,6 +1111,7 @@ void CInfoViewer::showRadiotext() infoViewerBB->showIcon_RadioText(g_Radiotext->haveRadiotext()); if (g_Radiotext->S_RtOsd) { + InfoClock->enableInfoClock(false); // dimensions of radiotext window int /*yoff = 8,*/ ii = 0; rt_dx = BoxEndX - BoxStartX; From ef374d7f8d5966a59225abf201c9a556befc560a Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 26 Nov 2013 11:56:23 +0100 Subject: [PATCH 37/77] CInfoViewer: show time with CComponentsFrmClock object This replaces old code that displayed time in infobar. --- src/gui/infoviewer.cpp | 46 +++++++++++++++++------------------------- src/gui/infoviewer.h | 4 +++- 2 files changed, 22 insertions(+), 28 deletions(-) diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index da32cc8c5..1e5f31946 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -56,7 +56,6 @@ #include #include #include -#include #include @@ -94,6 +93,7 @@ CInfoViewer::CInfoViewer () sigscale = NULL; snrscale = NULL; timescale = NULL; + clock = NULL; frameBuffer = CFrameBuffer::getInstance(); infoViewerBB = CInfoViewerBB::getInstance(); InfoHeightY = 0; @@ -128,6 +128,7 @@ CInfoViewer::~CInfoViewer() delete timescale; delete infoViewerBB; delete infobar_txt; + delete clock; } void CInfoViewer::Init() @@ -243,35 +244,26 @@ void CInfoViewer::changePB() timescale->setRgb(0, 100, 70); } -void CInfoViewer::paintTime (bool show_dot, bool firstPaint) +void CInfoViewer::paintTime (bool show_dot) { if (! gotTime) return; - char timestr[10]; - time_t rawtime = time(NULL); - strftime ((char *) ×tr, sizeof(timestr), "%H:%M", localtime(&rawtime)); + int clock_x = BoxEndX - time_width - LEFT_OFFSET; + int clock_y = ChanNameY; + int clock_w = time_width + LEFT_OFFSET; + int clock_h = time_height; - if ((!firstPaint) && (strcmp (timestr, old_timestr) == 0)) { - if (show_dot) - frameBuffer->paintBoxRel (BoxEndX - time_width + time_left_width - LEFT_OFFSET, ChanNameY, time_dot_width, time_height / 2 + 2, COL_INFOBAR_PLUS_0); - else - g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->RenderString (BoxEndX - time_width + time_left_width - LEFT_OFFSET, ChanNameY + time_height, time_dot_width, ":", COL_INFOBAR_TEXT); - strcpy (old_timestr, timestr); - } else { - strcpy (old_timestr, timestr); - - if (!firstPaint) { - frameBuffer->paintBoxRel(BoxEndX - time_width - LEFT_OFFSET, ChanNameY, time_width + LEFT_OFFSET, time_height, COL_INFOBAR_PLUS_0, RADIUS_SMALL, CORNER_TOP); - } - - timestr[2] = 0; - g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->RenderString (BoxEndX - time_width - LEFT_OFFSET, ChanNameY + time_height, time_left_width, timestr, COL_INFOBAR_TEXT); - g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->RenderString (BoxEndX - time_left_width - LEFT_OFFSET, ChanNameY + time_height, time_left_width, ×tr[3], COL_INFOBAR_TEXT); - g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->RenderString (BoxEndX - time_width + time_left_width - LEFT_OFFSET, ChanNameY + time_height, time_dot_width, ":", COL_INFOBAR_TEXT); - if (show_dot) - frameBuffer->paintBoxRel (BoxEndX - time_left_width - time_dot_width - LEFT_OFFSET, ChanNameY, time_dot_width, time_height / 2 + 2, COL_INFOBAR_PLUS_0); + if (clock == NULL){ + clock = new CComponentsFrmClock(); + clock->setCorner(RADIUS_LARGE, CORNER_TOP_RIGHT); + clock->doPaintBg(false); } + clock->setDimensionsAll(clock_x, clock_y, clock_w, clock_h); + clock->setClockFont(g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]); + clock->setClockFormat(show_dot ? "%H:%M" : "%H.%M"); + + clock->paint(CC_SAVE_SCREEN_NO); } void CInfoViewer::showRecordIcon (const bool show) @@ -516,7 +508,7 @@ void CInfoViewer::showMovieTitle(const int playState, const t_channel_id &Channe paintBackground(COL_INFOBAR_PLUS_0); bool show_dot = true; - paintTime (show_dot, true); + paintTime (show_dot); showRecordIcon (show_dot); show_dot = !show_dot; @@ -686,7 +678,7 @@ void CInfoViewer::showTitle (const int ChanNum, const std::string & Channel, con paintBackground(col_NumBox); bool show_dot = true; - paintTime (show_dot, true); + paintTime (show_dot); showRecordIcon (show_dot); show_dot = !show_dot; @@ -878,7 +870,7 @@ void CInfoViewer::loop(bool show_dot) res = messages_return::cancel_info; } else if ((msg == NeutrinoMessages::EVT_TIMER) && (data == sec_timer_id)) { showSNR (); - paintTime (show_dot, false); + paintTime (show_dot); showRecordIcon (show_dot); show_dot = !show_dot; showInfoFile(); diff --git a/src/gui/infoviewer.h b/src/gui/infoviewer.h index 367d609c3..e842f18eb 100644 --- a/src/gui/infoviewer.h +++ b/src/gui/infoviewer.h @@ -44,6 +44,7 @@ #include #include #include +#include class CInfoViewer { @@ -51,6 +52,7 @@ class CInfoViewer CFrameBuffer * frameBuffer; CInfoViewerBB* infoViewerBB; + CComponentsFrmClock *clock; bool gotTime; bool recordModeActive; @@ -116,7 +118,7 @@ class CInfoViewer const char *runningStart = NULL, const char *runningRest = NULL, const char *nextStart = NULL, const char *nextDuration = NULL, bool update_current = true, bool update_next = true); - void paintTime( bool show_dot, bool firstPaint ); + void paintTime( bool show_dot ); void showRecordIcon(const bool show); void showIcon_Tuner() const; From 1107e4f89bcc88dcd296f4f454bc381421aa3e19 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 26 Nov 2013 12:00:03 +0100 Subject: [PATCH 38/77] CComponentsFrmClock: disable separate handle of label paint This is already handled in CTextBox object itself and should be enough. --- src/gui/components/cc_frm_clock.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/components/cc_frm_clock.cpp b/src/gui/components/cc_frm_clock.cpp index 7e0493176..da76721b8 100644 --- a/src/gui/components/cc_frm_clock.cpp +++ b/src/gui/components/cc_frm_clock.cpp @@ -181,11 +181,11 @@ void CComponentsFrmClock::initCCLockItems() CTextBox* ctb = lbl->getCTextBoxObject(); if (ctb) ctb->setFontUseDigitHeight(); - +#if 0 //ensure paint of text and label bg on changed text or painted form background bool force_txt_and_bg = (lbl->textChanged() || this->paint_bg); lbl->forceTextPaint(force_txt_and_bg); - +#endif //set xpos of item cl_x += wtmp; From 4f387ae87ff7adda82f133dd3446d4d7cf05658c Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Tue, 26 Nov 2013 16:23:24 +0100 Subject: [PATCH 39/77] CEventFinderMenu -add epg search history --- data/locale/deutsch.locale | 2 + data/locale/english.locale | 2 + src/gui/eventlist.cpp | 88 ++++++++++++++++++++++++++------------ src/gui/eventlist.h | 30 +++++++------ src/neutrino.cpp | 21 +++++++++ src/system/locals.h | 2 + src/system/locals_intern.h | 2 + src/system/settings.h | 5 +++ 8 files changed, 111 insertions(+), 41 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index a69f02516..2c9bd0457 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -327,7 +327,9 @@ epgviewer.length Spieldauer (Min.) epgviewer.nodetailed Keine ausführlichen Informationen verfügbar epgviewer.notfound Keine Programminformationen (EPG) gefunden eventfinder.head EPG-Suche +eventfinder.history Frühere Suchen eventfinder.keyword Suche nach Textpassage +eventfinder.max_history Max. Anzahl früherer Suchen eventfinder.search Suche eventfinder.search_all_epg Ganze eventfinder.search_within_epg Suche innerhalb EPG-Daten diff --git a/data/locale/english.locale b/data/locale/english.locale index a70d08722..e2c3bed7f 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -327,7 +327,9 @@ epgviewer.length Length (min.) epgviewer.nodetailed No detailed informations available epgviewer.notfound No EPG found eventfinder.head Search in EPG +eventfinder.history Search history eventfinder.keyword Keyword +eventfinder.max_history Max results to fetch eventfinder.search Search eventfinder.search_all_epg whole eventfinder.search_within_epg Search within diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index 8ac359e87..a3fe5307f 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -71,6 +71,7 @@ inline static bool sortbyEventid (const CChannelEvent& a, const CChannelEvent& b return (a.channelID == b.channelID && a.eventID == b.eventID && a.startTime == b.startTime); } #endif + inline bool sortByDescription (const CChannelEvent& a, const CChannelEvent& b) { if(a.description == b.description) @@ -1126,6 +1127,22 @@ bool CNeutrinoEventList::findEvents(void) search_head_name += ": '"; search_head_name += m_search_keyword; search_head_name += "'"; + + if(!m_search_keyword.empty()){ + g_settings.epg_search_history.push_front(m_search_keyword); + std::list::iterator it = g_settings.epg_search_history.begin(); + it++; + while (it != g_settings.epg_search_history.end()) { + if (*it == m_search_keyword) + it = g_settings.epg_search_history.erase(it); + else + ++it; + } + g_settings.epg_search_history_size = g_settings.epg_search_history.size(); + if (g_settings.epg_search_history_size > g_settings.epg_search_history_max) + g_settings.epg_search_history_size = g_settings.epg_search_history_max; + } + } paintHead(0, search_head_name); paint(); @@ -1198,6 +1215,8 @@ CEventFinderMenu::CEventFinderMenu( int* event, m_search_list = search_list; m_search_channel_id = search_channel_id; m_search_bouquet_id = search_bouquet_id; + width = w_max (40, 10); + selected = -1; } @@ -1214,34 +1233,13 @@ int CEventFinderMenu::exec(CMenuTarget* parent, const std::string &actionkey) //printf("0\n"); showMenu(); } - else if(actionkey =="1") + else if(actionkey =="#1") { //printf("1\n"); *m_event = true; res = menu_return::RETURN_EXIT_ALL; } - else if(actionkey =="2") - { - //printf("2\n"); - /* - if(*m_search_list == CNeutrinoEventList::SEARCH_LIST_CHANNEL) - { - mf[1]->setActive(true); - m_search_channelname = CServiceManager::getInstance()->GetServiceName(*m_search_channel_id);; - } - else if(*m_search_list == CNeutrinoEventList::SEARCH_LIST_BOUQUET) - { - mf[1]->setActive(true); - m_search_channelname = bouquetList->Bouquets[*m_search_bouquet_id]->channelList->getName(); - } - else if(*m_search_list == CNeutrinoEventList::SEARCH_LIST_ALL) - { - mf[1]->setActive(false); - m_search_channelname = ""; - } - */ - } - else if(actionkey =="3") + else if(actionkey =="#2") { //printf("3\n"); // get channel id / bouquet id @@ -1275,9 +1273,38 @@ int CEventFinderMenu::exec(CMenuTarget* parent, const std::string &actionkey) } } } - else if(actionkey =="4") + else if(actionkey =="#history") { - //printf("4\n"); + + if (parent) + parent->hide(); + CMenuWidget* m = new CMenuWidget(LOCALE_EVENTFINDER_HISTORY, NEUTRINO_ICON_MOVIEPLAYER, width); + m->addKey(CRCInput::RC_spkr, this, "#clear"); + m->setSelected(selected); + m->addItem(GenericMenuSeparator); + m->addItem(GenericMenuBack); + m->addItem(GenericMenuSeparatorLine); + std::list::iterator it = g_settings.epg_search_history.begin(); + for (int i = 0; i < g_settings.epg_search_history_size; i++, ++it) + m->addItem(new CMenuForwarderNonLocalized((*it).c_str(), true, NULL, this, (*it).c_str(), CRCInput::convertDigitToKey(i + 1))); + m->exec(NULL, ""); + m->hide(); + delete m; + return menu_return::RETURN_REPAINT; + } + if (actionkey == "#clear") { + g_settings.epg_search_history.clear(); + g_settings.epg_search_history_size = 0; + return menu_return::RETURN_EXIT; + } + + std::list::iterator it = g_settings.epg_search_history.begin(); + for (int i = 0; i < g_settings.epg_search_history_size; i++, ++it){ + if((*it)== actionkey){ + *m_search_keyword = actionkey; + g_RCInput->postMsg((neutrino_msg_t) CRCInput::RC_blue, 0); + return menu_return::RETURN_EXIT; + } } return res; @@ -1316,12 +1343,16 @@ int CEventFinderMenu::showMenu(void) CMenuForwarder* mf0 = new CMenuForwarder(LOCALE_EVENTFINDER_KEYWORD, true, *m_search_keyword, &stringInput, NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED); CMenuOptionChooser* mo0 = new CMenuOptionChooser(LOCALE_EVENTFINDER_SEARCH_WITHIN_LIST, m_search_list, SEARCH_LIST_OPTIONS, SEARCH_LIST_OPTION_COUNT, true, this, CRCInput::convertDigitToKey(shortcut++)); - m_search_channelname_mf = new CMenuForwarderNonLocalized("", *m_search_list != CNeutrinoEventList::SEARCH_LIST_ALL, m_search_channelname, this, "3", CRCInput::convertDigitToKey(shortcut++)); + m_search_channelname_mf = new CMenuForwarderNonLocalized("", *m_search_list != CNeutrinoEventList::SEARCH_LIST_ALL, m_search_channelname, this, "#2", CRCInput::convertDigitToKey(shortcut++)); CMenuOptionChooser* mo1 = new CMenuOptionChooser(LOCALE_EVENTFINDER_SEARCH_WITHIN_EPG, m_search_epg_item, SEARCH_EPG_OPTIONS, SEARCH_EPG_OPTION_COUNT, true, NULL, CRCInput::convertDigitToKey(shortcut++)); - CMenuForwarder* mf1 = new CMenuForwarder(LOCALE_EVENTFINDER_START_SEARCH, true, NULL, this, "1", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN); + CMenuForwarder* mf1 = new CMenuForwarder(LOCALE_EVENTFINDER_START_SEARCH, true, NULL, this, "#1", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN); CMenuWidget searchMenu(LOCALE_EVENTFINDER_HEAD, NEUTRINO_ICON_FEATURES, 40); + CMenuForwarder* mf2 = new CMenuForwarder(LOCALE_EVENTFINDER_HISTORY, true, NULL, this, "#history", CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW); + CMenuOptionNumberChooser* moc1 = new CMenuOptionNumberChooser(LOCALE_EVENTFINDER_MAX_HISTORY, &g_settings.epg_search_history_max, true, 0, 50, NULL); + searchMenu.addItem(GenericMenuSeparatorLine); + searchMenu.addItem(GenericMenuSeparator); searchMenu.addItem(mf0); searchMenu.addItem(GenericMenuSeparatorLine); @@ -1330,6 +1361,9 @@ int CEventFinderMenu::showMenu(void) searchMenu.addItem(mo1); searchMenu.addItem(GenericMenuSeparatorLine); searchMenu.addItem(mf1); + searchMenu.addItem(GenericMenuSeparatorLine); + searchMenu.addItem(mf2); + searchMenu.addItem(moc1); res = searchMenu.exec(NULL,""); return(res); diff --git a/src/gui/eventlist.h b/src/gui/eventlist.h index 8eff085db..7fba30b57 100644 --- a/src/gui/eventlist.h +++ b/src/gui/eventlist.h @@ -139,21 +139,23 @@ class CEventFinderMenu : public CMenuTarget, CChangeObserver { private: CMenuForwarderNonLocalized* m_search_channelname_mf; - int* m_event; - int* m_search_epg_item; - std::string* m_search_keyword; - int* m_search_list; - std::string m_search_channelname; - t_channel_id* m_search_channel_id; - t_bouquet_id* m_search_bouquet_id; - int showMenu(void); + int* m_event; + int* m_search_epg_item; + std::string* m_search_keyword; + int* m_search_list; + std::string m_search_channelname; + t_channel_id* m_search_channel_id; + t_bouquet_id* m_search_bouquet_id; + int width; + int selected; + int showMenu(void); public: - CEventFinderMenu( int* event, - int* search_epg_item, - std::string* search_keyword, - int* search_list, - t_channel_id* search_channel_id, - t_bouquet_id* search_bouquet_id); + CEventFinderMenu( int* event, + int* search_epg_item, + std::string* search_keyword, + int* search_list, + t_channel_id* search_channel_id, + t_bouquet_id* search_bouquet_id); int exec( CMenuTarget* parent, const std::string &actionkey); bool changeNotify(const neutrino_locale_t OptionName, void *); diff --git a/src/neutrino.cpp b/src/neutrino.cpp index e16438298..00c84dfda 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -738,6 +738,18 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.startchanneltv_id = configfile.getInt64("startchanneltv_id", 0); g_settings.startchannelradio_id = configfile.getInt64("startchannelradio_id", 0); g_settings.uselastchannel = configfile.getInt32("uselastchannel" , 1); + //epg searsch + g_settings.epg_search_history_max = configfile.getInt32("epg_search_history_max", 10); + g_settings.epg_search_history_size = configfile.getInt32("epg_search_history_size", 0); + if (g_settings.epg_search_history_size > g_settings.epg_search_history_max) + g_settings.epg_search_history_size = g_settings.epg_search_history_max; + g_settings.epg_search_history.clear(); + for(int i = 0; i < g_settings.epg_search_history_size; i++) { + std::string s = configfile.getString("epg_search_history_" + to_string(i)); + if (s != "") + g_settings.epg_search_history.push_back(configfile.getString("epg_search_history_" + to_string(i), "")); + } + g_settings.epg_search_history_size = g_settings.epg_search_history.size(); // USERMENU -> in system/settings.h @@ -1179,6 +1191,15 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setInt64("startchanneltv_id", g_settings.startchanneltv_id); configfile.setInt64("startchannelradio_id", g_settings.startchannelradio_id); configfile.setInt32("uselastchannel", g_settings.uselastchannel); + //epg search + g_settings.epg_search_history_size = g_settings.epg_search_history.size(); + if (g_settings.epg_search_history_size > g_settings.epg_search_history_max) + g_settings.epg_search_history_size = g_settings.epg_search_history_max; + configfile.setInt32("epg_search_history_max", g_settings.epg_search_history_max); + configfile.setInt32("epg_search_history_size", g_settings.epg_search_history_size); + std::list:: iterator it = g_settings.epg_search_history.begin(); + for(int i = 0; i < g_settings.epg_search_history_size; i++, ++it) + configfile.setString("epg_search_history_" + to_string(i), *it); // USERMENU //--------------------------------------- diff --git a/src/system/locals.h b/src/system/locals.h index 1dc09f87c..e21369699 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -354,7 +354,9 @@ typedef enum LOCALE_EPGVIEWER_NODETAILED, LOCALE_EPGVIEWER_NOTFOUND, LOCALE_EVENTFINDER_HEAD, + LOCALE_EVENTFINDER_HISTORY, LOCALE_EVENTFINDER_KEYWORD, + LOCALE_EVENTFINDER_MAX_HISTORY, LOCALE_EVENTFINDER_SEARCH, LOCALE_EVENTFINDER_SEARCH_ALL_EPG, LOCALE_EVENTFINDER_SEARCH_WITHIN_EPG, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 214f61001..a57c08737 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -354,7 +354,9 @@ const char * locale_real_names[] = "epgviewer.nodetailed", "epgviewer.notfound", "eventfinder.head", + "eventfinder.history", "eventfinder.keyword", + "eventfinder.max_history", "eventfinder.search", "eventfinder.search_all_epg", "eventfinder.search_within_epg", diff --git a/src/system/settings.h b/src/system/settings.h index dcd43bb14..5d73ae098 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -38,6 +38,7 @@ #include #include +#include #ifdef BOXMODEL_APOLLO #define VIDEOMENU_VIDEOMODE_OPTION_COUNT 14 @@ -147,6 +148,10 @@ struct SNeutrinoSettings std::string epg_dir; int epg_scan; + int epg_search_history_size; + int epg_search_history_max; + std::list epg_search_history; + //network std::string network_ntpserver; std::string network_ntprefresh; From 0c18d4a6dbafffe000534df572ee81e4e6990363 Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Tue, 26 Nov 2013 14:08:48 +0100 Subject: [PATCH 40/77] CInfoClock: Rework calculate size & position - Fix display info clock - Preparation for alternative use of neutrino fonts / DynFonts --- src/gui/audiomute.cpp | 7 ++++--- src/gui/infoclock.cpp | 22 ++++++++++------------ src/gui/infoclock.h | 1 - src/gui/volumebar.cpp | 18 ++++++++++-------- src/gui/volumebar.h | 1 + src/system/setting_helpers.cpp | 5 +++++ 6 files changed, 30 insertions(+), 24 deletions(-) diff --git a/src/gui/audiomute.cpp b/src/gui/audiomute.cpp index 90ef21734..f311f8277 100644 --- a/src/gui/audiomute.cpp +++ b/src/gui/audiomute.cpp @@ -62,6 +62,9 @@ void CAudioMute::AudioMute(int newValue, bool isEvent) if( isEvent && ( neutrino->getMode() != CNeutrinoApp::mode_scart ) && ( neutrino->getMode() != CNeutrinoApp::mode_pic)) { + if (doInit) + CVolumeHelper::getInstance()->refresh(); + CVolumeHelper::getInstance()->getMuteIconDimensions(&x, &y, &width, &height); if ((y_old != y)) { if (do_paint_mute_icon) @@ -88,15 +91,13 @@ void CAudioMute::AudioMute(int newValue, bool isEvent) frameBuffer->setFbArea(CFrameBuffer::FB_PAINTAREA_MUTEICON1); } frameBuffer->fbNoCheck(false); - - if (doInit) - CVolumeHelper::getInstance()->refresh(); } } void CAudioMute::enableMuteIcon(bool enable) { CNeutrinoApp *neutrino = CNeutrinoApp::getInstance(); + CVolumeHelper::getInstance()->getMuteIconDimensions(&x, &y, &width, &height); frameBuffer->fbNoCheck(true); if (enable) { frameBuffer->doPaintMuteIcon(true); diff --git a/src/gui/infoclock.cpp b/src/gui/infoclock.cpp index b7e5c4c8e..1b5381588 100644 --- a/src/gui/infoclock.cpp +++ b/src/gui/infoclock.cpp @@ -57,8 +57,18 @@ void CInfoClock::initVarInfoClock() void CInfoClock::Init() { + int x_old = x, y_old = y, width_old = width, height_old = height; + cl_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]; CVolumeHelper::getInstance()->refresh(); CVolumeHelper::getInstance()->getInfoClockDimensions(&x, &y, &width, &height); + if ((x_old != x) || (y_old != y) || (width_old != width) || (height_old != height)) { + cleanCCForm(); + clearCCItems(); + } + + // set corner radius depending on clock height + corner_rad = (g_settings.rounded_corners) ? std::max(height/10, CORNER_RADIUS_SMALL) : 0; + initCCLockItems(); } @@ -82,18 +92,6 @@ bool CInfoClock::StopClock() return ret; } -void CInfoClock::paint(bool do_save_bg) -{ - // calculate current x-position of clock (mute icon on/off) - x = CVolumeHelper::getInstance()->getInfoClockX(); - - //prepare items before paint - initCCLockItems(); - - //paint the clock - paintForm(do_save_bg); -} - bool CInfoClock::enableInfoClock(bool enable) { bool ret = false; diff --git a/src/gui/infoclock.h b/src/gui/infoclock.h index ebefb2686..ebf1b912d 100644 --- a/src/gui/infoclock.h +++ b/src/gui/infoclock.h @@ -47,7 +47,6 @@ class CInfoClock : public CComponentsFrmClock bool StopClock(); bool enableInfoClock(bool enable); void ClearDisplay(); - void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); }; #endif diff --git a/src/gui/volumebar.cpp b/src/gui/volumebar.cpp index 0f55401f5..7d450b367 100644 --- a/src/gui/volumebar.cpp +++ b/src/gui/volumebar.cpp @@ -79,6 +79,7 @@ void CVolumeBar::initVarVolumeBar() void CVolumeBar::initVolumeBarSize() { CVolumeHelper *cvh = CVolumeHelper::getInstance(); + cvh->refresh(); cvh->getSpacer(&h_spacer, &v_spacer); cvh->getDimensions(&x, &y, &sw, &sh, &vb_icon_w, &vb_digit_w); cvh->getVolBarDimensions(&y, &height); @@ -125,7 +126,7 @@ void CVolumeBar::initVolumeBarPosition() if ((neutrino->isMuted()) && (!g_settings.mode_clock)) x_corr = mute_dx + h_spacer; if (g_settings.mode_clock) - y += max(clock_y + clock_height, mute_ay + mute_dy); + y = clock_y + clock_height + v_spacer; } x = sw - width - x_corr; break; @@ -260,6 +261,8 @@ CVolumeHelper::CVolumeHelper() { h_spacer = 11; v_spacer = 6; + vb_font = NULL; + clock_font = NULL; frameBuffer = CFrameBuffer::getInstance(); @@ -273,7 +276,6 @@ void CVolumeHelper::Init() y = frameBuffer->getScreenY() + v_spacer; sw = g_settings.screen_EndX - h_spacer; sh = frameBuffer->getScreenHeight(); - vb_font = NULL; initVolBarSize(); initMuteIcon(); @@ -282,12 +284,12 @@ void CVolumeHelper::Init() void CVolumeHelper::initInfoClock() { - digit_offset = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->getDigitOffset(); - digit_h = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->getDigitHeight(); - int t1 = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->getRenderWidth(widest_number); - int t2 = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->getRenderWidth(":"); - clock_dy = digit_h + (int)((float)digit_offset * 1.5); - clock_dx = t1*6 + t2*2; + digit_offset = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getDigitOffset(); + digit_h = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getDigitHeight(); + int t1 = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getRenderWidth(widest_number); + int t2 = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getRenderWidth(":"); + clock_dy = digit_h + (int)((float)digit_offset * 1.3); + clock_dx = t1*7 + t2*2; clock_ax = sw - clock_dx; clock_ay = y; vol_ay = y; diff --git a/src/gui/volumebar.h b/src/gui/volumebar.h index ccf7901e3..d6864b636 100644 --- a/src/gui/volumebar.h +++ b/src/gui/volumebar.h @@ -105,6 +105,7 @@ class CVolumeHelper int icon_width, icon_height, digit_width; int h_spacer, v_spacer; int vol_ay, vol_height; + Font** clock_font; CFrameBuffer *frameBuffer; void Init(); diff --git a/src/system/setting_helpers.cpp b/src/system/setting_helpers.cpp index b2ca12c00..8e8dde7f9 100644 --- a/src/system/setting_helpers.cpp +++ b/src/system/setting_helpers.cpp @@ -52,6 +52,7 @@ #include #include #include +#include #include #include #include @@ -321,6 +322,10 @@ bool CFontSizeNotifier::changeNotify(const neutrino_locale_t, void *) hintBox.hide(); /* recalculate infoclock/muteicon/volumebar */ CVolumeHelper::getInstance()->refresh(); + if (CNeutrinoApp::getInstance()->isMuted()) { + CAudioMute::getInstance()->enableMuteIcon(false); + CAudioMute::getInstance()->enableMuteIcon(true); + } return true; } From 1bfb6d2cd3dff43e9e3d2543a0ea49f206b571d2 Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Wed, 27 Nov 2013 00:19:05 +0100 Subject: [PATCH 41/77] CComponentsFrmClock: Rework font handling - Use setClockFont(enum FONT_TYPES) for selection of neutrino fonts - Use setClockFontSize(size) for Dynamic Font --- src/driver/neutrinofonts.h | 1 + src/gui/components/cc_frm_clock.cpp | 49 ++++++++++++++++++++++------- src/gui/components/cc_frm_clock.h | 14 +++++++-- src/gui/infoclock.cpp | 3 +- src/gui/volumebar.cpp | 29 +++++++++++------ src/gui/volumebar.h | 6 ++-- 6 files changed, 73 insertions(+), 29 deletions(-) diff --git a/src/driver/neutrinofonts.h b/src/driver/neutrinofonts.h index e5c99d55e..ce6e623c2 100644 --- a/src/driver/neutrinofonts.h +++ b/src/driver/neutrinofonts.h @@ -91,6 +91,7 @@ class CNeutrinoFonts }; enum { FONT_ID_VOLBAR, + FONT_ID_INFOCLOCK, FONT_ID_MAX }; diff --git a/src/gui/components/cc_frm_clock.cpp b/src/gui/components/cc_frm_clock.cpp index da76721b8..13bbb708d 100644 --- a/src/gui/components/cc_frm_clock.cpp +++ b/src/gui/components/cc_frm_clock.cpp @@ -29,6 +29,7 @@ #include #include +#include #include "cc_frm_clock.h" #include @@ -70,16 +71,19 @@ CComponentsFrmClock::CComponentsFrmClock( const int x_pos, const int y_pos, cons void CComponentsFrmClock::initVarClock() { initVarForm(); - cc_item_type = CC_ITEMTYPE_FRM_CLOCK; - corner_rad = RADIUS_SMALL; + cc_item_type = CC_ITEMTYPE_FRM_CLOCK; + corner_rad = RADIUS_SMALL; - cl_font = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO]; - cl_col_text = COL_MENUCONTENT_TEXT; - cl_format_str = "%H:%M"; - cl_align = CC_ALIGN_VER_CENTER | CC_ALIGN_HOR_CENTER; + cl_font_type = SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO; + cl_font = &g_Font[cl_font_type]; + dyn_font_size = 0; - cl_thread = 0; - cl_interval = 1; + cl_col_text = COL_MENUCONTENT_TEXT; + cl_format_str = "%H:%M"; + cl_align = CC_ALIGN_VER_CENTER | CC_ALIGN_HOR_CENTER; + + cl_thread = 0; + cl_interval = 1; } CComponentsFrmClock::~CComponentsFrmClock() @@ -117,8 +121,8 @@ void CComponentsFrmClock::initCCLockItems() string s_time = cl_timestr; //get minimal required height, width from raw text - int min_text_w = cl_font->getRenderWidth(s_time, true);; - int min_text_h = cl_font->getHeight(); + int min_text_w = (*getClockFont())->getRenderWidth(s_time, true);; + int min_text_h = (*getClockFont())->getHeight(); height = max(height, min_text_h); width = max(width, min_text_w); @@ -169,13 +173,13 @@ void CComponentsFrmClock::initCCLockItems() string stmp = s_time.substr(i, 1); //get width of current segment - int wtmp = cl_font->getRenderWidth(stmp, true); + int wtmp = (*getClockFont())->getRenderWidth(stmp, true); //set size, text, color of current item lbl->setDimensionsAll(cl_x, cl_y, wtmp, cl_h); lbl->setTextColor(cl_col_text); lbl->setColorAll(col_frame, col_body, col_shadow); - lbl->setText(stmp, CTextBox::CENTER, cl_font); + lbl->setText(stmp, CTextBox::CENTER, *getClockFont()); //use matching height for digits for better vertical centerring into form CTextBox* ctb = lbl->getCTextBoxObject(); @@ -333,3 +337,24 @@ void CComponentsFrmClock::paint(bool do_save_bg) //paint form contents paintForm(do_save_bg); } + +void CComponentsFrmClock::setClockFontSize(int size) +{ + int tmp_w = 0; + dyn_font_size = size; + cl_font = CNeutrinoFonts::getInstance()->getDynFont(tmp_w, dyn_font_size, "", CNeutrinoFonts::FONT_STYLE_BOLD, CNeutrinoFonts::FONT_ID_INFOCLOCK); +} + +void CComponentsFrmClock::setClockFont(int font) +{ + cl_font_type = font; + cl_font = &g_Font[cl_font_type]; +} + +Font** CComponentsFrmClock::getClockFont() +{ + if (dyn_font_size == 0) + cl_font = &g_Font[cl_font_type]; + return cl_font; + +} diff --git a/src/gui/components/cc_frm_clock.h b/src/gui/components/cc_frm_clock.h index 1af9d2580..860126edc 100644 --- a/src/gui/components/cc_frm_clock.h +++ b/src/gui/components/cc_frm_clock.h @@ -62,7 +62,11 @@ class CComponentsFrmClock : public CComponentsForm bool activeClock; ///object: font render object - Font *cl_font; + Font **cl_font; + + int cl_font_type; + int dyn_font_size; + ///text color int cl_col_text; ///time format @@ -80,6 +84,9 @@ class CComponentsFrmClock : public CComponentsForm ///initialize of general alignment of timestring segments within form area void initSegmentAlign(int* segment_width, int* segment_height); + ///return pointer of font object + inline Font** getClockFont(); + public: CComponentsFrmClock(); CComponentsFrmClock( const int x_pos, const int y_pos, const int w, const int h, @@ -87,8 +94,9 @@ class CComponentsFrmClock : public CComponentsForm fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); virtual ~CComponentsFrmClock(); - ///set font type for segments - virtual void setClockFont(Font *font){cl_font = font;}; + ///set font type or font size for segments + virtual void setClockFont(int font); + virtual void setClockFontSize(int size); ///set text color virtual void setTextColor(fb_pixel_t color_text){ cl_col_text = color_text;}; diff --git a/src/gui/infoclock.cpp b/src/gui/infoclock.cpp index 1b5381588..c6635fff4 100644 --- a/src/gui/infoclock.cpp +++ b/src/gui/infoclock.cpp @@ -58,8 +58,7 @@ void CInfoClock::initVarInfoClock() void CInfoClock::Init() { int x_old = x, y_old = y, width_old = width, height_old = height; - cl_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]; - CVolumeHelper::getInstance()->refresh(); + CVolumeHelper::getInstance()->refresh(cl_font); CVolumeHelper::getInstance()->getInfoClockDimensions(&x, &y, &width, &height); if ((x_old != x) || (y_old != y) || (width_old != width) || (height_old != height)) { cleanCCForm(); diff --git a/src/gui/volumebar.cpp b/src/gui/volumebar.cpp index 7d450b367..781ea51f8 100644 --- a/src/gui/volumebar.cpp +++ b/src/gui/volumebar.cpp @@ -269,7 +269,7 @@ CVolumeHelper::CVolumeHelper() Init(); } -void CVolumeHelper::Init() +void CVolumeHelper::Init(Font** font) { x = frameBuffer->getScreenX() + h_spacer; @@ -279,15 +279,26 @@ void CVolumeHelper::Init() initVolBarSize(); initMuteIcon(); - initInfoClock(); + initInfoClock(font); } -void CVolumeHelper::initInfoClock() +void CVolumeHelper::initInfoClock(Font** font) { - digit_offset = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getDigitOffset(); - digit_h = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getDigitHeight(); - int t1 = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getRenderWidth(widest_number); - int t2 = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getRenderWidth(":"); + if (clock_font == NULL){ + if (font == NULL) { + clock_font = &g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]; + } + else + clock_font = font; + } + else { + if (font != NULL) + clock_font = font; + } + digit_offset = (*clock_font)->getDigitOffset(); + digit_h = (*clock_font)->getDigitHeight(); + int t1 = (*clock_font)->getRenderWidth(widest_number); + int t2 = (*clock_font)->getRenderWidth(":"); clock_dy = digit_h + (int)((float)digit_offset * 1.3); clock_dx = t1*7 + t2*2; clock_ax = sw - clock_dx; @@ -347,9 +358,9 @@ int CVolumeHelper::getInfoClockX() return clock_ax; } -void CVolumeHelper::refresh() +void CVolumeHelper::refresh(Font** font) { - Init(); + Init(font); } CVolumeHelper* CVolumeHelper::getInstance() diff --git a/src/gui/volumebar.h b/src/gui/volumebar.h index d6864b636..b028da0a5 100644 --- a/src/gui/volumebar.h +++ b/src/gui/volumebar.h @@ -108,10 +108,10 @@ class CVolumeHelper Font** clock_font; CFrameBuffer *frameBuffer; - void Init(); + void Init(Font** font=NULL); void initVolBarSize(); void initMuteIcon(); - void initInfoClock(); + void initInfoClock(Font** font); public: @@ -128,7 +128,7 @@ class CVolumeHelper void getInfoClockDimensions(int *_x, int *_y, int *w, int *h) { *_x = getInfoClockX(); *_y = clock_ay; *w = clock_dx; *h = clock_dy; } void getVolBarDimensions(int *_y, int *_dy) { *_y = vol_ay; *_dy = vol_height; } void setMuteIconCorrY(int corr) { mute_corrY = corr; } - void refresh(); + void refresh(Font** font=NULL); }; #endif From 90985f11d250422d86bfb5030f5e87cec9dd4748 Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Tue, 26 Nov 2013 14:16:11 +0100 Subject: [PATCH 42/77] Adapting certain files to the changed font handling of info clock --- src/gui/channellist.cpp | 2 +- src/gui/infoclock.cpp | 2 +- src/gui/infoviewer.cpp | 2 +- src/gui/test_menu.cpp | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 6864276e2..082331577 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -2123,7 +2123,7 @@ void CChannelList::paintHead() headerClock->setClockIntervall(10); } - headerClock->setClockFont(g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]); + headerClock->setClockFont(SNeutrinoSettings::FONT_TYPE_MENU_TITLE); headerClock->setCorner(RADIUS_LARGE, CORNER_TOP_RIGHT); headerClock->setYPos(y); headerClock->setHeight(theight); diff --git a/src/gui/infoclock.cpp b/src/gui/infoclock.cpp index c6635fff4..75e063064 100644 --- a/src/gui/infoclock.cpp +++ b/src/gui/infoclock.cpp @@ -51,7 +51,7 @@ CInfoClock* CInfoClock::getInstance() void CInfoClock::initVarInfoClock() { - cl_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]; + setClockFont(SNeutrinoSettings::FONT_TYPE_MENU_TITLE); Init(); } diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index 1e5f31946..dd62828c9 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -260,7 +260,7 @@ void CInfoViewer::paintTime (bool show_dot) clock->doPaintBg(false); } clock->setDimensionsAll(clock_x, clock_y, clock_w, clock_h); - clock->setClockFont(g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]); + clock->setClockFont(SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME); clock->setClockFormat(show_dot ? "%H:%M" : "%H.%M"); clock->paint(CC_SAVE_SCREEN_NO); diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index d2380fdd3..e9687e322 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -614,7 +614,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) else if (actionKey == "running_clock"){ if (clock_r == NULL){ clock_r = new CComponentsFrmClock(100, 50, 0, 50, "%H.%M:%S"); - clock_r->setClockFont(g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]); + clock_r->setClockFont(SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME); clock_r->setClockIntervall(1); // clock_r->doPaintBg(false); } @@ -635,7 +635,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) else if (actionKey == "clock"){ if (clock == NULL){ clock = new CComponentsFrmClock(100, 50, 0, 50, "%H:%M", false); - clock->setClockFont(g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]); + clock->setClockFont(SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME); } if (!clock->isPainted()) From 435d25c0ce8e96cc61d14bbdb986f327b4c62d77 Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Wed, 27 Nov 2013 04:02:01 +0100 Subject: [PATCH 43/77] CInfoClock: Use dynamic font for display --- data/locale/deutsch.locale | 5 +++++ data/locale/english.locale | 5 +++++ src/gui/infoclock.cpp | 6 +++++- src/gui/osd_setup.cpp | 37 ++++++++++++++++++++++++++++++++++ src/gui/osd_setup.h | 1 + src/neutrino.cpp | 4 ++++ src/neutrino_menue.h | 1 + src/system/locals.h | 5 +++++ src/system/locals_intern.h | 5 +++++ src/system/setting_helpers.cpp | 5 ----- src/system/settings.h | 2 ++ 11 files changed, 70 insertions(+), 6 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 2c9bd0457..07348386e 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -256,6 +256,8 @@ ci.reset_standby Reset nach Standby ci.settings Zugangskontrolle ci.timeout CAM antwortet nicht ci.waiting Warte auf CAM-Antwort +clock_size Info Uhr +clock_size_height Höhe der Anzeige clock_switch_off Uhr ausblenden clock_switch_on Uhr einblenden colorchooser.alpha alpha @@ -810,6 +812,7 @@ menu.hint_channellist_foot Definiert, welche Informationen im unteren Sendungsfe menu.hint_channellist_setup Wählen Sie die Anzeigeoptionen für die Kanalliste menu.hint_channels Kanalliste öffnen menu.hint_ci Conditional-Access-Menü zum Einrichten Ihres CI-Moduls oder der eingebetteten Conax-Karte +menu.hint_clock_size Stellen Sie die Größe der Info Uhr ein. menu.hint_colors Konfigurieren Sie die Menü-Farben menu.hint_content_back Ändern Sie die Hintergrundfarbe für den Fensterinhalt menu.hint_content_textcolor Ändern Sie die Textfarbe für den Fensterinhalt @@ -874,6 +877,7 @@ menu.hint_infobar_sat Zeigt die aktuellen Satelliten- oder Kabel-Provider menu.hint_infobar_setup Wählen Sie die Anzeigeoptionen für die Infobar aus menu.hint_infobar_textcolor Ändern Sie die Textfarbe für die Infobar menu.hint_infobar_tuner Zeigt den aktiven Tuner als Nummernicon +menu.hint_infoclock_setup Wählen Sie die Anzeigeoptionen für die Info Uhr menu.hint_keep_numbers Mit der Aktivierung werden den Sendern feste/dauerhafte Kanalnummern zugewiesen menu.hint_key_addrecord Weisen Sie eine Taste für das Starten und Markieren von Aufnahmen im EPG zu menu.hint_key_addremind Weisen Sie eine Taste für das Umschalten im EPG über den Timer zu @@ -1240,6 +1244,7 @@ miscsettings.infobar_show_res Auflösung anzeigen miscsettings.infobar_show_res_simple einfach miscsettings.infobar_show_sysfs_hdd Füllstandanzeige (sysFS & hdd) miscsettings.infobar_show_tuner Aktiven Tuner anzeigen +miscsettings.infoclock Info Uhr miscsettings.progressbar Fortschrittsbalken miscsettings.progressbar_color Farbe miscsettings.progressbar_design Design diff --git a/data/locale/english.locale b/data/locale/english.locale index e2c3bed7f..03da9eb02 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -256,6 +256,8 @@ ci.reset_standby Reset after standby ci.settings Conditional access ci.timeout Timeout waiting CI menu ready ci.waiting Waiting for CI answer +clock_size Info clock +clock_size_height Display height clock_switch_off Clock off clock_switch_on Clock on colorchooser.alpha alpha @@ -810,6 +812,7 @@ menu.hint_channellist_foot Show additional information\nin bottom box menu.hint_channellist_setup Configure channel list GUI options menu.hint_channels Open channel list menu.hint_ci Conditional access menu\nto setup your CI CAM or embeded Conax card +menu.hint_clock_size Set the size of the info clock. menu.hint_colors Configure GUI colors menu.hint_content_back Change GUI window background color menu.hint_content_textcolor Change GUI window text color @@ -874,6 +877,7 @@ menu.hint_infobar_sat Show current satellite or cable provider menu.hint_infobar_setup Configure infobar options menu.hint_infobar_textcolor Change infobar text color menu.hint_infobar_tuner Show active tuner number icon +menu.hint_infoclock_setup Configure info clock GUI options menu.hint_keep_numbers Keep channel numbers over next scans\nand bouquets editing menu.hint_key_addrecord Assign button to add record timer\nfrom event list menu.hint_key_addremind Assign button to add zap timer\nfrom event list @@ -1240,6 +1244,7 @@ miscsettings.infobar_show_res show resolution on infobar miscsettings.infobar_show_res_simple simple miscsettings.infobar_show_sysfs_hdd Fill level (sysFS & hdd) miscsettings.infobar_show_tuner Display active tuner +miscsettings.infoclock Info clock miscsettings.progressbar Progressbar miscsettings.progressbar_color Color miscsettings.progressbar_design Design diff --git a/src/gui/infoclock.cpp b/src/gui/infoclock.cpp index 75e063064..e7d3d5aee 100644 --- a/src/gui/infoclock.cpp +++ b/src/gui/infoclock.cpp @@ -51,12 +51,16 @@ CInfoClock* CInfoClock::getInstance() void CInfoClock::initVarInfoClock() { - setClockFont(SNeutrinoSettings::FONT_TYPE_MENU_TITLE); Init(); } void CInfoClock::Init() { + static int oldSize = 0; + if (oldSize != g_settings.infoClockFontSize) { + oldSize = g_settings.infoClockFontSize; + setClockFontSize(g_settings.infoClockFontSize); + } int x_old = x, y_old = y, width_old = width, height_old = height; CVolumeHelper::getInstance()->refresh(cl_font); CVolumeHelper::getInstance()->getInfoClockDimensions(&x, &y, &width, &height); diff --git a/src/gui/osd_setup.cpp b/src/gui/osd_setup.cpp index 9760ea225..7d5a0662e 100644 --- a/src/gui/osd_setup.cpp +++ b/src/gui/osd_setup.cpp @@ -45,6 +45,8 @@ #include "filebrowser.h" #include "osd_progressbar_setup.h" +#include +#include #include #include #include @@ -545,6 +547,13 @@ int COsdSetup::showOsdSetup() mf->setHint("", LOCALE_MENU_HINT_VOLUME); osd_menu->addItem(mf); + //info clock + CMenuWidget osd_menu_infoclock(LOCALE_MAINMENU_SETTINGS, NEUTRINO_ICON_SETTINGS, width, MN_WIDGET_ID_OSDSETUP_INFOCLOCK); + showOsdInfoclockSetup(&osd_menu_infoclock); + mf = new CMenuForwarder(LOCALE_MISCSETTINGS_INFOCLOCK, true, NULL, &osd_menu_infoclock, NULL, CRCInput::convertDigitToKey(shortcut++)); + mf->setHint("", LOCALE_MENU_HINT_INFOCLOCK_SETUP); + osd_menu->addItem(mf); + //screenshot CMenuWidget osd_menu_screenshot(LOCALE_MAINMENU_SETTINGS, NEUTRINO_ICON_SETTINGS, width, MN_WIDGET_ID_OSDSETUP_SCREENSHOT); showOsdScreenShotSetup(&osd_menu_screenshot); @@ -590,12 +599,22 @@ int COsdSetup::showOsdSetup() osd_menu->addItem(mc); int oldVolumeSize = g_settings.volume_size; + int oldInfoClockSize = g_settings.infoClockFontSize; int res = osd_menu->exec(NULL, ""); if (oldVolumeSize != g_settings.volume_size) CVolumeHelper::getInstance()->refresh(); + if (oldInfoClockSize != g_settings.infoClockFontSize) { + CInfoClock::getInstance()->setClockFontSize(g_settings.infoClockFontSize); + CVolumeHelper::getInstance()->refresh(); + if (CNeutrinoApp::getInstance()->isMuted()) { + CAudioMute::getInstance()->enableMuteIcon(false); + CAudioMute::getInstance()->enableMuteIcon(true); + } + } + delete osd_menu; return res; } @@ -785,6 +804,13 @@ void COsdSetup::showOsdFontSizeSetup(CMenuWidget *menu_fonts) fontSettings->addItem(mf); w_index++; } +#if 0 + // size of info clock + fontSettings->addItem(GenericMenuSeparatorLine); + CMenuOptionNumberChooser* mn = new CMenuOptionNumberChooser(LOCALE_CLOCK_SIZE, &g_settings.infoClockFontSize, true, 30, 120); + mn->setHint("", LOCALE_MENU_HINT_CLOCK_SIZE); + fontSettings->addItem(mn); +#endif } //osd timeouts @@ -982,6 +1008,17 @@ void COsdSetup::showOsdVolumeSetup(CMenuWidget *menu_volume) menu_volume->addItem(mc); } +//info clock +void COsdSetup::showOsdInfoclockSetup(CMenuWidget *menu_infoclock) +{ + menu_infoclock->addIntroItems(LOCALE_MISCSETTINGS_INFOCLOCK); + + // size of info clock + CMenuOptionNumberChooser* mn = new CMenuOptionNumberChooser(LOCALE_CLOCK_SIZE_HEIGHT, &g_settings.infoClockFontSize, true, 30, 120); + mn->setHint("", LOCALE_MENU_HINT_CLOCK_SIZE); + menu_infoclock->addItem(mn); +} + bool COsdSetup::changeNotify(const neutrino_locale_t OptionName, void * data) { if(ARE_LOCALES_EQUAL(OptionName, LOCALE_COLORMENU_CONTRAST_FONTS)) diff --git a/src/gui/osd_setup.h b/src/gui/osd_setup.h index 68ab6ad17..2d30c064e 100644 --- a/src/gui/osd_setup.h +++ b/src/gui/osd_setup.h @@ -68,6 +68,7 @@ class COsdSetup : public CMenuTarget, public CChangeObserver void showOsdChanlistSetup(CMenuWidget *menu_chanlist); void showOsdEventlistSetup(CMenuWidget *menu_eventlist); void showOsdVolumeSetup(CMenuWidget *menu_volume); + void showOsdInfoclockSetup(CMenuWidget *menu_infoclock); void showOsdScreenShotSetup(CMenuWidget *menu_screenshot); void paintWindowSize(int w, int h); diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 00c84dfda..412494b76 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -821,6 +821,9 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.pip_width = configfile.getInt32("pip_width", 365); g_settings.pip_height = configfile.getInt32("pip_height", 200); #endif + + g_settings.infoClockFontSize = configfile.getInt32("infoClockFontSize", 34); + if(erg) configfile.setModifiedFlag(true); return erg; @@ -1237,6 +1240,7 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setInt32("pip_width", g_settings.pip_width); configfile.setInt32("pip_height", g_settings.pip_height); #endif + configfile.setInt32("infoClockFontSize", g_settings.infoClockFontSize); configfile.setInt32("easymenu", g_settings.easymenu); if(strcmp(fname, NEUTRINO_SETTINGS_FILE)) configfile.saveConfig(fname); diff --git a/src/neutrino_menue.h b/src/neutrino_menue.h index db23a4254..8a466f5a5 100644 --- a/src/neutrino_menue.h +++ b/src/neutrino_menue.h @@ -64,6 +64,7 @@ enum MN_WIDGET_ID MN_WIDGET_ID_OSDSETUP_TIMEOUT, MN_WIDGET_ID_OSDSETUP_SCREENSHOT, MN_WIDGET_ID_OSDSETUP_VOLUME, + MN_WIDGET_ID_OSDSETUP_INFOCLOCK, //actually it does not matter, but these 6 entries must be the same order as in menu MN_WIDGET_ID_OSDSETUP_FONTSIZE_MENU, MN_WIDGET_ID_OSDSETUP_FONTSIZE_CHANNELLIST, diff --git a/src/system/locals.h b/src/system/locals.h index e21369699..8677c2965 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -283,6 +283,8 @@ typedef enum LOCALE_CI_SETTINGS, LOCALE_CI_TIMEOUT, LOCALE_CI_WAITING, + LOCALE_CLOCK_SIZE, + LOCALE_CLOCK_SIZE_HEIGHT, LOCALE_CLOCK_SWITCH_OFF, LOCALE_CLOCK_SWITCH_ON, LOCALE_COLORCHOOSER_ALPHA, @@ -837,6 +839,7 @@ typedef enum LOCALE_MENU_HINT_CHANNELLIST_SETUP, LOCALE_MENU_HINT_CHANNELS, LOCALE_MENU_HINT_CI, + LOCALE_MENU_HINT_CLOCK_SIZE, LOCALE_MENU_HINT_COLORS, LOCALE_MENU_HINT_CONTENT_BACK, LOCALE_MENU_HINT_CONTENT_TEXTCOLOR, @@ -901,6 +904,7 @@ typedef enum LOCALE_MENU_HINT_INFOBAR_SETUP, LOCALE_MENU_HINT_INFOBAR_TEXTCOLOR, LOCALE_MENU_HINT_INFOBAR_TUNER, + LOCALE_MENU_HINT_INFOCLOCK_SETUP, LOCALE_MENU_HINT_KEEP_NUMBERS, LOCALE_MENU_HINT_KEY_ADDRECORD, LOCALE_MENU_HINT_KEY_ADDREMIND, @@ -1267,6 +1271,7 @@ typedef enum LOCALE_MISCSETTINGS_INFOBAR_SHOW_RES_SIMPLE, LOCALE_MISCSETTINGS_INFOBAR_SHOW_SYSFS_HDD, LOCALE_MISCSETTINGS_INFOBAR_SHOW_TUNER, + LOCALE_MISCSETTINGS_INFOCLOCK, LOCALE_MISCSETTINGS_PROGRESSBAR, LOCALE_MISCSETTINGS_PROGRESSBAR_COLOR, LOCALE_MISCSETTINGS_PROGRESSBAR_DESIGN, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index a57c08737..71f95daab 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -283,6 +283,8 @@ const char * locale_real_names[] = "ci.settings", "ci.timeout", "ci.waiting", + "clock_size", + "clock_size_height", "clock_switch_off", "clock_switch_on", "colorchooser.alpha", @@ -837,6 +839,7 @@ const char * locale_real_names[] = "menu.hint_channellist_setup", "menu.hint_channels", "menu.hint_ci", + "menu.hint_clock_size", "menu.hint_colors", "menu.hint_content_back", "menu.hint_content_textcolor", @@ -901,6 +904,7 @@ const char * locale_real_names[] = "menu.hint_infobar_setup", "menu.hint_infobar_textcolor", "menu.hint_infobar_tuner", + "menu.hint_infoclock_setup", "menu.hint_keep_numbers", "menu.hint_key_addrecord", "menu.hint_key_addremind", @@ -1267,6 +1271,7 @@ const char * locale_real_names[] = "miscsettings.infobar_show_res_simple", "miscsettings.infobar_show_sysfs_hdd", "miscsettings.infobar_show_tuner", + "miscsettings.infoclock", "miscsettings.progressbar", "miscsettings.progressbar_color", "miscsettings.progressbar_design", diff --git a/src/system/setting_helpers.cpp b/src/system/setting_helpers.cpp index 8e8dde7f9..b2ca12c00 100644 --- a/src/system/setting_helpers.cpp +++ b/src/system/setting_helpers.cpp @@ -52,7 +52,6 @@ #include #include #include -#include #include #include #include @@ -322,10 +321,6 @@ bool CFontSizeNotifier::changeNotify(const neutrino_locale_t, void *) hintBox.hide(); /* recalculate infoclock/muteicon/volumebar */ CVolumeHelper::getInstance()->refresh(); - if (CNeutrinoApp::getInstance()->isMuted()) { - CAudioMute::getInstance()->enableMuteIcon(false); - CAudioMute::getInstance()->enableMuteIcon(true); - } return true; } diff --git a/src/system/settings.h b/src/system/settings.h index 5d73ae098..150c80006 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -538,6 +538,8 @@ struct SNeutrinoSettings FONT_TYPE_COUNT }; + int infoClockFontSize; + // lcdd enum LCD_SETTINGS { LCD_BRIGHTNESS = 0, From 05cc6f18c1726349a456134eb0d4239b062c0162 Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Thu, 28 Nov 2013 02:56:07 +0100 Subject: [PATCH 44/77] CComponentsFrmClock: Remove double call of initCCLockItems() - initCCLockItems() is called by the refresh() function and the paint() function in initClockThread() --- src/gui/components/cc_frm_clock.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/gui/components/cc_frm_clock.cpp b/src/gui/components/cc_frm_clock.cpp index 13bbb708d..d9b308ab7 100644 --- a/src/gui/components/cc_frm_clock.cpp +++ b/src/gui/components/cc_frm_clock.cpp @@ -256,9 +256,6 @@ void* CComponentsFrmClock::initClockThread(void *arg) //start loop for paint while(1) { if (clock->paintClock) { - //refresh item property values - clock->refresh(); - //paint segements, but wihtout saved backgrounds clock->paint(CC_SAVE_SCREEN_NO); count = time(0); From 8a2185c32eb171f0e99e6cdad0ed71f1cbb742dc Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 29 Nov 2013 10:08:19 +0100 Subject: [PATCH 45/77] CInfoViewer: add missing color type for time display On changed theme colors, it's required to set the current color values otherwise the old values remain, this does not look so good. --- src/gui/infoviewer.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index dd62828c9..20eff23cf 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -259,6 +259,7 @@ void CInfoViewer::paintTime (bool show_dot) clock->setCorner(RADIUS_LARGE, CORNER_TOP_RIGHT); clock->doPaintBg(false); } + clock->setColorBody(COL_INFOBAR_PLUS_0); 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"); From e2ae51ae84073e95385b609d283de0e999af7c2f Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Fri, 22 Nov 2013 13:23:50 +0400 Subject: [PATCH 46/77] gui/movieplayer.cpp, neutrino.cpp: fix inactivity timer - do not stop playback to show cancel timer question --- src/gui/movieplayer.cpp | 2 +- src/neutrino.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index 05a1349a6..bc628a07e 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -799,7 +799,7 @@ void CMoviePlayerGui::PlayFile(void) } else if ( msg == NeutrinoMessages::ZAPTO || msg == NeutrinoMessages::STANDBY_ON || msg == NeutrinoMessages::SHUTDOWN || - msg == NeutrinoMessages::SLEEPTIMER) { // Exit for Record/Zapto Timers + ((msg == NeutrinoMessages::SLEEPTIMER) && !data) ) { // Exit for Record/Zapto Timers printf("CMoviePlayerGui::PlayFile: ZAPTO etc..\n"); if(msg != NeutrinoMessages::ZAPTO) menu_ret = menu_return::RETURN_EXIT_ALL; diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 412494b76..18d60fdab 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -2864,9 +2864,9 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) } } if(g_settings.shutdown_real) - ExitRun(true, (cs_get_revision() > 7)); - else if(mode != mode_standby) - standbyMode( true ); + g_RCInput->postMsg(NeutrinoMessages::SHUTDOWN, 0); + else + g_RCInput->postMsg(NeutrinoMessages::STANDBY_ON, 0); return messages_return::handled; } else if( msg == NeutrinoMessages::RELOAD_SETUP ) { From beb442680b14d7b06e7b656960511a42f9ef7551 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Tue, 26 Nov 2013 13:20:23 +0400 Subject: [PATCH 47/77] gui/infoviewer_bb.cpp: fix memleak, hddscale and sysscale was never deleted --- src/gui/infoviewer_bb.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/infoviewer_bb.cpp b/src/gui/infoviewer_bb.cpp index cdb770fed..ce419374d 100644 --- a/src/gui/infoviewer_bb.cpp +++ b/src/gui/infoviewer_bb.cpp @@ -87,14 +87,14 @@ CInfoViewerBB::CInfoViewerBB() bbIconInfo[0].h = 0; BBarY = 0; BBarFontY = 0; + hddscale = NULL; + sysscale = NULL; Init(); } void CInfoViewerBB::Init() { - hddscale = NULL; - sysscale = NULL; hddwidth = 0; bbIconMaxH = 0; bbButtonMaxH = 0; From 1378ef4ad0e079e4d66bc07dbcb989673dd55592 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Tue, 26 Nov 2013 15:35:36 +0400 Subject: [PATCH 48/77] gui/components/cc_item_infobox.cpp: fix memleak: CComponentsInfoBox ctor -> CComponentsText ctor -> initCCText(), initVarInfobox() -> initVarText() -> created ct_textbox = NULL, pointer lost; comment calls in CComponentsInfoBox dtor, which already called from base CComponentsText dtor --- src/gui/components/cc_item_infobox.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gui/components/cc_item_infobox.cpp b/src/gui/components/cc_item_infobox.cpp index ff1b30bfb..af3027911 100644 --- a/src/gui/components/cc_item_infobox.cpp +++ b/src/gui/components/cc_item_infobox.cpp @@ -66,18 +66,22 @@ CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const i CComponentsInfoBox::~CComponentsInfoBox() { +#if 0 // called from base (CComponentsText) dtor hide(); clearSavedScreen(); clearCCText(); + clear(); +#endif delete pic; delete cctext; - clear(); } void CComponentsInfoBox::initVarInfobox() { //CComponents, CComponentsItem, CComponentsText +#if 0 // called from base (CComponentsText) ctor initVarText(); +#endif cc_item_type = CC_ITEMTYPE_TEXT_INFOBOX; //CComponentsInfoBox From 5526bedc26b14f2bf673cc78161285e376095d09 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Tue, 26 Nov 2013 18:25:29 +0400 Subject: [PATCH 49/77] gui/components/cc_frm_signalbars.cpp: fix mem leak: initVarSigBar call from CSignalNoiseRatioBar reset pointers created by initSBItems from CSignalBar ctor --- src/gui/components/cc_frm_signalbars.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gui/components/cc_frm_signalbars.cpp b/src/gui/components/cc_frm_signalbars.cpp index b2e40f79e..7e3b30bdb 100644 --- a/src/gui/components/cc_frm_signalbars.cpp +++ b/src/gui/components/cc_frm_signalbars.cpp @@ -249,7 +249,9 @@ void CSignalBar::paint(bool do_save_bg) CSignalNoiseRatioBar::CSignalNoiseRatioBar() { initVarSnrBar(); +#if 0 // called from base (CSignalBar) ctor initSBItems(); +#endif } CSignalNoiseRatioBar::CSignalNoiseRatioBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref) @@ -261,12 +263,16 @@ CSignalNoiseRatioBar::CSignalNoiseRatioBar(const int& xpos, const int& ypos, con width = w; height = h; +#if 0 // called from base (CSignalBar) ctor initSBItems(); +#endif } void CSignalNoiseRatioBar::initVarSnrBar() { +#if 0 // called from base (CSignalBar) ctor initVarSigBar(); +#endif sb_name = "SNR"; } From ac773ea896457a131efc2c7a7104bdfba6efc20f Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Wed, 27 Nov 2013 12:05:39 +0400 Subject: [PATCH 50/77] gui/widget/menue.cpp: add CMenuDForwarderNonLocalized --- src/gui/widget/menue.cpp | 14 ++++++++++++++ src/gui/widget/menue.h | 8 ++++++++ 2 files changed, 22 insertions(+) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 988bd6ff0..77d5e0db6 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -1853,6 +1853,20 @@ int CMenuForwarderNonLocalized::getWidth(void) return tw; } + +CMenuDForwarderNonLocalized::CMenuDForwarderNonLocalized(const char * const Text, const bool Active, const char * const Option, CMenuTarget* Target, const char * const ActionKey, neutrino_msg_t DirectKey, const char * const IconName, const char * const IconName_Info_right) : CMenuForwarderNonLocalized(Text, Active, Option, Target, ActionKey, DirectKey, IconName, IconName_Info_right) +{ +} + +CMenuDForwarderNonLocalized::CMenuDForwarderNonLocalized(const char * const Text, const bool Active, const std::string &Option, CMenuTarget* Target, const char * const ActionKey, neutrino_msg_t DirectKey, const char * const IconName, const char * const IconName_Info_right) : CMenuForwarderNonLocalized(Text, Active, Option, Target, ActionKey, DirectKey, IconName, IconName_Info_right) +{ +} + +CMenuDForwarderNonLocalized::~CMenuDForwarderNonLocalized() +{ + delete jumpTarget; +} + //------------------------------------------------------------------------------------------------------------------------------- CMenuSeparator::CMenuSeparator(const int Type, const neutrino_locale_t Text, bool IsStatic) { diff --git a/src/gui/widget/menue.h b/src/gui/widget/menue.h index 7ae164a20..4134bf051 100644 --- a/src/gui/widget/menue.h +++ b/src/gui/widget/menue.h @@ -255,6 +255,14 @@ class CMenuForwarderNonLocalized : public CMenuForwarder void setText(const char * const Text); }; +class CMenuDForwarderNonLocalized : public CMenuForwarderNonLocalized +{ + public: + CMenuDForwarderNonLocalized(const char * const Text, const bool Active=true, const char * const Option=NULL, CMenuTarget* Target=NULL, const char * const ActionKey = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey, const char * const IconName = NULL, const char * const IconName_Info_right = NULL); + CMenuDForwarderNonLocalized(const char * const Text, const bool Active, const std::string &Option, CMenuTarget* Target=NULL, const char * const ActionKey = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey, const char * const IconName = NULL, const char * const IconName_Info_right = NULL); + ~CMenuDForwarderNonLocalized(); +}; + class CAbstractMenuOptionChooser : public CMenuItem { protected: From 4e48e81914a16272bac9ec5f9d957f94fa8c9345 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Wed, 27 Nov 2013 12:07:56 +0400 Subject: [PATCH 51/77] gui/scan_setup.cpp: fix memleaks --- src/gui/scan_setup.cpp | 41 +++++++++++++++++++++-------------------- src/gui/scan_setup.h | 2 -- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/src/gui/scan_setup.cpp b/src/gui/scan_setup.cpp index 9d57587ad..735a4f437 100644 --- a/src/gui/scan_setup.cpp +++ b/src/gui/scan_setup.cpp @@ -197,8 +197,6 @@ CScanSetup::CScanSetup(bool wizard_mode) width = w_max (40, 10); is_wizard = wizard_mode; - satSelect = NULL; - cableSelect = NULL; satOnOff = NULL; fautoScanAll = NULL; frontendSetup = NULL; @@ -214,8 +212,6 @@ CScanSetup::CScanSetup(bool wizard_mode) allow_start = true; if (CFEManager::getInstance()->haveCable()) nid = new CIntInput(LOCALE_SATSETUP_CABLE_NID, (int&) scansettings.cable_nid, 5, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE); - if (CFEManager::getInstance()->haveSat()) - satSelect = new CMenuOptionStringChooser(LOCALE_SATSETUP_SATELLITE, scansettings.satName, true, this, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED, true); } CScanSetup* CScanSetup::getInstance() @@ -232,7 +228,6 @@ CScanSetup* CScanSetup::getInstance() CScanSetup::~CScanSetup() { - delete satSelect; delete nid; } @@ -402,14 +397,8 @@ int CScanSetup::showScanMenu() //settings->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_SCANTS_PREVERENCES_RECEIVING_SYSTEM )); - //satSelect = new CMenuOptionStringChooser(LOCALE_SATSETUP_SATELLITE, scansettings.satName, true, this, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED, true); - satSelect->setHint("", LOCALE_MENU_HINT_SCAN_SATELLITE); - satOnOff = new CMenuWidget(LOCALE_SATSETUP_SATELLITE, NEUTRINO_ICON_SETTINGS, width); - /* add configured satellites to satSelect */ - fillSatSelect(satSelect); - //auto scan char autoscan[64]; std::string s_capt_part = g_Locale->getText(LOCALE_SATSETUP_SATELLITE); @@ -417,14 +406,14 @@ int CScanSetup::showScanMenu() CMenuWidget * autoScan = new CMenuWidget(LOCALE_SERVICEMENU_SCANTS, NEUTRINO_ICON_SETTINGS, w/*width*/, MN_WIDGET_ID_SCAN_AUTO_SCAN); addScanMenuAutoScan(autoScan); - mf = new CMenuForwarderNonLocalized(autoscan, true, NULL, autoScan, "", CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED); + mf = new CMenuDForwarderNonLocalized(autoscan, true, NULL, autoScan, "", CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED); mf->setHint("", LOCALE_MENU_HINT_SCAN_AUTO); settings->addItem(mf); //manual scan CMenuWidget * manualScan = new CMenuWidget(LOCALE_SATSETUP_MANUAL_SCAN, NEUTRINO_ICON_SETTINGS, w/*width*/, MN_WIDGET_ID_SCAN_MANUAL_SCAN); addScanMenuManualScan(manualScan); - mf = new CMenuForwarder(LOCALE_SATSETUP_MANUAL_SCAN, true, NULL, manualScan, "", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN); + mf = new CMenuDForwarder(LOCALE_SATSETUP_MANUAL_SCAN, true, NULL, manualScan, "", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN); mf->setHint("", LOCALE_MENU_HINT_SCAN_MANUAL); settings->addItem(mf); //auto scan all @@ -445,12 +434,9 @@ int CScanSetup::showScanMenu() if (CFEManager::getInstance()->haveCable()) { r_system = DVB_C; - cableSelect = new CMenuOptionStringChooser(LOCALE_CABLESETUP_PROVIDER, scansettings.cableName, true, this, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED, true); - cableSelect->setHint("", LOCALE_MENU_HINT_SCAN_CABLE); //-------------------------------------------------------------- settings->addItem(GenericMenuSeparatorLine); //-------------------------------------------------------------- - fillCableSelect(cableSelect); //tune timeout if(CFEManager::getInstance()->getFrontendCount() <= 1) { CMenuOptionNumberChooser * nc = new CMenuOptionNumberChooser(LOCALE_EXTRA_ZAPIT_FE_TIMEOUT, (int *)&zapitCfg.feTimeout, true, 6, 100); @@ -467,14 +453,14 @@ int CScanSetup::showScanMenu() CMenuWidget * autoScan = new CMenuWidget(LOCALE_SERVICEMENU_SCANTS, NEUTRINO_ICON_SETTINGS, w/*width*/, MN_WIDGET_ID_SCAN_AUTO_SCAN); addScanMenuAutoScan(autoScan); - mf = new CMenuForwarderNonLocalized(autoscan, true, NULL, autoScan, "", have_sat ? CRCInput::convertDigitToKey(shortcut++) : CRCInput::RC_red, have_sat ? NULL : NEUTRINO_ICON_BUTTON_RED); + mf = new CMenuDForwarderNonLocalized(autoscan, true, NULL, autoScan, "", have_sat ? CRCInput::convertDigitToKey(shortcut++) : CRCInput::RC_red, have_sat ? NULL : NEUTRINO_ICON_BUTTON_RED); mf->setHint("", LOCALE_MENU_HINT_SCAN_AUTO); settings->addItem(mf); //manual scan CMenuWidget * manualScan = new CMenuWidget(LOCALE_SATSETUP_MANUAL_SCAN, NEUTRINO_ICON_SETTINGS, w/*width*/, MN_WIDGET_ID_SCAN_MANUAL_SCAN); addScanMenuManualScan(manualScan); - mf = new CMenuForwarder(LOCALE_SATSETUP_MANUAL_SCAN, true, NULL, manualScan, "", have_sat ? CRCInput::convertDigitToKey(shortcut++) : CRCInput::RC_green, have_sat ? NULL : NEUTRINO_ICON_BUTTON_GREEN); + mf = new CMenuDForwarder(LOCALE_SATSETUP_MANUAL_SCAN, true, NULL, manualScan, "", have_sat ? CRCInput::convertDigitToKey(shortcut++) : CRCInput::RC_green, have_sat ? NULL : NEUTRINO_ICON_BUTTON_GREEN); mf->setHint("", LOCALE_MENU_HINT_SCAN_MANUAL); settings->addItem(mf); //simple cable scan @@ -736,7 +722,7 @@ int CScanSetup::showFrontendSetup(int number) mc->setHint("", LOCALE_MENU_HINT_SCAN_SATENABLE); satToSelect->addItem(mc); } - fsatSelect = new CMenuForwarder(LOCALE_SATSETUP_SELECT_SAT, allow_moptions, NULL, satToSelect, "", CRCInput::convertDigitToKey(shortcut++)); + fsatSelect = new CMenuDForwarder(LOCALE_SATSETUP_SELECT_SAT, allow_moptions, NULL, satToSelect, "", CRCInput::convertDigitToKey(shortcut++)); fsatSelect->setHint("", LOCALE_MENU_HINT_SCAN_SATADD); setupMenu->addItem(fsatSelect); @@ -1067,12 +1053,19 @@ void CScanSetup::addScanMenuManualScan(CMenuWidget *manual_Scan) manual_Scan->addIntroItems(); //---------------------------------------------------------------------- if (r_system == DVB_C) { + CMenuOptionStringChooser * cableSelect = new CMenuOptionStringChooser(LOCALE_CABLESETUP_PROVIDER, scansettings.cableName, true, this, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED, true); + cableSelect->setHint("", LOCALE_MENU_HINT_SCAN_CABLE); + fillCableSelect(cableSelect); manual_Scan->addItem(cableSelect); mf = new CMenuForwarder(LOCALE_SATSETUP_CABLE_NID, true, nid->getValue(), nid); mf->setHint("", LOCALE_MENU_HINT_SCAN_NID); manual_Scan->addItem(mf); mf = new CMenuDForwarder(LOCALE_SCANTS_SELECT_TP, true, NULL, new CTPSelectHandler(), "cable", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN); } else { + CMenuOptionStringChooser * satSelect = new CMenuOptionStringChooser(LOCALE_SATSETUP_SATELLITE, scansettings.satName, true, this, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED, true); + satSelect->setHint("", LOCALE_MENU_HINT_SCAN_SATELLITE); + /* add configured satellites to satSelect */ + fillSatSelect(satSelect); manual_Scan->addItem(satSelect); mf = new CMenuDForwarder(LOCALE_SCANTS_SELECT_TP, true, NULL, new CTPSelectHandler(), "sat", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN); } @@ -1163,12 +1156,20 @@ void CScanSetup::addScanMenuAutoScan(CMenuWidget *auto_Scan) auto_Scan->addIntroItems(); if (r_system == DVB_C) { //cable + CMenuOptionStringChooser * cableSelect = new CMenuOptionStringChooser(LOCALE_CABLESETUP_PROVIDER, scansettings.cableName, true, this, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED, true); + cableSelect->setHint("", LOCALE_MENU_HINT_SCAN_CABLE); + fillCableSelect(cableSelect); auto_Scan->addItem(cableSelect); mf = new CMenuForwarder(LOCALE_SATSETUP_CABLE_NID, true, nid->getValue(), nid); mf->setHint("", LOCALE_MENU_HINT_SCAN_NID); auto_Scan->addItem(mf); - } else + } else { + CMenuOptionStringChooser * satSelect = new CMenuOptionStringChooser(LOCALE_SATSETUP_SATELLITE, scansettings.satName, true, this, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED, true); + satSelect->setHint("", LOCALE_MENU_HINT_SCAN_SATELLITE); + /* add configured satellites to satSelect */ + fillSatSelect(satSelect); auto_Scan->addItem(satSelect); + } auto_Scan->addItem(GenericMenuSeparatorLine); //---------------------------------------------------------------------- diff --git a/src/gui/scan_setup.h b/src/gui/scan_setup.h index fe55c32ee..e826f3b2c 100644 --- a/src/gui/scan_setup.h +++ b/src/gui/scan_setup.h @@ -50,8 +50,6 @@ class CScanSetup : public CMenuTarget, public CChangeObserver int width; private: - CMenuOptionStringChooser *satSelect; - CMenuOptionStringChooser *cableSelect; CMenuWidget *satOnOff; /* global items to be enabled/disabled in notify */ From 00b0cef69cc8862c4a7ac145445b50bc261848a2 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Wed, 27 Nov 2013 12:23:43 +0400 Subject: [PATCH 52/77] gui/cam_menu.cpp: fix memleaks --- src/gui/cam_menu.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/cam_menu.cpp b/src/gui/cam_menu.cpp index c00f8ffb8..50d4ca2f3 100644 --- a/src/gui/cam_menu.cpp +++ b/src/gui/cam_menu.cpp @@ -135,7 +135,7 @@ int CCAMMenuHandler::doMainMenu() } else { snprintf(str1, sizeof(str1), "%s %d", g_Locale->getText(LOCALE_CI_EMPTY), i); tempMenu = new CMenuWidget(str1, NEUTRINO_ICON_SETTINGS); - cammenu->addItem(new CMenuForwarderNonLocalized(str1, false, NULL, tempMenu)); + cammenu->addItem(new CMenuDForwarderNonLocalized(str1, false, NULL, tempMenu)); memset(str1,0,sizeof(str1)); } if (i < (CiSlots - 1)) @@ -166,7 +166,7 @@ int CCAMMenuHandler::doMainMenu() } else { snprintf(str1, sizeof(str1), "%s %d", g_Locale->getText(LOCALE_SC_EMPTY), i); tempMenu = new CMenuWidget(str1, NEUTRINO_ICON_SETTINGS); - cammenu->addItem(new CMenuForwarderNonLocalized(str1, false, NULL, tempMenu)); + cammenu->addItem(new CMenuDForwarderNonLocalized(str1, false, NULL, tempMenu)); memset(str1,0,sizeof(str1)); } if (i < (ScNum - 1)) From 5f80ab6450bfe7852624710f29c28a49c0782831 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Wed, 27 Nov 2013 15:50:19 +0400 Subject: [PATCH 53/77] cc_base.h: make private initVarBasic and initVarItem, they are is called from constructors --- src/gui/components/cc_base.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/gui/components/cc_base.h b/src/gui/components/cc_base.h index 52dffe735..bf2eeb5cd 100644 --- a/src/gui/components/cc_base.h +++ b/src/gui/components/cc_base.h @@ -45,6 +45,8 @@ class CComponents private: ///pixel buffer handling, returns pixel buffer depends of given parameters fb_pixel_t* getScreen(int ax, int ay, int dx, int dy); + ///initialize of basic attributes, no parameters required + void initVarBasic(); protected: ///object: framebuffer object, usable in all sub classes @@ -97,8 +99,6 @@ class CComponents ///mode: true=allows painting of item, see also allowPaint() bool cc_allow_paint; - ///initialize of basic attributes, no parameters required - void initVarBasic(); ///rendering of framebuffer elements at once, ///elements are contained in v_fbdata, presumes added frambuffer elements with paintInit(), ///parameter do_save_bg=true, saves background of element to pixel buffer, this can be restore with hide() @@ -216,6 +216,9 @@ class CComponents class CComponentsItem : public CComponents { + private: + ///initialize all required attributes + void initVarItem(); protected: ///property: define of item type, see cc_types.h for possible types int cc_item_type; @@ -242,8 +245,6 @@ class CComponentsItem : public CComponents ///an item will be hide or overpainted with other methods, or it's embedded (bound) in a parent form. void paintInit(bool do_save_bg); - ///initialize all required attributes - void initVarItem(); public: CComponentsItem(); From 93a326e9eb2745c443e08fb6f46ce8416b61eb20 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Wed, 27 Nov 2013 15:52:19 +0400 Subject: [PATCH 54/77] components: remove initVarBasic and initVarItem calls from derived classes --- src/gui/components/cc_detailsline.cpp | 3 --- src/gui/components/cc_frm.cpp | 2 -- src/gui/components/cc_item.cpp | 1 - src/gui/components/cc_item_picture.cpp | 1 - src/gui/components/cc_item_shapes.cpp | 2 -- src/gui/components/cc_item_text.cpp | 1 - src/gui/components/cc_item_tvpic.cpp | 1 - 7 files changed, 11 deletions(-) diff --git a/src/gui/components/cc_detailsline.cpp b/src/gui/components/cc_detailsline.cpp index 646b0292e..8c20ccd9a 100644 --- a/src/gui/components/cc_detailsline.cpp +++ b/src/gui/components/cc_detailsline.cpp @@ -69,9 +69,6 @@ CComponentsDetailLine::CComponentsDetailLine(const int x_pos, const int y_pos_to void CComponentsDetailLine::initVarDline() { - //CComponents - initVarBasic(); - shadow_w = 1; //CComponentsDetailLine diff --git a/src/gui/components/cc_frm.cpp b/src/gui/components/cc_frm.cpp index 27c094170..83507f889 100644 --- a/src/gui/components/cc_frm.cpp +++ b/src/gui/components/cc_frm.cpp @@ -105,8 +105,6 @@ void CComponentsForm::clearCCItems() void CComponentsForm::initVarForm() { - //CComponentsItem - initVarItem(); //simple default dimensions diff --git a/src/gui/components/cc_item.cpp b/src/gui/components/cc_item.cpp index 0ab26c35d..30fccdfa4 100644 --- a/src/gui/components/cc_item.cpp +++ b/src/gui/components/cc_item.cpp @@ -52,7 +52,6 @@ CComponentsItem::CComponentsItem() void CComponentsItem::initVarItem() { //CComponents - initVarBasic(); cc_item_index = CC_NO_INDEX; cc_item_enabled = true; cc_item_selected = false; diff --git a/src/gui/components/cc_item_picture.cpp b/src/gui/components/cc_item_picture.cpp index ebd77bf6f..8d66f43f8 100644 --- a/src/gui/components/cc_item_picture.cpp +++ b/src/gui/components/cc_item_picture.cpp @@ -57,7 +57,6 @@ void CComponentsPicture::init( int x_pos, int y_pos, const string& image_name, c fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow) { //CComponents, CComponentsItem - initVarItem(); cc_item_type = CC_ITEMTYPE_PICTURE; //CComponentsPicture diff --git a/src/gui/components/cc_item_shapes.cpp b/src/gui/components/cc_item_shapes.cpp index 758622401..14393b610 100644 --- a/src/gui/components/cc_item_shapes.cpp +++ b/src/gui/components/cc_item_shapes.cpp @@ -38,7 +38,6 @@ using namespace std; CComponentsShapeSquare::CComponentsShapeSquare(const int x_pos, const int y_pos, const int w, const int h, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { //CComponentsItem - initVarItem(); cc_item_type = CC_ITEMTYPE_SHAPE_SQUARE; x = x_pos; @@ -64,7 +63,6 @@ CComponentsShapeCircle::CComponentsShapeCircle( int x_pos, int y_pos, int diam, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { //CComponents, CComponentsItem - initVarItem(); cc_item_type = CC_ITEMTYPE_SHAPE_CIRCLE; //CComponents diff --git a/src/gui/components/cc_item_text.cpp b/src/gui/components/cc_item_text.cpp index feb6b3f0e..797deae31 100644 --- a/src/gui/components/cc_item_text.cpp +++ b/src/gui/components/cc_item_text.cpp @@ -87,7 +87,6 @@ CComponentsText::~CComponentsText() void CComponentsText::initVarText() { //CComponents, CComponentsItem - initVarItem(); cc_item_type = CC_ITEMTYPE_TEXT; //CComponentsText diff --git a/src/gui/components/cc_item_tvpic.cpp b/src/gui/components/cc_item_tvpic.cpp index c5aa38117..388e2821a 100644 --- a/src/gui/components/cc_item_tvpic.cpp +++ b/src/gui/components/cc_item_tvpic.cpp @@ -43,7 +43,6 @@ using namespace std; CComponentsPIP::CComponentsPIP( const int x_pos, const int y_pos, const int percent, bool has_shadow) { //CComponents, CComponentsItem - initVarItem(); cc_item_type = CC_ITEMTYPE_PIP; //CComponentsPIP From 9897b9045caac927a3a0390bcdc8ea1f0089f9e2 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Wed, 27 Nov 2013 15:55:15 +0400 Subject: [PATCH 55/77] cc_item_progressbar.cpp: for advanced paint, replace paintShapes with paintBoxRel: too much overhead to replace single paintBoxRel call --- src/gui/components/cc_item_progressbar.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/gui/components/cc_item_progressbar.cpp b/src/gui/components/cc_item_progressbar.cpp index 06debd8ae..03f29ca12 100644 --- a/src/gui/components/cc_item_progressbar.cpp +++ b/src/gui/components/cc_item_progressbar.cpp @@ -76,7 +76,6 @@ CProgressBar::CProgressBar( const int x_pos, const int y_pos, const int w, const void CProgressBar::initVarProgressbar() { //CComponentsItem - initVarItem(); cc_item_type = CC_ITEMTYPE_PROGRESSBAR; //CProgressBar @@ -214,7 +213,8 @@ void CProgressBar::paintAdvanced() for (j = 0; j < hcnt; j++) { int sh_x = pb_x + i * itemw; int sh_y = py + j * itemh; - paintShapes(sh_x, sh_y, pointx, pointy, color); + //paintShapes(sh_x, sh_y, pointx, pointy, color); + frameBuffer->paintBoxRel(sh_x, sh_y, pointx, pointy, color); } } step = yw - rd - 1; @@ -230,7 +230,8 @@ void CProgressBar::paintAdvanced() for (j = 0; j < hcnt; j++) { int sh_x = pb_x + i * itemw; int sh_y = py + j * itemh; - paintShapes(sh_x, sh_y, pointx, pointy, color); + //paintShapes(sh_x, sh_y, pointx, pointy, color); + frameBuffer->paintBoxRel(sh_x, sh_y, pointx, pointy, color); } } off = diff; @@ -248,7 +249,8 @@ void CProgressBar::paintAdvanced() for (j = 0; j < hcnt; j++) { int sh_x = pb_x + i * itemw; int sh_y = py + j * itemh; - paintShapes(sh_x, sh_y, pointx, pointy, color); + //paintShapes(sh_x, sh_y, pointx, pointy, color); + frameBuffer->paintBoxRel(sh_x, sh_y, pointx, pointy, color); } } } @@ -256,7 +258,8 @@ void CProgressBar::paintAdvanced() for (j = 0; j < hcnt; j++) { int sh_x = pb_x + i * itemw; int sh_y = py + j * itemh; - paintShapes(sh_x, sh_y, pointx, pointy, pb_passive_col); //fill passive + //paintShapes(sh_x, sh_y, pointx, pointy, pb_passive_col); //fill passive + frameBuffer->paintBoxRel(sh_x, sh_y, pointx, pointy, pb_passive_col); } } } From 83649513af93bc7e33fccf45f89f87a897a89c33 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Wed, 27 Nov 2013 16:04:38 +0400 Subject: [PATCH 56/77] gui/imageinfo.cpp: fix memleak, b_info never deleted --- src/gui/imageinfo.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/imageinfo.cpp b/src/gui/imageinfo.cpp index 573bfc929..ff7c64da0 100644 --- a/src/gui/imageinfo.cpp +++ b/src/gui/imageinfo.cpp @@ -88,6 +88,7 @@ void CImageInfo::Clean() cc_tv = NULL; cc_lic = NULL; cc_sub_caption = NULL; + delete b_info; b_info = NULL; btn_red = NULL; } From 062b10be2ae8feec760a26d573ffe9e84ac4a550 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Wed, 27 Nov 2013 18:54:11 +0400 Subject: [PATCH 57/77] components: remove initVarForm calls in classes derived from CComponentsForm --- src/gui/components/cc_frm.h | 3 ++- src/gui/components/cc_frm_button.cpp | 1 - src/gui/components/cc_frm_clock.cpp | 1 - src/gui/components/cc_frm_ext_text.cpp | 1 - src/gui/components/cc_frm_header.cpp | 2 -- src/gui/components/cc_frm_icons.cpp | 2 -- src/gui/components/cc_frm_signalbars.cpp | 2 -- src/gui/components/cc_frm_window.cpp | 1 - src/gui/volumebar.cpp | 2 -- 9 files changed, 2 insertions(+), 13 deletions(-) diff --git a/src/gui/components/cc_frm.h b/src/gui/components/cc_frm.h index 9b92e1645..0db55a79b 100644 --- a/src/gui/components/cc_frm.h +++ b/src/gui/components/cc_frm.h @@ -37,9 +37,10 @@ class CComponentsForm : public CComponentsItem { + private: + void initVarForm(); protected: std::vector v_cc_items; - void initVarForm(); void paintForm(bool do_save_bg); ///generates next possible index for an item, see also cc_item_index, getIndex(), setIndex() int genIndex(); diff --git a/src/gui/components/cc_frm_button.cpp b/src/gui/components/cc_frm_button.cpp index 7846ef20d..639cfe683 100644 --- a/src/gui/components/cc_frm_button.cpp +++ b/src/gui/components/cc_frm_button.cpp @@ -88,7 +88,6 @@ CComponentsButton::CComponentsButton( const int x_pos, const int y_pos, const i void CComponentsButton::initVarButton() { - initVarForm(); cc_item_type = CC_ITEMTYPE_BUTTON; cc_btn_icon_obj = NULL; cc_btn_capt_obj = NULL; diff --git a/src/gui/components/cc_frm_clock.cpp b/src/gui/components/cc_frm_clock.cpp index d9b308ab7..11d983f4c 100644 --- a/src/gui/components/cc_frm_clock.cpp +++ b/src/gui/components/cc_frm_clock.cpp @@ -70,7 +70,6 @@ CComponentsFrmClock::CComponentsFrmClock( const int x_pos, const int y_pos, cons void CComponentsFrmClock::initVarClock() { - initVarForm(); cc_item_type = CC_ITEMTYPE_FRM_CLOCK; corner_rad = RADIUS_SMALL; diff --git a/src/gui/components/cc_frm_ext_text.cpp b/src/gui/components/cc_frm_ext_text.cpp index ce7c83c4e..d44c940d0 100644 --- a/src/gui/components/cc_frm_ext_text.cpp +++ b/src/gui/components/cc_frm_ext_text.cpp @@ -77,7 +77,6 @@ void CComponentsExtTextForm::initVarExtTextForm(const int x_pos, const int y_pos fb_pixel_t text_color, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { - initVarForm(); cc_item_type = CC_ITEMTYPE_FRM_EXT_TEXT; x = x_pos; y = y_pos; diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index ea447f548..0975ae630 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -90,8 +90,6 @@ CComponentsHeader::CComponentsHeader( const int x_pos, const int y_pos, const in void CComponentsHeader::initVarHeader() { - //CComponentsForm - initVarForm(); cc_item_type = CC_ITEMTYPE_FRM_HEADER; col_body = COL_MENUHEAD_PLUS_0; corner_rad = RADIUS_LARGE, diff --git a/src/gui/components/cc_frm_icons.cpp b/src/gui/components/cc_frm_icons.cpp index 5bb8fe615..4bb19468a 100644 --- a/src/gui/components/cc_frm_icons.cpp +++ b/src/gui/components/cc_frm_icons.cpp @@ -60,8 +60,6 @@ CComponentsIconForm::CComponentsIconForm(const int x_pos, const int y_pos, const void CComponentsIconForm::initVarIconForm() { - //CComponentsForm - initVarForm(); cc_item_type = CC_ITEMTYPE_FRM_ICONFORM; //set default width and height to 0, this causes a dynamic adaptation of width and height of form diff --git a/src/gui/components/cc_frm_signalbars.cpp b/src/gui/components/cc_frm_signalbars.cpp index 7e3b30bdb..2f6bf0ce0 100644 --- a/src/gui/components/cc_frm_signalbars.cpp +++ b/src/gui/components/cc_frm_signalbars.cpp @@ -95,7 +95,6 @@ void CSignalBar::initSBItems() void CSignalBar::initVarSigBar() { - initVarForm(); corner_rad = 0; corner_type = 0; append_h_offset = 2; @@ -313,7 +312,6 @@ CSignalBox::CSignalBox(const int& xpos, const int& ypos, const int& w, const int void CSignalBox::initVarSigBox() { - initVarForm(); corner_rad = 0; sbx_frontend = NULL; diff --git a/src/gui/components/cc_frm_window.cpp b/src/gui/components/cc_frm_window.cpp index beb623906..0be93d647 100644 --- a/src/gui/components/cc_frm_window.cpp +++ b/src/gui/components/cc_frm_window.cpp @@ -125,7 +125,6 @@ CComponentsWindow::~CComponentsWindow() void CComponentsWindow::initVarWindow() { //CComponentsForm - initVarForm(); cc_item_type = CC_ITEMTYPE_FRM_WINDOW; //using current screen settings for default dimensions diff --git a/src/gui/volumebar.cpp b/src/gui/volumebar.cpp index 781ea51f8..8578541b0 100644 --- a/src/gui/volumebar.cpp +++ b/src/gui/volumebar.cpp @@ -44,8 +44,6 @@ CVolumeBar::CVolumeBar() void CVolumeBar::initVarVolumeBar() { - //init inherited variables - initVarForm(); col_body = COL_MENUCONTENT_PLUS_0; vb_item_offset = 4; From 90c76a2985b8ccc991035c988a4f197696d988fa Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Wed, 27 Nov 2013 19:07:51 +0400 Subject: [PATCH 58/77] components: remove initVarHeader calls in classes derived from CComponentsHeader --- src/gui/components/cc_frm.h | 4 ++-- src/gui/components/cc_frm_footer.cpp | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/gui/components/cc_frm.h b/src/gui/components/cc_frm.h index 0db55a79b..f97e15e23 100644 --- a/src/gui/components/cc_frm.h +++ b/src/gui/components/cc_frm.h @@ -113,6 +113,8 @@ class CComponentsIconForm : public CComponentsForm class CComponentsHeader : public CComponentsForm { + private: + void initVarHeader(); protected: CComponentsPicture * cch_icon_obj; CComponentsText * cch_text_obj; @@ -132,8 +134,6 @@ class CComponentsHeader : public CComponentsForm void initDefaultButtons(); void initButtonFormSize(); - void initVarHeader(); - public: enum { diff --git a/src/gui/components/cc_frm_footer.cpp b/src/gui/components/cc_frm_footer.cpp index 0a07cbf5e..8ad8ff113 100644 --- a/src/gui/components/cc_frm_footer.cpp +++ b/src/gui/components/cc_frm_footer.cpp @@ -65,9 +65,6 @@ CComponentsFooter::CComponentsFooter( const int x_pos, const int y_pos, const in void CComponentsFooter::initVarFooter() { - //CComponentsHeader - initVarHeader(); - cc_item_type = CC_ITEMTYPE_FOOTER; corner_rad = RADIUS_LARGE; corner_type = CORNER_BOTTOM; From 1e5e36b7c8e40ac24a68681e2d10d9e8da00a56e Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Thu, 28 Nov 2013 15:14:20 +0400 Subject: [PATCH 59/77] cc_item_progressbar.cpp: fix attempt to draw box with width=0 --- src/gui/components/cc_item_progressbar.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/components/cc_item_progressbar.cpp b/src/gui/components/cc_item_progressbar.cpp index 03f29ca12..8c5944a41 100644 --- a/src/gui/components/cc_item_progressbar.cpp +++ b/src/gui/components/cc_item_progressbar.cpp @@ -149,7 +149,8 @@ void CProgressBar::paintSimple() { // progress value if (pb_active_width != pb_last_width){ - paintShapes(pb_x, pb_y, pb_active_width, pb_height, pb_active_col); // active bar + if (pb_active_width) + paintShapes(pb_x, pb_y, pb_active_width, pb_height, pb_active_col); // active bar paintShapes(pb_start_x_passive, pb_y, pb_passive_width, pb_height, pb_passive_col); // passive bar } From 3b707458be79ed022bc5ee54609f03f1336971a6 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Thu, 28 Nov 2013 17:53:29 +0400 Subject: [PATCH 60/77] gui/channellist.cpp: disable screen save for detail line --- 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 082331577..033b66fdb 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -1753,7 +1753,7 @@ void CChannelList::paintItem2DetailsLine (int pos) if (pos >= 0) { if (dline == NULL) dline = new CComponentsDetailLine(xpos, ypos1, ypos2, fheight/2+1, info_height-RADIUS_LARGE*2); - dline->paint(); + dline->paint(false); } } From edaa65d51d0d827e5cc3e8728ea2d683d70bdde1 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Thu, 28 Nov 2013 18:21:24 +0400 Subject: [PATCH 61/77] gui/channellist.cpp: fix empty box paint, if no logo found --- src/gui/channellist.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 033b66fdb..1f7114828 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -1763,7 +1763,9 @@ void CChannelList::showChannelLogo() static int logo_w = 0; static int logo_h = 0; int logo_w_max = full_width / 4; - frameBuffer->paintBoxRel(x + full_width - logo_off - logo_w, y+(theight-logo_h)/2, logo_w, logo_h, COL_MENUHEAD_PLUS_0); + + if (logo_w && logo_h) + frameBuffer->paintBoxRel(x + full_width - logo_off - logo_w, y+(theight-logo_h)/2, logo_w, logo_h, COL_MENUHEAD_PLUS_0); std::string lname; if(g_PicViewer->GetLogoName(chanlist[selected]->channel_id, chanlist[selected]->getName(), lname, &logo_w, &logo_h)) { From 4a0749276562450e143d85f06a09bc490fd0b96a Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Thu, 28 Nov 2013 19:09:17 +0400 Subject: [PATCH 62/77] gui/widget/menue.cpp: cleanup unused code --- src/gui/widget/menue.cpp | 52 ---------------------------------------- 1 file changed, 52 deletions(-) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 77d5e0db6..13594279f 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -506,14 +506,7 @@ int CMenuWidget::exec(CMenuTarget* parent, const std::string &) break; pos++; } -#if 0 - GenericMenuBack->setHint("", NONEXISTANT_LOCALE); -#endif checkHints(); -#if 0 - if (has_hints) - GenericMenuBack->setHint(NEUTRINO_ICON_HINT_BACK, LOCALE_MENU_HINT_BACK); -#endif if(savescreen) { calcSize(); @@ -816,11 +809,6 @@ void CMenuWidget::calcSize() int tmpw = items[i]->getWidth() + 10 + 10 + wi; /* 10 pixels to the left and right of the text */ if (tmpw > width) width = tmpw; -#if 0 - if(!items[i]->hintIcon.empty() || items[i]->hint != NONEXISTANT_LOCALE) { - has_hints = true; - } -#endif } hint_height = 0; if(g_settings.show_menu_hints && has_hints) { @@ -1077,27 +1065,6 @@ void CMenuWidget::paintHint(int pos) if (pos < 0 && !hint_painted) return; -#if 0 - if (hint_painted) { - /* clear detailsline line */ - // TODO CComponents::hide with param restore ? or auto (if it have saved screens) ? - if (details_line != NULL) { - if (savescreen) - details_line->restore(); - else - details_line->hide(); - } - /* clear info box */ - if (info_box != NULL) { - if (pos == -1) { - if (savescreen) - info_box->restore(); - else - info_box->hide(); - } - } - hint_painted = false; -#endif if (hint_painted) { /* clear detailsline line */ if (details_line) @@ -1113,18 +1080,8 @@ void CMenuWidget::paintHint(int pos) CMenuItem* item = items[pos]; if (item->hintIcon.empty() && item->hint == NONEXISTANT_LOCALE) { -#if 0 - if (info_box != NULL) { - if (savescreen) -#endif if (info_box) info_box->hide(false); -#if 0 - info_box->restore(); - else - info_box->hide(); - } -#endif return; } @@ -1153,9 +1110,6 @@ void CMenuWidget::paintHint(int pos) details_line->setHMarkDown(markh); details_line->syncSysColors(); } -#if 0 - details_line->paint(savescreen); -#endif //init infobox std::string str = g_Locale->getText(item->hint); @@ -1170,18 +1124,12 @@ void CMenuWidget::paintHint(int pos) info_box->setShadowOnOff(CC_SHADOW_ON); info_box->setPicture(item->hintIcon); } -#if 0 - /* force full paint - menu-over i.e. option chooser with pulldown can overwrite */ - info_box->paint(savescreen, true); -#endif - //paint result details_line->paint(); info_box->paint(); hint_painted = true; - } void CMenuWidget::addKey(neutrino_msg_t key, CMenuTarget *menue, const std::string & action) From 7f318a9d0f3af57fbfd0163906ee3d8f6b4b5239 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Fri, 29 Nov 2013 11:42:01 +0400 Subject: [PATCH 63/77] neutrino.cpp: fix crash if DISABLE_SECTIONSD defined for testing --- src/neutrino.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 18d60fdab..be6e57fe9 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -1943,9 +1943,7 @@ TIMER_START(); dprintf( DEBUG_NORMAL, "registering as event client\n"); -#ifndef DISABLE_SECTIONSD InitSectiondClient(); -#endif InitTimerdClient(); From 8aa819642da345cd7212a756660feacf6b30a6fa Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Fri, 29 Nov 2013 11:46:22 +0400 Subject: [PATCH 64/77] gui/widget/menue.cpp: try to disable 'always save/restore menu hint screens' (again) --- src/gui/widget/menue.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 13594279f..be8e7a9e0 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -1068,10 +1068,10 @@ void CMenuWidget::paintHint(int pos) if (hint_painted) { /* clear detailsline line */ if (details_line) - details_line->hide(); + savescreen ? details_line->hide() : details_line->kill(); /* clear info box */ if ((info_box) && (pos == -1)) - info_box->hide(true); + savescreen ? info_box->hide(true) : info_box->kill(); hint_painted = false; } if (pos < 0) @@ -1126,8 +1126,8 @@ void CMenuWidget::paintHint(int pos) } //paint result - details_line->paint(); - info_box->paint(); + details_line->paint(savescreen); + info_box->paint(savescreen); hint_painted = true; } From dd7c7fc7ae484f1ee750c1ec6370c312f6db1d69 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Fri, 29 Nov 2013 12:18:43 +0400 Subject: [PATCH 65/77] components: cleanup destructors - remove calls to functions, already called inside base classes destructors --- src/gui/components/cc_detailsline.cpp | 2 -- src/gui/components/cc_frm.cpp | 2 -- src/gui/components/cc_frm_clock.cpp | 1 - src/gui/components/cc_frm_header.cpp | 1 - src/gui/components/cc_frm_window.cpp | 1 - src/gui/components/cc_item_infobox.cpp | 10 ---------- src/gui/components/cc_item_text.cpp | 2 -- src/gui/components/cc_item_tvpic.cpp | 2 -- 8 files changed, 21 deletions(-) diff --git a/src/gui/components/cc_detailsline.cpp b/src/gui/components/cc_detailsline.cpp index 8c20ccd9a..8b319ce21 100644 --- a/src/gui/components/cc_detailsline.cpp +++ b/src/gui/components/cc_detailsline.cpp @@ -77,8 +77,6 @@ void CComponentsDetailLine::initVarDline() CComponentsDetailLine::~CComponentsDetailLine() { - hide(); //restore background - clear(); } // y_top (=y) diff --git a/src/gui/components/cc_frm.cpp b/src/gui/components/cc_frm.cpp index 83507f889..02d2c764b 100644 --- a/src/gui/components/cc_frm.cpp +++ b/src/gui/components/cc_frm.cpp @@ -76,8 +76,6 @@ void CComponentsForm::cleanCCForm() #endif clearCCItems(); - clearSavedScreen(); - clear(); } diff --git a/src/gui/components/cc_frm_clock.cpp b/src/gui/components/cc_frm_clock.cpp index 11d983f4c..dc05cece0 100644 --- a/src/gui/components/cc_frm_clock.cpp +++ b/src/gui/components/cc_frm_clock.cpp @@ -87,7 +87,6 @@ void CComponentsFrmClock::initVarClock() CComponentsFrmClock::~CComponentsFrmClock() { - cleanCCForm(); if (activeClock) stopThread(); } diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index 0975ae630..c73da039b 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -126,7 +126,6 @@ CComponentsHeader::~CComponentsHeader() printf("[~CComponentsHeader] [%s - %d] delete...\n", __FUNCTION__, __LINE__); #endif v_cch_btn.clear(); - cleanCCForm(); } void CComponentsHeader::setCaption(const std::string& caption, const int& align_mode) diff --git a/src/gui/components/cc_frm_window.cpp b/src/gui/components/cc_frm_window.cpp index 0be93d647..5fa98de8a 100644 --- a/src/gui/components/cc_frm_window.cpp +++ b/src/gui/components/cc_frm_window.cpp @@ -119,7 +119,6 @@ CComponentsWindow::~CComponentsWindow() #ifdef DEBUG_CC printf("[~CComponentsWindow] [%s - %d] delete...\n", __FUNCTION__, __LINE__); #endif - cleanCCForm(); } void CComponentsWindow::initVarWindow() diff --git a/src/gui/components/cc_item_infobox.cpp b/src/gui/components/cc_item_infobox.cpp index af3027911..77ff00bd5 100644 --- a/src/gui/components/cc_item_infobox.cpp +++ b/src/gui/components/cc_item_infobox.cpp @@ -66,22 +66,12 @@ CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const i CComponentsInfoBox::~CComponentsInfoBox() { -#if 0 // called from base (CComponentsText) dtor - hide(); - clearSavedScreen(); - clearCCText(); - clear(); -#endif delete pic; delete cctext; } void CComponentsInfoBox::initVarInfobox() { - //CComponents, CComponentsItem, CComponentsText -#if 0 // called from base (CComponentsText) ctor - initVarText(); -#endif cc_item_type = CC_ITEMTYPE_TEXT_INFOBOX; //CComponentsInfoBox diff --git a/src/gui/components/cc_item_text.cpp b/src/gui/components/cc_item_text.cpp index 797deae31..4e6db142c 100644 --- a/src/gui/components/cc_item_text.cpp +++ b/src/gui/components/cc_item_text.cpp @@ -78,9 +78,7 @@ CComponentsText::CComponentsText( const int x_pos, const int y_pos, const int w, CComponentsText::~CComponentsText() { hide(); - clearSavedScreen(); clearCCText(); - clear(); } diff --git a/src/gui/components/cc_item_tvpic.cpp b/src/gui/components/cc_item_tvpic.cpp index 388e2821a..19dc1faa0 100644 --- a/src/gui/components/cc_item_tvpic.cpp +++ b/src/gui/components/cc_item_tvpic.cpp @@ -67,8 +67,6 @@ CComponentsPIP::~CComponentsPIP() { hide(); videoDecoder->Pig(-1, -1, -1, -1); - clearSavedScreen(); - clear(); } void CComponentsPIP::paint(bool do_save_bg) From 006429215be968a07c22073d88e24ab537409833 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Fri, 29 Nov 2013 13:04:35 +0400 Subject: [PATCH 66/77] gui/parentallock_setup.cpp: fix non-easy mode, do not add menu security --- src/gui/parentallock_setup.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/gui/parentallock_setup.cpp b/src/gui/parentallock_setup.cpp index fba9290d0..160d88701 100644 --- a/src/gui/parentallock_setup.cpp +++ b/src/gui/parentallock_setup.cpp @@ -108,10 +108,13 @@ int CParentalSetup::showParentalSetup() // intros plock->addIntroItems(); + CMenuForwarder * mf; CPersonalizeGui &p = CNeutrinoApp::getInstance()->getPersonalizeGui(); - CMenuForwarder * mf = new CMenuForwarder(LOCALE_PARENTALLOCK_MENU, true, NULL, &p, NULL, CRCInput::RC_red , NEUTRINO_ICON_BUTTON_RED); - mf->setHint("", LOCALE_MENU_HINT_PARENTALLOCK_MENU); - plock->addItem(mf); + if (g_settings.easymenu) { + mf = new CMenuForwarder(LOCALE_PARENTALLOCK_MENU, true, NULL, &p, NULL, CRCInput::RC_red , NEUTRINO_ICON_BUTTON_RED); + mf->setHint("", LOCALE_MENU_HINT_PARENTALLOCK_MENU); + plock->addItem(mf); + } CMenuOptionChooser * mc; if (g_settings.easymenu) From 98fb57d924b68fb393d57b9ad385ca82bec6e5fe Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Fri, 29 Nov 2013 13:41:44 +0400 Subject: [PATCH 67/77] gui/osd_setup.cpp: fix memleak --- src/gui/osd_setup.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/osd_setup.cpp b/src/gui/osd_setup.cpp index 7d5a0662e..ba8496b62 100644 --- a/src/gui/osd_setup.cpp +++ b/src/gui/osd_setup.cpp @@ -515,7 +515,7 @@ int COsdSetup::showOsdSetup() osd_menu->addItem(mf); //progressbar - mf = new CMenuForwarder(LOCALE_MISCSETTINGS_PROGRESSBAR, true, NULL, new CProgressbarSetup(), NULL, CRCInput::convertDigitToKey(shortcut++)); + mf = new CMenuDForwarder(LOCALE_MISCSETTINGS_PROGRESSBAR, true, NULL, new CProgressbarSetup(), NULL, CRCInput::convertDigitToKey(shortcut++)); mf->setHint("", LOCALE_MENU_HINT_PROGRESSBAR); osd_menu->addItem(mf); From a438c0548bf2298df522630686ea51818a4c8fad Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Fri, 29 Nov 2013 13:42:01 +0400 Subject: [PATCH 68/77] gui/update.cpp: fix memleak --- src/gui/update.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/update.cpp b/src/gui/update.cpp index 36ea1b378..7e496b283 100644 --- a/src/gui/update.cpp +++ b/src/gui/update.cpp @@ -813,7 +813,7 @@ int CFlashExpert::showMTDSelector(const std::string & actionkey) enabled = false; // build jffs2 image from root0 if ((actionkey == "readmtd") && (lx == mtdInfo->findMTDNumberFromName("root0"))) { - CMenuForwarder *mf = new CMenuForwarderNonLocalized("root0", true, NULL, new CFlashExpertSetup(), NULL, CRCInput::convertDigitToKey(shortcut++)); + CMenuForwarder *mf = new CMenuDForwarderNonLocalized("root0", true, NULL, new CFlashExpertSetup(), NULL, CRCInput::convertDigitToKey(shortcut++)); mtdselector->addItem(mf); continue; } From 520b59e64ab2eca893d051c3c5e1e8346e9eec1a Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Fri, 29 Nov 2013 13:42:13 +0400 Subject: [PATCH 69/77] gui/update_menue.cpp: fix memleak --- src/gui/update_menue.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/update_menue.cpp b/src/gui/update_menue.cpp index 73162ae4e..5cfd1830c 100644 --- a/src/gui/update_menue.cpp +++ b/src/gui/update_menue.cpp @@ -118,9 +118,9 @@ int CSoftwareUpdate::showSoftwareUpdate() softUpdate.addItem(GenericMenuSeparatorLine); if (g_settings.easymenu) - mf = new CMenuForwarder(LOCALE_FLASHUPDATE_CREATEIMAGE_MENU, true, NULL, new CFlashExpertSetup(), NULL, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW); + mf = new CMenuDForwarder(LOCALE_FLASHUPDATE_CREATEIMAGE_MENU, true, NULL, new CFlashExpertSetup(), NULL, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW); else - mf = new CMenuForwarder(LOCALE_FLASHUPDATE_CREATEIMAGE_MENU, true, NULL, new CFlashExpertSetup(), NULL, CRCInput::convertDigitToKey(1)); + mf = new CMenuDForwarder(LOCALE_FLASHUPDATE_CREATEIMAGE_MENU, true, NULL, new CFlashExpertSetup(), NULL, CRCInput::convertDigitToKey(1)); mf->setHint("", LOCALE_MENU_HINT_SOFTUPDATE_CREATEIMAGE_MENU); softUpdate.addItem(mf); #endif From ddbc7fd44a20e62c5bed4a0952c7f2a65947613f Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Fri, 29 Nov 2013 14:13:14 +0400 Subject: [PATCH 70/77] gui/mediaplayer.cpp: fix memleak --- src/gui/mediaplayer.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/mediaplayer.cpp b/src/gui/mediaplayer.cpp index fd577a8ab..d1970c75e 100644 --- a/src/gui/mediaplayer.cpp +++ b/src/gui/mediaplayer.cpp @@ -262,6 +262,7 @@ int CMediaPlayerMenu::initMenuMedia(CMenuWidget *m, CPersonalizeGui *p) res = media->exec(NULL, ""); delete media; + delete moviePlayer; delete personalize; delete pictureviewergui; #if ENABLE_UPNP From a99ea61b7f8277dec218846918350fa555385b64 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Fri, 29 Nov 2013 15:32:47 +0400 Subject: [PATCH 71/77] gui/keybind_setup.cpp: fix memleak: in case not all keys from 'enum keynames' added to menu, memory leaked. make sure all keychoosers deleted --- src/gui/keybind_setup.cpp | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/gui/keybind_setup.cpp b/src/gui/keybind_setup.cpp index 5d194f0c7..b9e84a00f 100644 --- a/src/gui/keybind_setup.cpp +++ b/src/gui/keybind_setup.cpp @@ -215,6 +215,9 @@ int CKeybindSetup::showKeySetup() CMenuWidget bindSettings(LOCALE_MAINSETTINGS_HEAD, NEUTRINO_ICON_KEYBINDING, width, MN_WIDGET_ID_KEYSETUP_KEYBINDING); //keybindings + for (int i = 0; i < KEYBINDS_COUNT; i++) + keychooser[i] = new CKeyChooser(key_settings[i].keyvalue_p, key_settings[i].keydescription/*as head caption*/, NEUTRINO_ICON_SETTINGS); + int shortcut = 1; showKeyBindSetup(&bindSettings); CMenuForwarder * mf; @@ -266,6 +269,8 @@ int CKeybindSetup::showKeySetup() } delete keySettings; + for (int i = 0; i < KEYBINDS_COUNT; i++) + delete keychooser[i]; return res; } @@ -278,9 +283,6 @@ void CKeybindSetup::showKeyBindSetup(CMenuWidget *bindSettings) bindSettings->addIntroItems(LOCALE_KEYBINDINGMENU_HEAD); - for (int i = 0; i < KEYBINDS_COUNT; i++) - keychooser[i] = new CKeyChooser(key_settings[i].keyvalue_p, key_settings[i].keydescription/*as head caption*/, NEUTRINO_ICON_SETTINGS); - //modes CMenuWidget* bindSettings_modes = new CMenuWidget(LOCALE_KEYBINDINGMENU_HEAD, NEUTRINO_ICON_KEYBINDING, width, MN_WIDGET_ID_KEYSETUP_KEYBINDING_MODES); showKeyBindModeSetup(bindSettings_modes); @@ -311,7 +313,7 @@ void CKeybindSetup::showKeyBindSetup(CMenuWidget *bindSettings) //misc bindSettings->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_KEYBINDINGMENU_MISC)); - //bindSettings->addItem(new CMenuDForwarder(keydescription[KEY_PLUGIN], true, NULL, keychooser[KEY_PLUGIN])); + //bindSettings->addItem(new CMenuForwarder(keydescription[KEY_PLUGIN], true, NULL, keychooser[KEY_PLUGIN])); //Special keys CMenuWidget* bindSettings_special = new CMenuWidget(LOCALE_KEYBINDINGMENU_HEAD, NEUTRINO_ICON_KEYBINDING, width, MN_WIDGET_ID_KEYSETUP_KEYBINDING_SPECIAL); @@ -321,22 +323,22 @@ void CKeybindSetup::showKeyBindSetup(CMenuWidget *bindSettings) bindSettings->addItem(mf); // unlock - mf = new CMenuDForwarder(key_settings[KEY_UNLOCK].keydescription, true, keychooser[KEY_UNLOCK]->getKeyName(), keychooser[KEY_UNLOCK]); + mf = new CMenuForwarder(key_settings[KEY_UNLOCK].keydescription, true, keychooser[KEY_UNLOCK]->getKeyName(), keychooser[KEY_UNLOCK]); mf->setHint("", key_settings[KEY_UNLOCK].hint); bindSettings->addItem(mf); // screenshot - mf = new CMenuDForwarder(key_settings[KEY_SCREENSHOT].keydescription, true, keychooser[KEY_SCREENSHOT]->getKeyName(), keychooser[KEY_SCREENSHOT]); + mf = new CMenuForwarder(key_settings[KEY_SCREENSHOT].keydescription, true, keychooser[KEY_SCREENSHOT]->getKeyName(), keychooser[KEY_SCREENSHOT]); mf->setHint("", key_settings[KEY_SCREENSHOT].hint); bindSettings->addItem(mf); #ifdef ENABLE_PIP // pip - mf = new CMenuDForwarder(key_settings[KEY_PIP_CLOSE].keydescription, true, keychooser[KEY_PIP_CLOSE]->getKeyName(), keychooser[KEY_PIP_CLOSE]); + mf = new CMenuForwarder(key_settings[KEY_PIP_CLOSE].keydescription, true, keychooser[KEY_PIP_CLOSE]->getKeyName(), keychooser[KEY_PIP_CLOSE]); mf->setHint("", key_settings[KEY_PIP_CLOSE].hint); bindSettings->addItem(mf); - mf = new CMenuDForwarder(key_settings[KEY_PIP_SETUP].keydescription, true, keychooser[KEY_PIP_SETUP]->getKeyName(), keychooser[KEY_PIP_SETUP]); + mf = new CMenuForwarder(key_settings[KEY_PIP_SETUP].keydescription, true, keychooser[KEY_PIP_SETUP]->getKeyName(), keychooser[KEY_PIP_SETUP]); mf->setHint("", key_settings[KEY_PIP_SETUP].hint); bindSettings->addItem(mf); - mf = new CMenuDForwarder(key_settings[KEY_PIP_SWAP].keydescription, true, keychooser[KEY_PIP_SWAP]->getKeyName(), keychooser[KEY_PIP_SWAP]); + mf = new CMenuForwarder(key_settings[KEY_PIP_SWAP].keydescription, true, keychooser[KEY_PIP_SWAP]->getKeyName(), keychooser[KEY_PIP_SWAP]); mf->setHint("", key_settings[KEY_PIP_SWAP].hint); bindSettings->addItem(mf); #endif @@ -364,11 +366,11 @@ void CKeybindSetup::showKeyBindModeSetup(CMenuWidget *bindSettings_modes) bindSettings_modes->addIntroItems(LOCALE_KEYBINDINGMENU_MODECHANGE); // tv/radio - mf = new CMenuDForwarder(key_settings[KEY_TV_RADIO_MODE].keydescription, true, keychooser[KEY_TV_RADIO_MODE]->getKeyName(), keychooser[KEY_TV_RADIO_MODE], NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED); + mf = new CMenuForwarder(key_settings[KEY_TV_RADIO_MODE].keydescription, true, keychooser[KEY_TV_RADIO_MODE]->getKeyName(), keychooser[KEY_TV_RADIO_MODE], NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED); mf->setHint("", key_settings[KEY_TV_RADIO_MODE].hint); bindSettings_modes->addItem(mf); - mf = new CMenuDForwarder(key_settings[KEY_POWER_OFF].keydescription, true, keychooser[KEY_POWER_OFF]->getKeyName(), keychooser[KEY_POWER_OFF], NULL, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN); + mf = new CMenuForwarder(key_settings[KEY_POWER_OFF].keydescription, true, keychooser[KEY_POWER_OFF]->getKeyName(), keychooser[KEY_POWER_OFF], NULL, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN); mf->setHint("", key_settings[KEY_POWER_OFF].hint); bindSettings_modes->addItem(mf); } @@ -381,7 +383,7 @@ void CKeybindSetup::showKeyBindChannellistSetup(CMenuWidget *bindSettings_chlist bindSettings_chlist->addItem(oj); #endif for (int i = KEY_PAGE_UP; i <= KEY_CURRENT_TRANSPONDER; i++) { - CMenuForwarder * mf = new CMenuDForwarder(key_settings[i].keydescription, true, keychooser[i]->getKeyName(), keychooser[i]); + CMenuForwarder * mf = new CMenuForwarder(key_settings[i].keydescription, true, keychooser[i]->getKeyName(), keychooser[i]); mf->setHint("", key_settings[i].hint); bindSettings_chlist->addItem(mf); } @@ -396,7 +398,7 @@ void CKeybindSetup::showKeyBindQuickzapSetup(CMenuWidget *bindSettings_qzap) bindSettings_qzap->addIntroItems(LOCALE_KEYBINDINGMENU_QUICKZAP); for (int i = KEY_CHANNEL_UP; i <= KEY_LASTCHANNEL; i++) { - CMenuForwarder * mf = new CMenuDForwarder(key_settings[i].keydescription, true, keychooser[i]->getKeyName(), keychooser[i]); + CMenuForwarder * mf = new CMenuForwarder(key_settings[i].keydescription, true, keychooser[i]->getKeyName(), keychooser[i]); mf->setHint("", key_settings[i].hint); bindSettings_qzap->addItem(mf); } @@ -407,7 +409,7 @@ void CKeybindSetup::showKeyBindMovieplayerSetup(CMenuWidget *bindSettings_mplaye bindSettings_mplayer->addIntroItems(LOCALE_MAINMENU_MOVIEPLAYER); for (int i = MPKEY_REWIND; i < MPKEY_PLUGIN; i++) { - CMenuForwarder * mf = new CMenuDForwarder(key_settings[i].keydescription, true, keychooser[i]->getKeyName(), keychooser[i]); + CMenuForwarder * mf = new CMenuForwarder(key_settings[i].keydescription, true, keychooser[i]->getKeyName(), keychooser[i]); mf->setHint("", key_settings[i].hint); bindSettings_mplayer->addItem(mf); } From caced88719e0f325d862e6fc7e5c84d9ca6e5dd4 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Fri, 29 Nov 2013 15:33:27 +0400 Subject: [PATCH 72/77] gui/osdlang_setup.cpp: fix memleak --- src/gui/osdlang_setup.cpp | 5 ++++- src/gui/osdlang_setup.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gui/osdlang_setup.cpp b/src/gui/osdlang_setup.cpp index 0266b79dc..d53802637 100644 --- a/src/gui/osdlang_setup.cpp +++ b/src/gui/osdlang_setup.cpp @@ -59,6 +59,7 @@ COsdLangSetup::COsdLangSetup(bool wizard_mode) is_wizard = wizard_mode; width = w_max (45, 10); + tzNotifier = NULL; } COsdLangSetup::~COsdLangSetup() @@ -96,6 +97,7 @@ int COsdLangSetup::showLocalSetup() localSettings->addItem(mf); //timezone setup + tzNotifier = new CTZChangeNotifier(); CMenuOptionStringChooser* tzSelect = getTzItems(); if (tzSelect != NULL) localSettings->addItem(tzSelect); @@ -114,6 +116,7 @@ int COsdLangSetup::showLocalSetup() int res = localSettings->exec(NULL, ""); delete localSettings; delete langNotifier; + delete tzNotifier; return res; } @@ -126,7 +129,7 @@ CMenuOptionStringChooser* COsdLangSetup::getTzItems() CMenuOptionStringChooser* tzSelect = NULL; if (parser != NULL) { - tzSelect = new CMenuOptionStringChooser(LOCALE_MAINSETTINGS_TIMEZONE, g_settings.timezone, true, new CTZChangeNotifier(), CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN, true); + tzSelect = new CMenuOptionStringChooser(LOCALE_MAINSETTINGS_TIMEZONE, g_settings.timezone, true, tzNotifier, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN, true); tzSelect->setHint("", LOCALE_MENU_HINT_TIMEZONE); xmlNodePtr search = xmlDocGetRootElement(parser)->xmlChildrenNode; bool found = false; diff --git a/src/gui/osdlang_setup.h b/src/gui/osdlang_setup.h index 1e181b46b..e99125d76 100644 --- a/src/gui/osdlang_setup.h +++ b/src/gui/osdlang_setup.h @@ -54,6 +54,7 @@ class COsdLangSetup : public CMenuTarget, CChangeObserver int width; bool is_wizard; + CTZChangeNotifier * tzNotifier; int showLocalSetup(); void showPrefMenu(CMenuWidget *prefMenu, CLangSelectNotifier *langNotifier); From c88ad39c67e961001a84d84ab5a9fec623851aff Mon Sep 17 00:00:00 2001 From: martii Date: Fri, 29 Nov 2013 17:16:22 +0100 Subject: [PATCH 73/77] gui/components/cc_frm_clock: fix label widths for non-standard fonts --- src/gui/components/cc_frm_clock.cpp | 31 +++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/src/gui/components/cc_frm_clock.cpp b/src/gui/components/cc_frm_clock.cpp index dc05cece0..cfe2d1363 100644 --- a/src/gui/components/cc_frm_clock.cpp +++ b/src/gui/components/cc_frm_clock.cpp @@ -151,7 +151,21 @@ void CComponentsFrmClock::initCCLockItems() } } - //modifie available lable items with current segment chars + int minNumWidth = 0, w_tmp; + char b[2]; + b[1] = 0; + for (int i = 0; i < 10; i++) { + b[0] = '0' + i; + w_tmp = (*getClockFont())->getRenderWidth(b, true); + if (w_tmp > minNumWidth) + minNumWidth = w_tmp; + } + int minSepWidth = (*getClockFont())->getRenderWidth(":", true); + w_tmp = (*getClockFont())->getRenderWidth(".", true); + if (w_tmp > minSepWidth) + minSepWidth = w_tmp; + + //modify available label items with current segment chars for (size_t i = 0; i < v_cc_items.size(); i++) { //v_cc_items are only available as CComponent-items here, so we must cast them before @@ -171,7 +185,20 @@ void CComponentsFrmClock::initCCLockItems() string stmp = s_time.substr(i, 1); //get width of current segment - int wtmp = (*getClockFont())->getRenderWidth(stmp, true); + int wtmp; + char c = stmp.at(0); + switch (c) { + case '0' ... '9': + wtmp = minNumWidth; + break; + case '.': + case ':': + wtmp = minSepWidth; + break; + default: + b[0] = c; + wtmp = (*getClockFont())->getRenderWidth(stmp, true); + } //set size, text, color of current item lbl->setDimensionsAll(cl_x, cl_y, wtmp, cl_h); From 15b2b2ec050f23dc09c93c34c389ccba013b118b Mon Sep 17 00:00:00 2001 From: martii Date: Fri, 29 Nov 2013 21:06:36 +0100 Subject: [PATCH 74/77] remove widest_number definition and usage, add Font::getMaxDigitWidth() method instead Signed-off-by: M. Liebmann --- src/driver/fontrenderer.cpp | 17 +++++++++++ src/driver/fontrenderer.h | 2 ++ src/gui/channellist.cpp | 2 +- src/gui/components/cc_frm_clock.cpp | 13 ++------- .../components/unmaintained/cc_item_box.cpp | 2 +- src/gui/infoviewer.cpp | 2 +- src/gui/timeosd.cpp | 2 +- src/gui/volumebar.cpp | 2 +- src/gui/widget/menue.cpp | 28 ++++++++++++++----- src/neutrino.h | 2 -- 10 files changed, 47 insertions(+), 25 deletions(-) diff --git a/src/driver/fontrenderer.cpp b/src/driver/fontrenderer.cpp index 61cd4c2a3..d7bc09fb3 100644 --- a/src/driver/fontrenderer.cpp +++ b/src/driver/fontrenderer.cpp @@ -230,6 +230,8 @@ Font::Font(FBFontRenderClass *render, FTC_FaceID faceid, const int isize, const //font.image_type |= ftc_image_flag_autohinted; font.flags = FT_LOAD_RENDER | FT_LOAD_FORCE_AUTOHINT; + maxdigitwidth = 0; + scaler.face_id = font.face_id; scaler.width = isize * 64; scaler.height = isize * 64; @@ -318,6 +320,21 @@ int Font::getDigitOffset(void) return DigitOffset; } +int Font::getMaxDigitWidth(void) +{ + if (maxdigitwidth < 1) { + char b[2]; + b[1] = 0; + for (char c = '0'; c <= '9'; c++) { + *b = c; + int w = getRenderWidth(b, true); + if (w > maxdigitwidth) + maxdigitwidth = w; + } + } + return maxdigitwidth; +} + int UTF8ToUnicode(const char * &text, const bool utf8_encoded) // returns -1 on error { int unicode_value; diff --git a/src/driver/fontrenderer.h b/src/driver/fontrenderer.h index 124de9632..fa1f97ae1 100644 --- a/src/driver/fontrenderer.h +++ b/src/driver/fontrenderer.h @@ -53,6 +53,7 @@ class Font // these are HACKED values, because the font metrics were unusable. int height,DigitHeight,DigitOffset,ascender,descender,upper,lower; int fontwidth; + int maxdigitwidth; inline void paintFontPixel(fb_pixel_t *td, uint8_t fg_trans, uint8_t fg_red, uint8_t fg_green, uint8_t fg_blue, fb_pixel_t bg_col, int faktor, uint8_t index); @@ -71,6 +72,7 @@ class Font int getRenderWidth(const std::string & text, const bool utf8_encoded = false); int getHeight(void); int getDigitHeight(void); + int getMaxDigitWidth(void); int getDigitOffset(void); int getWidth(void); int getSize(){return font.width;} diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 1f7114828..d09087cd6 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -1376,7 +1376,7 @@ int CChannelList::numericZap(int key) return res; } size_t maxchansize = MaxChanNr().size(); - int fw = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNEL_NUM_ZAP]->getRenderWidth(widest_number); + int fw = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNEL_NUM_ZAP]->getMaxDigitWidth(); int sx = maxchansize * fw + (fw/2); int sy = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNEL_NUM_ZAP]->getHeight() + 6; diff --git a/src/gui/components/cc_frm_clock.cpp b/src/gui/components/cc_frm_clock.cpp index cfe2d1363..5ffa37582 100644 --- a/src/gui/components/cc_frm_clock.cpp +++ b/src/gui/components/cc_frm_clock.cpp @@ -151,15 +151,7 @@ void CComponentsFrmClock::initCCLockItems() } } - int minNumWidth = 0, w_tmp; - char b[2]; - b[1] = 0; - for (int i = 0; i < 10; i++) { - b[0] = '0' + i; - w_tmp = (*getClockFont())->getRenderWidth(b, true); - if (w_tmp > minNumWidth) - minNumWidth = w_tmp; - } + int w_tmp; int minSepWidth = (*getClockFont())->getRenderWidth(":", true); w_tmp = (*getClockFont())->getRenderWidth(".", true); if (w_tmp > minSepWidth) @@ -189,14 +181,13 @@ void CComponentsFrmClock::initCCLockItems() char c = stmp.at(0); switch (c) { case '0' ... '9': - wtmp = minNumWidth; + wtmp = (*getClockFont())->getMaxDigitWidth(); break; case '.': case ':': wtmp = minSepWidth; break; default: - b[0] = c; wtmp = (*getClockFont())->getRenderWidth(stmp, true); } diff --git a/src/gui/components/unmaintained/cc_item_box.cpp b/src/gui/components/unmaintained/cc_item_box.cpp index 29140ebc2..4a2175dc7 100644 --- a/src/gui/components/unmaintained/cc_item_box.cpp +++ b/src/gui/components/unmaintained/cc_item_box.cpp @@ -356,7 +356,7 @@ void CComponentsItemBox::calSizeOfElements() digit_h = font_text->getDigitHeight(); digit_offset = font_text->getDigitOffset(); v_element_data[i].height = digit_h + (int)((float)digit_offset*1.5); -// v_element_data[i].width = font_text->getRenderWidth(widest_number)*4 + font->getRenderWidth(":"); +// v_element_data[i].width = font_text->getMaxDigitWidth() + font->getRenderWidth(":"); v_element_data[i].width = font_text->getRenderWidth(timestr); v_element_data[i].element = timestr; } diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index 20eff23cf..4517a8e0b 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -194,7 +194,7 @@ void CInfoViewer::start () if ( g_settings.infobar_show_channellogo != 3 && g_settings.infobar_show_channellogo != 5 && g_settings.infobar_show_channellogo != 6) /* 3 & 5 & 6 is "default" with sigscales etc. */ { - ChanWidth = 4 * g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_NUMBER]->getRenderWidth(widest_number) + 10; + ChanWidth = 4 * g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_NUMBER]->getMaxDigitWidth() + 10; ChanHeight = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_NUMBER]->getHeight() * 9 / 8; } else diff --git a/src/gui/timeosd.cpp b/src/gui/timeosd.cpp index dedbfc780..c7ea16720 100644 --- a/src/gui/timeosd.cpp +++ b/src/gui/timeosd.cpp @@ -74,7 +74,7 @@ void CTimeOSD::GetDimensions() m_height = 10; m_y = frameBuffer->getScreenY(); m_width = g_Font[TIMEOSD_FONT]->getRenderWidth("00:00:00"); - t1 = g_Font[TIMEOSD_FONT]->getRenderWidth(widest_number); + t1 = g_Font[TIMEOSD_FONT]->getMaxDigitWidth(); m_width += t1; } diff --git a/src/gui/volumebar.cpp b/src/gui/volumebar.cpp index 8578541b0..1a264f139 100644 --- a/src/gui/volumebar.cpp +++ b/src/gui/volumebar.cpp @@ -295,7 +295,7 @@ void CVolumeHelper::initInfoClock(Font** font) } digit_offset = (*clock_font)->getDigitOffset(); digit_h = (*clock_font)->getDigitHeight(); - int t1 = (*clock_font)->getRenderWidth(widest_number); + int t1 = (*clock_font)->getMaxDigitWidth(); int t2 = (*clock_font)->getRenderWidth(":"); clock_dy = digit_h + (int)((float)digit_offset * 1.3); clock_dx = t1*7 + t2*2; diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index be8e7a9e0..0c991e369 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -1213,15 +1213,29 @@ int CMenuOptionNumberChooser::getWidth(void) const char * l_optionName = (optionString != NULL) ? optionString : g_Locale->getText(optionName); int width = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(l_optionName, true); - char tmp[20], *t; + int _lower_bound = lower_bound; + int _upper_bound = upper_bound; + int m = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getMaxDigitWidth(); - snprintf(tmp, sizeof(tmp), "%d", lower_bound); - for(t = tmp; *t; t++) if (isdigit((int)*t)) *t = *widest_number; - int w1 = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(tmp, true); + int w1 = 0; + if (_lower_bound < 0) { + w1 += g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth("-", true); + lower_bound *= -1; + } + while (_lower_bound > 0) { + w1 += m; + _lower_bound /= 10; + } - snprintf(tmp, sizeof(tmp), "%d", upper_bound); - for(t = tmp; *t; t++) if (isdigit((int)*t)) *t = *widest_number; - int w2 = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(tmp, true); + int w2 = 0; + if (_upper_bound < 0) { + w2 += g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth("-", true); + _upper_bound *= -1; + } + while (_upper_bound > 0) { + w1 += m; + _upper_bound /= 10; + } width += (w1 > w2) ? w1 : w2; diff --git a/src/neutrino.h b/src/neutrino.h index 734405e9b..9bbe88c7f 100644 --- a/src/neutrino.h +++ b/src/neutrino.h @@ -49,8 +49,6 @@ #include -#define widest_number "2" - #define ANNOUNCETIME (1 * 60) /************************************************************************************** From 4355c873cc91ef6b2cb9b938f3c53b61ee9a5af8 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 29 Nov 2013 21:09:50 +0100 Subject: [PATCH 75/77] CInfoClock: ensure use of current theme colors If user has changed colors or theme, new color settings must be applied, otherwise settings have no effect. --- src/gui/infoclock.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/infoclock.cpp b/src/gui/infoclock.cpp index e7d3d5aee..e7d690546 100644 --- a/src/gui/infoclock.cpp +++ b/src/gui/infoclock.cpp @@ -61,6 +61,10 @@ void CInfoClock::Init() oldSize = g_settings.infoClockFontSize; setClockFontSize(g_settings.infoClockFontSize); } + + //use current theme colors + syncSysColors(); + int x_old = x, y_old = y, width_old = width, height_old = height; CVolumeHelper::getInstance()->refresh(cl_font); CVolumeHelper::getInstance()->getInfoClockDimensions(&x, &y, &width, &height); From dff2733bc2770c7197bf1625532059ddbdb8f6e0 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 30 Nov 2013 00:41:45 +0100 Subject: [PATCH 76/77] CSignalBar/CSignalNoiseRatioBar: reduce code, clean ups Some var inits can be reduced, because of inheritance. --- src/gui/components/cc_frm_signalbars.cpp | 35 ++---------------------- src/gui/components/cc_frm_signalbars.h | 16 ++++------- 2 files changed, 9 insertions(+), 42 deletions(-) diff --git a/src/gui/components/cc_frm_signalbars.cpp b/src/gui/components/cc_frm_signalbars.cpp index 2f6bf0ce0..a7f94baec 100644 --- a/src/gui/components/cc_frm_signalbars.cpp +++ b/src/gui/components/cc_frm_signalbars.cpp @@ -39,10 +39,11 @@ using namespace std; CSignalBar::CSignalBar() { initVarSigBar(); + sb_name = "SIG"; initSBItems(); } -CSignalBar::CSignalBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref) +CSignalBar::CSignalBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref, const string& sbname) { initVarSigBar(); sb_frontend = frontend_ref; @@ -50,6 +51,7 @@ CSignalBar::CSignalBar(const int& xpos, const int& ypos, const int& w, const int y = ypos; width = w; height = h; + sb_name = sbname; initSBItems(); } @@ -115,7 +117,6 @@ void CSignalBar::initVarSigBar() sb_scale = NULL; sb_vlbl = NULL; sb_lbl = NULL; - sb_name = "SIG"; } void CSignalBar::initSBarScale() @@ -245,36 +246,6 @@ void CSignalBar::paint(bool do_save_bg) //******************************************************************************************************************************* -CSignalNoiseRatioBar::CSignalNoiseRatioBar() -{ - initVarSnrBar(); -#if 0 // called from base (CSignalBar) ctor - initSBItems(); -#endif -} - -CSignalNoiseRatioBar::CSignalNoiseRatioBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref) -{ - initVarSnrBar(); - sb_frontend = frontend_ref; - x = xpos; - y = ypos; - width = w; - height = h; - -#if 0 // called from base (CSignalBar) ctor - initSBItems(); -#endif -} - -void CSignalNoiseRatioBar::initVarSnrBar() -{ -#if 0 // called from base (CSignalBar) ctor - initVarSigBar(); -#endif - sb_name = "SNR"; -} - void CSignalNoiseRatioBar::Refresh() { //get current value from frontend diff --git a/src/gui/components/cc_frm_signalbars.h b/src/gui/components/cc_frm_signalbars.h index a5730e785..3945cdbb8 100644 --- a/src/gui/components/cc_frm_signalbars.h +++ b/src/gui/components/cc_frm_signalbars.h @@ -31,8 +31,7 @@ #include #endif -// #include -// #include + #include #include #include @@ -116,7 +115,7 @@ class CSignalBar : public CComponentsForm public: CSignalBar(); ///basic component class constructor for signal. - CSignalBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref); + CSignalBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref, const std::string& sb_name = "SIG"); ///assigns the current used frontend, simplified a tuner object, see frontend_c.h virtual void setFrontEnd(CFrontend *frontend_ref){sb_frontend = frontend_ref;}; @@ -155,14 +154,11 @@ class CSignalNoiseRatioBar : public CSignalBar ///refresh current item properties, use this before paintScale(). void Refresh(); - protected: - ///initialize all needed basic attributes and objects - void initVarSnrBar(); - public: - CSignalNoiseRatioBar(); + CSignalNoiseRatioBar(){}; ///basic component class constructor for signal noise ratio. - CSignalNoiseRatioBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref); + CSignalNoiseRatioBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref) + : CSignalBar(xpos, ypos, w, h, frontend_ref, "SNR"){}; }; /// Class CSignalBox() provides CSignalBar(), CSignalNoiseRatioBar() scales at once. @@ -172,7 +168,7 @@ additional of CSignalBar()- and CSignalNoiseRatioBar()-objects. To add a signalbox object to your code add this to a header file: -#include +#include class CSampleClass { From bf8ec4d89ee58eaed96dacff0b45de991834ce11 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 30 Nov 2013 18:26:47 +0100 Subject: [PATCH 77/77] Revert "Revert "global.h: Use forward-declarations to reduce number of dependencies"" This reverts commit 3c8d47fa49b6a45e1606c015fd193af7b5d9b8b9. No Idea why this was reverted, so revert again :-) --- src/driver/rcinput.cpp | 1 + src/driver/record.cpp | 1 + src/global.h | 43 ++++++++++------------------------ src/gui/channellist.cpp | 4 +++- src/gui/epgplus.cpp | 1 + src/gui/epgview.cpp | 1 + src/gui/eventlist.cpp | 1 + src/gui/infoviewer.cpp | 1 + src/gui/movieplayer.cpp | 4 ++++ src/gui/osd_setup.cpp | 1 + src/gui/screensetup.cpp | 1 + src/gui/sleeptimer.cpp | 1 + src/gui/start_wizard.cpp | 1 + src/gui/timerlist.cpp | 1 + src/gui/user_menue.cpp | 3 +++ src/neutrino.cpp | 1 + src/neutrino_menue.cpp | 1 + src/system/fsmounter.cpp | 1 + src/system/httptool.cpp | 3 +-- src/system/setting_helpers.cpp | 1 + 20 files changed, 39 insertions(+), 33 deletions(-) diff --git a/src/driver/rcinput.cpp b/src/driver/rcinput.cpp index a961282bc..aa98e6c4c 100644 --- a/src/driver/rcinput.cpp +++ b/src/driver/rcinput.cpp @@ -53,6 +53,7 @@ #include #include #include +#include #include //#define RCDEBUG diff --git a/src/driver/record.cpp b/src/driver/record.cpp index c10d2e924..9984e143e 100644 --- a/src/driver/record.cpp +++ b/src/driver/record.cpp @@ -51,6 +51,7 @@ #include +#include #include #include #include diff --git a/src/global.h b/src/global.h index 73322e913..c05a44822 100644 --- a/src/global.h +++ b/src/global.h @@ -6,14 +6,6 @@ Copyright (C) 2001 Steffen Hehn 'McClean' Homepage: http://dbox.cyberphoria.org/ - Kommentar: - - Diese GUI wurde von Grund auf neu programmiert und sollte nun vom - Aufbau und auch den Ausbaumoeglichkeiten gut aussehen. Neutrino basiert - auf der Client-Server Idee, diese GUI ist also von der direkten DBox- - Steuerung getrennt. Diese wird dann von Daemons uebernommen. - - License: GPL This program is free software; you can redistribute it and/or modify @@ -31,30 +23,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#include -#include - -#include -#include -#include -#if HAVE_COOL_HARDWARE -#include -#endif -#if HAVE_TRIPLEDRAGON -#include -#define CVFD CLCD -#endif - -#include #include -#include -#include -#include -#include - - #ifndef NEUTRINO_CPP #define NEUTRINO_CPP extern #endif @@ -80,26 +50,39 @@ NEUTRINO_CPP SNeutrinoSettings g_settings; NEUTRINO_CPP SglobalInfo g_info; #ifdef HAVE_CONTROLD +class CControldClient; NEUTRINO_CPP CControldClient *g_Controld; #endif +class CZapitClient; NEUTRINO_CPP CZapitClient *g_Zapit; +class CSectionsdClient; NEUTRINO_CPP CSectionsdClient *g_Sectionsd; +class CTimerdClient; NEUTRINO_CPP CTimerdClient *g_Timerd; +class FBFontRenderClass; NEUTRINO_CPP FBFontRenderClass *g_fontRenderer; NEUTRINO_CPP FBFontRenderClass *g_dynFontRenderer; +class Font; NEUTRINO_CPP Font * g_Font[SNeutrinoSettings::FONT_TYPE_COUNT]; NEUTRINO_CPP Font * g_SignalFont; +class CRCInput; NEUTRINO_CPP CRCInput *g_RCInput; +class CEpgData; NEUTRINO_CPP CEpgData *g_EpgData; +class CInfoViewer; NEUTRINO_CPP CInfoViewer *g_InfoViewer; +class CNeutrinoEventList; NEUTRINO_CPP CNeutrinoEventList *g_EventList; +class CLocaleManager; NEUTRINO_CPP CLocaleManager *g_Locale; +class CVideoSettings; NEUTRINO_CPP CVideoSettings *g_videoSettings; +class CRadioText; NEUTRINO_CPP CRadioText *g_Radiotext; #ifndef DISABLE_GUI_MOUNT diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index d09087cd6..ab7a55848 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -46,8 +46,10 @@ #include #include #include - +#include + #include +#include #include #include #include diff --git a/src/gui/epgplus.cpp b/src/gui/epgplus.cpp index 3ee640c51..2988692e2 100644 --- a/src/gui/epgplus.cpp +++ b/src/gui/epgplus.cpp @@ -31,6 +31,7 @@ #include #include +#include #include #include diff --git a/src/gui/epgview.cpp b/src/gui/epgview.cpp index 747633e61..1a9142f8d 100644 --- a/src/gui/epgview.cpp +++ b/src/gui/epgview.cpp @@ -27,6 +27,7 @@ #include #include +#include #include #include diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index a3fe5307f..fae12449d 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index 4517a8e0b..10a6dc858 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -62,6 +62,7 @@ #include #include #include +#include #include #include diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index bc628a07e..1d8dd425d 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -32,12 +32,16 @@ #include #include +#include +#include +#include #include #include #include #include #include #include +#include #include #include #include diff --git a/src/gui/osd_setup.cpp b/src/gui/osd_setup.cpp index ba8496b62..6c2f95d6c 100644 --- a/src/gui/osd_setup.cpp +++ b/src/gui/osd_setup.cpp @@ -56,6 +56,7 @@ #include #include #include +#include #include #include diff --git a/src/gui/screensetup.cpp b/src/gui/screensetup.cpp index b1662e478..4109a3d9b 100644 --- a/src/gui/screensetup.cpp +++ b/src/gui/screensetup.cpp @@ -36,6 +36,7 @@ #include #include +#include #include #include diff --git a/src/gui/sleeptimer.cpp b/src/gui/sleeptimer.cpp index 02c847b78..936355f3c 100644 --- a/src/gui/sleeptimer.cpp +++ b/src/gui/sleeptimer.cpp @@ -27,6 +27,7 @@ #endif #include +#include #include diff --git a/src/gui/start_wizard.cpp b/src/gui/start_wizard.cpp index 827781abf..676cfd182 100644 --- a/src/gui/start_wizard.cpp +++ b/src/gui/start_wizard.cpp @@ -46,6 +46,7 @@ #include "osd_setup.h" #include "osdlang_setup.h" #include "scan_setup.h" +#include "videosettings.h" #include #include diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index 0aeeaed11..ab5dbd095 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -48,6 +48,7 @@ #include #include +#include #include #include #include diff --git a/src/gui/user_menue.cpp b/src/gui/user_menue.cpp index 123066d18..e7859b8d8 100644 --- a/src/gui/user_menue.cpp +++ b/src/gui/user_menue.cpp @@ -48,6 +48,8 @@ #include "audio_select.h" #include "streaminfo2.h" #include "epgplus.h" +#include "epgview.h" +#include "eventlist.h" #include "movieplayer.h" #include "timerlist.h" #include "plugins.h" @@ -62,6 +64,7 @@ #include +#include #include #include diff --git a/src/neutrino.cpp b/src/neutrino.cpp index be6e57fe9..63f69f879 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -58,6 +58,7 @@ #include #include #include +#include #include #include "gui/audiomute.h" diff --git a/src/neutrino_menue.cpp b/src/neutrino_menue.cpp index 72c476b93..327efc425 100644 --- a/src/neutrino_menue.cpp +++ b/src/neutrino_menue.cpp @@ -76,6 +76,7 @@ #endif #include "gui/update.h" #include "gui/vfd_setup.h" +#include "gui/videosettings.h" #include "driver/record.h" diff --git a/src/system/fsmounter.cpp b/src/system/fsmounter.cpp index a6bfb93b3..d8d384220 100644 --- a/src/system/fsmounter.cpp +++ b/src/system/fsmounter.cpp @@ -36,6 +36,7 @@ #include #include +#include #include #include diff --git a/src/system/httptool.cpp b/src/system/httptool.cpp index 20bd5fba7..c23cd0a08 100644 --- a/src/system/httptool.cpp +++ b/src/system/httptool.cpp @@ -18,7 +18,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA */ - +#include #include #include @@ -30,7 +30,6 @@ #include - CHTTPTool::CHTTPTool() { statusViewer = NULL; diff --git a/src/system/setting_helpers.cpp b/src/system/setting_helpers.cpp index b2ca12c00..b01c3226e 100644 --- a/src/system/setting_helpers.cpp +++ b/src/system/setting_helpers.cpp @@ -53,6 +53,7 @@ #include #include #include +#include #include #include // obsolete #include