From fbff846e40e3d370e7cfeeffe3ea584591adf554 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Thu, 19 May 2016 16:59:56 +0200 Subject: [PATCH] channellist: add possibility to clear channel history Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/ffd0e7225199607836baa25f27898c6b938af845 Author: vanhofen Date: 2016-05-19 (Thu, 19 May 2016) Origin message was: ------------------ - channellist: add possibility to clear channel history --- data/locale/deutsch.locale | 1 + data/locale/english.locale | 1 + src/gui/channellist.cpp | 23 +++++++++++++++++++---- src/system/locals.h | 1 + src/system/locals_intern.h | 1 + 5 files changed, 23 insertions(+), 4 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index af0342b3b..42fb6169a 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -255,6 +255,7 @@ channellist.foot_sort_freq Sortiert[freq] channellist.foot_sort_sat Sortiert[sat] channellist.head Alle Kanäle channellist.history Verlauf +channellist.history_clear Verlauf löschen channellist.keep_numbers Dauerhafte Kanalnummern channellist.make_hdlist Erzeuge Bouquet mit HD-Kanälen channellist.make_newlist Erzeuge Bouquet mit neuen Kanälen diff --git a/data/locale/english.locale b/data/locale/english.locale index 9190af6d6..77a3b7a87 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -255,6 +255,7 @@ channellist.foot_sort_freq sorted[freq] channellist.foot_sort_sat sorted[sat] channellist.head All Services channellist.history History +channellist.history_clear Clear history channellist.keep_numbers Persistent channel numbers channellist.make_hdlist Create list of HD channels channellist.make_newlist Create list of new channels diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 0ac572d00..428fdb19e 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -311,6 +311,7 @@ int CChannelList::doChannelMenu(void) bool empty = (*chanlist).empty(); bool allow_edit = (bouquet && bouquet->zapitBouquet && !bouquet->zapitBouquet->bOther && !bouquet->zapitBouquet->bWebtv); + bool got_history = (CNeutrinoApp::getInstance()->channelList->getLastChannels().size() > 1); int i = 0; snprintf(cnt, sizeof(cnt), "%d", i); @@ -328,6 +329,10 @@ int CChannelList::doChannelMenu(void) snprintf(cnt, sizeof(cnt), "%d", i); menu->addItem(new CMenuForwarder(LOCALE_CHANNELLIST_RESET_ALL, reset_all, NULL, selector, cnt, CRCInput::convertDigitToKey(shortcut++)), old_selected == i++); + menu->addItem(GenericMenuSeparator); + snprintf(cnt, sizeof(cnt), "%d", i); + menu->addItem(new CMenuForwarder(LOCALE_CHANNELLIST_HISTORY_CLEAR, got_history, NULL, selector, cnt, CRCInput::convertDigitToKey(shortcut++)), old_selected == i++); + menu->addItem(new CMenuSeparator(CMenuSeparator::LINE)); snprintf(cnt, sizeof(cnt), "%d", i); menu->addItem(new CMenuForwarder(LOCALE_MAINMENU_SETTINGS, true, NULL, selector, cnt, CRCInput::convertDigitToKey(shortcut++)), old_selected == i++); @@ -411,7 +416,14 @@ int CChannelList::doChannelMenu(void) if(g_settings.make_new_list) CNeutrinoApp::getInstance()->MarkChannelsInit(); break; - case 5: // settings + case 5: // clear channel history + { + CNeutrinoApp::getInstance()->channelList->getLastChannels().clear(); + printf("%s:%d lastChList cleared\n", __FUNCTION__, __LINE__); + ret = -2; // exit channellist + } + break; + case 6: // settings { previous_channellist_additional = g_settings.channellist_additional; COsdSetup osd_setup; @@ -713,10 +725,13 @@ int CChannelList::show() if (selected + 1 < (*chanlist).size()) selected++; } - if (ret != 0) { - paint(); + if (ret == -2) // exit channellist + loop = false; + else { + if (ret != 0) + paint(); + timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_CHANLIST]); } - timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_CHANLIST]); } else if (!empty && msg == (neutrino_msg_t) g_settings.key_list_start) { actzap = updateSelection(0); diff --git a/src/system/locals.h b/src/system/locals.h index 1738cfc60..cac322dd7 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -282,6 +282,7 @@ typedef enum LOCALE_CHANNELLIST_FOOT_SORT_SAT, LOCALE_CHANNELLIST_HEAD, LOCALE_CHANNELLIST_HISTORY, + LOCALE_CHANNELLIST_HISTORY_CLEAR, LOCALE_CHANNELLIST_KEEP_NUMBERS, LOCALE_CHANNELLIST_MAKE_HDLIST, LOCALE_CHANNELLIST_MAKE_NEWLIST, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 04979cfda..105344a05 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -282,6 +282,7 @@ const char * locale_real_names[] = "channellist.foot_sort_sat", "channellist.head", "channellist.history", + "channellist.history_clear", "channellist.keep_numbers", "channellist.make_hdlist", "channellist.make_newlist",