From 35a08fc5dd37576f905a48b75da84cc1bb1023e4 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 17 Jan 2016 20:53:55 +0100 Subject: [PATCH 01/33] CTextBox: add signal handler into scroll methodes --- src/gui/widget/textbox.cpp | 2 ++ src/gui/widget/textbox.h | 1 + 2 files changed, 3 insertions(+) diff --git a/src/gui/widget/textbox.cpp b/src/gui/widget/textbox.cpp index c42fa67e2..18205ea50 100644 --- a/src/gui/widget/textbox.cpp +++ b/src/gui/widget/textbox.cpp @@ -685,6 +685,7 @@ void CTextBox::scrollPageDown(const int pages) m_nCurrentLine = m_nCurrentPage * m_nLinesPerPage; if (oldCurrentLine != m_nCurrentLine) refresh(); + OnAfterScrollPage(); } void CTextBox::scrollPageUp(const int pages) @@ -708,6 +709,7 @@ void CTextBox::scrollPageUp(const int pages) m_nCurrentLine = m_nCurrentPage * m_nLinesPerPage; if (oldCurrentLine != m_nCurrentLine) refresh(); + OnAfterScrollPage(); } void CTextBox::refresh(void) diff --git a/src/gui/widget/textbox.h b/src/gui/widget/textbox.h index 860e2cd7b..e895ece0e 100644 --- a/src/gui/widget/textbox.h +++ b/src/gui/widget/textbox.h @@ -212,6 +212,7 @@ class CTextBox : public sigc::trackable void hide (void); bool clearScreenBuffer(); sigc::signal OnAfterRefresh; + sigc::signal OnAfterScrollPage; }; #endif // !defined(AFX_TEXTBOX_H__208DED01_ABEC_491C_A632_5B21057DC5D8__INCLUDED_) From bee36d29f6ee5cc429a2439894eec576c67f7a07 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 17 Jan 2016 20:54:39 +0100 Subject: [PATCH 02/33] CMovieBrowser: fix paint of screenshots/covers while scroll in movie list Some covers were painted for entries without available cover image. Slot OnAfterRefresh() was not really a good point to paint, OnAfterScrollPage() seems a better solution. --- src/gui/moviebrowser.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gui/moviebrowser.cpp b/src/gui/moviebrowser.cpp index 590c5ed93..cfab1806f 100644 --- a/src/gui/moviebrowser.cpp +++ b/src/gui/moviebrowser.cpp @@ -1400,23 +1400,23 @@ void CMovieBrowser::refreshMovieInfo(void) if (m_settings.gui != MB_GUI_FILTER && logo_ok) { lx = m_cBoxFrameInfo.iX+m_cBoxFrameInfo.iWidth - flogo_w -14; ly = m_cBoxFrameInfo.iY - 1 + (m_cBoxFrameInfo.iHeight-flogo_h)/2; - if (pic == NULL){ + if (pic == NULL){ //TODO: paint custom covers with different ratio, currently only works with default ratio 16/9 or 4/3 pic = new CComponentsPicture(lx+2, ly+1, flogo_w, flogo_h, fname, NULL, CC_SHADOW_OFF, COL_MENUCONTENTSELECTED_PLUS_0); pic->enableFrame(true, 2); pic->enableCache(); pic->doPaintBg(false); - }else{ + }else pic->setPicture(fname); - } + if (!m_movieSelectionHandler->epgInfo2.empty()) - m_pcInfo->OnAfterRefresh.connect(sigc::mem_fun(pic, &CComponentsPicture::paint0)); - else - pic->paint0(); + m_pcInfo->OnAfterScrollPage.connect(sigc::mem_fun(pic, &CComponentsPicture::paint0)); }else{ delete pic; pic = NULL; } m_pcInfo->setText(&m_movieSelectionHandler->epgInfo2, logo_ok ? m_cBoxFrameInfo.iWidth-flogo_w-20 : 0); + if (pic) + pic->paint(CC_SAVE_SCREEN_NO); } void CMovieBrowser::info_hdd_level(bool paint_hdd) From ec4aa07e175806afb059b8be698ec0ca89435b70 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 16 Jan 2016 14:39:03 +0100 Subject: [PATCH 03/33] add CListHelpers class this can be used to factor out duplicate code implementations from all the various channel-, bouquet-, eventlists etc... --- src/gui/widget/Makefile.am | 1 + src/gui/widget/listhelpers.cpp | 71 ++++++++++++++++++++++++++++++++++ src/gui/widget/listhelpers.h | 30 ++++++++++++++ 3 files changed, 102 insertions(+) create mode 100644 src/gui/widget/listhelpers.cpp create mode 100644 src/gui/widget/listhelpers.h diff --git a/src/gui/widget/Makefile.am b/src/gui/widget/Makefile.am index ea77f8b29..0788d0319 100644 --- a/src/gui/widget/Makefile.am +++ b/src/gui/widget/Makefile.am @@ -25,6 +25,7 @@ libneutrino_gui_widget_a_SOURCES = \ keyboard_input.cpp \ listbox.cpp \ listframe.cpp \ + listhelpers.cpp \ menue.cpp \ messagebox.cpp \ mountchooser.cpp \ diff --git a/src/gui/widget/listhelpers.cpp b/src/gui/widget/listhelpers.cpp new file mode 100644 index 000000000..0f368a698 --- /dev/null +++ b/src/gui/widget/listhelpers.cpp @@ -0,0 +1,71 @@ +/* + Helper functions for various list implementations in neutrino + Copyright (C) 2016 Stefan Seyfried + + License: GPL + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see http://www.gnu.org/licenses/ +*/ + +#include +#include "listhelpers.h" + +#include +#include + +template int CListHelpers::UpDownKey(T list, neutrino_msg_t msg, int lines, int sel) +{ + int step; + if (list.empty()) + return -1; + + if (msg >= CRCInput::RC_MaxRC) { + printf("CListHelpers:%s: invalid key? 0x%lx\n", __func__, msg); + return -1; + } + int key = (int)msg; + if (key == g_settings.key_pageup) + step = -lines; + else if (key == g_settings.key_pagedown) + step = lines; + else if (msg == CRCInput::RC_up) + step = -1; + else if (msg == CRCInput::RC_down) + step = 1; + else { + printf("CListHelpers:%s: invalid key? 0x%lx\n", __func__, msg); + return -1; + } + int size = (int)list.size(); /* bigger than 0, because we checked for empty() before */ + // printf("CListHelpers:%s: key 0x%04lx lines %d size %d sel %d\n", __func__, msg, lines, size, sel); + int new_sel = sel + step; + if (new_sel < 0) { + if (sel != 0 && step != 1) + new_sel = 0; + else + new_sel = size - 1; + } + else if (new_sel > size - 1) { + if (sel != size - 1) + new_sel = size - 1; + else + new_sel = 0; + } + return new_sel; +} + +/* all used versions need to be prototyped here, to avoid linker errors */ +template int CListHelpers::UpDownKey >(std::vector, neutrino_msg_t, int, int); +template int CListHelpers::UpDownKey >(std::vector, neutrino_msg_t, int, int); +template int CListHelpers::UpDownKey >(std::vector, neutrino_msg_t, int, int); diff --git a/src/gui/widget/listhelpers.h b/src/gui/widget/listhelpers.h new file mode 100644 index 000000000..4ac2274cc --- /dev/null +++ b/src/gui/widget/listhelpers.h @@ -0,0 +1,30 @@ +/* + Helper functions for various list implementations in neutrino + Copyright (C) 2016 Stefan Seyfried + + License: GPL + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see http://www.gnu.org/licenses/ +*/ + + +#ifndef __LISTHELPERS__ +#define __LISTHELPERS__ + +class CListHelpers +{ + public: + template int UpDownKey(T list, neutrino_msg_t k, int lines, int sel); +}; +#endif From aec658ce2f73d8de8f8eab1fc386cdf0a3064712 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 16 Jan 2016 15:01:29 +0100 Subject: [PATCH 04/33] use CListHelpers to remove duplicated code CListHelpers::UpDownKey() allows to remove duplicated code from channellist, bouquetlist and bouqueteditor. --- src/gui/bedit/bouqueteditor_bouquets.cpp | 43 ++++-------------------- src/gui/bedit/bouqueteditor_bouquets.h | 3 +- src/gui/bedit/bouqueteditor_channels.cpp | 42 ++++------------------- src/gui/bedit/bouqueteditor_channels.h | 3 +- src/gui/bouquetlist.cpp | 42 ++++------------------- src/gui/bouquetlist.h | 3 +- src/gui/channellist.cpp | 30 ++++------------- src/gui/channellist.h | 3 +- 8 files changed, 33 insertions(+), 136 deletions(-) diff --git a/src/gui/bedit/bouqueteditor_bouquets.cpp b/src/gui/bedit/bouqueteditor_bouquets.cpp index c588464f0..3f829e2b8 100644 --- a/src/gui/bedit/bouqueteditor_bouquets.cpp +++ b/src/gui/bedit/bouqueteditor_bouquets.cpp @@ -2,15 +2,7 @@ Neutrino-GUI - DBoxII-Project Copyright (C) 2001 Steffen Hehn 'McClean' - Homepage: http://dbox.cyberphoria.org/ - - Kommentar: - - Diese GUI wurde von Grund auf neu programmiert und sollte nun vom - Aufbau und auch den Ausbaumoeglichkeiten gut aussehen. Neutrino basiert - auf der Client-Server Idee, diese GUI ist also von der direkten DBox- - Steuerung getrennt. Diese wird dann von Daemons uebernommen. - + Copyright (C) 2009,2011,2013,2016 Stefan Seyfried License: GPL @@ -166,7 +158,7 @@ void CBEBouquetWidget::hide() void CBEBouquetWidget::updateSelection(unsigned int newpos) { - if(newpos == selected) + if (newpos == selected || newpos == (unsigned int)-1) return; unsigned int prev_selected = selected; @@ -272,34 +264,11 @@ int CBEBouquetWidget::exec(CMenuTarget* parent, const std::string & /*actionKey* cancelMoveBouquet(); } } - else if (msg==CRCInput::RC_up || msg==(neutrino_msg_t)g_settings.key_pageup) + else if (msg == CRCInput::RC_up || msg == (neutrino_msg_t)g_settings.key_pageup || + msg == CRCInput::RC_down || msg == (neutrino_msg_t)g_settings.key_pagedown) { - if (!(Bouquets->empty())) { - int step = (msg == (neutrino_msg_t)g_settings.key_pageup) ? listmaxshow : 1; // browse or step 1 - int new_selected = selected - step; - - if (new_selected < 0) { - if (selected != 0 && step != 1) - new_selected = 0; - else - new_selected = Bouquets->size() - 1; - } - updateSelection(new_selected); - } - } - else if (msg==CRCInput::RC_down || msg==(neutrino_msg_t)g_settings.key_pagedown) - { - if (!(Bouquets->empty())) { - int step = ((int) msg == g_settings.key_pagedown) ? listmaxshow : 1; // browse or step 1 - int new_selected = selected + step; - if (new_selected > (int) Bouquets->size() - 1) { - if ((selected != Bouquets->size() - 1)) - new_selected = Bouquets->size() - 1; - else - new_selected = 0; - } - updateSelection(new_selected); - } + int new_selected = UpDownKey(*Bouquets, msg, listmaxshow, selected); + updateSelection(new_selected); } else if (msg == (neutrino_msg_t) g_settings.key_list_start || msg == (neutrino_msg_t) g_settings.key_list_end) { if (!(Bouquets->empty())) { diff --git a/src/gui/bedit/bouqueteditor_bouquets.h b/src/gui/bedit/bouqueteditor_bouquets.h index 1c935b587..256bd25bb 100644 --- a/src/gui/bedit/bouqueteditor_bouquets.h +++ b/src/gui/bedit/bouqueteditor_bouquets.h @@ -39,6 +39,7 @@ #include #include #include +#include #include /* class for handling when bouquets changed. */ @@ -51,7 +52,7 @@ public: virtual void onBouquetsChanged() {}; }; -class CBEBouquetWidget : public CMenuTarget +class CBEBouquetWidget : public CMenuTarget, public CListHelpers { private: diff --git a/src/gui/bedit/bouqueteditor_channels.cpp b/src/gui/bedit/bouqueteditor_channels.cpp index 6d92d9cc9..2286dbc17 100644 --- a/src/gui/bedit/bouqueteditor_channels.cpp +++ b/src/gui/bedit/bouqueteditor_channels.cpp @@ -5,14 +5,7 @@ Homepage: http://dbox.cyberphoria.org/ Copyright (C) 2011 CoolStream International Ltd - - Kommentar: - - Diese GUI wurde von Grund auf neu programmiert und sollte nun vom - Aufbau und auch den Ausbaumoeglichkeiten gut aussehen. Neutrino basiert - auf der Client-Server Idee, diese GUI ist also von der direkten DBox- - Steuerung getrennt. Diese wird dann von Daemons uebernommen. - + Copyright (C) 2009,2011,2013,2016 Stefan Seyfried License: GPL @@ -283,7 +276,7 @@ void CBEChannelWidget::hide() void CBEChannelWidget::updateSelection(unsigned int newpos) { - if(newpos == selected) + if (newpos == selected || newpos == (unsigned int)-1) return; unsigned int prev_selected = selected; @@ -360,34 +353,11 @@ int CBEChannelWidget::exec(CMenuTarget* parent, const std::string & /*actionKey* cancelMoveChannel(); } } - else if (msg==CRCInput::RC_up || msg==(neutrino_msg_t)g_settings.key_pageup) + else if (msg == CRCInput::RC_up || msg == (neutrino_msg_t)g_settings.key_pageup || + msg == CRCInput::RC_down || msg == (neutrino_msg_t)g_settings.key_pagedown) { - if (!(Channels->empty())) { - int step = (msg == (neutrino_msg_t)g_settings.key_pageup) ? listmaxshow : 1; // browse or step 1 - int new_selected = selected - step; - - if (new_selected < 0) { - if (selected != 0 && step != 1) - new_selected = 0; - else - new_selected = Channels->size() - 1; - } - updateSelection(new_selected); - } - } - else if (msg==CRCInput::RC_down || msg==(neutrino_msg_t)g_settings.key_pagedown) - { - if (!(Channels->empty())) { - int step = ((int) msg == g_settings.key_pagedown) ? listmaxshow : 1; // browse or step 1 - int new_selected = selected + step; - if (new_selected > (int) Channels->size() - 1) { - if ((selected != Channels->size() - 1)) - new_selected = Channels->size() - 1; - else - new_selected = 0; - } - updateSelection(new_selected); - } + int new_selected = UpDownKey(*Channels, msg, listmaxshow, selected); + updateSelection(new_selected); } else if (msg == (neutrino_msg_t) g_settings.key_list_start || msg == (neutrino_msg_t) g_settings.key_list_end) { if (!(Channels->empty())) { diff --git a/src/gui/bedit/bouqueteditor_channels.h b/src/gui/bedit/bouqueteditor_channels.h index fd17636fb..d13b9aa74 100644 --- a/src/gui/bedit/bouqueteditor_channels.h +++ b/src/gui/bedit/bouqueteditor_channels.h @@ -35,6 +35,7 @@ #include #include +#include #include #include @@ -42,7 +43,7 @@ #include #include -class CBEChannelWidget : public CMenuTarget +class CBEChannelWidget : public CMenuTarget, public CListHelpers { private: diff --git a/src/gui/bouquetlist.cpp b/src/gui/bouquetlist.cpp index e1ecb09e6..ae8dd7b3f 100644 --- a/src/gui/bouquetlist.cpp +++ b/src/gui/bouquetlist.cpp @@ -2,15 +2,7 @@ Neutrino-GUI - DBoxII-Project Copyright (C) 2001 Steffen Hehn 'McClean' - Homepage: http://dbox.cyberphoria.org/ - - Kommentar: - - Diese GUI wurde von Grund auf neu programmiert und sollte nun vom - Aufbau und auch den Ausbaumoeglichkeiten gut aussehen. Neutrino basiert - auf der Client-Server Idee, diese GUI ist also von der direkten DBox- - Steuerung getrennt. Diese wird dann von Daemons uebernommen. - + Copyright (C) 2009,2011,2013,2015-2016 Stefan Seyfried License: GPL @@ -390,6 +382,8 @@ const struct button_label CBouquetListButtons[4] = void CBouquetList::updateSelection(int newpos) { + if (newpos < 0) /* to avoid all callers having to check */ + return; if((int) selected != newpos) { int prev_selected = selected; unsigned int oldliststart = liststart; @@ -527,33 +521,11 @@ int CBouquetList::show(bool bShowChannelList) if (!Bouquets.empty()) updateSelection(Bouquets.size()-1); } - else if (msg == CRCInput::RC_up || (int) msg == g_settings.key_pageup) + else if (msg == CRCInput::RC_up || (int) msg == g_settings.key_pageup || + msg == CRCInput::RC_down || (int) msg == g_settings.key_pagedown) { - if (!Bouquets.empty()) { - int step = ((int) msg == g_settings.key_pageup) ? listmaxshow : 1; // browse or step 1 - int new_selected = selected - step; - if (new_selected < 0) { - if (selected != 0 && step != 1) - new_selected = 0; - else - new_selected = Bouquets.size() - 1; - } - updateSelection(new_selected); - } - } - else if (msg == CRCInput::RC_down || (int) msg == g_settings.key_pagedown) - { - if (!Bouquets.empty()) { - int step = ((int) msg == g_settings.key_pagedown) ? listmaxshow : 1; // browse or step 1 - int new_selected = selected + step; - if (new_selected > (int) Bouquets.size() - 1) { - if ((selected != Bouquets.size() - 1)) - new_selected = Bouquets.size() - 1; - else - new_selected = 0; - } - updateSelection(new_selected); - } + int new_selected = UpDownKey(Bouquets, msg, listmaxshow, selected); + updateSelection(new_selected); } else if(msg == (neutrino_msg_t)g_settings.key_bouquet_up || msg == (neutrino_msg_t)g_settings.key_bouquet_down) { if(bShowChannelList) { diff --git a/src/gui/bouquetlist.h b/src/gui/bouquetlist.h index e767a6c47..1ba8a199e 100644 --- a/src/gui/bouquetlist.h +++ b/src/gui/bouquetlist.h @@ -34,6 +34,7 @@ #define __bouquetlist__ #include +#include #include #include @@ -77,7 +78,7 @@ class CBouquet }; -class CBouquetList +class CBouquetList : public CListHelpers { private: CFrameBuffer *frameBuffer; diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 9c658f5ff..c0b4df985 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -2,7 +2,7 @@ Neutrino-GUI - DBoxII-Project Copyright (C) 2001 Steffen Hehn 'McClean' - Copyright (C) 2007-2015 Stefan Seyfried + Copyright (C) 2007-2016 Stefan Seyfried Kommentar: @@ -724,31 +724,13 @@ int CChannelList::show() else if (!empty && msg == (neutrino_msg_t) g_settings.key_list_end) { actzap = updateSelection((*chanlist).size()-1); } - else if (!empty && (msg == CRCInput::RC_up || (int) msg == g_settings.key_pageup)) + else if (!empty && (msg == CRCInput::RC_up || (int)msg == g_settings.key_pageup || + msg == CRCInput::RC_down || (int)msg == g_settings.key_pagedown)) { displayList = 1; - int step = ((int) msg == g_settings.key_pageup) ? listmaxshow : 1; // browse or step 1 - int new_selected = selected - step; - if (new_selected < 0) { - if (selected != 0 && step != 1) - new_selected = 0; - else - new_selected = (*chanlist).size() - 1; - } - actzap = updateSelection(new_selected); - } - else if (!empty && (msg == CRCInput::RC_down || (int) msg == g_settings.key_pagedown)) - { - displayList = 1; - int step = ((int) msg == g_settings.key_pagedown) ? listmaxshow : 1; // browse or step 1 - int new_selected = selected + step; - if (new_selected > (int) (*chanlist).size() - 1) { - if ((selected != (*chanlist).size() - 1)) - new_selected = (*chanlist).size() - 1; - else - new_selected = 0; - } - actzap = updateSelection(new_selected); + int new_selected = UpDownKey((*chanlist), msg, listmaxshow, selected); + if (new_selected >= 0) + actzap = updateSelection(new_selected); } else if (!edit_state && (msg == (neutrino_msg_t)g_settings.key_bouquet_up || msg == (neutrino_msg_t)g_settings.key_bouquet_down)) { diff --git a/src/gui/channellist.h b/src/gui/channellist.h index 96014b6b4..21d2babda 100644 --- a/src/gui/channellist.h +++ b/src/gui/channellist.h @@ -35,6 +35,7 @@ #include #include +#include #include #include @@ -63,7 +64,7 @@ enum { class CBouquet; -class CChannelList +class CChannelList : public CListHelpers { private: enum state_ From 99453de557eeed8195d3df85eee0a1ddba8e1a0e Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 16 Jan 2016 15:38:04 +0100 Subject: [PATCH 05/33] eventlist: use CListHelpers::UpDownKey --- src/gui/eventlist.cpp | 27 ++++----------------------- src/gui/eventlist.h | 3 ++- src/gui/widget/listhelpers.cpp | 1 + 3 files changed, 7 insertions(+), 24 deletions(-) diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index 49f76757d..7f6560d49 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -4,7 +4,7 @@ Copyright (C) 2001 Steffen Hehn 'McClean' Homepage: http://dbox.cyberphoria.org/ - Copyright (C) 2009-2014 Stefan Seyfried + Copyright (C) 2009-2016 Stefan Seyfried License: GPL @@ -359,7 +359,6 @@ int CEventList::exec(const t_channel_id channel_id, const std::string& channelna msg == CRCInput::RC_down || (int) msg == g_settings.key_pagedown) { bool paint_buttonbar = false; //function bar - int step = 0; int prev_selected = selected; // TODO: do we need this at all? Search button is always painted IIUC... if ((g_settings.key_channelList_addremind != (int)CRCInput::RC_nokey) || @@ -367,27 +366,9 @@ int CEventList::exec(const t_channel_id channel_id, const std::string& channelna ((g_settings.recording_type != CNeutrinoApp::RECORDING_OFF) && (g_settings.key_channelList_addrecord != (int)CRCInput::RC_nokey))) paint_buttonbar = true; - - if (msg == CRCInput::RC_up || (int) msg == g_settings.key_pageup) - { - step = ((int) msg == g_settings.key_pageup) ? listmaxshow : 1; // browse or step 1 - selected -= step; - if((prev_selected-step) < 0) // because of uint - selected = evtlist.size() - 1; - paintDescription(selected); - } - else if (msg == CRCInput::RC_down || (int) msg == g_settings.key_pagedown) - { - step = ((int) msg == g_settings.key_pagedown) ? listmaxshow : 1; // browse or step 1 - selected += step; - - if(selected >= evtlist.size()) - { - if (((evtlist.size() / listmaxshow) + 1) * listmaxshow == evtlist.size() + listmaxshow) // last page has full entries - selected = 0; - else - selected = ((step == (int)listmaxshow) && (selected < (((evtlist.size() / listmaxshow) + 1) * listmaxshow))) ? (evtlist.size() - 1) : 0; - } + int new_sel = UpDownKey(evtlist, msg, listmaxshow, selected); + if (new_sel >= 0) { + selected = new_sel; paintDescription(selected); } paintItem(prev_selected - liststart, channel_id); diff --git a/src/gui/eventlist.h b/src/gui/eventlist.h index 9bda01658..a5d9b9737 100644 --- a/src/gui/eventlist.h +++ b/src/gui/eventlist.h @@ -40,11 +40,12 @@ #include "infoviewer.h" #include "widget/menue.h" +#include "widget/listhelpers.h" #include -class CEventList +class CEventList : public CListHelpers { // Eventfinder start public: diff --git a/src/gui/widget/listhelpers.cpp b/src/gui/widget/listhelpers.cpp index 0f368a698..7ad2e1cec 100644 --- a/src/gui/widget/listhelpers.cpp +++ b/src/gui/widget/listhelpers.cpp @@ -69,3 +69,4 @@ template int CListHelpers::UpDownKey(T list, neutrino_msg_t msg, int l template int CListHelpers::UpDownKey >(std::vector, neutrino_msg_t, int, int); template int CListHelpers::UpDownKey >(std::vector, neutrino_msg_t, int, int); template int CListHelpers::UpDownKey >(std::vector, neutrino_msg_t, int, int); +template int CListHelpers::UpDownKey >(std::vector, neutrino_msg_t, int, int); From 7b872060996391cca51a997f51995e304784e72f Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 16 Jan 2016 17:48:30 +0100 Subject: [PATCH 06/33] CListHelpers: allow UpDownKey with int type, too --- src/gui/widget/listhelpers.cpp | 25 ++++++++++++++++++------- src/gui/widget/listhelpers.h | 10 +++++++++- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/src/gui/widget/listhelpers.cpp b/src/gui/widget/listhelpers.cpp index 7ad2e1cec..c06c3504f 100644 --- a/src/gui/widget/listhelpers.cpp +++ b/src/gui/widget/listhelpers.cpp @@ -24,10 +24,10 @@ #include #include -template int CListHelpers::UpDownKey(T list, neutrino_msg_t msg, int lines, int sel) +static int upDownKey(int size, neutrino_msg_t msg, int lines, int sel) { int step; - if (list.empty()) + if (size <= 0) /* list.empty() or similar... */ return -1; if (msg >= CRCInput::RC_MaxRC) { @@ -47,7 +47,6 @@ template int CListHelpers::UpDownKey(T list, neutrino_msg_t msg, int l printf("CListHelpers:%s: invalid key? 0x%lx\n", __func__, msg); return -1; } - int size = (int)list.size(); /* bigger than 0, because we checked for empty() before */ // printf("CListHelpers:%s: key 0x%04lx lines %d size %d sel %d\n", __func__, msg, lines, size, sel); int new_sel = sel + step; if (new_sel < 0) { @@ -65,8 +64,20 @@ template int CListHelpers::UpDownKey(T list, neutrino_msg_t msg, int l return new_sel; } +int CListHelpers::_UpDownKey(int size, neutrino_msg_t msg, int lines, int sel, _id) +{ + return upDownKey(size, msg, lines, sel); +} + +template int CListHelpers::_UpDownKey(T list, neutrino_msg_t msg, int lines, int sel, _id) +{ + return upDownKey(list.size(), msg, lines, sel); +} + /* all used versions need to be prototyped here, to avoid linker errors */ -template int CListHelpers::UpDownKey >(std::vector, neutrino_msg_t, int, int); -template int CListHelpers::UpDownKey >(std::vector, neutrino_msg_t, int, int); -template int CListHelpers::UpDownKey >(std::vector, neutrino_msg_t, int, int); -template int CListHelpers::UpDownKey >(std::vector, neutrino_msg_t, int, int); +/* helper macro for the prototypes */ +#define updown_t(x) template int CListHelpers::_UpDownKey(x, neutrino_msg_t, int, int, _id) +updown_t(std::vector); +updown_t(std::vector); +updown_t(std::vector); +updown_t(std::vector); diff --git a/src/gui/widget/listhelpers.h b/src/gui/widget/listhelpers.h index 4ac2274cc..228bd88d7 100644 --- a/src/gui/widget/listhelpers.h +++ b/src/gui/widget/listhelpers.h @@ -21,10 +21,18 @@ #ifndef __LISTHELPERS__ #define __LISTHELPERS__ +/* allow to trick the compiler into overriding template definitions */ +template struct _id { typedef T type; }; class CListHelpers { public: - template int UpDownKey(T list, neutrino_msg_t k, int lines, int sel); + template int UpDownKey(T list, neutrino_msg_t k, int lines, int sel) { + return _UpDownKey(list, k, lines, sel, _id()); + } + private: + /* stackoverflow.com/questions/3052579 */ + template int _UpDownKey(T list, neutrino_msg_t k, int lines, int sel, _id); + int _UpDownKey(int list, neutrino_msg_t k, int lines, int sel, _id); }; #endif From edf7d48e04830ac7f8b4ff87a96667c35eb4778c Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 16 Jan 2016 17:51:28 +0100 Subject: [PATCH 07/33] upnpbrowser: use CListHelpers::UpDownKey --- src/gui/upnpbrowser.cpp | 37 ++++++---------------------------- src/gui/upnpbrowser.h | 3 ++- src/gui/widget/listhelpers.cpp | 2 ++ 3 files changed, 10 insertions(+), 32 deletions(-) diff --git a/src/gui/upnpbrowser.cpp b/src/gui/upnpbrowser.cpp index 509300bb0..dd18cee43 100644 --- a/src/gui/upnpbrowser.cpp +++ b/src/gui/upnpbrowser.cpp @@ -2,16 +2,7 @@ Neutrino-GUI - DBoxII-Project UPnP Browser (c) 2007 by Jochen Friedrich - - Homepage: http://dbox.cyberphoria.org/ - - Kommentar: - - Diese GUI wurde von Grund auf neu programmiert und sollte nun vom - Aufbau und auch den Ausbaumoeglichkeiten gut aussehen. Neutrino basiert - auf der Client-Server Idee, diese GUI ist also von der direkten DBox- - Steuerung getrennt. Diese wird dann von Daemons uebernommen. - + (c) 2009-2011,2016 Stefan Seyfried License: GPL @@ -436,6 +427,8 @@ std::vector *CUpnpBrowserGui::decodeResult(std::string result) void CUpnpBrowserGui::updateDeviceSelection(int newpos) { + if (newpos < 0) /* do not explode if called with -1 arg... */ + return; if((int) m_selecteddevice != newpos) { int prev_selected = m_selecteddevice; unsigned int oldliststart = m_deviceliststart; @@ -488,28 +481,10 @@ void CUpnpBrowserGui::selectDevice() else if (msg_repeatok == (neutrino_msg_t) g_settings.key_list_end) { updateDeviceSelection(m_devices.size()-1); } - else if (msg_repeatok == CRCInput::RC_up || (int) msg == g_settings.key_pageup) + else if (msg_repeatok == CRCInput::RC_up || (int)msg == g_settings.key_pageup || + msg_repeatok == CRCInput::RC_down || (int)msg == g_settings.key_pagedown) { - int step = ((int) msg == g_settings.key_pageup) ? m_listmaxshow : 1; // browse or step 1 - int new_selected = m_selecteddevice - step; - if (new_selected < 0) { - if (m_selecteddevice != 0 && step != 1) - new_selected = 0; - else - new_selected = m_devices.size() - 1; - } - updateDeviceSelection(new_selected); - } - else if (msg_repeatok == CRCInput::RC_down || (int) msg == g_settings.key_pagedown) - { - int step = ((int) msg == g_settings.key_pagedown) ? m_listmaxshow : 1; // browse or step 1 - int new_selected = m_selecteddevice + step; - if (new_selected > (int) m_devices.size() - 1) { - if ((m_selecteddevice != m_devices.size() - 1)) - new_selected = m_devices.size() - 1; - else - new_selected = 0; - } + int new_selected = UpDownKey(m_devices, msg_repeatok, m_listmaxshow, m_selecteddevice); updateDeviceSelection(new_selected); } else if (msg == CRCInput::RC_right || msg == CRCInput::RC_ok) diff --git a/src/gui/upnpbrowser.h b/src/gui/upnpbrowser.h index 1e7f78051..940122d6a 100644 --- a/src/gui/upnpbrowser.h +++ b/src/gui/upnpbrowser.h @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -66,7 +67,7 @@ struct UPnPEntry int type; }; -class CUpnpBrowserGui : public CMenuTarget +class CUpnpBrowserGui : public CMenuTarget, public CListHelpers { public: CUpnpBrowserGui(); diff --git a/src/gui/widget/listhelpers.cpp b/src/gui/widget/listhelpers.cpp index c06c3504f..1249cc503 100644 --- a/src/gui/widget/listhelpers.cpp +++ b/src/gui/widget/listhelpers.cpp @@ -23,6 +23,7 @@ #include #include +#include static int upDownKey(int size, neutrino_msg_t msg, int lines, int sel) { @@ -81,3 +82,4 @@ updown_t(std::vector); updown_t(std::vector); updown_t(std::vector); updown_t(std::vector); +updown_t(std::vector); From ed7eaafbcb495bb744f707bf3f12b7f5359a2416 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 16 Jan 2016 18:18:50 +0100 Subject: [PATCH 08/33] timerlist: use CListHelpers remove duplicated code and use CListHelpers::UpDownKey(). Some variable types had to be changed to avoid typecasts, as a result (int) casts to foo.size() had to be added :-) --- src/gui/timerlist.cpp | 62 +++++++--------------------------- src/gui/timerlist.h | 7 ++-- src/gui/widget/listhelpers.cpp | 2 ++ 3 files changed, 19 insertions(+), 52 deletions(-) diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index 906424103..a0a5faac4 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -458,7 +458,7 @@ void CTimerList::updateEvents(void) height = theight+listmaxshow*fheight*2+footerHeight; // recalc height } - if (selected==timerlist.size() && !(timerlist.empty())) + if (!timerlist.empty() && selected == (int)timerlist.size()) { selected=timerlist.size()-1; liststart = (selected/listmaxshow)*listmaxshow; @@ -519,58 +519,22 @@ int CTimerList::show() loop=false; } - else if ((msg == CRCInput::RC_up || msg == (unsigned int)g_settings.key_pageup) && !(timerlist.empty())) + else if (!timerlist.empty() && + (msg == CRCInput::RC_up || (int)msg == g_settings.key_pageup || + msg == CRCInput::RC_down || (int)msg == g_settings.key_pagedown)) { - int step = 0; int prev_selected = selected; - - step = (msg == (unsigned int)g_settings.key_pageup) ? listmaxshow : 1; // browse or step 1 - selected -= step; - if((prev_selected-step) < 0) // because of uint - selected = timerlist.size() - 1; - - paintItem(prev_selected - liststart); - unsigned int oldliststart = liststart; - liststart = (selected/listmaxshow)*listmaxshow; - if (oldliststart!=liststart) - { + int oldliststart = liststart; + selected = UpDownKey(timerlist, msg, listmaxshow, selected); + if (selected < 0) /* UpDownKey error */ + selected = prev_selected; + liststart = (selected / listmaxshow) * listmaxshow; + if (oldliststart != liststart) paint(); - } - else - { + else { + paintItem(prev_selected - liststart); paintItem(selected - liststart); } - - paintFoot(); - } - else if ((msg == CRCInput::RC_down || msg == (unsigned int)g_settings.key_pagedown) && !(timerlist.empty())) - { - unsigned int step = 0; - int prev_selected = selected; - - step = (msg == (unsigned int)g_settings.key_pagedown) ? listmaxshow : 1; // browse or step 1 - selected += step; - - if(selected >= timerlist.size()) - { - if (((timerlist.size() / listmaxshow) + 1) * listmaxshow == timerlist.size() + listmaxshow) // last page has full entries - selected = 0; - else - selected = ((step == listmaxshow) && (selected < (((timerlist.size() / listmaxshow) + 1) * listmaxshow))) ? (timerlist.size() - 1) : 0; - } - paintItem(prev_selected - liststart); - - unsigned int oldliststart = liststart; - liststart = (selected/listmaxshow)*listmaxshow; - if (oldliststart!=liststart) - { - paint(); - } - else - { - paintItem(selected - liststart); - } - paintFoot(); } else if ((msg == CRCInput::RC_right || msg == CRCInput::RC_ok || msg==CRCInput::RC_blue) && !(timerlist.empty())) @@ -719,7 +683,7 @@ void CTimerList::paintItem(int pos) //selected item frameBuffer->paintBoxRel(x,ypos, real_width, 2*fheight, bgcolor, RADIUS_MID); - if (liststart+pos #include +#include #include @@ -43,7 +44,7 @@ class CTimerdClient; -class CTimerList : public CMenuTarget +class CTimerList : public CMenuTarget, public CListHelpers { private: CFrameBuffer *frameBuffer; @@ -54,8 +55,8 @@ class CTimerList : public CMenuTarget int fheight; // fontheight content int theight; // fontheight titel int footerHeight; - unsigned int selected; - unsigned int liststart; + int selected; + int liststart; unsigned int listmaxshow; bool visible; diff --git a/src/gui/widget/listhelpers.cpp b/src/gui/widget/listhelpers.cpp index 1249cc503..9d3adf3ab 100644 --- a/src/gui/widget/listhelpers.cpp +++ b/src/gui/widget/listhelpers.cpp @@ -24,6 +24,7 @@ #include #include #include +#include static int upDownKey(int size, neutrino_msg_t msg, int lines, int sel) { @@ -83,3 +84,4 @@ updown_t(std::vector); updown_t(std::vector); updown_t(std::vector); updown_t(std::vector); +updown_t(std::vector); From cfeaf6fc6d40427105af2e1ba0f9262c3f0fa8dd Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 16 Jan 2016 18:30:32 +0100 Subject: [PATCH 09/33] listbox: use CListHelpers --- src/gui/widget/listbox.cpp | 32 ++++++-------------------------- src/gui/widget/listbox.h | 3 ++- 2 files changed, 8 insertions(+), 27 deletions(-) diff --git a/src/gui/widget/listbox.cpp b/src/gui/widget/listbox.cpp index e05c02943..74f63bf65 100644 --- a/src/gui/widget/listbox.cpp +++ b/src/gui/widget/listbox.cpp @@ -188,33 +188,13 @@ int CListBox::exec(CMenuTarget* parent, const std::string & /*actionKey*/) { loop = false; } - else if (msg == CRCInput::RC_up || (int) msg == g_settings.key_pageup) + else if (msg == CRCInput::RC_up || (int) msg == g_settings.key_pageup || + msg == CRCInput::RC_down || (int) msg == g_settings.key_pagedown) { - if(getItemCount()!=0) { - int step = (msg == (neutrino_msg_t)g_settings.key_pageup) ? listmaxshow : 1; // browse or step 1 - int new_selected = selected - step; - - if (new_selected < 0) { - if (selected != 0 && step != 1) - new_selected = 0; - else - new_selected = getItemCount() - 1; - } - updateSelection(new_selected); - } - } - else if (msg == CRCInput::RC_down || (int) msg == g_settings.key_pagedown) - { - if(getItemCount()!=0) { - int step = ((int) msg == g_settings.key_pagedown) ? listmaxshow : 1; // browse or step 1 - int new_selected = selected + step; - if (new_selected > (int) getItemCount() - 1) { - if ((selected != getItemCount() - 1)) - new_selected = getItemCount() - 1; - else - new_selected = 0; - } - updateSelection(new_selected); + if (getItemCount() != 0) { + int new_selected = UpDownKey((int)getItemCount(), msg, listmaxshow, selected); + if (new_selected >= 0) + updateSelection(new_selected); } } else if (msg == (neutrino_msg_t) g_settings.key_list_start || msg == (neutrino_msg_t) g_settings.key_list_end) { diff --git a/src/gui/widget/listbox.h b/src/gui/widget/listbox.h index ce52081e0..26a27f8e6 100644 --- a/src/gui/widget/listbox.h +++ b/src/gui/widget/listbox.h @@ -26,12 +26,13 @@ #define __listbox__ #include "menue.h" +#include "listhelpers.h" #include #include -class CListBox : public CMenuTarget +class CListBox : public CMenuTarget, public CListHelpers { protected: CFrameBuffer* frameBuffer; From 2c64d2fb2b4e47b095b46b80337599af1df82bcc Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Mon, 18 Jan 2016 08:10:23 +0100 Subject: [PATCH 10/33] Revert "rcinput/neutrino: avoid the use of EVT_TIMESET" This reverts commit b307b78bf8259f0cac0694e1da95196e878d0c73. In some cases keys are don't used immediately: --- 0 key: 0074 value 0, translate: 0074 -standby- 1 key: 0074 value 1, translate: 0074 -standby- 0 key: 0074 value 0, translate: 0074 -standby- 1 key: 0074 value 1, translate: 0074 -standby- CVFD::ShowText: [14:14] 0 key: 0074 value 0, translate: 0074 -standby- 1 key: 0074 value 1, translate: 0074 -standby- 0 key: 0074 value 0, translate: 0074 -standby- 1 key: 0074 value 1, translate: 0074 -standby- 0 key: 0074 value 0, translate: 0074 -standby- 1 key: 0074 value 1, translate: 0074 -standby- 0 key: 0074 value 0, translate: 0074 -standby- 1 key: 0074 value 1, translate: 0074 -standby- 0 key: 0074 value 0, translate: 0074 -standby- 1 key: 0074 value 1, translate: 0074 -standby- 0 key: 0074 value 0, translate: 0074 -standby- 1 key: 0074 value 1, translate: 0074 -standby- 0 key: 0074 value 0, translate: 0074 -standby- 1 key: 0074 value 1, translate: 0074 -standby- 0 key: 0074 value 0, translate: 0074 -standby- 1 key: 0074 value 1, translate: 0074 -standby- 0 key: 0074 value 0, translate: 0074 -standby- 1 key: 0074 value 1, translate: 0074 -standby- 0 key: 0074 value 0, translate: 0074 -standby- 1 key: 0074 value 1, translate: 0074 -standby- 0 key: 0074 value 0, translate: 0074 -standby- 1 key: 0074 value 1, translate: 0074 -standby- 0 key: 0074 value 0, translate: 0074 -standby- 2 key: 0074 value 2, translate: 0074 -standby- 0 key: 0074 value 0, translate: 0074 -standby- 1 key: 0074 value 1, translate: 0074 -standby- 0 key: 0074 value 0, translate: 0074 -standby- [/.../cst-next/src/neutrino.cpp:standbyMode:3615] OFF CSAPI (POWER-CLK): new CPU frequency: 600000000Hz CSAPI (VIDEO): Standby 1 -> 0 CSAPI (HDMI-CEC): Power Status: STANDBY -> ON CSAPI (HDMI-CEC): Device free (Logical Address: 03) CSAPI (HDMI-CEC): Power Status: ON --- --- src/driver/rcinput.cpp | 25 ++++--------------------- src/neutrino.cpp | 8 ++------ 2 files changed, 6 insertions(+), 27 deletions(-) diff --git a/src/driver/rcinput.cpp b/src/driver/rcinput.cpp index e8346e09e..c11368e01 100644 --- a/src/driver/rcinput.cpp +++ b/src/driver/rcinput.cpp @@ -4,7 +4,7 @@ Copyright (C) 2001 Steffen Hehn 'McClean' 2003 thegoodguy - Copyright (C) 2008-2014,2016 Stefan Seyfried + Copyright (C) 2008-2012 Stefan Seyfried Copyright (C) 2013-2014 martii License: GPL @@ -519,6 +519,7 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 //static __u16 rc_last_key = KEY_MAX; static __u16 rc_last_repeat_key = KEY_MAX; + struct timeval tv; struct timeval tvselect; uint64_t InitialTimeout = Timeout; int64_t targetTimeout; @@ -1201,7 +1202,6 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 for (int i = 0; i < NUMBER_OF_EVENT_DEVICES; i++) { if ((fd_rc[i] != -1) && (FD_ISSET(fd_rc[i], &rfds))) { - uint64_t now_pressed = 0; t_input_event ev; int ret = read(fd_rc[i], &ev, sizeof(t_input_event)); if (ret != sizeof(t_input_event)) { @@ -1214,22 +1214,6 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 } if (ev.type == EV_SYN) continue; /* ignore... */ - if (ev.value) { - /* try to compensate for possible changes in wall clock - * kernel ev.time default uses CLOCK_REALTIME, as does gettimeofday(). - * so subtract gettimeofday() from ev.time and then add - * CLOCK_MONOTONIC, which is supposed to not change with settimeofday. - * Everything would be much easier if we could use the post-kernel 3.4 - * EVIOCSCLOCKID ioctl :-) */ - struct timespec t1; - now_pressed = ev.time.tv_usec + ev.time.tv_sec * 1000000ULL; - if (!clock_gettime(CLOCK_MONOTONIC, &t1)) { - struct timeval t2; - gettimeofday(&t2, NULL); - now_pressed += t1.tv_sec * 1000000ULL + t1.tv_nsec / 1000; - now_pressed -= (t2.tv_usec + t2.tv_sec * 1000000ULL); - } - } SHTDCNT::getInstance()->resetSleepTimer(); if (ev.value && firstKey) { firstKey = false; @@ -1276,12 +1260,11 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 #ifdef RCDEBUG printf("rc_last_key %04x rc_last_repeat_key %04x\n\n", rc_last_key, rc_last_repeat_key); #endif - bool keyok = true; -#if 0 uint64_t now_pressed; + bool keyok = true; + tv = ev.time; now_pressed = (uint64_t) tv.tv_usec + (uint64_t)((uint64_t) tv.tv_sec * (uint64_t) 1000000); -#endif if (trkey == rc_last_key) { /* only allow selected keys to be repeated */ if (mayRepeat(trkey, bAllowRepeatLR) || diff --git a/src/neutrino.cpp b/src/neutrino.cpp index c2d208e18..9c5bd6fa8 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -5,7 +5,7 @@ and some other guys Homepage: http://dbox.cyberphoria.org/ - Copyright (C) 2006-2016 Stefan Seyfried + Copyright (C) 2006-2014 Stefan Seyfried Copyright (C) 2011 CoolStream International Ltd @@ -1840,11 +1840,7 @@ void CNeutrinoApp::InitZapitClient() void CNeutrinoApp::InitSectiondClient() { g_Sectionsd = new CSectionsdClient; - struct timespec t; - if (clock_gettime(CLOCK_MONOTONIC, &t)) { - dprintf(DEBUG_NORMAL, "CLOCK_MONOTONIC not supported? (%m), falling back to EVT_TIMESET\n"); - g_Sectionsd->registerEvent(CSectionsdClient::EVT_TIMESET, 222, NEUTRINO_UDS_NAME); - } + g_Sectionsd->registerEvent(CSectionsdClient::EVT_TIMESET, 222, NEUTRINO_UDS_NAME); g_Sectionsd->registerEvent(CSectionsdClient::EVT_GOT_CN_EPG, 222, NEUTRINO_UDS_NAME); g_Sectionsd->registerEvent(CSectionsdClient::EVT_EIT_COMPLETE, 222, NEUTRINO_UDS_NAME); g_Sectionsd->registerEvent(CSectionsdClient::EVT_WRITE_SI_FINISHED, 222, NEUTRINO_UDS_NAME); From 299852d3886276d04a775aa2d93a009b8dce6dfa Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Mon, 18 Jan 2016 13:43:46 +0100 Subject: [PATCH 11/33] - listhelpers: satisfy -Werror --- src/gui/widget/listhelpers.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/widget/listhelpers.cpp b/src/gui/widget/listhelpers.cpp index 9d3adf3ab..45af70358 100644 --- a/src/gui/widget/listhelpers.cpp +++ b/src/gui/widget/listhelpers.cpp @@ -33,7 +33,7 @@ static int upDownKey(int size, neutrino_msg_t msg, int lines, int sel) return -1; if (msg >= CRCInput::RC_MaxRC) { - printf("CListHelpers:%s: invalid key? 0x%lx\n", __func__, msg); + printf("CListHelpers:%s: invalid key? 0x%X\n", __func__, msg); return -1; } int key = (int)msg; @@ -46,7 +46,7 @@ static int upDownKey(int size, neutrino_msg_t msg, int lines, int sel) else if (msg == CRCInput::RC_down) step = 1; else { - printf("CListHelpers:%s: invalid key? 0x%lx\n", __func__, msg); + printf("CListHelpers:%s: invalid key? 0x%X\n", __func__, msg); return -1; } // printf("CListHelpers:%s: key 0x%04lx lines %d size %d sel %d\n", __func__, msg, lines, size, sel); From 96d7401e082c6af5d9e8ffc1deada3fd0be1017d Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Fri, 1 Jan 2016 14:14:55 +0100 Subject: [PATCH 12/33] edit lua_api_version.h instead of autogenerating it This will help those who do not use ccache :-) --- src/gui/lua/Makefile.am | 15 --------------- src/gui/lua/lua_api_version.h | 7 +++++++ src/gui/lua/luainstance.h | 5 ----- 3 files changed, 7 insertions(+), 20 deletions(-) create mode 100644 src/gui/lua/lua_api_version.h diff --git a/src/gui/lua/Makefile.am b/src/gui/lua/Makefile.am index eab73c11d..4cf5c50aa 100644 --- a/src/gui/lua/Makefile.am +++ b/src/gui/lua/Makefile.am @@ -40,18 +40,3 @@ libneutrino_gui_lua_a_SOURCES = \ lua_threads_functions.cpp \ lua_video.cpp -# the continuous changes of LUA_API_VERSION_* in luainstance.h -# are not only of questionable usefulness, but they also cause -# rebuilds all over the place, even though it is only used in -# 2(!) source files. So split out those two definitions into an -# autogenerated separate file, they are #if 0'ed in luainstance.h -# already and the rest is dealt with via ccache... -BUILT_SOURCES = lua_api_version.h -lua_api_version.h: luainstance.h - @rm -f $@ - grep '^#define.*LUA_API' $(srcdir)/luainstance.h > $@ - -noinst_HEADERS = lua_api_version.h - -# so that lua_api_version.h can be found... -AM_CPPFLAGS += -I$(builddir) diff --git a/src/gui/lua/lua_api_version.h b/src/gui/lua/lua_api_version.h new file mode 100644 index 000000000..c5a53aad9 --- /dev/null +++ b/src/gui/lua/lua_api_version.h @@ -0,0 +1,7 @@ +/* + * this is only used in two code files, so put it into its own + * header to reduce complete neutrino rebuilding all the time due + * to luainstance.h changes + */ +#define LUA_API_VERSION_MAJOR 1 +#define LUA_API_VERSION_MINOR 37 diff --git a/src/gui/lua/luainstance.h b/src/gui/lua/luainstance.h index 6e803e69a..69311a9b9 100644 --- a/src/gui/lua/luainstance.h +++ b/src/gui/lua/luainstance.h @@ -30,11 +30,6 @@ extern "C" { #include "luainstance_helpers.h" -#if 0 -#define LUA_API_VERSION_MAJOR 1 -#define LUA_API_VERSION_MINOR 37 -#endif - void LuaInstRegisterFunctions(lua_State *L, bool fromThreads=false); /* inspired by Steve Kemp http://www.steve.org.uk/ */ From 0c67739074fed6b5c5bad1bce8bf20c389add5f6 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 19 Jan 2016 11:16:43 +0100 Subject: [PATCH 13/33] CComponentsPicture: fix missing dimension values on wrong image location In some constellations we can't get dimensions from getIconSize(), so it is useful to fall back to g_PicViewer->getSize(). Cache cleanup removed, can be done at runtime if required. --- src/gui/components/cc_item_picture.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/gui/components/cc_item_picture.cpp b/src/gui/components/cc_item_picture.cpp index 780add16d..c5ede3520 100644 --- a/src/gui/components/cc_item_picture.cpp +++ b/src/gui/components/cc_item_picture.cpp @@ -152,6 +152,18 @@ void CComponentsPicture::initCCItem() if (!do_scale){ //use image/icon size as object dimension values frameBuffer->getIconSize(pic_name.c_str(), &width, &height); + + /*if we have an image with full path => fallback to pv methode. + * That's always a cramp, why we don't have an unified solution in render classes? + */ + if (width == 0 || height == 0){ + int dx_tmp, dy_tmp; + g_PicViewer->getSize(pic_name.c_str(), &dx_tmp, &dy_tmp); + if (width == 0) + width = dx_tmp; + if (height == 0) + height = dy_tmp; + } return; } else{ //initialized scaled size @@ -169,10 +181,10 @@ void CComponentsPicture::initCCItem() //check dimensions, leave if dimensions are equal if (width == dx && height == dy) return; - +#if 0 //clean up possible cache on changed dimensions clearCache(); - +#endif //temporarily vars int w_2scale = width; int h_2scale = height; @@ -294,7 +306,6 @@ bool CComponentsPicture::hasChanges() return ret; } - CComponentsChannelLogo::CComponentsChannelLogo( const int &x_pos, const int &y_pos, const int &w, const int &h, const std::string& channelName, const uint64_t& channelId, From 7783ee684ff05a13e9dac9ffed4adc6595293c23 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 19 Jan 2016 11:11:34 +0100 Subject: [PATCH 14/33] CMovieBrowser:try to fix cover position and ratio for custom covers TODO: 4:3 screenshot are still broken Signed-off-by: M. Liebmann --- src/gui/moviebrowser.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/moviebrowser.cpp b/src/gui/moviebrowser.cpp index cfab1806f..29b4667bc 100644 --- a/src/gui/moviebrowser.cpp +++ b/src/gui/moviebrowser.cpp @@ -1401,13 +1401,15 @@ void CMovieBrowser::refreshMovieInfo(void) lx = m_cBoxFrameInfo.iX+m_cBoxFrameInfo.iWidth - flogo_w -14; ly = m_cBoxFrameInfo.iY - 1 + (m_cBoxFrameInfo.iHeight-flogo_h)/2; if (pic == NULL){ //TODO: paint custom covers with different ratio, currently only works with default ratio 16/9 or 4/3 - pic = new CComponentsPicture(lx+2, ly+1, flogo_w, flogo_h, fname, NULL, CC_SHADOW_OFF, COL_MENUCONTENTSELECTED_PLUS_0); + pic = new CComponentsPicture(lx+2, ly+1, fname, NULL, CC_SHADOW_OFF, COL_MENUCONTENTSELECTED_PLUS_0); + pic->setHeight(flogo_h, true); /*flogo_w*/ pic->enableFrame(true, 2); pic->enableCache(); pic->doPaintBg(false); }else pic->setPicture(fname); - + flogo_w = pic->getWidth(); + pic->setXPos(m_cBoxFrameInfo.iX+m_cBoxFrameInfo.iWidth - flogo_w -12); if (!m_movieSelectionHandler->epgInfo2.empty()) m_pcInfo->OnAfterScrollPage.connect(sigc::mem_fun(pic, &CComponentsPicture::paint0)); }else{ From 2eb0aed5db3f2b516dda92481740755dc1018db9 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Wed, 20 Jan 2016 20:00:00 +0100 Subject: [PATCH 15/33] - rc_lock: rework class; switch to singleton; add icon; vfd-support --- data/icons/Makefile.am | 1 + data/icons/rclock.png | Bin 0 -> 2300 bytes data/locale/deutsch.locale | 6 +- data/locale/english.locale | 8 +-- src/driver/vfd.cpp | 12 +++- src/gui/rc_lock.cpp | 104 +++++++++++++++++++--------- src/gui/rc_lock.h | 29 ++++---- src/gui/user_menue.cpp | 2 +- src/gui/user_menue_setup.cpp | 2 +- src/gui/widget/icons.h | 1 + src/neutrino.cpp | 3 +- src/nhttpd/tuxboxapi/controlapi.cpp | 7 +- src/system/locals.h | 2 +- src/system/locals_intern.h | 2 +- 14 files changed, 115 insertions(+), 64 deletions(-) create mode 100644 data/icons/rclock.png diff --git a/data/icons/Makefile.am b/data/icons/Makefile.am index 3224dad8e..8e519e47d 100644 --- a/data/icons/Makefile.am +++ b/data/icons/Makefile.am @@ -212,6 +212,7 @@ install_DATA += \ radiotextget.png \ radiotextoff.png \ radiotextwait.png \ + rclock.png \ rec.png \ rec_event_marker.png \ rec_gray.png \ diff --git a/data/icons/rclock.png b/data/icons/rclock.png new file mode 100644 index 0000000000000000000000000000000000000000..1736df521067e710a3f447d7249eaa500c488706 GIT binary patch literal 2300 zcmV z-bqBiB%+@?{;bwoPbsCyMxyxr4@#*Eu~=;KwF4j?j~^wX4~XbETUc#kofRykl!-#2 z@QZI82lfVmE-}Cr+IB$E{npo^N{qE?&IY zEQI(YfNv8Kh=?2@5D}%Mlpp2u`9Cc!E&X|RcJ^8-mHJdlxojB5ZX)uOh652rgb;5P z3WZN5Cns|bPjJm6bhj7@A$|tnUE6}J0P)9_{XM`R3+kqphti zAcU|(0YV5NrEFVVTwI!-o=yXh01Eux9sry^eYy|8PuTTsPgY8)zr|v)p8^O0Xb12O z0KNR|2ha)ND*&1RG~B;`ztGv)>1}Rq_BeRK=kqlrlS%)B2M;m;1b{qyL1C*P2p6p1 zqLliMt+*rM%|Cwp_&oqY0384h0yqKSIDl^g_!@v_06u1A0?1vyeEFGanwHI9N(mxD zTU*=P;c)mQ|Na028ssphy5#^OiU2s|+*WxTyL{oog$xVY%~n6aV1yX_WdIofi*{@; zEiGYqc-V+Wqi=F<0RTiIk;YIcv~OWyfmm)k6sDMmRj(u%W>BhRAIXuortY-(!K{eFJ~fZeQomVryN_f(V<+yKDuaN`xa za^=bxEBti;Z#gWl0L%k;1YiWf7=Wh?Kn?&VCMNy`px@zT&~=?W9uGM}YKZ}~cLs|+ zqUHdUO{Bxa!(JA&%b`5jYLfu|3E)!z6RbqmcH?9+SynDx*X<-2a`1k_Kx8Y~8eOXc zoV7mh{kzx$+BpA-Lqna+b|@WoQ`2bLOF#XA6J`ujOSKs9qjWE;%-{ z#dO}g=NW)UZ28<~+}7*$K4)HGeusFCumb?p%L7U&$O8I!odN?e!!e)PY|Q$6zB%Sm zV4gl+Bfudh>H&bsF<(jsKN?%c;#gncti7o!j&s7IBiRx2HrV=FB_2?52*l&@{Y13i zQ3bw4=gysbXKrq;JDbh6N-4dXrs=_8a9<=6d8ebJqpP8zA+78BS_!LArr^TCg9oFg zY5K>;#*C*=pV|i0S$RHO?(+5P z*QWv82kgTDvxJ`wp#+|%tz6O{=8XqqP4+uH-Jt*!n*AW*n= z?b_Db_)S{=TL6AcM1JK6{53~CZtk&;HKdd<41h=UyLWH7udgrM z)zxKel|3gvKX-^791af|gf+uJ)Y1bIiA2U$9ss7MrV5EfBC{0_C@GvY?hC>k3W4>u zMN!MdWt!$Inl3LdD;IOB4T6V5LSIkEngPJgj4u!ftgIOf2F2mShkY)2K&f6E>JDof z0!NP?^`AX^wowQHAq38xIn&tN+v|55>&^5eH4Oo!6ncAm{hFqcrfC$7M*UJs)RXjD zhCrEiccrecTVGMnYIZyH6M8)sl~SrT<_KR703wlyPDE-ubd_}hU|?XNwF+C`>jQwU z>)T_XP-zlW+rWHoiJ(`a_;#8H)Y=2)vCSxx$;g@kKt#8QD7zgLS4zP&O*K9~Zq^I{ zA;gDDsS%C@RqyyuCXeE=r`youH0@Ot$ZSrqRd{2jn`0RKVpK9N<8W=NtqeNAKaFruC{ zf_-%^%Q7uvo!etu1)zZ9S^o#e<13Rxd75jod$j z;(_QF4912oPP!!=VRaO3u;S~^h literal 0 HcmV?d00001 diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index e29d389fb..b1c7d40fd 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -1991,10 +1991,10 @@ plugintype.game Spiel plugintype.lua Lua-Plugin plugintype.script Skript plugintype.tool Werkzeug -rclock.lockmsg Die Fernbedienung der CST wird gesperrt.\n Um die Sperre aufzuheben, bitte\n und auf der Fernbedienung\n drücken. -rclock.menueadd FB sperren +rclock.locked Gesperrt +rclock.lockmsg Die Fernbedienung wird gesperrt.\nUm die Sperre aufzuheben, bitte\n[rot] gefolgt von [%s]\nauf der Fernbedienung drücken. rclock.title Fernbedienung sperren -rclock.unlockmsg Fernbedienung reaktiviert... +rclock.unlockmsg Fernbedienung reaktiviert recording.is_running Folgende Aufnahme läuft bereits! Neue Aufnahme starten? recording.start Starte Aufnahme, bitte warten...! recording.startstop_msg Meldung bei Aufnahme Start/Ende diff --git a/data/locale/english.locale b/data/locale/english.locale index 0347295a8..68e9acdf9 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -1991,10 +1991,10 @@ plugintype.game Game plugintype.lua Lua plugin plugintype.script Script plugintype.tool Tool -rclock.lockmsg Your box remote control will be locked.\n To unlock it, press \n and on your remote control. -rclock.menueadd Lock RC -rclock.title Lock Remote Control -rclock.unlockmsg Remote control reactivated. +rclock.locked Locked +rclock.lockmsg Remote control will be locked.\nTo unlock, press\n[red] followed by [%s]\non your remote control. +rclock.title Lock remote control +rclock.unlockmsg Remote control unlocked recording.is_running This channel already recording. Start new record? recording.start Start recording, please wait...! recording.startstop_msg Message when recording is start/stop diff --git a/src/driver/vfd.cpp b/src/driver/vfd.cpp index 0aa325bd9..0490201ae 100644 --- a/src/driver/vfd.cpp +++ b/src/driver/vfd.cpp @@ -404,8 +404,18 @@ void CVFD::showTime(bool force) recstatus = tmp_recstatus; } -void CVFD::showRCLock(int /*duration*/) +void CVFD::showRCLock(int duration) { + if (!has_lcd) + { + sleep(duration); + return; + } + + std::string _text = text; + ShowText(g_Locale->getText(LOCALE_RCLOCK_LOCKED)); + sleep(duration); + ShowText(_text.c_str()); } void CVFD::showVolume(const char vol, const bool force_update) diff --git a/src/gui/rc_lock.cpp b/src/gui/rc_lock.cpp index 48d01bb41..354a89caa 100644 --- a/src/gui/rc_lock.cpp +++ b/src/gui/rc_lock.cpp @@ -1,11 +1,8 @@ /* Neutrino-GUI - DBoxII-Project - Diese GUI wurde von Grund auf neu programmiert und sollte nun vom - Aufbau und auch den Ausbaumoeglichkeiten gut aussehen. Neutrino basiert - auf der Client-Server Idee, diese GUI ist also von der direkten DBox- - Steuerung getrennt. Diese wird dann von Daemons uebernommen. - + Copyright (C) 2001 Steffen Hehn 'McClean' + Copyright (C) 2015 Sven Hoefer (svenhoefer) License: GPL @@ -34,41 +31,63 @@ #include #include -#include #include -#include -const std::string CRCLock::NO_USER_INPUT = "noUserInput"; -bool CRCLock::locked = false; +const std::string CRCLock::NO_USER_INPUT = "NO_USER_INPUT"; -// -- Menue Handler Interface -// -- Infinite Loop to lock remote control (until release lock key pressed) -// -- 2003-12-01 rasc +CRCLock::CRCLock() +{ + locked = false; + lockIcon = NULL; +} + +CRCLock::~CRCLock() +{ + if (lockIcon) + { + delete lockIcon; + lockIcon = NULL; + } +} + +CRCLock* CRCLock::getInstance() +{ + static CRCLock* me = NULL; + if (!me) + me = new CRCLock(); + return me; +} int CRCLock::exec(CMenuTarget* parent, const std::string &actionKey) { - if(locked) + if (locked) + { + printf("CRCLock::%s: already locked; exiting\n", __func__); return menu_return::RETURN_EXIT_ALL; + } if (parent) parent->hide(); bool no_input = (actionKey == NO_USER_INPUT); - if (ShowMsg(LOCALE_RCLOCK_TITLE, LOCALE_RCLOCK_LOCKMSG, - CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbCancel, - NEUTRINO_ICON_INFO,450,no_input ? 5 : -1,no_input) == CMessageBox::mbrCancel) + std::string key_unlock = CRCInput::getKeyName((neutrino_msg_t) g_settings.key_unlock); + char lock_msg[1024]; + snprintf(lock_msg, sizeof(lock_msg)-1, g_Locale->getText(LOCALE_RCLOCK_LOCKMSG), key_unlock.c_str()); + + if (ShowMsg(LOCALE_RCLOCK_TITLE, lock_msg, CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbCancel, + NEUTRINO_ICON_INFO, 450, no_input ? 5 : -1, no_input) == CMessageBox::mbrCancel) return menu_return::RETURN_EXIT_ALL; - // -- Lockup Box locked = true; - lockBox(); + lockRC(); locked = false; - ShowMsg(LOCALE_RCLOCK_TITLE, LOCALE_RCLOCK_UNLOCKMSG, CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_INFO,450, no_input ? 5 : -1); + ShowMsg(LOCALE_RCLOCK_TITLE, LOCALE_RCLOCK_UNLOCKMSG, CMessageBox::mbrBack, CMessageBox::mbBack, + NEUTRINO_ICON_INFO, 450, no_input ? 5 : -1); return menu_return::RETURN_EXIT_ALL; } -void CRCLock::lockBox() +void CRCLock::lockRC() { neutrino_msg_t msg; neutrino_msg_data_t data; @@ -76,36 +95,53 @@ void CRCLock::lockBox() uint64_t timeoutEnd; // -- Loop until release key pressed - // -- Key sequence: within 5 secs - while (1) { - + // -- Release key sequence: [red] [g_settings.key_unlock] within 5 secs + printf("CRCLock::%s: locking remote control\n", __func__); + while (1) + { timeoutEnd = CRCInput::calcTimeoutEnd(9999999); g_RCInput->getMsgAbsoluteTimeout(&msg, &data, &timeoutEnd); if (msg == NeutrinoMessages::UNLOCK_RC) break; - if (msg == CRCInput::RC_red) { + if (msg == CRCInput::RC_red) + { timeoutEnd = CRCInput::calcTimeoutEnd(5); g_RCInput->getMsgAbsoluteTimeout(&msg, &data, &timeoutEnd); - //if (msg == CRCInput::RC_setup) break; - if (msg == (neutrino_msg_t) g_settings.key_unlock) break; + if (msg == (neutrino_msg_t) g_settings.key_unlock) + break; } - if (msg == CRCInput::RC_timeout) continue; + if (msg == CRCInput::RC_timeout) + continue; - // -- Zwen told me: Eating only RC events would be nice - // -- so be it... - - if (msg > CRCInput::RC_MaxRC) { + if (msg > CRCInput::RC_MaxRC) + { CNeutrinoApp::getInstance()->handleMsg(msg, data); - } else { + } + else + { + if (lockIcon == NULL) + { + lockIcon = new CComponentsPicture( + g_settings.screen_StartX + 10, + g_settings.screen_StartY + 10, + NEUTRINO_ICON_RCLOCK); + lockIcon->doPaintBg(false); + } + lockIcon->paint(CC_SAVE_SCREEN_YES); + CVFD::getInstance()->showRCLock(); - // Since showRCLock blocks 2secs for each key we eat all - // messages created during this time. Hopefully this ok... + // showRCLock blocks box for 2 seconds, + // so we eat all messages created during this time. g_RCInput->clearRCMsg(); + + lockIcon->hide(); } } + printf("CRCLock::%s: unlocking remote control\n", __func__); + return; } diff --git a/src/gui/rc_lock.h b/src/gui/rc_lock.h index bd32757d0..e75152e75 100644 --- a/src/gui/rc_lock.h +++ b/src/gui/rc_lock.h @@ -1,7 +1,8 @@ /* Neutrino-GUI - DBoxII-Project - + Copyright (C) 2001 Steffen Hehn 'McClean' + Copyright (C) 2015 Sven Hoefer (svenhoefer) License: GPL @@ -21,28 +22,30 @@ */ -#ifndef _remoteLock_ -#define _remoteLock_ +#ifndef _rc_lock_ +#define _rc_lock_ #include #include - -// -// -- Implements RemoteControl Locking... -// -- ... usefull, if you want to protect your box against unintented zapping -// -- 2003-12-01 rasc -// class CRCLock: public CMenuTarget { private: - void lockBox(); + bool locked; + CComponentsPicture *lockIcon; + + void lockRC(); public: - static const std::string NO_USER_INPUT; - int exec(CMenuTarget* parent, const std::string & actionKey); - static bool locked; + CRCLock(); + ~CRCLock(); + static CRCLock* getInstance(); + + static const std::string NO_USER_INPUT; + + int isLocked() { return locked; } + int exec(CMenuTarget* parent, const std::string & actionKey); }; #endif diff --git a/src/gui/user_menue.cpp b/src/gui/user_menue.cpp index b5a42917d..f156051d6 100644 --- a/src/gui/user_menue.cpp +++ b/src/gui/user_menue.cpp @@ -224,7 +224,7 @@ bool CUserMenu::showUserMenu(neutrino_msg_t msg) break; case SNeutrinoSettings::ITEM_REMOTE: keyhelper.get(&key,&icon,feat_key[g_settings.personalize[SNeutrinoSettings::P_FEAT_KEY_RC_LOCK]].key); //CRCInput::RC_nokey); - menu_item = new CMenuDForwarder(LOCALE_RCLOCK_MENUEADD, true, NULL, new CRCLock, "-1" , key, icon ); + menu_item = new CMenuForwarder(LOCALE_RCLOCK_TITLE, true, NULL, CRCLock::getInstance(), "-1" , key, icon ); // FIXME menu_item->setHint("", NONEXISTANT_LOCALE); break; case SNeutrinoSettings::ITEM_EPG_SUPER: diff --git a/src/gui/user_menue_setup.cpp b/src/gui/user_menue_setup.cpp index b21ca131c..249bcbc76 100644 --- a/src/gui/user_menue_setup.cpp +++ b/src/gui/user_menue_setup.cpp @@ -86,7 +86,7 @@ static keyvals usermenu_items[] = { SNeutrinoSettings::ITEM_INETPLAY, LOCALE_INETRADIO_NAME, usermenu_show }, { SNeutrinoSettings::ITEM_MOVIEPLAYER_MB, LOCALE_MOVIEBROWSER_HEAD, usermenu_show }, { SNeutrinoSettings::ITEM_TIMERLIST, LOCALE_TIMERLIST_NAME, usermenu_show }, - { SNeutrinoSettings::ITEM_REMOTE, LOCALE_RCLOCK_MENUEADD, usermenu_show }, + { SNeutrinoSettings::ITEM_REMOTE, LOCALE_RCLOCK_TITLE, usermenu_show }, { SNeutrinoSettings::ITEM_FAVORITS, LOCALE_FAVORITES_MENUEADD, usermenu_show }, { SNeutrinoSettings::ITEM_TECHINFO, LOCALE_EPGMENU_STREAMINFO, usermenu_show }, { SNeutrinoSettings::ITEM_PLUGIN_TYPES, LOCALE_USERMENU_ITEM_PLUGIN_TYPES, usermenu_show }, diff --git a/src/gui/widget/icons.h b/src/gui/widget/icons.h index 60e2cf912..2b5264475 100644 --- a/src/gui/widget/icons.h +++ b/src/gui/widget/icons.h @@ -158,6 +158,7 @@ #define NEUTRINO_ICON_NETWORK "network" #define NEUTRINO_ICON_LCD "lcd" #define NEUTRINO_ICON_VOLUME "volume" +#define NEUTRINO_ICON_RCLOCK "rclock" #define NEUTRINO_ICON_RESOLUTION_1920 "res_1920" #define NEUTRINO_ICON_RESOLUTION_1080 "res_1080" #define NEUTRINO_ICON_RESOLUTION_1440 "res_1440" diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 9c5bd6fa8..eb3e865f8 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -3237,8 +3237,7 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) } else if (msg == NeutrinoMessages::LOCK_RC) { - CRCLock rcLock; - rcLock.exec(NULL,CRCLock::NO_USER_INPUT); + CRCLock::getInstance()->exec(NULL, CRCLock::NO_USER_INPUT); return messages_return::handled; } else if( msg == NeutrinoMessages::CHANGEMODE ) { diff --git a/src/nhttpd/tuxboxapi/controlapi.cpp b/src/nhttpd/tuxboxapi/controlapi.cpp index 90a6d2735..e61f19c61 100644 --- a/src/nhttpd/tuxboxapi/controlapi.cpp +++ b/src/nhttpd/tuxboxapi/controlapi.cpp @@ -498,14 +498,15 @@ void CControlAPI::RCCGI(CyhookHandler *hh) { if (!(hh->ParamList.empty())) { + bool locked = CRCLock::getInstance()->isLocked(); + if (hh->ParamList["1"] == "lock"){ // lock remote control - if(!CRCLock::locked) + if (!locked) NeutrinoAPI->EventServer->sendEvent(NeutrinoMessages::LOCK_RC, CEventServer::INITID_HTTPD); } else if (hh->ParamList["1"] == "unlock"){// unlock remote control - if(CRCLock::locked) + if (locked) NeutrinoAPI->EventServer->sendEvent(NeutrinoMessages::UNLOCK_RC, CEventServer::INITID_HTTPD); - } else{ hh->SendError(); diff --git a/src/system/locals.h b/src/system/locals.h index 4a3123646..5fe1c56e8 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -2018,8 +2018,8 @@ typedef enum LOCALE_PLUGINTYPE_LUA, LOCALE_PLUGINTYPE_SCRIPT, LOCALE_PLUGINTYPE_TOOL, + LOCALE_RCLOCK_LOCKED, LOCALE_RCLOCK_LOCKMSG, - LOCALE_RCLOCK_MENUEADD, LOCALE_RCLOCK_TITLE, LOCALE_RCLOCK_UNLOCKMSG, LOCALE_RECORDING_IS_RUNNING, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index a5dd56ea8..33ac965be 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -2018,8 +2018,8 @@ const char * locale_real_names[] = "plugintype.lua", "plugintype.script", "plugintype.tool", + "rclock.locked", "rclock.lockmsg", - "rclock.menueadd", "rclock.title", "rclock.unlockmsg", "recording.is_running", From 7a2b1e26da4c8beee9ed4a97d9e838543179b1a0 Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Wed, 20 Jan 2016 22:03:46 +0100 Subject: [PATCH 16/33] neutrino.cpp: Enable mute icon in channellist when 'Quickzap in list' active or allow Partial revert commit 5eb7f4aea8a7dfc379d953cf17cc6688fcd09af3 --- src/neutrino.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index eb3e865f8..d5f39d074 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -2541,14 +2541,10 @@ int CNeutrinoApp::showChannelList(const neutrino_msg_t _msg, bool from_menu) //_show: if(msg == CRCInput::RC_ok) { - if (g_settings.channellist_new_zap_mode > 0) /* allow or active */ - g_audioMute->enableMuteIcon(false); if( !bouquetList->Bouquets.empty() && bouquetList->Bouquets[old_b]->channelList->getSize() > 0) nNewChannel = bouquetList->Bouquets[old_b]->channelList->exec();//with ZAP! else nNewChannel = bouquetList->exec(true); - if (g_settings.channellist_new_zap_mode > 0) /* allow or active */ - g_audioMute->enableMuteIcon(true); } else if(msg == CRCInput::RC_sat) { SetChannelMode(LIST_MODE_SAT); nNewChannel = bouquetList->exec(true); From 1a290fb0cccd6e38a31c28635469e967a6156aff Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Thu, 21 Jan 2016 08:24:21 +0100 Subject: [PATCH 17/33] - infoviewer_bb: make showIcon_DD() public --- src/gui/infoviewer_bb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/infoviewer_bb.h b/src/gui/infoviewer_bb.h index 4a7944028..1c690a677 100644 --- a/src/gui/infoviewer_bb.h +++ b/src/gui/infoviewer_bb.h @@ -113,7 +113,6 @@ class CInfoViewerBB void showBBIcons(const int modus, const std::string & icon); void getBBIconInfo(void); bool checkBBIcon(const char * const icon, int *w, int *h); - void showIcon_DD(void); void paint_ca_icons(int, const char*, int&); void paintCA_bar(int,int); @@ -143,6 +142,7 @@ class CInfoViewerBB void showIcon_SubT(); void showIcon_Resolution(); void showIcon_Tuner(void); + void showIcon_DD(void); void showBBButtons(const int modus=-1); void paintshowButtonBar(); void getBBButtonInfo(void); From 2694b87d0806d8120562673dd246a89c81694aa9 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Thu, 21 Jan 2016 08:25:18 +0100 Subject: [PATCH 18/33] - infoviewer: fix display of DolbyDigital icon --- src/gui/infoviewer.cpp | 16 ++++++---------- src/gui/infoviewer_bb.cpp | 3 --- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index f28909a5f..f1eeddc74 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -1366,20 +1366,18 @@ int CInfoViewer::handleMsg (const neutrino_msg_t msg, neutrino_msg_data_t data) if (is_visible) showRecordIcon(true); } else if (msg == NeutrinoMessages::EVT_ZAP_GOTAPIDS) { if ((*(t_channel_id *) data) == current_channel_id) { -#if 0 - if (is_visible && showButtonBar) - infoViewerBB->showBBButtons(CInfoViewerBB::BUTTON_GREEN); -#endif + if (is_visible && showButtonBar) { + infoViewerBB->showIcon_DD(); + infoViewerBB->showBBButtons(); // in case button text has changed + } if (g_settings.radiotext_enable && g_Radiotext && !g_RemoteControl->current_PIDs.APIDs.empty() && ((CNeutrinoApp::getInstance()->getMode()) == NeutrinoMessages::mode_radio)) g_Radiotext->setPid(g_RemoteControl->current_PIDs.APIDs[g_RemoteControl->current_PIDs.PIDs.selected_apid].pid); } return messages_return::handled; } else if (msg == NeutrinoMessages::EVT_ZAP_GOT_SUBSERVICES) { if ((*(t_channel_id *) data) == current_channel_id) { -#if 0 if (is_visible && showButtonBar) - infoViewerBB->showBBButtons(CInfoViewerBB::BUTTON_YELLOW); -#endif + infoViewerBB->showBBButtons(); // in case button text has changed } return messages_return::handled; } else if (msg == NeutrinoMessages::EVT_ZAP_SUB_COMPLETE) { @@ -1784,9 +1782,7 @@ void CInfoViewer::show_Data (bool calledFromEvent) frameBuffer->paintBackgroundBoxRel (BoxEndX - 108, posy, 112, height2); } #endif - infoViewerBB->showBBButtons(CInfoViewerBB::BUTTON_RED); - infoViewerBB->showBBButtons(CInfoViewerBB::BUTTON_GREEN); - infoViewerBB->showBBButtons(CInfoViewerBB::BUTTON_YELLOW); + infoViewerBB->showBBButtons(); } if ((info_CurrentNext.flags & CSectionsdClient::epgflags::not_broadcast) || diff --git a/src/gui/infoviewer_bb.cpp b/src/gui/infoviewer_bb.cpp index 33d1f669a..b6c766264 100644 --- a/src/gui/infoviewer_bb.cpp +++ b/src/gui/infoviewer_bb.cpp @@ -439,9 +439,6 @@ void CInfoViewerBB::showBBButtons(const int modus) } } - if (modus == CInfoViewerBB::BUTTON_GREEN) - showIcon_DD(); - for (i = 0; i < CInfoViewerBB::BUTTON_MAX; i++) { tmp_bbButtonInfoText[i] = bbButtonInfo[i].text; } From 695f8459070e961a6ed4460e37ec14fed7e79dcd Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 10 Jan 2016 17:12:02 +0100 Subject: [PATCH 19/33] CComponentsItem: remove clean up from kill() It is not always useful to clean up everything with kill(). For more control in some cases an separate clean up should be better. --- src/gui/components/cc_item.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/components/cc_item.cpp b/src/gui/components/cc_item.cpp index 9c938167c..4f9b242c4 100644 --- a/src/gui/components/cc_item.cpp +++ b/src/gui/components/cc_item.cpp @@ -135,7 +135,6 @@ void CComponentsItem::kill(const fb_pixel_t& bg_color, bool ignore_parent) else CComponents::kill(cc_parent->getColorBody(), cc_parent->getCornerRadius()); } - clearScreenBuffer(); } //synchronize colors for forms From b701c345fb49090917c3f98af0c6fb1e67bbd84a Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 21 Jan 2016 10:24:58 +0100 Subject: [PATCH 20/33] CCDraw: remove clean up after restored screen It seems not always useful to clean up everything after hide(). For more control in some cases an separate clean up with clearSavedScreen() should be more flexible. --- src/gui/components/cc_draw.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/gui/components/cc_draw.cpp b/src/gui/components/cc_draw.cpp index a43e0e461..0b2a4456e 100644 --- a/src/gui/components/cc_draw.cpp +++ b/src/gui/components/cc_draw.cpp @@ -620,8 +620,6 @@ void CCDraw::paintFbItems(bool do_save_bg) void CCDraw::hide() { - bool restored = false; - //restore saved screen background of item if available for(size_t i =0; i< v_fbdata.size() ;i++) { if (v_fbdata[i].fbdata_type == CC_FBDATA_TYPE_BGSCREEN){ @@ -629,14 +627,9 @@ void CCDraw::hide() //restore screen from backround layer frameBuffer->waitForIdle("CCDraw::hide()"); frameBuffer->RestoreScreen(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy, v_fbdata[i].pixbuf); - restored = true; } } } - //cleanup background layer, but only if restore was required - if (restored) - clearSavedScreen(); - is_painted = false; firstPaint = true; } From 60c9dc843225c7e465cdc272d243a7c0e70c5789 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 11 Jan 2016 16:40:38 +0100 Subject: [PATCH 21/33] CComponentsText: try to fix mismatching calculation of y pos inside form --- 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 bfe7a622a..3707dfd85 100644 --- a/src/gui/components/cc_item_text.cpp +++ b/src/gui/components/cc_item_text.cpp @@ -133,7 +133,7 @@ void CComponentsText::initCCText() if (cc_parent){ int th_parent_fr = cc_parent->getFrameThickness(); iX = cc_xr + (x <= th_parent_fr ? th_parent_fr : 0); - iY = cc_yr + (y <= th_parent_fr ? th_parent_fr : 0); + iY = cc_yr - (y <= th_parent_fr ? th_parent_fr : 0); } //init textbox From 98b73c0d092064304c1aa4b83b347f387b886876 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 12 Jan 2016 19:46:08 +0100 Subject: [PATCH 22/33] CInfoViewer: use different modes with enums for virtual zap and number input mode This should fix missing rounded corners in numbaur input mode too. Thx defans for input ! --- src/gui/channellist.cpp | 2 +- src/gui/infoviewer.cpp | 20 ++++++++++---------- src/gui/infoviewer.h | 26 ++++++++++++++++++++++++-- src/neutrino.cpp | 3 ++- 4 files changed, 37 insertions(+), 14 deletions(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index c0b4df985..d3b51f91f 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -1461,7 +1461,7 @@ void CChannelList::virtual_zap_mode(bool up) break; } } - g_InfoViewer->clearVirtualZapMode(); + g_InfoViewer->resetSwitchMode(); //disable virtual_zap_mode if (doZap) { if(g_settings.timing[SNeutrinoSettings::TIMING_INFOBAR] == 0) diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index f1eeddc74..0b43be313 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -142,7 +142,7 @@ void CInfoViewer::Init() showButtonBar = false; //gotTime = g_Sectionsd->getIsTimeSet (); gotTime = timeset; - virtual_zap_mode = false; + zap_mode = IV_MODE_DEFAULT; newfreq = true; chanready = 1; fileplay = 0; @@ -431,7 +431,7 @@ void CInfoViewer::paintBody() { int h_body = InfoHeightY - header_height + (g_settings.infobar_casystem_display < 2 ? infoViewerBB->bottom_bar_offset : 0); - if(virtual_zap_mode) + if(zap_mode) h_body -= (g_settings.infobar_casystem_display < 2 ? infoViewerBB->bottom_bar_offset : 0); if (body == NULL) @@ -440,8 +440,8 @@ void CInfoViewer::paintBody() body->setDimensionsAll(ChanInfoX, ChanNameY + header_height, BoxEndX-ChanInfoX, h_body); //set corner and shadow modes, consider virtual zap mode - body->setCorner(RADIUS_LARGE, virtual_zap_mode ? CORNER_BOTTOM : CORNER_NONE); - body->enableShadow(virtual_zap_mode ? CC_SHADOW_ON : CC_SHADOW_RIGHT); + body->setCorner(RADIUS_LARGE, (zap_mode) ? CORNER_BOTTOM : CORNER_NONE); + body->enableShadow(zap_mode ? CC_SHADOW_ON : CC_SHADOW_RIGHT); body->setColorBody(g_settings.theme.infobar_gradient_body ? COL_MENUHEAD_PLUS_0 : COL_INFOBAR_PLUS_0); body->enableColBodyGradient(g_settings.theme.infobar_gradient_body, COL_INFOBAR_PLUS_0, g_settings.theme.infobar_gradient_body_direction); @@ -702,7 +702,7 @@ void CInfoViewer::showTitle(CZapitChannel * channel, const bool calledFromNumZap ChannelName = Channel; bool new_chan = false; - if (virtual_zap_mode) { + if (zap_mode & IV_MODE_VIRTUAL_ZAP) { if (g_RemoteControl->current_channel_id != new_channel_id) { col_NumBoxText = COL_MENUHEAD_TEXT; } @@ -895,7 +895,7 @@ void CInfoViewer::setInfobarTimeout(int timeout_ext) void CInfoViewer::loop(bool show_dot) { bool hideIt = true; - virtual_zap_mode = false; + resetSwitchMode(); //no virtual zap //bool fadeOut = false; timeoutEnd=0;; setInfobarTimeout(); @@ -950,7 +950,7 @@ void CInfoViewer::loop(bool show_dot) //infoViewerBB->showIcon_CA_Status(0); infoViewerBB->showIcon_Resolution(); } else if ((g_settings.mode_left_right_key_tv == SNeutrinoSettings::VZAP) && ((msg == CRCInput::RC_right) || (msg == CRCInput::RC_left ))) { - virtual_zap_mode = true; + setSwitchMode(IV_MODE_VIRTUAL_ZAP); res = messages_return::cancel_all; hideIt = true; } else if ((msg == NeutrinoMessages::EVT_RECORDMODE) && @@ -1029,7 +1029,7 @@ void CInfoViewer::loop(bool show_dot) g_RCInput->killTimer (sec_timer_id); fader.StopFade(); - if (virtual_zap_mode) { + if (zap_mode & IV_MODE_VIRTUAL_ZAP) { /* if bouquet cycle set, do virtual over current bouquet */ if (/*g_settings.zap_cycle && */ /* (bouquetList != NULL) && */ !(bouquetList->Bouquets.empty())) bouquetList->Bouquets[bouquetList->getActiveBouquetNumber()]->channelList->virtual_zap_mode(msg == CRCInput::RC_right); @@ -1444,7 +1444,7 @@ int CInfoViewer::handleMsg (const neutrino_msg_t msg, neutrino_msg_data_t data) void CInfoViewer::sendNoEpg(const t_channel_id for_channel_id) { - if (!virtual_zap_mode) { + if (!zap_mode/* & IV_MODE_DEFAULT*/) { char *p = new char[sizeof(t_channel_id)]; memcpy(p, &for_channel_id, sizeof(t_channel_id)); g_RCInput->postMsg (NeutrinoMessages::EVT_NOEPG_YET, (const neutrino_msg_data_t) p, false); @@ -1968,7 +1968,7 @@ void CInfoViewer::showInfoFile() //paint info, don't save background, if already painted, global hide is also done by killTitle() bool save_bg = !infobar_txt->isPainted(); - if (new_text || virtual_zap_mode) + if (new_text || (zap_mode & IV_MODE_VIRTUAL_ZAP)) infobar_txt->paint(save_bg); } diff --git a/src/gui/infoviewer.h b/src/gui/infoviewer.h index a7300a7d6..6fe7044a9 100644 --- a/src/gui/infoviewer.h +++ b/src/gui/infoviewer.h @@ -57,6 +57,7 @@ class CInfoViewer bool gotTime; bool recordModeActive; + #ifndef SKIP_CA_STATUS bool CA_Status; #endif @@ -110,6 +111,7 @@ class CInfoViewer bool casysChange; bool channellogoChange; uint32_t lcdUpdateTimer; + int zap_mode; void paintBackground(int col_Numbox); void paintHead(); @@ -147,7 +149,7 @@ class CInfoViewer public: bool chanready; bool is_visible; - bool virtual_zap_mode; + char aspectRatio; uint32_t sec_timer_id; @@ -178,7 +180,27 @@ class CInfoViewer //void Set_CA_Status(int Status); int handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data); - void clearVirtualZapMode() {virtual_zap_mode = false;} + + enum{ + IV_MODE_DEFAULT = 0, + IV_MODE_VIRTUAL_ZAP = 1, + IV_MODE_NUMBER_ZAP = 2 + };/*iv_switch_mode_t*/ + /**sets mode for infoviewer. + * @param[in] mode + * @li IV_MODE_DEFAULT + * @li IV_MODE_VIRTUAL_ZAP means the virtual zap mode, user is typing keys for virtual channel switch + * @li IV_MODE_NUMBER_ZAP means number mode, user is typing number keys into screen + * @return + * void + * @see + * resetSwitchMode() + * getSwitchMode() + */ + void setSwitchMode(const int& mode) {zap_mode = mode;} + int getSwitchMode() {return zap_mode;} + void resetSwitchMode() {setSwitchMode(IV_MODE_DEFAULT);} + void changePB(); void ResetPB(); void showSNR(); diff --git a/src/neutrino.cpp b/src/neutrino.cpp index d5f39d074..1dd14710d 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -2135,6 +2135,7 @@ void CNeutrinoApp::quickZap(int msg) void CNeutrinoApp::numericZap(int msg) { StopSubtitles(); + g_InfoViewer->setSwitchMode(CInfoViewer::IV_MODE_NUMBER_ZAP); int res = channelList->numericZap( msg ); StartSubtitles(res < 0); if (res >= 0 && CRCInput::isNumeric(msg)) { @@ -2771,7 +2772,7 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) } /* ================================== KEYS ================================================ */ - if( msg == CRCInput::RC_ok || (!g_InfoViewer->virtual_zap_mode && (msg == CRCInput::RC_sat || msg == CRCInput::RC_favorites))) { + if( msg == CRCInput::RC_ok || (!g_InfoViewer->getSwitchMode() && (msg == CRCInput::RC_sat || msg == CRCInput::RC_favorites))) { if( (mode == mode_tv) || (mode == mode_radio) || (mode == mode_ts) || (mode == mode_webtv)) { showChannelList(msg); return messages_return::handled; From 387d96d2f5dfa23f3c38ce4b1ba8e405cacd0f15 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 21 Jan 2016 10:27:22 +0100 Subject: [PATCH 23/33] CScreenSaver: fix possible render of clock over screen size check position and size use only possible available screen size --- src/gui/screensaver.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/gui/screensaver.cpp b/src/gui/screensaver.cpp index 0235a9358..05c7396e5 100644 --- a/src/gui/screensaver.cpp +++ b/src/gui/screensaver.cpp @@ -271,7 +271,7 @@ void CScreenSaver::paint() if (!scr_clock){ scr_clock = new CComponentsFrmClock(1, 1, NULL, "%H.%M:%S", "%H.%M %S", true); scr_clock->setClockFont(g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_NUMBER]); - scr_clock->enableSaveBg(); + scr_clock->disableSaveBg(); scr_clock->doPaintBg(false); } if (scr_clock->isPainted()) @@ -279,7 +279,17 @@ void CScreenSaver::paint() scr_clock->kill(); scr_clock->setTextColor(clr.i_color); - scr_clock->setPosP(rand() % 80, rand() % 90); + + //check position and size use only possible available screen size + int x_cl, y_cl, w_cl, h_cl; + scr_clock->getDimensions( &x_cl, &y_cl, &w_cl, &h_cl); + bool unchecked = true; + while(unchecked){ + scr_clock->setPosP(uint8_t(rand() % 100),uint8_t(rand() % 100)); + scr_clock->getDimensions( &x_cl, &y_cl, &w_cl, &h_cl); + if (x_cl+w_cl < g_settings.screen_EndX && y_cl+h_cl < g_settings.screen_EndY) + unchecked = false; + } scr_clock->Start(); if (g_settings.screensaver_mode == SCR_MODE_CLOCK_COLOR) { From 9775f1f43af5973e7a26ec8871c83ab5551232ff Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 21 Jan 2016 10:49:10 +0100 Subject: [PATCH 24/33] cc_types: add missing item type to signalbar --- src/gui/components/cc_types.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/components/cc_types.h b/src/gui/components/cc_types.h index 8636ab679..cb135fe6a 100644 --- a/src/gui/components/cc_types.h +++ b/src/gui/components/cc_types.h @@ -63,6 +63,7 @@ typedef enum CC_ITEMTYPE_BUTTON_BLUE, CC_ITEMTYPE_SLIDER, CC_ITEMTYPE_FRM_SCROLLBAR, + CC_ITEMTYPE_FRM_SIGNALBAR, CC_ITEMTYPES }CC_ITEMTYPES_T; From 9d72b086a2558876f6c0d27eeb1373015dfb5542 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 21 Jan 2016 10:56:30 +0100 Subject: [PATCH 25/33] text screen save: try to rework screen save behavior for textbox objects Screen save now always disabled by default and can be controlled outside of relevant objects. --- src/gui/channellist.cpp | 6 ++- src/gui/components/cc_frm_button.cpp | 1 + src/gui/components/cc_frm_button.h | 21 ++++++++++ src/gui/components/cc_frm_clock.cpp | 5 +-- src/gui/components/cc_frm_clock.h | 14 ++++++- src/gui/components/cc_frm_ext_text.cpp | 8 ++-- src/gui/components/cc_frm_ext_text.h | 18 +++++++++ src/gui/components/cc_frm_header.cpp | 2 +- src/gui/components/cc_frm_header.h | 17 ++++++++ src/gui/components/cc_frm_signalbars.cpp | 21 ++++++---- src/gui/components/cc_frm_signalbars.h | 49 ++++++++++++++++++++++-- src/gui/components/cc_item_text.cpp | 4 +- src/gui/components/cc_item_text.h | 16 ++++++-- src/gui/components/cc_text_screen.h | 21 +++++++++- src/gui/infoviewer.cpp | 6 ++- src/gui/widget/textbox.cpp | 4 +- 16 files changed, 177 insertions(+), 36 deletions(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index d3b51f91f..17655dc91 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -2060,8 +2060,10 @@ void CChannelList::paint() void CChannelList::paintHead() { - if (header == NULL) + if (header == NULL){ header = new CComponentsHeader(); + header->getTextObject()->enableTboxSaveScreen(g_settings.theme.menu_Head_gradient);//enable screen save for title text if color gradient is in use + } header->setDimensionsAll(x, y, full_width, theight); @@ -2098,7 +2100,7 @@ void CChannelList::paintHead() else logo_off = 10; - header->paint(CC_SAVE_SCREEN_NO); + header->paint(CC_SAVE_SCREEN_NO); //TODO: paint title only, currently paint() does paint all enabled header items at once and causes flicker effects in unchanged items (e.g. clock) } CComponentsHeader* CChannelList::getHeaderObject() diff --git a/src/gui/components/cc_frm_button.cpp b/src/gui/components/cc_frm_button.cpp index 38087c79a..403418664 100644 --- a/src/gui/components/cc_frm_button.cpp +++ b/src/gui/components/cc_frm_button.cpp @@ -174,6 +174,7 @@ void CComponentsButton::initCaption() if (cc_btn_capt_obj == NULL){ cc_btn_capt_obj = new CComponentsLabel(); cc_btn_capt_obj->doPaintBg(false); + cc_btn_capt_obj->doPaintTextBoxBg(false); cc_btn_capt_obj->enableTboxSaveScreen(cc_txt_save_screen); addCCItem(cc_btn_capt_obj); } diff --git a/src/gui/components/cc_frm_button.h b/src/gui/components/cc_frm_button.h index 44a688b32..d665ac6ce 100644 --- a/src/gui/components/cc_frm_button.h +++ b/src/gui/components/cc_frm_button.h @@ -135,6 +135,27 @@ class CComponentsButton : public CComponentsFrmChain, public CCTextScreen ///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;} + /**Member to modify background behavior of embeded caption object. + * @param[in] mode + * @li bool, default = true + * @return + * void + * @see + * Parent member: CCTextScreen::enableTboxSaveScreen() + * CTextBox::enableSaveScreen() + * disableTboxSaveScreen() + */ + virtual void enableTboxSaveScreen(bool mode) + { + if (cc_txt_save_screen == mode) + return; + cc_txt_save_screen = mode; + for(size_t i=0; igetItemType() == CC_ITEMTYPE_LABEL) + static_cast(v_cc_items[i])->enableTboxSaveScreen(cc_txt_save_screen); + } + }; + ///set caption: parameter as string virtual void setCaption(const std::string& text); ///set caption: parameter as locale diff --git a/src/gui/components/cc_frm_clock.cpp b/src/gui/components/cc_frm_clock.cpp index 313b05cc2..e20ef0916 100644 --- a/src/gui/components/cc_frm_clock.cpp +++ b/src/gui/components/cc_frm_clock.cpp @@ -402,16 +402,13 @@ void CComponentsFrmClock::kill(const fb_pixel_t& bg_color, bool ignore_parent) CComponentsForm::kill(bg_color, ignore_parent); } -void CComponentsFrmClock::enableSegmentSaveScreen(bool mode) +void CComponentsFrmClock::enableTboxSaveScreen(bool mode) { if (cc_txt_save_screen == mode || v_cc_items.empty()) return; - cc_txt_save_screen = mode; - for (size_t i = 0; i < v_cc_items.size(); i++){ CComponentsLabel *seg = static_cast (v_cc_items[i]); - //seg->clearSavedScreen(); seg->enableTboxSaveScreen(cc_txt_save_screen); } } diff --git a/src/gui/components/cc_frm_clock.h b/src/gui/components/cc_frm_clock.h index 6b91c836f..8f5fe47b4 100644 --- a/src/gui/components/cc_frm_clock.h +++ b/src/gui/components/cc_frm_clock.h @@ -158,8 +158,18 @@ class CComponentsFrmClock : public CComponentsForm, public CCTextScreen ///reinitialize clock contents virtual void refresh() { initCCLockItems(); } - ///allows to save bg screen behind text within segment objects, see also cl_save_segment_screen - void enableSegmentSaveScreen(bool mode); + + /**Member to modify background behavior of embeded segment objects + * @param[in] mode + * @li bool, default = true + * @return + * void + * @see + * Parent member: CCTextScreen::enableTboxSaveScreen() + * CTextBox::enableSaveScreen() + * disableTboxSaveScreen() + */ + void enableTboxSaveScreen(bool mode); ///set color gradient on/off, returns true if gradient mode was changed virtual bool enableColBodyGradient(const int& enable_mode, const fb_pixel_t& sec_color = 255 /*=COL_BACKGROUND*/); diff --git a/src/gui/components/cc_frm_ext_text.cpp b/src/gui/components/cc_frm_ext_text.cpp index 5d24e7d58..97b798795 100644 --- a/src/gui/components/cc_frm_ext_text.cpp +++ b/src/gui/components/cc_frm_ext_text.cpp @@ -104,7 +104,8 @@ void CComponentsExtTextForm::initLabel() //initialize label object if (ccx_label_obj == NULL){ ccx_label_obj = new CComponentsLabel(); - ccx_label_obj->doPaintBg(false); + ccx_label_obj->doPaintBg(!cc_txt_save_screen); + ccx_label_obj->doPaintTextBoxBg(false); ccx_label_obj->enableTboxSaveScreen(cc_txt_save_screen); } @@ -117,7 +118,7 @@ void CComponentsExtTextForm::initLabel() ccx_label_width = (ccx_percent_label_w * width/100); ccx_label_obj->setText(ccx_label_text, ccx_label_align, ccx_font); ccx_label_obj->setTextColor(ccx_label_color); - ccx_label_obj->setDimensionsAll(fr_thickness, 0, ccx_label_width-fr_thickness, height-2*fr_thickness); + ccx_label_obj->setDimensionsAll(0, 0, ccx_label_width-2*fr_thickness, height-2*fr_thickness); ccx_label_obj->setCorner(this->corner_rad, CORNER_LEFT); } } @@ -127,7 +128,8 @@ void CComponentsExtTextForm::initText() //initialize text object if (ccx_text_obj == NULL){ ccx_text_obj = new CComponentsText(); - ccx_text_obj->doPaintBg(false); + ccx_text_obj->doPaintBg(!cc_txt_save_screen); + ccx_text_obj->doPaintTextBoxBg(false); ccx_text_obj->enableTboxSaveScreen(cc_txt_save_screen); } diff --git a/src/gui/components/cc_frm_ext_text.h b/src/gui/components/cc_frm_ext_text.h index 007680dea..0bf45f508 100644 --- a/src/gui/components/cc_frm_ext_text.h +++ b/src/gui/components/cc_frm_ext_text.h @@ -110,6 +110,24 @@ class CComponentsExtTextForm : public CComponentsForm, public CCTextScreen ///returns a pointer to the internal text object, use this to get access to its most properties CComponentsText*getTextObject(){return ccx_text_obj;}; + /**Member to modify background behavior of embeded label and text objects + * @param[in] mode + * @li bool, default = true + * @return + * void + * @see + * Parent member: CCTextScreen::enableTboxSaveScreen() + * CTextBox::enableSaveScreen() + * disableTboxSaveScreen() + */ + void enableTboxSaveScreen(bool mode){ + if (cc_txt_save_screen == mode) + return; + cc_txt_save_screen = mode; + for(size_t i=0; i(v_cc_items[i])->enableTboxSaveScreen(cc_txt_save_screen); + }; + ///sets the text modes (mainly text alignment) to the label and text object, see /gui/widget/textbox.h for possible modes void setTextModes(const int& label_mode, const int& text_mode); diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index f26bc4132..4a69827f7 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -86,7 +86,7 @@ void CComponentsHeader::initVarHeader( const int& x_pos, const int& y_pos, const fb_pixel_t color_shadow) { cc_item_type = CC_ITEMTYPE_FRM_HEADER; - cc_txt_save_screen = true; + cc_txt_save_screen = false; x = x_old = x_pos; y = y_old = y_pos; diff --git a/src/gui/components/cc_frm_header.h b/src/gui/components/cc_frm_header.h index 56eb3e38d..45354ca2e 100644 --- a/src/gui/components/cc_frm_header.h +++ b/src/gui/components/cc_frm_header.h @@ -211,6 +211,23 @@ class CComponentsHeader : public CComponentsForm, public CCTextScreen ///returns the text object virtual CComponentsText* getTextObject(){return cch_text_obj;} + /**Member to modify background behavior of embeded title + * @param[in] mode + * @li bool, default = true + * @return + * void + * @see + * Parent member: CCTextScreen::enableTboxSaveScreen() + * CTextBox::enableSaveScreen() + * disableTboxSaveScreen() + */ + void enableTboxSaveScreen(bool mode) + { + cc_txt_save_screen = mode; + if (cch_text_obj->getCTextBoxObject()) + cch_text_obj->getCTextBoxObject()->enableSaveScreen(cc_txt_save_screen); + } + ///returns the clock object virtual CComponentsFrmClock* getClockObject(){return cch_cl_obj;} diff --git a/src/gui/components/cc_frm_signalbars.cpp b/src/gui/components/cc_frm_signalbars.cpp index 5bea94103..27061c8b8 100644 --- a/src/gui/components/cc_frm_signalbars.cpp +++ b/src/gui/components/cc_frm_signalbars.cpp @@ -106,7 +106,7 @@ void CSignalBar::initVarSigBar() append_x_offset = 2; append_y_offset = 2; height = SB_MIN_HEIGHT; - + cc_item_type = CC_ITEMTYPE_FRM_SIGNALBAR; sb_scale_height = -1; dy_font = CNeutrinoFonts::getInstance(); @@ -144,12 +144,13 @@ void CSignalBar::initSBarValue() //create value label object with basic properties if (sb_vlbl == NULL){ sb_vlbl = new CComponentsLabel(); - sb_vlbl->doPaintBg(false); - sb_vlbl->doPaintTextBoxBg(false); - sb_vlbl->enableTboxSaveScreen(true); sb_vlbl->setText(REF_PERCENT_TXT, sb_val_mode, sb_font); } + sb_vlbl->doPaintBg(false); + sb_vlbl->doPaintTextBoxBg(!cc_txt_save_screen); + sb_vlbl->enableTboxSaveScreen(cc_txt_save_screen); + //move and set dimensions int vlbl_x = sb_scale->getXPos() + sb_scale_width + append_y_offset; int vlbl_h = sb_scale->getHeight(); @@ -169,12 +170,14 @@ void CSignalBar::initSBarName() //create name label object with basic properties if (sb_lbl == NULL){ sb_lbl = new CComponentsLabel(); - sb_lbl->doPaintBg(false); - sb_lbl->doPaintTextBoxBg(false); - sb_lbl->enableTboxSaveScreen(true); - sb_lbl->setText(sb_name, CTextBox::NO_AUTO_LINEBREAK | CTextBox::RIGHT, sb_font); } + sb_lbl->doPaintBg(false); + sb_lbl->doPaintTextBoxBg(!cc_txt_save_screen); + sb_lbl->enableTboxSaveScreen(cc_txt_save_screen); + + sb_lbl->setText(sb_name, CTextBox::NO_AUTO_LINEBREAK | CTextBox::RIGHT, sb_font); + //move and set dimensions int lbl_x = sb_vlbl->getXPos()+ sb_vlbl->getWidth(); int lbl_h = sb_vlbl->getHeight(); @@ -316,11 +319,13 @@ void CSignalBox::initSignalItems() sbar->setFrontEnd(sbx_frontend); sbar->setCorner(0); sbar->setScaleHeight(scale_h); + sbar->enableTboxSaveScreen(cc_txt_save_screen); snrbar->setDimensionsAll(vertical ? sbar_x : CC_APPEND, vertical ? CC_APPEND : 1, sbar_w, sbar_h); snrbar->setFrontEnd(sbx_frontend); snrbar->setCorner(0); snrbar->setScaleHeight(scale_h); + snrbar->enableTboxSaveScreen(cc_txt_save_screen); } void CSignalBox::paintScale() diff --git a/src/gui/components/cc_frm_signalbars.h b/src/gui/components/cc_frm_signalbars.h index e78de5353..216b221af 100644 --- a/src/gui/components/cc_frm_signalbars.h +++ b/src/gui/components/cc_frm_signalbars.h @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -47,7 +48,7 @@ CSignalBar() and their sub classes based up CComponentsForm() and are usable lik CSignalBar() is intended to show signal rate. */ -class CSignalBar : public CComponentsForm +class CSignalBar : public CComponentsForm, public CCTextScreen { public: ///refresh current item properties, use this before paintScale(). @@ -141,6 +142,27 @@ class CSignalBar : public CComponentsForm //returns the current signal value uint16_t getValue(void) { return sb_signal; } + + /**Member to modify background behavior of embeded caption objects (value, name) + * @param[in] mode + * @li bool, default = true + * @return + * void + * @see + * Parent member: CCTextScreen::enableTboxSaveScreen() + * CTextBox::enableSaveScreen() + * disableTboxSaveScreen() + */ + void enableTboxSaveScreen(bool mode) + { + if (cc_txt_save_screen == mode) + return; + cc_txt_save_screen = mode; + for(size_t i=0; igetItemType() == CC_ITEMTYPE_LABEL) + static_cast(v_cc_items[i])->enableTboxSaveScreen(cc_txt_save_screen); + } + } }; /// Sub class of CSignalBar() @@ -237,7 +259,7 @@ void CSampleClass::hide () */ -class CSignalBox : public CComponentsForm +class CSignalBox : public CComponentsForm, public CCTextScreen { private: ///object: current frontend @@ -289,8 +311,27 @@ class CSignalBox : public CComponentsForm ///return current snr value uint16_t getSNRValue(void) { return snrbar->getValue();} - - ///return current snr value + + /**Member to modify background behavior of embeded caption objects (value, name) + * @param[in] mode + * @li bool, default = true + * @return + * void + * @see + * Parent member: CCTextScreen::enableTboxSaveScreen() + * CTextBox::enableSaveScreen() + * disableTboxSaveScreen() + */ + void enableTboxSaveScreen(bool mode) + { + if (cc_txt_save_screen == mode) + return; + cc_txt_save_screen = mode; + for(size_t i=0; igetItemType() == CC_ITEMTYPE_FRM_SIGNALBAR) + static_cast(v_cc_items[i])->enableTboxSaveScreen(cc_txt_save_screen); + } + }; }; #endif diff --git a/src/gui/components/cc_item_text.cpp b/src/gui/components/cc_item_text.cpp index 3707dfd85..c554f1123 100644 --- a/src/gui/components/cc_item_text.cpp +++ b/src/gui/components/cc_item_text.cpp @@ -145,13 +145,13 @@ void CComponentsText::initCCText() ct_textbox->setTextMode(ct_text_mode); ct_textbox->setWindowPos(this); ct_textbox->setTextBorderWidth(ct_text_Hborder, ct_text_Vborder); - ct_textbox->enableBackgroundPaint(ct_paint_textbg); + ct_textbox->enableBackgroundPaint(ct_paint_textbg && !cc_txt_save_screen); ct_textbox->setBackGroundColor(col_body); ct_textbox->setBackGroundRadius(corner_rad-fr_thickness, corner_type); ct_textbox->setTextColor(ct_col_text); ct_textbox->setWindowMaxDimensions(iWidth, iHeight); ct_textbox->setWindowMinDimensions(iWidth, iHeight); - ct_textbox->enableSaveScreen(cc_txt_save_screen); + ct_textbox->enableSaveScreen(cc_txt_save_screen && !ct_paint_textbg); ct_textbox->enableUTF8(ct_utf8_encoded); //observe behavior of parent form if available diff --git a/src/gui/components/cc_item_text.h b/src/gui/components/cc_item_text.h index af36d128b..5bf297212 100644 --- a/src/gui/components/cc_item_text.h +++ b/src/gui/components/cc_item_text.h @@ -177,14 +177,22 @@ class CComponentsText : public CCTextScreen, public CComponentsItem, public CBox ///returns count of lines from a text box page virtual int getTextLinesAutoHeight(const int& textMaxHeight, const int& textWidth, const int& mode); - ///allows to save bg screen behind text within CTextBox object, see also cc_txt_save_screen + + /**Member to modify background behavior of textbox object + * @param[in] mode + * @li bool, default = true + * @return + * void + * @see + * Parent member: CCTextScreen::enableTboxSaveScreen() + * CTextBox::enableSaveScreen() + * disableTboxSaveScreen() + */ void enableTboxSaveScreen(bool mode) { - if (cc_txt_save_screen == mode) - return; cc_txt_save_screen = mode; if (ct_textbox) - ct_textbox->enableSaveScreen(mode); + ct_textbox->enableSaveScreen(cc_txt_save_screen); } ///enable/disable utf8 encoding void enableUTF8(bool enable = true){ct_utf8_encoded = enable;} diff --git a/src/gui/components/cc_text_screen.h b/src/gui/components/cc_text_screen.h index afdbe9024..07f7e05e6 100644 --- a/src/gui/components/cc_text_screen.h +++ b/src/gui/components/cc_text_screen.h @@ -24,7 +24,6 @@ #ifndef __CC_TXT_SCREEN__ #define __CC_TXT_SCREEN__ - //! Sub class for CTextBox using CComponent classes. /*! This class contains flags or helpers to control CTextBox screen and paint handling and mostly used by @@ -38,7 +37,25 @@ class CCTextScreen bool cc_txt_save_screen; public: - CCTextScreen(){cc_txt_save_screen = false;}; + CCTextScreen(){cc_txt_save_screen = false;} + + /**Abstract member to modify background behavior of embeded textbox object + * @param[in] mode + * @li bool, default = true, enables backround saving of textbox object. This causes painting of backround from saved screen instead simple backround (if enabled) + * This is usefull if text should be paint on transparent background or background with color gradient. + * @return + * void + * @see + * CTextBox::enableSaveScreen() + * disableTboxSaveScreen() + */ + virtual void enableTboxSaveScreen(bool mode) = 0; + + /**member to disable background behavior of embeded textbox object. + * @see + * disableTboxSaveScreen() + */ + virtual void disableTboxSaveScreen(){enableTboxSaveScreen(false);} }; #endif diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index 0b43be313..b326b7dca 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -252,10 +252,10 @@ void CInfoViewer::initClock() InfoClock->getInstance()->disableInfoClock(); clock->enableColBodyGradient(gradient_top, COL_INFOBAR_PLUS_0); - clock->enableSegmentSaveScreen(gradient_top); + clock->doPaintBg(!gradient_top); + clock->enableTboxSaveScreen(gradient_top); clock->setColorBody(COL_INFOBAR_PLUS_0); clock->setCorner(RADIUS_LARGE, CORNER_TOP_RIGHT); - clock->doPaintBg(!gradient_top); clock->setClockFont(g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]); clock->setPos(BoxEndX - 10 - clock->getWidth(), ChanNameY); clock->setTextColor(COL_INFOBAR_TEXT); @@ -1523,7 +1523,9 @@ void CInfoViewer::showSNR () int sigbox_offset = ChanWidth *10/100; sigbox = new CSignalBox(BoxStartX + sigbox_offset, y_numbox+ChanHeight/2, ChanWidth - 2*sigbox_offset, ChanHeight/2, CFEManager::getInstance()->getLiveFE(), true, NULL, "S", "Q"); sigbox->setTextColor(COL_INFOBAR_TEXT); + sigbox->setColorBody(numbox->getColorBody()); sigbox->doPaintBg(false); + sigbox->enableTboxSaveScreen(numbox->getColBodyGradientMode()); } sigbox->paint(CC_SAVE_SCREEN_NO); } diff --git a/src/gui/widget/textbox.cpp b/src/gui/widget/textbox.cpp index 18205ea50..5f33a725e 100644 --- a/src/gui/widget/textbox.cpp +++ b/src/gui/widget/textbox.cpp @@ -588,8 +588,8 @@ void CTextBox::refreshText(void) //save screen only if no paint of background required if (!m_nPaintBackground && m_SaveScreen) { if (m_bgpixbuf == NULL){ - //TRACE("[CTextBox] %s save bg %d\r\n", __FUNCTION__, __LINE__); if ((dx * dy) >0){ +// TRACE("[CTextBox] [%s - %d] save bg for use as transparent background [%s]\n", __func__, __LINE__, m_cText.c_str()); m_bgpixbuf= new fb_pixel_t[dx * dy]; frameBuffer->SaveScreen(ax, ay, dx, dy, m_bgpixbuf); } @@ -598,7 +598,7 @@ void CTextBox::refreshText(void) //Paint Text Background bool allow_paint_bg = (m_old_cText != m_cText || has_changed || m_has_scrolled); - if (m_nPaintBackground){ + if (m_nPaintBackground && !m_SaveScreen){ clearScreenBuffer(); if (allow_paint_bg){ //TRACE("[CTextBox] %s paint bg %d\r\n", __FUNCTION__, __LINE__); From 3553030bce420e7494b9949583ba077bca724586 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Thu, 21 Jan 2016 11:17:05 +0100 Subject: [PATCH 26/33] - controlapi: add possibility to check status of remote control --- src/nhttpd/doc/nhttpd_controlapi.html | 11 ++++++++++- src/nhttpd/tuxboxapi/controlapi.cpp | 25 ++++++++++++++++++------- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/src/nhttpd/doc/nhttpd_controlapi.html b/src/nhttpd/doc/nhttpd_controlapi.html index 8cedb54d7..4a215504f 100644 --- a/src/nhttpd/doc/nhttpd_controlapi.html +++ b/src/nhttpd/doc/nhttpd_controlapi.html @@ -1655,6 +1655,16 @@ ok
Fernbedienung
Handler: http://box_ip/control/rc

+Parameter:keine/status
+Rückgabe:on/off
+
+Zeigt den Status der Fernbedienung
+
+Beispiel:
+
+http://box_ip/control/rc?status
+on
+
Parameter: lock
Rückgabe: ok

@@ -1674,7 +1684,6 @@ Beispiel:

http://box_ip/control/rc?unlock
ok
-
diff --git a/src/nhttpd/tuxboxapi/controlapi.cpp b/src/nhttpd/tuxboxapi/controlapi.cpp index e61f19c61..093b9d1cf 100644 --- a/src/nhttpd/tuxboxapi/controlapi.cpp +++ b/src/nhttpd/tuxboxapi/controlapi.cpp @@ -496,23 +496,34 @@ void CControlAPI::StandbyCGI(CyhookHandler *hh) //----------------------------------------------------------------------------- void CControlAPI::RCCGI(CyhookHandler *hh) { - if (!(hh->ParamList.empty())) - { - bool locked = CRCLock::getInstance()->isLocked(); + bool locked = CRCLock::getInstance()->isLocked(); - if (hh->ParamList["1"] == "lock"){ // lock remote control + if (hh->ParamList.empty() || hh->ParamList["1"] == "status") + { + if (locked) + hh->WriteLn("off"); + else + hh->WriteLn("on"); + } + else + { + if (hh->ParamList["1"] == "lock") + { if (!locked) NeutrinoAPI->EventServer->sendEvent(NeutrinoMessages::LOCK_RC, CEventServer::INITID_HTTPD); } - else if (hh->ParamList["1"] == "unlock"){// unlock remote control + else if (hh->ParamList["1"] == "unlock") + { if (locked) NeutrinoAPI->EventServer->sendEvent(NeutrinoMessages::UNLOCK_RC, CEventServer::INITID_HTTPD); } - else{ + else + { hh->SendError(); + return; } + hh->SendOk(); } - hh->SendOk(); } //----------------------------------------------------------------------------- From a2ba19459704893c261336d73cabbb777e5f79b9 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Thu, 21 Jan 2016 11:18:53 +0100 Subject: [PATCH 27/33] - yWeb: add button to check status of remote control --- src/nhttpd/web/Y_Tools_Boxcontrol.yhtm | 1 + src/nhttpd/web/Y_Version.txt | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/nhttpd/web/Y_Tools_Boxcontrol.yhtm b/src/nhttpd/web/Y_Tools_Boxcontrol.yhtm index ade978061..200ad4064 100644 --- a/src/nhttpd/web/Y_Tools_Boxcontrol.yhtm +++ b/src/nhttpd/web/Y_Tools_Boxcontrol.yhtm @@ -73,6 +73,7 @@ function standby(_standby){ + diff --git a/src/nhttpd/web/Y_Version.txt b/src/nhttpd/web/Y_Version.txt index ecf60e920..ad8537925 100644 --- a/src/nhttpd/web/Y_Version.txt +++ b/src/nhttpd/web/Y_Version.txt @@ -1,4 +1,4 @@ -version=2.9.0.24 -date=28.12.2015 +version=2.9.0.25 +date=21.01.2016 type=Release info=Port CST From 2738f70f38289bd3a2875eb8ea8f85a66548bdc2 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Thu, 21 Jan 2016 16:38:59 +0100 Subject: [PATCH 28/33] - yWeb: remove hardcoded css from textareas --- src/nhttpd/web/Y_Ext_Settings.yhtm | 2 +- src/nhttpd/web/Y_Ext_Uninstall.yhtm | 2 +- src/nhttpd/web/Y_Ext_Update.yhtm | 2 +- src/nhttpd/web/Y_Filemgr_Edit.yhtm | 2 +- src/nhttpd/web/Y_Main.css | 5 +++++ src/nhttpd/web/Y_Settings_Timer.yhtm | 2 +- src/nhttpd/web/Y_Tools_Cmd.yhtm | 2 +- src/nhttpd/web/Y_Version.txt | 2 +- 8 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/nhttpd/web/Y_Ext_Settings.yhtm b/src/nhttpd/web/Y_Ext_Settings.yhtm index f9a9f906d..ae3d6a290 100644 --- a/src/nhttpd/web/Y_Ext_Settings.yhtm +++ b/src/nhttpd/web/Y_Ext_Settings.yhtm @@ -23,7 +23,7 @@ function do_submit(){ - +
 

diff --git a/src/nhttpd/web/Y_Ext_Uninstall.yhtm b/src/nhttpd/web/Y_Ext_Uninstall.yhtm index 8bdc1c748..4ce14288f 100644 --- a/src/nhttpd/web/Y_Ext_Uninstall.yhtm +++ b/src/nhttpd/web/Y_Ext_Uninstall.yhtm @@ -63,7 +63,7 @@ function init(){
- +

diff --git a/src/nhttpd/web/Y_Ext_Update.yhtm b/src/nhttpd/web/Y_Ext_Update.yhtm index eff7c7ee0..e42e9d6f4 100644 --- a/src/nhttpd/web/Y_Ext_Update.yhtm +++ b/src/nhttpd/web/Y_Ext_Update.yhtm @@ -54,7 +54,7 @@ - +

diff --git a/src/nhttpd/web/Y_Filemgr_Edit.yhtm b/src/nhttpd/web/Y_Filemgr_Edit.yhtm index 53c920441..ed52365e5 100644 --- a/src/nhttpd/web/Y_Filemgr_Edit.yhtm +++ b/src/nhttpd/web/Y_Filemgr_Edit.yhtm @@ -56,7 +56,7 @@ function ni(){ - +
diff --git a/src/nhttpd/web/Y_Main.css b/src/nhttpd/web/Y_Main.css index 2a4142672..6c975bd3f 100644 --- a/src/nhttpd/web/Y_Main.css +++ b/src/nhttpd/web/Y_Main.css @@ -95,6 +95,11 @@ input[type="text"],input[type="password"],select{ margin: 0px; } +textarea { + font: monospace medium 'Courier New', sans-serif; + background: #ffffff; + color: #436976; +} * html .boxhead h2 {height: 1%;} /* For IE 5 PC */ a { color: #555555; diff --git a/src/nhttpd/web/Y_Settings_Timer.yhtm b/src/nhttpd/web/Y_Settings_Timer.yhtm index e7897b78c..772812db3 100644 --- a/src/nhttpd/web/Y_Settings_Timer.yhtm +++ b/src/nhttpd/web/Y_Settings_Timer.yhtm @@ -50,7 +50,7 @@ function do_submit() {   - +
diff --git a/src/nhttpd/web/Y_Tools_Cmd.yhtm b/src/nhttpd/web/Y_Tools_Cmd.yhtm index 5eea1491b..511646fc4 100644 --- a/src/nhttpd/web/Y_Tools_Cmd.yhtm +++ b/src/nhttpd/web/Y_Tools_Cmd.yhtm @@ -51,7 +51,7 @@ function doUpload() {=var-set:help_url=Help-Tools-Command_Shell=}{=var-set:menu={=L:tools.command_shell=}=}{=include-block:Y_Blocks.txt;work_menu=}
- +
diff --git a/src/nhttpd/web/Y_Version.txt b/src/nhttpd/web/Y_Version.txt index ad8537925..691238b8c 100644 --- a/src/nhttpd/web/Y_Version.txt +++ b/src/nhttpd/web/Y_Version.txt @@ -1,4 +1,4 @@ -version=2.9.0.25 +version=2.9.0.26 date=21.01.2016 type=Release info=Port CST From 8a61c3bfcd1235ff4585a894956d29763a20660e Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Thu, 21 Jan 2016 09:09:30 +0100 Subject: [PATCH 29/33] CLuaInstance: Add some CComponentsHeader functions - Set Lua api version to 1.38 --- src/gui/lua/Makefile.am | 1 + src/gui/lua/lua_api_version.h | 2 +- src/gui/lua/lua_cc_header.cpp | 138 ++++++++++++++++++++++++++++++ src/gui/lua/lua_cc_header.h | 49 +++++++++++ src/gui/lua/luainstance.cpp | 2 + src/gui/lua/luainstance_helpers.h | 1 + 6 files changed, 192 insertions(+), 1 deletion(-) create mode 100644 src/gui/lua/lua_cc_header.cpp create mode 100644 src/gui/lua/lua_cc_header.h diff --git a/src/gui/lua/Makefile.am b/src/gui/lua/Makefile.am index 4cf5c50aa..e3861cb76 100644 --- a/src/gui/lua/Makefile.am +++ b/src/gui/lua/Makefile.am @@ -25,6 +25,7 @@ noinst_LIBRARIES = libneutrino_gui_lua.a libneutrino_gui_lua_a_SOURCES = \ luainstance.cpp \ luainstance_helpers.cpp \ + lua_cc_header.cpp \ lua_cc_picture.cpp \ lua_cc_signalbox.cpp \ lua_cc_text.cpp \ diff --git a/src/gui/lua/lua_api_version.h b/src/gui/lua/lua_api_version.h index c5a53aad9..9fe6f1a67 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 37 +#define LUA_API_VERSION_MINOR 38 diff --git a/src/gui/lua/lua_cc_header.cpp b/src/gui/lua/lua_cc_header.cpp new file mode 100644 index 000000000..c2273cde5 --- /dev/null +++ b/src/gui/lua/lua_cc_header.cpp @@ -0,0 +1,138 @@ +/* + * lua components header + * + * (C) 2016 M. Liebmann (micha-bbg) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "luainstance.h" +#include "lua_cc_window.h" +#include "lua_cc_header.h" + + +CLuaInstCCHeader* CLuaInstCCHeader::getInstance() +{ + static CLuaInstCCHeader* LuaInstCCHeader = NULL; + + if(!LuaInstCCHeader) + LuaInstCCHeader = new CLuaInstCCHeader(); + return LuaInstCCHeader; +} + +CLuaCCHeader *CLuaInstCCHeader::CCHeaderCheck(lua_State *L, int n) +{ + return *(CLuaCCHeader **) luaL_checkudata(L, n, LUA_HEADER_CLASSNAME); +} + +void CLuaInstCCHeader::CCHeaderRegister(lua_State *L) +{ + luaL_Reg meth[] = { + { "new", CLuaInstCCHeader::CCHeaderNew }, + { "paint", CLuaInstCCHeader::CCHeaderPaint }, + { "hide", CLuaInstCCHeader::CCHeaderHide }, + { "__gc", CLuaInstCCHeader::CCHeaderDelete }, + { NULL, NULL } + }; + + luaL_newmetatable(L, LUA_HEADER_CLASSNAME); + luaL_setfuncs(L, meth, 0); + lua_pushvalue(L, -1); + lua_setfield(L, -1, "__index"); + lua_setglobal(L, LUA_HEADER_CLASSNAME); +} + + +int CLuaInstCCHeader::CCHeaderNew(lua_State *L) +{ + lua_assert(lua_istable(L,1)); + + CLuaCCWindow* parent = NULL; + lua_Integer x=10, y=10, dx=100, dy=100; + lua_Integer buttons = 0; + lua_Integer shadow_mode = CC_SHADOW_OFF; + + std::string caption, icon; + lua_Unsigned color_frame = (lua_Unsigned)COL_MENUCONTENT_PLUS_6; + lua_Unsigned color_body = (lua_Unsigned)COL_MENUCONTENT_PLUS_0; + lua_Unsigned color_shadow = (lua_Unsigned)COL_MENUCONTENTDARK_PLUS_0; + + tableLookup(L, "parent", (void**)&parent); + tableLookup(L, "x", x); + tableLookup(L, "y", y); + tableLookup(L, "dx", dx); + tableLookup(L, "dy", dy); + tableLookup(L, "caption", caption); + tableLookup(L, "icon", icon); + tableLookup(L, "shadow_mode", shadow_mode); + tableLookup(L, "color_frame", color_frame); + tableLookup(L, "color_body" , color_body); + tableLookup(L, "color_shadow", color_shadow); + + color_frame = checkMagicMask(color_frame); + color_body = checkMagicMask(color_body); + color_shadow = checkMagicMask(color_shadow); + + CComponentsForm* pw = (parent && parent->w) ? parent->w->getBodyObject() : NULL; + CLuaCCHeader **udata = (CLuaCCHeader **) lua_newuserdata(L, sizeof(CLuaCCHeader *)); + *udata = new CLuaCCHeader(); + (*udata)->ch = new CComponentsHeader((const int&)x, (const int&)y, (const int&)dx, (const int&)dy, + caption, (std::string)"", (const int&)buttons, + (CComponentsForm*)parent, (int)shadow_mode, + (fb_pixel_t)color_frame, (fb_pixel_t)color_body, (fb_pixel_t)color_shadow); + (*udata)->parent = pw; + luaL_getmetatable(L, LUA_HEADER_CLASSNAME); + lua_setmetatable(L, -2); + return 1; +} + +int CLuaInstCCHeader::CCHeaderPaint(lua_State *L) +{ + lua_assert(lua_istable(L,1)); + CLuaCCHeader *D = CCHeaderCheck(L, 1); + if (!D) return 0; + + bool do_save_bg = true; + tableLookup(L, "do_save_bg", do_save_bg); + + D->ch->paint(do_save_bg); + return 0; +} + +int CLuaInstCCHeader::CCHeaderHide(lua_State *L) +{ + CLuaCCHeader *D = CCHeaderCheck(L, 1); + if (!D) return 0; + + D->ch->hide(); + return 0; +} + +int CLuaInstCCHeader::CCHeaderDelete(lua_State *L) +{ + CLuaCCHeader *D = CCHeaderCheck(L, 1); + if (!D) return 0; + delete D; + return 0; +} diff --git a/src/gui/lua/lua_cc_header.h b/src/gui/lua/lua_cc_header.h new file mode 100644 index 000000000..bea6bf72f --- /dev/null +++ b/src/gui/lua/lua_cc_header.h @@ -0,0 +1,49 @@ +/* + * lua components header + * + * (C) 2016 M. Liebmann (micha-bbg) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef _LUACCHEADER_H +#define _LUACCHEADER_H + +class CLuaCCHeader +{ + public: + CComponentsHeader *ch; + CComponentsForm *parent; + CLuaCCHeader() { ch = NULL; parent = NULL; } + ~CLuaCCHeader() { if (parent == NULL) delete ch; } +}; + +class CLuaInstCCHeader +{ + public: + CLuaInstCCHeader() {}; + ~CLuaInstCCHeader() {}; + static CLuaInstCCHeader* getInstance(); + static void CCHeaderRegister(lua_State *L); + + private: + static CLuaCCHeader *CCHeaderCheck(lua_State *L, int n); + static int CCHeaderNew(lua_State *L); + static int CCHeaderPaint(lua_State *L); + static int CCHeaderHide(lua_State *L); + static int CCHeaderDelete(lua_State *L); + +}; + +#endif //_LUACCHEADER_H diff --git a/src/gui/lua/luainstance.cpp b/src/gui/lua/luainstance.cpp index f02cea774..f3bf6b45f 100644 --- a/src/gui/lua/luainstance.cpp +++ b/src/gui/lua/luainstance.cpp @@ -37,6 +37,7 @@ #include #include "luainstance.h" +#include "lua_cc_header.h" #include "lua_cc_picture.h" #include "lua_cc_signalbox.h" #include "lua_cc_text.h" @@ -605,6 +606,7 @@ void LuaInstRegisterFunctions(lua_State *L, bool fromThreads/*=false*/) lua_settop(L, top); // ------------------------------------------ CLuaInstCCPicture::getInstance()->CCPictureRegister(L); + CLuaInstCCHeader::getInstance()->CCHeaderRegister(L); CLuaInstCCSignalbox::getInstance()->CCSignalBoxRegister(L); CLuaInstCCText::getInstance()->CCTextRegister(L); CLuaInstCCWindow::getInstance()->CCWindowRegister(L); diff --git a/src/gui/lua/luainstance_helpers.h b/src/gui/lua/luainstance_helpers.h index bd4eb571f..5b6dfb141 100644 --- a/src/gui/lua/luainstance_helpers.h +++ b/src/gui/lua/luainstance_helpers.h @@ -29,6 +29,7 @@ #define LUA_VIDEO_CLASSNAME "video" #define LUA_MISC_CLASSNAME "misc" #define LUA_CURL_CLASSNAME "curl" +#define LUA_HEADER_CLASSNAME "header" //#define LUA_WIKI "http://wiki.tuxbox.org/....." #define LUA_WIKI "https://slknet.de/wiki/w" From cb7895d981d4d394c604da0fe755edfe31c9f007 Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Thu, 21 Jan 2016 09:09:33 +0100 Subject: [PATCH 30/33] CLuaInstMisc: Add getTimeOfDay() script function - Set Lua api version to 1.39 --- src/gui/lua/lua_api_version.h | 2 +- src/gui/lua/lua_misc.cpp | 15 +++++++++++++++ src/gui/lua/lua_misc.h | 1 + 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/gui/lua/lua_api_version.h b/src/gui/lua/lua_api_version.h index 9fe6f1a67..f95bdbc54 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 38 +#define LUA_API_VERSION_MINOR 39 diff --git a/src/gui/lua/lua_misc.cpp b/src/gui/lua/lua_misc.cpp index 2c173fe0f..3514f19c8 100644 --- a/src/gui/lua/lua_misc.cpp +++ b/src/gui/lua/lua_misc.cpp @@ -71,6 +71,7 @@ void CLuaInstMisc::LuaMiscRegister(lua_State *L) { "GetRevision", CLuaInstMisc::GetRevision }, { "checkVersion", CLuaInstMisc::checkVersion }, { "postMsg", CLuaInstMisc::postMsg }, + { "getTimeOfDay", CLuaInstMisc::getTimeOfDay }, { "__gc", CLuaInstMisc::MiscDelete }, { NULL, NULL } }; @@ -338,6 +339,20 @@ int CLuaInstMisc::postMsg(lua_State *L) return 0; } +int CLuaInstMisc::getTimeOfDay(lua_State *L) +{ + CLuaMisc *D = MiscCheckData(L, 1); + if (!D) return 0; + + struct timeval t1; + double dt; + gettimeofday(&t1, NULL); + dt = (double)t1.tv_sec + ((double)t1.tv_usec)/1000000ULL; + + lua_pushnumber(L, (lua_Number)dt); + return 1; +} + int CLuaInstMisc::MiscDelete(lua_State *L) { CLuaMisc *D = MiscCheckData(L, 1); diff --git a/src/gui/lua/lua_misc.h b/src/gui/lua/lua_misc.h index 0d4969be7..56ea4023f 100644 --- a/src/gui/lua/lua_misc.h +++ b/src/gui/lua/lua_misc.h @@ -63,6 +63,7 @@ class CLuaInstMisc static int GetRevision(lua_State *L); static int checkVersion(lua_State *L); static int postMsg(lua_State *L); + static int getTimeOfDay(lua_State *L); static int MiscDelete(lua_State *L); static void miscFunctionDeprecated(lua_State *L, std::string oldFunc); From 23242e605c7ec4eda28035d410186db096fbefd7 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Fri, 22 Jan 2016 10:49:45 +0100 Subject: [PATCH 31/33] - infoviewer: fix overlaps on buttons while zapping --- src/gui/infoviewer.cpp | 4 ++-- src/gui/infoviewer_bb.cpp | 4 ++-- src/gui/infoviewer_bb.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index b326b7dca..6ebcd0298 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -1368,7 +1368,7 @@ int CInfoViewer::handleMsg (const neutrino_msg_t msg, neutrino_msg_data_t data) if ((*(t_channel_id *) data) == current_channel_id) { if (is_visible && showButtonBar) { infoViewerBB->showIcon_DD(); - infoViewerBB->showBBButtons(); // in case button text has changed + infoViewerBB->showBBButtons(true /*paintFooter*/); // in case button text has changed } if (g_settings.radiotext_enable && g_Radiotext && !g_RemoteControl->current_PIDs.APIDs.empty() && ((CNeutrinoApp::getInstance()->getMode()) == NeutrinoMessages::mode_radio)) g_Radiotext->setPid(g_RemoteControl->current_PIDs.APIDs[g_RemoteControl->current_PIDs.PIDs.selected_apid].pid); @@ -1377,7 +1377,7 @@ int CInfoViewer::handleMsg (const neutrino_msg_t msg, neutrino_msg_data_t data) } else if (msg == NeutrinoMessages::EVT_ZAP_GOT_SUBSERVICES) { if ((*(t_channel_id *) data) == current_channel_id) { if (is_visible && showButtonBar) - infoViewerBB->showBBButtons(); // in case button text has changed + infoViewerBB->showBBButtons(true /*paintFooter*/); // in case button text has changed } return messages_return::handled; } else if (msg == NeutrinoMessages::EVT_ZAP_SUB_COMPLETE) { diff --git a/src/gui/infoviewer_bb.cpp b/src/gui/infoviewer_bb.cpp index b6c766264..f91408b3b 100644 --- a/src/gui/infoviewer_bb.cpp +++ b/src/gui/infoviewer_bb.cpp @@ -377,7 +377,7 @@ void CInfoViewerBB::getBBButtonInfo() } } -void CInfoViewerBB::showBBButtons(const int modus) +void CInfoViewerBB::showBBButtons(bool paintFooter) { if (!is_visible) return; @@ -406,7 +406,7 @@ void CInfoViewerBB::showBBButtons(const int modus) int buf_y = BBarY; int buf_w = g_InfoViewer->BoxEndX-buf_x; int buf_h = InfoHeightY_Info; - if (modus != -1) { + if (paintFooter) { pixbuf = new fb_pixel_t[buf_w * buf_h]; //printf("\nbuf_x: %d, buf_y: %d, buf_w: %d, buf_h: %d, pixbuf: %p\n \n", buf_x, buf_y, buf_w, buf_h, pixbuf); frameBuffer->SaveScreen(buf_x, buf_y, buf_w, buf_h, pixbuf); diff --git a/src/gui/infoviewer_bb.h b/src/gui/infoviewer_bb.h index 1c690a677..81961a018 100644 --- a/src/gui/infoviewer_bb.h +++ b/src/gui/infoviewer_bb.h @@ -143,7 +143,7 @@ class CInfoViewerBB void showIcon_Resolution(); void showIcon_Tuner(void); void showIcon_DD(void); - void showBBButtons(const int modus=-1); + void showBBButtons(bool paintFooter = false); void paintshowButtonBar(); void getBBButtonInfo(void); void reset_allScala(void); From c8b0ae41039ab16207b7564a06ac387d3de66b96 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 24 Jan 2016 12:21:25 +0100 Subject: [PATCH 32/33] Revert "Revert "rcinput/neutrino: avoid the use of EVT_TIMESET"" This reverts commit 2c64d2fb2b4e47b095b46b80337599af1df82bcc. --- src/driver/rcinput.cpp | 25 +++++++++++++++++++++---- src/neutrino.cpp | 8 ++++++-- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/driver/rcinput.cpp b/src/driver/rcinput.cpp index c11368e01..e8346e09e 100644 --- a/src/driver/rcinput.cpp +++ b/src/driver/rcinput.cpp @@ -4,7 +4,7 @@ Copyright (C) 2001 Steffen Hehn 'McClean' 2003 thegoodguy - Copyright (C) 2008-2012 Stefan Seyfried + Copyright (C) 2008-2014,2016 Stefan Seyfried Copyright (C) 2013-2014 martii License: GPL @@ -519,7 +519,6 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 //static __u16 rc_last_key = KEY_MAX; static __u16 rc_last_repeat_key = KEY_MAX; - struct timeval tv; struct timeval tvselect; uint64_t InitialTimeout = Timeout; int64_t targetTimeout; @@ -1202,6 +1201,7 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 for (int i = 0; i < NUMBER_OF_EVENT_DEVICES; i++) { if ((fd_rc[i] != -1) && (FD_ISSET(fd_rc[i], &rfds))) { + uint64_t now_pressed = 0; t_input_event ev; int ret = read(fd_rc[i], &ev, sizeof(t_input_event)); if (ret != sizeof(t_input_event)) { @@ -1214,6 +1214,22 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 } if (ev.type == EV_SYN) continue; /* ignore... */ + if (ev.value) { + /* try to compensate for possible changes in wall clock + * kernel ev.time default uses CLOCK_REALTIME, as does gettimeofday(). + * so subtract gettimeofday() from ev.time and then add + * CLOCK_MONOTONIC, which is supposed to not change with settimeofday. + * Everything would be much easier if we could use the post-kernel 3.4 + * EVIOCSCLOCKID ioctl :-) */ + struct timespec t1; + now_pressed = ev.time.tv_usec + ev.time.tv_sec * 1000000ULL; + if (!clock_gettime(CLOCK_MONOTONIC, &t1)) { + struct timeval t2; + gettimeofday(&t2, NULL); + now_pressed += t1.tv_sec * 1000000ULL + t1.tv_nsec / 1000; + now_pressed -= (t2.tv_usec + t2.tv_sec * 1000000ULL); + } + } SHTDCNT::getInstance()->resetSleepTimer(); if (ev.value && firstKey) { firstKey = false; @@ -1260,11 +1276,12 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 #ifdef RCDEBUG printf("rc_last_key %04x rc_last_repeat_key %04x\n\n", rc_last_key, rc_last_repeat_key); #endif - uint64_t now_pressed; bool keyok = true; - +#if 0 + uint64_t now_pressed; tv = ev.time; now_pressed = (uint64_t) tv.tv_usec + (uint64_t)((uint64_t) tv.tv_sec * (uint64_t) 1000000); +#endif if (trkey == rc_last_key) { /* only allow selected keys to be repeated */ if (mayRepeat(trkey, bAllowRepeatLR) || diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 1dd14710d..4d1c7dad8 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -5,7 +5,7 @@ and some other guys Homepage: http://dbox.cyberphoria.org/ - Copyright (C) 2006-2014 Stefan Seyfried + Copyright (C) 2006-2016 Stefan Seyfried Copyright (C) 2011 CoolStream International Ltd @@ -1840,7 +1840,11 @@ void CNeutrinoApp::InitZapitClient() void CNeutrinoApp::InitSectiondClient() { g_Sectionsd = new CSectionsdClient; - g_Sectionsd->registerEvent(CSectionsdClient::EVT_TIMESET, 222, NEUTRINO_UDS_NAME); + struct timespec t; + if (clock_gettime(CLOCK_MONOTONIC, &t)) { + dprintf(DEBUG_NORMAL, "CLOCK_MONOTONIC not supported? (%m), falling back to EVT_TIMESET\n"); + g_Sectionsd->registerEvent(CSectionsdClient::EVT_TIMESET, 222, NEUTRINO_UDS_NAME); + } g_Sectionsd->registerEvent(CSectionsdClient::EVT_GOT_CN_EPG, 222, NEUTRINO_UDS_NAME); g_Sectionsd->registerEvent(CSectionsdClient::EVT_EIT_COMPLETE, 222, NEUTRINO_UDS_NAME); g_Sectionsd->registerEvent(CSectionsdClient::EVT_WRITE_SI_FINISHED, 222, NEUTRINO_UDS_NAME); From 7ed61751201d47858c0052c27c01f20f08481ded Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 24 Jan 2016 12:23:00 +0100 Subject: [PATCH 33/33] Revert "- listhelpers: satisfy -Werror" This reverts commit 299852d3886276d04a775aa2d93a009b8dce6dfa. --- src/gui/widget/listhelpers.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/widget/listhelpers.cpp b/src/gui/widget/listhelpers.cpp index 45af70358..9d3adf3ab 100644 --- a/src/gui/widget/listhelpers.cpp +++ b/src/gui/widget/listhelpers.cpp @@ -33,7 +33,7 @@ static int upDownKey(int size, neutrino_msg_t msg, int lines, int sel) return -1; if (msg >= CRCInput::RC_MaxRC) { - printf("CListHelpers:%s: invalid key? 0x%X\n", __func__, msg); + printf("CListHelpers:%s: invalid key? 0x%lx\n", __func__, msg); return -1; } int key = (int)msg; @@ -46,7 +46,7 @@ static int upDownKey(int size, neutrino_msg_t msg, int lines, int sel) else if (msg == CRCInput::RC_down) step = 1; else { - printf("CListHelpers:%s: invalid key? 0x%X\n", __func__, msg); + printf("CListHelpers:%s: invalid key? 0x%lx\n", __func__, msg); return -1; } // printf("CListHelpers:%s: key 0x%04lx lines %d size %d sel %d\n", __func__, msg, lines, size, sel);