1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
/*
* search.c
*
* See the README file for copyright information and how to reach the author.
*
* $Id: search.c,v 1.4 2006/06/18 13:59:36 schmitzj Exp $
*
*/
#include "search.h"
#include "magazine.h"
EventItem::EventItem(const class cEvent *ev)
{
char buf[200];
const char *txt,*chan;
cString time1,time2,date;
cChannel *channel;
myev=ev;
channel = Channels.GetByChannelID(ev->ChannelID(), true);
time1=ev->GetTimeString();
time2=ev->GetEndTimeString();
date=ev->GetDateString();
chan=channel->ShortName(true);
txt=ev->Title();
snprintf(buf,sizeof(buf)-1,"%.6s %s - %s %s/%s",(const char *)date,(const char *)time1,(const char *)time2,chan,txt);
SetText(buf);
}
// -----------------------------------------------------------------------------
cSearchMenu::cSearchMenu(const class cEvent *ev) : cOsdMenu(tr("Search"))
{
myev=ev;
const char *title;
title=ev->Title();
char txt[200];
snprintf(txt,sizeof(txt),"%s '%s'...",tr("Search for"),title);
SetTitle(txt);
SetStatus(tr("Searching..."));
Display();
Skins.Message(mtInfo, tr("Searching..."));
const cSchedules* Schedules = cSchedules::Schedules(_schedulesLock);
const cSchedule *s;
s=Schedules->GetSchedule(ev->ChannelID());
int cc=search(s,ev);
snprintf(txt,sizeof(txt),"%s '%s':",tr("Search for"),title);
SetTitle(txt);
if (cc>0)
{
SetStatus("");
SetHelp(tr("Record"), tr("Details"), tr("in all"), tr("Back"));
}
else
{
SetStatus(tr("Nothing found!"));
SetHelp(NULL, NULL, tr("in all"), tr("Back"));
}
Display();
}
const cEvent *cev=NULL;
int cSearchMenu::search(const cSchedule *s,const class cEvent *ev)
{
const char *title;
title=ev->Title();
int cc=0;
cev=s->GetPresentEvent();
while (cev)
{
if (cev!=ev || tvonscreenCfg.showsearchinitiator)
{
const char *ctitle;
ctitle=cev->Title();
if (ctitle && title && strstr(ctitle,title)) // || strstr(title,ctitle))
{
Add(new EventItem(cev));
cc++;
}
}
cev=magazine::getNext(s,cev);
}
return cc;
}
void cSearchMenu::searchIn(const cSchedule** schedArray,int schedArrayNum)
{
cChannel* channel;
const char *title;
title=myev->Title();
char txt[200];
snprintf(txt,sizeof(txt),"%s '%s'...",tr("Search for"),title);
SetTitle(txt);
Clear();
SetStatus(tr("Searching..."));
Display();
Skins.Message(mtInfo, tr("Searching..."));
int cc=0;
for (int i=0;i<schedArrayNum;i++)
{
channel = Channels.GetByChannelID(schedArray[i]->ChannelID(), true);
snprintf(txt,sizeof(txt),"%s /%-20.20s",tr("Searching..."),channel->ShortName(true));
Skins.Message(mtInfo, txt);
cc+=search(schedArray[i],myev);
}
snprintf(txt,sizeof(txt),"%s '%s':",tr("Search for"),title);
SetTitle(txt);
if (cc>0)
{
SetStatus("");
SetHelp(tr("Record"), tr("Details"), NULL, tr("Back"));
}
else
{
SetStatus(tr("Nothing found!"));
SetHelp(NULL, NULL, NULL, tr("Back"));
}
Display();
}
const class cEvent *cSearchMenu::currentSelected(void)
{
EventItem *item = (EventItem *)Get(Current());
return item ? item->Event() : NULL;
}
|