Merge branch 'ni/tuxbox' into ni/mp/tuxbox

Origin commit data
------------------
Commit: b4b328a0bc
Author: vanhofen <vanhofen@gmx.de>
Date: 2017-02-13 (Mon, 13 Feb 2017)
This commit is contained in:
vanhofen
2017-02-13 19:36:03 +01:00
8 changed files with 235 additions and 31 deletions

View File

@@ -414,6 +414,7 @@ void CImageInfo::InitInfoText(const std::string& text)
//add a caption for info contents //add a caption for info contents
Font * caption_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]; Font * caption_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU];
int caption_height = caption_font->getHeight(); int caption_height = caption_font->getHeight();
y_tmp = max(y_tmp, cc_tv->getYPos()+cc_tv->getHeight());
if (cc_sub_caption == NULL) if (cc_sub_caption == NULL)
cc_sub_caption = new CComponentsLabel(cc_info->getXPos(), y_tmp, cc_info->getWidth(), caption_height, cc_sub_caption = new CComponentsLabel(cc_info->getXPos(), y_tmp, cc_info->getWidth(), caption_height,
g_Locale->getText(LOCALE_IMAGEINFO_LICENSE), CTextBox::AUTO_WIDTH, item_font); g_Locale->getText(LOCALE_IMAGEINFO_LICENSE), CTextBox::AUTO_WIDTH, item_font);

View File

@@ -2971,7 +2971,7 @@ bool CMovieBrowser::loadTsFileNamesFromDir(const std::string & dirname)
CFileList flist; CFileList flist;
if (readDir(dirname, &flist) == true) if (readDir(dirname, &flist) == true)
{ {
for (unsigned int i = 0; i < flist.size(); i++) for (size_t i = 0; i < flist.size(); i++)
{ {
if (S_ISDIR(flist[i].Mode)) { if (S_ISDIR(flist[i].Mode)) {
if (m_settings.ts_only || !CFileBrowser::checkBD(flist[i])) { if (m_settings.ts_only || !CFileBrowser::checkBD(flist[i])) {
@@ -2982,6 +2982,7 @@ bool CMovieBrowser::loadTsFileNamesFromDir(const std::string & dirname)
} else { } else {
result |= addFile(flist[i], dirItNr); result |= addFile(flist[i], dirItNr);
} }
OnLoadFile(i, flist.size(), g_Locale->getText(LOCALE_MOVIEBROWSER_SCAN_FOR_MOVIES));
} }
//result = true; //result = true;
} }
@@ -3220,7 +3221,8 @@ void CMovieBrowser::loadMovies(bool doRefresh)
{ {
TRACE("[mb] loadMovies: \n"); TRACE("[mb] loadMovies: \n");
CHintBox loadBox((show_mode == MB_SHOW_YT) ? LOCALE_MOVIEPLAYER_YTPLAYBACK : LOCALE_MOVIEBROWSER_HEAD, g_Locale->getText(LOCALE_MOVIEBROWSER_SCAN_FOR_MOVIES)); CProgressWindow loadBox((show_mode == MB_SHOW_YT) ? LOCALE_MOVIEPLAYER_YTPLAYBACK : LOCALE_MOVIEBROWSER_HEAD, 500, 150, show_mode == MB_SHOW_YT ? &ytparser.OnLoadVideoInfo : &OnLoadFile);
loadBox.enableShadow();
loadBox.paint(); loadBox.paint();
if (show_mode == MB_SHOW_YT) { if (show_mode == MB_SHOW_YT) {

View File

@@ -364,6 +364,7 @@ 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;
}; };
// 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

@@ -3,7 +3,7 @@
Copyright (C) 2001 by Steffen Hehn 'McClean' Copyright (C) 2001 by Steffen Hehn 'McClean'
Implementation of CComponent Window class. Implementation of CComponent Window class.
Copyright (C) 2014 Thilo Graf 'dbt' Copyright (C) 2014-2017 Thilo Graf 'dbt'
Copyright (C) 2009-2013 Stefan Seyfried Copyright (C) 2009-2013 Stefan Seyfried
@@ -34,15 +34,42 @@
#include <driver/fontrenderer.h> #include <driver/fontrenderer.h>
#include <driver/display.h> #include <driver/display.h>
using namespace sigc;
using namespace std;
CProgressWindow::CProgressWindow(CComponentsForm *parent) CProgressWindow::CProgressWindow(CComponentsForm *parent,
: CComponentsWindow(0, 0, 700, 200, string(), NEUTRINO_ICON_INFO, parent, CC_SHADOW_ON) const int &dx,
const int &dy,
signal<void, size_t, size_t, string> *statusSignal,
signal<void, size_t, size_t, string> *localSignal,
signal<void, size_t, size_t, string> *globalSignal)
: CComponentsWindow(0, 0, dx, dy, string(), NEUTRINO_ICON_INFO, parent, CC_SHADOW_ON)
{ {
Init(); Init(statusSignal, localSignal, globalSignal);
} }
void CProgressWindow::Init() CProgressWindow::CProgressWindow(const neutrino_locale_t title,
const int &dx,
const int &dy,
signal<void, size_t, size_t, string> *statusSignal,
signal<void, size_t, size_t, string> *localSignal,
signal<void, size_t, size_t, string> *globalSignal)
: CComponentsWindow(0, 0, dx, dy, g_Locale->getText(title), NEUTRINO_ICON_INFO, NULL, CC_SHADOW_ON)
{ {
Init(statusSignal, localSignal, globalSignal);
}
void CProgressWindow::Init( signal<void, size_t, size_t, string> *statusSignal,
signal<void,size_t, size_t, string> *localSignal,
signal<void, size_t, size_t, string> *globalSignal)
{
if (statusSignal)
*statusSignal->connect(mem_fun(*this, &CProgressWindow::showStatus));
if (localSignal)
*localSignal->connect(mem_fun(*this, &CProgressWindow::showLocalStatus));
if (globalSignal)
*globalSignal->connect(mem_fun(*this, &CProgressWindow::showGlobalStatus));
global_progress = local_progress = 100; global_progress = local_progress = 100;
showFooter(false); showFooter(false);
@@ -50,7 +77,7 @@ void CProgressWindow::Init()
int x_item = 10; int x_item = 10;
int y_item = 10; int y_item = 10;
setWidthP(75);
int w_item = width-2*x_item; int w_item = width-2*x_item;
int h_item = 14; int h_item = 14;
int h_pbar = 20; int h_pbar = 20;
@@ -62,6 +89,7 @@ void CProgressWindow::Init()
status_txt->setDimensionsAll(x_item, y_item, w_item, h_txt); status_txt->setDimensionsAll(x_item, y_item, w_item, h_txt);
status_txt->setColorBody(col_body); status_txt->setColorBody(col_body);
status_txt->doPaintTextBoxBg(true); status_txt->doPaintTextBoxBg(true);
status_txt->doPaintBg(false);
addWindowItem(status_txt); addWindowItem(status_txt);
y_item += h_txt + 10; y_item += h_txt + 10;
@@ -88,7 +116,7 @@ void CProgressWindow::Init()
y_item += 2*h_pbar; y_item += 2*h_pbar;
h_height = ccw_head->getHeight(); h_height = ccw_head->getHeight();
height = y_item + h_height; height = max(height, y_item + h_height);
setCenterPos(); setCenterPos();
} }
@@ -102,7 +130,7 @@ void CProgressWindow::setTitle(const neutrino_locale_t title)
#endif // VFD_UPDATE #endif // VFD_UPDATE
} }
void CProgressWindow::setTitle(const std::string & title) void CProgressWindow::setTitle(const string & title)
{ {
setWindowCaption(title); setWindowCaption(title);
@@ -123,7 +151,7 @@ void CProgressWindow::fitItems()
} }
} }
void CProgressWindow::showStatus(const unsigned int prog) void CProgressWindow::showStatus(const unsigned int prog, const unsigned int max, const string &statusText)
{ {
if (global_progress == prog) if (global_progress == prog)
return; return;
@@ -134,17 +162,19 @@ void CProgressWindow::showStatus(const unsigned int prog)
global_bar->setHeight(g_height + g_height/2); global_bar->setHeight(g_height + g_height/2);
} }
showGlobalStatus(prog); showGlobalStatus(prog, max, statusText);
} }
void CProgressWindow::showGlobalStatus(const unsigned int prog) void CProgressWindow::showGlobalStatus(const unsigned int prog, const unsigned int max, const string &statusText)
{ {
if (global_progress == prog) if (global_progress == prog)
return; return;
global_bar->allowPaint(true); global_bar->allowPaint(true);
global_progress = prog; global_progress = prog;
global_bar->setValues(prog, 100); global_bar->setValues(prog, (int)max);
if (!statusText.empty())
showStatusMessageUTF(statusText);
global_bar->paint(false); global_bar->paint(false);
#ifdef VFD_UPDATE #ifdef VFD_UPDATE
@@ -152,14 +182,16 @@ void CProgressWindow::showGlobalStatus(const unsigned int prog)
#endif // VFD_UPDATE #endif // VFD_UPDATE
} }
void CProgressWindow::showLocalStatus(const unsigned int prog) void CProgressWindow::showLocalStatus(const unsigned int prog, const unsigned int max, const string &statusText)
{ {
if (local_progress == prog) if (local_progress == prog)
return; return;
local_bar->allowPaint(true); local_bar->allowPaint(true);
local_progress = prog; local_progress = prog;
local_bar->setValues(prog, 100); local_bar->setValues(prog, (int)max);
if (!statusText.empty())
showStatusMessageUTF(statusText);
local_bar->paint(false); local_bar->paint(false);
#ifdef VFD_UPDATE #ifdef VFD_UPDATE
@@ -169,7 +201,7 @@ void CProgressWindow::showLocalStatus(const unsigned int prog)
#endif // VFD_UPDATE #endif // VFD_UPDATE
} }
void CProgressWindow::showStatusMessageUTF(const std::string & text) void CProgressWindow::showStatusMessageUTF(const string & text)
{ {
string txt = text; string txt = text;
int w_txt = status_txt->getWidth(); int w_txt = status_txt->getWidth();
@@ -194,7 +226,7 @@ void CProgressWindow::hide()
CComponentsWindow::hide(); CComponentsWindow::hide();
} }
int CProgressWindow::exec(CMenuTarget* parent, const std::string & /*actionKey*/) int CProgressWindow::exec(CMenuTarget* parent, const string & /*actionKey*/)
{ {
if(parent) if(parent)
{ {

View File

@@ -3,7 +3,7 @@
Copyright (C) 2001 by Steffen Hehn 'McClean' Copyright (C) 2001 by Steffen Hehn 'McClean'
Implementation of CComponent Window class. Implementation of CComponent Window class.
Copyright (C) 2014 Thilo Graf 'dbt' Copyright (C) 2014-2017 Thilo Graf 'dbt'
License: GPL License: GPL
@@ -38,24 +38,189 @@ class CProgressWindow : public CComponentsWindow, public CMenuTarget
unsigned int local_progress; unsigned int local_progress;
int w_bar_frame; int w_bar_frame;
int h_height; int h_height;
void Init(); void Init( sigc::signal<void, size_t, size_t, std::string> *statusSignal,
sigc::signal<void,size_t, size_t, std::string> *localSignal,
sigc::signal<void, size_t, size_t, std::string> *globalSignal);
void fitItems(); void fitItems();
public: public:
/**CProgressWindow Constructor
* @param[in] parent
* @li optional: expects type CComponentsForm * as possible parent object, default = NULL
* @param[in] dx
* @li optional: expects type const &int, width of window, default = 0, auto size with declared default values
* @param[in] dy
* @li optional: expects type const &int, height of window, default = 0, auto size with declared default values
* @param[in] status_Signal
* @li optional: expects type sigc::signal<void, size_t, size_t, std::string>, defines an optional signal container for
* current changing values.
* @param[in] localSignal
* @li optional: expects type sigc::signal<void, size_t, size_t, std::string>, defines an optional signal container for
* current changing local values.
* @param[in] globalSignal
* @li optional: expects type sigc::signal<void, size_t, size_t, std::string>, defines an optional signal container for
* current changing global values.
*
* @example
* void CFooClass::DoCount{
* //Usage with classic init inside method:
*
* //Create a CProgressWindow object
* CProgressWindow progress;
*
* //set possible properties, eg. like here we dont't need a header
* status.showHeader(false);
*
* //paint window
* status.paint();
*
* //set possible properties, like current status text
* status.showStatusMessageUTF("test progress");
*
* //set current progress, call functions, methods or use a while, next loop or what ever
* status.showStatus(25)
*
* //finally remove window from screen
* 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:
*
* class CFooClass
* {
* //Usage with signals:
* //declare a signal eg. in header file
* private:
* //other members...
* sigc::signal<void, size_t, size_t, std::string> OnProgress;
* //other members...
* public:
* //other members...
* void DoAnything();
* //other members...
* };
*
* //add the OnProgress signal into a counter methode
* void CFooClass::DoCount{
* size_t max = 10
* for (size_t i = 0; i < max; i++){
* OnProgress(i, max, "Test");
* }
* }
*
* 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, &OnProgress);
* //paint window
* progress.paint(); // paint()
*
* //...
*
* 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
*/
CProgressWindow(CComponentsForm *parent = NULL,
const int &dx = 700,
const int &dy = 200,
sigc::signal<void, size_t, size_t, std::string> *status_Signal = NULL,
sigc::signal<void,size_t, size_t, std::string> *localSignal = NULL,
sigc::signal<void, size_t, size_t, std::string> *globalSignal = NULL);
CProgressWindow(CComponentsForm *parent = NULL); /**CProgressWindow Constructor
* @param[in] title
* @li expects type neutrino_locale_t as window title
*
* @see For other arguments and examples, see related constructor(s)
*/
CProgressWindow(const neutrino_locale_t title,
const int &dx = 700,
const int &dy = 200,
sigc::signal<void, size_t, size_t, std::string> *status_Signal = NULL,
sigc::signal<void,size_t, size_t, std::string> *localSignal = NULL,
sigc::signal<void, size_t, size_t, std::string> *globalSignal = NULL);
/**Sets titel of window
* @param[in] title
* @li expects type neutrino_locale_t as window title
*/
void setTitle(const neutrino_locale_t title); void setTitle(const neutrino_locale_t title);
/**Sets titel of window
* @param[in] title
* @li expects type std::string as window title
*/
void setTitle(const std::string & title);
/**
* Remove window from screen, restores background.
*/
virtual void hide(); virtual void hide();
/**
* Executes the exec contents. In this case it will paint the window and remove possible parents from screen
* @param[in] parent
* @li optional: expects type CMenuTarget*
* @param[in] actionKey
* @li optional: without effect
* @return int = menu_return::RETURN_REPAINT
*/
virtual int exec( CMenuTarget* parent, const std::string & actionKey ); virtual int exec( CMenuTarget* parent, const std::string & actionKey );
void showStatus(const unsigned int prog); /**
void showGlobalStatus(const unsigned int prog); * Sets current progress value and show progress in window.
* @param[in] prog
* @li expects type unsigned int, describes current progress value
* @param[in] max
* @li optional: expects type unsigned int, describes maximal progress value, default = 100
* @param[in] statusText
* @li optional: expects type std::string, describes current status text, default = empty
*/
void showStatus(const unsigned int prog, const unsigned int max = 100, const std::string &statusText = std::string());
/**
* Sets current local progressbar value and show progress in window.
* @note For other arguments take a look to related method showStatus()
* @see showStatus()
*/
void showLocalStatus(const unsigned int prog, const unsigned int max = 100, const std::string &statusText = std::string());
/**
* Sets current global progressbar value and show progress in window.
* @note For other arguments take a look to related method showStatus()
* @see showStatus()
*/
void showGlobalStatus(const unsigned int prog, const unsigned int max = 100, const std::string &statusText = std::string());
/**
* Gets current progress value
* @return unsigned int
*/
unsigned int getGlobalStatus(void); unsigned int getGlobalStatus(void);
void showLocalStatus(const unsigned int prog);
/**
* Sets current progress value and show progress in window.
* @param[in] text
* @li expects type std::string, describes current status text
*/
void showStatusMessageUTF(const std::string & text); // UTF-8 void showStatusMessageUTF(const std::string & text); // UTF-8
/**
* Paint window
* @param[in] do_save_bg
* @li optional: expects type bool, sets background save mode
*/
void paint(bool do_save_bg = true); void paint(bool do_save_bg = true);
void setTitle(const std::string & title);
}; };

View File

@@ -323,6 +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));
#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

@@ -27,7 +27,7 @@
#include <string> #include <string>
#include <map> #include <map>
#include <xmltree/xmlinterface.h> #include <xmltree/xmlinterface.h>
#include <sigc++/sigc++.h>
#include <OpenThreads/Thread> #include <OpenThreads/Thread>
#include <OpenThreads/Condition> #include <OpenThreads/Condition>
@@ -155,6 +155,8 @@ 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

View File

@@ -291,7 +291,7 @@ bool CCamManager::SetMode(t_channel_id channel_id, enum runmode mode, bool start
} }
if((oldmask != newmask) || force_update) { if((oldmask != newmask) || force_update) {
INFO(" ##NI: (oldmask != newmask) || force_update)\n"); INFO(" ##NI: (oldmask != newmask) || force_update)");
cam->setCaMask(newmask); cam->setCaMask(newmask);
cam->setSource(source); cam->setSource(source);
if(newmask != 0 && (!filter_channels || !channel->bUseCI)) { if(newmask != 0 && (!filter_channels || !channel->bUseCI)) {
@@ -301,7 +301,7 @@ bool CCamManager::SetMode(t_channel_id channel_id, enum runmode mode, bool start
} }
if(newmask == 0) { if(newmask == 0) {
INFO(" ##NI: (newmask == 0)\n"); INFO(" ##NI: (newmask == 0)");
/* FIXME: back to live channel from playback dont parse pmt and call setCaPmt /* FIXME: back to live channel from playback dont parse pmt and call setCaPmt
* (see CMD_SB_LOCK / UNLOCK PLAYBACK */ * (see CMD_SB_LOCK / UNLOCK PLAYBACK */
//channel->setRawPmt(NULL);//FIXME //channel->setRawPmt(NULL);//FIXME
@@ -312,7 +312,7 @@ bool CCamManager::SetMode(t_channel_id channel_id, enum runmode mode, bool start
//NI - this is a hack for rezaping to the recording channe //NI - this is a hack for rezaping to the recording channe
//if commig from movieplayer, disable hack //if commig from movieplayer, disable hack
if(!mp && ( (!mode || (mode && !chan->scrambled)) && (!start && rmode)) ){ if(!mp && ( (!mode || (mode && !chan->scrambled)) && (!start && rmode)) ){
INFO(" ##NI: HACK: disabling TS\n"); INFO(" ##NI: HACK: disabling TS");
cCA::GetInstance()->SetTS(CA_DVBCI_TS_INPUT_DISABLED); cCA::GetInstance()->SetTS(CA_DVBCI_TS_INPUT_DISABLED);
} }
mp = false; mp = false;
@@ -326,7 +326,7 @@ bool CCamManager::SetMode(t_channel_id channel_id, enum runmode mode, bool start
if(start) { if(start) {
if ((tunerno >= 0 && tunerno == cDemux::GetSource(cam->getSource())) || (filter_channels && channel->bUseCI)) { if ((tunerno >= 0 && tunerno == cDemux::GetSource(cam->getSource())) || (filter_channels && channel->bUseCI)) {
rmode = true; rmode = true;
INFO(" ##NI: rmode\n"); INFO(" ##NI: rmode");
} }
} else } else
@@ -342,7 +342,7 @@ bool CCamManager::SetMode(t_channel_id channel_id, enum runmode mode, bool start
list = CCam::CAPMT_ADD; list = CCam::CAPMT_ADD;
#ifdef BOXMODEL_CS_HD2 #ifdef BOXMODEL_CS_HD2
INFO(" ##NI: channel_map.size() %d\n",channel_map.size()); INFO(" ##NI: channel_map.size() %d",channel_map.size());
int ci_use_count = 0; int ci_use_count = 0;
for (it = channel_map.begin(); it != channel_map.end(); ++it) for (it = channel_map.begin(); it != channel_map.end(); ++it)
{ {