From 96a73691a72de3e796db9271e32b1ce47ef1fe79 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Fri, 28 Oct 2016 09:55:40 +0200 Subject: [PATCH 1/7] textbox: fix box width in round corners mode Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/002277fb5f3d8901eee375d8899b653e1ea7d121 Author: vanhofen Date: 2016-10-28 (Fri, 28 Oct 2016) Origin message was: ------------------ - textbox: fix box width in round corners mode --- src/gui/widget/textbox.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widget/textbox.cpp b/src/gui/widget/textbox.cpp index 5091a2086..7120b7a16 100644 --- a/src/gui/widget/textbox.cpp +++ b/src/gui/widget/textbox.cpp @@ -587,7 +587,7 @@ void CTextBox::refreshText(void) //bg variables int ax = m_cFrameTextRel.iX+m_cFrame.iX; int ay = m_cFrameTextRel.iY+m_cFrame.iY; - int dx = m_old_cText != m_cText || m_nNrOfPages>1 ? m_cFrameTextRel.iWidth : m_nMaxTextWidth; + int dx = m_old_cText != m_cText || m_nNrOfPages>1 ? m_cFrameTextRel.iWidth : m_nMaxTextWidth - m_nBgRadius; int dy = m_cFrameTextRel.iHeight; //avoid artefacts in transparent cornes From 7bafa13c7ed6eb5e595cb02374c14fa1cc93e202 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Fri, 28 Oct 2016 20:50:52 +0200 Subject: [PATCH 2/7] src/gui/osd_setup.cpp try to fix segfault, call from channellist Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/682b6f578e321abff15d77624b8399ee2f86c756 Author: Jacek Jendrzej Date: 2016-10-28 (Fri, 28 Oct 2016) --- src/gui/osd_setup.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/osd_setup.cpp b/src/gui/osd_setup.cpp index 414c6fe00..8a5f85d59 100644 --- a/src/gui/osd_setup.cpp +++ b/src/gui/osd_setup.cpp @@ -1389,7 +1389,7 @@ int COsdSetup::showContextChanlistMenu(CChannelList *parent_channellist) CMenuWidget * menu_chanlist = new CMenuWidget(LOCALE_MAINMENU_SETTINGS, NEUTRINO_ICON_SETTINGS, width); //using native callback to ensure stop header clock in parent channellist before paint this menu window - if (parent_channellist && g_settings.menu_pos == CMenuWidget::MENU_POS_TOP_RIGHT) + if (parent_channellist) menu_chanlist->OnBeforePaint.connect(sigc::mem_fun(parent_channellist->getHeaderObject()->getClockObject(), &CComponentsFrmClock::block)); menu_chanlist->enableSaveScreen(true); From 985775b93cdcd8e769e4d17afac7da2d6ed44d1d Mon Sep 17 00:00:00 2001 From: TangoCash Date: Fri, 28 Oct 2016 22:17:41 +0200 Subject: [PATCH 3/7] add possibility to add Name,Url,Port, Username and Password if needed. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/3776340268df676c8d0ad22bb1f93e1ed8512145 Author: TangoCash Date: 2016-10-28 (Fri, 28 Oct 2016) --- data/locale/deutsch.locale | 6 +- data/locale/english.locale | 6 +- lib/timerdclient/timerdtypes.h | 2 +- src/gui/timerlist.cpp | 149 ++++++++++++++++++++++----------- src/gui/timerlist.h | 12 +-- src/neutrino.cpp | 45 +++++++--- src/system/locals.h | 6 +- src/system/locals_intern.h | 6 +- src/system/settings.h | 11 ++- 9 files changed, 173 insertions(+), 70 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index dc2a2c1b6..cac819112 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -2100,8 +2100,12 @@ remotebox_add hinzufügen remotebox_channel_na Kanal auf Remote-Box nicht verfügbar remotebox_del löschen remotebox_head Remote-Boxen -remotebox_ip Remote-Box IP remotebox_mod bearbeiten +remotebox_user Benutzer +remotebox_pass Passwort +remotebox_port Port +remotebox_rbaddr Adresse +remotebox_rbname Anzeigename reset_all Werkseinstellungen und Reboot reset_channels Lösche Kanäle reset_confirm Sind Sie sich sicher? diff --git a/data/locale/english.locale b/data/locale/english.locale index 220663cbe..c2b581deb 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -2100,8 +2100,12 @@ remotebox_add add remotebox_channel_na Channel not available on Remote-Box remotebox_del delete remotebox_head Remote-Boxes -remotebox_ip Remote-Box IP remotebox_mod modify +remotebox_user User +remotebox_pass Password +remotebox_port Port +remotebox_rbaddr Address +remotebox_rbname Screenname reset_all Factory reset and reboot reset_channels Delete all channels reset_confirm Are you sure ? diff --git a/lib/timerdclient/timerdtypes.h b/lib/timerdclient/timerdtypes.h index 040094c1e..76294f409 100644 --- a/lib/timerdclient/timerdtypes.h +++ b/lib/timerdclient/timerdtypes.h @@ -162,7 +162,7 @@ class CTimerd char pluginName[EXEC_PLUGIN_NAME_MAXLEN]; //only filled if applicable char recordingDir[RECORD_DIR_MAXLEN]; //only filled if applicable char epgTitle[EPG_TITLE_MAXLEN]; //only filled if applicable - char remotebox_ip[16]; + char remotebox_name[25]; int rem_pre; int rem_post; diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index 387371448..556a5030b 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -295,14 +295,36 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey) const char * key = actionKey.c_str(); if(actionKey == "add_ip") { - std::string remoteip; - CIPInput remotebox_NetworkIP(LOCALE_REMOTEBOX_IP , &remoteip); - remotebox_NetworkIP.enableSaveScreen(true); - if ((remotebox_NetworkIP.exec(NULL,"") == true) && (!remoteip.empty())) { - remboxmenu->addItem(new CMenuForwarder(remoteip, true, NULL, this, "cha_ip")); - remotebox_NetworkIP.hide(); + std::string rbname,rbaddress,user,pass = ""; + std::string port = "80"; + CKeyboardInput remotebox_name(LOCALE_REMOTEBOX_RBNAME , &rbname, 25); + CKeyboardInput remotebox_address(LOCALE_REMOTEBOX_RBADDR , &rbaddress, 50); + CStringInput remotebox_port(LOCALE_REMOTEBOX_PORT , &port, 5); + CKeyboardInput remotebox_user(LOCALE_REMOTEBOX_USER , &user, 15); + CKeyboardInput remotebox_pass(LOCALE_REMOTEBOX_PASS , &pass, 15); + CMenuWidget * rbsetup = new CMenuWidget(LOCALE_REMOTEBOX_HEAD, NEUTRINO_ICON_TIMER); + rbsetup->addItem(new CMenuForwarder(LOCALE_REMOTEBOX_RBNAME, true, rbname, &remotebox_name)); + rbsetup->addItem(new CMenuForwarder(LOCALE_REMOTEBOX_RBADDR, true, rbaddress, &remotebox_address)); + rbsetup->addItem(new CMenuForwarder(LOCALE_REMOTEBOX_PORT, true, port, &remotebox_port)); + rbsetup->addItem(new CMenuForwarder(LOCALE_REMOTEBOX_USER, true, user, &remotebox_user)); + rbsetup->addItem(new CMenuForwarder(LOCALE_REMOTEBOX_PASS, true, pass, &remotebox_pass)); + rbsetup->enableSaveScreen(true); + if ((rbsetup->exec(NULL,"") == true) && (!rbaddress.empty())) { + remboxmenu->addItem(new CMenuForwarder(rbname, true, NULL, this, "cha_ip")); + rbsetup->hide(); remboxmenu->enableSaveScreen(false); remboxmenu->hide(); + timer_remotebox_item timer_rb; + timer_rb.rbaddress = rbaddress; + if (!timer_rb.rbaddress.empty()) { + timer_rb.port = atoi(port); + timer_rb.user = user; + timer_rb.pass = pass; + timer_rb.rbname = rbname; + if (timer_rb.rbname.empty()) + timer_rb.rbname = timer_rb.rbaddress; + g_settings.timer_remotebox_ip.push_back(timer_rb); + } changed = true; } return menu_return::RETURN_REPAINT; @@ -324,12 +346,25 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey) bselected = remboxmenu->getSelected(); CMenuItem* item = remboxmenu->getItem(bselected); CMenuForwarder *f = static_cast(item); - std::string remoteip = f->getName(); - CIPInput remotebox_NetworkIP(LOCALE_REMOTEBOX_IP , &remoteip); - remotebox_NetworkIP.enableSaveScreen(true); - if (remotebox_NetworkIP.exec(NULL,"") == true) { - f->setName(remoteip); - remotebox_NetworkIP.hide(); + std::vector::iterator it = g_settings.timer_remotebox_ip.begin(); + std::advance(it,bselected-item_offset); + std::string port = to_string(it->port); + CKeyboardInput remotebox_name(LOCALE_REMOTEBOX_RBNAME , &it->rbname, 25); + CKeyboardInput remotebox_address(LOCALE_REMOTEBOX_RBADDR , &it->rbaddress, 50); + CStringInput remotebox_port(LOCALE_REMOTEBOX_PORT , &port, 5); + CKeyboardInput remotebox_user(LOCALE_REMOTEBOX_USER , &it->user, 15); + CKeyboardInput remotebox_pass(LOCALE_REMOTEBOX_PASS , &it->pass, 15); + CMenuWidget * rbsetup = new CMenuWidget(LOCALE_REMOTEBOX_HEAD, NEUTRINO_ICON_TIMER); + rbsetup->addItem(new CMenuForwarder(LOCALE_REMOTEBOX_RBNAME, true, it->rbname, &remotebox_name)); + rbsetup->addItem(new CMenuForwarder(LOCALE_REMOTEBOX_RBADDR, true, it->rbaddress, &remotebox_address)); + rbsetup->addItem(new CMenuForwarder(LOCALE_REMOTEBOX_PORT, true, port, &remotebox_port)); + rbsetup->addItem(new CMenuForwarder(LOCALE_REMOTEBOX_USER, true, it->user, &remotebox_user)); + rbsetup->addItem(new CMenuForwarder(LOCALE_REMOTEBOX_PASS, true, it->pass, &remotebox_pass)); + rbsetup->enableSaveScreen(true); + if ((rbsetup->exec(NULL,"") == true) && (!it->rbaddress.empty())) { + it->port = atoi(port); + f->setName(it->rbname); + rbsetup->hide(); remboxmenu->enableSaveScreen(false); remboxmenu->hide(); changed = true; @@ -360,7 +395,7 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey) CHTTPTool httpTool; std::string r_url; r_url = "http://"; - r_url += timerlist[selected].remotebox_ip; + r_url += RemoteBoxConnectUrl(timerlist[selected].remotebox_name); r_url += "/control/timer?action=new&update=1"; r_url += "&alarm=" + to_string((int)timerlist[selected].alarmTime); r_url += "&stop=" + to_string((int)timerlist[selected].stopTime); @@ -381,12 +416,12 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey) } return menu_return::RETURN_EXIT; } - else if ((strcmp(key, "send_remotetimer") == 0) && remoteChanExists(timerlist[selected].channel_id)) + else if ((strcmp(key, "send_remotetimer") == 0) && RemoteBoxChanExists(timerlist[selected].channel_id)) { CHTTPTool httpTool; std::string r_url; r_url = "http://"; - r_url += timerlist[selected].remotebox_ip; + r_url += RemoteBoxConnectUrl(timerlist[selected].remotebox_name); r_url += "/control/timer?action=new"; r_url += "&alarm=" + to_string((int)timerlist[selected].alarmTime + timerlist[selected].rem_pre); r_url += "&stop=" + to_string((int)timerlist[selected].stopTime - timerlist[selected].rem_post); @@ -400,11 +435,11 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey) if (r_url=="ok") Timer->removeTimerEvent(timerlist[selected].eventID); } - else if ((strcmp(key, "fetch_remotetimer") == 0) && localChanExists(timerlist[selected].channel_id)) + else if ((strcmp(key, "fetch_remotetimer") == 0) && LocalBoxChanExists(timerlist[selected].channel_id)) { int pre,post; Timer->getRecordingSafety(pre,post); - std::string remotebox_ip = timerlist[selected].remotebox_ip; + std::string remotebox_name = timerlist[selected].remotebox_name; std::string eventID = to_string((int)timerlist[selected].eventID); int res = Timer->addRecordTimerEvent(timerlist[selected].channel_id, timerlist[selected].alarmTime + pre, @@ -426,7 +461,7 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey) CHTTPTool httpTool; std::string r_url; r_url = "http://"; - r_url += remotebox_ip; + r_url += RemoteBoxConnectUrl(remotebox_name); r_url += "/control/timer?action=remove"; r_url += "&id=" + eventID; //printf("[remotetimer] url:%s\n",r_url.c_str()); @@ -439,7 +474,7 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey) CHTTPTool httpTool; std::string r_url; r_url = "http://"; - r_url += timerlist[selected].remotebox_ip; + r_url += RemoteBoxConnectUrl(timerlist[selected].remotebox_name); r_url += "/control/timer?action=remove"; r_url += "&id=" + to_string((int)timerlist[selected].eventID); //printf("[remotetimer] url:%s\n",r_url.c_str()); @@ -451,7 +486,7 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey) CHTTPTool httpTool; std::string r_url; r_url = "http://"; - r_url += timerlist[selected].remotebox_ip; + r_url += RemoteBoxConnectUrl(timerlist[selected].remotebox_name); r_url += "/control/timer?action=new&update=1"; r_url += "&alarm=" + to_string((int)timerlist[selected].alarmTime); r_url += "&stop=" + to_string((int)timerlist[selected].stopTime); @@ -609,7 +644,7 @@ void CTimerList::updateEvents(void) { timerlist.clear(); Timer->getTimerList (timerlist); - remoteTimerList (timerlist); + RemoteBoxTimerList (timerlist); sort(timerlist.begin(), timerlist.end()); theight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); @@ -640,37 +675,37 @@ void CTimerList::updateEvents(void) y = getScreenStartY(height); } -void CTimerList::select_remotebox_ip() +void CTimerList::RemoteBoxSelect() { int select = 0; CMenuWidget *m = new CMenuWidget(LOCALE_REMOTEBOX_HEAD, NEUTRINO_ICON_TIMER); CMenuSelectorTarget * selector = new CMenuSelectorTarget(&select); - for (std::list::iterator it = g_settings.timer_remotebox_ip.begin(); it != g_settings.timer_remotebox_ip.end(); ++it) - m->addItem(new CMenuForwarder(*it, true, NULL, selector, to_string(std::distance(g_settings.timer_remotebox_ip.begin(),it)).c_str())); + for (std::vector::iterator it = g_settings.timer_remotebox_ip.begin(); it != g_settings.timer_remotebox_ip.end(); ++it) + m->addItem(new CMenuForwarder(it->rbname, true, NULL, selector, to_string(std::distance(g_settings.timer_remotebox_ip.begin(),it)).c_str())); m->exec(NULL, ""); delete selector; - std::list::iterator it = g_settings.timer_remotebox_ip.begin(); + std::vector::iterator it = g_settings.timer_remotebox_ip.begin(); std::advance(it,select); - if (askUserOnRemoteTimerConflict(timerlist[selected].announceTime, timerlist[selected].stopTime, (char*) it->c_str())) + if (askUserOnRemoteTimerConflict(timerlist[selected].announceTime, timerlist[selected].stopTime, (char*) it->rbname.c_str())) { - strncpy(timerlist[selected].remotebox_ip,it->c_str(),sizeof(timerlist[selected].remotebox_ip)); - timerlist[selected].remotebox_ip[sizeof(timerlist[selected].remotebox_ip) - 1] = 0; + strncpy(timerlist[selected].remotebox_name,it->rbname.c_str(),sizeof(timerlist[selected].remotebox_name)); + timerlist[selected].remotebox_name[sizeof(timerlist[selected].remotebox_name) - 1] = 0; } } -bool CTimerList::remoteChanExists(t_channel_id channel_id) +bool CTimerList::RemoteBoxChanExists(t_channel_id channel_id) { - if (strcmp(timerlist[selected].remotebox_ip,"") == 0) + if (strcmp(timerlist[selected].remotebox_name,"") == 0) return false; CHTTPTool httpTool; std::string r_url; r_url = "http://"; - r_url += timerlist[selected].remotebox_ip; + r_url += RemoteBoxConnectUrl(timerlist[selected].remotebox_name); r_url += "/control/getchannel?format=json&id="; r_url += string_printf_helper(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, channel_id); r_url = httpTool.downloadString(r_url, -1, httpConnectTimeout); @@ -692,7 +727,7 @@ bool CTimerList::remoteChanExists(t_channel_id channel_id) return (r_url == "true"); } -bool CTimerList::localChanExists(t_channel_id channel_id) +bool CTimerList::LocalBoxChanExists(t_channel_id channel_id) { CZapitChannel * channel = CServiceManager::getInstance()->FindChannel(channel_id); if (channel) @@ -701,17 +736,33 @@ bool CTimerList::localChanExists(t_channel_id channel_id) return false; } -void CTimerList::remoteTimerList(CTimerd::TimerList &rtimerlist) +std::string CTimerList::RemoteBoxConnectUrl(std::string _rbname) +{ + std::string c_url = ""; + for (std::vector::iterator it = g_settings.timer_remotebox_ip.begin(); + it != g_settings.timer_remotebox_ip.end(); ++it) { + if (it->rbname == _rbname) { + if (!it->user.empty() && !it->pass.empty()) + c_url += it->user + ":" + it->pass +"@"; + c_url += it->rbaddress; + c_url += ":" + to_string(it->port); + break; + } + } + return c_url; +} + +void CTimerList::RemoteBoxTimerList(CTimerd::TimerList &rtimerlist) { if (g_settings.timer_remotebox_ip.size() == 0) return; CHTTPTool httpTool; std::string r_url; - for (std::list::iterator it = g_settings.timer_remotebox_ip.begin(); + for (std::vector::iterator it = g_settings.timer_remotebox_ip.begin(); it != g_settings.timer_remotebox_ip.end(); ++it) { r_url = "http://"; - r_url += *it; + r_url += RemoteBoxConnectUrl(it->rbname); r_url += "/control/timer?format=json"; r_url = httpTool.downloadString(r_url, -1, httpConnectTimeout); //printf("[remotetimer] timers:%s\n",r_url.c_str()); @@ -735,8 +786,8 @@ void CTimerList::remoteTimerList(CTimerd::TimerList &rtimerlist) for (unsigned int i= 0; ic_str(),sizeof(rtimer.remotebox_ip)); - rtimer.remotebox_ip[sizeof(rtimer.remotebox_ip) - 1] = 0; + strncpy(rtimer.remotebox_name,it->rbname.c_str(),sizeof(rtimer.remotebox_name)); + rtimer.remotebox_name[sizeof(rtimer.remotebox_name) - 1] = 0; rtimer.rem_pre = rem_pre; rtimer.rem_post = rem_post; rtimer.eventID = atoi(remotetimers[i].get("id","").asString()); @@ -845,7 +896,7 @@ int CTimerList::show() else if ((msg == CRCInput::RC_play) && !(timerlist.empty()) && (g_settings.timer_remotebox_ip.size() > 0)) { if (timerlist[selected].eventType == CTimerd::TIMER_RECORD ) { - select_remotebox_ip(); + RemoteBoxSelect(); if (exec(this,"send_remotetimer")) { res=menu_return::RETURN_EXIT_ALL; @@ -911,7 +962,7 @@ int CTimerList::show() } else if (msg==CRCInput::RC_setup) { - update = enterRemoteBox(); + update = RemoteBoxSetup(); } else if (msg==CRCInput::RC_yellow) { @@ -975,7 +1026,7 @@ void CTimerList::hide() } } -bool CTimerList::enterRemoteBox() +bool CTimerList::RemoteBoxSetup() { bool ret = false; remboxmenu = new CMenuWidget(LOCALE_REMOTEBOX_HEAD, NEUTRINO_ICON_TIMER); @@ -985,20 +1036,24 @@ bool CTimerList::enterRemoteBox() remboxmenu->addIntroItems(); item_offset = remboxmenu->getItemsCount(); - for (std::list::iterator it = g_settings.timer_remotebox_ip.begin(); + for (std::vector::iterator it = g_settings.timer_remotebox_ip.begin(); it != g_settings.timer_remotebox_ip.end(); ++it) - remboxmenu->addItem(new CMenuForwarder(*it, true, NULL, this, "cha_ip")); + remboxmenu->addItem(new CMenuForwarder(it->rbname, true, NULL, this, "cha_ip")); remboxmenu->setFooter(RemoteBoxFooterButtons, RemoteBoxFooterButtonCount); remboxmenu->enableSaveScreen(true); remboxmenu->exec(NULL, ""); if (changed) { + std::vector old_timer_remotebox_ip = g_settings.timer_remotebox_ip; g_settings.timer_remotebox_ip.clear(); for (int i = item_offset; i < remboxmenu->getItemsCount(); i++) { CMenuItem *item = remboxmenu->getItem(i); CMenuForwarder *f = static_cast(item); - g_settings.timer_remotebox_ip.push_back(f->getName()); + for (std::vector::iterator it = old_timer_remotebox_ip.begin(); + it != old_timer_remotebox_ip.end(); ++it) + if (it->rbname == f->getName()) { + g_settings.timer_remotebox_ip.push_back(*it);} } changed = false; ret = true; @@ -1066,7 +1121,7 @@ void CTimerList::paintItem(int pos) sprintf(srepeatcount,"%ux",timer.repeatCount); g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+fw*13+(real_width-fw*23)/2,ypos+fheight, (real_width-fw*13)/2-5, srepeatcount, color, fheight); } - std::string t_type = (timer.eventType == CTimerd::TIMER_REMOTEBOX) ? std::string(convertTimerType2String(timer.eventType)) + " (" + std::string(timer.remotebox_ip) + ")" : convertTimerType2String(timer.eventType); + std::string t_type = (timer.eventType == CTimerd::TIMER_REMOTEBOX) ? std::string(convertTimerType2String(timer.eventType)) + " (" + std::string(timer.remotebox_name) + ")" : convertTimerType2String(timer.eventType); g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+fw*13+(real_width-fw*13)/2,ypos+fheight, (real_width-fw*13)/2-5, t_type, color, fheight); // paint rec icon when recording in progress @@ -1148,7 +1203,7 @@ void CTimerList::paintItem(int pos) CHTTPTool httpTool; std::string r_url; r_url = "http://"; - r_url += std::string(timer.remotebox_ip); + r_url += RemoteBoxConnectUrl(timer.remotebox_name); r_url += "/control/getchannel?format=json&id="; r_url += string_printf_helper(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, timer.channel_id); r_url = httpTool.downloadString(r_url, -1, httpConnectTimeout); @@ -1680,7 +1735,7 @@ int CTimerList::newTimer() return ret; } -bool CTimerList::askUserOnRemoteTimerConflict(time_t announceTime, time_t stopTime, char * remotebox_ip) +bool CTimerList::askUserOnRemoteTimerConflict(time_t announceTime, time_t stopTime, char * remotebox_name) { CTimerd::TimerList overlappingTimers; int pre,post; @@ -1690,7 +1745,7 @@ bool CTimerList::askUserOnRemoteTimerConflict(time_t announceTime, time_t stopTi it != timerlist.end();++it) { - if (strcmp(it->remotebox_ip,remotebox_ip) == 0) { + if (strcmp(it->remotebox_name,remotebox_name) == 0) { if(it->stopTime != 0 && stopTime != 0) { diff --git a/src/gui/timerlist.h b/src/gui/timerlist.h index 329a7fe55..32f2500ff 100644 --- a/src/gui/timerlist.h +++ b/src/gui/timerlist.h @@ -41,6 +41,7 @@ #include #include +#include class CTimerdClient; @@ -86,11 +87,12 @@ class CTimerList : public CMenuTarget, public CListHelpers int newTimer(); /* todo: properly import the enum CVFD::MODES */ int saved_dispmode; - void remoteTimerList(CTimerd::TimerList &timerlist); - bool enterRemoteBox(); - void select_remotebox_ip(); - bool remoteChanExists(t_channel_id channel_id); - bool localChanExists(t_channel_id channel_id); + void RemoteBoxTimerList(CTimerd::TimerList &timerlist); + bool RemoteBoxSetup(); + void RemoteBoxSelect(); + std::string RemoteBoxConnectUrl(std::string _rbname); + bool RemoteBoxChanExists(t_channel_id channel_id); + bool LocalBoxChanExists(t_channel_id channel_id); int rem_pre,rem_post; int item_offset; bool changed; diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 07187bda3..a82795d94 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -459,14 +459,26 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.sleeptimer_min = configfile.getInt32("sleeptimer_min", 0); g_settings.timer_remotebox_ip.clear(); - int timer_remotebox_ip_count = configfile.getInt32("timer_remotebox_ip_count", 0); - if (timer_remotebox_ip_count) { - for (int i = 0; i < timer_remotebox_ip_count; i++) { - std::string k = "timer_remotebox_ip_" + to_string(i); - std::string timer_remotebox_ip = configfile.getString(k, ""); - if (timer_remotebox_ip.empty()) + int timer_remotebox_itemcount = configfile.getInt32("timer_remotebox_ip_count", 0); + if (timer_remotebox_itemcount) { + for (int i = 0; i < timer_remotebox_itemcount; i++) { + timer_remotebox_item timer_rb; + std::string k; + k = "timer_remotebox_ip_" + to_string(i); + timer_rb.rbaddress = configfile.getString(k, ""); + if (timer_rb.rbaddress.empty()) continue; - g_settings.timer_remotebox_ip.push_back(timer_remotebox_ip); + k = "timer_remotebox_port_" + to_string(i); + timer_rb.port = configfile.getInt32(k, 80); + k = "timer_remotebox_user_" + to_string(i); + timer_rb.user = configfile.getString(k, ""); + k = "timer_remotebox_pass_" + to_string(i); + timer_rb.pass = configfile.getString(k, ""); + k = "timer_remotebox_rbname_" + to_string(i); + timer_rb.rbname = configfile.getString(k, ""); + if (timer_rb.rbname.empty()) + timer_rb.rbname = timer_rb.rbaddress; + g_settings.timer_remotebox_ip.push_back(timer_rb); } } @@ -1056,11 +1068,20 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setInt32("shutdown_min" , g_settings.shutdown_min ); configfile.setInt32("sleeptimer_min", g_settings.sleeptimer_min); - int timer_remotebox_ip_count = 0; - for (std::list::iterator it = g_settings.timer_remotebox_ip.begin(); it != g_settings.timer_remotebox_ip.end(); ++it) { - std::string k = "timer_remotebox_ip_" + to_string(timer_remotebox_ip_count); - configfile.setString(k, *it); - timer_remotebox_ip_count++; + int timer_remotebox_itemcount = 0; + for (std::vector::iterator it = g_settings.timer_remotebox_ip.begin(); it != g_settings.timer_remotebox_ip.end(); ++it) { + std::string k; + k = "timer_remotebox_ip_" + to_string(timer_remotebox_itemcount); + configfile.setString(k, it->rbaddress); + k = "timer_remotebox_rbname_" + to_string(timer_remotebox_itemcount); + configfile.setString(k, it->rbname); + k = "timer_remotebox_user_" + to_string(timer_remotebox_itemcount); + configfile.setString(k, it->user); + k = "timer_remotebox_pass_" + to_string(timer_remotebox_itemcount); + configfile.setString(k, it->pass); + k = "timer_remotebox_port_" + to_string(timer_remotebox_itemcount); + configfile.setInt32(k, it->port); + timer_remotebox_itemcount++; } configfile.setInt32 ( "timer_remotebox_ip_count", g_settings.timer_remotebox_ip.size()); diff --git a/src/system/locals.h b/src/system/locals.h index f94923248..b705a9f65 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -2127,8 +2127,12 @@ typedef enum LOCALE_REMOTEBOX_CHANNEL_NA, LOCALE_REMOTEBOX_DEL, LOCALE_REMOTEBOX_HEAD, - LOCALE_REMOTEBOX_IP, LOCALE_REMOTEBOX_MOD, + LOCALE_REMOTEBOX_USER, + LOCALE_REMOTEBOX_PASS, + LOCALE_REMOTEBOX_PORT, + LOCALE_REMOTEBOX_RBADDR, + LOCALE_REMOTEBOX_RBNAME, LOCALE_RESET_ALL, LOCALE_RESET_CHANNELS, LOCALE_RESET_CONFIRM, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 482e7d875..b0e4ade50 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -2127,8 +2127,12 @@ const char * locale_real_names[] = "remotebox_channel_na", "remotebox_del", "remotebox_head", - "remotebox_ip", "remotebox_mod", + "remotebox_user", + "remotebox_pass", + "remotebox_port", + "remotebox_rbaddr", + "remotebox_rbname", "reset_all", "reset_channels", "reset_confirm", diff --git a/src/system/settings.h b/src/system/settings.h index 6744aaaae..60f322cbf 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -145,6 +145,15 @@ struct SNeutrinoTheme unsigned char clock_Digit_blue; }; +struct timer_remotebox_item +{ + unsigned int port; + std::string user; + std::string pass; + std::string rbname; + std::string rbaddress; +}; + struct SNeutrinoSettings { std::string version_pseudo; @@ -450,7 +459,7 @@ struct SNeutrinoSettings int recording_slow_warning; int recording_startstop_msg; int shutdown_timer_record_type; - std::list timer_remotebox_ip; + std::vector timer_remotebox_ip; std::string recording_filename_template; int recording_already_found_check; From 7cee609cbb9434fd13f9f878692c7a16dc2b20f0 Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Sat, 29 Oct 2016 08:20:22 +0200 Subject: [PATCH 4/7] Sort locale Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/373ae57e42163eed79202ab8f46bf238528749b7 Author: Michael Liebmann Date: 2016-10-29 (Sat, 29 Oct 2016) --- data/locale/deutsch.locale | 2 +- data/locale/english.locale | 2 +- src/system/locals.h | 2 +- src/system/locals_intern.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index cac819112..f6638ea2f 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -2101,11 +2101,11 @@ remotebox_channel_na Kanal auf Remote-Box nicht verfügbar remotebox_del löschen remotebox_head Remote-Boxen remotebox_mod bearbeiten -remotebox_user Benutzer remotebox_pass Passwort remotebox_port Port remotebox_rbaddr Adresse remotebox_rbname Anzeigename +remotebox_user Benutzer reset_all Werkseinstellungen und Reboot reset_channels Lösche Kanäle reset_confirm Sind Sie sich sicher? diff --git a/data/locale/english.locale b/data/locale/english.locale index c2b581deb..a5a01372d 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -2101,11 +2101,11 @@ remotebox_channel_na Channel not available on Remote-Box remotebox_del delete remotebox_head Remote-Boxes remotebox_mod modify -remotebox_user User remotebox_pass Password remotebox_port Port remotebox_rbaddr Address remotebox_rbname Screenname +remotebox_user User reset_all Factory reset and reboot reset_channels Delete all channels reset_confirm Are you sure ? diff --git a/src/system/locals.h b/src/system/locals.h index b705a9f65..fc3447568 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -2128,11 +2128,11 @@ typedef enum LOCALE_REMOTEBOX_DEL, LOCALE_REMOTEBOX_HEAD, LOCALE_REMOTEBOX_MOD, - LOCALE_REMOTEBOX_USER, LOCALE_REMOTEBOX_PASS, LOCALE_REMOTEBOX_PORT, LOCALE_REMOTEBOX_RBADDR, LOCALE_REMOTEBOX_RBNAME, + LOCALE_REMOTEBOX_USER, LOCALE_RESET_ALL, LOCALE_RESET_CHANNELS, LOCALE_RESET_CONFIRM, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index b0e4ade50..b1cce4e60 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -2128,11 +2128,11 @@ const char * locale_real_names[] = "remotebox_del", "remotebox_head", "remotebox_mod", - "remotebox_user", "remotebox_pass", "remotebox_port", "remotebox_rbaddr", "remotebox_rbname", + "remotebox_user", "reset_all", "reset_channels", "reset_confirm", From ca6a5d59753eca1aeedd505b47a4b134f97ac2f3 Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Sat, 29 Oct 2016 08:20:32 +0200 Subject: [PATCH 5/7] CStringInput: Make saveScreen changeable with forceSaveScreen() Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/0e22860ac05aa80fb84face560e424a349248835 Author: Michael Liebmann Date: 2016-10-29 (Sat, 29 Oct 2016) --- src/gui/widget/stringinput.cpp | 29 +++++++++++++++++++++-------- src/gui/widget/stringinput.h | 4 ++++ 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/gui/widget/stringinput.cpp b/src/gui/widget/stringinput.cpp index b47a99c4e..8fa986268 100644 --- a/src/gui/widget/stringinput.cpp +++ b/src/gui/widget/stringinput.cpp @@ -150,6 +150,8 @@ void CStringInput::init() y = getScreenStartY(height); selected = 0; smstimer = 0; + force_saveScreen = false; + pixBuf = NULL; } void CStringInput::NormalKeyPressed(const neutrino_msg_t key) @@ -377,6 +379,15 @@ std::string &CStringInput::getValue(void) return *valueString; } +void CStringInput::forceSaveScreen(bool enable) +{ + force_saveScreen = enable; + if (!enable && pixBuf) { + delete[] pixBuf; + pixBuf = NULL; + } +} + int CStringInput::exec( CMenuTarget* parent, const std::string & ) { neutrino_msg_t msg; @@ -392,11 +403,12 @@ int CStringInput::exec( CMenuTarget* parent, const std::string & ) if (size > (int) valueString->length()) valueString->append(size - valueString->length(), ' '); - fb_pixel_t * pixbuf = NULL; - if (!parent) { - pixbuf = new fb_pixel_t[(width + OFFSET_SHADOW) * (height + OFFSET_SHADOW)]; - if (pixbuf) - frameBuffer->SaveScreen(x, y, width + OFFSET_SHADOW, height + OFFSET_SHADOW, pixbuf); + if (pixBuf) + delete[] pixBuf; + if (!parent || force_saveScreen) { + pixBuf = new fb_pixel_t[(width + OFFSET_SHADOW) * (height + OFFSET_SHADOW)]; + if (pixBuf) + frameBuffer->SaveScreen(x, y, width + OFFSET_SHADOW, height + OFFSET_SHADOW, pixBuf); } paint(); @@ -517,10 +529,11 @@ int CStringInput::exec( CMenuTarget* parent, const std::string & ) } } - if (pixbuf) + if (pixBuf) { - frameBuffer->RestoreScreen(x, y, width + OFFSET_SHADOW, height + OFFSET_SHADOW, pixbuf); - delete[] pixbuf;//Mismatching allocation and deallocation: pixbuf + frameBuffer->RestoreScreen(x, y, width + OFFSET_SHADOW, height + OFFSET_SHADOW, pixBuf); + delete[] pixBuf; + pixBuf = NULL; frameBuffer->blit(); } else hide(); diff --git a/src/gui/widget/stringinput.h b/src/gui/widget/stringinput.h index 2a8d9bcd4..d435a7f84 100644 --- a/src/gui/widget/stringinput.h +++ b/src/gui/widget/stringinput.h @@ -61,6 +61,8 @@ class CStringInput : public CMenuTarget int size; int selected; CChangeObserver * observ; + bool force_saveScreen; + fb_pixel_t *pixBuf; virtual void init(); @@ -91,6 +93,8 @@ class CStringInput : public CMenuTarget int exec( CMenuTarget* parent, const std::string & actionKey ); void setMinMax(const int min_value, const int max_value); virtual std::string &getValue(void); + + void forceSaveScreen(bool enable); }; class CStringInputSMS : public CStringInput From e564e864e4bd21365dd2e6b8b3063c60a77c66d9 Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Sat, 29 Oct 2016 08:20:36 +0200 Subject: [PATCH 6/7] CKeyboardInput: Make saveScreen changeable with forceSaveScreen() Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/74b0ce7f7061abc30b094eb12d2956ef42c97c93 Author: Michael Liebmann Date: 2016-10-29 (Sat, 29 Oct 2016) --- src/gui/widget/keyboard_input.cpp | 34 +++++++++++++++++++++++-------- src/gui/widget/keyboard_input.h | 4 ++++ 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/src/gui/widget/keyboard_input.cpp b/src/gui/widget/keyboard_input.cpp index 72cd73dfc..a7f574cfe 100644 --- a/src/gui/widget/keyboard_input.cpp +++ b/src/gui/widget/keyboard_input.cpp @@ -199,6 +199,8 @@ CKeyboardInput::CKeyboardInput(const neutrino_locale_t Name, std::string* Value, caps = 0; srow = scol = 0; focus = FOCUS_STRING; + force_saveScreen = false; + pixBuf = NULL; } CKeyboardInput::CKeyboardInput(const std::string &Name, std::string *Value, int Size, CChangeObserver* Observ, const char * const Icon, const neutrino_locale_t Hint_1, const neutrino_locale_t Hint_2) @@ -221,6 +223,8 @@ CKeyboardInput::CKeyboardInput(const std::string &Name, std::string *Value, int caps = 0; srow = scol = 0; focus = FOCUS_STRING; + force_saveScreen = false; + pixBuf = NULL; } CKeyboardInput::CKeyboardInput(const std::string &Name, std::string *Value, int Size, CChangeObserver* Observ, const char * const Icon, std::string HintText_1, std::string HintText_2) @@ -243,6 +247,8 @@ CKeyboardInput::CKeyboardInput(const std::string &Name, std::string *Value, int caps = 0; srow = scol = 0; focus = FOCUS_STRING; + force_saveScreen = false; + pixBuf = NULL; } CKeyboardInput::~CKeyboardInput() @@ -515,6 +521,15 @@ std::string &CKeyboardInput::getValue(void) return *valueString; } +void CKeyboardInput::forceSaveScreen(bool enable) +{ + force_saveScreen = enable; + if (!enable && pixBuf) { + delete[] pixBuf; + pixBuf = NULL; + } +} + int CKeyboardInput::exec(CMenuTarget* parent, const std::string &) { neutrino_msg_t msg; @@ -528,11 +543,12 @@ int CKeyboardInput::exec(CMenuTarget* parent, const std::string &) std::string oldval = *valueString; - fb_pixel_t * pixbuf = NULL; - if (!parent) { - pixbuf = new fb_pixel_t[(width + OFFSET_SHADOW) * (height + OFFSET_SHADOW)]; - if (pixbuf) - frameBuffer->SaveScreen(x, y, width + OFFSET_SHADOW, height + OFFSET_SHADOW, pixbuf); + if (pixBuf) + delete[] pixBuf; + if (!parent || force_saveScreen) { + pixBuf = new fb_pixel_t[(width + OFFSET_SHADOW) * (height + OFFSET_SHADOW)]; + if (pixBuf) + frameBuffer->SaveScreen(x, y, width + OFFSET_SHADOW, height + OFFSET_SHADOW, pixBuf); } paint(); @@ -624,10 +640,12 @@ int CKeyboardInput::exec(CMenuTarget* parent, const std::string &) } } - if (pixbuf) + if (pixBuf) { - frameBuffer->RestoreScreen(x, y, width + OFFSET_SHADOW, height + OFFSET_SHADOW, pixbuf); - delete[] pixbuf; + frameBuffer->RestoreScreen(x, y, width + OFFSET_SHADOW, height + OFFSET_SHADOW, pixBuf); + delete[] pixBuf; + pixBuf = NULL; + frameBuffer->blit(); } else hide(); diff --git a/src/gui/widget/keyboard_input.h b/src/gui/widget/keyboard_input.h index 009934b4a..1003e7f39 100644 --- a/src/gui/widget/keyboard_input.h +++ b/src/gui/widget/keyboard_input.h @@ -101,6 +101,8 @@ class CKeyboardInput : public CMenuTarget int selected; bool changed; CChangeObserver * observ; + bool force_saveScreen; + fb_pixel_t *pixBuf; virtual void init(); @@ -133,6 +135,8 @@ class CKeyboardInput : public CMenuTarget void hide(); int exec( CMenuTarget* parent, const std::string & actionKey ); virtual std::string &getValue(void); + + void forceSaveScreen(bool enable); }; #endif From ca4121947f570314382dec15178ae041fa611ffc Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Sat, 29 Oct 2016 08:20:40 +0200 Subject: [PATCH 7/7] Use forceSaveScreen() in COsdSetup & CTimerList Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/e5402057d3148bbb98ef6b218de0905b2b0c96db Author: Michael Liebmann Date: 2016-10-29 (Sat, 29 Oct 2016) --- src/gui/osd_setup.cpp | 1 + src/gui/timerlist.cpp | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/gui/osd_setup.cpp b/src/gui/osd_setup.cpp index 8a5f85d59..e14f12de4 100644 --- a/src/gui/osd_setup.cpp +++ b/src/gui/osd_setup.cpp @@ -922,6 +922,7 @@ public: while (value.length() < 3) value = " " + value; CStringInput input(name, &value, 3, LOCALE_IPSETUP_HINT_1, LOCALE_IPSETUP_HINT_2, "0123456789 ", this); + input.forceSaveScreen(true); return input.exec(parent, action_Key); } diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index 556a5030b..60b6ce892 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -298,10 +298,15 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey) std::string rbname,rbaddress,user,pass = ""; std::string port = "80"; CKeyboardInput remotebox_name(LOCALE_REMOTEBOX_RBNAME , &rbname, 25); + remotebox_name.forceSaveScreen(true); CKeyboardInput remotebox_address(LOCALE_REMOTEBOX_RBADDR , &rbaddress, 50); + remotebox_address.forceSaveScreen(true); CStringInput remotebox_port(LOCALE_REMOTEBOX_PORT , &port, 5); + remotebox_port.forceSaveScreen(true); CKeyboardInput remotebox_user(LOCALE_REMOTEBOX_USER , &user, 15); + remotebox_user.forceSaveScreen(true); CKeyboardInput remotebox_pass(LOCALE_REMOTEBOX_PASS , &pass, 15); + remotebox_pass.forceSaveScreen(true); CMenuWidget * rbsetup = new CMenuWidget(LOCALE_REMOTEBOX_HEAD, NEUTRINO_ICON_TIMER); rbsetup->addItem(new CMenuForwarder(LOCALE_REMOTEBOX_RBNAME, true, rbname, &remotebox_name)); rbsetup->addItem(new CMenuForwarder(LOCALE_REMOTEBOX_RBADDR, true, rbaddress, &remotebox_address)); @@ -350,10 +355,15 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey) std::advance(it,bselected-item_offset); std::string port = to_string(it->port); CKeyboardInput remotebox_name(LOCALE_REMOTEBOX_RBNAME , &it->rbname, 25); + remotebox_name.forceSaveScreen(true); CKeyboardInput remotebox_address(LOCALE_REMOTEBOX_RBADDR , &it->rbaddress, 50); + remotebox_address.forceSaveScreen(true); CStringInput remotebox_port(LOCALE_REMOTEBOX_PORT , &port, 5); + remotebox_port.forceSaveScreen(true); CKeyboardInput remotebox_user(LOCALE_REMOTEBOX_USER , &it->user, 15); + remotebox_user.forceSaveScreen(true); CKeyboardInput remotebox_pass(LOCALE_REMOTEBOX_PASS , &it->pass, 15); + remotebox_pass.forceSaveScreen(true); CMenuWidget * rbsetup = new CMenuWidget(LOCALE_REMOTEBOX_HEAD, NEUTRINO_ICON_TIMER); rbsetup->addItem(new CMenuForwarder(LOCALE_REMOTEBOX_RBNAME, true, it->rbname, &remotebox_name)); rbsetup->addItem(new CMenuForwarder(LOCALE_REMOTEBOX_RBADDR, true, it->rbaddress, &remotebox_address)); @@ -684,6 +694,7 @@ void CTimerList::RemoteBoxSelect() for (std::vector::iterator it = g_settings.timer_remotebox_ip.begin(); it != g_settings.timer_remotebox_ip.end(); ++it) m->addItem(new CMenuForwarder(it->rbname, true, NULL, selector, to_string(std::distance(g_settings.timer_remotebox_ip.begin(),it)).c_str())); + m->enableSaveScreen(true); m->exec(NULL, ""); delete selector;