diff --git a/configure.ac b/configure.ac index 49409f994..925854238 100644 --- a/configure.ac +++ b/configure.ac @@ -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]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES]) diff --git a/src/driver/fb_accel.h b/src/driver/fb_accel.h index 090ef4cc4..f776908be 100644 --- a/src/driver/fb_accel.h +++ b/src/driver/fb_accel.h @@ -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 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); + fb_pixel_t * getBackBufferPointer() const; void setBlendMode(uint8_t); void setBlendLevel(int); uint32_t getWidth4FB_HW_ACC(const uint32_t x, const uint32_t w, const bool max=true); diff --git a/src/driver/fb_accel_cs_hd2.cpp b/src/driver/fb_accel_cs_hd2.cpp index 256a9c729..bc2983560 100644 --- a/src/driver/fb_accel_cs_hd2.cpp +++ b/src/driver/fb_accel_cs_hd2.cpp @@ -211,6 +211,11 @@ int CFbAccelCSHD2::setMode(unsigned int, unsigned int, unsigned int) return 0; /* dont fail because of this */ } +fb_pixel_t * CFbAccelCSHD2::getBackBufferPointer() const +{ + return backbuffer; +} + void CFbAccelCSHD2::setBlendMode(uint8_t mode) { if (ioctl(fd, FBIO_SETBLENDMODE, mode)) diff --git a/src/driver/fb_generic.h b/src/driver/fb_generic.h index fdd9cc8d5..7112a8226 100644 --- a/src/driver/fb_generic.h +++ b/src/driver/fb_generic.h @@ -266,7 +266,7 @@ class CFrameBuffer : public sigc::trackable 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); 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); diff --git a/src/gui/imageinfo.cpp b/src/gui/imageinfo.cpp index 99a3cace5..15dd92544 100644 --- a/src/gui/imageinfo.cpp +++ b/src/gui/imageinfo.cpp @@ -414,6 +414,7 @@ void CImageInfo::InitInfoText(const std::string& text) //add a caption for info contents Font * caption_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]; int caption_height = caption_font->getHeight(); + y_tmp = max(y_tmp, cc_tv->getYPos()+cc_tv->getHeight()); if (cc_sub_caption == NULL) 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); diff --git a/src/gui/moviebrowser/mb.cpp b/src/gui/moviebrowser/mb.cpp index df99c29d7..11257e512 100644 --- a/src/gui/moviebrowser/mb.cpp +++ b/src/gui/moviebrowser/mb.cpp @@ -2874,7 +2874,7 @@ bool CMovieBrowser::loadTsFileNamesFromDir(const std::string & dirname) CFileList flist; 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 (m_settings.ts_only || !CFileBrowser::checkBD(flist[i])) { @@ -2885,6 +2885,7 @@ bool CMovieBrowser::loadTsFileNamesFromDir(const std::string & dirname) } else { result |= addFile(flist[i], dirItNr); } + OnLoadFile(i, flist.size(), g_Locale->getText(LOCALE_MOVIEBROWSER_SCAN_FOR_MOVIES)); } //result = true; } @@ -3123,7 +3124,8 @@ void CMovieBrowser::loadMovies(bool doRefresh) { 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(); if (show_mode == MB_SHOW_YT) { diff --git a/src/gui/moviebrowser/mb.h b/src/gui/moviebrowser/mb.h index 9dee3dbee..3f29afdea 100644 --- a/src/gui/moviebrowser/mb.h +++ b/src/gui/moviebrowser/mb.h @@ -362,6 +362,7 @@ class CMovieBrowser : public CMenuTarget void clearSelection(); bool supportedExtension(CFile &file); bool addFile(CFile &file, int dirItNr); + sigc::signal OnLoadFile; }; // 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/gui/test_menu.cpp b/src/gui/test_menu.cpp index 6471856cd..cee1d8f62 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -60,6 +60,7 @@ #include #include #include +#include #if HAVE_COOL_HARDWARE extern int cs_test_card(int unit, char * str); diff --git a/src/gui/widget/progresswindow.cpp b/src/gui/widget/progresswindow.cpp index f91584872..0fed059cd 100644 --- a/src/gui/widget/progresswindow.cpp +++ b/src/gui/widget/progresswindow.cpp @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Implementation of CComponent Window class. - Copyright (C) 2014 Thilo Graf 'dbt' + Copyright (C) 2014-2017 Thilo Graf 'dbt' Copyright (C) 2009-2013 Stefan Seyfried @@ -34,15 +34,42 @@ #include #include +using namespace sigc; +using namespace std; -CProgressWindow::CProgressWindow(CComponentsForm *parent) -: CComponentsWindow(0, 0, 700, 200, string(), NEUTRINO_ICON_INFO, parent, CC_SHADOW_ON) +CProgressWindow::CProgressWindow(CComponentsForm *parent, + const int &dx, + const int &dy, + signal *statusSignal, + signal *localSignal, + signal *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 *statusSignal, + signal *localSignal, + signal *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 *statusSignal, + signal *localSignal, + signal *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; showFooter(false); @@ -50,7 +77,7 @@ void CProgressWindow::Init() int x_item = 10; int y_item = 10; - setWidthP(75); + int w_item = width-2*x_item; int h_item = 14; int h_pbar = 20; @@ -62,6 +89,7 @@ void CProgressWindow::Init() status_txt->setDimensionsAll(x_item, y_item, w_item, h_txt); status_txt->setColorBody(col_body); status_txt->doPaintTextBoxBg(true); + status_txt->doPaintBg(false); addWindowItem(status_txt); y_item += h_txt + 10; @@ -88,7 +116,7 @@ void CProgressWindow::Init() y_item += 2*h_pbar; h_height = ccw_head->getHeight(); - height = y_item + h_height; + height = max(height, y_item + h_height); setCenterPos(); } @@ -102,7 +130,7 @@ void CProgressWindow::setTitle(const neutrino_locale_t title) #endif // VFD_UPDATE } -void CProgressWindow::setTitle(const std::string & title) +void CProgressWindow::setTitle(const string & 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) return; @@ -134,17 +162,19 @@ void CProgressWindow::showStatus(const unsigned int prog) 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) return; global_bar->allowPaint(true); global_progress = prog; - global_bar->setValues(prog, 100); + global_bar->setValues(prog, (int)max); + if (!statusText.empty()) + showStatusMessageUTF(statusText); global_bar->paint(false); #ifdef VFD_UPDATE @@ -152,14 +182,16 @@ void CProgressWindow::showGlobalStatus(const unsigned int prog) #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) return; local_bar->allowPaint(true); local_progress = prog; - local_bar->setValues(prog, 100); + local_bar->setValues(prog, (int)max); + if (!statusText.empty()) + showStatusMessageUTF(statusText); local_bar->paint(false); #ifdef VFD_UPDATE @@ -169,7 +201,7 @@ void CProgressWindow::showLocalStatus(const unsigned int prog) #endif // VFD_UPDATE } -void CProgressWindow::showStatusMessageUTF(const std::string & text) +void CProgressWindow::showStatusMessageUTF(const string & text) { string txt = text; int w_txt = status_txt->getWidth(); @@ -194,7 +226,7 @@ void CProgressWindow::hide() CComponentsWindow::hide(); } -int CProgressWindow::exec(CMenuTarget* parent, const std::string & /*actionKey*/) +int CProgressWindow::exec(CMenuTarget* parent, const string & /*actionKey*/) { if(parent) { diff --git a/src/gui/widget/progresswindow.h b/src/gui/widget/progresswindow.h index 6b8ff9e72..811b5714a 100644 --- a/src/gui/widget/progresswindow.h +++ b/src/gui/widget/progresswindow.h @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Implementation of CComponent Window class. - Copyright (C) 2014 Thilo Graf 'dbt' + Copyright (C) 2014-2017 Thilo Graf 'dbt' License: GPL @@ -38,24 +38,189 @@ class CProgressWindow : public CComponentsWindow, public CMenuTarget unsigned int local_progress; int w_bar_frame; int h_height; - void Init(); + void Init( sigc::signal *statusSignal, + sigc::signal *localSignal, + sigc::signal *globalSignal); void fitItems(); 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, defines an optional signal container for + * current changing values. + * @param[in] localSignal + * @li optional: expects type sigc::signal, defines an optional signal container for + * current changing local values. + * @param[in] globalSignal + * @li optional: expects type sigc::signal, 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 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 *status_Signal = NULL, + sigc::signal *localSignal = NULL, + sigc::signal *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 *status_Signal = NULL, + sigc::signal *localSignal = NULL, + sigc::signal *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); + + /**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(); + /** + * 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 ); - 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); - 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 + + /** + * Paint window + * @param[in] do_save_bg + * @li optional: expects type bool, sets background save mode + */ void paint(bool do_save_bg = true); - void setTitle(const std::string & title); }; diff --git a/src/system/ytparser.cpp b/src/system/ytparser.cpp index 928df3afe..3c558ee1b 100644 --- a/src/system/ytparser.cpp +++ b/src/system/ytparser.cpp @@ -323,6 +323,7 @@ bool cYTFeedParser::parseFeedJSON(std::string &answer) Json::Value elements = root["items"]; for(unsigned int i=0; igetText(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 adb30ba67..c54c2239b 100644 --- a/src/system/ytparser.h +++ b/src/system/ytparser.h @@ -27,7 +27,7 @@ #include #include #include - +#include #include #include @@ -155,6 +155,8 @@ 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