diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index b763b31bf..80b09008d 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -2101,8 +2101,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_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 2d4dd0d2e..2c25697a1 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -2101,8 +2101,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_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/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/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 a2df75099..5336d1105 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -295,14 +295,41 @@ 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); + 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)); + 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 +351,30 @@ 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); + 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)); + 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 +405,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 +426,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 +445,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 +471,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 +484,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 +496,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 +654,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 +685,38 @@ 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->enableSaveScreen(true); 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 +738,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 +747,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 +797,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 +907,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 +973,7 @@ int CTimerList::show() } else if (msg==CRCInput::RC_setup) { - update = enterRemoteBox(); + update = RemoteBoxSetup(); } else if (msg==CRCInput::RC_yellow) { @@ -975,7 +1037,7 @@ void CTimerList::hide() } } -bool CTimerList::enterRemoteBox() +bool CTimerList::RemoteBoxSetup() { bool ret = false; remboxmenu = new CMenuWidget(LOCALE_REMOTEBOX_HEAD, NEUTRINO_ICON_TIMER); @@ -985,20 +1047,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 +1132,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 +1214,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 +1746,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 +1756,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/gui/widget/keyboard_input.cpp b/src/gui/widget/keyboard_input.cpp index d6e7341cf..3ff38ab1a 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 diff --git a/src/gui/widget/stringinput.cpp b/src/gui/widget/stringinput.cpp index 748683900..8301a0a99 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 diff --git a/src/neutrino.cpp b/src/neutrino.cpp index f295fde90..9098db426 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 d5638fafa..da5e395db 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -2128,8 +2128,12 @@ typedef enum LOCALE_REMOTEBOX_CHANNEL_NA, LOCALE_REMOTEBOX_DEL, LOCALE_REMOTEBOX_HEAD, - LOCALE_REMOTEBOX_IP, LOCALE_REMOTEBOX_MOD, + 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 a1e106dc3..960c71e3a 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -2128,8 +2128,12 @@ const char * locale_real_names[] = "remotebox_channel_na", "remotebox_del", "remotebox_head", - "remotebox_ip", "remotebox_mod", + "remotebox_pass", + "remotebox_port", + "remotebox_rbaddr", + "remotebox_rbname", + "remotebox_user", "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;