From 87fe3bd4061b0763c3fdd104a2c2d9bb92cf5282 Mon Sep 17 00:00:00 2001 From: satbaby Date: Thu, 1 Nov 2012 18:55:03 +0100 Subject: [PATCH] eventlist: -add notifier to search menu, ported from tuxcvs, THX Gaucho316 --- src/gui/eventlist.cpp | 46 ++++++++++++++++++++++++++++++++++--------- src/gui/eventlist.h | 4 +++- 2 files changed, 40 insertions(+), 10 deletions(-) diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index f0f2f5d21..12571f2b2 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -1241,6 +1241,7 @@ int CEventFinderMenu::showMenu(void) /************************************************************************************************/ { int res = menu_return::RETURN_REPAINT; + m_search_channelname_mf = NULL; *m_event = false; if(*m_search_list == CNeutrinoEventList::SEARCH_LIST_CHANNEL) @@ -1264,24 +1265,51 @@ int CEventFinderMenu::showMenu(void) CStringInputSMS stringInput(LOCALE_EVENTFINDER_KEYWORD,m_search_keyword, 20, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789 -_/()<>=+.,:!?\\'"); - CMenuForwarder* mf2 = new CMenuForwarder(LOCALE_EVENTFINDER_KEYWORD ,true, *m_search_keyword, &stringInput, NULL, CRCInput::RC_1 ); - CMenuOptionChooser* mo0 = new CMenuOptionChooser(LOCALE_EVENTFINDER_SEARCH_WITHIN_LIST , m_search_list, SEARCH_LIST_OPTIONS, SEARCH_LIST_OPTION_COUNT, true, NULL, CRCInput::RC_2); - CMenuForwarderNonLocalized* mf1 = new CMenuForwarderNonLocalized("", *m_search_list != CNeutrinoEventList::SEARCH_LIST_ALL, m_search_channelname, this, "3", CRCInput::RC_3 ); + CMenuForwarder* mf0 = new CMenuForwarder(LOCALE_EVENTFINDER_KEYWORD, true, *m_search_keyword, &stringInput, NULL, CRCInput::RC_1, NEUTRINO_ICON_BUTTON_1); + CMenuOptionChooser* mo0 = new CMenuOptionChooser(LOCALE_EVENTFINDER_SEARCH_WITHIN_LIST, m_search_list, SEARCH_LIST_OPTIONS, SEARCH_LIST_OPTION_COUNT, true, this, CRCInput::RC_2, NEUTRINO_ICON_BUTTON_2); + m_search_channelname_mf = new CMenuForwarderNonLocalized("", *m_search_list != CNeutrinoEventList::SEARCH_LIST_ALL, m_search_channelname, this, "3", CRCInput::RC_3, NEUTRINO_ICON_BUTTON_3); CMenuOptionChooser* mo1 = new CMenuOptionChooser(LOCALE_EVENTFINDER_SEARCH_WITHIN_EPG, m_search_epg_item, SEARCH_EPG_OPTIONS, SEARCH_EPG_OPTION_COUNT, true, NULL, CRCInput::RC_4); - CMenuForwarder* mf0 = new CMenuForwarder(LOCALE_EVENTFINDER_START_SEARCH, true, NULL, this, "1", CRCInput::RC_5 ); + CMenuForwarder* mf1 = new CMenuForwarder(LOCALE_EVENTFINDER_START_SEARCH, true, NULL, this, "5", CRCInput::RC_5, NEUTRINO_ICON_BUTTON_5); CMenuWidget searchMenu(LOCALE_EVENTFINDER_HEAD, NEUTRINO_ICON_FEATURES); searchMenu.addItem(GenericMenuSeparator); - searchMenu.addItem(mf2, false); + searchMenu.addItem(mf0); searchMenu.addItem(GenericMenuSeparatorLine); - searchMenu.addItem(mo0, false); - searchMenu.addItem(mf1, false); - searchMenu.addItem(mo1, false); + searchMenu.addItem(mo0); + searchMenu.addItem(m_search_channelname_mf); + searchMenu.addItem(mo1); searchMenu.addItem(GenericMenuSeparatorLine); - searchMenu.addItem(mf0, false); + searchMenu.addItem(mf1); res = searchMenu.exec(NULL,""); return(res); } + + +/************************************************************************************************/ +bool CEventFinderMenu::changeNotify(const neutrino_locale_t OptionName, void *) +/************************************************************************************************/ +{ + if (ARE_LOCALES_EQUAL(OptionName, LOCALE_EVENTFINDER_SEARCH_WITHIN_LIST)) + { + if (*m_search_list == CNeutrinoEventList::SEARCH_LIST_CHANNEL) + { + m_search_channelname = g_Zapit->getChannelName(*m_search_channel_id); + m_search_channelname_mf->setActive(true); + } + else if (*m_search_list == CNeutrinoEventList::SEARCH_LIST_BOUQUET) + { + m_search_channelname = bouquetList->Bouquets[*m_search_bouquet_id]->channelList->getName(); + m_search_channelname_mf->setActive(true); + } + else if (*m_search_list == CNeutrinoEventList::SEARCH_LIST_ALL) + { + m_search_channelname = ""; + m_search_channelname_mf->setActive(false); + } + } + return false; +} + diff --git a/src/gui/eventlist.h b/src/gui/eventlist.h index c1ef8b81b..41a128cfa 100644 --- a/src/gui/eventlist.h +++ b/src/gui/eventlist.h @@ -134,9 +134,10 @@ class CEventListHandler : public CMenuTarget }; -class CEventFinderMenu : public CMenuTarget +class CEventFinderMenu : public CMenuTarget, CChangeObserver { private: + CMenuForwarderNonLocalized* m_search_channelname_mf; int* m_event; int* m_search_epg_item; std::string* m_search_keyword; @@ -153,6 +154,7 @@ class CEventFinderMenu : public CMenuTarget t_channel_id* search_channel_id, t_bouquet_id* search_bouquet_id); int exec( CMenuTarget* parent, const std::string &actionkey); + bool changeNotify(const neutrino_locale_t OptionName, void *); }; #endif