From 1dcfc52a334c4b460ca206e38a9cfebfa9a7d7b7 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 28 Nov 2014 10:24:00 +0100 Subject: [PATCH 01/98] system/helpers: remove mkdirhier(); gui/themes: use createDir() This is a partial revert of picked commit 431657e35d6d985dfcf7a5bdffa1aaf0fbc0b477. There were two methods, createDir() and mkdirhier() for the same purpose. We don't need it twice. btw: existing function createDir() fixed --- src/gui/themes.cpp | 5 +++-- src/system/helpers.cpp | 47 +++++++++++++++++++----------------------- src/system/helpers.h | 7 ++++--- 3 files changed, 28 insertions(+), 31 deletions(-) diff --git a/src/gui/themes.cpp b/src/gui/themes.cpp index 4900194e5..60963cc9b 100644 --- a/src/gui/themes.cpp +++ b/src/gui/themes.cpp @@ -163,8 +163,9 @@ int CThemes::Show() CKeyboardInput nameInput(LOCALE_COLORTHEMEMENU_NAME, &file_name); CMenuForwarder *m1 = new CMenuForwarder(LOCALE_COLORTHEMEMENU_SAVE, true , NULL, &nameInput, NULL, CRCInput::RC_green); - if (mkdirhier(THEMEDIR_VAR) && errno != EEXIST) { + if (CFileHelpers::createDir(THEMEDIR_VAR) && errno != EEXIST) { printf("[neutrino theme] error creating %s\n", THEMEDIR_VAR); + } if (access(THEMEDIR_VAR, F_OK) == 0 ) { themes.addItem(GenericMenuSeparatorLine); @@ -343,7 +344,7 @@ void CThemes::move_userDir() { if (access(USERDIR, F_OK) == 0) { - if (mkdirhier(THEMEDIR_VAR) && errno != EEXIST) + if (CFileHelpers::createDir(THEMEDIR_VAR) && errno != EEXIST) { printf("[neutrino theme] error creating %s\n", THEMEDIR_VAR); return; diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp index 4280c0913..b8dff1eec 100644 --- a/src/system/helpers.cpp +++ b/src/system/helpers.cpp @@ -38,12 +38,14 @@ #include #include #include +#include #include #include #include - +#include "debug.h" #include #include +using namespace std; void mySleep(int sec) { struct timeval timeout; @@ -215,7 +217,7 @@ FILE* my_popen( pid_t& pid, const char *cmdstring, const char *type) } return(fp); } - +#if 0 int mkdirhier(const char *pathname, mode_t mode) { int res = -1; @@ -236,7 +238,7 @@ int mkdirhier(const char *pathname, mode_t mode) res = 0; return res; } - +# endif int safe_mkdir(const char * path) { @@ -671,32 +673,25 @@ bool CFileHelpers::copyDir(const char *Src, const char *Dst, bool backupMode) return true; } -bool CFileHelpers::createDir(const char *Dir, mode_t mode) +int CFileHelpers::createDir(string& Dir, mode_t mode) { - char dirPath[PATH_MAX]; - DIR *dir; - if ((dir = opendir(Dir)) != NULL) { - closedir(dir); - errno = EEXIST; - return false; - } - - int ret = -1; - while (ret == -1) { - strcpy(dirPath, Dir); - ret = mkdir(dirPath, mode); - if ((errno == ENOENT) && (ret == -1)) { - char * pos = strrchr(dirPath,'/'); - if (pos != NULL) { - pos[0] = '\0'; - createDir(dirPath, mode); - } + struct stat st; + int res = 0; + for(string::iterator iter = Dir.begin() ; iter != Dir.end();) { + string::iterator newIter = find(iter, Dir.end(), '/' ); + string newPath = string( Dir.begin(), newIter ); + if( !newPath.empty() && stat(newPath.c_str(), &st) != 0) { + res = mkdir( newPath.c_str(), mode); + if (errno == EEXIST) + res = 0; + if(res != 0) + dprintf(DEBUG_NORMAL, "[CFileHelpers %s] creating directory %s: %s\n", __func__, newPath.c_str(), strerror(errno)); } - else - return !ret || (errno == EEXIST); + iter = newIter; + if(newIter != Dir.end()) + ++ iter; } - errno = 0; - return true; + return res; } bool CFileHelpers::removeDir(const char *Dir) diff --git a/src/system/helpers.h b/src/system/helpers.h index afa14d132..b9074331b 100644 --- a/src/system/helpers.h +++ b/src/system/helpers.h @@ -44,8 +44,8 @@ FILE* my_popen( pid_t& pid, const char *cmdstring, const char *type); int safe_mkdir(const char * path); inline int safe_mkdir(std::string path) { return safe_mkdir(path.c_str()); } -int mkdirhier(const char *pathname, mode_t mode = 0755); -inline int mkdirhier(std::string path, mode_t mode = 0755) { return mkdirhier(path.c_str(), mode); } +//int mkdirhier(const char *pathname, mode_t mode = 0755); +//inline int mkdirhier(std::string path, mode_t mode = 0755) { return mkdirhier(path.c_str(), mode); } off_t file_size(const char *filename); bool file_exists(const char *filename); void wakeup_hdd(const char *hdd_dir); @@ -88,7 +88,8 @@ class CFileHelpers bool copyFile(const char *Src, const char *Dst, mode_t mode); bool copyDir(const char *Src, const char *Dst, bool backupMode=false); - bool createDir(const char *Dir, mode_t mode); + static int createDir(std::string& Dir, mode_t mode = 755); + static int createDir(const char *Dir, mode_t mode = 755){std::string dir = std::string(Dir);return createDir(dir, mode);} bool removeDir(const char *Dir); }; From 1f81228d7b98db067b1cad84db5dc547958103dd Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 27 Aug 2014 22:31:20 +0200 Subject: [PATCH 02/98] CTestMenu: disable tuner test code Doesn't work with newer frontend api, and not really required. --- src/gui/test_menu.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index a788863fd..0ab9cc734 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -311,6 +311,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) return res; } +#if 0 //some parts DEPRECATED else if (actionKey.find("22kon") != std::string::npos) { int fnum = atoi(actionKey.substr(5, 1).c_str()); @@ -366,6 +367,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) scanTs.exec(NULL, "manual"); return res; } +#endif else if (actionKey == "button"){ if (button == NULL) button = new CComponentsButtonRed(100, 100, 100, 50, "Test"); @@ -796,7 +798,7 @@ void CTestMenu::showHWTests(CMenuWidget *widget) widget->addItem(new CMenuForwarder("Smartcard 2", true, NULL, this, "card1")); widget->addItem(new CMenuForwarder("HDD", true, NULL, this, "hdd")); widget->addItem(new CMenuForwarder("SD/MMC", true, NULL, this, "mmc")); - +#if 0 //some parts DEPRECATED for (unsigned i = 0; i < sizeof(test_pos)/sizeof(int); i++) { CServiceManager::getInstance()->InitSatPosition(test_pos[i], NULL, true); } @@ -843,4 +845,5 @@ void CTestMenu::showHWTests(CMenuWidget *widget) } } CFEManager::getInstance()->linkFrontends(true); +#endif } From 8f621ef472dc9e48ec7aadcbfd9bd7d330e03509 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 16 Oct 2014 14:05:30 +0200 Subject: [PATCH 03/98] neutrino.cpp: add signal OnBeforeRestart This allows to handle events inside from objects with matching slots and events without explicit calls in neutrino.cpp. Used here general for stopping of thread in timer object. In some cases it could be necessary to stop timer thread otherwise it is possible that restart is blocked here. This happens here automatically, without separate instances of timer objects. Conflicts: src/neutrino.h --- src/neutrino.cpp | 3 +++ src/neutrino.h | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 364002b1c..c59e2e750 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -3869,6 +3869,9 @@ int CNeutrinoApp::exec(CMenuTarget* parent, const std::string & actionKey) return menu_return::RETURN_EXIT_ALL; } else if(actionKey=="restart") { + //usage of slots from any classes + OnBeforeRestart(); + if (recordingstatus) DisplayErrorMessage(g_Locale->getText(LOCALE_SERVICEMENU_RESTART_REFUSED_RECORDING)); else { diff --git a/src/neutrino.h b/src/neutrino.h index 0a704617b..51b000e51 100644 --- a/src/neutrino.h +++ b/src/neutrino.h @@ -39,7 +39,7 @@ #include "gui/personalize.h" #include "gui/user_menue.h" #include - +#include #include #define ANNOUNCETIME (1 * 60) @@ -57,7 +57,7 @@ class CFrameBuffer; class CConfigFile; class CScanSettings; -class CNeutrinoApp : public CMenuTarget, CChangeObserver +class CNeutrinoApp : public CMenuTarget, CChangeObserver, sigc::trackable { public: enum @@ -228,6 +228,8 @@ public: void stopPlayBack(bool lock = false); bool adjustToChannelID(const t_channel_id channel_id); void screensaver(bool); + //signal/event handler before restart of neutrino gui + sigc::signal OnBeforeRestart; }; #endif From 28ef6e147eafa0bb397cf683d21bac7d8941b1b0 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 26 Sep 2014 16:46:03 +0200 Subject: [PATCH 04/98] CComponentsTimer: add slot for auto timer start/stop Connection with OnBeforeRestart ensures closing threads. Under certain circumstances, eg. running thread, a restart could fail. --- src/gui/components/cc_timer.cpp | 7 +++++++ src/gui/components/cc_timer.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/src/gui/components/cc_timer.cpp b/src/gui/components/cc_timer.cpp index d056e0932..d95d299bc 100644 --- a/src/gui/components/cc_timer.cpp +++ b/src/gui/components/cc_timer.cpp @@ -40,6 +40,8 @@ CComponentsTimer::CComponentsTimer( const int& interval) { tm_thread = 0; tm_interval = interval; + + sl = sigc::mem_fun(*this, &CComponentsTimer::stopTimer); startTimer(); } @@ -81,6 +83,9 @@ bool CComponentsTimer::startTimer() } } dprintf(DEBUG_INFO,"[CComponentsTimer] [%s] timer thread [%lu] created with interval = %d\n", __func__, tm_thread, tm_interval); + + //ensure kill of thread on any restart of neutrino + CNeutrinoApp::getInstance()->OnBeforeRestart.connect(sl); return true; } @@ -99,6 +104,8 @@ bool CComponentsTimer::stopTimer() } if (thres == 0){ tm_thread = 0; + //ensure disconnect of unused slot + sl.disconnect(); return true; } diff --git a/src/gui/components/cc_timer.h b/src/gui/components/cc_timer.h index 4151b298c..62992c5aa 100644 --- a/src/gui/components/cc_timer.h +++ b/src/gui/components/cc_timer.h @@ -50,6 +50,8 @@ class CComponentsTimer : public sigc::trackable static void* initTimerThread(void *arg); ///mutex for timer OpenThreads::Mutex mutex; + ///slot for signals + sigc::slot0 sl; public: ///class constructor, parameter interval sets the interval in seconds, default value=1 (1 sec) From eebfc455c637622f03b1c2c50741ec0c0e47b5a4 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 30 Sep 2014 08:49:29 +0200 Subject: [PATCH 05/98] CComponentsTimer: log output moved Log message was shown on each call of startTimer. --- src/gui/components/cc_timer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/components/cc_timer.cpp b/src/gui/components/cc_timer.cpp index d95d299bc..42efb2b99 100644 --- a/src/gui/components/cc_timer.cpp +++ b/src/gui/components/cc_timer.cpp @@ -81,8 +81,8 @@ bool CComponentsTimer::startTimer() dprintf(DEBUG_NORMAL,"[CComponentsTimer] [%s] pthread_create %s\n", __func__, strerror(errno)); return false; } + dprintf(DEBUG_INFO,"[CComponentsTimer] [%s] timer thread [%lu] created with interval = %d\n", __func__, tm_thread, tm_interval); } - dprintf(DEBUG_INFO,"[CComponentsTimer] [%s] timer thread [%lu] created with interval = %d\n", __func__, tm_thread, tm_interval); //ensure kill of thread on any restart of neutrino CNeutrinoApp::getInstance()->OnBeforeRestart.connect(sl); From 8aa2b6a5ab35974a3c6facc9441895af3c730ead Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 30 Sep 2014 09:04:03 +0200 Subject: [PATCH 06/98] CComponentsTimer: start timer only if interval > 0 --- src/gui/components/cc_timer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/components/cc_timer.cpp b/src/gui/components/cc_timer.cpp index 42efb2b99..e303ade61 100644 --- a/src/gui/components/cc_timer.cpp +++ b/src/gui/components/cc_timer.cpp @@ -42,7 +42,8 @@ CComponentsTimer::CComponentsTimer( const int& interval) tm_interval = interval; sl = sigc::mem_fun(*this, &CComponentsTimer::stopTimer); - startTimer(); + if (interval > 0) + startTimer(); } CComponentsTimer::~CComponentsTimer() From f7faf07ab165d5289d7b824b42b2c99b782c52d3 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 4 Oct 2014 00:20:48 +0200 Subject: [PATCH 07/98] CComponentsForm: fix item offset with enabled frame frame width was not considered --- src/gui/components/cc_frm.cpp | 25 +++++++++++++++---------- src/gui/components/cc_frm_button.cpp | 4 ++-- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/gui/components/cc_frm.cpp b/src/gui/components/cc_frm.cpp index cd916cdc3..a99068860 100644 --- a/src/gui/components/cc_frm.cpp +++ b/src/gui/components/cc_frm.cpp @@ -363,6 +363,7 @@ void CComponentsForm::paintCCItems() //using of real x/y values to paint items if this text object is bound in a parent form int this_x = x, auto_x = x, this_y = y, auto_y = y, this_w = width; + int w_parent_frame = 0; if (cc_parent){ this_x = auto_x = cc_xr; this_y = auto_y = cc_yr; @@ -406,14 +407,14 @@ void CComponentsForm::paintCCItems() dprintf(DEBUG_INFO, "[CComponentsForm] %s: page_count = %u, item_page = %u, cur_page = %u\n", __func__, getPageCount(), cc_item->getPageNumber(), this->cur_page); - //get current dimension of item - int w_item = cc_item->getWidth(); - int h_item = cc_item->getHeight(); - //get current position of item int xpos = cc_item->getXPos(); int ypos = cc_item->getYPos(); + //get current dimension of item + int w_item = cc_item->getWidth() - (xpos <= fr_thickness ? fr_thickness : 0); + int h_item = cc_item->getHeight() - (ypos <= fr_thickness ? fr_thickness : 0); + //check item for corrupt position, skip current item if found problems if (ypos > height || xpos > this_w){ dprintf(DEBUG_INFO, "[CComponentsForm] %s: [form: %d] [item-index %d] [type=%d] WARNING: item position is out of form size:\ndefinied x=%d, defined this_w=%d \ndefinied y=%d, defined height=%d \n", @@ -422,37 +423,41 @@ void CComponentsForm::paintCCItems() continue; } + w_parent_frame = xpos <= fr_thickness ? fr_thickness : 0; + //set required x-position to item: //append vertical if (xpos == CC_APPEND){ auto_x += append_x_offset; - cc_item->setRealXPos(auto_x + xpos); + cc_item->setRealXPos(auto_x + xpos + w_parent_frame); auto_x += w_item; } //positionize vertical centered else if (xpos == CC_CENTERED){ auto_x = this_w/2 - w_item/2; - cc_item->setRealXPos(this_x + auto_x); + cc_item->setRealXPos(this_x + auto_x + w_parent_frame); } else{ - cc_item->setRealXPos(this_x + xpos); + cc_item->setRealXPos(this_x + xpos + w_parent_frame); auto_x = (cc_item->getRealXPos() + w_item); } + w_parent_frame = ypos <= fr_thickness ? fr_thickness : 0; + //set required y-position to item //append hor if (ypos == CC_APPEND){ auto_y += append_y_offset; - cc_item->setRealYPos(auto_y + ypos); + cc_item->setRealYPos(auto_y + ypos + w_parent_frame); auto_y += h_item; } //positionize hor centered else if (ypos == CC_CENTERED){ auto_y = height/2 - h_item/2; - cc_item->setRealYPos(this_y + auto_y); + cc_item->setRealYPos(this_y + auto_y + w_parent_frame); } else{ - cc_item->setRealYPos(this_y + ypos); + cc_item->setRealYPos(this_y + ypos + w_parent_frame); auto_y = (cc_item->getRealYPos() + h_item); } diff --git a/src/gui/components/cc_frm_button.cpp b/src/gui/components/cc_frm_button.cpp index cb5d8b322..e68795a24 100644 --- a/src/gui/components/cc_frm_button.cpp +++ b/src/gui/components/cc_frm_button.cpp @@ -184,7 +184,7 @@ void CComponentsButton::initCaption() x_cap += cc_btn_icon_obj ? cc_btn_icon_obj->getWidth() : 0; int w_cap = width - fr_thickness - append_x_offset - x_cap - fr_thickness; - int h_cap = height - 2*fr_thickness; + int h_cap = height*80/100/* - 2*fr_thickness*/; /*NOTE: paint of centered text in y direction without y_offset @@ -192,7 +192,7 @@ void CComponentsButton::initCaption() but text render isn't wrong here, because capitalized chars or long chars like e. 'q', 'y' are considered! Therefore we here need other icons or a hack, that considers some different height values. */ - int y_cap = height/2 - h_cap/2 - fr_thickness; + int y_cap = height/2 - h_cap/2 + fr_thickness/2; cc_btn_capt_obj->setDimensionsAll(x_cap, y_cap, w_cap, h_cap); From 09851f3b9f728ac510f057535bb74ccb655e2082 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 4 Oct 2014 19:09:31 +0200 Subject: [PATCH 08/98] CComponentsForm: reduce corner radius on frame border If we have a frame around parent item, ensure matching corners inside of embedded item, this avoids ugly unpainted spaces between frame and item border. TODO: other constellations are not considered at the moment! --- src/gui/components/cc_frm.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/gui/components/cc_frm.cpp b/src/gui/components/cc_frm.cpp index a99068860..29a7d1bc9 100644 --- a/src/gui/components/cc_frm.cpp +++ b/src/gui/components/cc_frm.cpp @@ -423,6 +423,7 @@ void CComponentsForm::paintCCItems() continue; } + //move item x-position, if we have a frame on parent, TODO: other constellations not considered at the moment w_parent_frame = xpos <= fr_thickness ? fr_thickness : 0; //set required x-position to item: @@ -442,6 +443,7 @@ void CComponentsForm::paintCCItems() auto_x = (cc_item->getRealXPos() + w_item); } + //move item y-position, if we have a frame on parent, TODO: other constellations not considered at the moment w_parent_frame = ypos <= fr_thickness ? fr_thickness : 0; //set required y-position to item @@ -461,6 +463,13 @@ void CComponentsForm::paintCCItems() auto_y = (cc_item->getRealYPos() + h_item); } + //reduce corner radius, if we have a frame around parent item, ensure matching corners inside of embedded item, this avoids ugly unpainted spaces between frame and item border + //TODO: other constellations not considered at the moment + if (w_parent_frame){ + if(xpos <= fr_thickness || ypos <= fr_thickness) + cc_item->setCorner(max(0, cc_item->getCornerRadius()-w_parent_frame), cc_item->getCornerType()); + } + //These steps check whether the element can be painted into the container. //Is it too wide or too high, it will be shortened and displayed in the log. //This should be avoid! From 23c708b7876ac2601fbb866db99f57212e667d09 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 5 Oct 2014 17:20:05 +0200 Subject: [PATCH 09/98] CComponentsForm: fix unnecessary try for scroll This avoids unnecessary flicker effects, because no paint is required, if page count = 1 and also ensures, that this page is defined as current page. --- src/gui/components/cc_frm.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gui/components/cc_frm.cpp b/src/gui/components/cc_frm.cpp index 29a7d1bc9..9237050b1 100644 --- a/src/gui/components/cc_frm.cpp +++ b/src/gui/components/cc_frm.cpp @@ -622,9 +622,14 @@ CComponentsItem* CComponentsForm::getSelectedItemObject() void CComponentsForm::ScrollPage(int direction, bool do_paint) { + if (getPageCount() == 1){ + cur_page = 0; + return; + } + OnBeforeScrollPage(); - int target_page_id = (int)getPageCount() - 1; + int target_page_id = (int)page_count - 1; int target_page = (int)cur_page; if (direction == SCROLL_P_DOWN) From 04083bc299260608ba3b6f8e84bc80b909ca601d Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 18 Oct 2014 00:48:23 +0200 Subject: [PATCH 10/98] CComponentsButton: use of global button text color Used text color was different to old button handler. --- src/gui/components/cc_frm_button.cpp | 5 +++-- src/gui/components/cc_frm_button.h | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/gui/components/cc_frm_button.cpp b/src/gui/components/cc_frm_button.cpp index e68795a24..b1f87af8b 100644 --- a/src/gui/components/cc_frm_button.cpp +++ b/src/gui/components/cc_frm_button.cpp @@ -115,7 +115,8 @@ void CComponentsButton::initVarButton( const int& x_pos, const int& y_pos, const append_y_offset = 0; corner_rad = RADIUS_MID; - cc_btn_capt_col = COL_MENUCONTENT_TEXT; + cc_btn_capt_col = COL_INFOBAR_SHADOW_TEXT; + cc_btn_capt_disable_col = COL_MENUCONTENTINACTIVE_TEXT; cc_btn_icon_obj = NULL; cc_btn_capt_obj = NULL; cc_btn_dy_font = CNeutrinoFonts::getInstance(); @@ -204,7 +205,7 @@ void CComponentsButton::initCaption() cc_btn_capt_obj->forceTextPaint(); //here required; //set color - cc_btn_capt_obj->setTextColor(this->cc_item_enabled ? COL_MENUCONTENT_TEXT : COL_MENUCONTENTINACTIVE_TEXT); + cc_btn_capt_obj->setTextColor(this->cc_item_enabled ? cc_btn_capt_col : cc_btn_capt_disable_col); //corner of text item cc_btn_capt_obj->setCorner(corner_rad-fr_thickness, corner_type); diff --git a/src/gui/components/cc_frm_button.h b/src/gui/components/cc_frm_button.h index 9472c8f33..aabfb8932 100644 --- a/src/gui/components/cc_frm_button.h +++ b/src/gui/components/cc_frm_button.h @@ -74,6 +74,8 @@ class CComponentsButton : public CComponentsFrmChain ///property: text color fb_pixel_t cc_btn_capt_col; + ///property: text color for disabled button + fb_pixel_t cc_btn_capt_disable_col; ///object: text font Font* cc_btn_font; ///object: dynamic font object handler @@ -126,7 +128,7 @@ class CComponentsButton : public CComponentsFrmChain fb_pixel_t color_frame = COL_DARK_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); ///set text color - virtual void setButtonTextColor(fb_pixel_t caption_color){cc_btn_capt_col = caption_color;}; + virtual void setButtonTextColor(fb_pixel_t text_color, fb_pixel_t text_color_disabled = COL_MENUCONTENTINACTIVE_TEXT){cc_btn_capt_col = text_color; cc_btn_capt_disable_col = text_color_disabled;} ///set caption: parameter as string virtual void setCaption(const std::string& text); From 782c958bde20637bd6e827b2025ccf896e3f80a0 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 26 Oct 2014 23:47:43 +0100 Subject: [PATCH 11/98] CComponentsInfoBox: fix applying of properties Some properties were not applied if cctext was already exists, eg. after changed theme --- src/gui/components/cc_item_infobox.cpp | 37 ++++++++++++++------------ 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/src/gui/components/cc_item_infobox.cpp b/src/gui/components/cc_item_infobox.cpp index d87dc39fb..8a51786d8 100644 --- a/src/gui/components/cc_item_infobox.cpp +++ b/src/gui/components/cc_item_infobox.cpp @@ -137,22 +137,25 @@ void CComponentsInfoBox::paint(bool do_save_bg) if (!ct_text.empty()){ if (cctext) delete cctext; - - cctext = new CComponentsText(); - cctext->setText(ct_text, ct_text_mode, ct_font); - cctext->doPaintTextBoxBg(ct_paint_textbg); - cctext->doPaintBg(false); - cctext->setTextColor(ct_col_text); - cctext->enableTboxSaveScreen(save_tbox_screen); - - //calculate vars for x-position and dimensions - int tx = x_offset + x_text + pic_w; - int tw = width - x_offset - pic_w - 2*fr_thickness; - int th = height-2*fr_thickness; - cctext->setDimensionsAll(tx, y_text, tw, th); - - //paint, but set visibility mode - cctext->allowPaint(cc_allow_paint); - cctext->paint(CC_SAVE_SCREEN_NO); + cctext = NULL; } + + if (cctext == NULL) + cctext = new CComponentsText(); + + cctext->setText(ct_text, ct_text_mode, ct_font); + cctext->doPaintTextBoxBg(ct_paint_textbg); + cctext->doPaintBg(false); + cctext->setTextColor(ct_col_text); + cctext->enableTboxSaveScreen(save_tbox_screen); + + //calculate vars for x-position and dimensions + int tx = x_offset + x_text + pic_w; + int tw = width - x_offset - pic_w - 2*fr_thickness; + int th = height-2*fr_thickness; + cctext->setDimensionsAll(tx, y_text, tw, th); + + //paint, but set visibility mode + cctext->allowPaint(cc_allow_paint); + cctext->paint(CC_SAVE_SCREEN_NO); } From 20180b5b83da654bcb025b40fe2bcb37e9bc8a73 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 26 Oct 2014 23:49:27 +0100 Subject: [PATCH 12/98] CMenuWidget: fix applying of hintbox text color after changed theme --- src/gui/widget/menue.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index d7565b616..9d06a0b44 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -1357,7 +1357,7 @@ void CMenuWidget::paintHint(int pos) info_box->setDimensionsAll(x, ypos2, iwidth, hint_height); info_box->setFrameThickness(2); info_box->removeLineBreaks(str); - info_box->setText(str, CTextBox::AUTO_WIDTH, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]); + info_box->setText(str, CTextBox::AUTO_WIDTH, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT], COL_MENUCONTENT_TEXT); info_box->setCorner(RADIUS_LARGE); info_box->syncSysColors(); info_box->setColorBody(COL_MENUCONTENTDARK_PLUS_0); From 8227638c062119cafe7da089aefe58ac07dee2d3 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 12 Oct 2014 22:38:10 +0200 Subject: [PATCH 13/98] CComponentsPicture: simplify item init, adapt getHeight/getWidth members Members getHeight/getWidth returns now image related values dependent of scale mode --- src/gui/components/cc_frm_header.cpp | 2 +- src/gui/components/cc_item_picture.cpp | 94 +++++++++++++------------- src/gui/components/cc_item_picture.h | 14 +++- 3 files changed, 59 insertions(+), 51 deletions(-) diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index d97ef5057..6be2b8794 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -205,7 +205,7 @@ void CComponentsHeader::initIcon() //get dimensions of header icon int iw = 0; int ih = 0; - cch_icon_obj->getImageSize(&iw, &ih); + cch_icon_obj->getSize(&iw, &ih); dprintf(DEBUG_INFO, "[CComponentsHeader]\n [%s - %d] init icon size: iw = %d, ih = %d\n", __func__, __LINE__, iw, ih); cch_icon_obj->setWidth(iw); cch_icon_obj->setHeight(ih); diff --git a/src/gui/components/cc_item_picture.cpp b/src/gui/components/cc_item_picture.cpp index fb68ee7b2..37c0daea2 100644 --- a/src/gui/components/cc_item_picture.cpp +++ b/src/gui/components/cc_item_picture.cpp @@ -42,12 +42,12 @@ using namespace std; //------------------------------------------------------------------------------------------------------- //sub class CComponentsPicture from CComponentsItem CComponentsPicture::CComponentsPicture( const int &x_pos, const int &y_pos, const int &w, const int &h, - const std::string& image_path, + const std::string& image_name, CComponentsForm *parent, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow, int transparent) { - init(x_pos, y_pos, w, h, image_path, parent, has_shadow, color_frame, color_background, color_shadow, transparent, SCALE); + init(x_pos, y_pos, w, h, image_name, parent, has_shadow, color_frame, color_background, color_shadow, transparent, SCALE); } CComponentsPicture::CComponentsPicture( const int &x_pos, const int &y_pos, @@ -59,6 +59,7 @@ CComponentsPicture::CComponentsPicture( const int &x_pos, const int &y_pos, init(x_pos, y_pos, 0, 0, image_name, parent, has_shadow, color_frame, color_background, color_shadow, transparent, NO_SCALE); } + void CComponentsPicture::init( const int &x_pos, const int &y_pos, const int &w, const int &h, const string& image_name, CComponentsForm *parent, @@ -72,25 +73,20 @@ void CComponentsPicture::init( const int &x_pos, const int &y_pos, const int &w, //CComponents x = x_pos; y = y_pos; + width = w; height = h; - width = w; + pic_name = image_name; shadow = has_shadow; shadow_w = SHADOW_OFFSET; col_frame = color_frame; col_body = color_background; col_shadow = color_shadow; - - //CComponentsPicture - pic_name = image_name; + do_scale = allow_scale; is_image_painted= false; do_paint = true; - image_transparent = transparent; - do_scale = allow_scale; - g_PicViewer->getSupportedImageFormats(v_ext); - v_ext.resize(unique(v_ext.begin(), v_ext.end()) - v_ext.begin()); initCCItem(); initParent(parent); } @@ -112,64 +108,65 @@ void CComponentsPicture::setPicture(const char* picture_name) void CComponentsPicture::initCCItem() { + if (pic_name.empty()){ + dprintf(DEBUG_NORMAL, "[CComponentsPicture] %s: no image file assigned...\n", __func__); + return; + } + //handle size int w_pic = width; int h_pic = height; - if (pic_name.empty()) - return; - //check for path or name, set icon or image with full path string::size_type pos = pic_name.find("/", 0); if (pos == string::npos) do_scale = false; - dprintf(DEBUG_INFO, "[CComponentsPicture] %s: detected image file: do_scale: %d (pos= %d), pic_name=%s\n", __func__, do_scale, pos, pic_name.c_str()); - - //get current image size - getImageSize(&w_pic, &h_pic); - - //for icons (names without explicit path) set dimensions of "this" to current image...//TODO: centering image/icon - if (!do_scale){ - width = max(w_pic, width); - height = max(h_pic, height); - } - else{ //defined values in constructor or defined via setters defined, have priority, value 0 is not allowed - if (width == 0) - width = w_pic; - if (height == 0) - height = h_pic; - } - - //resize/scale image if required, if no icon mode detected, use real image size - if (do_scale){ - if (width != w_pic || height != h_pic) { + if (!do_scale || (w_pic == 0 || w_pic == 0)){ + if (!pic_name.empty()) + frameBuffer->getIconSize(pic_name.c_str(), &width, &height); + }else{ + g_PicViewer->getSize(pic_name.c_str(), &w_pic, &h_pic); + if (width != w_pic || height != h_pic) g_PicViewer->rescaleImageDimensions(&w_pic, &h_pic, width, height); - width = w_pic; - height = h_pic; - } } } void CComponentsPicture::initPosition(int *x_position, int *y_position) { - //using of real x/y values to paint images if this picture object is bound in a parent form *x_position = x; *y_position = y; - if (cc_parent){ + if (cc_parent){ //using of real x/y values to paint images if this picture object is bound in a parent form *x_position = cc_xr; *y_position = cc_yr; } } -void CComponentsPicture::getImageSize(int* width_image, int *height_image) +void CComponentsPicture::getSize(int* width_image, int *height_image) { - if (do_scale) - g_PicViewer->getSize(pic_name.c_str(), width_image, height_image); - else + initCCItem(); + if (do_scale){ + *width_image = width; + *height_image = height; + }else{ frameBuffer->getIconSize(pic_name.c_str(), width_image, height_image); + } +} + +int CComponentsPicture::getWidth() +{ + int w, h; + getSize(&w, &h); + return w; +} + +int CComponentsPicture::getHeight() +{ + int w, h; + getSize(&w, &h); + return h; } void CComponentsPicture::paintPicture() @@ -217,8 +214,7 @@ CComponentsChannelLogo::CComponentsChannelLogo( const int &x_pos, const int &y_p "", parent, has_shadow, color_frame, color_background, color_shadow, transparent) { - setChannel(channelId, channelName); - alt_pic_name = ""; + init(channelId, channelName, SCALE); } CComponentsChannelLogo::CComponentsChannelLogo( const int &x_pos, const int &y_pos, @@ -231,11 +227,15 @@ CComponentsChannelLogo::CComponentsChannelLogo( const int &x_pos, const int &y_p "", parent, has_shadow, color_frame, color_background, color_shadow, transparent) { - setChannel(channelId, channelName); - alt_pic_name = ""; + init(channelId, channelName, NO_SCALE); } - +void CComponentsChannelLogo::init(const uint64_t& channelId, const std::string& channelName, bool allow_scale) +{ + setChannel(channelId, channelName); + do_scale = allow_scale; + alt_pic_name = ""; +} void CComponentsChannelLogo::setAltLogo(const std::string& picture_name) { alt_pic_name = picture_name; diff --git a/src/gui/components/cc_item_picture.h b/src/gui/components/cc_item_picture.h index 00cf5d10c..ce8240416 100644 --- a/src/gui/components/cc_item_picture.h +++ b/src/gui/components/cc_item_picture.h @@ -111,12 +111,18 @@ class CComponentsPicture : public CComponentsItem ///sets an image name (unscaled icons only), full image path or url to an image file virtual void setPicture(const char* picture_name); + ///handle image size + virtual void getSize(int* width_image, int *height_image); + ///return width of component + virtual int getWidth(); + ///return height of component + virtual int getHeight(); + + virtual void doScale(bool scale = true){do_scale = scale;} + ///return paint mode of internal image, true=image was painted, please do not to confuse with isPainted()! isPainted() is related to item itself. virtual inline bool isPicPainted(){return is_image_painted;}; - ///handle image size - void getImageSize(int* width_image, int *height_image); - ///paint item virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); ///hide item @@ -137,6 +143,8 @@ class CComponentsChannelLogo : public CComponentsPicture ///indicates that logo is available, after paint or new instance, value = false bool has_logo; + void init(const uint64_t& channelId, const std::string& channelName, bool allow_scale); + public: CComponentsChannelLogo( const int &x_pos, const int &y_pos, const int &w, const int &h, const std::string& channelName = "", From c027412832ab54f703d3a6f3b5403121c8b7f3f6 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 12 Oct 2014 22:41:05 +0200 Subject: [PATCH 14/98] CComponentsPIP: fix centering of image auto centering was broken, eg.to see in channellist if radio mode was enabled --- src/gui/components/cc_item_tvpic.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/components/cc_item_tvpic.cpp b/src/gui/components/cc_item_tvpic.cpp index 40ea55adf..8bc4a5ee1 100644 --- a/src/gui/components/cc_item_tvpic.cpp +++ b/src/gui/components/cc_item_tvpic.cpp @@ -101,6 +101,10 @@ void CComponentsPIP::paint(bool do_save_bg) } else{ //paint an alternate image if no tv mode available CComponentsPicture pic = CComponentsPicture (pig_x, pig_y, pig_w, pig_h, pic_name, NULL, false, col_frame, col_frame); + pic.doPaintBg(false); + int w, h; + pic.getSize(&w, &h); + pic.setPos(pig_x + pig_w/2-w/2, pig_y + pig_h/2-h/2); pic.setCorner(corner_rad, corner_type); pic.paint(CC_SAVE_SCREEN_NO); } From f499efa208ccc3ec84e68c4ddf4249f2e547622f Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 12 Oct 2014 22:48:50 +0200 Subject: [PATCH 15/98] CChannelList: ensure down scaling if header height is too small Logo is initialized with width and height, but enforces in most cases upscaling of logo. Default now disabled scaling but if header too small, down scaling is enabled. --- src/gui/channellist.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 0ed285ebe..0add17c11 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -1666,6 +1666,7 @@ void CChannelList::showChannelLogo() CChannelLogo = new CComponentsChannelLogo(0, 0, logo_w_max, theight, (*chanlist)[selected]->getName(), (*chanlist)[selected]->channel_id); if (CChannelLogo->hasLogo()) { + CChannelLogo->doScale(theight < CChannelLogo->getHeight()); CChannelLogo->setXPos(x + full_width - logo_off - CChannelLogo->getWidth()); CChannelLogo->setYPos(y + (theight - CChannelLogo->getHeight()) / 2); CChannelLogo->paint(); From 8929255e9e12e1de9f4e82c267a6bf94947597ba Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 30 Oct 2014 12:02:04 +0100 Subject: [PATCH 16/98] CComponentsPicture: don't paint image, if is not available --- src/gui/components/cc_item_picture.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/components/cc_item_picture.cpp b/src/gui/components/cc_item_picture.cpp index 37c0daea2..4b755a443 100644 --- a/src/gui/components/cc_item_picture.cpp +++ b/src/gui/components/cc_item_picture.cpp @@ -109,7 +109,7 @@ void CComponentsPicture::setPicture(const char* picture_name) void CComponentsPicture::initCCItem() { if (pic_name.empty()){ - dprintf(DEBUG_NORMAL, "[CComponentsPicture] %s: no image file assigned...\n", __func__); + dprintf(DEBUG_INFO, "[CComponentsPicture] %s - %d : no image file assigned...\n", __func__, __LINE__); return; } @@ -193,6 +193,8 @@ void CComponentsPicture::paintPicture() void CComponentsPicture::paint(bool do_save_bg) { + if (pic_name.empty()) + return; paintInit(do_save_bg); paintPicture(); } From c7a40bb6dcff7a7713ec38c6aae2a6746fc14901 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 4 Nov 2014 19:42:03 +0100 Subject: [PATCH 17/98] gui/Makefile.am: add conclusive description with last tag and branch --- src/gui/Makefile.am | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui/Makefile.am b/src/gui/Makefile.am index 0930ca12b..e4f4cf2a8 100644 --- a/src/gui/Makefile.am +++ b/src/gui/Makefile.am @@ -6,9 +6,10 @@ version.h: echo '#define BUILT_DATE "'`date`'"' > $@ @if test -d $(top_srcdir)/.git ; then \ pushd $(top_srcdir) ; \ - GITDESCRIBE=$$(git describe --always --dirty || echo 'VCS failed') ; \ + GITBRANCH=$$(git rev-parse --abbrev-ref HEAD) ; \ + GITDESCRIBE=$$(git describe --always --tags --dirty || echo 'VCS failed') ; \ popd ; \ - echo '#define VCS "'$${GITDESCRIBE}'"' >> $@ ; \ + echo '#define VCS "'$${GITDESCRIBE} [$${GITBRANCH}]'"' >> $@ ; \ fi noinst_HEADERS = version.h .PHONY: version.h From 66e5f03c92d45e18252f9f882ab6f8884636e90b Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 30 Oct 2014 09:58:27 +0100 Subject: [PATCH 18/98] CComponentsButton: use unified body colors in gradient mode Some theme controlled colors don't really looks nice in some combinations with window backgrounds. --- src/gui/components/cc_frm_button.cpp | 8 ++++---- src/gui/components/cc_frm_button.h | 28 ++++++++++++++++------------ 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/gui/components/cc_frm_button.cpp b/src/gui/components/cc_frm_button.cpp index b1f87af8b..6462f9cf0 100644 --- a/src/gui/components/cc_frm_button.cpp +++ b/src/gui/components/cc_frm_button.cpp @@ -106,17 +106,17 @@ void CComponentsButton::initVarButton( const int& x_pos, const int& y_pos, const col_shadow = color_shadow; col_body_gradient = g_settings.gradiant; - setColBodyGradient(CColorGradient::gradientDark2Light2Dark, CFrameBuffer::gradientVertical, CColorGradient::light); + setColBodyGradient(CColorGradient::gradientLight2Dark, CFrameBuffer::gradientVertical, CColorGradient::light); cc_item_enabled = enabled; cc_item_selected = selected; fr_thickness = 3; append_x_offset = 6; append_y_offset = 0; - corner_rad = RADIUS_MID; + corner_rad = 0; - cc_btn_capt_col = COL_INFOBAR_SHADOW_TEXT; - cc_btn_capt_disable_col = COL_MENUCONTENTINACTIVE_TEXT; + cc_btn_capt_col = col_body_gradient ? COL_BUTTON_TEXT_ENABLED : COL_INFOBAR_SHADOW_TEXT; + cc_btn_capt_disable_col = col_body_gradient ? COL_BUTTON_TEXT_DISABLED : COL_MENUCONTENTINACTIVE_TEXT; cc_btn_icon_obj = NULL; cc_btn_capt_obj = NULL; cc_btn_dy_font = CNeutrinoFonts::getInstance(); diff --git a/src/gui/components/cc_frm_button.h b/src/gui/components/cc_frm_button.h index aabfb8932..cfead2d37 100644 --- a/src/gui/components/cc_frm_button.h +++ b/src/gui/components/cc_frm_button.h @@ -35,6 +35,10 @@ #include #include +#define COL_BUTTON_BODY COL_DARK_GRAY +#define COL_BUTTON_TEXT_ENABLED COL_BLACK +#define COL_BUTTON_TEXT_DISABLED COL_LIGHT_GRAY + //! Sub class of CComponentsForm. /*! Shows a button box with caption and optional icon. @@ -98,7 +102,7 @@ class CComponentsButton : public CComponentsFrmChain bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, - fb_pixel_t color_frame = COL_DARK_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); + fb_pixel_t color_frame = COL_DARK_GRAY, fb_pixel_t color_body = COL_BUTTON_BODY, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); CComponentsButton( const int& x_pos, const int& y_pos, const int& w, const int& h, const neutrino_locale_t& caption_locale, @@ -107,7 +111,7 @@ class CComponentsButton : public CComponentsFrmChain bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, - fb_pixel_t color_frame = COL_DARK_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); + fb_pixel_t color_frame = COL_DARK_GRAY, fb_pixel_t color_body = COL_BUTTON_BODY, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); CComponentsButton( const int& x_pos, const int& y_pos, const int& w, const int& h, const neutrino_locale_t& caption_locale, @@ -116,7 +120,7 @@ class CComponentsButton : public CComponentsFrmChain bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, - fb_pixel_t color_frame = COL_DARK_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); + fb_pixel_t color_frame = COL_DARK_GRAY, fb_pixel_t color_body = COL_BUTTON_BODY, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); CComponentsButton( const int& x_pos, const int& y_pos, const int& w, const int& h, const std::string& caption, @@ -125,7 +129,7 @@ class CComponentsButton : public CComponentsFrmChain bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, - fb_pixel_t color_frame = COL_DARK_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); + fb_pixel_t color_frame = COL_DARK_GRAY, fb_pixel_t color_body = COL_BUTTON_BODY, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); ///set text color virtual void setButtonTextColor(fb_pixel_t text_color, fb_pixel_t text_color_disabled = COL_MENUCONTENTINACTIVE_TEXT){cc_btn_capt_col = text_color; cc_btn_capt_disable_col = text_color_disabled;} @@ -178,7 +182,7 @@ class CComponentsButtonRed : public CComponentsButton bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, - fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0) + fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_BUTTON_BODY, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0) :CComponentsButton(x_pos, y_pos, w, h, caption, NEUTRINO_ICON_BUTTON_RED, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow) { cc_item_type = CC_ITEMTYPE_BUTTON_RED; @@ -189,7 +193,7 @@ class CComponentsButtonRed : public CComponentsButton bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, - fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0) + fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_BUTTON_BODY, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0) :CComponentsButton(x_pos, y_pos, w, h, caption_locale, NEUTRINO_ICON_BUTTON_RED, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow) { cc_item_type = CC_ITEMTYPE_BUTTON_RED; @@ -209,7 +213,7 @@ class CComponentsButtonGreen : public CComponentsButton bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, - fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0) + fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_BUTTON_BODY, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0) :CComponentsButton(x_pos, y_pos, w, h, caption, NEUTRINO_ICON_BUTTON_GREEN, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow) { cc_item_type = CC_ITEMTYPE_BUTTON_GREEN; @@ -220,7 +224,7 @@ class CComponentsButtonGreen : public CComponentsButton bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, - fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0) + fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_BUTTON_BODY, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0) :CComponentsButton(x_pos, y_pos, w, h, caption_locale, NEUTRINO_ICON_BUTTON_GREEN, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow) { cc_item_type = CC_ITEMTYPE_BUTTON_GREEN; @@ -240,7 +244,7 @@ class CComponentsButtonYellow : public CComponentsButton bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, - fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0) + fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_BUTTON_BODY, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0) :CComponentsButton(x_pos, y_pos, w, h, caption, NEUTRINO_ICON_BUTTON_YELLOW, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow) { cc_item_type = CC_ITEMTYPE_BUTTON_YELLOW; @@ -251,7 +255,7 @@ class CComponentsButtonYellow : public CComponentsButton bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, - fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0) + fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_BUTTON_BODY, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0) :CComponentsButton(x_pos, y_pos, w, h, caption_locale, NEUTRINO_ICON_BUTTON_YELLOW, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow) { cc_item_type = CC_ITEMTYPE_BUTTON_YELLOW; @@ -271,7 +275,7 @@ class CComponentsButtonBlue : public CComponentsButton bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, - fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0) + fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_BUTTON_BODY, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0) :CComponentsButton(x_pos, y_pos, w, h, caption, NEUTRINO_ICON_BUTTON_BLUE, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow) { cc_item_type = CC_ITEMTYPE_BUTTON_BLUE; @@ -282,7 +286,7 @@ class CComponentsButtonBlue : public CComponentsButton bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, - fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0) + fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_BUTTON_BODY, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0) :CComponentsButton(x_pos, y_pos, w, h, caption_locale, NEUTRINO_ICON_BUTTON_BLUE, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow) { cc_item_type = CC_ITEMTYPE_BUTTON_BLUE; From bee35e9042555dcd42dcd65ea1d572739ec093c2 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 6 Nov 2014 16:14:01 +0100 Subject: [PATCH 19/98] CMovieBrowser: fix unintended upscaling of channellogo Upscale is not allowed and do down scale only if header height is too small. --- src/gui/moviebrowser.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/moviebrowser.cpp b/src/gui/moviebrowser.cpp index 02612682d..2d8f6fd33 100644 --- a/src/gui/moviebrowser.cpp +++ b/src/gui/moviebrowser.cpp @@ -1267,6 +1267,7 @@ void CMovieBrowser::refreshMovieInfo(void) if (CChannelLogo && CChannelLogo->hasLogo()) { lx = m_cBoxFrame.iX+m_cBoxFrameTitleRel.iX+m_cBoxFrameTitleRel.iWidth-CChannelLogo->getWidth()-10; ly = m_cBoxFrameTitleRel.iY+m_cBoxFrame.iY+ (m_cBoxFrameTitleRel.iHeight-CChannelLogo->getHeight())/2; + CChannelLogo->doScale(m_cBoxFrameTitleRel.iHeight < CChannelLogo->getHeight()); CChannelLogo->setXPos(lx - pb_hdd_offset); CChannelLogo->setYPos(ly); CChannelLogo->paint(); From 8a1965fcca6974dcdf6e4707e3db18a81cfaf7c8 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 6 Nov 2014 17:02:00 +0100 Subject: [PATCH 20/98] CVolumeBar: fix icon postion Icon was not centered in y position. --- src/gui/volumebar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/volumebar.cpp b/src/gui/volumebar.cpp index bed085121..b1445c5b2 100644 --- a/src/gui/volumebar.cpp +++ b/src/gui/volumebar.cpp @@ -173,7 +173,7 @@ void CVolumeBar::initVolumeBarItems() //init current icon object void CVolumeBar::initVolumeBarIcon() { - vb_icon = new CComponentsPicture(vb_icon_x, 0, vb_icon_w, height, NEUTRINO_ICON_VOLUME); + vb_icon = new CComponentsPicture(vb_icon_x, CC_CENTERED, vb_icon_w, height, NEUTRINO_ICON_VOLUME); vb_icon->setColorBody(col_body); vb_icon->setCorner(cornerRad(), CORNER_LEFT); From 7ec096fa3d9bbbccd08a31133f7eb9a4df21c187 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 6 Nov 2014 21:22:39 +0100 Subject: [PATCH 21/98] CComponentsFooter: add optional possibility to switch colored button frame --- src/gui/components/cc_frm_footer.cpp | 22 ++++++++++++++-------- src/gui/components/cc_frm_footer.h | 5 +++++ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/gui/components/cc_frm_footer.cpp b/src/gui/components/cc_frm_footer.cpp index 87687b29e..6cac356f6 100644 --- a/src/gui/components/cc_frm_footer.cpp +++ b/src/gui/components/cc_frm_footer.cpp @@ -77,6 +77,7 @@ void CComponentsFooter::initVarFooter( const int& x_pos, const int& y_pos, const col_body = color_body; col_shadow = color_shadow; col_body_gradient = false; + btn_auto_frame_col = false; corner_rad = RADIUS_LARGE; corner_type = CORNER_BOTTOM; @@ -146,14 +147,19 @@ void CComponentsFooter::setButtonLabels(const struct button_label_s * const cont btn->setButtonResult(content[i].btn_result); btn->setButtonAlias(content[i].btn_alias); - if (btn_name == NEUTRINO_ICON_BUTTON_RED) - btn->setColorFrame(COL_DARK_RED); - if (btn_name == NEUTRINO_ICON_BUTTON_GREEN) - btn->setColorFrame(COL_DARK_GREEN); - if (btn_name == NEUTRINO_ICON_BUTTON_YELLOW) - btn->setColorFrame(COL_OLIVE); - if (btn_name == NEUTRINO_ICON_BUTTON_BLUE) - btn->setColorFrame(COL_DARK_BLUE); + //set button frames to icon color, predefined for available color buttons + if (btn_auto_frame_col){ + fb_pixel_t f_col = btn->getColorFrame(); + if (btn_name == NEUTRINO_ICON_BUTTON_RED) + f_col = COL_DARK_RED; + if (btn_name == NEUTRINO_ICON_BUTTON_GREEN) + f_col = COL_DARK_GREEN; + if (btn_name == NEUTRINO_ICON_BUTTON_YELLOW) + f_col = COL_OLIVE; + if (btn_name == NEUTRINO_ICON_BUTTON_BLUE) + f_col = COL_DARK_BLUE; + btn->setColorFrame(f_col); + } chain->addCCItem(btn); diff --git a/src/gui/components/cc_frm_footer.h b/src/gui/components/cc_frm_footer.h index 2606a1cca..3f2b6cb5b 100644 --- a/src/gui/components/cc_frm_footer.h +++ b/src/gui/components/cc_frm_footer.h @@ -69,6 +69,8 @@ class CComponentsFooter : public CComponentsHeader ///show button frame and background, default false bool btn_contour; + ///enable/disable button frame in icon color, predefined for red, green, yellow and blue, default disabled + bool btn_auto_frame_col; ///property: set font for label caption, see also setButtonFont() Font* ccf_btn_font; @@ -95,6 +97,9 @@ class CComponentsFooter : public CComponentsHeader ///add button labels with string label type as content, parameter 1 as vector, chain_width as int, label width as int void setButtonLabels(const std::vectorv_content, const int& chain_width, const int& label_width); + ///enable/disable button frame in icon color, predefined for red, green, yellow and blue + inline void enableButtonFrameColor(bool enable = true){btn_auto_frame_col = enable;} + ///add button labels with old label type, count as size_t, chain_width as int, label width as int ///NOTE: for compatibility with older button handler find in gui/widget/buttons.h, if possible, don't use this void setButtonLabels(const struct button_label * const content, const size_t& label_count, const int& chain_width = 0, const int& label_width = 0); From 0f8c1829d82b2ba85a2f5d7494443987883dcb04 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 1 Nov 2014 17:18:42 +0100 Subject: [PATCH 22/98] CComponentsFooter: fix button view with gradient show contour only in gradient mode --- src/gui/components/cc_frm_footer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/components/cc_frm_footer.cpp b/src/gui/components/cc_frm_footer.cpp index 6cac356f6..3d02f61c6 100644 --- a/src/gui/components/cc_frm_footer.cpp +++ b/src/gui/components/cc_frm_footer.cpp @@ -82,7 +82,7 @@ void CComponentsFooter::initVarFooter( const int& x_pos, const int& y_pos, const corner_rad = RADIUS_LARGE; corner_type = CORNER_BOTTOM; - btn_contour = false; + btn_contour = g_settings.gradiant; ccf_btn_font = NULL; chain = NULL; From 52f7c79db8585bdcac6789bb187f6e8c239fd3bc Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 7 Nov 2014 23:37:51 +0100 Subject: [PATCH 23/98] CComponentsForm: fix init value of getPageCount() value is always 1 --- src/gui/components/cc_frm.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/components/cc_frm.cpp b/src/gui/components/cc_frm.cpp index 9237050b1..cf40cc7d1 100644 --- a/src/gui/components/cc_frm.cpp +++ b/src/gui/components/cc_frm.cpp @@ -549,14 +549,14 @@ void CComponentsForm::setPageCount(const u_int8_t& pageCount) u_int8_t CComponentsForm::getPageCount() { - u_int8_t num = 0; + u_int8_t num = 1; for(size_t i=0; igetPageNumber(); num = max(item_num, num); } //convert type, possible -Wconversion warnings! - page_count = static_cast(num + 1); + page_count = static_cast(num); return page_count; } From d4f466d595d0ca6356eea35bb8814530fdebb98f Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 8 Nov 2014 00:33:21 +0100 Subject: [PATCH 24/98] CNeutrinoEventList: rework paint of header Reduce code with chain form and use text and logo items as embedded items. --- src/gui/eventlist.cpp | 59 +++++++++++-------------------------------- 1 file changed, 15 insertions(+), 44 deletions(-) diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index 1bac43dd7..35f4cde60 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -850,71 +850,42 @@ void CNeutrinoEventList::paintDescription(int index) void CNeutrinoEventList::paintHead(t_channel_id _channel_id, std::string _channelname, std::string _channelname_prev, std::string _channelname_next) { - CComponentsHeader* header = NULL; - CComponentsChannelLogo* midLogo = NULL; - CComponentsText* midText = NULL; - CComponentsText* lText = NULL; - CComponentsText* rText = NULL; - int font_mid = SNeutrinoSettings::FONT_TYPE_EVENTLIST_TITLE; int font_lr = SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMLARGE; - header = new CComponentsHeader(x, y, full_width, theight); - header->paint(CC_SAVE_SCREEN_NO); + CComponentsFrmChain header(x, y, full_width, theight); + header.enableColBodyGradient(g_settings.gradiant); + header.setCorner(RADIUS_LARGE, CORNER_TOP); - int logo_w_max = full_width / 4; - int name_w = 0; int x_off = 10; - int y_off = std::max((theight - g_Font[font_lr]->getHeight()) / 2, 0); - int x_pos = x; - int y_pos = y; - int mid_width = full_width * 40 / 100; // 40% - int side_width = ((full_width - mid_width) / 2) - (2 * x_off); + int mid_width = header.getWidth() * 40 / 100; // 40% + int side_width = ((header.getWidth() - mid_width) / 2) - (2 * x_off); - midLogo = new CComponentsChannelLogo(0, 0, logo_w_max, theight, _channelname, _channel_id); + CComponentsChannelLogo* midLogo = new CComponentsChannelLogo(CC_CENTERED, CC_CENTERED, _channelname, _channel_id); if (midLogo->hasLogo()) { - int logo_w = midLogo->getWidth(); - midLogo->setXPos(x + (full_width - logo_w) / 2); - midLogo->setYPos(y + (theight - midLogo->getHeight()) / 2); - midLogo->paint(); + header.addCCItem(midLogo); // recalc widths - mid_width = logo_w; - side_width = ((full_width - mid_width) / 2) - (4 * x_off); + side_width = ((full_width - midLogo->getWidth()) / 2) - (4 * x_off); } else { - name_w = g_Font[font_mid]->getRenderWidth(_channelname); - x_pos = x + (full_width - std::min(name_w, mid_width))/2; - y_pos = y; - midText = new CComponentsText(x_pos, y_pos, mid_width, theight, _channelname, CTextBox::NO_AUTO_LINEBREAK, g_Font[font_mid]); + delete midLogo; + CComponentsText *midText = new CComponentsText(CC_CENTERED, CC_CENTERED, mid_width, theight, _channelname, CTextBox::CENTER, g_Font[font_mid], &header, CC_SHADOW_OFF, COL_MENUHEAD_TEXT); midText->doPaintBg(false); - midText->setTextColor(COL_MENUHEAD_TEXT); - midText->paint(CC_SAVE_SCREEN_NO); } if (!_channelname_prev.empty()) { - x_pos = x + x_off; - y_pos = y + y_off; - lText = new CComponentsText(x_pos, y_pos, side_width, theight, _channelname_prev, CTextBox::NO_AUTO_LINEBREAK, g_Font[font_lr]); + CComponentsText *lText = new CComponentsText(x_off, CC_CENTERED, side_width, theight, _channelname_prev, CTextBox::NO_AUTO_LINEBREAK, g_Font[font_lr], &header, CC_SHADOW_OFF, COL_MENUHEAD_TEXT); lText->doPaintBg(false); - lText->setTextColor(COL_MENUHEAD_TEXT); - lText->paint(CC_SAVE_SCREEN_NO); } if (!_channelname_next.empty()) { - name_w = g_Font[font_lr]->getRenderWidth(_channelname_next); - x_pos = x + full_width - std::min(name_w, side_width) - x_off; - y_pos = y + y_off; - rText = new CComponentsText(x_pos, y_pos, std::min(name_w, side_width), theight, _channelname_next, CTextBox::NO_AUTO_LINEBREAK, g_Font[font_lr]); + int name_w = std::min(g_Font[font_lr]->getRenderWidth(_channelname_next), side_width); + int x_pos = header.getWidth() - name_w - x_off; + CComponentsText *rText = new CComponentsText(x_pos, CC_CENTERED, name_w, theight, _channelname_next, CTextBox::NO_AUTO_LINEBREAK, g_Font[font_lr], &header, CC_SHADOW_OFF, COL_MENUHEAD_TEXT); rText->doPaintBg(false); - rText->setTextColor(COL_MENUHEAD_TEXT); - rText->paint(CC_SAVE_SCREEN_NO); } - if (rText) delete rText; - if (lText) delete lText; - if (midText) delete midText; - if (midLogo) delete midLogo; - if (header) delete header; + header.paint(CC_SAVE_SCREEN_NO); } void CNeutrinoEventList::paint(t_channel_id channel_id) From d72603665c547ff7d4e2deab1735bbfb90c0a780 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 14 Nov 2014 23:38:52 +0100 Subject: [PATCH 25/98] CComponentsForm: prevent wrong id parameter if item size out of range --- src/gui/components/cc_frm.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gui/components/cc_frm.cpp b/src/gui/components/cc_frm.cpp index cf40cc7d1..3c5c76113 100644 --- a/src/gui/components/cc_frm.cpp +++ b/src/gui/components/cc_frm.cpp @@ -250,6 +250,11 @@ int CComponentsForm::genIndex() CComponentsItem* CComponentsForm::getCCItem(const uint& cc_item_id) { + if (cc_item_id >= size()){ + dprintf(DEBUG_NORMAL, "[CComponentsForm] [%s - %d] Error: parameter cc_item_id = %u, out of range (size = %u)...\n", __func__, __LINE__, cc_item_id, size()); + return NULL; + } + if (v_cc_items[cc_item_id]) return v_cc_items[cc_item_id]; return NULL; From 9491d72edd56cb37af0cd564fbe12f43e5a7c30d Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 23 Nov 2014 17:19:27 +0100 Subject: [PATCH 26/98] neutrino.cpp: use simple error message for zapit fail --- src/neutrino.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index c59e2e750..6f988d5c5 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -1947,9 +1947,7 @@ TIMER_START(); /* later on, we'll crash anyway, so tell about it. */ if (! zapit_init) - ShowMsg(LOCALE_MESSAGEBOX_INFO, - "Zapit initialization failed.\nThis is a fatal error, sorry.", - CMessageBox::mbrBack, CMessageBox::mbBack); + DisplayErrorMessage("Zapit initialization failed. This is a fatal error, sorry."); InitZapitClient(); g_Zapit->setStandby(false); From 6fc8d1bb9feb3d89247e69c161cec070cdd06a39 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 24 Nov 2014 01:01:33 +0100 Subject: [PATCH 27/98] system/helpers.cpp: add more possible exexutable paths --- src/system/helpers.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp index b8dff1eec..20b0496cc 100644 --- a/src/system/helpers.cpp +++ b/src/system/helpers.cpp @@ -340,7 +340,7 @@ std::string find_executable(const char *name) if (tmpPath) path = strdupa(tmpPath); else - path = strdupa("/bin:/usr/bin:/sbin:/usr/sbin"); + path = strdupa("/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin"); if (name[0] == '/') { /* full path given */ if (!access(name, X_OK) && !stat(name, &s) && S_ISREG(s.st_mode)) return std::string(name); From 8ebb5f98ca9ebac8e64992846a4df00814957a76 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 30 Nov 2014 00:07:21 +0100 Subject: [PATCH 28/98] CComponentsItem: add setXPos/setYPos(), that consider real position --- src/gui/components/cc_base.h | 6 +++++- src/gui/components/cc_item.cpp | 18 ++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/gui/components/cc_base.h b/src/gui/components/cc_base.h index 35d3e9437..3618b2581 100644 --- a/src/gui/components/cc_base.h +++ b/src/gui/components/cc_base.h @@ -251,7 +251,7 @@ class CComponents : public CComponentsSignals, public COSDFader ///allow/disalows paint of item and its contents, but initialize of other properties are not touched ///this can be understood as a counterpart to isPainted(), but before paint and value of is_painted is modified temporarily till next paint of item //TODO: is this sufficiently? - virtual void allowPaint(bool allow){cc_allow_paint = allow; is_painted = cc_allow_paint ? false : true;}; + void allowPaint(bool allow){cc_allow_paint = allow; is_painted = cc_allow_paint ? false : true;}; ///returns visibility mode virtual bool paintAllowed(){return cc_allow_paint;}; @@ -346,6 +346,10 @@ class CComponentsItem : public CComponents ///returns current number of page location of current item, see: cc_page_number virtual u_int8_t getPageNumber(){return cc_page_number;}; + ///set screen x-position, parameter as int + virtual void setXPos(const int& xpos); + ///set screen y-position, parameter as int + virtual void setYPos(const int& ypos); ///set screen x-position, parameter as uint8_t, percent x value related to current width of parent form or screen virtual void setXPosP(const uint8_t& xpos_percent); ///set screen y-position, parameter as uint8_t, percent y value related to current height of parent form or screen diff --git a/src/gui/components/cc_item.cpp b/src/gui/components/cc_item.cpp index 4f61cd47a..f89406d03 100644 --- a/src/gui/components/cc_item.cpp +++ b/src/gui/components/cc_item.cpp @@ -194,16 +194,30 @@ bool CComponentsItem::isAdded() return false; } +inline void CComponentsItem::setXPos(const int& xpos) +{ + x = xpos; + if (cc_parent) + setRealXPos(cc_parent->getRealXPos() + x); +} + +inline void CComponentsItem::setYPos(const int& ypos) +{ + y = ypos; + if (cc_parent) + setRealYPos(cc_parent->getRealYPos() + y); +} + void CComponentsItem::setXPosP(const uint8_t& xpos_percent) { int x_tmp = cc_parent ? xpos_percent*cc_parent->getWidth() : xpos_percent*frameBuffer->getScreenWidth(); - x = x_tmp/100; + setXPos(x_tmp/100); } void CComponentsItem::setYPosP(const uint8_t& ypos_percent) { int y_tmp = cc_parent ? ypos_percent*cc_parent->getHeight() : ypos_percent*frameBuffer->getScreenHeight(); - x = y_tmp/100; + setYPos(y_tmp/100); } void CComponentsItem::setPosP(const uint8_t& xpos_percent, const uint8_t& ypos_percent) From 663c7deef2e5a64215cb73258919500bb88e3faf Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 30 Nov 2014 00:12:15 +0100 Subject: [PATCH 29/98] CProgressBar: add missing assign of 'allow paint' property Property had no effect. --- src/gui/components/cc_item_progressbar.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/gui/components/cc_item_progressbar.cpp b/src/gui/components/cc_item_progressbar.cpp index 47db76b46..aa9dbf0fb 100644 --- a/src/gui/components/cc_item_progressbar.cpp +++ b/src/gui/components/cc_item_progressbar.cpp @@ -422,11 +422,14 @@ void CProgressBar::paintProgress(bool do_save_bg) //progress bool pb_invert = (pb_type == PB_REDRIGHT) || ((pb_type == PB_TIMESCALE) && g_settings.progressbar_timescale_invert); - if (pb_active_width != pb_last_width) { - CProgressBarCache *pbc = CProgressBarCache::lookup(pb_height, pb_max_width, pb_active_col, pb_passive_col, *pb_design, pb_invert, *pb_gradient, pb_red, pb_yellow, pb_green); - if (pbc) - pbc->paint(pb_x, pb_y, pb_active_width, pb_passive_width); - is_painted = true; + + if (cc_allow_paint){ + if (pb_active_width != pb_last_width) { + CProgressBarCache *pbc = CProgressBarCache::lookup(pb_height, pb_max_width, pb_active_col, pb_passive_col, *pb_design, pb_invert, *pb_gradient, pb_red, pb_yellow, pb_green); + if (pbc) + pbc->paint(pb_x, pb_y, pb_active_width, pb_passive_width); + is_painted = true; + } } if (is_painted) From 7e084c2531423aa03969cbd706d315c6284a0975 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 30 Nov 2014 00:21:46 +0100 Subject: [PATCH 30/98] CProgressWindow: add member showStatus() This displays only one progress bar instead two and shows the global status. That's senseful , if only one progress bar is required. --- src/gui/widget/progresswindow.cpp | 17 +++++++++++++++++ src/gui/widget/progresswindow.h | 9 +++++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/gui/widget/progresswindow.cpp b/src/gui/widget/progresswindow.cpp index 7ae089877..9bbb4670d 100644 --- a/src/gui/widget/progresswindow.cpp +++ b/src/gui/widget/progresswindow.cpp @@ -62,6 +62,7 @@ void CProgressWindow::Init() //create local_bar object local_bar = new CProgressBar(); + local_bar->allowPaint(false); local_bar->setDimensionsAll(x_item, y_item, w_item, h_pbar); local_bar->setColorBody(col_body); local_bar->setActiveColor(COL_MENUCONTENT_PLUS_7); @@ -72,6 +73,7 @@ void CProgressWindow::Init() //create global_bar object global_bar = new CProgressBar(); + global_bar->allowPaint(false); global_bar->setDimensionsAll(x_item, y_item, w_item, h_pbar); global_bar->setColorBody(col_body); global_bar->setActiveColor(COL_MENUCONTENT_PLUS_7); @@ -94,12 +96,26 @@ void CProgressWindow::setTitle(const neutrino_locale_t title) #endif // VFD_UPDATE } +void CProgressWindow::showStatus(const unsigned int prog) +{ + if (global_progress == prog) + return; + + if (!global_bar->isPainted()){ + int g_height = global_bar->getHeight(); + global_bar->setYPos(local_bar->getYPos() + g_height/2); + global_bar->setHeight(g_height + g_height/2); + } + + showGlobalStatus(prog); +} void CProgressWindow::showGlobalStatus(const unsigned int prog) { if (global_progress == prog) return; + global_bar->allowPaint(true); global_progress = prog; global_bar->setValues(prog, 100); global_bar->paint(false); @@ -114,6 +130,7 @@ void CProgressWindow::showLocalStatus(const unsigned int prog) if (local_progress == prog) return; + local_bar->allowPaint(true); local_progress = prog; local_bar->setValues(prog, 100); local_bar->paint(false); diff --git a/src/gui/widget/progresswindow.h b/src/gui/widget/progresswindow.h index 42cbbf32a..6901cb79b 100644 --- a/src/gui/widget/progresswindow.h +++ b/src/gui/widget/progresswindow.h @@ -48,10 +48,11 @@ class CProgressWindow : public CComponentsWindow, public CMenuTarget virtual int exec( CMenuTarget* parent, const std::string & actionKey ); - virtual void showGlobalStatus(const unsigned int prog); - virtual unsigned int getGlobalStatus(void); - virtual void showLocalStatus(const unsigned int prog); - virtual void showStatusMessageUTF(const std::string & text); // UTF-8 + void showStatus(const unsigned int prog); + void showGlobalStatus(const unsigned int prog); + unsigned int getGlobalStatus(void); + void showLocalStatus(const unsigned int prog); + void showStatusMessageUTF(const std::string & text); // UTF-8 }; From c2a12994384e3f5db84df07e752bb5edab1ed369 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 30 Nov 2014 00:26:01 +0100 Subject: [PATCH 31/98] CAudioPlayerGui: replace showGlobalStatus() with showStatus() --- src/gui/audioplayer.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index 816abbb40..cd08238fa 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -1141,7 +1141,7 @@ void CAudioPlayerGui::scanXmlData(xmlDocPtr answer_parser, const char *nametag, listPos++; // show status int global = 100*listPos / maxProgress; - progress.showGlobalStatus(global); + progress.showStatus(global); #ifdef LCD_UPDATE CVFD::getInstance()->showProgressBar(global, "read xmldata..."); CVFD::getInstance()->setMode(CVFD::MODE_PROGRESSBAR); @@ -1237,7 +1237,7 @@ bool CAudioPlayerGui::openFilebrowser(void) currentProgress++; // show status int global = 100*currentProgress/maxProgress; - progress.showGlobalStatus(global); + progress.showStatus(global); progress.showStatusMessageUTF(files->Name); #ifdef LCD_UPDATE CVFD::getInstance()->showProgressBar(global, "read metadata..."); @@ -1431,7 +1431,7 @@ bool CAudioPlayerGui::openSCbrowser(void) currentProgress++; // show progress int global = 100*currentProgress/maxProgress; - progress.showGlobalStatus(global); + progress.showStatus(global); progress.showStatusMessageUTF(files->Name); #ifdef LCD_UPDATE CVFD::getInstance()->showProgressBar(global, "read metadata..."); @@ -2502,7 +2502,7 @@ void CAudioPlayerGui::buildSearchTree() it!=m_playlist.end(); ++it) { listPos++; - progress.showGlobalStatus(100*listPos / maxProgress); + progress.showStatus(100*listPos / maxProgress); progress.showStatusMessageUTF(it->Filename); unsigned char firstChar = getFirstChar(*it); const std::pair item = From 930b40588c702002d9b32f4b5b56d26d14121bb8 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 5 Dec 2014 23:05:29 +0100 Subject: [PATCH 32/98] CMenuWidget: fix getSelected() member preselected was not suitable as return value --- src/gui/widget/menue.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widget/menue.h b/src/gui/widget/menue.h index 74fd2051e..4ff9d50df 100644 --- a/src/gui/widget/menue.h +++ b/src/gui/widget/menue.h @@ -569,7 +569,7 @@ class CMenuWidget : public CMenuTarget virtual int exec(CMenuTarget* parent, const std::string & actionKey); virtual const char *getName(); virtual void integratePlugins(CPlugins::i_type_t integration, const unsigned int shortcut=CRCInput::RC_nokey); - void setSelected(const int &Preselected){ preselected = Preselected; }; + void setSelected(const int &Preselected){ selected = Preselected; }; int getSelected()const { return selected; }; void move(int xoff, int yoff); int getSelectedLine(void)const {return exit_pressed ? -1 : selected;}; From d58679f42ddec6becae1c21b51e3b6f2a21a8075 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 8 Dec 2014 11:58:31 +0100 Subject: [PATCH 33/98] CEitManager: use unified binary search for ntp --- src/eitd/sectionsd.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/eitd/sectionsd.cpp b/src/eitd/sectionsd.cpp index 7af727702..dedd55092 100644 --- a/src/eitd/sectionsd.cpp +++ b/src/eitd/sectionsd.cpp @@ -100,7 +100,7 @@ static bool messaging_zap_detected = false; //NTP-Config #define CONF_FILE CONFIGDIR "/neutrino.conf" -std::string ntp_system_cmd_prefix = "/sbin/ntpdate "; +std::string ntp_system_cmd_prefix = find_executable("ntpdate") + " "; std::string ntp_system_cmd; std::string ntpserver; @@ -2147,8 +2147,16 @@ bool CEitManager::Start() max_events = config.epg_max_events; epg_save_frequently = config.epg_save_frequently; - if (find_executable("ntpdate").empty()) - ntp_system_cmd_prefix = "ntpd -n -q -p "; + if (find_executable("ntpdate").empty()){ + ntp_system_cmd_prefix = find_executable("ntpd"); + if (!ntp_system_cmd_prefix.empty()){ + ntp_system_cmd_prefix += " -n -q -p "; + } + else{ + printf("[sectionsd] NTP Error: time sync not possible, ntpdate/ntpd not found\n"); + ntpenable = false; + } + } printf("[sectionsd] Caching: %d days, %d hours Extended Text, max %d events, Events are old %d hours after end time\n", config.epg_cache, config.epg_extendedcache, config.epg_max_events, config.epg_old_events); From d3f9aa33f76ef019006c9c15b28b5d2bb56f25a1 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 8 Dec 2014 12:23:07 +0100 Subject: [PATCH 34/98] CMenuWidget: move include of neutrino_menue.h to menue.h makes explicit include unnecessary if it is needed by a widget, eg: widget id's are parameter of constructor and is one of required widget elements. --- src/gui/widget/menue.cpp | 2 +- src/gui/widget/menue.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 9d06a0b44..c6e0991c9 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -38,7 +38,7 @@ #include #include -#include + #include #include #include diff --git a/src/gui/widget/menue.h b/src/gui/widget/menue.h index 4ff9d50df..b00079e0e 100644 --- a/src/gui/widget/menue.h +++ b/src/gui/widget/menue.h @@ -46,6 +46,7 @@ #include #include #include +#include extern "C" { #include #include From 3599a4246f17dbe0229da3019ce4fee21d5b7036 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 8 Dec 2014 12:24:08 +0100 Subject: [PATCH 35/98] CNetworkServiceSetup: use widget id instead explicit select method neutrino_menue.h: add ID for network service menue --- src/gui/network_service.cpp | 6 +++--- src/neutrino_menue.h | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/gui/network_service.cpp b/src/gui/network_service.cpp index d7a0ed648..dcfc50111 100644 --- a/src/gui/network_service.cpp +++ b/src/gui/network_service.cpp @@ -140,8 +140,8 @@ int CNetworkServiceSetup::showNetworkServiceSetup() { int shortcut = 1; - CMenuWidget* setup = new CMenuWidget(LOCALE_MAINSETTINGS_NETWORK, NEUTRINO_ICON_SETTINGS, width); - setup->setSelected(selected); + CMenuWidget* setup = new CMenuWidget(LOCALE_MAINSETTINGS_NETWORK, NEUTRINO_ICON_SETTINGS, width, MN_WIDGET_ID_NETWORKSETUP_SERVICES); + setup->addIntroItems(LOCALE_NETWORKMENU_SERVICES); CNetworkService * items[SERVICE_COUNT]; @@ -194,7 +194,7 @@ int CNetworkServiceSetup::showNetworkServiceSetup() } int res = setup->exec (NULL, ""); - selected = setup->getSelected(); + delete setup; for(unsigned i = 0; i < SERVICE_COUNT; i++) diff --git a/src/neutrino_menue.h b/src/neutrino_menue.h index cb261abab..1318d7402 100644 --- a/src/neutrino_menue.h +++ b/src/neutrino_menue.h @@ -185,6 +185,9 @@ enum MN_WIDGET_ID MN_WIDGET_ID_TESTMENU_HARDWARE, MN_WIDGET_ID_TESTMENU_COMPONENTS, + //network services + MN_WIDGET_ID_NETWORKSETUP_SERVICES, + MN_WIDGET_ID_MAX }; From 1d574d93bc5207d0e500dffe1ebad5e586124c4f Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 16 Dec 2014 20:57:30 +0100 Subject: [PATCH 36/98] CComponentsTimer: simplify isRun function --- src/gui/components/cc_timer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/components/cc_timer.h b/src/gui/components/cc_timer.h index 62992c5aa..5be4b252b 100644 --- a/src/gui/components/cc_timer.h +++ b/src/gui/components/cc_timer.h @@ -64,7 +64,7 @@ class CComponentsTimer : public sigc::trackable bool stopTimer(); ///returns true, if timer is running in thread - bool isRun() const {return tm_thread == 0 ? false:true;}; + bool isRun() const {return tm_thread;}; ///set another interval in seconds void setTimerIntervall(const int& seconds){tm_interval = seconds;}; From 32af48cc80524caa39235a507cb075db39d4c84c Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 30 Nov 2014 22:20:00 +0100 Subject: [PATCH 37/98] CProgressWindow: reassign y position of body items on disabled header --- src/gui/widget/progresswindow.cpp | 21 ++++++++++++++++++++- src/gui/widget/progresswindow.h | 4 +++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/gui/widget/progresswindow.cpp b/src/gui/widget/progresswindow.cpp index 9bbb4670d..d7e1eb79f 100644 --- a/src/gui/widget/progresswindow.cpp +++ b/src/gui/widget/progresswindow.cpp @@ -82,7 +82,8 @@ void CProgressWindow::Init() addWindowItem(global_bar); y_item += 2*h_pbar; - height = y_item + ccw_head->getHeight(); + h_height = ccw_head->getHeight(); + height = y_item + h_height; setCenterPos(); } @@ -96,6 +97,18 @@ void CProgressWindow::setTitle(const neutrino_locale_t title) #endif // VFD_UPDATE } +//if header is disabled we need new position for body items +void CProgressWindow::fitItems() +{ + if (ccw_show_header) + return; + + for(size_t i=0; isize() ;i++){ + int y_item = ccw_body->getCCItem(i)->getYPos() + h_height - 10; + ccw_body->getCCItem(i)->setYPos(y_item); + } +} + void CProgressWindow::showStatus(const unsigned int prog) { if (global_progress == prog) @@ -177,3 +190,9 @@ int CProgressWindow::exec(CMenuTarget* parent, const std::string & /*actionKey*/ return menu_return::RETURN_REPAINT; } + +void CProgressWindow::paint(bool do_save_bg) +{ + fitItems(); + CComponentsWindow::paint(do_save_bg); +} diff --git a/src/gui/widget/progresswindow.h b/src/gui/widget/progresswindow.h index 6901cb79b..5bf54a7ba 100644 --- a/src/gui/widget/progresswindow.h +++ b/src/gui/widget/progresswindow.h @@ -37,8 +37,9 @@ class CProgressWindow : public CComponentsWindow, public CMenuTarget unsigned int global_progress; unsigned int local_progress; int w_bar_frame; - + int h_height; void Init(); + void fitItems(); public: @@ -53,6 +54,7 @@ class CProgressWindow : public CComponentsWindow, public CMenuTarget unsigned int getGlobalStatus(void); void showLocalStatus(const unsigned int prog); void showStatusMessageUTF(const std::string & text); // UTF-8 + void paint(bool do_save_bg = true); }; From 98d18f3ff44d17ae460819c3010ce790fe26d6cc Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 26 Dec 2014 18:02:31 +0100 Subject: [PATCH 38/98] CAudioPlayerGui: paint of id3 info with info box Infobox provides already paint of text, so is not required to call explicit fontrenderer methods. --- src/gui/audioplayer.cpp | 52 ++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index cd08238fa..0d39642a2 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -1825,10 +1825,6 @@ void CAudioPlayerGui::paintItemID3DetailsLine (int pos) if (dline != NULL) dline->kill(); - // clear infobox - if (ibox != NULL) - ibox->kill(); - // paint Line if detail info (and not valid list pos) and info box if (!m_playlist.empty() && (pos >= 0)) { @@ -1839,39 +1835,41 @@ void CAudioPlayerGui::paintItemID3DetailsLine (int pos) dline->paint(false); // paint id3 infobox - if (ibox == NULL) + if (ibox == NULL){ ibox = new CComponentsInfoBox(m_x, ypos2, m_width, m_info_height); - ibox->setCorner(RADIUS_LARGE); - ibox->setYPos(ypos2); - ibox->setColorBody(COL_MENUCONTENTDARK_PLUS_0); - ibox->setFrameThickness(2); - ibox->paint(false); + ibox->setFrameThickness(2); + ibox->setCorner(RADIUS_LARGE); + ibox->setYPos(ypos2); + ibox->setColorBody(COL_MENUCONTENTDARK_PLUS_0); + ibox->forceTextPaint(false); + } - g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + 10, ypos2 + 2 + 1*m_fheight, m_width- 80, - m_playlist[m_selected].MetaData.title, COL_MENUCONTENTDARK_TEXT); - std::string tmp; + //title + std::string text_info = m_playlist[m_selected].MetaData.title; + + //date, genre if (m_playlist[m_selected].MetaData.genre.empty()) - tmp = m_playlist[m_selected].MetaData.date; + text_info = m_playlist[m_selected].MetaData.date; else if (m_playlist[m_selected].MetaData.date.empty()) - tmp = m_playlist[m_selected].MetaData.genre; + text_info = m_playlist[m_selected].MetaData.genre; else { - tmp = m_playlist[m_selected].MetaData.genre; - tmp += " / "; - tmp += m_playlist[m_selected].MetaData.date; + text_info = m_playlist[m_selected].MetaData.genre; + text_info += " / "; + text_info += m_playlist[m_selected].MetaData.date; } - int w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(tmp) + 10; - g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + m_width - w - 5, ypos2 + 2 + 1*m_fheight, - w, tmp, COL_MENUCONTENTDARK_TEXT); - tmp = m_playlist[m_selected].MetaData.artist; + + //artist, album + text_info = m_playlist[m_selected].MetaData.artist; if (!(m_playlist[m_selected].MetaData.album.empty())) { - tmp += " ("; - tmp += m_playlist[m_selected].MetaData.album; - tmp += ')'; + text_info += " ("; + text_info += m_playlist[m_selected].MetaData.album; + text_info += ')'; } - g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + 10, ypos2 + 2*m_fheight - 2, m_width - 20, - tmp, COL_MENUCONTENTDARK_TEXT); + + ibox->setText(text_info, CTextBox::AUTO_WIDTH, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO], COL_MENUCONTENT_TEXT); + ibox->paint(false); } else { From 9776d163f782b31ba567f2ba9a05cd3f7da12662 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 27 Dec 2014 14:10:31 +0100 Subject: [PATCH 39/98] CBEChannelSelectWidget/CBEChannelWidget: uinng unified infobox font size ...unified style matching to menu hints --- src/gui/bedit/bouqueteditor_channels.cpp | 2 +- src/gui/bedit/bouqueteditor_chanselect.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/bedit/bouqueteditor_channels.cpp b/src/gui/bedit/bouqueteditor_channels.cpp index c33646742..35d26784d 100644 --- a/src/gui/bedit/bouqueteditor_channels.cpp +++ b/src/gui/bedit/bouqueteditor_channels.cpp @@ -225,7 +225,7 @@ void CBEChannelWidget::paintDetails(int index) std::string str = getInfoText(index); //info box - ibox->setText(str, CTextBox::AUTO_WIDTH | CTextBox::NO_AUTO_LINEBREAK, g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]); + ibox->setText(str, CTextBox::AUTO_WIDTH | CTextBox::NO_AUTO_LINEBREAK, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]); ibox->setColorBody(COL_MENUCONTENTDARK_PLUS_0); ibox->paint(CC_SAVE_SCREEN_NO); } diff --git a/src/gui/bedit/bouqueteditor_chanselect.cpp b/src/gui/bedit/bouqueteditor_chanselect.cpp index fcc12c1d1..1c6b08cfc 100644 --- a/src/gui/bedit/bouqueteditor_chanselect.cpp +++ b/src/gui/bedit/bouqueteditor_chanselect.cpp @@ -280,7 +280,7 @@ void CBEChannelSelectWidget::paintDetails(int index) std::string str = getInfoText(index); //info box - ibox->setText(str, CTextBox::AUTO_WIDTH | CTextBox::NO_AUTO_LINEBREAK, g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]); + ibox->setText(str, CTextBox::AUTO_WIDTH | CTextBox::NO_AUTO_LINEBREAK, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]); ibox->setColorBody(COL_MENUCONTENTDARK_PLUS_0); ibox->paint(false); } From b56570016880f3f5bdd9145ecc95a82f1653b1d3 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 27 Dec 2014 20:45:40 +0100 Subject: [PATCH 40/98] CBEBouquet-Classes: switch to new buttonbar based up cc-footer class --- src/gui/bedit/bouqueteditor_bouquets.cpp | 11 ++++++----- src/gui/bedit/bouqueteditor_bouquets.h | 4 ++-- src/gui/bedit/bouqueteditor_channels.cpp | 7 ++++--- src/gui/bedit/bouqueteditor_channels.h | 2 +- src/gui/bedit/bouqueteditor_chanselect.cpp | 7 ++++--- src/gui/bedit/bouqueteditor_chanselect.h | 2 +- 6 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/gui/bedit/bouqueteditor_bouquets.cpp b/src/gui/bedit/bouqueteditor_bouquets.cpp index 39cdfa421..4892f58c7 100644 --- a/src/gui/bedit/bouqueteditor_bouquets.cpp +++ b/src/gui/bedit/bouqueteditor_bouquets.cpp @@ -41,7 +41,7 @@ #include #include #include -#include + #include #include #include @@ -67,7 +67,7 @@ CBEBouquetWidget::CBEBouquetWidget() state = beDefault; Bouquets = NULL; iheight = 0; - ButtonHeight = 0; + ButtonHeight = footer.getHeight(); fheight = 0; theight = 0; } @@ -154,12 +154,14 @@ const struct button_label CBEBouquetWidgetButtons[6] = void CBEBouquetWidget::paintFoot() { - ::paintButtons(x, y+height, width, 6, CBEBouquetWidgetButtons, width, ButtonHeight); + size_t numbuttons = sizeof(CBEBouquetWidgetButtons)/sizeof(CBEBouquetWidgetButtons[0]); + footer.paintButtons(x, y+height, width, ButtonHeight, numbuttons, CBEBouquetWidgetButtons, width/numbuttons-20); } void CBEBouquetWidget::hide() { - frameBuffer->paintBackgroundBoxRel(x,y, width,height+ButtonHeight); + frameBuffer->paintBackgroundBoxRel(x,y, width,height); + footer.kill(); } void CBEBouquetWidget::updateSelection(unsigned int newpos) @@ -194,7 +196,6 @@ int CBEBouquetWidget::exec(CMenuTarget* parent, const std::string & /*actionKey* if (parent) parent->hide(); - ButtonHeight = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()+8; theight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); fheight = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getHeight(); diff --git a/src/gui/bedit/bouqueteditor_bouquets.h b/src/gui/bedit/bouqueteditor_bouquets.h index f7f2c1f8e..1c935b587 100644 --- a/src/gui/bedit/bouqueteditor_bouquets.h +++ b/src/gui/bedit/bouqueteditor_bouquets.h @@ -38,7 +38,7 @@ #include #include #include - +#include #include /* class for handling when bouquets changed. */ @@ -57,7 +57,7 @@ class CBEBouquetWidget : public CMenuTarget private: CFrameBuffer *frameBuffer; - + CComponentsFooter footer; enum { beDefault, diff --git a/src/gui/bedit/bouqueteditor_channels.cpp b/src/gui/bedit/bouqueteditor_channels.cpp index 35d26784d..fadb234cc 100644 --- a/src/gui/bedit/bouqueteditor_channels.cpp +++ b/src/gui/bedit/bouqueteditor_channels.cpp @@ -44,7 +44,7 @@ #include #include #include "bouqueteditor_chanselect.h" -#include +#include #include #include #include @@ -73,7 +73,7 @@ CBEChannelWidget::CBEChannelWidget(const std::string & Caption, unsigned int Bou theight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); fheight = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getHeight(); - footerHeight= g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()+6; + footerHeight= footer.getHeight(); frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_YELLOW, &icol_w, &icol_h); iheight = std::max(fheight, icol_h+2); @@ -196,7 +196,8 @@ const struct button_label CBEChannelWidgetButtons[6] = void CBEChannelWidget::paintFoot() { - ::paintButtons(x, y + (height-footerHeight), width, 6, CBEChannelWidgetButtons, width, footerHeight); + size_t numbuttons = sizeof(CBEChannelWidgetButtons)/sizeof(CBEChannelWidgetButtons[0]); + footer.paintButtons(x, y + (height-footerHeight), width, footerHeight, numbuttons, CBEChannelWidgetButtons, width/numbuttons-20); } std::string CBEChannelWidget::getInfoText(int index) diff --git a/src/gui/bedit/bouqueteditor_channels.h b/src/gui/bedit/bouqueteditor_channels.h index 6b834cf7a..fd17636fb 100644 --- a/src/gui/bedit/bouqueteditor_channels.h +++ b/src/gui/bedit/bouqueteditor_channels.h @@ -49,7 +49,7 @@ class CBEChannelWidget : public CMenuTarget CFrameBuffer *frameBuffer; CComponentsDetailLine *dline; CComponentsInfoBox *ibox; - + CComponentsFooter footer; enum state_ { beDefault, diff --git a/src/gui/bedit/bouqueteditor_chanselect.cpp b/src/gui/bedit/bouqueteditor_chanselect.cpp index 1c6b08cfc..0875d657b 100644 --- a/src/gui/bedit/bouqueteditor_chanselect.cpp +++ b/src/gui/bedit/bouqueteditor_chanselect.cpp @@ -41,7 +41,7 @@ #include #include #include -#include + #include #include @@ -59,7 +59,7 @@ CBEChannelSelectWidget::CBEChannelSelectWidget(const std::string & Caption, CZap info_height = 0; theight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); fheight = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getHeight(); - footerHeight= g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()+6; + footerHeight= footer.getHeight(); frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_GREEN, &icol_w, &icol_h); iheight = std::max(fheight, icol_h+2); @@ -251,7 +251,8 @@ void CBEChannelSelectWidget::paintFoot() Button[0].locale = LOCALE_CHANNELLIST_FOOT_SORT_ALPHA; break; } - ::paintButtons(x, y + (height-footerHeight), width, numbuttons, Button, width, footerHeight); + + footer.paintButtons(x, y + (height-footerHeight), width, footerHeight, numbuttons, Button, width/numbuttons-20); } std::string CBEChannelSelectWidget::getInfoText(int index) diff --git a/src/gui/bedit/bouqueteditor_chanselect.h b/src/gui/bedit/bouqueteditor_chanselect.h index af5ce6743..a4d2ccaeb 100644 --- a/src/gui/bedit/bouqueteditor_chanselect.h +++ b/src/gui/bedit/bouqueteditor_chanselect.h @@ -52,7 +52,7 @@ class CBEChannelSelectWidget : public CListBox bool isChannelInBouquet( int index); CComponentsDetailLine *dline; CComponentsInfoBox *ibox; - + CComponentsFooter footer; uint getItemCount(); void paintItem(uint32_t itemNr, int paintNr, bool selected); void paintDetails(int index); From d95446882ce2420c87753448152599d19960ba9b Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 27 Dec 2014 20:55:14 +0100 Subject: [PATCH 41/98] CBEBouquetWidget/CBEChannelWidget: add missing exit icon Menue icon has no effect here and exit icon was missed --- src/gui/bedit/bouqueteditor_bouquets.cpp | 2 +- src/gui/bedit/bouqueteditor_channels.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/bedit/bouqueteditor_bouquets.cpp b/src/gui/bedit/bouqueteditor_bouquets.cpp index 4892f58c7..c68d26427 100644 --- a/src/gui/bedit/bouqueteditor_bouquets.cpp +++ b/src/gui/bedit/bouqueteditor_bouquets.cpp @@ -138,7 +138,7 @@ void CBEBouquetWidget::paint() void CBEBouquetWidget::paintHead() { - CComponentsHeaderLocalized header(x, y, width, theight, LOCALE_BOUQUETLIST_HEAD, "" /*no header icon*/, CComponentsHeaderLocalized::CC_BTN_MENU); + CComponentsHeaderLocalized header(x, y, width, theight, LOCALE_BOUQUETLIST_HEAD, "" /*no header icon*/, CComponentsHeaderLocalized::CC_BTN_EXIT); header.paint(CC_SAVE_SCREEN_NO); } diff --git a/src/gui/bedit/bouqueteditor_channels.cpp b/src/gui/bedit/bouqueteditor_channels.cpp index fadb234cc..c7bbee759 100644 --- a/src/gui/bedit/bouqueteditor_channels.cpp +++ b/src/gui/bedit/bouqueteditor_channels.cpp @@ -179,7 +179,7 @@ void CBEChannelWidget::paint() void CBEChannelWidget::paintHead() { - CComponentsHeader header(x, y, width, theight, caption); + CComponentsHeader header(x, y, width, theight, caption, "" /*no header icon*/, CComponentsHeader::CC_BTN_EXIT); header.paint(CC_SAVE_SCREEN_NO); } From 1097a8ef0d9257edb3c1457b19c4f6bfa21b8644 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 27 Dec 2014 22:07:01 +0100 Subject: [PATCH 42/98] CImageInfo: fix button color with gradient --- src/gui/imageinfo.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/imageinfo.cpp b/src/gui/imageinfo.cpp index c99fdd382..2b236ff5a 100644 --- a/src/gui/imageinfo.cpp +++ b/src/gui/imageinfo.cpp @@ -185,7 +185,8 @@ void CImageInfo::ShowWindow() cc_win->setWindowHeaderButtons(CComponentsHeader::CC_BTN_MENU | CComponentsHeader::CC_BTN_EXIT); footer = cc_win->getFooterObject(); int h_footer = footer->getHeight(); - btn_red = new CComponentsButtonRed(10, CC_CENTERED, 250, h_footer-h_footer/4, LOCALE_BUILDINFO_MENU, footer, false , true, false, footer->getColorBody(), footer->getColorBody()); + fb_pixel_t btn_col = g_settings.gradiant ? COL_BUTTON_BODY : footer->getColorBody(); + btn_red = new CComponentsButtonRed(10, CC_CENTERED, 250, h_footer-h_footer/4, LOCALE_BUILDINFO_MENU, footer, false , true, false, footer->getColorBody(), btn_col); } //prepare minitv From b3f044575adffa140b4e45d1e19a39c175752110 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 25 Nov 2014 09:36:16 +0100 Subject: [PATCH 43/98] deutsch.locale: remove denglish part --- data/locale/deutsch.locale | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 30ae26407..2bf6679bf 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -598,7 +598,7 @@ flashupdate.menu_apply_settings Settingsübernahme erlauben flashupdate.mkfs_create_image Image erstellen flashupdate.mkfs_preparing_files Dateien und Verzeichnisse vorbereiten flashupdate.mkfs_using_sumtool Benutze Sumtool -flashupdate.msgbox Es wurde folgendes neues File gefunden:\nDatum: %s, %s\nBasisImage: %s\nTyp: %s\n\nWollen Sie diese Version jetzt herunterladen\nund installieren? +flashupdate.msgbox Es wurde folgende neue Datei gefunden:\nDatum: %s, %s\nBasisImage: %s\nTyp: %s\n\nWollen Sie diese Version jetzt herunterladen und installieren? flashupdate.msgbox_manual Es wurde ein neues Image gefunden:\nDatum: %s, %s\nBasisImage: %s\nImageTyp: %s\n\nWollen Sie diese Version jetzt installieren? flashupdate.mtdselector Partitions-Auswahl flashupdate.namemode1 Dateiname Settingsfile From c4bb2176f9fc7dc3fb10bbdde6e4ed10818e38d9 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 13 Nov 2014 10:19:55 +0100 Subject: [PATCH 44/98] locale: more precise text for update messages --- data/locale/deutsch.locale | 4 ++-- data/locale/english.locale | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 2bf6679bf..4d241fcf7 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -586,9 +586,9 @@ flashupdate.fileis0bytes die Dateigröße ist 0 Byte flashupdate.fileselector Datei-Auswahl flashupdate.flashreadyreboot Das Image wurde erfolgreich geflasht.\nIhre Box wird jetzt neu gestartet. flashupdate.getinfofile lade Versioninfo -flashupdate.getinfofileerror kann Info nicht laden +flashupdate.getinfofileerror Kann Aktualisierungs-Info nicht laden! flashupdate.getupdatefile lade Update -flashupdate.getupdatefileerror kann Update nicht laden +flashupdate.getupdatefileerror Kann Aktualisierung nicht laden! flashupdate.globalprogress Gesamtstatus: flashupdate.head Aktualisierung flashupdate.md5check Imageprüfung diff --git a/data/locale/english.locale b/data/locale/english.locale index 807519718..2022f3db2 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -586,9 +586,9 @@ flashupdate.fileis0bytes the filesize is 0 Bytes flashupdate.fileselector File-Selector flashupdate.flashreadyreboot The image was successfully flashed.\nThe box will be rebooted now. flashupdate.getinfofile getting versioninfo -flashupdate.getinfofileerror can't get versioninfo +flashupdate.getinfofileerror Can't get update versioninfo! flashupdate.getupdatefile getting update -flashupdate.getupdatefileerror can't get update +flashupdate.getupdatefileerror Can't get update! flashupdate.globalprogress Global Progress: flashupdate.head Software Update flashupdate.md5check checking image From e58b86f38f7cb4f3b01121fdfe415ca56b964203 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 20 Dec 2014 23:29:14 +0100 Subject: [PATCH 45/98] CFlashUpdate: change name for CFile object for better differ --- src/gui/update.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/update.cpp b/src/gui/update.cpp index f5b8fa61e..57b15c09c 100644 --- a/src/gui/update.cpp +++ b/src/gui/update.cpp @@ -415,18 +415,18 @@ printf("[update] mode is %d\n", softupdate_mode); UpdatesBrowser.Filter = &UpdatesFilter; - CFile * CFileSelected = NULL; + CFile * file_selected = NULL; if (!(UpdatesBrowser.exec(g_settings.update_dir.c_str()))) { menu_ret = UpdatesBrowser.getMenuRet(); return false; } - CFileSelected = UpdatesBrowser.getSelectedFile(); + file_selected = UpdatesBrowser.getSelectedFile(); - if (CFileSelected == NULL) + if (file_selected == NULL) return false; - filename = CFileSelected->Name; + filename = file_selected->Name; FILE* fd = fopen(filename.c_str(), "r"); if(fd) From 1a4d06175fe477d615d405e4cc6b4529cc053451 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 3 Jan 2015 00:06:37 +0100 Subject: [PATCH 46/98] CBEChannelWidget: remove not required hide() Avoids unnecessary flicker effects, it's enough to repaint only text. --- src/gui/bedit/bouqueteditor_channels.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/gui/bedit/bouqueteditor_channels.cpp b/src/gui/bedit/bouqueteditor_channels.cpp index c7bbee759..8126de0c8 100644 --- a/src/gui/bedit/bouqueteditor_channels.cpp +++ b/src/gui/bedit/bouqueteditor_channels.cpp @@ -250,19 +250,13 @@ void CBEChannelWidget::initItem2DetailsLine (int pos, int /*ch_index*/) dline->setYPos(ypos1a); //infobox - if (ibox == NULL) + if (ibox == NULL){ ibox = new CComponentsInfoBox(); - - if (ibox->isPainted()) - ibox->hide(CC_SAVE_SCREEN_NO); - - ibox->setDimensionsAll(x, ypos2, width, info_height); - ibox->setFrameThickness(2); -#if 0 - ibox->paint(false,true); -#endif - ibox->setCorner(RADIUS_LARGE); - ibox->setShadowOnOff(CC_SHADOW_OFF); + ibox->setDimensionsAll(x, ypos2, width, info_height); + ibox->setFrameThickness(2); + ibox->setCorner(RADIUS_LARGE); + ibox->setShadowOnOff(CC_SHADOW_OFF); + } } } From 674f2f983aaa55161eeb8fc65385911f4f25fc65 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 4 Jan 2015 20:35:25 +0100 Subject: [PATCH 47/98] CComponentsForm: reduce log spam in info mode --- src/gui/components/cc_frm.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/components/cc_frm.cpp b/src/gui/components/cc_frm.cpp index 3c5c76113..fb4b3c779 100644 --- a/src/gui/components/cc_frm.cpp +++ b/src/gui/components/cc_frm.cpp @@ -410,7 +410,7 @@ void CComponentsForm::paintCCItems() //assign item object CComponentsItem *cc_item = v_cc_items[i]; - dprintf(DEBUG_INFO, "[CComponentsForm] %s: page_count = %u, item_page = %u, cur_page = %u\n", __func__, getPageCount(), cc_item->getPageNumber(), this->cur_page); + dprintf(DEBUG_DEBUG, "[CComponentsForm] %s: page_count = %u, item_page = %u, cur_page = %u\n", __func__, getPageCount(), cc_item->getPageNumber(), this->cur_page); //get current position of item int xpos = cc_item->getXPos(); From 76ca33de9fe173e9338a5522e61ad03ea59f3916 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 12 Jan 2015 21:38:29 +0100 Subject: [PATCH 48/98] CTimeThread: sectionsd.cpp: use thread save localtime_r --- src/eitd/sectionsd.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/eitd/sectionsd.cpp b/src/eitd/sectionsd.cpp index dedd55092..210489723 100644 --- a/src/eitd/sectionsd.cpp +++ b/src/eitd/sectionsd.cpp @@ -37,7 +37,7 @@ #include #include #include - +#include #include #include @@ -1370,12 +1370,12 @@ void CTimeThread::waitForTimeset(void) void CTimeThread::setSystemTime(time_t tim) { struct timeval tv; - + struct tm t; time_t now = time(NULL); - struct tm *tmTime = localtime(&now); + struct tm *tmTime = localtime_r(&now, &t); gettimeofday(&tv, NULL); - timediff = (int64_t)tim * (int64_t)1000000 - (tv.tv_usec + tv.tv_sec * (int64_t)1000000); + timediff = int64_t(tim * 1000000 - (tv.tv_usec + tv.tv_sec * 1000000)); xprintf("%s: timediff %" PRId64 ", current: %02d.%02d.%04d %02d:%02d:%02d, dvb: %s", name.c_str(), timediff, tmTime->tm_mday, tmTime->tm_mon+1, tmTime->tm_year+1900, @@ -1392,8 +1392,8 @@ void CTimeThread::setSystemTime(time_t tim) return; if (timeset && abs(tim - tv.tv_sec) < 120) { /* abs() is int */ struct timeval oldd; - tv.tv_sec = timediff / 1000000LL; - tv.tv_usec = timediff % 1000000LL; + tv.tv_sec = time_t(timediff / 1000000LL); + tv.tv_usec = suseconds_t(timediff % 1000000LL); if (adjtime(&tv, &oldd)) xprintf("adjtime(%d, %d) failed: %m\n", (int)tv.tv_sec, (int)tv.tv_usec); else { From 08cb42d22f6700f787a87bc2a280ac9876a05f81 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 12 Jan 2015 22:02:20 +0100 Subject: [PATCH 49/98] gui/audioplayer.cpp/h: fix some type conversions --- src/gui/audioplayer.cpp | 6 +++--- src/gui/audioplayer.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index 0d39642a2..895569b08 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -2166,7 +2166,7 @@ void CAudioPlayerGui::updateTimes(const bool force) } if ((updatePlayed || updateTotal) && m_curr_audiofile.FileType != CFile::STREAM_AUDIO && m_time_total != 0) { - CVFD::getInstance()->showAudioProgress(100 * m_time_played / m_time_total); + CVFD::getInstance()->showAudioProgress(uint8_t(100 * m_time_played / m_time_total)); } } } @@ -2184,7 +2184,7 @@ void CAudioPlayerGui::paintLCD() CVFD::getInstance()->showAudioTrack(m_curr_audiofile.MetaData.artist, m_curr_audiofile.MetaData.title, m_curr_audiofile.MetaData.album); if (m_curr_audiofile.FileType != CFile::STREAM_AUDIO && m_time_total != 0) - CVFD::getInstance()->showAudioProgress(100 * m_time_played / m_time_total); + CVFD::getInstance()->showAudioProgress(uint8_t(100 * m_time_played / m_time_total)); break; case CAudioPlayerGui::PAUSE: CVFD::getInstance()->showAudioPlayMode(CVFD::AUDIO_MODE_PAUSE); @@ -2327,7 +2327,7 @@ void CAudioPlayerGui::getFileInfoToDisplay(std::string &fileInfo, CAudiofileExt { fileInfo += "Unknown"; } - file.firstChar = tolower(fileInfo[0]); + file.firstChar = (char)tolower(fileInfo[0]); //info += fileInfo; } diff --git a/src/gui/audioplayer.h b/src/gui/audioplayer.h index f41dc98c2..6d8db5bbc 100644 --- a/src/gui/audioplayer.h +++ b/src/gui/audioplayer.h @@ -81,7 +81,7 @@ class RandomNumber int operator()(int n) { - return ((int64_t)n * rand() / RAND_MAX); + return (n * rand() / RAND_MAX); } }; From c92d4fad1a14d6cd55ef586531fe215b5e8a0fe4 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 12 Jan 2015 22:25:25 +0100 Subject: [PATCH 50/98] frontend.cpp/pzapit.cpp: fix format string --- src/zapit/src/frontend.cpp | 2 +- src/zapit/src/pzapit.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/zapit/src/frontend.cpp b/src/zapit/src/frontend.cpp index 2bc885346..dcad640e0 100644 --- a/src/zapit/src/frontend.cpp +++ b/src/zapit/src/frontend.cpp @@ -694,7 +694,7 @@ struct dvb_frontend_event CFrontend::getEvent(void) } else if (event.status & FE_TIMEDOUT) { if(timedout < timer_msec) timedout = timer_msec; - printf("[fe%d] ############################## FE_TIMEDOUT (max %d)\n", fenumber, timedout); + printf("[fe%d] ############################## FE_TIMEDOUT (max %u)\n", fenumber, timedout); /*break;*/ } else { if (event.status & FE_HAS_SIGNAL) diff --git a/src/zapit/src/pzapit.cpp b/src/zapit/src/pzapit.cpp index 269283171..d31e8a718 100644 --- a/src/zapit/src/pzapit.cpp +++ b/src/zapit/src/pzapit.cpp @@ -653,7 +653,7 @@ int main (int argc, char** argv) std::vector::const_iterator ch_resp; for (ch_resp = channels.begin(), channel = 1; ch_resp != channels.end(); ch_resp++, ++channel) //std::cout << channel << ": " << ch_resp->name << ": " << ch_resp->channel_id<< std::endl; - printf("%3d: %s (%04x)\n", channel, ch_resp->name, (short) (ch_resp->channel_id &0xFFFF)); + printf("%3u: %s (%04x)\n", channel, ch_resp->name, (short) (ch_resp->channel_id &0xFFFF)); return 0; } } From f15cf6f57d6ba59098299ab4774d1e9c66617da8 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 12 Jan 2015 22:54:18 +0100 Subject: [PATCH 51/98] SIservices.hpp/SIsections.hpp: switch functions to const --- src/eitd/SIsections.hpp | 2 +- src/eitd/SIservices.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/eitd/SIsections.hpp b/src/eitd/SIsections.hpp index b537cadaf..f5d652c31 100644 --- a/src/eitd/SIsections.hpp +++ b/src/eitd/SIsections.hpp @@ -194,7 +194,7 @@ class SIsectionTIME parsed = 0; parse(buf); } - time_t getTime() { return dvbtime; } + time_t getTime() const { return dvbtime; } int is_parsed(void) const { return parsed; } }; diff --git a/src/eitd/SIservices.hpp b/src/eitd/SIservices.hpp index 186a58861..ee2c1d395 100644 --- a/src/eitd/SIservices.hpp +++ b/src/eitd/SIservices.hpp @@ -121,7 +121,7 @@ public: int eitScheduleFlag(void) { return (int)flags.EIT_schedule_flag; } int eitPresentFollowingFlag(void) { return (int)flags.EIT_present_following_flag; } #endif - int runningStatus(void) { return (int)flags.running_status; } + int runningStatus(void) const { return (int)flags.running_status; } #if 0 // unused int freeCAmode(void) { return (int)flags.free_CA_mode; } From 56ea6c140ffc1830069364ada5162670fab149d0 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 12 Jan 2015 23:02:30 +0100 Subject: [PATCH 52/98] CComponentsFooter: Function setButtonLabels() change parameter Performance: parameter 'v_content' should be passed by reference --- src/gui/components/cc_frm_footer.cpp | 4 ++-- src/gui/components/cc_frm_footer.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/components/cc_frm_footer.cpp b/src/gui/components/cc_frm_footer.cpp index 3d02f61c6..ac1b1da16 100644 --- a/src/gui/components/cc_frm_footer.cpp +++ b/src/gui/components/cc_frm_footer.cpp @@ -221,7 +221,7 @@ void CComponentsFooter::setButtonLabels(const struct button_label * const conten setButtonLabels(buttons, label_count, chain_width, label_width); } -void CComponentsFooter::setButtonLabels(const vectorv_content, const int& chain_width, const int& label_width) +void CComponentsFooter::setButtonLabels(const vector &v_content, const int& chain_width, const int& label_width) { size_t label_count = v_content.size(); button_label_l buttons[label_count]; @@ -237,7 +237,7 @@ void CComponentsFooter::setButtonLabels(const vectorv_content, c setButtonLabels(buttons, label_count, chain_width, label_width); } -void CComponentsFooter::setButtonLabels(const vectorv_content, const int& chain_width, const int& label_width) +void CComponentsFooter::setButtonLabels(const vector &v_content, const int& chain_width, const int& label_width) { size_t label_count = v_content.size(); button_label_s buttons[label_count]; diff --git a/src/gui/components/cc_frm_footer.h b/src/gui/components/cc_frm_footer.h index 3f2b6cb5b..602c06963 100644 --- a/src/gui/components/cc_frm_footer.h +++ b/src/gui/components/cc_frm_footer.h @@ -93,9 +93,9 @@ class CComponentsFooter : public CComponentsHeader ///add button labels with locale label type as content, count as size_t, chain_width as int, label width as int void setButtonLabels(const struct button_label_l * const content, const size_t& label_count, const int& chain_width = 0, const int& label_width = 0); ///add button labels with locale label type as content, parameter 1 as vector, chain_width as int, label width as int - void setButtonLabels(const std::vectorv_content, const int& chain_width, const int& label_width); + void setButtonLabels(const std::vector &v_content, const int& chain_width, const int& label_width); ///add button labels with string label type as content, parameter 1 as vector, chain_width as int, label width as int - void setButtonLabels(const std::vectorv_content, const int& chain_width, const int& label_width); + void setButtonLabels(const std::vector &v_content, const int& chain_width, const int& label_width); ///enable/disable button frame in icon color, predefined for red, green, yellow and blue inline void enableButtonFrameColor(bool enable = true){btn_auto_frame_col = enable;} From 9c8549197490c1e8d49349bb6545cd1e88cc60e3 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 13 Jan 2015 16:14:26 +0100 Subject: [PATCH 53/98] CProgressBarCache: fix compiler warnings wconversion --- src/gui/components/cc_item_progressbar.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/components/cc_item_progressbar.cpp b/src/gui/components/cc_item_progressbar.cpp index aa9dbf0fb..4f7453aec 100644 --- a/src/gui/components/cc_item_progressbar.cpp +++ b/src/gui/components/cc_item_progressbar.cpp @@ -379,9 +379,9 @@ void CProgressBarCache::applyGradient(fb_pixel_t *b) if (v != last_old) { last_old = v; double s = sin((y + .5) * M_PI / pb_height) * .8 + .2; - float fr = ((last_old >> 16) & 0xff) * s + 0.5; - float fg = ((last_old >> 8) & 0xff) * s + 0.5; - float fb = ((last_old ) & 0xff) * s + 0.5; + float fr = float(((last_old >> 16) & 0xff) * s + 0.5); + float fg = float(((last_old >> 8) & 0xff) * s + 0.5); + float fb = float(((last_old ) & 0xff) * s + 0.5); last_new = (last_old & 0xFF000000) | ((unsigned int)fr << 16) | ((unsigned int)fg << 8) From 4d8f7f3acbff94fcfc74499b990dd39edaa3b4f0 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 13 Jan 2015 16:25:28 +0100 Subject: [PATCH 54/98] EpgPlus: fix wconversion --- src/gui/epgplus.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/epgplus.cpp b/src/gui/epgplus.cpp index 13bb7985a..a3c4e5d8c 100644 --- a/src/gui/epgplus.cpp +++ b/src/gui/epgplus.cpp @@ -1236,10 +1236,10 @@ void EpgPlus::paint() this->frameBuffer->paintBoxRel (this->sliderX, this->sliderY, this->sliderWidth, this->sliderHeight, COL_MENUCONTENT_PLUS_0); int tmp = ((this->channelList->getSize() - 1) / this->maxNumberOfDisplayableEntries) + 1; - float sliderKnobHeight = (sliderHeight - 4) / tmp; + float sliderKnobHeight = float((sliderHeight - 4) / tmp); int sliderKnobPosition = this->selectedChannelEntry == NULL ? 0 : (this->selectedChannelEntry->index / this->maxNumberOfDisplayableEntries); - this->frameBuffer->paintBoxRel (this->sliderX + 2, this->sliderY + int (sliderKnobPosition * sliderKnobHeight) + this->frameBuffer->paintBoxRel (this->sliderX + 2, this->sliderY + (int(sliderKnobPosition * sliderKnobHeight)) , this->sliderWidth - 4, int (sliderKnobHeight) , COL_MENUCONTENT_PLUS_3); } From ebc9d28e0e50fe5694a3c7c3fa6577868a3052ab Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 13 Jan 2015 20:57:34 +0100 Subject: [PATCH 55/98] CComponentsInfoBox: fix centering of image --- src/gui/components/cc_item_infobox.cpp | 15 ++++++++------- src/gui/components/cc_item_infobox.h | 3 --- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/gui/components/cc_item_infobox.cpp b/src/gui/components/cc_item_infobox.cpp index 8a51786d8..4385341be 100644 --- a/src/gui/components/cc_item_infobox.cpp +++ b/src/gui/components/cc_item_infobox.cpp @@ -95,8 +95,11 @@ void CComponentsInfoBox::setPicture(const char* picture_name) void CComponentsInfoBox::paintPicture() { //ensure empty pic object - if (pic) + if (pic){ + if (pic->isPicPainted()) + pic->kill(); delete pic; + } pic = NULL; //exit if no image definied @@ -104,15 +107,13 @@ void CComponentsInfoBox::paintPicture() return; //init pic object and set icon paint position - pic = new CComponentsPicture(x+fr_thickness+x_offset, y+fr_thickness, ""); - - //define icon - pic->setPicture(pic_name); + pic = new CComponentsPicture(x+fr_thickness+x_offset, y+fr_thickness, 0, height-2*fr_thickness, pic_name); //NOTE: icons do not scale! - //fit icon into infobox - pic->setHeight(height-2*fr_thickness); pic->setColorBody(col_body); + //fit icon into frame + pic->setYPos(y+(height/2-pic->getHeight()/2)); + //paint, but set visibility mode pic->allowPaint(cc_allow_paint); pic->paint(CC_SAVE_SCREEN_NO); diff --git a/src/gui/components/cc_item_infobox.h b/src/gui/components/cc_item_infobox.h index da6043757..7a8c5c616 100644 --- a/src/gui/components/cc_item_infobox.h +++ b/src/gui/components/cc_item_infobox.h @@ -57,9 +57,6 @@ class CComponentsInfoBox : public CComponentsText ///property: path or name of displayed image std::string pic_name; - ///set scale mode of image - bool scale_image; - public: ///object: internal used CTextBox object CComponentsText * cctext; From 6151152a20a96889753cae3a200e4911513a9c01 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 14 Jan 2015 16:57:00 +0100 Subject: [PATCH 56/98] CPictureViewer: use neutrino internal log Show only errors in mode DEBUG_NORMAL. --- src/driver/pictureviewer/pictureviewer.cpp | 59 +++++++++++++--------- 1 file changed, 34 insertions(+), 25 deletions(-) diff --git a/src/driver/pictureviewer/pictureviewer.cpp b/src/driver/pictureviewer/pictureviewer.cpp index dd696e2d4..7c1ca758d 100644 --- a/src/driver/pictureviewer/pictureviewer.cpp +++ b/src/driver/pictureviewer/pictureviewer.cpp @@ -3,14 +3,14 @@ #include #include "pictureviewer.h" #include "pv_config.h" - +#include #include #include #include #include #include #include - +#include #include #ifdef FBV_SUPPORT_GIF @@ -170,7 +170,7 @@ bool CPictureViewer::DecodeImage (const std::string & _name, bool showBusySign, } m_NextPic_Buffer = (unsigned char *) malloc (x * y * 3); if (m_NextPic_Buffer == NULL) { - printf ("DecodeImage: Error: malloc\n"); + dprintf(DEBUG_NORMAL, "[CPictureViewer] [%s - %d] Error: malloc, %s\n", __func__, __LINE__, strerror(errno)); return false; } // dbout("---Decoding Start(%d/%d)\n",x,y); @@ -207,11 +207,11 @@ bool CPictureViewer::DecodeImage (const std::string & _name, bool showBusySign, else m_NextPic_YPan = 0; } else { - printf ("Unable to read file !\n"); + dprintf(DEBUG_NORMAL, "[CPictureViewer] [%s - %d] Error: Unable to read file !, %s\n", __func__, __LINE__, strerror(errno)); free (m_NextPic_Buffer); m_NextPic_Buffer = (unsigned char *) malloc (3); if (m_NextPic_Buffer == NULL) { - printf ("DecodeImage: Error: malloc\n"); + dprintf(DEBUG_NORMAL, "[CPictureViewer] [%s - %d] Error: malloc, %s\n", __func__, __LINE__, strerror(errno)); return false; } memset (m_NextPic_Buffer, 0, 3); @@ -223,14 +223,14 @@ bool CPictureViewer::DecodeImage (const std::string & _name, bool showBusySign, m_NextPic_YPan = 0; } } else { - printf ("Unable to read file or format not recognized!\n"); + dprintf(DEBUG_NORMAL, "[CPictureViewer] [%s - %d] Unable to read file or format not recognized!\n", __func__, __LINE__); if (m_NextPic_Buffer != NULL) { free (m_NextPic_Buffer); m_NextPic_Buffer = NULL; } m_NextPic_Buffer = (unsigned char *) malloc (3); if (m_NextPic_Buffer == NULL) { - printf ("DecodeImage: Error: malloc\n"); + dprintf(DEBUG_NORMAL, "[CPictureViewer] [%s - %d] Error: malloc, %s\n", __func__, __LINE__, strerror(errno)); return false; } memset (m_NextPic_Buffer, 0, 3); @@ -436,7 +436,7 @@ void CPictureViewer::showBusy (int sx, int sy, int width, char r, char g, char b fb_buffer = (unsigned char *) CFrameBuffer::getInstance()->convertRGB2FB (rgb_buffer, 1, 1); if (fb_buffer == NULL) { - printf ("showBusy: Error: malloc 1\n"); + dprintf(DEBUG_NORMAL, "[CPictureViewer] [%s - %d] Error: malloc\n", __func__, __LINE__); return; } if (m_busy_buffer != NULL) { @@ -445,7 +445,7 @@ void CPictureViewer::showBusy (int sx, int sy, int width, char r, char g, char b } m_busy_buffer = (unsigned char *) malloc (width * width * cpp); if (m_busy_buffer == NULL) { - printf ("showBusy: Error: malloc 2: \n"); + dprintf(DEBUG_NORMAL, "[CPictureViewer] [%s - %d] Error: malloc\n", __func__, __LINE__); return; } busy_buffer_wrk = m_busy_buffer; @@ -625,22 +625,27 @@ bool CPictureViewer::DisplayImage(const std::string & name, int posx, int posy, /* TODO: cache or check for same */ fb_pixel_t * data = getImage(name, width, height); - if (transp > CFrameBuffer::TM_EMPTY) - frameBuffer->SetTransparentDefault(); + if (data){ + if (transp > CFrameBuffer::TM_EMPTY) + frameBuffer->SetTransparentDefault(); - if(data) { - frameBuffer->blit2FB(data, width, height, posx, posy); - cs_free_uncached(data); - return true; + if(data) { + frameBuffer->blit2FB(data, width, height, posx, posy); + cs_free_uncached(data); + return true; + } } return false; } fb_pixel_t * CPictureViewer::int_getImage(const std::string & name, int *width, int *height, bool GetImage) { + if (access(name.c_str(), R_OK) == -1) + return NULL; + int x, y, load_ret, bpp = 0; - CFormathandler *fh; - unsigned char * buffer; + CFormathandler *fh = NULL; + unsigned char * buffer = NULL; fb_pixel_t * ret = NULL; std::string mode_str; @@ -655,8 +660,8 @@ fb_pixel_t * CPictureViewer::int_getImage(const std::string & name, int *width, buffer = (unsigned char *) malloc(x * y * 4); if (buffer == NULL) { - printf("%s: Error: malloc\n", mode_str.c_str()); - return 0; + dprintf(DEBUG_NORMAL, "[CPictureViewer] [%s - %d] mode %s: Error: malloc\n", __func__, __LINE__, mode_str.c_str()); + return NULL; } #ifdef FBV_SUPPORT_PNG if ((name.find(".png") == (name.length() - 4)) && (fh_png_id(name.c_str()))) @@ -664,13 +669,15 @@ fb_pixel_t * CPictureViewer::int_getImage(const std::string & name, int *width, else #endif load_ret = fh->get_pic(name.c_str (), &buffer, &x, &y); + dprintf(DEBUG_INFO, "[CPictureViewer] [%s - %d] load_result: %d \n", __func__, __LINE__, load_ret); + if (load_ret == FH_ERROR_OK) { -// printf("%s: decoded %s, %d x %d \n", mode_str.c_str(), name.c_str(), x, y); + dprintf(DEBUG_INFO, "[CPictureViewer] [%s - %d] mode %s, decoded %s, (Pos: %d %d) ,bpp = %d \n", __func__, __LINE__, mode_str.c_str(), name.c_str(), x, y, bpp); // resize only getImage if ((GetImage) && (x != *width || y != *height)) { - printf("%s: resize %s to %d x %d \n", mode_str.c_str(), name.c_str(), *width, *height); + dprintf(DEBUG_INFO, "[CPictureViewer] [%s - %d] resize %s to %d x %d \n", __func__, __LINE__, name.c_str(), *width, *height); if (bpp == 4) buffer = ResizeA(buffer, x, y, *width, *height); else @@ -684,11 +691,13 @@ fb_pixel_t * CPictureViewer::int_getImage(const std::string & name, int *width, ret = (fb_pixel_t *) CFrameBuffer::getInstance()->convertRGB2FB(buffer, x, y, convertSetupAlpha2Alpha(g_settings.theme.infobar_alpha)); *width = x; *height = y; - }else - printf("%s: Error decoding file %s\n", mode_str.c_str(), name.c_str()); + }else{ + dprintf(DEBUG_NORMAL, "[CPictureViewer] [%s - %d] mode %s: Error decoding file %s\n", __func__, __LINE__, mode_str.c_str(), name.c_str()); + return NULL; + } free(buffer); }else - printf("%s: Error open file %s\n", mode_str.c_str(), name.c_str()); + dprintf(DEBUG_NORMAL, "[CPictureViewer] [%s - %d] mode: %s, file: %s Error: %s, buffer = %p (Pos: %d %d, Dim: %d x %d)\n", __func__, __LINE__, mode_str.c_str(), name.c_str(), strerror(errno), buffer, x, y, *width, *height); return ret; } @@ -711,7 +720,7 @@ unsigned char * CPictureViewer::int_Resize(unsigned char *orgin, int ox, int oy, if(cr == NULL) { - printf("Resize Error: malloc\n"); + dprintf(DEBUG_NORMAL, "[CPictureViewer] [%s - %d] Resize Error: malloc\n", __func__, __LINE__); return(orgin); } }else From 2dc47e0fe157df6b309dfd96a8e5305493bff19a Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 14 Jan 2015 19:24:43 +0100 Subject: [PATCH 57/98] CPictureViewer: fix wconversion warnings --- src/driver/pictureviewer/pictureviewer.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/driver/pictureviewer/pictureviewer.cpp b/src/driver/pictureviewer/pictureviewer.cpp index 7c1ca758d..8400b1148 100644 --- a/src/driver/pictureviewer/pictureviewer.cpp +++ b/src/driver/pictureviewer/pictureviewer.cpp @@ -304,8 +304,8 @@ void CPictureViewer::Zoom (float factor) int oldx = m_CurrentPic_X; int oldy = m_CurrentPic_Y; unsigned char *oldBuf = m_CurrentPic_Buffer; - m_CurrentPic_X = (int) (factor * m_CurrentPic_X); - m_CurrentPic_Y = (int) (factor * m_CurrentPic_Y); + m_CurrentPic_X = int(factor * (float)m_CurrentPic_X); + m_CurrentPic_Y = int(factor * (float)m_CurrentPic_Y); m_CurrentPic_Buffer = Resize(m_CurrentPic_Buffer, oldx, oldy, m_CurrentPic_X, m_CurrentPic_Y, m_scaling); @@ -379,7 +379,7 @@ CPictureViewer::CPictureViewer () fh_root = NULL; m_scaling = COLOR; //m_aspect = 4.0 / 3; - m_aspect = 16.0 / 9; + m_aspect = float(16.0 / 9.0); m_CurrentPic_Name = ""; m_CurrentPic_Buffer = NULL; m_CurrentPic_X = 0; @@ -609,10 +609,10 @@ void CPictureViewer::rescaleImageDimensions(int *width, int *height, const int m aspect = (float)(*width) / (float)(*height); if (((float)(*width) / (float)max_width) > ((float)(*height) / (float)max_height)) { *width = max_width; - *height = (int)(max_width / aspect); + *height = int((float)max_width / aspect); }else{ *height = max_height; - *width = (int)(max_height * aspect); + *width = int((float)max_height * aspect); } } @@ -776,7 +776,10 @@ unsigned char * CPictureViewer::int_Resize(unsigned char *orgin, int ox, int oy, r+=q[0]; g+=q[1]; b+=q[2]; a+=q[3]; } } - p[0]=r/sq; p[1]=g/sq; p[2]=b/sq; p[3]=a/sq; + p[0]= uint8_t(r/sq); + p[1]= uint8_t(g/sq); + p[2]= uint8_t(b/sq); + p[3]= uint8_t(a/sq); } } }else @@ -795,7 +798,9 @@ unsigned char * CPictureViewer::int_Resize(unsigned char *orgin, int ox, int oy, r+=q[0]; g+=q[1]; b+=q[2]; } } - p[0]=r/sq; p[1]=g/sq; p[2]=b/sq; + p[0]= uint8_t(r/sq); + p[1]= uint8_t(g/sq); + p[2]= uint8_t(b/sq); } } } From e8d46a8a55ca61a9a0b3f98f0ea63c5a215431cb Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 14 Jan 2015 19:29:23 +0100 Subject: [PATCH 58/98] CComponentsPicture: fix icon size/scale handling --- src/gui/components/cc_item_picture.cpp | 45 ++++++++++++++++---------- src/gui/components/cc_item_picture.h | 11 +++++-- 2 files changed, 37 insertions(+), 19 deletions(-) diff --git a/src/gui/components/cc_item_picture.cpp b/src/gui/components/cc_item_picture.cpp index 4b755a443..bca05b38d 100644 --- a/src/gui/components/cc_item_picture.cpp +++ b/src/gui/components/cc_item_picture.cpp @@ -113,22 +113,23 @@ void CComponentsPicture::initCCItem() return; } - //handle size - int w_pic = width; - int h_pic = height; - - //check for path or name, set icon or image with full path + //check for path or name, set icon or image with full path, has no path, then use as icon and disble scale mode string::size_type pos = pic_name.find("/", 0); if (pos == string::npos) do_scale = false; - if (!do_scale || (w_pic == 0 || w_pic == 0)){ - if (!pic_name.empty()) - frameBuffer->getIconSize(pic_name.c_str(), &width, &height); - }else{ - g_PicViewer->getSize(pic_name.c_str(), &w_pic, &h_pic); - if (width != w_pic || height != h_pic) - g_PicViewer->rescaleImageDimensions(&w_pic, &h_pic, width, height); + //initial internal size + int w_pic = width; + int h_pic = height; + + if (!do_scale){ + //use image/icon size as object dimension values + frameBuffer->getIconSize(pic_name.c_str(), &width, &height); + } + else{ + //if initialized dimension values = 0, set current object dimension values to real image size otherwise use defined size + g_PicViewer->getSize(pic_name.c_str(), (width == 0 ? &width : &w_pic), (height == 0 ? &height : &h_pic)); + g_PicViewer->rescaleImageDimensions(&w_pic, &h_pic, width, height); } } @@ -234,17 +235,18 @@ CComponentsChannelLogo::CComponentsChannelLogo( const int &x_pos, const int &y_p void CComponentsChannelLogo::init(const uint64_t& channelId, const std::string& channelName, bool allow_scale) { + alt_pic_name = ""; setChannel(channelId, channelName); do_scale = allow_scale; - alt_pic_name = ""; } void CComponentsChannelLogo::setAltLogo(const std::string& picture_name) { alt_pic_name = picture_name; channel_id = 0; channel_name = ""; - has_logo = true; - initCCItem(); + has_logo = !alt_pic_name.empty(); + if (has_logo) + initCCItem(); } void CComponentsChannelLogo::setAltLogo(const char* picture_name) @@ -263,9 +265,18 @@ void CComponentsChannelLogo::setChannel(const uint64_t& channelId, const std::st has_logo = g_PicViewer->GetLogoName(channel_id, channel_name, pic_name, &dummy, &dummy); - if (!has_logo) + if (!has_logo)//no logo was found, use altrenate icon or logo pic_name = alt_pic_name; - + + //if logo or alternate image still not available, set has logo to false + has_logo = !pic_name.empty(); + + //refresh object initCCItem(); + + //set has_logo to false if no dimensions were detected + if (width && height) + has_logo = true; + doPaintBg(false); } diff --git a/src/gui/components/cc_item_picture.h b/src/gui/components/cc_item_picture.h index ce8240416..d6a1a3640 100644 --- a/src/gui/components/cc_item_picture.h +++ b/src/gui/components/cc_item_picture.h @@ -86,7 +86,7 @@ class CComponentsPicture : public CComponentsItem void SetTransparent(int t){ image_transparent = t; } public: - ///constructor for image objects, use this for scaled images, scaling dimensions are defined with parameters w (width) and h (height) + ///constructor for image objects, use this for scaled images, scaling dimensions are defined with parameters w (width) and h (height), only values >0 causes scale of image CComponentsPicture( const int &x_pos, const int &y_pos, const int &w, const int &h, const std::string& image_name, CComponentsForm *parent = NULL, @@ -118,7 +118,14 @@ class CComponentsPicture : public CComponentsItem ///return height of component virtual int getHeight(); - virtual void doScale(bool scale = true){do_scale = scale;} + ///set width of object and image, value >0 causes scale of image + virtual void setWidth(const int& w){CComponentsItem::setWidth(w), do_scale = true; initCCItem();} + ///set height of object and image, value >0 causes scale of image + virtual void setHeight(const int& h){CComponentsItem::setHeight(h), do_scale = true; initCCItem();} + ///set width of object and image related to current screen size, see also CComponentsItem::setWidthP(), parameter as uint8_t + virtual void setWidthP(const uint8_t& w_percent){CComponentsItem::setWidthP(w_percent), do_scale = true; initCCItem();} + ///set height of object and image related to current screen size, see also CComponentsItem::setHeightP(), parameter as uint8_t + virtual void setHeightP(const uint8_t& h_percent){CComponentsItem::setHeightP(h_percent), do_scale = true; initCCItem();} ///return paint mode of internal image, true=image was painted, please do not to confuse with isPainted()! isPainted() is related to item itself. virtual inline bool isPicPainted(){return is_image_painted;}; From 51aab307c308d2c9b330ce8a3dfa122d6946d545 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 14 Jan 2015 19:30:51 +0100 Subject: [PATCH 59/98] CComponentsItem: fix remove gradient buffer on killed item --- src/gui/components/cc_item.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/components/cc_item.cpp b/src/gui/components/cc_item.cpp index f89406d03..f27efe142 100644 --- a/src/gui/components/cc_item.cpp +++ b/src/gui/components/cc_item.cpp @@ -168,6 +168,10 @@ void CComponentsItem::kill(const fb_pixel_t& bg_color, bool ignore_parent) void CComponentsItem::syncSysColors() { col_body = COL_MENUCONTENT_PLUS_0; + if (cc_body_gradientBuf){ + free(cc_body_gradientBuf); + cc_body_gradientBuf = NULL; + } col_shadow = COL_MENUCONTENTDARK_PLUS_0; col_frame = COL_MENUCONTENT_PLUS_6; } From d33c4911d2287e67061bef168c4bc1cdd1aa74d2 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 14 Jan 2015 19:32:10 +0100 Subject: [PATCH 60/98] CComponentsButton: fix fit of button icon Scale was broken --- src/gui/components/cc_frm_button.cpp | 29 +++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/gui/components/cc_frm_button.cpp b/src/gui/components/cc_frm_button.cpp index 6462f9cf0..3c70efa4a 100644 --- a/src/gui/components/cc_frm_button.cpp +++ b/src/gui/components/cc_frm_button.cpp @@ -145,18 +145,25 @@ void CComponentsButton::initIcon() if (cc_btn_icon_obj == NULL){ int w_icon = 0; int h_icon = 0; - frameBuffer->getIconSize(cc_btn_icon.c_str(), &w_icon, &h_icon); + int y_icon = 0; - h_icon = min(height-2*fr_thickness, h_icon); -// if (h_icon != h_max){ -// int ratio = h_icon/h_max; -// cc_btn_icon = frameBuffer->getIconBasePath() + cc_btn_icon; -// cc_btn_icon += ".png"; -// w_icon = w_icon*ratio; -// } - - int y_icon = height/2 - h_icon/2; - cc_btn_icon_obj = new CComponentsPicture(fr_thickness, y_icon, w_icon, h_icon, cc_btn_icon, this); + string::size_type pos = cc_btn_icon.find("/", 0); + if (pos == string::npos) + cc_btn_icon = frameBuffer->getIconBasePath() + cc_btn_icon + ".png"; + + cc_btn_icon_obj = new CComponentsPicture(fr_thickness, y_icon, cc_btn_icon, this); + h_icon = cc_btn_icon_obj->getHeight(); + + if (h_icon > (height-2*fr_thickness)){ + cc_btn_icon_obj->setHeight(height*80/100); + uint8_t h_ratio = uint8_t(height*100/h_icon); + w_icon = h_ratio*cc_btn_icon_obj->getWidth()/100; + cc_btn_icon_obj->setWidth(w_icon); + } + + y_icon = height/2 - cc_btn_icon_obj->getHeight()/2; + + cc_btn_icon_obj->setYPos(y_icon); cc_btn_icon_obj->doPaintBg(false); } } From 1cb885dfe97fb3190fc11d34e4005d27ddb0d4ae Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 14 Jan 2015 19:33:38 +0100 Subject: [PATCH 61/98] CChannelList/CNeutrinoEventList/CMovieBrowser: fix logo scale Downscale was broken. --- src/gui/channellist.cpp | 20 +++++++++++++------- src/gui/eventlist.cpp | 27 ++++++++++++++++++++------- src/gui/moviebrowser.cpp | 13 ++++++++++--- 3 files changed, 43 insertions(+), 17 deletions(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 0add17c11..52b64c72c 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -1663,13 +1663,19 @@ void CChannelList::showChannelLogo() CChannelLogo->hide(); delete CChannelLogo; } - CChannelLogo = new CComponentsChannelLogo(0, 0, logo_w_max, theight, - (*chanlist)[selected]->getName(), (*chanlist)[selected]->channel_id); - if (CChannelLogo->hasLogo()) { - CChannelLogo->doScale(theight < CChannelLogo->getHeight()); - CChannelLogo->setXPos(x + full_width - logo_off - CChannelLogo->getWidth()); - CChannelLogo->setYPos(y + (theight - CChannelLogo->getHeight()) / 2); - CChannelLogo->paint(); + CChannelLogo = new CComponentsChannelLogo(0, 0, (*chanlist)[selected]->getName(), (*chanlist)[selected]->channel_id); + + if (CChannelLogo->hasLogo()){ + int h_logo = CChannelLogo->getHeight(); + if (h_logo > theight){ //scale image if required, TODO: move into an own handler, eg. header, so channel logo should be paint in header object + uint8_t h_ratio = uint8_t(theight*100/h_logo); + CChannelLogo->setHeight(theight); + int w_logo = h_ratio*CChannelLogo->getWidth()/100; + CChannelLogo->setWidth(min(w_logo, logo_w_max)); + CChannelLogo->setXPos(x + full_width - logo_off - CChannelLogo->getWidth()); + CChannelLogo->setYPos(y + (theight - CChannelLogo->getHeight()) / 2); + CChannelLogo->paint(); + } } else { delete CChannelLogo; CChannelLogo = NULL; diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index 35f4cde60..2845b1de5 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -858,17 +858,30 @@ void CNeutrinoEventList::paintHead(t_channel_id _channel_id, std::string _channe header.setCorner(RADIUS_LARGE, CORNER_TOP); int x_off = 10; - int mid_width = header.getWidth() * 40 / 100; // 40% - int side_width = ((header.getWidth() - mid_width) / 2) - (2 * x_off); + int mid_width = full_width * 40 / 100; // 40% + int side_width = ((full_width - mid_width) / 2) - (2 * x_off); - CComponentsChannelLogo* midLogo = new CComponentsChannelLogo(CC_CENTERED, CC_CENTERED, _channelname, _channel_id); + //create an logo object + CComponentsChannelLogo* midLogo = new CComponentsChannelLogo(0, 0, _channelname, _channel_id, &header); if (midLogo->hasLogo()) { - header.addCCItem(midLogo); + //if logo object has found a logo and was ititialized, the hand it's size + int w_logo = midLogo->getWidth(); + + //scale image if required, TODO: move into an own handler, eg. header, so channel logo should be paint in header object + int h_logo = midLogo->getHeight(); + if (h_logo > theight){ + uint8_t h_ratio = uint8_t(theight*100/h_logo); + midLogo->setHeight(theight); + w_logo = h_ratio*w_logo/100; + midLogo->setWidth(w_logo); + } + midLogo->setPos(CC_CENTERED, CC_CENTERED); + // recalc widths - side_width = ((full_width - midLogo->getWidth()) / 2) - (4 * x_off); + side_width = ((full_width - w_logo) / 2) - (4 * x_off); } else { - delete midLogo; + header.removeCCItem(midLogo); //remove/destroy logo object, if it is not available CComponentsText *midText = new CComponentsText(CC_CENTERED, CC_CENTERED, mid_width, theight, _channelname, CTextBox::CENTER, g_Font[font_mid], &header, CC_SHADOW_OFF, COL_MENUHEAD_TEXT); midText->doPaintBg(false); } @@ -880,7 +893,7 @@ void CNeutrinoEventList::paintHead(t_channel_id _channel_id, std::string _channe if (!_channelname_next.empty()) { int name_w = std::min(g_Font[font_lr]->getRenderWidth(_channelname_next), side_width); - int x_pos = header.getWidth() - name_w - x_off; + int x_pos = full_width - name_w - x_off; CComponentsText *rText = new CComponentsText(x_pos, CC_CENTERED, name_w, theight, _channelname_next, CTextBox::NO_AUTO_LINEBREAK, g_Font[font_lr], &header, CC_SHADOW_OFF, COL_MENUHEAD_TEXT); rText->doPaintBg(false); } diff --git a/src/gui/moviebrowser.cpp b/src/gui/moviebrowser.cpp index 2d8f6fd33..ff185cd17 100644 --- a/src/gui/moviebrowser.cpp +++ b/src/gui/moviebrowser.cpp @@ -1259,15 +1259,22 @@ void CMovieBrowser::refreshMovieInfo(void) CChannelLogo = NULL; } if (old_EpgId != m_movieSelectionHandler->epgEpgId >>16) { - CChannelLogo = new CComponentsChannelLogo(0, 0, logo_w_max, m_cBoxFrameTitleRel.iHeight, - m_movieSelectionHandler->epgChannel, m_movieSelectionHandler->epgEpgId >>16); + CChannelLogo = new CComponentsChannelLogo(0, 0, m_movieSelectionHandler->epgChannel, m_movieSelectionHandler->epgEpgId >>16); old_EpgId = m_movieSelectionHandler->epgEpgId >>16; } if (CChannelLogo && CChannelLogo->hasLogo()) { + //scale image if required, TODO: move into an own handler, eg. header, so channel logo should be paint in header object + int h_logo = CChannelLogo->getHeight(); + if (h_logo > m_cBoxFrameTitleRel.iHeight){ + uint8_t ratio = m_cBoxFrameTitleRel.iHeight*100/h_logo; + CChannelLogo->setHeight(m_cBoxFrameTitleRel.iHeight); + int w_logo = ratio*CChannelLogo->getWidth()/100; + CChannelLogo->setWidth(min(w_logo, logo_w_max)); + } + lx = m_cBoxFrame.iX+m_cBoxFrameTitleRel.iX+m_cBoxFrameTitleRel.iWidth-CChannelLogo->getWidth()-10; ly = m_cBoxFrameTitleRel.iY+m_cBoxFrame.iY+ (m_cBoxFrameTitleRel.iHeight-CChannelLogo->getHeight())/2; - CChannelLogo->doScale(m_cBoxFrameTitleRel.iHeight < CChannelLogo->getHeight()); CChannelLogo->setXPos(lx - pb_hdd_offset); CChannelLogo->setYPos(ly); CChannelLogo->paint(); From 3538077821620f356762bf44e2caf6842c1a1fce Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 14 Jan 2015 20:20:11 +0100 Subject: [PATCH 62/98] system/helpers.cpp: getNowTimeStr(), use thread save localtime version --- src/system/helpers.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp index 20b0496cc..f878eb7b3 100644 --- a/src/system/helpers.cpp +++ b/src/system/helpers.cpp @@ -423,8 +423,9 @@ std::string getNowTimeStr(const char* format) { char tmpStr[256]; struct timeval tv; + struct tm t; gettimeofday(&tv, NULL); - strftime(tmpStr, sizeof(tmpStr), format, localtime(&tv.tv_sec)); + strftime(tmpStr, sizeof(tmpStr), format, localtime_r(&tv.tv_sec, &t)); return (std::string)tmpStr; } From c9dd6fac39246ad5f85f617b5a35ac6a8a5bcd04 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 14 Jan 2015 21:44:14 +0100 Subject: [PATCH 63/98] system/helpers.cpp: add return value for mySleep() --- src/system/helpers.cpp | 4 ++-- src/system/helpers.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp index f878eb7b3..abdaeb1a3 100644 --- a/src/system/helpers.cpp +++ b/src/system/helpers.cpp @@ -47,12 +47,12 @@ #include using namespace std; -void mySleep(int sec) { +int mySleep(int sec) { struct timeval timeout; timeout.tv_sec = sec; timeout.tv_usec = 0; - select(0,0,0,0, &timeout); + return select(0,0,0,0, &timeout); } off_t file_size(const char *filename) diff --git a/src/system/helpers.h b/src/system/helpers.h index b9074331b..2f7b51137 100644 --- a/src/system/helpers.h +++ b/src/system/helpers.h @@ -52,7 +52,7 @@ void wakeup_hdd(const char *hdd_dir); int check_dir(const char * dir, bool allow_tmp = false); bool get_fs_usage(const char * dir, uint64_t &btotal, uint64_t &bused, long *bsize=NULL); bool get_mem_usage(unsigned long &total, unsigned long &free); -void mySleep(int sec); +int mySleep(int sec); std::string find_executable(const char *name); /* basically what "foo=`command`" does in the shell */ From be78944eb878ce8c7b9094853d1856f88fad1cbc Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 15 Jan 2015 20:26:18 +0100 Subject: [PATCH 64/98] CScreenSaver: use unified debug output --- src/gui/screensaver.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gui/screensaver.cpp b/src/gui/screensaver.cpp index 5541800be..c21b76ff0 100644 --- a/src/gui/screensaver.cpp +++ b/src/gui/screensaver.cpp @@ -36,7 +36,7 @@ #include #include "audiomute.h" #include "screensaver.h" - +#include #include extern CInfoClock *InfoClock; @@ -167,7 +167,7 @@ bool CScreenSaver::ReadDir() /* open dir */ if((dir=opendir(dir_name)) == NULL) { - fprintf(stderr,"[CScreenSaver] Error opendir ...\n"); + fprintf(stderr,"[CScreenSaver] %s - %d : error open dir...\n", __func__, __LINE__); return ret; } @@ -207,12 +207,12 @@ bool CScreenSaver::ReadDir() /* close pointer */ if(closedir(dir) == -1) - printf("[CScreenSaver] Error no closed %s\n", dir_name); + dprintf(DEBUG_NORMAL, "[CScreenSaver] %s - %d : Error no closed %s\n", __func__, __LINE__, dir_name); if(!v_bg_files.empty()) ret = true; else - printf("[CScreenSaver] no picture found\n"); + dprintf(DEBUG_NORMAL, "[CScreenSaver] %s - %d : no picture found\n", __func__, __LINE__); return ret; } @@ -230,7 +230,7 @@ void CScreenSaver::PaintPicture() return; } - printf("[CScreenSaver] PaintPicture: %s\n", v_bg_files.at(index).c_str()); + dprintf(DEBUG_INFO, "[CScreenSaver] %s - %d : %s\n", __func__, __LINE__, v_bg_files.at(index).c_str()); m_viewer->ShowImage(v_bg_files.at(index).c_str(), false /*unscaled*/); index++; From 016fc14177e1d7065a0be61c981742a16497ca41 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 15 Jan 2015 20:28:38 +0100 Subject: [PATCH 65/98] CScreenSaver: fix wconversion warnings --- src/gui/screensaver.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/screensaver.cpp b/src/gui/screensaver.cpp index c21b76ff0..6106912e6 100644 --- a/src/gui/screensaver.cpp +++ b/src/gui/screensaver.cpp @@ -87,9 +87,9 @@ void CScreenSaver::Start() m_viewer->SetVisible(g_settings.screen_StartX, g_settings.screen_EndX, g_settings.screen_StartY, g_settings.screen_EndY); if (g_settings.video_Format == 3) - m_viewer->SetAspectRatio(16.0/9); + m_viewer->SetAspectRatio(float(16.0/9)); else - m_viewer->SetAspectRatio(4.0/3); + m_viewer->SetAspectRatio(float(4.0/3)); m_viewer->Cleanup(); From 1b3f5847beb2f285f8ab1a3570e8822a97626a5d Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 21 Jan 2015 09:41:43 +0100 Subject: [PATCH 66/98] CComponentsSignals: add signals for hide events --- src/gui/components/cc_signals.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gui/components/cc_signals.h b/src/gui/components/cc_signals.h index 91bc79a5f..4a8cf0bb2 100644 --- a/src/gui/components/cc_signals.h +++ b/src/gui/components/cc_signals.h @@ -111,9 +111,16 @@ class CComponentsSignals : public sigc::trackable ///signal on leave CComponentsForm::ScrollPage() sigc::signal OnAfterScrollPage; + ///signal on before paint() sigc::signal OnBeforePaint; + ///signal on after paint() sigc::signal OnAfterPaint; + ///signal on before execute hide() + sigc::signal OnBeforeHide; + ///signal on after execute hide() + sigc::signal OnAfterHide; + ///signal on CComponentsForm::setSelectedItem() is completed sigc::signal OnSelect; }; From 4a0975eb90172cacb9e6da16c88740080e792dab Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 24 Jan 2015 22:48:01 +0100 Subject: [PATCH 67/98] CComponentsText: expand setTextColor() methode apply color value direct in text box object --- src/gui/components/cc_item_text.cpp | 9 ++++++++- src/gui/components/cc_item_text.h | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/gui/components/cc_item_text.cpp b/src/gui/components/cc_item_text.cpp index 0023cd578..5e361fe64 100644 --- a/src/gui/components/cc_item_text.cpp +++ b/src/gui/components/cc_item_text.cpp @@ -187,7 +187,7 @@ void CComponentsText::setText(const std::string& stext, const int mode, Font* fo ct_text_mode = mode; ct_font = font_text; if (color_text != 0) - ct_col_text = color_text; + setTextColor(color_text); dprintf(DEBUG_DEBUG, "[CComponentsText] [%s - %d] ct_text: %s \n", __func__, __LINE__, ct_text.c_str()); } @@ -298,3 +298,10 @@ int CComponentsText::getTextLinesAutoHeight(const int& textMaxHeight, const int& return ret; } + +void CComponentsText::setTextColor(const fb_pixel_t& color_text) +{ + ct_col_text = color_text; + if (ct_textbox) + ct_textbox->setTextColor(ct_col_text); +} diff --git a/src/gui/components/cc_item_text.h b/src/gui/components/cc_item_text.h index feeda5125..3aa99eda2 100644 --- a/src/gui/components/cc_item_text.h +++ b/src/gui/components/cc_item_text.h @@ -116,7 +116,7 @@ class CComponentsText : public CComponentsItem, public CBox ///send options for text font (size and type), color and mode (allignment) virtual inline void setTextFont(Font* font_text){ct_font = font_text;}; ///set text color - virtual inline void setTextColor(fb_pixel_t color_text){ ct_col_text = color_text;}; + virtual void setTextColor(const fb_pixel_t& color_text); ///get text color virtual inline fb_pixel_t getTextColor(){return ct_col_text;}; ///set text alignment, also see textbox.h for possible alignment modes From 012c699951f01badfbfdfc1bd0da547dd80fe740 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 20 Jan 2015 12:21:44 +0100 Subject: [PATCH 68/98] CComponentsTimer: move pthread members into startTimer() --- src/gui/components/cc_timer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/components/cc_timer.cpp b/src/gui/components/cc_timer.cpp index e303ade61..01cd9da11 100644 --- a/src/gui/components/cc_timer.cpp +++ b/src/gui/components/cc_timer.cpp @@ -55,9 +55,6 @@ CComponentsTimer::~CComponentsTimer() //thread handle void* CComponentsTimer::initTimerThread(void *arg) { - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE,0); - pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS,0); - CComponentsTimer *timer = static_cast(arg); //start loop @@ -76,6 +73,9 @@ bool CComponentsTimer::startTimer() { void *ptr = static_cast(this); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE,0); + pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS,0); + if(!tm_thread) { int res = pthread_create (&tm_thread, NULL, initTimerThread, ptr) ; if (res != 0){ From 592b0025d911889cb45190394517aa96ae823e86 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 25 Jan 2015 15:31:22 +0100 Subject: [PATCH 69/98] CComponentsInfoBox: remove unnecessary call for kill() partial revert of: CComponentsInfoBox: fix centering of image --- src/gui/components/cc_item_infobox.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/gui/components/cc_item_infobox.cpp b/src/gui/components/cc_item_infobox.cpp index 4385341be..0477cf1f3 100644 --- a/src/gui/components/cc_item_infobox.cpp +++ b/src/gui/components/cc_item_infobox.cpp @@ -96,11 +96,9 @@ void CComponentsInfoBox::paintPicture() { //ensure empty pic object if (pic){ - if (pic->isPicPainted()) - pic->kill(); delete pic; + pic = NULL; } - pic = NULL; //exit if no image definied if (pic_name.empty()) From 84ee2dd0593a9273df8cd4b5ea4cdf3ce6358b1d Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 25 Jan 2015 19:31:00 +0100 Subject: [PATCH 70/98] CVolumeBar: use defined volumebar size as default height --- src/gui/volumebar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/volumebar.cpp b/src/gui/volumebar.cpp index b1445c5b2..8a9fd60ca 100644 --- a/src/gui/volumebar.cpp +++ b/src/gui/volumebar.cpp @@ -48,7 +48,7 @@ void CVolumeBar::initVarVolumeBar() col_body = COL_MENUCONTENT_PLUS_0; vb_item_offset = 4; - height = 4*vb_item_offset; //default height + height = g_settings.volume_size; //default height //assume volume value as pointer to global setting vb_vol = &g_settings.current_volume; From 6a50e563219ba33ade341f43d00a0e7b6a7a2881 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 25 Jan 2015 20:01:35 +0100 Subject: [PATCH 71/98] CVolumeBar: optimize icon position --- src/gui/volumebar.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gui/volumebar.cpp b/src/gui/volumebar.cpp index 8a9fd60ca..66e6a5804 100644 --- a/src/gui/volumebar.cpp +++ b/src/gui/volumebar.cpp @@ -89,14 +89,14 @@ void CVolumeBar::initVolumeBarSize() vb_pbw = 200; vb_pbh = height-4*vb_item_offset; - //adapt x-pos - vb_icon_x = vb_item_offset; - vb_pbx = vb_icon_x + vb_icon_w + vb_item_offset; - vb_digit_x = vb_pbx + vb_pbw + vb_item_offset; - //result for width width = (vb_icon_w + vb_pbw + vb_digit_w) + 4*vb_item_offset; + //adapt x-pos + vb_pbx = vb_item_offset + vb_icon_w + vb_item_offset; + vb_icon_x = vb_pbx/2 - vb_icon_w/2 + vb_item_offset; + vb_digit_x = vb_pbx + vb_pbw + vb_item_offset; + // mute icon cvh->getMuteIconDimensions(&mute_ax, &mute_ay, &mute_dx, &mute_dy); // info clock From a9c474e486d2fb6d2b542d154cd1068502d2013b Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 28 Jan 2015 21:16:58 +0100 Subject: [PATCH 72/98] CComponentsInfoBox: fix scale height for larger picons --- src/gui/components/cc_item_infobox.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/components/cc_item_infobox.cpp b/src/gui/components/cc_item_infobox.cpp index 0477cf1f3..1d659e541 100644 --- a/src/gui/components/cc_item_infobox.cpp +++ b/src/gui/components/cc_item_infobox.cpp @@ -105,7 +105,7 @@ void CComponentsInfoBox::paintPicture() return; //init pic object and set icon paint position - pic = new CComponentsPicture(x+fr_thickness+x_offset, y+fr_thickness, 0, height-2*fr_thickness, pic_name); //NOTE: icons do not scale! + pic = new CComponentsPicture(x+fr_thickness+x_offset, y+fr_thickness, 0, min(48, height-2*fr_thickness), pic_name); //NOTE: icons do not scale! pic->setColorBody(col_body); From 58b7c0e6bf75d9f5e56f7512794c4c7f48fb4b52 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 31 Jan 2015 22:29:54 +0100 Subject: [PATCH 73/98] CFileHelpers: declare removeDir() as static allows use without object --- src/system/helpers.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/system/helpers.h b/src/system/helpers.h index 2f7b51137..bf1269620 100644 --- a/src/system/helpers.h +++ b/src/system/helpers.h @@ -90,7 +90,7 @@ class CFileHelpers bool copyDir(const char *Src, const char *Dst, bool backupMode=false); static int createDir(std::string& Dir, mode_t mode = 755); static int createDir(const char *Dir, mode_t mode = 755){std::string dir = std::string(Dir);return createDir(dir, mode);} - bool removeDir(const char *Dir); + static bool removeDir(const char *Dir); }; std::string to_string(int); From 1b095e725e8f1e84701a87f0111e68ecb4193ed3 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 7 Feb 2015 14:59:20 +0100 Subject: [PATCH 74/98] CFileHelpers: add function getDirSize() --- src/system/helpers.cpp | 28 ++++++++++++++++++++++++++++ src/system/helpers.h | 2 ++ 2 files changed, 30 insertions(+) diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp index abdaeb1a3..0b5b82a49 100644 --- a/src/system/helpers.cpp +++ b/src/system/helpers.cpp @@ -722,6 +722,34 @@ bool CFileHelpers::removeDir(const char *Dir) return true; } +u_int64_t CFileHelpers::getDirSize(const char *dirname) +{ + DIR *d; + struct dirent *de; + struct stat buf; + int exists; + u_int64_t total_size = 0; + + d = opendir(dirname); + if (d == NULL) { + perror("prsize"); + return 0; + } + + for (de = readdir(d); de != NULL; de = readdir(d)) { + exists = stat(de->d_name, &buf); + if (exists < 0) { + fprintf(stderr, "Couldn't stat %s\n", de->d_name); + } else { + total_size += buf.st_size; + } + } + + closedir(d); + + return total_size; +} + static int hdd_open_dev(const char * fname) { FILE * fp; diff --git a/src/system/helpers.h b/src/system/helpers.h index bf1269620..3b9060c60 100644 --- a/src/system/helpers.h +++ b/src/system/helpers.h @@ -91,6 +91,8 @@ class CFileHelpers static int createDir(std::string& Dir, mode_t mode = 755); static int createDir(const char *Dir, mode_t mode = 755){std::string dir = std::string(Dir);return createDir(dir, mode);} static bool removeDir(const char *Dir); + static uint64_t getDirSize(const char *dir); + static uint64_t getDirSize(const std::string& dir){return getDirSize(dir.c_str());}; }; std::string to_string(int); From a185ad34d40e2f3e2f0ab71b02740957fe748832 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 7 Feb 2015 18:43:30 +0100 Subject: [PATCH 75/98] CFileHelpers: rework methode getDirSize(), makes it work recursively --- src/system/helpers.cpp | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp index 0b5b82a49..d273f26fe 100644 --- a/src/system/helpers.cpp +++ b/src/system/helpers.cpp @@ -724,28 +724,35 @@ bool CFileHelpers::removeDir(const char *Dir) u_int64_t CFileHelpers::getDirSize(const char *dirname) { - DIR *d; - struct dirent *de; - struct stat buf; - int exists; - u_int64_t total_size = 0; + DIR *dir; + char fullDirName[500]; + struct dirent *dirPnt; + struct stat cur_file; + uint64_t total_size = 0; - d = opendir(dirname); - if (d == NULL) { - perror("prsize"); + //open current dir + sprintf(fullDirName, "%s/", dirname); + if((dir = opendir(fullDirName)) == NULL) { + fprintf(stderr, "Couldn't open %s\n", fullDirName); return 0; } - for (de = readdir(d); de != NULL; de = readdir(d)) { - exists = stat(de->d_name, &buf); - if (exists < 0) { - fprintf(stderr, "Couldn't stat %s\n", de->d_name); - } else { - total_size += buf.st_size; - } - } + //go through the directory + while( (dirPnt = readdir(dir)) != NULL ) { + if(strcmp((*dirPnt).d_name, "..") == 0 || strcmp((*dirPnt).d_name, ".") == 0) + continue; - closedir(d); + //create current filepath + sprintf(fullDirName, "%s/%s", dirname, (*dirPnt).d_name); + if(stat(fullDirName, &cur_file) == -1) + continue; + + if(cur_file.st_mode & S_IFREG) //file... + total_size += cur_file.st_size; + else if(cur_file.st_mode & S_IFDIR) //dir... + total_size += getDirSize(fullDirName); + } + closedir(dir); return total_size; } From d2ae57e5b61ced783e509138727e9fe894b768b3 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 22 Feb 2015 14:21:51 +0100 Subject: [PATCH 76/98] CComponentsText: avoid unintentional overwriting of current property values If parameters were not explicitly defined, default values of parameters overwrite current property values. --- src/gui/components/cc_item_text.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/components/cc_item_text.cpp b/src/gui/components/cc_item_text.cpp index 5e361fe64..0251666e0 100644 --- a/src/gui/components/cc_item_text.cpp +++ b/src/gui/components/cc_item_text.cpp @@ -184,8 +184,10 @@ void CComponentsText::setText(const std::string& stext, const int mode, Font* fo { ct_old_text = ct_text; ct_text = stext; - ct_text_mode = mode; - ct_font = font_text; + if (mode != ~CTextBox::AUTO_WIDTH) + ct_text_mode = mode; + if (font_text) + ct_font = font_text; if (color_text != 0) setTextColor(color_text); From 341b142aa0c95f82ec19746e4b06dc14660dcd4d Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 22 Feb 2015 14:47:43 +0100 Subject: [PATCH 77/98] CComponentsText: add possibilty to set font style Usable with methode setText() and parameter 'style' provided enums are: FONT_STYLE_REGULAR FONT_STYLE_BOLD FONT_STYLE_ITALIC --- src/gui/components/cc_item_text.cpp | 23 +++++++++++++---------- src/gui/components/cc_item_text.h | 18 +++++++++++++----- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/src/gui/components/cc_item_text.cpp b/src/gui/components/cc_item_text.cpp index 0251666e0..e3e4aa878 100644 --- a/src/gui/components/cc_item_text.cpp +++ b/src/gui/components/cc_item_text.cpp @@ -81,6 +81,7 @@ void CComponentsText::initVarText( const int x_pos, const int y_pos, const int w ct_text = text; ct_old_text = ct_text; ct_text_mode = mode; + ct_text_style = FONT_STYLE_REGULAR; iX = x = x_pos; iY = y = y_pos; @@ -113,7 +114,7 @@ void CComponentsText::initCCText() { //set default font, if is no font definied if (ct_font == NULL) - ct_font = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]; + ct_font = *CNeutrinoFonts::getInstance()->getDynFont(width, height, ct_text, ct_text_style)/*g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]*/; //define height from font size height = max(height, ct_font->getHeight()); @@ -180,7 +181,7 @@ void CComponentsText::clearCCText() ct_textbox = NULL; } -void CComponentsText::setText(const std::string& stext, const int mode, Font* font_text, const fb_pixel_t& color_text) +void CComponentsText::setText(const std::string& stext, const int mode, Font* font_text, const fb_pixel_t& color_text, const int& style) { ct_old_text = ct_text; ct_text = stext; @@ -190,25 +191,27 @@ void CComponentsText::setText(const std::string& stext, const int mode, Font* fo ct_font = font_text; if (color_text != 0) setTextColor(color_text); + if (style != FONT_STYLE_REGULAR) + ct_text_style = style; dprintf(DEBUG_DEBUG, "[CComponentsText] [%s - %d] ct_text: %s \n", __func__, __LINE__, ct_text.c_str()); } -void CComponentsText::setText(neutrino_locale_t locale_text, int mode, Font* font_text, const fb_pixel_t& color_text) +void CComponentsText::setText(neutrino_locale_t locale_text, int mode, Font* font_text, const fb_pixel_t& color_text, const int& style) { string stext = g_Locale->getText(locale_text); - setText(stext, mode, font_text, color_text); + setText(stext, mode, font_text, color_text, style); } -void CComponentsText::setText(const char* ctext, const int mode, Font* font_text, const fb_pixel_t& color_text) +void CComponentsText::setText(const char* ctext, const int mode, Font* font_text, const fb_pixel_t& color_text, const int& style) { - setText((string)ctext, mode, font_text, color_text); + setText((string)ctext, mode, font_text, color_text, style); } -void CComponentsText::setText(const int digit, const int mode, Font* font_text, const fb_pixel_t& color_text) +void CComponentsText::setText(const int digit, const int mode, Font* font_text, const fb_pixel_t& color_text, const int& style) { string s_digit = iToString(digit); - setText(s_digit, mode, font_text, color_text); + setText(s_digit, mode, font_text, color_text, style); } string CComponentsText::getTextFromFile(const string& path_to_textfile) @@ -232,14 +235,14 @@ string CComponentsText::getTextFromFile(const string& path_to_textfile) } //set text lines directly from a file, returns true on succsess -bool CComponentsText::setTextFromFile(const string& path_to_textfile, const int mode, Font* font_text, const fb_pixel_t& color_text) +bool CComponentsText::setTextFromFile(const string& path_to_textfile, const int mode, Font* font_text, const fb_pixel_t& color_text, const int& style) { string txt = getTextFromFile(path_to_textfile); if (txt.empty()) return false; - setText(txt, mode, font_text, color_text); + setText(txt, mode, font_text, color_text, style); return true; } diff --git a/src/gui/components/cc_item_text.h b/src/gui/components/cc_item_text.h index 3aa99eda2..96307f2b7 100644 --- a/src/gui/components/cc_item_text.h +++ b/src/gui/components/cc_item_text.h @@ -45,6 +45,8 @@ class CComponentsText : public CComponentsItem, public CBox CTextBox * ct_textbox; ///object: Fontrenderer object Font * ct_font; + ///property: font style + int ct_text_style; ///property: text color fb_pixel_t ct_col_text; @@ -89,6 +91,12 @@ class CComponentsText : public CComponentsItem, public CBox ///paint CCItem backckrond (if paint_bg=true), apply initCCText() and send paint() to the CTextBox object void paintText(bool do_save_bg = CC_SAVE_SCREEN_YES); public: + enum { + FONT_STYLE_REGULAR = 0, + FONT_STYLE_BOLD = 1, + FONT_STYLE_ITALIC = 2 + }; + CComponentsText( const int x_pos = 10, const int y_pos = 10, const int w = 150, const int h = 50, std::string text = "", const int mode = CTextBox::AUTO_WIDTH, @@ -128,15 +136,15 @@ class CComponentsText : public CComponentsItem, public CBox virtual inline void doPaintTextBoxBg(bool do_paintbox_bg){ ct_paint_textbg = do_paintbox_bg;}; ///set text as string also possible with overloades members for loacales, const char and text file - virtual void setText(const std::string& stext, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL, const fb_pixel_t& color_text = 0); + virtual void setText(const std::string& stext, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL, const fb_pixel_t& color_text = 0, const int& style = FONT_STYLE_REGULAR); ///set text with const char* - virtual void setText(const char* ctext, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL, const fb_pixel_t& color_text = 0); + virtual void setText(const char* ctext, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL, const fb_pixel_t& color_text = 0, const int& style = FONT_STYLE_REGULAR); ///set text from locale - virtual void setText(neutrino_locale_t locale_text, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL, const fb_pixel_t& color_text = 0); + virtual void setText(neutrino_locale_t locale_text, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL, const fb_pixel_t& color_text = 0, const int& style = FONT_STYLE_REGULAR); ///set text from digit, digit is integer - virtual void setText(const int digit, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL, const fb_pixel_t& color_text = 0); + virtual void setText(const int digit, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL, const fb_pixel_t& color_text = 0, const int& style = FONT_STYLE_REGULAR); ///set text directly from a textfile, path as string is required - virtual bool setTextFromFile(const std::string& path_to_textfile, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL, const fb_pixel_t& color_text = 0); + virtual bool setTextFromFile(const std::string& path_to_textfile, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL, const fb_pixel_t& color_text = 0, const int& style = FONT_STYLE_REGULAR); ///get text directly from a textfile, path as string is required virtual std::string getTextFromFile(const std::string& path_to_textfile); ///returns current text content of text/label object as std::string From 0d6f0a8c883bf005182d921258b2be9a3f1c6c21 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 1 Mar 2015 22:58:33 +0100 Subject: [PATCH 78/98] CNeutrinoApp: rework switch handling for channallist paint In some cases it is advantageous if you can override paint of channellist, e.g. if RC_ok is shared with other window handlers. In such cases will so could be avoided. --- src/neutrino.cpp | 18 ++++++++++++++---- src/neutrino.h | 6 ++++-- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 6f988d5c5..a55be8789 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -233,7 +233,8 @@ CNeutrinoApp::CNeutrinoApp() favorites_changed = false; bouquets_changed = false; channels_init = false; - channellist_visible = false; + channelList_allowed = true; + channelList_painted = false; } /*------------------------------------------------------------------------------------- @@ -2490,10 +2491,18 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) int CNeutrinoApp::showChannelList(const neutrino_msg_t _msg, bool from_menu) { + /* Exit here if paint of channlellist is not allowed, disallow could be possible, eg: if + * RC_ok or other stuff is shared with other window handlers and + * it's easy here to disable channellist paint if required! + */ + if (!channelList_allowed){ + channelList_allowed = true; + return menu_return::RETURN_NONE; + } + channelList_painted = false; + neutrino_msg_t msg = _msg; InfoClock->enableInfoClock(false); - channellist_visible = true; - StopSubtitles(); //_show: @@ -2582,7 +2591,8 @@ _repeat: SetChannelMode(LIST_MODE_FAV); } - channellist_visible = false; + channelList_painted = true; + if (!from_menu) InfoClock->enableInfoClock(true); diff --git a/src/neutrino.h b/src/neutrino.h index 51b000e51..424a05d03 100644 --- a/src/neutrino.h +++ b/src/neutrino.h @@ -105,7 +105,8 @@ private: int tvsort[LIST_MODE_LAST]; int radiosort[LIST_MODE_LAST]; - bool channellist_visible; + bool channelList_allowed; + bool channelList_painted; int first_mode_found; void SDT_ReloadChannels(); @@ -219,8 +220,9 @@ public: void saveEpg(bool cvfd_mode); void stopDaemonsForFlash(); int showChannelList(const neutrino_msg_t msg, bool from_menu = false); + void allowChannelList(bool allow){channelList_allowed = allow;} CPersonalizeGui & getPersonalizeGui() { return personalize; } - bool getChannellistIsVisible() { return channellist_visible; } + bool getChannellistIsVisible() { return channelList_painted; } void zapTo(t_channel_id channel_id); bool wakeupFromStandby(void); void standbyToStandby(void); From eb3971e9090dd798ec7e3e2aa436d53c776b271c Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 3 Mar 2015 23:03:31 +0100 Subject: [PATCH 79/98] COsdSetup: use paint for apply new gradient settings, reduced flicker effects --- src/gui/osd_setup.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/osd_setup.cpp b/src/gui/osd_setup.cpp index 8b393a13b..6172918ea 100644 --- a/src/gui/osd_setup.cpp +++ b/src/gui/osd_setup.cpp @@ -1136,8 +1136,8 @@ bool COsdSetup::changeNotify(const neutrino_locale_t OptionName, void * data) return false; } else if(ARE_LOCALES_EQUAL(OptionName, LOCALE_COLOR_GRADIENT)) { - osd_menu->hide(); - return true; + osd_menu->paint(); + return false; } else if(ARE_LOCALES_EQUAL(OptionName, LOCALE_COLORMENU_OSD_PRESET)) { int preset = * (int *) data; From 45623aa810515f671bc7b5b150da84f71c5130f3 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 28 Feb 2015 23:22:19 +0100 Subject: [PATCH 80/98] CComponentsTimer: move mySleep call into mutex block, seems was not ok so --- src/gui/components/cc_timer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/components/cc_timer.cpp b/src/gui/components/cc_timer.cpp index 01cd9da11..a2d30ec75 100644 --- a/src/gui/components/cc_timer.cpp +++ b/src/gui/components/cc_timer.cpp @@ -61,8 +61,8 @@ void* CComponentsTimer::initTimerThread(void *arg) while(timer) { timer->mutex.lock(); timer->OnTimer(); - timer->mutex.unlock(); mySleep(timer->tm_interval); + timer->mutex.unlock(); } return 0; From b9e04a4999af63dd5626e473ef6192fff95faeca Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 18 Mar 2015 12:03:33 +0100 Subject: [PATCH 81/98] CNeutrinoFonts: use neutrino debug output as default with line numbers --- src/driver/neutrinofonts.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/driver/neutrinofonts.cpp b/src/driver/neutrinofonts.cpp index 3cf0ddb03..d0a2b6ad0 100644 --- a/src/driver/neutrinofonts.cpp +++ b/src/driver/neutrinofonts.cpp @@ -117,7 +117,7 @@ void CNeutrinoFonts::SetupDynamicFonts(bool initRenderClass/*=true*/) dynFontStyle[0] = g_dynFontRenderer->AddFont(fontDescr.filename.c_str()); fontDescr.name = g_dynFontRenderer->getFamily(fontDescr.filename.c_str()); - dprintf(DEBUG_NORMAL, " dynamic font family: %s\n", fontDescr.name.c_str()); + dprintf(DEBUG_NORMAL, "[CNeutrinoFonts] [%s - %d] dynamic font family: %s\n", __func__, __LINE__, fontDescr.name.c_str()); dynFontStyle[1] = "Bold Regular"; g_dynFontRenderer->AddFont(fontDescr.filename.c_str(), true); // make italics @@ -135,14 +135,14 @@ void CNeutrinoFonts::SetupNeutrinoFonts(bool initRenderClass/*=true*/) old_fontDescr.size_offset = fontDescr.size_offset; old_fontDescr.filename = fontDescr.filename; fontDescr.filename = ""; - dprintf(DEBUG_NORMAL, "font file: %s\n", g_settings.font_file.c_str()); + dprintf(DEBUG_NORMAL, "[CNeutrinoFonts] [%s - %d] font file: %s\n", __func__, __LINE__, g_settings.font_file.c_str()); if (access(g_settings.font_file.c_str(), F_OK)) { if (!access(FONTDIR"/neutrino.ttf", F_OK)) { fontDescr.filename = FONTDIR"/neutrino.ttf"; g_settings.font_file = fontDescr.filename; } else { - fprintf( stderr,"[neutrino] font file [%s] not found\n neutrino exit\n",FONTDIR"/neutrino.ttf"); + fprintf( stderr,"[CNeutrinoFonts] [%s - %d] font file [%s] not found\n neutrino exit\n", __func__, __LINE__, FONTDIR"/neutrino.ttf"); _exit(0); } } @@ -154,7 +154,7 @@ void CNeutrinoFonts::SetupNeutrinoFonts(bool initRenderClass/*=true*/) old_fontDescr.name = fontDescr.name; fontDescr.name = ""; fontDescr.name = g_fontRenderer->getFamily(fontDescr.filename.c_str()); - dprintf(DEBUG_NORMAL, "standard font family: %s\n", fontDescr.name.c_str()); + dprintf(DEBUG_NORMAL, "[CNeutrinoFonts] [%s - %d] standard font family: %s\n", __func__, __LINE__, fontDescr.name.c_str()); fontStyle[1] = "Bold Regular"; g_fontRenderer->AddFont(fontDescr.filename.c_str(), true); // make italics @@ -209,10 +209,11 @@ void CNeutrinoFonts::refreshDynFont(int dx, int dy, std::string text, int style, Font *dynFont = g_dynFontRenderer->getFont(fontDescr.name.c_str(), dynFontStyle[style].c_str(), dynSize); dyn_font->font = dynFont; dyn_font->size = dynSize; - if (dyn_font->size != dynSize) - printf("##### [%s] change %s_font size old %d to new %d, index: %u\n", __FUNCTION__, (isShare)?"share":"dyn", oldSize, dyn_font->size, index); - else - printf("##### [%s] refresh %s_font size %d, index: %u\n", __FUNCTION__, (isShare)?"share":"dyn", dyn_font->size, index); + if (dyn_font->size != dynSize){ + dprintf(DEBUG_NORMAL, "[CNeutrinoFonts] [%s - %d] change %s_font size old %d to new %d, index: %u\n", __func__, __LINE__, (isShare)?"share":"dyn", oldSize, dyn_font->size, index); + }else{ + dprintf(DEBUG_NORMAL, "[CNeutrinoFonts] [%s - %d] refresh %s_font size %d, index: %u\n",__func__, __LINE__, (isShare)?"share":"dyn", dyn_font->size, index); + } } int CNeutrinoFonts::getFontHeight(Font* fnt) From 459c12006017a21543c45e3142f35e3599c8ad79 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 19 Mar 2015 08:00:25 +0100 Subject: [PATCH 82/98] CTextBox: catching error if position has signed values Wrong position assignments can trigger crash. Prevent segfaults. Error log should indicate this. --- src/gui/widget/textbox.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/gui/widget/textbox.cpp b/src/gui/widget/textbox.cpp index 021c4cd95..bbe28d4a3 100644 --- a/src/gui/widget/textbox.cpp +++ b/src/gui/widget/textbox.cpp @@ -56,7 +56,7 @@ #endif #include - +#include #include "textbox.h" #include @@ -553,13 +553,13 @@ void CTextBox::refreshText(void) //bg variables int ax = m_cFrameTextRel.iX+m_cFrame.iX; - int ay = /*m_cFrameTextRel.iY+*/m_cFrame.iY; + int ay = m_cFrameTextRel.iY+m_cFrame.iY; int dx = m_cFrameTextRel.iWidth; int dy = m_cFrameTextRel.iHeight; //find changes bool has_changed = hasChanged(&ax, &ay, &dx, &dy); - + //destroy pixel buffer on changed property values if (has_changed){ if (m_bgpixbuf){ @@ -569,6 +569,12 @@ void CTextBox::refreshText(void) } } + //detect corrupt position values + if ((ax<=0) || (ay<=0)){ + dprintf(DEBUG_NORMAL, "\033[33m[CTextBox] [%s - %d] ERROR! position out of range: ax = %d, ay = %d, dx = %d, dy = %d\033[0m\n", __func__, __LINE__, ax, ay, dx, dy); + return; + } + //save screen only if no paint of background required if (!m_nPaintBackground && m_SaveScreen) { if (m_bgpixbuf == NULL){ From e631559555bd6170bf25b16647b4b6966ba1ce29 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 19 Mar 2015 12:04:20 +0100 Subject: [PATCH 83/98] CChannelList: fix paint of unscaled images Unscaled images were never painted. --- src/gui/channellist.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 52b64c72c..d08569dc1 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -1672,10 +1672,10 @@ void CChannelList::showChannelLogo() CChannelLogo->setHeight(theight); int w_logo = h_ratio*CChannelLogo->getWidth()/100; CChannelLogo->setWidth(min(w_logo, logo_w_max)); - CChannelLogo->setXPos(x + full_width - logo_off - CChannelLogo->getWidth()); - CChannelLogo->setYPos(y + (theight - CChannelLogo->getHeight()) / 2); - CChannelLogo->paint(); } + CChannelLogo->setXPos(x + full_width - logo_off - CChannelLogo->getWidth()); + CChannelLogo->setYPos(y + (theight - CChannelLogo->getHeight()) / 2); + CChannelLogo->paint(); } else { delete CChannelLogo; CChannelLogo = NULL; From 47b37d440543ecec165702b856bda6c9e42459e1 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 28 Mar 2015 20:59:53 +0100 Subject: [PATCH 84/98] CComponentsButton: disable gradient Not necessary as long not all or most gui buttons can provide gradient --- src/gui/components/cc_frm_button.cpp | 8 ++++---- src/gui/components/cc_frm_button.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gui/components/cc_frm_button.cpp b/src/gui/components/cc_frm_button.cpp index 3c70efa4a..0d5a3ed17 100644 --- a/src/gui/components/cc_frm_button.cpp +++ b/src/gui/components/cc_frm_button.cpp @@ -101,12 +101,12 @@ void CComponentsButton::initVarButton( const int& x_pos, const int& y_pos, const height = h; shadow = has_shadow; shadow_w = SHADOW_OFFSET; - col_frame = color_frame; - col_body = color_body; - col_shadow = color_shadow; - col_body_gradient = g_settings.gradiant; + col_body_gradient = false/*g_settings.gradiant*/; //gradient is prepared for use but disabled at the moment till some other parts of gui parts are provide gradient setColBodyGradient(CColorGradient::gradientLight2Dark, CFrameBuffer::gradientVertical, CColorGradient::light); + col_frame = color_frame; + col_body = col_body_gradient? COL_DARK_GRAY : color_body; + col_shadow = color_shadow; cc_item_enabled = enabled; cc_item_selected = selected; diff --git a/src/gui/components/cc_frm_button.h b/src/gui/components/cc_frm_button.h index cfead2d37..95d2a9d09 100644 --- a/src/gui/components/cc_frm_button.h +++ b/src/gui/components/cc_frm_button.h @@ -35,7 +35,7 @@ #include #include -#define COL_BUTTON_BODY COL_DARK_GRAY +#define COL_BUTTON_BODY COL_INFOBAR_SHADOW_PLUS_1 #define COL_BUTTON_TEXT_ENABLED COL_BLACK #define COL_BUTTON_TEXT_DISABLED COL_LIGHT_GRAY From 5750ca23ae5516dc3c9a142e2b032356b890703b Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 8 Feb 2015 11:24:49 +0100 Subject: [PATCH 85/98] opkg_manager: add a list of packages to hide Advanced build system can come up with an impressive list of (sub-)packages, most of them not really interesting for installation through the GUI. Add a filter with simple patterns to suppress the display of those packages. TODO: this should be made configurable via a run-time config file. Signed-off-by: Markus Volk --- src/gui/opkg_manager.cpp | 44 ++++++++++++++++++++++++++++++++++++++++ src/gui/opkg_manager.h | 1 + 2 files changed, 45 insertions(+) diff --git a/src/gui/opkg_manager.cpp b/src/gui/opkg_manager.cpp index 959dca1c0..f569ea16a 100644 --- a/src/gui/opkg_manager.cpp +++ b/src/gui/opkg_manager.cpp @@ -187,12 +187,52 @@ static const struct button_label COPKGManagerFooterButtonsExpert[COPKGManagerFoo { NEUTRINO_ICON_BUTTON_BLUE, LOCALE_OPKG_BUTTON_UNINSTALL } }; +/* TODO: this should go into a config file... */ +static std::string bad_pattern[] = { + "-dev$", + "-doc$", + "-dbg$", + "-ptest$", + "-staticdev$", + "-locale-", + "-charmap-", + "-gconv-", + "-localedata-", + "^locale-base-", + "^perl-module-", + "" +}; + +bool COPKGManager::badpackage(std::string &s) +{ + int i; + for (i = 0; !bad_pattern[i].empty(); i++) + { + std::string p = bad_pattern[i]; + size_t patlen = p.length() - 1; + /* poor man's regex :-) only supported are "^" and "$" */ + if (p.substr(patlen, 1) == "$") { /* match at end */ + if (s.rfind(p.substr(0, patlen)) == (s.length() - patlen)) + return true; + } else if (p.substr(0, 1) == "^") { /* match at beginning */ + if (s.find(p.substr(1)) == 0) + return true; + } else { /* match everywhere */ + if (s.find(p) != std::string::npos) + return true; + } + } + return false; +} + void COPKGManager::updateMenu() { bool upgradesAvailable = false; getPkgData(OM_LIST_INSTALLED); getPkgData(OM_LIST_UPGRADEABLE); for (std::map::iterator it = pkg_map.begin(); it != pkg_map.end(); it++) { + if (badpackage(it->second.name)) + continue; it->second.forwarder->iconName_Info_right = ""; it->second.forwarder->setActive(true); if (it->second.upgradable) { @@ -249,6 +289,8 @@ int COPKGManager::showMenu() pkg_vec.clear(); for (std::map::iterator it = pkg_map.begin(); it != pkg_map.end(); it++) { + if (badpackage(it->second.name)) + continue; it->second.forwarder = new CMenuForwarder(it->second.desc, true, NULL , this, it->second.name.c_str()); it->second.forwarder->setHint("", it->second.desc); menu->addItem(it->second.forwarder); @@ -322,6 +364,8 @@ void COPKGManager::getPkgData(const int pkg_content_id) while (fgets(buf, sizeof(buf), f)) { + if (buf[0] == ' ') + continue; /* second, third, ... line of description will not be shown anyway */ std::string line(buf); trim(line); diff --git a/src/gui/opkg_manager.h b/src/gui/opkg_manager.h index 26e89afcb..c5f014ea5 100644 --- a/src/gui/opkg_manager.h +++ b/src/gui/opkg_manager.h @@ -67,6 +67,7 @@ class COPKGManager : public CMenuTarget int showMenu(); void updateMenu(); void refreshMenu(); + bool badpackage(std::string &s); struct pkg { std::string name; From ae139d4ec2a3da95d6fb2fb7089a480f4a45b5f3 Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Tue, 31 Mar 2015 09:27:59 +0200 Subject: [PATCH 86/98] CComponentsText: Fix default font --- src/gui/components/cc_item_text.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/components/cc_item_text.cpp b/src/gui/components/cc_item_text.cpp index e3e4aa878..c24e255e0 100644 --- a/src/gui/components/cc_item_text.cpp +++ b/src/gui/components/cc_item_text.cpp @@ -114,7 +114,7 @@ void CComponentsText::initCCText() { //set default font, if is no font definied if (ct_font == NULL) - ct_font = *CNeutrinoFonts::getInstance()->getDynFont(width, height, ct_text, ct_text_style)/*g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]*/; + ct_font = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]; //define height from font size height = max(height, ct_font->getHeight()); From 17b7cc98b2bdad2b08abb523e3f1ddc9536f5a24 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 2 Apr 2015 09:43:52 +0200 Subject: [PATCH 87/98] CNeutrinoApp: fix rebase error comes with: CNeutrinoApp: rework switch handling for channallist paint --- src/neutrino.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index a55be8789..e045c8389 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -2499,7 +2499,7 @@ int CNeutrinoApp::showChannelList(const neutrino_msg_t _msg, bool from_menu) channelList_allowed = true; return menu_return::RETURN_NONE; } - channelList_painted = false; + channelList_painted = true; neutrino_msg_t msg = _msg; InfoClock->enableInfoClock(false); @@ -2591,7 +2591,7 @@ _repeat: SetChannelMode(LIST_MODE_FAV); } - channelList_painted = true; + channelList_painted = false; if (!from_menu) InfoClock->enableInfoClock(true); From 80457beaf6b7d3550c40a18985a829062fc3bea5 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 4 Apr 2015 22:35:57 +0200 Subject: [PATCH 88/98] CComponentsPicture: add sub classes for scalable images and channel logos This could replace call of CComponentsPicture objects with explicit dimension values = 0 --- src/gui/components/cc_item_picture.h | 71 ++++++++++++++++++++++++++-- 1 file changed, 68 insertions(+), 3 deletions(-) diff --git a/src/gui/components/cc_item_picture.h b/src/gui/components/cc_item_picture.h index d6a1a3640..2f84d0eca 100644 --- a/src/gui/components/cc_item_picture.h +++ b/src/gui/components/cc_item_picture.h @@ -86,7 +86,15 @@ class CComponentsPicture : public CComponentsItem void SetTransparent(int t){ image_transparent = t; } public: - ///constructor for image objects, use this for scaled images, scaling dimensions are defined with parameters w (width) and h (height), only values >0 causes scale of image + /*! + Constructor for image objects: use this for scaled images. + Dimensions are defined with parameters w (width) and h (height). + Note: only dimension values >0 causes scaling of image! + Note: See also class CComponentsPictureScalable(). That does the same like this, but uses internal value 0 for parameters w (width) and h (height). + If scaling is not required, you should use overloaded version that comes without dimension parameters. + If no dimensions are defined (in constructor or e.g. with setWidth() or setHeight(), + width and height are defined by image itself and are retrievable e.g. with getWidth() or getHeight(). + */ CComponentsPicture( const int &x_pos, const int &y_pos, const int &w, const int &h, const std::string& image_name, CComponentsForm *parent = NULL, @@ -96,7 +104,13 @@ class CComponentsPicture : public CComponentsItem fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0, int transparent = CFrameBuffer::TM_NONE); - ///constructor for image objects, use this for non scaled images, dimensions are defined by image size + /*! + Constructor for image objects, use this for non scaled images. This is similar with known method paintIcon() from framebuffer class. + Dimensions are defined by image itself. + Note: you can use the dimension setters setWidth() or setHeight() too, but this has only effects for item body, not for image! + If scaling is required, you should use overloaded version above, that comes with dimension parameters or use + class CComponentsPictureScalable(). + */ CComponentsPicture( const int &x_pos, const int &y_pos, const std::string& image_name, CComponentsForm *parent = NULL, @@ -136,6 +150,24 @@ class CComponentsPicture : public CComponentsItem virtual void hide(bool no_restore = false); }; +class CComponentsPictureScalable : public CComponentsPicture +{ + public: + /*! + Constructor for image objects: use this for scaled images. + Does the same like class CComponentsPicture() with assigned value 0 for parameters w (width) and h (height). + */ + CComponentsPictureScalable( const int &x_pos, const int &y_pos, + const std::string& image_name, + CComponentsForm *parent = NULL, + bool has_shadow = CC_SHADOW_OFF, + fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, + fb_pixel_t color_background = 0, + fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0, + int transparent = CFrameBuffer::TM_NONE) + : CComponentsPicture(x_pos, y_pos, 0, 0, image_name, parent, has_shadow, color_frame, color_background, color_shadow, transparent){}; +}; + class CComponentsChannelLogo : public CComponentsPicture { private: @@ -153,6 +185,12 @@ class CComponentsChannelLogo : public CComponentsPicture void init(const uint64_t& channelId, const std::string& channelName, bool allow_scale); public: + /*! + Constructor for channel image objects: use this for scaled channel logos. + Does the same like class CComponentsPicture() with parameters w (width) and h (height), see above! + Requires parameter channel_name or channelId instead image filename + NOTE: channel name string is prefered! + */ CComponentsChannelLogo( const int &x_pos, const int &y_pos, const int &w, const int &h, const std::string& channelName = "", const uint64_t& channelId =0, @@ -162,7 +200,13 @@ class CComponentsChannelLogo : public CComponentsPicture fb_pixel_t color_background = 0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0, int transparent = CFrameBuffer::TM_BLACK); - + + /*! + Constructor for channel image objects: use this for non scaled channel logos. + Does the same like class CComponentsPicture() without parameters w (width) and h (height), see above! + Requires parameter channel_name or channelId instead image filename + NOTE: channel name string is prefered! + */ CComponentsChannelLogo( const int &x_pos, const int &y_pos, const std::string& channelName = "", const uint64_t& channelId =0, @@ -186,4 +230,25 @@ class CComponentsChannelLogo : public CComponentsPicture }; +class CComponentsChannelLogoScalable : public CComponentsChannelLogo +{ + public: + /*! + Constructor for channel image objects: use this for scaled channel logos. + Does the same like class CComponentsPictureScalable(), see above! + Requires parameter channel_name or channelId instead image filename. + NOTE: channel name string is prefered! + */ + CComponentsChannelLogoScalable( const int &x_pos, const int &y_pos, + const std::string& channelName = "", + const uint64_t& channelId =0, + CComponentsForm *parent = NULL, + bool has_shadow = CC_SHADOW_OFF, + fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, + fb_pixel_t color_background = 0, + fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0, + int transparent = CFrameBuffer::TM_BLACK) + : CComponentsChannelLogo(x_pos, y_pos, 0, 0, channelName, channelId, parent, has_shadow, color_frame, color_background, color_shadow, transparent){}; +}; + #endif From 388ab3aa02750cb1e7b1612e9a8dcab5692e5db6 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 4 Apr 2015 23:32:48 +0200 Subject: [PATCH 89/98] CChannelList: use class for scalable channel logos Previous class used limited scale handling mainly with the member paintIcon() by framebuffer class. Because of many possible channel logo files, the icon cache was filled very fast. That was never considered in paintIcon() and caused strange behavior at screen, as no image data were assigned correctly. --- src/gui/channellist.cpp | 2 +- src/gui/channellist.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index d08569dc1..2da427a7b 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -1663,7 +1663,7 @@ void CChannelList::showChannelLogo() CChannelLogo->hide(); delete CChannelLogo; } - CChannelLogo = new CComponentsChannelLogo(0, 0, (*chanlist)[selected]->getName(), (*chanlist)[selected]->channel_id); + CChannelLogo = new CComponentsChannelLogoScalable(0, 0, (*chanlist)[selected]->getName(), (*chanlist)[selected]->channel_id); if (CChannelLogo->hasLogo()){ int h_logo = CChannelLogo->getHeight(); diff --git a/src/gui/channellist.h b/src/gui/channellist.h index 91ac932de..8d584e4eb 100644 --- a/src/gui/channellist.h +++ b/src/gui/channellist.h @@ -127,7 +127,7 @@ private: int ChannelList_Rec; - CComponentsChannelLogo* CChannelLogo; + CComponentsChannelLogoScalable* CChannelLogo; bool headerNew; void paintDetails(int index); From ba6f26525551b3bf9c12b6632f9d9d838f38fd1f Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 5 Apr 2015 17:38:20 +0200 Subject: [PATCH 90/98] CFrameBuffer: add comment for unsolved issue on full icon cache --- src/driver/framebuffer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/driver/framebuffer.cpp b/src/driver/framebuffer.cpp index 6060ddb39..19f927b09 100644 --- a/src/driver/framebuffer.cpp +++ b/src/driver/framebuffer.cpp @@ -1075,7 +1075,7 @@ bool CFrameBuffer::paintIcon(const std::string & filename, const int x, const in data = g_PicViewer->getIcon(newname, &width, &height); - if(data) { + if(data) { //TODO: intercepting of possible full icon cache, that could cause strange behavior while painting of uncached icons int dsize = width*height*sizeof(fb_pixel_t); //printf("CFrameBuffer::paintIcon: %s found, data %x size %d x %d\n", newname.c_str(), data, width, height);fflush(stdout); if(cache_size+dsize < ICON_CACHE_SIZE) { From d8da2a3087abc67aee3dc4c281d2e3c1a38d9b66 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 27 Apr 2015 09:21:19 +0200 Subject: [PATCH 91/98] Revert "CComponentsItem: fix remove gradient buffer on killed item" This reverts commit 51aab307c308d2c9b330ce8a3dfa122d6946d545. --- src/gui/components/cc_item.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/gui/components/cc_item.cpp b/src/gui/components/cc_item.cpp index f27efe142..f89406d03 100644 --- a/src/gui/components/cc_item.cpp +++ b/src/gui/components/cc_item.cpp @@ -168,10 +168,6 @@ void CComponentsItem::kill(const fb_pixel_t& bg_color, bool ignore_parent) void CComponentsItem::syncSysColors() { col_body = COL_MENUCONTENT_PLUS_0; - if (cc_body_gradientBuf){ - free(cc_body_gradientBuf); - cc_body_gradientBuf = NULL; - } col_shadow = COL_MENUCONTENTDARK_PLUS_0; col_frame = COL_MENUCONTENT_PLUS_6; } From 53ce471af8d9df44c0d459f6e02358620555655d Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Mon, 27 Apr 2015 09:25:21 +0200 Subject: [PATCH 92/98] gradient: try to fix delete gradient data only on color change Signed-off-by: Thilo Graf --- src/gui/components/cc_base.cpp | 11 ++++++++--- src/gui/components/cc_base.h | 3 +-- src/gui/components/cc_item.cpp | 19 ++++++++++++++----- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/src/gui/components/cc_base.cpp b/src/gui/components/cc_base.cpp index aea0dfe3a..dcb58fe09 100644 --- a/src/gui/components/cc_base.cpp +++ b/src/gui/components/cc_base.cpp @@ -65,8 +65,9 @@ CComponents::CComponents() : COSDFader(g_settings.theme.menu_Content_alpha) frameBuffer = CFrameBuffer::getInstance(); v_fbdata.clear(); saved_screen.pixbuf = NULL; - cc_body_gradientBuf = NULL; col_body_gradient = false; + cc_gradientData.gradientBuf = NULL; + cc_gradientData.boxBuf = NULL; } CComponents::~CComponents() @@ -74,8 +75,10 @@ CComponents::~CComponents() hide(); clearSavedScreen(); clearFbData(); - if (cc_body_gradientBuf) - free(cc_body_gradientBuf); + if (cc_gradientData.gradientBuf) + free(cc_gradientData.gradientBuf); + if (cc_gradientData.boxBuf) + cs_free_uncached(cc_gradientData.boxBuf); } void CComponents::clearSavedScreen() @@ -293,11 +296,13 @@ void CComponents::clearFbData() if (v_fbdata[i].pixbuf) delete[] v_fbdata[i].pixbuf; +#if 0 if (v_fbdata[i].data && (v_fbdata[i].fbdata_type == CC_FBDATA_TYPE_BOX)) { gradientData_t *gradientData = static_cast (v_fbdata[i].data); if (gradientData->boxBuf) cs_free_uncached(gradientData->boxBuf); } +#endif } v_fbdata.clear(); } diff --git a/src/gui/components/cc_base.h b/src/gui/components/cc_base.h index 3618b2581..3aa0f740d 100644 --- a/src/gui/components/cc_base.h +++ b/src/gui/components/cc_base.h @@ -72,6 +72,7 @@ class CComponents : public CComponentsSignals, public COSDFader void *cc_tag; ///property: color of body fb_pixel_t col_body; + fb_pixel_t old_gradient_color; ///property: color of shadow fb_pixel_t col_shadow; ///property: color of frame @@ -81,8 +82,6 @@ class CComponents : public CComponentsSignals, public COSDFader ///property: contains data for gradiant handling gradientData_t cc_gradientData; - ///gradiant pixel buffer - fb_pixel_t *cc_body_gradientBuf; ///property: true component can paint gradient, see also enableColBodyGradient() bool col_body_gradient; ///property: background gradient mode diff --git a/src/gui/components/cc_item.cpp b/src/gui/components/cc_item.cpp index f89406d03..c8e9a516b 100644 --- a/src/gui/components/cc_item.cpp +++ b/src/gui/components/cc_item.cpp @@ -33,6 +33,7 @@ #include "cc_base.h" #include #include +#include using namespace std; // y @@ -98,8 +99,7 @@ void CComponentsItem::paintInit(bool do_save_bg) ix = cc_xr; iy = cc_yr; } - - cc_gradientData.boxBuf = NULL; + cc_gradientData.mode = CFrameBuffer::pbrg_noFree; void* gradientData = (cc_gradientData.gradientBuf == NULL) ? NULL : &cc_gradientData; comp_fbdata_t fbdata[] = @@ -257,12 +257,21 @@ void CComponentsItem::setFocus(bool focus) void CComponentsItem::initBodyGradient() { - if (cc_body_gradientBuf == NULL) { + if (col_body_gradient && cc_gradientData.gradientBuf && old_gradient_color != col_body) { + free(cc_gradientData.gradientBuf); + cc_gradientData.gradientBuf = NULL; + if (cc_gradientData.boxBuf) { + cs_free_uncached(cc_gradientData.boxBuf); + cc_gradientData.boxBuf = NULL; + } + } + if (cc_gradientData.gradientBuf == NULL) { CColorGradient ccGradient; int gsize = cc_body_gradient_direction == CFrameBuffer::gradientVertical ? height : width; - cc_body_gradientBuf = ccGradient.gradientOneColor(col_body, NULL, gsize, cc_body_gradient_mode, cc_body_gradient_intensity, cc_body_gradient_intensity_v_min, cc_body_gradient_intensity_v_max, cc_body_gradient_saturation); + cc_gradientData.gradientBuf = ccGradient.gradientOneColor(col_body, NULL, gsize, cc_body_gradient_mode, cc_body_gradient_intensity, cc_body_gradient_intensity_v_min, cc_body_gradient_intensity_v_max, cc_body_gradient_saturation); + old_gradient_color = col_body; } - cc_gradientData.gradientBuf = cc_body_gradientBuf; + cc_gradientData.direction = cc_body_gradient_direction; cc_gradientData.mode = CFrameBuffer::pbrg_noOption; } From 7016a86ca21214c4f7fc1fc04001a59b090c1e45 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Mon, 27 Apr 2015 09:54:33 +0200 Subject: [PATCH 93/98] CComponentsInfoBox: add switch to enable gradient for info box Signed-off-by: Thilo Graf --- src/gui/components/cc_item_infobox.cpp | 4 ++++ src/gui/components/cc_item_infobox.h | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gui/components/cc_item_infobox.cpp b/src/gui/components/cc_item_infobox.cpp index 1d659e541..676a1db3a 100644 --- a/src/gui/components/cc_item_infobox.cpp +++ b/src/gui/components/cc_item_infobox.cpp @@ -109,6 +109,10 @@ void CComponentsInfoBox::paintPicture() pic->setColorBody(col_body); + //set gradient behavior of pic object + if (col_body_gradient) + pic->doPaintBg(false); + //fit icon into frame pic->setYPos(y+(height/2-pic->getHeight()/2)); diff --git a/src/gui/components/cc_item_infobox.h b/src/gui/components/cc_item_infobox.h index 7a8c5c616..6a86a6dc6 100644 --- a/src/gui/components/cc_item_infobox.h +++ b/src/gui/components/cc_item_infobox.h @@ -83,7 +83,8 @@ class CComponentsInfoBox : public CComponentsText void setPicture(const std::string& picture_name); ///set property: path or name of displayed image, parameter as const char* void setPicture(const char* picture_name); - + ///set property: gradient behavior + void enableGradient(bool enable) { col_body_gradient = enable; } ///paint item void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); }; From 8a41089a92a7f89245ed41a1e05480747a9015a0 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Mon, 27 Apr 2015 09:55:14 +0200 Subject: [PATCH 94/98] CMenueWidget: add color gradient to menue hints Signed-off-by: Thilo Graf --- src/gui/widget/menue.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index c6e0991c9..7759dfb41 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -1302,6 +1302,9 @@ void CMenuWidget::paintHint(int pos) if (pos < 0 && !hint_painted) return; + + info_box->enableGradient(g_settings.gradiant != 0); //TODO: manage via themes + info_box->setColorBody(COL_MENUCONTENT_PLUS_0); if (hint_painted) { /* clear detailsline line */ From 1e16dbbf5911ac7fca402360e0d58cff76a8c688 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 27 Apr 2015 10:02:18 +0200 Subject: [PATCH 95/98] cc_base.cpp: paint shadow only on firs paint of item body Avoids unnecessary paint of shadow layers, This should avoid flicker effects. --- src/gui/components/cc_base.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/components/cc_base.cpp b/src/gui/components/cc_base.cpp index dcb58fe09..7cd054c05 100644 --- a/src/gui/components/cc_base.cpp +++ b/src/gui/components/cc_base.cpp @@ -198,7 +198,7 @@ void CComponents::paintFbItems(bool do_save_bg) //calculate current shadow width depends of current corner_rad sw_cur = max(2*v_fbdata[i].r, sw); } - if (cc_allow_paint){ + if (cc_allow_paint && is_painted){ // shadow right frameBuffer->paintBoxRel(x_sh, v_fbdata[i].y, sw_cur, v_fbdata[i].dy-sw_cur, v_fbdata[i].color, v_fbdata[i].r, corner_type & CORNER_TOP_RIGHT); // shadow bottom From 5f603ed6b08223a6d5236ecb12dcccf8b1983574 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 27 Apr 2015 11:51:01 +0200 Subject: [PATCH 96/98] cc_base.cpp: fix wrong statment value Comes with 1e16dbbf5911ac7fca402360e0d58cff76a8c688 --- src/gui/components/cc_base.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/components/cc_base.cpp b/src/gui/components/cc_base.cpp index 7cd054c05..223db8d95 100644 --- a/src/gui/components/cc_base.cpp +++ b/src/gui/components/cc_base.cpp @@ -198,7 +198,7 @@ void CComponents::paintFbItems(bool do_save_bg) //calculate current shadow width depends of current corner_rad sw_cur = max(2*v_fbdata[i].r, sw); } - if (cc_allow_paint && is_painted){ + if (cc_allow_paint && !is_painted){ // shadow right frameBuffer->paintBoxRel(x_sh, v_fbdata[i].y, sw_cur, v_fbdata[i].dy-sw_cur, v_fbdata[i].color, v_fbdata[i].r, corner_type & CORNER_TOP_RIGHT); // shadow bottom From 01516cf94379ef3aade55b785a07cda7b075675e Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 29 Apr 2015 10:16:55 +0200 Subject: [PATCH 97/98] themes: use hintbox and header gradient option in theme settings Color gradient feature was originally intended for use inside theme settings and it's not really suitable for generally use as default in all themes at the moment, so it makes more sense to have options in theme settings and let the user decide to customize this, unless enough other gui parts can use this feature. --- data/locale/deutsch.locale | 1 + data/locale/english.locale | 1 + data/locale/nederlands.locale | 1 + data/locale/slovak.locale | 1 + data/themes/Classic.theme | 2 ++ data/themes/Crema.theme | 2 ++ data/themes/DVB2000.theme | 2 ++ data/themes/DarkBlue.theme | 2 ++ data/themes/DarkBrown.theme | 2 ++ data/themes/Gray.theme | 2 ++ data/themes/Grey-Blue.theme | 2 ++ data/themes/MonoChrom.theme | 2 ++ data/themes/Olive.theme | 2 ++ data/themes/Red.theme | 2 ++ data/themes/VirginMedia.theme | 2 ++ src/gui/channellist.cpp | 6 +++--- src/gui/components/cc_base.cpp | 2 +- src/gui/components/cc_frm_footer.cpp | 2 +- src/gui/components/cc_frm_header.cpp | 2 +- src/gui/eventlist.cpp | 2 +- src/gui/imageinfo.cpp | 2 +- src/gui/osd_setup.cpp | 22 ++++++++++++++++------ src/gui/themes.cpp | 4 ++++ src/gui/widget/colorchooser.cpp | 4 ++-- src/gui/widget/menue.cpp | 3 ++- src/gui/widget/menue.h | 4 ++-- src/neutrino.cpp | 4 ++-- src/system/locals.h | 1 + src/system/locals_intern.h | 1 + src/system/settings.h | 5 ++++- 30 files changed, 68 insertions(+), 22 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 4d241fcf7..c040746b7 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -299,6 +299,7 @@ colormenusetup.menuhead Titelleiste colorstatusbar.text Infobar colorthememenu.head Theme auswählen colorthememenu.head2 Themes laden +colorthememenu.menu_hints Hinweisfenster colorthememenu.name Themename colorthememenu.neutrino_theme Neutrino Theme colorthememenu.question Aktuelles Theme beibehalten? diff --git a/data/locale/english.locale b/data/locale/english.locale index 2022f3db2..25346c375 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -299,6 +299,7 @@ colormenusetup.menuhead Header colorstatusbar.text Infobar colorthememenu.head Select theme colorthememenu.head2 Load themes +colorthememenu.menu_hints Hint box colorthememenu.name Theme name colorthememenu.neutrino_theme Neutrino Theme colorthememenu.question Use selected theme? diff --git a/data/locale/nederlands.locale b/data/locale/nederlands.locale index 9d05d7e13..7b1f29194 100644 --- a/data/locale/nederlands.locale +++ b/data/locale/nederlands.locale @@ -294,6 +294,7 @@ colormenusetup.menuhead Menu kop colorstatusbar.text Infobalk colorthememenu.head Selecteer thema colorthememenu.head2 Thema's laden +colorthememenu.menu_hints Hint box colorthememenu.name Naam thema colorthememenu.neutrino_theme Neutrino Thema colorthememenu.question Geselecteerde thema gebruiken? diff --git a/data/locale/slovak.locale b/data/locale/slovak.locale index b9507ce04..04a5f69f4 100644 --- a/data/locale/slovak.locale +++ b/data/locale/slovak.locale @@ -300,6 +300,7 @@ colormenusetup.menuhead Hlavička colorstatusbar.text Text stavového riadku colorthememenu.head Výber vzhľadu colorthememenu.head2 Nahraj vzhľad +colorthememenu.menu_hints Tip Box colorthememenu.name Názov vzhľadu colorthememenu.neutrino_theme Neutrino colorthememenu.question Použiť vybraný vzhľad? diff --git a/data/themes/Classic.theme b/data/themes/Classic.theme index 2d2562217..d194eb8f6 100644 --- a/data/themes/Classic.theme +++ b/data/themes/Classic.theme @@ -38,3 +38,5 @@ menu_Content_inactive_Text_alpha=0 menu_Content_inactive_Text_red=80 menu_Content_inactive_Text_green=80 menu_Content_inactive_Text_blue=80 +menu_Hint_gradient=0 +menu_Head_gradient=0 diff --git a/data/themes/Crema.theme b/data/themes/Crema.theme index 0abd780bb..5ce2ed3ad 100644 --- a/data/themes/Crema.theme +++ b/data/themes/Crema.theme @@ -38,3 +38,5 @@ menu_Head_alpha=0 menu_Head_blue=28 menu_Head_green=0 menu_Head_red=0 +menu_Hint_gradient=0 +menu_Head_gradient=0 diff --git a/data/themes/DVB2000.theme b/data/themes/DVB2000.theme index 5a9ad7ae7..1f5f73301 100644 --- a/data/themes/DVB2000.theme +++ b/data/themes/DVB2000.theme @@ -38,3 +38,5 @@ menu_Content_inactive_Text_alpha=0 menu_Content_inactive_Text_red=100 menu_Content_inactive_Text_green=100 menu_Content_inactive_Text_blue=0 +menu_Hint_gradient=0 +menu_Head_gradient=0 diff --git a/data/themes/DarkBlue.theme b/data/themes/DarkBlue.theme index 9bc2849d1..fc3a262af 100644 --- a/data/themes/DarkBlue.theme +++ b/data/themes/DarkBlue.theme @@ -38,3 +38,5 @@ menu_Content_inactive_Text_alpha=0 menu_Content_inactive_Text_red=55 menu_Content_inactive_Text_green=70 menu_Content_inactive_Text_blue=85 +menu_Hint_gradient=0 +menu_Head_gradient=0 diff --git a/data/themes/DarkBrown.theme b/data/themes/DarkBrown.theme index 903181d21..b337df705 100644 --- a/data/themes/DarkBrown.theme +++ b/data/themes/DarkBrown.theme @@ -38,3 +38,5 @@ menu_Content_inactive_Text_alpha=0 menu_Content_inactive_Text_red=60 menu_Content_inactive_Text_green=60 menu_Content_inactive_Text_blue=60 +menu_Hint_gradient=0 +menu_Head_gradient=0 diff --git a/data/themes/Gray.theme b/data/themes/Gray.theme index 6356e7d1b..245fa5e93 100644 --- a/data/themes/Gray.theme +++ b/data/themes/Gray.theme @@ -49,3 +49,5 @@ menu_Head_alpha=0 menu_Head_blue=30 menu_Head_green=20 menu_Head_red=15 +menu_Hint_gradient=0 +menu_Head_gradient=0 diff --git a/data/themes/Grey-Blue.theme b/data/themes/Grey-Blue.theme index d274fb352..9a8c9190b 100644 --- a/data/themes/Grey-Blue.theme +++ b/data/themes/Grey-Blue.theme @@ -46,3 +46,5 @@ menu_Head_alpha=4 menu_Head_blue=0 menu_Head_green=0 menu_Head_red=0 +menu_Hint_gradient=0 +menu_Head_gradient=0 diff --git a/data/themes/MonoChrom.theme b/data/themes/MonoChrom.theme index 4ed999dc0..bed644c00 100644 --- a/data/themes/MonoChrom.theme +++ b/data/themes/MonoChrom.theme @@ -38,3 +38,5 @@ menu_Head_alpha=0 menu_Head_blue=0 menu_Head_green=0 menu_Head_red=0 +menu_Hint_gradient=0 +menu_Head_gradient=0 diff --git a/data/themes/Olive.theme b/data/themes/Olive.theme index c30b4eba1..8696172e6 100644 --- a/data/themes/Olive.theme +++ b/data/themes/Olive.theme @@ -38,3 +38,5 @@ menu_Head_alpha=0 menu_Head_blue=80 menu_Head_green=80 menu_Head_red=80 +menu_Hint_gradient=0 +menu_Head_gradient=0 diff --git a/data/themes/Red.theme b/data/themes/Red.theme index 714fea08c..4b1b4ad09 100644 --- a/data/themes/Red.theme +++ b/data/themes/Red.theme @@ -49,3 +49,5 @@ menu_Head_alpha=0 menu_Head_blue=0 menu_Head_green=10 menu_Head_red=40 +menu_Hint_gradient=0 +menu_Head_gradient=0 diff --git a/data/themes/VirginMedia.theme b/data/themes/VirginMedia.theme index 23a3b8f21..9fb66a4b2 100644 --- a/data/themes/VirginMedia.theme +++ b/data/themes/VirginMedia.theme @@ -38,3 +38,5 @@ menu_Content_inactive_Text_alpha=0 menu_Content_inactive_Text_red=60 menu_Content_inactive_Text_green=60 menu_Content_inactive_Text_blue=60 +menu_Hint_gradient=0 +menu_Head_gradient=0 diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 2da427a7b..b957c44ad 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -2049,7 +2049,7 @@ void CChannelList::paint() void CChannelList::paintHead() { - static int gradient = g_settings.gradiant; + static int gradient = g_settings.theme.menu_Head_gradient; CComponentsHeader header(x, y, full_width, theight, name /*no header icon*/); if (bouquet && bouquet->zapitBouquet && bouquet->zapitBouquet->bLocked != g_settings.parentallock_defaultlocked) @@ -2059,8 +2059,8 @@ void CChannelList::paintHead() header.paint(CC_SAVE_SCREEN_NO); - if (gradient != g_settings.gradiant && headerClock != NULL) { - gradient = g_settings.gradiant; + if (gradient != g_settings.theme.menu_Head_gradient && headerClock != NULL) { + gradient = g_settings.theme.menu_Head_gradient; headerClock->clearSavedScreen(); delete headerClock; headerClock = NULL; diff --git a/src/gui/components/cc_base.cpp b/src/gui/components/cc_base.cpp index 223db8d95..deec9ea97 100644 --- a/src/gui/components/cc_base.cpp +++ b/src/gui/components/cc_base.cpp @@ -328,5 +328,5 @@ void CComponents::setFrameThickness(const int& thickness, const int& thickness_s void CComponents::enableColBodyGradient(bool do_paint_gradient) { - col_body_gradient = g_settings.gradiant ? do_paint_gradient : false; + col_body_gradient = do_paint_gradient; } diff --git a/src/gui/components/cc_frm_footer.cpp b/src/gui/components/cc_frm_footer.cpp index ac1b1da16..cb84e182c 100644 --- a/src/gui/components/cc_frm_footer.cpp +++ b/src/gui/components/cc_frm_footer.cpp @@ -82,7 +82,7 @@ void CComponentsFooter::initVarFooter( const int& x_pos, const int& y_pos, const corner_rad = RADIUS_LARGE; corner_type = CORNER_BOTTOM; - btn_contour = g_settings.gradiant; + btn_contour = false /*g_settings.theme.Button_gradient*/; //TODO: not implemented at the moment ccf_btn_font = NULL; chain = NULL; diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index 6be2b8794..44c363607 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -98,7 +98,7 @@ void CComponentsHeader::initVarHeader( const int& x_pos, const int& y_pos, const col_body = color_body; col_shadow = color_shadow; col_body = COL_MENUHEAD_PLUS_0; - col_body_gradient = g_settings.gradiant; + col_body_gradient = g_settings.theme.menu_Head_gradient; cc_body_gradient_direction = CFrameBuffer::gradientVertical; cch_text = caption; cch_icon_name = icon_name; diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index 2845b1de5..4a0695b09 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -854,7 +854,7 @@ void CNeutrinoEventList::paintHead(t_channel_id _channel_id, std::string _channe int font_lr = SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMLARGE; CComponentsFrmChain header(x, y, full_width, theight); - header.enableColBodyGradient(g_settings.gradiant); + header.enableColBodyGradient(g_settings.theme.menu_Head_gradient); header.setCorner(RADIUS_LARGE, CORNER_TOP); int x_off = 10; diff --git a/src/gui/imageinfo.cpp b/src/gui/imageinfo.cpp index 2b236ff5a..f657ed813 100644 --- a/src/gui/imageinfo.cpp +++ b/src/gui/imageinfo.cpp @@ -185,7 +185,7 @@ void CImageInfo::ShowWindow() cc_win->setWindowHeaderButtons(CComponentsHeader::CC_BTN_MENU | CComponentsHeader::CC_BTN_EXIT); footer = cc_win->getFooterObject(); int h_footer = footer->getHeight(); - fb_pixel_t btn_col = g_settings.gradiant ? COL_BUTTON_BODY : footer->getColorBody(); + fb_pixel_t btn_col = /*g_settings.theme.Button_gradient ? COL_BUTTON_BODY :*/ footer->getColorBody(); //TODO: Button_gradient option btn_red = new CComponentsButtonRed(10, CC_CENTERED, 250, h_footer-h_footer/4, LOCALE_BUILDINFO_MENU, footer, false , true, false, footer->getColorBody(), btn_col); } diff --git a/src/gui/osd_setup.cpp b/src/gui/osd_setup.cpp index 6172918ea..681cfc00d 100644 --- a/src/gui/osd_setup.cpp +++ b/src/gui/osd_setup.cpp @@ -603,11 +603,6 @@ int COsdSetup::showOsdSetup() mfWindowSize->setHint("", LOCALE_MENU_HINT_WINDOW_SIZE); osd_menu->addItem(mfWindowSize); - // color gradient - mc = new CMenuOptionChooser(LOCALE_COLOR_GRADIENT, &g_settings.gradiant, MESSAGEBOX_NO_YES_OPTIONS, MESSAGEBOX_NO_YES_OPTION_COUNT, true, this ); - mc->setHint("", LOCALE_MENU_HINT_COLOR_GRADIENT); - osd_menu->addItem(mc); - osd_menu->addItem(GenericMenuSeparatorLine); // scrambled @@ -653,6 +648,7 @@ void COsdSetup::showOsdMenueColorSetup(CMenuWidget *menu_colors) menu_colors->addItem(mf); SNeutrinoTheme &t = g_settings.theme; + sigc::slot0 slot_repaint = sigc::mem_fun(menu_colors, &CMenuWidget::paint); //we want to repaint after changed Option CColorChooser* chHeadcolor = new CColorChooser(LOCALE_COLORMENU_BACKGROUND, &t.menu_Head_red, &t.menu_Head_green, &t.menu_Head_blue, &t.menu_Head_alpha, colorSetupNotifier); @@ -683,6 +679,13 @@ void COsdSetup::showOsdMenueColorSetup(CMenuWidget *menu_colors) mf->setHint("", LOCALE_MENU_HINT_HEAD_TEXTCOLOR); menu_colors->addItem(mf); + // head color gradient + CMenuOptionChooser *oj; + oj = new CMenuOptionChooser(LOCALE_COLOR_GRADIENT, &g_settings.theme.menu_Head_gradient, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true ); + oj->OnAfterChangeOption.connect(slot_repaint); + oj->setHint("", LOCALE_MENU_HINT_COLOR_GRADIENT); + menu_colors->addItem(oj); + menu_colors->addItem( new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_COLORMENUSETUP_MENUCONTENT)); mf = new CMenuDForwarder(LOCALE_COLORMENU_BACKGROUND, true, NULL, chContentcolor ); mf->setHint("", LOCALE_MENU_HINT_CONTENT_BACK); @@ -710,6 +713,13 @@ void COsdSetup::showOsdMenueColorSetup(CMenuWidget *menu_colors) mf->setHint("", LOCALE_MENU_HINT_SELECTED_TEXT); menu_colors->addItem(mf); + // hintbox color gradient + menu_colors->addItem( new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_COLORTHEMEMENU_MENU_HINTS)); + oj = new CMenuOptionChooser(LOCALE_COLOR_GRADIENT, &t.menu_Hint_gradient, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true); + oj->OnAfterChangeOption.connect(slot_repaint); + oj->setHint("", LOCALE_MENU_HINT_COLOR_GRADIENT); + menu_colors->addItem(oj); + CColorChooser* chInfobarcolor = new CColorChooser(LOCALE_COLORMENU_BACKGROUND, &t.infobar_red, &t.infobar_green, &t.infobar_blue, &t.infobar_alpha, colorSetupNotifier); CColorChooser* chInfobarTextcolor = new CColorChooser(LOCALE_COLORMENU_TEXTCOLOR, &t.infobar_Text_red, @@ -1137,7 +1147,7 @@ bool COsdSetup::changeNotify(const neutrino_locale_t OptionName, void * data) } else if(ARE_LOCALES_EQUAL(OptionName, LOCALE_COLOR_GRADIENT)) { osd_menu->paint(); - return false; + return true; } else if(ARE_LOCALES_EQUAL(OptionName, LOCALE_COLORMENU_OSD_PRESET)) { int preset = * (int *) data; diff --git a/src/gui/themes.cpp b/src/gui/themes.cpp index 60963cc9b..425e68a33 100644 --- a/src/gui/themes.cpp +++ b/src/gui/themes.cpp @@ -245,6 +245,7 @@ void CThemes::setTheme(CConfigFile &configfile) configfile.setInt32( "menu_Head_Text_red", t.menu_Head_Text_red ); configfile.setInt32( "menu_Head_Text_green", t.menu_Head_Text_green ); configfile.setInt32( "menu_Head_Text_blue", t.menu_Head_Text_blue ); + configfile.setInt32( "menu_Head_gradient" , t.menu_Head_gradient); configfile.setInt32( "menu_Content_alpha", t.menu_Content_alpha ); configfile.setInt32( "menu_Content_red", t.menu_Content_red ); configfile.setInt32( "menu_Content_green", t.menu_Content_green ); @@ -269,6 +270,7 @@ void CThemes::setTheme(CConfigFile &configfile) configfile.setInt32( "menu_Content_inactive_Text_red", t.menu_Content_inactive_Text_red ); configfile.setInt32( "menu_Content_inactive_Text_green", t.menu_Content_inactive_Text_green ); configfile.setInt32( "menu_Content_inactive_Text_blue", t.menu_Content_inactive_Text_blue ); + configfile.setInt32( "menu_Hint_gradient" , t.menu_Hint_gradient); configfile.setInt32( "infobar_alpha", t.infobar_alpha ); configfile.setInt32( "infobar_red", t.infobar_red ); configfile.setInt32( "infobar_green", t.infobar_green ); @@ -298,6 +300,7 @@ void CThemes::getTheme(CConfigFile &configfile) t.menu_Head_Text_red = configfile.getInt32( "menu_Head_Text_red", 0x5f ); t.menu_Head_Text_green = configfile.getInt32( "menu_Head_Text_green", 0x46 ); t.menu_Head_Text_blue = configfile.getInt32( "menu_Head_Text_blue", 0x00 ); + t.menu_Head_gradient = configfile.getInt32( "menu_Head_gradient", 1); t.menu_Content_alpha = configfile.getInt32( "menu_Content_alpha", 0x14 ); t.menu_Content_red = configfile.getInt32( "menu_Content_red", 0x00 ); t.menu_Content_green = configfile.getInt32( "menu_Content_green", 0x0f ); @@ -322,6 +325,7 @@ void CThemes::getTheme(CConfigFile &configfile) t.menu_Content_inactive_Text_red = configfile.getInt32( "menu_Content_inactive_Text_red", 55 ); t.menu_Content_inactive_Text_green = configfile.getInt32( "menu_Content_inactive_Text_green", 70 ); t.menu_Content_inactive_Text_blue = configfile.getInt32( "menu_Content_inactive_Text_blue", 85 ); + t.menu_Hint_gradient = configfile.getInt32( "menu_Hint_gradient", 0); t.infobar_alpha = configfile.getInt32( "infobar_alpha", 0x14 ); t.infobar_red = configfile.getInt32( "infobar_red", 0x00 ); t.infobar_green = configfile.getInt32( "infobar_green", 0x0e ); diff --git a/src/gui/widget/colorchooser.cpp b/src/gui/widget/colorchooser.cpp index 8f758dc45..e2924c173 100644 --- a/src/gui/widget/colorchooser.cpp +++ b/src/gui/widget/colorchooser.cpp @@ -107,7 +107,7 @@ void CColorChooser::setColor() int w_col = mheight*4; int h_col = mheight*4-10; - if ((g_settings.gradiant) && ((chooser_gradient == gradient_head_body) || (chooser_gradient == gradient_head_text))) { + if ((g_settings.theme.menu_Head_gradient) && ((chooser_gradient == gradient_head_body) || (chooser_gradient == gradient_head_text))) { CComponentsHeader header(x_col, y_col+((h_col-hheight)/2), w_col, hheight, "Head"); if (chooser_gradient == gradient_head_body) header.setColorBody(col); @@ -270,7 +270,7 @@ void CColorChooser::paint() for (int i = 0; i < 4; i++) paintSlider(x + 10, y + hheight + mheight * i, value[i], colorchooser_names[i], iconnames[i], (i == 0)); - if ((!g_settings.gradiant) || ((chooser_gradient != gradient_head_body) && (chooser_gradient != gradient_head_text))) { + if ((!g_settings.theme.menu_Head_gradient) || ((chooser_gradient != gradient_head_body) && (chooser_gradient != gradient_head_text))) { //color preview frameBuffer->paintBoxRel(x+offset+160,y+hheight+5, mheight*4, mheight*4-10, COL_MENUHEAD_PLUS_0); frameBuffer->paintBoxRel(x+offset+162,y+hheight+2+5, mheight*4-4 ,mheight*4-4-10, 254); diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 7759dfb41..1303269f1 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -1303,7 +1303,7 @@ void CMenuWidget::paintHint(int pos) if (pos < 0 && !hint_painted) return; - info_box->enableGradient(g_settings.gradiant != 0); //TODO: manage via themes + info_box->enableGradient(g_settings.theme.menu_Hint_gradient != 0); info_box->setColorBody(COL_MENUCONTENT_PLUS_0); if (hint_painted) { @@ -1826,6 +1826,7 @@ int CMenuOptionChooser::exec(CMenuTarget*) } } paint(true); + OnAfterChangeOption(); if(observ && !luaAction.empty()) { if (optionValname) wantsRepaint = observ->changeNotify(luaState, luaAction, luaId, optionValname); diff --git a/src/gui/widget/menue.h b/src/gui/widget/menue.h index b00079e0e..6d3c20ed4 100644 --- a/src/gui/widget/menue.h +++ b/src/gui/widget/menue.h @@ -355,7 +355,7 @@ struct CMenuOptionChooserCompareItem: public std::binary_function OnAfterChangeOption; int paint(bool selected); int exec(CMenuTarget* parent); diff --git a/src/neutrino.cpp b/src/neutrino.cpp index e045c8389..50e65b559 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -543,7 +543,7 @@ int CNeutrinoApp::loadSetup(const char * fname) CThemes::getTheme(configfile); - g_settings.gradiant = (configfile.getBool( "gradiant", false ))? 1 : 0; + //personalize g_settings.personalize_pincode = configfile.getString( "personalize_pincode", "0000" ); @@ -1067,7 +1067,7 @@ void CNeutrinoApp::saveSetup(const char * fname) CThemes::setTheme(configfile); - configfile.setBool( "gradiant", (g_settings.gradiant!=0)?true:false ); + //personalize configfile.setString("personalize_pincode", g_settings.personalize_pincode); diff --git a/src/system/locals.h b/src/system/locals.h index 9b768e095..2779bc17d 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -326,6 +326,7 @@ typedef enum LOCALE_COLORSTATUSBAR_TEXT, LOCALE_COLORTHEMEMENU_HEAD, LOCALE_COLORTHEMEMENU_HEAD2, + LOCALE_COLORTHEMEMENU_MENU_HINTS, LOCALE_COLORTHEMEMENU_NAME, LOCALE_COLORTHEMEMENU_NEUTRINO_THEME, LOCALE_COLORTHEMEMENU_QUESTION, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 0423c1586..af30d8339 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -326,6 +326,7 @@ const char * locale_real_names[] = "colorstatusbar.text", "colorthememenu.head", "colorthememenu.head2", + "colorthememenu.menu_hints", "colorthememenu.name", "colorthememenu.neutrino_theme", "colorthememenu.question", diff --git a/src/system/settings.h b/src/system/settings.h index 6431c2616..17bcf7848 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -59,6 +59,8 @@ struct SNeutrinoTheme unsigned char menu_Head_Text_green; unsigned char menu_Head_Text_blue; + int menu_Head_gradient; + unsigned char menu_Content_alpha; unsigned char menu_Content_red; unsigned char menu_Content_green; @@ -89,6 +91,8 @@ struct SNeutrinoTheme unsigned char menu_Content_inactive_Text_green; unsigned char menu_Content_inactive_Text_blue; + int menu_Hint_gradient; + unsigned char infobar_alpha; unsigned char infobar_red; unsigned char infobar_green; @@ -365,7 +369,6 @@ struct SNeutrinoSettings int colored_events_channellist; int colored_events_infobar; int contrast_fonts; - int gradiant; //network #define NETWORK_NFS_NR_OF_ENTRIES 8 From 7044df1f9f33ad2bd216a9768bfde6d79f6a2ce8 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 29 Apr 2015 12:01:11 +0200 Subject: [PATCH 98/98] COsdSetup: remove repaint call for gradient assignment Is already executed by chooser object via slot inside showOsdSetup(), and osd_menu object is not the required object. --- src/gui/osd_setup.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/gui/osd_setup.cpp b/src/gui/osd_setup.cpp index 681cfc00d..6d2c0aad4 100644 --- a/src/gui/osd_setup.cpp +++ b/src/gui/osd_setup.cpp @@ -1145,10 +1145,6 @@ bool COsdSetup::changeNotify(const neutrino_locale_t OptionName, void * data) g_InfoViewer->changePB(); return false; } - else if(ARE_LOCALES_EQUAL(OptionName, LOCALE_COLOR_GRADIENT)) { - osd_menu->paint(); - return true; - } else if(ARE_LOCALES_EQUAL(OptionName, LOCALE_COLORMENU_OSD_PRESET)) { int preset = * (int *) data; printf("preset %d (setting %d)\n", preset, g_settings.screen_preset);