diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index f87c2006e..92dc38778 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -2091,6 +2091,12 @@ recordingmenu.vcr Videorekorder recordingmenu.vtxt_pid Teletext aufnehmen recordingmenu.zap_on_announce Umschalten bei Ankündigung recordtimer.announce Die Aufnahme beginnt in wenigen Minuten. +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 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 a599cea3c..de9e55ee9 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -2091,6 +2091,12 @@ recordingmenu.vcr vcr recordingmenu.vtxt_pid record teletext recordingmenu.zap_on_announce zap on recording announce recordtimer.announce Recording starts in a few minutes +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 reset_all Factory reset and reboot reset_channels Delete all channels reset_confirm Are you sure ? diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index 14bf92e16..d4ebfd2c6 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -3,6 +3,8 @@ Timerliste by Zwen (C) 2009, 2011-2014 Stefan Seyfried + Remote Timers by + (C) 2016 TangoCash Homepage: http://dbox.cyberphoria.org/ @@ -291,6 +293,42 @@ 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); + if (remotebox_NetworkIP.exec(NULL,"") == true) { + remboxmenu->addItem(new CMenuForwarder(remoteip, true, NULL, this, "cha_ip")); + remotebox_NetworkIP.hide(); + changed = true; + } + return menu_return::RETURN_EXIT; + } + + if(actionKey == "del_ip") { + selected = remboxmenu->getSelected(); + if (selected >= item_offset) { + remboxmenu->removeItem(selected); + remboxmenu->hide(); + selected = remboxmenu->getSelected(); + changed = true; + } + return menu_return::RETURN_EXIT; + } + + if(actionKey == "cha_ip") { + selected = remboxmenu->getSelected(); + CMenuItem* item = remboxmenu->getItem(selected); + CMenuForwarder *f = static_cast(item); + std::string remoteip = f->getName(); + CIPInput remotebox_NetworkIP(LOCALE_REMOTEBOX_IP , &remoteip); + if (remotebox_NetworkIP.exec(NULL,"") == true) { + f->setName(remoteip); + remotebox_NetworkIP.hide(); + changed = true; + } + return menu_return::RETURN_EXIT; + } + if (strcmp(key, "modifytimer") == 0) { timerlist[selected].announceTime = timerlist[selected].alarmTime -60; @@ -536,6 +574,13 @@ struct button_label TimerListButtons[TimerListButtonsCount] = { NEUTRINO_ICON_BUTTON_MENU_SMALL, NONEXISTANT_LOCALE } }; +#define RemoteBoxFooterButtonCount 3 +static const struct button_label RemoteBoxFooterButtons[RemoteBoxFooterButtonCount] = { + { NEUTRINO_ICON_BUTTON_RED, LOCALE_REMOTEBOX_DEL }, + { NEUTRINO_ICON_BUTTON_GREEN, LOCALE_REMOTEBOX_ADD }, + { NEUTRINO_ICON_BUTTON_OKAY, LOCALE_REMOTEBOX_MOD } +}; + void CTimerList::updateEvents(void) { timerlist.clear(); @@ -580,13 +625,13 @@ void CTimerList::select_remotebox_ip() } int select = 0; - CMenuWidget *m = new CMenuWidget(LOCALE_TIMERLIST_NAME, NEUTRINO_ICON_TIMER); + 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())); - int res = m->exec(NULL, ""); + m->exec(NULL, ""); delete selector; @@ -617,7 +662,7 @@ bool CTimerList::remoteChanExists(t_channel_id channel_id) r_url = root.get("success","false").asString(); if (r_url == "false") - ShowMsg(LOCALE_STREAMINFO_NOT_AVAILABLE, convertChannelId2String(channel_id), + ShowMsg(LOCALE_REMOTEBOX_CHANNEL_NA, convertChannelId2String(channel_id), CMessageBox::mbrOk, CMessageBox::mbOk, NULL, 450, 30, false); return (r_url == "true"); @@ -915,13 +960,31 @@ void CTimerList::hide() void CTimerList::enterRemoteBox() { -/* - CMenuWidget* remboxmenu = new CMenuWidget(LOCALE_MAINSETTINGS_HEAD, NEUTRINO_ICON_SETTINGS, 40, MN_WIDGET_ID_NETWORKSETUP); - CIPInput remotebox_NetworkIP(LOCALE_NETWORKMENU_IPADDRESS , &g_settings.remotebox_address); - CMenuForwarder *m1 = new CMenuForwarder(LOCALE_NETWORKMENU_IPADDRESS , true, g_settings.remotebox_address , &remotebox_NetworkIP ); - remboxmenu->addItem( m1); + remboxmenu = new CMenuWidget(LOCALE_REMOTEBOX_HEAD, NEUTRINO_ICON_TIMER); + remboxmenu->addKey(CRCInput::RC_red, this, "del_ip"); + remboxmenu->addKey(CRCInput::RC_green, this, "add_ip"); + + remboxmenu->addIntroItems(); + + item_offset = remboxmenu->getItemsCount(); + for (std::list::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->setFooter(RemoteBoxFooterButtons, RemoteBoxFooterButtonCount); + remboxmenu->exec(NULL, ""); -*/ + remboxmenu->hide(); + if (changed) { + 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()); + } + changed = false; + } + delete remboxmenu; } void CTimerList::paintItem(int pos) diff --git a/src/gui/timerlist.h b/src/gui/timerlist.h index 2085d8e98..8d31b84e9 100644 --- a/src/gui/timerlist.h +++ b/src/gui/timerlist.h @@ -91,6 +91,9 @@ class CTimerList : public CMenuTarget, public CListHelpers bool remoteChanExists(t_channel_id channel_id); bool localChanExists(t_channel_id channel_id); int rem_pre,rem_post; + int item_offset; + bool changed; + CMenuWidget *remboxmenu; public: CTimerList(); diff --git a/src/system/locals.h b/src/system/locals.h index 1d7b43b3a..f66030446 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -2118,6 +2118,12 @@ typedef enum LOCALE_RECORDINGMENU_VTXT_PID, LOCALE_RECORDINGMENU_ZAP_ON_ANNOUNCE, LOCALE_RECORDTIMER_ANNOUNCE, + LOCALE_REMOTEBOX_ADD, + LOCALE_REMOTEBOX_CHANNEL_NA, + LOCALE_REMOTEBOX_DEL, + LOCALE_REMOTEBOX_HEAD, + LOCALE_REMOTEBOX_IP, + LOCALE_REMOTEBOX_MOD, LOCALE_RESET_ALL, LOCALE_RESET_CHANNELS, LOCALE_RESET_CONFIRM, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index f8bfb6dec..2439efe55 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -2118,6 +2118,12 @@ const char * locale_real_names[] = "recordingmenu.vtxt_pid", "recordingmenu.zap_on_announce", "recordtimer.announce", + "remotebox_add", + "remotebox_channel_na", + "remotebox_del", + "remotebox_head", + "remotebox_ip", + "remotebox_mod", "reset_all", "reset_channels", "reset_confirm",