From 5ac8d0085b86fd5b40bf772187548820adc1f277 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Fri, 19 Aug 2016 21:17:45 +0200 Subject: [PATCH 01/17] src/gui/lua/lua_cc_text.cpp if dx and dy is not set and text have parent use Height and Width size from parent Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/a648daba757c9d9b27a23269ecc3881ac5a2ec62 Author: Jacek Jendrzej Date: 2016-08-19 (Fri, 19 Aug 2016) --- src/gui/lua/lua_cc_text.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/gui/lua/lua_cc_text.cpp b/src/gui/lua/lua_cc_text.cpp index f7ed3a540..243aeaf3a 100644 --- a/src/gui/lua/lua_cc_text.cpp +++ b/src/gui/lua/lua_cc_text.cpp @@ -77,7 +77,7 @@ int CLuaInstCCText::CCTextNew(lua_State *L) lua_assert(lua_istable(L,1)); CLuaCCWindow* parent = NULL; - lua_Integer x=10, y=10, dx=100, dy=100; + lua_Integer x=10, y=10, dx=-1, dy=-1; std::string text = ""; std::string tmpMode = ""; lua_Integer mode = CTextBox::AUTO_WIDTH; @@ -139,6 +139,16 @@ int CLuaInstCCText::CCTextNew(lua_State *L) } CComponentsForm* pw = (parent && parent->w) ? parent->w->getBodyObject() : NULL; + if(pw){ + if(dx == -1) + dx = pw->getHeight(); + if(dy == -1) + dy = pw->getWidth(); + } + if(dx == -1) + dx = 100; + if(dy == -1) + dy = 100; CLuaCCText **udata = (CLuaCCText **) lua_newuserdata(L, sizeof(CLuaCCText *)); *udata = new CLuaCCText(); From 882bdf5b2d1a7098a0e2d012c9e250a135e9e6ec Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Sat, 20 Aug 2016 09:54:12 +0200 Subject: [PATCH 02/17] supplement to 5ac8d0085b86fd5b40bf772187548820adc1f277 Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/27ddf8935d36ff8a73ee9ac7aa24d41e53c31921 Author: Jacek Jendrzej Date: 2016-08-20 (Sat, 20 Aug 2016) --- src/gui/lua/lua_cc_text.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/lua/lua_cc_text.cpp b/src/gui/lua/lua_cc_text.cpp index 243aeaf3a..e4c8d637e 100644 --- a/src/gui/lua/lua_cc_text.cpp +++ b/src/gui/lua/lua_cc_text.cpp @@ -140,14 +140,14 @@ int CLuaInstCCText::CCTextNew(lua_State *L) CComponentsForm* pw = (parent && parent->w) ? parent->w->getBodyObject() : NULL; if(pw){ - if(dx == -1) + if(dx < 1) dx = pw->getHeight(); - if(dy == -1) + if(dy < 1) dy = pw->getWidth(); } - if(dx == -1) + if(dx < 1) dx = 100; - if(dy == -1) + if(dy < 1) dy = 100; CLuaCCText **udata = (CLuaCCText **) lua_newuserdata(L, sizeof(CLuaCCText *)); From f1912db7201099980f79f8ace316962b3c5ff99c Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Sat, 20 Aug 2016 13:59:15 +0200 Subject: [PATCH 03/17] 2:supplement to 5ac8d0085b86fd5b40bf772187548820adc1f277 Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/c37ef21912e77cf5673642c6fabfe46556541d2b Author: Jacek Jendrzej Date: 2016-08-20 (Sat, 20 Aug 2016) Origin message was: ------------------ 2:supplement to 5ac8d0085b86fd5b40bf772187548820adc1f277 --- src/gui/lua/lua_cc_text.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/lua/lua_cc_text.cpp b/src/gui/lua/lua_cc_text.cpp index e4c8d637e..60f23f78c 100644 --- a/src/gui/lua/lua_cc_text.cpp +++ b/src/gui/lua/lua_cc_text.cpp @@ -140,10 +140,10 @@ int CLuaInstCCText::CCTextNew(lua_State *L) CComponentsForm* pw = (parent && parent->w) ? parent->w->getBodyObject() : NULL; if(pw){ - if(dx < 1) - dx = pw->getHeight(); if(dy < 1) - dy = pw->getWidth(); + dy = pw->getHeight(); + if(dx < 1) + dx = pw->getWidth(); } if(dx < 1) dx = 100; From 46b77c77e6ceb85dd20b8f0e24d07989a46029a1 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Sat, 20 Aug 2016 16:20:16 +0200 Subject: [PATCH 04/17] src/gui/components/cc_frm_window.cpp dont paint over screen size Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/912017621ba3c0a753514fd6c69ea1f3377e8af5 Author: Jacek Jendrzej Date: 2016-08-20 (Sat, 20 Aug 2016) --- src/gui/components/cc_frm_window.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gui/components/cc_frm_window.cpp b/src/gui/components/cc_frm_window.cpp index 869acd530..e808e28b1 100644 --- a/src/gui/components/cc_frm_window.cpp +++ b/src/gui/components/cc_frm_window.cpp @@ -170,8 +170,13 @@ void CComponentsWindow::initWindowSize() if (width == 0) width = frameBuffer->getScreenWidth(); + else if ((unsigned)width > frameBuffer->getScreenWidth()) + width = frameBuffer->getScreenWidth(); + if (height == 0) height = frameBuffer->getScreenHeight(); + else if((unsigned)height > frameBuffer->getScreenHeight()) + height = frameBuffer->getScreenHeight(); } void CComponentsWindow::initWindowPos() From 7e874ddf64a4255aa9c9792ab95bc7acce02447d Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Sun, 21 Aug 2016 16:17:28 +0200 Subject: [PATCH 05/17] lua_cc_picture: add cpicture getHeight / getWidth option Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/d5051a100fbc738f344749d30c51a47b6eb551df Author: Jacek Jendrzej Date: 2016-08-21 (Sun, 21 Aug 2016) --- src/gui/lua/lua_cc_picture.cpp | 22 ++++++++++++++++++++++ src/gui/lua/lua_cc_picture.h | 2 ++ 2 files changed, 24 insertions(+) diff --git a/src/gui/lua/lua_cc_picture.cpp b/src/gui/lua/lua_cc_picture.cpp index 926bb520f..b383bd79b 100644 --- a/src/gui/lua/lua_cc_picture.cpp +++ b/src/gui/lua/lua_cc_picture.cpp @@ -57,6 +57,8 @@ void CLuaInstCCPicture::CCPictureRegister(lua_State *L) { "hide", CLuaInstCCPicture::CCPictureHide }, { "setPicture", CLuaInstCCPicture::CCPictureSetPicture }, { "setCenterPos", CLuaInstCCPicture::CCPictureSetCenterPos }, + { "getHeight", CLuaInstCCPicture::CCPictureGetHeight }, + { "getWidth", CLuaInstCCPicture::CCPictureGetWidth }, { "__gc", CLuaInstCCPicture::CCPictureDelete }, { NULL, NULL } }; @@ -126,6 +128,26 @@ int CLuaInstCCPicture::CCPictureNew(lua_State *L) return 1; } +int CLuaInstCCPicture::CCPictureGetHeight(lua_State *L) +{ + CLuaCCPicture *D = CCPictureCheck(L, 1); + if (!D) return 0; + + int h = D->cp->getHeight(); + lua_pushinteger(L, h); + return 1; +} + +int CLuaInstCCPicture::CCPictureGetWidth(lua_State *L) +{ + CLuaCCPicture *D = CCPictureCheck(L, 1); + if (!D) return 0; + + int w = D->cp->getWidth(); + lua_pushinteger(L, w); + return 1; +} + int CLuaInstCCPicture::CCPicturePaint(lua_State *L) { lua_assert(lua_istable(L,1)); diff --git a/src/gui/lua/lua_cc_picture.h b/src/gui/lua/lua_cc_picture.h index 2fb7c3e14..8bbc697ad 100644 --- a/src/gui/lua/lua_cc_picture.h +++ b/src/gui/lua/lua_cc_picture.h @@ -46,6 +46,8 @@ class CLuaInstCCPicture static int CCPictureHide(lua_State *L); static int CCPictureSetPicture(lua_State *L); static int CCPictureSetCenterPos(lua_State *L); + static int CCPictureGetHeight(lua_State *L); + static int CCPictureGetWidth(lua_State *L); static int CCPictureDelete(lua_State *L); }; From fcfb4c41e56721030fd6c326a26ba6622f6f4519 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Sun, 21 Aug 2016 18:29:10 +0200 Subject: [PATCH 06/17] lua_cc_window: add setDimensionsAll option Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/5c26de095c29ce2e44243f196e8eac6b8b1b50eb Author: Jacek Jendrzej Date: 2016-08-21 (Sun, 21 Aug 2016) --- src/gui/lua/lua_cc_window.cpp | 23 +++++++++++++++++++++++ src/gui/lua/lua_cc_window.h | 1 + 2 files changed, 24 insertions(+) diff --git a/src/gui/lua/lua_cc_window.cpp b/src/gui/lua/lua_cc_window.cpp index 9977bfa2b..754a1c16d 100644 --- a/src/gui/lua/lua_cc_window.cpp +++ b/src/gui/lua/lua_cc_window.cpp @@ -56,6 +56,7 @@ void CLuaInstCCWindow::CCWindowRegister(lua_State *L) { "header_height", CLuaInstCCWindow::CCWindowGetHeaderHeight_dep }, /* function 'header_height' is deprecated */ { "footer_height", CLuaInstCCWindow::CCWindowGetFooterHeight_dep }, /* function 'footer_height' is deprecated */ { "setCenterPos", CLuaInstCCWindow::CCWindowSetCenterPos }, + { "setDimensionsAll", CLuaInstCCWindow::CCWindowSetDimensionsAll }, { "__gc", CLuaInstCCWindow::CCWindowDelete }, { NULL, NULL } }; @@ -295,6 +296,28 @@ int CLuaInstCCWindow::CCWindowGetFooterHeight(lua_State *L) return 1; } +int CLuaInstCCWindow::CCWindowSetDimensionsAll(lua_State *L) +{ + CLuaCCWindow *D = CCWindowCheck(L, 1); + if (!D) return 0; + lua_Integer x = luaL_checkint(L, 2); + lua_Integer y = luaL_checkint(L, 3); + lua_Integer w = luaL_checkint(L, 4); + lua_Integer h = luaL_checkint(L, 5); + if(x>-1 && y > -1 && w > 1 && h > 1){ + if (h > (lua_Integer)CFrameBuffer::getInstance()->getScreenHeight()) + h = (lua_Integer)CFrameBuffer::getInstance()->getScreenHeight(); + if (w > (lua_Integer)CFrameBuffer::getInstance()->getScreenWidth()) + w = (lua_Integer)CFrameBuffer::getInstance()->getScreenWidth(); + if(x > w) + x = 0; + if(y > h) + y = 0; + D->w->setDimensionsAll(x,y,w,h); + } + return 0; +} + int CLuaInstCCWindow::CCWindowSetCenterPos(lua_State *L) { lua_assert(lua_istable(L,1)); diff --git a/src/gui/lua/lua_cc_window.h b/src/gui/lua/lua_cc_window.h index 0e32bc386..98cd9ac86 100644 --- a/src/gui/lua/lua_cc_window.h +++ b/src/gui/lua/lua_cc_window.h @@ -51,6 +51,7 @@ class CLuaInstCCWindow static int CCWindowGetFooterHeight_dep(lua_State *L); // function 'footer_height' is deprecated static int CCWindowSetCenterPos(lua_State *L); static int CCWindowDelete(lua_State *L); + static int CCWindowSetDimensionsAll(lua_State *L); }; #endif //_LUACCWINDOW_H From c9f0b15a1ddeafef0ab2312f4fc31b540f97fc6c Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Mon, 22 Aug 2016 04:25:33 +0200 Subject: [PATCH 07/17] Complete missing lua api versions: - colors: some internal renamings (78230ea) v1.40 - colors: make footer background color configurable (70abfb3) v1.41 - luainstance: add missing entry for shadow color (832649c) v1.42 - cc_text: if dx and dy is not set and text have parent use Height (5ac8d00) v1.43 - cc_window: dont paint over screen size (46b77c7) v1.44 - cpicture: Add getHeight/getWidth option (7e874dd) v1.45 - cpicture: Add setDimensionsAll option (fcfb4c4) v1.46 - Set Lua api version to 1.46 See also neutrino-hd wiki: https://wiki.neutrino-hd.de/wiki/Neutrino_HD_Lua_API#Changelog Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/c990411575812689b988e3bb6418d64550b5f763 Author: Michael Liebmann Date: 2016-08-22 (Mon, 22 Aug 2016) Origin message was: ------------------ Complete missing lua api versions: - colors: some internal renamings (78230ea) v1.40 - colors: make footer background color configurable (70abfb3) v1.41 - luainstance: add missing entry for shadow color (832649c) v1.42 - cc_text: if dx and dy is not set and text have parent use Height (5ac8d00) v1.43 - cc_window: dont paint over screen size (46b77c7) v1.44 - cpicture: Add getHeight/getWidth option (7e874dd) v1.45 - cpicture: Add setDimensionsAll option (fcfb4c4) v1.46 - Set Lua api version to 1.46 See also neutrino-hd wiki: https://wiki.neutrino-hd.de/wiki/Neutrino_HD_Lua_API#Changelog --- src/gui/lua/lua_api_version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/lua/lua_api_version.h b/src/gui/lua/lua_api_version.h index f95bdbc54..51f649f64 100644 --- a/src/gui/lua/lua_api_version.h +++ b/src/gui/lua/lua_api_version.h @@ -4,4 +4,4 @@ * to luainstance.h changes */ #define LUA_API_VERSION_MAJOR 1 -#define LUA_API_VERSION_MINOR 39 +#define LUA_API_VERSION_MINOR 46 From a8292eae0b922430aeebe9647e505764d3e48e49 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Mon, 22 Aug 2016 20:59:06 +0200 Subject: [PATCH 08/17] src/gui/lua/lua_cc_window.cpp use setButtonLabels real window width Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/52d16769f13ca14abd9d5cc72c368a6bb73b06fd Author: Jacek Jendrzej Date: 2016-08-22 (Mon, 22 Aug 2016) --- src/gui/lua/lua_cc_window.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/lua/lua_cc_window.cpp b/src/gui/lua/lua_cc_window.cpp index 754a1c16d..03313ca22 100644 --- a/src/gui/lua/lua_cc_window.cpp +++ b/src/gui/lua/lua_cc_window.cpp @@ -161,7 +161,7 @@ int CLuaInstCCWindow::CCWindowNew(lua_State *L) buttons.push_back(btnSblue); } if (!buttons.empty()) - footer->setButtonLabels(buttons, dx-20, (dx-20) / (buttons.size()+1)); + footer->setButtonLabels(buttons, (*udata)->w->getWidth()-20, ((*udata)->w->getWidth()-20) / (buttons.size()+1)); } } From cdd40d98b0407e2978affd6c89d7231d7e2ac099 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 20 Aug 2016 23:54:40 +0200 Subject: [PATCH 09/17] CComponentsFooter: use background color of footer inside chain object Ensure pass of bg color from parent into chain object and button objects. Required by embedded button objects. This prevents "holes" on screen. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/a92757697f6f911fd36016e0a39c62ca4f2bf10d Author: Thilo Graf Date: 2016-08-20 (Sat, 20 Aug 2016) --- 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 de72490fd..7945d8a3c 100644 --- a/src/gui/components/cc_frm_footer.cpp +++ b/src/gui/components/cc_frm_footer.cpp @@ -117,7 +117,7 @@ void CComponentsFooter::setButtonLabels(const struct button_label_s * const cont //footer as primary container (in this context '=this') and the parent for the button label container (chain object), //button label container (chain object) itself is concurrent the parent object for button objects. if (chain == NULL){ - chain = new CComponentsFrmChain(x_chain, CC_CENTERED, w_chain, height, 0, CC_DIR_X, this); + chain = new CComponentsFrmChain(x_chain, CC_CENTERED, w_chain, height, 0, CC_DIR_X, this, CC_SHADOW_OFF, COL_MENUCONTENT_PLUS_6, col_body); chain->setCorner(this->corner_rad, this->corner_type); chain->doPaintBg(false); } From 27f527bb45de9ab3c6eaf4d6f60b28a08ce40b74 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 21 Aug 2016 14:22:08 +0200 Subject: [PATCH 10/17] CComponentsWindow: simplify statements Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/ca5702acf4b3ccb52bf5944206e89c06abe64a72 Author: Thilo Graf Date: 2016-08-21 (Sun, 21 Aug 2016) --- src/gui/components/cc_frm_window.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/gui/components/cc_frm_window.cpp b/src/gui/components/cc_frm_window.cpp index e808e28b1..a3a5ba43e 100644 --- a/src/gui/components/cc_frm_window.cpp +++ b/src/gui/components/cc_frm_window.cpp @@ -168,14 +168,10 @@ void CComponentsWindow::initWindowSize() if (cc_parent) return; - if (width == 0) - width = frameBuffer->getScreenWidth(); - else if ((unsigned)width > frameBuffer->getScreenWidth()) + if (width == 0 || (unsigned)width > frameBuffer->getScreenWidth()) width = frameBuffer->getScreenWidth(); - if (height == 0) - height = frameBuffer->getScreenHeight(); - else if((unsigned)height > frameBuffer->getScreenHeight()) + if (height == 0 || (unsigned)height > frameBuffer->getScreenHeight()) height = frameBuffer->getScreenHeight(); } From 5e16a9f6b4f05bd9c829bdbe9a62cb1de18c52a6 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 21 Aug 2016 15:12:01 +0200 Subject: [PATCH 11/17] CComponentsButton: reduce shadow width buttons are mostly small elements, so these elements should have a reasonable shadow width Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/2cf409bc27a227adbdb2da76bc88dd677774d583 Author: Thilo Graf Date: 2016-08-21 (Sun, 21 Aug 2016) --- src/gui/components/cc_frm_button.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/components/cc_frm_button.cpp b/src/gui/components/cc_frm_button.cpp index a92617ebf..24b2d8917 100644 --- a/src/gui/components/cc_frm_button.cpp +++ b/src/gui/components/cc_frm_button.cpp @@ -100,7 +100,7 @@ void CComponentsButton::initVarButton( const int& x_pos, const int& y_pos, const width = w; height = h; shadow = shadow_mode; - shadow_w = SHADOW_OFFSET; + shadow_w = SHADOW_OFFSET/2; //buttons are mostly small elements, so these elements should have a reasonable shadow width cc_body_gradient_enable = CC_COLGRAD_OFF/*g_settings.gradiant*/; //TODO: gradient is prepared for use but disabled at the moment till some other parts of gui parts are provide gradient setColBodyGradient(cc_body_gradient_enable/*CColorGradient::gradientLight2Dark*/, CFrameBuffer::gradientVertical, CColorGradient::light); @@ -113,7 +113,7 @@ void CComponentsButton::initVarButton( const int& x_pos, const int& y_pos, const fr_thickness = 0; //TODO: parts of the GUI still don't use framed buttons append_x_offset = 6; append_y_offset = 0; - corner_rad = 0; + corner_rad = RADIUS_SMALL; cc_btn_capt_col = cc_body_gradient_enable ? COL_BUTTON_TEXT_ENABLED : COL_MENUFOOT_TEXT; cc_btn_capt_disable_col = cc_body_gradient_enable ? COL_BUTTON_TEXT_DISABLED : COL_MENUCONTENTINACTIVE_TEXT; From d2c96fd9e7387721296a99632e6b9e8f0d95a251 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 21 Aug 2016 20:45:12 +0200 Subject: [PATCH 12/17] CMenuWidget: assign all layer colors out of header init This fixes missing applying of possible changes of colour settings in color setup for frame. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/41ed6513bd28911ef0e7e1f62631939ef0aa6c9f Author: Thilo Graf Date: 2016-08-21 (Sun, 21 Aug 2016) --- 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 5d6c73335..21af5cd46 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -1243,7 +1243,7 @@ void CMenuWidget::paint() header->enableShadow(CC_SHADOW_RIGHT); header->setOffset(10); } - header->setColorBody(COL_MENUHEAD_PLUS_0); + header->setColorAll(COL_MENUCONTENT_PLUS_6, COL_MENUHEAD_PLUS_0, COL_SHADOW_PLUS_0); header->setCaptionColor(COL_MENUHEAD_TEXT); header->enableColBodyGradient(g_settings.theme.menu_Head_gradient, COL_MENUCONTENT_PLUS_0); header->enableGradientBgCleanUp(savescreen); From e371ec33837897a9f1305fd68de66b073dc25615 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 22 Aug 2016 21:11:38 +0200 Subject: [PATCH 13/17] CComponentsWindow: fix possible holes between frame and footer One line was to much Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/90866b232a4780a9c8616f80ed75cb7320848169 Author: Thilo Graf Date: 2016-08-22 (Mon, 22 Aug 2016) --- src/gui/components/cc_frm_window.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/components/cc_frm_window.cpp b/src/gui/components/cc_frm_window.cpp index a3a5ba43e..682236278 100644 --- a/src/gui/components/cc_frm_window.cpp +++ b/src/gui/components/cc_frm_window.cpp @@ -219,7 +219,7 @@ void CComponentsWindow::initFooter() ccw_footer->setPos(0, cc_yr + height - ccw_footer->getHeight()- fr_thickness); ccw_footer->setWidth(width-2*fr_thickness); ccw_footer->enableShadow(false/*shadow*/); - ccw_footer->setCorner(corner_rad-fr_thickness/2, CORNER_BOTTOM); + ccw_footer->setCorner(corner_rad-fr_thickness, CORNER_BOTTOM); ccw_footer->setButtonFont(ccw_button_font); ccw_footer->setColorBody(ccw_col_footer); ccw_footer->doPaintBg(true); From 2891e335b1db61bbcec81978e2166cc60d08d1b5 Mon Sep 17 00:00:00 2001 From: TangoCash Date: Tue, 23 Aug 2016 14:26:24 +0200 Subject: [PATCH 14/17] controlapi: add xmltv support Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/bdde716c4a08f41c4497620c242581c451c65965 Author: TangoCash Date: 2016-08-23 (Tue, 23 Aug 2016) Origin message was: ------------------ - controlapi: add xmltv support --- src/nhttpd/tuxboxapi/controlapi.cpp | 123 ++++++++++++++++++++++++++++ src/nhttpd/tuxboxapi/controlapi.h | 2 + 2 files changed, 125 insertions(+) diff --git a/src/nhttpd/tuxboxapi/controlapi.cpp b/src/nhttpd/tuxboxapi/controlapi.cpp index 0134b523c..709791eb5 100644 --- a/src/nhttpd/tuxboxapi/controlapi.cpp +++ b/src/nhttpd/tuxboxapi/controlapi.cpp @@ -217,6 +217,9 @@ const CControlAPI::TyCgiCall CControlAPI::yCgiCallList[]= {"renamebouquet", &CControlAPI::renameBouquetCGI, "text/plain"}, {"changebouquet", &CControlAPI::changeBouquetCGI, "text/plain"}, {"updatebouquet", &CControlAPI::updateBouquetCGI, "text/plain"}, + // xmltv + {"xmltv.data", &CControlAPI::xmltvepgCGI, "+xml"}, + {"xmltv.m3u", &CControlAPI::xmltvm3uCGI, ""}, // utils {"build_live_url", &CControlAPI::build_live_url, ""}, {"get_logo", &CControlAPI::logoCGI, "text/plain"}, @@ -3028,6 +3031,126 @@ void CControlAPI::updateBouquetCGI(CyhookHandler *hh) NeutrinoAPI->UpdateBouquets(); hh->SendOk(); } +//----------------------------------------------------------------------------- +// details EPG Information in xmltv format from all user bouquets +//----------------------------------------------------------------------------- +void CControlAPI::xmltvepgCGI(CyhookHandler *hh) +{ + int mode = NeutrinoAPI->Zapit->getMode(); + hh->ParamList["format"] = "xml"; + TOutType outType = hh->outStart(); + + t_channel_id channel_id; + std::string result = ""; + std::string channelTag = "", channelData = ""; + std::string programmeTag = "", programmeData = ""; + + ZapitChannelList chanlist; + CChannelEventList eList; + CChannelEventList::iterator eventIterator; + + for (int i = 0; i < (int) g_bouquetManager->Bouquets.size(); i++) + { + if (mode == CZapitClient::MODE_RADIO) + g_bouquetManager->Bouquets[i]->getRadioChannels(chanlist); + else + g_bouquetManager->Bouquets[i]->getTvChannels(chanlist); + if(!chanlist.empty() && !g_bouquetManager->Bouquets[i]->bHidden && g_bouquetManager->Bouquets[i]->bUser) + { + for(int j = 0; j < (int) chanlist.size(); j++) + { + CZapitChannel * channel = chanlist[j]; + channel_id = channel->getChannelID() & 0xFFFFFFFFFFFFULL; + channelTag = "channel id=\""+string_printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, channel_id)+"\""; + channelData = hh->outPair("display-name", hh->outValue(channel->getName()), true); + result += hh->outObject(channelTag, channelData); + + eList.clear(); + + CEitManager::getInstance()->getEventsServiceKey(channel_id, eList); + + if (eList.size() == 0) + continue; + + if (eList.size() > 50) + eList.erase(eList.begin()+50,eList.end()); + + for (eventIterator = eList.begin(); eventIterator != eList.end(); ++eventIterator) + { + if (eventIterator->get_channel_id() == channel_id) + { + programmeTag = "programme "; + programmeTag += "channel=\""+string_printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, channel_id)+"\" "; + char zbuffer[25] = { 0 }; + struct tm *mtime = localtime(&eventIterator->startTime); + strftime(zbuffer, 21, "%Y%m%d%H%M%S +0200", mtime); + programmeTag += "start=\""+std::string(zbuffer)+"\" "; + long _stoptime = eventIterator->startTime + eventIterator->duration; + mtime = localtime(&_stoptime); + strftime(zbuffer, 21, "%Y%m%d%H%M%S +0200", mtime); + programmeTag += "stop=\""+std::string(zbuffer)+"\" "; + + programmeData = hh->outPair("title lang=\"de\"", hh->outValue(eventIterator->description), false); + programmeData += hh->outPair("desc lang=\"de\"", hh->outValue(eventIterator->text), true); + + result += hh->outArrayItem(programmeTag, programmeData, false); + } + } + } + } + } + + + result = hh->outObject("tv generator-info-name=\"Neutrino XMLTV Generator v1.0\"", result); + + result = "\n\n" + result; + + hh->SendResult(result); +} + +void CControlAPI::xmltvm3uCGI(CyhookHandler *hh) +{ + + TOutType outType = hh->outStart(); + std::string result = ""; + + int mode = NeutrinoAPI->Zapit->getMode(); + // build url + std::string url = ""; + if(!hh->ParamList["host"].empty()) + url = "http://"+hh->ParamList["host"]; + else + url = "http://"+hh->HeaderList["Host"]; + /* strip off optional custom port */ + if (url.rfind(":") != 4) + url = url.substr(0, url.rfind(":")); + + url += ":31339/id="; + + result += "#EXTM3U\n"; + + for (int i = 0; i < (int) g_bouquetManager->Bouquets.size(); i++) + { + ZapitChannelList chanlist; + if (mode == CZapitClient::MODE_RADIO) + g_bouquetManager->Bouquets[i]->getRadioChannels(chanlist); + else + g_bouquetManager->Bouquets[i]->getTvChannels(chanlist); + if(!chanlist.empty() && !g_bouquetManager->Bouquets[i]->bHidden && g_bouquetManager->Bouquets[i]->bUser) + { + for(int j = 0; j < (int) chanlist.size(); j++) + { + CZapitChannel * channel = chanlist[j]; + std::string bouq_name = g_bouquetManager->Bouquets[i]->Name; + std::string chan_id_short = string_printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, channel->getChannelID() & 0xFFFFFFFFFFFFULL); + result += "#EXTINF:-1 tvg-id=\""+chan_id_short+"\" tvg-logo=\""+chan_id_short+".png\" group-title=\""+bouq_name+"\", [COLOR gold]"+channel->getName()+"[/COLOR]\n"; + result += url+string_printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, channel->getChannelID())+"\n"; + } + } + } + + hh->SendResult(result); +} //------------------------------------------------------------------------- // audio_no : (optional) audio channel // host : (optional) ip of dbox diff --git a/src/nhttpd/tuxboxapi/controlapi.h b/src/nhttpd/tuxboxapi/controlapi.h index 05749b7f5..e80702b28 100644 --- a/src/nhttpd/tuxboxapi/controlapi.h +++ b/src/nhttpd/tuxboxapi/controlapi.h @@ -123,6 +123,8 @@ private: void renameBouquetCGI(CyhookHandler *hh); void changeBouquetCGI(CyhookHandler *hh); void updateBouquetCGI(CyhookHandler *hh); + void xmltvepgCGI(CyhookHandler *hh); + void xmltvm3uCGI(CyhookHandler *hh); void build_live_url(CyhookHandler *hh); void logoCGI(CyhookHandler *hh); void ConfigCGI(CyhookHandler *hh); From 765957f617ceebfe0147d27e1d60b79dd0a9be34 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Tue, 23 Aug 2016 14:26:51 +0200 Subject: [PATCH 15/17] yhook: avoid parameters from xml closing tag Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/acf58551a8a426fc9b39432e996e374b14f43176 Author: vanhofen Date: 2016-08-23 (Tue, 23 Aug 2016) Origin message was: ------------------ - yhook: avoid parameters from xml closing tag --- src/nhttpd/yhttpd_core/yhook.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/nhttpd/yhttpd_core/yhook.cpp b/src/nhttpd/yhttpd_core/yhook.cpp index 56537c057..7838cefa9 100644 --- a/src/nhttpd/yhttpd_core/yhook.cpp +++ b/src/nhttpd/yhttpd_core/yhook.cpp @@ -444,10 +444,11 @@ std::string CyhookHandler::outSingle(std::string _content) { //----------------------------------------------------------------------------- std::string CyhookHandler::outPair(std::string _key, std::string _content, bool _next) { - std::string result = ""; + std::string result = "", _key_close = "", tmp; + ySplitString(_key, " ", _key_close, tmp); switch (outType) { case xml: - result = outIndent() + "<" + _key + ">" + _content + ""; + result = outIndent() + "<" + _key + ">" + _content + ""; break; case json: result = outIndent() + "\"" + _key + "\": \"" + _content + "\""; @@ -466,11 +467,12 @@ std::string CyhookHandler::outPair(std::string _key, std::string _content, bool //----------------------------------------------------------------------------- std::string CyhookHandler::outArray(std::string _key, std::string _content, bool _next) { - std::string result = ""; + std::string result = "", _key_close = "", tmp; + ySplitString(_key, " ", _key_close, tmp); switch (outType) { case xml: //TODO: xml check and DESC check - result = outIndent() + "<" + _key + ">\n" + _content + ""; + result = outIndent() + "<" + _key + ">\n" + _content + ""; result += "\n"; break; case json: @@ -489,11 +491,12 @@ std::string CyhookHandler::outArray(std::string _key, std::string _content, bool //----------------------------------------------------------------------------- std::string CyhookHandler::outArrayItem(std::string _key, std::string _content, bool _next) { - std::string result = ""; + std::string result = "", _key_close = "", tmp; + ySplitString(_key, " ", _key_close, tmp); switch (outType) { case xml: //TODO: xml check and DESC check - result = outIndent() + "<" + _key + ">\n" + _content + ""; + result = outIndent() + "<" + _key + ">\n" + _content + ""; result += "\n"; break; case json: @@ -511,11 +514,12 @@ std::string CyhookHandler::outArrayItem(std::string _key, std::string _content, } //----------------------------------------------------------------------------- std::string CyhookHandler::outObject(std::string _key, std::string _content, bool _next) { - std::string result = ""; + std::string result = "", _key_close = "", tmp; + ySplitString(_key, " ", _key_close, tmp); switch (outType) { case xml: //TODO: xml check and DESC check - result = outIndent() + "<" + _key + ">\n" + _content + ""; + result = outIndent() + "<" + _key + ">\n" + _content + ""; result += "\n"; break; case json: From 6398975e24ceeb90b7066583c6539d531474033c Mon Sep 17 00:00:00 2001 From: vanhofen Date: Tue, 23 Aug 2016 15:39:09 +0200 Subject: [PATCH 16/17] controlapi: remove unused variable outType from xmltv functions Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/7c47b1a2a6138f33091eb0400fe8448a8248ba2d Author: vanhofen Date: 2016-08-23 (Tue, 23 Aug 2016) Origin message was: ------------------ - controlapi: remove unused variable outType from xmltv functions --- src/nhttpd/tuxboxapi/controlapi.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/nhttpd/tuxboxapi/controlapi.cpp b/src/nhttpd/tuxboxapi/controlapi.cpp index 709791eb5..ccf614601 100644 --- a/src/nhttpd/tuxboxapi/controlapi.cpp +++ b/src/nhttpd/tuxboxapi/controlapi.cpp @@ -3038,7 +3038,7 @@ void CControlAPI::xmltvepgCGI(CyhookHandler *hh) { int mode = NeutrinoAPI->Zapit->getMode(); hh->ParamList["format"] = "xml"; - TOutType outType = hh->outStart(); + hh->outStart(); t_channel_id channel_id; std::string result = ""; @@ -3110,8 +3110,7 @@ void CControlAPI::xmltvepgCGI(CyhookHandler *hh) void CControlAPI::xmltvm3uCGI(CyhookHandler *hh) { - - TOutType outType = hh->outStart(); + hh->outStart(); std::string result = ""; int mode = NeutrinoAPI->Zapit->getMode(); From 5a24dc1ce5c4d1ba64d76e1141549cebef27aac4 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 23 Aug 2016 15:59:40 +0200 Subject: [PATCH 17/17] CComponentsFooter: don't use default parameters for privat member Passed init values are better to see here. This should fix wrong footer color too. See UPNP-Browser, color was not applied here. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/9b9a8d1a789020d43a36474c60d51453cbc6593d Author: Thilo Graf Date: 2016-08-23 (Tue, 23 Aug 2016) --- src/gui/components/cc_frm_footer.cpp | 2 +- src/gui/components/cc_frm_footer.h | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/gui/components/cc_frm_footer.cpp b/src/gui/components/cc_frm_footer.cpp index 7945d8a3c..a02d999b2 100644 --- a/src/gui/components/cc_frm_footer.cpp +++ b/src/gui/components/cc_frm_footer.cpp @@ -36,7 +36,7 @@ using namespace std; CComponentsFooter::CComponentsFooter(CComponentsForm* parent) { //CComponentsFooter - initVarFooter(1, 1, 0, 0, 0, parent); + initVarFooter(1, 1, 0, 0, 0, parent, CC_SHADOW_OFF, COL_MENUCONTENT_PLUS_6, COL_MENUFOOT_PLUS_0, COL_SHADOW_PLUS_0); } CComponentsFooter::CComponentsFooter( const int& x_pos, const int& y_pos, const int& w, const int& h, diff --git a/src/gui/components/cc_frm_footer.h b/src/gui/components/cc_frm_footer.h index 311afbc3e..b10ac8c8d 100644 --- a/src/gui/components/cc_frm_footer.h +++ b/src/gui/components/cc_frm_footer.h @@ -60,13 +60,13 @@ Missing parameters are filled with default values and must be assigned afterward class CComponentsFooter : public CComponentsHeader { private: - void initVarFooter( const int& x_pos, const int& y_pos, const int& w, const int& h = 0, - const int& buttons = 0, - CComponentsForm *parent = NULL, - int shadow_mode = CC_SHADOW_OFF, - fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, - fb_pixel_t color_body = COL_MENUFOOT_PLUS_0, - fb_pixel_t color_shadow = COL_SHADOW_PLUS_0); + void initVarFooter( const int& x_pos, const int& y_pos, const int& w, const int& h, + const int& buttons, + CComponentsForm *parent, + int shadow_mode, + fb_pixel_t color_frame, + fb_pixel_t color_body, + fb_pixel_t color_shadow ); ///show button frame and background, default false bool btn_contour;