/*
- Copyright 2004-2007 Chris Tallon, 2014 Marten Richter
+ Copyright 2004-2020 Chris Tallon, 2014 Marten Richter
This file is part of VOMP.
along with VOMP. If not, see <https://www.gnu.org/licenses/>.
*/
-#include "vepglistadvanced.h"
+#include <sstream>
#include "boxstack.h"
#include "input.h"
#include "vepg.h"
#include "staticartwork.h"
-#include <sstream>
-
+#include "vepglistadvanced.h"
-VEpgListAdvanced::VEpgListAdvanced(VVideoLiveTV *tvideolive, ChannelList* tchanList,ULONG initialChannelNumber)
+VEpgListAdvanced::VEpgListAdvanced(VVideoLiveTV* tvideolive, ChannelList* tchanList, ULONG initialChannelNumber)
{
- channelNumber = initialChannelNumber;
- chanList = tchanList;
- videolive = tvideolive;
- boxstack = BoxStack::getInstance();
+ channelNumber = initialChannelNumber;
+ chanList = tchanList;
+ videolive = tvideolive;
+ boxstack = BoxStack::getInstance();
- mode = OneChannel;
+ mode = OneChannel;
- setSize(640+40, 500+40); //old setSize(570, 420);
- createBuffer();
+ setSize(640 + 40, 500 + 40); //old setSize(570, 420);
+ createBuffer();
- setPosition(20, 20);
+ setPosition(20, 20);
- setTitleBarOn(1);
- setTitleBarColour(DrawStyle::TITLEBARBACKGROUND);
- TVMediaInfo *info= new TVMediaInfo();
- info->setChannelLogo(channelNumber);
- info->setStaticFallback(sa_tv);
- setTitleBarIcon(info);
+ setTitleBarOn(1);
+ setTitleBarColour(DrawStyle::TITLEBARBACKGROUND);
+ TVMediaInfo* info = new TVMediaInfo();
+ info->setChannelLogo(channelNumber);
+ info->setStaticFallback(sa_tv);
+ setTitleBarIcon(info);
- sl.setPosition(10, 30 + 5);
- sl.setSize(area.w*42/100 - 20, area.h - 30 - 15 - 30);
- sl.setLinesPerOption(2.4f);
- add(&sl);
+ sl.setPosition(10, 30 + 5);
+ sl.setSize(area.w * 42 / 100 - 20, area.h - 30 - 15 - 30);
+ sl.setLinesPerOption(2.4f);
+ add(&sl);
- Region slarea=sl.getRegionR();
+ Region slarea = sl.getRegionR();
- epg.setParaMode(true);
- epg.setPosition(slarea.x +slarea.w+10 ,30+5);
- epg.setSize(area.w -slarea.x -slarea.w -10, area.h - 30 - 15 - 30);
- add(&epg);
- epg.setText("");
- epg.setVideoBackground();
- epg.setBackgroundColour(DrawStyle::VIEWTRANSPARENTBACKGROUND);
+ epg.setParaMode(true);
+ epg.setPosition(slarea.x + slarea.w + 10, 30 + 5);
+ epg.setSize(area.w - slarea.x - slarea.w - 10, area.h - 30 - 15 - 30);
+ add(&epg);
+ epg.setText("");
+ epg.setVideoBackground();
+ epg.setBackgroundColour(DrawStyle::VIEWTRANSPARENTBACKGROUND);
- epgTVmedia.setPosition(epg.getRegionR().w-100-10,10);
- epgTVmedia.setSize(100,(UINT)(150/Osd::getInstance()->getPixelAspect()));
- epg.add(&epgTVmedia);
+ epgTVmedia.setPosition(epg.getRegionR().w - 100 - 10, 10);
+ epgTVmedia.setSize(100, (UINT)(150 / Osd::getInstance()->getPixelAspect()));
+ epg.add(&epgTVmedia);
- boxRed.setBackgroundColour(DrawStyle::RED);
- boxRed.setPosition(165 /*54*/, sl.getY2()+8);
- boxRed.setSize(18, 16);
- add(&boxRed);
+ boxRed.setBackgroundColour(DrawStyle::RED);
+ boxRed.setPosition(165 /*54*/, sl.getY2() + 8);
+ boxRed.setSize(18, 16);
+ add(&boxRed);
- textRed.setPosition(boxRed.getX2(), sl.getY2()+4);
- textRed.setSize(116, 30);
+ textRed.setPosition(boxRed.getX2(), sl.getY2() + 4);
+ textRed.setSize(116, 30);
- add(&textRed);
+ add(&textRed);
- boxGreen.setBackgroundColour(DrawStyle::GREEN);
- boxGreen.setPosition(165 +1*110, sl.getY2()+8);
- boxGreen.setSize(18, 16);
- add(&boxGreen);
+ boxGreen.setBackgroundColour(DrawStyle::GREEN);
+ boxGreen.setPosition(165 + 1 * 110, sl.getY2() + 8);
+ boxGreen.setSize(18, 16);
+ add(&boxGreen);
- textGreen.setPosition(boxGreen.getX2(), sl.getY2()+4);
- textGreen.setSize(116, 30);
- add(&textGreen);
+ textGreen.setPosition(boxGreen.getX2(), sl.getY2() + 4);
+ textGreen.setSize(116, 30);
+ add(&textGreen);
- boxYellow.setBackgroundColour(DrawStyle::YELLOW);
- boxYellow.setPosition(165 +2*110, sl.getY2()+8);
- boxYellow.setSize(18, 16);
- add(&boxYellow);
+ boxYellow.setBackgroundColour(DrawStyle::YELLOW);
+ boxYellow.setPosition(165 + 2 * 110, sl.getY2() + 8);
+ boxYellow.setSize(18, 16);
+ add(&boxYellow);
- textYellow.setPosition(boxYellow.getX2(), sl.getY2()+4);
- textYellow.setSize(116, 30);
- add(&textYellow);
+ textYellow.setPosition(boxYellow.getX2(), sl.getY2() + 4);
+ textYellow.setSize(116, 30);
+ add(&textYellow);
- boxBlue.setBackgroundColour(DrawStyle::BLUE);
- boxBlue.setPosition(165 +3*110, sl.getY2()+8);
- boxBlue.setSize(18, 16);
- add(&boxBlue);
+ boxBlue.setBackgroundColour(DrawStyle::BLUE);
+ boxBlue.setPosition(165 + 3 * 110, sl.getY2() + 8);
+ boxBlue.setSize(18, 16);
+ add(&boxBlue);
- textBlue.setPosition(boxBlue.getX2(), sl.getY2()+4);
- textBlue.setSize(116, 30);
- add(&textBlue);
+ textBlue.setPosition(boxBlue.getX2(), sl.getY2() + 4);
+ textBlue.setSize(116, 30);
+ add(&textBlue);
- setButtonText();
+ setButtonText();
-
- updateEpgDataChannel();
+ updateEpgDataChannel();
}
VEpgListAdvanced::~VEpgListAdvanced()
{
- clearEventList();
+ clearEventList();
}
-
void VEpgListAdvanced::setButtonText()
{
- switch (mode)
- {
- case OneChannel: {
- textRed.setText(tr("Record"));
- textGreen.setText(tr("Now"));
- textYellow.setText(tr("Next"));
- textBlue.setText(tr("Guide"));
-
- } break;
- case Now: {
- textRed.setText(tr("Record"));
- textGreen.setText(tr("Next"));
- textYellow.setText(tr("Schedule"));
- textBlue.setText(tr("Switch"));
- } break;
- case Next: {
- textRed.setText(tr("Record"));
- textGreen.setText(tr("Now"));
- textYellow.setText(tr("Schedule"));
- textBlue.setText(tr("Switch"));
- } break;
-
- };
+ switch (mode)
+ {
+ case OneChannel:
+ {
+ textRed.setText(tr("Record"));
+ textGreen.setText(tr("Now"));
+ textYellow.setText(tr("Next"));
+ textBlue.setText(tr("Guide"));
+ break;
+ }
+ case Now:
+ {
+ textRed.setText(tr("Record"));
+ textGreen.setText(tr("Next"));
+ textYellow.setText(tr("Schedule"));
+ textBlue.setText(tr("Switch"));
+ break;
+ }
+ case Next:
+ {
+ textRed.setText(tr("Record"));
+ textGreen.setText(tr("Now"));
+ textYellow.setText(tr("Schedule"));
+ textBlue.setText(tr("Switch"));
+ break;
+ }
+ };
}
void VEpgListAdvanced::doRed()
{
- doRecord();
+ doRecord();
}
void VEpgListAdvanced::doGreen()
{
- switch (mode)
- {
- case Now: {
- doNext();
- } break;
- case OneChannel:
- case Next: {
- doNow();
- } break;
- };
+ switch (mode)
+ {
+ case Now:
+ {
+ doNext();
+ break;
+ }
+ case OneChannel:
+ case Next:
+ {
+ doNow();
+ break;
+ }
+ };
}
void VEpgListAdvanced::doYellow()
{
- switch (mode)
- {
- case OneChannel: {
- doNext();
- } break;
- case Next:
- case Now: {
- doProgramm();
- } break;
- };
+ switch (mode)
+ {
+ case OneChannel:
+ {
+ doNext();
+ break;
+ }
+ case Next:
+ case Now:
+ {
+ doProgramm();
+ break;
+ }
+ };
}
void VEpgListAdvanced::doBlue()
{
- switch (mode)
- {
- case OneChannel: {
- doGrid();
- } break;
- case Next:
- case Now: {
- doSwitch();
- } break;
- };
+ switch (mode)
+ {
+ case OneChannel:
+ {
+ doGrid();
+ break;
+ }
+ case Next:
+ case Now:
+ {
+ doSwitch();
+ break;
+ }
+ };
}
void VEpgListAdvanced::doNext()
{
- Log::getInstance()->log("VEventListAdvanced", Log::DEBUG, "doNext");
- ULONG slCurrentOption = reinterpret_cast<ULONG>(sl.getCurrentOptionData());
- if (mode!=OneChannel) {
- Channel * chan=(*chanList)[slCurrentOption];
- channelNumber = chan->number;
- }
- mode=Next;
- updateEpgDataNowNext(true);
- setButtonText();
- TVMediaInfo *info= new TVMediaInfo();
- info->setStaticArtwork(sa_tv);
- setTitleBarIcon(info);
- draw(true);
- boxstack->update(this);
+ Log::getInstance()->log("VEventListAdvanced", Log::DEBUG, "doNext");
+ ULONG slCurrentOption = reinterpret_cast<ULONG>(sl.getCurrentOptionData());
+
+ if (mode != OneChannel)
+ {
+ Channel* chan = (*chanList)[slCurrentOption];
+ channelNumber = chan->number;
+ }
+
+ mode = Next;
+ updateEpgDataNowNext(true);
+ setButtonText();
+ TVMediaInfo* info = new TVMediaInfo();
+ info->setStaticArtwork(sa_tv);
+ setTitleBarIcon(info);
+ draw(true);
+ boxstack->update(this);
}
void VEpgListAdvanced::doNow()
{
- Log::getInstance()->log("VEventListAdvanced", Log::DEBUG, "doNow");
- ULONG slCurrentOption = reinterpret_cast<ULONG>(sl.getCurrentOptionData());
- if (mode!=OneChannel) {
- Channel * chan=(*chanList)[slCurrentOption];
- channelNumber = chan->number;
- }
- mode=Now;
- updateEpgDataNowNext(true);
- setButtonText();
- TVMediaInfo *info= new TVMediaInfo();
- info->setStaticArtwork(sa_tv);
- setTitleBarIcon(info);
- draw(true);
- boxstack->update(this);
+ Log::getInstance()->log("VEventListAdvanced", Log::DEBUG, "doNow");
+ ULONG slCurrentOption = reinterpret_cast<ULONG>(sl.getCurrentOptionData());
+
+ if (mode != OneChannel)
+ {
+ Channel* chan = (*chanList)[slCurrentOption];
+ channelNumber = chan->number;
+ }
+
+ mode = Now;
+ updateEpgDataNowNext(true);
+ setButtonText();
+ TVMediaInfo* info = new TVMediaInfo();
+ info->setStaticArtwork(sa_tv);
+ setTitleBarIcon(info);
+ draw(true);
+ boxstack->update(this);
}
void VEpgListAdvanced::doProgramm()
{
- Log::getInstance()->log("VEventListAdvanced", Log::DEBUG, "doProgram");
- mode=OneChannel;
- ULONG slCurrentOption = reinterpret_cast<ULONG>(sl.getCurrentOptionData());
- Channel * chan=(*chanList)[slCurrentOption];
- channelNumber = chan->number;
- updateEpgDataChannel();
- setButtonText();
- TVMediaInfo *info= new TVMediaInfo();
- info->setChannelLogo(channelNumber);
- info->setStaticFallback(sa_tv);
- setTitleBarIcon(info);
- draw(true);
- boxstack->update(this);
+ Log::getInstance()->log("VEventListAdvanced", Log::DEBUG, "doProgram");
+ mode = OneChannel;
+ ULONG slCurrentOption = reinterpret_cast<ULONG>(sl.getCurrentOptionData());
+ Channel* chan = (*chanList)[slCurrentOption];
+ channelNumber = chan->number;
+ updateEpgDataChannel();
+ setButtonText();
+ TVMediaInfo* info = new TVMediaInfo();
+ info->setChannelLogo(channelNumber);
+ info->setStaticFallback(sa_tv);
+ setTitleBarIcon(info);
+ draw(true);
+ boxstack->update(this);
}
void VEpgListAdvanced::doSwitch()
{
+ if (videolive)
+ {
+ if (mode != OneChannel)
+ {
+ ULONG slCurrentOption = reinterpret_cast<ULONG>(sl.getCurrentOptionData());
+ Channel* chan = (*chanList)[slCurrentOption];
+ channelNumber = chan->number;
+ }
- if (videolive)
- {
- if (mode!=OneChannel) {
- ULONG slCurrentOption = reinterpret_cast<ULONG>(sl.getCurrentOptionData());
- Channel * chan=(*chanList)[slCurrentOption];
- channelNumber = chan->number;
- }
- Log::getInstance()->log("VEventListAdvanced", Log::DEBUG, "doSwitch %d", channelNumber);
- Message* m = new Message(); // Must be done after this view deleted
- m->from = this;
- m->to = videolive;
- m->message = Message::CHANNEL_CHANGE;
- m->parameter = channelNumber;
- m->tag = 0;
- MessageQueue::getInstance()->postMessage(m);
- }
+ Log::getInstance()->log("VEventListAdvanced", Log::DEBUG, "doSwitch %d", channelNumber);
+ Message* m = new Message(); // Must be done after this view deleted
+ m->from = this;
+ m->to = videolive;
+ m->message = Message::CHANNEL_CHANGE;
+ m->parameter = channelNumber;
+ m->tag = 0;
+ MessageQueue::getInstance()->postMessage(m);
+ }
}
#if WIN32
-// FIXME win pragma
-#pragma warning(disable : 4703)
+ // FIXME win pragma
+ #pragma warning(disable : 4703)
#endif
void VEpgListAdvanced::doRecord()
{
- int channel;
- Event* current = getCurrentOptionEvent(channel);
- if (current)
- {
- Log::getInstance()->log("VEventListAdvanced", Log::DEBUG, "Found the option you pointed at. %s %d", current->title, current->id);
- unsigned int chanlistsize=chanList->size();
- Channel * chan;
- UINT listIndex;
- for(listIndex = 0; listIndex < chanlistsize; listIndex++)
- {
- chan = (*chanList)[listIndex];
- if ((int)chan->number == channel) break;
- }
+ int channel;
+ Event* current = getCurrentOptionEvent(channel);
+
+ if (current)
+ {
+ Log::getInstance()->log("VEventListAdvanced", Log::DEBUG, "Found the option you pointed at. %s %d", current->title, current->id);
+ unsigned int chanlistsize = chanList->size();
+ Channel* chan;
+ UINT listIndex;
- Log::getInstance()->log("VEpgSummary", Log::DEBUG, "ID %lu TIME %lu DURATION %lu TITLE %s", current->id, current->time,
- current->duration, current->title);
- VEpgSetTimer* vs = new VEpgSetTimer(current, chan);
- vs->draw();
- boxstack->add(vs);
- boxstack->update(vs);
- }
+ for (listIndex = 0; listIndex < chanlistsize; listIndex++)
+ {
+ chan = (*chanList)[listIndex];
+
+ if ((int)chan->number == channel) break;
+ }
+
+ Log::getInstance()->log("VEpgSummary", Log::DEBUG, "ID %lu TIME %lu DURATION %lu TITLE %s",
+ current->id, current->time, current->duration, current->title);
+ VEpgSetTimer* vs = new VEpgSetTimer(current, chan);
+ vs->draw();
+ boxstack->add(vs);
+ boxstack->update(vs);
+ }
}
void VEpgListAdvanced::doGrid()
{
+ if (mode != OneChannel)
+ {
+ ULONG slCurrentOption = reinterpret_cast<ULONG>(sl.getCurrentOptionData());
+ Channel* chan = (*chanList)[slCurrentOption];
+ channelNumber = chan->number;
+ }
- if (mode!=OneChannel) {
- ULONG slCurrentOption = reinterpret_cast<ULONG>(sl.getCurrentOptionData());
- Channel * chan=(*chanList)[slCurrentOption];
- channelNumber = chan->number;
- }
- UINT listIndex;
- unsigned int chanlistsize=chanList->size();
- Channel *chan;
- for(listIndex = 0; listIndex < chanlistsize; listIndex++)
- {
- chan = (*chanList)[listIndex];
- if (chan->number == channelNumber) break;
- }
+ UINT listIndex;
+ unsigned int chanlistsize = chanList->size();
+ Channel* chan;
- VEpg* vepg = new VEpg(videolive, listIndex, chanList);
- vepg->draw();
- boxstack->add(vepg);
- boxstack->update(vepg);
+ for (listIndex = 0; listIndex < chanlistsize; listIndex++)
+ {
+ chan = (*chanList)[listIndex];
+ if (chan->number == channelNumber) break;
+ }
+ VEpg* vepg = new VEpg(videolive, listIndex, chanList);
+ vepg->draw();
+ boxstack->add(vepg);
+ boxstack->update(vepg);
}
void VEpgListAdvanced::clearEventList()
{
- std::vector<EventList*>::iterator itty = eventLista.begin();
- while (itty!= eventLista.end()) {
- if (*itty) {
- (*itty)->clear();
- delete (*itty);
- }
- itty++;
- }
- eventLista.clear();
+ std::vector<EventList*>::iterator itty = eventLista.begin();
-}
+ while (itty != eventLista.end())
+ {
+ if (*itty)
+ {
+ (*itty)->clear();
+ delete (*itty);
+ }
+ itty++;
+ }
+
+ eventLista.clear();
+}
/* Prototype
*
void VEpgListAdvanced::updateEpgData()
{
- switch (mode)
- {
- case OneChannel: {
- //updateEpgDataChannel();
- } break;
- case Next:
- case Now: {
- updateEpgDataNowNext(false);
- } break;
- };
-
+ switch (mode)
+ {
+ case OneChannel:
+ {
+ //updateEpgDataChannel();
+ break;
+ }
+ case Next:
+ case Now:
+ {
+ updateEpgDataNowNext(false);
+ break;
+ }
+ };
}
void VEpgListAdvanced::updateEpgDataNowNext(bool changeState)
{
- int startupdate=0;
- int endupdate=0;
-
- unsigned int chanlistsize=chanList->size();
- if (changeState) {
- clearEventList();
- eventLista.resize(chanList->size());
- Channel* chan;
- for(UINT listIndex = 0; listIndex < chanlistsize; listIndex++)
- {
- if (listIndex < 0) continue;
- if (listIndex >= chanlistsize) continue;
- chan = (*chanList)[listIndex];
- if (chan->number == channelNumber) {
- startupdate = listIndex-sl.getNumOptionsDisplayable()-2;
- endupdate = listIndex+sl.getNumOptionsDisplayable()+2;
- break;
- }
- }
- } else {
- startupdate=sl.getTopOption()-2;
- endupdate=sl.getBottomOption()+1;
- }
+ int startupdate = 0;
+ int endupdate = 0;
- time_t now;
- time(&now);
+ unsigned int chanlistsize = chanList->size();
- Channel* chan;
- for(int listIndex = startupdate; listIndex < endupdate; listIndex++)
- {
- if (listIndex < 0) continue;
- if (listIndex >= (int)chanlistsize) continue;
+ if (changeState)
+ {
+ clearEventList();
+ eventLista.resize(chanList->size());
+ Channel* chan;
+
+ for (UINT listIndex = 0; listIndex < chanlistsize; listIndex++)
+ {
+ if (listIndex < 0) continue;
+ if (listIndex >= chanlistsize) continue;
+
+ chan = (*chanList)[listIndex];
+
+ if (chan->number == channelNumber)
+ {
+ startupdate = listIndex - sl.getNumOptionsDisplayable() - 2;
+ endupdate = listIndex + sl.getNumOptionsDisplayable() + 2;
+ break;
+ }
+ }
+ }
+ else
+ {
+ startupdate = sl.getTopOption() - 2;
+ endupdate = sl.getBottomOption() + 1;
+ }
- chan = (*chanList)[listIndex];
- if (!eventLista[listIndex]) eventLista[listIndex] = VDR::getInstance()->getChannelSchedule(chan->number, now, 4 * 60 *60);
+ time_t now;
+ time(&now);
- }
+ Channel* chan;
+ for (int listIndex = startupdate; listIndex < endupdate; listIndex++)
+ {
+ if (listIndex < 0) continue;
+ if (listIndex >= (int)chanlistsize) continue;
+
+ chan = (*chanList)[listIndex];
+
+ if (!eventLista[listIndex]) eventLista[listIndex] = VDR::getInstance()->getChannelSchedule(chan->number, now, 4 * 60 * 60);
+ }
}
void VEpgListAdvanced::updateEpgDataChannel()
{
- clearEventList();
- eventLista.resize(1);
- time_t now;
- time(&now);
- eventLista[0] = VDR::getInstance()->getChannelSchedule(channelNumber, now, 24 * 60 *60 *30); // one month
- Log::getInstance()->log("VEventListAdvanced", Log::DEBUG, "Eventlist %x %d", eventLista[0],channelNumber);
-
+ clearEventList();
+ eventLista.resize(1);
+ time_t now;
+ time(&now);
+ eventLista[0] = VDR::getInstance()->getChannelSchedule(channelNumber, now, 24 * 60 * 60 * 30); // one month
+ Log::getInstance()->log("VEventListAdvanced", Log::DEBUG, "Eventlist %x %d", eventLista[0], channelNumber);
}
void VEpgListAdvanced::drawData(bool doIndexPop)
{
- switch (mode)
- {
- case OneChannel: {
- drawDataChannel(doIndexPop);
- } break;
- case Next: {
- drawDataNowNext(true, doIndexPop);
- } break;
- case Now: {
- drawDataNowNext(false, doIndexPop);
- } break;
- };
+ switch (mode)
+ {
+ case OneChannel:
+ {
+ drawDataChannel(doIndexPop);
+ break;
+ }
+ case Next:
+ {
+ drawDataNowNext(true, doIndexPop);
+ break;
+ }
+ case Now:
+ {
+ drawDataNowNext(false, doIndexPop);
+ break;
+ }
+ };
}
sl.addColumn(0);
sl.addColumn(25 );
sl.addColumn(25 + 7);
- sl.addColumn(25 + 7+ 7);
+ sl.addColumn(25 + 7 + 7);
//sl.addColumn(118);
int first = 1;
char tempC[300]; // FIXME
struct tm btime;
-
-
-
Event* currentEvent = NULL;
EventList::iterator j;
EventList* eventList = eventLista[0];
- if (eventList) {
- for (j = eventList->begin(); j != eventList->end(); j++)
- {
- currentEvent = *j;
- time_t eventStartTime = (time_t)currentEvent->time;
- time_t eventEndTime = (time_t)(currentEvent->time + currentEvent->duration);
-
- LOCALTIME_R(&eventStartTime, &btime);
- strftime(tempA, 300, "%d/%m/%y %H:%M ", &btime);
- LOCALTIME_R(&eventEndTime, &btime);
- strftime(tempB, 300, "- %H:%M ", &btime);
- int check = SNPRINTF(tempC, 300, "\t %s\n \t \t%s%s", currentEvent->title,tempA,tempB);
- if ((check < 0) || (check > 299)) Log::getInstance()->log("VEventListAdvanced", Log::DEBUG, "String too big");
- // New TVMedia stuff
- TVMediaInfo *info= new TVMediaInfo();
- info->setPosterThumb(channelNumber, currentEvent->id);
- info->setStaticFallback(sa_defposter);
- currentEvent->index = sl.addOption(tempC, reinterpret_cast<void*>(currentEvent->id), first, info);
- first = 0;
- }
+
+ if (eventList)
+ {
+ for (j = eventList->begin(); j != eventList->end(); j++)
+ {
+ currentEvent = *j;
+ time_t eventStartTime = (time_t)currentEvent->time;
+ time_t eventEndTime = (time_t)(currentEvent->time + currentEvent->duration);
+
+ LOCALTIME_R(&eventStartTime, &btime);
+ strftime(tempA, 300, "%d/%m/%y %H:%M ", &btime);
+ LOCALTIME_R(&eventEndTime, &btime);
+ strftime(tempB, 300, "- %H:%M ", &btime);
+ int check = SNPRINTF(tempC, 300, "\t %s\n \t \t%s%s", currentEvent->title, tempA, tempB);
+
+ if ((check < 0) || (check > 299)) Log::getInstance()->log("VEventListAdvanced", Log::DEBUG, "String too big");
+
+ // New TVMedia stuff
+ TVMediaInfo* info = new TVMediaInfo();
+ info->setPosterThumb(channelNumber, currentEvent->id);
+ info->setStaticFallback(sa_defposter);
+ currentEvent->index = sl.addOption(tempC, reinterpret_cast<void*>(currentEvent->id), first, info);
+ first = 0;
+ }
}
if (doIndexPop)
sl.hintSetCurrent(saveIndex);
sl.hintSetTop(saveTop);
}
- updateSelection();
+ updateSelection();
}
void VEpgListAdvanced::drawDataNowNext(bool next, bool doIndexPop)
char tempC[300]; // FIXME
struct tm btime;
-
-
-
Event* currentEvent = NULL;
EventList::iterator j;
- int minevents=1;
+ int minevents = 1;
+
if (next) minevents++;
- int setcurrenthelper =0;
- unsigned int chanlistsize=chanList->size();
- for(UINT listIndex = 0; listIndex < chanlistsize; listIndex++)
+ int setcurrenthelper = 0;
+
+ unsigned int chanlistsize = chanList->size();
+
+ for (UINT listIndex = 0; listIndex < chanlistsize; listIndex++)
{
- Channel* chan;
- chan = (*chanList)[listIndex];
-
- EventList* eventList = eventLista[listIndex];
- if (eventList && ((int)eventList->size() >= minevents)) {
- j = eventList->begin();
-
- currentEvent = j[minevents-1];
- time_t eventStartTime = (time_t)currentEvent->time;
- time_t eventEndTime = (time_t)(currentEvent->time + currentEvent->duration);
-
- LOCALTIME_R(&eventStartTime, &btime);
- strftime(tempA, 300, "%H:%M ", &btime);
- LOCALTIME_R(&eventEndTime, &btime);
- strftime(tempB, 300, "- %H:%M ", &btime);
- int check = SNPRINTF(tempC, 300, "%s\n%s\t %s%s", currentEvent->title, chan->name,tempA,tempB);
- if ((check < 0) || (check > 299)) Log::getInstance()->log("VEventListAdvanced", Log::DEBUG, "String too big");
- } else {
- sprintf(tempC, "\n%s", chan->name);
-
- }
- TVMediaInfo *info= new TVMediaInfo();
- if ((*chanList)[listIndex]->number == channelNumber) {
- first = 1;
- setcurrenthelper = listIndex;
- }
- info->setChannelLogo((*chanList)[listIndex]->number);
- info->setStaticFallback(sa_tv);
- int index = sl.addOption(tempC, reinterpret_cast<void*>(listIndex), first, info);
- if (currentEvent) currentEvent->index = index;
- first = 0;
+ Channel* chan;
+ chan = (*chanList)[listIndex];
+
+ EventList* eventList = eventLista[listIndex];
+
+ if (eventList && ((int)eventList->size() >= minevents))
+ {
+ j = eventList->begin();
+
+ currentEvent = j[minevents - 1];
+ time_t eventStartTime = (time_t)currentEvent->time;
+ time_t eventEndTime = (time_t)(currentEvent->time + currentEvent->duration);
+
+ LOCALTIME_R(&eventStartTime, &btime);
+ strftime(tempA, 300, "%H:%M ", &btime);
+ LOCALTIME_R(&eventEndTime, &btime);
+ strftime(tempB, 300, "- %H:%M ", &btime);
+ int check = SNPRINTF(tempC, 300, "%s\n%s\t %s%s", currentEvent->title, chan->name, tempA, tempB);
+
+ if ((check < 0) || (check > 299)) Log::getInstance()->log("VEventListAdvanced", Log::DEBUG, "String too big");
+ }
+ else
+ {
+ sprintf(tempC, "\n%s", chan->name);
+ }
+
+ TVMediaInfo* info = new TVMediaInfo();
+
+ if ((*chanList)[listIndex]->number == channelNumber)
+ {
+ first = 1;
+ setcurrenthelper = listIndex;
+ }
+
+ info->setChannelLogo((*chanList)[listIndex]->number);
+ info->setStaticFallback(sa_tv);
+ int index = sl.addOption(tempC, reinterpret_cast<void*>(listIndex), first, info);
+
+ if (currentEvent) currentEvent->index = index;
+
+ first = 0;
}
if (doIndexPop)
sl.hintSetCurrent(saveIndex);
sl.hintSetTop(saveTop);
}
+
updateSelection();
}
void VEpgListAdvanced::draw(bool doIndexPop)
{
+ // Single channel mode
+ switch (mode)
+ {
+ case OneChannel:
+ {
+ char tempA[300];
+ unsigned int chanlistsize = chanList->size();
+ Channel* chan;
+ UINT listIndex;
- // Single channel mode
- switch (mode) {
- case OneChannel: {
- char tempA[300];
- unsigned int chanlistsize=chanList->size();
- Channel * chan;
- UINT listIndex;
- for(listIndex = 0; listIndex < chanlistsize; listIndex++)
- {
- chan = (*chanList)[listIndex];
- if (chan->number == channelNumber) break;
- }
- sprintf(tempA, tr("Schedule - %s"), (*chanList)[listIndex]->name);
- setTitleText(tempA);
- } break;
- case Now: {
- setTitleText(tr("Now"));
- } break;
- case Next: {
- setTitleText(tr("Next"));
- } break;
- };
-
-
-
- drawData(doIndexPop);
+ for (listIndex = 0; listIndex < chanlistsize; listIndex++)
+ {
+ chan = (*chanList)[listIndex];
- TBBoxx::draw();
+ if (chan->number == channelNumber) break;
+ }
+ sprintf(tempA, tr("Schedule - %s"), (*chanList)[listIndex]->name);
+ setTitleText(tempA);
+ break;
+ }
+ case Now:
+ {
+ setTitleText(tr("Now"));
+ break;
+ }
+ case Next:
+ {
+ setTitleText(tr("Next"));
+ break;
+ }
+ };
+ drawData(doIndexPop);
+ TBBoxx::draw();
+ char freeSpace[50];
+ struct tm btime;
+ time_t now;
+ time(&now);
+ LOCALTIME_R(&now, &btime);
+ strftime(freeSpace, 299, "%d/%m/%y", &btime);
+ drawTextRJ(freeSpace, getWidth(), 5, DrawStyle::LIGHTTEXT);
- char freeSpace[50];
- struct tm btime;
- time_t now;
- time(&now);
- LOCALTIME_R(&now, &btime);
- strftime(freeSpace, 299, "%d/%m/%y", &btime);
+ // Symbols
- drawTextRJ(freeSpace, getWidth(), 5, DrawStyle::LIGHTTEXT);
+ WSymbol w;
+ TEMPADD(&w);
- // Symbols
+ w.nextSymbol = WSymbol::UP;
+ w.setPosition(20, area.h - 35);
+ w.draw();
- WSymbol w;
- TEMPADD(&w);
- w.nextSymbol = WSymbol::UP;
- w.setPosition(20, area.h-35);
- w.draw();
- w.nextSymbol = WSymbol::DOWN;
- w.setPosition(50, area.h-35);
- w.draw();
- w.nextSymbol = WSymbol::SKIPBACK;
- w.setPosition(85, area.h-35);
- w.draw();
- w.nextSymbol = WSymbol::SKIPFORWARD;
- w.setPosition(115, area.h-35);
- w.draw();
+ w.nextSymbol = WSymbol::DOWN;
+ w.setPosition(50, area.h - 35);
+ w.draw();
- drawTextRJ(tr("[ok] = info"), 560+70, sl.getY2()+4, DrawStyle::LIGHTTEXT);
+ w.nextSymbol = WSymbol::SKIPBACK;
+ w.setPosition(85, area.h - 35);
+ w.draw();
- // All static stuff done
+ w.nextSymbol = WSymbol::SKIPFORWARD;
+ w.setPosition(115, area.h - 35);
+ w.draw();
+ drawTextRJ(tr("[ok] = info"), 560 + 70, sl.getY2() + 4, DrawStyle::LIGHTTEXT);
+ // All static stuff done
}
Event* VEpgListAdvanced::getCurrentOptionEvent(int& channel)
return currentEvent;
}
-
-
void VEpgListAdvanced::updateSelection()
{
- int channel=0;
- if (mode==OneChannel) {
- TVMediaInfo *info= new TVMediaInfo();
- info->setChannelLogo(channelNumber);
- info->setStaticFallback(sa_tv);
- setTitleBarIcon(info);
- }
- Event* toShow = getCurrentOptionEvent(channel);
- if (toShow)
- {
- toShow->loadinfos(channel);
- std::stringstream description;
+ int channel = 0;
- description << "\n"<< toShow->title << "\n\n";
- description << toShow->subtitle <<"\n";
- description << toShow->description;
+ if (mode == OneChannel)
+ {
+ TVMediaInfo* info = new TVMediaInfo();
+ info->setChannelLogo(channelNumber);
+ info->setStaticFallback(sa_tv);
+ setTitleBarIcon(info);
+ }
- TVMedia poster;
- poster.height=0;
- if (toShow->movieInfo) {
- poster=toShow->movieInfo->poster;
- }
- if (toShow->seriesInfo) {
- if (toShow->seriesInfo->seasonposter.height) {
- poster=toShow->seriesInfo->seasonposter;
- }
- else if (toShow->seriesInfo->posters.size()) {
- poster=toShow->seriesInfo->posters[0];
- }
- }
- if (poster.height) {
- epgTVmedia.setTVMedia(poster.info, WTVMedia::ZoomHorizontal);
- epgTVmedia.setVisible(true);
- } else {
- if (toShow->epgImage)
- {
- TVMediaInfo info;
- info.setPosterThumb(channel,toShow->id);
- epgTVmedia.setTVMedia(info, WTVMedia::ZoomHorizontal);
- epgTVmedia.setVisible(true);
- }else if (mode!=OneChannel) {
- TVMediaInfo info;
- info.setChannelLogo(channel);
- epgTVmedia.setTVMedia(info, WTVMedia::ZoomHorizontal);
- epgTVmedia.setVisible(true);
- } else {
- epgTVmedia.setVisible(false);
- }
- }
+ Event* toShow = getCurrentOptionEvent(channel);
- epg.setText(description.str().c_str());
- } else {
- epg.setText("");
- if (mode!=OneChannel) {
- TVMediaInfo info;
- info.setChannelLogo(channel);
- epgTVmedia.setTVMedia(info, WTVMedia::ZoomHorizontal);
- epgTVmedia.setVisible(true);
- } else {
- epgTVmedia.setVisible(false);
- }
- }
+ if (toShow)
+ {
+ toShow->loadinfos(channel);
+ std::stringstream description;
+
+ description << "\n" << toShow->title << "\n\n";
+ description << toShow->subtitle << "\n";
+ description << toShow->description;
+
+ TVMedia poster;
+ poster.height = 0;
+
+ if (toShow->movieInfo)
+ {
+ poster = toShow->movieInfo->poster;
+ }
+
+ if (toShow->seriesInfo)
+ {
+ if (toShow->seriesInfo->seasonposter.height)
+ {
+ poster = toShow->seriesInfo->seasonposter;
+ }
+ else if (toShow->seriesInfo->posters.size())
+ {
+ poster = toShow->seriesInfo->posters[0];
+ }
+ }
+
+ if (poster.height)
+ {
+ epgTVmedia.setTVMedia(poster.info, WTVMedia::ZoomHorizontal);
+ epgTVmedia.setVisible(true);
+ }
+ else
+ {
+ if (toShow->epgImage)
+ {
+ TVMediaInfo info;
+ info.setPosterThumb(channel, toShow->id);
+ epgTVmedia.setTVMedia(info, WTVMedia::ZoomHorizontal);
+ epgTVmedia.setVisible(true);
+ }
+ else if (mode != OneChannel)
+ {
+ TVMediaInfo info;
+ info.setChannelLogo(channel);
+ epgTVmedia.setTVMedia(info, WTVMedia::ZoomHorizontal);
+ epgTVmedia.setVisible(true);
+ }
+ else
+ {
+ epgTVmedia.setVisible(false);
+ }
+ }
+ epg.setText(description.str().c_str());
+ }
+ else
+ {
+ epg.setText("");
+
+ if (mode != OneChannel)
+ {
+ TVMediaInfo info;
+ info.setChannelLogo(channel);
+ epgTVmedia.setTVMedia(info, WTVMedia::ZoomHorizontal);
+ epgTVmedia.setVisible(true);
+ }
+ else
+ {
+ epgTVmedia.setVisible(false);
+ }
+ }
}
int VEpgListAdvanced::handleCommand(int command)
{
- switch(command)
+ switch (command)
{
case Input::UP:
{
boxstack->update(this);
return 2;
}
+
case Input::DOWN:
{
sl.down();
boxstack->update(this);
return 2;
}
+
case Input::SKIPBACK:
{
sl.pageUp();
boxstack->update(this);
return 2;
}
+
case Input::SKIPFORWARD:
{
sl.pageDown();
boxstack->update(this);
return 2;
}
+
case Input::RED:
{
- doRed();
- return 2;
+ doRed();
+ return 2;
}
+
case Input::GREEN:
{
- doGreen();
- return 2;
+ doGreen();
+ return 2;
}
+
case Input::YELLOW:
{
- doYellow();
- return 2;
+ doYellow();
+ return 2;
}
+
case Input::BLUE:
{
- doBlue();
- return 2;
+ doBlue();
+ return 2;
}
+
case Input::OK:
{
if (sl.getNumOptions() == 0) return 2;
-
int channel;
Event* current = getCurrentOptionEvent(channel);
+
if (current)
{
- Log::getInstance()->log("VEventListAdvanced", Log::DEBUG, "Found the option you pointed at. %s %d", current->title, current->id);
- unsigned int chanlistsize=chanList->size();
- Channel * chan;
- UINT listIndex;
- for(listIndex = 0; listIndex < chanlistsize; listIndex++)
- {
- chan = (*chanList)[listIndex];
- if ((int)chan->number == channel) break;
- }
-
- VEpgSummary* vr = new VEpgSummary(current, (*chanList)[listIndex]);
- vr->draw();
- boxstack->add(vr);
- boxstack->update(vr);
-
- return 2;
+ Log::getInstance()->log("VEventListAdvanced", Log::DEBUG, "Found the option you pointed at. %s %d", current->title, current->id);
+ unsigned int chanlistsize = chanList->size();
+ Channel* chan;
+ UINT listIndex;
+
+ for (listIndex = 0; listIndex < chanlistsize; listIndex++)
+ {
+ chan = (*chanList)[listIndex];
+ if ((int)chan->number == channel) break;
+ }
+
+ VEpgSummary* vr = new VEpgSummary(current, (*chanList)[listIndex]);
+ vr->draw();
+ boxstack->add(vr);
+ boxstack->update(vr);
+
+ return 2;
}
+
// should not get to here
return 1;
}
+
case Input::BACK:
{
- return 4;
+ return 4;
}
}
+
// stop command getting to any more views
return 1;
}
if (m->message == Message::MOUSE_MOVE)
{
- if (sl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
+ if (sl.mouseMove((m->parameter >> 16) - getScreenX(), (m->parameter & 0xFFFF) - getScreenY()))
{
quickUpdate();
boxstack->update(this);
}
else if (m->message == Message::MOUSE_LBDOWN)
{
- if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
+ if (sl.mouseLBDOWN((m->parameter >> 16) - getScreenX(), (m->parameter & 0xFFFF) - getScreenY()))
{
boxstack->handleCommand(Input::OK); //simulate OK press
}
- else if (boxRed.mouseLBDOWN((m->parameter >> 16) - getScreenX(), (m->parameter & 0xFFFF) - getScreenY()))
- {
- boxstack->handleCommand(Input::RED);
- }
- else if (boxGreen.mouseLBDOWN((m->parameter >> 16) - getScreenX(), (m->parameter & 0xFFFF) - getScreenY()))
- {
- boxstack->handleCommand(Input::GREEN);
- }
- else if (boxYellow.mouseLBDOWN((m->parameter >> 16) - getScreenX(), (m->parameter & 0xFFFF) - getScreenY()))
- {
- boxstack->handleCommand(Input::GREEN);
- }
- else if (boxBlue.mouseLBDOWN((m->parameter >> 16) - getScreenX(), (m->parameter & 0xFFFF) - getScreenY()))
- {
- boxstack->handleCommand(Input::GREEN);
- }
+ else if (boxRed.mouseLBDOWN((m->parameter >> 16) - getScreenX(), (m->parameter & 0xFFFF) - getScreenY()))
+ {
+ boxstack->handleCommand(Input::RED);
+ }
+ else if (boxGreen.mouseLBDOWN((m->parameter >> 16) - getScreenX(), (m->parameter & 0xFFFF) - getScreenY()))
+ {
+ boxstack->handleCommand(Input::GREEN);
+ }
+ else if (boxYellow.mouseLBDOWN((m->parameter >> 16) - getScreenX(), (m->parameter & 0xFFFF) - getScreenY()))
+ {
+ boxstack->handleCommand(Input::GREEN);
+ }
+ else if (boxBlue.mouseLBDOWN((m->parameter >> 16) - getScreenX(), (m->parameter & 0xFFFF) - getScreenY()))
+ {
+ boxstack->handleCommand(Input::GREEN);
+ }
else
{
if (coordsOutsideBox(m))
}
}
-
-
-void VEpgListAdvanced::quickUpdate() { //only quick for plattform that need it!
- updateEpgData();
- updateSelection();
+void VEpgListAdvanced::quickUpdate() //only quick for plattform that need it!
+{
+ updateEpgData();
+ updateSelection();
#ifdef GRADIENT_DRAWING
- draw();
+ draw();
#else
- sl.draw();
- epg.draw();
+ sl.draw();
+ epg.draw();
#endif
}