CEventFinderMenu -add epg search history

Origin commit data
------------------
Commit: 4f387ae87f
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2013-11-26 (Tue, 26 Nov 2013)
This commit is contained in:
Jacek Jendrzej
2013-11-26 16:23:24 +01:00
parent 7218b95281
commit a33bb55eaa
8 changed files with 111 additions and 41 deletions

View File

@@ -327,7 +327,9 @@ epgviewer.length Spieldauer (Min.)
epgviewer.nodetailed Keine ausführlichen Informationen verfügbar
epgviewer.notfound Keine Programminformationen (EPG) gefunden
eventfinder.head EPG-Suche
eventfinder.history Frühere Suchen
eventfinder.keyword Suche nach Textpassage
eventfinder.max_history Max. Anzahl früherer Suchen
eventfinder.search Suche
eventfinder.search_all_epg Ganze
eventfinder.search_within_epg Suche innerhalb EPG-Daten

View File

@@ -327,7 +327,9 @@ epgviewer.length Length (min.)
epgviewer.nodetailed No detailed informations available
epgviewer.notfound No EPG found
eventfinder.head Search in EPG
eventfinder.history Search history
eventfinder.keyword Keyword
eventfinder.max_history Max results to fetch
eventfinder.search Search
eventfinder.search_all_epg whole
eventfinder.search_within_epg Search within

View File

@@ -71,6 +71,7 @@ inline static bool sortbyEventid (const CChannelEvent& a, const CChannelEvent& b
return (a.channelID == b.channelID && a.eventID == b.eventID && a.startTime == b.startTime);
}
#endif
inline bool sortByDescription (const CChannelEvent& a, const CChannelEvent& b)
{
if(a.description == b.description)
@@ -1126,6 +1127,22 @@ bool CNeutrinoEventList::findEvents(void)
search_head_name += ": '";
search_head_name += m_search_keyword;
search_head_name += "'";
if(!m_search_keyword.empty()){
g_settings.epg_search_history.push_front(m_search_keyword);
std::list<std::string>::iterator it = g_settings.epg_search_history.begin();
it++;
while (it != g_settings.epg_search_history.end()) {
if (*it == m_search_keyword)
it = g_settings.epg_search_history.erase(it);
else
++it;
}
g_settings.epg_search_history_size = g_settings.epg_search_history.size();
if (g_settings.epg_search_history_size > g_settings.epg_search_history_max)
g_settings.epg_search_history_size = g_settings.epg_search_history_max;
}
}
paintHead(0, search_head_name);
paint();
@@ -1198,6 +1215,8 @@ CEventFinderMenu::CEventFinderMenu( int* event,
m_search_list = search_list;
m_search_channel_id = search_channel_id;
m_search_bouquet_id = search_bouquet_id;
width = w_max (40, 10);
selected = -1;
}
@@ -1214,34 +1233,13 @@ int CEventFinderMenu::exec(CMenuTarget* parent, const std::string &actionkey)
//printf("0\n");
showMenu();
}
else if(actionkey =="1")
else if(actionkey =="#1")
{
//printf("1\n");
*m_event = true;
res = menu_return::RETURN_EXIT_ALL;
}
else if(actionkey =="2")
{
//printf("2\n");
/*
if(*m_search_list == CNeutrinoEventList::SEARCH_LIST_CHANNEL)
{
mf[1]->setActive(true);
m_search_channelname = CServiceManager::getInstance()->GetServiceName(*m_search_channel_id);;
}
else if(*m_search_list == CNeutrinoEventList::SEARCH_LIST_BOUQUET)
{
mf[1]->setActive(true);
m_search_channelname = bouquetList->Bouquets[*m_search_bouquet_id]->channelList->getName();
}
else if(*m_search_list == CNeutrinoEventList::SEARCH_LIST_ALL)
{
mf[1]->setActive(false);
m_search_channelname = "";
}
*/
}
else if(actionkey =="3")
else if(actionkey =="#2")
{
//printf("3\n");
// get channel id / bouquet id
@@ -1275,9 +1273,38 @@ int CEventFinderMenu::exec(CMenuTarget* parent, const std::string &actionkey)
}
}
}
else if(actionkey =="4")
else if(actionkey =="#history")
{
//printf("4\n");
if (parent)
parent->hide();
CMenuWidget* m = new CMenuWidget(LOCALE_EVENTFINDER_HISTORY, NEUTRINO_ICON_MOVIEPLAYER, width);
m->addKey(CRCInput::RC_spkr, this, "#clear");
m->setSelected(selected);
m->addItem(GenericMenuSeparator);
m->addItem(GenericMenuBack);
m->addItem(GenericMenuSeparatorLine);
std::list<std::string>::iterator it = g_settings.epg_search_history.begin();
for (int i = 0; i < g_settings.epg_search_history_size; i++, ++it)
m->addItem(new CMenuForwarderNonLocalized((*it).c_str(), true, NULL, this, (*it).c_str(), CRCInput::convertDigitToKey(i + 1)));
m->exec(NULL, "");
m->hide();
delete m;
return menu_return::RETURN_REPAINT;
}
if (actionkey == "#clear") {
g_settings.epg_search_history.clear();
g_settings.epg_search_history_size = 0;
return menu_return::RETURN_EXIT;
}
std::list<std::string>::iterator it = g_settings.epg_search_history.begin();
for (int i = 0; i < g_settings.epg_search_history_size; i++, ++it){
if((*it)== actionkey){
*m_search_keyword = actionkey;
g_RCInput->postMsg((neutrino_msg_t) CRCInput::RC_blue, 0);
return menu_return::RETURN_EXIT;
}
}
return res;
@@ -1316,12 +1343,16 @@ int CEventFinderMenu::showMenu(void)
CMenuForwarder* mf0 = new CMenuForwarder(LOCALE_EVENTFINDER_KEYWORD, true, *m_search_keyword, &stringInput, NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED);
CMenuOptionChooser* mo0 = new CMenuOptionChooser(LOCALE_EVENTFINDER_SEARCH_WITHIN_LIST, m_search_list, SEARCH_LIST_OPTIONS, SEARCH_LIST_OPTION_COUNT, true, this, CRCInput::convertDigitToKey(shortcut++));
m_search_channelname_mf = new CMenuForwarderNonLocalized("", *m_search_list != CNeutrinoEventList::SEARCH_LIST_ALL, m_search_channelname, this, "3", CRCInput::convertDigitToKey(shortcut++));
m_search_channelname_mf = new CMenuForwarderNonLocalized("", *m_search_list != CNeutrinoEventList::SEARCH_LIST_ALL, m_search_channelname, this, "#2", CRCInput::convertDigitToKey(shortcut++));
CMenuOptionChooser* mo1 = new CMenuOptionChooser(LOCALE_EVENTFINDER_SEARCH_WITHIN_EPG, m_search_epg_item, SEARCH_EPG_OPTIONS, SEARCH_EPG_OPTION_COUNT, true, NULL, CRCInput::convertDigitToKey(shortcut++));
CMenuForwarder* mf1 = new CMenuForwarder(LOCALE_EVENTFINDER_START_SEARCH, true, NULL, this, "1", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN);
CMenuForwarder* mf1 = new CMenuForwarder(LOCALE_EVENTFINDER_START_SEARCH, true, NULL, this, "#1", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN);
CMenuWidget searchMenu(LOCALE_EVENTFINDER_HEAD, NEUTRINO_ICON_FEATURES, 40);
CMenuForwarder* mf2 = new CMenuForwarder(LOCALE_EVENTFINDER_HISTORY, true, NULL, this, "#history", CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW);
CMenuOptionNumberChooser* moc1 = new CMenuOptionNumberChooser(LOCALE_EVENTFINDER_MAX_HISTORY, &g_settings.epg_search_history_max, true, 0, 50, NULL);
searchMenu.addItem(GenericMenuSeparatorLine);
searchMenu.addItem(GenericMenuSeparator);
searchMenu.addItem(mf0);
searchMenu.addItem(GenericMenuSeparatorLine);
@@ -1330,6 +1361,9 @@ int CEventFinderMenu::showMenu(void)
searchMenu.addItem(mo1);
searchMenu.addItem(GenericMenuSeparatorLine);
searchMenu.addItem(mf1);
searchMenu.addItem(GenericMenuSeparatorLine);
searchMenu.addItem(mf2);
searchMenu.addItem(moc1);
res = searchMenu.exec(NULL,"");
return(res);

View File

@@ -146,6 +146,8 @@ class CEventFinderMenu : public CMenuTarget, CChangeObserver
std::string m_search_channelname;
t_channel_id* m_search_channel_id;
t_bouquet_id* m_search_bouquet_id;
int width;
int selected;
int showMenu(void);
public:
CEventFinderMenu( int* event,

View File

@@ -738,6 +738,18 @@ int CNeutrinoApp::loadSetup(const char * fname)
g_settings.startchanneltv_id = configfile.getInt64("startchanneltv_id", 0);
g_settings.startchannelradio_id = configfile.getInt64("startchannelradio_id", 0);
g_settings.uselastchannel = configfile.getInt32("uselastchannel" , 1);
//epg searsch
g_settings.epg_search_history_max = configfile.getInt32("epg_search_history_max", 10);
g_settings.epg_search_history_size = configfile.getInt32("epg_search_history_size", 0);
if (g_settings.epg_search_history_size > g_settings.epg_search_history_max)
g_settings.epg_search_history_size = g_settings.epg_search_history_max;
g_settings.epg_search_history.clear();
for(int i = 0; i < g_settings.epg_search_history_size; i++) {
std::string s = configfile.getString("epg_search_history_" + to_string(i));
if (s != "")
g_settings.epg_search_history.push_back(configfile.getString("epg_search_history_" + to_string(i), ""));
}
g_settings.epg_search_history_size = g_settings.epg_search_history.size();
// USERMENU -> in system/settings.h
@@ -1179,6 +1191,15 @@ void CNeutrinoApp::saveSetup(const char * fname)
configfile.setInt64("startchanneltv_id", g_settings.startchanneltv_id);
configfile.setInt64("startchannelradio_id", g_settings.startchannelradio_id);
configfile.setInt32("uselastchannel", g_settings.uselastchannel);
//epg search
g_settings.epg_search_history_size = g_settings.epg_search_history.size();
if (g_settings.epg_search_history_size > g_settings.epg_search_history_max)
g_settings.epg_search_history_size = g_settings.epg_search_history_max;
configfile.setInt32("epg_search_history_max", g_settings.epg_search_history_max);
configfile.setInt32("epg_search_history_size", g_settings.epg_search_history_size);
std::list<std::string>:: iterator it = g_settings.epg_search_history.begin();
for(int i = 0; i < g_settings.epg_search_history_size; i++, ++it)
configfile.setString("epg_search_history_" + to_string(i), *it);
// USERMENU
//---------------------------------------

View File

@@ -354,7 +354,9 @@ typedef enum
LOCALE_EPGVIEWER_NODETAILED,
LOCALE_EPGVIEWER_NOTFOUND,
LOCALE_EVENTFINDER_HEAD,
LOCALE_EVENTFINDER_HISTORY,
LOCALE_EVENTFINDER_KEYWORD,
LOCALE_EVENTFINDER_MAX_HISTORY,
LOCALE_EVENTFINDER_SEARCH,
LOCALE_EVENTFINDER_SEARCH_ALL_EPG,
LOCALE_EVENTFINDER_SEARCH_WITHIN_EPG,

View File

@@ -354,7 +354,9 @@ const char * locale_real_names[] =
"epgviewer.nodetailed",
"epgviewer.notfound",
"eventfinder.head",
"eventfinder.history",
"eventfinder.keyword",
"eventfinder.max_history",
"eventfinder.search",
"eventfinder.search_all_epg",
"eventfinder.search_within_epg",

View File

@@ -38,6 +38,7 @@
#include <zapit/client/zapittools.h>
#include <string>
#include <list>
#ifdef BOXMODEL_APOLLO
#define VIDEOMENU_VIDEOMODE_OPTION_COUNT 14
@@ -147,6 +148,10 @@ struct SNeutrinoSettings
std::string epg_dir;
int epg_scan;
int epg_search_history_size;
int epg_search_history_max;
std::list<std::string> epg_search_history;
//network
std::string network_ntpserver;
std::string network_ntprefresh;