Merge remote-tracking branch 'tuxbox/master'

Origin commit data
------------------
Branch: ni/coolstream
Commit: 1d9d81d448
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2017-02-15 (Wed, 15 Feb 2017)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
Stefan Seyfried
2017-02-15 20:26:44 +01:00
12 changed files with 239 additions and 28 deletions

View File

@@ -1,4 +1,4 @@
AC_INIT(Neutrino-MP,3.4.1) AC_INIT(Neutrino-MP,3.4.2)
AM_INIT_AUTOMAKE([1.0.1 nostdinc]) AM_INIT_AUTOMAKE([1.0.1 nostdinc])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])

View File

@@ -125,6 +125,7 @@ class CFbAccelCSHD2
void paintBoxRel(const int x, const int y, const int dx, const int dy, const fb_pixel_t col, int radius = 0, int type = CORNER_ALL); void paintBoxRel(const int x, const int y, const int dx, const int dy, const fb_pixel_t col, int radius = 0, int type = CORNER_ALL);
void blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp = 0, uint32_t yp = 0, bool transp = false); void blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp = 0, uint32_t yp = 0, bool transp = false);
void blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff); void blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff);
fb_pixel_t * getBackBufferPointer() const;
void setBlendMode(uint8_t); void setBlendMode(uint8_t);
void setBlendLevel(int); void setBlendLevel(int);
uint32_t getWidth4FB_HW_ACC(const uint32_t x, const uint32_t w, const bool max=true); uint32_t getWidth4FB_HW_ACC(const uint32_t x, const uint32_t w, const bool max=true);

View File

@@ -211,6 +211,11 @@ int CFbAccelCSHD2::setMode(unsigned int, unsigned int, unsigned int)
return 0; /* dont fail because of this */ return 0; /* dont fail because of this */
} }
fb_pixel_t * CFbAccelCSHD2::getBackBufferPointer() const
{
return backbuffer;
}
void CFbAccelCSHD2::setBlendMode(uint8_t mode) void CFbAccelCSHD2::setBlendMode(uint8_t mode)
{ {
if (ioctl(fd, FBIO_SETBLENDMODE, mode)) if (ioctl(fd, FBIO_SETBLENDMODE, mode))

View File

@@ -266,7 +266,7 @@ class CFrameBuffer : public sigc::trackable
void* convertRGBA2FB(unsigned char *rgbbuff, unsigned long x, unsigned long y); void* convertRGBA2FB(unsigned char *rgbbuff, unsigned long x, unsigned long y);
void displayRGB(unsigned char *rgbbuff, int x_size, int y_size, int x_pan, int y_pan, int x_offs, int y_offs, bool clearfb = true, int transp = 0xFF); void displayRGB(unsigned char *rgbbuff, int x_size, int y_size, int x_pan, int y_pan, int x_offs, int y_offs, bool clearfb = true, int transp = 0xFF);
virtual void blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp = 0, uint32_t yp = 0, bool transp = false); virtual void blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp = 0, uint32_t yp = 0, bool transp = false);
void blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff); virtual void blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff);
virtual void mark(int x, int y, int dx, int dy); virtual void mark(int x, int y, int dx, int dy);

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

@@ -2874,7 +2874,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])) {
@@ -2885,6 +2885,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;
} }
@@ -3123,7 +3124,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

@@ -362,6 +362,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

@@ -60,6 +60,7 @@
#include <gui/buildinfo.h> #include <gui/buildinfo.h>
#include <gui/widget/buttons.h> #include <gui/widget/buttons.h>
#include <system/helpers.h> #include <system/helpers.h>
#include <gui/components/cc_timer.h>
#if HAVE_COOL_HARDWARE #if HAVE_COOL_HARDWARE
extern int cs_test_card(int unit, char * str); extern int cs_test_card(int unit, char * str);

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