first = -1;
second = -1;
third = command;
- pos = 0;
+ numGot = 1;
videoLive = v;
}
+VChannelSelect::~VChannelSelect()
+{
+ Timers::getInstance()->cancelTimer(this, 1);
+}
+
void VChannelSelect::draw()
{
View::draw();
break;
}
}
+
+ Timers::getInstance()->setTimer(this, 1, (struct timespec){3, 0});
}
int VChannelSelect::handleCommand(int command)
{
case Remote::ZERO ... Remote::NINE:
{
- if (pos == 1) first = second;
+ if (numGot == 2) first = second;
second = third;
third = command;
+ ++numGot;
+
draw();
show();
- if (pos == 1)
+
+ if (numGot == 3)
{
Message* m = new Message();
m->from = this;
m->message = Message::CLOSE_ME;
ViewMan::getInstance()->postMessage(m);
- m = new Message();
- m->from = this;
- m->to = videoLive;
- m->message = Message::CHANNEL_CHANGE;
- m->parameter = (first * 100) + (second * 10) + third;
- ViewMan::getInstance()->postMessage(m);
+ // Is there valid data?
+ if ((first > 0) || (second > 0) || (third > 0))
+ {
+ m = new Message();
+ m->from = this;
+ m->to = videoLive;
+ m->message = Message::CHANNEL_CHANGE;
+ m->parameter = (first * 100) + (second * 10) + third;
+ ViewMan::getInstance()->postMessage(m);
+ }
}
- pos = 1;
return 2;
}
// allow command to drop through to other views
return 0;
}
+
+void VChannelSelect::timercall(int clientReference)
+{
+ Log::getInstance()->log("VChannelSelect", Log::DEBUG, "Timer call");
+
+ // Close me
+ Message* m = new Message();
+ m->from = this;
+ m->to = ViewMan::getInstance();
+ m->message = Message::CLOSE_ME;
+ ViewMan::getInstance()->postMessage(m);
+
+ // Is there valid data?
+ if ((first > 0) || (second > 0) || (third > 0))
+ {
+ // Change channel
+
+ ULONG newChannel = 0;
+ switch(numGot)
+ {
+ case 3:
+ newChannel += first * 100;
+ case 2:
+ newChannel += second * 10;
+ case 1:
+ newChannel += third;
+ }
+
+ m = new Message();
+ m->from = this;
+ m->to = videoLive;
+ m->message = Message::CHANNEL_CHANGE;
+ m->parameter = newChannel;
+ ViewMan::getInstance()->postMessage(m);
+ }
+}
w.setSurfaceOffset(keyx + 50, keyy + 20);\r
w.draw();\r
\r
- drawText("OK", keyx + 18, keyy + 20, Colour::LIGHTTEXT);\r
+ drawText(tr("OK"), keyx + 18, keyy + 20, Colour::LIGHTTEXT);\r
\r
surface->fillblt(keyx + 72, keyy + 4, 104, Surface::getFontHeight() + 2, surface->rgba(200, 0, 0, 255));\r
- drawText("Page up", keyx + 74, keyy + 5, Colour::LIGHTTEXT);\r
+ drawText(tr("Page up"), keyx + 74, keyy + 5, Colour::LIGHTTEXT);\r
\r
surface->fillblt(keyx + 72, keyy + Surface::getFontHeight() + 8, 104, Surface::getFontHeight() + 2, surface->rgba(0, 200, 0, 255));\r
- drawText("Page down", keyx + 74, keyy + Surface::getFontHeight() + 9, Colour::LIGHTTEXT);\r
+ drawText(tr("Page down"), keyx + 74, keyy + Surface::getFontHeight() + 9, Colour::LIGHTTEXT);\r
\r
surface->fillblt(keyx + 180, keyy + 4, 104, Surface::getFontHeight() + 2, surface->rgba(200, 200, 0, 255));\r
- drawText("-24 hours", keyx + 182, keyy + 5, Colour::LIGHTTEXT);\r
+ drawText(tr("-24 hours"), keyx + 182, keyy + 5, Colour::LIGHTTEXT);\r
\r
surface->fillblt(keyx + 180, keyy + Surface::getFontHeight() + 8, 104, Surface::getFontHeight() + 2, surface->rgba( 0, 0, 200, 255));\r
- drawText("+24 hours", keyx + 182, keyy + Surface::getFontHeight() + 9, Colour::LIGHTTEXT);\r
+ drawText(tr("+24 hours"), keyx + 182, keyy + Surface::getFontHeight() + 9, Colour::LIGHTTEXT);\r
\r
surface->fillblt(keyx + 290, keyy + 4, 180, Surface::getFontHeight() + 2, surface->rgba( 180, 180, 180, 255));\r
- drawText("Guide / Back: Close", keyx + 292 , keyy + 5, Colour::LIGHTTEXT);\r
+ drawText(tr("Guide / Back: Close"), keyx + 292 , keyy + 5, Colour::LIGHTTEXT);\r
\r
surface->fillblt(keyx + 290, keyy + Surface::getFontHeight() + 8, 180, Surface::getFontHeight() + 2, surface->rgba( 180, 180, 180, 255));\r
Colour red = Colour(130, 0, 0);\r
- drawText("Rec: Set timer", keyx + 292, keyy + Surface::getFontHeight() + 9, red);\r
+ drawText(tr("Rec: Set timer"), keyx + 292, keyy + Surface::getFontHeight() + 9, red);\r
\r
surface->fillblt(keyx + 474, keyy + 4, 128, Surface::getFontHeight() + 2, surface->rgba( 180, 180, 180, 255));\r
w.nextSymbol = WSymbol::PLAY;\r
w.setSurfaceOffset(keyx + 476, keyy + 5);\r
w.draw();\r
- drawText("Sel channel", keyx + 496, keyy + 5, Colour::LIGHTTEXT);\r
+ drawText(tr("Sel channel"), keyx + 496, keyy + 5, Colour::LIGHTTEXT);\r
\r
surface->fillblt(keyx + 474, keyy + Surface::getFontHeight() + 8, 128, Surface::getFontHeight() + 2, surface->rgba( 180, 180, 180, 255));\r
- drawText("Go: Preview", keyx + 476, keyy + Surface::getFontHeight() + 9, Colour::LIGHTTEXT);\r
+ drawText(tr("Go: Preview"), keyx + 476, keyy + Surface::getFontHeight() + 9, Colour::LIGHTTEXT);\r
}\r
\r
int VEpg::handleCommand(int command)\r
// TODO should the above two comditional statements be combined to avoid calling updateEventList() twice?\r
Event* event;\r
Event noevent; // an event to use if there are gaps in the epg\r
- thisEvent.setdescription("There are no programme details available for this period");\r
+ thisEvent.setdescription(tr("There are no programme details available for this period"));\r
thisEvent.duration = WINDOW_WIDTH * 60;\r
thisEvent.time = ltime;\r
- thisEvent.settitle("No programme details");\r
+ thisEvent.settitle(tr("No programme details"));\r
thisEvent.id = 0;\r
bool swapColour = FALSE; // alternate cell colour\r
bool currentRow = FALSE;\r
paintCell(&noevent, y, Colour::NOPROGRAMME, Colour::LIGHTTEXT); // fill row with no programme colour to be painted ove with valid programmes\r
if (currentRow)\r
{\r
- thisEvent.setdescription("There are no programme details available for this period");\r
+ thisEvent.setdescription(tr("There are no programme details available for this period"));\r
thisEvent.duration = WINDOW_WIDTH * 60;\r
thisEvent.time = ltime;\r
- thisEvent.settitle("No programme details");\r
+ thisEvent.settitle(tr("No programme details"));\r
thisEvent.id = 0;\r
}\r
if (eventLista[listIndex])\r
sort(eventLista[listIndex]->begin(), eventLista[listIndex]->end(), EventSorter());\r
for(e = 0; e < (eventLista[listIndex])->size(); e++) // step through events for this channel\r
{\r
- fg = Colour::LIGHTTEXT;\r
+ fg = Colour::LIGHTTEXT;\r
event = (*eventLista[listIndex])[e];\r
- if (event)\r
- {\r
- UINT end = event->time + event->duration; // programme end time\r
- if(event->time >= UINT(ltime) + (WINDOW_WIDTH * 60)) // programme starts after RHS of window\r
- continue; // that's enough of this channel's events\r
- if(end <= UINT(ltime)) // programme ends before LHS of window\r
- continue; // this event is before the window - let's try the next event\r
- // this event is one we are interested in\r
- bg = (swapColour)?Colour::PROGRAMMEA:Colour::PROGRAMMEB; // alternate cell colour\r
- swapColour = !swapColour; // it wil be the other colour next time\r
- if(event->time <= UINT(selTime) && end > UINT(selTime) && currentRow)\r
- {\r
- // this is the selected programme\r
- thisEvent.setdescription(event->description);\r
- thisEvent.duration = event->duration;\r
- thisEvent.time = event->time;\r
- thisEvent.settitle(event->title);\r
- thisEvent.id = event->id;\r
- if(thisEvent.id == 0)\r
- thisEvent.id = 1;\r
- bg = Colour::SELECTHIGHLIGHT; // highlight cell\r
- fg = Colour::DARKTEXT;\r
- }\r
- else\r
- {\r
- if (currentRow && thisEvent.id == 0)\r
- {\r
- if (end <= UINT(selTime) && end > UINT(thisEvent.time))\r
- thisEvent.time = end;\r
- if (event->time > UINT(selTime) && event->time < thisEvent.time + thisEvent.duration)\r
- thisEvent.duration = event->time - thisEvent.time;\r
- }\r
- }\r
- paintCell(event, y, bg, fg);\r
- }\r
+ if (event)\r
+ {\r
+ UINT end = event->time + event->duration; // programme end time\r
+ if(event->time >= UINT(ltime) + (WINDOW_WIDTH * 60)) // programme starts after RHS of window\r
+ continue; // that's enough of this channel's events\r
+ if(end <= UINT(ltime)) // programme ends before LHS of window\r
+ continue; // this event is before the window - let's try the next event\r
+ // this event is one we are interested in\r
+ bg = (swapColour)?Colour::PROGRAMMEA:Colour::PROGRAMMEB; // alternate cell colour\r
+ swapColour = !swapColour; // it wil be the other colour next time\r
+ if(event->time <= UINT(selTime) && end > UINT(selTime) && currentRow)\r
+ {\r
+ // this is the selected programme\r
+ thisEvent.setdescription(event->description);\r
+ thisEvent.duration = event->duration;\r
+ thisEvent.time = event->time;\r
+ thisEvent.settitle(event->title);\r
+ thisEvent.id = event->id;\r
+ if(thisEvent.id == 0)\r
+ thisEvent.id = 1;\r
+ bg = Colour::SELECTHIGHLIGHT; // highlight cell\r
+ fg = Colour::DARKTEXT;\r
+ }\r
+ else\r
+ {\r
+ if (currentRow && thisEvent.id == 0)\r
+ {\r
+ if (end <= UINT(selTime) && end > UINT(thisEvent.time))\r
+ thisEvent.time = end;\r
+ if (event->time > UINT(selTime) && event->time < thisEvent.time + thisEvent.duration)\r
+ thisEvent.duration = event->time - thisEvent.time;\r
+ }\r
+ }\r
+ paintCell(event, y, bg, fg);\r
+ }\r
}\r
}\r
else\r
{\r
- // no event list for this channel. Already painted noevent colour so just highlight if selected\r
+ // no event list for this channel. Already painted noevent colour so just highlight if selected\r
if (currentRow)\r
{\r
bg = Colour::SELECTHIGHLIGHT; // highlight cell\r
else\r
{\r
bg = Colour::NOPROGRAMME;\r
- fg = Colour::LIGHTTEXT;\r
- noevent.settitle("No programme details");\r
- paintCell(&noevent, y, bg, fg);\r
+ fg = Colour::LIGHTTEXT;\r
+ noevent.settitle(tr("No programme details"));\r
+ paintCell(&noevent, y, bg, fg);\r
}\r
}\r
y += Surface::getFontHeight() + 1;\r