From 4e013de774c48cf15199e96feb433d7b3fae3d1c Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Mon, 6 Mar 2017 15:50:06 +0100 Subject: [PATCH 1/4] subpagetable is unsigned Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/e10cb00613898eb4a67fae3166fec019876c86e4 Author: Jacek Jendrzej Date: 2017-03-06 (Mon, 06 Mar 2017) Origin message was: ------------------ subpagetable is unsigned ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- lib/libtuxtxt/tuxtxt.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libtuxtxt/tuxtxt.cpp b/lib/libtuxtxt/tuxtxt.cpp index d83df3251..5eae7e587 100644 --- a/lib/libtuxtxt/tuxtxt.cpp +++ b/lib/libtuxtxt/tuxtxt.cpp @@ -5234,7 +5234,7 @@ void RenderPage() { page_atrb[32].fg = yellow; page_atrb[32].bg = menu1; - int showpage = tuxtxt_cache.page_receiving; + int showpage = tuxtxt_cache.page_receiving < 0 ? 0 : tuxtxt_cache.page_receiving; int showsubpage = tuxtxt_cache.subpagetable[showpage]; if (showsubpage!=0xff) { From 8b8723a29779c35112ae1bebc63d12451a1155b4 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 6 Mar 2017 21:25:36 +0100 Subject: [PATCH 2/4] CMovieBrowser: remove wrong progress value Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/26a0f319231bf1bb0865e283ceb1fb35b5df6b1a Author: Thilo Graf Date: 2017-03-06 (Mon, 06 Mar 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/moviebrowser/mb.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/moviebrowser/mb.cpp b/src/gui/moviebrowser/mb.cpp index 724048fa9..d6c29d8c4 100644 --- a/src/gui/moviebrowser/mb.cpp +++ b/src/gui/moviebrowser/mb.cpp @@ -2766,7 +2766,7 @@ void CMovieBrowser::loadAllTsFileNamesFromStorage(void) for (i=0; i < size;i++) { if (*m_dir[i].used == true){ - OnLoadDir(i+1, size, m_dir[i].name); + OnLoadDir(i, size, m_dir[i].name); loadTsFileNamesFromDir(m_dir[i].name); } } From 562dbec77cc6bd0b285f1f1d75ff3ebd43a7d01f Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 6 Mar 2017 21:25:36 +0100 Subject: [PATCH 3/4] CProgressWindow/CProgressSignals: add prepared signals Required for inhertance of signals used with CProgressWindow. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/7f511ebd1a394aa1650fcefa81423dc6c679099d Author: Thilo Graf Date: 2017-03-06 (Mon, 06 Mar 2017) ------------------ This commit was generated by Migit --- src/gui/widget/progresswindow.h | 76 ++++++++++++++++++++++++++++++--- 1 file changed, 71 insertions(+), 5 deletions(-) diff --git a/src/gui/widget/progresswindow.h b/src/gui/widget/progresswindow.h index e94d08755..4943fb0e2 100644 --- a/src/gui/widget/progresswindow.h +++ b/src/gui/widget/progresswindow.h @@ -89,10 +89,10 @@ class CProgressWindow : public CComponentsWindow, public CMenuTarget * status.hide(); * } * - * //That's it. Until now these steps are a classical way inside neutrino, but you can use proress window with signals too. - * //Working with signals have the advantage that the implementation could be more compactly, because - * //complex constructions within the classes are usually unnecessary, - * //beacuse of the signals can be installed where they directly take the required values. See next example: + * //That's it. Until now these steps are a classical way inside neutrino, but you can use proress window with signals too. + * //Working with signals have the advantage that the implementation could be more compactly, because + * //complex constructions within the classes are usually unnecessary, + * //beacuse of the signals can be installed where they directly catching the required values. See next example: * * class CFooClass * { @@ -101,6 +101,7 @@ class CProgressWindow : public CComponentsWindow, public CMenuTarget * private: * //other members... * sigc::signal OnProgress; + * void DoCount(); * //other members... * public: * //other members... @@ -132,8 +133,53 @@ class CProgressWindow : public CComponentsWindow, public CMenuTarget * //finally remove window from screen * progress.hide(); * } + * + * //Another and a recommended way to implement signals is to inherit prepared signals with + * //class CProgressSignals. This class contains prepared signals for implemantation and disconnetion of slots + * //is performed automatically. + * //See next example: + * class CFooClass : public CProgressSignals + * { + * private: + * //other members... + * void DoCount(); + * //other members... + * public: + * //other members... + * void DoAnything(); + * //other members... + * }; + * + * //add the OnGlobalProgress and OnLocalProgress signals into a counter methode + * void CFooClass::DoCount();{ + * size_t max = 10; + * for (size_t i = 0; i < max; i++){ + * OnGlobalProgress(i, max, "Test"); //visualize global progress + * for (size_t j = 0; j < max; j++){ + * OnLocalProgress(ij, max, "Test"); // visualize local progress + * } + * } + * } + * + * void CFooClass::DoAnything{ + * //inside of methode which calls the progress define a CProgressWindow object and the counter method: + * //...any code + * CProgressWindow progress(NULL, 500, 150, NULL, &OnLocalProgress, &OnGlobalProgress); + * progress.paint(); // paint window + * + * //... + * + * void DoCount(); + * + * //... + * + * //finally remove window from screen + * progress.hide(); + * } + * * @note - * Don't use status_Signal at same time with localSignal and globalSignal. In This case please set status_Signal = NULL + * Don't use status_Signal at same time with localSignal and globalSignal. \n + * In This case please set prameter 'status_Signal' = NULL */ CProgressWindow(CComponentsForm *parent = NULL, const int &dx = PW_MIN_WIDTH, @@ -241,5 +287,25 @@ class CProgressWindow : public CComponentsWindow, public CMenuTarget void paint(bool do_save_bg = true); }; +class CProgressSignals : public sigc::trackable +{ + public: + /**CProgressSignals Constructor: + * Additional class for inherited signal implemantations into classes with used CProgressWindow instances. + */ + CProgressSignals() + { + //obligatory init of signals. Not really required but just to be safe. + OnProgress.clear(); + OnLocalProgress.clear(); + OnGlobalProgress.clear(); + }; + + /** + * For general usage for implementations of signals for classes which are using CProgressBar() window instances based on inheritance. + * @see Take a look into examples to find in progressbar.h + */ + sigc::signal OnProgress, OnLocalProgress, OnGlobalProgress; +}; #endif From a41f318adc49ac23742e7dcbe7ea7fc7c9e3b3ec Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 6 Mar 2017 21:25:36 +0100 Subject: [PATCH 4/4] CMovieBrowser/cYTFeedParser: implement signals from CProgressSignals Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/8c6a47ee3a8047cd2f1c7ba6635ae3923d1ef127 Author: Thilo Graf Date: 2017-03-06 (Mon, 06 Mar 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/moviebrowser/mb.cpp | 6 +++--- src/gui/moviebrowser/mb.h | 5 ++--- src/system/ytparser.cpp | 2 +- src/system/ytparser.h | 5 ++--- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/gui/moviebrowser/mb.cpp b/src/gui/moviebrowser/mb.cpp index d6c29d8c4..2e3c0780f 100644 --- a/src/gui/moviebrowser/mb.cpp +++ b/src/gui/moviebrowser/mb.cpp @@ -2766,7 +2766,7 @@ void CMovieBrowser::loadAllTsFileNamesFromStorage(void) for (i=0; i < size;i++) { if (*m_dir[i].used == true){ - OnLoadDir(i, size, m_dir[i].name); + OnGlobalProgress(i, size, m_dir[i].name); loadTsFileNamesFromDir(m_dir[i].name); } } @@ -2887,7 +2887,7 @@ bool CMovieBrowser::loadTsFileNamesFromDir(const std::string & dirname) } else { result |= addFile(flist[i], dirItNr); } - OnLoadFile(i, flist.size(), dirname ); + OnLocalProgress(i, flist.size(), dirname ); } //result = true; } @@ -3126,7 +3126,7 @@ void CMovieBrowser::loadMovies(bool doRefresh) { TRACE("[mb] loadMovies: \n"); - CProgressWindow loadBox((show_mode == MB_SHOW_YT) ? LOCALE_MOVIEPLAYER_YTPLAYBACK : LOCALE_MOVIEBROWSER_SCAN_FOR_MOVIES, CCW_PERCENT 50, CCW_PERCENT 10, NULL, show_mode == MB_SHOW_YT ? &ytparser.OnLoadVideoInfo : &OnLoadFile, &OnLoadDir); + CProgressWindow loadBox((show_mode == MB_SHOW_YT) ? LOCALE_MOVIEPLAYER_YTPLAYBACK : LOCALE_MOVIEBROWSER_SCAN_FOR_MOVIES, CCW_PERCENT 50, CCW_PERCENT 10, NULL, show_mode == MB_SHOW_YT ? &ytparser.OnProgress : &OnLocalProgress, &OnGlobalProgress); loadBox.enableShadow(); loadBox.paint(); diff --git a/src/gui/moviebrowser/mb.h b/src/gui/moviebrowser/mb.h index 0b37d4c2e..762fba5c6 100644 --- a/src/gui/moviebrowser/mb.h +++ b/src/gui/moviebrowser/mb.h @@ -57,6 +57,7 @@ #include #include #include +#include #define MAX_NUMBER_OF_BOOKMARK_ITEMS MI_MOVIE_BOOK_USER_MAX // we just use the same size as used in Movie info (MAX_NUMBER_OF_BOOKMARK_ITEMS is used for the number of menu items) #define MOVIEBROWSER_SETTINGS_FILE CONFIGDIR "/moviebrowser.conf" @@ -133,7 +134,7 @@ class CYTCacheSelectorTarget : public CMenuTarget }; // Priorities for Developmemt: P1: critical feature, P2: important feature, P3: for next release, P4: looks nice, lets see -class CMovieBrowser : public CMenuTarget +class CMovieBrowser : public CMenuTarget, public CProgressSignals { friend class CYTCacheSelectorTarget; @@ -362,8 +363,6 @@ class CMovieBrowser : public CMenuTarget void clearSelection(); bool supportedExtension(CFile &file); bool addFile(CFile &file, int dirItNr); - sigc::signal OnLoadFile; - sigc::signal OnLoadDir; }; // I tried a lot to use the menu.cpp as ListBox selection, and I got three solution which are all garbage. diff --git a/src/system/ytparser.cpp b/src/system/ytparser.cpp index 3c558ee1b..407d452a4 100644 --- a/src/system/ytparser.cpp +++ b/src/system/ytparser.cpp @@ -323,7 +323,7 @@ bool cYTFeedParser::parseFeedJSON(std::string &answer) Json::Value elements = root["items"]; for(unsigned int i=0; igetText(LOCALE_MOVIEBROWSER_SCAN_FOR_MOVIES)); + OnProgress(i, elements.size(), g_Locale->getText(LOCALE_MOVIEBROWSER_SCAN_FOR_MOVIES)); #ifdef DEBUG_PARSER printf("=========================================================\n"); printf("Element %d in elements\n", i); diff --git a/src/system/ytparser.h b/src/system/ytparser.h index c54c2239b..dcc8f1322 100644 --- a/src/system/ytparser.h +++ b/src/system/ytparser.h @@ -30,6 +30,7 @@ #include #include #include +#include class cYTVideoUrl { @@ -68,7 +69,7 @@ class cYTVideoInfo typedef std::vector yt_video_list_t; -class cYTFeedParser +class cYTFeedParser : public CProgressSignals { private: std::string error; @@ -155,8 +156,6 @@ class cYTFeedParser void SetMaxResults(int count) { max_results = count; } void SetConcurrentDownloads(int count) { concurrent_downloads = count; } void SetThumbnailDir(std::string &_thumbnail_dir); - - sigc::signal OnLoadVideoInfo; }; #endif