Merge branch 'pu/fb-setmode' of https://github.com/tuxbox-neutrino/gui-neutrino into ni/tuxbox

Conflicts:
	src/gui/moviebrowser/mb.h


Origin commit data
------------------
Branch: ni/coolstream
Commit: 73ea6fddcb
Author: vanhofen <vanhofen@gmx.de>
Date: 2017-03-06 (Mon, 06 Mar 2017)



------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2017-03-06 23:26:32 +01:00
6 changed files with 80 additions and 16 deletions

View File

@@ -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)
{

View File

@@ -2863,7 +2863,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);
OnGlobalProgress(i, size, m_dir[i].name);
loadTsFileNamesFromDir(m_dir[i].name);
}
}
@@ -2984,7 +2984,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;
}
@@ -3223,7 +3223,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();

View File

@@ -57,6 +57,7 @@
#include <driver/file.h>
#include <driver/fb_window.h>
#include <system/ytparser.h>
#include <gui/widget/progresswindow.h>
#include <gui/imdb.h> //NI
#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)
@@ -134,7 +135,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;
@@ -364,8 +365,6 @@ class CMovieBrowser : public CMenuTarget
void clearSelection();
bool supportedExtension(CFile &file);
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.

View File

@@ -92,7 +92,7 @@ class CProgressWindow : public CComponentsWindow, public CMenuTarget
* //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:
* //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<void, size_t, size_t, std::string> 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<void, size_t, size_t, std::string> OnProgress, OnLocalProgress, OnGlobalProgress;
};
#endif

View File

@@ -323,7 +323,7 @@ bool cYTFeedParser::parseFeedJSON(std::string &answer)
Json::Value elements = root["items"];
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
printf("=========================================================\n");
printf("Element %d in elements\n", i);

View File

@@ -30,6 +30,7 @@
#include <sigc++/sigc++.h>
#include <OpenThreads/Thread>
#include <OpenThreads/Condition>
#include <gui/widget/progresswindow.h>
class cYTVideoUrl
{
@@ -68,7 +69,7 @@ class cYTVideoInfo
typedef std::vector<cYTVideoInfo> 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<void, size_t, size_t, std::string> OnLoadVideoInfo;
};
#endif