CMovieBrowser/cYTFeedParser: implement signals from CProgressSignals

This commit is contained in:
2017-03-06 21:25:36 +01:00
parent 7f511ebd1a
commit 8c6a47ee3a
4 changed files with 8 additions and 10 deletions

View File

@@ -2766,7 +2766,7 @@ void CMovieBrowser::loadAllTsFileNamesFromStorage(void)
for (i=0; i < size;i++) for (i=0; i < size;i++)
{ {
if (*m_dir[i].used == true){ 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); loadTsFileNamesFromDir(m_dir[i].name);
} }
} }
@@ -2887,7 +2887,7 @@ bool CMovieBrowser::loadTsFileNamesFromDir(const std::string & dirname)
} else { } else {
result |= addFile(flist[i], dirItNr); result |= addFile(flist[i], dirItNr);
} }
OnLoadFile(i, flist.size(), dirname ); OnLocalProgress(i, flist.size(), dirname );
} }
//result = true; //result = true;
} }
@@ -3126,7 +3126,7 @@ void CMovieBrowser::loadMovies(bool doRefresh)
{ {
TRACE("[mb] loadMovies: \n"); 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.enableShadow();
loadBox.paint(); loadBox.paint();

View File

@@ -57,6 +57,7 @@
#include <driver/file.h> #include <driver/file.h>
#include <driver/fb_window.h> #include <driver/fb_window.h>
#include <system/ytparser.h> #include <system/ytparser.h>
#include <gui/widget/progresswindow.h>
#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 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" #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 // 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; friend class CYTCacheSelectorTarget;
@@ -362,8 +363,6 @@ class CMovieBrowser : public CMenuTarget
void clearSelection(); void clearSelection();
bool supportedExtension(CFile &file); bool supportedExtension(CFile &file);
bool addFile(CFile &file, int dirItNr); bool addFile(CFile &file, int dirItNr);
sigc::signal<void, size_t, size_t, std::string> OnLoadFile;
sigc::signal<void, size_t, size_t, std::string> OnLoadDir;
}; };
// I tried a lot to use the menu.cpp as ListBox selection, and I got three solution which are all garbage. // I tried a lot to use the menu.cpp as ListBox selection, and I got three solution which are all garbage.

View File

@@ -323,7 +323,7 @@ bool cYTFeedParser::parseFeedJSON(std::string &answer)
Json::Value elements = root["items"]; Json::Value elements = root["items"];
for(unsigned int i=0; i<elements.size();++i) for(unsigned int i=0; i<elements.size();++i)
{ {
OnLoadVideoInfo(i, elements.size(), g_Locale->getText(LOCALE_MOVIEBROWSER_SCAN_FOR_MOVIES)); OnProgress(i, elements.size(), g_Locale->getText(LOCALE_MOVIEBROWSER_SCAN_FOR_MOVIES));
#ifdef DEBUG_PARSER #ifdef DEBUG_PARSER
printf("=========================================================\n"); printf("=========================================================\n");
printf("Element %d in elements\n", i); printf("Element %d in elements\n", i);

View File

@@ -30,6 +30,7 @@
#include <sigc++/sigc++.h> #include <sigc++/sigc++.h>
#include <OpenThreads/Thread> #include <OpenThreads/Thread>
#include <OpenThreads/Condition> #include <OpenThreads/Condition>
#include <gui/widget/progresswindow.h>
class cYTVideoUrl class cYTVideoUrl
{ {
@@ -68,7 +69,7 @@ class cYTVideoInfo
typedef std::vector<cYTVideoInfo> yt_video_list_t; typedef std::vector<cYTVideoInfo> yt_video_list_t;
class cYTFeedParser class cYTFeedParser : public CProgressSignals
{ {
private: private:
std::string error; std::string error;
@@ -155,8 +156,6 @@ class cYTFeedParser
void SetMaxResults(int count) { max_results = count; } void SetMaxResults(int count) { max_results = count; }
void SetConcurrentDownloads(int count) { concurrent_downloads = count; } void SetConcurrentDownloads(int count) { concurrent_downloads = count; }
void SetThumbnailDir(std::string &_thumbnail_dir); void SetThumbnailDir(std::string &_thumbnail_dir);
sigc::signal<void, size_t, size_t, std::string> OnLoadVideoInfo;
}; };
#endif #endif