From 9184ac6266a0419910a46480a4de28a710d619c4 Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Sun, 23 Feb 2014 20:59:46 +0100 Subject: [PATCH 001/225] CLuaInstance: Rename componentstext to ctext - Better readability and consistent designation - Still not a problem since API not yet public --- src/gui/luainstance.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/luainstance.cpp b/src/gui/luainstance.cpp index 699b2ba21..046f783de 100644 --- a/src/gui/luainstance.cpp +++ b/src/gui/luainstance.cpp @@ -1490,7 +1490,7 @@ int CLuaInstance::SignalBoxDelete(lua_State *L) CLuaComponentsText *CLuaInstance::ComponentsTextCheck(lua_State *L, int n) { - return *(CLuaComponentsText **) luaL_checkudata(L, n, "componentstext"); + return *(CLuaComponentsText **) luaL_checkudata(L, n, "ctext"); } void CLuaInstance::ComponentsTextRegister(lua_State *L) @@ -1504,11 +1504,11 @@ void CLuaInstance::ComponentsTextRegister(lua_State *L) { NULL, NULL } }; - luaL_newmetatable(L, "componentstext"); + luaL_newmetatable(L, "ctext"); luaL_setfuncs(L, meth, 0); lua_pushvalue(L, -1); lua_setfield(L, -1, "__index"); - lua_setglobal(L, "componentstext"); + lua_setglobal(L, "ctext"); } int CLuaInstance::ComponentsTextNew(lua_State *L) @@ -1564,7 +1564,7 @@ int CLuaInstance::ComponentsTextNew(lua_State *L) CLuaComponentsText **udata = (CLuaComponentsText **) lua_newuserdata(L, sizeof(CLuaComponentsText *)); *udata = new CLuaComponentsText(); (*udata)->ct = new CComponentsText(x, y, dx, dy, text, mode, g_Font[font_text], has_shadow, (fb_pixel_t)color_text, (fb_pixel_t)color_frame, (fb_pixel_t)color_body, (fb_pixel_t)color_shadow); - luaL_getmetatable(L, "componentstext"); + luaL_getmetatable(L, "ctext"); lua_setmetatable(L, -2); return 1; } From 7826ab0fcad8bc98975d07a99e6e66c5c2aae753 Mon Sep 17 00:00:00 2001 From: martii Date: Tue, 25 Feb 2014 00:09:14 +0100 Subject: [PATCH 002/225] driver/rcinput: implement long key press support (but no rcsim/yWeb support at this time) driver/rcinput: drop unused gettimeofday code --- data/locale/deutsch.locale | 2 + data/locale/english.locale | 2 + src/driver/rcinput.cpp | 308 ++++++++++++++++++---------------- src/driver/rcinput.h | 16 +- src/gui/keybind_setup.cpp | 20 +++ src/gui/widget/keychooser.cpp | 2 + src/neutrino.cpp | 2 + src/system/helpers.h | 3 + src/system/locals.h | 2 + src/system/locals_intern.h | 2 + src/system/settings.h | 2 + 11 files changed, 215 insertions(+), 146 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index fbc619da5..287f53b3c 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -674,6 +674,7 @@ keybindingmenu.channellist Kanalliste keybindingmenu.channelup Kanal hoch keybindingmenu.head Tasten-Belegungen bearbeiten keybindingmenu.lastchannel Letzter Kanal +keybindingmenu.longkeypress_duration Langer Tastendruck keybindingmenu.misc Sonstige keybindingmenu.mode_left_right_key_tv Funktion li/re Tasten im TV-Modus keybindingmenu.mode_left_right_key_tv_infobar Infobar einblenden @@ -958,6 +959,7 @@ menu.hint_leds_record Definiert, ob die Power-LEDs blinken sollen, wenn eine Auf menu.hint_leds_standby Definiert den Status der Power-LEDs im Standby menu.hint_leds_tv Definiert den Status der Power-LEDs im TV-Modus menu.hint_load Laden der Neutrino-HD-Einstellungen aus einer Datei +menu.hint_longkeypress_duration Tasten, die länger als die angegebene Zeit betätigt werden, werden als "langer Tastendruck" behandelt. menu.hint_lua Plugins ausführen menu.hint_make_hdlist Bei aktiver Option wird ein Bouquet namens 'HD' erzeugt, in dem alle HD-Sender zusammengefasst sind menu.hint_make_newlist Nach einer Kanalsuche wird ein Bouquet namens 'neue Kanäle' erzeugt diff --git a/data/locale/english.locale b/data/locale/english.locale index ec15f61b5..88f3c24d8 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -674,6 +674,7 @@ keybindingmenu.channellist Channellist keybindingmenu.channelup channel up keybindingmenu.head Edit Keybindings keybindingmenu.lastchannel Quick Zap +keybindingmenu.longkeypress_duration Long key-press keybindingmenu.misc Misc keybindingmenu.mode_left_right_key_tv Left/Right Key Behavior in TV-Mode keybindingmenu.mode_left_right_key_tv_infobar Show Infobar @@ -958,6 +959,7 @@ menu.hint_leds_record LEDs state when box recording menu.hint_leds_standby LEDs state in soft-standby mode menu.hint_leds_tv Working LEDs state menu.hint_load Load Neutrino-HD GUI settings from file +menu.hint_longkeypress_duration A key press will be considered as "long key press" if it's pressed longer than the specified time. menu.hint_lua Run Plugins menu.hint_make_hdlist Auto-create HD channel list based on\nchannel type and name menu.hint_make_newlist Create list of recently added channels diff --git a/src/driver/rcinput.cpp b/src/driver/rcinput.cpp index 2c39718b6..d10aa2164 100644 --- a/src/driver/rcinput.cpp +++ b/src/driver/rcinput.cpp @@ -5,6 +5,7 @@ 2003 thegoodguy Copyright (C) 2008-2012 Stefan Seyfried + Copyright (C) 2013-2014 martii License: GPL @@ -29,6 +30,7 @@ #include #include +#include #include #include @@ -42,6 +44,7 @@ #endif /* KEYBOARD_INSTEAD_OF_REMOTE_CONTROL */ #include #include +#include #include #include @@ -51,12 +54,14 @@ #include #include -#include +//#include +#include #include +#include +#include #include //#define RCDEBUG -//#define USE_GETTIMEOFDAY #define ENABLE_REPEAT_CHECK @@ -67,6 +72,7 @@ typedef struct input_event t_input_event; static struct termio orig_termio; static bool saved_orig_termio = false; #endif /* KEYBOARD_INSTEAD_OF_REMOTE_CONTROL */ +static bool input_stopped = false; /********************************************************************************* * Constructor - opens rc-input device, selects rc-hardware and starts threads @@ -75,6 +81,8 @@ static bool saved_orig_termio = false; CRCInput::CRCInput() { timerid= 1; + repeatkeys = NULL; + longPressAny = false; // pipe for internal event-queue // ----------------------------- @@ -106,7 +114,7 @@ CRCInput::CRCInput() int clilen; memset(&servaddr, 0, sizeof(struct sockaddr_un)); servaddr.sun_family = AF_UNIX; - strcpy(servaddr.sun_path, NEUTRINO_UDS_NAME); + cstrncpy(servaddr.sun_path, NEUTRINO_UDS_NAME, sizeof(servaddr.sun_path)); clilen = sizeof(servaddr.sun_family) + strlen(servaddr.sun_path); unlink(NEUTRINO_UDS_NAME); @@ -137,30 +145,34 @@ CRCInput::CRCInput() repeat_block = repeat_block_generic = 0; open(); rc_last_key = KEY_MAX; - firstKey = true; + longPressEnd = 0; //select and setup remote control hardware set_rc_hw(); } -void CRCInput::open() +/* if dev is given, open device with index , if not (re)open all */ +void CRCInput::open(int dev) { - close(); + if (dev == -1) + close(); for (int i = 0; i < NUMBER_OF_EVENT_DEVICES; i++) { - if ((fd_rc[i] = ::open(RC_EVENT_DEVICE[i], O_RDONLY)) == -1) - perror(RC_EVENT_DEVICE[i]); - else - { - fcntl(fd_rc[i], F_SETFL, O_NONBLOCK); + if (dev != -1) { + if (i != dev || fd_rc[i] != -1) + continue; } + if ((fd_rc[i] = ::open(RC_EVENT_DEVICE[i], O_RDWR|O_NONBLOCK|O_CLOEXEC)) == -1) + perror(RC_EVENT_DEVICE[i]); printf("CRCInput::open: %s fd %d\n", RC_EVENT_DEVICE[i], fd_rc[i]); } //+++++++++++++++++++++++++++++++++++++++ #ifdef KEYBOARD_INSTEAD_OF_REMOTE_CONTROL fd_keyb = STDIN_FILENO; + if (fd_rc[0] < 0) + fd_rc[0] = fd_keyb; #else fd_keyb = 0; #endif /* KEYBOARD_INSTEAD_OF_REMOTE_CONTROL */ @@ -267,6 +279,7 @@ CRCInput::~CRCInput() **************************************************************************/ void CRCInput::stopInput() { + input_stopped = true; close(); } @@ -278,6 +291,7 @@ void CRCInput::restartInput() { close(); open(); + input_stopped = false; } #if 0 //never used @@ -335,13 +349,7 @@ int CRCInput::messageLoop( bool anyKeyCancels, int timeout ) int CRCInput::addTimer(uint64_t Interval, bool oneshot, bool correct_time ) { -#ifdef USE_GETTIMEOFDAY - struct timeval tv; - gettimeofday( &tv, NULL ); - uint64_t timeNow = (uint64_t) tv.tv_usec + (uint64_t)((uint64_t) tv.tv_sec * (uint64_t) 1000000); -#else uint64_t timeNow = time_monotonic_us(); -#endif timer _newtimer; if (!oneshot) @@ -373,19 +381,6 @@ int CRCInput::addTimer(uint64_t Interval, bool oneshot, bool correct_time ) return _newtimer.id; } -#ifdef USE_GETTIMEOFDAY -int CRCInput::addTimer(struct timeval Timeout) -{ - uint64_t timesout = (uint64_t) Timeout.tv_usec + (uint64_t)((uint64_t) Timeout.tv_sec * (uint64_t) 1000000); - return addTimer( timesout, true, false ); -} - -int CRCInput::addTimer(const time_t *Timeout) -{ - return addTimer( (uint64_t)*Timeout* (uint64_t) 1000000, true, false ); -} -#endif - void CRCInput::killTimer(uint32_t &id) { //printf("killing timer %d\n", id); @@ -405,13 +400,7 @@ void CRCInput::killTimer(uint32_t &id) int CRCInput::checkTimers() { int _id = 0; -#ifdef USE_GETTIMEOFDAY - struct timeval tv; - gettimeofday( &tv, NULL ); - uint64_t timeNow = (uint64_t) tv.tv_usec + (uint64_t)((uint64_t) tv.tv_sec * (uint64_t) 1000000); -#else uint64_t timeNow = time_monotonic_us(); -#endif std::vector::iterator e; for ( e= timers.begin(); e!= timers.end(); ++e ) if ( e->times_out< timeNow+ 2000 ) @@ -451,36 +440,18 @@ int CRCInput::checkTimers() int64_t CRCInput::calcTimeoutEnd(const int timeout_in_seconds) { -#ifdef USE_GETTIMEOFDAY - struct timeval tv; - gettimeofday(&tv, NULL); - return (uint64_t) tv.tv_usec + (uint64_t)((uint64_t) tv.tv_sec + (uint64_t)timeout_in_seconds) * (uint64_t) 1000000; -#else return time_monotonic_us() + ((uint64_t)timeout_in_seconds * (uint64_t) 1000000); -#endif } int64_t CRCInput::calcTimeoutEnd_MS(const int timeout_in_milliseconds) { -#ifdef USE_GETTIMEOFDAY - struct timeval tv; - gettimeofday(&tv, NULL); - uint64_t timeNow = (uint64_t) tv.tv_usec + (uint64_t)((uint64_t) tv.tv_sec * (uint64_t) 1000000); -#else uint64_t timeNow = time_monotonic_us(); -#endif return ( timeNow + timeout_in_milliseconds * 1000 ); } void CRCInput::getMsgAbsoluteTimeout(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint64_t *TimeoutEnd, bool bAllowRepeatLR) { -#ifdef USE_GETTIMEOFDAY - struct timeval tv; - gettimeofday( &tv, NULL ); - uint64_t timeNow = (uint64_t) tv.tv_usec + (uint64_t)((uint64_t) tv.tv_sec * (uint64_t) 1000000); -#else uint64_t timeNow = time_monotonic_us(); -#endif uint64_t diff; if ( *TimeoutEnd < timeNow+ 100 ) @@ -490,16 +461,6 @@ void CRCInput::getMsgAbsoluteTimeout(neutrino_msg_t * msg, neutrino_msg_data_t * //printf("CRCInput::getMsgAbsoluteTimeout diff %llx TimeoutEnd %llx now %llx\n", diff, *TimeoutEnd, timeNow); getMsg_us( msg, data, diff, bAllowRepeatLR ); -#ifdef USE_GETTIMEOFDAY - if ( *msg == NeutrinoMessages::EVT_TIMESET ) - { - // recalculate timeout.... - //uint64_t ta= *TimeoutEnd; - *TimeoutEnd= *TimeoutEnd + *(int64_t*) *data; - - //printf("[getMsgAbsoluteTimeout]: EVT_TIMESET - recalculate timeout\n%llx/%llx - %llx/%llx\n", timeNow, *(int64_t*) *data, *TimeoutEnd, ta ); - } -#endif } void CRCInput::getMsg(neutrino_msg_t * msg, neutrino_msg_data_t * data, int Timeout, bool bAllowRepeatLR) @@ -512,6 +473,43 @@ void CRCInput::getMsg_ms(neutrino_msg_t * msg, neutrino_msg_data_t * data, int T getMsg_us(msg, data, (uint64_t) Timeout * 1000, bAllowRepeatLR); } +uint32_t *CRCInput::setAllowRepeat(uint32_t *rk) { + uint32_t *r = repeatkeys; + repeatkeys = rk; + return r; +} + +bool checkLongPress(uint32_t key); // keybind_setup.cpp + +bool CRCInput::mayLongPress(uint32_t key, bool bAllowRepeatLR) +{ + if (mayRepeat(key, bAllowRepeatLR)) + return false; + if (longPressAny) + return true; + return checkLongPress(key); +} + +bool CRCInput::mayRepeat(uint32_t key, bool bAllowRepeatLR) +{ + if((key == RC_up) || (key == RC_down) + || (key == RC_plus) || (key == RC_minus) + || (key == RC_page_down) || (key == RC_page_up) + || ((bAllowRepeatLR) && ((key == RC_left ) || (key == RC_right)))) + return true; + + if (repeatkeys) { + uint32_t *k = repeatkeys; + while (*k != RC_nokey) { + if (*k == key) { + return true; + } + k++; + } + } + return false; +} + void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint64_t Timeout, bool bAllowRepeatLR) { static uint64_t last_keypress = 0ULL; @@ -527,27 +525,28 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 int timer_id; fd_set rfds; - t_input_event ev; *data = 0; + /* reopen a missing input device + * TODO: real hot-plugging, e.g. of keyboards and triggering this loop... + * right now it is only run if some event is happening "by accident" */ + if (!input_stopped) { + for (int i = 0; i < NUMBER_OF_EVENT_DEVICES; i++) { + if (fd_rc[i] == -1) + open(i); + } + } + // wiederholung reinmachen - dass wirklich die ganze zeit bis timeout gewartet wird! -#ifdef USE_GETTIMEOFDAY - gettimeofday( &tv, NULL ); - uint64_t getKeyBegin = (uint64_t) tv.tv_usec + (uint64_t)((uint64_t) tv.tv_sec * (uint64_t) 1000000); -#else uint64_t getKeyBegin = time_monotonic_us(); -#endif + while(1) { + /* we later check for ev.type = EV_SYN which is 0x00, so set something invalid here... */ timer_id = 0; if ( !timers.empty() ) { -#ifdef USE_GETTIMEOFDAY - gettimeofday( &tv, NULL ); - uint64_t t_n= (uint64_t) tv.tv_usec + (uint64_t)((uint64_t) tv.tv_sec * (uint64_t) 1000000); -#else uint64_t t_n = time_monotonic_us(); -#endif if ( timers[0].times_out< t_n ) { timer_id = checkTimers(); @@ -816,17 +815,17 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 break; case NeutrinoMessages::EVT_POPUP : *msg = NeutrinoMessages::EVT_POPUP; - *data = (unsigned) p; + *data = (unsigned long) p; dont_delete_p = true; break; case NeutrinoMessages::EVT_EXTMSG : *msg = NeutrinoMessages::EVT_EXTMSG; - *data = (unsigned) p; + *data = (unsigned long) p; dont_delete_p = true; break; case NeutrinoMessages::CHANGEMODE : // Change *msg = NeutrinoMessages::CHANGEMODE; - *data = *(unsigned*) p; + *data = *(unsigned long*) p; break; case NeutrinoMessages::STANDBY_TOGGLE : *msg = NeutrinoMessages::STANDBY_TOGGLE; @@ -842,7 +841,7 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 break; case NeutrinoMessages::EVT_START_PLUGIN : *msg = NeutrinoMessages::EVT_START_PLUGIN; - *data = (unsigned) p; + *data = (unsigned long) p; dont_delete_p = true; break; case NeutrinoMessages::LOCK_RC : @@ -920,12 +919,6 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 if ((int64_t)last_keypress > *(int64_t*)p) last_keypress += *(int64_t *)p; -#ifdef USE_GETTIMEOFDAY - // Timer anpassen - for(std::vector::iterator e = timers.begin(); e != timers.end(); ++e) - if (e->correct_time) - e->times_out+= *(int64_t*) p; -#endif *msg = NeutrinoMessages::EVT_TIMESET; *data = (neutrino_msg_data_t) p; dont_delete_p = true; @@ -1110,7 +1103,7 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 { case CTimerdClient::EVT_ANNOUNCE_RECORD : *msg = NeutrinoMessages::ANNOUNCE_RECORD; - *data = (unsigned) p; + *data = (unsigned long) p; dont_delete_p = true; break; case CTimerdClient::EVT_ANNOUNCE_ZAPTO : @@ -1132,17 +1125,17 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 break; case CTimerdClient::EVT_RECORD_START : *msg = NeutrinoMessages::RECORD_START; - *data = (unsigned) p; + *data = (unsigned long) p; dont_delete_p = true; break; case CTimerdClient::EVT_RECORD_STOP : *msg = NeutrinoMessages::RECORD_STOP; - *data = (unsigned) p; + *data = (unsigned long) p; dont_delete_p = true; break; case CTimerdClient::EVT_ZAPTO : *msg = NeutrinoMessages::ZAPTO; - *data = (unsigned) p; + *data = (unsigned long) p; dont_delete_p = true; break; case CTimerdClient::EVT_SHUTDOWN : @@ -1159,15 +1152,14 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 break; case CTimerdClient::EVT_REMIND : *msg = NeutrinoMessages::REMIND; - *data = (unsigned) p; + *data = (unsigned long) p; dont_delete_p = true; break; case CTimerdClient::EVT_EXEC_PLUGIN : *msg = NeutrinoMessages::EVT_START_PLUGIN; - *data = (unsigned) p; + *data = (unsigned long) p; dont_delete_p = true; break; - default : printf("[neutrino] event INITID_TIMERD - unknown eventID 0x%x\n", emsg.eventID ); @@ -1195,10 +1187,21 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 } else printf("[neutrino] event - unknown initiatorID 0x%x\n", emsg.initiatorID); - if ( !dont_delete_p ) - { - delete[] p;//new [] delete [] - p= NULL; + + switch (emsg.eventID) { + case NeutrinoMessages::EVT_CURRENTEPG: + case NeutrinoMessages::EVT_NEXTEPG: + { + CSectionsdClient::CurrentNextInfo *cn = (CSectionsdClient::CurrentNextInfo *) p; + delete cn; + p = NULL; + break; + } + default: + if (!dont_delete_p) { + delete[] p; + p = NULL; + } } } } @@ -1219,25 +1222,57 @@ 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))) { - int ret; - ret = read(fd_rc[i], &ev, sizeof(t_input_event)); - - if(ret != sizeof(t_input_event)) + t_input_event ev; + int ret = read(fd_rc[i], &ev, sizeof(t_input_event)); + if (ret != sizeof(t_input_event)) { + if (errno == ENODEV) { + /* hot-unplugged? */ + ::close(fd_rc[i]); + fd_rc[i] = -1; + } continue; - SHTDCNT::getInstance()->resetSleepTimer(); - if (firstKey) { - firstKey = false; - CTimerManager::getInstance()->cancelShutdownOnWakeup(); } + if (ev.type == EV_SYN) + continue; /* ignore... */ + SHTDCNT::getInstance()->resetSleepTimer(); uint32_t trkey = translate(ev.code); #ifdef DEBUG - printf("key: %04x value %d, translate: %04x -%s-\n", ev.code, ev.value, trkey, getKeyName(trkey).c_str()); + printf("%d key: %04x value %d, translate: %04x -%s-\n", ev.value, ev.code, ev.value, trkey, getKeyName(trkey).c_str()); #endif if (trkey == RC_nokey) continue; + + if (g_settings.longkeypress_duration > LONGKEYPRESS_OFF) { + uint64_t longPressNow = time_monotonic_us(); + if (ev.value == 0 && longPressEnd) { + if (longPressNow < longPressEnd) { + // Key was a potential long press, but wasn't pressed long enough + longPressEnd = 0; + ev.value = 1; + } else { + // Long-press, key released after time limit + longPressEnd = 0; + continue; + } + } else if (ev.value == 1 && mayLongPress(trkey, bAllowRepeatLR)) { + // A long-press may start here. + longPressEnd = longPressNow + 1000 * g_settings.longkeypress_duration; + rc_last_key = KEY_MAX; + continue; + } else if (ev.value == 2 && longPressEnd) { + if (longPressEnd < longPressNow) { + // Key was pressed long enough. + ev.value = 1; + trkey |= RC_Repeat; + } else { + // Long-press, but key still not released. Skip. + continue; + } + } + } + if (ev.value) { #ifdef RCDEBUG - printf("got keydown native key: %04x %04x, translate: %04x -%s-\n", ev.code, ev.code&0x1f, translate(ev.code, 0), getKeyName(translate(ev.code, 0)).c_str()); printf("rc_last_key %04x rc_last_repeat_key %04x\n\n", rc_last_key, rc_last_repeat_key); #endif uint64_t now_pressed; @@ -1245,21 +1280,17 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 tv = ev.time; now_pressed = (uint64_t) tv.tv_usec + (uint64_t)((uint64_t) tv.tv_sec * (uint64_t) 1000000); - if (ev.code == rc_last_key) { + if (trkey == rc_last_key) { /* only allow selected keys to be repeated */ - /* (why?) */ - if( (trkey == RC_up) || (trkey == RC_down ) || - (trkey == RC_plus ) || (trkey == RC_minus ) || - (trkey == RC_page_down ) || (trkey == RC_page_up ) || - ((bAllowRepeatLR) && ((trkey == RC_left ) || (trkey == RC_right))) || - (g_settings.shutdown_real_rcdelay && ((trkey == RC_standby) && (cs_get_revision() > 7))) ) + if (mayRepeat(trkey, bAllowRepeatLR) || + (g_settings.shutdown_real_rcdelay && ((trkey == RC_standby) && (cs_get_revision() > 7))) ) { #ifdef ENABLE_REPEAT_CHECK - if (rc_last_repeat_key != ev.code) { + if (rc_last_repeat_key != trkey) { if ((now_pressed > last_keypress + repeat_block) || /* accept all keys after time discontinuity: */ (now_pressed < last_keypress)) - rc_last_repeat_key = ev.code; + rc_last_repeat_key = trkey; else keyok = false; } @@ -1271,7 +1302,7 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 else rc_last_repeat_key = KEY_MAX; - rc_last_key = ev.code; + rc_last_key = trkey; if (keyok) { #ifdef ENABLE_REPEAT_CHECK @@ -1292,9 +1323,6 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 } /* if (ev.value) */ else { // clear rc_last_key on keyup event -#ifdef RCDEBUG - printf("got keyup native key: %04x %04x, translate: %04x -%s-\n", ev.code, ev.code&0x1f, translate(ev.code, 0), getKeyName(translate(ev.code, 0)).c_str() ); -#endif rc_last_key = KEY_MAX; if (trkey == RC_standby) { *msg = RC_standby; @@ -1329,12 +1357,7 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 else { //timeout neu kalkulieren -#ifdef USE_GETTIMEOFDAY - gettimeofday( &tv, NULL ); - int64_t getKeyNow = (int64_t) tv.tv_usec + (int64_t)((int64_t) tv.tv_sec * (int64_t) 1000000); -#else int64_t getKeyNow = time_monotonic_us(); -#endif int64_t diff = (getKeyNow - getKeyBegin); if( Timeout <= (uint64_t) diff ) { @@ -1485,20 +1508,6 @@ const char * CRCInput::getSpecialKeyName(const unsigned int key) return "radio"; case RC_text: return "text"; -#if 0 - case RC_shift_red: - return "shift-red"; - case RC_shift_green: - return "shift-green"; - case RC_shift_yellow: - return "shift-yellow"; - case RC_shift_blue: - return "shift-blue"; - case RC_shift_tv: - return "shift-tv"; - case RC_shift_radio: - return "shift-radio"; -#endif case RC_epg: return "epg"; case RC_recall: @@ -1566,16 +1575,24 @@ const char * CRCInput::getSpecialKeyName(const unsigned int key) } std::string CRCInput::getKeyName(const unsigned int key) +{ + std::string res(getKeyNameC(key & ~RC_Repeat)); + if ((key & RC_Repeat) && res != "unknown") + res += " (long)"; + return res; +} + +const char *CRCInput::getKeyNameC(const unsigned int key) { int lunicode_value = getUnicodeValue(key); if (lunicode_value == -1) return getSpecialKeyName(key); else { - char tmp[2]; + static char tmp[2]; tmp[0] = lunicode_value; tmp[1] = 0; - return std::string(tmp); + return tmp; } } @@ -1585,8 +1602,15 @@ std::string CRCInput::getKeyName(const unsigned int key) **************************************************************************/ int CRCInput::translate(int code) { - if(code == 0x100) code = RC_up; - else if(code == 0x101) code = RC_down; + switch(code) + { + case 0x100: // FIXME -- needed? + return RC_up; + case 0x101: // FIXME -- needed? + return RC_down; + default: + break; + } if ((code >= 0) && (code <= KEY_MAX)) return code; diff --git a/src/driver/rcinput.h b/src/driver/rcinput.h index 228374297..bee874e6a 100644 --- a/src/driver/rcinput.h +++ b/src/driver/rcinput.h @@ -115,8 +115,8 @@ */ -typedef uint32_t neutrino_msg_t; -typedef uint32_t neutrino_msg_data_t; +typedef unsigned long neutrino_msg_t; +typedef unsigned long neutrino_msg_data_t; #define NEUTRINO_UDS_NAME "/tmp/neutrino.sock" @@ -141,6 +141,9 @@ class CRCInput uint32_t timerid; std::vector timers; + uint32_t *repeatkeys; + uint64_t longPressEnd; + bool longPressAny; int fd_pipe_high_priority[2]; int fd_pipe_low_priority[2]; int fd_gamerc; @@ -151,15 +154,16 @@ class CRCInput int fd_max; int clickfd; - bool firstKey; __u16 rc_last_key; void set_dsp(); - void open(); + void open(int dev = -1); void close(); int translate(int code); void calculateMaxFd(void); int checkTimers(); + bool mayRepeat(uint32_t key, bool bAllowRepeatLR = false); + bool mayLongPress(uint32_t key, bool bAllowRepeatLR = false); #ifdef IOC_IR_SET_PRI_PROTOCOL void set_rc_hw(ir_protocol_t ir_protocol, unsigned int ir_address); #endif @@ -287,8 +291,10 @@ class CRCInput static int getNumericValue(const neutrino_msg_t key); static unsigned int convertDigitToKey(const unsigned int digit); static int getUnicodeValue(const neutrino_msg_t key); + uint32_t *setAllowRepeat(uint32_t *); static const char * getSpecialKeyName(const unsigned int key); + static const char *getKeyNameC(const unsigned int key); static std::string getKeyName(const unsigned int key); int addTimer(uint64_t Interval, bool oneshot= true, bool correct_time= true ); @@ -312,6 +318,8 @@ class CRCInput void close_click(); void play_click(); void reset_dsp(int rate); + + void setLongPressAny(bool b) { longPressAny = b; }; }; diff --git a/src/gui/keybind_setup.cpp b/src/gui/keybind_setup.cpp index 08bd0ac0e..b17b8e3cf 100644 --- a/src/gui/keybind_setup.cpp +++ b/src/gui/keybind_setup.cpp @@ -194,6 +194,17 @@ const key_settings_struct_t key_settings[CKeybindSetup::KEYBINDS_COUNT] = {LOCALE_EXTRA_KEY_PIC_SIZE, &g_settings.key_pic_size_active, LOCALE_MENU_HINT_KEY_PIC_SIZE_ACTIVE } }; +// used by driver/rcinput.cpp +bool checkLongPress(uint32_t key) +{ + if (g_settings.longkeypress_duration == LONGKEYPRESS_OFF) + return false; + key |= CRCInput::RC_Repeat; + for (unsigned int i = 0; i < CKeybindSetup::KEYBINDS_COUNT; i++) + if ((uint32_t)*key_settings[i].keyvalue_p == key) + return true; + return false; +} int CKeybindSetup::showKeySetup() { @@ -242,9 +253,18 @@ int CKeybindSetup::showKeySetup() mc->setHint("", LOCALE_MENU_HINT_KEY_HARDWARE); keySettings->addItem(mc); } + std::string ms_number_format("%d "); ms_number_format += g_Locale->getText(LOCALE_UNIT_SHORT_MILLISECOND); CMenuOptionNumberChooser *cc; + + cc = new CMenuOptionNumberChooser(LOCALE_KEYBINDINGMENU_LONGKEYPRESS_DURATION, + &g_settings.longkeypress_duration, true, LONGKEYPRESS_OFF, 9999, NULL, 0, LONGKEYPRESS_OFF, LOCALE_OPTIONS_OFF); + cc->setNumberFormat(ms_number_format); + cc->setNumericInput(true); + cc->setHint("", LOCALE_MENU_HINT_LONGKEYPRESS_DURATION); + keySettings->addItem(cc); + cc = new CMenuOptionNumberChooser(LOCALE_KEYBINDINGMENU_REPEATBLOCK, &g_settings.repeat_blocker, true, 0, 999); cc->setNumberFormat(ms_number_format); diff --git a/src/gui/widget/keychooser.cpp b/src/gui/widget/keychooser.cpp index ed146b8fa..f11a0d28b 100644 --- a/src/gui/widget/keychooser.cpp +++ b/src/gui/widget/keychooser.cpp @@ -119,6 +119,7 @@ int CKeyChooserItem::exec(CMenuTarget* parent, const std::string &) paint(); g_RCInput->clearRCMsg(); + g_RCInput->setLongPressAny(true); timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings ::TIMING_MENU]); @@ -138,6 +139,7 @@ int CKeyChooserItem::exec(CMenuTarget* parent, const std::string &) goto get_Message; } + g_RCInput->setLongPressAny(false); hide(); return res; } diff --git a/src/neutrino.cpp b/src/neutrino.cpp index af3e0e685..f259ca06f 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -3880,6 +3880,7 @@ void CNeutrinoApp::loadKeys(const char * fname) g_settings.key_click = tconfig.getInt32( "key_click", 1 ); g_settings.repeat_blocker = tconfig.getInt32("repeat_blocker", 150); g_settings.repeat_genericblocker = tconfig.getInt32("repeat_genericblocker", 100); + g_settings.longkeypress_duration = tconfig.getInt32("longkeypress_duration", LONGKEYPRESS_OFF); g_settings.bouquetlist_mode = tconfig.getInt32( "bouquetlist_mode", 0 ); g_settings.sms_channel = tconfig.getInt32( "sms_channel", 0 ); @@ -3947,6 +3948,7 @@ void CNeutrinoApp::saveKeys(const char * fname) tconfig.setInt32( "key_click", g_settings.key_click ); tconfig.setInt32( "repeat_blocker", g_settings.repeat_blocker ); tconfig.setInt32( "repeat_genericblocker", g_settings.repeat_genericblocker ); + tconfig.setInt32( "longkeypress_duration", g_settings.longkeypress_duration ); tconfig.setInt32( "bouquetlist_mode", g_settings.bouquetlist_mode ); tconfig.setInt32( "sms_channel", g_settings.sms_channel ); diff --git a/src/system/helpers.h b/src/system/helpers.h index b494a2500..1a68cb316 100644 --- a/src/system/helpers.h +++ b/src/system/helpers.h @@ -23,6 +23,7 @@ */ #include +#include #include #include @@ -80,4 +81,6 @@ template std::string to_string(C i) return s.str(); } +inline void cstrncpy(char *dest, const char * const src, size_t n) { n--; strncpy(dest, src, n); dest[n] = 0; } +inline void cstrncpy(char *dest, const std::string &src, size_t n) { n--; strncpy(dest, src.c_str(), n); dest[n] = 0; } #endif diff --git a/src/system/locals.h b/src/system/locals.h index c6ac6e6df..d6d27d4a6 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -701,6 +701,7 @@ typedef enum LOCALE_KEYBINDINGMENU_CHANNELUP, LOCALE_KEYBINDINGMENU_HEAD, LOCALE_KEYBINDINGMENU_LASTCHANNEL, + LOCALE_KEYBINDINGMENU_LONGKEYPRESS_DURATION, LOCALE_KEYBINDINGMENU_MISC, LOCALE_KEYBINDINGMENU_MODE_LEFT_RIGHT_KEY_TV, LOCALE_KEYBINDINGMENU_MODE_LEFT_RIGHT_KEY_TV_INFOBAR, @@ -985,6 +986,7 @@ typedef enum LOCALE_MENU_HINT_LEDS_STANDBY, LOCALE_MENU_HINT_LEDS_TV, LOCALE_MENU_HINT_LOAD, + LOCALE_MENU_HINT_LONGKEYPRESS_DURATION, LOCALE_MENU_HINT_LUA, LOCALE_MENU_HINT_MAKE_HDLIST, LOCALE_MENU_HINT_MAKE_NEWLIST, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index f17d1f15d..1dd98deda 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -701,6 +701,7 @@ const char * locale_real_names[] = "keybindingmenu.channelup", "keybindingmenu.head", "keybindingmenu.lastchannel", + "keybindingmenu.longkeypress_duration", "keybindingmenu.misc", "keybindingmenu.mode_left_right_key_tv", "keybindingmenu.mode_left_right_key_tv_infobar", @@ -985,6 +986,7 @@ const char * locale_real_names[] = "menu.hint_leds_standby", "menu.hint_leds_tv", "menu.hint_load", + "menu.hint_longkeypress_duration", "menu.hint_lua", "menu.hint_make_hdlist", "menu.hint_make_newlist", diff --git a/src/system/settings.h b/src/system/settings.h index b2354cbdc..460e17744 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -477,6 +477,8 @@ struct SNeutrinoSettings int channellist_show_channellogo; int repeat_blocker; int repeat_genericblocker; +#define LONGKEYPRESS_OFF 499 + int longkeypress_duration; int remote_control_hardware; int audiochannel_up_down_enable; From 34c23ed7a5aaebe2bdd9b8550484d0df79b70e7b Mon Sep 17 00:00:00 2001 From: martii Date: Sun, 23 Feb 2014 10:26:34 +0100 Subject: [PATCH 003/225] driver/rcinput: let getUnicodeValue() return const char * --- src/driver/rcinput.cpp | 32 ++++++++++++------------------ src/driver/rcinput.h | 2 +- src/gui/widget/stringinput.cpp | 4 ++-- src/gui/widget/stringinput_ext.cpp | 10 +++++----- 4 files changed, 21 insertions(+), 27 deletions(-) diff --git a/src/driver/rcinput.cpp b/src/driver/rcinput.cpp index d10aa2164..e5144511b 100644 --- a/src/driver/rcinput.cpp +++ b/src/driver/rcinput.cpp @@ -1431,21 +1431,21 @@ unsigned int CRCInput::convertDigitToKey(const unsigned int digit) } /************************************************************************** -* getUnicodeValue - return unicode value of the key or -1 +* getUnicodeValue - return unicode value of the key or \0 * **************************************************************************/ #define UNICODE_VALUE_SIZE 58 -static const int unicode_value[UNICODE_VALUE_SIZE] = {-1 , -1 , '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', -1 , -1 , - 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '{', '}', -1 , -1 , 'A', 'S', - 'D', 'F', 'G', 'H', 'J', 'K', 'L', ';', -1 /* FIXME */, -1 /* FIXME */, -1 , '\\', 'Z', 'X', 'C', 'V', - 'B', 'N', 'M', ',', '.', '/', -1, -1, -1, ' '}; +static const char unicode_value[UNICODE_VALUE_SIZE * 2] = + "\0\0" "\0\0" "1\0" "2\0" "3\0" "4\0" "5\0" "6\0" "7\0" "8\0" "9\0" "0\0" "-\0" "=\0" "\0\0" "\0\0" + "Q\0" "W\0" "E\0" "R\0" "T\0" "Y\0" "U\0" "I\0" "O\0" "P\0" "{\0" "}\0" "\0\0" "\0\0" "A\0" "S\0" + "D\0" "F\0" "G\0" "H\0" "J\0" "K\0" "L\0" ";\0" "'\0" "\140\0" "\0\0" "\\\0" "Z\0" "X\0" "C\0" "V\0" + "B\0" "N\0" "M\0" "\0\0" ".\0" "/\0" "\0\0" "\0\0" "\0\0" " "; -int CRCInput::getUnicodeValue(const neutrino_msg_t key) +const char *CRCInput::getUnicodeValue(const neutrino_msg_t key) { if (key < UNICODE_VALUE_SIZE) - return unicode_value[key]; - else - return -1; + return unicode_value + key * 2; + return ""; } /************************************************************************** @@ -1584,16 +1584,10 @@ std::string CRCInput::getKeyName(const unsigned int key) const char *CRCInput::getKeyNameC(const unsigned int key) { - int lunicode_value = getUnicodeValue(key); - if (lunicode_value == -1) - return getSpecialKeyName(key); - else - { - static char tmp[2]; - tmp[0] = lunicode_value; - tmp[1] = 0; - return tmp; - } + const char *lunicode_value = getUnicodeValue(key); + if (*lunicode_value) + return lunicode_value; + return getSpecialKeyName(key); } /************************************************************************** diff --git a/src/driver/rcinput.h b/src/driver/rcinput.h index bee874e6a..feb414941 100644 --- a/src/driver/rcinput.h +++ b/src/driver/rcinput.h @@ -290,7 +290,7 @@ class CRCInput static bool isNumeric(const neutrino_msg_t key); static int getNumericValue(const neutrino_msg_t key); static unsigned int convertDigitToKey(const unsigned int digit); - static int getUnicodeValue(const neutrino_msg_t key); + static const char *getUnicodeValue(const neutrino_msg_t key); uint32_t *setAllowRepeat(uint32_t *); static const char * getSpecialKeyName(const unsigned int key); diff --git a/src/gui/widget/stringinput.cpp b/src/gui/widget/stringinput.cpp index 04e2b769c..5099f2c55 100644 --- a/src/gui/widget/stringinput.cpp +++ b/src/gui/widget/stringinput.cpp @@ -430,7 +430,7 @@ int CStringInput::exec( CMenuTarget* parent, const std::string & ) { keyRightPressed(); } - else if (CRCInput::getUnicodeValue(msg) != -1) + else if (*CRCInput::getUnicodeValue(msg)) { NormalKeyPressed(msg); } @@ -701,7 +701,7 @@ void CStringInputSMS::NormalKeyPressed(const neutrino_msg_t key) } else { - valueString->at(selected) = (char)CRCInput::getUnicodeValue(key); + valueString->at(selected) = *CRCInput::getUnicodeValue(key); keyRedPressed(); /* to lower, paintChar */ keyRightPressed(); /* last_digit = -1, move to next position */ } diff --git a/src/gui/widget/stringinput_ext.cpp b/src/gui/widget/stringinput_ext.cpp index 82abac222..c56ef9aca 100644 --- a/src/gui/widget/stringinput_ext.cpp +++ b/src/gui/widget/stringinput_ext.cpp @@ -218,7 +218,7 @@ int CExtendedInput::exec( CMenuTarget* parent, const std::string & ) CVFD::getInstance()->showMenuText(1, valueString->c_str(), selectedChar+1); } } - else if ( (CRCInput::getUnicodeValue(msg) != -1) || (msg == CRCInput::RC_red) || (msg == CRCInput::RC_green) || (msg == CRCInput::RC_blue) || (msg == CRCInput::RC_yellow) + else if ( (!*CRCInput::getUnicodeValue(msg)) || (msg == CRCInput::RC_red) || (msg == CRCInput::RC_green) || (msg == CRCInput::RC_blue) || (msg == CRCInput::RC_yellow) || (msg == CRCInput::RC_up) || (msg == CRCInput::RC_down)) { inputFields[selectedChar]->keyPressed(msg); @@ -377,12 +377,12 @@ int CExtendedInput_Item_Char::getCharID( char ch ) void CExtendedInput_Item_Char::keyPressed(const int key) { - int value = CRCInput::getUnicodeValue(key); - if (value != -1) + const char *value = CRCInput::getUnicodeValue(key); + if (*value) { - if (isAllowedChar((char)value)) + if (isAllowedChar(*value)) { - *data = (char)value; + *data = *value; g_RCInput->postMsg( CRCInput::RC_right, 0 ); } } From 6aab6745ec51d6ff542c537bcf7db9db4a1479a9 Mon Sep 17 00:00:00 2001 From: martii Date: Mon, 24 Feb 2014 18:53:49 +0100 Subject: [PATCH 004/225] gui/widget/stringinput_ext: unbreak e8670e6c90e1dfe81a8b7e38e60559bc56fee193 --- src/gui/widget/stringinput_ext.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widget/stringinput_ext.cpp b/src/gui/widget/stringinput_ext.cpp index c56ef9aca..0f49cbb8b 100644 --- a/src/gui/widget/stringinput_ext.cpp +++ b/src/gui/widget/stringinput_ext.cpp @@ -218,7 +218,7 @@ int CExtendedInput::exec( CMenuTarget* parent, const std::string & ) CVFD::getInstance()->showMenuText(1, valueString->c_str(), selectedChar+1); } } - else if ( (!*CRCInput::getUnicodeValue(msg)) || (msg == CRCInput::RC_red) || (msg == CRCInput::RC_green) || (msg == CRCInput::RC_blue) || (msg == CRCInput::RC_yellow) + else if ( (*CRCInput::getUnicodeValue(msg)) || (msg == CRCInput::RC_red) || (msg == CRCInput::RC_green) || (msg == CRCInput::RC_blue) || (msg == CRCInput::RC_yellow) || (msg == CRCInput::RC_up) || (msg == CRCInput::RC_down)) { inputFields[selectedChar]->keyPressed(msg); From 26633871954196a53aafbb12685dd77f22ba7bc9 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Fri, 18 Oct 2013 19:17:02 +0400 Subject: [PATCH 005/225] src/neutrino.cpp: set default CI clock to 9 mhz --- src/neutrino.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index f259ca06f..7e2f62081 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -358,7 +358,7 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.standby_cpufreq = configfile.getInt32("standby_cpufreq", 100); g_settings.rounded_corners = configfile.getInt32("rounded_corners", 1); g_settings.ci_standby_reset = configfile.getInt32("ci_standby_reset", 0); - g_settings.ci_clock = configfile.getInt32("ci_clock", 7); + g_settings.ci_clock = configfile.getInt32("ci_clock", 9); g_settings.ci_ignore_messages = configfile.getInt32("ci_ignore_messages", 0); #ifndef CPU_FREQ From e1c7198ed8aa911a992cb9d3f4c24ee0082a505d Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Tue, 25 Feb 2014 14:45:56 +0400 Subject: [PATCH 006/225] driver/file.cpp: add iso file type --- src/driver/file.cpp | 4 ++-- src/driver/file.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/driver/file.cpp b/src/driver/file.cpp index 8bbb099b5..aa3002c98 100644 --- a/src/driver/file.cpp +++ b/src/driver/file.cpp @@ -43,7 +43,7 @@ const char * const file_extension_list[] = { "aac", "asf", "avi", "bmp", "cdr", "crw", - "dts", "flac", "gif", "imu", "jpeg", "jpg", + "dts", "flac", "gif", "imu", "iso", "jpeg", "jpg", "m2a", "m3u", "m4a", "mkv", "mp2", "mp3", "mpa", "ogg", "pls", "png", "sh", "txt", "url", "wav", "xml" @@ -53,7 +53,7 @@ const char * const file_extension_list[] = const CFile::FileType file_type_list[] = { CFile::FILE_AAC , CFile::FILE_ASF , CFile::FILE_AVI , CFile::FILE_PICTURE , CFile::FILE_CDR , CFile::FILE_PICTURE , - CFile::FILE_WAV , CFile::FILE_FLAC , CFile::FILE_PICTURE , CFile::STREAM_PICTURE, CFile::FILE_PICTURE , CFile::FILE_PICTURE , + CFile::FILE_WAV , CFile::FILE_FLAC , CFile::FILE_PICTURE , CFile::STREAM_PICTURE, CFile::FILE_ISO , CFile::FILE_PICTURE , CFile::FILE_PICTURE , CFile::FILE_MP3 , CFile::FILE_PLAYLIST , CFile::FILE_AAC , CFile::FILE_MKV , CFile::FILE_MP3 , CFile::FILE_MP3 , CFile::FILE_MP3 , CFile::FILE_OGG , CFile::FILE_PLAYLIST, CFile::FILE_PICTURE , CFile::FILE_TEXT , CFile::FILE_TEXT , CFile::STREAM_AUDIO , CFile::FILE_WAV , CFile::FILE_XML diff --git a/src/driver/file.h b/src/driver/file.h index 5f826a5db..b65f41fe8 100644 --- a/src/driver/file.h +++ b/src/driver/file.h @@ -56,6 +56,7 @@ public: FILE_AVI, FILE_ASF, FILE_DIR, + FILE_ISO, FILE_TEXT, FILE_CDR, FILE_MP3, From dbb5de61c85404a35658af58ca1e7ed46e1a7008 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Tue, 25 Feb 2014 14:47:54 +0400 Subject: [PATCH 007/225] gui/movieplayer.cpp: add iso file mount --- src/gui/movieplayer.cpp | 120 ++++++++++++++++++++++++++-------------- src/gui/movieplayer.h | 4 ++ 2 files changed, 81 insertions(+), 43 deletions(-) diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index f8c09872d..5c57bac18 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -46,6 +46,7 @@ #include #include #include +#include #include #include @@ -68,6 +69,7 @@ extern CRemoteControl *g_RemoteControl; /* neutrino.cpp */ extern CInfoClock *InfoClock; #define TIMESHIFT_SECONDS 3 +#define ISO_MOUNT_POINT "/media/iso" CMoviePlayerGui* CMoviePlayerGui::instance_mp = NULL; @@ -122,6 +124,7 @@ void CMoviePlayerGui::Init(void) tsfilefilter.addFilter("mov"); tsfilefilter.addFilter("m3u"); tsfilefilter.addFilter("pls"); + tsfilefilter.addFilter("iso"); if (g_settings.network_nfs_moviedir.empty()) Path_local = "/"; @@ -146,6 +149,7 @@ void CMoviePlayerGui::Init(void) min_y = 0; max_y = 0; ext_subs = false; + iso_file = false; } void CMoviePlayerGui::cutNeutrino() @@ -346,6 +350,26 @@ void CMoviePlayerGui::Cleanup() p_movie_info = NULL; } +void CMoviePlayerGui::makeFilename() +{ + if(file_name.empty()) { + std::string::size_type pos = full_name.find_last_of('/'); + if(pos != std::string::npos) { + file_name = full_name.substr(pos+1); + std::replace(file_name.begin(), file_name.end(), '_', ' '); + } else + file_name = full_name; + + if(file_name.substr(0,14)=="videoplayback?"){//youtube name + if(!p_movie_info->epgTitle.empty()) + file_name = p_movie_info->epgTitle; + else + file_name = ""; + } + printf("CMoviePlayerGui::makeFilename: full_name [%s] file_name [%s]\n", full_name.c_str(), file_name.c_str()); + } +} + bool CMoviePlayerGui::SelectFile() { bool ret = false; @@ -414,55 +438,18 @@ bool CMoviePlayerGui::SelectFile() is_file_player = true; full_name = file->Name.c_str(); ret = true; - if(file->getType() == CFile::FILE_PLAYLIST) { - std::ifstream infile; - char cLine[1024]; - char name[1024] = { 0 }; - infile.open(file->Name.c_str(), std::ifstream::in); - while (infile.good()) - { - infile.getline(cLine, sizeof(cLine)); - if (cLine[strlen(cLine)-1]=='\r') - cLine[strlen(cLine)-1]=0; - - int dur; - sscanf(cLine, "#EXTINF:%d,%[^\n]\n", &dur, name); - if (strlen(cLine) > 0 && cLine[0]!='#') - { - char *url = NULL; - if ( (url = strstr(cLine, "http://")) || (url = strstr(cLine, "rtmp://")) || (url = strstr(cLine, "rtsp://")) ){ - if (url != NULL) { - printf("name %s [%d] url: %s\n", name, dur, url); - full_name = url; - if(strlen(name)) - file_name = name; - } - } - } - } - } + if(file->getType() == CFile::FILE_PLAYLIST) + parsePlaylist(file); + else if(file->getType() == CFile::FILE_ISO) + ret = mountIso(file); } } else menu_ret = filebrowser->getMenuRet(); CAudioMute::getInstance()->enableMuteIcon(true); InfoClock->enableInfoClock(true); } - if(ret && file_name.empty()) { - std::string::size_type pos = full_name.find_last_of('/'); - if(pos != std::string::npos) { - file_name = full_name.substr(pos+1); - std::replace(file_name.begin(), file_name.end(), '_', ' '); - } else - file_name = full_name; - - if(file_name.substr(0,14)=="videoplayback?"){//youtube name - if(!p_movie_info->epgTitle.empty()) - file_name = p_movie_info->epgTitle; - else - file_name = ""; - } - printf("CMoviePlayerGui::SelectFile: full_name [%s] file_name [%s]\n", full_name.c_str(), file_name.c_str()); - } + if (ret) + makeFilename(); //store last multiformat play dir g_settings.network_nfs_moviedir = Path_local; @@ -845,6 +832,11 @@ void CMoviePlayerGui::PlayFile(void) playback->SetSpeed(1); playback->Close(); + if (iso_file) { + iso_file = false; + if (umount2(ISO_MOUNT_POINT ,MNT_FORCE)) + perror(ISO_MOUNT_POINT); + } CVFD::getInstance()->ShowIcon(FP_ICON_PLAY, false); CVFD::getInstance()->ShowIcon(FP_ICON_PAUSE, false); @@ -1622,3 +1614,45 @@ void CMoviePlayerGui::selectAutoLang() } } } + +void CMoviePlayerGui::parsePlaylist(CFile *file) +{ + std::ifstream infile; + char cLine[1024]; + char name[1024] = { 0 }; + infile.open(file->Name.c_str(), std::ifstream::in); + while (infile.good()) + { + infile.getline(cLine, sizeof(cLine)); + if (cLine[strlen(cLine)-1]=='\r') + cLine[strlen(cLine)-1]=0; + + int dur; + sscanf(cLine, "#EXTINF:%d,%[^\n]\n", &dur, name); + if (strlen(cLine) > 0 && cLine[0]!='#') + { + char *url = NULL; + if ( (url = strstr(cLine, "http://")) || (url = strstr(cLine, "rtmp://")) || (url = strstr(cLine, "rtsp://")) ){ + if (url != NULL) { + printf("name %s [%d] url: %s\n", name, dur, url); + full_name = url; + if(strlen(name)) + file_name = name; + } + } + } + } +} + +bool CMoviePlayerGui::mountIso(CFile *file) +{ + printf("ISO file passed: %s\n", file->Name.c_str()); + safe_mkdir(ISO_MOUNT_POINT); + if (my_system(5, "mount", "-o", "loop", file->Name.c_str(), ISO_MOUNT_POINT) == 0) { + makeFilename(); + full_name = "/media/iso"; + iso_file = true; + return true; + } + return false; +} diff --git a/src/gui/movieplayer.h b/src/gui/movieplayer.h index 7a2144951..5edab2792 100644 --- a/src/gui/movieplayer.h +++ b/src/gui/movieplayer.h @@ -108,6 +108,7 @@ class CMoviePlayerGui : public CMenuTarget /* playback from file */ bool is_file_player; + bool iso_file; CFileBrowser * filebrowser; CFileFilter tsfilefilter; std::string Path_local; @@ -142,6 +143,9 @@ class CMoviePlayerGui : public CMenuTarget void clearSubtitle(); void selectChapter(); void selectAutoLang(); + void parsePlaylist(CFile *file); + bool mountIso(CFile *file); + void makeFilename(); void Cleanup(); static void *ShowStartHint(void *arg); From fa79f1d9d311c7e95211f94d14026b74cf1742e2 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Tue, 25 Feb 2014 16:38:51 +0400 Subject: [PATCH 008/225] locals: add locale for subtitles charset selection --- data/locale/english.locale | 1 + src/system/locals.h | 1 + src/system/locals_intern.h | 1 + 3 files changed, 3 insertions(+) diff --git a/data/locale/english.locale b/data/locale/english.locale index 88f3c24d8..e97f6eb87 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -1875,6 +1875,7 @@ streaming.slow System/hdd too slow, consider to stop some records streaming.write_error The recording was aborted,\nsince an error occured during the writing process. stringinput.caps caps / no caps stringinput.clear clear all +subtitles.charset Charset subtitles.head Subtitles subtitles.stop Stop subtitles timer.eventrecord.msg The event is scheduled for recording.\nTo edit the schedule open the timer list. diff --git a/src/system/locals.h b/src/system/locals.h index d6d27d4a6..258375c28 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -1902,6 +1902,7 @@ typedef enum LOCALE_STREAMING_WRITE_ERROR, LOCALE_STRINGINPUT_CAPS, LOCALE_STRINGINPUT_CLEAR, + LOCALE_SUBTITLES_CHARSET, LOCALE_SUBTITLES_HEAD, LOCALE_SUBTITLES_STOP, LOCALE_TIMER_EVENTRECORD_MSG, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 1dd98deda..32306cb70 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -1902,6 +1902,7 @@ const char * locale_real_names[] = "streaming.write_error", "stringinput.caps", "stringinput.clear", + "subtitles.charset", "subtitles.head", "subtitles.stop", "timer.eventrecord.msg", From b85c0daf7aeab66aadd71e2be2bf5ffa63dea814 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Tue, 25 Feb 2014 16:39:43 +0400 Subject: [PATCH 009/225] neutrino.cpp: add subtitles charset setting --- src/neutrino.cpp | 2 ++ src/system/settings.h | 1 + 2 files changed, 3 insertions(+) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 7e2f62081..51ae3a1d5 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -435,6 +435,7 @@ int CNeutrinoApp::loadSetup(const char * fname) sprintf(cfg_key, "pref_subs_%d", i); g_settings.pref_subs[i] = configfile.getString(cfg_key, "none"); } + g_settings.subs_charset = configfile.getString("subs_charset", "CP1252"); g_settings.zap_cycle = configfile.getInt32( "zap_cycle", 0 ); //vcr @@ -945,6 +946,7 @@ void CNeutrinoApp::saveSetup(const char * fname) sprintf(cfg_key, "pref_subs_%d", i); configfile.setString(cfg_key, g_settings.pref_subs[i]); } + configfile.setString("subs_charset", g_settings.subs_charset); //vcr configfile.setBool("vcr_AutoSwitch" , g_settings.vcr_AutoSwitch ); diff --git a/src/system/settings.h b/src/system/settings.h index 460e17744..a162462cc 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -138,6 +138,7 @@ struct SNeutrinoSettings std::string pref_lang[3]; std::string pref_subs[3]; + std::string subs_charset; // EPG int epg_save; From 6b7b4f3dfe0099e4a81b133f327f5b7b53795c7a Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Tue, 25 Feb 2014 16:46:46 +0400 Subject: [PATCH 010/225] src/Makefile.am: for apollo/uClibc add -liconv --- src/Makefile.am | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Makefile.am b/src/Makefile.am index 1df8a164b..8d07aa28e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -140,6 +140,9 @@ neutrino_LDADD += -lca-ci -llnxtmvssUsr -llnxUKAL -llnxplatUsr -llnxtmasUsr -lln else neutrino_LDADD += -lnxp endif +if BOXMODEL_APOLLO +neutrino_LDADD += -liconv +endif endif bin_PROGRAMS += drivertool From c4f4babb6fd9dc722c6a74f993302dde23078aab Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Tue, 25 Feb 2014 16:48:31 +0400 Subject: [PATCH 011/225] gui/movieplayer.cpp: add text subtitles charset select and conversion --- src/gui/movieplayer.cpp | 58 ++++++++++++++++++++++++++++++++++++++--- src/gui/movieplayer.h | 1 + 2 files changed, 55 insertions(+), 4 deletions(-) diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index 5c57bac18..a541bcd39 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -56,6 +56,7 @@ #include #include #include +#include //extern CPlugins *g_PluginList; #if HAVE_TRIPLEDRAGON @@ -1375,9 +1376,21 @@ void CMoviePlayerGui::selectSubtitle() int select = -1; CMenuSelectorTarget * selector = new CMenuSelectorTarget(&select); - if(!numsubs) { + if(!numsubs) playback->FindAllSubs(spids, sub_supported, &numsubs, slanguage); - } + + CMenuOptionStringChooser * sc = new CMenuOptionStringChooser(LOCALE_SUBTITLES_CHARSET, &g_settings.subs_charset, true, NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED, true); + sc->addOption("UTF-8"); + sc->addOption("UCS-2"); + sc->addOption("CP1250"); + sc->addOption("CP1251"); + sc->addOption("CP1252"); + sc->addOption("CP1253"); + sc->addOption("KOI8-R"); + + APIDSelector.addItem(sc); + APIDSelector.addItem(GenericMenuSeparatorLine); + char cnt[5]; unsigned int count; for (count = 0; count < numsubs; count++) { @@ -1432,6 +1445,39 @@ void CMoviePlayerGui::clearSubtitle() fb_pixel_t * simple_resize32(uint8_t * orgin, uint32_t * colors, int nb_colors, int ox, int oy, int dx, int dy); +bool CMoviePlayerGui::convertSubtitle(std::string &text) +{ + bool ret = false; + iconv_t cd = iconv_open("UTF-8", g_settings.subs_charset.c_str()); + if (cd == (iconv_t)-1) { + perror("iconv_open"); + return ret; + } + size_t ilen = text.length(); + size_t olen = ilen*4; + size_t len = olen; + char * buf = (char *) malloc(olen+1); + if (buf == NULL) { + iconv_close(cd); + return ret; + } + memset(buf, olen+1, 0); + char * out = buf; + char * in = (char *) text.c_str(); + if (iconv(cd, &in, &ilen, &out, &olen) == (size_t)-1) { + printf("CMoviePlayerGui::convertSubtitle: iconv error\n"); + } + else { + memset(buf + (len - olen), 0, olen); + text = buf; + ret = true; + } + + free(buf); + iconv_close(cd); + return true; +} + void CMoviePlayerGui::showSubtitle(neutrino_msg_data_t data) { if (!data) { @@ -1535,8 +1581,12 @@ void CMoviePlayerGui::showSubtitle(neutrino_msg_data_t data) } } for (unsigned i = 0; i < subtext.size(); i++) { - if (!isUTF8(subtext[i])) - subtext[i] = convertLatin1UTF8(subtext[i]); + if (!isUTF8(subtext[i])) { + if (g_settings.subs_charset != "UTF-8") + convertSubtitle(subtext[i]); + else + subtext[i] = convertLatin1UTF8(subtext[i]); + } printf("subtext %d: [%s]\n", i, subtext[i].c_str()); } printf("********************************************************************\n"); diff --git a/src/gui/movieplayer.h b/src/gui/movieplayer.h index 5edab2792..0e9c09c41 100644 --- a/src/gui/movieplayer.h +++ b/src/gui/movieplayer.h @@ -139,6 +139,7 @@ class CMoviePlayerGui : public CMenuTarget void updateLcd(); void selectSubtitle(); + bool convertSubtitle(std::string &text); void showSubtitle(neutrino_msg_data_t data); void clearSubtitle(); void selectChapter(); From 3f7e757dcaa66c706b20aec1fd698f3f13379bd1 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Tue, 25 Feb 2014 17:22:59 +0400 Subject: [PATCH 012/225] src/Makefile.am: fix -liconv --- src/Makefile.am | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Makefile.am b/src/Makefile.am index 8d07aa28e..413f93280 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -140,10 +140,11 @@ neutrino_LDADD += -lca-ci -llnxtmvssUsr -llnxUKAL -llnxplatUsr -llnxtmasUsr -lln else neutrino_LDADD += -lnxp endif +endif + if BOXMODEL_APOLLO neutrino_LDADD += -liconv endif -endif bin_PROGRAMS += drivertool drivertool_SOURCES = drivertool.c From 9805f0abb7b9d3b4570058835ec532705db2d67d Mon Sep 17 00:00:00 2001 From: "[CST] Bas" Date: Tue, 7 Jan 2014 17:07:15 +0100 Subject: [PATCH 013/225] nederlands.locale: fix some weird characters that were supposed to be newlines. --- data/locale/nederlands.locale | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/data/locale/nederlands.locale b/data/locale/nederlands.locale index 5f4d0e229..6ec3d0176 100644 --- a/data/locale/nederlands.locale +++ b/data/locale/nederlands.locale @@ -1713,8 +1713,8 @@ settings.backup_failed Backup maken mislukt settings.help Help settings.menu_hints Menu hints weergeven settings.menu_pos Menu positie -settings.missingoptionsconffile De instellingen zijn geupdate. \nNieuwe opties zijn standaard ingesteld. -settings.noconffile Geen Neutrino-HD instellingen gevonden.\n Gebruikt standaard instellingen. +settings.missingoptionsconffile De instellingen zijn geupdate.\nNieuwe opties zijn standaard ingesteld. +settings.noconffile Geen Neutrino-HD instellingen gevonden.\nGebruikt standaard instellingen. settings.pos_bottom_left Links onder settings.pos_bottom_right Rechts onder settings.pos_default_center Gecentreerd boven @@ -1724,8 +1724,8 @@ settings.pos_top_right Rechts boven settings.restore Instellingen herstellen settings.restore_warn Alle instellingen zullen vervangen worden.\nDe ontvanger zal opnieuw opstarten\nWilt u verder gaan? shutdown.recoding_query Wilt u de opname stoppen? -shutdowntimer.announce De ontvanger zal binnen 1 minuut uitschakelen./nWilt u het uitschakelen annuleren? -sleeptimerbox.announce De ontvanger zal binnen 1 minunut in standby schakelen./nlWilt u dit annuleren? +shutdowntimer.announce De ontvanger zal binnen 1 minuut uitschakelen.\nWilt u het uitschakelen annuleren? +sleeptimerbox.announce De ontvanger zal binnen 1 minunut in standby schakelen.\nWilt u dit annuleren? sleeptimerbox.hint1 Afsluit tijd in minuten (000=uit) sleeptimerbox.hint2 De ontvanger schakelt zichzelf uit na deze periode in standby. sleeptimerbox.hint3 De ontvanger zal automatisch uitschakelen indien u de afstandsbediening niet gebruikt. From b8d5a61c1d76921a77e46e185c74f339b74bbec8 Mon Sep 17 00:00:00 2001 From: "[CST] Bas" Date: Tue, 7 Jan 2014 17:09:44 +0100 Subject: [PATCH 014/225] nederlands.locale: fix spelling error. --- data/locale/nederlands.locale | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/locale/nederlands.locale b/data/locale/nederlands.locale index 6ec3d0176..6d0d1d789 100644 --- a/data/locale/nederlands.locale +++ b/data/locale/nederlands.locale @@ -1725,7 +1725,7 @@ settings.restore Instellingen herstellen settings.restore_warn Alle instellingen zullen vervangen worden.\nDe ontvanger zal opnieuw opstarten\nWilt u verder gaan? shutdown.recoding_query Wilt u de opname stoppen? shutdowntimer.announce De ontvanger zal binnen 1 minuut uitschakelen.\nWilt u het uitschakelen annuleren? -sleeptimerbox.announce De ontvanger zal binnen 1 minunut in standby schakelen.\nWilt u dit annuleren? +sleeptimerbox.announce De ontvanger zal binnen 1 minuut in standby schakelen.\nWilt u dit annuleren? sleeptimerbox.hint1 Afsluit tijd in minuten (000=uit) sleeptimerbox.hint2 De ontvanger schakelt zichzelf uit na deze periode in standby. sleeptimerbox.hint3 De ontvanger zal automatisch uitschakelen indien u de afstandsbediening niet gebruikt. From 8beb80c24663ac6fc86475185d0cf6ba266e8057 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Tue, 25 Feb 2014 18:59:21 +0400 Subject: [PATCH 015/225] deutsch, english, nederlands locale: little change for twin, independent modes: TWIN meant for TWIN LNB, independent also suitable for monoblock --- data/locale/deutsch.locale | 4 ++-- data/locale/english.locale | 4 ++-- data/locale/nederlands.locale | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 287f53b3c..76eef10e4 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -1744,9 +1744,9 @@ satsetup.fastscan_prov_tvv TV Vlaanderen satsetup.fastscan_sd nur SD satsetup.fastscan_type Scantyp satsetup.fe_mode Tuner Modus -satsetup.fe_mode_independent Independent +satsetup.fe_mode_independent Independent / TWIN Monoblock satsetup.fe_mode_link_loop Loop -satsetup.fe_mode_link_twin TWIN +satsetup.fe_mode_link_twin TWIN LNB satsetup.fe_mode_master Master satsetup.fe_mode_unused Nicht genutzt satsetup.fe_setup Tuner Einstellungen diff --git a/data/locale/english.locale b/data/locale/english.locale index e97f6eb87..39820b4fc 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -1744,9 +1744,9 @@ satsetup.fastscan_prov_tvv TV Vlaanderen satsetup.fastscan_sd SD only satsetup.fastscan_type Scan type satsetup.fe_mode Tuner mode -satsetup.fe_mode_independent Independent +satsetup.fe_mode_independent Independent / TWIN Monoblock satsetup.fe_mode_link_loop Loop -satsetup.fe_mode_link_twin TWIN +satsetup.fe_mode_link_twin TWIN LNB satsetup.fe_mode_master Master satsetup.fe_mode_unused Unused satsetup.fe_setup Setup tuner diff --git a/data/locale/nederlands.locale b/data/locale/nederlands.locale index 6d0d1d789..67732d156 100644 --- a/data/locale/nederlands.locale +++ b/data/locale/nederlands.locale @@ -1618,9 +1618,9 @@ satsetup.fastscan_type Scantype satsetup.fe_mode Tuner mode satsetup.fe_mode Tuner modus satsetup.fe_mode_alone Onafhankelijk -satsetup.fe_mode_independent Onafhankelijk +satsetup.fe_mode_independent Onafhankelijk / TWIN Monoblock satsetup.fe_mode_link_loop Doorgelust -satsetup.fe_mode_link_twin Twin +satsetup.fe_mode_link_twin Twin LNB satsetup.fe_mode_loop Doorgelust satsetup.fe_mode_master Master satsetup.fe_mode_single Single From 6d18d1cfa1e97840913495658ed6304eba1485bd Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Tue, 25 Feb 2014 18:56:05 +0100 Subject: [PATCH 016/225] neutrino: Use uint32_t again for neutrino_msg_t & neutrino_msg_data_t --- src/driver/rcinput.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/driver/rcinput.h b/src/driver/rcinput.h index feb414941..89f7f4100 100644 --- a/src/driver/rcinput.h +++ b/src/driver/rcinput.h @@ -115,8 +115,8 @@ */ -typedef unsigned long neutrino_msg_t; -typedef unsigned long neutrino_msg_data_t; +typedef uint32_t neutrino_msg_t; +typedef uint32_t neutrino_msg_data_t; #define NEUTRINO_UDS_NAME "/tmp/neutrino.sock" From d750c9e0f9f9061a4fd267ae48ac8548d9e53f24 Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Wed, 26 Feb 2014 10:02:15 +0100 Subject: [PATCH 017/225] Update deutsch.locale --- data/locale/deutsch.locale | 1 + 1 file changed, 1 insertion(+) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 76eef10e4..66ba3a800 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -1875,6 +1875,7 @@ streaming.slow System oder Datenträger zu langsam! Bitte ggf. einige Aufnahmen streaming.write_error Die Aufnahme wurde leider abgebrochen,\nda ein Fehler beim Schreiben der Daten auftrat. stringinput.caps Groß-/Kleinbuchstaben stringinput.clear Alles löschen +subtitles.charset Zeichensatz subtitles.head Untertitel subtitles.stop Untertitel aus timer.eventrecord.msg Die Sendung wurde zur Aufnahme vorgemerkt. From 21f7c930aea8070bb4eaecd12226a85e4f9c20ba Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Wed, 26 Feb 2014 10:02:27 +0100 Subject: [PATCH 018/225] src/system/helpers.cpp: Add str_replace() function --- src/system/helpers.cpp | 15 +++++++++++++++ src/system/helpers.h | 1 + 2 files changed, 16 insertions(+) diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp index c4a80b7f5..5b51e0601 100644 --- a/src/system/helpers.cpp +++ b/src/system/helpers.cpp @@ -402,6 +402,21 @@ time_t toEpoch(std::string &date) } +std::string& str_replace(const std::string &search, const std::string &replace, std::string &text) +{ + if (search.empty() || text.empty()) + return text; + + size_t searchLen = search.length(); + while (1) { + size_t pos = text.find(search); + if (pos == std::string::npos) + break; + text.replace(pos, searchLen, replace); + } + return text; +} + CFileHelpers::CFileHelpers() { FileBufSize = 0xFFFF; diff --git a/src/system/helpers.h b/src/system/helpers.h index 1a68cb316..74b9e0208 100644 --- a/src/system/helpers.h +++ b/src/system/helpers.h @@ -54,6 +54,7 @@ std::string getFileExt(std::string &file); std::string getNowTimeStr(const char* format); std::string trim(std::string &str, const std::string &trimChars = " \n\r\t"); time_t toEpoch(std::string &date); +std::string& str_replace(const std::string &search, const std::string &replace, std::string &text); class CFileHelpers { From 0028ad0d9b117d453d218f2a359b675deb1c5e18 Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Wed, 26 Feb 2014 10:02:32 +0100 Subject: [PATCH 019/225] src/system/helpers.cpp: Add htmlEntityDecode() for decode html string --- src/system/helpers.cpp | 22 ++++++++++++++++++++++ src/system/helpers.h | 1 + 2 files changed, 23 insertions(+) diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp index 5b51e0601..2ab1512cd 100644 --- a/src/system/helpers.cpp +++ b/src/system/helpers.cpp @@ -417,6 +417,28 @@ std::string& str_replace(const std::string &search, const std::string &replace, return text; } +std::string& htmlEntityDecode(std::string& text) +{ + struct decode_table { + const char* code; + const char* htmlCode; + }; + decode_table dt[] = + { + {" ", " "}, + {"&", "&"}, + {"<", "<"}, + {">", ">"}, + {"\"", """}, + {"'", "'"}, + {NULL, NULL} + }; + for (int i = 0; dt[i].code != NULL; i++) + text = str_replace(dt[i].htmlCode, dt[i].code, text); + + return text; +} + CFileHelpers::CFileHelpers() { FileBufSize = 0xFFFF; diff --git a/src/system/helpers.h b/src/system/helpers.h index 74b9e0208..480c43f03 100644 --- a/src/system/helpers.h +++ b/src/system/helpers.h @@ -55,6 +55,7 @@ std::string getNowTimeStr(const char* format); std::string trim(std::string &str, const std::string &trimChars = " \n\r\t"); time_t toEpoch(std::string &date); std::string& str_replace(const std::string &search, const std::string &replace, std::string &text); +std::string& htmlEntityDecode(std::string& text); class CFileHelpers { From a250436d2944120f29e8c7e2372e628ffa73c316 Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Wed, 26 Feb 2014 10:02:38 +0100 Subject: [PATCH 020/225] CLuaInstance: Add DECODE_HTML flag to ctext.new for decode html string - Use function htmlEntityDecode() --- src/gui/luainstance.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/luainstance.cpp b/src/gui/luainstance.cpp index 046f783de..822de9c51 100644 --- a/src/gui/luainstance.cpp +++ b/src/gui/luainstance.cpp @@ -24,6 +24,7 @@ #include #include +#include #include #include #include @@ -1552,6 +1553,7 @@ int CLuaInstance::ComponentsTextNew(lua_State *L) { "ALIGN_TOP", CTextBox::TOP }, { "ALIGN_BOTTOM", CTextBox::BOTTOM }, { "ALIGN_NO_AUTO_LINEBREAK", CTextBox::NO_AUTO_LINEBREAK }, + { "DECODE_HTML", 0 }, { NULL, 0 } }; mode = 0; @@ -1559,6 +1561,8 @@ int CLuaInstance::ComponentsTextNew(lua_State *L) if (tmpMode.find(txt_align[i].name) != std::string::npos) mode |= txt_align[i].code; } + if (tmpMode.find("DECODE_HTML") != std::string::npos) + htmlEntityDecode(text); } CLuaComponentsText **udata = (CLuaComponentsText **) lua_newuserdata(L, sizeof(CLuaComponentsText *)); From 3ae6f132021c546f71fb3d3a0c9f61789816d7e1 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Wed, 26 Feb 2014 21:03:46 +0100 Subject: [PATCH 021/225] - cables.xml: update unitymedia as suggested by OneOfNine --- data/cables.xml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/data/cables.xml b/data/cables.xml index 610fa2fc8..3220eb5f9 100644 --- a/data/cables.xml +++ b/data/cables.xml @@ -247,17 +247,13 @@ - - - - - + From 8d1e6b1e005d3aff65c5aade52b4cf576b1119a7 Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Thu, 27 Feb 2014 22:46:33 +0100 Subject: [PATCH 022/225] CLuaInstance: Add has_shadow and window colors to cwindow.new --- src/gui/luainstance.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/gui/luainstance.cpp b/src/gui/luainstance.cpp index 822de9c51..f2891d96f 100644 --- a/src/gui/luainstance.cpp +++ b/src/gui/luainstance.cpp @@ -1308,11 +1308,15 @@ int CLuaInstance::CWindowNew(lua_State *L) { lua_assert(lua_istable(L,1)); - std::string name, icon = std::string(NEUTRINO_ICON_INFO); - std::string btnRed = ""; - std::string btnGreen = ""; - std::string btnYellow = ""; - std::string btnBlue = ""; + std::string name, icon = std::string(NEUTRINO_ICON_INFO); + lua_Integer color_frame = (lua_Integer)COL_MENUCONTENT_PLUS_6; + lua_Integer color_body = (lua_Integer)COL_MENUCONTENT_PLUS_0; + lua_Integer color_shadow = (lua_Integer)COL_MENUCONTENTDARK_PLUS_0; + std::string tmp1 = "false"; + std::string btnRed = ""; + std::string btnGreen = ""; + std::string btnYellow = ""; + std::string btnBlue = ""; int x = 100, y = 100, dx = 450, dy = 250; tableLookup(L, "x", x); tableLookup(L, "y", y); @@ -1320,6 +1324,11 @@ int CLuaInstance::CWindowNew(lua_State *L) tableLookup(L, "dy", dy); tableLookup(L, "name", name) || tableLookup(L, "title", name) || tableLookup(L, "caption", name); tableLookup(L, "icon", icon); + tableLookup(L, "has_shadow" , tmp1); + bool has_shadow = (tmp1 == "true" || tmp1 == "1" || tmp1 == "yes"); + tableLookup(L, "color_frame" , color_frame); + tableLookup(L, "color_body" , color_body); + tableLookup(L, "color_shadow", color_shadow); tableLookup(L, "btnRed", btnRed); tableLookup(L, "btnGreen", btnGreen); tableLookup(L, "btnYellow", btnYellow); @@ -1327,7 +1336,7 @@ int CLuaInstance::CWindowNew(lua_State *L) CLuaCWindow **udata = (CLuaCWindow **) lua_newuserdata(L, sizeof(CLuaCWindow *)); *udata = new CLuaCWindow(); - (*udata)->w = new CComponentsWindow(x, y, dx, dy, name.c_str(), icon.c_str()); + (*udata)->w = new CComponentsWindow(x, y, dx, dy, name.c_str(), icon.c_str(), has_shadow, (fb_pixel_t)color_frame, (fb_pixel_t)color_body, (fb_pixel_t)color_shadow); CComponentsFooter* footer = (*udata)->w->getFooterObject(); if (footer) { From c745b636f8a6786c33d21fe641dab7084283f9ba Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Fri, 28 Feb 2014 00:00:41 +0100 Subject: [PATCH 023/225] CPluginList::exec: Add CRCInput::RC_setup to exit all menus --- src/gui/pluginlist.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gui/pluginlist.cpp b/src/gui/pluginlist.cpp index 7291153f4..d2ee3cdc4 100644 --- a/src/gui/pluginlist.cpp +++ b/src/gui/pluginlist.cpp @@ -246,6 +246,11 @@ int CPluginList::exec(CMenuTarget* parent, const std::string & /*actionKey*/) g_RCInput->postMsg(msg, data); loop=false; } + else if ( msg == CRCInput::RC_setup ) + { + loop = false; + res = menu_return::RETURN_EXIT_ALL; + } else if ( CNeutrinoApp::getInstance()->handleMsg(msg, data) & messages_return::cancel_all ) { loop = false; From 5f4c1b986c3a041139be33b6d18ce238580d0855 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 7 Oct 2012 16:01:19 +0200 Subject: [PATCH 024/225] add basic support for DVB-T This needs more fine tuning wrt scan setup etc, but should work for now. Conflicts: data/Makefile.am data/locale/english.locale src/gui/scan.cpp src/gui/scan_setup.cpp src/neutrino.cpp src/zapit/include/zapit/getservices.h src/zapit/src/frontend.cpp src/zapit/src/getservices.cpp src/zapit/src/transponder.cpp --- data/Makefile.am | 2 +- data/locale/deutsch.locale | 2 + data/locale/english.locale | 2 + data/mk_terrestrial_xml.pl | 92 ++++++++++++++++++++++++ data/terrestrial.xml | 86 ++++++++++++++++++++++ src/gui/scan.cpp | 12 ++++ src/gui/scan_setup.cpp | 43 +++++++++-- src/neutrino.cpp | 20 ++++-- src/system/locals.h | 2 + src/system/locals_intern.h | 2 + src/zapit/include/zapit/scan.h | 1 - src/zapit/include/zapit/settings.h | 1 + src/zapit/src/frontend.cpp | 111 ++++++++++++++++++++++++++--- src/zapit/src/getservices.cpp | 61 ++++++++++++++-- src/zapit/src/scan.cpp | 12 ++-- src/zapit/src/transponder.cpp | 49 +++++++++++-- 16 files changed, 460 insertions(+), 38 deletions(-) create mode 100755 data/mk_terrestrial_xml.pl create mode 100644 data/terrestrial.xml diff --git a/data/Makefile.am b/data/Makefile.am index ffce4ceb4..5f4751b23 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -5,7 +5,7 @@ SUBDIRS += lcd endif configdir = $(CONFIGDIR) -config_DATA = cables.xml satellites.xml encoding.conf tobackup.conf providermap.xml settingsupdate.conf +config_DATA = cables.xml satellites.xml encoding.conf tobackup.conf providermap.xml settingsupdate.conf terrestrial.xml install-data-hook: $(INSTALL) -d $(DESTDIR)/$(CONFIGDIR)/zapit diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 66ba3a800..fb1065324 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -1784,6 +1784,7 @@ scants.abort_body Scanvorgang wirklich abbrechen? scants.abort_header breche Scan ab... scants.actcable Kabelnetz: scants.actsatellite Satellit: +scants.actterrestrial Terrestrisch: scants.bouquet Bouquets scants.bouquet_create neu erstellen scants.bouquet_erase löschen @@ -1878,6 +1879,7 @@ stringinput.clear Alles löschen subtitles.charset Zeichensatz subtitles.head Untertitel subtitles.stop Untertitel aus +terrestrialsetup.provider DVB-T Region timer.eventrecord.msg Die Sendung wurde zur Aufnahme vorgemerkt. timer.eventrecord.title Aufnahme vormerken timer.eventtimed.msg Die Sendung wurde vorgemerkt. diff --git a/data/locale/english.locale b/data/locale/english.locale index 39820b4fc..5d9b82545 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -1784,6 +1784,7 @@ scants.abort_body Should the search really be aborted? scants.abort_header Abortion of channel scan scants.actcable Cable: scants.actsatellite Satellite: +scants.actterrestrial Terrestrial: scants.bouquet Bouquet scants.bouquet_create create new scants.bouquet_erase erase old @@ -1878,6 +1879,7 @@ stringinput.clear clear all subtitles.charset Charset subtitles.head Subtitles subtitles.stop Stop subtitles +terrestrialsetup.provider Terrestrial Provider timer.eventrecord.msg The event is scheduled for recording.\nTo edit the schedule open the timer list. timer.eventrecord.title Schedule Record timer.eventtimed.msg The event is scheduled.\nThe box will power on and \nswitch to this channel at the given time. diff --git a/data/mk_terrestrial_xml.pl b/data/mk_terrestrial_xml.pl new file mode 100755 index 000000000..e008f25ec --- /dev/null +++ b/data/mk_terrestrial_xml.pl @@ -0,0 +1,92 @@ +#!/usr/bin/perl -w +# +# create a terrestrial.xml for neutrino from the data installed by the +# dvb utils +# the behaviour is similar to the "scan" program form the dvb utils. +# +# Released under the GPL V2 or later +# (C) 2009-2012 Stefan Seyfried + +use strict; +my $srcdir = "/usr/share/dvb/dvb-t"; + +# can be given as "de-*" +my $scanfile = shift; +$scanfile = "auto-Default" unless (defined $scanfile); + +my @sourcefiles = glob($srcdir . "/" . $scanfile); +my ($sourcefile, $basename, $line, $k); +my ($freq, $bw, $cr_hp, $cr_lp, $mod, $tmode, $gint, $hier); + +# from /usr/include/linux/dvb/frontend.h +# inversion is not used in the scan files +my %INV = ("INVERSION_OFF" => 0, "INVERSION_ON" => 1, "INVERSION_AUTO" => 2); +my %CODE_RATE = ("NONE" => 0, "1/2" => 1, "2/3" => 2, "3/4" => 3, "4/5" => 4, + "5/6" => 5, "6/7" => 6, "7/8" => 7, "8/9" => 8, "AUTO" => 9); +my %MODULATION = ("QPSK" => 0, "QAM16" => 1, "QAM32" => 2, "QAM64" => 3, + "QAM128" => 4, "QAM256" => 5, "AUTO" => 6); +my %T_MODE = ("2k" => 0, "8k" => 1, "AUTO" => 2); +my %BWIDTH = ("8MHz" => 0, "7MHz" => 1, "6MHz" => 2, "AUTO" => 3); +my %GINTERVAL = ("1/32" => 0, "1/16" => 1, "1/8" => 2, "1/4" => 3, "AUTO" => 4); +my %HIERARCHY = ("NONE" => 0, "1" => 1, "2" => 2, "4" => 3, "AUTO" => 4); + + +# print the header +print("\n"); +print("\n\n"); +print("\n"); +# +# explain the parameters +print("\n\n"); +# header ends... + +print("\n"); +foreach $sourcefile (@sourcefiles) +{ + open(FILE, "< $sourcefile") or die "can't open $sourcefile: $!\n"; + $basename = $sourcefile; + $basename =~ s#^.*/##; + print("\t\n"); + while ($line = ) + { # T 184500000 7MHz 3/4 NONE QAM16 8k 1/4 NONE + next unless ($line =~ m/^T\s+(\d+)\s+(\dMHz)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)/); + $freq = $1; $bw = $2; $cr_hp = $3; $cr_lp = $4; $mod = $5; $tmode = $6; $gint = $7; $hier = $8; + unless (defined($CODE_RATE{$cr_hp})) { warn "$basename: illegal cr_hp: $cr_hp, using AUTO\n"; $cr_hp="AUTO" }; + unless (defined($CODE_RATE{$cr_lp})) { warn "$basename: illegal cr_lp: $cr_lp, using AUTO\n"; $cr_lp="AUTO" }; + unless (defined($MODULATION{$mod})) { die "$basename: illegal mod: $mod\n" }; # no errors in those (yet). + unless (defined($T_MODE{$tmode})) { die "$basename: illegal tmode: $tmode\n" }; + unless (defined($GINTERVAL{$gint})) { die "$basename: illegal gint: $gint\n" }; + unless (defined($HIERARCHY{$hier})) { die "$basename: illegal hier: $hier\n" }; + unless (defined($BWIDTH{$bw})) { die "$basename: illegal bw: $bw\n" }; + if ($cr_hp eq "NONE") { $cr_hp="AUTO" }; # same as scan.c + if ($cr_lp eq "NONE") { $cr_lp="AUTO" }; # same as scan.c + printf("\t\t\n", + $freq / 1000, $BWIDTH{$bw}, $MODULATION{$mod}, + $T_MODE{$tmode}, $CODE_RATE{$cr_hp}, $CODE_RATE{$cr_lp}, + $GINTERVAL{$gint}, $HIERARCHY{$hier}); + } + print("\t\n"); +} +print("\n"); diff --git a/data/terrestrial.xml b/data/terrestrial.xml new file mode 100644 index 000000000..6c03dd07e --- /dev/null +++ b/data/terrestrial.xml @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/gui/scan.cpp b/src/gui/scan.cpp index f553be1a4..4725abf55 100644 --- a/src/gui/scan.cpp +++ b/src/gui/scan.cpp @@ -221,6 +221,18 @@ int CScanTs::exec(CMenuTarget* /*parent*/, const std::string & actionKey) TP.feparams.dvb_feparams.u.qpsk.symbol_rate = atoi(scansettings.sat_TP_rate.c_str()); TP.feparams.dvb_feparams.u.qpsk.fec_inner = (fe_code_rate_t) scansettings.sat_TP_fec; TP.polarization = scansettings.sat_TP_pol; + } else if (deltype == FE_OFDM) { + /* DVB-T. TODO: proper menu and parameter setup, not all "AUTO" */ + if (TP.feparams.dvb_feparams.frequency < 300000) + TP.feparams.dvb_feparams.u.ofdm.bandwidth = BANDWIDTH_7_MHZ; + else + TP.feparams.dvb_feparams.u.ofdm.bandwidth = BANDWIDTH_8_MHZ; + TP.feparams.dvb_feparams.u.ofdm.code_rate_HP = FEC_AUTO; + TP.feparams.dvb_feparams.u.ofdm.code_rate_LP = FEC_AUTO; + TP.feparams.dvb_feparams.u.ofdm.constellation = QAM_AUTO; + TP.feparams.dvb_feparams.u.ofdm.transmission_mode = TRANSMISSION_MODE_AUTO; + TP.feparams.dvb_feparams.u.ofdm.guard_interval = GUARD_INTERVAL_AUTO; + TP.feparams.dvb_feparams.u.ofdm.hierarchy_information = HIERARCHY_AUTO; } else { TP.feparams.dvb_feparams.frequency = atoi(scansettings.cable_TP_freq.c_str()); TP.feparams.dvb_feparams.u.qam.symbol_rate = atoi(scansettings.cable_TP_rate.c_str()); diff --git a/src/gui/scan_setup.cpp b/src/gui/scan_setup.cpp index a00bfde8e..c84e5c8e8 100644 --- a/src/gui/scan_setup.cpp +++ b/src/gui/scan_setup.cpp @@ -476,6 +476,36 @@ int CScanSetup::showScanMenu() settings->addItem(fcableScan); settings->addItem(GenericMenuSeparatorLine); } + if (CFEManager::getInstance()->haveTerr()) { + r_system = DVB_T; + // tune timeout, "Setup tuner" is not shown for only one non-sat tuner + if (CFEManager::getInstance()->getFrontendCount() <= 1) { + CMenuOptionNumberChooser * nc = new CMenuOptionNumberChooser(LOCALE_EXTRA_ZAPIT_FE_TIMEOUT, (int *)&zapitCfg.feTimeout, true, 6, 100); + nc->setHint("", LOCALE_MENU_HINT_SCAN_FETIMEOUT); + settings->addItem(nc); + } + + //auto scan + char autoscan[64]; + std::string s_capt_part = g_Locale->getText(LOCALE_TERRESTRIALSETUP_PROVIDER); + snprintf(autoscan, 64, g_Locale->getText(LOCALE_SATSETUP_AUTO_SCAN), s_capt_part.c_str()); + bool have_other = ! CFEManager::getInstance()->terrOnly(); + + /* FIXME leak, satSelect added to both auto and manual scan, so one of them cannot be deleted */ + CMenuWidget * autoScan = new CMenuWidget(LOCALE_SERVICEMENU_SCANTS, NEUTRINO_ICON_SETTINGS, w, MN_WIDGET_ID_SCAN_AUTO_SCAN); + addScanMenuAutoScan(autoScan); + mf = new CMenuDForwarder(autoscan, true, NULL, autoScan, "", have_other ? CRCInput::RC_nokey : CRCInput::RC_green, have_other ? NULL : NEUTRINO_ICON_BUTTON_GREEN); + mf->setHint("", LOCALE_MENU_HINT_SCAN_AUTO); + settings->addItem(mf); + + //manual scan + CMenuWidget * manualScan = new CMenuWidget(LOCALE_SATSETUP_MANUAL_SCAN, NEUTRINO_ICON_SETTINGS, w, MN_WIDGET_ID_SCAN_MANUAL_SCAN); + addScanMenuManualScan(manualScan); + mf = new CMenuForwarder(LOCALE_SATSETUP_MANUAL_SCAN, true, NULL, manualScan, "", have_other ? CRCInput::RC_nokey : CRCInput::RC_yellow, have_other ? NULL : NEUTRINO_ICON_BUTTON_YELLOW); + mf->setHint("", LOCALE_MENU_HINT_SCAN_MANUAL); + settings->addItem(mf); + settings->addItem(GenericMenuSeparatorLine); + } //service select mode mc = new CMenuOptionChooser(LOCALE_ZAPIT_SCANTYPE, (int *)&scansettings.scanType, SCANTS_ZAPIT_SCANTYPE, SCANTS_ZAPIT_SCANTYPE_COUNT, true, NULL, CRCInput::convertDigitToKey(shortcut++), "", true); mc->setHint("", LOCALE_MENU_HINT_SCAN_SCANTYPE); @@ -1266,7 +1296,6 @@ int CScanSetup::addScanOptionsItems(CMenuWidget *options_menu, const int &shortc printf("[neutrino] CScanSetup call %s...\n", __FUNCTION__); int shortCut = shortcut; - CMenuOptionChooser *fec = NULL; CMenuOptionChooser *mod_pol = NULL; CMenuForwarder *Freq = NULL; @@ -1293,13 +1322,19 @@ int CScanSetup::addScanOptionsItems(CMenuWidget *options_menu, const int &shortc Rate->setHint("", LOCALE_MENU_HINT_SCAN_RATE); mod_pol = new CMenuOptionChooser(LOCALE_EXTRA_TP_MOD, (int *)&scansettings.cable_TP_mod, SATSETUP_SCANTP_MOD, SATSETUP_SCANTP_MOD_COUNT, true, NULL, CRCInput::convertDigitToKey(shortCut++)); mod_pol->setHint("", LOCALE_MENU_HINT_SCAN_MOD); + } else if (r_system == DVB_T) { + CStringInput *freq = new CStringInput(LOCALE_EXTRA_TP_FREQ, &scansettings.terr_TP_freq, 6, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "0123456789"); + Freq = new CMenuDForwarder(LOCALE_EXTRA_TP_FREQ, true, scansettings.terr_TP_freq, freq, "", CRCInput::convertDigitToKey(shortCut++)); + Freq->setHint("", LOCALE_MENU_HINT_SCAN_FREQ); } options_menu->addItem(Freq); - options_menu->addItem(Rate); - if (r_system == DVB_S) + if (Rate) + options_menu->addItem(Rate); + if (fec) options_menu->addItem(fec); - options_menu->addItem(mod_pol); + if (mod_pol) + options_menu->addItem(mod_pol); return shortCut; } diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 51ae3a1d5..81aa36f4d 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -1891,12 +1891,20 @@ TIMER_START(); cpuFreq = new cCpuFreqManager(); cpuFreq->SetCpuFreq(g_settings.cpufreq * 1000 * 1000); - - g_info.delivery_system = CFEManager::getInstance()->getLiveFE()->getInfo()->type == FE_QPSK ? DVB_S : DVB_C; -#if HAVE_TRIPLEDRAGON - /* only SAT-hd1 before rev 8 has fan, rev 1 is TD (compat hack) */ - g_info.has_fan = (cs_get_revision() > 1 && cs_get_revision() < 8 && g_info.delivery_system == DVB_S); -#else + switch (CFEManager::getInstance()->getLiveFE()->getInfo()->type) { + case FE_QPSK: + g_info.delivery_system = DVB_S; + break; + case FE_OFDM: + g_info.delivery_system = DVB_T; + break; + case FE_QAM: + default: + g_info.delivery_system = DVB_C; + break; + } +#if HAVE_COOL_HARDWARE + /* only SAT-hd1 before rev 8 has fan */ g_info.has_fan = (cs_get_revision() < 8 && g_info.delivery_system == DVB_S); #endif dprintf(DEBUG_NORMAL, "g_info.has_fan: %d\n", g_info.has_fan); diff --git a/src/system/locals.h b/src/system/locals.h index 258375c28..85f153220 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -1811,6 +1811,7 @@ typedef enum LOCALE_SCANTS_ABORT_HEADER, LOCALE_SCANTS_ACTCABLE, LOCALE_SCANTS_ACTSATELLITE, + LOCALE_SCANTS_ACTTERRESTRIAL, LOCALE_SCANTS_BOUQUET, LOCALE_SCANTS_BOUQUET_CREATE, LOCALE_SCANTS_BOUQUET_ERASE, @@ -1905,6 +1906,7 @@ typedef enum LOCALE_SUBTITLES_CHARSET, LOCALE_SUBTITLES_HEAD, LOCALE_SUBTITLES_STOP, + LOCALE_TERRESTRIALSETUP_PROVIDER, LOCALE_TIMER_EVENTRECORD_MSG, LOCALE_TIMER_EVENTRECORD_TITLE, LOCALE_TIMER_EVENTTIMED_MSG, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 32306cb70..69ac38b0e 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -1811,6 +1811,7 @@ const char * locale_real_names[] = "scants.abort_header", "scants.actcable", "scants.actsatellite", + "scants.actterrestrial", "scants.bouquet", "scants.bouquet_create", "scants.bouquet_erase", @@ -1905,6 +1906,7 @@ const char * locale_real_names[] = "subtitles.charset", "subtitles.head", "subtitles.stop", + "terrestrialsetup.provider", "timer.eventrecord.msg", "timer.eventrecord.title", "timer.eventtimed.msg", diff --git a/src/zapit/include/zapit/scan.h b/src/zapit/include/zapit/scan.h index 938dab62b..3b6046e45 100644 --- a/src/zapit/include/zapit/scan.h +++ b/src/zapit/include/zapit/scan.h @@ -61,7 +61,6 @@ class CServiceScan : public OpenThreads::Thread private: bool started; bool running; - bool cable; bool abort_scan; scan_type_t scan_mode; int flags; diff --git a/src/zapit/include/zapit/settings.h b/src/zapit/include/zapit/settings.h index c70c58fd2..7be89bc9f 100644 --- a/src/zapit/include/zapit/settings.h +++ b/src/zapit/include/zapit/settings.h @@ -47,6 +47,7 @@ #define CABLES_XML CONFIGDIR "/cables.xml" #define SATELLITES_XML CONFIGDIR "/satellites.xml" +#define TERRESTRIAL_XML CONFIGDIR "/terrestrial.xml" #define AUDIO_DEVICE "/dev/dvb/adapter0/audio0" #define DEMUX_DEVICE "/dev/dvb/adapter0/demux0" diff --git a/src/zapit/src/frontend.cpp b/src/zapit/src/frontend.cpp index 40d8e6947..24a75dd58 100644 --- a/src/zapit/src/frontend.cpp +++ b/src/zapit/src/frontend.cpp @@ -51,17 +51,27 @@ extern int zapit_debug; #define FREQUENCY 1 #define MODULATION 2 #define INVERSION 3 +// common to S/S2/C #define SYMBOL_RATE 4 #define DELIVERY_SYSTEM 5 #define INNER_FEC 6 // DVB-S/S2 specific #define PILOTS 7 #define ROLLOFF 8 +// DVB-T specific +#define BANDWIDTH 4 +#define CODE_RATE_HP 6 +#define CODE_RATE_LP 7 +#define TRANSMISSION_MODE 8 +#define GUARD_INTERVAL 9 +#define HIERARCHY 10 + #define FE_COMMON_PROPS 2 #define FE_DVBS_PROPS 6 #define FE_DVBS2_PROPS 8 #define FE_DVBC_PROPS 6 +#define FE_DVBT_PROPS 10 /* stolen from dvb.c from vlc */ static const struct dtv_property dvbs_cmdargs[] = { @@ -99,6 +109,21 @@ static const struct dtv_property dvbc_cmdargs[] = { { DTV_TUNE, {}, { 0 }, 0}, }; +static const struct dtv_property dvbt_cmdargs[] = { + { DTV_CLEAR, {0,0,0}, { 0 } ,0}, + { DTV_FREQUENCY, {}, { 0 } ,0}, + { DTV_MODULATION, {}, { QAM_AUTO } ,0}, + { DTV_INVERSION, {}, { INVERSION_AUTO } ,0}, + { DTV_BANDWIDTH_HZ, {}, { 8000000 } ,0}, + { DTV_DELIVERY_SYSTEM, {}, { SYS_DVBT } ,0}, + { DTV_CODE_RATE_HP, {}, { FEC_AUTO } ,0}, + { DTV_CODE_RATE_LP, {}, { FEC_AUTO } ,0}, + { DTV_TRANSMISSION_MODE,{}, { TRANSMISSION_MODE_AUTO}, 0}, + { DTV_GUARD_INTERVAL, {}, { GUARD_INTERVAL_AUTO}, 0}, + { DTV_HIERARCHY, {}, { HIERARCHY_AUTO }, 0}, + { DTV_TUNE, {}, { 0 }, 0}, +}; + #define diff(x,y) (max(x,y) - min(x,y)) @@ -500,7 +525,8 @@ void CFrontend::getDelSys(int f, int m, char *&fec, char *&sys, char *&mod) void CFrontend::getDelSys(uint8_t type, int f, int m, char *&fec, char *&sys, char *&mod) { - if (type == FE_QPSK) { + switch (type) { + case FE_QPSK: if (f < FEC_S2_QPSK_1_2) { sys = (char *)"DVB"; mod = (char *)"QPSK"; @@ -511,7 +537,9 @@ void CFrontend::getDelSys(uint8_t type, int f, int m, char *&fec, char *&sys, ch sys = (char *)"DVB-S2"; mod = (char *)"8PSK"; } - } else if (type == FE_QAM) { + break; + case FE_QAM: + case FE_OFDM: sys = (char *)"DVB"; switch (m) { case QAM_16: @@ -529,11 +557,23 @@ void CFrontend::getDelSys(uint8_t type, int f, int m, char *&fec, char *&sys, ch case QAM_256: mod = (char *)"QAM_256"; break; + case QPSK: + if (type == FE_OFDM) { + mod = (char *)"QPSK"; + break; + } + /* fallthrouh for FE_QAM... */ case QAM_AUTO: default: mod = (char *)"QAM_AUTO"; break; } + break; + default: + printf("[frontend] unknown type %d!\n", type); + sys = (char *)"UNKNOWN"; + mod = (char *)"UNKNOWN"; + break; } switch (f) { @@ -614,6 +654,11 @@ bool CFrontend::buildProperties(const FrontendParameters *feparams, struct dtv_p modulation = feparams->dvb_feparams.u.qam.modulation; delsys = SYS_DVBC_ANNEX_AC; break; + case FE_OFDM: + fec_inner = FEC_AUTO; /* dummy, for next switch statement */ + modulation = feparams->dvb_feparams.u.ofdm.constellation; + delsys = SYS_DVBT; + break; default: printf("frontend: unknown frontend type, exiting\n"); return 0; @@ -712,6 +757,36 @@ bool CFrontend::buildProperties(const FrontendParameters *feparams, struct dtv_p cmdseq.props[INNER_FEC].u.data = fec_inner; nrOfProps = FE_DVBC_PROPS; break; + case FE_OFDM: + memcpy(cmdseq.props, dvbt_cmdargs, sizeof(dvbt_cmdargs)); + nrOfProps = FE_DVBT_PROPS; + cmdseq.props[FREQUENCY].u.data = feparams->dvb_feparams.frequency; + cmdseq.props[MODULATION].u.data = modulation; + cmdseq.props[INVERSION].u.data = feparams->dvb_feparams.inversion; + cmdseq.props[CODE_RATE_HP].u.data = feparams->dvb_feparams.u.ofdm.code_rate_HP; + cmdseq.props[CODE_RATE_LP].u.data = feparams->dvb_feparams.u.ofdm.code_rate_LP; + cmdseq.props[TRANSMISSION_MODE].u.data = feparams->dvb_feparams.u.ofdm.transmission_mode; + cmdseq.props[GUARD_INTERVAL].u.data = feparams->dvb_feparams.u.ofdm.guard_interval; + cmdseq.props[HIERARCHY].u.data = feparams->dvb_feparams.u.ofdm.hierarchy_information; + switch (feparams->dvb_feparams.u.ofdm.bandwidth) { + case BANDWIDTH_6_MHZ: + cmdseq.props[BANDWIDTH].u.data = 6000000; + break; + case BANDWIDTH_7_MHZ: + cmdseq.props[BANDWIDTH].u.data = 7000000; + break; + case BANDWIDTH_8_MHZ: + cmdseq.props[BANDWIDTH].u.data = 8000000; + break; + default: + printf("[fe%d] unknown bandwidth for OFDM %d\n", + fenumber, feparams->dvb_feparams.u.ofdm.bandwidth); + /* fallthrough */ + case BANDWIDTH_AUTO: + cmdseq.props[BANDWIDTH].u.data = 0; + break; + } + break; default: printf("frontend: unknown frontend type, exiting\n"); return false; @@ -731,7 +806,7 @@ bool CFrontend::buildProperties(const FrontendParameters *feparams, struct dtv_p int CFrontend::setFrontend(const FrontendParameters *feparams, bool nowait) { - struct dtv_property cmdargs[FE_COMMON_PROPS + FE_DVBS2_PROPS]; // WARNING: increase when needed more space + struct dtv_property cmdargs[FE_COMMON_PROPS + FE_DVBT_PROPS]; // WARNING: increase when needed more space struct dtv_properties cmdseq; cmdseq.num = FE_COMMON_PROPS; @@ -1096,10 +1171,10 @@ int CFrontend::setParameters(TP_params *TP, bool nowait) memcpy(&feparams, &TP->feparams, sizeof(feparams)); freq = (int) feparams.dvb_feparams.frequency; char * f, *s, *m; + bool high_band; - if (info.type == FE_QPSK) { - bool high_band; - + switch (info.type) { + case FE_QPSK: if (freq < lnbSwitch) { high_band = false; freq_offset = lnbOffsetLow; @@ -1111,10 +1186,30 @@ int CFrontend::setParameters(TP_params *TP, bool nowait) feparams.dvb_feparams.frequency = abs(freq - freq_offset); setSec(TP->diseqc, TP->polarization, high_band); getDelSys(feparams.dvb_feparams.u.qpsk.fec_inner, dvbs_get_modulation(feparams.dvb_feparams.u.qpsk.fec_inner), f, s, m); - } else if (info.type == FE_QAM) { + break; + case FE_QAM: if (freq < 1000*1000) feparams.dvb_feparams.frequency = freq * 1000; - getDelSys(feparams.dvb_feparams.u.qam.fec_inner, feparams.dvb_feparams.u.qam.modulation, f, s, m); + getDelSys(feparams.dvb_feparams.u.qam.fec_inner,feparams.dvb_feparams.u.qam.modulation, f, s, m); +#if 0 + switch (TP->feparams.dvb_feparams.inversion) { + case INVERSION_OFF: + TP->feparams.dvb_feparams.inversion = INVERSION_ON; + break; + case INVERSION_ON: + default: + TP->feparams.dvb_feparams.inversion = INVERSION_OFF; + break; + } +#endif + case FE_OFDM: + if (freq < 1000*1000) + feparams.dvb_feparams.frequency = freq * 1000; + getDelSys(feparams.dvb_feparams.u.ofdm.code_rate_HP,feparams.dvb_feparams.u.ofdm.constellation, f, s, m); + break; + default: + printf("[fe%d] unknown type %d\n", fenumber, info.type); + break; } printf("[fe%d] tune to %d %s %s %s %s srate %d (tuner %d offset %d timeout %d)\n", fenumber, freq, s, m, f, diff --git a/src/zapit/src/getservices.cpp b/src/zapit/src/getservices.cpp index 30b087724..a4b2fed4d 100644 --- a/src/zapit/src/getservices.cpp +++ b/src/zapit/src/getservices.cpp @@ -70,11 +70,12 @@ bool CServiceManager::ParseScanXml(fe_type_t delsys) case FE_QPSK: scanInputParser = parseXmlFile(SATELLITES_XML); break; - case FE_QAM: scanInputParser = parseXmlFile(CABLES_XML); break; - + case FE_OFDM: + scanInputParser = parseXmlFile(TERRESTRIAL_XML); + break; default: WARN("Unknown type %d", frontendType); return false; @@ -330,14 +331,17 @@ void CServiceManager::ParseTransponders(xmlNodePtr node, t_satellite_position sa feparams.dvb_feparams.frequency = xmlGetNumericAttribute(node, "frq", 0); feparams.dvb_feparams.inversion = (fe_spectral_inversion) xmlGetNumericAttribute(node, "inv", 0); - if(delsys == FE_QAM) { + switch (delsys) { + case FE_OFDM: + case FE_QAM: feparams.dvb_feparams.u.qam.symbol_rate = xmlGetNumericAttribute(node, "sr", 0); feparams.dvb_feparams.u.qam.fec_inner = (fe_code_rate_t) xmlGetNumericAttribute(node, "fec", 0); feparams.dvb_feparams.u.qam.modulation = (fe_modulation_t) xmlGetNumericAttribute(node, "mod", 0); if (feparams.dvb_feparams.frequency > 1000*1000) feparams.dvb_feparams.frequency = feparams.dvb_feparams.frequency/1000; //transponderlist was read from tuxbox - } else { + break; + default: feparams.dvb_feparams.u.qpsk.fec_inner = (fe_code_rate_t) xmlGetNumericAttribute(node, "fec", 0); feparams.dvb_feparams.u.qpsk.symbol_rate = xmlGetNumericAttribute(node, "sr", 0); @@ -351,7 +355,7 @@ void CServiceManager::ParseTransponders(xmlNodePtr node, t_satellite_position sa else feparams.dvb_feparams.frequency = (int) 1000 * (int) round ((double) feparams.dvb_feparams.frequency / (double) 1000); } - freq_id_t freq = CREATE_FREQ_ID(feparams.dvb_feparams.frequency, delsys == FE_QAM); + freq_id_t freq = CREATE_FREQ_ID(feparams.dvb_feparams.frequency, delsys != FE_QPSK); transponder_id_t tid = CREATE_TRANSPONDER_ID64(freq, satellitePosition,original_network_id,transport_stream_id); transponder t(delsys, tid, feparams, polarization); @@ -476,6 +480,11 @@ void CServiceManager::FindTransponder(xmlNodePtr search) char * name = xmlGetAttribute(search, "name"); satellitePosition = GetSatellitePosition(name); } + else if (!strcmp(xmlGetName(search), "terrestrial")) { + delsys = FE_OFDM; + char * name = xmlGetAttribute(search, "name"); + satellitePosition = GetSatellitePosition(name); + } else if ((strcmp(xmlGetName(search), "sat"))) { search = search->xmlNextNode; continue; @@ -527,7 +536,28 @@ void CServiceManager::ParseSatTransponders(fe_type_t fType, xmlNodePtr search, t feparams.dvb_feparams.u.qpsk.fec_inner = (fe_code_rate_t) xml_fec; feparams.dvb_feparams.frequency = (int) 1000 * (int) round ((double) feparams.dvb_feparams.frequency / (double) 1000); } - freq_id_t freq = CREATE_FREQ_ID(feparams.dvb_feparams.frequency, fType == FE_QAM); + else if (fType == FE_OFDM) { + feparams.dvb_feparams.u.ofdm.bandwidth = (fe_bandwidth_t) + xmlGetNumericAttribute(tps, "bandwidth", 0); + feparams.dvb_feparams.u.ofdm.constellation = (fe_modulation_t) + xmlGetNumericAttribute(tps, "constellation", 0); + feparams.dvb_feparams.u.ofdm.transmission_mode = (fe_transmit_mode_t) + xmlGetNumericAttribute(tps, "transmission_mode", 0); + feparams.dvb_feparams.u.ofdm.code_rate_HP = (fe_code_rate_t) + xmlGetNumericAttribute(tps, "code_rate_HP", 0); + feparams.dvb_feparams.u.ofdm.code_rate_LP = (fe_code_rate_t) + xmlGetNumericAttribute(tps, "code_rate_LP", 0); + feparams.dvb_feparams.u.ofdm.guard_interval = (fe_guard_interval_t) + xmlGetNumericAttribute(tps, "guard_interval", 0); + feparams.dvb_feparams.u.ofdm.hierarchy_information = (fe_hierarchy_t) + xmlGetNumericAttribute(tps, "hierarchy", 0); + if (feparams.dvb_feparams.frequency > 1000*1000) + feparams.dvb_feparams.frequency /= 1000; // old transponder list + } + else /* we'll probably crash sooner or later, so write to STDERR... */ + fprintf(stderr, "[getservices] %s: unknown frontend type %d!\n", __func__, fType); + + freq_id_t freq = CREATE_FREQ_ID(feparams.dvb_feparams.frequency, fType != FE_QPSK); polarization &= 7; transponder_id_t tid = CREATE_TRANSPONDER_ID64(freq, satellitePosition, fake_nid, fake_tid); @@ -675,6 +705,7 @@ bool CServiceManager::LoadServices(bool only_current) satcleared = 1; } #endif + TIMER_START(); allchans.clear(); transponders.clear(); @@ -694,6 +725,10 @@ bool CServiceManager::LoadServices(bool only_current) INFO("Loading cables..."); LoadScanXml(FE_QAM); } + if (CFEManager::getInstance()->haveTerr()) { + INFO("Loading terrestrial..."); + LoadScanXml(FE_OFDM); + } parser = parseXmlFile(SERVICES_XML); if (parser != NULL) { @@ -704,6 +739,11 @@ bool CServiceManager::LoadServices(bool only_current) if (!(strcmp(xmlGetName(search), "sat"))) { position = xmlGetSignedNumericAttribute(search, "position", 10); InitSatPosition(position, name, false, FE_QPSK); + } else if (!(strcmp(xmlGetName(search), "terrestrial"))) { + position = GetSatellitePosition(name); + if (!position) + position = (0x0EFF & fake_pos++); + InitSatPosition(position, name, false, FE_OFDM); } else { position = GetSatellitePosition(name); if (!position) @@ -783,7 +823,9 @@ void CServiceManager::WriteSatHeader(FILE * fd, sat_config_t &config) case FE_QAM: /* cable */ fprintf(fd, "\t\n", config.name.c_str(), config.position); break; - case FE_OFDM: + case FE_OFDM: /* terrestrial */ + fprintf(fd, "\t\n", config.name.c_str(), config.position); + break; default: break; } @@ -853,6 +895,9 @@ void CServiceManager::SaveServices(bool tocopy, bool if_changed, bool no_deleted case FE_QAM: fprintf(fd, "\t\n"); break; + case FE_OFDM: + fprintf(fd, "\t\n"); + break; default: break; } @@ -977,6 +1022,8 @@ bool CServiceManager::SaveCurrentServices(transponder_id_t tpid) footer = ""; break; case FE_OFDM: + sprintf(satstr, "\t<%s name=\"%s\"\n", "terrestrial", spos_it->second.name.c_str()); + break; default: break; } diff --git a/src/zapit/src/scan.cpp b/src/zapit/src/scan.cpp index c6ba501b1..cd09fe827 100644 --- a/src/zapit/src/scan.cpp +++ b/src/zapit/src/scan.cpp @@ -270,7 +270,7 @@ _repeat: } } - freq_id_t freq = CREATE_FREQ_ID(tI->second.feparams.dvb_feparams.frequency, cable); + freq_id_t freq = CREATE_FREQ_ID(tI->second.feparams.dvb_feparams.frequency, frontendType != FE_QPSK); CNit nit(satellitePosition, freq, cable_nid); if(flags & SCAN_NIT) @@ -480,7 +480,6 @@ bool CServiceScan::SetFrontend(t_satellite_position satellitePosition) frontend = fe; CFEManager::getInstance()->setLiveFE(frontend); frontendType = frontend->getInfo()->type; - cable = (frontend->getInfo()->type == FE_QAM);//FIXME return true; } @@ -594,9 +593,10 @@ bool CServiceScan::ScanTransponder() printf("[scan] NIT %s, fta only: %s, satellites %s\n", flags & SCAN_NIT ? "yes" : "no", flags & SCAN_FTA ? "yes" : "no", scanProviders.size() == 1 ? "single" : "multi"); - freq_id_t freq = CREATE_FREQ_ID(TP->feparams.dvb_feparams.frequency, cable); + freq_id_t freq = CREATE_FREQ_ID(TP->feparams.dvb_feparams.frequency, frontendType != FE_QPSK); fake_tid++; fake_nid++; + transponder_id_t tid = CREATE_TRANSPONDER_ID64(freq, satellitePosition, fake_nid, fake_tid); transponder t(frontendType, tid, TP->feparams, TP->polarization); t.dump("[scan]"); @@ -639,7 +639,7 @@ bool CServiceScan::ReplaceTransponderParams(freq_id_t freq, t_satellite_position bool ret = false; for (transponder_list_t::iterator tI = transponders.begin(); tI != transponders.end(); ++tI) { if (tI->second.satellitePosition == satellitePosition) { - freq_id_t newfreq = CREATE_FREQ_ID(tI->second.feparams.dvb_feparams.frequency, cable); + freq_id_t newfreq = CREATE_FREQ_ID(tI->second.feparams.dvb_feparams.frequency, frontendType != FE_QPSK); if (freq == newfreq) { memcpy(&tI->second.feparams, feparams, sizeof(struct dvb_frontend_parameters)); tI->second.polarization = polarization; @@ -655,7 +655,7 @@ bool CServiceScan::ReplaceTransponderParams(freq_id_t freq, t_satellite_position void CServiceScan::SendTransponderInfo(transponder &t) { uint32_t actual_freq = t.feparams.dvb_feparams.frequency; - if (!cable) + if (frontendType == FE_QAM) actual_freq /= 1000; CZapit::getInstance()->SendEvent(CZapitClient::EVT_SCAN_REPORT_FREQUENCY, &actual_freq,sizeof(actual_freq)); @@ -663,7 +663,7 @@ void CServiceScan::SendTransponderInfo(transponder &t) CZapit::getInstance()->SendEvent(CZapitClient::EVT_SCAN_PROVIDER, (void *) " ", 2); CZapit::getInstance()->SendEvent(CZapitClient::EVT_SCAN_SERVICENAME, (void *) " ", 2); - if (!cable) { + if (frontendType == FE_QPSK) { uint32_t actual_polarisation = ((t.feparams.dvb_feparams.u.qpsk.symbol_rate/1000) << 16) | (t.feparams.dvb_feparams.u.qpsk.fec_inner << 8) | (uint)t.polarization; CZapit::getInstance()->SendEvent(CZapitClient::EVT_SCAN_REPORT_FREQUENCYP, &actual_polarisation,sizeof(actual_polarisation)); } diff --git a/src/zapit/src/transponder.cpp b/src/zapit/src/transponder.cpp index 291ec09c8..0a1a8f231 100644 --- a/src/zapit/src/transponder.cpp +++ b/src/zapit/src/transponder.cpp @@ -53,13 +53,20 @@ transponder::transponder() bool transponder::operator==(const transponder& t) const { - return ( + if (type != FE_OFDM) + return ( (satellitePosition == t.satellitePosition) && //(transport_stream_id == t.transport_stream_id) && //(original_network_id == t.original_network_id) && ((polarization & 1) == (t.polarization & 1)) && (abs((int) feparams.dvb_feparams.frequency - (int)t.feparams.dvb_feparams.frequency) <= 3000) ); + return ((satellitePosition == t.satellitePosition) && + //(transport_stream_id == t.transport_stream_id) && + //(original_network_id == t.original_network_id) && + ((polarization & 1) == (t.polarization & 1)) && + (abs((int) feparams.dvb_feparams.frequency - (int)t.feparams.dvb_feparams.frequency) <= 100) + ); } bool transponder::compare(const transponder& t) const @@ -77,13 +84,23 @@ bool transponder::compare(const transponder& t) const (dvb_feparams1->u.qam.modulation == dvb_feparams2->u.qam.modulation || dvb_feparams1->u.qam.modulation == QAM_AUTO || dvb_feparams2->u.qam.modulation == QAM_AUTO) ); - } else { + } else if (type == FE_QPSK) { ret = ( (t == (*this)) && (dvb_feparams1->u.qpsk.symbol_rate == dvb_feparams2->u.qpsk.symbol_rate) && (dvb_feparams1->u.qpsk.fec_inner == dvb_feparams2->u.qpsk.fec_inner || dvb_feparams1->u.qpsk.fec_inner == FEC_AUTO || dvb_feparams2->u.qpsk.fec_inner == FEC_AUTO) ); + } else if (type == FE_OFDM) { + ret = ( (t == (*this)) && + (dvb_feparams1->u.ofdm.bandwidth == dvb_feparams2->u.ofdm.bandwidth) && + (dvb_feparams1->u.ofdm.code_rate_HP == dvb_feparams2->u.ofdm.code_rate_HP || + dvb_feparams1->u.ofdm.code_rate_HP == FEC_AUTO || dvb_feparams2->u.ofdm.code_rate_HP == FEC_AUTO) && + (dvb_feparams1->u.ofdm.code_rate_LP == dvb_feparams2->u.ofdm.code_rate_LP || + dvb_feparams1->u.ofdm.code_rate_LP == FEC_AUTO || dvb_feparams2->u.ofdm.code_rate_LP == FEC_AUTO) && + (dvb_feparams1->u.ofdm.constellation == dvb_feparams2->u.ofdm.constellation || + dvb_feparams1->u.ofdm.constellation == QAM_AUTO || dvb_feparams2->u.ofdm.constellation == QAM_AUTO) + ); } return ret; } @@ -99,12 +116,20 @@ void transponder::dumpServiceXml(FILE * fd) dvb_feparams->u.qam.symbol_rate, dvb_feparams->u.qam.fec_inner, dvb_feparams->u.qam.modulation); - } else { + } else if (type == FE_QPSK) { fprintf(fd, "\t\t\n", transport_stream_id, original_network_id, dvb_feparams->frequency, dvb_feparams->inversion, dvb_feparams->u.qpsk.symbol_rate, dvb_feparams->u.qpsk.fec_inner, polarization); + } else if (type == FE_OFDM) { + fprintf(fd, "\t\t\n", + transport_stream_id, original_network_id, + dvb_feparams->frequency, dvb_feparams->inversion, + dvb_feparams->u.ofdm.bandwidth, dvb_feparams->u.ofdm.code_rate_HP, + dvb_feparams->u.ofdm.code_rate_LP, dvb_feparams->u.ofdm.constellation, + dvb_feparams->u.ofdm.transmission_mode, dvb_feparams->u.ofdm.guard_interval, + dvb_feparams->u.ofdm.hierarchy_information); } } @@ -116,10 +141,14 @@ void transponder::dump(std::string label) printf("%s tp-id %016" PRIx64 " freq %d rate %d fec %d mod %d\n", label.c_str(), transponder_id, dvb_feparams->frequency, dvb_feparams->u.qam.symbol_rate, dvb_feparams->u.qam.fec_inner, dvb_feparams->u.qam.modulation); - else + else if (type == FE_QPSK) printf("%s tp-id %016" PRIx64 " freq %d rate %d fec %d pol %d\n", label.c_str(), transponder_id, dvb_feparams->frequency, dvb_feparams->u.qpsk.symbol_rate, dvb_feparams->u.qpsk.fec_inner, polarization); + else if (type == FE_OFDM) + printf("%s tp-id %016llx freq %d bw %d coderate %d\n", label.c_str(), + transponder_id, dvb_feparams->frequency, dvb_feparams->u.ofdm.bandwidth, + dvb_feparams->u.ofdm.code_rate_HP); } #if 0 //never used @@ -144,8 +173,10 @@ char transponder::pol(unsigned char p) std::string transponder::description() { char buf[128] = {0}; - char * f, *s, *m; + char *f, *s, *m, *f2; struct dvb_frontend_parameters *dvb_feparams = &feparams.dvb_feparams; + const char *bw[4] = { "8MHz", "7MHz", "6MHz", "auto" }; + int b; switch(deltype) { case FE_QPSK: @@ -157,7 +188,15 @@ std::string transponder::description() snprintf(buf, sizeof(buf), "%d %d %s %s %s ", dvb_feparams->frequency/1000, dvb_feparams->u.qam.symbol_rate/1000, f, s, m); break; case FE_OFDM: + CFrontend::getDelSys(type, dvb_feparams->u.ofdm.code_rate_HP, dvb_feparams->u.ofdm.constellation, f, s, m); + CFrontend::getDelSys(type, dvb_feparams->u.ofdm.code_rate_LP, dvb_feparams->u.ofdm.constellation, f2, s, m); + b = dvb_feparams->u.ofdm.bandwidth; + if (b > 3) + b = 3; + snprintf(buf, sizeof(buf), "%d %s %s %s %s ", dvb_feparams->frequency, bw[b], f, f2, m); + break; case FE_ATSC: + snprintf(buf, sizeof(buf), "ATSC not yet supported "); break; } return std::string(buf); From 1486109a28b2cd7cafbe1bfd12f48ee7b86f09b0 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 11 May 2013 23:59:26 +0200 Subject: [PATCH 025/225] frontend: add helpers for DVB-T Conflicts: src/zapit/include/zapit/femanager.h src/zapit/src/femanager.cpp --- src/zapit/include/zapit/femanager.h | 8 +++++--- src/zapit/include/zapit/frontend_c.h | 1 + src/zapit/src/femanager.cpp | 20 ++++++++++++++++++-- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/zapit/include/zapit/femanager.h b/src/zapit/include/zapit/femanager.h index d7fa6a679..56220b31a 100644 --- a/src/zapit/include/zapit/femanager.h +++ b/src/zapit/include/zapit/femanager.h @@ -84,6 +84,7 @@ class CFEManager bool have_sat; bool have_cable; + bool have_terr; bool have_locked; OpenThreads::ReentrantMutex mutex; @@ -140,10 +141,11 @@ class CFEManager bool haveFreeDemux(); bool haveSat() { return have_sat; } bool haveCable() { return have_cable; } - bool satOnly() { return (have_sat && !have_cable); } - bool cableOnly() { return (have_cable && !have_sat); } + bool haveTerr() { return have_terr; } + bool satOnly() { return (have_sat && !have_cable && !have_terr); } + bool cableOnly() { return (have_cable && !have_sat && ! have_terr); } + bool terrOnly() { return (have_terr && !have_sat && ! have_cable); } void Lock() { mutex.lock(); } void Unlock() { mutex.unlock(); } - }; #endif /* __femanager_h__ */ diff --git a/src/zapit/include/zapit/frontend_c.h b/src/zapit/include/zapit/frontend_c.h index 1ff0e8b3a..3155f1383 100644 --- a/src/zapit/include/zapit/frontend_c.h +++ b/src/zapit/include/zapit/frontend_c.h @@ -262,6 +262,7 @@ class CFrontend } bool isCable() { return (info.type == FE_QAM); } bool isSat() { return (info.type == FE_QPSK); } + bool isTerr() { return (info.type == FE_OFDM); } fe_type_t getType() { return info.type; } }; #endif /* __zapit_frontend_h__ */ diff --git a/src/zapit/src/femanager.cpp b/src/zapit/src/femanager.cpp index b8841c50a..fc3e4be0f 100644 --- a/src/zapit/src/femanager.cpp +++ b/src/zapit/src/femanager.cpp @@ -92,7 +92,7 @@ bool CFEManager::Init() unsigned short fekey; OpenThreads::ScopedLock m_lock(mutex); - have_sat = have_cable = false; + have_sat = have_cable = have_terr = false; for(int i = 0; i < MAX_ADAPTERS; i++) { for(int j = 0; j < MAX_FE; j++) { fe = new CFrontend(j, i); @@ -106,6 +106,8 @@ bool CFEManager::Init() have_sat = true; else if (fe->getInfo()->type == FE_QAM) have_cable = true; + else if (fe->isTerr()) + have_terr = true; } else delete fe; } @@ -227,6 +229,7 @@ bool CFEManager::loadSettings() } bool fsat = true; //bool fcable = true; + bool fterr = true; for(fe_map_iterator_t it = femap.begin(); it != femap.end(); it++) { CFrontend * fe = it->second; frontend_config_t & fe_config = fe->getConfig(); @@ -260,6 +263,14 @@ bool CFEManager::loadSettings() #endif def_mode = CFrontend::FE_MODE_INDEPENDENT; } + if (fe->isTerr()) { + if (fterr) { + fterr = false; + def_mode = def_mode0; + } + if (def_mode > CFrontend::FE_MODE_INDEPENDENT) + def_mode = CFrontend::FE_MODE_INDEPENDENT; + } if (femap.size() == 1) def_mode = CFrontend::FE_MODE_INDEPENDENT; @@ -694,11 +705,16 @@ CFrontend * CFEManager::getScanFrontend(t_satellite_position satellitePosition) CFrontend * frontend = NULL; for(fe_map_iterator_t it = femap.begin(); it != femap.end(); it++) { CFrontend * mfe = it->second; - if(mfe->isCable()) { + if (mfe->isCable()) { if ((mfe->getMode() != CFrontend::FE_MODE_UNUSED) && ((satellitePosition & 0xF00) == 0xF00)) { frontend = mfe; break; } + } else if (mfe->isTerr()) { + if ((mfe->getMode() != CFrontend::FE_MODE_UNUSED) && (satellitePosition & 0xF00) == 0xE00) { + frontend = mfe; + break; + } } else { if (mfe->getMode() == CFrontend::FE_MODE_UNUSED || CFrontend::linked(mfe->getMode())) continue; From 8415c345b82387f36b315eafee431dbaa5cda829 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 12 May 2013 00:01:34 +0200 Subject: [PATCH 026/225] getservices: add code for DVB-T Conflicts: src/zapit/src/getservices.cpp --- src/zapit/src/getservices.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/zapit/src/getservices.cpp b/src/zapit/src/getservices.cpp index a4b2fed4d..1357c5421 100644 --- a/src/zapit/src/getservices.cpp +++ b/src/zapit/src/getservices.cpp @@ -669,6 +669,11 @@ bool CServiceManager::LoadScanXml(fe_type_t delsys) position = xmlGetSignedNumericAttribute(search, "position", 10); char * name = xmlGetAttribute(search, "name"); InitSatPosition(position, name, false, delsys); + } else if (!(strcmp(xmlGetName(search), "terrestrial"))) { + char * name = xmlGetAttribute(search, "name"); + position = fake_pos++; + position &= 0x0EFF; + InitSatPosition(position, name, false, delsys); } else if(!(strcmp(xmlGetName(search), "cable"))) { char * name = xmlGetAttribute(search, "name"); position = fake_pos++; @@ -725,10 +730,10 @@ bool CServiceManager::LoadServices(bool only_current) INFO("Loading cables..."); LoadScanXml(FE_QAM); } - if (CFEManager::getInstance()->haveTerr()) { - INFO("Loading terrestrial..."); - LoadScanXml(FE_OFDM); - } + if (CFEManager::getInstance()->haveTerr()) { + INFO("Loading terrestrial..."); + LoadScanXml(FE_OFDM); + } parser = parseXmlFile(SERVICES_XML); if (parser != NULL) { From 1a4f65302ea8b6a9f56eaee7b51c2f29aa10822e Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 12 May 2013 02:47:00 +0200 Subject: [PATCH 027/225] scansetup: add DVB-T Conflicts: src/gui/scan_setup.cpp src/gui/scan_setup.h --- src/gui/scan.cpp | 36 ++++++++++++++++------- src/gui/scan_setup.cpp | 66 ++++++++++++++++++++++++++++++++---------- src/system/settings.h | 2 ++ 3 files changed, 79 insertions(+), 25 deletions(-) diff --git a/src/gui/scan.cpp b/src/gui/scan.cpp index 4725abf55..3e90157b5 100644 --- a/src/gui/scan.cpp +++ b/src/gui/scan.cpp @@ -4,13 +4,7 @@ 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) 2011-2012 Stefan Seyfried License: GPL @@ -125,6 +119,18 @@ void CScanTs::prev_next_TP( bool up) TP.feparams.dvb_feparams.u.qpsk.symbol_rate = tI->second.feparams.dvb_feparams.u.qpsk.symbol_rate; TP.feparams.dvb_feparams.u.qpsk.fec_inner = tI->second.feparams.dvb_feparams.u.qpsk.fec_inner; TP.polarization = tI->second.polarization; + } else if (deltype == FE_OFDM) { + /* DVB-T. TODO: proper menu and parameter setup, not all "AUTO" */ + if (TP.feparams.dvb_feparams.frequency < 300000) + TP.feparams.dvb_feparams.u.ofdm.bandwidth = BANDWIDTH_7_MHZ; + else + TP.feparams.dvb_feparams.u.ofdm.bandwidth = BANDWIDTH_8_MHZ; + TP.feparams.dvb_feparams.u.ofdm.code_rate_HP = FEC_AUTO; + TP.feparams.dvb_feparams.u.ofdm.code_rate_LP = FEC_AUTO; + TP.feparams.dvb_feparams.u.ofdm.constellation = QAM_AUTO; + TP.feparams.dvb_feparams.u.ofdm.transmission_mode = TRANSMISSION_MODE_AUTO; + TP.feparams.dvb_feparams.u.ofdm.guard_interval = GUARD_INTERVAL_AUTO; + TP.feparams.dvb_feparams.u.ofdm.hierarchy_information = HIERARCHY_AUTO; } else { TP.feparams.dvb_feparams.u.qam.symbol_rate = tI->second.feparams.dvb_feparams.u.qam.symbol_rate; TP.feparams.dvb_feparams.u.qam.fec_inner = tI->second.feparams.dvb_feparams.u.qam.fec_inner; @@ -143,11 +149,14 @@ void CScanTs::testFunc() if(deltype == FE_QPSK) { CFrontend::getDelSys(deltype, TP.feparams.dvb_feparams.u.qpsk.fec_inner, dvbs_get_modulation((fe_code_rate_t)TP.feparams.dvb_feparams.u.qpsk.fec_inner), f, s, m); snprintf(buffer,sizeof(buffer), "%u %c %d %s %s %s", TP.feparams.dvb_feparams.frequency/1000, transponder::pol(TP.polarization), TP.feparams.dvb_feparams.u.qpsk.symbol_rate/1000, f, s, m); - } else { + } else if (deltype == FE_QAM) { CFrontend::getDelSys(deltype, TP.feparams.dvb_feparams.u.qam.fec_inner, TP.feparams.dvb_feparams.u.qam.modulation, f, s, m); snprintf(buffer,sizeof(buffer), "%u %d %s %s %s", TP.feparams.dvb_feparams.frequency/1000, TP.feparams.dvb_feparams.u.qam.symbol_rate/1000, f, s, m); + } else if (deltype == FE_OFDM) { + sprintf(buffer, "%u", TP.feparams.dvb_feparams.frequency); /* no way int can overflow the buffer */ } -printf("CScanTs::testFunc: %s\n", buffer); + + printf("CScanTs::testFunc: %s\n", buffer); paintLine(xpos2, ypos_cur_satellite, w - 95, pname.c_str()); paintLine(xpos2, ypos_frequency, w, buffer); success = g_Zapit->tune_TP(TP); @@ -155,6 +164,7 @@ printf("CScanTs::testFunc: %s\n", buffer); int CScanTs::exec(CMenuTarget* /*parent*/, const std::string & actionKey) { + printf("CScanTs::exec %s\n", actionKey.c_str()); neutrino_msg_t msg; neutrino_msg_data_t data; @@ -179,7 +189,12 @@ int CScanTs::exec(CMenuTarget* /*parent*/, const std::string & actionKey) bool manual = (actionKey == "manual") || test; bool fast = (actionKey == "fast"); - pname = (deltype == FE_QPSK) ? scansettings.satName : scansettings.cableName; + switch (deltype) { + case FE_QPSK: pname = scansettings.satName; break; + case FE_QAM: pname = scansettings.cableName; break; + case FE_OFDM: pname = scansettings.terrName; break; + default: printf("CScanTs::exec:%d unknown deltype %d\n", __LINE__, deltype); + } int scan_pids = CZapit::getInstance()->scanPids(); @@ -223,6 +238,7 @@ int CScanTs::exec(CMenuTarget* /*parent*/, const std::string & actionKey) TP.polarization = scansettings.sat_TP_pol; } else if (deltype == FE_OFDM) { /* DVB-T. TODO: proper menu and parameter setup, not all "AUTO" */ + TP.feparams.dvb_feparams.frequency = atoi(scansettings.terr_TP_freq.c_str()); if (TP.feparams.dvb_feparams.frequency < 300000) TP.feparams.dvb_feparams.u.ofdm.bandwidth = BANDWIDTH_7_MHZ; else diff --git a/src/gui/scan_setup.cpp b/src/gui/scan_setup.cpp index c84e5c8e8..2db44b9b5 100644 --- a/src/gui/scan_setup.cpp +++ b/src/gui/scan_setup.cpp @@ -310,7 +310,12 @@ int CScanSetup::exec(CMenuTarget* parent, const std::string &actionKey) std::string scants_key[] = {"all", "manual", "test", "fast", "auto"/*doesn't exists in CScanTs!*/}; if (actionKey.size() > 1) { - int delsys = actionKey[0] == 's' ? FE_QPSK : FE_QAM; + int delsys; + switch (actionKey[0]) { + case 's': delsys = FE_QPSK; break; + case 't': delsys = FE_OFDM; break; + default: delsys = FE_QAM; break; + } std::string as = actionKey.substr(1); printf("[neutrino] CScanSetup::%s scan %c in %s mode...\n", __FUNCTION__, actionKey[0], as.c_str()); for (uint i=0; i< (sizeof(scants_key)/sizeof(scants_key[0])); i++) @@ -368,6 +373,7 @@ int CScanSetup::showScanMenu() printf("[neutrino] CScanSetup call %s...\n", __FUNCTION__); int shortcut = 1; int w = getSatMenuListWidth(); + printf("C: %d S: %d T: %d\n", CFEManager::getInstance()->haveCable(),CFEManager::getInstance()->haveSat(), CFEManager::getInstance()->haveTerr()); CMenuForwarder * mf; CMenuOptionChooser * mc; @@ -956,17 +962,20 @@ void CScanSetup::fillSatSelect(CMenuOptionStringChooser * select) //init cable provider menu void CScanSetup::fillCableSelect(CMenuOptionStringChooser * select) { - printf("[neutrino] CScanSetup call %s...\n", __FUNCTION__); + const char *what = r_system == DVB_C ? "cable" : "terrestrial"; + printf("[neutrino] CScanSetup call %s (%s)...\n", __func__, what); //don't misunderstand the name "satSelect", in this context it's actually for cable providers satellite_map_t satmap = CServiceManager::getInstance()->SatelliteList(); bool sfound = false; std::string fname; for (sat_iterator_t sit = satmap.begin(); sit != satmap.end(); sit++) { - if (sit->second.deltype != FE_QAM) + if (r_system == DVB_C && sit->second.deltype != FE_QAM) + continue; + if (r_system == DVB_T && sit->second.deltype != FE_OFDM) continue; - printf("Adding cable menu for %s position %d\n", sit->second.name.c_str(), sit->first); + printf("Adding %s menu for %s position %d\n", what, sit->second.name.c_str(), sit->first); select->addOption(sit->second.name.c_str()); if (fname.empty()) @@ -975,10 +984,14 @@ void CScanSetup::fillCableSelect(CMenuOptionStringChooser * select) if (!sfound && (scansettings.cableName == sit->second.name)) sfound = true; - dprintf(DEBUG_DEBUG, "got scanprovider (cable): %s\n", sit->second.name.c_str()); + dprintf(DEBUG_DEBUG, "got scanprovider (%s): %s\n", what, sit->second.name.c_str()); + } + if (!sfound && !fname.empty()) { + if (r_system == DVB_C) + scansettings.cableName = fname; + if (r_system == DVB_T) + scansettings.terrName = fname; } - if (!sfound && !fname.empty()) - scansettings.cableName = fname; } int CScanSetup::showScanMenuSatFind() @@ -1062,7 +1075,7 @@ void CScanSetup::addScanMenuTempSat(CMenuWidget *temp_sat, sat_config_t & satcon motor->setHint("", LOCALE_MENU_HINT_SCAN_MOTORPOS); usals = new CMenuOptionChooser(LOCALE_EXTRA_USE_GOTOXX, &satconfig.use_usals, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true /*dmode == DISEQC_ADVANCED*/); usals->setHint("", LOCALE_MENU_HINT_SCAN_USEUSALS); - }else{ + } else { if (satconfig.diseqc < 0) satconfig.diseqc = 0; unilnb = new CMenuOptionNumberChooser(LOCALE_UNICABLE_LNB, &satconfig.diseqc, true, 0, 1); @@ -1102,8 +1115,10 @@ void CScanSetup::addScanMenuManualScan(CMenuWidget *manual_Scan) CMenuForwarder * mf; manual_Scan->addIntroItems(); + const char *act_test, *act_manual; //---------------------------------------------------------------------- if (r_system == DVB_C) { + act_test = "ctest"; act_manual = "cmanual"; CMenuOptionStringChooser * cableSelect = new CMenuOptionStringChooser(LOCALE_CABLESETUP_PROVIDER, &scansettings.cableName, true, this, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED, true); cableSelect->setHint("", LOCALE_MENU_HINT_SCAN_CABLE); fillCableSelect(cableSelect); @@ -1112,7 +1127,15 @@ void CScanSetup::addScanMenuManualScan(CMenuWidget *manual_Scan) mf->setHint("", LOCALE_MENU_HINT_SCAN_NID); manual_Scan->addItem(mf); mf = new CMenuDForwarder(LOCALE_SCANTS_SELECT_TP, true, NULL, new CTPSelectHandler(), "cable", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN); + } else if (r_system == DVB_T) { + act_test = "ttest"; act_manual = "tmanual"; + CMenuOptionStringChooser * terrSelect = new CMenuOptionStringChooser(LOCALE_TERRESTRIALSETUP_PROVIDER, &scansettings.terrName, true, this, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED, true); + //terrSelect->setHint("", LOCALE_MENU_HINT_SCAN_CABLE); + fillCableSelect(terrSelect); + manual_Scan->addItem(terrSelect); + mf = new CMenuDForwarder(LOCALE_SCANTS_SELECT_TP, true, NULL, new CTPSelectHandler(), "terrestrial", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN); } else { + act_test = "stest"; act_manual = "smanual"; CMenuOptionStringChooser * satSelect = new CMenuOptionStringChooser(LOCALE_SATSETUP_SATELLITE, &scansettings.satName, true, this, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED, true); satSelect->setHint("", LOCALE_MENU_HINT_SCAN_SATELLITE); /* add configured satellites to satSelect */ @@ -1131,11 +1154,11 @@ void CScanSetup::addScanMenuManualScan(CMenuWidget *manual_Scan) //---------------------------------------------------------------------- manual_Scan->addItem(GenericMenuSeparatorLine); - mf = new CMenuForwarder(LOCALE_SCANTS_TEST, allow_start, NULL, this, r_system == DVB_C ? "ctest" : "stest", CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW); + mf = new CMenuForwarder(LOCALE_SCANTS_TEST, allow_start, NULL, this, act_test, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW); mf->setHint("", LOCALE_MENU_HINT_SCAN_TEST); manual_Scan->addItem(mf); - mf = new CMenuForwarder(LOCALE_SCANTS_STARTNOW, allow_start, NULL, this, r_system == DVB_C ? "cmanual" : "smanual", CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE); + mf = new CMenuForwarder(LOCALE_SCANTS_STARTNOW, allow_start, NULL, this, act_manual, CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE); mf->setHint("", LOCALE_MENU_HINT_SCAN_START); manual_Scan->addItem(mf); } @@ -1206,6 +1229,7 @@ void CScanSetup::addScanMenuAutoScan(CMenuWidget *auto_Scan) CMenuForwarder * mf; auto_Scan->addIntroItems(); + const char *action; if (r_system == DVB_C) { //cable CMenuOptionStringChooser * cableSelect = new CMenuOptionStringChooser(LOCALE_CABLESETUP_PROVIDER, &scansettings.cableName, true, this, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED, true); cableSelect->setHint("", LOCALE_MENU_HINT_SCAN_CABLE); @@ -1214,12 +1238,20 @@ void CScanSetup::addScanMenuAutoScan(CMenuWidget *auto_Scan) mf = new CMenuForwarder(LOCALE_SATSETUP_CABLE_NID, true, nid->getValue(), nid); mf->setHint("", LOCALE_MENU_HINT_SCAN_NID); auto_Scan->addItem(mf); + action = "cauto"; + } else if (r_system == DVB_T) { + CMenuOptionStringChooser * terrSelect = new CMenuOptionStringChooser(LOCALE_TERRESTRIALSETUP_PROVIDER, &scansettings.terrName, true, this, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED, true); + //terrSelect->setHint("", LOCALE_MENU_HINT_SCAN_CABLE); + fillCableSelect(terrSelect); + auto_Scan->addItem(terrSelect); + action = "tauto"; } else { CMenuOptionStringChooser * satSelect = new CMenuOptionStringChooser(LOCALE_SATSETUP_SATELLITE, &scansettings.satName, true, this, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED, true); satSelect->setHint("", LOCALE_MENU_HINT_SCAN_SATELLITE); /* add configured satellites to satSelect */ fillSatSelect(satSelect); auto_Scan->addItem(satSelect); + action = "sauto"; } auto_Scan->addItem(GenericMenuSeparatorLine); @@ -1227,7 +1259,7 @@ void CScanSetup::addScanMenuAutoScan(CMenuWidget *auto_Scan) addListFlagsItems(auto_Scan, 1); //---------------------------------------------------------------------- auto_Scan->addItem(GenericMenuSeparatorLine); - mf = new CMenuForwarder(LOCALE_SCANTS_STARTNOW, allow_start, NULL, this, r_system == DVB_C ? "cauto" : "sauto", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN); + mf = new CMenuForwarder(LOCALE_SCANTS_STARTNOW, allow_start, NULL, this, action, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN); mf->setHint("", LOCALE_MENU_HINT_SCAN_START); auto_Scan->addItem(mf); } @@ -1322,10 +1354,10 @@ int CScanSetup::addScanOptionsItems(CMenuWidget *options_menu, const int &shortc Rate->setHint("", LOCALE_MENU_HINT_SCAN_RATE); mod_pol = new CMenuOptionChooser(LOCALE_EXTRA_TP_MOD, (int *)&scansettings.cable_TP_mod, SATSETUP_SCANTP_MOD, SATSETUP_SCANTP_MOD_COUNT, true, NULL, CRCInput::convertDigitToKey(shortCut++)); mod_pol->setHint("", LOCALE_MENU_HINT_SCAN_MOD); - } else if (r_system == DVB_T) { - CStringInput *freq = new CStringInput(LOCALE_EXTRA_TP_FREQ, &scansettings.terr_TP_freq, 6, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "0123456789"); - Freq = new CMenuDForwarder(LOCALE_EXTRA_TP_FREQ, true, scansettings.terr_TP_freq, freq, "", CRCInput::convertDigitToKey(shortCut++)); - Freq->setHint("", LOCALE_MENU_HINT_SCAN_FREQ); + } else if (r_system == DVB_T) { + CStringInput *freq = new CStringInput(LOCALE_EXTRA_TP_FREQ, &scansettings.terr_TP_freq, 6, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "0123456789"); + Freq = new CMenuDForwarder(LOCALE_EXTRA_TP_FREQ, true, scansettings.terr_TP_freq, freq, "", CRCInput::convertDigitToKey(shortCut++)); + Freq->setHint("", LOCALE_MENU_HINT_SCAN_FREQ); } options_menu->addItem(Freq); @@ -1547,6 +1579,8 @@ int CTPSelectHandler::exec(CMenuTarget* parent, const std::string &actionkey) std::string name; if (actionkey == "sat") name = scansettings.satName; + else if (actionkey == "terrestrial") + name = scansettings.terrName; else name = scansettings.cableName; @@ -1619,6 +1653,8 @@ int CTPSelectHandler::exec(CMenuTarget* parent, const std::string &actionkey) scansettings.cable_TP_mod = tmpI->second.feparams.dvb_feparams.u.qam.modulation; break; case FE_OFDM: + scansettings.terr_TP_freq = to_string(tmpI->second.feparams.dvb_feparams.frequency); + break; case FE_ATSC: break; } diff --git a/src/system/settings.h b/src/system/settings.h index a162462cc..ab0a6cf6b 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -789,6 +789,8 @@ class CScanSettings std::string cable_TP_freq; std::string cable_TP_rate; + std::string terrName; + std::string terr_TP_freq; CScanSettings(); //void useDefaults(const delivery_system_t _delivery_system); From aee3647fef3182d6d1b301c6aae6b773c86c34f7 Mon Sep 17 00:00:00 2001 From: martii Date: Sat, 1 Jun 2013 15:06:34 +0200 Subject: [PATCH 028/225] gui/streaminfo2: fix DVB-T label Conflicts: data/locale/deutsch.locale --- data/locale/deutsch.locale | 3 ++- data/locale/english.locale | 1 + src/gui/streaminfo2.cpp | 4 ++++ src/system/locals.h | 1 + src/system/locals_intern.h | 1 + src/zapit/src/transponder.cpp | 18 +++++++++--------- 6 files changed, 18 insertions(+), 10 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index fb1065324..b623ce4f4 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -1879,7 +1879,8 @@ stringinput.clear Alles löschen subtitles.charset Zeichensatz subtitles.head Untertitel subtitles.stop Untertitel aus -terrestrialsetup.provider DVB-T Region +terrestrialsetup.area Region +terrestrialsetup.provider DVB-T Versorgungsbereich timer.eventrecord.msg Die Sendung wurde zur Aufnahme vorgemerkt. timer.eventrecord.title Aufnahme vormerken timer.eventtimed.msg Die Sendung wurde vorgemerkt. diff --git a/data/locale/english.locale b/data/locale/english.locale index 5d9b82545..8e1da55e2 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -1879,6 +1879,7 @@ stringinput.clear clear all subtitles.charset Charset subtitles.head Subtitles subtitles.stop Stop subtitles +terrestrialsetup.area Area terrestrialsetup.provider Terrestrial Provider timer.eventrecord.msg The event is scheduled for recording.\nTo edit the schedule open the timer list. timer.eventrecord.title Schedule Record diff --git a/src/gui/streaminfo2.cpp b/src/gui/streaminfo2.cpp index 2c61b5819..5a1efb11b 100644 --- a/src/gui/streaminfo2.cpp +++ b/src/gui/streaminfo2.cpp @@ -559,6 +559,10 @@ void CStreamInfo2::paint_techinfo(int xpos, int ypos) sprintf (buf, "%s:",g_Locale->getText (LOCALE_SATSETUP_SATELLITE));//swiped locale else if(t.deltype == FE_QAM) sprintf (buf, "%s:",g_Locale->getText (LOCALE_CHANNELLIST_PROVS)); +#ifdef MARTII + else + snprintf (buf, sizeof(buf), "%s:",g_Locale->getText (LOCALE_TERRESTRIALSETUP_AREA)); +#endif g_Font[font_info]->RenderString(xpos, ypos, box_width, buf, COL_INFOBAR_TEXT, 0, true); // UTF-8 diff --git a/src/system/locals.h b/src/system/locals.h index 85f153220..9f70b81e3 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -1906,6 +1906,7 @@ typedef enum LOCALE_SUBTITLES_CHARSET, LOCALE_SUBTITLES_HEAD, LOCALE_SUBTITLES_STOP, + LOCALE_TERRESTRIALSETUP_AREA, LOCALE_TERRESTRIALSETUP_PROVIDER, LOCALE_TIMER_EVENTRECORD_MSG, LOCALE_TIMER_EVENTRECORD_TITLE, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 69ac38b0e..8cb505eef 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -1906,6 +1906,7 @@ const char * locale_real_names[] = "subtitles.charset", "subtitles.head", "subtitles.stop", + "terrestrialsetup.area", "terrestrialsetup.provider", "timer.eventrecord.msg", "timer.eventrecord.title", diff --git a/src/zapit/src/transponder.cpp b/src/zapit/src/transponder.cpp index 0a1a8f231..a3dd7e311 100644 --- a/src/zapit/src/transponder.cpp +++ b/src/zapit/src/transponder.cpp @@ -53,7 +53,7 @@ transponder::transponder() bool transponder::operator==(const transponder& t) const { - if (type != FE_OFDM) + if (deltype != FE_OFDM) return ( (satellitePosition == t.satellitePosition) && //(transport_stream_id == t.transport_stream_id) && @@ -84,14 +84,14 @@ bool transponder::compare(const transponder& t) const (dvb_feparams1->u.qam.modulation == dvb_feparams2->u.qam.modulation || dvb_feparams1->u.qam.modulation == QAM_AUTO || dvb_feparams2->u.qam.modulation == QAM_AUTO) ); - } else if (type == FE_QPSK) { + } else if (deltype == FE_QPSK) { ret = ( (t == (*this)) && (dvb_feparams1->u.qpsk.symbol_rate == dvb_feparams2->u.qpsk.symbol_rate) && (dvb_feparams1->u.qpsk.fec_inner == dvb_feparams2->u.qpsk.fec_inner || dvb_feparams1->u.qpsk.fec_inner == FEC_AUTO || dvb_feparams2->u.qpsk.fec_inner == FEC_AUTO) ); - } else if (type == FE_OFDM) { + } else if (deltype == FE_OFDM) { ret = ( (t == (*this)) && (dvb_feparams1->u.ofdm.bandwidth == dvb_feparams2->u.ofdm.bandwidth) && (dvb_feparams1->u.ofdm.code_rate_HP == dvb_feparams2->u.ofdm.code_rate_HP || @@ -116,13 +116,13 @@ void transponder::dumpServiceXml(FILE * fd) dvb_feparams->u.qam.symbol_rate, dvb_feparams->u.qam.fec_inner, dvb_feparams->u.qam.modulation); - } else if (type == FE_QPSK) { + } else if (deltype == FE_QPSK) { fprintf(fd, "\t\t\n", transport_stream_id, original_network_id, dvb_feparams->frequency, dvb_feparams->inversion, dvb_feparams->u.qpsk.symbol_rate, dvb_feparams->u.qpsk.fec_inner, polarization); - } else if (type == FE_OFDM) { + } else if (deltype == FE_OFDM) { fprintf(fd, "\t\t\n", transport_stream_id, original_network_id, dvb_feparams->frequency, dvb_feparams->inversion, @@ -141,11 +141,11 @@ void transponder::dump(std::string label) printf("%s tp-id %016" PRIx64 " freq %d rate %d fec %d mod %d\n", label.c_str(), transponder_id, dvb_feparams->frequency, dvb_feparams->u.qam.symbol_rate, dvb_feparams->u.qam.fec_inner, dvb_feparams->u.qam.modulation); - else if (type == FE_QPSK) + else if (deltype == FE_QPSK) printf("%s tp-id %016" PRIx64 " freq %d rate %d fec %d pol %d\n", label.c_str(), transponder_id, dvb_feparams->frequency, dvb_feparams->u.qpsk.symbol_rate, dvb_feparams->u.qpsk.fec_inner, polarization); - else if (type == FE_OFDM) + else if (deltype == FE_OFDM) printf("%s tp-id %016llx freq %d bw %d coderate %d\n", label.c_str(), transponder_id, dvb_feparams->frequency, dvb_feparams->u.ofdm.bandwidth, dvb_feparams->u.ofdm.code_rate_HP); @@ -188,8 +188,8 @@ std::string transponder::description() snprintf(buf, sizeof(buf), "%d %d %s %s %s ", dvb_feparams->frequency/1000, dvb_feparams->u.qam.symbol_rate/1000, f, s, m); break; case FE_OFDM: - CFrontend::getDelSys(type, dvb_feparams->u.ofdm.code_rate_HP, dvb_feparams->u.ofdm.constellation, f, s, m); - CFrontend::getDelSys(type, dvb_feparams->u.ofdm.code_rate_LP, dvb_feparams->u.ofdm.constellation, f2, s, m); + CFrontend::getDelSys(deltype, dvb_feparams->u.ofdm.code_rate_HP, dvb_feparams->u.ofdm.constellation, f, s, m); + CFrontend::getDelSys(deltype, dvb_feparams->u.ofdm.code_rate_LP, dvb_feparams->u.ofdm.constellation, f2, s, m); b = dvb_feparams->u.ofdm.bandwidth; if (b > 3) b = 3; From a26af0104be529568b51d89c23f40831e24a8f34 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Wed, 19 Feb 2014 13:33:13 +0400 Subject: [PATCH 029/225] gui/scan_setup.cpp: fix DVB-T frontend labels --- src/gui/scan_setup.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/scan_setup.cpp b/src/gui/scan_setup.cpp index 2db44b9b5..5af926331 100644 --- a/src/gui/scan_setup.cpp +++ b/src/gui/scan_setup.cpp @@ -569,10 +569,12 @@ int CScanSetup::showScanMenuFrontendSetup() if (g_settings.easymenu) snprintf(name, sizeof(name), "%s %d: %s", g_Locale->getText(LOCALE_SATSETUP_FE_SETUP), i+1, fe->getInfo()->type == FE_QPSK ? g_Locale->getText(LOCALE_SCANTS_ACTSATELLITE) + : fe->getInfo()->type == FE_OFDM ? g_Locale->getText(LOCALE_SCANTS_ACTTERRESTRIAL) : g_Locale->getText(LOCALE_SCANTS_ACTCABLE)); else snprintf(name, sizeof(name), "%s %d: %s %s", g_Locale->getText(LOCALE_SATSETUP_FE_SETUP), i+1, fe->getInfo()->type == FE_QPSK ? g_Locale->getText(LOCALE_SCANTS_ACTSATELLITE) + : fe->getInfo()->type == FE_OFDM ? g_Locale->getText(LOCALE_SCANTS_ACTTERRESTRIAL) : g_Locale->getText(LOCALE_SCANTS_ACTCABLE), fe->getInfo()->name); @@ -677,6 +679,7 @@ int CScanSetup::showFrontendSetup(int number) if (g_settings.easymenu) snprintf(name, sizeof(name), "%s %d: %s", g_Locale->getText(LOCALE_SATSETUP_FE_SETUP), number+1, fe->getInfo()->type == FE_QPSK ? g_Locale->getText(LOCALE_SCANTS_ACTSATELLITE) + : fe->getInfo()->type == FE_OFDM ? g_Locale->getText(LOCALE_SCANTS_ACTTERRESTRIAL) : g_Locale->getText(LOCALE_SCANTS_ACTCABLE)); else snprintf(name, sizeof(name), "%s %d: %s", g_Locale->getText(LOCALE_SATSETUP_FE_SETUP), number+1, fe->getInfo()->name); @@ -1355,6 +1358,7 @@ int CScanSetup::addScanOptionsItems(CMenuWidget *options_menu, const int &shortc mod_pol = new CMenuOptionChooser(LOCALE_EXTRA_TP_MOD, (int *)&scansettings.cable_TP_mod, SATSETUP_SCANTP_MOD, SATSETUP_SCANTP_MOD_COUNT, true, NULL, CRCInput::convertDigitToKey(shortCut++)); mod_pol->setHint("", LOCALE_MENU_HINT_SCAN_MOD); } else if (r_system == DVB_T) { + // TODO: more params ? CStringInput *freq = new CStringInput(LOCALE_EXTRA_TP_FREQ, &scansettings.terr_TP_freq, 6, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "0123456789"); Freq = new CMenuDForwarder(LOCALE_EXTRA_TP_FREQ, true, scansettings.terr_TP_freq, freq, "", CRCInput::convertDigitToKey(shortCut++)); Freq->setHint("", LOCALE_MENU_HINT_SCAN_FREQ); From 196fcc397b8a801239732e7ca4175d56ca73fa52 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Wed, 19 Feb 2014 15:05:46 +0400 Subject: [PATCH 030/225] gui/streaminfo2.cpp: fix DVB-T label --- src/gui/streaminfo2.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/gui/streaminfo2.cpp b/src/gui/streaminfo2.cpp index 5a1efb11b..738815b81 100644 --- a/src/gui/streaminfo2.cpp +++ b/src/gui/streaminfo2.cpp @@ -559,10 +559,8 @@ void CStreamInfo2::paint_techinfo(int xpos, int ypos) sprintf (buf, "%s:",g_Locale->getText (LOCALE_SATSETUP_SATELLITE));//swiped locale else if(t.deltype == FE_QAM) sprintf (buf, "%s:",g_Locale->getText (LOCALE_CHANNELLIST_PROVS)); -#ifdef MARTII else snprintf (buf, sizeof(buf), "%s:",g_Locale->getText (LOCALE_TERRESTRIALSETUP_AREA)); -#endif g_Font[font_info]->RenderString(xpos, ypos, box_width, buf, COL_INFOBAR_TEXT, 0, true); // UTF-8 From b322403f198cb4eaa50a3ebee3c267e784be29df Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Wed, 19 Feb 2014 15:18:22 +0400 Subject: [PATCH 031/225] zapit/src/getservices.cpp: fix missed DVB-T footer --- src/zapit/src/getservices.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/zapit/src/getservices.cpp b/src/zapit/src/getservices.cpp index 1357c5421..786443b88 100644 --- a/src/zapit/src/getservices.cpp +++ b/src/zapit/src/getservices.cpp @@ -1028,6 +1028,7 @@ bool CServiceManager::SaveCurrentServices(transponder_id_t tpid) break; case FE_OFDM: sprintf(satstr, "\t<%s name=\"%s\"\n", "terrestrial", spos_it->second.name.c_str()); + footer = ""; break; default: break; From 3a4b873b88c94d620b5d4f2e8eb7742afa293320 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Fri, 28 Feb 2014 13:56:57 +0400 Subject: [PATCH 032/225] zapit/src/getservices.cpp: try to add workaround for reported bug, under some circumstances sat name= written to services instead of cable name=. Real bug reason unknown yet --- src/zapit/src/getservices.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/zapit/src/getservices.cpp b/src/zapit/src/getservices.cpp index 786443b88..f9bb9748d 100644 --- a/src/zapit/src/getservices.cpp +++ b/src/zapit/src/getservices.cpp @@ -820,6 +820,12 @@ void CServiceManager::CopyFile(char * from, char * to) void CServiceManager::WriteSatHeader(FILE * fd, sat_config_t &config) { + /* FIXME hack */ + if ((config.position & 0xF00) == 0xF00) + config.deltype = FE_QAM; + else if ((config.position & 0xF00) == 0xE00) + config.deltype = FE_OFDM; + switch (config.deltype) { case FE_QPSK: /* satellite */ fprintf(fd, "\t\n", From 26aecaf40893af6b238de6658c52891b354eac5b Mon Sep 17 00:00:00 2001 From: martii Date: Sat, 1 Mar 2014 12:43:19 +0100 Subject: [PATCH 033/225] CNeutrinoApp::SetChannelMode: adjust to live channel instead of a semi-random one at startup --- src/neutrino.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 81aa36f4d..d3b90e289 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -1523,7 +1523,7 @@ void CNeutrinoApp::SetChannelMode(int newmode) if(g_settings.channellist_sort_mode == CChannelList::SORT_CH_NUMBER) bouquetList->Bouquets[i]->channelList->SortChNumber(); } - channelList->adjustToChannelID(channelList->getActiveChannel_ChannelID()); + channelList->adjustToChannelID(CZapit::getInstance()->GetCurrentChannelID()); } lastChannelMode = newmode; } From b0a77a8e267f2d976987deba859d6e0cf35f1e69 Mon Sep 17 00:00:00 2001 From: martii Date: Sat, 1 Mar 2014 21:14:15 +0100 Subject: [PATCH 034/225] gui/zapit_setup: add initial channel list mode options --- data/locale/deutsch.locale | 7 ++++++- data/locale/english.locale | 5 +++++ src/gui/zapit_setup.cpp | 17 +++++++++++++++++ src/neutrino.cpp | 8 ++++++++ src/system/locals.h | 5 +++++ src/system/locals_intern.h | 5 +++++ src/system/settings.h | 2 ++ 7 files changed, 48 insertions(+), 1 deletion(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index b623ce4f4..09b445d1d 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -240,6 +240,7 @@ channellist.nonefound Es wurden keine Kanäle gefunden!\nFühren Sie bitte eine channellist.numeric_adjust Numeric zap adjust channellist.provs Anbieter channellist.recording_not_possible Aufnahme nicht möglich! +channellist.remember Zuletzt verwendete channellist.reset_all Entferne Markierung "Neu" für alle Kanäle channellist.reset_flags Entferne Kanal-Markierung "Neu" channellist.sats Satelliten @@ -818,6 +819,8 @@ menu.hint_channellist_epg_align Legen Sie fest, wie der Text für das EPG in der menu.hint_channellist_extended Bei aktivierter Funktion wird vor dem Sendernamen ein Balken eingeblendet, der den Sendungsfortschritt anzeigt menu.hint_channellist_fonts Ändern Sie die Schriftgrößen in der Kanalliste menu.hint_channellist_foot Definiert, welche Informationen im unteren Sendungsfenster angezeigt werden sollen +menu.hint_channellist_mode Wählen Sie die Start-Kanalliste im TV-Modus +menu.hint_channellist_mode_radio Wählen Sie die Start-Kanalliste im Radio-Modus menu.hint_channellist_setup Wählen Sie die Anzeigeoptionen für die Kanalliste menu.hint_channellist_show_channellogo Zeigt Senderlogos in der Kanalliste. menu.hint_channels Kanalliste öffnen @@ -2060,8 +2063,10 @@ zapit.scantype.all Alle Services zapit.scantype.radio Nur Radio zapit.scantype.tv Nur TV zapit.scantype.tvradio Nur TV & Radio +zapitsetup.channelmode Start-Kanalliste für TV +zapitsetup.channelmode_radio Start-Kanalliste für Radio zapitsetup.head Startkanal-Verwaltung -zapitsetup.info Start Kanal +zapitsetup.info Startkanal zapitsetup.last_radio Radio Kanal zapitsetup.last_tv TV Kanal zapitsetup.last_use Kanal beim Runterfahren speichern diff --git a/data/locale/english.locale b/data/locale/english.locale index 8e1da55e2..c61b29047 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -240,6 +240,7 @@ channellist.nonefound No channels were found!\nPlease execute a scan\n(MENU-key channellist.numeric_adjust Numeric zap adjust channellist.provs Providers channellist.recording_not_possible Recording not possible! +channellist.remember Last used channellist.reset_all Reset 'new' flag for all channels channellist.reset_flags Reset 'new' channel flag channellist.sats Satellites @@ -818,6 +819,8 @@ menu.hint_channellist_epg_align EPG event align menu.hint_channellist_extended Show current event progress bar menu.hint_channellist_fonts Change channel list font sizes menu.hint_channellist_foot Show additional information\nin bottom box +menu.hint_channellist_mode Use the selected channel list mode on startup if last mode is TV +menu.hint_channellist_mode_radio Use the selected channel list mode on startup if last mode is Radio menu.hint_channellist_setup Configure channel list GUI options menu.hint_channellist_show_channellogo Show channellogos in channel list menu.hint_channels Open channel list @@ -2060,6 +2063,8 @@ zapit.scantype.all all services zapit.scantype.radio only radio zapit.scantype.tv only tv zapit.scantype.tvradio tv & radio +zapitsetup.channelmode Initial TV channel list +zapitsetup.channelmode_radio Initial Radio channel list zapitsetup.head Start Channel Settings zapitsetup.info Start Channel zapitsetup.last_radio Radio Channel diff --git a/src/gui/zapit_setup.cpp b/src/gui/zapit_setup.cpp index a9b2e8bc3..337093b5e 100644 --- a/src/gui/zapit_setup.cpp +++ b/src/gui/zapit_setup.cpp @@ -75,6 +75,20 @@ int CZapitSetup::showMenu() CMenuForwarder *zapit2 = new CMenuForwarder(LOCALE_ZAPITSETUP_LAST_RADIO , !g_settings.uselastchannel, g_settings.StartChannelRadio, &select, "radio", CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW ); zapit2->setHint("", LOCALE_MENU_HINT_LAST_RADIO); + #define CHANNEL_LIST_MODE_OPTION_COUNT 5 + const CMenuOptionChooser::keyval CHANNEL_LIST_MODE_OPTIONS[CHANNEL_LIST_MODE_OPTION_COUNT] = { + { -1, LOCALE_CHANNELLIST_REMEMBER } + , { LIST_MODE_FAV, LOCALE_CHANNELLIST_FAVS } + , { LIST_MODE_PROV, LOCALE_BOUQUETLIST_HEAD } + , { LIST_MODE_SAT, LOCALE_CHANNELLIST_SATS } + , { LIST_MODE_ALL, LOCALE_CHANNELLIST_HEAD } + }; + + CMenuOptionChooser *channel_mode = new CMenuOptionChooser(LOCALE_ZAPITSETUP_CHANNELMODE, &g_settings.channel_mode_initial, CHANNEL_LIST_MODE_OPTIONS, CHANNEL_LIST_MODE_OPTION_COUNT, true, NULL, CRCInput::RC_1, NULL, true); + channel_mode->setHint("", LOCALE_MENU_HINT_CHANNELLIST_MODE); + CMenuOptionChooser *channel_mode_radio = new CMenuOptionChooser(LOCALE_ZAPITSETUP_CHANNELMODE_RADIO, &g_settings.channel_mode_initial_radio, CHANNEL_LIST_MODE_OPTIONS, CHANNEL_LIST_MODE_OPTION_COUNT, true, NULL, CRCInput::RC_2, NULL, true); + channel_mode_radio->setHint("", LOCALE_MENU_HINT_CHANNELLIST_MODE_RADIO); + miscZapitNotifier->addItem(zapit1); miscZapitNotifier->addItem(zapit2); @@ -82,6 +96,9 @@ int CZapitSetup::showMenu() zapit->addItem(GenericMenuSeparatorLine); zapit->addItem(zapit1); zapit->addItem(zapit2); + zapit->addItem(GenericMenuSeparatorLine); + zapit->addItem(channel_mode); + zapit->addItem(channel_mode_radio); int res = zapit->exec(NULL, ""); delete miscZapitNotifier; diff --git a/src/neutrino.cpp b/src/neutrino.cpp index d3b90e289..a3a84f84a 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -332,6 +332,12 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.current_volume_step = configfile.getInt32("current_volume_step", 2); g_settings.channel_mode = configfile.getInt32("channel_mode", LIST_MODE_PROV); g_settings.channel_mode_radio = configfile.getInt32("channel_mode_radio", LIST_MODE_PROV); + g_settings.channel_mode_initial = configfile.getInt32("channel_mode_initial", -1); + g_settings.channel_mode_initial_radio = configfile.getInt32("channel_mode_initial_radio", -1); + if (g_settings.channel_mode_initial > -1) + g_settings.channel_mode = g_settings.channel_mode_initial; + if (g_settings.channel_mode_initial_radio > -1) + g_settings.channel_mode_radio = g_settings.channel_mode_initial_radio; g_settings.fan_speed = configfile.getInt32( "fan_speed", 1); if(g_settings.fan_speed < 1) g_settings.fan_speed = 1; @@ -862,6 +868,8 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setInt32( "current_volume_step", g_settings.current_volume_step ); configfile.setInt32( "channel_mode", g_settings.channel_mode ); configfile.setInt32( "channel_mode_radio", g_settings.channel_mode_radio ); + configfile.setInt32( "channel_mode_initial", g_settings.channel_mode_initial ); + configfile.setInt32( "channel_mode_initial_radio", g_settings.channel_mode_initial_radio ); configfile.setInt32( "fan_speed", g_settings.fan_speed); diff --git a/src/system/locals.h b/src/system/locals.h index 9f70b81e3..958e0d76a 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -267,6 +267,7 @@ typedef enum LOCALE_CHANNELLIST_NUMERIC_ADJUST, LOCALE_CHANNELLIST_PROVS, LOCALE_CHANNELLIST_RECORDING_NOT_POSSIBLE, + LOCALE_CHANNELLIST_REMEMBER, LOCALE_CHANNELLIST_RESET_ALL, LOCALE_CHANNELLIST_RESET_FLAGS, LOCALE_CHANNELLIST_SATS, @@ -845,6 +846,8 @@ typedef enum LOCALE_MENU_HINT_CHANNELLIST_EXTENDED, LOCALE_MENU_HINT_CHANNELLIST_FONTS, LOCALE_MENU_HINT_CHANNELLIST_FOOT, + LOCALE_MENU_HINT_CHANNELLIST_MODE, + LOCALE_MENU_HINT_CHANNELLIST_MODE_RADIO, LOCALE_MENU_HINT_CHANNELLIST_SETUP, LOCALE_MENU_HINT_CHANNELLIST_SHOW_CHANNELLOGO, LOCALE_MENU_HINT_CHANNELS, @@ -2087,6 +2090,8 @@ typedef enum LOCALE_ZAPIT_SCANTYPE_RADIO, LOCALE_ZAPIT_SCANTYPE_TV, LOCALE_ZAPIT_SCANTYPE_TVRADIO, + LOCALE_ZAPITSETUP_CHANNELMODE, + LOCALE_ZAPITSETUP_CHANNELMODE_RADIO, LOCALE_ZAPITSETUP_HEAD, LOCALE_ZAPITSETUP_INFO, LOCALE_ZAPITSETUP_LAST_RADIO, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 8cb505eef..73cd38ef2 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -267,6 +267,7 @@ const char * locale_real_names[] = "channellist.numeric_adjust", "channellist.provs", "channellist.recording_not_possible", + "channellist.remember", "channellist.reset_all", "channellist.reset_flags", "channellist.sats", @@ -845,6 +846,8 @@ const char * locale_real_names[] = "menu.hint_channellist_extended", "menu.hint_channellist_fonts", "menu.hint_channellist_foot", + "menu.hint_channellist_mode", + "menu.hint_channellist_mode_radio", "menu.hint_channellist_setup", "menu.hint_channellist_show_channellogo", "menu.hint_channels", @@ -2087,6 +2090,8 @@ const char * locale_real_names[] = "zapit.scantype.radio", "zapit.scantype.tv", "zapit.scantype.tvradio", + "zapitsetup.channelmode", + "zapitsetup.channelmode_radio", "zapitsetup.head", "zapitsetup.info", "zapitsetup.last_radio", diff --git a/src/system/settings.h b/src/system/settings.h index ab0a6cf6b..f4d0697b1 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -64,6 +64,8 @@ struct SNeutrinoSettings int current_volume_step; int channel_mode; int channel_mode_radio; + int channel_mode_initial; + int channel_mode_initial_radio; //misc int shutdown_real; From dbdf6b6afe38e67e58baf339699b034489c456b2 Mon Sep 17 00:00:00 2001 From: martii Date: Sat, 1 Mar 2014 13:43:37 +0100 Subject: [PATCH 035/225] gui/zapit_setup: add initial channel list mode options (locale fix) --- src/gui/zapit_setup.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/zapit_setup.cpp b/src/gui/zapit_setup.cpp index 337093b5e..8b600c16e 100644 --- a/src/gui/zapit_setup.cpp +++ b/src/gui/zapit_setup.cpp @@ -79,7 +79,7 @@ int CZapitSetup::showMenu() const CMenuOptionChooser::keyval CHANNEL_LIST_MODE_OPTIONS[CHANNEL_LIST_MODE_OPTION_COUNT] = { { -1, LOCALE_CHANNELLIST_REMEMBER } , { LIST_MODE_FAV, LOCALE_CHANNELLIST_FAVS } - , { LIST_MODE_PROV, LOCALE_BOUQUETLIST_HEAD } + , { LIST_MODE_PROV, LOCALE_CHANNELLIST_PROVS } , { LIST_MODE_SAT, LOCALE_CHANNELLIST_SATS } , { LIST_MODE_ALL, LOCALE_CHANNELLIST_HEAD } }; From a25bc90d7bc857dce3b0fe5e58c77df8787a90c4 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 1 Mar 2014 21:16:29 +0100 Subject: [PATCH 036/225] hdd_menu: improve error resilience in getFmtType() --- src/gui/hdd_menu.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gui/hdd_menu.cpp b/src/gui/hdd_menu.cpp index 0087c5219..e1ee63f33 100644 --- a/src/gui/hdd_menu.cpp +++ b/src/gui/hdd_menu.cpp @@ -105,14 +105,18 @@ std::string getFmtType(const char* name, int num) FILE* f = my_popen(pid, pcmd.c_str(), "r"); if (f != NULL) { char buff[512]; - fgets(buff, sizeof(buff), f); + if (!fgets(buff, sizeof(buff), f)) + buff[0] = '\0'; fclose(f); ret = buff; std::string search = "TYPE=\""; size_t pos = ret.find(search); + if (pos == std::string::npos) + return ""; ret = ret.substr(pos + search.length()); pos = ret.find("\""); - ret = ret.substr(0, pos); + if (pos != std::string::npos) + ret = ret.substr(0, pos); } return ret; } From 64a61f5aa27b604288fe60b41a4f74b484e1b44e Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 23 Feb 2014 17:57:02 +0100 Subject: [PATCH 037/225] hdd_menu: better error message ...when trying to check unsupported file system type --- data/locale/deutsch.locale | 1 + data/locale/english.locale | 1 + src/gui/hdd_menu.cpp | 4 +++- src/system/locals.h | 1 + src/system/locals_intern.h | 1 + 5 files changed, 7 insertions(+), 1 deletion(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 09b445d1d..9dd4b45c5 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -621,6 +621,7 @@ hdd_format Formatiere Festplatte hdd_format_failed Formatierung fehlgeschlagen hdd_format_warn Formatierung wird gestartet hdd_fs Dateisystem zum formatieren +hdd_fs_unknown unbekannt hdd_manage Laufwerke verwalten hdd_middle Mittel hdd_noise Akustikkontrolle (AAM) diff --git a/data/locale/english.locale b/data/locale/english.locale index c61b29047..af747cb90 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -621,6 +621,7 @@ hdd_format Formating drive... hdd_format_failed Formating failed! hdd_format_warn Start format... hdd_fs Filesystem used to format +hdd_fs_unknown unknown hdd_manage Manage drives hdd_middle Mid hdd_noise Acoustic-control (AAM) diff --git a/src/gui/hdd_menu.cpp b/src/gui/hdd_menu.cpp index e1ee63f33..7b9e0c734 100644 --- a/src/gui/hdd_menu.cpp +++ b/src/gui/hdd_menu.cpp @@ -2,7 +2,7 @@ Neutrino-GUI - DBoxII-Project Copyright (C) 2001 Steffen Hehn 'McClean' - Copyright (C) 2010-2012 Stefan Seyfried + Copyright (C) 2010-2014 Stefan Seyfried License: GPL @@ -617,6 +617,8 @@ int CHDDChkExec::exec(CMenuTarget* /*parent*/, const std::string& key) ((fmt_type == "ext4") && (!ext4FsckBinaryExist) && (!e2fsckBinaryExist))) { char msg1[512], msg2[512]; + if (fmt_type.empty()) + fmt_type = g_Locale->getText(LOCALE_HDD_FS_UNKNOWN); snprintf(msg1, sizeof(msg1)-1, "%s", g_Locale->getText(LOCALE_HDD_CHECK_FORMAT_BAD)); snprintf(msg2, sizeof(msg2)-1, msg1, fmt_type.c_str()); hintbox = new CHintBox(LOCALE_HDD_CHECK, msg2); diff --git a/src/system/locals.h b/src/system/locals.h index 958e0d76a..a38cf9c63 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -648,6 +648,7 @@ typedef enum LOCALE_HDD_FORMAT_FAILED, LOCALE_HDD_FORMAT_WARN, LOCALE_HDD_FS, + LOCALE_HDD_FS_UNKNOWN, LOCALE_HDD_MANAGE, LOCALE_HDD_MIDDLE, LOCALE_HDD_NOISE, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 73cd38ef2..d8bf9e571 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -648,6 +648,7 @@ const char * locale_real_names[] = "hdd_format_failed", "hdd_format_warn", "hdd_fs", + "hdd_fs_unknown", "hdd_manage", "hdd_middle", "hdd_noise", From 04fd8c277ccb7f14a1b9c3fddce0dfbad3383475 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 1 Mar 2014 21:17:56 +0100 Subject: [PATCH 038/225] my_popen: fix indentation --- src/system/helpers.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp index 2ab1512cd..3ab043b44 100644 --- a/src/system/helpers.cpp +++ b/src/system/helpers.cpp @@ -205,8 +205,8 @@ FILE* my_popen( pid_t& pid, const char *cmdstring, const char *type) close(pfd[1]); if ((fp = fdopen(pfd[0], type)) == NULL) return(NULL); - } else { - close(pfd[0]); + } else { + close(pfd[0]); if ((fp = fdopen(pfd[1], type)) == NULL) return(NULL); } From fd063bbd961069ae6e9676e60e33ff31fa7e905b Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Sat, 1 Mar 2014 21:45:19 +0100 Subject: [PATCH 039/225] gui/zapit_setup: add initial channel list mode options (MenuOptionChooser fix) --- src/gui/zapit_setup.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/zapit_setup.cpp b/src/gui/zapit_setup.cpp index 8b600c16e..eb368339f 100644 --- a/src/gui/zapit_setup.cpp +++ b/src/gui/zapit_setup.cpp @@ -84,9 +84,9 @@ int CZapitSetup::showMenu() , { LIST_MODE_ALL, LOCALE_CHANNELLIST_HEAD } }; - CMenuOptionChooser *channel_mode = new CMenuOptionChooser(LOCALE_ZAPITSETUP_CHANNELMODE, &g_settings.channel_mode_initial, CHANNEL_LIST_MODE_OPTIONS, CHANNEL_LIST_MODE_OPTION_COUNT, true, NULL, CRCInput::RC_1, NULL, true); + CMenuOptionChooser *channel_mode = new CMenuOptionChooser(LOCALE_ZAPITSETUP_CHANNELMODE, &g_settings.channel_mode_initial, CHANNEL_LIST_MODE_OPTIONS, CHANNEL_LIST_MODE_OPTION_COUNT, true, NULL, CRCInput::RC_1, NEUTRINO_ICON_BUTTON_1); channel_mode->setHint("", LOCALE_MENU_HINT_CHANNELLIST_MODE); - CMenuOptionChooser *channel_mode_radio = new CMenuOptionChooser(LOCALE_ZAPITSETUP_CHANNELMODE_RADIO, &g_settings.channel_mode_initial_radio, CHANNEL_LIST_MODE_OPTIONS, CHANNEL_LIST_MODE_OPTION_COUNT, true, NULL, CRCInput::RC_2, NULL, true); + CMenuOptionChooser *channel_mode_radio = new CMenuOptionChooser(LOCALE_ZAPITSETUP_CHANNELMODE_RADIO, &g_settings.channel_mode_initial_radio, CHANNEL_LIST_MODE_OPTIONS, CHANNEL_LIST_MODE_OPTION_COUNT, true, NULL, CRCInput::RC_2, NEUTRINO_ICON_BUTTON_2); channel_mode_radio->setHint("", LOCALE_MENU_HINT_CHANNELLIST_MODE_RADIO); miscZapitNotifier->addItem(zapit1); From 580fcc97e58a785e3808577d3310b4ce645df9eb Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Sat, 1 Mar 2014 23:33:45 +0100 Subject: [PATCH 040/225] - fix (and enable) one-key-plugin; fix movieplayer-plugin --- data/locale/deutsch.locale | 7 +++-- data/locale/english.locale | 5 +++- src/gui/keybind_setup.cpp | 9 ++++--- src/gui/keybind_setup.h | 2 +- src/gui/miscsettings_menu.cpp | 48 ++++++++++++++++++++++++++--------- src/gui/movieplayer.cpp | 2 +- src/neutrino.cpp | 28 ++------------------ src/neutrino.h | 1 - src/system/locals.h | 3 +++ src/system/locals_intern.h | 3 +++ 10 files changed, 61 insertions(+), 47 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 9dd4b45c5..83c0f78ce 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -391,7 +391,7 @@ extra.key_pic_size 4:3 Anzeigeverhalten extra.key_pip_close Stop/Start PiP extra.key_pip_setup PiP Konfiguration extra.key_pip_swap Umschalten PiP/live -extra.key_plugin One-touch-Plugin +extra.key_plugin Schnellstart-Plugin extra.key_screenshot Screenshot Taste extra.key_timeshift Timeshift extra.key_unlock Entsperrtaste @@ -937,6 +937,7 @@ menu.hint_key_pic_size_active Die Taste für das 4:3 Anzeigeverhalten deaktivier menu.hint_key_pip_close Tastenzuordnung für Stop PiP oder Start mit aktuellem Kanal menu.hint_key_pip_setup Tastenzuordnung für PiP Konfiguration menu.hint_key_pip_swap Tastenzuordnung zum Umschalten PiP und aktuellem Kanal +menu.hint_key_plugin Wählen Sie eine Taste für das Schnellstart-Plugin menu.hint_key_poweroff Wählen Sie eine Taste für den Standby und für das Verhalten für Standby und Deep-Standby menu.hint_key_quickzap Konfigurieren Sie die Tastenbelegung für die Schnellumschaltung menu.hint_key_repeatblock Die Verzögerung nach einem Tastendruck bis die Box reagieren soll @@ -983,6 +984,7 @@ menu.hint_misc_filebrowser Dateisystem, Dateirechte anzeigen im Dateibrowser, St menu.hint_misc_general Standby-, Teletext- und Rotor-Einstellungen, Pluginverzeichnis auf externem Datenträger menu.hint_misc_zapit Verwaltung der Start-Kanäle für den TV/Radio-Modus menu.hint_movie Wiedergabe von Filmen +menu.hint_movieplayer_plugin Wählen Sie ein Plugin, das mit einer Schnellstart-Taste im Movieplayer-Modus gestartet wird menu.hint_net_broadcast Ändern Sie die Broadcast-Adresse.\nWenn Sie unsicher sind, verwenden Sie zuletzt .255 menu.hint_net_dhcp Verwenden Sie einen DHCP-Server für die automatische Vergabe einer IP-Adresse im Netzwerk menu.hint_net_djmount Mountet UPnP-Geräte als Dateisystem unter /media/00upnp @@ -1018,6 +1020,7 @@ menu.hint_net_xupnpd Freigabe von Live Channels über UPNP menu.hint_network IP-Adresse, Gateway, DNS, Zeit-Sync, Netzwerk-Freigaben, Dienste und mehr menu.hint_new_zap_mode Aktiviert Quickzap in der Kanalliste. Nach Betätigen der Mute-Taste wird mit den Hoch/Runter-Tasten direkt umgeschalten menu.hint_numeric_adjust Adjust channel list mode on numeric zap +menu.hint_onekey_plugin Wählen Sie ein Plugin, das mit einer Schnellstart-Taste gestartet wird menu.hint_osd Farben, Schriftarten, Anzeigegröße, Ansichtsoptionen der Menüs und mehr menu.hint_osd_language Wählen Sie ihre Menü-Sprache menu.hint_osd_preset Wählen Sie zwischen Röhren-TV (CRT) oder Flachbildschirm (LCD) @@ -1502,7 +1505,7 @@ mpkey.bookmark Speichere Lesezeichen mpkey.forward Vorlauf mpkey.pause Pause mpkey.play Play -mpkey.plugin Starte Plugin +mpkey.plugin Movieplayer-Plugin mpkey.rewind Rücklauf mpkey.stop Stopp mpkey.subtitle Untertitel diff --git a/data/locale/english.locale b/data/locale/english.locale index af747cb90..42226686d 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -937,6 +937,7 @@ menu.hint_key_pic_size_active Disable/enable key for the 4:3 display behavior menu.hint_key_pip_close Assign button to stop PiP\nor start it for current channel menu.hint_key_pip_setup Assign button to configure PiP menu.hint_key_pip_swap Assign button to swap PiP and live channel +menu.hint_key_plugin Assign button to execute the one touch plugin menu.hint_key_poweroff Assign button to switch power state\n (standby/deepstandby <-> running) menu.hint_key_quickzap Configure keybingdings for quick\nchannel switch menu.hint_key_repeatblock Delay after button press and before\nfirst key repeat @@ -983,6 +984,7 @@ menu.hint_misc_filebrowser Filesystem encoding, file rights\ndeny directory leav menu.hint_misc_general Start to standby, cache teletext, swp rotor\nplugin hdd dir menu.hint_misc_zapit Initial TV/Radio channels menu.hint_movie Play movies +menu.hint_movieplayer_plugin Choose a plugin that's executed with the one touch key in movieplayer mode menu.hint_net_broadcast Enter broadcast address\nif unsure, use IP address with last .255 menu.hint_net_dhcp Use DHCP server to auto-configure menu.hint_net_djmount Mount UPnP devices as filesystem\nunder /media/00upnp @@ -1018,6 +1020,7 @@ menu.hint_net_xupnpd Share live channels over UPNP menu.hint_network IP address, gateway, DNS, Time sync\nNetwork shares and services menu.hint_new_zap_mode Allow channel switch while browsing\n(toggle mode with 'mute' in channel list) menu.hint_numeric_adjust Adjust channel list mode on numeric zap +menu.hint_onekey_plugin Choose a plugin that's executed with the one touch key menu.hint_osd Colors, fonts, screen size\nGUI look and feel options menu.hint_osd_language Select OSD language menu.hint_osd_preset Pre-configured screen margins for CRT and LCD TV @@ -1502,7 +1505,7 @@ mpkey.bookmark save bookmark mpkey.forward Forward mpkey.pause Pause mpkey.play Play -mpkey.plugin Run plugin +mpkey.plugin Movieplayer plugin mpkey.rewind Rewind mpkey.stop Stop mpkey.subtitle Subtitles diff --git a/src/gui/keybind_setup.cpp b/src/gui/keybind_setup.cpp index b17b8e3cf..e47d742a9 100644 --- a/src/gui/keybind_setup.cpp +++ b/src/gui/keybind_setup.cpp @@ -183,7 +183,7 @@ const key_settings_struct_t key_settings[CKeybindSetup::KEYBINDS_COUNT] = {LOCALE_MPKEY_BOOKMARK, &g_settings.mpkey_bookmark, LOCALE_MENU_HINT_KEY_MPBOOKMARK }, {LOCALE_EXTRA_KEY_TIMESHIFT, &g_settings.key_timeshift, LOCALE_MENU_HINT_KEY_MPTIMESHIFT }, {LOCALE_MPKEY_PLUGIN, &g_settings.mpkey_plugin, LOCALE_MENU_HINT_KEY_MPPLUGIN }, - /*{LOCALE_EXTRA_KEY_PLUGIN, &g_settings.key_plugin, },*/ + {LOCALE_EXTRA_KEY_PLUGIN, &g_settings.key_plugin, LOCALE_MENU_HINT_KEY_PLUGIN }, {LOCALE_EXTRA_KEY_UNLOCK, &g_settings.key_unlock, LOCALE_MENU_HINT_KEY_UNLOCK}, {LOCALE_EXTRA_KEY_SCREENSHOT, &g_settings.key_screenshot, LOCALE_MENU_HINT_KEY_SCREENSHOT }, {LOCALE_EXTRA_KEY_PIP_CLOSE, &g_settings.key_pip_close, LOCALE_MENU_HINT_KEY_PIP_CLOSE }, @@ -337,7 +337,6 @@ void CKeybindSetup::showKeyBindSetup(CMenuWidget *bindSettings) //misc bindSettings->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_KEYBINDINGMENU_MISC)); - //bindSettings->addItem(new CMenuForwarder(keydescription[KEY_PLUGIN], true, NULL, keychooser[KEY_PLUGIN])); //Special keys CMenuWidget* bindSettings_special = new CMenuWidget(LOCALE_KEYBINDINGMENU_HEAD, NEUTRINO_ICON_KEYBINDING, width, MN_WIDGET_ID_KEYSETUP_KEYBINDING_SPECIAL); @@ -346,6 +345,10 @@ void CKeybindSetup::showKeyBindSetup(CMenuWidget *bindSettings) mf->setHint("", LOCALE_MENU_HINT_KEY_SPECIAL_ACTIVE); bindSettings->addItem(mf); + //onekey-plugin + mf = new CMenuForwarder(key_settings[KEY_PLUGIN].keydescription, true, keychooser[KEY_PLUGIN]->getKeyName(), keychooser[KEY_PLUGIN]); + mf->setHint("", key_settings[KEY_PLUGIN].hint); + bindSettings->addItem(mf); // unlock mf = new CMenuForwarder(key_settings[KEY_UNLOCK].keydescription, true, keychooser[KEY_UNLOCK]->getKeyName(), keychooser[KEY_UNLOCK]); mf->setHint("", key_settings[KEY_UNLOCK].hint); @@ -432,7 +435,7 @@ void CKeybindSetup::showKeyBindMovieplayerSetup(CMenuWidget *bindSettings_mplaye { bindSettings_mplayer->addIntroItems(LOCALE_MAINMENU_MOVIEPLAYER); - for (int i = MPKEY_REWIND; i < MPKEY_PLUGIN; i++) { + for (int i = MPKEY_REWIND; i <= MPKEY_PLUGIN; i++) { CMenuForwarder * mf = new CMenuForwarder(key_settings[i].keydescription, true, keychooser[i]->getKeyName(), keychooser[i]); mf->setHint("", key_settings[i].hint); bindSettings_mplayer->addItem(mf); diff --git a/src/gui/keybind_setup.h b/src/gui/keybind_setup.h index 7a6313793..8b0de168d 100644 --- a/src/gui/keybind_setup.h +++ b/src/gui/keybind_setup.h @@ -74,7 +74,7 @@ class CKeybindSetup : public CMenuTarget, public CChangeObserver MPKEY_BOOKMARK, KEY_TIMESHIFT, MPKEY_PLUGIN, - /*KEY_PLUGIN,*/ + KEY_PLUGIN, KEY_UNLOCK, KEY_SCREENSHOT, KEY_PIP_CLOSE, diff --git a/src/gui/miscsettings_menu.cpp b/src/gui/miscsettings_menu.cpp index c707e6ff6..36eb28c9a 100644 --- a/src/gui/miscsettings_menu.cpp +++ b/src/gui/miscsettings_menu.cpp @@ -57,8 +57,6 @@ #include #include -//#define ONE_KEY_PLUGIN - extern CPlugins * g_PluginList; extern cVideo *videoDecoder; @@ -95,10 +93,31 @@ int CMiscMenue::exec(CMenuTarget* parent, const std::string &actionKey) return menu_return::RETURN_REPAINT; } -#ifdef ONE_KEY_PLUGIN - else if(actionKey == "onekeyplugin") + else if(actionKey == "onekey_plugin") { - CMenuWidget MoviePluginSelector(LOCALE_EXTRA_KEY_PLUGIN, NEUTRINO_ICON_FEATURES); + CMenuWidget OneKeyPluginSelector(LOCALE_EXTRA_KEY_PLUGIN, NEUTRINO_ICON_FEATURES); + OneKeyPluginSelector.addItem(GenericMenuSeparator); + + char id[5]; + int cnt = 0; + int enabled_count = 0; + for(unsigned int count=0;count < (unsigned int) g_PluginList->getNumberOfPlugins();count++) + { + if (!g_PluginList->isHidden(count)) + { + sprintf(id, "%d", count); + enabled_count++; + OneKeyPluginSelector.addItem(new CMenuForwarder(g_PluginList->getName(count), true, NULL, new COnekeyPluginChangeExec(), id, CRCInput::convertDigitToKey(count)), (cnt == 0)); + cnt++; + } + } + + OneKeyPluginSelector.exec(NULL, ""); + return menu_return::RETURN_REPAINT; + } + else if(actionKey == "movieplayer_plugin") + { + CMenuWidget MoviePluginSelector(LOCALE_MOVIEPLAYER_DEFPLUGIN, NEUTRINO_ICON_FEATURES); MoviePluginSelector.addItem(GenericMenuSeparator); char id[5]; @@ -106,12 +125,11 @@ int CMiscMenue::exec(CMenuTarget* parent, const std::string &actionKey) int enabled_count = 0; for(unsigned int count=0;count < (unsigned int) g_PluginList->getNumberOfPlugins();count++) { - if (g_PluginList->getType(count)== CPlugins::P_TYPE_TOOL && !g_PluginList->isHidden(count)) + if (!g_PluginList->isHidden(count)) { - // e.g. vtxt-plugins sprintf(id, "%d", count); enabled_count++; - MoviePluginSelector.addItem(new CMenuForwarder(g_PluginList->getName(count), true, NULL, new COnekeyPluginChangeExec(), id, CRCInput::convertDigitToKey(count)), (cnt == 0)); + MoviePluginSelector.addItem(new CMenuForwarder(g_PluginList->getName(count), true, NULL, new CMoviePluginChangeExec(), id, CRCInput::convertDigitToKey(count)), (cnt == 0)); cnt++; } } @@ -119,7 +137,6 @@ int CMiscMenue::exec(CMenuTarget* parent, const std::string &actionKey) MoviePluginSelector.exec(NULL, ""); return menu_return::RETURN_REPAINT; } -#endif /*ONE_KEY_PLUGIN*/ else if(actionKey == "info") { unsigned num = CEitManager::getInstance()->getEventsCount(); @@ -315,12 +332,19 @@ void CMiscMenue::showMiscSettingsMenuGeneral(CMenuWidget *ms_general) ms_general->addItem(mc); } + ms_general->addItem(GenericMenuSeparatorLine); + CMenuForwarder * mf = new CMenuForwarder(LOCALE_PLUGINS_HDD_DIR, true, g_settings.plugin_hdd_dir, this, "plugin_dir"); mf->setHint("", LOCALE_MENU_HINT_PLUGINS_HDD_DIR); ms_general->addItem(mf); -#ifdef ONE_KEY_PLUGIN - ms_general->addItem(new CMenuForwarder(LOCALE_EXTRA_KEY_PLUGIN, true, g_settings.onekey_plugin,this,"onekeyplugin")); -#endif /*ONE_KEY_PLUGIN*/ + + mf = new CMenuForwarder(LOCALE_EXTRA_KEY_PLUGIN, true, g_settings.onekey_plugin, this, "onekey_plugin"); + mf->setHint("", LOCALE_MENU_HINT_ONEKEY_PLUGIN); + ms_general->addItem(mf); + + mf = new CMenuForwarder(LOCALE_MPKEY_PLUGIN, true, g_settings.movieplayer_plugin, this, "movieplayer_plugin"); + mf->setHint("", LOCALE_MENU_HINT_MOVIEPLAYER_PLUGIN); + ms_general->addItem(mf); } #define VIDEOMENU_HDMI_CEC_MODE_OPTION_COUNT 2 diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index a541bcd39..4d5b45a6b 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -629,7 +629,7 @@ void CMoviePlayerGui::PlayFile(void) showSubtitle(0); if (msg == (neutrino_msg_t) g_settings.mpkey_plugin) { - //g_PluginList->start_plugin_by_name (g_settings.movieplayer_plugin.c_str (), pidt); + g_PluginList->start_plugin_by_name (g_settings.movieplayer_plugin.c_str (), 0 /*param is unused*/); } else if (msg == (neutrino_msg_t) g_settings.mpkey_stop) { playstate = CMoviePlayerGui::STOPPED; } else if (msg == (neutrino_msg_t) g_settings.mpkey_play) { diff --git a/src/neutrino.cpp b/src/neutrino.cpp index a3a84f84a..0bf273f58 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -618,7 +618,7 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.recording_startstop_msg = configfile.getBool("recording_startstop_msg" , true); // default plugin for movieplayer - g_settings.movieplayer_plugin = configfile.getString( "movieplayer_plugin", "Teletext" ); + g_settings.movieplayer_plugin = configfile.getString( "movieplayer_plugin", "noplugin" ); g_settings.onekey_plugin = configfile.getString( "onekey_plugin", "noplugin" ); g_settings.plugin_hdd_dir = configfile.getString( "plugin_hdd_dir", "/media/sda1/plugins" ); g_settings.logo_hdd_dir = configfile.getString( "logo_hdd_dir", "/media/sda1/logos" ); @@ -1962,8 +1962,6 @@ TIMER_START(); //load Pluginlist before main menu (only show script menu if at least one script is available g_PluginList->loadPlugins(); - MoviePluginChanger = new CMoviePluginChangeExec; - // setup recording device setupRecordingDevice(); @@ -3643,27 +3641,6 @@ int CNeutrinoApp::exec(CMenuTarget* parent, const std::string & actionKey) return menu_return::RETURN_REPAINT; } - else if(actionKey == "movieplugin") { - parent->hide(); - CMenuWidget MoviePluginSelector(LOCALE_MOVIEPLAYER_DEFPLUGIN, NEUTRINO_ICON_FEATURES); - MoviePluginSelector.addItem(GenericMenuSeparator); - - char id[5]; - int cnt = 0; - int enabled_count = 0; - for(unsigned int count=0;count < (unsigned int) g_PluginList->getNumberOfPlugins();count++) { - if (g_PluginList->getType(count)== CPlugins::P_TYPE_TOOL && !g_PluginList->isHidden(count)) { - // zB vtxt-plugins - sprintf(id, "%d", count); - enabled_count++; - MoviePluginSelector.addItem(new CMenuForwarder(g_PluginList->getName(count), true, NULL, MoviePluginChanger, id, CRCInput::convertDigitToKey(count)), (cnt == 0)); - cnt++; - } - } - - MoviePluginSelector.exec(NULL, ""); - return menu_return::RETURN_REPAINT; - } else if(actionKey == "clearSectionsd") { g_Sectionsd->freeMemory(); @@ -3885,7 +3862,7 @@ void CNeutrinoApp::loadKeys(const char * fname) g_settings.mpkey_audio = tconfig.getInt32( "mpkey.audio", CRCInput::RC_green ); g_settings.mpkey_time = tconfig.getInt32( "mpkey.time", CRCInput::RC_setup ); g_settings.mpkey_bookmark = tconfig.getInt32( "mpkey.bookmark", CRCInput::RC_blue ); - g_settings.mpkey_plugin = tconfig.getInt32( "mpkey.plugin", CRCInput::RC_red ); + g_settings.mpkey_plugin = tconfig.getInt32( "mpkey.plugin", (unsigned int)CRCInput::RC_nokey ); g_settings.mpkey_subtitle = tconfig.getInt32( "mpkey.subtitle", CRCInput::RC_sub ); g_settings.key_format_mode_active = tconfig.getInt32( "key_format_mode_active", 1 ); @@ -4149,7 +4126,6 @@ void CNeutrinoApp::Cleanup() printf("cleanup 13\n");fflush(stdout); delete audioSetupNotifier; audioSetupNotifier = NULL; - delete MoviePluginChanger; MoviePluginChanger = NULL; printf("cleanup 14\n");fflush(stdout); delete TVbouquetList; TVbouquetList = NULL; diff --git a/src/neutrino.h b/src/neutrino.h index 821468789..9652136b0 100644 --- a/src/neutrino.h +++ b/src/neutrino.h @@ -102,7 +102,6 @@ private: int tvsort[LIST_MODE_LAST]; int radiosort[LIST_MODE_LAST]; - CMoviePluginChangeExec *MoviePluginChanger; bool channellist_visible; void SDT_ReloadChannels(); diff --git a/src/system/locals.h b/src/system/locals.h index a38cf9c63..3e2f597c1 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -964,6 +964,7 @@ typedef enum LOCALE_MENU_HINT_KEY_PIP_CLOSE, LOCALE_MENU_HINT_KEY_PIP_SETUP, LOCALE_MENU_HINT_KEY_PIP_SWAP, + LOCALE_MENU_HINT_KEY_PLUGIN, LOCALE_MENU_HINT_KEY_POWEROFF, LOCALE_MENU_HINT_KEY_QUICKZAP, LOCALE_MENU_HINT_KEY_REPEATBLOCK, @@ -1010,6 +1011,7 @@ typedef enum LOCALE_MENU_HINT_MISC_GENERAL, LOCALE_MENU_HINT_MISC_ZAPIT, LOCALE_MENU_HINT_MOVIE, + LOCALE_MENU_HINT_MOVIEPLAYER_PLUGIN, LOCALE_MENU_HINT_NET_BROADCAST, LOCALE_MENU_HINT_NET_DHCP, LOCALE_MENU_HINT_NET_DJMOUNT, @@ -1045,6 +1047,7 @@ typedef enum LOCALE_MENU_HINT_NETWORK, LOCALE_MENU_HINT_NEW_ZAP_MODE, LOCALE_MENU_HINT_NUMERIC_ADJUST, + LOCALE_MENU_HINT_ONEKEY_PLUGIN, LOCALE_MENU_HINT_OSD, LOCALE_MENU_HINT_OSD_LANGUAGE, LOCALE_MENU_HINT_OSD_PRESET, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index d8bf9e571..4ee6d219e 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -964,6 +964,7 @@ const char * locale_real_names[] = "menu.hint_key_pip_close", "menu.hint_key_pip_setup", "menu.hint_key_pip_swap", + "menu.hint_key_plugin", "menu.hint_key_poweroff", "menu.hint_key_quickzap", "menu.hint_key_repeatblock", @@ -1010,6 +1011,7 @@ const char * locale_real_names[] = "menu.hint_misc_general", "menu.hint_misc_zapit", "menu.hint_movie", + "menu.hint_movieplayer_plugin", "menu.hint_net_broadcast", "menu.hint_net_dhcp", "menu.hint_net_djmount", @@ -1045,6 +1047,7 @@ const char * locale_real_names[] = "menu.hint_network", "menu.hint_new_zap_mode", "menu.hint_numeric_adjust", + "menu.hint_onekey_plugin", "menu.hint_osd", "menu.hint_osd_language", "menu.hint_osd_preset", From 4b5242c254310677514346830192b88af563fa9c Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Sun, 2 Mar 2014 00:43:59 +0100 Subject: [PATCH 041/225] - plugins: cleanup * drop PLUGINDIR_USB * drop unused 'param' from startPlugin --- src/gui/movieplayer.cpp | 2 +- src/gui/pluginlist.cpp | 2 +- src/gui/plugins.cpp | 252 ++------------------------------- src/gui/plugins.h | 6 +- src/neutrino.cpp | 2 +- src/system/setting_helpers.cpp | 2 +- 6 files changed, 20 insertions(+), 246 deletions(-) diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index 4d5b45a6b..25e4b052f 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -629,7 +629,7 @@ void CMoviePlayerGui::PlayFile(void) showSubtitle(0); if (msg == (neutrino_msg_t) g_settings.mpkey_plugin) { - g_PluginList->start_plugin_by_name (g_settings.movieplayer_plugin.c_str (), 0 /*param is unused*/); + g_PluginList->startPlugin_by_name(g_settings.movieplayer_plugin.c_str ()); } else if (msg == (neutrino_msg_t) g_settings.mpkey_stop) { playstate = CMoviePlayerGui::STOPPED; } else if (msg == (neutrino_msg_t) g_settings.mpkey_play) { diff --git a/src/gui/pluginlist.cpp b/src/gui/pluginlist.cpp index d2ee3cdc4..353f7efcc 100644 --- a/src/gui/pluginlist.cpp +++ b/src/gui/pluginlist.cpp @@ -366,7 +366,7 @@ void CPluginList::paintItems() CPluginList::result_ CPluginList::pluginSelected() { hide(); - g_PluginList->startPlugin(pluginlist[selected]->number,0); + g_PluginList->startPlugin(pluginlist[selected]->number); if (!g_PluginList->getScriptOutput().empty()) { ShowMsg(LOCALE_PLUGINS_RESULT, g_PluginList->getScriptOutput(), CMessageBox::mbrBack,CMessageBox::mbBack,NEUTRINO_ICON_SHELL); diff --git a/src/gui/plugins.cpp b/src/gui/plugins.cpp index 439a5f7c5..f5088e0d6 100644 --- a/src/gui/plugins.cpp +++ b/src/gui/plugins.cpp @@ -59,14 +59,6 @@ #include #include "plugins.h" -/* for alexW images with old drivers: - * #define USE_VBI_INTERFACE 1 - */ - -#ifdef USE_VBI_INTERFACE -#define AVIA_VBI_START_VTXT 1 -#define AVIA_VBI_STOP_VTXT 2 -#endif #include #if ENABLE_LUA @@ -77,7 +69,6 @@ extern CPlugins * g_PluginList; /* neutrino.cpp */ extern CRemoteControl * g_RemoteControl; /* neutrino.cpp */ #define PLUGINDIR_VAR "/var/tuxbox/plugins" -#define PLUGINDIR_USB "/mnt/usb/tuxbox/plugins" CPlugins::CPlugins() { @@ -85,6 +76,11 @@ CPlugins::CPlugins() number_of_plugins = 0; } +CPlugins::~CPlugins() +{ + plugin_list.clear(); +} + bool CPlugins::plugin_exists(const std::string & filename) { return (find_plugin(filename) >= 0); @@ -163,22 +159,14 @@ void CPlugins::loadPlugins() plugin_list.clear(); sindex = 100; scanDir(g_settings.plugin_hdd_dir.c_str()); - scanDir(PLUGINDIR_USB); scanDir(PLUGINDIR_VAR); scanDir(PLUGINDIR); sort (plugin_list.begin(), plugin_list.end()); } -CPlugins::~CPlugins() -{ - plugin_list.clear(); -} - bool CPlugins::parseCfg(plugin *plugin_data) { -// FILE *fd; - std::ifstream inFile; std::string line[20]; int linecount = 0; @@ -292,13 +280,13 @@ PluginParam * CPlugins::makeParam(const char * const id, const int value, Plugin return makeParam(id, aval, next); } -void CPlugins::start_plugin_by_name(const std::string & filename,int param) +void CPlugins::startPlugin_by_name(const std::string & name) { for (int i = 0; i < (int) plugin_list.size(); i++) { - if (filename.compare(g_PluginList->getName(i))==0) + if (name.compare(g_PluginList->getName(i))==0) { - startPlugin(i,param); + startPlugin(i); return; } } @@ -308,7 +296,7 @@ void CPlugins::startPlugin(const char * const name) { int pluginnr = find_plugin(name); if (pluginnr > -1) - startPlugin(pluginnr,0); + startPlugin(pluginnr); else printf("[CPlugins] could not find %s\n", name); @@ -365,7 +353,7 @@ void CPlugins::startLuaPlugin(int number) } #endif -void CPlugins::startPlugin(int number,int /*param*/) +void CPlugins::startPlugin(int number) { // always delete old output delScriptOutput(); @@ -380,9 +368,8 @@ void CPlugins::startPlugin(int number,int /*param*/) sprintf(tmp, "%d", g_settings.screen_EndY); setenv("SCREEN_END_Y", tmp, 1); - //bool ispip = strncmp(plugin_list[number].pluginfile.c_str(), "pip", 3) ? false : true; bool ispip = strstr(plugin_list[number].pluginfile.c_str(), "pip") != 0; -//printf("exec: %s pip: %d\n", plugin_list[number].pluginfile.c_str(), ispip); + //printf("exec: %s pip: %d\n", plugin_list[number].pluginfile.c_str(), ispip); if (ispip && !g_RemoteControl->is_video_started) return; if (plugin_list[number].type == CPlugins::P_TYPE_SCRIPT) @@ -404,226 +391,15 @@ void CPlugins::startPlugin(int number,int /*param*/) return; } -#if 0 - PluginExec execPlugin; - char depstring[129]; - char *argv[20]; - void *libhandle[20]; - int argc = 0, i = 0, lcd_fd=-1; - char *p; - char *np; - void *handle; - char * error; - int vtpid = 0; - PluginParam * startparam = 0; -#endif - g_RCInput->clearRCMsg(); -#if 0 - if (plugin_list[number].fb) - { - startparam = makeParam(P_ID_FBUFFER , frameBuffer->getFileHandle() , startparam); - } - if (plugin_list[number].rc) - { - startparam = makeParam(P_ID_RCINPUT , g_RCInput->getFileHandle() , startparam); - startparam = makeParam(P_ID_RCBLK_ANF, g_settings.repeat_genericblocker, startparam); - startparam = makeParam(P_ID_RCBLK_REP, g_settings.repeat_blocker , startparam); - } - else - { - g_RCInput->stopInput(); - } - if (plugin_list[number].lcd) - { - CLCD::getInstance()->pause(); - - lcd_fd = open("/dev/dbox/lcd0", O_RDWR); - - startparam = makeParam(P_ID_LCD , lcd_fd , startparam); - } - if (plugin_list[number].vtxtpid) - { - vtpid = g_RemoteControl->current_PIDs.PIDs.vtxtpid; -#ifdef USE_VBI_INTERFACE - int fd = open("/dev/dbox/vbi0", O_RDWR); - if (fd > 0) - { - ioctl(fd, AVIA_VBI_STOP_VTXT, 0); - close(fd); - } -#endif - if (param>0) - vtpid=param; - startparam = makeParam(P_ID_VTXTPID, vtpid, startparam); - } - if (plugin_list[number].needoffset) - { - startparam = makeParam(P_ID_VFORMAT , g_settings.video_Format , startparam); - startparam = makeParam(P_ID_OFF_X , g_settings.screen_StartX , startparam); - startparam = makeParam(P_ID_OFF_Y , g_settings.screen_StartY , startparam); - startparam = makeParam(P_ID_END_X , g_settings.screen_EndX , startparam); - startparam = makeParam(P_ID_END_Y , g_settings.screen_EndY , startparam); - } - - PluginParam *par = startparam; - for ( ; par; par=par->next ) - { - printf("[CPlugins] (id,val):(%s,%s)\n", par->id, par->val); - } - std::string pluginname = plugin_list[number].filename; - - strcpy(depstring, plugin_list[number].depend.c_str()); - - argc=0; - if ( depstring[0] ) - { - p=depstring; - while ( 1 ) - { - argv[ argc ] = p; - argc++; - np = strchr(p,','); - if ( !np ) - break; - - *np=0; - p=np+1; - if ( argc == 20 ) // mehr nicht ! - break; - } - } - for ( i=0; isetPauseScanning (true); - g_Zapit->setEventMode(false); - if (g_Zapit->isPlayBackActive()) { - if (!CNeutrinoApp::getInstance()->recordingstatus) - g_Zapit->setRecordMode(true); - } else { - /* no playback, we playing file ? zap to channel */ - t_channel_id current_channel = g_Zapit->getCurrentServiceID(); - g_Zapit->zapTo_serviceID(current_channel); - } - } - g_RCInput->close_click(); -#ifndef FB_USE_PALETTE - if (plugin_list[number].fb) { - frameBuffer->setMode(720, 576, 8); - frameBuffer->paletteSet(); - } -#endif - execPlugin(startparam); - dlclose(handle); - printf("[CPlugins] exec done...\n"); - g_RCInput->open_click(); - } - } - //restore framebuffer... -//#if 0 -// g_RCInput->open_click(); -//#endif - - //if (!plugin_list[number].rc) - g_RCInput->restartInput(); - g_RCInput->clearRCMsg(); - - if (plugin_list[number].lcd) - { - if (lcd_fd != -1) - close(lcd_fd); - CLCD::getInstance()->resume(); - } - - if (plugin_list[number].fb) - { -#ifdef FB_USE_PALETTE - frameBuffer->paletteSet(); -#else - frameBuffer->setMode(720, 576, 8 * sizeof(fb_pixel_t)); -#endif - } - frameBuffer->paintBackgroundBox(0,0,720,576); - if (ispip) { - if (!CNeutrinoApp::getInstance()->recordingstatus) { - g_Zapit->setRecordMode(false); - } - g_Zapit->setEventMode(true); - g_Sectionsd->setPauseScanning (false); - } - -#ifdef USE_VBI_INTERFACE - if (plugin_list[number].vtxtpid) - { - if (vtpid != 0) - { - // versuche, den gtx/enx_vbi wieder zu starten - int fd = open("/dev/dbox/vbi0", O_RDWR); - if (fd > 0) - { - ioctl(fd, AVIA_VBI_START_VTXT, vtpid); - close(fd); - } - } - } -#endif - } - - /* unload shared libs */ - for ( i=0; iid, since it is the original */ - free(par->val); - PluginParam * tmp = par; - par = par->next; - delete tmp; - } - g_RCInput->clearRCMsg(); -#else g_RCInput->clearRCMsg(); g_RCInput->stopInput(); - //frameBuffer->setMode(720, 576, 8 * sizeof(fb_pixel_t)); + printf("Starting %s\n", plugin_list[number].pluginfile.c_str()); my_system(2, plugin_list[number].pluginfile.c_str(), NULL); - //frameBuffer->setMode(720, 576, 8 * sizeof(fb_pixel_t)); + frameBuffer->paintBackground(); g_RCInput->restartInput(); g_RCInput->clearRCMsg(); -#endif } bool CPlugins::hasPlugin(CPlugins::p_type_t type) @@ -671,5 +447,3 @@ CPlugins::p_type_t CPlugins::getPluginType(int type) return P_TYPE_DISABLED; } } - - diff --git a/src/gui/plugins.h b/src/gui/plugins.h index ac7f15089..ede5aa4a3 100644 --- a/src/gui/plugins.h +++ b/src/gui/plugins.h @@ -123,13 +123,13 @@ class CPlugins inline int getIndex (const int number) const { return plugin_list[number].index ; } inline neutrino_msg_t getKey (const int number) const { return (neutrino_msg_t)plugin_list[number].key; } - void startPlugin(int number,int param); - void start_plugin_by_name(const std::string & filename,int param);// start plugins by "name=" in .cfg + void startPlugin(int number); // start plugins by number + void startPlugin(const char * const filename); // start plugins by filename + void startPlugin_by_name(const std::string & name); // start plugins by "name=" in .cfg void startScriptPlugin(int number); #if ENABLE_LUA void startLuaPlugin(int number); #endif - void startPlugin(const char * const filename); // start plugins also by name bool hasPlugin(CPlugins::p_type_t type); const std::string& getScriptOutput() const; diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 0bf273f58..5b1f7ee42 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -2210,7 +2210,7 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) numericZap( msg ); } else if( msg == (neutrino_msg_t) g_settings.key_plugin ) { - g_PluginList->start_plugin_by_name(g_settings.onekey_plugin.c_str(), 0); + g_PluginList->startPlugin_by_name(g_settings.onekey_plugin.c_str()); } else if(msg == (neutrino_msg_t) g_settings.key_timeshift) { CRecordManager::getInstance()->StartTimeshift(); diff --git a/src/system/setting_helpers.cpp b/src/system/setting_helpers.cpp index e94306ecd..2ec232eb6 100644 --- a/src/system/setting_helpers.cpp +++ b/src/system/setting_helpers.cpp @@ -385,7 +385,7 @@ int CStreamFeaturesChangeExec::exec(CMenuTarget* parent, const std::string & act } else if (sel>=0) { - g_PluginList->startPlugin(sel,0); + g_PluginList->startPlugin(sel); } return menu_return::RETURN_EXIT; From 3fa31ef44199ccef03bf46a86569af2e7339eb2e Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Sun, 2 Mar 2014 07:27:43 +0100 Subject: [PATCH 042/225] CLuaInstance: Add footer_height function --- src/gui/luainstance.cpp | 15 +++++++++++++++ src/gui/luainstance.h | 1 + 2 files changed, 16 insertions(+) diff --git a/src/gui/luainstance.cpp b/src/gui/luainstance.cpp index f2891d96f..0b1dd8cb7 100644 --- a/src/gui/luainstance.cpp +++ b/src/gui/luainstance.cpp @@ -1293,6 +1293,7 @@ void CLuaInstance::CWindowRegister(lua_State *L) { "paint", CLuaInstance::CWindowPaint }, { "hide", CLuaInstance::CWindowHide }, { "header_height", CLuaInstance::CWindowGetHeaderHeight }, + { "footer_height", CLuaInstance::CWindowGetFooterHeight }, { "__gc", CLuaInstance::CWindowDelete }, { NULL, NULL } }; @@ -1415,6 +1416,20 @@ int CLuaInstance::CWindowGetHeaderHeight(lua_State *L) return 1; } +int CLuaInstance::CWindowGetFooterHeight(lua_State *L) +{ + CLuaCWindow *m = CWindowCheck(L, 1); + if (!m) + return 0; + + CComponentsFooter* footer = m->w->getFooterObject(); + int fh = 0; + if (footer) + fh = footer->getHeight(); + lua_pushinteger(L, fh); + return 1; +} + int CLuaInstance::CWindowDelete(lua_State *L) { CLuaCWindow *m = CWindowCheck(L, 1); diff --git a/src/gui/luainstance.h b/src/gui/luainstance.h index 093fda100..7e5c31e51 100644 --- a/src/gui/luainstance.h +++ b/src/gui/luainstance.h @@ -199,6 +199,7 @@ private: static int CWindowPaint(lua_State *L); static int CWindowHide(lua_State *L); static int CWindowGetHeaderHeight(lua_State *L); + static int CWindowGetFooterHeight(lua_State *L); static int CWindowDelete(lua_State *L); static CLuaSignalBox *SignalBoxCheck(lua_State *L, int n); From c161760670d85095e46279b4e2ad2bcb6214f73c Mon Sep 17 00:00:00 2001 From: FlatTV Date: Sun, 2 Mar 2014 12:15:55 +0100 Subject: [PATCH 043/225] cYTFeedParser: Fix decodeVideoInfo() --- src/system/ytparser.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/system/ytparser.cpp b/src/system/ytparser.cpp index fe5b6870b..7e7622757 100644 --- a/src/system/ytparser.cpp +++ b/src/system/ytparser.cpp @@ -406,7 +406,7 @@ bool cYTFeedParser::decodeVideoInfo(std::string &answer, cYTVideoInfo &vinfo) std::string infofile = thumbnail_dir; infofile += "/"; infofile += vinfo.id; - infofile += ".txt" + infofile += ".txt"; saveToFile(infofile.c_str(), answer); #endif if(answer.find("token=") == std::string::npos) @@ -440,7 +440,17 @@ bool cYTFeedParser::decodeVideoInfo(std::string &answer, cYTVideoInfo &vinfo) #endif cYTVideoUrl yurl; yurl.url = smap["url"]; - yurl.sig = smap["sig"]; + + std::string::size_type ptr = smap["url"].find("signature="); + if (ptr != std::string::npos) + { + ptr = smap["url"].find("=", ptr); + smap["url"].erase(0,ptr+1); + + if((ptr = smap["url"].find("&")) != std::string::npos) + yurl.sig = smap["url"].substr(0,ptr); + } + int id = atoi(smap["itag"].c_str()); if (supportedFormat(id) && !yurl.url.empty() && !yurl.sig.empty()) { yurl.quality = smap["quality"]; From eb206ae523a83aa7aec53492ead29bd3493b5b8f Mon Sep 17 00:00:00 2001 From: martii Date: Sun, 2 Mar 2014 21:31:26 +0100 Subject: [PATCH 044/225] gui/widget/menue, gui/osdlang_setup: drop CMenuOptionLanguageChooser class --- src/gui/osdlang_setup.cpp | 18 ++++++++++++---- src/gui/personalize.cpp | 2 +- src/gui/widget/menue.cpp | 43 --------------------------------------- src/gui/widget/menue.h | 25 +---------------------- 4 files changed, 16 insertions(+), 72 deletions(-) diff --git a/src/gui/osdlang_setup.cpp b/src/gui/osdlang_setup.cpp index efea73397..983db336f 100644 --- a/src/gui/osdlang_setup.cpp +++ b/src/gui/osdlang_setup.cpp @@ -67,12 +67,18 @@ COsdLangSetup::~COsdLangSetup() } -int COsdLangSetup::exec(CMenuTarget* parent, const std::string &/*actionKey*/) +int COsdLangSetup::exec(CMenuTarget* parent, const std::string &actionKey) { dprintf(DEBUG_DEBUG, "init international setup\n"); if(parent != NULL) parent->hide(); + if (actionKey != "") { + g_settings.language = actionKey; + g_Locale->loadLocale(g_settings.language.c_str()); + return menu_return::RETURN_REPAINT; + } + int res = showLocalSetup(); return res; @@ -92,7 +98,7 @@ int COsdLangSetup::showLocalSetup() CMenuWidget osdl_setup(LOCALE_LANGUAGESETUP_OSD, NEUTRINO_ICON_LANGUAGE, width, MN_WIDGET_ID_LANGUAGESETUP_LOCALE); showLanguageSetup(&osdl_setup); - CMenuForwarder * mf = new CMenuForwarder(LOCALE_LANGUAGESETUP_OSD, true, NULL, &osdl_setup, NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED); + CMenuForwarder * mf = new CMenuForwarder(LOCALE_LANGUAGESETUP_OSD, true, g_settings.language, &osdl_setup, NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED); mf->setHint("", LOCALE_MENU_HINT_OSD_LANGUAGE); localSettings->addItem(mf); @@ -186,8 +192,12 @@ void COsdLangSetup::showLanguageSetup(CMenuWidget *osdl_setup) if (pos != NULL) { *pos = '\0'; - CMenuOptionLanguageChooser* oj = new CMenuOptionLanguageChooser((char*)locale, this, locale); - osdl_setup->addItem( oj ); + std::string loc(locale); + loc.at(0) = toupper(loc.at(0)); + + CMenuForwarder *mf = new CMenuForwarder(loc, true, NULL, this, locale); + mf->iconName = mf->getActionKey(); + osdl_setup->addItem(mf, !strcmp(locale, g_settings.language.c_str())); } free(namelist[count]); } diff --git a/src/gui/personalize.cpp b/src/gui/personalize.cpp index b36f2044f..04968098a 100644 --- a/src/gui/personalize.cpp +++ b/src/gui/personalize.cpp @@ -874,7 +874,7 @@ void CPersonalizeGui::addPersonalizedItems() //convert item to locked forwarder and use generated pin mode for usage as ask parameter v_item[i].menuItem = new CLockedMenuForwarder(fw->getTextLocale(), g_settings.easymenu ? g_settings.parentallock_pincode : g_settings.personalize_pincode, - use_pin, fw->active, NULL, fw->getTarget(), fw->getActionKey().c_str(), d_key, fw->iconName.c_str(), lock_icon); + use_pin, fw->active, NULL, fw->getTarget(), fw->getActionKey(), d_key, fw->iconName.c_str(), lock_icon); v_item[i].menuItem->hintIcon = fw->hintIcon; v_item[i].menuItem->hint = fw->hint; //add item if it's set to visible or pin protected and allow to add an forwarder as next diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 5ce614589..debbbaed7 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -1769,49 +1769,6 @@ int CMenuOptionStringChooser::paint( bool selected ) //------------------------------------------------------------------------------------------------------------------------------- -CMenuOptionLanguageChooser::CMenuOptionLanguageChooser(char* OptionValue, CChangeObserver* Observ, const char * const IconName) -{ - height = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight(); - optionValue = OptionValue; - observ = Observ; - - directKey = CRCInput::RC_nokey; - iconName = IconName ? IconName : ""; -} - - -CMenuOptionLanguageChooser::~CMenuOptionLanguageChooser() -{ -} - -int CMenuOptionLanguageChooser::exec(CMenuTarget*) -{ - g_settings.language = optionValue; - if(observ) - observ->changeNotify(LOCALE_LANGUAGESETUP_SELECT, (void *) optionValue.c_str()); - return menu_return::RETURN_EXIT; -} - -int CMenuOptionLanguageChooser::paint( bool selected ) -{ - active = true; - - //paint item - prepareItem(selected, height); - - paintItemButton(selected, height, iconName); - - //convert first letter to large - std::string s_optionValue = optionValue; - if(!s_optionValue.empty()) - s_optionValue[0] = (char)toupper(s_optionValue[0]); - //paint text - paintItemCaption(selected, height , s_optionValue.c_str()); - - return y+height; -} - -//------------------------------------------------------------------------------------------------------------------------------- CMenuForwarder::CMenuForwarder(const neutrino_locale_t Text, const bool Active, const std::string &Option, CMenuTarget* Target, const char * const ActionKey, neutrino_msg_t DirectKey, const char * const IconName, const char * const IconName_Info_right, bool IsStatic) { option_string = &Option; diff --git a/src/gui/widget/menue.h b/src/gui/widget/menue.h index c66484fea..aa286d8da 100644 --- a/src/gui/widget/menue.h +++ b/src/gui/widget/menue.h @@ -245,7 +245,7 @@ class CMenuForwarder : public CMenuItem int getWidth(void); neutrino_locale_t getTextLocale() const {return name;} CMenuTarget* getTarget() const {return jumpTarget;} - std::string getActionKey(){return actionKey;} + const char *getActionKey(){return actionKey.c_str();} int exec(CMenuTarget* parent); bool isSelectable(void) const { return active; } @@ -444,29 +444,6 @@ class CMenuOptionStringChooser : public CMenuItem int isMenueOptionChooser(void) const{return 1;} }; -class CMenuOptionLanguageChooser : public CMenuItem -{ - int height; - std::string optionValue; - CChangeObserver * observ; - - public: - CMenuOptionLanguageChooser(char* OptionValue, CChangeObserver* Observ = NULL, const char * const IconName = NULL); - ~CMenuOptionLanguageChooser(); - - int paint(bool selected); - int getHeight(void) const - { - return height; - } - bool isSelectable(void) const - { - return true; - } - - int exec(CMenuTarget* parent); -}; - class CMenuGlobal { public: From cf43a6f2a6e17182a3c01b79e12c886683b05394 Mon Sep 17 00:00:00 2001 From: martii Date: Sun, 2 Mar 2014 23:00:30 +0100 Subject: [PATCH 045/225] gui/pluginlist: drop custom menu implementation (but use the menu-hint as plugin-description) --- src/gui/pluginlist.cpp | 340 ++++++----------------------------------- src/gui/pluginlist.h | 61 ++------ src/gui/timerlist.cpp | 8 +- 3 files changed, 58 insertions(+), 351 deletions(-) diff --git a/src/gui/pluginlist.cpp b/src/gui/pluginlist.cpp index 353f7efcc..2f28c53e2 100644 --- a/src/gui/pluginlist.cpp +++ b/src/gui/pluginlist.cpp @@ -57,332 +57,80 @@ #include #include +#include #include "plugins.h" -/* for alexW images with old drivers: - * #define USE_VBI_INTERFACE 1 - */ - -#ifdef USE_VBI_INTERFACE - #define AVIA_VBI_START_VTXT 1 - #define AVIA_VBI_STOP_VTXT 2 -#endif - -#include extern CPlugins * g_PluginList; /* neutrino.cpp */ -extern CRemoteControl * g_RemoteControl; /* neutrino.cpp */ -CPluginList::CPluginList(const neutrino_locale_t Name, const uint32_t listtype) +CPluginList::CPluginList(const neutrino_locale_t Title, const uint32_t listtype) { - frameBuffer = CFrameBuffer::getInstance(); - name = Name; + title = Title; pluginlisttype = listtype; - selected = 0; - width = w_max( 500, 0 ); - height = h_max( 526, 50 ); // 2*25 pixel frei - theight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); - // - fheight1 = g_Font[SNeutrinoSettings::FONT_TYPE_GAMELIST_ITEMLARGE]->getHeight(); - fheight2 = g_Font[SNeutrinoSettings::FONT_TYPE_GAMELIST_ITEMSMALL]->getHeight(); - fheight = fheight1 + fheight2 + 2; - // - listmaxshow = (height-theight-0)/fheight; - height = theight+0+listmaxshow*fheight; // recalc height - x=getScreenStartX( width ); - y=getScreenStartY( height ); - liststart = 0; + width = w_max (40, 10); + selected = -1; + number = -1; } -CPluginList::~CPluginList() +int CPluginList::run() { - for(unsigned int count=0;countstartPlugin(number); + if (!g_PluginList->getScriptOutput().empty()) { + hide(); + ShowMsg(LOCALE_PLUGINS_RESULT, g_PluginList->getScriptOutput(), CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_SHELL); } - pluginlist.clear(); + return menu_return::RETURN_REPAINT; } -int CPluginList::exec(CMenuTarget* parent, const std::string & /*actionKey*/) +int CPluginList::exec(CMenuTarget* parent, const std::string &actionKey) { - neutrino_msg_t msg; - neutrino_msg_data_t data; - - int res = menu_return::RETURN_REPAINT; - if (parent) - { parent->hide(); - } - //scan4plugins here! - for(unsigned int count=0;countname = g_Locale->getText(LOCALE_MENU_BACK); - pluginlist.push_back(tmp); - - for(unsigned int count=0;count < (unsigned int)g_PluginList->getNumberOfPlugins();count++) - { - if ((g_PluginList->getType(count) & pluginlisttype) && !g_PluginList->isHidden(count)) - { - tmp = new pluginitem(); - tmp->number = count; - tmp->name = g_PluginList->getName(count); - tmp->desc = g_PluginList->getDescription(count); - if (tmp->desc == "") - tmp->desc = "---"; - pluginlist.push_back(tmp); - } - } - - COSDFader fader(g_settings.menu_Content_alpha); - fader.StartFadeIn(); - - paint(); - - uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]); - - bool loop=true; - while (loop) - { - g_RCInput->getMsgAbsoluteTimeout( &msg, &data, &timeoutEnd ); - - if ( msg <= CRCInput::RC_MaxRC ) - timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]); - - if((msg == NeutrinoMessages::EVT_TIMER) && (data == fader.GetTimer())) { - if(fader.Fade()) { - loop = false; - } - } - else if ( ( msg == CRCInput::RC_timeout ) || - ( msg == (neutrino_msg_t)g_settings.key_channelList_cancel ) ) - { - if(fader.StartFadeOut()) { - timeoutEnd = CRCInput::calcTimeoutEnd( 1 ); - msg = 0; - } else - loop=false; - } - else if ( msg == (neutrino_msg_t)g_settings.key_channelList_pageup ) - { - if ((int(selected)-int(listmaxshow))<0) - selected=0; - else - selected -= listmaxshow; - liststart = (selected/listmaxshow)*listmaxshow; - paintItems(); - } - else if ( msg == (neutrino_msg_t)g_settings.key_channelList_pagedown ) - { - selected+=listmaxshow; - if (selected>pluginlist.size()-1) - selected=pluginlist.size()-1; - liststart = (selected/listmaxshow)*listmaxshow; - paintItems(); - } - else if ( msg == CRCInput::RC_up ) - { - int prevselected=selected; - if(selected==0) - { - selected = pluginlist.size()-1; - } - else - selected--; - paintItem(prevselected - liststart); - unsigned int oldliststart = liststart; - liststart = (selected/listmaxshow)*listmaxshow; - if(oldliststart!=liststart) - { - paintItems(); - } - else - { - paintItem(selected - liststart); - } - } - else if ( msg == CRCInput::RC_down ) - { - int prevselected=selected; - selected = (selected+1)%pluginlist.size(); - paintItem(prevselected - liststart); - unsigned int oldliststart = liststart; - liststart = (selected/listmaxshow)*listmaxshow; - if(oldliststart!=liststart) - { - paintItems(); - } - else - { - paintItem(selected - liststart); - } - } - else if ( msg == CRCInput::RC_ok ) - { - if(selected==0) - { - loop=false; - } - else - {//exec the plugin :)) - if (pluginSelected() == close) - { - loop=false; - } - } - } - else if( (msg== CRCInput::RC_red) || - (msg==CRCInput::RC_green) || - (msg==CRCInput::RC_yellow) || - (msg==CRCInput::RC_blue) || - (CRCInput::isNumeric(msg)) ) - { - g_RCInput->postMsg(msg, data); - loop=false; - } - else if ( msg == CRCInput::RC_setup ) - { - loop = false; - res = menu_return::RETURN_EXIT_ALL; - } - else if ( CNeutrinoApp::getInstance()->handleMsg(msg, data) & messages_return::cancel_all ) - { - loop = false; - res = menu_return::RETURN_EXIT_ALL; - } - } - hide(); - - fader.Stop(); - return res; -} - -void CPluginList::hide() -{ - frameBuffer->paintBackgroundBoxRel(x,y, width+15,height); -} - -void CPluginList::paintItem(int pos) -{ - int ypos = (y+theight) + pos*fheight; - int itemheight = fheight; - - fb_pixel_t color = COL_MENUCONTENT_TEXT; - fb_pixel_t bgcolor = COL_MENUCONTENT_PLUS_0; - - if (liststart+pos==selected) - { - color = COL_MENUCONTENTSELECTED_TEXT; - bgcolor = COL_MENUCONTENTSELECTED_PLUS_0; - } - - if(liststart+pos==0) - { //back is half-height... - itemheight = (fheight / 2) + 3; - frameBuffer->paintBoxRel(x , ypos + itemheight , width , 15, COL_MENUCONTENT_PLUS_0); - frameBuffer->paintBoxRel(x + 10, ypos + itemheight + 5, width - 20, 1, COL_MENUCONTENT_PLUS_5); - frameBuffer->paintBoxRel(x + 10, ypos + itemheight + 6, width - 20, 1, COL_MENUCONTENT_PLUS_2); - } - else if(liststart==0) - { - ypos -= (fheight / 2) - 15; - //if(pos==(int)listmaxshow-1) - // frameBuffer->paintBoxRel(x,ypos+itemheight, width, (fheight / 2)-15, COL_MENUCONTENT_PLUS_0); - - } - //frameBuffer->paintBoxRel(x, ypos, width, itemheight, bgcolor); - - if(liststart+pos < pluginlist.size()) - { - frameBuffer->paintBoxRel(x, ypos, width, itemheight, bgcolor, RADIUS_LARGE); - pluginitem* actplugin = pluginlist[liststart+pos]; - g_Font[SNeutrinoSettings::FONT_TYPE_GAMELIST_ITEMLARGE]->RenderString(x+10, ypos+fheight1+3, width-20, actplugin->name, color, 0, true); // UTF-8 - g_Font[SNeutrinoSettings::FONT_TYPE_GAMELIST_ITEMSMALL]->RenderString(x+20, ypos+fheight, width-20, actplugin->desc, color, 0, true); // UTF-8 - } -} - -void CPluginList::paintHead() -{ - int h_width = width; - if (listmaxshow < pluginlist.size()) - h_width += 15; - - CComponentsHeaderLocalized header(x, y, h_width, theight, name); + if (number > -1) + return run(); + const char *icon = ""; if (pluginlisttype == CPlugins::P_TYPE_GAME) - header.setIcon(NEUTRINO_ICON_GAMES); + icon = NEUTRINO_ICON_GAMES; else - header.setIcon(NEUTRINO_ICON_SHELL); + icon = NEUTRINO_ICON_SHELL; - header.paint(CC_SAVE_SCREEN_NO); -} + CMenuWidget m(title, icon, width); + m.setSelected(selected); + m.addIntroItems(); -void CPluginList::paint() -{ - hide(); - width = w_max( 500, 0 ); - height = h_max( 526, 50 ); // 2*25 pixel frei - listmaxshow = (height-theight-0)/fheight; - if (pluginlist.size() < listmaxshow) - listmaxshow = pluginlist.size(); - height = theight+0+listmaxshow*fheight; // recalc height - x=getScreenStartX( width ); - y=getScreenStartY( height ); + int nop = g_PluginList->getNumberOfPlugins(); - liststart = (selected/listmaxshow)*listmaxshow; + int shortcut = 1; - paintHead(); - paintItems(); -} - -void CPluginList::paintItems() -{ - if(listmaxshow < pluginlist.size()) - { - // Scrollbar - int nrOfPages = ((pluginlist.size()-1) / listmaxshow)+1; - int currPage = (liststart/listmaxshow) +1; - float blockHeight = (height-theight-4-RADIUS_LARGE)/nrOfPages; - - frameBuffer->paintBoxRel(x, y+theight, width+15, height-theight, COL_MENUCONTENT_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM); - - frameBuffer->paintBoxRel(x+width, y+theight, 15, height-theight-RADIUS_LARGE, COL_MENUCONTENT_PLUS_1); - frameBuffer->paintBoxRel(x+ width +2, y+theight+2+int((currPage-1)*blockHeight) , 11, int(blockHeight), COL_MENUCONTENT_PLUS_3); - } else - frameBuffer->paintBoxRel(x, y+theight, width, height-theight, COL_MENUCONTENT_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM); - - for(unsigned int count=0;countgetType(count) & pluginlisttype) && !g_PluginList->isHidden(count)) { + CMenuForwarder *f = new CMenuForwarder(std::string(g_PluginList->getName(count)), true, "", this, to_string(count).c_str(), CRCInput::convertDigitToKey(shortcut++)); + //TODO: use hint-icons; header-icons are to small + f->setHint("", g_PluginList->getDescription(count)); + m.addItem(f); + } } + m.exec(NULL, ""); + m.hide(); + selected = m.getSelected(); + + return menu_return::RETURN_REPAINT; } -CPluginList::result_ CPluginList::pluginSelected() +CPluginChooser::CPluginChooser(const neutrino_locale_t Name, const uint32_t listtype, std::string &selectedFile) : CPluginList(Name, listtype) { - hide(); - g_PluginList->startPlugin(pluginlist[selected]->number); - if (!g_PluginList->getScriptOutput().empty()) - { - ShowMsg(LOCALE_PLUGINS_RESULT, g_PluginList->getScriptOutput(), CMessageBox::mbrBack,CMessageBox::mbBack,NEUTRINO_ICON_SHELL); - } - paint(); - return resume; + selectedFilePtr = &selectedFile; } -CPluginChooser::CPluginChooser(const neutrino_locale_t Name, const uint32_t listtype, char* pluginname) - : CPluginList(Name, listtype), selected_plugin(pluginname) +int CPluginChooser::run() { + if (number > -1) + *selectedFilePtr = g_PluginList->getFileName(number); + return menu_return::RETURN_EXIT; } - -CPluginList::result_ CPluginChooser::pluginSelected() -{ - strcpy(selected_plugin,g_PluginList->getFileName(pluginlist[selected]->number)); - return CPluginList::close; -} - diff --git a/src/gui/pluginlist.h b/src/gui/pluginlist.h index 3f7642d31..02a17f0c8 100644 --- a/src/gui/pluginlist.h +++ b/src/gui/pluginlist.h @@ -43,71 +43,28 @@ class CPluginList : public CMenuTarget { - public: - enum result_ - { - close = 0, - resume = 1 - } result; - private: - - CFrameBuffer *frameBuffer; - - struct pluginitem - { - int number; - std::string name; // UTF-8 encoded - std::string desc; // UTF-8 encoded - }; - - unsigned int liststart; - unsigned int listmaxshow; - int key; - neutrino_locale_t name; + neutrino_locale_t title; uint32_t pluginlisttype; - - int fheight; // Fonthoehe Channellist-Inhalt - int theight; // Fonthoehe Channellist-Titel - - int fheight1,fheight2; - - int width; - int height; - int x; - int y; - - void paintItem(int pos); - void paintItems(); - void paint(); - void paintHead(); + int width; protected: - - unsigned int selected; - std::vector pluginlist; - - virtual CPluginList::result_ pluginSelected(); + int selected; + int number; public: - - CPluginList(const neutrino_locale_t Name, const uint32_t listtype); - virtual ~CPluginList(); - - void hide(); + CPluginList(const neutrino_locale_t Title, const uint32_t listtype); int exec(CMenuTarget* parent, const std::string & actionKey); + virtual int run (); }; class CPluginChooser : public CPluginList { private: - char* selected_plugin; - protected: - - CPluginList::result_ pluginSelected(); - + std::string *selectedFilePtr; public: - CPluginChooser(const neutrino_locale_t Name, const uint32_t listtype, char* pluginname); + CPluginChooser(const neutrino_locale_t Name, const uint32_t listtype, std::string &selectedFile); + int run (); }; #endif diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index 827cb877b..3aafcd90b 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -65,6 +65,7 @@ #include #include +#include #include #include @@ -1223,12 +1224,12 @@ int CTimerList::newTimer() CStringInputSMS timerSettings_msg(LOCALE_TIMERLIST_MESSAGE, &timerNew_message, 30, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789-.,:!?/ "); CMenuForwarder *m9 = new CMenuForwarder(LOCALE_TIMERLIST_MESSAGE, false, timerNew_message, &timerSettings_msg ); - strcpy(timerNew.pluginName,"---"); + std::string timerNew_pluginName("---"); CPluginChooser plugin_chooser(LOCALE_TIMERLIST_PLUGIN, CPlugins::P_TYPE_SCRIPT | CPlugins::P_TYPE_TOOL #if ENABLE_LUA | CPlugins::P_TYPE_LUA #endif - , timerNew.pluginName); + , timerNew_pluginName); CMenuForwarder *m10 = new CMenuForwarder(LOCALE_TIMERLIST_PLUGIN, false, timerNew.pluginName, &plugin_chooser); @@ -1258,7 +1259,8 @@ int CTimerList::newTimer() notifier2.changeNotify(NONEXISTANT_LOCALE, NULL); int ret=timerSettings.exec(this,""); - strncpy(timerNew.message, timerNew_message.c_str(), sizeof(timerNew.message)); + cstrncpy(timerNew.pluginName, timerNew_pluginName, sizeof(timerNew.pluginName)); + cstrncpy(timerNew.message, timerNew_message, sizeof(timerNew.message)); // delete dynamic created objects for (unsigned int count=0; count Date: Mon, 16 Dec 2013 17:16:24 +0100 Subject: [PATCH 046/225] CComponentsFrmClock: change wording of comment, was unsuituable --- src/gui/components/cc_frm_clock.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/components/cc_frm_clock.h b/src/gui/components/cc_frm_clock.h index 81e0e7a59..c0a21bdbe 100644 --- a/src/gui/components/cc_frm_clock.h +++ b/src/gui/components/cc_frm_clock.h @@ -57,7 +57,7 @@ class CComponentsFrmClock : public CComponentsForm ///raw time chars char cl_timestr[20]; - ///allow to paint clock within thread and is not similar to cc_allow_paint + ///handle paint clock within thread and is not similar to cc_allow_paint bool paintClock; //TODO: please add comments! bool activeClock; From 2b65f1d1b36badbb9efc00c3757e7043ffc83531 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 16 Dec 2013 17:19:18 +0100 Subject: [PATCH 047/225] CComponentsFrmClock: remove statement stopThread() is doing check against NULL itself --- src/gui/components/cc_frm_clock.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gui/components/cc_frm_clock.cpp b/src/gui/components/cc_frm_clock.cpp index e329ed275..b40e34601 100644 --- a/src/gui/components/cc_frm_clock.cpp +++ b/src/gui/components/cc_frm_clock.cpp @@ -86,8 +86,7 @@ void CComponentsFrmClock::initVarClock( const int& x_pos, const int& y_pos, cons CComponentsFrmClock::~CComponentsFrmClock() { - if (activeClock) - stopThread(); + stopThread(); } void CComponentsFrmClock::initTimeString() From f813b9ea98a1795b6debfd41218612778381a02c Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 23 Feb 2014 16:25:16 +0100 Subject: [PATCH 048/225] CComponents: add member CheckFbData() for fbdata check This check happens several times, therefore it is senseful, to move into own member. Function returns false on error and is used here to show an error message if something was wrong. Such errors can happen on position or dimension errors e.g. out of screen or too large display values. Note: this is only an emergency helper for debugging on fatal errors during developing of window stuff. Mostly errors of this kind causing crashes and must be fixed. --- src/gui/components/cc_base.cpp | 53 ++++++++++++++++++++-------------- src/gui/components/cc_base.h | 3 ++ 2 files changed, 35 insertions(+), 21 deletions(-) diff --git a/src/gui/components/cc_base.cpp b/src/gui/components/cc_base.cpp index c9c49528a..223253ecc 100644 --- a/src/gui/components/cc_base.cpp +++ b/src/gui/components/cc_base.cpp @@ -31,7 +31,7 @@ #include #include #include "cc_base.h" - +#include using namespace std; //abstract basic class CComponents @@ -83,15 +83,30 @@ void CComponents::initVarBasic() saved_screen.pixbuf = NULL; } +bool CComponents::CheckFbData(const comp_fbdata_t& fbdata) +{ + if ( (fbdata.x <= 0 || fbdata.y <= 0) || + (fbdata.dx == 0 || fbdata.dy == 0) || + (fbdata.dx > (int32_t)frameBuffer->getScreenWidth(true) || fbdata.dy > (int32_t)frameBuffer->getScreenHeight(true))){ + printf("\33[31m\t[CComponents] WARNING! Position <= 0 [%s - %d]\n\tx = %d y = %d\n\tdx = %d dy = %d\n\033[37m", + __func__, __LINE__, + fbdata.x, fbdata.y, + fbdata.dx, fbdata.dy); + return false; + } + return true; +} + //paint framebuffer stuff and fill buffer void CComponents::paintFbItems(bool do_save_bg) { //save background before first paint, do_save_bg must be true - if (firstPaint && do_save_bg) { + if (firstPaint && do_save_bg){ for(size_t i=0; isave screen: %d, fbdata_type: %d\n\tx = %d\n\ty = %d\n\tdx = %d\n\tdy = %d\n", __func__, @@ -103,27 +118,23 @@ void CComponents::paintFbItems(bool do_save_bg) v_fbdata[i].dx, v_fbdata[i].dy); #endif - saved_screen.x = v_fbdata[i].x; - saved_screen.y = v_fbdata[i].y; - saved_screen.dx = v_fbdata[i].dx; - saved_screen.dy = v_fbdata[i].dy; - clearSavedScreen(); - saved_screen.pixbuf = getScreen(saved_screen.x, saved_screen.y, saved_screen.dx, saved_screen.dy); - firstPaint = false; - break; - } + saved_screen.x = v_fbdata[i].x; + saved_screen.y = v_fbdata[i].y; + saved_screen.dx = v_fbdata[i].dx; + saved_screen.dy = v_fbdata[i].dy; + clearSavedScreen(); + saved_screen.pixbuf = getScreen(saved_screen.x, saved_screen.y, saved_screen.dx, saved_screen.dy); + firstPaint = false; + break; } } - for(size_t i=0; i< v_fbdata.size() ;i++){ - // Don't paint if dx or dy are 0 - if ((v_fbdata[i].dx == 0) || (v_fbdata[i].dy == 0)){ -#ifdef DEBUG_CC - printf("\t[CComponents] WARNING: [%s - %d], dx = %d dy = %d\n", __func__, __LINE__, v_fbdata[i].dx, v_fbdata[i].dy); -#endif + for(size_t i=0; i< v_fbdata.size(); i++){ + // Don't paint on dimension or position error dx or dy are 0 + if (!CheckFbData(v_fbdata[i])){ + DisplayErrorMessage("Display error, please show log and report!"); continue; } - int fbtype = v_fbdata[i].fbdata_type; #ifdef DEBUG_CC printf("\t[CComponents]\n\t[%s - %d], fbdata_[%d]\n\tx = %d\n\ty = %d\n\tdx = %d\n\tdy = %d\n", diff --git a/src/gui/components/cc_base.h b/src/gui/components/cc_base.h index a726361a8..6ae2c533c 100644 --- a/src/gui/components/cc_base.h +++ b/src/gui/components/cc_base.h @@ -104,6 +104,9 @@ class CComponents ///parameter do_save_bg=true, saves background of element to pixel buffer, this can be restore with hide() void paintFbItems(bool do_save_bg = true); + ///check current fbdtata position and dimensions, parameter fbdata is an element of v_fbdata, returns false on error + bool CheckFbData(const comp_fbdata_t& fbdata); + ///clean up old screen buffer saved in v_fbdata virtual void clearFbData(); From f2bfa22159f997a50b7994900d0f028ba24e7f51 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 23 Feb 2014 16:26:26 +0100 Subject: [PATCH 049/225] configure: add libbluray support into configure It may happen that the build process aborts if this lib is not expilzit specified, although this lib is not used directly by neutrino. It seems to be dependent of build environment, and should be understand as a prevention. --- configure.ac | 2 ++ src/Makefile.am | 1 + 2 files changed, 3 insertions(+) diff --git a/configure.ac b/configure.ac index 6c6401ac4..53674002b 100644 --- a/configure.ac +++ b/configure.ac @@ -94,6 +94,7 @@ TUXBOX_APPS_LIB_PKGCONFIG(PNG,libpng) TUXBOX_APPS_LIB_PKGCONFIG(AVFORMAT,libavformat) TUXBOX_APPS_LIB_PKGCONFIG(AVCODEC,libavcodec) TUXBOX_APPS_LIB_PKGCONFIG(AVUTIL,libavutil) +TUXBOX_APPS_LIB_PKGCONFIG(BLURAY,libbluray) #TUXBOX_APPS_LIB_PKGCONFIG(CONFIGFILE,tuxbox-configfile) #TUXBOX_APPS_LIB_PKGCONFIG(CONNECTION,tuxbox-connection) @@ -224,6 +225,7 @@ AC_SUBST(VORBISIDEC_CFLAGS) AC_SUBST(VORBISIDEC_LIBS) AC_SUBST(LUA_CFLAGS) AC_SUBST(LUA_LIBS) +AC_SUBST(BLURAY_LIBS) AC_OUTPUT([ Makefile diff --git a/src/Makefile.am b/src/Makefile.am index 413f93280..ca20b69f1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -107,6 +107,7 @@ neutrino_LDADD = \ @CURL_LIBS@ \ @FREETYPE_LIBS@ \ @PNG_LIBS@ \ + @BLURAY_LIBS@ \ @LIBCS_LIBS@ \ @AVFORMAT_LIBS@ \ @AVUTIL_LIBS@ \ From c34f25bb7d3677f7be698168ba5b3cbba514ae5a Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 26 Feb 2014 15:44:03 +0100 Subject: [PATCH 050/225] CComponentsInfoBox, CComponentsPicture: add overloaded members setPicture() --- src/gui/components/cc_item_infobox.cpp | 13 +++++++++++++ src/gui/components/cc_item_infobox.h | 6 ++++-- src/gui/components/cc_item_picture.cpp | 15 +++++++++++++++ src/gui/components/cc_item_picture.h | 2 ++ 4 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/gui/components/cc_item_infobox.cpp b/src/gui/components/cc_item_infobox.cpp index 77ff00bd5..1a9490aab 100644 --- a/src/gui/components/cc_item_infobox.cpp +++ b/src/gui/components/cc_item_infobox.cpp @@ -81,6 +81,19 @@ void CComponentsInfoBox::initVarInfobox() x_offset = 10; } +void CComponentsInfoBox::setPicture(const std::string& picture_name) +{ + pic_name = picture_name; +} + +void CComponentsInfoBox::setPicture(const char* picture_name) +{ + string s_tmp = ""; + if (picture_name) + s_tmp = string(picture_name); + setPicture(s_tmp); +} + void CComponentsInfoBox::paintPicture() { //ensure empty pic object diff --git a/src/gui/components/cc_item_infobox.h b/src/gui/components/cc_item_infobox.h index afcfffd5b..362ab03a8 100644 --- a/src/gui/components/cc_item_infobox.h +++ b/src/gui/components/cc_item_infobox.h @@ -73,8 +73,10 @@ class CComponentsInfoBox : public CComponentsText ///set property: space around fram and beetween picture and textbox inline void setSpaceOffset(const int offset){x_offset = offset;}; - ///set property: path or name of displayed image - inline void setPicture(const std::string& picture_name){pic_name = picture_name;}; + ///set property: path or name of displayed image, parameter as string + void setPicture(const std::string& picture_name); + ///set property: path or name of displayed image, parameter as const char* + void setPicture(const char* picture_name); ///paint item void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); diff --git a/src/gui/components/cc_item_picture.cpp b/src/gui/components/cc_item_picture.cpp index bc8f67472..f7ea5f2b8 100644 --- a/src/gui/components/cc_item_picture.cpp +++ b/src/gui/components/cc_item_picture.cpp @@ -87,6 +87,13 @@ void CComponentsPicture::setPicture(const std::string& picture_name) initCCItem(); } +void CComponentsPicture::setPicture(const char* picture_name) +{ + string s_tmp = ""; + if (picture_name) + s_tmp = string(picture_name); + setPicture(s_tmp); +} void CComponentsPicture::setPictureAlign(const int alignment) { @@ -230,6 +237,14 @@ void CComponentsChannelLogo::setPicture(const std::string& picture_name) initVarPictureChannellLogo(); } +void CComponentsChannelLogo::setPicture(const char* picture_name) +{ + string s_tmp = ""; + if (picture_name) + s_tmp = string(picture_name); + this->setPicture(s_tmp); +} + void CComponentsChannelLogo::setChannel(const uint64_t& channelId, const std::string& channelName) { channel_id = channelId; diff --git a/src/gui/components/cc_item_picture.h b/src/gui/components/cc_item_picture.h index 0b2710be9..56b90859e 100644 --- a/src/gui/components/cc_item_picture.h +++ b/src/gui/components/cc_item_picture.h @@ -87,6 +87,7 @@ class CComponentsPicture : public CComponentsItem virtual inline void setPicturePaint(bool paint_p){pic_paint = paint_p;}; virtual inline void setPicturePaintBackground(bool paintBg){pic_paintBg = paintBg;}; virtual void setPicture(const std::string& picture_name); + virtual void setPicture(const char* picture_name); virtual void setPictureAlign(const int alignment); virtual inline bool isPicPainted(){return pic_painted;}; @@ -120,6 +121,7 @@ class CComponentsChannelLogo : public CComponentsPicture, CPictureViewer void setChannel(const uint64_t& channelId, const std::string& channelName); void setPicture(const std::string& picture_name); + void setPicture(const char* picture_name); bool hasLogo(){return has_logo;}; void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); }; From 8a39f01a79900aed1227517bbd44d18e0c979ede Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 26 Feb 2014 17:57:12 +0100 Subject: [PATCH 051/225] CMenuItem: remove redundant member for background paint It seems this method came with more functionality in past, but it's currently not required in that Form. --- src/gui/widget/menue.cpp | 12 +----------- src/gui/widget/menue.h | 2 -- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index debbbaed7..c68ceae61 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -138,16 +138,6 @@ void CMenuItem::initItemColors(const bool select_mode) } } -void CMenuItem::paintItemBackground (const bool select_mode, const int &item_height) -{ - CFrameBuffer *frameBuffer = CFrameBuffer::getInstance(); - //FIXME what select_mode change here ?? - if(select_mode) - frameBuffer->paintBoxRel(x, y, dx, item_height, item_bgcolor, RADIUS_LARGE); - else - frameBuffer->paintBoxRel(x, y, dx, item_height, item_bgcolor, RADIUS_LARGE); -} - void CMenuItem::paintItemCaption(const bool select_mode, const int &item_height, const char * left_text, const char * right_text, const fb_pixel_t right_bgcol) { if (select_mode) @@ -209,7 +199,7 @@ void CMenuItem::prepareItem(const bool select_mode, const int &item_height) initItemColors(select_mode); //paint item background - paintItemBackground(select_mode, item_height); + CFrameBuffer::getInstance()->paintBoxRel(x, y, dx, item_height, item_bgcolor, RADIUS_LARGE); } void CMenuItem::paintItemSlider( const bool select_mode, const int &item_height, const int &optionvalue, const int &factor, const char * left_text, const char * right_text) diff --git a/src/gui/widget/menue.h b/src/gui/widget/menue.h index aa286d8da..4208490f1 100644 --- a/src/gui/widget/menue.h +++ b/src/gui/widget/menue.h @@ -162,8 +162,6 @@ class CMenuItem virtual void paintItemButton(const bool select_mode, const int &item_height, const std::string& icon_Name = NEUTRINO_ICON_BUTTON_RIGHT); - virtual void paintItemBackground (const bool select_mode, const int &item_height); - virtual void prepareItem(const bool select_mode, const int &item_height); virtual void setItemButton(const std::string& icon_Name, const bool is_select_button = false); From 38dffb8456995cf38381e96d472570fe56eae00d Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 26 Feb 2014 22:34:14 +0100 Subject: [PATCH 052/225] CComponentsItem: add members to set item position via percent value --- src/gui/components/cc_base.cpp | 14 ++++++++++++-- src/gui/components/cc_base.h | 18 +++++++++++++----- src/gui/components/cc_item.cpp | 21 ++++++++++++++++++++- 3 files changed, 45 insertions(+), 8 deletions(-) diff --git a/src/gui/components/cc_base.cpp b/src/gui/components/cc_base.cpp index 223253ecc..2e8a06b82 100644 --- a/src/gui/components/cc_base.cpp +++ b/src/gui/components/cc_base.cpp @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012-2014, Thilo Graf 'dbt' Copyright (C) 2012, Michael Liebmann 'micha-bbg' License: GPL @@ -235,10 +235,20 @@ void CComponents::kill() } //clean old screen buffer -inline void CComponents::clearFbData() +void CComponents::clearFbData() { for(size_t i =0; i< v_fbdata.size() ;i++) if (v_fbdata[i].pixbuf) delete[] v_fbdata[i].pixbuf; v_fbdata.clear(); } + +inline void CComponents::setXPos(const int& xpos) +{ + x = xpos; +} + +inline void CComponents::setYPos(const int& ypos) +{ + y = ypos; +} diff --git a/src/gui/components/cc_base.h b/src/gui/components/cc_base.h index 6ae2c533c..175b30580 100644 --- a/src/gui/components/cc_base.h +++ b/src/gui/components/cc_base.h @@ -120,11 +120,11 @@ class CComponents CComponents(); virtual~CComponents(); - ///set screen x-position - inline virtual void setXPos(const int& xpos){x = xpos;}; - ///set screen y-position, - inline virtual void setYPos(const int& ypos){y = ypos;}; - ///set x and y position + ///set screen x-position, parameter as int + virtual void setXPos(const int& xpos); + ///set screen y-position, parameter as int + virtual void setYPos(const int& ypos); + ///set x and y position at once ///Note: position of bound components (items) means position related within parent form, not for screen! ///to set the real screen position, look at setRealPos() inline virtual void setPos(const int& xpos, const int& ypos){x = xpos; y = ypos;}; @@ -286,6 +286,14 @@ class CComponentsItem : public CComponents ///set an index to item, see also attribut cc_item_index. ///To generate an index, use genIndex() virtual void setIndex(const int& index){cc_item_index = index;}; + + ///set screen x-position, parameter as uint8_t, percent value of screen x + virtual void setXPosP(const uint8_t& xpos_percent); + ///set screen y-position, parameter as uint8_t, percent value of screen y + virtual void setYPosP(const uint8_t& ypos_percent); + ///set x and y position as percent value from current parent or screen dimensions at once + ///Note: position of bound components (items) means position related within parent form, not for screen! + virtual void setPosP(const uint8_t& xpos_percent, const uint8_t& ypos_percent); }; #endif diff --git a/src/gui/components/cc_item.cpp b/src/gui/components/cc_item.cpp index 08902596b..e9cc06486 100644 --- a/src/gui/components/cc_item.cpp +++ b/src/gui/components/cc_item.cpp @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012-2014, Thilo Graf 'dbt' Copyright (C) 2012, Michael Liebmann 'micha-bbg' License: GPL @@ -31,6 +31,7 @@ #include #include #include "cc_base.h" +#include using namespace std; @@ -163,3 +164,21 @@ bool CComponentsItem::isAdded() return false; } + +void CComponentsItem::setXPosP(const uint8_t& xpos_percent) +{ + int x_tmp = cc_parent ? xpos_percent*cc_parent->getWidth() : xpos_percent*frameBuffer->getScreenWidth(); + x = x_tmp/100; +} + +void CComponentsItem::setYPosP(const uint8_t& ypos_percent) +{ + int y_tmp = cc_parent ? ypos_percent*cc_parent->getHeight() : ypos_percent*frameBuffer->getScreenHeight(); + x = y_tmp/100; +} + +void CComponentsItem::setPosP(const uint8_t& xpos_percent, const uint8_t& ypos_percent) +{ + setXPosP(xpos_percent); + setYPosP(ypos_percent); +} From 8a897103acb679d0aaf67d51f3567a6fa4b6014f Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 27 Feb 2014 19:43:30 +0100 Subject: [PATCH 053/225] CComponentsItem: move/rename doCenter()to base class CComponentsItem So it's possible to use this method for all cc-items. setCenterPos() comes now with parameter 'along_mode' (CC_ALONG_X, CC_ALONG_Y). So it's possible to center in x or y direction. As default are both directions predefined. --- src/gui/buildinfo.cpp | 4 ++-- src/gui/components/cc_base.h | 5 ++++- src/gui/components/cc_frm_window.cpp | 6 ------ src/gui/components/cc_frm_window.h | 2 -- src/gui/components/cc_item.cpp | 8 ++++++++ src/gui/components/cc_types.h | 9 ++++++++- 6 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/gui/buildinfo.cpp b/src/gui/buildinfo.cpp index 45b87a2c6..5bbadcbe5 100644 --- a/src/gui/buildinfo.cpp +++ b/src/gui/buildinfo.cpp @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Copyright (C) 2013, M. Liebmann 'micha-bbg' - Copyright (C) 2013, Thilo Graf 'dbt' + Copyright (C) 2013-2014, Thilo Graf 'dbt' License: GPL @@ -43,7 +43,7 @@ CBuildInfo::CBuildInfo() : CComponentsWindow(0, 0, 700, 500, LOCALE_BUILDINFO_ME //init all var members void CBuildInfo::initVarBuildInfo() { - doCenter(); + setCenterPos(); font = NULL; setWindowHeaderButtons(CComponentsHeader::CC_BTN_MENU | CComponentsHeader::CC_BTN_EXIT); diff --git a/src/gui/components/cc_base.h b/src/gui/components/cc_base.h index 175b30580..f9ecf678b 100644 --- a/src/gui/components/cc_base.h +++ b/src/gui/components/cc_base.h @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012-2014, Thilo Graf 'dbt' License: GPL @@ -294,6 +294,9 @@ class CComponentsItem : public CComponents ///set x and y position as percent value from current parent or screen dimensions at once ///Note: position of bound components (items) means position related within parent form, not for screen! virtual void setPosP(const uint8_t& xpos_percent, const uint8_t& ypos_percent); + + ///do center item on screen or within a parent form, parameter along_mode assigns direction of centering + virtual void setCenterPos(int along_mode = CC_ALONG_X | CC_ALONG_Y); }; #endif diff --git a/src/gui/components/cc_frm_window.cpp b/src/gui/components/cc_frm_window.cpp index f5021d580..629b3386a 100644 --- a/src/gui/components/cc_frm_window.cpp +++ b/src/gui/components/cc_frm_window.cpp @@ -29,7 +29,6 @@ #include #include #include "cc_frm_window.h" -#include using namespace std; @@ -146,11 +145,6 @@ void CComponentsWindow::initWindowPos() y = frameBuffer->getScreenY(); } -void CComponentsWindow::doCenter(){ - x = cc_parent ? cc_parent->getWidth() - width/2 : getScreenStartX(width); - y = cc_parent ? cc_parent->getHeight() - height/2 : getScreenStartY(height); -} - void CComponentsWindow::setWindowCaption(neutrino_locale_t locale_text, const int& align_mode) { ccw_caption = g_Locale->getText(locale_text); diff --git a/src/gui/components/cc_frm_window.h b/src/gui/components/cc_frm_window.h index d658bd090..de4761f0d 100644 --- a/src/gui/components/cc_frm_window.h +++ b/src/gui/components/cc_frm_window.h @@ -90,8 +90,6 @@ class CComponentsWindow : public CComponentsForm fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); - ///allow centering of window on screen, mostly senseful for window object without parent - void doCenter(); ///initialize width and height void initWindowSize(); ///initialize position diff --git a/src/gui/components/cc_item.cpp b/src/gui/components/cc_item.cpp index e9cc06486..fc74d73b0 100644 --- a/src/gui/components/cc_item.cpp +++ b/src/gui/components/cc_item.cpp @@ -182,3 +182,11 @@ void CComponentsItem::setPosP(const uint8_t& xpos_percent, const uint8_t& ypos_p setXPosP(xpos_percent); setYPosP(ypos_percent); } + +void CComponentsItem::setCenterPos(int along_mode) +{ + if (along_mode & CC_ALONG_X) + x = cc_parent ? cc_parent->getWidth() - width/2 : getScreenStartX(width); + if (along_mode & CC_ALONG_Y) + y = cc_parent ? cc_parent->getHeight() - height/2 : getScreenStartY(height); +} diff --git a/src/gui/components/cc_types.h b/src/gui/components/cc_types.h index 401c3c44d..2d790e669 100644 --- a/src/gui/components/cc_types.h +++ b/src/gui/components/cc_types.h @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012-2014, Thilo Graf 'dbt' License: GPL @@ -110,6 +110,13 @@ enum CC_ALIGN_VER_CENTER = 32 }; +//item centering modes, see also CComponentsItem::setCenterPos() +enum +{ + CC_ALONG_X = 1, + CC_ALONG_Y = 2 +}; + enum { CC_ITEMBOX_ICON, From 9b18d0cf5b153902d29eaf71d0080ab365e93235 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 27 Feb 2014 19:49:33 +0100 Subject: [PATCH 054/225] CComponentsItem: comments corrected --- src/gui/components/cc_base.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/gui/components/cc_base.h b/src/gui/components/cc_base.h index f9ecf678b..5f71048b3 100644 --- a/src/gui/components/cc_base.h +++ b/src/gui/components/cc_base.h @@ -287,12 +287,11 @@ class CComponentsItem : public CComponents ///To generate an index, use genIndex() virtual void setIndex(const int& index){cc_item_index = index;}; - ///set screen x-position, parameter as uint8_t, percent value of screen x + ///set screen x-position, parameter as uint8_t, percent x value related to current width of parent form or screen virtual void setXPosP(const uint8_t& xpos_percent); - ///set screen y-position, parameter as uint8_t, percent value of screen y + ///set screen y-position, parameter as uint8_t, percent y value related to current height of parent form or screen virtual void setYPosP(const uint8_t& ypos_percent); - ///set x and y position as percent value from current parent or screen dimensions at once - ///Note: position of bound components (items) means position related within parent form, not for screen! + ///set x and y position as percent value related to current parent form or screen dimensions at once virtual void setPosP(const uint8_t& xpos_percent, const uint8_t& ypos_percent); ///do center item on screen or within a parent form, parameter along_mode assigns direction of centering From a33cad448a20791839c240ad1aa1a325019476c3 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 27 Feb 2014 20:37:08 +0100 Subject: [PATCH 055/225] CComponentsItem: add methodes to set width and height via percent value Percent value is related to current screen or parent size --- src/gui/components/cc_base.h | 5 +++++ src/gui/components/cc_item.cpp | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/gui/components/cc_base.h b/src/gui/components/cc_base.h index 5f71048b3..5bb3741ca 100644 --- a/src/gui/components/cc_base.h +++ b/src/gui/components/cc_base.h @@ -296,6 +296,11 @@ class CComponentsItem : public CComponents ///do center item on screen or within a parent form, parameter along_mode assigns direction of centering virtual void setCenterPos(int along_mode = CC_ALONG_X | CC_ALONG_Y); + + ///set item height, parameter as uint8_t, as percent value related to current height of parent form or screen + virtual void setHeightP(const uint8_t& h_percent); + ///set item width, parameter as uint8_t, as percent value related to current width of parent form or screen + virtual void setWidthP(const uint8_t& w_percent); }; #endif diff --git a/src/gui/components/cc_item.cpp b/src/gui/components/cc_item.cpp index fc74d73b0..400560666 100644 --- a/src/gui/components/cc_item.cpp +++ b/src/gui/components/cc_item.cpp @@ -190,3 +190,13 @@ void CComponentsItem::setCenterPos(int along_mode) if (along_mode & CC_ALONG_Y) y = cc_parent ? cc_parent->getHeight() - height/2 : getScreenStartY(height); } + +void CComponentsItem::setHeightP(const uint8_t& h_percent) +{ + height = cc_parent ? h_percent*cc_parent->getWidth()/100 : h_percent*frameBuffer->getScreenWidth()/100; +} + +void CComponentsItem::setWidthP(const uint8_t& w_percent) +{ + width = cc_parent ? w_percent*cc_parent->getHeight()/100 : w_percent*frameBuffer->getScreenHeight()/100; +} From 2fade10a110c11cb644df030f157613e76d7e61a Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 27 Feb 2014 20:48:24 +0100 Subject: [PATCH 056/225] CComponentsPicture: add comment to isPicPainted() Not to confuse with isPainted(). Because isPicPainted() is related to internal image. --- src/gui/components/cc_item_picture.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/components/cc_item_picture.h b/src/gui/components/cc_item_picture.h index 56b90859e..06c9bec27 100644 --- a/src/gui/components/cc_item_picture.h +++ b/src/gui/components/cc_item_picture.h @@ -90,7 +90,9 @@ class CComponentsPicture : public CComponentsItem virtual void setPicture(const char* picture_name); virtual void setPictureAlign(const int alignment); + ///return paint mode of internal image, true=image was painted, please do not to confuse with isPainted()! isPainted() is related to item itself. virtual inline bool isPicPainted(){return pic_painted;}; + virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); virtual void hide(bool no_restore = false); virtual inline void getPictureSize(int *pwidth, int *pheight){*pwidth=pic_width; *pheight=pic_height;}; From 4a76ca953e1c26f80588a303f04f56b52c1be2fd Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 27 Feb 2014 21:26:49 +0100 Subject: [PATCH 057/225] cc_types.h: add forward declaration for CComponentsForm() required for parameter in CComponentsItem constructors --- src/gui/components/cc_types.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/components/cc_types.h b/src/gui/components/cc_types.h index 2d790e669..520fa5f79 100644 --- a/src/gui/components/cc_types.h +++ b/src/gui/components/cc_types.h @@ -32,6 +32,8 @@ // #define DEBUG_CC +class CComponentsForm; + ///cc item types typedef enum { From 23d7b62cf04845305af22fb54716c16c05063941 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 3 Mar 2014 09:43:39 +0100 Subject: [PATCH 058/225] CComponents: add new parameter 'parent' Use strictly CComponentsForm as parent parameter in constructors. Some parts have been cleaned up (Constructors, init methodes removed) New parameter makes it possible already add current item in constructor. So in mostly situations is it not necessary to use explicit addCCItem(), but addCCItem()is still valid and necessary in certain situations. Affected are all cc-classes and their derivates. Some classes must or can be adapted later. The function is not currently restricted, because usage of parent parameter is not explicit defined in constructors, see CImageInfo, here yet are used addCCItem() methodes. Generally this parameter is located in the constructors before bool has_shadow, but it is not sure whether it would be better to use this parameter as the first. That remains to be clarified. --- src/gui/buildinfo.cpp | 3 +- src/gui/components/cc_base.cpp | 35 ++++---- src/gui/components/cc_base.h | 20 ++--- src/gui/components/cc_frm.cpp | 56 +++++------- src/gui/components/cc_frm.h | 12 +-- src/gui/components/cc_frm_button.cpp | 70 ++++++++------- src/gui/components/cc_frm_button.h | 99 +++++++++++++++------- src/gui/components/cc_frm_clock.cpp | 15 ++-- src/gui/components/cc_frm_clock.h | 10 +-- src/gui/components/cc_frm_ext_text.cpp | 9 +- src/gui/components/cc_frm_ext_text.h | 7 +- src/gui/components/cc_frm_footer.cpp | 11 ++- src/gui/components/cc_frm_footer.h | 4 +- src/gui/components/cc_frm_header.cpp | 11 ++- src/gui/components/cc_frm_header.h | 5 +- src/gui/components/cc_frm_icons.cpp | 9 +- src/gui/components/cc_frm_icons.h | 4 +- src/gui/components/cc_frm_signalbars.cpp | 11 ++- src/gui/components/cc_frm_signalbars.h | 15 ++-- src/gui/components/cc_frm_slider.cpp | 20 ++--- src/gui/components/cc_frm_slider.h | 17 +--- src/gui/components/cc_frm_window.cpp | 20 +++-- src/gui/components/cc_frm_window.h | 7 +- src/gui/components/cc_item.cpp | 22 ++--- src/gui/components/cc_item_infobox.cpp | 40 ++++----- src/gui/components/cc_item_infobox.h | 12 +-- src/gui/components/cc_item_picture.cpp | 25 ++++-- src/gui/components/cc_item_picture.h | 5 +- src/gui/components/cc_item_progressbar.cpp | 33 ++------ src/gui/components/cc_item_progressbar.h | 11 +-- src/gui/components/cc_item_shapes.cpp | 15 +++- src/gui/components/cc_item_shapes.h | 10 ++- src/gui/components/cc_item_text.cpp | 16 ++-- src/gui/components/cc_item_text.h | 17 ++-- src/gui/components/cc_item_tvpic.cpp | 14 +-- src/gui/components/cc_item_tvpic.h | 7 +- src/gui/imageinfo.cpp | 5 +- src/gui/infoclock.cpp | 2 +- src/gui/luainstance.cpp | 12 +-- src/gui/test_menu.cpp | 8 +- src/gui/timeosd.cpp | 2 +- src/gui/widget/menue.cpp | 2 +- 42 files changed, 382 insertions(+), 346 deletions(-) diff --git a/src/gui/buildinfo.cpp b/src/gui/buildinfo.cpp index 5bbadcbe5..3cc1ed0b9 100644 --- a/src/gui/buildinfo.cpp +++ b/src/gui/buildinfo.cpp @@ -174,11 +174,10 @@ void CBuildInfo::InitInfoItems() //init info texts for(size_t i=0; igetText(v_info[i].caption), v_info[i].info_text); + CComponentsExtTextForm *info = new CComponentsExtTextForm(10, CC_APPEND, w_info, h_info, g_Locale->getText(v_info[i].caption), v_info[i].info_text, ccw_body); info->setLabelAndTextFont(font); info->setTextModes(CTextBox::TOP , CTextBox::AUTO_HIGH | CTextBox::TOP | CTextBox::AUTO_LINEBREAK_NO_BREAKCHARS); info->doPaintBg(false); - ccw_body->addCCItem(info); } } diff --git a/src/gui/components/cc_base.cpp b/src/gui/components/cc_base.cpp index 2e8a06b82..f140cf0ad 100644 --- a/src/gui/components/cc_base.cpp +++ b/src/gui/components/cc_base.cpp @@ -36,25 +36,6 @@ using namespace std; //abstract basic class CComponents CComponents::CComponents() -{ - initVarBasic(); -} - -CComponents::~CComponents() -{ - hide(); - clearSavedScreen(); - clearFbData(); -} - -void CComponents::clearSavedScreen() -{ - if (saved_screen.pixbuf) - delete[] saved_screen.pixbuf; - saved_screen.pixbuf = NULL; -} - -void CComponents::initVarBasic() { x = saved_screen.x = 0; y = saved_screen.y = 0; @@ -73,7 +54,7 @@ void CComponents::initVarBasic() shadow_w = SHADOW_OFFSET; fr_thickness = 0; fr_thickness_sel = 3; - + firstPaint = true; is_painted = false; paint_bg = true; @@ -83,6 +64,20 @@ void CComponents::initVarBasic() saved_screen.pixbuf = NULL; } +CComponents::~CComponents() +{ + hide(); + clearSavedScreen(); + clearFbData(); +} + +void CComponents::clearSavedScreen() +{ + if (saved_screen.pixbuf) + delete[] saved_screen.pixbuf; + saved_screen.pixbuf = NULL; +} + bool CComponents::CheckFbData(const comp_fbdata_t& fbdata) { if ( (fbdata.x <= 0 || fbdata.y <= 0) || diff --git a/src/gui/components/cc_base.h b/src/gui/components/cc_base.h index 5bb3741ca..4abd9cb1b 100644 --- a/src/gui/components/cc_base.h +++ b/src/gui/components/cc_base.h @@ -33,8 +33,6 @@ #include #include - - /// Basic component class. /*! Basic attributes and member functions for component sub classes @@ -45,9 +43,7 @@ class CComponents private: ///pixel buffer handling, returns pixel buffer depends of given parameters fb_pixel_t* getScreen(int ax, int ay, int dx, int dy); - ///initialize of basic attributes, no parameters required - void initVarBasic(); - + protected: ///object: framebuffer object, usable in all sub classes CFrameBuffer * frameBuffer; @@ -221,9 +217,6 @@ class CComponents class CComponentsItem : public CComponents { - private: - ///initialize all required attributes - void initVarItem(); protected: ///property: define of item type, see cc_types.h for possible types int cc_item_type; @@ -238,7 +231,7 @@ class CComponentsItem : public CComponents ///Pointer to the form object in which this item is embedded. ///Is typically the type CComponentsForm or derived classes, default intialized with NULL - CComponentsItem *cc_parent; + CComponentsForm *cc_parent; ///hides item, arg: no_restore=true causes no restore of background, but clean up pixel buffer if required void hideCCItem(bool no_restore = false); @@ -250,14 +243,17 @@ class CComponentsItem : public CComponents ///an item will be hide or overpainted with other methods, or it's embedded (bound) in a parent form. void paintInit(bool do_save_bg); + ///add "this" current item to parent + void initParent(CComponentsForm* parent); + public: - CComponentsItem(); + CComponentsItem(CComponentsForm *parent = NULL); ///sets pointer to the form object in which this item is embedded. - virtual void setParent(CComponentsItem *parent){cc_parent = parent;}; + virtual void setParent(CComponentsForm *parent){cc_parent = parent;}; ///returns pointer to the form object in which this item is embedded. - virtual CComponentsItem * getParent(){return cc_parent;}; + virtual CComponentsForm* getParent(){return cc_parent;}; ///property: returns true if item is added to a form virtual bool isAdded(); diff --git a/src/gui/components/cc_frm.cpp b/src/gui/components/cc_frm.cpp index 37bda8853..25ed839a4 100644 --- a/src/gui/components/cc_frm.cpp +++ b/src/gui/components/cc_frm.cpp @@ -36,19 +36,16 @@ using namespace std; //------------------------------------------------------------------------------------------------------- //sub class CComponentsForm from CComponentsItem -CComponentsForm::CComponentsForm() +CComponentsForm::CComponentsForm( const int x_pos, const int y_pos, const int w, const int h, + CComponentsForm* parent, + bool has_shadow, + fb_pixel_t color_frame, + fb_pixel_t color_body, + fb_pixel_t color_shadow) + :CComponentsItem(parent) { - //CComponentsForm - initVarForm(); -} + cc_item_type = CC_ITEMTYPE_FRM; -CComponentsForm::CComponentsForm(const int x_pos, const int y_pos, const int w, const int h, bool has_shadow, - fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) -{ - //CComponentsForm - initVarForm(); - - //CComponents x = x_pos; y = y_pos; cc_xr = x; @@ -60,6 +57,16 @@ CComponentsForm::CComponentsForm(const int x_pos, const int y_pos, const int w, col_frame = color_frame; col_body = color_body; col_shadow = color_shadow; + + shadow_w = SHADOW_OFFSET; + corner_rad = RADIUS_LARGE; + corner_type = CORNER_ALL; + cc_item_index = 0; + + v_cc_items.clear(); + + append_x_offset = 0; + append_y_offset = 0; } CComponentsForm::~CComponentsForm() @@ -89,31 +96,6 @@ void CComponentsForm::clear() } -void CComponentsForm::initVarForm() -{ - - - //simple default dimensions - x = 0; - y = 0; - width = 150; - height = 150; - shadow = CC_SHADOW_OFF; - shadow_w = SHADOW_OFFSET; - col_frame = COL_MENUCONTENT_PLUS_6; - col_body = COL_MENUCONTENT_PLUS_0; - col_shadow = COL_MENUCONTENTDARK_PLUS_0; - corner_rad = RADIUS_LARGE; - corner_type = CORNER_ALL; - cc_item_index = 0; - - //CComponentsForm - v_cc_items.clear(); - cc_item_type = CC_ITEMTYPE_FRM; - append_x_offset = 0; - append_y_offset = 0; -} - void CComponentsForm::addCCItem(CComponentsItem* cc_Item) { if (cc_Item){ @@ -177,7 +159,7 @@ void CComponentsForm::replaceCCItem(const uint& cc_item_id, CComponentsItem* new if (!v_cc_items.empty()){ CComponentsItem* old_Item = v_cc_items[cc_item_id]; if (old_Item){ - CComponentsItem * old_parent = old_Item->getParent(); + CComponentsForm * old_parent = old_Item->getParent(); new_cc_Item->setParent(old_parent); new_cc_Item->setIndex(old_parent->getIndex()); delete old_Item; diff --git a/src/gui/components/cc_frm.h b/src/gui/components/cc_frm.h index d532cdbfc..fc5b21dcd 100644 --- a/src/gui/components/cc_frm.h +++ b/src/gui/components/cc_frm.h @@ -31,8 +31,6 @@ class CComponentsForm : public CComponentsItem { - private: - void initVarForm(); protected: std::vector v_cc_items; void paintForm(bool do_save_bg); @@ -42,10 +40,12 @@ class CComponentsForm : public CComponentsItem int append_x_offset; int append_y_offset; public: - - CComponentsForm(); - CComponentsForm(const int x_pos, const int y_pos, const int w, const int h, bool has_shadow = CC_SHADOW_OFF, - fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); + CComponentsForm( const int x_pos = 0, const int y_pos = 0, const int w = 800, const int h = 600, + CComponentsForm *parent = NULL, + bool has_shadow = CC_SHADOW_OFF, + fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, + fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, + fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); virtual ~CComponentsForm(); void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); diff --git a/src/gui/components/cc_frm_button.cpp b/src/gui/components/cc_frm_button.cpp index 005455d5a..69d25ed65 100644 --- a/src/gui/components/cc_frm_button.cpp +++ b/src/gui/components/cc_frm_button.cpp @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012-2014, Thilo Graf 'dbt' License: GPL @@ -37,41 +37,41 @@ using namespace std; -CComponentsButton::CComponentsButton( const int x_pos, const int y_pos, const int w, const int h, +CComponentsButton::CComponentsButton( const int& x_pos, const int& y_pos, const int& w, const int& h, const std::string& caption, const std::string& icon_name, - bool selected, bool enabled, bool has_shadow, + CComponentsForm* parent, + bool selected, + bool enabled, + bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { - initVarButton(); - cc_btn_icon = icon_name; - cc_btn_capt = caption; - cc_btn_capt_col = COL_MENUCONTENT_TEXT; - - x = x_pos; - y = y_pos; - width = w; - height = h; - shadow = has_shadow; - shadow_w = SHADOW_OFFSET; - col_frame = color_frame; - col_body = color_body; - col_shadow = color_shadow; - cc_item_enabled = enabled; - cc_item_selected = selected; - fr_thickness = FRAME_TH; + cc_btn_capt_locale = NONEXISTANT_LOCALE; + initVarButton(x_pos, y_pos, w, h, caption, icon_name, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow); } -CComponentsButton::CComponentsButton( const int x_pos, const int y_pos, const int w, const int h, +CComponentsButton::CComponentsButton( const int& x_pos, const int& y_pos, const int& w, const int& h, const neutrino_locale_t& caption_locale, const std::string& icon_name, - bool selected, bool enabled, bool has_shadow, + CComponentsForm* parent, + bool selected, + bool enabled, + bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { - initVarButton(); - cc_btn_icon = icon_name; cc_btn_capt_locale = caption_locale; - cc_btn_capt = g_Locale->getText(cc_btn_capt_locale); - cc_btn_capt_col = COL_MENUCONTENT_TEXT; - + initVarButton(x_pos, y_pos, w, h, g_Locale->getText(cc_btn_capt_locale), icon_name, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow); +} + +void CComponentsButton::initVarButton( const int& x_pos, const int& y_pos, const int& w, const int& h, + const std::string& caption, + const std::string& icon_name, + CComponentsForm* parent, + bool selected, + bool enabled, + bool has_shadow, + fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) +{ + cc_item_type = CC_ITEMTYPE_BUTTON; + x = x_pos; y = y_pos; width = w; @@ -84,18 +84,16 @@ CComponentsButton::CComponentsButton( const int x_pos, const int y_pos, const i cc_item_enabled = enabled; cc_item_selected = selected; fr_thickness = FRAME_TH; -} - -void CComponentsButton::initVarButton() -{ - cc_item_type = CC_ITEMTYPE_BUTTON; + + cc_btn_capt_col = COL_MENUCONTENT_TEXT; cc_btn_icon_obj = NULL; cc_btn_capt_obj = NULL; cc_btn_dy_font = CNeutrinoFonts::getInstance(); cc_btn_font = NULL; - cc_btn_icon = ""; - cc_btn_capt = ""; - cc_btn_capt_locale = NONEXISTANT_LOCALE; + cc_btn_icon = icon_name; + cc_btn_capt = caption; + + initParent(parent); } void CComponentsButton::initIcon() @@ -195,7 +193,7 @@ void CComponentsButton::setCaption(const std::string& text) void CComponentsButton::setCaption(const neutrino_locale_t locale_text) { cc_btn_capt_locale = locale_text; - cc_btn_capt = g_Locale->getText(cc_btn_capt_locale); + setCaption(g_Locale->getText(cc_btn_capt_locale)); } void CComponentsButton::initCCBtnItems() diff --git a/src/gui/components/cc_frm_button.h b/src/gui/components/cc_frm_button.h index 976433e81..5df275521 100644 --- a/src/gui/components/cc_frm_button.h +++ b/src/gui/components/cc_frm_button.h @@ -45,7 +45,14 @@ class CComponentsButton : public CComponentsForm CComponentsLabel *cc_btn_capt_obj; ///initialize all required attributes and objects - void initVarButton(); + void initVarButton( const int& x_pos, const int& y_pos, const int& w, const int& h, + const std::string& caption, + const std::string& icon_name, + CComponentsForm* parent, + bool selected, + bool enabled, + bool has_shadow, + fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow); ///property: button text as string, see also setCaption() and getCaptionString() std::string cc_btn_capt; @@ -72,13 +79,21 @@ class CComponentsButton : public CComponentsForm public: ///basic constructor for button object with most needed params, no button icon is definied here - CComponentsButton( const int x_pos, const int y_pos, const int w, const int h, + CComponentsButton( const int& x_pos, const int& y_pos, const int& w, const int& h, const std::string& caption, const std::string& icon_name = "", - bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, + CComponentsForm *parent = NULL, + bool selected = false, + bool enabled = true, + bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); - CComponentsButton( const int x_pos, const int y_pos, const int w, const int h, - const neutrino_locale_t& caption_locale, const std::string& icon_name = "", - bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, + + CComponentsButton( const int& x_pos, const int& y_pos, const int& w, const int& h, + const neutrino_locale_t& caption_locale, + const std::string& icon_name = "", + CComponentsForm *parent = NULL, + bool selected = false, + bool enabled = true, + bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); ///set text color @@ -108,19 +123,25 @@ Shows a button box with caption and prepared red icon. class CComponentsButtonRed : public CComponentsButton { public: - CComponentsButtonRed( const int x_pos, const int y_pos, const int w, const int h, + CComponentsButtonRed( const int& x_pos, const int& y_pos, const int& w, const int& h, const std::string& caption, - bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, + CComponentsForm *parent = NULL, + bool selected = false, + bool enabled = true, + bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0) - :CComponentsButton(x_pos, y_pos, w, h, caption, NEUTRINO_ICON_BUTTON_RED, selected, enabled, has_shadow, color_frame, color_body, color_shadow) + :CComponentsButton(x_pos, y_pos, w, h, caption, NEUTRINO_ICON_BUTTON_RED, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow) { cc_item_type = CC_ITEMTYPE_BUTTON_RED; }; - CComponentsButtonRed( const int x_pos, const int y_pos, const int w, const int h, + CComponentsButtonRed( const int& x_pos, const int& y_pos, const int& w, const int& h, const neutrino_locale_t& caption_locale, - bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, + CComponentsForm *parent = NULL, + bool selected = false, + bool enabled = true, + bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0) - :CComponentsButton(x_pos, y_pos, w, h, caption_locale, NEUTRINO_ICON_BUTTON_RED, selected, enabled, has_shadow, color_frame, color_body, color_shadow) + :CComponentsButton(x_pos, y_pos, w, h, caption_locale, NEUTRINO_ICON_BUTTON_RED, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow) { cc_item_type = CC_ITEMTYPE_BUTTON_RED; }; @@ -133,19 +154,25 @@ Shows a button box with caption and prepared green icon. class CComponentsButtonGreen : public CComponentsButton { public: - CComponentsButtonGreen( const int x_pos, const int y_pos, const int w, const int h, + CComponentsButtonGreen( const int& x_pos, const int& y_pos, const int& w, const int& h, const std::string& caption, - bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, + CComponentsForm *parent = NULL, + bool selected = false, + bool enabled = true, + bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0) - :CComponentsButton(x_pos, y_pos, w, h, caption, NEUTRINO_ICON_BUTTON_GREEN, selected, enabled, has_shadow, color_frame, color_body, color_shadow) + :CComponentsButton(x_pos, y_pos, w, h, caption, NEUTRINO_ICON_BUTTON_GREEN, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow) { cc_item_type = CC_ITEMTYPE_BUTTON_GREEN; }; - CComponentsButtonGreen( const int x_pos, const int y_pos, const int w, const int h, + CComponentsButtonGreen( const int& x_pos, const int& y_pos, const int& w, const int& h, const neutrino_locale_t& caption_locale, - bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, + CComponentsForm *parent = NULL, + bool selected = false, + bool enabled = true, + bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0) - :CComponentsButton(x_pos, y_pos, w, h, caption_locale, NEUTRINO_ICON_BUTTON_GREEN, selected, enabled, has_shadow, color_frame, color_body, color_shadow) + :CComponentsButton(x_pos, y_pos, w, h, caption_locale, NEUTRINO_ICON_BUTTON_GREEN, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow) { cc_item_type = CC_ITEMTYPE_BUTTON_GREEN; }; @@ -158,19 +185,25 @@ Shows a button box with caption and prepared yellow icon. class CComponentsButtonYellow : public CComponentsButton { public: - CComponentsButtonYellow( const int x_pos, const int y_pos, const int w, const int h, + CComponentsButtonYellow( const int& x_pos, const int& y_pos, const int& w, const int& h, const std::string& caption, - bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, + CComponentsForm *parent = NULL, + bool selected = false, + bool enabled = true, + bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0) - :CComponentsButton(x_pos, y_pos, w, h, caption, NEUTRINO_ICON_BUTTON_YELLOW, selected, enabled, has_shadow, color_frame, color_body, color_shadow) + :CComponentsButton(x_pos, y_pos, w, h, caption, NEUTRINO_ICON_BUTTON_YELLOW, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow) { cc_item_type = CC_ITEMTYPE_BUTTON_YELLOW; }; - CComponentsButtonYellow( const int x_pos, const int y_pos, const int w, const int h, + CComponentsButtonYellow( const int& x_pos, const int& y_pos, const int& w, const int& h, const neutrino_locale_t& caption_locale, - bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, + CComponentsForm *parent = NULL, + bool selected = false, + bool enabled = true, + bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0) - :CComponentsButton(x_pos, y_pos, w, h, caption_locale, NEUTRINO_ICON_BUTTON_YELLOW, selected, enabled, has_shadow, color_frame, color_body, color_shadow) + :CComponentsButton(x_pos, y_pos, w, h, caption_locale, NEUTRINO_ICON_BUTTON_YELLOW, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow) { cc_item_type = CC_ITEMTYPE_BUTTON_YELLOW; }; @@ -183,19 +216,25 @@ Shows a button box with caption and prepared blue icon. class CComponentsButtonBlue : public CComponentsButton { public: - CComponentsButtonBlue( const int x_pos, const int y_pos, const int w, const int h, + CComponentsButtonBlue( const int& x_pos, const int& y_pos, const int& w, const int& h, const std::string& caption, - bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, + CComponentsForm *parent = NULL, + bool selected = false, + bool enabled = true, + bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0) - :CComponentsButton(x_pos, y_pos, w, h, caption, NEUTRINO_ICON_BUTTON_BLUE, selected, enabled, has_shadow, color_frame, color_body, color_shadow) + :CComponentsButton(x_pos, y_pos, w, h, caption, NEUTRINO_ICON_BUTTON_BLUE, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow) { cc_item_type = CC_ITEMTYPE_BUTTON_BLUE; }; - CComponentsButtonBlue( const int x_pos, const int y_pos, const int w, const int h, + CComponentsButtonBlue( const int& x_pos, const int& y_pos, const int& w, const int& h, const neutrino_locale_t& caption_locale, - bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, + CComponentsForm *parent = NULL, + bool selected = false, + bool enabled = true, + bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0) - :CComponentsButton(x_pos, y_pos, w, h, caption_locale, NEUTRINO_ICON_BUTTON_BLUE, selected, enabled, has_shadow, color_frame, color_body, color_shadow) + :CComponentsButton(x_pos, y_pos, w, h, caption_locale, NEUTRINO_ICON_BUTTON_BLUE, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow) { cc_item_type = CC_ITEMTYPE_BUTTON_BLUE; }; diff --git a/src/gui/components/cc_frm_clock.cpp b/src/gui/components/cc_frm_clock.cpp index b40e34601..35add9f8a 100644 --- a/src/gui/components/cc_frm_clock.cpp +++ b/src/gui/components/cc_frm_clock.cpp @@ -41,16 +41,12 @@ using namespace std; CComponentsFrmClock::CComponentsFrmClock( const int& x_pos, const int& y_pos, const int& w, const int& h, - const char* format_str, bool activ, bool has_shadow, + const char* format_str, + bool activ, + CComponentsForm* parent, + bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) -{ - initVarClock(x_pos, y_pos, w, h, format_str, activ, has_shadow, color_frame, color_body, color_shadow); -} - -void CComponentsFrmClock::initVarClock( const int& x_pos, const int& y_pos, const int& w, const int& h, - const char* format_str, bool activ, bool has_shadow, - fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { x = x_pos; y = y_pos; @@ -80,6 +76,9 @@ void CComponentsFrmClock::initVarClock( const int& x_pos, const int& y_pos, cons paintClock = false; activeClock = activ; + + initParent(parent); + if (activeClock) startThread(); } diff --git a/src/gui/components/cc_frm_clock.h b/src/gui/components/cc_frm_clock.h index c0a21bdbe..f8725cd4a 100644 --- a/src/gui/components/cc_frm_clock.h +++ b/src/gui/components/cc_frm_clock.h @@ -77,11 +77,6 @@ class CComponentsFrmClock : public CComponentsForm ///time string align, default allign is ver and hor centered int cl_align; - ///initialize all attributes and required objects - void initVarClock( const int& x_pos, const int& y_pos, const int& w, const int& h, - const char* format_str, bool activ, bool has_shadow, - fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow); - ///initialize clock contents void initCCLockItems(); ///initialize timestring, called in initCCLockItems() @@ -94,7 +89,10 @@ class CComponentsFrmClock : public CComponentsForm public: CComponentsFrmClock( const int& x_pos = 1, const int& y_pos = 1, const int& w = 200, const int& h = 48, - const char* format_str = "%H:%M", bool activ=false, bool has_shadow = CC_SHADOW_OFF, + const char* format_str = "%H:%M", + bool activ=false, + CComponentsForm *parent = NULL, + bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); virtual ~CComponentsFrmClock(); diff --git a/src/gui/components/cc_frm_ext_text.cpp b/src/gui/components/cc_frm_ext_text.cpp index 05196bd78..b3e3e263e 100644 --- a/src/gui/components/cc_frm_ext_text.cpp +++ b/src/gui/components/cc_frm_ext_text.cpp @@ -36,28 +36,32 @@ using namespace std; CComponentsExtTextForm::CComponentsExtTextForm( const int& x_pos, const int& y_pos, const int& w, const int& h, const std::string& label_text, const std::string& text, + CComponentsForm* parent, bool has_shadow, fb_pixel_t label_color, fb_pixel_t text_color, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { - initVarExtTextForm(x_pos, y_pos, w, h, label_text, text, has_shadow, label_color, text_color, color_frame, color_body, color_shadow); + initVarExtTextForm(x_pos, y_pos, w, h, label_text, text, parent, has_shadow, label_color, text_color, color_frame, color_body, color_shadow); initCCTextItems(); } CComponentsExtTextFormLocalized::CComponentsExtTextFormLocalized(const int& x_pos, const int& y_pos, const int& w, const int& h, const neutrino_locale_t& locale_label_text, const neutrino_locale_t& locale_text, + CComponentsForm* parent, bool has_shadow, fb_pixel_t label_color, fb_pixel_t text_color, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) : CComponentsExtTextForm( x_pos, y_pos, w, h, g_Locale->getText(locale_label_text), g_Locale->getText(locale_text), + parent, has_shadow, label_color, text_color, color_frame, color_body, color_shadow){}; void CComponentsExtTextForm::initVarExtTextForm(const int& x_pos, const int& y_pos, const int& w, const int& h, const std::string& label_text, const std::string& text, + CComponentsForm* parent, bool has_shadow, fb_pixel_t label_color, fb_pixel_t text_color, @@ -90,7 +94,8 @@ void CComponentsExtTextForm::initVarExtTextForm(const int& x_pos, const int& y_p int dx = 0, dy = DEF_HEIGHT; ccx_font = *(CNeutrinoFonts::getInstance()->getDynFont(dx, dy)); ccx_label_align = ccx_text_align = CTextBox::NO_AUTO_LINEBREAK; - + + initParent(parent); } diff --git a/src/gui/components/cc_frm_ext_text.h b/src/gui/components/cc_frm_ext_text.h index 59a837b97..66a2172fb 100644 --- a/src/gui/components/cc_frm_ext_text.h +++ b/src/gui/components/cc_frm_ext_text.h @@ -68,6 +68,7 @@ class CComponentsExtTextForm : public CComponentsForm ///initialize basic variables void initVarExtTextForm(const int& x_pos, const int& y_pos, const int& w, const int& h, const std::string& label_text, const std::string& text, + CComponentsForm* parent, bool has_shadow, fb_pixel_t label_color, fb_pixel_t text_color, @@ -77,10 +78,13 @@ class CComponentsExtTextForm : public CComponentsForm ///advanced constructor for CComponentsExtTextForm, provides parameters for the most required properties, and caption as string CComponentsExtTextForm( const int& x_pos = 1, const int& y_pos = 1, const int& w = 300, const int& h = 48, const std::string& label_text = "", const std::string& text = "", + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t label_color = COL_MENUCONTENTINACTIVE_TEXT, fb_pixel_t text_color = COL_MENUCONTENT_TEXT, - fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); + fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, + fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, + fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); // ~CComponentsExtTextForm(); //inherited from CComponentsForm ///assigns texts for label and text, parameter as string, parameter Font is optional for required font type, default font is dependently from defined item height @@ -119,6 +123,7 @@ class CComponentsExtTextFormLocalized : public CComponentsExtTextForm ///advanced constructor for CComponentsExtTextForm, provides parameters for the most required properties, and caption as locales CComponentsExtTextFormLocalized(const int& x_pos = 1, const int& y_pos = 1, const int& w = 300, const int& h = 48, const neutrino_locale_t& locale_label_text = NONEXISTANT_LOCALE, const neutrino_locale_t& locale_text = NONEXISTANT_LOCALE, + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t label_color = COL_MENUCONTENTINACTIVE_TEXT, fb_pixel_t text_color = COL_MENUCONTENT_TEXT, diff --git a/src/gui/components/cc_frm_footer.cpp b/src/gui/components/cc_frm_footer.cpp index 59d5c6154..a3332d764 100644 --- a/src/gui/components/cc_frm_footer.cpp +++ b/src/gui/components/cc_frm_footer.cpp @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2013, Thilo Graf 'dbt' + Copyright (C) 2013-2014, Thilo Graf 'dbt' License: GPL @@ -33,25 +33,27 @@ using namespace std; //------------------------------------------------------------------------------------------------------- //sub class CComponentsFooter inherit from CComponentsHeader -CComponentsFooter::CComponentsFooter() +CComponentsFooter::CComponentsFooter(CComponentsForm* parent) { //CComponentsFooter - initVarFooter(1, 1, 0, 0); + initVarFooter(1, 1, 0, 0, 0, parent); } CComponentsFooter::CComponentsFooter( const int& x_pos, const int& y_pos, const int& w, const int& h, const int& buttons, + CComponentsForm* parent, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow ) { //CComponentsFooter - initVarFooter(x_pos, y_pos, w, h, buttons, has_shadow, color_frame, color_body, color_shadow); + initVarFooter(x_pos, y_pos, w, h, buttons, parent, has_shadow, color_frame, color_body, color_shadow); } void CComponentsFooter::initVarFooter( const int& x_pos, const int& y_pos, const int& w, const int& h, const int& buttons, + CComponentsForm* parent, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, @@ -82,4 +84,5 @@ void CComponentsFooter::initVarFooter( const int& x_pos, const int& y_pos, const initDefaultButtons(); initCCItems(); + initParent(parent); } diff --git a/src/gui/components/cc_frm_footer.h b/src/gui/components/cc_frm_footer.h index dd96a02bd..f0fad0646 100644 --- a/src/gui/components/cc_frm_footer.h +++ b/src/gui/components/cc_frm_footer.h @@ -36,14 +36,16 @@ class CComponentsFooter : public CComponentsHeader protected: void initVarFooter( const int& x_pos, const int& y_pos, const int& w, const int& h = 0, const int& buttons = 0, + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_INFOBAR_SHADOW_PLUS_1, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); public: - CComponentsFooter(); + CComponentsFooter(CComponentsForm *parent = NULL); CComponentsFooter( const int& x_pos, const int& y_pos, const int& w, const int& h = 0, const int& buttons = 0, + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_INFOBAR_SHADOW_PLUS_1, diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index 4c1cc4c4b..8152c37ac 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -34,28 +34,30 @@ using namespace std; //------------------------------------------------------------------------------------------------------- //sub class CComponentsHeader inherit from CComponentsForm -CComponentsHeader::CComponentsHeader() +CComponentsHeader::CComponentsHeader(CComponentsForm* parent) { //CComponentsHeader - initVarHeader(1, 1, 0, 0, "", "", 0); + initVarHeader(1, 1, 0, 0, "", "", 0, parent); } CComponentsHeader::CComponentsHeader( const int& x_pos, const int& y_pos, const int& w, const int& h, const std::string& caption, const std::string& icon_name, const int& buttons, + CComponentsForm* parent, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { - initVarHeader(x_pos, y_pos, w, h, caption, icon_name, buttons, has_shadow, color_frame, color_body, color_shadow); + initVarHeader(x_pos, y_pos, w, h, caption, icon_name, buttons, parent, has_shadow, color_frame, color_body, color_shadow); } CComponentsHeaderLocalized::CComponentsHeaderLocalized( const int& x_pos, const int& y_pos, const int& w, const int& h, neutrino_locale_t caption_locale, const std::string& icon_name, const int& buttons, + CComponentsForm* parent, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, @@ -63,6 +65,7 @@ CComponentsHeaderLocalized::CComponentsHeaderLocalized( const int& x_pos, const :CComponentsHeader( x_pos, y_pos, w, h, g_Locale->getText(caption_locale), icon_name, buttons, + parent, has_shadow, color_frame, color_body, color_shadow){}; @@ -70,6 +73,7 @@ void CComponentsHeader::initVarHeader( const int& x_pos, const int& y_pos, const const std::string& caption, const std::string& icon_name, const int& buttons, + CComponentsForm* parent, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, @@ -117,6 +121,7 @@ void CComponentsHeader::initVarHeader( const int& x_pos, const int& y_pos, const initDefaultButtons(); initCCItems(); + initParent(parent); } CComponentsHeader::~CComponentsHeader() diff --git a/src/gui/components/cc_frm_header.h b/src/gui/components/cc_frm_header.h index 7756b269e..e4bad26c0 100644 --- a/src/gui/components/cc_frm_header.h +++ b/src/gui/components/cc_frm_header.h @@ -42,6 +42,7 @@ class CComponentsHeader : public CComponentsForm const std::string& caption = "header", const std::string& = "", const int& buttons = 0, + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, @@ -110,11 +111,12 @@ class CComponentsHeader : public CComponentsForm CC_HEADER_ITEM_BUTTONS = 2 }; - CComponentsHeader(); + CComponentsHeader(CComponentsForm *parent = NULL); CComponentsHeader( const int& x_pos, const int& y_pos, const int& w, const int& h = 0, const std::string& caption = "", const std::string& = "", const int& buttons = 0, + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, @@ -188,6 +190,7 @@ class CComponentsHeaderLocalized : public CComponentsHeader neutrino_locale_t caption_locale = NONEXISTANT_LOCALE, const std::string& = "", const int& buttons = 0, + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, diff --git a/src/gui/components/cc_frm_icons.cpp b/src/gui/components/cc_frm_icons.cpp index aa6b84d92..926f25544 100644 --- a/src/gui/components/cc_frm_icons.cpp +++ b/src/gui/components/cc_frm_icons.cpp @@ -33,21 +33,23 @@ using namespace std; //sub class CComponentsIconForm inherit from CComponentsForm -CComponentsIconForm::CComponentsIconForm() +CComponentsIconForm::CComponentsIconForm(CComponentsForm* parent) { - initVarIconForm(1, 1, 0, 0, vector()); + initVarIconForm(1, 1, 0, 0, vector(), parent); } CComponentsIconForm::CComponentsIconForm( const int &x_pos, const int &y_pos, const int &w, const int &h, const std::vector &v_icon_names, + CComponentsForm* parent, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { - initVarIconForm(x_pos, y_pos, w, h, v_icon_names, has_shadow, color_frame, color_body, color_shadow); + initVarIconForm(x_pos, y_pos, w, h, v_icon_names, parent, has_shadow, color_frame, color_body, color_shadow); } void CComponentsIconForm::initVarIconForm( const int &x_pos, const int &y_pos, const int &w, const int &h, const std::vector &v_icon_names, + CComponentsForm* parent, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { @@ -65,6 +67,7 @@ void CComponentsIconForm::initVarIconForm( const int &x_pos, const int &y_pos, c ccif_offset = 2; ccif_icon_align = CC_ICONS_FRM_ALIGN_LEFT; + initParent(parent); } void CComponentsIconForm::addIcon(const std::string& icon_name) diff --git a/src/gui/components/cc_frm_icons.h b/src/gui/components/cc_frm_icons.h index 83b86c5f8..6f48c195e 100644 --- a/src/gui/components/cc_frm_icons.h +++ b/src/gui/components/cc_frm_icons.h @@ -36,15 +36,17 @@ class CComponentsIconForm : public CComponentsForm protected: void initVarIconForm( const int &x_pos, const int &y_pos, const int &w, const int &h, const std::vector &v_icon_names, + CComponentsForm* parent, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); public: - CComponentsIconForm(); + CComponentsIconForm(CComponentsForm *parent = NULL); CComponentsIconForm( const int &x_pos, const int &y_pos, const int &w, const int &h, const std::vector &v_icon_names, + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); diff --git a/src/gui/components/cc_frm_signalbars.cpp b/src/gui/components/cc_frm_signalbars.cpp index 1b2d21295..7b44dee5b 100644 --- a/src/gui/components/cc_frm_signalbars.cpp +++ b/src/gui/components/cc_frm_signalbars.cpp @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Class for signalbar based up CComponent classes. - Copyright (C) 2013, Thilo Graf 'dbt' + Copyright (C) 2013-1014, Thilo Graf 'dbt' License: GPL @@ -37,16 +37,17 @@ using namespace std; -CSignalBar::CSignalBar() +CSignalBar::CSignalBar(CComponentsForm *parent) { initVarSigBar(); sb_name = "SIG"; initDimensions(); initSBItems(); + initParent(parent); } -CSignalBar::CSignalBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref, const string& sbname) +CSignalBar::CSignalBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref, const string& sbname, CComponentsForm *parent) { initVarSigBar(); sb_frontend = frontend_ref; @@ -58,6 +59,7 @@ CSignalBar::CSignalBar(const int& xpos, const int& ypos, const int& w, const int initDimensions(); initSBItems(); + initParent(parent); } void CSignalBar::initDimensions() @@ -256,7 +258,7 @@ void CSignalNoiseRatioBar::Refresh() //********************************************************************************************************************** -CSignalBox::CSignalBox(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref, const bool vert) +CSignalBox::CSignalBox(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref, const bool vert, CComponentsForm *parent) { initVarSigBox(); vertical = vert; @@ -284,6 +286,7 @@ CSignalBox::CSignalBox(const int& xpos, const int& ypos, const int& w, const int addCCItem(snrbar); initSignalItems(); + initParent(parent); } void CSignalBox::initVarSigBox() diff --git a/src/gui/components/cc_frm_signalbars.h b/src/gui/components/cc_frm_signalbars.h index c7474ffa7..a5cb7dcd9 100644 --- a/src/gui/components/cc_frm_signalbars.h +++ b/src/gui/components/cc_frm_signalbars.h @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Class for signalbar based up CComponent classes. - Copyright (C) 2013, Thilo Graf 'dbt' + Copyright (C) 2013-2014, Thilo Graf 'dbt' License: GPL @@ -110,9 +110,9 @@ class CSignalBar : public CComponentsForm std::string sb_name; public: - CSignalBar(); + CSignalBar(CComponentsForm *parent = NULL); ///basic component class constructor for signal. - CSignalBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref, const std::string& sb_name = "SIG"); + CSignalBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref, const std::string& sb_name = "SIG", CComponentsForm *parent = NULL); ///assigns the current used frontend, simplified a tuner object, see frontend_c.h virtual void setFrontEnd(CFrontend *frontend_ref){sb_frontend = frontend_ref;}; @@ -157,10 +157,11 @@ class CSignalNoiseRatioBar : public CSignalBar void Refresh(); public: - CSignalNoiseRatioBar(){}; + CSignalNoiseRatioBar(CComponentsForm *parent = NULL) + : CSignalBar(parent){}; ///basic component class constructor for signal noise ratio. - CSignalNoiseRatioBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref) - : CSignalBar(xpos, ypos, w, h, frontend_ref, "SNR"){}; + CSignalNoiseRatioBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref, CComponentsForm *parent = NULL) + : CSignalBar(xpos, ypos, w, h, frontend_ref, "SNR", parent){}; }; /// Class CSignalBox() provides CSignalBar(), CSignalNoiseRatioBar() scales at once. @@ -268,7 +269,7 @@ class CSignalBox : public CComponentsForm public: ///class constructor for signal noise ratio. - CSignalBox(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref = NULL, const bool vertical = true); + CSignalBox(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref = NULL, const bool vertical = true, CComponentsForm *parent = NULL); ///returns the signal object, type = CSignalBar* CSignalBar* getScaleObject(){return sbar;}; diff --git a/src/gui/components/cc_frm_slider.cpp b/src/gui/components/cc_frm_slider.cpp index f61b37fa6..bed4cbd64 100644 --- a/src/gui/components/cc_frm_slider.cpp +++ b/src/gui/components/cc_frm_slider.cpp @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2013, Thilo Graf 'dbt' + Copyright (C) 2013-2014, Thilo Graf 'dbt' License: GPL @@ -33,20 +33,7 @@ CComponentsSlider::CComponentsSlider( const int& x_pos, const int& y_pos, const const int& current_value, const int& min_value, const int& max_value, - bool has_shadow, - fb_pixel_t& color_frame, - fb_pixel_t& color_body, - fb_pixel_t& color_shadow) -{ - initVarSlider(x_pos, y_pos, w, h, current_value, min_value, max_value, has_shadow, color_frame, color_body, color_shadow); - initCCSlItems(); -} - - -void CComponentsSlider::initVarSlider( const int& x_pos, const int& y_pos, const int& w, const int& h, - const int& current_value, - const int& min_value, - const int& max_value, + CComponentsForm *parent, bool has_shadow, fb_pixel_t& color_frame, fb_pixel_t& color_body, @@ -74,6 +61,9 @@ void CComponentsSlider::initVarSlider( const int& x_pos, const int& y_pos, const csl_body_icon = NEUTRINO_ICON_VOLUMEBODY; csl_slider_icon =NEUTRINO_ICON_VOLUMESLIDER2; + + initCCSlItems(); + initParent(parent); } //set current value diff --git a/src/gui/components/cc_frm_slider.h b/src/gui/components/cc_frm_slider.h index 9241dc49c..08395d759 100644 --- a/src/gui/components/cc_frm_slider.h +++ b/src/gui/components/cc_frm_slider.h @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2013, Thilo Graf 'dbt' + Copyright (C) 2013-2014, Thilo Graf 'dbt' License: GPL @@ -60,23 +60,12 @@ class CComponentsSlider : public CComponentsForm ///init all items at once void initCCSlItems(); - ///init all required variables - void initVarSlider( const int& x_pos, const int& y_pos, const int& w, const int& h, - const int& current_value, - const int& min_value, - const int& max_value, - bool has_shadow, - fb_pixel_t& color_frame, - fb_pixel_t& color_body, - fb_pixel_t& color_shadow); - protected: - - public: - CComponentsSlider( const int& x_pos = 1, const int& y_pos = 1, const int& w = 120+16, const int& h = 32, + CComponentsSlider( const int& x_pos = 0, const int& y_pos = 0, const int& w = 120+16, const int& h = 32, const int& current_value = 0, const int& min_value = 0, const int& max_value = 100, + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t& color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t& color_body = COL_MENUHEAD_PLUS_0, diff --git a/src/gui/components/cc_frm_window.cpp b/src/gui/components/cc_frm_window.cpp index 629b3386a..013315ff8 100644 --- a/src/gui/components/cc_frm_window.cpp +++ b/src/gui/components/cc_frm_window.cpp @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2012, 2013, 2014 Thilo Graf 'dbt' + Copyright (C) 2012-2014 Thilo Graf 'dbt' Copyright (C) 2012, Michael Liebmann 'micha-bbg' License: GPL @@ -34,56 +34,61 @@ using namespace std; //------------------------------------------------------------------------------------------------------- //sub class CComponentsWindow inherit from CComponentsForm -CComponentsWindow::CComponentsWindow() +CComponentsWindow::CComponentsWindow(CComponentsForm *parent) { - initVarWindow(); + initVarWindow(0, 0, 800, 600, "", "", parent); } CComponentsWindow::CComponentsWindow( const int& x_pos, const int& y_pos, const int& w, const int& h, neutrino_locale_t locale_caption, const string& iconname, + CComponentsForm *parent, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { string s_caption = locale_caption != NONEXISTANT_LOCALE ? g_Locale->getText(locale_caption) : ""; - initVarWindow(x_pos, y_pos, w, h, s_caption, iconname, has_shadow, color_frame, color_body, color_shadow); + initVarWindow(x_pos, y_pos, w, h, s_caption, iconname, parent, has_shadow, color_frame, color_body, color_shadow); } CComponentsWindow::CComponentsWindow( const int& x_pos, const int& y_pos, const int& w, const int& h, const string& caption, const string& iconname, + CComponentsForm *parent, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { - initVarWindow(x_pos, y_pos, w, h, caption, iconname, has_shadow, color_frame, color_body, color_shadow); + initVarWindow(x_pos, y_pos, w, h, caption, iconname, parent, has_shadow, color_frame, color_body, color_shadow); } CComponentsWindowMax::CComponentsWindowMax( const string& caption, const string& iconname, + CComponentsForm *parent, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) :CComponentsWindow(0, 0, 0, 0, caption, - iconname, has_shadow, color_frame, color_body, color_shadow){}; + iconname, parent, has_shadow, color_frame, color_body, color_shadow){}; CComponentsWindowMax::CComponentsWindowMax( neutrino_locale_t locale_caption, const string& iconname, + CComponentsForm *parent, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) :CComponentsWindow(0, 0, 0, 0, locale_caption != NONEXISTANT_LOCALE ? g_Locale->getText(locale_caption) : "", - iconname, has_shadow, color_frame, color_body, color_shadow){}; + iconname, parent, has_shadow, color_frame, color_body, color_shadow){}; void CComponentsWindow::initVarWindow( const int& x_pos, const int& y_pos, const int& w, const int& h, const string& caption, const string& iconname, + CComponentsForm *parent, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, @@ -121,6 +126,7 @@ void CComponentsWindow::initVarWindow( const int& x_pos, const int& y_pos, const ccw_align_mode = CTextBox::NO_AUTO_LINEBREAK; initCCWItems(); + initParent(parent); } void CComponentsWindow::initWindowSize() diff --git a/src/gui/components/cc_frm_window.h b/src/gui/components/cc_frm_window.h index de4761f0d..30838c1c2 100644 --- a/src/gui/components/cc_frm_window.h +++ b/src/gui/components/cc_frm_window.h @@ -86,6 +86,7 @@ class CComponentsWindow : public CComponentsForm void initVarWindow( const int& x_pos = CC_CENTERED, const int& y_pos = CC_CENTERED, const int& w = 0, const int& h = 0, const std::string& caption = "", const std::string& iconname = "", + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, @@ -101,12 +102,13 @@ class CComponentsWindow : public CComponentsForm CC_WINDOW_ITEM_HEADER = 0 }; ///simple constructor for CComponentsWindow, this shows a window over full screen - CComponentsWindow(); + CComponentsWindow(CComponentsForm *parent = NULL); ///advanced constructor for CComponentsWindow, provides parameters for the most required properties, and caption as string, x_pos or y_pos = 0 will center window CComponentsWindow( const int& x_pos, const int& y_pos, const int& w, const int& h, const std::string& caption = "", const std::string& iconname = "", + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, @@ -116,6 +118,7 @@ class CComponentsWindow : public CComponentsForm CComponentsWindow( const int& x_pos, const int& y_pos, const int& w, const int& h, neutrino_locale_t locale_text = NONEXISTANT_LOCALE, const std::string& iconname = "", + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, @@ -163,6 +166,7 @@ class CComponentsWindowMax : public CComponentsWindow public: ///simple constructor for CComponentsWindow, provides parameters for caption as string and icon, this shows a centered window based up current screen settings CComponentsWindowMax( const std::string& caption, const std::string& iconname = "", + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, @@ -170,6 +174,7 @@ class CComponentsWindowMax : public CComponentsWindow ///simple constructor for CComponentsWindow, provides parameters for caption from locales and icon, this shows a centered window based up current screen settings CComponentsWindowMax( neutrino_locale_t locale_caption, const std::string& iconname = "", + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, diff --git a/src/gui/components/cc_item.cpp b/src/gui/components/cc_item.cpp index 400560666..b88c43165 100644 --- a/src/gui/components/cc_item.cpp +++ b/src/gui/components/cc_item.cpp @@ -35,14 +35,6 @@ using namespace std; -//abstract sub class CComponentsItem from CComponents -CComponentsItem::CComponentsItem() -{ - //CComponentsItem - initVarItem(); - cc_item_type = CC_ITEMTYPE_BASE; -} - // y // x+------f-r-a-m-e-------+ // | | @@ -50,13 +42,21 @@ CComponentsItem::CComponentsItem() // | | // +--------width---------+ -void CComponentsItem::initVarItem() +//abstract sub class CComponentsItem from CComponents +CComponentsItem::CComponentsItem(CComponentsForm* parent) { - //CComponents + cc_item_type = CC_ITEMTYPE_BASE; cc_item_index = CC_NO_INDEX; cc_item_enabled = true; cc_item_selected = false; - cc_parent = NULL; + initParent(parent); +} + +void CComponentsItem::initParent(CComponentsForm* parent) +{ + cc_parent = parent; + if (cc_parent) + cc_parent->addCCItem(this); } // Paint container background in cc-items with shadow, background and frame. diff --git a/src/gui/components/cc_item_infobox.cpp b/src/gui/components/cc_item_infobox.cpp index 1a9490aab..30e41c234 100644 --- a/src/gui/components/cc_item_infobox.cpp +++ b/src/gui/components/cc_item_infobox.cpp @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012-2014, Thilo Graf 'dbt' Copyright (C) 2012, Michael Liebmann 'micha-bbg' License: GPL @@ -35,20 +35,16 @@ using namespace std; //sub class CComponentsInfoBox from CComponentsItem -CComponentsInfoBox::CComponentsInfoBox() +CComponentsInfoBox::CComponentsInfoBox( const int& x_pos, const int& y_pos, const int& w, const int& h, + std::string info_text, + const int mode, + Font* font_text, + CComponentsForm *parent, + bool has_shadow, + fb_pixel_t color_text, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { - //CComponentsInfoBox - initVarInfobox(); -} + cc_item_type = CC_ITEMTYPE_TEXT_INFOBOX; -CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const int w, const int h, - std::string info_text, const int mode, Font* font_text, - bool has_shadow, - fb_pixel_t color_text, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) -{ - //CComponentsInfoBox - initVarInfobox(); - x = x_pos; y = y_pos; width = w; @@ -62,23 +58,19 @@ CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const i ct_text_mode = mode; ct_font = font_text; ct_col_text = color_text; -} - -CComponentsInfoBox::~CComponentsInfoBox() -{ - delete pic; - delete cctext; -} - -void CComponentsInfoBox::initVarInfobox() -{ - cc_item_type = CC_ITEMTYPE_TEXT_INFOBOX; //CComponentsInfoBox pic = NULL; cctext = NULL; pic_name = ""; x_offset = 10; + initParent(parent); +} + +CComponentsInfoBox::~CComponentsInfoBox() +{ + delete pic; + delete cctext; } void CComponentsInfoBox::setPicture(const std::string& picture_name) diff --git a/src/gui/components/cc_item_infobox.h b/src/gui/components/cc_item_infobox.h index 362ab03a8..4e22c97ca 100644 --- a/src/gui/components/cc_item_infobox.h +++ b/src/gui/components/cc_item_infobox.h @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012-2014, Thilo Graf 'dbt' License: GPL @@ -52,8 +52,6 @@ class CComponentsInfoBox : public CComponentsText ///property: path or default name of displayed image std::string pic_default_name; - ///initialize all needed default attributes - void initVarInfobox(); ///paint picture, used in initVarInfobox() void paintPicture(); ///property: path or name of displayed image @@ -63,9 +61,11 @@ class CComponentsInfoBox : public CComponentsText ///object: internal used CTextBox object CComponentsText * cctext; - CComponentsInfoBox(); - CComponentsInfoBox( const int x_pos, const int y_pos, const int w, const int h, - std::string info_text = "", const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL, + CComponentsInfoBox( const int& x_pos = 0, const int& y_pos = 0, const int& w = 800, const int& h = 600, + std::string info_text = "", + const int mode = CTextBox::AUTO_WIDTH, + Font* font_text = NULL, + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_text = COL_MENUCONTENT_TEXT, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); diff --git a/src/gui/components/cc_item_picture.cpp b/src/gui/components/cc_item_picture.cpp index f7ea5f2b8..af793f0a7 100644 --- a/src/gui/components/cc_item_picture.cpp +++ b/src/gui/components/cc_item_picture.cpp @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012-2014, Thilo Graf 'dbt' Copyright (C) 2012, Michael Liebmann 'micha-bbg' License: GPL @@ -41,13 +41,20 @@ using namespace std; //------------------------------------------------------------------------------------------------------- //sub class CComponentsPicture from CComponentsItem CComponentsPicture::CComponentsPicture( const int &x_pos, const int &y_pos, const int &w, const int &h, - const std::string& image_name, const int &alignment, bool has_shadow, + const std::string& image_name, + const int &alignment, + CComponentsForm *parent, + bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow) { - init(x_pos, y_pos, w, h, image_name, alignment, has_shadow, color_frame, color_background, color_shadow); + init(x_pos, y_pos, w, h, image_name, alignment, parent, has_shadow, color_frame, color_background, color_shadow); } -void CComponentsPicture::init( const int &x_pos, const int &y_pos, const int &w, const int &h, const string& image_name, const int &alignment, bool has_shadow, +void CComponentsPicture::init( const int &x_pos, const int &y_pos, const int &w, const int &h, + const string& image_name, + const int &alignment, + CComponentsForm *parent, + bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow) { //CComponents, CComponentsItem @@ -79,6 +86,7 @@ void CComponentsPicture::init( const int &x_pos, const int &y_pos, const int &w, pic_width = pic_height = 0; initCCItem(); + initParent(parent); } void CComponentsPicture::setPicture(const std::string& picture_name) @@ -217,11 +225,14 @@ void CComponentsPicture::hide(bool no_restore) CComponentsChannelLogo::CComponentsChannelLogo( const int &x_pos, const int &y_pos, const int &w, const int &h, - const uint64_t& channelId, const std::string& channelName, - const int &alignment, bool has_shadow, + const uint64_t& channelId, + const std::string& channelName, + const int &alignment, + CComponentsForm *parent, + bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow) :CComponentsPicture(x_pos, y_pos, w, h, - "", alignment, has_shadow, + "", alignment, parent, has_shadow, color_frame, color_background, color_shadow) { channel_id = channelId; diff --git a/src/gui/components/cc_item_picture.h b/src/gui/components/cc_item_picture.h index 06c9bec27..149174e3d 100644 --- a/src/gui/components/cc_item_picture.h +++ b/src/gui/components/cc_item_picture.h @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012-2014, Thilo Graf 'dbt' Copyright (C) 2012, Michael Liebmann 'micha-bbg' License: GPL @@ -63,6 +63,7 @@ class CComponentsPicture : public CComponentsItem void init( const int &x_pos, const int &y_pos, const int &w, const int &h, const std::string& image_name, const int &alignment, + CComponentsForm *parent, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_background, @@ -78,6 +79,7 @@ class CComponentsPicture : public CComponentsItem CComponentsPicture( const int &x_pos, const int &y_pos, const int &w, const int &h, const std::string& image_name, const int &alignment = CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER, + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_background = 0, @@ -116,6 +118,7 @@ class CComponentsChannelLogo : public CComponentsPicture, CPictureViewer const uint64_t& channelId =0, const std::string& channelName = "", const int &alignment = CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER, + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_background = 0, diff --git a/src/gui/components/cc_item_progressbar.cpp b/src/gui/components/cc_item_progressbar.cpp index 8c5944a41..3aefc7363 100644 --- a/src/gui/components/cc_item_progressbar.cpp +++ b/src/gui/components/cc_item_progressbar.cpp @@ -2,7 +2,7 @@ Based up Neutrino-GUI - Tuxbox-Project Copyright (C) 2001 by Steffen Hehn 'McClean' - (C) 2008, 2013 by Thilo Graf + (C) 2008,2013,2014 by Thilo Graf (C) 2009,2010,2013 Stefan Seyfried License: GPL @@ -39,19 +39,16 @@ #define GREEN 0x00FF00 #define YELLOW 0xFFFF00 -CProgressBar::CProgressBar() -{ - initVarProgressbar(); -} - CProgressBar::CProgressBar( const int x_pos, const int y_pos, const int w, const int h, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow, const fb_pixel_t active_col, const fb_pixel_t passive_col, const bool blinkenlights, const int r, const int g, const int b, - const bool inv) + const bool inv, + CComponentsForm *parent) { - initVarProgressbar(); + //CComponentsItem + cc_item_type = CC_ITEMTYPE_PROGRESSBAR; //CComponents x = x_pos; @@ -70,24 +67,9 @@ CProgressBar::CProgressBar( const int x_pos, const int y_pos, const int w, const pb_yellow = b; pb_active_col = active_col; pb_passive_col = passive_col; -} - -void CProgressBar::initVarProgressbar() -{ - //CComponentsItem - cc_item_type = CC_ITEMTYPE_PROGRESSBAR; - - //CProgressBar - pb_blink = false; - pb_invert = false; pb_bl_changed = g_settings.progressbar_color; pb_last_width = -1; - pb_red = 40; - pb_green = 100; - pb_yellow = 70; - pb_active_col = COL_INFOBAR_PLUS_7; - pb_passive_col = COL_INFOBAR_PLUS_3; pb_value = 0; pb_max_value = 0; pb_paint_zero = false; @@ -100,7 +82,8 @@ void CProgressBar::initVarProgressbar() pb_height = 0; pb_start_x_passive = 0; pb_passive_width = width; -} + initParent(parent); +} //calculate bar dimensions void CProgressBar::initDimensions() @@ -138,7 +121,7 @@ void CProgressBar::initDimensions() void CProgressBar::paintShapes(int &shx, int ­, int &shw, int &shh, fb_pixel_t &col) { - CComponentsShapeSquare shape(shx, shy, shw, shh, false); + CComponentsShapeSquare shape(shx, shy, shw, shh, NULL, false); shape.setColorBody(col); shape.allowPaint(cc_allow_paint); shape.paint(false); diff --git a/src/gui/components/cc_item_progressbar.h b/src/gui/components/cc_item_progressbar.h index ecc074eee..515761b24 100644 --- a/src/gui/components/cc_item_progressbar.h +++ b/src/gui/components/cc_item_progressbar.h @@ -2,7 +2,7 @@ Based up Neutrino-GUI - Tuxbox-Project Copyright (C) 2001 by Steffen Hehn 'McClean' - (C) 2008, 2013 by Thilo Graf + (C) 2008,2013,2014 by Thilo Graf (C) 2009,2010,2013 Stefan Seyfried License: GPL @@ -50,7 +50,8 @@ #define __CC_PROGRESSBAR_H__ #include "config.h" -#include +#include "cc_base.h" + #include class CProgressBar : public CComponentsItem @@ -110,14 +111,14 @@ class CProgressBar : public CComponentsItem ///inv: false => red on the left side, true: red on right side. ///active_col, passive_col: sets colors for displayed values, activ_col means the the displayed progress ///color_frame, color_body, color_shadow: colores of progressbar for frame, body and shadow, Note: color of frame is ineffective on fr_thickness = 0 - CProgressBar(); - CProgressBar( const int x_pos, const int y_pos, + CProgressBar( const int x_pos = 0, const int y_pos = 0, const int w = -1, const int h = -1, fb_pixel_t color_frame = 0, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0, const fb_pixel_t active_col = COL_INFOBAR_PLUS_7, const fb_pixel_t passive_col = COL_INFOBAR_PLUS_3, const bool blinkenlights = false, const int r = 40, const int g = 100, const int b =70, - const bool inv = false ); + const bool inv = false, + CComponentsForm *parent = NULL); ///set up to display available values diff --git a/src/gui/components/cc_item_shapes.cpp b/src/gui/components/cc_item_shapes.cpp index 14393b610..c4acb6514 100644 --- a/src/gui/components/cc_item_shapes.cpp +++ b/src/gui/components/cc_item_shapes.cpp @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012-2014, Thilo Graf 'dbt' Copyright (C) 2012, Michael Liebmann 'micha-bbg' License: GPL @@ -35,7 +35,10 @@ using namespace std; //sub class CComponentsShapeSquare from CComponentsItem -CComponentsShapeSquare::CComponentsShapeSquare(const int x_pos, const int y_pos, const int w, const int h, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) +CComponentsShapeSquare::CComponentsShapeSquare( const int x_pos, const int y_pos, const int w, const int h, + CComponentsForm *parent, + bool has_shadow, + fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { //CComponentsItem cc_item_type = CC_ITEMTYPE_SHAPE_SQUARE; @@ -49,6 +52,7 @@ CComponentsShapeSquare::CComponentsShapeSquare(const int x_pos, const int y_pos, col_frame = color_frame; col_body = color_body; col_shadow = color_shadow; + initParent(parent); } void CComponentsShapeSquare::paint(bool do_save_bg) @@ -59,8 +63,10 @@ void CComponentsShapeSquare::paint(bool do_save_bg) //------------------------------------------------------------------------------------------------------- //sub class CComponentsShapeCircle from CComponentsItem -CComponentsShapeCircle::CComponentsShapeCircle( int x_pos, int y_pos, int diam, bool has_shadow, - fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) +CComponentsShapeCircle::CComponentsShapeCircle( int x_pos, int y_pos, int diam, + CComponentsForm *parent, + bool has_shadow, + fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { //CComponents, CComponentsItem cc_item_type = CC_ITEMTYPE_SHAPE_CIRCLE; @@ -80,6 +86,7 @@ CComponentsShapeCircle::CComponentsShapeCircle( int x_pos, int y_pos, int diam, //CComponentsItem corner_rad = d/2; + initParent(parent); } // y diff --git a/src/gui/components/cc_item_shapes.h b/src/gui/components/cc_item_shapes.h index e9e879033..db53d66ec 100644 --- a/src/gui/components/cc_item_shapes.h +++ b/src/gui/components/cc_item_shapes.h @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012-2014 Thilo Graf 'dbt' License: GPL @@ -43,7 +43,9 @@ class CComponentsShapeCircle : public CComponentsItem ///property: diam int d; public: - CComponentsShapeCircle( const int x_pos, const int y_pos, const int diam, bool has_shadow = CC_SHADOW_ON, + CComponentsShapeCircle( const int x_pos, const int y_pos, const int diam, + CComponentsForm *parent = NULL, + bool has_shadow = CC_SHADOW_ON, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); ///set property: diam @@ -58,7 +60,9 @@ class CComponentsShapeCircle : public CComponentsItem class CComponentsShapeSquare : public CComponentsItem { public: - CComponentsShapeSquare( const int x_pos, const int y_pos, const int w, const int h, bool has_shadow = CC_SHADOW_ON, + CComponentsShapeSquare( const int x_pos, const int y_pos, const int w, const int h, + CComponentsForm *parent = NULL, + bool has_shadow = CC_SHADOW_ON, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); diff --git a/src/gui/components/cc_item_text.cpp b/src/gui/components/cc_item_text.cpp index e681dbca5..f8aeb48de 100644 --- a/src/gui/components/cc_item_text.cpp +++ b/src/gui/components/cc_item_text.cpp @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012-2014, Thilo Graf 'dbt' Copyright (C) 2012, Michael Liebmann 'micha-bbg' License: GPL @@ -38,16 +38,11 @@ using namespace std; //sub class CComponentsText from CComponentsItem -CComponentsText::CComponentsText() -{ - //CComponentsText - initVarText(); - - initCCText(); -} - CComponentsText::CComponentsText( const int x_pos, const int y_pos, const int w, const int h, - std::string text, const int mode, Font* font_text, + std::string text, + const int mode, + Font* font_text, + CComponentsForm *parent, bool has_shadow, fb_pixel_t color_text, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { @@ -71,6 +66,7 @@ CComponentsText::CComponentsText( const int x_pos, const int y_pos, const int w, ct_col_text = color_text; initCCText(); + initParent(parent); } diff --git a/src/gui/components/cc_item_text.h b/src/gui/components/cc_item_text.h index 8d44d7f55..51e667337 100644 --- a/src/gui/components/cc_item_text.h +++ b/src/gui/components/cc_item_text.h @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012-2014, Thilo Graf 'dbt' License: GPL @@ -83,9 +83,11 @@ class CComponentsText : public CComponentsItem, public CBox ///paint CCItem backckrond (if paint_bg=true), apply initCCText() and send paint() to the CTextBox object void paintText(bool do_save_bg = CC_SAVE_SCREEN_YES); public: - CComponentsText(); - CComponentsText( const int x_pos, const int y_pos, const int w, const int h, - std::string text = "", const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL, + CComponentsText( const int x_pos = 10, const int y_pos = 10, const int w = 150, const int h = 50, + std::string text = "", + const int mode = CTextBox::AUTO_WIDTH, + Font* font_text = NULL, + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_text = COL_MENUCONTENT_TEXT, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); virtual ~CComponentsText(); @@ -151,10 +153,13 @@ class CComponentsLabel : public CComponentsText { public: CComponentsLabel( const int x_pos = 10, const int y_pos = 10, const int w = 150, const int h = 50, - std::string text = "", const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL, + std::string text = "", + const int mode = CTextBox::AUTO_WIDTH, + Font* font_text = NULL, + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_text = COL_MENUCONTENTINACTIVE_TEXT, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0) - :CComponentsText(x_pos, y_pos, w, h, text, mode, font_text, has_shadow, color_text, color_frame, color_body, color_shadow) + :CComponentsText(x_pos, y_pos, w, h, text, mode, font_text, parent, has_shadow, color_text, color_frame, color_body, color_shadow) { cc_item_type = CC_ITEMTYPE_LABEL; }; diff --git a/src/gui/components/cc_item_tvpic.cpp b/src/gui/components/cc_item_tvpic.cpp index 19dc1faa0..731b826a8 100644 --- a/src/gui/components/cc_item_tvpic.cpp +++ b/src/gui/components/cc_item_tvpic.cpp @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012-2014, Thilo Graf 'dbt' Copyright (C) 2012, Michael Liebmann 'micha-bbg' License: GPL @@ -40,7 +40,10 @@ using namespace std; //------------------------------------------------------------------------------------------------------- //sub class CComponentsPIP from CComponentsItem -CComponentsPIP::CComponentsPIP( const int x_pos, const int y_pos, const int percent, bool has_shadow) +CComponentsPIP::CComponentsPIP( const int x_pos, const int y_pos, const int percent, + CComponentsForm *parent, + bool has_shadow, + fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { //CComponents, CComponentsItem cc_item_type = CC_ITEMTYPE_PIP; @@ -58,9 +61,10 @@ CComponentsPIP::CComponentsPIP( const int x_pos, const int y_pos, const int perc height = percent*screen_h/100; shadow = has_shadow; shadow_w = SHADOW_OFFSET; - col_frame = COL_BACKGROUND; - col_body = COL_BACKGROUND; - col_shadow = COL_MENUCONTENTDARK_PLUS_0; + col_frame = color_frame; + col_body = color_body; + col_shadow = color_shadow; + initParent(parent); } CComponentsPIP::~CComponentsPIP() diff --git a/src/gui/components/cc_item_tvpic.h b/src/gui/components/cc_item_tvpic.h index fef5a23b8..9b881f60f 100644 --- a/src/gui/components/cc_item_tvpic.h +++ b/src/gui/components/cc_item_tvpic.h @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012-2014, Thilo Graf 'dbt' License: GPL @@ -50,7 +50,10 @@ class CComponentsPIP : public CComponentsItem std::string pic_name; public: ///constructor: initialize of position like all other items with x and y values, but dimensions in percent - CComponentsPIP( const int x_pos, const int y_pos, const int percent = 30, bool has_shadow = CC_SHADOW_OFF); + CComponentsPIP( const int x_pos = 0, const int y_pos = 0, const int percent = 30, + CComponentsForm *parent = NULL, + bool has_shadow = CC_SHADOW_OFF, + fb_pixel_t color_frame = COL_BACKGROUND, fb_pixel_t color_body = COL_BACKGROUND, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); ~CComponentsPIP(); ///set property: width of tv box in pixel diff --git a/src/gui/imageinfo.cpp b/src/gui/imageinfo.cpp index 297334d67..8675636e0 100644 --- a/src/gui/imageinfo.cpp +++ b/src/gui/imageinfo.cpp @@ -181,12 +181,11 @@ void CImageInfo::ShowWindow() { CComponentsFooter *footer = NULL; if (cc_win == NULL){ - cc_win = new CComponentsWindowMax(LOCALE_IMAGEINFO_HEAD, NEUTRINO_ICON_INFO, CC_SHADOW_ON); + cc_win = new CComponentsWindowMax(LOCALE_IMAGEINFO_HEAD, NEUTRINO_ICON_INFO, 0, CC_SHADOW_ON); cc_win->setWindowHeaderButtons(CComponentsHeader::CC_BTN_MENU | CComponentsHeader::CC_BTN_EXIT); footer = cc_win->getFooterObject(); footer->setColorBody(COL_INFOBAR_SHADOW_PLUS_1); - btn_red = new CComponentsButtonRed(10, CC_CENTERED, 250, footer->getHeight(), LOCALE_BUILDINFO_MENU, false , true, false, footer->getColorBody(), footer->getColorBody()); - footer->addCCItem(btn_red); + btn_red = new CComponentsButtonRed(10, CC_CENTERED, 250, footer->getHeight(), LOCALE_BUILDINFO_MENU, footer, false , true, false, footer->getColorBody(), footer->getColorBody()); } //prepare minitv diff --git a/src/gui/infoclock.cpp b/src/gui/infoclock.cpp index 0a96fad82..769276713 100644 --- a/src/gui/infoclock.cpp +++ b/src/gui/infoclock.cpp @@ -36,7 +36,7 @@ -CInfoClock::CInfoClock():CComponentsFrmClock( 0, 0, 0, 50, "%H:%M:%S", true, CC_SHADOW_ON, COL_LIGHT_GRAY, COL_MENUCONTENT_PLUS_0,COL_MENUCONTENTDARK_PLUS_0) +CInfoClock::CInfoClock():CComponentsFrmClock( 0, 0, 0, 50, "%H:%M:%S", true, NULL, CC_SHADOW_ON, COL_LIGHT_GRAY, COL_MENUCONTENT_PLUS_0,COL_MENUCONTENTDARK_PLUS_0) { initVarInfoClock(); } diff --git a/src/gui/luainstance.cpp b/src/gui/luainstance.cpp index 0b1dd8cb7..f5a4456c2 100644 --- a/src/gui/luainstance.cpp +++ b/src/gui/luainstance.cpp @@ -1337,7 +1337,7 @@ int CLuaInstance::CWindowNew(lua_State *L) CLuaCWindow **udata = (CLuaCWindow **) lua_newuserdata(L, sizeof(CLuaCWindow *)); *udata = new CLuaCWindow(); - (*udata)->w = new CComponentsWindow(x, y, dx, dy, name.c_str(), icon.c_str(), has_shadow, (fb_pixel_t)color_frame, (fb_pixel_t)color_body, (fb_pixel_t)color_shadow); + (*udata)->w = new CComponentsWindow(x, y, dx, dy, name.c_str(), icon.c_str(), 0, has_shadow, (fb_pixel_t)color_frame, (fb_pixel_t)color_body, (fb_pixel_t)color_shadow); CComponentsFooter* footer = (*udata)->w->getFooterObject(); if (footer) { @@ -1352,13 +1352,13 @@ int CLuaInstance::CWindowNew(lua_State *L) int btnh = footer->getHeight(); int start = 10; if (btnRed != "") - footer->addCCItem(new CComponentsButtonRed(start, CC_CENTERED, btnw, btnh, btnRed, false , true, false, col, col)); + footer->addCCItem(new CComponentsButtonRed(start, CC_CENTERED, btnw, btnh, btnRed, 0, false , true, false, col, col)); if (btnGreen != "") - footer->addCCItem(new CComponentsButtonGreen(start+=btnw, CC_CENTERED, btnw, btnh, btnGreen, false , true, false, col, col)); + footer->addCCItem(new CComponentsButtonGreen(start+=btnw, CC_CENTERED, btnw, btnh, btnGreen, 0, false , true, false, col, col)); if (btnYellow != "") - footer->addCCItem(new CComponentsButtonYellow(start+=btnw, CC_CENTERED, btnw, btnh, btnYellow, false , true, false, col, col)); + footer->addCCItem(new CComponentsButtonYellow(start+=btnw, CC_CENTERED, btnw, btnh, btnYellow, 0, false , true, false, col, col)); if (btnBlue != "") - footer->addCCItem(new CComponentsButtonBlue(start+=btnw, CC_CENTERED, btnw, btnh, btnBlue, false , true, false, col, col)); + footer->addCCItem(new CComponentsButtonBlue(start+=btnw, CC_CENTERED, btnw, btnh, btnBlue, 0, false , true, false, col, col)); } } @@ -1591,7 +1591,7 @@ int CLuaInstance::ComponentsTextNew(lua_State *L) CLuaComponentsText **udata = (CLuaComponentsText **) lua_newuserdata(L, sizeof(CLuaComponentsText *)); *udata = new CLuaComponentsText(); - (*udata)->ct = new CComponentsText(x, y, dx, dy, text, mode, g_Font[font_text], has_shadow, (fb_pixel_t)color_text, (fb_pixel_t)color_frame, (fb_pixel_t)color_body, (fb_pixel_t)color_shadow); + (*udata)->ct = new CComponentsText(x, y, dx, dy, text, mode, g_Font[font_text], NULL, has_shadow, (fb_pixel_t)color_text, (fb_pixel_t)color_frame, (fb_pixel_t)color_body, (fb_pixel_t)color_shadow); luaL_getmetatable(L, "ctext"); lua_setmetatable(L, -2); return 1; diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index b6a8efcba..5b758e3b8 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -374,7 +374,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) } else if (actionKey == "circle"){ if (circle == NULL) - circle = new CComponentsShapeCircle (100, 100, 100, false); + circle = new CComponentsShapeCircle (100, 100, 100, NULL, false); if (!circle->isPainted()) circle->paint(); @@ -384,7 +384,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) } else if (actionKey == "square"){ if (sq == NULL) - sq = new CComponentsShapeSquare (100, 220, 100, 100, false); + sq = new CComponentsShapeSquare (100, 220, 100, 100, NULL, false); if (!sq->isPainted()) sq->paint(); @@ -433,7 +433,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) CComponentsText *t2 = new CComponentsText(t1->getXPos()+t1->getWidth(), 0, 200, 50, "Text2", CTextBox::NO_AUTO_LINEBREAK | CTextBox::RIGHT); t2->setCorner(RADIUS_MID, CORNER_TOP_RIGHT); - form->addCCItem(t2); + form->addCCItem(t2); CComponentsShapeCircle *c1 = new CComponentsShapeCircle(28, 40, 28); c1->setColorBody(COL_RED); @@ -523,7 +523,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) else if (actionKey == "footer"){ int hh = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); if (footer == NULL){ - footer = new CComponentsFooter (100, 50, 500, hh, CComponentsHeader::CC_BTN_HELP | CComponentsHeader::CC_BTN_EXIT | CComponentsHeader::CC_BTN_MENU, true); + footer = new CComponentsFooter (100, 50, 500, hh, CComponentsHeader::CC_BTN_HELP | CComponentsHeader::CC_BTN_EXIT | CComponentsHeader::CC_BTN_MENU, NULL, true); int start = 5, btnw =90, btnh = 37; footer->addCCItem(new CComponentsButtonRed(start, 0, btnw, btnh, "Button1")); footer->addCCItem(new CComponentsButtonGreen(start+=btnw, 0, btnw, btnh, "Button2")); diff --git a/src/gui/timeosd.cpp b/src/gui/timeosd.cpp index e08164061..74af715f2 100644 --- a/src/gui/timeosd.cpp +++ b/src/gui/timeosd.cpp @@ -36,7 +36,7 @@ -CTimeOSD::CTimeOSD():CComponentsFrmClock( 0, 0, 0, 50, "%H:%M:%S", true, CC_SHADOW_ON, COL_LIGHT_GRAY, COL_MENUCONTENT_PLUS_0,COL_MENUCONTENTDARK_PLUS_0) +CTimeOSD::CTimeOSD():CComponentsFrmClock( 0, 0, 0, 50, "%H:%M:%S", true, NULL, CC_SHADOW_ON, COL_LIGHT_GRAY, COL_MENUCONTENT_PLUS_0,COL_MENUCONTENTDARK_PLUS_0) { Init(); } diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index c68ceae61..a0e154bad 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -181,7 +181,7 @@ void CMenuItem::paintItemCaption(const bool select_mode, const int &item_height, right_bg_col = COL_MENUCONTENTINACTIVE_TEXT; right_frame_col = COL_MENUCONTENTINACTIVE_TEXT; } - CComponentsShapeSquare col(stringstartposOption, y + 2, dx - stringstartposOption + x - 2, item_height - 4, false, right_frame_col, right_bg_col); + CComponentsShapeSquare col(stringstartposOption, y + 2, dx - stringstartposOption + x - 2, item_height - 4, NULL, false, right_frame_col, right_bg_col); col.setFrameThickness(3); col.setCorner(RADIUS_LARGE); col.paint(false); From 651c7e5426c38b8d45bb27cca212d1f10e311233 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Mon, 3 Mar 2014 13:12:46 +0400 Subject: [PATCH 059/225] zapit/src/femanager.cpp: determine if master has loop-linked frontends at link time --- src/zapit/include/zapit/frontend_c.h | 1 + src/zapit/src/femanager.cpp | 27 +++------------------------ 2 files changed, 4 insertions(+), 24 deletions(-) diff --git a/src/zapit/include/zapit/frontend_c.h b/src/zapit/include/zapit/frontend_c.h index 3155f1383..326c1ee01 100644 --- a/src/zapit/include/zapit/frontend_c.h +++ b/src/zapit/include/zapit/frontend_c.h @@ -139,6 +139,7 @@ class CFrontend TP_params currentTransponder; bool slave; fe_work_mode_t femode; + bool have_loop; int masterkey; fe_linkmap_t linkmap; int fenumber; diff --git a/src/zapit/src/femanager.cpp b/src/zapit/src/femanager.cpp index fc3e4be0f..fa66b2f91 100644 --- a/src/zapit/src/femanager.cpp +++ b/src/zapit/src/femanager.cpp @@ -393,12 +393,9 @@ void CFEManager::linkFrontends(bool init) unused_demux = 0; for(fe_map_iterator_t it = femap.begin(); it != femap.end(); it++) { CFrontend * fe = it->second; -#if 0 - if (fe->getInfo()->type != FE_QPSK) - fe->setMode(CFrontend::FE_MODE_INDEPENDENT); -#endif int femode = fe->getMode(); fe->slave = false; + fe->have_loop = false; fe->linkmap.clear(); if (femode == CFrontend::FE_MODE_MASTER) { INFO("Frontend #%d: is master", fe->fenumber); @@ -410,25 +407,14 @@ void CFEManager::linkFrontends(bool init) continue; if (fe2->getType() != fe->getType() || (fe2->getMaster() != fe->fenumber)) continue; -#if 0 - int mnum = fe2->getMaster(); - if (mnum != fe->fenumber) - continue; - CFrontend * mfe = getFE(mnum); - if (!mfe) { - INFO("Frontend %d: master %d not found", fe->fenumber, mnum); - continue; - } - mfe->linkmap.push_back(fe2); -#endif fe->linkmap.push_back(fe2); if (fe2->getMode() == CFrontend::FE_MODE_LINK_LOOP) { INFO("Frontend #%d: link to master %d as LOOP", fe2->fenumber, fe->fenumber); + fe->have_loop = true; } else { INFO("Frontend #%d: link to master %d as TWIN", fe2->fenumber, fe->fenumber); } - } } else if (femode == CFrontend::FE_MODE_LINK_LOOP) { INFO("Frontend #%d: is LOOP, master %d", fe->fenumber, fe->getMaster()); @@ -545,14 +531,7 @@ CFrontend * CFEManager::getFrontend(CZapitChannel * channel) } if (mfe->getMode() == CFrontend::FE_MODE_MASTER) { - bool have_loop = false; - for (unsigned int i = 0; i < mfe->linkmap.size(); i++) { - CFrontend * fe = mfe->linkmap[i]; - if (fe->getMode() == CFrontend::FE_MODE_LINK_LOOP) { - have_loop = true; - break; - } - } + bool have_loop = mfe->have_loop; CFrontend * free_frontend = NULL; CFrontend * free_twin = NULL; bool loop_busy = false; From 33caf8edca630370405c4ead1b141b5ec05bd1f4 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Mon, 3 Mar 2014 14:30:35 +0400 Subject: [PATCH 060/225] Revert "deutsch, english, nederlands locale: little change for twin, independent modes:" This reverts commit 8beb80c24663ac6fc86475185d0cf6ba266e8057. --- data/locale/deutsch.locale | 4 ++-- data/locale/english.locale | 4 ++-- data/locale/nederlands.locale | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 83c0f78ce..e5e742691 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -1751,9 +1751,9 @@ satsetup.fastscan_prov_tvv TV Vlaanderen satsetup.fastscan_sd nur SD satsetup.fastscan_type Scantyp satsetup.fe_mode Tuner Modus -satsetup.fe_mode_independent Independent / TWIN Monoblock +satsetup.fe_mode_independent Independent satsetup.fe_mode_link_loop Loop -satsetup.fe_mode_link_twin TWIN LNB +satsetup.fe_mode_link_twin TWIN satsetup.fe_mode_master Master satsetup.fe_mode_unused Nicht genutzt satsetup.fe_setup Tuner Einstellungen diff --git a/data/locale/english.locale b/data/locale/english.locale index 42226686d..fc08b9c6b 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -1751,9 +1751,9 @@ satsetup.fastscan_prov_tvv TV Vlaanderen satsetup.fastscan_sd SD only satsetup.fastscan_type Scan type satsetup.fe_mode Tuner mode -satsetup.fe_mode_independent Independent / TWIN Monoblock +satsetup.fe_mode_independent Independent satsetup.fe_mode_link_loop Loop -satsetup.fe_mode_link_twin TWIN LNB +satsetup.fe_mode_link_twin TWIN satsetup.fe_mode_master Master satsetup.fe_mode_unused Unused satsetup.fe_setup Setup tuner diff --git a/data/locale/nederlands.locale b/data/locale/nederlands.locale index 67732d156..6d0d1d789 100644 --- a/data/locale/nederlands.locale +++ b/data/locale/nederlands.locale @@ -1618,9 +1618,9 @@ satsetup.fastscan_type Scantype satsetup.fe_mode Tuner mode satsetup.fe_mode Tuner modus satsetup.fe_mode_alone Onafhankelijk -satsetup.fe_mode_independent Onafhankelijk / TWIN Monoblock +satsetup.fe_mode_independent Onafhankelijk satsetup.fe_mode_link_loop Doorgelust -satsetup.fe_mode_link_twin Twin LNB +satsetup.fe_mode_link_twin Twin satsetup.fe_mode_loop Doorgelust satsetup.fe_mode_master Master satsetup.fe_mode_single Single From 06f31f9655de827b2ccdb0c3a247cfd758d6d772 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Mon, 3 Mar 2014 14:40:30 +0400 Subject: [PATCH 061/225] zapit/src/femanager.cpp: add have_rotor flag, limit check for the same position to frontend with configured rotor (usals or rotor positions enable). this should allow TWIN multisat setups --- src/zapit/include/zapit/femanager.h | 1 - src/zapit/include/zapit/frontend_c.h | 1 + src/zapit/src/femanager.cpp | 35 ++++++++++------------------ 3 files changed, 13 insertions(+), 24 deletions(-) diff --git a/src/zapit/include/zapit/femanager.h b/src/zapit/include/zapit/femanager.h index 56220b31a..0eb2d3d3b 100644 --- a/src/zapit/include/zapit/femanager.h +++ b/src/zapit/include/zapit/femanager.h @@ -118,7 +118,6 @@ class CFEManager CFrontend * allocateFE(CZapitChannel * channel, bool forrecord = false); fe_mode_t getMode() { return mode; }; - void setMode(fe_mode_t newmode, bool initial = false); int getFrontendCount() { return femap.size(); }; int getEnabledCount(); diff --git a/src/zapit/include/zapit/frontend_c.h b/src/zapit/include/zapit/frontend_c.h index 326c1ee01..f1344a368 100644 --- a/src/zapit/include/zapit/frontend_c.h +++ b/src/zapit/include/zapit/frontend_c.h @@ -140,6 +140,7 @@ class CFrontend bool slave; fe_work_mode_t femode; bool have_loop; + bool have_rotor; int masterkey; fe_linkmap_t linkmap; int fenumber; diff --git a/src/zapit/src/femanager.cpp b/src/zapit/src/femanager.cpp index fa66b2f91..1ecf4a614 100644 --- a/src/zapit/src/femanager.cpp +++ b/src/zapit/src/femanager.cpp @@ -396,9 +396,9 @@ void CFEManager::linkFrontends(bool init) int femode = fe->getMode(); fe->slave = false; fe->have_loop = false; + fe->have_rotor = false; fe->linkmap.clear(); if (femode == CFrontend::FE_MODE_MASTER) { - INFO("Frontend #%d: is master", fe->fenumber); fe->linkmap.push_back(fe); /* fe is master, find all linked */ for(fe_map_iterator_t it2 = femap.begin(); it2 != femap.end(); it2++) { @@ -416,6 +416,16 @@ void CFEManager::linkFrontends(bool init) INFO("Frontend #%d: link to master %d as TWIN", fe2->fenumber, fe->fenumber); } } + frontend_config_t & fe_config = fe->getConfig(); + satellite_map_t &satellites = fe->getSatellites(); + for(sat_iterator_t sit = satellites.begin(); sit != satellites.end(); ++sit) { + if (fe_config.use_usals || (sit->second.configured && (sit->second.motor_position || sit->second.use_usals))) { + fe->have_rotor = true; + break; + } + } + INFO("Frontend #%d: is master, with loop: %s, with rotor: %s", fe->fenumber, + fe->have_loop ? "yes" : "no", fe->have_rotor ? "yes" : "no"); } else if (femode == CFrontend::FE_MODE_LINK_LOOP) { INFO("Frontend #%d: is LOOP, master %d", fe->fenumber, fe->getMaster()); if (init) @@ -436,27 +446,6 @@ void CFEManager::linkFrontends(bool init) } } -#if 0 -void CFEManager::setMode(fe_mode_t newmode, bool initial) -{ - if(!initial && (newmode == mode)) - return; - - mode = newmode; - if(femap.size() == 1) - mode = FE_MODE_SINGLE; - - bool setslave = (mode == FE_MODE_LOOP) || (mode == FE_MODE_SINGLE); - for(fe_map_iterator_t it = femap.begin(); it != femap.end(); it++) { - CFrontend * fe = it->second; - if(it != femap.begin()) { - INFO("Frontend %d as slave: %s", fe->fenumber, setslave ? "yes" : "no"); - fe->setMasterSlave(setslave); - } else - fe->Init(); - } -} -#endif void CFEManager::Open() { for(fe_map_iterator_t it = femap.begin(); it != femap.end(); it++) { @@ -541,7 +530,7 @@ CFrontend * CFEManager::getFrontend(CZapitChannel * channel) fe->Locked(), fe->getFrequency(), fe->getTsidOnid(), channel->getFreqId(), channel->getTransponderId()); if(fe->Locked()) { - if (fe->isSat() && (fe->getCurrentSatellitePosition() != satellitePosition)) { + if (mfe->have_rotor && (fe->getCurrentSatellitePosition() != satellitePosition)) { free_frontend = NULL; free_twin = NULL; break; From 409df1b8096b2b742008f641904b9e59416375a2 Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Sun, 2 Mar 2014 14:20:13 +0100 Subject: [PATCH 062/225] src/system/helpers.cpp - htmlEntityDecode(): Add various html codes --- src/system/helpers.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp index 3ab043b44..4e1152323 100644 --- a/src/system/helpers.cpp +++ b/src/system/helpers.cpp @@ -425,12 +425,19 @@ std::string& htmlEntityDecode(std::string& text) }; decode_table dt[] = { - {" ", " "}, + {" ", " "}, {"&", "&"}, {"<", "<"}, {">", ">"}, {"\"", """}, {"'", "'"}, + {"€", "€"}, + {"–", "–"}, + {"“", "“"}, + {"”", "”"}, + {"„", "„"}, + {"•", "•"}, + {"…", "…"}, {NULL, NULL} }; for (int i = 0; dt[i].code != NULL; i++) From c0245159f4bfd6ee76e9b659314d89dbe92061cf Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Mon, 3 Mar 2014 08:20:30 +0100 Subject: [PATCH 063/225] CPluginList: Supplement to commit cf43a6f (RC_setup for exit all menus) --- src/gui/pluginlist.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/pluginlist.cpp b/src/gui/pluginlist.cpp index 2f28c53e2..92af63578 100644 --- a/src/gui/pluginlist.cpp +++ b/src/gui/pluginlist.cpp @@ -116,11 +116,11 @@ int CPluginList::exec(CMenuTarget* parent, const std::string &actionKey) m.addItem(f); } } - m.exec(NULL, ""); + int res = m.exec(NULL, ""); m.hide(); selected = m.getSelected(); - return menu_return::RETURN_REPAINT; + return res; } CPluginChooser::CPluginChooser(const neutrino_locale_t Name, const uint32_t listtype, std::string &selectedFile) : CPluginList(Name, listtype) From d1b8246316bb0d4e7776664031e4d40319feeda4 Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Mon, 3 Mar 2014 19:33:24 +0100 Subject: [PATCH 064/225] CComponents: More precise error message (commit f813b9e) --- src/gui/components/cc_base.cpp | 34 ++++++++++++++++++++++------------ src/gui/components/cc_base.h | 2 +- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/src/gui/components/cc_base.cpp b/src/gui/components/cc_base.cpp index f140cf0ad..1b180ff3b 100644 --- a/src/gui/components/cc_base.cpp +++ b/src/gui/components/cc_base.cpp @@ -78,17 +78,27 @@ void CComponents::clearSavedScreen() saved_screen.pixbuf = NULL; } -bool CComponents::CheckFbData(const comp_fbdata_t& fbdata) +bool CComponents::CheckFbData(const comp_fbdata_t& fbdata, const char* func, const int line) { - if ( (fbdata.x <= 0 || fbdata.y <= 0) || - (fbdata.dx == 0 || fbdata.dy == 0) || - (fbdata.dx > (int32_t)frameBuffer->getScreenWidth(true) || fbdata.dy > (int32_t)frameBuffer->getScreenHeight(true))){ - printf("\33[31m\t[CComponents] WARNING! Position <= 0 [%s - %d]\n\tx = %d y = %d\n\tdx = %d dy = %d\n\033[37m", - __func__, __LINE__, - fbdata.x, fbdata.y, - fbdata.dx, fbdata.dy); - return false; - } + int32_t rows = fbdata.dx / (int32_t)frameBuffer->getScreenWidth(true) - 1 + fbdata.y; + int32_t rest = fbdata.dx % (int32_t)frameBuffer->getScreenWidth(true); + int32_t end = rows * (int32_t)frameBuffer->getScreenWidth(true) + rest; + if ( (fbdata.x < 0 || fbdata.y < 0) || + (end >= (int32_t)frameBuffer->getScreenWidth(true)*(int32_t)frameBuffer->getScreenHeight(true)) + ) { + printf("\33[31m\t[CComponents] ERROR! Position < 0 or > FB end [%s - %d]\n\tx = %d y = %d\n\tdx = %d dy = %d\n\33[0m", + func, line, + fbdata.x, fbdata.y, + fbdata.dx, fbdata.dy); + return false; + } + if (fbdata.dx == 0 || fbdata.dy == 0) { + printf("\33[33m\t[CComponents] WARNING! dx and/or dy = 0 [%s - %d]\n\tx = %d y = %d\n\tdx = %d dy = %d\n\33[0m", + func, line, + fbdata.x, fbdata.y, + fbdata.dx, fbdata.dy); + return false; + } return true; } @@ -98,7 +108,7 @@ void CComponents::paintFbItems(bool do_save_bg) //save background before first paint, do_save_bg must be true if (firstPaint && do_save_bg){ for(size_t i=0; i Date: Tue, 4 Mar 2014 07:07:45 +0100 Subject: [PATCH 065/225] CTimerList: Fix eventType CTimerd::TIMER_EXEC_PLUGIN --- src/gui/timerlist.cpp | 9 +++++---- src/gui/timerlist.h | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index 3aafcd90b..00b4ac109 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -263,6 +263,7 @@ CTimerList::CTimerList() Timer = new CTimerdClient(); skipEventID=0; timerNew_message = ""; + timerNew_pluginName = ""; /* most probable default */ saved_dispmode = (int)CVFD::MODE_TVRADIO; @@ -343,9 +344,9 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey) data = (void*)timerNew_message.c_str(); else if (timerNew.eventType==CTimerd::TIMER_EXEC_PLUGIN) { - if (strcmp(timerNew.pluginName, "---") == 0) + if (timerNew_pluginName == "---") return menu_return::RETURN_REPAINT; - data= timerNew.pluginName; + data = (void*)timerNew_pluginName.c_str(); } if (timerNew.eventRepeat >= CTimerd::TIMERREPEAT_WEEKDAYS) Timer->getWeekdaysFromStr(&timerNew.eventRepeat, m_weekdaysStr); @@ -1224,13 +1225,13 @@ int CTimerList::newTimer() CStringInputSMS timerSettings_msg(LOCALE_TIMERLIST_MESSAGE, &timerNew_message, 30, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789-.,:!?/ "); CMenuForwarder *m9 = new CMenuForwarder(LOCALE_TIMERLIST_MESSAGE, false, timerNew_message, &timerSettings_msg ); - std::string timerNew_pluginName("---"); + timerNew_pluginName = "---"; CPluginChooser plugin_chooser(LOCALE_TIMERLIST_PLUGIN, CPlugins::P_TYPE_SCRIPT | CPlugins::P_TYPE_TOOL #if ENABLE_LUA | CPlugins::P_TYPE_LUA #endif , timerNew_pluginName); - CMenuForwarder *m10 = new CMenuForwarder(LOCALE_TIMERLIST_PLUGIN, false, timerNew.pluginName, &plugin_chooser); + CMenuForwarder *m10 = new CMenuForwarder(LOCALE_TIMERLIST_PLUGIN, false, timerNew_pluginName, &plugin_chooser); CTimerListNewNotifier notifier2((int *)&timerNew.eventType, diff --git a/src/gui/timerlist.h b/src/gui/timerlist.h index c05c7f486..137eb6286 100644 --- a/src/gui/timerlist.h +++ b/src/gui/timerlist.h @@ -66,7 +66,8 @@ class CTimerList : public CMenuTarget std::string timerNew_channel_name; std::string m_weekdaysStr; std::string timerNew_message; - + std::string timerNew_pluginName; + int timer_apids_dflt; int timer_apids_std; int timer_apids_ac3; From e6a004be87856667bd6f7aae72907d4b89ccfa5b Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 5 Mar 2014 12:10:17 +0100 Subject: [PATCH 066/225] CComponents: remove error message. Log output should be enough. --- src/gui/components/cc_base.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/gui/components/cc_base.cpp b/src/gui/components/cc_base.cpp index 1b180ff3b..3d913b920 100644 --- a/src/gui/components/cc_base.cpp +++ b/src/gui/components/cc_base.cpp @@ -109,7 +109,6 @@ void CComponents::paintFbItems(bool do_save_bg) if (firstPaint && do_save_bg){ for(size_t i=0; i Date: Thu, 6 Mar 2014 09:59:18 +0100 Subject: [PATCH 067/225] - hdd_menu: fix hdd_sleep 'off' --- src/gui/hdd_menu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/hdd_menu.cpp b/src/gui/hdd_menu.cpp index 7b9e0c734..d86051395 100644 --- a/src/gui/hdd_menu.cpp +++ b/src/gui/hdd_menu.cpp @@ -326,7 +326,7 @@ int CHDDDestExec::exec(CMenuTarget* /*parent*/, const std::string&) const char hdidle[] = "/sbin/hd-idle"; bool have_hdidle = !access(hdidle, X_OK); - if (g_settings.hdd_sleep < 60) + if (g_settings.hdd_sleep > 0 && g_settings.hdd_sleep < 60) g_settings.hdd_sleep = 60; if (have_hdidle) { From 7c19f53e4b2757b379c7d9b6c076ebbef623c3fe Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Thu, 6 Mar 2014 12:45:48 +0100 Subject: [PATCH 068/225] - user_menu: add some pointers to delete --- src/gui/user_menue.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/user_menue.cpp b/src/gui/user_menue.cpp index e76c25ee5..91e1aed20 100644 --- a/src/gui/user_menue.cpp +++ b/src/gui/user_menue.cpp @@ -462,7 +462,9 @@ bool CUserMenu::showUserMenu(int button) if (imageinfo) delete imageinfo; if (boxinfo) delete boxinfo; if (games) delete games; + if (tools) delete tools; if (scripts) delete scripts; + if (lua) delete lua; if (menu) delete menu; InfoClock->enableInfoClock(true); From a05121d9b79818aa84a56cba9cb491b35e91e83c Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Thu, 6 Mar 2014 12:56:24 +0100 Subject: [PATCH 069/225] - user_menue.cpp: whitespace cleanup --- src/gui/user_menue.cpp | 64 +++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/src/gui/user_menue.cpp b/src/gui/user_menue.cpp index 91e1aed20..1149754df 100644 --- a/src/gui/user_menue.cpp +++ b/src/gui/user_menue.cpp @@ -108,14 +108,14 @@ bool CUserMenu::showUserMenu(int button) int menu_prev = -1; // define classes - CFavorites* tmpFavorites = NULL; - CAudioSelectMenuHandler* tmpAudioSelectMenuHandler = NULL; - CMenuWidget* tmpNVODSelector = NULL; + CFavorites* tmpFavorites = NULL; + CAudioSelectMenuHandler* tmpAudioSelectMenuHandler = NULL; + CMenuWidget* tmpNVODSelector = NULL; CSubChannelSelectMenu subchanselect; CStreamInfo2 * streamInfo = NULL; - CEventListHandler* tmpEventListHandler = NULL; - CEPGplusHandler* tmpEPGplusHandler = NULL; - CEPGDataHandler* tmpEPGDataHandler = NULL; + CEventListHandler* tmpEventListHandler = NULL; + CEPGplusHandler* tmpEPGplusHandler = NULL; + CEPGDataHandler* tmpEPGDataHandler = NULL; CTimerList* Timerlist = NULL; CRCLock *rcLock = NULL; CStreamFeaturesChangeExec *StreamFeaturesChanger = NULL; @@ -140,7 +140,7 @@ bool CUserMenu::showUserMenu(int button) if ( txt.empty() ) txt = g_Locale->getText(caption); - CMenuWidget *menu = new CMenuWidget(txt.c_str() , user_menu[button].menu_icon_def, width); + CMenuWidget *menu = new CMenuWidget(txt.c_str(), user_menu[button].menu_icon_def, width); if (menu == NULL) return 0; @@ -211,7 +211,7 @@ bool CUserMenu::showUserMenu(int button) menu_prev = SNeutrinoSettings::ITEM_REMOTE; keyhelper.get(&key,&icon,feat_key[g_settings.personalize[SNeutrinoSettings::P_FEAT_KEY_RC_LOCK]].key); //CRCInput::RC_nokey); rcLock = new CRCLock(); - menu_item = new CMenuForwarder(LOCALE_RCLOCK_MENUEADD, true, NULL, rcLock, "-1" , key, icon ); + menu_item = new CMenuForwarder(LOCALE_RCLOCK_MENUEADD, true, NULL, rcLock, "-1", key, icon ); menu->addItem(menu_item, false); break; @@ -220,7 +220,7 @@ bool CUserMenu::showUserMenu(int button) menu_prev = SNeutrinoSettings::ITEM_EPG_SUPER; tmpEPGplusHandler = new CEPGplusHandler(); keyhelper.get(&key,&icon,CRCInput::RC_green); - menu_item = new CMenuForwarder(LOCALE_EPGMENU_EPGPLUS , true, NULL, tmpEPGplusHandler , "-1", key, icon); + menu_item = new CMenuForwarder(LOCALE_EPGMENU_EPGPLUS, true, NULL, tmpEPGplusHandler, "-1", key, icon); menu->addItem(menu_item, false); break; @@ -229,7 +229,7 @@ bool CUserMenu::showUserMenu(int button) menu_prev = SNeutrinoSettings::ITEM_EPG_LIST; tmpEventListHandler = new CEventListHandler(); keyhelper.get(&key,&icon,CRCInput::RC_red); - menu_item = new CMenuForwarder(LOCALE_EPGMENU_EVENTLIST , true, NULL, tmpEventListHandler, "-1", key, icon); + menu_item = new CMenuForwarder(LOCALE_EPGMENU_EVENTLIST, true, NULL, tmpEventListHandler, "-1", key, icon); menu->addItem(menu_item, false); break; @@ -238,7 +238,7 @@ bool CUserMenu::showUserMenu(int button) menu_prev = SNeutrinoSettings::ITEM_EPG_INFO; tmpEPGDataHandler = new CEPGDataHandler(); keyhelper.get(&key,&icon,CRCInput::RC_yellow); - menu_item = new CMenuForwarder(LOCALE_EPGMENU_EVENTINFO , true, NULL, tmpEPGDataHandler , "-1", key, icon); + menu_item = new CMenuForwarder(LOCALE_EPGMENU_EVENTINFO, true, NULL, tmpEPGDataHandler, "-1", key, icon); menu->addItem(menu_item, false); break; @@ -248,7 +248,7 @@ bool CUserMenu::showUserMenu(int button) dummy = g_Sectionsd->getIsScanningActive(); //dummy = sectionsd_scanning; keyhelper.get(&key,&icon); - menu_item = new CMenuOptionChooser(LOCALE_MAINMENU_PAUSESECTIONSD, &dummy, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this , key, icon ); + menu_item = new CMenuOptionChooser(LOCALE_MAINMENU_PAUSESECTIONSD, &dummy, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this, key, icon ); menu->addItem(menu_item, false); menu_items++; keyhelper.get(&key,&icon); @@ -349,7 +349,7 @@ bool CUserMenu::showUserMenu(int button) menu_prev = SNeutrinoSettings::ITEM_PLUGIN_TYPES; neutrino_msg_t d_key = g_PluginList->getKey(count); //printf("[neutrino usermenu] plugin %d, set key %d...\n", count, g_PluginList->getKey(count)); - StreamFeaturesChanger = new CStreamFeaturesChangeExec(); + StreamFeaturesChanger = new CStreamFeaturesChangeExec(); keyhelper.get(&key,&icon, d_key); menu_item = new CMenuForwarder(g_PluginList->getName(count), true, NULL, StreamFeaturesChanger, id, key, icon); menu->addItem(menu_item, 0); @@ -363,7 +363,7 @@ bool CUserMenu::showUserMenu(int button) menu_items++; menu_prev = SNeutrinoSettings::ITEM_VTXT; keyhelper.get(&key,&icon, feat_key[g_settings.personalize[SNeutrinoSettings::P_FEAT_KEY_VTXT]].key); //CRCInput::RC_blue - StreamFeaturesChanger = new CStreamFeaturesChangeExec(); + StreamFeaturesChanger = new CStreamFeaturesChangeExec(); menu_item = new CMenuForwarder(LOCALE_USERMENU_ITEM_VTXT, true, NULL, StreamFeaturesChanger, "teletext", key, icon); menu->addItem(menu_item, 0); break; @@ -372,7 +372,7 @@ bool CUserMenu::showUserMenu(int button) menu_prev = SNeutrinoSettings::ITEM_IMAGEINFO; imageinfo = new CImageInfo(); keyhelper.get(&key,&icon); - menu->addItem(new CMenuForwarder(LOCALE_SERVICEMENU_IMAGEINFO, true, NULL, imageinfo, NULL, key, icon ), false); + menu->addItem(new CMenuForwarder(LOCALE_SERVICEMENU_IMAGEINFO, true, NULL, imageinfo, NULL, key, icon ), false); break; case SNeutrinoSettings::ITEM_BOXINFO: menu_items++; @@ -449,23 +449,23 @@ bool CUserMenu::showUserMenu(int button) user_menu[button].selected = menu->getSelected(); // clear the heap - if (tmpFavorites) delete tmpFavorites; - if (tmpAudioSelectMenuHandler) delete tmpAudioSelectMenuHandler; - if (tmpNVODSelector) delete tmpNVODSelector; - if (streamInfo) delete streamInfo; - if (tmpEventListHandler) delete tmpEventListHandler; - if (tmpEPGplusHandler) delete tmpEPGplusHandler; - if (tmpEPGDataHandler) delete tmpEPGDataHandler; - if (Timerlist) delete Timerlist; - if (rcLock) delete rcLock; - if (StreamFeaturesChanger) delete StreamFeaturesChanger; - if (imageinfo) delete imageinfo; - if (boxinfo) delete boxinfo; - if (games) delete games; - if (tools) delete tools; - if (scripts) delete scripts; - if (lua) delete lua; - if (menu) delete menu; + if (tmpFavorites) delete tmpFavorites; + if (tmpAudioSelectMenuHandler) delete tmpAudioSelectMenuHandler; + if (tmpNVODSelector) delete tmpNVODSelector; + if (streamInfo) delete streamInfo; + if (tmpEventListHandler) delete tmpEventListHandler; + if (tmpEPGplusHandler) delete tmpEPGplusHandler; + if (tmpEPGDataHandler) delete tmpEPGDataHandler; + if (Timerlist) delete Timerlist; + if (rcLock) delete rcLock; + if (StreamFeaturesChanger) delete StreamFeaturesChanger; + if (imageinfo) delete imageinfo; + if (boxinfo) delete boxinfo; + if (games) delete games; + if (tools) delete tools; + if (scripts) delete scripts; + if (lua) delete lua; + if (menu) delete menu; InfoClock->enableInfoClock(true); From 1b450382e61e392755516bc28adf6074fe9c70e8 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Tue, 4 Mar 2014 11:09:14 +0400 Subject: [PATCH 070/225] zapit/data/frontend.conf: remove config for fe1 --- src/zapit/data/frontend.conf | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/zapit/data/frontend.conf b/src/zapit/data/frontend.conf index 013cef302..9f5939a13 100644 --- a/src/zapit/data/frontend.conf +++ b/src/zapit/data/frontend.conf @@ -8,13 +8,3 @@ fe0_satellites=192 fe0_uni_qrg=0 fe0_uni_scr=-1 fe0_mode=1 -fe1_diseqcRepeats=0 -fe1_diseqcType=0 -fe1_highVoltage=0 -fe1_lastSatellitePosition=360 -fe1_motorRotationSpeed=18 -fe1_position_192=192,-1,-1,-1,0,0,9750,10600,11700,0,0,1 -fe1_satellites=192 -fe1_uni_qrg=0 -fe1_uni_scr=-1 -fe1_mode=0 From af99ce3a28110ef85b6e98dae1cd172781e74f05 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Tue, 4 Mar 2014 12:22:17 +0400 Subject: [PATCH 071/225] zapit/src/femanager.cpp: add per frontend rotor swap option --- src/zapit/include/zapit/frontend_c.h | 1 + src/zapit/include/zapit/frontend_types.h | 1 + src/zapit/src/femanager.cpp | 2 ++ 3 files changed, 4 insertions(+) diff --git a/src/zapit/include/zapit/frontend_c.h b/src/zapit/include/zapit/frontend_c.h index f1344a368..5ae39ae59 100644 --- a/src/zapit/include/zapit/frontend_c.h +++ b/src/zapit/include/zapit/frontend_c.h @@ -180,6 +180,7 @@ class CFrontend static fe_modulation_t getModulation(const uint8_t modulation); uint8_t getPolarization(void) const; const struct dvb_frontend_info *getInfo(void) const { return &info; }; + bool getRotorSwap() { return config.rotor_swap; } uint32_t getBitErrorRate(void) const; uint16_t getSignalNoiseRatio(void) const; diff --git a/src/zapit/include/zapit/frontend_types.h b/src/zapit/include/zapit/frontend_types.h index eb0a85e89..409f981dd 100644 --- a/src/zapit/include/zapit/frontend_types.h +++ b/src/zapit/include/zapit/frontend_types.h @@ -39,6 +39,7 @@ typedef struct frontend_config { int highVoltage; int diseqc_order; int use_usals; + int rotor_swap; } frontend_config_t; #endif // __FRONTEND_TYPES_H__ diff --git a/src/zapit/src/femanager.cpp b/src/zapit/src/femanager.cpp index 1ecf4a614..9838b8ade 100644 --- a/src/zapit/src/femanager.cpp +++ b/src/zapit/src/femanager.cpp @@ -243,6 +243,7 @@ bool CFEManager::loadSettings() fe_config.uni_qrg = getConfigValue(fe, "uni_qrg", 0); fe_config.diseqc_order = getConfigValue(fe, "diseqc_order", UNCOMMITED_FIRST); fe_config.use_usals = getConfigValue(fe, "use_usals", 0); + fe_config.rotor_swap = getConfigValue(fe, "rotor_swap", 0); fe->setRotorSatellitePosition(getConfigValue(fe, "lastSatellitePosition", 0)); @@ -334,6 +335,7 @@ void CFEManager::saveSettings(bool write) setConfigValue(fe, "uni_qrg", fe_config.uni_qrg); setConfigValue(fe, "diseqc_order", fe_config.diseqc_order); setConfigValue(fe, "use_usals", fe_config.use_usals); + setConfigValue(fe, "rotor_swap", fe_config.rotor_swap); setConfigValue(fe, "lastSatellitePosition", fe->getRotorSatellitePosition()); setConfigValue(fe, "mode", fe->getMode()); setConfigValue(fe, "master", fe->getMaster()); From 929eb8676022ef5efd9b0790e5564205d6dd86b8 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Tue, 4 Mar 2014 12:22:47 +0400 Subject: [PATCH 072/225] gui/scan_setup.cpp, gui/motorcontrol.cpp: use per frontend rotor swap option --- src/gui/motorcontrol.cpp | 9 +++++---- src/gui/motorcontrol.h | 1 + src/gui/scan_setup.cpp | 5 +++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/gui/motorcontrol.cpp b/src/gui/motorcontrol.cpp index 1eca47b51..04c5c54d7 100644 --- a/src/gui/motorcontrol.cpp +++ b/src/gui/motorcontrol.cpp @@ -90,6 +90,7 @@ void CMotorControl::Init(void) satellitePosition = 0; stepDelay = 10; signalbox = NULL; + rotor_swap = frontend->getRotorSwap(); } int CMotorControl::exec(CMenuTarget* parent, const std::string &) @@ -197,7 +198,7 @@ int CMotorControl::exec(CMenuTarget* parent, const std::string &) else if (msg == CRCInput::RC_4) { if (installerMenue) { printf("[motorcontrol] 4 key received... set west (soft) limit\n"); - if(g_settings.rotor_swap) lim_cmd = 0x66; + if(rotor_swap) lim_cmd = 0x66; else lim_cmd = 0x67; g_Zapit->sendMotorCommand(0xE1, 0x31, lim_cmd, 0, 0, 0); //g_Zapit->tune_TP(TP); @@ -233,7 +234,7 @@ int CMotorControl::exec(CMenuTarget* parent, const std::string &) else if (msg == CRCInput::RC_6) { if (installerMenue) { printf("[motorcontrol] 6 key received... set east (soft) limit\n"); - if(g_settings.rotor_swap) lim_cmd = 0x67; + if(rotor_swap) lim_cmd = 0x67; else lim_cmd = 0x66; g_Zapit->sendMotorCommand(0xE1, 0x31, lim_cmd, 0, 0, 0); //g_Zapit->tune_TP(TP); @@ -320,10 +321,10 @@ void CMotorControl::motorStep(bool west) { int cmd; if (west) { - if(g_settings.rotor_swap) cmd = 0x68; + if(rotor_swap) cmd = 0x68; else cmd = 0x69; } else { - if(g_settings.rotor_swap) cmd = 0x69; + if(rotor_swap) cmd = 0x69; else cmd = 0x68; } printf("[motorcontrol] motorStep: %s\n", west ? "West" : "East"); diff --git a/src/gui/motorcontrol.h b/src/gui/motorcontrol.h index 5ca924dc8..b7e01b321 100644 --- a/src/gui/motorcontrol.h +++ b/src/gui/motorcontrol.h @@ -50,6 +50,7 @@ class CMotorControl : public CMenuTarget void Init(void); CFrameBuffer *frameBuffer; CFrontend *frontend; + bool rotor_swap; int x; int y; int width; diff --git a/src/gui/scan_setup.cpp b/src/gui/scan_setup.cpp index 5af926331..86fa3df03 100644 --- a/src/gui/scan_setup.cpp +++ b/src/gui/scan_setup.cpp @@ -809,6 +809,11 @@ int CScanSetup::showFrontendSetup(int number) setupMenu->addItem(mc); msettings.Add(mc); + mc = new CMenuOptionChooser(LOCALE_EXTRA_ROTOR_SWAP, &fe_config.rotor_swap, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, allow_moptions, this); + mc->setHint("", LOCALE_MENU_HINT_ROTOR_SWAP); + setupMenu->addItem(mc); + msettings.Add(mc); + CMenuForwarder * mf = new CMenuForwarder(LOCALE_MOTORCONTROL_HEAD, allow_moptions, NULL, this, "satfind", CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE); mf->setHint("", LOCALE_MENU_HINT_SCAN_SATFIND); setupMenu->addItem(mf); From a3f4cbaa9026e2c0cbfe71188fb13426a64d603e Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Tue, 4 Mar 2014 12:23:21 +0400 Subject: [PATCH 073/225] gui/miscsettings_menu.cpp: remove global rotor_swap option --- src/gui/miscsettings_menu.cpp | 8 -------- src/neutrino.cpp | 2 -- src/system/settings.h | 1 - 3 files changed, 11 deletions(-) diff --git a/src/gui/miscsettings_menu.cpp b/src/gui/miscsettings_menu.cpp index 36eb28c9a..85e01624e 100644 --- a/src/gui/miscsettings_menu.cpp +++ b/src/gui/miscsettings_menu.cpp @@ -324,14 +324,6 @@ void CMiscMenue::showMiscSettingsMenuGeneral(CMenuWidget *ms_general) ms_general->addItem(mn); } - //rotor - //don't show rotor settings on cable box - if (CFEManager::getInstance()->haveSat()) { - mc = new CMenuOptionChooser(LOCALE_EXTRA_ROTOR_SWAP, &g_settings.rotor_swap, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true); - mc->setHint("", LOCALE_MENU_HINT_ROTOR_SWAP); - ms_general->addItem(mc); - } - ms_general->addItem(GenericMenuSeparatorLine); CMenuForwarder * mf = new CMenuForwarder(LOCALE_PLUGINS_HDD_DIR, true, g_settings.plugin_hdd_dir, this, "plugin_dir"); diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 5b1f7ee42..3f8f6214a 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -379,7 +379,6 @@ int CNeutrinoApp::loadSetup(const char * fname) //misc g_settings.power_standby = configfile.getInt32( "power_standby", 0); - g_settings.rotor_swap = configfile.getInt32( "rotor_swap", 0); //led g_settings.led_tv_mode = configfile.getInt32( "led_tv_mode", 2); @@ -911,7 +910,6 @@ void CNeutrinoApp::saveSetup(const char * fname) //misc configfile.setInt32( "power_standby", g_settings.power_standby); - configfile.setInt32( "rotor_swap", g_settings.rotor_swap); configfile.setInt32( "zap_cycle", g_settings.zap_cycle ); configfile.setInt32( "hdd_fs", g_settings.hdd_fs); configfile.setInt32( "hdd_sleep", g_settings.hdd_sleep); diff --git a/src/system/settings.h b/src/system/settings.h index f4d0697b1..24d754d49 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -629,7 +629,6 @@ struct SNeutrinoSettings int uselastchannel; int power_standby; - int rotor_swap; int hdd_sleep; int hdd_noise; int hdd_fs; From 476f6f8da9994a3e38730327770325cfcf0b6f91 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Tue, 4 Mar 2014 12:54:38 +0400 Subject: [PATCH 074/225] locals: add locale for rotor options menu hints --- data/locale/english.locale | 2 ++ src/system/locals.h | 2 ++ src/system/locals_intern.h | 2 ++ 3 files changed, 6 insertions(+) diff --git a/data/locale/english.locale b/data/locale/english.locale index fc08b9c6b..378f2083b 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -1116,6 +1116,7 @@ menu.hint_scan_logical_hd If both SD and HD channel versions present\nput HD to menu.hint_scan_longitude Enter your longtitude menu.hint_scan_manual Manual transponder scan using\nselected parameters menu.hint_scan_mod Select transponder modulation +menu.hint_scan_motor Rotor options, satellite finder menu.hint_scan_motor_18v Use 18V when moving rotor menu.hint_scan_motor_speed Rotor moving speed in 1/10 degree\nper second menu.hint_scan_motorpos Select stored position number for this satellite,\nignored, if USALS enabled @@ -1140,6 +1141,7 @@ menu.hint_scan_start Start scan. You can use 'exit' button to stop menu.hint_scan_test Test signal for this transponder menu.hint_scan_tpselect Select transponder to scan menu.hint_scan_uncommited Select uncommited input for\nthis satellite +menu.hint_scan_usals USALS options menu.hint_scan_usals_repeat Repeat usals move rotor commands\nif you expirience unstable rotor move menu.hint_scan_usalsall Use USALS for all satellites on this frontend menu.hint_scan_useusals Use USALS for this satellite,\nif ON, rotor position ignored diff --git a/src/system/locals.h b/src/system/locals.h index 3e2f597c1..836d540f4 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -1143,6 +1143,7 @@ typedef enum LOCALE_MENU_HINT_SCAN_LONGITUDE, LOCALE_MENU_HINT_SCAN_MANUAL, LOCALE_MENU_HINT_SCAN_MOD, + LOCALE_MENU_HINT_SCAN_MOTOR, LOCALE_MENU_HINT_SCAN_MOTOR_18V, LOCALE_MENU_HINT_SCAN_MOTOR_SPEED, LOCALE_MENU_HINT_SCAN_MOTORPOS, @@ -1167,6 +1168,7 @@ typedef enum LOCALE_MENU_HINT_SCAN_TEST, LOCALE_MENU_HINT_SCAN_TPSELECT, LOCALE_MENU_HINT_SCAN_UNCOMMITED, + LOCALE_MENU_HINT_SCAN_USALS, LOCALE_MENU_HINT_SCAN_USALS_REPEAT, LOCALE_MENU_HINT_SCAN_USALSALL, LOCALE_MENU_HINT_SCAN_USEUSALS, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 4ee6d219e..5dee89ea9 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -1143,6 +1143,7 @@ const char * locale_real_names[] = "menu.hint_scan_longitude", "menu.hint_scan_manual", "menu.hint_scan_mod", + "menu.hint_scan_motor", "menu.hint_scan_motor_18v", "menu.hint_scan_motor_speed", "menu.hint_scan_motorpos", @@ -1167,6 +1168,7 @@ const char * locale_real_names[] = "menu.hint_scan_test", "menu.hint_scan_tpselect", "menu.hint_scan_uncommited", + "menu.hint_scan_usals", "menu.hint_scan_usals_repeat", "menu.hint_scan_usalsall", "menu.hint_scan_useusals", From 7682d58070541217963018b9353e41337a564ef0 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Tue, 4 Mar 2014 12:54:58 +0400 Subject: [PATCH 075/225] gui/scan_setup.cpp: move rotor options to its own menus --- src/gui/scan_setup.cpp | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/src/gui/scan_setup.cpp b/src/gui/scan_setup.cpp index 86fa3df03..4ba2fd489 100644 --- a/src/gui/scan_setup.cpp +++ b/src/gui/scan_setup.cpp @@ -547,7 +547,6 @@ neutrino_locale_t CScanSetup::getModeLocale(int mode) int CScanSetup::showScanMenuFrontendSetup() { CMenuForwarder * mf; - int shortcut = 1; fe_restart = false; allow_start = !CRecordManager::getInstance()->RecordingStatus() || CRecordManager::getInstance()->TimeshiftOnly(); @@ -616,28 +615,35 @@ int CScanSetup::showScanMenuFrontendSetup() zapit_lat_str = std::string(zapit_lat); zapit_long_str = std::string(zapit_long); - setupMenu->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_SATSETUP_EXTENDED_MOTOR)); + CMenuWidget * rotorMenu = new CMenuWidget(LOCALE_SATSETUP_EXTENDED_MOTOR, NEUTRINO_ICON_SETTINGS, width); + rotorMenu->addIntroItems(); + + int shortcut = 1; CMenuOptionChooser * mc = new CMenuOptionChooser(LOCALE_EXTRA_LADIRECTION, (int *)&zapitCfg.gotoXXLaDirection, OPTIONS_SOUTH0_NORTH1_OPTIONS, OPTIONS_SOUTH0_NORTH1_OPTION_COUNT, true, NULL, CRCInput::convertDigitToKey(shortcut++)); mc->setHint("", LOCALE_MENU_HINT_SCAN_LADIRECTION); - setupMenu->addItem(mc); + rotorMenu->addItem(mc); CStringInput * toff1 = new CStringInput(LOCALE_EXTRA_LATITUDE, &zapit_lat_str, 10, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "0123456789."); mf = new CMenuDForwarder(LOCALE_EXTRA_LATITUDE, true, zapit_lat, toff1, "", CRCInput::convertDigitToKey(shortcut++)); mf->setHint("", LOCALE_MENU_HINT_SCAN_LATITUDE); - setupMenu->addItem(mf); + rotorMenu->addItem(mf); mc = new CMenuOptionChooser(LOCALE_EXTRA_LODIRECTION, (int *)&zapitCfg.gotoXXLoDirection, OPTIONS_EAST0_WEST1_OPTIONS, OPTIONS_EAST0_WEST1_OPTION_COUNT, true, NULL, CRCInput::convertDigitToKey(shortcut++)); mc->setHint("", LOCALE_MENU_HINT_SCAN_LODIRECTION); - setupMenu->addItem(mc); + rotorMenu->addItem(mc); CStringInput * toff2 = new CStringInput(LOCALE_EXTRA_LONGITUDE, &zapit_long_str, 10, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "0123456789."); mf = new CMenuDForwarder(LOCALE_EXTRA_LONGITUDE, true, zapit_long, toff2, "", CRCInput::convertDigitToKey(shortcut++)); mf->setHint("", LOCALE_MENU_HINT_SCAN_LONGITUDE); - setupMenu->addItem(mf); + rotorMenu->addItem(mf); nc = new CMenuOptionNumberChooser(LOCALE_SATSETUP_USALS_REPEAT, (int *)&zapitCfg.repeatUsals, true, 0, 10, NULL, 0, 0, LOCALE_OPTIONS_OFF); nc->setHint("", LOCALE_MENU_HINT_SCAN_USALS_REPEAT); - setupMenu->addItem(nc); + rotorMenu->addItem(nc); + + mf = new CMenuDForwarder(LOCALE_SATSETUP_EXTENDED_MOTOR, true, NULL, rotorMenu); + mf->setHint("", LOCALE_MENU_HINT_SCAN_USALS); + setupMenu->addItem(mf); } int res = setupMenu->exec(NULL, ""); @@ -792,32 +798,38 @@ int CScanSetup::showFrontendSetup(int number) uniSetup = new CMenuForwarder(LOCALE_SATSETUP_UNI_SETTINGS, (dmode == DISEQC_UNICABLE), NULL, this, "unisetup", CRCInput::convertDigitToKey(shortcut++)); setupMenu->addItem(uniSetup); - setupMenu->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_SATSETUP_EXTENDED_MOTOR)); + CMenuWidget * rotorMenu = new CMenuWidget(LOCALE_SATSETUP_EXTENDED_MOTOR, NEUTRINO_ICON_SETTINGS, width); + rotorMenu->addIntroItems(); + CMenuOptionNumberChooser * nc = new CMenuOptionNumberChooser(LOCALE_EXTRA_ZAPIT_MOTOR_SPEED, (int *)&fe_config.motorRotationSpeed, allow_moptions, 0, 64, NULL); nc->setNumberFormat(rotationSpeed2str); nc->setHint("", LOCALE_MENU_HINT_SCAN_MOTOR_SPEED); - setupMenu->addItem(nc); + rotorMenu->addItem(nc); msettings.Add(nc); mc = new CMenuOptionChooser(LOCALE_EXTRA_ZAPIT_HVOLTAGE, (int *)&fe_config.highVoltage, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, allow_moptions); mc->setHint("", LOCALE_MENU_HINT_SCAN_MOTOR_18V); - setupMenu->addItem(mc); + rotorMenu->addItem(mc); msettings.Add(mc); mc = new CMenuOptionChooser(LOCALE_SATSETUP_USE_USALS, &fe_config.use_usals, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, allow_moptions, this); mc->setHint("", LOCALE_MENU_HINT_SCAN_USALSALL); - setupMenu->addItem(mc); + rotorMenu->addItem(mc); msettings.Add(mc); mc = new CMenuOptionChooser(LOCALE_EXTRA_ROTOR_SWAP, &fe_config.rotor_swap, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, allow_moptions, this); mc->setHint("", LOCALE_MENU_HINT_ROTOR_SWAP); - setupMenu->addItem(mc); + rotorMenu->addItem(mc); msettings.Add(mc); CMenuForwarder * mf = new CMenuForwarder(LOCALE_MOTORCONTROL_HEAD, allow_moptions, NULL, this, "satfind", CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE); mf->setHint("", LOCALE_MENU_HINT_SCAN_SATFIND); - setupMenu->addItem(mf); + rotorMenu->addItem(mf); msettings.Add(mf); + + mf = new CMenuDForwarder(LOCALE_SATSETUP_EXTENDED_MOTOR, allow_moptions, NULL, rotorMenu, "", CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE); + mf->setHint("", LOCALE_MENU_HINT_SCAN_MOTOR); + setupMenu->addItem(mf); } int res = setupMenu->exec(NULL, ""); From 753f3f2f959ee32e0ee94b46e3d133d1f2c78945 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Wed, 5 Mar 2014 10:30:19 +0400 Subject: [PATCH 076/225] neutrino.cpp: add pip config settings for radio mode --- src/neutrino.cpp | 26 ++++++++++++++++++++++++-- src/system/settings.h | 4 ++++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 3f8f6214a..838cba8ee 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -149,6 +149,9 @@ static bool nhttpd_thread_started = false; //#define DISABLE_SECTIONSD extern cVideo * videoDecoder; +#ifdef ENABLE_PIP +extern cVideo *pipDecoder; +#endif extern cDemux *videoDemux; extern cAudio * audioDecoder; cPowerManager *powerManager; @@ -831,6 +834,11 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.pip_y = configfile.getInt32("pip_y", 50); g_settings.pip_width = configfile.getInt32("pip_width", 365); g_settings.pip_height = configfile.getInt32("pip_height", 200); + + g_settings.pip_radio_x = configfile.getInt32("pip_radio_x", g_settings.pip_x); + g_settings.pip_radio_y = configfile.getInt32("pip_radio_y", g_settings.pip_y); + g_settings.pip_radio_width = configfile.getInt32("pip_radio_width", g_settings.pip_width); + g_settings.pip_radio_height = configfile.getInt32("pip_radio_height", g_settings.pip_height); #endif g_settings.infoClockFontSize = configfile.getInt32("infoClockFontSize", 30); @@ -1262,6 +1270,11 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setInt32("pip_y", g_settings.pip_y); configfile.setInt32("pip_width", g_settings.pip_width); configfile.setInt32("pip_height", g_settings.pip_height); + + configfile.setInt32("pip_radio_x", g_settings.pip_radio_x); + configfile.setInt32("pip_radio_y", g_settings.pip_radio_y); + configfile.setInt32("pip_radio_width", g_settings.pip_radio_width); + configfile.setInt32("pip_radio_height", g_settings.pip_radio_height); #endif configfile.setInt32("infoClockFontSize", g_settings.infoClockFontSize); configfile.setInt32("infoClockBackground", g_settings.infoClockBackground); @@ -3243,7 +3256,7 @@ void CNeutrinoApp::tvMode( bool rezap ) delete g_Radiotext; g_Radiotext = NULL; } - + videoDecoder->StopPicture(); CVFD::getInstance()->ShowIcon(FP_ICON_RADIO, false); StartSubtitles(!rezap); @@ -3260,6 +3273,11 @@ void CNeutrinoApp::tvMode( bool rezap ) bool stopauto = (mode != mode_ts); mode = mode_tv; +#ifdef ENABLE_PIP + pipDecoder->Pig(g_settings.pip_x, g_settings.pip_y, + g_settings.pip_width, g_settings.pip_height, + frameBuffer->getScreenWidth(true), frameBuffer->getScreenHeight(true)); +#endif if(stopauto /*&& autoshift*/) { //printf("standby on: autoshift ! stopping ...\n"); CRecordManager::getInstance()->StopAutoRecord(); @@ -3478,7 +3496,11 @@ void CNeutrinoApp::radioMode( bool rezap) videoDecoder->Standby(false); } mode = mode_radio; - +#ifdef ENABLE_PIP + pipDecoder->Pig(g_settings.pip_radio_x, g_settings.pip_radio_y, + g_settings.pip_radio_width, g_settings.pip_radio_height, + frameBuffer->getScreenWidth(true), frameBuffer->getScreenHeight(true)); +#endif CRecordManager::getInstance()->StopAutoRecord(); g_RemoteControl->radioMode(); diff --git a/src/system/settings.h b/src/system/settings.h index 24d754d49..ead5916f9 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -465,6 +465,10 @@ struct SNeutrinoSettings int pip_height; int pip_x; int pip_y; + int pip_radio_width; + int pip_radio_height; + int pip_radio_x; + int pip_radio_y; int bigFonts; int window_size; int window_width; From ea1e2706f885288c434cde240f1bd8d4e3f97f6c Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Wed, 5 Mar 2014 10:31:05 +0400 Subject: [PATCH 077/225] gui/pipsetup.cpp: support different PIP setup for tv and radio modes --- src/gui/pipsetup.cpp | 28 ++++++++++++++++++++-------- src/gui/pipsetup.h | 2 ++ 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/gui/pipsetup.cpp b/src/gui/pipsetup.cpp index 98692ad7a..6be220ec7 100644 --- a/src/gui/pipsetup.cpp +++ b/src/gui/pipsetup.cpp @@ -25,10 +25,22 @@ extern cVideo *pipDecoder; CPipSetup::CPipSetup() { frameBuffer = CFrameBuffer::getInstance(); - x_coord = g_settings.pip_x; - y_coord = g_settings.pip_y; - width = g_settings.pip_width; - height = g_settings.pip_height; + + if(CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_radio) { + gx = &g_settings.pip_radio_x; + gy = &g_settings.pip_radio_y; + gw = &g_settings.pip_radio_width; + gh = &g_settings.pip_radio_height; + } else { + gx = &g_settings.pip_x; + gy = &g_settings.pip_y; + gw = &g_settings.pip_width; + gh = &g_settings.pip_height; + } + x_coord = *gx; + y_coord = *gy; + width = *gw; + height = *gh; maxw = frameBuffer->getScreenWidth(true); maxh = frameBuffer->getScreenHeight(true); @@ -53,8 +65,8 @@ void CPipSetup::move(int x, int y, bool abs) } x_coord = newx; y_coord = newy; - g_settings.pip_x = x_coord; - g_settings.pip_y = y_coord; + *gx = x_coord; + *gy = y_coord; printf("CPipSetup::move: x %d y %d\n", x_coord, y_coord); pipDecoder->Pig(x_coord, y_coord, width, height, maxw, maxh); @@ -85,8 +97,8 @@ void CPipSetup::resize(int w, int h, bool abs) width = neww; height = newh; } - g_settings.pip_width = width; - g_settings.pip_height = height; + *gw = width; + *gh = height; printf("CPipSetup::resize: w %d h %d \n", width, height); pipDecoder->Pig(x_coord, y_coord, width, height, maxw, maxh); diff --git a/src/gui/pipsetup.h b/src/gui/pipsetup.h index 373f3096b..0111569d8 100644 --- a/src/gui/pipsetup.h +++ b/src/gui/pipsetup.h @@ -17,6 +17,8 @@ class CPipSetup : public CMenuTarget int maxh; int minw; int minh; + + int *gx, *gy, *gw, *gh; void paint(); void hide(); void clear(); From 040b2a958ef5997d2365fb860311e9f9bf066fb2 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Wed, 5 Mar 2014 12:27:22 +0400 Subject: [PATCH 078/225] gui/bouquetlist.cpp: fix inactive color when called to add channel to bouquet --- src/gui/bouquetlist.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/bouquetlist.cpp b/src/gui/bouquetlist.cpp index bc8257e33..8132fa3a2 100644 --- a/src/gui/bouquetlist.cpp +++ b/src/gui/bouquetlist.cpp @@ -570,7 +570,7 @@ void CBouquetList::paintItem(int pos) if(npos < (int) Bouquets.size()) CVFD::getInstance()->showMenuText(0, lname, -1, true); } else { - if(npos < (int) Bouquets.size()) + if(!favonly && (npos < (int) Bouquets.size())) iscurrent = !Bouquets[npos]->channelList->isEmpty(); color = iscurrent ? COL_MENUCONTENT_TEXT : COL_MENUCONTENTINACTIVE_TEXT; bgcolor = iscurrent ? COL_MENUCONTENT_PLUS_0 : COL_MENUCONTENTINACTIVE_PLUS_0; From 793c3aab5aebf6da531d7cc06384eeca21cce5be Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Thu, 6 Mar 2014 11:17:06 +0400 Subject: [PATCH 079/225] gui/osdlang_setup.cpp: revert language selection to old behaviour: close menu after select --- src/gui/osdlang_setup.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/osdlang_setup.cpp b/src/gui/osdlang_setup.cpp index 983db336f..8073375c4 100644 --- a/src/gui/osdlang_setup.cpp +++ b/src/gui/osdlang_setup.cpp @@ -76,7 +76,7 @@ int COsdLangSetup::exec(CMenuTarget* parent, const std::string &actionKey) if (actionKey != "") { g_settings.language = actionKey; g_Locale->loadLocale(g_settings.language.c_str()); - return menu_return::RETURN_REPAINT; + return menu_return::RETURN_EXIT; } int res = showLocalSetup(); From 8284fe6e53f0430773ea091adb4364c1c1b1a99e Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Thu, 6 Mar 2014 14:18:55 +0400 Subject: [PATCH 080/225] system/setting_helpers.cpp: create /var_init/etc/.reset on factory reset, to be processed by apollo init scripts to erase /var partition --- src/system/setting_helpers.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/system/setting_helpers.cpp b/src/system/setting_helpers.cpp index 2ec232eb6..7949249b9 100644 --- a/src/system/setting_helpers.cpp +++ b/src/system/setting_helpers.cpp @@ -538,6 +538,13 @@ int CDataResetNotifier::exec(CMenuTarget* /*parent*/, const std::string& actionK CZapit::getInstance()->GetConfig(zapitCfg); g_RCInput->postMsg( NeutrinoMessages::REBOOT, 0); ret = menu_return::RETURN_EXIT_ALL; +#ifdef BOXMODEL_APOLLO + /* flag file to erase /var partition on factory reset, + will be done by init scripts */ + FILE * fp = fopen("/var_init/etc/.reset", "w"); + if (fp) + fclose(fp); +#endif } if(delete_set) { unlink(NEUTRINO_SETTINGS_FILE); From 5ca62c111eb5aadacda8146deeed3a34c25cf082 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Thu, 6 Mar 2014 16:46:50 +0400 Subject: [PATCH 081/225] zapit/src/bouquets.cpp: change bouquets delete behavior after scan: if box cable-only, remove all bouquets, else remove bouquets for scanned position only, do not remove bouquets after single transponder scan --- src/zapit/include/zapit/bouquets.h | 3 ++- src/zapit/src/bouquets.cpp | 34 ++++++++++++++++++++++++++---- src/zapit/src/scan.cpp | 4 ++-- 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/src/zapit/include/zapit/bouquets.h b/src/zapit/include/zapit/bouquets.h index ca26782a3..33b483fc7 100644 --- a/src/zapit/include/zapit/bouquets.h +++ b/src/zapit/include/zapit/bouquets.h @@ -105,7 +105,7 @@ class CBouquetManager void saveBouquets(void); void saveUBouquets(void); - void saveBouquets(const CZapitClient::bouquetMode bouquetMode, const char * const providerName); + void saveBouquets(const CZapitClient::bouquetMode bouquetMode, const char * const providerName, t_satellite_position satellitePosition = -1); void loadBouquets(bool ignoreBouquetFile = false); void renumServices(); @@ -118,6 +118,7 @@ class CBouquetManager bool existsChannelInBouquet(unsigned int bq_id, const t_channel_id channel_id); void clearAll(bool user = true); + void deletePosition(t_satellite_position satellitePosition); void sortBouquets(void); }; diff --git a/src/zapit/src/bouquets.cpp b/src/zapit/src/bouquets.cpp index b26c51385..5cf329e58 100644 --- a/src/zapit/src/bouquets.cpp +++ b/src/zapit/src/bouquets.cpp @@ -279,12 +279,16 @@ void CBouquetManager::saveUBouquets(void) chmod(UBOUQUETS_XML, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); } -void CBouquetManager::saveBouquets(const CZapitClient::bouquetMode bouquetMode, const char * const providerName) +void CBouquetManager::saveBouquets(const CZapitClient::bouquetMode bouquetMode, const char * const providerName, t_satellite_position satellitePosition) { if (bouquetMode == CZapitClient::BM_DELETEBOUQUETS) { INFO("removing existing bouquets"); - //unlink(BOUQUETS_XML); - g_bouquetManager->clearAll(false); + if (satellitePosition > 0) { + if (CFEManager::getInstance()->cableOnly()) + g_bouquetManager->clearAll(false); + else + g_bouquetManager->deletePosition(satellitePosition); + } } if (bouquetMode == CZapitClient::BM_DONTTOUCHBOUQUETS) return; @@ -413,6 +417,14 @@ void CBouquetManager::parseBouquetsXml(const char *fname, bool bUser) } channel_node = channel_node->xmlNextNode; + if(!bUser) { + /* set satellite position for provider bouquets. + reset position to 0, if position not match - means mixed bouquet */ + if (newBouquet->satellitePosition < 0) + newBouquet->satellitePosition = satellitePosition; + else if (newBouquet->satellitePosition != satellitePosition) + newBouquet->satellitePosition = 0; + } } if(!bUser) newBouquet->sortBouquet(); @@ -503,6 +515,7 @@ CZapitBouquet* CBouquetManager::addBouquet(const std::string & name, bool ub, bo newBouquet->bUser = ub; newBouquet->bFav = myfav; newBouquet->bOther = false; + newBouquet->satellitePosition = -1; //printf("CBouquetManager::addBouquet: %s, user %s\n", name.c_str(), ub ? "YES" : "NO"); if(ub) { @@ -651,7 +664,7 @@ void CBouquetManager::clearAll(bool user) { BouquetList tmplist; for (unsigned int i =0; i < Bouquets.size(); i++) { - if (!user || !Bouquets[i]->bFav) + if (user || !Bouquets[i]->bUser) delete Bouquets[i]; else tmplist.push_back(Bouquets[i]); @@ -663,6 +676,19 @@ void CBouquetManager::clearAll(bool user) remainChannels = NULL; } +void CBouquetManager::deletePosition(t_satellite_position satellitePosition) +{ + BouquetList tmplist; + for (unsigned int i =0; i < Bouquets.size(); i++) { + if (satellitePosition == Bouquets[i]->satellitePosition) { +printf("CBouquetManager::deletePosition: delete [%s]\n", Bouquets[i]->Name.c_str()); + delete Bouquets[i]; + } else + tmplist.push_back(Bouquets[i]); + } + Bouquets = tmplist; +} + CBouquetManager::ChannelIterator::ChannelIterator(CBouquetManager* owner, const bool TV) { Owner = owner; diff --git a/src/zapit/src/scan.cpp b/src/zapit/src/scan.cpp index cd09fe827..c8d1710dd 100644 --- a/src/zapit/src/scan.cpp +++ b/src/zapit/src/scan.cpp @@ -544,7 +544,7 @@ bool CServiceScan::ScanProviders() } if( !scanBouquetManager->Bouquets.empty() ) { - scanBouquetManager->saveBouquets(bouquetMode, spI->second.c_str()); + scanBouquetManager->saveBouquets(bouquetMode, spI->second.c_str(), position); } scanBouquetManager->clearAll(); } @@ -616,7 +616,7 @@ bool CServiceScan::ScanTransponder() found_channels = 0; if(found_channels) { - scanBouquetManager->saveBouquets(bouquetMode, providerName.c_str()); + scanBouquetManager->saveBouquets(bouquetMode, providerName.c_str(), scanedtransponders.size() > 1 ? satellitePosition : -1); SaveServices(); Cleanup(true); CZapitClient myZapitClient; From 185a5c0e8b47e79368ba639d7dbbc614ab176104 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Fri, 7 Mar 2014 22:22:35 +0100 Subject: [PATCH 082/225] satellites.xml: update Thor 5/6/Intelsat --- data/satellites.xml | 55 +++++++++++++++++++-------------------------- 1 file changed, 23 insertions(+), 32 deletions(-) diff --git a/data/satellites.xml b/data/satellites.xml index 6496837e3..d28eb8946 100644 --- a/data/satellites.xml +++ b/data/satellites.xml @@ -1428,11 +1428,11 @@ - + - + @@ -1440,10 +1440,11 @@ + + - - + @@ -1454,7 +1455,6 @@ - @@ -1474,30 +1474,20 @@ - + - + - + - - - - - + + + - - - - - - - - @@ -1505,19 +1495,18 @@ - - - - + + - + + @@ -1525,18 +1514,20 @@ - - + + + + - - + + + - - + From e8c0543ac1128922ff5ee45223c1d0b9297d38b6 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Fri, 7 Mar 2014 22:49:36 +0100 Subject: [PATCH 083/225] - locale: move first-search locale-dir from /var/tuxbox/config/locale ... ... to /var/tuxbox/locale --- src/system/localize.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/system/localize.cpp b/src/system/localize.cpp index 6a3f2cb1d..4a196ca88 100644 --- a/src/system/localize.cpp +++ b/src/system/localize.cpp @@ -108,7 +108,8 @@ CLocaleManager::~CLocaleManager() ::free(defaultDataMem); } -const char * path[2] = { CONFIGDIR "/locale/", DATADIR "/neutrino/locale/"}; +#define LOCALEDIR_VAR "/var/tuxbox/locale" +const char * path[2] = { LOCALEDIR_VAR, DATADIR "/neutrino/locale/"}; CLocaleManager::loadLocale_ret_t CLocaleManager::loadLocale(const char * const locale, bool asdefault) { From 7ab37854c648452a8419203fa2f63603502d2fa7 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Fri, 7 Mar 2014 23:03:57 +0100 Subject: [PATCH 084/225] - pictureviewer: add a var-dir for channellogos (/var/tuxbox/icons/logo) --- src/driver/pictureviewer/pictureviewer.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/driver/pictureviewer/pictureviewer.cpp b/src/driver/pictureviewer/pictureviewer.cpp index d42b6f606..439518cf7 100644 --- a/src/driver/pictureviewer/pictureviewer.cpp +++ b/src/driver/pictureviewer/pictureviewer.cpp @@ -499,6 +499,7 @@ void CPictureViewer::getSize(const char* name, int* width, int *height) } #define LOGO_FLASH_DIR DATADIR "/neutrino/icons/logo" +#define LOGO_FLASH_DIR_VAR "/var/tuxbox/icons/logo" bool CPictureViewer::GetLogoName(const uint64_t& channel_id, const std::string& ChannelName, std::string & name, int *width, int *height) { @@ -523,6 +524,16 @@ bool CPictureViewer::GetLogoName(const uint64_t& channel_id, const std::string& id_tmp_path += strChnId + fileType[i]; v_path.push_back(id_tmp_path); + //create filename with channel name (LOGO_FLASH_DIR_VAR) + id_tmp_path = LOGO_FLASH_DIR_VAR "/"; + id_tmp_path += ChannelName + fileType[i]; + v_path.push_back(id_tmp_path); + + //create filename with id (LOGO_FLASH_DIR_VAR) + id_tmp_path = LOGO_FLASH_DIR_VAR "/"; + id_tmp_path += strChnId + fileType[i]; + v_path.push_back(id_tmp_path); + //create filename with channel name (LOGO_FLASH_DIR) id_tmp_path = LOGO_FLASH_DIR "/"; id_tmp_path += ChannelName + fileType[i]; From fd57dace0eb055f8a9bd8026c530922f062a77f3 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Mon, 10 Mar 2014 13:52:00 +0400 Subject: [PATCH 085/225] zapit/include/zapit/satconfig.h: add macros for cable/terrestrial positions --- src/zapit/include/zapit/satconfig.h | 3 +++ src/zapit/src/femanager.cpp | 4 ++-- src/zapit/src/getservices.cpp | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/zapit/include/zapit/satconfig.h b/src/zapit/include/zapit/satconfig.h index 5dc5c2f3f..06abb71d5 100644 --- a/src/zapit/include/zapit/satconfig.h +++ b/src/zapit/include/zapit/satconfig.h @@ -46,6 +46,9 @@ typedef enum diseqc_cmd_order { COMMITED_FIRST } diseqc_cmd_order_t; +#define SAT_POSITION_CABLE(satellitePosition) ((satellitePosition > 0) && ((satellitePosition & 0xF00) == 0xF00)) +#define SAT_POSITION_TERR(satellitePosition) ((satellitePosition > 0) && ((satellitePosition & 0xF00) == 0xE00)) + typedef std::pair satellite_pair_t; typedef std::map satellite_map_t; typedef std::map::iterator sat_iterator_t; diff --git a/src/zapit/src/femanager.cpp b/src/zapit/src/femanager.cpp index 9838b8ade..c1ba1cfd6 100644 --- a/src/zapit/src/femanager.cpp +++ b/src/zapit/src/femanager.cpp @@ -676,12 +676,12 @@ CFrontend * CFEManager::getScanFrontend(t_satellite_position satellitePosition) for(fe_map_iterator_t it = femap.begin(); it != femap.end(); it++) { CFrontend * mfe = it->second; if (mfe->isCable()) { - if ((mfe->getMode() != CFrontend::FE_MODE_UNUSED) && ((satellitePosition & 0xF00) == 0xF00)) { + if ((mfe->getMode() != CFrontend::FE_MODE_UNUSED) && SAT_POSITION_CABLE(satellitePosition)) { frontend = mfe; break; } } else if (mfe->isTerr()) { - if ((mfe->getMode() != CFrontend::FE_MODE_UNUSED) && (satellitePosition & 0xF00) == 0xE00) { + if ((mfe->getMode() != CFrontend::FE_MODE_UNUSED) && SAT_POSITION_TERR(satellitePosition)) { frontend = mfe; break; } diff --git a/src/zapit/src/getservices.cpp b/src/zapit/src/getservices.cpp index f9bb9748d..289e2f67b 100644 --- a/src/zapit/src/getservices.cpp +++ b/src/zapit/src/getservices.cpp @@ -821,9 +821,9 @@ void CServiceManager::CopyFile(char * from, char * to) void CServiceManager::WriteSatHeader(FILE * fd, sat_config_t &config) { /* FIXME hack */ - if ((config.position & 0xF00) == 0xF00) + if (SAT_POSITION_CABLE(config.position)) config.deltype = FE_QAM; - else if ((config.position & 0xF00) == 0xE00) + else if (SAT_POSITION_TERR(config.position)) config.deltype = FE_OFDM; switch (config.deltype) { From 87d5f4feb92ed1ecb880a5871cc17b802dcbed52 Mon Sep 17 00:00:00 2001 From: martii Date: Thu, 26 Sep 2013 14:47:17 +0200 Subject: [PATCH 086/225] gui/movieplayer: create and use a movieinfo copy (fixes timeshift playback) --- src/gui/movieplayer.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index 25e4b052f..8d9c44ffe 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -508,7 +508,13 @@ void CMoviePlayerGui::PlayFile(void) printf("IS FILE PLAYER: %s\n", is_file_player ? "true": "false" ); - if(p_movie_info != NULL) { + MI_MOVIE_INFO mi; + + if(p_movie_info) { + // p_movie_info may be invalidated by CRecordManager while we're still using it. Create and use a copy. + mi = *p_movie_info; + p_movie_info = &mi; + duration = p_movie_info->length * 60 * 1000; int percent = CZapit::getInstance()->GetPidVolume(p_movie_info->epgId, currentapid, currentac3 == 1); CZapit::getInstance()->SetVolumePercent(percent); From cc6848624a88fe962062b9cbd55e335454d0652e Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Tue, 11 Mar 2014 15:51:24 +0400 Subject: [PATCH 087/225] locals: add locale for timeshift record duration --- data/locale/english.locale | 6 ++++-- src/system/locals.h | 2 ++ src/system/locals_intern.h | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/data/locale/english.locale b/data/locale/english.locale index 378f2083b..c3d92d2ab 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -403,7 +403,8 @@ extra.lodirection LoDirection extra.longitude Longitude extra.menu_left_exit "Left" = menu back extra.north North -extra.record_time Maximal recording time +extra.record_time Maximal recording duration +extra.record_time_ts Maximal timeshift duration extra.rotor_swap Swap rotor east/west extra.rounded_corners Shape of corners extra.rounded_corners_off angular @@ -1063,7 +1064,8 @@ menu.hint_record_end Stop direct record after maximal time or after current even menu.hint_record_slow_warn Show warning, when record buffer is close to overflow menu.hint_record_startstop_msg Turns the message when recording start/end on or off. menu.hint_record_tdir Select directory to save timeshift recordings\nin temporary timeshift mode -menu.hint_record_time Record time before stop when\nusing direct record with record button +menu.hint_record_time Record duration before stop when\nusing direct record with record button +menu.hint_record_time_ts Timeshift duration before stop when\ntemporary timeshift enabled menu.hint_record_timeafter Stop record after event end\nin minutes menu.hint_record_timebefore Start record before event start\nin minutes menu.hint_record_timer Configure record by timer options diff --git a/src/system/locals.h b/src/system/locals.h index 836d540f4..18d2caae5 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -431,6 +431,7 @@ typedef enum LOCALE_EXTRA_MENU_LEFT_EXIT, LOCALE_EXTRA_NORTH, LOCALE_EXTRA_RECORD_TIME, + LOCALE_EXTRA_RECORD_TIME_TS, LOCALE_EXTRA_ROTOR_SWAP, LOCALE_EXTRA_ROUNDED_CORNERS, LOCALE_EXTRA_ROUNDED_CORNERS_OFF, @@ -1091,6 +1092,7 @@ typedef enum LOCALE_MENU_HINT_RECORD_STARTSTOP_MSG, LOCALE_MENU_HINT_RECORD_TDIR, LOCALE_MENU_HINT_RECORD_TIME, + LOCALE_MENU_HINT_RECORD_TIME_TS, LOCALE_MENU_HINT_RECORD_TIMEAFTER, LOCALE_MENU_HINT_RECORD_TIMEBEFORE, LOCALE_MENU_HINT_RECORD_TIMER, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 5dee89ea9..ca130e871 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -431,6 +431,7 @@ const char * locale_real_names[] = "extra.menu_left_exit", "extra.north", "extra.record_time", + "extra.record_time_ts", "extra.rotor_swap", "extra.rounded_corners", "extra.rounded_corners_off", @@ -1091,6 +1092,7 @@ const char * locale_real_names[] = "menu.hint_record_startstop_msg", "menu.hint_record_tdir", "menu.hint_record_time", + "menu.hint_record_time_ts", "menu.hint_record_timeafter", "menu.hint_record_timebefore", "menu.hint_record_timer", From 6201a95358817f0355a618a90793a44645689b22 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Tue, 11 Mar 2014 16:21:32 +0400 Subject: [PATCH 088/225] neutrino.cpp: add timeshift record duration setting --- src/gui/record_setup.cpp | 6 ++++++ src/neutrino.cpp | 2 ++ src/system/settings.h | 1 + 3 files changed, 9 insertions(+) diff --git a/src/gui/record_setup.cpp b/src/gui/record_setup.cpp index 207b6ea94..41d70ed3a 100644 --- a/src/gui/record_setup.cpp +++ b/src/gui/record_setup.cpp @@ -390,6 +390,12 @@ void CRecordSetup::showRecordTimeShiftSetup(CMenuWidget *menu_ts) mc = new CMenuOptionChooser(LOCALE_EXTRA_TEMP_TIMESHIFT, &g_settings.temp_timeshift, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true); mc->setHint("", LOCALE_MENU_HINT_RECORD_TIMESHIFT_TEMP); menu_ts->addItem(mc); + + //rec hours + mn = new CMenuOptionNumberChooser(LOCALE_EXTRA_RECORD_TIME_TS, &g_settings.timeshift_hours, true, 1, 24, NULL); + mn->setNumberFormat(std::string("%d ") + g_Locale->getText(LOCALE_UNIT_SHORT_HOUR)); + mn->setHint("", LOCALE_MENU_HINT_RECORD_TIME_TS); + menu_ts->addItem(mn); } } diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 838cba8ee..df548abe1 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -599,6 +599,7 @@ int CNeutrinoApp::loadSetup(const char * fname) } } g_settings.record_hours = configfile.getInt32( "record_hours", 4 ); + g_settings.timeshift_hours = configfile.getInt32( "timeshift_hours", 4 ); g_settings.filesystem_is_utf8 = configfile.getBool("filesystem_is_utf8" , true ); //recording (server + vcr) @@ -1118,6 +1119,7 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setInt32( "auto_timeshift", g_settings.auto_timeshift ); configfile.setInt32( "auto_delete", g_settings.auto_delete ); configfile.setInt32( "record_hours", g_settings.record_hours ); + configfile.setInt32( "timeshift_hours", g_settings.timeshift_hours ); //printf("set: key_unlock =============== %d\n", g_settings.key_unlock); configfile.setInt32( "screenshot_count", g_settings.screenshot_count ); configfile.setInt32( "screenshot_format", g_settings.screenshot_format ); diff --git a/src/system/settings.h b/src/system/settings.h index ead5916f9..610d38d9e 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -414,6 +414,7 @@ struct SNeutrinoSettings int temp_timeshift; int auto_delete; int record_hours; + int timeshift_hours; int mpkey_rewind; int mpkey_forward; From 8074000b23e4efaadc7f17d0f109ffc8463232ff Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Tue, 11 Mar 2014 16:22:50 +0400 Subject: [PATCH 089/225] driver/record.cpp: always use configured hours to record for temporary timeshift; cleanup unused code --- src/driver/record.cpp | 169 ++++-------------------------------------- src/driver/record.h | 3 - 2 files changed, 14 insertions(+), 158 deletions(-) diff --git a/src/driver/record.cpp b/src/driver/record.cpp index f2fb366fc..9e6697b68 100644 --- a/src/driver/record.cpp +++ b/src/driver/record.cpp @@ -97,7 +97,6 @@ CRecordInstance::CRecordInstance(const CTimerd::RecordingInfo * const eventinfo, cMovieInfo = new CMovieInfo(); recMovieInfo = new MI_MOVIE_INFO(); record = NULL; - tshift_mode = TSHIFT_MODE_OFF; rec_stop_msg = g_Locale->getText(LOCALE_RECORDING_STOP); } @@ -260,6 +259,7 @@ bool CRecordInstance::Stop(bool remove_event) hintBox.paint(); printf("%s: channel %" PRIx64 " recording_id %d\n", __func__, channel_id, recording_id); + printf("%s: file %s.ts\n", __FUNCTION__, filename); SaveXml(); /* Stop do close fd - if started */ record->Stop(); @@ -450,15 +450,19 @@ record_error_msg_t CRecordInstance::Record() //FIXME recording_id (timerd eventID) is 0 means its user recording, in this case timer always added ? if(ret == RECORD_OK && recording_id == 0) { time_t now = time(NULL); - int record_end = now+g_settings.record_hours*60*60; - if (g_settings.recording_epg_for_end) - { - int pre=0, post=0; - CEPGData epgData; - if (CEitManager::getInstance()->getActualEPGServiceKey(channel_id, &epgData )) { - g_Timerd->getRecordingSafety(pre, post); - if (epgData.epg_times.startzeit > 0) - record_end = epgData.epg_times.startzeit + epgData.epg_times.dauer + post; + int record_end; + if (autoshift) { + record_end = now+g_settings.timeshift_hours*60*60; + } else { + record_end = now+g_settings.record_hours*60*60; + if (g_settings.recording_epg_for_end) { + int pre=0, post=0; + CEPGData epgData; + if (CEitManager::getInstance()->getActualEPGServiceKey(channel_id, &epgData )) { + g_Timerd->getRecordingSafety(pre, post); + if (epgData.epg_times.startzeit > 0) + record_end = epgData.epg_times.startzeit + epgData.epg_times.dauer + post; + } } } recording_id = g_Timerd->addImmediateRecordTimerEvent(channel_id, now, record_end, epgid, epg_time, apidmode); @@ -832,28 +836,6 @@ const std::string CRecordManager::GetFileName(t_channel_id channel_id, bool time /* return record mode mask, for channel_id not 0, or global */ int CRecordManager::GetRecordMode(const t_channel_id channel_id) { -#if 0 - if (RecordingStatus(channel_id) || IsTimeshift(channel_id)) - { - if (RecordingStatus(channel_id) && !IsTimeshift(channel_id)) - return RECMODE_REC; - if (channel_id == 0) - { - int records = GetRecordCount(); - if (IsTimeshift(channel_id) && (records == 1)) - return RECMODE_TSHIFT; - else if (IsTimeshift(channel_id) && (records > 1)) - return RECMODE_REC_TSHIFT; - else - return RECMODE_OFF; - } else - { - if (IsTimeshift(channel_id)) - return RECMODE_TSHIFT; - } - } - return RECMODE_OFF; -#endif int recmode = RECMODE_OFF; mutex.lock(); if (channel_id == 0) { @@ -913,10 +895,6 @@ bool CRecordManager::Record(const CTimerd::RecordingInfo * const eventinfo, cons if (g_settings.recording_type == CNeutrinoApp::RECORDING_OFF) return false; -#if 0 - if(!CheckRecording(eventinfo)) - return false; -#endif #if 1 // FIXME test StopSectionsd = false; @@ -926,18 +904,6 @@ bool CRecordManager::Record(const CTimerd::RecordingInfo * const eventinfo, cons RunStartScript(); mutex.lock(); -#if 0 - inst = FindInstance(eventinfo->channel_id); - if(inst) { - if(direct_record) { - error_msg = RECORD_BUSY; - } else { - CTimerd::RecordingInfo * evt = new CTimerd::RecordingInfo(*eventinfo); - printf("%s add %llx : %s to pending\n", __FUNCTION__, evt->channel_id, evt->epgTitle); - nextmap.push_back((CTimerd::RecordingInfo *)evt); - } - } else -#endif if(recmap.size() < RECORD_MAX_COUNT) { CFrontend * frontend = NULL; if(CutBackNeutrino(eventinfo->channel_id, frontend)) { @@ -1034,18 +1000,6 @@ bool CRecordManager::StopAutoRecord(bool lock) return (inst != NULL); } -#if 0 -bool CRecordManager::CheckRecording(const CTimerd::RecordingInfo * const eventinfo) -{ - t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); - /* FIXME check if frontend used for timeshift the same and will zap ?? */ - if(/*(eventinfo->channel_id == live_channel_id) ||*/ !SAME_TRANSPONDER(eventinfo->channel_id, live_channel_id)) - StopAutoRecord(); - - return true; -} -#endif - void CRecordManager::StartNextRecording() { CTimerd::RecordingInfo * eventinfo = NULL; @@ -1053,25 +1007,6 @@ void CRecordManager::StartNextRecording() for(nextmap_iterator_t it = nextmap.begin(); it != nextmap.end(); it++) { eventinfo = *it; -#if 0 - bool tested = true; - if( !recmap.empty() ) { - CRecordInstance * inst = FindInstance(eventinfo->channel_id); - /* same channel recording and not auto - skip */ - if(inst && !inst->Timeshift()) - tested = false; - /* there is only auto-record which can be stopped */ - else if(recmap.size() == 1 && autoshift) - tested = true; - else { - /* there are some recordings, test any (first) for now */ - recmap_iterator_t fit = recmap.begin(); - t_channel_id channel_id = fit->second->GetChannelId(); - tested = (SAME_TRANSPONDER(channel_id, eventinfo->channel_id)); - } - } - if(tested) -#endif CZapitChannel * channel = CServiceManager::getInstance()->FindChannel(eventinfo->channel_id); if (channel && CFEManager::getInstance()->canTune(channel)) { @@ -1140,11 +1075,6 @@ void CRecordManager::StopInstance(CRecordInstance * inst, bool remove_event) if(inst->Timeshift()) autoshift = false; -#if 0 - t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); - if(inst->GetChannelId() == live_channel_id) - recordingstatus = 0; -#endif delete inst; } @@ -1278,47 +1208,6 @@ int CRecordManager::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data return messages_return::unhandled; } -#if 0 -bool CRecordManager::IsTimeshift(t_channel_id channel_id) -{ - bool ret = false; - CRecordInstance * inst; - mutex.lock(); - if (channel_id != 0) - { - inst = FindInstance(channel_id); - if(inst && inst->tshift_mode) - ret = true; - else - ret = false; - } else - { - for(recmap_iterator_t it = recmap.begin(); it != recmap.end(); it++) - { - if(it->second->tshift_mode) - { - mutex.unlock(); - return true; - } - } - } - mutex.unlock(); - return ret; -} - -void CRecordManager::SetTimeshiftMode(CRecordInstance * inst, int mode) -{ - mutex.lock(); - /* reset all instances mode ? */ - for(recmap_iterator_t it = recmap.begin(); it != recmap.end(); it++) - it->second->tshift_mode = TSHIFT_MODE_OFF; - - mutex.unlock(); - if (inst) - inst->tshift_mode = mode; -} -#endif - void CRecordManager::StartTimeshift() { if(g_RemoteControl->is_video_started) @@ -1326,26 +1215,6 @@ void CRecordManager::StartTimeshift() std::string tmode = "ptimeshift"; // already recording, pause bool res = true; t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); -#if 0 - if(RecordingStatus(live_channel_id)) - { - tmode = "ptimeshift"; // already recording, pause - if(GetRecordMode(live_channel_id) == RECMODE_TSHIFT) - SetTimeshiftMode(FindInstance(live_channel_id), TSHIFT_MODE_PAUSE); - } else - { - if(g_settings.temp_timeshift) - { - res = StartAutoRecord(); - SetTimeshiftMode(FindInstance(live_channel_id), TSHIFT_MODE_TEMPORAER); - } else - { - res = Record(live_channel_id); - SetTimeshiftMode(FindInstance(live_channel_id), TSHIFT_MODE_PERMANET); - } - tmode = "timeshift"; // record just started - } -#endif /* start temporary timeshift if enabled and not running, but dont start second record */ if (g_settings.temp_timeshift) { if (!FindTimeshift()) { @@ -1427,10 +1296,6 @@ int CRecordManager::exec(CMenuTarget* parent, const std::string & actionKey ) return menu_return::RETURN_EXIT_ALL; } -#if 0 - else - DisplayInfoMessage(g_Locale->getText(LOCALE_RECORDING_IS_RUNNING)); -#endif } else if(actionKey == "Timeshift") { StartTimeshift(); @@ -1497,7 +1362,6 @@ bool CRecordManager::ShowMenu(void) durations.push_back(duration); const char* mode_icon = NEUTRINO_ICON_REC; - //if (inst->tshift_mode) if (inst->Timeshift()) mode_icon = NEUTRINO_ICON_AUTO_SHIFT; @@ -1551,7 +1415,6 @@ bool CRecordManager::ShowMenu(void) bool CRecordManager::AskToStop(const t_channel_id channel_id, const int recid) { - //int recording_id = 0; std::string title, duration; CRecordInstance * inst; @@ -1562,7 +1425,6 @@ bool CRecordManager::AskToStop(const t_channel_id channel_id, const int recid) inst = FindInstance(channel_id); if(inst) { - //recording_id = inst->GetRecordingId(); inst->GetRecordString(title, duration); title += duration; } @@ -1572,9 +1434,6 @@ bool CRecordManager::AskToStop(const t_channel_id channel_id, const int recid) if(ShowMsg(LOCALE_SHUTDOWN_RECODING_QUERY, title.c_str(), CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbNo, NULL, 450, 30, false) == CMessageBox::mbrYes) { -#if 0 - g_Timerd->stopTimerEvent(recording_id); -#endif mutex.lock(); if (recid) inst = FindInstanceID(recid); diff --git a/src/driver/record.h b/src/driver/record.h index a75c67830..3205b5f06 100644 --- a/src/driver/record.h +++ b/src/driver/record.h @@ -163,14 +163,12 @@ class CRecordManager : public CMenuTarget /*, public CChangeObserver*/ bool CutBackNeutrino(const t_channel_id channel_id, CFrontend * &frontend); void RestoreNeutrino(void); - bool CheckRecording(const CTimerd::RecordingInfo * const eventinfo); void StartNextRecording(); void StopPostProcess(); void StopInstance(CRecordInstance * inst, bool remove_event = true); CRecordInstance * FindInstance(t_channel_id); CRecordInstance * FindInstanceID(int recid); CRecordInstance * FindTimeshift(); - //void SetTimeshiftMode(CRecordInstance * inst=NULL, int mode=TSHIFT_MODE_OFF); public: enum record_modes_t @@ -225,7 +223,6 @@ class CRecordManager : public CMenuTarget /*, public CChangeObserver*/ CRecordInstance* getRecordInstance(std::string file); // old code #if 0 - bool IsTimeshift(t_channel_id channel_id=0); bool MountDirectory(const char *recordingDir); bool ChooseRecDir(std::string &dir); int recordingstatus; From 61f9a8d8b4dbfce6865bfb05560b72f817df73ec Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Thu, 13 Mar 2014 14:33:41 +0400 Subject: [PATCH 090/225] zapit/include/zapit/types.h: add INVALID_SAT_POSITION define --- src/zapit/include/zapit/types.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/zapit/include/zapit/types.h b/src/zapit/include/zapit/types.h index 6ec6994e0..6f62866c0 100644 --- a/src/zapit/include/zapit/types.h +++ b/src/zapit/include/zapit/types.h @@ -81,4 +81,6 @@ typedef uint64_t transponder_id_t; #define GET_FREQ_FROM_TPID(transponder_id) ((freq_id_t)(transponder_id >> 48)) #define CREATE_FREQ_ID(frequency, cable) (freq_id_t)(cable ? frequency/100 : frequency/1000) +#define INVALID_SAT_POSITION 0x1FFF + #endif /* __zapit__types_h__ */ From 7d48b6c1f9ad1201e78681e079003daef2c1b753 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Thu, 13 Mar 2014 14:35:31 +0400 Subject: [PATCH 091/225] zapit/src/bouquets.cpp: use INVALID_SAT_POSITION instead of -1 --- src/zapit/include/zapit/bouquets.h | 2 +- src/zapit/src/bouquets.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/zapit/include/zapit/bouquets.h b/src/zapit/include/zapit/bouquets.h index 33b483fc7..82567133c 100644 --- a/src/zapit/include/zapit/bouquets.h +++ b/src/zapit/include/zapit/bouquets.h @@ -105,7 +105,7 @@ class CBouquetManager void saveBouquets(void); void saveUBouquets(void); - void saveBouquets(const CZapitClient::bouquetMode bouquetMode, const char * const providerName, t_satellite_position satellitePosition = -1); + void saveBouquets(const CZapitClient::bouquetMode bouquetMode, const char * const providerName, t_satellite_position satellitePosition = INVALID_SAT_POSITION); void loadBouquets(bool ignoreBouquetFile = false); void renumServices(); diff --git a/src/zapit/src/bouquets.cpp b/src/zapit/src/bouquets.cpp index 5cf329e58..6ee45ec10 100644 --- a/src/zapit/src/bouquets.cpp +++ b/src/zapit/src/bouquets.cpp @@ -283,7 +283,7 @@ void CBouquetManager::saveBouquets(const CZapitClient::bouquetMode bouquetMode, { if (bouquetMode == CZapitClient::BM_DELETEBOUQUETS) { INFO("removing existing bouquets"); - if (satellitePosition > 0) { + if (satellitePosition != INVALID_SAT_POSITION) { if (CFEManager::getInstance()->cableOnly()) g_bouquetManager->clearAll(false); else @@ -420,7 +420,7 @@ void CBouquetManager::parseBouquetsXml(const char *fname, bool bUser) if(!bUser) { /* set satellite position for provider bouquets. reset position to 0, if position not match - means mixed bouquet */ - if (newBouquet->satellitePosition < 0) + if (newBouquet->satellitePosition == INVALID_SAT_POSITION) newBouquet->satellitePosition = satellitePosition; else if (newBouquet->satellitePosition != satellitePosition) newBouquet->satellitePosition = 0; @@ -515,7 +515,7 @@ CZapitBouquet* CBouquetManager::addBouquet(const std::string & name, bool ub, bo newBouquet->bUser = ub; newBouquet->bFav = myfav; newBouquet->bOther = false; - newBouquet->satellitePosition = -1; + newBouquet->satellitePosition = INVALID_SAT_POSITION; //printf("CBouquetManager::addBouquet: %s, user %s\n", name.c_str(), ub ? "YES" : "NO"); if(ub) { @@ -681,7 +681,7 @@ void CBouquetManager::deletePosition(t_satellite_position satellitePosition) BouquetList tmplist; for (unsigned int i =0; i < Bouquets.size(); i++) { if (satellitePosition == Bouquets[i]->satellitePosition) { -printf("CBouquetManager::deletePosition: delete [%s]\n", Bouquets[i]->Name.c_str()); + printf("CBouquetManager::deletePosition: delete [%s]\n", Bouquets[i]->Name.c_str()); delete Bouquets[i]; } else tmplist.push_back(Bouquets[i]); From b2dc082707f413c7dd92b574e899a474460b138b Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Thu, 13 Mar 2014 15:45:41 +0400 Subject: [PATCH 092/225] zapit/src/capmt.cpp: stop cam if channel not found --- src/zapit/include/zapit/capmt.h | 1 + src/zapit/src/capmt.cpp | 32 ++++++++++++++++++-------------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/zapit/include/zapit/capmt.h b/src/zapit/include/zapit/capmt.h index b16180262..30772bc63 100644 --- a/src/zapit/include/zapit/capmt.h +++ b/src/zapit/include/zapit/capmt.h @@ -94,6 +94,7 @@ class CCamManager OpenThreads::Mutex mutex; static CCamManager * manager; bool SetMode(t_channel_id id, enum runmode mode, bool enable, bool force_update = false); + void StopCam(t_channel_id id, CCam *cam); public: CCamManager(); diff --git a/src/zapit/src/capmt.cpp b/src/zapit/src/capmt.cpp index 275b49a44..8f8fc3f95 100644 --- a/src/zapit/src/capmt.cpp +++ b/src/zapit/src/capmt.cpp @@ -181,6 +181,14 @@ CCamManager * CCamManager::getInstance(void) return manager; } +void CCamManager::StopCam(t_channel_id channel_id, CCam *cam) +{ + cam->sendMessage(NULL, 0, false); + cam->sendCaPmt(channel_id, NULL, 0); + channel_map.erase(channel_id); + delete cam; +} + bool CCamManager::SetMode(t_channel_id channel_id, enum runmode mode, bool start, bool force_update) { CCam * cam; @@ -190,12 +198,7 @@ bool CCamManager::SetMode(t_channel_id channel_id, enum runmode mode, bool start CZapitChannel * channel = CServiceManager::getInstance()->FindChannel(channel_id); - if(channel == NULL) { - printf("CCamManager: channel %" PRIx64 " not found\n", channel_id); - return false; - } - //INFO("channel %llx [%s] mode %d %s update %d", channel_id, channel->getName().c_str(), mode, start ? "START" : "STOP", force_update); - mutex.lock(); + OpenThreads::ScopedLock m_lock(mutex); cammap_iterator_t it = channel_map.find(channel_id); if(it != channel_map.end()) { @@ -204,9 +207,14 @@ bool CCamManager::SetMode(t_channel_id channel_id, enum runmode mode, bool start cam = new CCam(); channel_map.insert(std::pair(channel_id, cam)); } else { - mutex.unlock(); return false; } + if(channel == NULL) { + printf("CCamManager: channel %" PRIx64 " not found\n", channel_id); + StopCam(channel_id, cam); + return false; + } + //INFO("channel %llx [%s] mode %d %s update %d", channel_id, channel->getName().c_str(), mode, start ? "START" : "STOP", force_update); /* FIXME until proper demux management */ switch(mode) { @@ -246,10 +254,7 @@ bool CCamManager::SetMode(t_channel_id channel_id, enum runmode mode, bool start if((oldmask != newmask) || force_update) { cam->setCaMask(newmask); cam->setSource(source); - if(newmask == 0) { - cam->sendMessage(NULL, 0, false); - cam->sendCaPmt(channel->getChannelID(), NULL, 0); - } else { + if(newmask != 0) { cam->makeCaPmt(channel, true); cam->setCaPmt(true); } @@ -259,9 +264,9 @@ bool CCamManager::SetMode(t_channel_id channel_id, enum runmode mode, bool start /* FIXME: back to live channel from playback dont parse pmt and call setCaPmt * (see CMD_SB_LOCK / UNLOCK PLAYBACK */ //channel->setRawPmt(NULL);//FIXME - channel_map.erase(channel_id); - delete cam; + StopCam(channel_id, cam); } + CaIdVector caids; cCA::GetInstance()->GetCAIDS(caids); //uint8_t list = CCam::CAPMT_FIRST; @@ -287,7 +292,6 @@ bool CCamManager::SetMode(t_channel_id channel_id, enum runmode mode, bool start cam->sendCaPmt(channel->getChannelID(), buffer, len); //list = CCam::CAPMT_MORE; } - mutex.unlock(); return true; } From c5e1ab04e6b761aeee25a095d22552bf673a274d Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Thu, 13 Mar 2014 15:52:33 +0400 Subject: [PATCH 093/225] zapit/src/getservices.cpp: add code to remove channels for the given satellite position, current live channel skipped to prevent neutrino crashes --- src/zapit/include/zapit/getservices.h | 1 + src/zapit/src/getservices.cpp | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/zapit/include/zapit/getservices.h b/src/zapit/include/zapit/getservices.h index 2dc1cd0dc..bfc4e0014 100644 --- a/src/zapit/include/zapit/getservices.h +++ b/src/zapit/include/zapit/getservices.h @@ -123,6 +123,7 @@ class CServiceManager void ResetChannelNumbers(bool bouquets = true, bool numbers = false); void RemoveChannel(const t_channel_id channel_id); + void RemovePosition(t_satellite_position satellitePosition); void RemoveAllChannels(); void RemoveCurrentChannels(); void RemoveNVODChannels(); diff --git a/src/zapit/src/getservices.cpp b/src/zapit/src/getservices.cpp index 289e2f67b..af134fa52 100644 --- a/src/zapit/src/getservices.cpp +++ b/src/zapit/src/getservices.cpp @@ -164,6 +164,21 @@ void CServiceManager::RemoveAllChannels() { allchans.clear(); } + +void CServiceManager::RemovePosition(t_satellite_position satellitePosition) +{ + INFO("delete %d, size before: %d", satellitePosition, allchans.size()); + t_channel_id live_id = CZapit::getInstance()->GetCurrentChannelID(); + for (channel_map_iterator_t it = allchans.begin(); it != allchans.end();) { + if (it->second.getSatellitePosition() == satellitePosition && live_id != it->first) + allchans.erase(it++); + else + ++it; + } + services_changed = true; + INFO("delete %d, size after: %d", satellitePosition, allchans.size()); +} + #if 0 //never used void CServiceManager::RemoveNVODChannels() From 90768b15acc5a1b9bc878fbb54823bf4866560d2 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Thu, 13 Mar 2014 16:06:20 +0400 Subject: [PATCH 094/225] gui/bouquetlist.cpp: allow to delete whole satellite from satellite bouquet view --- src/gui/bouquetlist.cpp | 35 ++++++++++++++++++++++------------- src/gui/bouquetlist.h | 2 ++ 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/gui/bouquetlist.cpp b/src/gui/bouquetlist.cpp index 8132fa3a2..2093e52dd 100644 --- a/src/gui/bouquetlist.cpp +++ b/src/gui/bouquetlist.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include #include @@ -56,6 +57,7 @@ #include #include +#include extern CBouquetManager *g_bouquetManager; @@ -230,7 +232,7 @@ int CBouquetList::doMenu() zapitBouquet = Bouquets[selected]->zapitBouquet; /* zapitBouquet not NULL only on real bouquets, not on virtual SAT or HD */ - if(!zapitBouquet) + if(!zapitBouquet && Bouquets[selected]->satellitePosition == INVALID_SAT_POSITION) return 0; CMenuWidget* menu = new CMenuWidget(LOCALE_CHANNELLIST_EDIT, NEUTRINO_ICON_SETTINGS); @@ -238,7 +240,7 @@ int CBouquetList::doMenu() CMenuSelectorTarget * selector = new CMenuSelectorTarget(&select); sprintf(cnt, "%d", i); - if(!zapitBouquet->bUser) { + if (zapitBouquet && !zapitBouquet->bUser) { menu->addItem(new CMenuForwarder(LOCALE_FAVORITES_COPY, true, NULL, selector, cnt, CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE), old_selected == i ++); menu->exec(NULL, ""); delete menu; @@ -289,17 +291,24 @@ int CBouquetList::doMenu() printf("CBouquetList::doMenu: %d selected\n", select); if(select >= 0) { old_selected = select; - switch(select) { - case 0: - hide(); - bouquet_id = g_bouquetManager->existsUBouquet(Bouquets[selected]->channelList->getName()); - if(bouquet_id >= 0) { - g_bouquetManager->deleteBouquet(bouquet_id); - return 1; - } - break; - default: - break; + hide(); + + int result = ShowMsg ( LOCALE_BOUQUETEDITOR_DELETE, Bouquets[selected]->channelList->getName(), CMessageBox::mbrNo, CMessageBox::mbYes | CMessageBox::mbNo ); + if(result != CMessageBox::mbrYes) + return -1; + + if (zapitBouquet) { + bouquet_id = g_bouquetManager->existsUBouquet(Bouquets[selected]->channelList->getName()); + if(bouquet_id >= 0) { + g_bouquetManager->deleteBouquet(bouquet_id); + return 1; + } + } else { + CServiceManager::getInstance()->RemovePosition(Bouquets[selected]->satellitePosition); + g_bouquetManager->loadBouquets(); + g_bouquetManager->deletePosition(Bouquets[selected]->satellitePosition); + CServiceManager::getInstance()->SetServicesChanged(true); + return 1; } } return -1; diff --git a/src/gui/bouquetlist.h b/src/gui/bouquetlist.h index c8eb4b3ec..1b5968fe2 100644 --- a/src/gui/bouquetlist.h +++ b/src/gui/bouquetlist.h @@ -58,12 +58,14 @@ class CBouquet bool bLocked; CChannelList* channelList; CZapitBouquet * zapitBouquet; + t_satellite_position satellitePosition; CBouquet(const int Unique_key, const char * const Name, const bool locked, bool vlist = false) { zapitBouquet = NULL; unique_key = Unique_key; bLocked = locked; + satellitePosition = INVALID_SAT_POSITION; channelList = new CChannelList(Name, false, vlist); } From 90b9469e3b2d2c9f50a9aee9a0b691d9677e6b13 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Thu, 13 Mar 2014 16:06:46 +0400 Subject: [PATCH 095/225] neutrino.cpp: set satellite position for generated satellite bouquets --- src/neutrino.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index df548abe1..c0a56ba7e 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -1384,6 +1384,7 @@ void CNeutrinoApp::channelsInit(bool bOnly) tvi = 0, ri = 0; CBouquet* tmp1 = TVsatList->addBouquet(sit->second.name.c_str()); CBouquet* tmp2 = RADIOsatList->addBouquet(sit->second.name.c_str()); + tmp1->satellitePosition = tmp2->satellitePosition = sit->first; for(zapit_list_it_t it = zapitList.begin(); it != zapitList.end(); it++) { if ((*it)->getServiceType() == ST_DIGITAL_TELEVISION_SERVICE) { @@ -1395,7 +1396,7 @@ void CNeutrinoApp::channelsInit(bool bOnly) ri++; } } - printf("[neutrino] created %s bouquet with %d TV and %d RADIO channels\n", sit->second.name.c_str(), tvi, ri); + printf("[neutrino] created %s (%d) bouquet with %d TV and %d RADIO channels\n", sit->second.name.c_str(), sit->first, tvi, ri); if(!tvi) TVsatList->deleteBouquet(tmp1); if(!ri) @@ -2427,9 +2428,9 @@ _show: nNewChannel = bouquetList->exec(true); } _repeat: - CVFD::getInstance ()->showServicename(channelList->getActiveChannelName()); - CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO); printf("************************* ZAP RES: nNewChannel %d\n", nNewChannel);fflush(stdout); + //CVFD::getInstance ()->showServicename(channelList->getActiveChannelName()); + CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO); if(nNewChannel == -1) { // restore orig. bouquet and selected channel on cancel /* FIXME if mode was changed while browsing, * other modes selected bouquet not restored */ From e0055b53394619e4de6214793267c9f58b9677cd Mon Sep 17 00:00:00 2001 From: FlatTV Date: Thu, 13 Mar 2014 17:24:36 +0100 Subject: [PATCH 096/225] record menu: add filename template --- data/locale/deutsch.locale | 4 ++ data/locale/english.locale | 4 ++ src/driver/record.cpp | 76 +++++++++++++++++++++++++++++--------- src/driver/record.h | 5 ++- src/gui/record_setup.cpp | 11 ++++-- src/neutrino.cpp | 2 + src/system/locals.h | 4 ++ src/system/locals_intern.h | 4 ++ src/system/settings.h | 1 + 9 files changed, 89 insertions(+), 22 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index e5e742691..23e947194 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -1060,6 +1060,7 @@ menu.hint_record_data_dvbsub Untertitel-Spur zu Aufnahme hinzufügen menu.hint_record_data_vtxt Teletext-Spur zu Aufnahme hinzufügen menu.hint_record_dir Wählen Sie das Aufnahmeverzeichnis menu.hint_record_end Wählen Sie zwischen maximaler Aufnahmezeit oder einem Aufnahmeende anhand der EPG-Daten +menu.hint_record_filename_template Vorlagemuster für den Dateiname bearbeiten menu.hint_record_slow_warn Zeige Warnung, wenn der Aufnahmepuffer zu überlaufen droht menu.hint_record_startstop_msg Schaltet die Meldung bei Aufnahmestart/ende ein oder aus. menu.hint_record_tdir Wählen Sie ein Verzeichnis für Ihre Timeshift-Aufnahmen im temporären Timeshift-Modus @@ -1699,6 +1700,9 @@ recordingmenu.end_of_recording_epg EPG aktuelles Event recordingmenu.end_of_recording_max max. Aufnahmezeit recordingmenu.end_of_recording_name Ende der Sofortaufnahme recordingmenu.file Direkt (Datei) +recordingmenu.filename_template Vorlage für Dateiname +recordingmenu.filename_template_hint Platzhalter werden durch folgende Werte ersetzt: +recordingmenu.filename_template_hint2 %C = Kanal, %T = Titel, %I = Info, %d = Datum, %t = Zeit recordingmenu.help Aufnahmegeräte:\n-----------------------\nServer:\nauf PC mit Hilfe eines Streaming-Programmes\n\n(analoger) Videorekorder:\nüber VCR-Ausgang\n\nDirekt (Datei):\nauf ein per NFS gemountetes Verzeichnis\noder eine interne Festplatte\nTS: SPTS-Mode Treiber laden(dbox2)\nPES: SPTS-Mode Treiber nicht laden(dbox2)\n\n\nMaximale Dateigröße:\n----------------------\nNFS V2: 2 GB (2048 MB)\nNFS V3: fast unendlich (0 MB)\nFAT: 2 GB (2048 MB)\nFAT32: 4 GB (4096 MB) recordingmenu.multimenu.ask_stop_all Wirklich alle %d Aufnahmen beenden? recordingmenu.multimenu.info_stop_all %d von %d Aufnahmen werden beendet. diff --git a/data/locale/english.locale b/data/locale/english.locale index c3d92d2ab..4c08276d9 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -1061,6 +1061,7 @@ menu.hint_record_data_dvbsub subtitle stream menu.hint_record_data_vtxt VideoText stream menu.hint_record_dir Select directory to store recordings menu.hint_record_end Stop direct record after maximal time or after current event end time +menu.hint_record_filename_template edit filename template menu.hint_record_slow_warn Show warning, when record buffer is close to overflow menu.hint_record_startstop_msg Turns the message when recording start/end on or off. menu.hint_record_tdir Select directory to save timeshift recordings\nin temporary timeshift mode @@ -1703,6 +1704,9 @@ recordingmenu.end_of_recording_epg EPG act. Event recordingmenu.end_of_recording_max max. Recordingtime recordingmenu.end_of_recording_name Endtime of Recording recordingmenu.file direct (file) +recordingmenu.filename_template filename template +recordingmenu.filename_template_hint wildcards will be replaced +recordingmenu.filename_template_hint2 %C = channel, %T = title, %I = info, %d = date, %t = time recordingmenu.help Recording devices:\n--------------------------\nserver:\nusing streaming software on a PC\n\n(analog) vcr:\nusing the vcr outlet\n\ndirect (file):\ndirectly into an NFS mounted directory\nor onto an internal hard drive\nTS: use spts mode(dbox2)\nPES: do not use spts mode(dbox2)\n\n\nMax. file size:\n---------------------\nNFS V2: 2 GB (2048 MB)\nNFS V3: almost unlimited (0 MB)\nFAT: 2 GB (2048 MB)\nFAT32: 4 GB (4096 MB) recordingmenu.multimenu.ask_stop_all really stop all %d recordings? recordingmenu.multimenu.info_stop_all %d of %d recordings will be stopped. diff --git a/src/driver/record.cpp b/src/driver/record.cpp index 9e6697b68..7e2896903 100644 --- a/src/driver/record.cpp +++ b/src/driver/record.cpp @@ -680,25 +680,13 @@ record_error_msg_t CRecordInstance::MakeFileName(CZapitChannel * channel) strncat(filename, "_",FILENAMEBUFFERSIZE - strlen(filename)-1); } - pos = strlen(filename); - if (g_settings.recording_epg_for_filename) { - if(epgid != 0) { - CShortEPGData epgdata; - if(CEitManager::getInstance()->getEPGidShort(epgid, &epgdata)) { - if (!(epgdata.title.empty())) { - strcpy(&(filename[pos]), epgdata.title.c_str()); - ZapitTools::replace_char(&filename[pos]); - } - } - } else if (!epgTitle.empty()) { - strcpy(&(filename[pos]), epgTitle.c_str()); - ZapitTools::replace_char(&filename[pos]); - } - } + pos = strlen(filename) - ((!autoshift && g_settings.recording_save_in_channeldir) ? 0 : (ext_channel_name.length() /*remove last "_"*/ +1)); + + std::string ext_file_name = g_settings.recording_filename_template; + MakeExtFileName(channel, ext_file_name); + strcpy(&(filename[pos]), UTF8_TO_FILESYSTEM_ENCODING(ext_file_name.c_str())); pos = strlen(filename); - time_t t = time(NULL); - pos += strftime(&(filename[pos]), sizeof(filename) - pos - 1, "%Y%m%d_%H%M%S", localtime(&t)); if(autoshift) strncat(filename, "_temp",FILENAMEBUFFERSIZE - strlen(filename)-1); @@ -706,6 +694,60 @@ record_error_msg_t CRecordInstance::MakeFileName(CZapitChannel * channel) return RECORD_OK; } +void CRecordInstance::StringReplace(std::string &str, const std::string search, const std::string rstr) +{ + std::string::size_type ptr = 0; + std::string::size_type pos = 0; + while((ptr = str.find(search,pos)) != std::string::npos){ + str.replace(ptr,search.length(),rstr); + pos = ptr + rstr.length(); + } +} + +void CRecordInstance::MakeExtFileName(CZapitChannel * channel, std::string &FilenameTemplate) +{ + char buf[256]; + + // %C == channel, %T == title, %I == info1, %d == date, %t == time_t + if (FilenameTemplate.empty()) + FilenameTemplate = "%C_%T_%d_%t"; + + time_t t = time(NULL); + strftime(buf,sizeof(buf),"%Y%m%d",localtime(&t)); + StringReplace(FilenameTemplate,"%d",buf); + + strftime(buf,sizeof(buf),"%H%M%S",localtime(&t)); + StringReplace(FilenameTemplate,"%t",buf); + + std::string channel_name = channel->getName(); + if (!(channel_name.empty())) { + strcpy(buf, UTF8_TO_FILESYSTEM_ENCODING(channel_name.c_str())); + ZapitTools::replace_char(buf); + StringReplace(FilenameTemplate,"%C",buf); + } + else + StringReplace(FilenameTemplate,"%C","no_channel"); + + CShortEPGData epgdata; + if(CEitManager::getInstance()->getEPGidShort(epgid, &epgdata)) { + if (!(epgdata.title.empty())) { + strcpy(buf, epgdata.title.c_str()); + ZapitTools::replace_char(buf); + StringReplace(FilenameTemplate,"%T",buf); + } + else + StringReplace(FilenameTemplate,"%T","no_title"); + + if (!(epgdata.info1.empty())) { + strcpy(buf, epgdata.info1.c_str()); + ZapitTools::replace_char(buf); + StringReplace(FilenameTemplate,"%I",buf); + } + else + StringReplace(FilenameTemplate,"%I","no_info"); + } +} + void CRecordInstance::GetRecordString(std::string &str, std::string &dur) { CZapitChannel * channel = CServiceManager::getInstance()->FindChannel(channel_id); diff --git a/src/driver/record.h b/src/driver/record.h index 3205b5f06..365d24f89 100644 --- a/src/driver/record.h +++ b/src/driver/record.h @@ -79,6 +79,7 @@ class CRecordInstance t_channel_id channel_id; event_id_t epgid; std::string epgTitle; + std::string epgInfo1; unsigned char apidmode; time_t epg_time; time_t start_time; @@ -107,7 +108,9 @@ class CRecordInstance bool SaveXml(); record_error_msg_t Start(CZapitChannel * channel); void WaitRecMsg(time_t StartTime, time_t WaitTime); - public: + void MakeExtFileName(CZapitChannel * channel, std::string &FilenameTemplate); + void StringReplace(std::string &str, const std::string search, const std::string rstr); + public: CRecordInstance(const CTimerd::RecordingInfo * const eventinfo, std::string &dir, bool timeshift = false, bool stream_vtxt_pid = false, bool stream_pmt_pid = false, bool stream_subtitle_pids = false); ~CRecordInstance(); diff --git a/src/gui/record_setup.cpp b/src/gui/record_setup.cpp index 41d70ed3a..3bfe629bf 100644 --- a/src/gui/record_setup.cpp +++ b/src/gui/record_setup.cpp @@ -239,9 +239,12 @@ int CRecordSetup::showRecordSetup() recordingSettings->addItem(startstop_msg); } - //template - //CStringInput recordingSettings_filenameTemplate(LOCALE_RECORDINGMENU_FILENAME_TEMPLATE, &g_settings.recording_filename_template[0], 21, LOCALE_RECORDINGMENU_FILENAME_TEMPLATE_HINT, LOCALE_IPSETUP_HINT_2, "%/-_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 "); - //CMenuForwarder* mf11 = new CMenuForwarder(LOCALE_RECORDINGMENU_FILENAME_TEMPLATE, true, g_settings.recording_filename_template[0], &recordingSettings_filenameTemplate); + //filename template + CStringInputSMS* filename_template = new CStringInputSMS(LOCALE_RECORDINGMENU_FILENAME_TEMPLATE, &g_settings.recording_filename_template, 21, LOCALE_RECORDINGMENU_FILENAME_TEMPLATE_HINT, LOCALE_RECORDINGMENU_FILENAME_TEMPLATE_HINT2, "%/-_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 "); + CMenuForwarder* ft = new CMenuDForwarder(LOCALE_RECORDINGMENU_FILENAME_TEMPLATE, true, g_settings.recording_filename_template, filename_template, NULL, CRCInput::RC_1); + ft->setHint("", LOCALE_MENU_HINT_RECORD_FILE_TEMPLATE); + recordingSettings->addItem(ft); + recordingSettings->addItem(GenericMenuSeparatorLine); if (!g_settings.easymenu) { @@ -267,7 +270,7 @@ int CRecordSetup::showRecordSetup() //datasettings showRecordDataSetup(&recordingaDataSettings); - mf = new CMenuForwarder(LOCALE_RECORDINGMENU_DATA_PIDS, true, NULL, &recordingaDataSettings, NULL, CRCInput::RC_1); + mf = new CMenuForwarder(LOCALE_RECORDINGMENU_DATA_PIDS, true, NULL, &recordingaDataSettings, NULL, CRCInput::RC_2); mf->setHint("", LOCALE_MENU_HINT_RECORD_DATA); recordingSettings->addItem(mf); } diff --git a/src/neutrino.cpp b/src/neutrino.cpp index c0a56ba7e..800f75666 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -613,6 +613,7 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.recording_stream_vtxt_pid = configfile.getBool("recordingmenu.stream_vtxt_pid" , true); g_settings.recording_stream_subtitle_pids = configfile.getBool("recordingmenu.stream_subtitle_pids", true); g_settings.recording_stream_pmt_pid = configfile.getBool("recordingmenu.stream_pmt_pid" , false); + g_settings.recording_filename_template = configfile.getString("recordingmenu.filename_template" , "%C_%T%d_%t"); g_settings.recording_choose_direct_rec_dir = configfile.getInt32( "recording_choose_direct_rec_dir", 0 ); g_settings.recording_epg_for_filename = configfile.getBool("recording_epg_for_filename" , true); g_settings.recording_epg_for_end = configfile.getBool("recording_epg_for_end" , true); @@ -1099,6 +1100,7 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setBool ("recordingmenu.stream_vtxt_pid" , g_settings.recording_stream_vtxt_pid ); configfile.setBool ("recordingmenu.stream_subtitle_pids" , g_settings.recording_stream_subtitle_pids ); configfile.setBool ("recordingmenu.stream_pmt_pid" , g_settings.recording_stream_pmt_pid ); + configfile.setString("recordingmenu.filename_template" , g_settings.recording_filename_template ); configfile.setInt32 ("recording_choose_direct_rec_dir" , g_settings.recording_choose_direct_rec_dir); configfile.setBool ("recording_epg_for_filename" , g_settings.recording_epg_for_filename ); configfile.setBool ("recording_epg_for_end" , g_settings.recording_epg_for_end ); diff --git a/src/system/locals.h b/src/system/locals.h index 18d2caae5..ec1448254 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -1088,6 +1088,7 @@ typedef enum LOCALE_MENU_HINT_RECORD_DATA_VTXT, LOCALE_MENU_HINT_RECORD_DIR, LOCALE_MENU_HINT_RECORD_END, + LOCALE_MENU_HINT_RECORD_FILE_TEMPLATE, LOCALE_MENU_HINT_RECORD_SLOW_WARN, LOCALE_MENU_HINT_RECORD_STARTSTOP_MSG, LOCALE_MENU_HINT_RECORD_TDIR, @@ -1730,6 +1731,9 @@ typedef enum LOCALE_RECORDINGMENU_END_OF_RECORDING_MAX, LOCALE_RECORDINGMENU_END_OF_RECORDING_NAME, LOCALE_RECORDINGMENU_FILE, + LOCALE_RECORDINGMENU_FILENAME_TEMPLATE, + LOCALE_RECORDINGMENU_FILENAME_TEMPLATE_HINT, + LOCALE_RECORDINGMENU_FILENAME_TEMPLATE_HINT2, LOCALE_RECORDINGMENU_HELP, LOCALE_RECORDINGMENU_MULTIMENU_ASK_STOP_ALL, LOCALE_RECORDINGMENU_MULTIMENU_INFO_STOP_ALL, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index ca130e871..f2369d4a4 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -1088,6 +1088,7 @@ const char * locale_real_names[] = "menu.hint_record_data_vtxt", "menu.hint_record_dir", "menu.hint_record_end", + "menu.hint_record_filename_template", "menu.hint_record_slow_warn", "menu.hint_record_startstop_msg", "menu.hint_record_tdir", @@ -1730,6 +1731,9 @@ const char * locale_real_names[] = "recordingmenu.end_of_recording_max", "recordingmenu.end_of_recording_name", "recordingmenu.file", + "recordingmenu.filename_template", + "recordingmenu.filename_template_hint", + "recordingmenu.filename_template_hint2", "recordingmenu.help", "recordingmenu.multimenu.ask_stop_all", "recordingmenu.multimenu.info_stop_all", diff --git a/src/system/settings.h b/src/system/settings.h index 610d38d9e..f2d4255f0 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -376,6 +376,7 @@ struct SNeutrinoSettings int recording_slow_warning; int recording_startstop_msg; int shutdown_timer_record_type; + std::string recording_filename_template; int filesystem_is_utf8; // default plugin for ts-movieplayer (red button) From 32a9fb879613423bb96748e63bc62f0afadbae80 Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Sun, 9 Mar 2014 09:30:23 +0100 Subject: [PATCH 097/225] Update deutsch.locale --- data/locale/deutsch.locale | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 23e947194..d5f3f4fa3 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -403,7 +403,8 @@ extra.lodirection Längengrad-Ausrichtung extra.longitude Längengrad extra.menu_left_exit "links" = Menü zurück extra.north Norden -extra.record_time Maximale Aufnahmezeit +extra.record_time Maximale Aufnahmedauer +extra.record_time_ts Maximale Timeshiftdauer extra.rotor_swap Rotor dreht Ost/West extra.rounded_corners Eckendarstellung extra.rounded_corners_off eckig @@ -1064,7 +1065,8 @@ menu.hint_record_filename_template Vorlagemuster für den Dateiname bearbeiten menu.hint_record_slow_warn Zeige Warnung, wenn der Aufnahmepuffer zu überlaufen droht menu.hint_record_startstop_msg Schaltet die Meldung bei Aufnahmestart/ende ein oder aus. menu.hint_record_tdir Wählen Sie ein Verzeichnis für Ihre Timeshift-Aufnahmen im temporären Timeshift-Modus -menu.hint_record_time Geben Sie eine maximale Aufnahmezeit in Stunden ein, wenn Sie die Aufnahme nicht vorzeitig stoppen +menu.hint_record_time Aufzeichnungsdauer vor dem Stopp bei der Verwendung von Direktaufzeichnung mit Record-Taste. +menu.hint_record_time_ts Timeshiftdauer vor dem Stopp, wenn temporäres Timeshift aktiviert. menu.hint_record_timeafter Stellen Sie die Nachlaufzeit für Timer-Aufnahmen ein\nEin Wert von 2 beendet die Aufnahme 2 Minuten nach dem Sendungsende menu.hint_record_timebefore Stellen Sie die Vorlaufzeit für Timer-Aufnahmen ein\nEin Wert von 2 startet die Aufnahme 2 Minuten vor dem Sendungsbeginn menu.hint_record_timer Konfigurieren Sie Optionen für Timer-Aufnahmen @@ -1117,6 +1119,7 @@ menu.hint_scan_logical_hd Wenn der Kanal in SD und in HD verfügbar ist, wird HD menu.hint_scan_longitude Geben Sie ihren Längengrad ein menu.hint_scan_manual Manueller Transponder-Suchlauf mit ausgewählten Parametern menu.hint_scan_mod Wählen Sie eine Transponder-Modulation +menu.hint_scan_motor Rotor Optionen, Satfinder menu.hint_scan_motor_18v Benutze 18V für Motorbewegungen menu.hint_scan_motor_speed Rotor-Bewegungsgeschwindigkeit in 1/10 Grad pro Sekunde menu.hint_scan_motorpos Wählen Sie eine gespeicherten Positions-Nummer für diesen Satelliten,\nwird ignoriert, wenn USALS aktiv @@ -1141,6 +1144,7 @@ menu.hint_scan_start Startet die Kanalsuche mit den angegebenen Parametern.\nMit menu.hint_scan_test Testen Sie das Signal für diesen Transponder menu.hint_scan_tpselect Wählen Sie einen einzelnen Transponder für den Suchlauf menu.hint_scan_uncommited Wählen Sie nicht festgeschriebene Angaben für diesen Satelliten +menu.hint_scan_usals USALS Optionen menu.hint_scan_usals_repeat Geben Sie die USALS-Wiederholungen für den Rotor ein menu.hint_scan_usalsall Verwenden Sie USALS für alle Satelliten an diesem Tuner menu.hint_scan_useusals Verwenden Sie USALS für diesen Satelliten,\nwenn aktiv, wird Rotorposition ignoriert From bb4eccfbed459c6f794bf258e1d89dd2d261a96f Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Fri, 14 Mar 2014 17:52:28 +0100 Subject: [PATCH 098/225] CRecordSetup: Fix menu hint specifier --- data/locale/deutsch.locale | 2 +- src/gui/record_setup.cpp | 2 +- src/system/locals.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index d5f3f4fa3..b225476b6 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -1061,7 +1061,7 @@ menu.hint_record_data_dvbsub Untertitel-Spur zu Aufnahme hinzufügen menu.hint_record_data_vtxt Teletext-Spur zu Aufnahme hinzufügen menu.hint_record_dir Wählen Sie das Aufnahmeverzeichnis menu.hint_record_end Wählen Sie zwischen maximaler Aufnahmezeit oder einem Aufnahmeende anhand der EPG-Daten -menu.hint_record_filename_template Vorlagemuster für den Dateiname bearbeiten +menu.hint_record_filename_template Vorlagemuster für den Dateinamen bearbeiten menu.hint_record_slow_warn Zeige Warnung, wenn der Aufnahmepuffer zu überlaufen droht menu.hint_record_startstop_msg Schaltet die Meldung bei Aufnahmestart/ende ein oder aus. menu.hint_record_tdir Wählen Sie ein Verzeichnis für Ihre Timeshift-Aufnahmen im temporären Timeshift-Modus diff --git a/src/gui/record_setup.cpp b/src/gui/record_setup.cpp index 3bfe629bf..a3206aa1e 100644 --- a/src/gui/record_setup.cpp +++ b/src/gui/record_setup.cpp @@ -242,7 +242,7 @@ int CRecordSetup::showRecordSetup() //filename template CStringInputSMS* filename_template = new CStringInputSMS(LOCALE_RECORDINGMENU_FILENAME_TEMPLATE, &g_settings.recording_filename_template, 21, LOCALE_RECORDINGMENU_FILENAME_TEMPLATE_HINT, LOCALE_RECORDINGMENU_FILENAME_TEMPLATE_HINT2, "%/-_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 "); CMenuForwarder* ft = new CMenuDForwarder(LOCALE_RECORDINGMENU_FILENAME_TEMPLATE, true, g_settings.recording_filename_template, filename_template, NULL, CRCInput::RC_1); - ft->setHint("", LOCALE_MENU_HINT_RECORD_FILE_TEMPLATE); + ft->setHint("", LOCALE_MENU_HINT_RECORD_FILENAME_TEMPLATE); recordingSettings->addItem(ft); recordingSettings->addItem(GenericMenuSeparatorLine); diff --git a/src/system/locals.h b/src/system/locals.h index ec1448254..2ac9d7fd0 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -1088,7 +1088,7 @@ typedef enum LOCALE_MENU_HINT_RECORD_DATA_VTXT, LOCALE_MENU_HINT_RECORD_DIR, LOCALE_MENU_HINT_RECORD_END, - LOCALE_MENU_HINT_RECORD_FILE_TEMPLATE, + LOCALE_MENU_HINT_RECORD_FILENAME_TEMPLATE, LOCALE_MENU_HINT_RECORD_SLOW_WARN, LOCALE_MENU_HINT_RECORD_STARTSTOP_MSG, LOCALE_MENU_HINT_RECORD_TDIR, From 623efecc2fa787bd3678c7508eceef1c1a6929f6 Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Sun, 16 Mar 2014 11:56:35 +0100 Subject: [PATCH 099/225] CLuaInstance: Add debug output to CWindowDelete/ComponentsTextDelete --- src/gui/luainstance.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/luainstance.cpp b/src/gui/luainstance.cpp index f5a4456c2..3ec4c504d 100644 --- a/src/gui/luainstance.cpp +++ b/src/gui/luainstance.cpp @@ -1432,11 +1432,12 @@ int CLuaInstance::CWindowGetFooterHeight(lua_State *L) int CLuaInstance::CWindowDelete(lua_State *L) { + DBG("CLuaInstance::%s %d\n", __func__, lua_gettop(L)); CLuaCWindow *m = CWindowCheck(L, 1); if (!m) return 0; - m->w->kill(); + m->w->hide(); delete m; return 0; } @@ -1653,11 +1654,12 @@ int CLuaInstance::ComponentsTextScroll(lua_State *L) int CLuaInstance::ComponentsTextDelete(lua_State *L) { + DBG("CLuaInstance::%s %d\n", __func__, lua_gettop(L)); CLuaComponentsText *m = ComponentsTextCheck(L, 1); if (!m) return 0; - m->ct->kill(); + m->ct->hide(); delete m; return 0; } From f4c70c96a50270950b0886ba7cacab05e8934477 Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Sun, 16 Mar 2014 11:56:48 +0100 Subject: [PATCH 100/225] CLuaInstance: Add additional tableLookup for get userdata --- src/gui/luainstance.cpp | 12 ++++++++++++ src/gui/luainstance.h | 1 + 2 files changed, 13 insertions(+) diff --git a/src/gui/luainstance.cpp b/src/gui/luainstance.cpp index 3ec4c504d..cc9d2a94d 100644 --- a/src/gui/luainstance.cpp +++ b/src/gui/luainstance.cpp @@ -677,6 +677,18 @@ bool CLuaInstance::tableLookup(lua_State *L, const char *what, int &value) return res; } +bool CLuaInstance::tableLookup(lua_State *L, const char *what, void** value) +{ + bool res = false; + lua_pushstring(L, what); + lua_gettable(L, -2); + res = lua_isuserdata(L, -1); + if (res) + *value = lua_unboxpointer(L, -1); + lua_pop(L, 1); + return res; +} + bool CLuaMenuChangeObserver::changeNotify(lua_State *L, const std::string &luaAction, const std::string &luaId, void *Data) { const char *optionValue = (const char *) Data; diff --git a/src/gui/luainstance.h b/src/gui/luainstance.h index 7e5c31e51..93d66af6e 100644 --- a/src/gui/luainstance.h +++ b/src/gui/luainstance.h @@ -218,6 +218,7 @@ private: static bool tableLookup(lua_State*, const char*, std::string&); static bool tableLookup(lua_State*, const char*, int&); + static bool tableLookup(lua_State*, const char*, void**); }; #endif /* _LUAINSTANCE_H */ From 81608cbd3f6a52d184430eca3edb1bb8d72cceb7 Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Sun, 16 Mar 2014 11:56:53 +0100 Subject: [PATCH 101/225] CLuaInstance::ComponentsTextNew: Add 'parent' parameter... ...for the integration of ctext in a parent cwindow --- src/gui/luainstance.cpp | 29 ++++++++++++++++------------- src/gui/luainstance.h | 5 +++-- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/gui/luainstance.cpp b/src/gui/luainstance.cpp index cc9d2a94d..2375a1375 100644 --- a/src/gui/luainstance.cpp +++ b/src/gui/luainstance.cpp @@ -1553,6 +1553,7 @@ int CLuaInstance::ComponentsTextNew(lua_State *L) { lua_assert(lua_istable(L,1)); + CLuaCWindow* parent = NULL; int x=10, y=10, dx=100, dy=100; std::string text = ""; std::string tmpMode = ""; @@ -1564,6 +1565,7 @@ int CLuaInstance::ComponentsTextNew(lua_State *L) lua_Integer color_shadow = (lua_Integer)COL_MENUCONTENTDARK_PLUS_0; std::string tmp1 = "false"; + tableLookup(L, "parent" , (void**)&parent); tableLookup(L, "x" , x); tableLookup(L, "y" , y); tableLookup(L, "dx" , dx); @@ -1602,9 +1604,12 @@ int CLuaInstance::ComponentsTextNew(lua_State *L) htmlEntityDecode(text); } + CComponentsForm* pw = (parent && parent->w) ? parent->w->getBodyObject() : NULL; + CLuaComponentsText **udata = (CLuaComponentsText **) lua_newuserdata(L, sizeof(CLuaComponentsText *)); *udata = new CLuaComponentsText(); - (*udata)->ct = new CComponentsText(x, y, dx, dy, text, mode, g_Font[font_text], NULL, has_shadow, (fb_pixel_t)color_text, (fb_pixel_t)color_frame, (fb_pixel_t)color_body, (fb_pixel_t)color_shadow); + (*udata)->ct = new CComponentsText(x, y, dx, dy, text, mode, g_Font[font_text], pw, has_shadow, (fb_pixel_t)color_text, (fb_pixel_t)color_frame, (fb_pixel_t)color_body, (fb_pixel_t)color_shadow); + (*udata)->parent = pw; luaL_getmetatable(L, "ctext"); lua_setmetatable(L, -2); return 1; @@ -1613,14 +1618,13 @@ int CLuaInstance::ComponentsTextNew(lua_State *L) int CLuaInstance::ComponentsTextPaint(lua_State *L) { lua_assert(lua_istable(L,1)); + CLuaComponentsText *m = ComponentsTextCheck(L, 1); + if (!m) return 0; + std::string tmp = "true"; tableLookup(L, "do_save_bg", tmp); bool do_save_bg = (tmp == "true" || tmp == "1" || tmp == "yes"); - CLuaComponentsText *m = ComponentsTextCheck(L, 1); - if (!m) - return 0; - m->ct->paint(do_save_bg); return 0; } @@ -1628,29 +1632,28 @@ int CLuaInstance::ComponentsTextPaint(lua_State *L) int CLuaInstance::ComponentsTextHide(lua_State *L) { lua_assert(lua_istable(L,1)); + CLuaComponentsText *m = ComponentsTextCheck(L, 1); + if (!m) return 0; + std::string tmp = "false"; tableLookup(L, "no_restore", tmp); bool no_restore = (tmp == "true" || tmp == "1" || tmp == "yes"); - CLuaComponentsText *m = ComponentsTextCheck(L, 1); - if (!m) - return 0; - m->ct->hide(no_restore); + return 0; } int CLuaInstance::ComponentsTextScroll(lua_State *L) { lua_assert(lua_istable(L,1)); + CLuaComponentsText *m = ComponentsTextCheck(L, 1); + if (!m) return 0; + std::string tmp = "true"; tableLookup(L, "dir", tmp); bool scrollDown = (tmp == "down" || tmp == "1"); - CLuaComponentsText *m = ComponentsTextCheck(L, 1); - if (!m) - return 0; - //get the textbox instance from lua object and use CTexBbox scroll methods CTextBox* ctb = m->ct->getCTextBoxObject(); if (ctb) { diff --git a/src/gui/luainstance.h b/src/gui/luainstance.h index 93d66af6e..711a2895c 100644 --- a/src/gui/luainstance.h +++ b/src/gui/luainstance.h @@ -138,8 +138,9 @@ class CLuaComponentsText { public: CComponentsText *ct; - CLuaComponentsText() { ct = NULL; } - ~CLuaComponentsText() { delete ct; } + CComponentsForm *parent; + CLuaComponentsText() { ct = NULL; parent = NULL;} + ~CLuaComponentsText() { if (parent == NULL) delete ct; } }; From 4df0449e39980f791a3af41f1831f1c56f9892c9 Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Sun, 16 Mar 2014 11:56:57 +0100 Subject: [PATCH 102/225] CLuaInstance: Add setText function to ctext --- src/gui/luainstance.cpp | 25 ++++++++++++++++++++++++- src/gui/luainstance.h | 4 +++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/gui/luainstance.cpp b/src/gui/luainstance.cpp index 2375a1375..68a36e80a 100644 --- a/src/gui/luainstance.cpp +++ b/src/gui/luainstance.cpp @@ -1537,6 +1537,7 @@ void CLuaInstance::ComponentsTextRegister(lua_State *L) { "new", CLuaInstance::ComponentsTextNew }, { "paint", CLuaInstance::ComponentsTextPaint }, { "hide", CLuaInstance::ComponentsTextHide }, + { "setText", CLuaInstance::ComponentsTextSetText }, { "scroll", CLuaInstance::ComponentsTextScroll }, { "__gc", CLuaInstance::ComponentsTextDelete }, { NULL, NULL } @@ -1610,6 +1611,8 @@ int CLuaInstance::ComponentsTextNew(lua_State *L) *udata = new CLuaComponentsText(); (*udata)->ct = new CComponentsText(x, y, dx, dy, text, mode, g_Font[font_text], pw, has_shadow, (fb_pixel_t)color_text, (fb_pixel_t)color_frame, (fb_pixel_t)color_body, (fb_pixel_t)color_shadow); (*udata)->parent = pw; + (*udata)->mode = mode; + (*udata)->font_text = font_text; luaL_getmetatable(L, "ctext"); lua_setmetatable(L, -2); return 1; @@ -1639,8 +1642,28 @@ int CLuaInstance::ComponentsTextHide(lua_State *L) tableLookup(L, "no_restore", tmp); bool no_restore = (tmp == "true" || tmp == "1" || tmp == "yes"); - m->ct->hide(no_restore); + if (m->parent) { + m->ct->setText("", m->mode, g_Font[m->font_text]); + m->ct->paint(); + } else + m->ct->hide(no_restore); + return 0; +} +int CLuaInstance::ComponentsTextSetText(lua_State *L) +{ + lua_assert(lua_istable(L,1)); + CLuaComponentsText *m = ComponentsTextCheck(L, 1); + if (!m) return 0; + + std::string text = ""; + int mode = m->mode; + int font_text = m->font_text; + tableLookup(L, "text", text); + tableLookup(L, "mode", mode); + tableLookup(L, "font_text", font_text); + + m->ct->setText(text, mode, g_Font[font_text]); return 0; } diff --git a/src/gui/luainstance.h b/src/gui/luainstance.h index 711a2895c..388e2b427 100644 --- a/src/gui/luainstance.h +++ b/src/gui/luainstance.h @@ -139,7 +139,8 @@ class CLuaComponentsText public: CComponentsText *ct; CComponentsForm *parent; - CLuaComponentsText() { ct = NULL; parent = NULL;} + int mode, font_text; + CLuaComponentsText() { ct = NULL; parent = NULL; mode = 0; font_text = 0;} ~CLuaComponentsText() { if (parent == NULL) delete ct; } }; @@ -214,6 +215,7 @@ private: static int ComponentsTextNew(lua_State *L); static int ComponentsTextPaint(lua_State *L); static int ComponentsTextHide(lua_State *L); + static int ComponentsTextSetText(lua_State *L); static int ComponentsTextScroll(lua_State *L); static int ComponentsTextDelete(lua_State *L); From 5136563035a618c7c96d82b4925ad009f1a58278 Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Sun, 16 Mar 2014 11:57:01 +0100 Subject: [PATCH 103/225] CLuaInstance: Add function 'functionDeprecated()' for debug output... ...when a script function is deprecated. --- data/locale/deutsch.locale | 3 +++ data/locale/english.locale | 3 +++ src/gui/luainstance.cpp | 12 ++++++++++++ src/gui/luainstance.h | 2 ++ src/system/locals.h | 3 +++ src/system/locals_intern.h | 3 +++ 6 files changed, 26 insertions(+) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index b225476b6..3e4f07604 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -741,6 +741,9 @@ ledcontroler.off LED1 & LED2 aus ledcontroler.on.all LED1 & LED2 an ledcontroler.on.led1 LED1 an ledcontroler.on.led2 LED2 an +lua.function_deprecated1 Achtung! +lua.function_deprecated2 Die Funktion +lua.function_deprecated3 ist veraltet,\n bitte nutzen Sie mainmenu.audioplayer Audioplayer mainmenu.channels Kanalliste mainmenu.clearsectionsd Lösche EPG Cache diff --git a/data/locale/english.locale b/data/locale/english.locale index 4c08276d9..d91d5a4c1 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -741,6 +741,9 @@ ledcontroler.off Led1 & Led2 off ledcontroler.on.all Led1 & Led2 on ledcontroler.on.led1 Led1 on ledcontroler.on.led2 Led2 on +lua.function_deprecated1 Attention! +lua.function_deprecated2 Function +lua.function_deprecated3 is deprecated,\n please use mainmenu.audioplayer Audioplayer mainmenu.channels Channels mainmenu.clearsectionsd Clear EPG Cache diff --git a/src/gui/luainstance.cpp b/src/gui/luainstance.cpp index 68a36e80a..66dd47a0d 100644 --- a/src/gui/luainstance.cpp +++ b/src/gui/luainstance.cpp @@ -307,6 +307,18 @@ CLuaInstance::~CLuaInstance() } } +void CLuaInstance::functionDeprecated(lua_State *L, const char* oldFunc, const char* newFunc) +{ + lua_Debug ar; + lua_getstack(L, 1, &ar); + lua_getinfo(L, "Sl", &ar); + printf("[Lua Script] \33[1;31m%s\33[0m %s \33[33m%s\33[0m %s \33[1;33m%s\33[0m.\n (%s:%d)\n", + g_Locale->getText(LOCALE_LUA_FUNCTION_DEPRECATED1), + g_Locale->getText(LOCALE_LUA_FUNCTION_DEPRECATED2), oldFunc, + g_Locale->getText(LOCALE_LUA_FUNCTION_DEPRECATED3), newFunc, + ar.short_src, ar.currentline); +} + #define SET_VAR1(NAME) \ lua_pushinteger(lua, NAME); \ lua_setglobal(lua, #NAME); diff --git a/src/gui/luainstance.h b/src/gui/luainstance.h index 388e2b427..c40e3d6d5 100644 --- a/src/gui/luainstance.h +++ b/src/gui/luainstance.h @@ -161,6 +161,8 @@ private: lua_State* lua; void registerFunctions(); + static void functionDeprecated(lua_State *L, const char* oldFunc, const char* newFunc); + static int NewWindow(lua_State *L); static int PaintBox(lua_State *L); static int PaintIcon(lua_State *L); diff --git a/src/system/locals.h b/src/system/locals.h index 2ac9d7fd0..e52de6d83 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -768,6 +768,9 @@ typedef enum LOCALE_LEDCONTROLER_ON_ALL, LOCALE_LEDCONTROLER_ON_LED1, LOCALE_LEDCONTROLER_ON_LED2, + LOCALE_LUA_FUNCTION_DEPRECATED1, + LOCALE_LUA_FUNCTION_DEPRECATED2, + LOCALE_LUA_FUNCTION_DEPRECATED3, LOCALE_MAINMENU_AUDIOPLAYER, LOCALE_MAINMENU_CHANNELS, LOCALE_MAINMENU_CLEARSECTIONSD, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index f2369d4a4..e7cad05c9 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -768,6 +768,9 @@ const char * locale_real_names[] = "ledcontroler.on.all", "ledcontroler.on.led1", "ledcontroler.on.led2", + "lua.function_deprecated1", + "lua.function_deprecated2", + "lua.function_deprecated3", "mainmenu.audioplayer", "mainmenu.channels", "mainmenu.clearsectionsd", From a501f4e10e95b8f712c7034c5e659f380043fbc0 Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Sun, 16 Mar 2014 11:57:06 +0100 Subject: [PATCH 104/225] CLuaInstance: Add setCaption & paintHeader function to cwindow --- src/gui/luainstance.cpp | 28 ++++++++++++++++++++++++++++ src/gui/luainstance.h | 2 ++ 2 files changed, 30 insertions(+) diff --git a/src/gui/luainstance.cpp b/src/gui/luainstance.cpp index 66dd47a0d..60e7a796b 100644 --- a/src/gui/luainstance.cpp +++ b/src/gui/luainstance.cpp @@ -1316,6 +1316,8 @@ void CLuaInstance::CWindowRegister(lua_State *L) { "new", CLuaInstance::CWindowNew }, { "paint", CLuaInstance::CWindowPaint }, { "hide", CLuaInstance::CWindowHide }, + { "setCaption", CLuaInstance::CWindowSetCaption }, + { "paintHeader", CLuaInstance::CWindowPaintHeader }, { "header_height", CLuaInstance::CWindowGetHeaderHeight }, { "footer_height", CLuaInstance::CWindowGetFooterHeight }, { "__gc", CLuaInstance::CWindowDelete }, @@ -1426,6 +1428,32 @@ int CLuaInstance::CWindowHide(lua_State *L) return 0; } +int CLuaInstance::CWindowSetCaption(lua_State *L) +{ + lua_assert(lua_istable(L,1)); + CLuaCWindow *m = CWindowCheck(L, 1); + if (!m) return 0; + + std::string name = ""; + tableLookup(L, "name", name) || tableLookup(L, "title", name) || tableLookup(L, "caption", name); + + m->w->setWindowCaption(name); + return 0; +} + +int CLuaInstance::CWindowPaintHeader(lua_State *L) +{ + CLuaCWindow *m = CWindowCheck(L, 1); + if (!m) return 0; + + CComponentsHeader* header = m->w->getHeaderObject(); + if (header) + m->w->showHeader(); + header->paint(); + + return 0; +} + int CLuaInstance::CWindowGetHeaderHeight(lua_State *L) { CLuaCWindow *m = CWindowCheck(L, 1); diff --git a/src/gui/luainstance.h b/src/gui/luainstance.h index c40e3d6d5..bdcfa8f8d 100644 --- a/src/gui/luainstance.h +++ b/src/gui/luainstance.h @@ -202,6 +202,8 @@ private: static CLuaCWindow *CWindowCheck(lua_State *L, int n); static int CWindowPaint(lua_State *L); static int CWindowHide(lua_State *L); + static int CWindowSetCaption(lua_State *L); + static int CWindowPaintHeader(lua_State *L); static int CWindowGetHeaderHeight(lua_State *L); static int CWindowGetFooterHeight(lua_State *L); static int CWindowDelete(lua_State *L); From 1e78781d18a91512da796519749a29869ff07d65 Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Sun, 16 Mar 2014 11:57:10 +0100 Subject: [PATCH 105/225] CLuaInstance: Add various CComponentsPicture functions - Added: new, paint, hide, setpicture --- src/gui/luainstance.cpp | 120 ++++++++++++++++++++++++++++++++++++++++ src/gui/luainstance.h | 17 ++++++ 2 files changed, 137 insertions(+) diff --git a/src/gui/luainstance.cpp b/src/gui/luainstance.cpp index 60e7a796b..1ebd62a12 100644 --- a/src/gui/luainstance.cpp +++ b/src/gui/luainstance.cpp @@ -403,6 +403,7 @@ void CLuaInstance::registerFunctions() CWindowRegister(lua); ComponentsTextRegister(lua); SignalBoxRegister(lua); + CPictureRegister(lua); } CLuaData *CLuaInstance::CheckData(lua_State *L, int narg) @@ -1743,3 +1744,122 @@ int CLuaInstance::ComponentsTextDelete(lua_State *L) } // -------------------------------------------------------------------------------- + +CLuaPicture *CLuaInstance::CPictureCheck(lua_State *L, int n) +{ + return *(CLuaPicture **) luaL_checkudata(L, n, "cpicture"); +} + +void CLuaInstance::CPictureRegister(lua_State *L) +{ + luaL_Reg meth[] = { + { "new", CLuaInstance::CPictureNew }, + { "paint", CLuaInstance::CPicturePaint }, + { "hide", CLuaInstance::CPictureHide }, + { "setPicture", CLuaInstance::CPictureSetPicture }, + { "__gc", CLuaInstance::CPictureDelete }, + { NULL, NULL } + }; + + luaL_newmetatable(L, "cpicture"); + luaL_setfuncs(L, meth, 0); + lua_pushvalue(L, -1); + lua_setfield(L, -1, "__index"); + lua_setglobal(L, "cpicture"); +} + +int CLuaInstance::CPictureNew(lua_State *L) +{ + lua_assert(lua_istable(L,1)); + + CLuaCWindow* parent = NULL; + int x=10, y=10, dx=100, dy=100; + std::string image_name = ""; + int alignment = CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER; + + std::string tmp1 = "false"; // has_shadow + lua_Integer color_frame = (lua_Integer)COL_MENUCONTENT_PLUS_6; + lua_Integer color_background = (lua_Integer)COL_MENUCONTENT_PLUS_0; + lua_Integer color_shadow = (lua_Integer)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, "image" , image_name); + tableLookup(L, "alignment" , alignment); + tableLookup(L, "has_shadow" , tmp1); + bool has_shadow = (tmp1 == "true" || tmp1 == "1" || tmp1 == "yes"); + tableLookup(L, "color_frame" , color_frame); + tableLookup(L, "color_background" , color_background); + tableLookup(L, "color_shadow" , color_shadow); + + CComponentsForm* pw = (parent && parent->w) ? parent->w->getBodyObject() : NULL; + + CLuaPicture **udata = (CLuaPicture **) lua_newuserdata(L, sizeof(CLuaPicture *)); + *udata = new CLuaPicture(); + (*udata)->cp = new CComponentsPicture(x, y, dx, dy, image_name, alignment, pw, has_shadow, (fb_pixel_t)color_frame, (fb_pixel_t)color_background, (fb_pixel_t)color_shadow); + (*udata)->parent = pw; + luaL_getmetatable(L, "cpicture"); + lua_setmetatable(L, -2); + return 1; +} + +int CLuaInstance::CPicturePaint(lua_State *L) +{ + lua_assert(lua_istable(L,1)); + CLuaPicture *m = CPictureCheck(L, 1); + if (!m) return 0; + + std::string tmp = "true"; + tableLookup(L, "do_save_bg", tmp); + bool do_save_bg = (tmp == "true" || tmp == "1" || tmp == "yes"); + + m->cp->paint(do_save_bg); + return 0; +} + +int CLuaInstance::CPictureHide(lua_State *L) +{ + lua_assert(lua_istable(L,1)); + CLuaPicture *m = CPictureCheck(L, 1); + if (!m) return 0; + + std::string tmp = "false"; + tableLookup(L, "no_restore", tmp); + bool no_restore = (tmp == "true" || tmp == "1" || tmp == "yes"); + + if (m->parent) { + m->cp->setPicture(""); + m->cp->paint(); + } else + m->cp->hide(no_restore); + return 0; +} + +int CLuaInstance::CPictureSetPicture(lua_State *L) +{ + lua_assert(lua_istable(L,1)); + CLuaPicture *m = CPictureCheck(L, 1); + if (!m) return 0; + + std::string image_name = ""; + tableLookup(L, "image", image_name); + + m->cp->setPicture(image_name); + return 0; +} + +int CLuaInstance::CPictureDelete(lua_State *L) +{ + DBG("CLuaInstance::%s %d\n", __func__, lua_gettop(L)); + CLuaPicture *m = CPictureCheck(L, 1); + if (!m) return 0; + + m->cp->hide(); + delete m; + return 0; +} + +// -------------------------------------------------------------------------------- diff --git a/src/gui/luainstance.h b/src/gui/luainstance.h index bdcfa8f8d..da2703ffb 100644 --- a/src/gui/luainstance.h +++ b/src/gui/luainstance.h @@ -144,6 +144,15 @@ class CLuaComponentsText ~CLuaComponentsText() { if (parent == NULL) delete ct; } }; +class CLuaPicture +{ + public: + CComponentsPicture *cp; + CComponentsForm *parent; + CLuaPicture() { cp = NULL; parent = NULL; } + ~CLuaPicture() { if (parent == NULL) delete cp; } +}; + /* inspired by Steve Kemp http://www.steve.org.uk/ */ class CLuaInstance @@ -223,6 +232,14 @@ private: static int ComponentsTextScroll(lua_State *L); static int ComponentsTextDelete(lua_State *L); + static CLuaPicture *CPictureCheck(lua_State *L, int n); + static void CPictureRegister(lua_State *L); + static int CPictureNew(lua_State *L); + static int CPicturePaint(lua_State *L); + static int CPictureHide(lua_State *L); + static int CPictureSetPicture(lua_State *L); + static int CPictureDelete(lua_State *L); + static bool tableLookup(lua_State*, const char*, std::string&); static bool tableLookup(lua_State*, const char*, int&); static bool tableLookup(lua_State*, const char*, void**); From 2dbdb8798e0531974639e866dc59996e6e5c89fb Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Sun, 16 Mar 2014 11:57:14 +0100 Subject: [PATCH 106/225] CLuaInstance: Replace cwindow header_height & footer_height - Replace with headerHeight & footerHeight - Set header_height & footer_height to deprecated --- src/gui/luainstance.cpp | 20 ++++++++++++++++++-- src/gui/luainstance.h | 2 ++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/gui/luainstance.cpp b/src/gui/luainstance.cpp index 1ebd62a12..31871e117 100644 --- a/src/gui/luainstance.cpp +++ b/src/gui/luainstance.cpp @@ -1319,8 +1319,10 @@ void CLuaInstance::CWindowRegister(lua_State *L) { "hide", CLuaInstance::CWindowHide }, { "setCaption", CLuaInstance::CWindowSetCaption }, { "paintHeader", CLuaInstance::CWindowPaintHeader }, - { "header_height", CLuaInstance::CWindowGetHeaderHeight }, - { "footer_height", CLuaInstance::CWindowGetFooterHeight }, + { "headerHeight", CLuaInstance::CWindowGetHeaderHeight }, + { "footerHeight", CLuaInstance::CWindowGetFooterHeight }, + { "header_height", CLuaInstance::CWindowGetHeaderHeight_dep }, /* function 'header_height' is deprecated */ + { "footer_height", CLuaInstance::CWindowGetFooterHeight_dep }, /* function 'footer_height' is deprecated */ { "__gc", CLuaInstance::CWindowDelete }, { NULL, NULL } }; @@ -1455,6 +1457,20 @@ int CLuaInstance::CWindowPaintHeader(lua_State *L) return 0; } +// function 'header_height' is deprecated +int CLuaInstance::CWindowGetHeaderHeight_dep(lua_State *L) +{ + functionDeprecated(L, "header_height", "headerHeight"); + return CWindowGetHeaderHeight(L); +} + +// function 'footer_height' is deprecated +int CLuaInstance::CWindowGetFooterHeight_dep(lua_State *L) +{ + functionDeprecated(L, "footer_height", "footerHeight"); + return CWindowGetFooterHeight(L); +} + int CLuaInstance::CWindowGetHeaderHeight(lua_State *L) { CLuaCWindow *m = CWindowCheck(L, 1); diff --git a/src/gui/luainstance.h b/src/gui/luainstance.h index da2703ffb..245a74459 100644 --- a/src/gui/luainstance.h +++ b/src/gui/luainstance.h @@ -215,6 +215,8 @@ private: static int CWindowPaintHeader(lua_State *L); static int CWindowGetHeaderHeight(lua_State *L); static int CWindowGetFooterHeight(lua_State *L); + static int CWindowGetHeaderHeight_dep(lua_State *L); // function 'header_height' is deprecated + static int CWindowGetFooterHeight_dep(lua_State *L); // function 'footer_height' is deprecated static int CWindowDelete(lua_State *L); static CLuaSignalBox *SignalBoxCheck(lua_State *L, int n); From 5d4286285a6f15c2ff453d0e9a4fa7b9c7c4f7a6 Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Tue, 18 Mar 2014 19:01:20 +0100 Subject: [PATCH 107/225] CStringInputSMS: Add '%' to valid chars --- src/gui/widget/stringinput.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widget/stringinput.cpp b/src/gui/widget/stringinput.cpp index 5099f2c55..146269d70 100644 --- a/src/gui/widget/stringinput.cpp +++ b/src/gui/widget/stringinput.cpp @@ -636,7 +636,7 @@ void CStringInputSMS::initSMS(const char * const Valid_Chars) { last_digit = -1; // no key pressed yet const char CharList[10][11] = { "0 -_/()<>=", // 10 characters - "1+.,:!?\\'",//' for c't search ;) + "1+.,:!?%\\'", //' for c't search ;) "abc2ä", "def3", "ghi4", From b61a225d2b083fb5573fa71ea00da5490eca9675 Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Mon, 17 Mar 2014 21:44:17 +0100 Subject: [PATCH 108/225] CLuaInstance: Optional specification of parameters for runScript() - Add parameters as std::vector and possibility of return of status and error messages. (THX Martii) Example: void runScript(const char *fileName, std::vector *argv, std::string *result_code, std::string *result_string, std::string *error_string); - Add Parameters as const char*, last parameter to NULL is imperative. Example: void runScript(const char *fileName, const char *arg0, const char *arg1, ..., NULL); --- src/gui/luainstance.cpp | 45 ++++++++++++++++++++++++++++++++++++++++- src/gui/luainstance.h | 8 +++++++- 2 files changed, 51 insertions(+), 2 deletions(-) diff --git a/src/gui/luainstance.cpp b/src/gui/luainstance.cpp index 31871e117..13083b6a2 100644 --- a/src/gui/luainstance.cpp +++ b/src/gui/luainstance.cpp @@ -327,7 +327,7 @@ void CLuaInstance::functionDeprecated(lua_State *L, const char* oldFunc, const c lua_setglobal(lua, #NAME); /* Run the given script. */ -void CLuaInstance::runScript(const char *fileName) +void CLuaInstance::runScript(const char *fileName, std::vector *argv, std::string *result_code, std::string *result_string, std::string *error_string) { // luaL_dofile(lua, fileName); /* run the script */ @@ -335,17 +335,60 @@ void CLuaInstance::runScript(const char *fileName) if (status) { fprintf(stderr, "[CLuaInstance::%s] Can't load file: %s\n", __func__, lua_tostring(lua, -1)); ShowMsg2UTF("Lua script error:", lua_tostring(lua, -1), CMsgBox::mbrBack, CMsgBox::mbBack); + if (error_string) + *error_string = std::string(lua_tostring(lua, -1)); return; } set_lua_variables(lua); + if (argv && (!argv->empty())) { + lua_createtable(lua, argv->size(), 0); + int n = 0; + for(std::vector::iterator it = argv->begin(); it != argv->end(); ++it) { + lua_pushstring(lua, it->c_str()); + lua_rawseti(lua, -2, n++); + } + lua_setglobal(lua, "arg"); + } status = lua_pcall(lua, 0, LUA_MULTRET, 0); + if (result_code) + *result_code = to_string(status); + if (result_string && lua_isstring(lua, -1)) + *result_string = std::string(lua_tostring(lua, -1)); if (status) { fprintf(stderr, "[CLuaInstance::%s] error in script: %s\n", __func__, lua_tostring(lua, -1)); ShowMsg2UTF("Lua script error:", lua_tostring(lua, -1), CMsgBox::mbrBack, CMsgBox::mbBack); + if (error_string) + *error_string = std::string(lua_tostring(lua, -1)); } } +// Example: runScript(fileName, "Arg1", "Arg2", "Arg3", ..., NULL); +// Type of all parameters: const char* +// The last parameter to NULL is imperative. +void CLuaInstance::runScript(const char *fileName, const char *arg0, ...) +{ + int i = 0; + std::vector args; + args.push_back(arg0); + va_list list; + va_start(list, arg0); + const char* temp = va_arg(list, const char*); + while (temp != NULL) { + if (i >= 64) { + fprintf(stderr, "CLuaInstance::runScript: too many arguments!\n"); + args.clear(); + return; + } + args.push_back(temp); + temp = va_arg(list, const char*); + i++; + } + va_end(list); + runScript(fileName, &args); + args.clear(); +} + const luaL_Reg CLuaInstance::methods[] = { { "PaintBox", CLuaInstance::PaintBox }, diff --git a/src/gui/luainstance.h b/src/gui/luainstance.h index 245a74459..035dea282 100644 --- a/src/gui/luainstance.h +++ b/src/gui/luainstance.h @@ -30,6 +30,7 @@ extern "C" { #include #include #include +#include /* this is stored as userdata in the lua_State */ struct CLuaData @@ -164,7 +165,12 @@ class CLuaInstance public: CLuaInstance(); ~CLuaInstance(); - void runScript(const char *fileName); + void runScript(const char *fileName, std::vector *argv = NULL, std::string *result_code = NULL, std::string *result_string = NULL, std::string *error_string = NULL); + + // Example: runScript(fileName, "Arg1", "Arg2", "Arg3", ..., NULL); + // Type of all parameters: const char* + // The last parameter to NULL is imperative. + void runScript(const char *fileName, const char *arg0, ...); private: lua_State* lua; From 0a957abf31d0ccc6b6998746237da84eddef8260 Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Mon, 17 Mar 2014 15:08:05 +0100 Subject: [PATCH 109/225] CLuaInstance: Add runScript() function for using in Lua script - Script runs in a new instance in neutrino context Example: local n = neutrino() n:runScript(filename [, args, ...]) --- src/gui/luainstance.cpp | 22 ++++++++++++++++++++++ src/gui/luainstance.h | 1 + 2 files changed, 23 insertions(+) diff --git a/src/gui/luainstance.cpp b/src/gui/luainstance.cpp index 13083b6a2..9d11a9392 100644 --- a/src/gui/luainstance.cpp +++ b/src/gui/luainstance.cpp @@ -401,6 +401,7 @@ const luaL_Reg CLuaInstance::methods[] = { "DisplayImage", CLuaInstance::DisplayImage }, { "Blit", CLuaInstance::Blit }, { "GetLanguage", CLuaInstance::GetLanguage }, + { "runScript", CLuaInstance::runScriptExt }, { NULL, NULL } }; @@ -709,6 +710,27 @@ int CLuaInstance::GetLanguage(lua_State *L) return 1; } +int CLuaInstance::runScriptExt(lua_State *L) +{ + CLuaData *W = CheckData(L, 1); + if (!W) return 0; + + int numargs = lua_gettop(L); + const char *script = luaL_checkstring(L, 2); + std::vector args; + for (int i = 3; i <= numargs; i++) { + std::string arg = luaL_checkstring(L, i); + if (!arg.empty()) + args.push_back(arg); + } + + CLuaInstance *lua = new CLuaInstance(); + lua->runScript(script, &args); + args.clear(); + delete lua; + return 0; +} + bool CLuaInstance::tableLookup(lua_State *L, const char *what, std::string &value) { bool res = false; diff --git a/src/gui/luainstance.h b/src/gui/luainstance.h index 035dea282..be9459c42 100644 --- a/src/gui/luainstance.h +++ b/src/gui/luainstance.h @@ -188,6 +188,7 @@ private: static int GCWindow(lua_State *L); static int Blit(lua_State *L); static int GetLanguage(lua_State *L); + static int runScriptExt(lua_State *L); static int GetSize(lua_State *L); static int DisplayImage(lua_State *L); From b80e7480a2c139f72d5869d5b41060a7c7fef530 Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Wed, 19 Mar 2014 15:15:02 +0100 Subject: [PATCH 110/225] CLuaInstance::runScript: Set script parameter 0 to 'script name'... ...for compatibility with standalone lua scripts --- src/gui/luainstance.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/gui/luainstance.cpp b/src/gui/luainstance.cpp index 9d11a9392..6883c68fe 100644 --- a/src/gui/luainstance.cpp +++ b/src/gui/luainstance.cpp @@ -339,16 +339,24 @@ void CLuaInstance::runScript(const char *fileName, std::vector *arg *error_string = std::string(lua_tostring(lua, -1)); return; } + int argvSize = 1; + int n = 0; set_lua_variables(lua); + if (argv && (!argv->empty())) + argvSize += argv->size(); + lua_createtable(lua, argvSize, 0); + + // arg0 is scriptname + lua_pushstring(lua, fileName); + lua_rawseti(lua, -2, n++); + if (argv && (!argv->empty())) { - lua_createtable(lua, argv->size(), 0); - int n = 0; for(std::vector::iterator it = argv->begin(); it != argv->end(); ++it) { lua_pushstring(lua, it->c_str()); lua_rawseti(lua, -2, n++); } - lua_setglobal(lua, "arg"); } + lua_setglobal(lua, "arg"); status = lua_pcall(lua, 0, LUA_MULTRET, 0); if (result_code) *result_code = to_string(status); From 80d7cc186d2ff88543f6b094282315191730d0d9 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Wed, 19 Mar 2014 18:32:34 +0100 Subject: [PATCH 111/225] CPictureViewer:: move download code to separate funktion DownloadImage --- src/driver/pictureviewer/pictureviewer.cpp | 45 ++++++++++++---------- src/driver/pictureviewer/pictureviewer.h | 1 + 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/src/driver/pictureviewer/pictureviewer.cpp b/src/driver/pictureviewer/pictureviewer.cpp index 439518cf7..809523849 100644 --- a/src/driver/pictureviewer/pictureviewer.cpp +++ b/src/driver/pictureviewer/pictureviewer.cpp @@ -102,6 +102,29 @@ CPictureViewer::CFormathandler * CPictureViewer::fh_getsize (const char *name, i } return (NULL); } +std::string CPictureViewer::DownloadImage(std::string url) +{ + if (strstr(url.c_str(), "://")) { + std::string tmpname = "/tmp/pictureviewer" + url.substr(url.find_last_of(".")); + FILE *tmpFile = fopen(tmpname.c_str(), "wb"); + if (tmpFile) { + CURL *ch = curl_easy_init(); + curl_easy_setopt(ch, CURLOPT_VERBOSE, 0L); + curl_easy_setopt(ch, CURLOPT_NOPROGRESS, 1L); + curl_easy_setopt(ch, CURLOPT_NOSIGNAL, 1L); + curl_easy_setopt(ch, CURLOPT_WRITEFUNCTION, NULL); + curl_easy_setopt(ch, CURLOPT_WRITEDATA, tmpFile); + curl_easy_setopt(ch, CURLOPT_FAILONERROR, 1L); + curl_easy_setopt(ch, CURLOPT_URL, url.c_str()); + curl_easy_perform(ch); + curl_easy_cleanup(ch); + fclose(tmpFile); + url = true; + } + url = tmpname; + } + return url; +} bool CPictureViewer::DecodeImage (const std::string & _name, bool showBusySign, bool unscaled) { @@ -121,29 +144,9 @@ bool CPictureViewer::DecodeImage (const std::string & _name, bool showBusySign, if (showBusySign) showBusy (m_startx + 3, m_starty + 3, 10, 0xff, 00, 00); - std::string name = _name; bool url = false; - if (strstr(name.c_str(), "://")) { - std::string tmpname; - tmpname = "/tmp/pictureviewer" + name.substr(name.find_last_of(".")); - FILE *tmpFile = fopen(tmpname.c_str(), "wb"); - if (tmpFile) { - CURL *ch = curl_easy_init(); - curl_easy_setopt(ch, CURLOPT_VERBOSE, 0L); - curl_easy_setopt(ch, CURLOPT_NOPROGRESS, 1L); - curl_easy_setopt(ch, CURLOPT_NOSIGNAL, 1L); - curl_easy_setopt(ch, CURLOPT_WRITEFUNCTION, NULL); - curl_easy_setopt(ch, CURLOPT_WRITEDATA, tmpFile); - curl_easy_setopt(ch, CURLOPT_FAILONERROR, 1L); - curl_easy_setopt(ch, CURLOPT_URL, name.c_str()); - curl_easy_perform(ch); - curl_easy_cleanup(ch); - fclose(tmpFile); - url = true; - } - name = tmpname; - } + std::string name = DownloadImage(_name); CFormathandler *fh; if (unscaled) diff --git a/src/driver/pictureviewer/pictureviewer.h b/src/driver/pictureviewer/pictureviewer.h index 71d8d256f..4326c45d4 100644 --- a/src/driver/pictureviewer/pictureviewer.h +++ b/src/driver/pictureviewer/pictureviewer.h @@ -54,6 +54,7 @@ class CPictureViewer bool ShowImage(const std::string & filename, bool unscaled=false); bool DecodeImage(const std::string & name, bool showBusySign=false, bool unscaled=false); bool DisplayNextImage(); + std::string DownloadImage(std::string url); void SetScaling(ScalingMode s){m_scaling=s;} void SetAspectRatio(float aspect_ratio) {m_aspect=aspect_ratio;} void showBusy(int sx, int sy, int width, char r, char g, char b); From 98bdb436088a92525d54b03cb9a1f7174eef85ae Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Wed, 19 Mar 2014 18:35:10 +0100 Subject: [PATCH 112/225] upnpbrowser.cpp: -add albumArtURI parse --- src/gui/upnpbrowser.cpp | 15 ++++++++++----- src/gui/upnpbrowser.h | 1 + 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/gui/upnpbrowser.cpp b/src/gui/upnpbrowser.cpp index 54a09a72f..2274d9267 100644 --- a/src/gui/upnpbrowser.cpp +++ b/src/gui/upnpbrowser.cpp @@ -260,7 +260,7 @@ std::vector *CUpnpBrowserGui::decodeResult(std::string result) for (node=root->GetChild(); node; node=node->GetNext()) { bool isdir; - std::string title, artist = "", album = "", id, children; + std::string title, artist = "", album = "", albumArtURI = "", id, children; const char *type, *p; if (!strcmp(node->GetType(), "container")) @@ -291,7 +291,7 @@ std::vector *CUpnpBrowserGui::decodeResult(std::string result) p = ""; children=std::string(p); - UPnPEntry entry={id, isdir, title, artist, album, children, resources, -1}; + UPnPEntry entry={id, isdir, title, artist, album, albumArtURI, children, resources, -1}; entries->push_back(entry); } if (!strcmp(node->GetType(), "item")) @@ -330,6 +330,13 @@ std::vector *CUpnpBrowserGui::decodeResult(std::string result) p = ""; album=std::string(p); } + else if (!strcmp(type,"albumArtURI")) + { + p=snode->GetData(); + if (!p) + p = ""; + albumArtURI=std::string(p); + } else if (!strcmp(type,"res")) { p = snode->GetData(); @@ -416,8 +423,7 @@ std::vector *CUpnpBrowserGui::decodeResult(std::string result) p = ""; children=std::string(p); - UPnPEntry entry={id, isdir, title, artist, album, children, resources, preferred}; - + UPnPEntry entry={id, isdir, title, artist, album, albumArtURI, children, resources, preferred}; entries->push_back(entry); } } @@ -1140,7 +1146,6 @@ void CUpnpBrowserGui::paintDetails(std::vector *entry, unsigned int i // Foot info int top = m_y + (m_height - m_info_height - 1 * m_buttonHeight) + 2; int text_start = m_x + 10; - printf("paintDetails: index %d use_playing %d shown %d\n", index, use_playing, m_playing_entry_is_shown); if ((!use_playing) && ((*entry)[index].isdir)) { diff --git a/src/gui/upnpbrowser.h b/src/gui/upnpbrowser.h index 4014ff6aa..ae7dba0f4 100644 --- a/src/gui/upnpbrowser.h +++ b/src/gui/upnpbrowser.h @@ -57,6 +57,7 @@ struct UPnPEntry std::string title; std::string artist; std::string album; + std::string albumArtURI; std::string children; std::vector resources; int preferred; From a5f2ebaec3a93db08a1e11c425e9074f9eeff434 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Fri, 14 Mar 2014 13:55:39 +0400 Subject: [PATCH 113/225] gui/cam_menu.cpp: cleanup, fix memleak when messages ignored --- src/gui/cam_menu.cpp | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/src/gui/cam_menu.cpp b/src/gui/cam_menu.cpp index 94224436c..de5c0f2e0 100644 --- a/src/gui/cam_menu.cpp +++ b/src/gui/cam_menu.cpp @@ -226,8 +226,6 @@ int CCAMMenuHandler::handleCamMsg (const neutrino_msg_t msg, neutrino_msg_data_t if (msg != NeutrinoMessages::EVT_CA_MESSAGE) return from_menu ? 1 : -1; - if (g_settings.ci_ignore_messages && !from_menu) - return 1; rMsg = (CA_MESSAGE *)data; if (!rMsg) @@ -242,6 +240,9 @@ int CCAMMenuHandler::handleCamMsg (const neutrino_msg_t msg, neutrino_msg_data_t printf("CCAMMenuHandler::handleCamMsg: msg %d from %s\n", MsgId, from_menu ? "menu" : "neutrino"); + if (g_settings.ci_ignore_messages && !from_menu) + return 1; + if (SlotType != CA_SLOT_TYPE_SMARTCARD && SlotType != CA_SLOT_TYPE_CI) return -1; @@ -251,9 +252,6 @@ int CCAMMenuHandler::handleCamMsg (const neutrino_msg_t msg, neutrino_msg_data_t g_Locale->getText(SlotType == CA_SLOT_TYPE_CI ? LOCALE_CI_INSERTED : LOCALE_SC_INSERTED), (int)curslot+1); printf("CCAMMenuHandler::handleCamMsg: %s\n", str); ShowHint(LOCALE_MESSAGEBOX_INFO, str); -#if 0 - showHintBox(LOCALE_MESSAGEBOX_INFO, str, CI_MSG_TIME); -#endif } else if (MsgId == CA_MESSAGE_MSG_REMOVED) { hideHintBox(); @@ -262,9 +260,6 @@ int CCAMMenuHandler::handleCamMsg (const neutrino_msg_t msg, neutrino_msg_data_t printf("CCAMMenuHandler::handleCamMsg: %s\n", str); ShowHint(LOCALE_MESSAGEBOX_INFO, str); -#if 0 - showHintBox(LOCALE_MESSAGEBOX_INFO, str, CI_MSG_TIME); -#endif } else if(MsgId == CA_MESSAGE_MSG_INIT_OK) { if(hintBox != NULL) { hintBox->hide(); @@ -280,9 +275,6 @@ int CCAMMenuHandler::handleCamMsg (const neutrino_msg_t msg, neutrino_msg_data_t printf("CCAMMenuHandler::handleCamMsg: %s\n", str); CCamManager::getInstance()->Start(CZapit::getInstance()->GetCurrentChannelID(), CCamManager::PLAY, true); ShowHint(LOCALE_MESSAGEBOX_INFO, str); -#if 0 - showHintBox(LOCALE_MESSAGEBOX_INFO, str, CI_MSG_TIME); -#endif } else if(MsgId == CA_MESSAGE_MSG_INIT_FAILED) { hideHintBox(); @@ -295,9 +287,6 @@ int CCAMMenuHandler::handleCamMsg (const neutrino_msg_t msg, neutrino_msg_data_t printf("CCAMMenuHandler::handleCamMsg: %s\n", str); ShowHint(LOCALE_MESSAGEBOX_INFO, str); -#if 0 - showHintBox(LOCALE_MESSAGEBOX_INFO, str, CI_MSG_TIME); -#endif } else if(MsgId == CA_MESSAGE_MSG_MMI_MENU || MsgId == CA_MESSAGE_MSG_MMI_LIST) { bool sublevel = false; @@ -378,13 +367,6 @@ int CCAMMenuHandler::handleCamMsg (const neutrino_msg_t msg, neutrino_msg_data_t if(strlen(pMenu->bottom)) slen += snprintf(&lstr[slen], 255-slen, "\n%s", pMenu->bottom); ShowHint(convertDVBUTF8(pMenu->title, strlen(pMenu->title), 0).c_str(), convertDVBUTF8(lstr, slen, 0).c_str()); -#endif -#if 0 - showHintBox(LOCALE_MESSAGEBOX_INFO, convertDVBUTF8(lstr, slen, 0).c_str()); - sleep(4);//FIXME - if(!from_menu) { - hideHintBox(); - } #endif return 0; } @@ -478,9 +460,6 @@ int CCAMMenuHandler::doMenu(int slot, CA_SLOT_TYPE slotType) hideHintBox(); ShowHint(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(slotType == CA_SLOT_TYPE_CI ? LOCALE_CI_TIMEOUT : LOCALE_SC_TIMEOUT)); -#if 0 - showHintBox(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_CI_TIMEOUT), 5); -#endif ca->MenuClose(slotType, slot); return menu_return::RETURN_REPAINT; } From ce4552b4b9443d8a3e32bc47b6a607c58a09bc0a Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Fri, 14 Mar 2014 14:11:26 +0400 Subject: [PATCH 114/225] gui/cam_menu.cpp: use dialog for menu/list messages generated outside of menu --- src/gui/cam_menu.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/gui/cam_menu.cpp b/src/gui/cam_menu.cpp index de5c0f2e0..44b46b403 100644 --- a/src/gui/cam_menu.cpp +++ b/src/gui/cam_menu.cpp @@ -103,8 +103,6 @@ int CCAMMenuHandler::doMainMenu() int CiSlots = ca->GetNumberCISlots(); CMenuWidget* cammenu = new CMenuWidget(LOCALE_CI_SETTINGS, NEUTRINO_ICON_SETTINGS); - //cammenu->addItem( GenericMenuBack ); - //cammenu->addItem( GenericMenuSeparatorLine ); cammenu->addIntroItems(); if (!g_settings.easymenu) { @@ -304,7 +302,7 @@ int CCAMMenuHandler::handleCamMsg (const neutrino_msg_t msg, neutrino_msg_data_t hideHintBox(); int selected = -1; - if(pMenu->choice_nb) { + if(pMenu->choice_nb && from_menu) { CMenuWidget* menu = new CMenuWidget(convertDVBUTF8(pMenu->title, strlen(pMenu->title), 0).c_str(), NEUTRINO_ICON_SETTINGS); menu->enableSaveScreen(true); @@ -354,12 +352,15 @@ int CCAMMenuHandler::handleCamMsg (const neutrino_msg_t msg, neutrino_msg_data_t hideHintBox(); #if 1 if(strlen(pMenu->title)) - slen += snprintf(&lstr[slen], 255-slen, "%s", pMenu->title); + slen += snprintf(&lstr[slen], 255-slen, "%s\n", pMenu->title); if(strlen(pMenu->subtitle)) - slen += snprintf(&lstr[slen], 255-slen, "\n%s", pMenu->subtitle); + slen += snprintf(&lstr[slen], 255-slen, "%s\n", pMenu->subtitle); if(strlen(pMenu->bottom)) - slen += snprintf(&lstr[slen], 255-slen, "\n%s", pMenu->bottom); + slen += snprintf(&lstr[slen], 255-slen, "%s\n", pMenu->bottom); + for(i = 0; (i < pMenu->choice_nb) && (i < MAX_MMI_ITEMS); i++) { + slen += snprintf(&lstr[slen], 255-slen, "%s\n", pMenu->choice_item[i]); + } ShowHint(LOCALE_MESSAGEBOX_INFO, convertDVBUTF8(lstr, slen, 0).c_str()); #else if(strlen(pMenu->subtitle)) From 47609eb2f119d60e184cd7a14ae2b319f563835e Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Mon, 17 Mar 2014 12:28:00 +0400 Subject: [PATCH 115/225] neutrino.cpp: remove not reached keys handle, do not pass RC_timeout --- src/neutrino.cpp | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 800f75666..cc0e9158e 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -2284,12 +2284,6 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) else ShowHint(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_PERSONALIZE_MENUDISABLEDHINT),450, 10); } - else if ((msg == CRCInput::RC_audio) && !g_settings.audio_run_player) - { - StopSubtitles(); - usermenu.showUserMenu(SNeutrinoSettings::BUTTON_GREEN); - StartSubtitles(); - } else if( msg == CRCInput::RC_green) { if (g_settings.personalize[SNeutrinoSettings::P_MAIN_GREEN_BUTTON] == CPersonalizeGui::PERSONALIZE_ACTIVE_MODE_ENABLED) @@ -2311,17 +2305,6 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) else ShowHint(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_PERSONALIZE_MENUDISABLEDHINT),450, 10); } - else if( (msg == CRCInput::RC_green) || ((msg == CRCInput::RC_audio) && !g_settings.audio_run_player) ) - { - StopSubtitles(); - usermenu.showUserMenu(SNeutrinoSettings::BUTTON_GREEN); - StartSubtitles(); - } - else if( msg == CRCInput::RC_yellow ) { // NVODs - StopSubtitles(); - usermenu.showUserMenu(SNeutrinoSettings::BUTTON_YELLOW); - StartSubtitles(); - } else if( msg == CRCInput::RC_blue ) { if (g_settings.personalize[SNeutrinoSettings::P_MAIN_BLUE_BUTTON] == CPersonalizeGui::PERSONALIZE_ACTIVE_MODE_ENABLED)// Features Menu - Personalization Check { @@ -2332,6 +2315,12 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) else ShowHint(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_PERSONALIZE_MENUDISABLEDHINT), 450, 10); } + else if ((msg == CRCInput::RC_audio) && !g_settings.audio_run_player) + { + StopSubtitles(); + usermenu.showUserMenu(SNeutrinoSettings::BUTTON_GREEN); + StartSubtitles(); + } else if( (msg == CRCInput::RC_audio) && g_settings.audio_run_player) { //open mediaplayer menu in audio mode, user can select between audioplayer and internetradio CMediaPlayerMenu * media = CMediaPlayerMenu::getInstance(); @@ -2369,7 +2358,8 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) if (msg == CRCInput::RC_home) { CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO); } - handleMsg(msg, data); + if (msg != CRCInput::RC_timeout) + handleMsg(msg, data); } } else { @@ -2381,7 +2371,8 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) } } else { - handleMsg(msg, data); + if (msg != CRCInput::RC_timeout) + handleMsg(msg, data); } } } From ffce0866bca79b76c72dba53e07c22a1119a207e Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Mon, 17 Mar 2014 15:31:10 +0400 Subject: [PATCH 116/225] gui/cam_menu.cpp: rework, handle mmi timeout, close menu on CI/card insert/remove --- src/gui/cam_menu.cpp | 132 +++++++++++++++++++++++-------------------- src/gui/cam_menu.h | 7 ++- 2 files changed, 77 insertions(+), 62 deletions(-) diff --git a/src/gui/cam_menu.cpp b/src/gui/cam_menu.cpp index 44b46b403..dabae28ab 100644 --- a/src/gui/cam_menu.cpp +++ b/src/gui/cam_menu.cpp @@ -57,6 +57,9 @@ void CCAMMenuHandler::init(void) { hintBox = NULL; ca = cCA::GetInstance(); + close_timer = 0; + in_menu = false; + menu_type = menu_slot = -1; } int CCAMMenuHandler::exec(CMenuTarget* parent, const std::string &actionkey) @@ -171,25 +174,23 @@ int CCAMMenuHandler::doMainMenu() cammenu->addItem( GenericMenuSeparatorLine ); i++; } - + in_menu = true; ret = cammenu->exec(NULL, ""); delete cammenu; + in_menu = false; return ret; } #define CI_MSG_TIME 5 -int CCAMMenuHandler::handleMsg (const neutrino_msg_t msg, neutrino_msg_data_t data) +int CCAMMenuHandler::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data) { - int ret = messages_return::handled; //printf("CCAMMenuHandler::handleMsg: msg 0x%x data 0x%x\n", msg, data); - int camret = handleCamMsg(msg, data); - if(camret < 0) { - ret = messages_return::unhandled; - } - return ret; + int msgret; + handleCamMsg(msg, data, msgret); + return msgret; } -void CCAMMenuHandler::showHintBox (const neutrino_locale_t /*Caption*/, const char * const Text, uint32_t timeout) +void CCAMMenuHandler::showHintBox(const neutrino_locale_t /*Caption*/, const char * const Text, uint32_t timeout) { hideHintBox(); hintBox = new CHintBox(LOCALE_MESSAGEBOX_INFO, Text); @@ -209,9 +210,8 @@ void CCAMMenuHandler::hideHintBox(void) } } -int CCAMMenuHandler::handleCamMsg (const neutrino_msg_t msg, neutrino_msg_data_t data, bool from_menu) +int CCAMMenuHandler::handleCamMsg(const neutrino_msg_t msg, neutrino_msg_data_t data, int &msgret, bool from_menu) { - int ret = 0; char str[255]; char cnt[5]; int i; @@ -221,9 +221,19 @@ int CCAMMenuHandler::handleCamMsg (const neutrino_msg_t msg, neutrino_msg_data_t MMI_ENQUIRY_INFO *pMmiEnquiry = &MmiEnquiry; CA_MESSAGE Msg, *rMsg; - if (msg != NeutrinoMessages::EVT_CA_MESSAGE) - return from_menu ? 1 : -1; + printf("CCAMMenuHandler::handleCamMsg: msg %x data %x from %s\n", msg, data, from_menu ? "menu" : "neutrino"); + msgret = messages_return::unhandled; + if ((msg == NeutrinoMessages::EVT_TIMER) && (data == close_timer)) { + printf("CCAMMenuHandler::handleCamMsg: EVT_TIMER close_timer %d\n", close_timer); + g_RCInput->killTimer(close_timer); + msgret = messages_return::cancel_info; + } + + if (msg != NeutrinoMessages::EVT_CA_MESSAGE) + return 1; + + msgret = messages_return::handled; rMsg = (CA_MESSAGE *)data; if (!rMsg) @@ -236,34 +246,36 @@ int CCAMMenuHandler::handleCamMsg (const neutrino_msg_t msg, neutrino_msg_data_t CA_SLOT_TYPE SlotType = Msg.SlotType; int curslot = Msg.Slot; - printf("CCAMMenuHandler::handleCamMsg: msg %d from %s\n", MsgId, from_menu ? "menu" : "neutrino"); + printf("CCAMMenuHandler::handleCamMsg: CA msg %x from %s\n", MsgId, from_menu ? "menu" : "neutrino"); if (g_settings.ci_ignore_messages && !from_menu) return 1; + hideHintBox(); + if (SlotType != CA_SLOT_TYPE_SMARTCARD && SlotType != CA_SLOT_TYPE_CI) return -1; if(MsgId == CA_MESSAGE_MSG_INSERTED) { - hideHintBox(); snprintf(str, sizeof(str), "%s %d", g_Locale->getText(SlotType == CA_SLOT_TYPE_CI ? LOCALE_CI_INSERTED : LOCALE_SC_INSERTED), (int)curslot+1); printf("CCAMMenuHandler::handleCamMsg: %s\n", str); - ShowHint(LOCALE_MESSAGEBOX_INFO, str); + ShowHint(LOCALE_MESSAGEBOX_INFO, str, 450, 3); + if (in_menu) + msgret = messages_return::cancel_all; } else if (MsgId == CA_MESSAGE_MSG_REMOVED) { - hideHintBox(); - snprintf(str, sizeof(str), "%s %d", g_Locale->getText(SlotType == CA_SLOT_TYPE_CI ? LOCALE_CI_REMOVED : LOCALE_SC_REMOVED), (int)curslot+1); printf("CCAMMenuHandler::handleCamMsg: %s\n", str); - ShowHint(LOCALE_MESSAGEBOX_INFO, str); + ShowHint(LOCALE_MESSAGEBOX_INFO, str, 450, 3); +#if 0 + if (menu_slot == curslot && menu_type == SlotType) + return 3; +#endif + if (in_menu) + msgret = messages_return::cancel_all; } else if(MsgId == CA_MESSAGE_MSG_INIT_OK) { - if(hintBox != NULL) { - hintBox->hide(); - delete hintBox; - hintBox = NULL; - } char name[255] = "Unknown"; if (ca) ca->ModuleName(SlotType, curslot, name); @@ -272,10 +284,8 @@ int CCAMMenuHandler::handleCamMsg (const neutrino_msg_t msg, neutrino_msg_data_t g_Locale->getText(SlotType == CA_SLOT_TYPE_CI ? LOCALE_CI_INIT_OK : LOCALE_SC_INIT_OK), (int)curslot+1, name); printf("CCAMMenuHandler::handleCamMsg: %s\n", str); CCamManager::getInstance()->Start(CZapit::getInstance()->GetCurrentChannelID(), CCamManager::PLAY, true); - ShowHint(LOCALE_MESSAGEBOX_INFO, str); + ShowHint(LOCALE_MESSAGEBOX_INFO, str, 450, 3); } else if(MsgId == CA_MESSAGE_MSG_INIT_FAILED) { - hideHintBox(); - char name[255] = "Unknown"; if (ca) ca->ModuleName(SlotType, curslot, name); @@ -284,7 +294,7 @@ int CCAMMenuHandler::handleCamMsg (const neutrino_msg_t msg, neutrino_msg_data_t g_Locale->getText(SlotType == CA_SLOT_TYPE_CI ? LOCALE_CI_INIT_FAILED : LOCALE_SC_INIT_FAILED), (int)curslot+1, name); printf("CCAMMenuHandler::handleCamMsg: %s\n", str); - ShowHint(LOCALE_MESSAGEBOX_INFO, str); + ShowHint(LOCALE_MESSAGEBOX_INFO, str, 450, 3); } else if(MsgId == CA_MESSAGE_MSG_MMI_MENU || MsgId == CA_MESSAGE_MSG_MMI_LIST) { bool sublevel = false; @@ -299,8 +309,7 @@ int CCAMMenuHandler::handleCamMsg (const neutrino_msg_t msg, neutrino_msg_data_t printf("CCAMMenuHandler::handleCamMsg: slot %d menu ready, title %s choices %d\n", curslot, convertDVBUTF8(pMenu->title, strlen(pMenu->title), 0).c_str(), pMenu->choice_nb); - hideHintBox(); - + int menuret = menu_return::RETURN_REPAINT; int selected = -1; if(pMenu->choice_nb && from_menu) { CMenuWidget* menu = new CMenuWidget(convertDVBUTF8(pMenu->title, strlen(pMenu->title), 0).c_str(), NEUTRINO_ICON_SETTINGS); @@ -340,8 +349,7 @@ int CCAMMenuHandler::handleCamMsg (const neutrino_msg_t msg, neutrino_msg_data_t menu->addItem(new CMenuForwarder(convertDVBUTF8(pMenu->bottom, slen, 0).c_str(), false)); } - menu->exec(NULL, ""); - + menuret = menu->exec(NULL, ""); delete menu; delete selector; } else { @@ -349,8 +357,6 @@ int CCAMMenuHandler::handleCamMsg (const neutrino_msg_t msg, neutrino_msg_data_t char lstr[255]; int slen = 0; - hideHintBox(); -#if 1 if(strlen(pMenu->title)) slen += snprintf(&lstr[slen], 255-slen, "%s\n", pMenu->title); if(strlen(pMenu->subtitle)) @@ -358,22 +364,15 @@ int CCAMMenuHandler::handleCamMsg (const neutrino_msg_t msg, neutrino_msg_data_t if(strlen(pMenu->bottom)) slen += snprintf(&lstr[slen], 255-slen, "%s\n", pMenu->bottom); - for(i = 0; (i < pMenu->choice_nb) && (i < MAX_MMI_ITEMS); i++) { + for(i = 0; (i < pMenu->choice_nb) && (i < MAX_MMI_ITEMS); i++) slen += snprintf(&lstr[slen], 255-slen, "%s\n", pMenu->choice_item[i]); - } + ShowHint(LOCALE_MESSAGEBOX_INFO, convertDVBUTF8(lstr, slen, 0).c_str()); -#else - if(strlen(pMenu->subtitle)) - slen += snprintf(&lstr[slen], 255-slen, "\n%s", pMenu->subtitle); - if(strlen(pMenu->bottom)) - slen += snprintf(&lstr[slen], 255-slen, "\n%s", pMenu->bottom); - ShowHint(convertDVBUTF8(pMenu->title, strlen(pMenu->title), 0).c_str(), convertDVBUTF8(lstr, slen, 0).c_str()); -#endif return 0; } if(sublevel) - return 0; + return menuret == menu_return::RETURN_EXIT_ALL ? 3 : 0; if(selected >= 0) { printf("CCAMMenuHandler::handleCamMsg: selected %d:%s sublevel %s\n", selected, pMenu->choice_item[i], sublevel ? "yes" : "no"); @@ -381,7 +380,7 @@ int CCAMMenuHandler::handleCamMsg (const neutrino_msg_t msg, neutrino_msg_data_t timeoutEnd = CRCInput::calcTimeoutEnd(10); return 1; } else { - return 2; + return menuret == menu_return::RETURN_EXIT_ALL ? 3 : 2; } } else if(MsgId == CA_MESSAGE_MSG_MMI_REQ_INPUT) { @@ -391,7 +390,6 @@ int CCAMMenuHandler::handleCamMsg (const neutrino_msg_t msg, neutrino_msg_data_t memmove(pMmiEnquiry, (MMI_ENQUIRY_INFO *)Msg.Msg.Data[0], sizeof(MMI_ENQUIRY_INFO)); free((void *)Msg.Msg.Data[0]); printf("CCAMMenuHandler::handleCamMsg: slot %d input request, text %s\n", curslot, convertDVBUTF8(pMmiEnquiry->enquiryText, strlen(pMmiEnquiry->enquiryText), 0).c_str()); - hideHintBox(); std::string ENQAnswer; @@ -411,9 +409,15 @@ int CCAMMenuHandler::handleCamMsg (const neutrino_msg_t msg, neutrino_msg_data_t } } else if(MsgId == CA_MESSAGE_MSG_MMI_CLOSE) { - printf("CCAMMenuHandler::handleCamMsg: close request slot: %d\n", curslot); - hideHintBox(); - ca->MenuClose(SlotType, curslot); + int timeout = 0; + if (Msg.Flags & CA_MESSAGE_HAS_PARAM1_INT) + timeout = Msg.Msg.Param[0]; + printf("CCAMMenuHandler::handleCamMsg: close request slot: %d (timeout %d)\n", curslot, timeout); + //ca->MenuClose(SlotType, curslot); + if (timeout) + close_timer = g_RCInput->addTimer(timeout*1000*1000, true); + else + msgret = messages_return::cancel_info; return 0; } else if(MsgId == CA_MESSAGE_MSG_MMI_TEXT) { @@ -431,10 +435,8 @@ int CCAMMenuHandler::handleCamMsg (const neutrino_msg_t msg, neutrino_msg_data_t return -1; } CNeutrinoApp::getInstance()->zapTo(channel->getChannelID()); - } else - ret = -1; - //printf("CCAMMenuHandler::handleCamMsg: return %d\n", ret); - return ret; + } + return 1; } int CCAMMenuHandler::doMenu(int slot, CA_SLOT_TYPE slotType) @@ -444,6 +446,8 @@ int CCAMMenuHandler::doMenu(int slot, CA_SLOT_TYPE slotType) neutrino_msg_data_t data; bool doexit = false; + menu_slot = slot; + menu_type = slotType; while(!doexit) { printf("CCAMMenuHandler::doMenu: enter menu for slot %d\n", slot); @@ -460,20 +464,23 @@ int CCAMMenuHandler::doMenu(int slot, CA_SLOT_TYPE slotType) printf("CCAMMenuHandler::doMenu: menu timeout\n"); hideHintBox(); ShowHint(LOCALE_MESSAGEBOX_INFO, - g_Locale->getText(slotType == CA_SLOT_TYPE_CI ? LOCALE_CI_TIMEOUT : LOCALE_SC_TIMEOUT)); + g_Locale->getText(slotType == CA_SLOT_TYPE_CI ? LOCALE_CI_TIMEOUT : LOCALE_SC_TIMEOUT), 450, 3); ca->MenuClose(slotType, slot); return menu_return::RETURN_REPAINT; } - /* -1 = not our event, 0 = back to top menu, 1 = continue loop, 2 = quit */ - int ret = handleCamMsg(msg, data, true); - printf("CCAMMenuHandler::doMenu: handleCamMsg %d\n", ret); - if(ret < 0 && (msg > CRCInput::RC_Messages)) { - if ( CNeutrinoApp::getInstance()->handleMsg( msg, data ) & ( messages_return::cancel_all | messages_return::cancel_info ) ) + /* -1 = not our event, 0 = back to top menu, 1 = continue loop, 2 = quit , 3 = quit all*/ + int msgret; + int ret = handleCamMsg(msg, data, msgret, true); + printf("CCAMMenuHandler::doMenu: handleCamMsg ret: %d\n", ret); + if((msgret & messages_return::unhandled) && (msg > CRCInput::RC_Events)) { + if (CNeutrinoApp::getInstance()->handleMsg(msg, data) & (messages_return::cancel_all | messages_return::cancel_info)) { doexit = true; res = menu_return::RETURN_EXIT_ALL; + break; } - } else if (ret == 1) { + } + if (ret == 1) { /* workaround: dont cycle here on timers */ if (msg != NeutrinoMessages::EVT_TIMER) timeoutEnd = CRCInput::calcTimeoutEnd(10); @@ -481,6 +488,10 @@ int CCAMMenuHandler::doMenu(int slot, CA_SLOT_TYPE slotType) } else if (ret == 2) { doexit = true; break; + } else if (ret == 3) { + res = menu_return::RETURN_EXIT_ALL; + doexit = true; + break; } else { // ret == 0 break; } @@ -488,6 +499,7 @@ int CCAMMenuHandler::doMenu(int slot, CA_SLOT_TYPE slotType) } ca->MenuClose(slotType, slot); hideHintBox(); + menu_type = menu_slot = -1; printf("CCAMMenuHandler::doMenu: return\n"); return res; } diff --git a/src/gui/cam_menu.h b/src/gui/cam_menu.h index 4a8c1fa43..829aa3433 100644 --- a/src/gui/cam_menu.h +++ b/src/gui/cam_menu.h @@ -37,10 +37,13 @@ class CCAMMenuHandler : public CMenuTarget, public CChangeObserver CHintBox * hintBox; cCA *ca; uint64_t timeoutEnd; - //int slot; + uint32_t close_timer; + int menu_slot; + int menu_type; + bool in_menu; int doMenu(int slot, CA_SLOT_TYPE slotType); int doMainMenu(); - int handleCamMsg (const neutrino_msg_t msg, neutrino_msg_data_t data, bool from_menu = false); + int handleCamMsg (const neutrino_msg_t msg, neutrino_msg_data_t data, int &msgret, bool from_menu = false); void hideHintBox(void); void showHintBox(const neutrino_locale_t Caption, const char * const Text, uint32_t timeout = 0); public: From df95c904b453c05ffbf97b4484f3e13eb44b2668 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Thu, 20 Mar 2014 15:05:57 +0400 Subject: [PATCH 117/225] locals: add new locales for fast-scan --- data/locale/english.locale | 15 ++++++++++++--- src/system/locals.h | 15 ++++++++++++--- src/system/locals_intern.h | 15 ++++++++++++--- 3 files changed, 36 insertions(+), 9 deletions(-) diff --git a/data/locale/english.locale b/data/locale/english.locale index d91d5a4c1..ef815e968 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -1753,12 +1753,21 @@ satsetup.diseqcrepeat DiSEqC-repeats satsetup.extended DiSEqC-Settings satsetup.extended_motor Motor-Settings satsetup.fastscan_all SD and HD +satsetup.fastscan_auto_diseqc Start auto-diseqc configuration +satsetup.fastscan_auto_diseqc_wait Auto-diseqc configuration in progress satsetup.fastscan_hd HD only satsetup.fastscan_head Fast scan (Astra 1, 19.2E, 12.515Mhz) satsetup.fastscan_prov Provider -satsetup.fastscan_prov_cd CanalDigitaal -satsetup.fastscan_prov_telesat TéléSAT -satsetup.fastscan_prov_tvv TV Vlaanderen +satsetup.fastscan_prov_cd_hd CanalDigitaal (HD) +satsetup.fastscan_prov_cd_sd CanalDigitaal (SD) +satsetup.fastscan_prov_hda HD Austria +satsetup.fastscan_prov_hello Hello +satsetup.fastscan_prov_skylink_c Skylink Czech +satsetup.fastscan_prov_skylink_s Skylink Slovak +satsetup.fastscan_prov_telesat_b TéléSAT Belgium +satsetup.fastscan_prov_telesat_l TéléSAT Luxemburg +satsetup.fastscan_prov_tvv_hd TV Vlaanderen (HD) +satsetup.fastscan_prov_tvv_sd TV Vlaanderen (SD) satsetup.fastscan_sd SD only satsetup.fastscan_type Scan type satsetup.fe_mode Tuner mode diff --git a/src/system/locals.h b/src/system/locals.h index e52de6d83..ac15eb73b 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -1780,12 +1780,21 @@ typedef enum LOCALE_SATSETUP_EXTENDED, LOCALE_SATSETUP_EXTENDED_MOTOR, LOCALE_SATSETUP_FASTSCAN_ALL, + LOCALE_SATSETUP_FASTSCAN_AUTO_DISEQC, + LOCALE_SATSETUP_FASTSCAN_AUTO_DISEQC_WAIT, LOCALE_SATSETUP_FASTSCAN_HD, LOCALE_SATSETUP_FASTSCAN_HEAD, LOCALE_SATSETUP_FASTSCAN_PROV, - LOCALE_SATSETUP_FASTSCAN_PROV_CD, - LOCALE_SATSETUP_FASTSCAN_PROV_TELESAT, - LOCALE_SATSETUP_FASTSCAN_PROV_TVV, + LOCALE_SATSETUP_FASTSCAN_PROV_CD_HD, + LOCALE_SATSETUP_FASTSCAN_PROV_CD_SD, + LOCALE_SATSETUP_FASTSCAN_PROV_HDA, + LOCALE_SATSETUP_FASTSCAN_PROV_HELLO, + LOCALE_SATSETUP_FASTSCAN_PROV_SKYLINK_C, + LOCALE_SATSETUP_FASTSCAN_PROV_SKYLINK_S, + LOCALE_SATSETUP_FASTSCAN_PROV_TELESAT_B, + LOCALE_SATSETUP_FASTSCAN_PROV_TELESAT_L, + LOCALE_SATSETUP_FASTSCAN_PROV_TVV_HD, + LOCALE_SATSETUP_FASTSCAN_PROV_TVV_SD, LOCALE_SATSETUP_FASTSCAN_SD, LOCALE_SATSETUP_FASTSCAN_TYPE, LOCALE_SATSETUP_FE_MODE, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index e7cad05c9..d2b9c1734 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -1780,12 +1780,21 @@ const char * locale_real_names[] = "satsetup.extended", "satsetup.extended_motor", "satsetup.fastscan_all", + "satsetup.fastscan_auto_diseqc", + "satsetup.fastscan_auto_diseqc_wait", "satsetup.fastscan_hd", "satsetup.fastscan_head", "satsetup.fastscan_prov", - "satsetup.fastscan_prov_cd", - "satsetup.fastscan_prov_telesat", - "satsetup.fastscan_prov_tvv", + "satsetup.fastscan_prov_cd_hd", + "satsetup.fastscan_prov_cd_sd", + "satsetup.fastscan_prov_hda", + "satsetup.fastscan_prov_hello", + "satsetup.fastscan_prov_skylink_c", + "satsetup.fastscan_prov_skylink_s", + "satsetup.fastscan_prov_telesat_b", + "satsetup.fastscan_prov_telesat_l", + "satsetup.fastscan_prov_tvv_hd", + "satsetup.fastscan_prov_tvv_sd", "satsetup.fastscan_sd", "satsetup.fastscan_type", "satsetup.fe_mode", From 1960a84b6c47187667778bfaf69a8c0d05f89c2f Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Thu, 20 Mar 2014 15:09:36 +0400 Subject: [PATCH 118/225] zapit/src/fastscan.cpp: add fast-scan operators, add diseqc autoconfig --- src/zapit/include/zapit/fastscan.h | 19 ++-- src/zapit/include/zapit/scan.h | 1 + src/zapit/src/fastscan.cpp | 140 +++++++++++++++++++++++++---- 3 files changed, 137 insertions(+), 23 deletions(-) diff --git a/src/zapit/include/zapit/fastscan.h b/src/zapit/include/zapit/fastscan.h index bc3083a1c..397f6c470 100644 --- a/src/zapit/include/zapit/fastscan.h +++ b/src/zapit/include/zapit/fastscan.h @@ -23,15 +23,25 @@ #define _FASTSCAN_H_ typedef enum fs_operator { - OPERATOR_CD, - OPERATOR_TVV, - OPERATOR_TELESAT, + OPERATOR_CD_SD, + OPERATOR_CD_HD, + OPERATOR_TVV_SD, + OPERATOR_TVV_HD, + OPERATOR_TELESAT_B, + OPERATOR_TELESAT_L, + OPERATOR_HD_AUSTRIA, + OPERATOR_SKYLINK_C, + OPERATOR_SKYLINK_S, + OPERATOR_HELLO, OPERATOR_MAX } fs_operator_t; #define CD_OPERATOR_ID (106) #define TVV_OPERATOR_ID (108) #define TELESAT_OPERATOR_ID (109) +#define HDAUSTRIA_OPERATOR_ID (100) +#define SKYLINK_OPERATOR_ID (200) +#define HELLO_OPERATOR_ID (300) #define FAST_SCAN_SD 1 #define FAST_SCAN_HD 2 @@ -39,8 +49,7 @@ typedef enum fs_operator { typedef struct fast_scan_operator { int id; - unsigned short sd_pid; - unsigned short hd_pid; + unsigned short pid; char * name; } fast_scan_operator_t; diff --git a/src/zapit/include/zapit/scan.h b/src/zapit/include/zapit/scan.h index 3b6046e45..f49a7cd7c 100644 --- a/src/zapit/include/zapit/scan.h +++ b/src/zapit/include/zapit/scan.h @@ -144,6 +144,7 @@ class CServiceScan : public OpenThreads::Thread bool isFtaOnly() { return flags & SCAN_FTA; } int GetFlags() { return flags; } bool SatHaveChannels() { return satHaveChannels; } + bool TestDiseqcConfig(int num); }; #endif /* __scan_h__ */ diff --git a/src/zapit/src/fastscan.cpp b/src/zapit/src/fastscan.cpp index 311183113..292b2331c 100644 --- a/src/zapit/src/fastscan.cpp +++ b/src/zapit/src/fastscan.cpp @@ -38,9 +38,16 @@ //#define SCAN_DEBUG fast_scan_operator_t fast_scan_operators [OPERATOR_MAX] = { - { CD_OPERATOR_ID, 900, 901, (char *) "CanalDigitaal" }, - { TVV_OPERATOR_ID, 910, 911, (char *) "TV Vlaanderen" }, - { TELESAT_OPERATOR_ID, 920, 921 , (char *) "TéléSAT" } + { CD_OPERATOR_ID, 900, (char *) "CanalDigitaal (SD)" }, + { CD_OPERATOR_ID, 901, (char *) "CanalDigitaal (HD)" }, + { TVV_OPERATOR_ID, 910, (char *) "TV Vlaanderen (SD)" }, + { TVV_OPERATOR_ID, 911, (char *) "TV Vlaanderen (HD)" }, + { TELESAT_OPERATOR_ID, 920, (char *) "TéléSAT Belgique" }, + { TELESAT_OPERATOR_ID, 921, (char *) "TéléSAT Luxembourg" }, + { HDAUSTRIA_OPERATOR_ID, 950, (char *) "HD Austria" }, + { SKYLINK_OPERATOR_ID, 30, (char *) "Skylink Czech Republic" }, + { SKYLINK_OPERATOR_ID, 31, (char *) "Skylink Slovak Republic" }, + { HELLO_OPERATOR_ID, 951, (char *) "Hello" } }; extern CBouquetManager *g_bouquetManager; @@ -48,22 +55,87 @@ extern CBouquetManager* scanBouquetManager; extern CZapitClient::bouquetMode bouquetMode; extern transponder_list_t transponders; // defined in zapit.cpp +typedef struct diseq_test_param { + int position; + int frequency; + int symbol_rate; + fe_code_rate_t fec_inner; + int polarization; +} diseq_test_param_t; + +diseq_test_param_t diseqc_test[] = { + // { 192, 12515000, 22000000, FEC_5_6, 0 }, // test TP + { 192, 12552000, 22000000, FEC_5_6, 1 }, + { 235, 12168000, 27500000, FEC_3_4, 1 }, + { 282, 11778000, 27500000, FEC_2_3, 1 }, // FIXME: no such TP on lyngsat ?? + { 130, 11681000, 27500000, FEC_S2_8PSK_3_4, 0 }, + { 90, 12074000, 27500000, FEC_S2_8PSK_3_4, 1 }, +}; +#define diseqc_test_count (sizeof(diseqc_test)/sizeof(diseq_test_param_t)) + +bool CServiceScan::TestDiseqcConfig(int num) +{ + if(num >= OPERATOR_MAX) { + printf("[fast scan] invalid operator %d\n", num); + return false; + } + fast_scan_operator_t *op = &fast_scan_operators[num]; + printf("[fast scan] testing diseqc config for operator %d [%s], pid 0x%x\n", op->id, op->name, op->pid); + InitFastscanLnb(op->id); + + std::set scanned; + satellite_map_t &satmap = frontend->getSatellites(); + for (int diseqc = 0; diseqc < 4; diseqc++) { + for (unsigned i = 0; i < diseqc_test_count; i++) { + if ((op->id == HELLO_OPERATOR_ID) && (diseqc_test[i].position == 282)) + continue; + if ((op->id != HELLO_OPERATOR_ID) && (diseqc_test[i].position == 90)) + continue; + + std::set::iterator it = scanned.find(diseqc_test[i].position); + if (it != scanned.end()) + continue; + + FrontendParameters feparams; + feparams.dvb_feparams.frequency = diseqc_test[i].frequency; + feparams.dvb_feparams.u.qpsk.symbol_rate = diseqc_test[i].symbol_rate; + feparams.dvb_feparams.u.qpsk.fec_inner = diseqc_test[i].fec_inner; + + int old_diseqc = satmap[diseqc_test[i].position].diseqc; + satmap[diseqc_test[i].position].diseqc = diseqc; + + if (tuneFrequency(&feparams, diseqc_test[i].polarization, diseqc_test[i].position)) { + scanned.insert(diseqc_test[i].position); + break; + } + satmap[diseqc_test[i].position].diseqc = old_diseqc; + } + } + return true; +} + void CServiceScan::InitFastscanLnb(int id) { CServiceManager::getInstance()->InitSatPosition(192, NULL, true); CServiceManager::getInstance()->InitSatPosition(235, NULL, true); - CServiceManager::getInstance()->InitSatPosition(282, NULL, true); CServiceManager::getInstance()->InitSatPosition(130, NULL, true); + if (id == HELLO_OPERATOR_ID) + CServiceManager::getInstance()->InitSatPosition(90, NULL, true); + else + CServiceManager::getInstance()->InitSatPosition(282, NULL, true); + satellite_map_t & satmap = CServiceManager::getInstance()->SatelliteList(); frontend = CFEManager::getInstance()->getFE(0); //frontend->setSatellites(satmap); //satmap = frontend->getSatellites(); - +#if 0 switch(id) { default: case CD_OPERATOR_ID: case TVV_OPERATOR_ID: + case SKYLINK_OPERATOR_ID: + case HDAUSTRIA_OPERATOR_ID: satmap[192].diseqc = 0; satmap[235].diseqc = 1; satmap[282].diseqc = 2; @@ -75,11 +147,22 @@ void CServiceScan::InitFastscanLnb(int id) satmap[235].diseqc = 2; satmap[282].diseqc = 3; break; + case HELLO_OPERATOR_ID: + satmap[90].diseqc = 0; + satmap[130].diseqc = 1; + satmap[192].diseqc = 2; + satmap[235].diseqc = 3; + break; } +#endif satmap[130].configured = 1; satmap[192].configured = 1; satmap[235].configured = 1; - satmap[282].configured = 1; + if (id == HELLO_OPERATOR_ID) + satmap[90].configured = 1; + else + satmap[282].configured = 1; + frontend->setSatellites(satmap); frontend->setDiseqcType(DISEQC_1_0); CFEManager::getInstance()->saveSettings(); @@ -89,38 +172,53 @@ void CServiceScan::InitFastscanLnb(int id) bool CServiceScan::ScanFast() { fast_scan_type_t * fast_type = (fast_scan_type_t *) scan_arg; - fast_scan_operator_t * op; - fs_operator_t num = fast_type->op; - int type = fast_type->type; + fast_scan_operator_t *op; + //int type = fast_type->type; uint8_t polarization; FrontendParameters feparams; - int res; + bool res; + fs_operator_t num = fast_type->op; if(num >= OPERATOR_MAX) { printf("[fast scan] invalid operator %d\n", num); goto _err; } + op = &fast_scan_operators[num]; + found_transponders = 0; found_channels = 0; found_tv_chans = 0; found_data_chans = 0; found_radio_chans = 0; - op = &fast_scan_operators[num]; - printf("[fast scan] scaning operator %d for %s channels\n", op->id, type == FAST_SCAN_SD ? "SD" : type == FAST_SCAN_HD ? "HD" : "All"); + //printf("[fast scan] scaning operator %d for %s channels\n", op->id, type == FAST_SCAN_SD ? "SD" : type == FAST_SCAN_HD ? "HD" : "All"); + printf("[fast scan] scaning operator %d [%s], pid 0x%x\n", op->id, op->name, op->pid); - feparams.dvb_feparams.frequency = 12515000; - feparams.dvb_feparams.u.qpsk.symbol_rate = 22000000; - feparams.dvb_feparams.u.qpsk.fec_inner = FEC_5_6; + feparams.dvb_feparams.frequency = 12070000; + feparams.dvb_feparams.u.qpsk.symbol_rate = 27500000; + feparams.dvb_feparams.u.qpsk.fec_inner = FEC_3_4; polarization = 0; CZapit::getInstance()->SendEvent(CZapitClient::EVT_SCAN_SATELLITE, op->name, strlen(op->name)+1); InitFastscanLnb(op->id); - if(!tuneFrequency(&feparams, polarization, 192)) { - printf("[fast scan] tune failed\n"); - goto _err; + if(!tuneFrequency(&feparams, polarization, 235)) { + printf("[fast scan] tune failed, try backup\n"); + if (op->id == HELLO_OPERATOR_ID) { + feparams.dvb_feparams.frequency = 12074000; + feparams.dvb_feparams.u.qpsk.symbol_rate = 27500000; + feparams.dvb_feparams.u.qpsk.fec_inner = FEC_3_4; + polarization = 1; + res = tuneFrequency(&feparams, polarization, 192); + } else { + feparams.dvb_feparams.frequency = 12515000; + feparams.dvb_feparams.u.qpsk.symbol_rate = 22000000; + feparams.dvb_feparams.u.qpsk.fec_inner = FEC_5_6; + res = tuneFrequency(&feparams, polarization, 192); + } + if (!res) + goto _err; } scanBouquetManager = new CBouquetManager(); @@ -129,6 +227,7 @@ bool CServiceScan::ScanFast() fast_services_freq.clear(); fast_services_number.clear(); +#if 0 if(type & FAST_SCAN_SD) { res = ParseFnt(op->sd_pid, op->id); if(res == 0) @@ -143,6 +242,11 @@ bool CServiceScan::ScanFast() printf("[fast scan] pid %d (HD) scan done, found %d transponders and %d services\n", op->hd_pid, found_transponders, found_channels); } +#endif + res = ParseFnt(op->pid, op->id); + if(res == 0) + ParseFst(op->pid, op); + //FIXME move to Cleanup() ? if(found_channels) { CZapitClient myZapitClient; From acffe8024d57b58507a2f1618d6cd45b9af61616 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Thu, 20 Mar 2014 15:10:47 +0400 Subject: [PATCH 119/225] gui/scan_setup.cpp: add fast-scan operators, add fast-scan diseqc auto-config and menu to change diseqc --- src/gui/scan_setup.cpp | 68 ++++++++++++++++++++++++++++++++++++------ src/gui/scan_setup.h | 3 ++ 2 files changed, 62 insertions(+), 9 deletions(-) diff --git a/src/gui/scan_setup.cpp b/src/gui/scan_setup.cpp index 4ba2fd489..e673a8c25 100644 --- a/src/gui/scan_setup.cpp +++ b/src/gui/scan_setup.cpp @@ -307,6 +307,10 @@ int CScanSetup::exec(CMenuTarget* parent, const std::string &actionKey) return menu_return::RETURN_EXIT_ALL; return res; } + if (actionKey == "fastdiseqc") { + printf("[neutrino] CScanSetup::%s: showFastscanDiseqcSetup()\n", __FUNCTION__); + return showFastscanDiseqcSetup(); + } std::string scants_key[] = {"all", "manual", "test", "fast", "auto"/*doesn't exists in CScanTs!*/}; if (actionKey.size() > 1) { @@ -1204,6 +1208,7 @@ void CScanSetup::addScanMenuAutoScanAll(CMenuWidget *auto_ScanAll) } #ifdef ENABLE_FASTSCAN +#if 0 #define FAST_SCAN_OPTIONS_COUNT 2 const CMenuOptionChooser::keyval FAST_SCAN_OPTIONS[FAST_SCAN_OPTIONS_COUNT] = { @@ -1211,14 +1216,22 @@ const CMenuOptionChooser::keyval FAST_SCAN_OPTIONS[FAST_SCAN_OPTIONS_COUNT] = { FAST_SCAN_HD, LOCALE_SATSETUP_FASTSCAN_HD } /*{ FAST_SCAN_ALL, LOCALE_SATSETUP_FASTSCAN_ALL }*/ }; +#endif -#define FAST_SCAN_PROV_OPTIONS_COUNT 3 -const CMenuOptionChooser::keyval FAST_SCAN_PROV_OPTIONS[FAST_SCAN_PROV_OPTIONS_COUNT] = +const CMenuOptionChooser::keyval FAST_SCAN_PROV_OPTIONS[] = { - { OPERATOR_CD, LOCALE_SATSETUP_FASTSCAN_PROV_CD }, - { OPERATOR_TVV, LOCALE_SATSETUP_FASTSCAN_PROV_TVV }, - { OPERATOR_TELESAT, LOCALE_SATSETUP_FASTSCAN_PROV_TELESAT } + { OPERATOR_CD_SD, LOCALE_SATSETUP_FASTSCAN_PROV_CD_SD }, + { OPERATOR_CD_HD, LOCALE_SATSETUP_FASTSCAN_PROV_CD_HD }, + { OPERATOR_TVV_SD, LOCALE_SATSETUP_FASTSCAN_PROV_TVV_SD }, + { OPERATOR_TVV_HD, LOCALE_SATSETUP_FASTSCAN_PROV_TVV_HD }, + { OPERATOR_TELESAT_B, LOCALE_SATSETUP_FASTSCAN_PROV_TELESAT_B }, + { OPERATOR_TELESAT_L, LOCALE_SATSETUP_FASTSCAN_PROV_TELESAT_L }, + { OPERATOR_HD_AUSTRIA, LOCALE_SATSETUP_FASTSCAN_PROV_HDA }, + { OPERATOR_SKYLINK_C, LOCALE_SATSETUP_FASTSCAN_PROV_SKYLINK_C }, + { OPERATOR_SKYLINK_S, LOCALE_SATSETUP_FASTSCAN_PROV_SKYLINK_S }, + { OPERATOR_HELLO, LOCALE_SATSETUP_FASTSCAN_PROV_HELLO } }; +#define FAST_SCAN_PROV_OPTIONS_COUNT (sizeof(FAST_SCAN_PROV_OPTIONS)/sizeof(CMenuOptionChooser::keyval)) //init fast scan menu void CScanSetup::addScanMenuFastScan(CMenuWidget *fast_ScanMenu) @@ -1228,17 +1241,54 @@ void CScanSetup::addScanMenuFastScan(CMenuWidget *fast_ScanMenu) CMenuOptionChooser* fastProv = new CMenuOptionChooser(LOCALE_SATSETUP_FASTSCAN_PROV, (int *)&scansettings.fast_op, FAST_SCAN_PROV_OPTIONS, FAST_SCAN_PROV_OPTIONS_COUNT, true, NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED, true); fastProv->setHint("", LOCALE_MENU_HINT_SCAN_FASTPROV); + fast_ScanMenu->addItem(fastProv); +#if 0 CMenuOptionChooser* fastType = new CMenuOptionChooser(LOCALE_SATSETUP_FASTSCAN_TYPE, (int *)&scansettings.fast_type, FAST_SCAN_OPTIONS, FAST_SCAN_OPTIONS_COUNT, true, NULL, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN, true); fastType->setHint("", LOCALE_MENU_HINT_SCAN_FASTTYPE); - - //---------------------------------------------------------------------- - fast_ScanMenu->addItem(fastProv); fast_ScanMenu->addItem(fastType); - //---------------------------------------------------------------------- +#endif fast_ScanMenu->addItem(GenericMenuSeparatorLine); +#if 0 CMenuForwarder * mf = new CMenuForwarder(LOCALE_SCANTS_STARTNOW, allow_start, NULL, this, "sfast", CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW); mf->setHint("", LOCALE_MENU_HINT_SCAN_START); fast_ScanMenu->addItem(mf); +#endif + CMenuForwarder * mf = new CMenuForwarder(LOCALE_SATSETUP_FASTSCAN_AUTO_DISEQC, allow_start, NULL, this, "fastdiseqc", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN); + mf->setHint("", LOCALE_MENU_HINT_SCAN_START); + fast_ScanMenu->addItem(mf); +} + +int CScanSetup::showFastscanDiseqcSetup() +{ + CHintBox * hintbox = new CHintBox(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_SATSETUP_FASTSCAN_AUTO_DISEQC_WAIT)); + hintbox->paint(); + + CServiceScan::getInstance()->TestDiseqcConfig(scansettings.fast_op); + delete hintbox; + + CMenuWidget * sat_setup = new CMenuWidget(LOCALE_SATSETUP_DISEQC_INPUT, NEUTRINO_ICON_SETTINGS, width); + sat_setup->addIntroItems(); + + CFrontend * fe = CFEManager::getInstance()->getFE(0); + satellite_map_t & satmap = fe->getSatellites(); + INFO("satmap size = %d", (int)satmap.size()); + for (sat_iterator_t sit = satmap.begin(); sit != satmap.end(); ++sit) + { + if(!sit->second.configured) + continue; + + std::string satname = CServiceManager::getInstance()->GetSatelliteName(sit->first); + CMenuOptionNumberChooser *diseqc = new CMenuOptionNumberChooser(satname, &sit->second.diseqc, true, -1, 15, this, 1, -1, LOCALE_OPTIONS_OFF); + sat_setup->addItem(diseqc); + } + sat_setup->addItem(GenericMenuSeparatorLine); + CMenuForwarder * mf = new CMenuForwarder(LOCALE_SCANTS_STARTNOW, allow_start, NULL, this, "sfast", CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW); + mf->setHint("", LOCALE_MENU_HINT_SCAN_START); + sat_setup->addItem(mf); + + int res = sat_setup->exec(NULL, ""); + delete sat_setup; + return res; } #endif /*ENABLE_FASTSCAN*/ diff --git a/src/gui/scan_setup.h b/src/gui/scan_setup.h index e826f3b2c..aa8cb896b 100644 --- a/src/gui/scan_setup.h +++ b/src/gui/scan_setup.h @@ -116,6 +116,9 @@ class CScanSetup : public CMenuTarget, public CChangeObserver int addScanOptionsItems(CMenuWidget *options_menu, const int &shortcut = 1); int addListFlagsItems(CMenuWidget *listflags_menu, const int &shortcut = 1, bool manual = false); +#ifdef ENABLE_FASTSCAN + int showFastscanDiseqcSetup(); +#endif void saveScanSetup(); From 9ec646bebec58b57d1a24b0ec6cd3a57b6e40215 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Fri, 21 Mar 2014 11:30:07 +0400 Subject: [PATCH 120/225] zapit/src/frontend.cpp: change timers to use time_monotonic_ms() --- src/zapit/src/frontend.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/zapit/src/frontend.cpp b/src/zapit/src/frontend.cpp index 24a75dd58..12cfdc254 100644 --- a/src/zapit/src/frontend.cpp +++ b/src/zapit/src/frontend.cpp @@ -36,6 +36,7 @@ #include #include #include +#include extern transponder_list_t transponders; extern int zapit_debug; @@ -128,20 +129,18 @@ static const struct dtv_property dvbt_cmdargs[] = { #define diff(x,y) (max(x,y) - min(x,y)) #define FE_TIMER_INIT() \ + unsigned int timer_start; \ static unsigned int tmin = 2000, tmax = 0; \ - struct timeval tv, tv2; \ unsigned int timer_msec = 0; #define FE_TIMER_START() \ - gettimeofday(&tv, NULL); + timer_start = time_monotonic_ms(); #define FE_TIMER_STOP(label) \ - gettimeofday(&tv2, NULL); \ - timer_msec = ((tv2.tv_sec-tv.tv_sec) * 1000) + \ - ((tv2.tv_usec-tv.tv_usec) / 1000); \ + timer_msec = time_monotonic_ms() - timer_start; \ if(tmin > timer_msec) tmin = timer_msec; \ if(tmax < timer_msec) tmax = timer_msec; \ - printf("[fe%d] %s: %u msec (min %u max %u)\n", \ + printf("[fe%d] %s: %u msec (min %u max %u)\n", \ fenumber, label, timer_msec, tmin, tmax); // Internal Inner FEC representation From b36a66db34f3cf4bca759fa95563238b18378dbc Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Fri, 21 Mar 2014 13:37:59 +0400 Subject: [PATCH 121/225] gui/widget/menue.cpp: add CMenuOptionChooser::setOptions --- src/gui/widget/menue.cpp | 33 ++++++++++++++++++++++++++------- src/gui/widget/menue.h | 21 +++++++++++++++------ 2 files changed, 41 insertions(+), 13 deletions(-) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index a0e154bad..e50cd1262 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -1350,9 +1350,7 @@ CMenuOptionChooser::CMenuOptionChooser(const neutrino_locale_t OptionName, int * for (unsigned int i = 0; i < number_of_options; i++) { struct keyval_ext opt; - opt.key = Options[i].key; - opt.value = Options[i].value; - opt.valname = NULL; + opt = Options[i]; options.push_back(opt); } } @@ -1373,9 +1371,7 @@ CMenuOptionChooser::CMenuOptionChooser(const std::string &OptionName, int * cons for (unsigned int i = 0; i < number_of_options; i++) { struct keyval_ext opt; - opt.key = Options[i].key; - opt.value = Options[i].value; - opt.valname = NULL; + opt = Options[i]; options.push_back(opt); } } @@ -1450,10 +1446,33 @@ CMenuOptionChooser::CMenuOptionChooser(const std::string &OptionName, int * cons CMenuOptionChooser::~CMenuOptionChooser() { - options.clear(); clearChooserOptions(); } +void CMenuOptionChooser::setOptions(const struct keyval * const Options, const unsigned Number_Of_Options) +{ + options.clear(); + number_of_options = Number_Of_Options; + for (unsigned int i = 0; i < number_of_options; i++) + { + struct keyval_ext opt; + opt = Options[i]; + options.push_back(opt); + } + if (used && x != -1) + paint(false); +} + +void CMenuOptionChooser::setOptions(const struct keyval_ext * const Options, const unsigned Number_Of_Options) +{ + options.clear(); + number_of_options = Number_Of_Options; + for (unsigned int i = 0; i < number_of_options; i++) + options.push_back(Options[i]); + if (used && x != -1) + paint(false); +} + void CMenuOptionChooser::setOption(const int newvalue) { *optionValue = newvalue; diff --git a/src/gui/widget/menue.h b/src/gui/widget/menue.h index 4208490f1..816eff9ee 100644 --- a/src/gui/widget/menue.h +++ b/src/gui/widget/menue.h @@ -353,17 +353,24 @@ struct CMenuOptionChooserCompareItem: public std::binary_function Date: Fri, 21 Mar 2014 13:41:13 +0400 Subject: [PATCH 122/225] gui/scan_setup.cpp: add dynamic diseqc options switch based on frontend mode --- src/gui/scan_setup.cpp | 38 +++++++++++++++++++++++++++++++++++++- src/gui/scan_setup.h | 1 + 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/src/gui/scan_setup.cpp b/src/gui/scan_setup.cpp index e673a8c25..35debb8ad 100644 --- a/src/gui/scan_setup.cpp +++ b/src/gui/scan_setup.cpp @@ -672,6 +672,38 @@ static std::string rotationSpeed2str(int i) return to_string(i/10) + g_Locale->getText(LOCALE_UNIT_DECIMAL) + to_string(i%10) + "°/" + g_Locale->getText(LOCALE_UNIT_SHORT_SECOND); } +static struct CMenuOptionChooser::keyval_ext twin_doptions[2]; +void CScanSetup::setDiseqcOptions(int number) +{ + CFrontend * fe = CFEManager::getInstance()->getFE(number); + + int mode = fe->getMode(); + if (CFrontend::linked(femode)) { + printf("CScanSetup::setDiseqcOptions: set options for linked\n"); + CFrontend * mfe = CFEManager::getInstance()->getFE(femaster); + frontend_config_t & mfe_config = mfe->getConfig(); + + int count = 1; + twin_doptions[0].key = mfe_config.diseqcType; + twin_doptions[0].value = (mfe_config.diseqcType == NO_DISEQC ? LOCALE_SATSETUP_NODISEQC : + mfe_config.diseqcType == MINI_DISEQC ? LOCALE_SATSETUP_MINIDISEQC : + mfe_config.diseqcType == DISEQC_1_0 ? LOCALE_SATSETUP_DISEQC10 : + mfe_config.diseqcType == DISEQC_1_1 ? LOCALE_SATSETUP_DISEQC11 : + mfe_config.diseqcType == DISEQC_ADVANCED ? LOCALE_SATSETUP_DISEQC_ADVANCED : + LOCALE_SATSETUP_UNICABLE); + + if (mode == CFrontend::FE_MODE_LINK_TWIN && mfe_config.diseqcType != DISEQC_UNICABLE) { + count++; + twin_doptions[1].key = DISEQC_UNICABLE; + twin_doptions[1].value = LOCALE_SATSETUP_UNICABLE; + } + dtype->setOptions(twin_doptions, count); + } else if( mode != CFrontend::FE_MODE_UNUSED) { + printf("CScanSetup::setDiseqcOptions: set default options\n"); + dtype->setOptions(SATSETUP_DISEQC_OPTIONS, SATSETUP_DISEQC_OPTION_COUNT); + } +} + int CScanSetup::showFrontendSetup(int number) { int shortcut = 1; @@ -768,6 +800,9 @@ int CScanSetup::showFrontendSetup(int number) dtype->setHint("", LOCALE_MENU_HINT_SCAN_DISEQCTYPE); setupMenu->addItem(dtype); + if (fecount > 1) + setDiseqcOptions(fenumber); + /* diseqc repeats */ ojDiseqcRepeats = new CMenuOptionNumberChooser(LOCALE_SATSETUP_DISEQCREPEAT, (int *)&fe_config.diseqcRepeats, allow_moptions && (dmode != NO_DISEQC) && (dmode != DISEQC_ADVANCED), 0, 2, NULL); ojDiseqcRepeats->setHint("", LOCALE_MENU_HINT_SCAN_DISEQCREPEAT); @@ -1523,7 +1558,6 @@ bool CScanSetup::changeNotify(const neutrino_locale_t OptionName, void * /*data* bool enable = (dmode < DISEQC_ADVANCED) && (dmode != NO_DISEQC); ojDiseqcRepeats->setActive(enable && !CFrontend::linked(femode) && femode != CFrontend::FE_MODE_UNUSED); dorder->setActive(!CFrontend::linked(femode) && femode != CFrontend::FE_MODE_UNUSED && dmode == DISEQC_ADVANCED); - } else if(ARE_LOCALES_EQUAL(OptionName, LOCALE_SATSETUP_FE_MODE)) { printf("[neutrino] CScanSetup::%s: fe%d mode %d master %d\n", __FUNCTION__, fenumber, femode, femaster); @@ -1552,6 +1586,7 @@ bool CScanSetup::changeNotify(const neutrino_locale_t OptionName, void * /*data* if (femaster >= 0) fe->setMaster(femaster); } + setDiseqcOptions(fenumber); } else if(ARE_LOCALES_EQUAL(OptionName, LOCALE_SATSETUP_FE_MODE_MASTER)) { printf("[neutrino] CScanSetup::%s: fe%d link %d \n", __FUNCTION__, fenumber, femaster); @@ -1559,6 +1594,7 @@ bool CScanSetup::changeNotify(const neutrino_locale_t OptionName, void * /*data* CFrontend * fe = CFEManager::getInstance()->getFE(fenumber); if (fe) fe->setMaster(femaster); + setDiseqcOptions(fenumber); } else if(ARE_LOCALES_EQUAL(OptionName, LOCALE_CABLESETUP_PROVIDER)) { printf("[neutrino] CScanSetup::%s: new provider: [%s]\n", __FUNCTION__, scansettings.cableName.c_str()); diff --git a/src/gui/scan_setup.h b/src/gui/scan_setup.h index aa8cb896b..b76dc9784 100644 --- a/src/gui/scan_setup.h +++ b/src/gui/scan_setup.h @@ -119,6 +119,7 @@ class CScanSetup : public CMenuTarget, public CChangeObserver #ifdef ENABLE_FASTSCAN int showFastscanDiseqcSetup(); #endif + void setDiseqcOptions(int number); void saveScanSetup(); From d1082945034f59f30ce9615424b6bd6625fabcce Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Fri, 21 Mar 2014 14:37:53 +0400 Subject: [PATCH 123/225] zapit/src/fastscan.cpp: improve fastscan tune reporting --- src/zapit/include/zapit/scan.h | 1 + src/zapit/src/fastscan.cpp | 25 +++++++++++++++++++------ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/zapit/include/zapit/scan.h b/src/zapit/include/zapit/scan.h index f49a7cd7c..3ccd72a2f 100644 --- a/src/zapit/include/zapit/scan.h +++ b/src/zapit/include/zapit/scan.h @@ -113,6 +113,7 @@ class CServiceScan : public OpenThreads::Thread void process_service_list_descriptor(const unsigned char * const buffer, const t_transport_stream_id transport_stream_id, const t_original_network_id original_network_id, t_satellite_position satellitePosition, freq_id_t freq); void process_satellite_delivery_system_descriptor(const unsigned char * const buffer, FrontendParameters * feparams, uint8_t * polarization, t_satellite_position * satellitePosition); bool ScanFast(); + void ReportFastScan(FrontendParameters &feparams, uint8_t polarization, t_satellite_position satellitePosition); void run(); diff --git a/src/zapit/src/fastscan.cpp b/src/zapit/src/fastscan.cpp index 292b2331c..be1bde935 100644 --- a/src/zapit/src/fastscan.cpp +++ b/src/zapit/src/fastscan.cpp @@ -169,6 +169,18 @@ void CServiceScan::InitFastscanLnb(int id) SetFrontend(192); } +void CServiceScan::ReportFastScan(FrontendParameters &feparams, uint8_t polarization, t_satellite_position satellitePosition) +{ + std::string satname = CServiceManager::getInstance()->GetSatelliteName(satellitePosition); + uint32_t actual_polarisation = ((feparams.dvb_feparams.u.qpsk.symbol_rate/1000) << 16) + | (feparams.dvb_feparams.u.qpsk.fec_inner << 8) | (uint)polarization; + uint32_t actual_freq = feparams.dvb_feparams.frequency; + + CZapit::getInstance()->SendEvent(CZapitClient::EVT_SCAN_SATELLITE, satname.c_str(), satname.size() + 1); + CZapit::getInstance()->SendEvent(CZapitClient::EVT_SCAN_REPORT_FREQUENCYP, &actual_polarisation,sizeof(actual_polarisation)); + CZapit::getInstance()->SendEvent(CZapitClient::EVT_SCAN_REPORT_FREQUENCY, &actual_freq,sizeof(actual_freq)); +} + bool CServiceScan::ScanFast() { fast_scan_type_t * fast_type = (fast_scan_type_t *) scan_arg; @@ -191,7 +203,6 @@ bool CServiceScan::ScanFast() found_data_chans = 0; found_radio_chans = 0; - //printf("[fast scan] scaning operator %d for %s channels\n", op->id, type == FAST_SCAN_SD ? "SD" : type == FAST_SCAN_HD ? "HD" : "All"); printf("[fast scan] scaning operator %d [%s], pid 0x%x\n", op->id, op->name, op->pid); @@ -200,8 +211,7 @@ bool CServiceScan::ScanFast() feparams.dvb_feparams.u.qpsk.fec_inner = FEC_3_4; polarization = 0; - CZapit::getInstance()->SendEvent(CZapitClient::EVT_SCAN_SATELLITE, op->name, strlen(op->name)+1); - + ReportFastScan(feparams, polarization, 235); InitFastscanLnb(op->id); if(!tuneFrequency(&feparams, polarization, 235)) { printf("[fast scan] tune failed, try backup\n"); @@ -210,16 +220,19 @@ bool CServiceScan::ScanFast() feparams.dvb_feparams.u.qpsk.symbol_rate = 27500000; feparams.dvb_feparams.u.qpsk.fec_inner = FEC_3_4; polarization = 1; - res = tuneFrequency(&feparams, polarization, 192); + ReportFastScan(feparams, polarization, 90); + res = tuneFrequency(&feparams, polarization, 90); } else { feparams.dvb_feparams.frequency = 12515000; feparams.dvb_feparams.u.qpsk.symbol_rate = 22000000; feparams.dvb_feparams.u.qpsk.fec_inner = FEC_5_6; + ReportFastScan(feparams, polarization, 192); res = tuneFrequency(&feparams, polarization, 192); } if (!res) goto _err; } + CZapit::getInstance()->SendEvent(CZapitClient::EVT_SCAN_SATELLITE, op->name, strlen(op->name)+1); scanBouquetManager = new CBouquetManager(); @@ -609,11 +622,11 @@ bool CServiceScan::ParseFnt(unsigned short pid, unsigned short operator_id) transponders.insert(transponder_pair_t(TsidOnid, t)); } found_transponders++; - //CZapit::getInstance()->SendEvent(CZapitClient::EVT_SCAN_NUM_TRANSPONDERS, - // &found_transponders, sizeof(found_transponders)); +#if 0 uint32_t actual_freq = freq; CZapit::getInstance()->SendEvent(CZapitClient::EVT_SCAN_REPORT_FREQUENCY, &actual_freq, sizeof(actual_freq)); +#endif //satellite_delivery_system_descriptor(buffer + pos2, transport_stream_id, original_network_id, satellitePosition, freq); } break; From 716f353214ae8459b2630d3d75577d14f61d7a56 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Mon, 24 Mar 2014 14:59:29 +0100 Subject: [PATCH 124/225] - localize.cpp: fix LOCALEDIR_VAR --- src/system/localize.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/system/localize.cpp b/src/system/localize.cpp index 4a196ca88..c1be218fe 100644 --- a/src/system/localize.cpp +++ b/src/system/localize.cpp @@ -108,7 +108,7 @@ CLocaleManager::~CLocaleManager() ::free(defaultDataMem); } -#define LOCALEDIR_VAR "/var/tuxbox/locale" +#define LOCALEDIR_VAR "/var/tuxbox/locale/" const char * path[2] = { LOCALEDIR_VAR, DATADIR "/neutrino/locale/"}; CLocaleManager::loadLocale_ret_t CLocaleManager::loadLocale(const char * const locale, bool asdefault) From 1dfc9c1449b26f9703c0f067f95af853b6bcd57c Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Wed, 26 Mar 2014 14:30:20 +0400 Subject: [PATCH 125/225] Revert "streamts: set CPU freq to 'high' for streaming" This reverts commit c9a3b348108a24f906e679b7a03f838e83f1bbd0. --- src/driver/streamts.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/driver/streamts.cpp b/src/driver/streamts.cpp index 15d004dcd..122a65bf2 100644 --- a/src/driver/streamts.cpp +++ b/src/driver/streamts.cpp @@ -58,10 +58,6 @@ #include #include #include -#include - -/* defined in neutrino.cpp */ -extern cCpuFreqManager * cpuFreq; /* experimental mode: * stream not possible, if record running @@ -338,7 +334,6 @@ bool CStreamManager::Parse(int fd, stream_pids_t &pids, t_channel_id &chid) int mode = CNeutrinoApp::getInstance()->getMode(); if (mode == NeutrinoMessages::mode_standby && streams.empty()) { printf("CStreamManager::Parse: wakeup zapit..\n"); - cpuFreq->SetCpuFreq(g_settings.cpufreq * 1000 * 1000); g_Zapit->setStandby(false); g_Zapit->getMode(); } @@ -519,7 +514,6 @@ void CStreamManager::run() if (g_Zapit->getMode() != 0) { printf("CStreamManager::run: put zapit into standby...\n"); g_Zapit->setStandby(true); - cpuFreq->SetCpuFreq(g_settings.standby_cpufreq * 1000 * 1000); } } } From 50eb534417c51433fc6e9d91f19a7b8da54559c1 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Wed, 26 Mar 2014 14:30:29 +0400 Subject: [PATCH 126/225] Revert "streamts: put zapit back into standby after streaming" This reverts commit 8c0cb5b96ea791a9bf07e3070ba46a0dff01f152. --- src/driver/streamts.cpp | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/driver/streamts.cpp b/src/driver/streamts.cpp index 122a65bf2..8df0b0580 100644 --- a/src/driver/streamts.cpp +++ b/src/driver/streamts.cpp @@ -3,8 +3,6 @@ Copyright (C) 2011-2012 CoolStream International Ltd - Copyright (C) 2010-2012, 2014 Stefan Seyfried - based on code which is Copyright (C) 2002 Andreas Oberritter Copyright (C) 2001 TripleDES @@ -507,15 +505,6 @@ void CStreamManager::run() mutex.unlock(); } } - /* this is a cheap check */ - if (streams.empty() && - CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_standby) { - /* this check is more expensive (goes through the socket) */ - if (g_Zapit->getMode() != 0) { - printf("CStreamManager::run: put zapit into standby...\n"); - g_Zapit->setStandby(true); - } - } } } } From dc3185f3a0afe8fc93f9eb2756b66696a2a71f77 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Wed, 26 Mar 2014 13:48:27 +0400 Subject: [PATCH 127/225] neutrinoMessages.h: add EVT_STREAM_START/STOP events --- src/neutrinoMessages.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/neutrinoMessages.h b/src/neutrinoMessages.h index e5110e190..80482a0a4 100644 --- a/src/neutrinoMessages.h +++ b/src/neutrinoMessages.h @@ -113,6 +113,8 @@ struct NeutrinoMessages { EVT_HDMI_CEC_STANDBY = CRCInput::RC_Events + 42, EVT_SET_MUTE = CRCInput::RC_Events + 43, EVT_SET_VOLUME = CRCInput::RC_Events + 44, + EVT_STREAM_START = CRCInput::RC_Events + 45, /* data = fd */ + EVT_STREAM_STOP = CRCInput::RC_Events + 46, /* NEVER CHANGE THIS */ EVT_CA_MESSAGE = CRCInput::RC_Events + 60, /* data = CA_MESSAGE pointer */ From f321f33b1c502bb0430815fa47d8be17602a42ff Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Wed, 26 Mar 2014 13:50:27 +0400 Subject: [PATCH 128/225] neutrino.cpp: add common code to partially neutrino wakeup / put to sleep; process EVT_STREAM_START/STOP events --- src/neutrino.cpp | 83 +++++++++++++++++++++++++++++++----------------- src/neutrino.h | 2 ++ 2 files changed, 55 insertions(+), 30 deletions(-) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index cc0e9158e..171bd4641 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -2484,6 +2484,40 @@ void CNeutrinoApp::zapTo(t_channel_id channel_id) } } +void CNeutrinoApp::wakeupFromStandby(void) +{ + bool alive = recordingstatus || CEpgScan::getInstance()->Running() || + CStreamManager::getInstance()->StreamStatus(); + + if ((mode == mode_standby) && !alive) { + cpuFreq->SetCpuFreq(g_settings.cpufreq * 1000 * 1000); + if(g_settings.ci_standby_reset) { + g_CamHandler->exec(NULL, "ca_ci_reset0"); + g_CamHandler->exec(NULL, "ca_ci_reset1"); + } + g_Zapit->setStandby(false); + g_Zapit->getMode(); + } +} + +void CNeutrinoApp::standbyToStandby(void) +{ + bool alive = recordingstatus || CEpgScan::getInstance()->Running() || + CStreamManager::getInstance()->StreamStatus(); + + if ((mode == mode_standby) && !alive) { + // zap back to pre-recording channel if necessary + t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); + if (standby_channel_id && (live_channel_id != standby_channel_id)) { + live_channel_id = standby_channel_id; + channelList->zapTo_ChannelID(live_channel_id); + } + g_Zapit->setStandby(true); + g_Sectionsd->setPauseScanning(true); + cpuFreq->SetCpuFreq(g_settings.standby_cpufreq * 1000 * 1000); + } +} + int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) { int res = 0; @@ -2726,27 +2760,9 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) /* sent by rcinput, when got msg from zapit about record activated/deactivated */ /* should be sent when no record running */ printf("NeutrinoMessages::EVT_RECORDMODE: %s\n", ( data ) ? "on" : "off"); - //if(!CRecordManager::getInstance()->RecordingStatus() && was_record && (!data)) - - /* no records left and record mode off FIXME check !*/ - if(!CRecordManager::getInstance()->RecordingStatus() && (!data)) - { - if(mode == mode_standby) { - // zap back to pre-recording channel if necessary - t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); - if (standby_channel_id && (live_channel_id != standby_channel_id)) { - live_channel_id = standby_channel_id; - channelList->zapTo_ChannelID(live_channel_id); - } - /* do not put zapit to standby, if epg scan not finished */ - if (!CEpgScan::getInstance()->Running()) - g_Zapit->setStandby(true); - cpuFreq->SetCpuFreq(g_settings.standby_cpufreq * 1000 * 1000); - } - /* try to wakeup epg scan */ - CEpgScan::getInstance()->Next(); - } recordingstatus = data; + CEpgScan::getInstance()->Next(); + standbyToStandby(); autoshift = CRecordManager::getInstance()->TimeshiftOnly(); CVFD::getInstance()->ShowIcon(FP_ICON_CAM1, recordingstatus != 0); @@ -2756,15 +2772,8 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) return messages_return::handled; } else if (msg == NeutrinoMessages::RECORD_START) { - //FIXME better at announce ? - if( mode == mode_standby ) { - cpuFreq->SetCpuFreq(g_settings.cpufreq * 1000 * 1000); - if(!recordingstatus && g_settings.ci_standby_reset) { - g_CamHandler->exec(NULL, "ca_ci_reset0"); - g_CamHandler->exec(NULL, "ca_ci_reset1"); - } - } + wakeupFromStandby(); #if 0 //zap to rec channel if box start from deepstandby if(timer_wakeup){ @@ -2801,11 +2810,25 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) delete[] (unsigned char*) data; return messages_return::handled; } + else if (msg == NeutrinoMessages::EVT_STREAM_START) { + int fd = (int) data; + printf("NeutrinoMessages::EVT_STREAM_START: fd %d\n", fd); + wakeupFromStandby(); + + if (!CStreamManager::getInstance()->AddClient(fd)) + close(fd); + return messages_return::handled; + } + else if (msg == NeutrinoMessages::EVT_STREAM_STOP) { + printf("NeutrinoMessages::EVT_STREAM_STOP\n"); + CEpgScan::getInstance()->Next(); + standbyToStandby(); + return messages_return::handled; + } else if( msg == NeutrinoMessages::EVT_PMT_CHANGED) { - res = messages_return::handled; t_channel_id channel_id = *(t_channel_id*) data; CRecordManager::getInstance()->Update(channel_id); - return res; + return messages_return::handled; } else if( msg == NeutrinoMessages::ZAPTO) { diff --git a/src/neutrino.h b/src/neutrino.h index 9652136b0..be8d3a00b 100644 --- a/src/neutrino.h +++ b/src/neutrino.h @@ -213,6 +213,8 @@ public: CPersonalizeGui & getPersonalizeGui() { return personalize; } bool getChannellistIsVisible() { return channellist_visible; } void zapTo(t_channel_id channel_id); + void wakeupFromStandby(void); + void standbyToStandby(void); }; #endif From 63ce8f2a69fb2086719ed6476d44a56ae08ac429 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Wed, 26 Mar 2014 13:51:39 +0400 Subject: [PATCH 129/225] driver/scanepg.cpp: do not zap, if streaming active; use common standbyToStandby() from neutrino --- src/driver/scanepg.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/driver/scanepg.cpp b/src/driver/scanepg.cpp index a2bd09bc6..945f835aa 100644 --- a/src/driver/scanepg.cpp +++ b/src/driver/scanepg.cpp @@ -37,6 +37,7 @@ #include #include +#include #define EPG_RESCAN_TIME (24*60*60) @@ -234,16 +235,20 @@ int CEpgScan::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data) void CEpgScan::EnterStandby() { - if (standby) { - CZapit::getInstance()->SetCurrentChannelID(live_channel_id); - //CZapit::getInstance()->EnablePlayback(true); - g_Zapit->setStandby(true); - g_Sectionsd->setPauseScanning(true); - } //g_RCInput->killTimer(rescan_timer); if (rescan_timer == 0) rescan_timer = g_RCInput->addTimer(EPG_RESCAN_TIME*1000ULL*1000ULL, true); INFO("rescan timer id %d", rescan_timer); + + if (standby) { + CZapit::getInstance()->SetCurrentChannelID(live_channel_id); +#if 0 + //CZapit::getInstance()->EnablePlayback(true); + g_Zapit->setStandby(true); + g_Sectionsd->setPauseScanning(true); +#endif + CNeutrinoApp::getInstance()->standbyToStandby(); + } } void CEpgScan::Next() @@ -255,7 +260,7 @@ void CEpgScan::Next() return; if (!standby && CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_standby) return; - if (CRecordManager::getInstance()->RecordingStatus()) + if (CRecordManager::getInstance()->RecordingStatus() || CStreamManager::getInstance()->StreamStatus()) return; if (g_settings.epg_scan == 2 && scanmap.empty()) From ded947f05af119fd0f1e11627cd66c6b5a666843 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Wed, 26 Mar 2014 14:29:44 +0400 Subject: [PATCH 130/225] driver/streamts.cpp: add support to stream from different tuners --- src/driver/streamts.cpp | 315 ++++++++++++++++++++++++---------------- src/driver/streamts.h | 11 +- 2 files changed, 198 insertions(+), 128 deletions(-) diff --git a/src/driver/streamts.cpp b/src/driver/streamts.cpp index 8df0b0580..22d569094 100644 --- a/src/driver/streamts.cpp +++ b/src/driver/streamts.cpp @@ -1,7 +1,7 @@ /* Neutrino-GUI - DBoxII-Project - Copyright (C) 2011-2012 CoolStream International Ltd + Copyright (C) 2011-2014 CoolStream International Ltd based on code which is Copyright (C) 2002 Andreas Oberritter @@ -60,9 +60,8 @@ /* experimental mode: * stream not possible, if record running * pids in url ignored, and added from channel, with fake PAT/PMT - * different channels supported, only from the same transponder - no zap is done, + * different channels supported, * with url like http://coolstream:31339/id=c32400030070283e (channel id) - * TODO: multi-tuner support */ #define ENABLE_MULTI_CHANNEL @@ -114,23 +113,24 @@ bool CStreamInstance::Stop() bool CStreamInstance::Send(ssize_t r) { - mutex.lock(); + OpenThreads::ScopedLock m_lock(mutex); + int flags = 0; + if (fds.size() > 1) + flags = MSG_DONTWAIT; for (stream_fds_t::iterator it = fds.begin(); it != fds.end(); ++it) { - int ret, i = 10; + int i = 10; + unsigned char *b = buf; + ssize_t count = r; do { - ret = send(*it, buf, r, MSG_DONTWAIT); -#if 0 - if (ret != r) - usleep(100); -#endif - } while ((ret != r) && (i-- > 0)); - if (ret != r) { - if (r < 0) - perror("send"); - printf("send err, fd %d: (%d from %d)\n", *it, ret, r); - } + int ret = send(*it, b, count, flags); + if (ret > 0) { + b += ret; + count -= ret; + } + } while ((count > 0) && (i-- > 0)); + if (count) + printf("send err, fd %d: (%d from %d)\n", *it, r-count, r); } - mutex.unlock(); return true; } @@ -143,28 +143,23 @@ void CStreamInstance::Close() void CStreamInstance::AddClient(int clientfd) { - mutex.lock(); + OpenThreads::ScopedLock m_lock(mutex); fds.insert(clientfd); printf("CStreamInstance::AddClient: %d (count %d)\n", clientfd, fds.size()); - mutex.unlock(); } void CStreamInstance::RemoveClient(int clientfd) { - mutex.lock(); + OpenThreads::ScopedLock m_lock(mutex); fds.erase(clientfd); close(clientfd); printf("CStreamInstance::RemoveClient: %d (count %d)\n", clientfd, fds.size()); - mutex.unlock(); } void CStreamInstance::run() { printf("CStreamInstance::run: %llx\n", channel_id); -#if 0 - dmx = new cDemux(STREAM_DEMUX);//FIXME -#endif CZapitChannel * tmpchan = CServiceManager::getInstance()->FindChannel(channel_id); if (!tmpchan) return; @@ -191,7 +186,7 @@ void CStreamInstance::run() while (running) { ssize_t r = dmx->Read(buf, IN_SIZE, 100); - if(r > 0) + if (r > 0) Send(r); } @@ -273,13 +268,83 @@ bool CStreamManager::SetPort(int newport) return ret; } -bool CStreamManager::Parse(int fd, stream_pids_t &pids, t_channel_id &chid) +CFrontend * CStreamManager::FindFrontend(CZapitChannel * channel) +{ + std::set frontends; + CFrontend * frontend = NULL; + + t_channel_id chid = channel->getChannelID(); + if (CRecordManager::getInstance()->RecordingStatus(chid)) { + printf("CStreamManager::Parse: channel %llx recorded, aborting..\n", chid); + return frontend; + } + + t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); + CFrontend *live_fe = CZapit::getInstance()->GetLiveFrontend(); + + if (live_channel_id == chid) + return live_fe; + + CFEManager::getInstance()->Lock(); + + bool unlock = true; + CFEManager::getInstance()->lockFrontend(live_fe); + + OpenThreads::ScopedLock m_lock(mutex); + for (streammap_iterator_t it = streams.begin(); it != streams.end(); ++it) + frontends.insert(it->second->frontend); + + for (std::set::iterator ft = frontends.begin(); ft != frontends.end(); ft++) + CFEManager::getInstance()->lockFrontend(*ft); + + frontend = CFEManager::getInstance()->allocateFE(channel, true); + + if (frontend == NULL) { + unlock = false; + CFEManager::getInstance()->unlockFrontend(live_fe); + frontend = CFEManager::getInstance()->allocateFE(channel, true); + } + + CFEManager::getInstance()->Unlock(); + + if (frontend) { + bool found = (live_fe != frontend) || SAME_TRANSPONDER(live_channel_id, chid); + bool ret = false; + if (found) + ret = zapit.zapTo_record(chid) > 0; + else + ret = zapit.zapTo_serviceID(chid) > 0; + + if (ret) { +#ifdef ENABLE_PIP + /* FIXME until proper demux management */ + t_channel_id pip_channel_id = CZapit::getInstance()->GetPipChannelID(); + if ((pip_channel_id == chid) && (channel->getRecordDemux() == channel->getPipDemux())) + zapit.stopPip(); +#endif + } else { + frontend = NULL; + } + } + + CFEManager::getInstance()->Lock(); + for (std::set::iterator ft = frontends.begin(); ft != frontends.end(); ft++) + CFEManager::getInstance()->unlockFrontend(*ft); + + if (unlock) + CFEManager::getInstance()->unlockFrontend(live_fe); + + CFEManager::getInstance()->Unlock(); + return frontend; +} + +bool CStreamManager::Parse(int fd, stream_pids_t &pids, t_channel_id &chid, CFrontend * &frontend) { char cbuf[512]; char *bp; FILE * fp = fdopen(fd, "r+"); - if(fp == NULL) { + if (fp == NULL) { perror("fdopen"); return false; } @@ -290,7 +355,7 @@ bool CStreamManager::Parse(int fd, stream_pids_t &pids, t_channel_id &chid) while (bp - &cbuf[0] < (int) sizeof(cbuf)) { unsigned char c; int res = read(fd, &c, 1); - if(res < 0) { + if (res < 0) { perror("read"); return false; } @@ -313,68 +378,54 @@ bool CStreamManager::Parse(int fd, stream_pids_t &pids, t_channel_id &chid) return false; } + chid = CZapit::getInstance()->GetCurrentChannelID(); + CZapitChannel * channel = CZapit::getInstance()->GetCurrentChannel(); + #ifndef ENABLE_MULTI_CHANNEL /* parse stdin / url path, start dmx filters */ do { int pid; int res = sscanf(bp, "%x", &pid); - if(res == 1) { - printf("New pid: 0x%x\n", pid); + if (res == 1) { + printf("CStreamManager::Parse: pid: 0x%x\n", pid); pids.insert(pid); } + } while ((bp = strchr(bp, ',')) && (bp++)); +#else + t_channel_id tmpid; + bp = &cbuf[5]; + if (sscanf(bp, "id=%llx", &tmpid) == 1) { + channel = CServiceManager::getInstance()->FindChannel(tmpid); + chid = tmpid; } - while ((bp = strchr(bp, ',')) && (bp++)); #endif + if (!channel) + return false; - chid = CZapit::getInstance()->GetCurrentChannelID(); - CZapitChannel * channel = CZapit::getInstance()->GetCurrentChannel(); + printf("CStreamManager::Parse: channel_id %llx [%s]\n", chid, channel->getName().c_str()); - int mode = CNeutrinoApp::getInstance()->getMode(); - if (mode == NeutrinoMessages::mode_standby && streams.empty()) { - printf("CStreamManager::Parse: wakeup zapit..\n"); - g_Zapit->setStandby(false); - g_Zapit->getMode(); + frontend = FindFrontend(channel); + if (!frontend) { + printf("CStreamManager::Parse: no free frontend\n"); + return false; } - if(pids.empty()) { -#ifdef ENABLE_MULTI_CHANNEL - t_channel_id tmpid; - bp = &cbuf[5]; - if (sscanf(bp, "id=%llx", &tmpid) == 1) { - printf("############################# channel_id %llx\n", tmpid); - CZapitChannel * tmpchan = CServiceManager::getInstance()->FindChannel(tmpid); - if (tmpchan && (tmpid != chid) && SAME_TRANSPONDER(tmpid, chid)) { - printf("############################# channel_id %llx -> zap\n", tmpid); - bool ret = g_Zapit->zapTo_record(tmpid) > 0; - if (ret) { - channel = tmpchan; - chid = tmpid; - } - } - } - if(CRecordManager::getInstance()->RecordingStatus(chid)) { - printf("CStreamManager::Parse: channel %llx recorded, aborting..\n", chid); - return false; - } -#ifdef ENABLE_PIP - t_channel_id pip_channel_id = CZapit::getInstance()->GetPipChannelID(); - if ((chid == pip_channel_id) && (channel->getRecordDemux() == channel->getPipDemux())) { - printf("CStreamManager::Parse: channel %llx used for pip, aborting..\n", chid); - return false; - } -#endif -#endif + AddPids(fd, channel, pids); - printf("CStreamManager::Parse: no pids in url, using channel %llx pids\n", chid); - if(!channel) - return false; - //pids.insert(0); - //pids.insert(channel->getPmtPid()); - pids.insert(channel->getVideoPid()); + return !pids.empty(); +} + +void CStreamManager::AddPids(int fd, CZapitChannel *channel, stream_pids_t &pids) +{ + if (pids.empty()) { + printf("CStreamManager::AddPids: no pids in url, using channel %llx pids\n", channel->getChannelID()); + if (channel->getVideoPid()) + pids.insert(channel->getVideoPid()); for (int i = 0; i < channel->getAudioChannelCount(); i++) pids.insert(channel->getAudioChannel(i)->pid); } + CGenPsi psi; for (stream_pids_t::iterator it = pids.begin(); it != pids.end(); ++it) { if (*it == channel->getVideoPid()) { @@ -385,9 +436,9 @@ bool CStreamManager::Parse(int fd, stream_pids_t &pids, t_channel_id &chid) if (*it == channel->getAudioChannel(i)->pid) { CZapitAudioChannel::ZapitAudioChannelType atype = channel->getAudioChannel(i)->audioChannelType; printf("CStreamManager::Parse: genpsi apid %x (%d)\n", *it, atype); - if(channel->getAudioChannel(i)->audioChannelType == CZapitAudioChannel::EAC3){ + if (channel->getAudioChannel(i)->audioChannelType == CZapitAudioChannel::EAC3) { psi.addPid(*it, EN_TYPE_AUDIO_EAC3, atype, channel->getAudioChannel(i)->description.c_str()); - }else{ + } else { psi.addPid(*it, EN_TYPE_AUDIO, atype, channel->getAudioChannel(i)->description.c_str()); } } @@ -395,40 +446,81 @@ bool CStreamManager::Parse(int fd, stream_pids_t &pids, t_channel_id &chid) } } //add pcr pid - if(channel->getPcrPid() != channel->getVideoPid()){ + if (channel->getPcrPid() && (channel->getPcrPid() != channel->getVideoPid())) { pids.insert(channel->getPcrPid()); psi.addPid(channel->getPcrPid(), EN_TYPE_PCR, 0); } //add teletext pid - if (g_settings.recording_stream_vtxt_pid && channel->getTeletextPid() != 0){ + if (g_settings.recording_stream_vtxt_pid && channel->getTeletextPid() != 0) { pids.insert(channel->getTeletextPid()); psi.addPid(channel->getTeletextPid(), EN_TYPE_TELTEX, 0, channel->getTeletextLang()); } //add dvb sub pid - if (g_settings.recording_stream_subtitle_pids){ + if (g_settings.recording_stream_subtitle_pids) { for (int i = 0 ; i < (int)channel->getSubtitleCount() ; ++i) { CZapitAbsSub* s = channel->getChannelSub(i); if (s->thisSubType == CZapitAbsSub::DVB) { - if(i>9)//max sub pids + if (i>9)//max sub pids break; CZapitDVBSub* sd = reinterpret_cast(s); pids.insert(sd->pId); - psi.addPid( sd->pId, EN_TYPE_DVBSUB, 0, sd->ISO639_language_code.c_str() ); + psi.addPid(sd->pId, EN_TYPE_DVBSUB, 0, sd->ISO639_language_code.c_str()); } } - } psi.genpsi(fd); +} - return !pids.empty(); +bool CStreamManager::AddClient(int connfd) +{ + stream_pids_t pids; + t_channel_id channel_id; + CFrontend *frontend; + + if (Parse(connfd, pids, channel_id, frontend)) { + OpenThreads::ScopedLock m_lock(mutex); + streammap_iterator_t it = streams.find(channel_id); + if (it != streams.end()) { + it->second->AddClient(connfd); + } else { + CStreamInstance * stream = new CStreamInstance(connfd, channel_id, pids); + stream->frontend = frontend; + + int sendsize = 10*IN_SIZE; + unsigned int m = sizeof(sendsize); + setsockopt(listenfd, SOL_SOCKET, SO_SNDBUF, (void *)&sendsize, m); + if (stream->Start()) + streams.insert(streammap_pair_t(channel_id, stream)); + else + delete stream; + } + return true; + } + return false; +} + +void CStreamManager::RemoveClient(int fd) +{ + OpenThreads::ScopedLock m_lock(mutex); + for (streammap_iterator_t it = streams.begin(); it != streams.end(); ++it) { + if (it->second->HasFd(fd)) { + CStreamInstance *stream = it->second; + stream->RemoveClient(fd); + if (stream->GetFds().empty()) { + streams.erase(stream->GetChannelId()); + delete stream; + } + break; + } + } } void CStreamManager::run() { struct sockaddr_in servaddr; - int clilen = sizeof(servaddr);; + int clilen = sizeof(servaddr); struct pollfd pfd[128]; int poll_cnt; @@ -452,57 +544,33 @@ void CStreamManager::run() } mutex.unlock(); //printf("polling, count= %d\n", poll_cnt); - int pollres = poll (pfd, poll_cnt, 1000); - if (pollres < 0) { - perror("CStreamManager::run(): poll"); + int pollres = poll (pfd, poll_cnt, 10000); + if (pollres <= 0) { + if (pollres < 0) + perror("CStreamManager::run(): poll"); continue; } - if(pollres == 0) - continue; for (int i = poll_cnt - 1; i >= 0; i--) { if (pfd[i].revents & (POLLIN | POLLPRI | POLLHUP | POLLRDHUP)) { printf("fd %d has events %x\n", pfd[i].fd, pfd[i].revents); if (pfd[i].fd == listenfd) { - int connfd = accept (listenfd, (struct sockaddr *) &servaddr, (socklen_t *) & clilen); + int connfd = accept(listenfd, (struct sockaddr *) &servaddr, (socklen_t *) & clilen); printf("CStreamManager::run(): connection, fd %d\n", connfd); - if(connfd < 0) { + if (connfd < 0) { perror("CStreamManager::run(): accept"); continue; } - stream_pids_t pids; - t_channel_id channel_id; - if (Parse(connfd, pids, channel_id)) { - mutex.lock(); - streammap_iterator_t it = streams.find(channel_id); - if (it != streams.end()) { - it->second->AddClient(connfd); - } else { - CStreamInstance * stream = new CStreamInstance(connfd, channel_id, pids); - if (stream->Start()) - streams.insert(streammap_pair_t(channel_id, stream)); - else - delete stream; - } - mutex.unlock(); - } else { +#if 0 + if (!AddClient(connfd)) close(connfd); - } +#endif + g_RCInput->postMsg(NeutrinoMessages::EVT_STREAM_START, connfd); } else { if (pfd[i].revents & (POLLHUP | POLLRDHUP)) { printf("CStreamManager::run(): POLLHUP, fd %d\n", pfd[i].fd); - mutex.lock(); - for (streammap_iterator_t it = streams.begin(); it != streams.end(); ++it) { - if (it->second->HasFd(pfd[i].fd)) { - CStreamInstance *stream = it->second; - stream->RemoveClient(pfd[i].fd); - if (stream->GetFds().empty()) { - streams.erase(stream->GetChannelId()); - delete stream; - } - break; - } - } - mutex.unlock(); + RemoveClient(pfd[i].fd); + if (streams.empty()) + g_RCInput->postMsg(NeutrinoMessages::EVT_STREAM_STOP, 0); } } } @@ -559,8 +627,6 @@ bool CStreamManager::Listen() { struct sockaddr_in socketAddr; int socketOptActive = 1; - int sendsize = 10*IN_SIZE; - unsigned int m = sizeof(sendsize); if ((listenfd = socket (AF_INET, SOCK_STREAM, 0)) < 0) { fprintf (stderr, "network port %u open: ", port); @@ -590,12 +656,7 @@ bool CStreamManager::Listen() goto _error; } -#if 1 - setsockopt(listenfd, SOL_SOCKET, SO_SNDBUF, (void *)&sendsize, m); - sendsize = 0; - getsockopt(listenfd, SOL_SOCKET, SO_SNDBUF, (void *)&sendsize, &m); - printf("CStreamManager::Listen: on %d, fd %d (%d)\n", port, listenfd, sendsize); -#endif + printf("CStreamManager::Listen: on %d, fd %d\n", port, listenfd); return true; _error: close (listenfd); diff --git a/src/driver/streamts.h b/src/driver/streamts.h index 9b10ddeca..e1a6915a1 100644 --- a/src/driver/streamts.h +++ b/src/driver/streamts.h @@ -27,6 +27,7 @@ #include #include +#include #include #include @@ -38,6 +39,7 @@ class CStreamInstance : public OpenThreads::Thread private: bool running; cDemux * dmx; + CFrontend * frontend; OpenThreads::Mutex mutex; unsigned char * buf; @@ -48,6 +50,7 @@ class CStreamInstance : public OpenThreads::Thread bool Send(ssize_t r); void Close(); void run(); + friend class CStreamManager; public: CStreamInstance(int clientfd, t_channel_id chid, stream_pids_t &pids); ~CStreamInstance(); @@ -74,12 +77,17 @@ class CStreamManager : public OpenThreads::Thread OpenThreads::Mutex mutex; static CStreamManager * sm; + CZapitClient zapit; streammap_t streams; bool Listen(); - bool Parse(int fd, stream_pids_t &pids, t_channel_id &chid); + bool Parse(int fd, stream_pids_t &pids, t_channel_id &chid, CFrontend * &frontend); + void AddPids(int fd, CZapitChannel * channel, stream_pids_t &pids); + void CheckStandby(bool enter); + CFrontend * FindFrontend(CZapitChannel * channel); bool StopAll(); + void RemoveClient(int fd); void run(); CStreamManager(); public: @@ -91,6 +99,7 @@ class CStreamManager : public OpenThreads::Thread bool StreamStatus(t_channel_id channel_id = 0); bool SetPort(int newport); int GetPort() { return port; } + bool AddClient(int fd); }; #endif From d81b50523cc21ea638c4d4b0bcd429484bb87fc8 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Wed, 26 Mar 2014 12:22:52 +0100 Subject: [PATCH 131/225] - neutrinoyparser: add function 'get_boxmodel' --- .../tuxboxapi/coolstream/neutrinoyparser.cpp | 27 +++++++++++++++++++ .../tuxboxapi/coolstream/neutrinoyparser.h | 1 + 2 files changed, 28 insertions(+) diff --git a/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp b/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp index 593c74c51..dce0ad5df 100644 --- a/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp +++ b/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp @@ -119,6 +119,7 @@ const CNeutrinoYParser::TyFuncCall CNeutrinoYParser::yFuncCallList[]= {"umount_get_list", &CNeutrinoYParser::func_unmount_get_list}, {"get_partition_list", &CNeutrinoYParser::func_get_partition_list}, {"get_boxtype", &CNeutrinoYParser::func_get_boxtype}, + {"get_boxmodel", &CNeutrinoYParser::func_get_boxmodel}, {"get_current_stream_info", &CNeutrinoYParser::func_get_current_stream_info}, {"get_timer_list", &CNeutrinoYParser::func_get_timer_list}, {"set_timer_form", &CNeutrinoYParser::func_set_timer_form}, @@ -734,6 +735,32 @@ std::string CNeutrinoYParser::func_get_boxtype(CyhookHandler *, std::string) return boxname; } //------------------------------------------------------------------------- +// y-func : get boxmodel +//------------------------------------------------------------------------- +std::string CNeutrinoYParser::func_get_boxmodel(CyhookHandler *, std::string) +{ + unsigned int system_rev = cs_get_revision(); + std::string boxmodel = "Unknown"; + + switch(system_rev) + { + case 6: + case 7: + case 8: + case 10: + boxmodel = "Nevis"; + break; + case 9: + case 11: + boxmodel = "Apollo"; + break; + default: + break; + } + + return boxmodel; +} +//------------------------------------------------------------------------- // y-func : get stream info //------------------------------------------------------------------------- std::string CNeutrinoYParser::func_get_current_stream_info(CyhookHandler *hh, std::string) diff --git a/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.h b/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.h index 6b934c37d..d21e8afba 100644 --- a/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.h +++ b/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.h @@ -67,6 +67,7 @@ public: // func TUXBOX std::string func_get_boxtype(CyhookHandler *hh, std::string para); + std::string func_get_boxmodel(CyhookHandler *hh, std::string para); }; #endif /*__nhttpd_neutrinoyparser_h__*/ From d4dc3fcbbdebc644d56b68f8edf1350c8f1475ee Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Wed, 26 Mar 2014 12:45:18 +0100 Subject: [PATCH 132/225] - neutrinoyparser: remove delivery_system from boxname --- .../tuxboxapi/coolstream/neutrinoyparser.cpp | 4 +--- src/nhttpd/web/Y_Blocks.txt | 18 +++++++----------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp b/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp index dce0ad5df..2ce55b2ad 100644 --- a/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp +++ b/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp @@ -686,7 +686,7 @@ std::string CNeutrinoYParser::func_get_partition_list(CyhookHandler *, std::str //------------------------------------------------------------------------- // y-func : get boxtypetext //------------------------------------------------------------------------- -std::string CNeutrinoYParser::func_get_boxtype(CyhookHandler *, std::string) +std::string CNeutrinoYParser::func_get_boxtype(CyhookHandler *, std::string) { unsigned int system_rev = cs_get_revision(); std::string boxname = "CST "; @@ -730,8 +730,6 @@ std::string CNeutrinoYParser::func_get_boxtype(CyhookHandler *, std::string) break; } - if (system_rev != 9) // don't add delivery_system for Tank - boxname += (g_info.delivery_system == DVB_S || (system_rev == 1)) ? " SAT":" CABLE"; return boxname; } //------------------------------------------------------------------------- diff --git a/src/nhttpd/web/Y_Blocks.txt b/src/nhttpd/web/Y_Blocks.txt index d9fc4081a..4f6c332ac 100644 --- a/src/nhttpd/web/Y_Blocks.txt +++ b/src/nhttpd/web/Y_Blocks.txt @@ -501,18 +501,14 @@ start-block~remote {=if-equal:{=var-get:yfbtype=}~0~ {=if-equal:{=var-get:nfbtype=}~2~ {=include-block:Y_Blocks.txt;rc_dbox_philips=}~ {=if-equal:{=var-get:nfbtype=}~1~ {=include-block:Y_Blocks.txt;rc_dbox_nokia_old=}~ - {=if-equal:{=var-get:boxtype=}~CST Neo SAT~ {=include-block:Y_Blocks.txt;rc_cst_v2=}~ - {=if-equal:{=var-get:boxtype=}~CST Neo CABLE~ {=include-block:Y_Blocks.txt;rc_cst_v2=}~ - {=if-equal:{=var-get:boxtype=}~CST Zee SAT~ {=include-block:Y_Blocks.txt;rc_cst_v3=}~ - {=if-equal:{=var-get:boxtype=}~CST Zee CABLE~ {=include-block:Y_Blocks.txt;rc_cst_v3=}~ - {=if-equal:{=var-get:boxtype=}~CST Neo Twin SAT~ {=include-block:Y_Blocks.txt;rc_cst_v4=}~ - {=if-equal:{=var-get:boxtype=}~CST Neo Twin CABLE~ {=include-block:Y_Blocks.txt;rc_cst_v4=}~ - {=if-equal:{=var-get:boxtype=}~CST Tank~ {=include-block:Y_Blocks.txt;rc_cst_v5=}~ - {=if-equal:{=var-get:boxtype=}~CST Trinity SAT~ {=include-block:Y_Blocks.txt;rc_cst_v6=}~ - {=if-equal:{=var-get:boxtype=}~CST Trinity CABLE~ {=include-block:Y_Blocks.txt;rc_cst_v6=}~ + {=if-equal:{=var-get:boxtype=}~CST Neo~ {=include-block:Y_Blocks.txt;rc_cst_v2=}~ + {=if-equal:{=var-get:boxtype=}~CST Zee~ {=include-block:Y_Blocks.txt;rc_cst_v3=}~ + {=if-equal:{=var-get:boxtype=}~CST Neo Twin~ {=include-block:Y_Blocks.txt;rc_cst_v4=}~ + {=if-equal:{=var-get:boxtype=}~CST Tank~ {=include-block:Y_Blocks.txt;rc_cst_v5=}~ + {=if-equal:{=var-get:boxtype=}~CST Trinity~ {=include-block:Y_Blocks.txt;rc_cst_v6=}~ - {=comment:fallback~=} {=include-block:Y_Blocks.txt;rc_cst_v1=} - =}=}=}=}=}=}=}=}=} + {=comment:fallback~=} {=include-block:Y_Blocks.txt;rc_cst_v1=} + =}=}=}=}=} =}=} ~ {=if-equal:{=var-get:yfbtype=}~-2~ {=include-block:Y_Blocks.txt;rc_dbox_philips=}~ From a3e8142fae2ceb61b5f5e0be72ac861aa9b797a4 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Wed, 26 Mar 2014 12:57:48 +0100 Subject: [PATCH 133/225] - controlapi: add boxmodel to control/info?hwinfo --- src/nhttpd/tuxboxapi/coolstream/controlapi.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp index 3bb368d39..805176c64 100644 --- a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp +++ b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp @@ -630,12 +630,13 @@ void CControlAPI::InfoCGI(CyhookHandler *hh) void CControlAPI::HWInfoCGI(CyhookHandler *hh) { std::string boxname = NeutrinoAPI->NeutrinoYParser->func_get_boxtype(hh, ""); + std::string boxmodel = NeutrinoAPI->NeutrinoYParser->func_get_boxmodel(hh, ""); static CNetAdapter netadapter; std::string eth_id = netadapter.getMacAddr(); std::transform(eth_id.begin(), eth_id.end(), eth_id.begin(), ::tolower); - hh->printf("%s\nMAC:%s\n", boxname.c_str(),eth_id.c_str()); + hh->printf("%s (%s)\nMAC:%s\n", boxname.c_str(), boxmodel.c_str(), eth_id.c_str()); } //----------------------------------------------------------------------------- void CControlAPI::ShutdownCGI(CyhookHandler *hh) From b96a7d43a69816f7b144de271bc7497c4a1c787f Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Thu, 27 Mar 2014 18:46:49 +0400 Subject: [PATCH 134/225] driver/streamts.cpp: optimize poll timeout, cancel thread on stop --- src/driver/streamts.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/driver/streamts.cpp b/src/driver/streamts.cpp index 22d569094..5ceb7983f 100644 --- a/src/driver/streamts.cpp +++ b/src/driver/streamts.cpp @@ -247,7 +247,10 @@ bool CStreamManager::Stop() if (!running) return false; running = false; - return (OpenThreads::Thread::join() == 0); + cancel(); + bool ret = (OpenThreads::Thread::join() == 0); + StopAll(); + return ret; } bool CStreamManager::SetPort(int newport) @@ -524,6 +527,7 @@ void CStreamManager::run() struct pollfd pfd[128]; int poll_cnt; + int poll_timeout = -1; printf("Starting STREAM thread keeper, tid %ld\n", syscall(__NR_gettid)); @@ -544,7 +548,7 @@ void CStreamManager::run() } mutex.unlock(); //printf("polling, count= %d\n", poll_cnt); - int pollres = poll (pfd, poll_cnt, 10000); + int pollres = poll (pfd, poll_cnt, poll_timeout); if (pollres <= 0) { if (pollres < 0) perror("CStreamManager::run(): poll"); @@ -565,12 +569,15 @@ void CStreamManager::run() close(connfd); #endif g_RCInput->postMsg(NeutrinoMessages::EVT_STREAM_START, connfd); + poll_timeout = 1000; } else { if (pfd[i].revents & (POLLHUP | POLLRDHUP)) { printf("CStreamManager::run(): POLLHUP, fd %d\n", pfd[i].fd); RemoveClient(pfd[i].fd); - if (streams.empty()) + if (streams.empty()) { + poll_timeout = -1; g_RCInput->postMsg(NeutrinoMessages::EVT_STREAM_STOP, 0); + } } } } From 29bec8dda2a39ce0719bba169c5571f0d0131810 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Thu, 27 Mar 2014 18:47:14 +0400 Subject: [PATCH 135/225] locals: add new locales for epg scan --- data/locale/english.locale | 5 +++++ src/system/locals.h | 5 +++++ src/system/locals_intern.h | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/data/locale/english.locale b/data/locale/english.locale index ef815e968..d5d9006cf 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -851,6 +851,7 @@ menu.hint_epg_old_events Hours after event end time to consider\nevent old and r menu.hint_epg_save Save cached EPG to harddisk or usb flash\nand load it after boot menu.hint_epg_save_standby Save EPG on soft standby mode menu.hint_epg_scan Enable background epg scan using free tuner,\ncurrent bouquet or all favorites +menu.hint_epg_scan_mode Select box state to run epg scan menu.hint_event_textcolor Change event color for colored-event options\nin channel list and infobar menu.hint_eventlist_additional Show additional informations\nin main box menu.hint_eventlist_fonts Change event list font sizes @@ -1259,8 +1260,12 @@ miscsettings.epg_old_events_hint2 Set in hours miscsettings.epg_save Save/Restore epg on reboot miscsettings.epg_save_standby Save epg on soft standby miscsettings.epg_scan EPG scan +miscsettings.epg_scan_always Always miscsettings.epg_scan_bq bouquet miscsettings.epg_scan_fav favorites +miscsettings.epg_scan_live Live +miscsettings.epg_scan_sel Selected +miscsettings.epg_scan_standby Standby miscsettings.general General miscsettings.head Extended settings miscsettings.infobar Infobar diff --git a/src/system/locals.h b/src/system/locals.h index ac15eb73b..0b33294d5 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -878,6 +878,7 @@ typedef enum LOCALE_MENU_HINT_EPG_SAVE, LOCALE_MENU_HINT_EPG_SAVE_STANDBY, LOCALE_MENU_HINT_EPG_SCAN, + LOCALE_MENU_HINT_EPG_SCAN_MODE, LOCALE_MENU_HINT_EVENT_TEXTCOLOR, LOCALE_MENU_HINT_EVENTLIST_ADDITIONAL, LOCALE_MENU_HINT_EVENTLIST_FONTS, @@ -1286,8 +1287,12 @@ typedef enum LOCALE_MISCSETTINGS_EPG_SAVE, LOCALE_MISCSETTINGS_EPG_SAVE_STANDBY, LOCALE_MISCSETTINGS_EPG_SCAN, + LOCALE_MISCSETTINGS_EPG_SCAN_ALWAYS, LOCALE_MISCSETTINGS_EPG_SCAN_BQ, LOCALE_MISCSETTINGS_EPG_SCAN_FAV, + LOCALE_MISCSETTINGS_EPG_SCAN_LIVE, + LOCALE_MISCSETTINGS_EPG_SCAN_SEL, + LOCALE_MISCSETTINGS_EPG_SCAN_STANDBY, LOCALE_MISCSETTINGS_GENERAL, LOCALE_MISCSETTINGS_HEAD, LOCALE_MISCSETTINGS_INFOBAR, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index d2b9c1734..08c228fe7 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -878,6 +878,7 @@ const char * locale_real_names[] = "menu.hint_epg_save", "menu.hint_epg_save_standby", "menu.hint_epg_scan", + "menu.hint_epg_scan_mode", "menu.hint_event_textcolor", "menu.hint_eventlist_additional", "menu.hint_eventlist_fonts", @@ -1286,8 +1287,12 @@ const char * locale_real_names[] = "miscsettings.epg_save", "miscsettings.epg_save_standby", "miscsettings.epg_scan", + "miscsettings.epg_scan_always", "miscsettings.epg_scan_bq", "miscsettings.epg_scan_fav", + "miscsettings.epg_scan_live", + "miscsettings.epg_scan_sel", + "miscsettings.epg_scan_standby", "miscsettings.general", "miscsettings.head", "miscsettings.infobar", From d4353a0692493331022be7a9c1ff40c2e586f8ec Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Thu, 27 Mar 2014 18:47:50 +0400 Subject: [PATCH 136/225] neutrino.cpp: add setting to select box state for epg scan --- src/neutrino.cpp | 7 ++++++- src/system/settings.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 171bd4641..df6d3a848 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -468,6 +468,7 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.epg_save = configfile.getBool("epg_save", false); g_settings.epg_save_standby = configfile.getBool("epg_save_standby", true); g_settings.epg_scan = configfile.getInt32("epg_scan", 0); + g_settings.epg_scan_mode = configfile.getInt32("epg_scan_mode", CEpgScan::MODE_ALWAYS); //widget settings g_settings.widget_fade = false; g_settings.widget_fade = configfile.getBool("widget_fade" , false ); @@ -974,6 +975,7 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setBool("epg_save", g_settings.epg_save); configfile.setBool("epg_save_standby", g_settings.epg_save_standby); configfile.setInt32("epg_scan", g_settings.epg_scan); + configfile.setInt32("epg_scan_mode", g_settings.epg_scan_mode); configfile.setInt32("epg_cache_time" ,g_settings.epg_cache ); configfile.setInt32("epg_extendedcache_time" ,g_settings.epg_extendedcache); configfile.setInt32("epg_old_events" ,g_settings.epg_old_events ); @@ -2139,11 +2141,12 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) InfoClock->enableInfoClock(false); int old_ttx = g_settings.cacheTXT; int old_epg = g_settings.epg_scan; + int old_mode = g_settings.epg_scan_mode; mainMenu.exec(NULL, ""); InfoClock->enableInfoClock(true); StartSubtitles(); saveSetup(NEUTRINO_SETTINGS_FILE); - if (old_epg != g_settings.epg_scan) { + if (old_epg != g_settings.epg_scan || old_mode != g_settings.epg_scan_mode) { if (g_settings.epg_scan) CEpgScan::getInstance()->Start(); else @@ -3751,7 +3754,9 @@ void stop_daemons(bool stopall, bool for_flash) pthread_join(nhttpd_thread, NULL); } printf("httpd shutdown done\n"); + printf("streaming shutdown\n"); CStreamManager::getInstance()->Stop(); + printf("streaming shutdown done\n"); if(stopall || for_flash) { printf("timerd shutdown\n"); if (g_Timerd) diff --git a/src/system/settings.h b/src/system/settings.h index f2d4255f0..d30cffe0d 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -151,6 +151,7 @@ struct SNeutrinoSettings int epg_extendedcache; std::string epg_dir; int epg_scan; + int epg_scan_mode; int epg_search_history_size; int epg_search_history_max; From 37cf3482b7ffebe3126d937bd9281cb923d8e550 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Thu, 27 Mar 2014 18:48:36 +0400 Subject: [PATCH 137/225] zapit/src/bouquets.cpp: add bouquet flag to select bouquet for epg scan --- src/zapit/include/zapit/bouquets.h | 3 ++- src/zapit/src/bouquets.cpp | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/zapit/include/zapit/bouquets.h b/src/zapit/include/zapit/bouquets.h index 82567133c..a0b63a317 100644 --- a/src/zapit/include/zapit/bouquets.h +++ b/src/zapit/include/zapit/bouquets.h @@ -36,12 +36,13 @@ class CZapitBouquet bool bUser; bool bFav; bool bOther; + int bScanEpg; t_satellite_position satellitePosition; ZapitChannelList radioChannels; ZapitChannelList tvChannels; - inline CZapitBouquet(const std::string name) { Name = name; bHidden = false; bLocked = false; bUser = true; } + inline CZapitBouquet(const std::string name) { Name = name; bHidden = false; bLocked = false; bUser = false; bOther = false; bScanEpg = false; } void addService(CZapitChannel* newChannel); diff --git a/src/zapit/src/bouquets.cpp b/src/zapit/src/bouquets.cpp index 6ee45ec10..8b23860ed 100644 --- a/src/zapit/src/bouquets.cpp +++ b/src/zapit/src/bouquets.cpp @@ -211,8 +211,8 @@ CBouquetManager::~CBouquetManager() void CBouquetManager::writeBouquetHeader(FILE * bouq_fd, uint32_t i, const char * bouquetName) { //printf("[bouquets] writing bouquet header: %s\n", bouquetName); - fprintf(bouq_fd, "\t