2013-12-07 15:51:50 +01:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <vector>
|
2013-01-17 13:16:44 +01:00
|
|
|
|
2013-12-07 15:51:50 +01:00
|
|
|
#include "config.h"
|
2013-07-17 16:43:57 +02:00
|
|
|
#include "services/epgsearch.h"
|
2013-07-20 13:46:26 +02:00
|
|
|
#include "services/remotetimers.h"
|
2013-12-07 15:51:50 +01:00
|
|
|
|
|
|
|
#include "tools.h"
|
|
|
|
#include "setup.h"
|
2013-01-17 13:16:44 +01:00
|
|
|
|
|
|
|
#include "tvguideosd.h"
|
|
|
|
|
|
|
|
cTvGuideOsd::cTvGuideOsd(void) {
|
2013-05-26 11:38:05 +02:00
|
|
|
detailView = NULL;
|
|
|
|
detailViewActive = false;
|
2013-05-20 11:37:37 +02:00
|
|
|
activeGrid = NULL;
|
2013-05-26 11:38:05 +02:00
|
|
|
timeLine = NULL;
|
2013-07-09 00:17:42 +02:00
|
|
|
recMenuManager = NULL;
|
2013-12-23 09:12:19 +01:00
|
|
|
channelJumper = NULL;
|
2013-01-17 13:16:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
cTvGuideOsd::~cTvGuideOsd() {
|
2013-05-26 11:38:05 +02:00
|
|
|
delete myTime;
|
|
|
|
columns.Clear();
|
2013-05-20 11:37:37 +02:00
|
|
|
if (tvguideConfig.displayStatusHeader) {
|
|
|
|
delete statusHeader;
|
2013-05-26 11:38:05 +02:00
|
|
|
}
|
2013-05-20 11:37:37 +02:00
|
|
|
if (detailView)
|
2013-05-26 11:38:05 +02:00
|
|
|
delete detailView;
|
|
|
|
delete timeLine;
|
2013-05-31 13:58:22 +02:00
|
|
|
delete channelGroups;
|
2013-05-26 11:38:05 +02:00
|
|
|
delete footer;
|
2013-07-09 00:17:42 +02:00
|
|
|
delete recMenuManager;
|
2013-12-23 09:12:19 +01:00
|
|
|
if (channelJumper)
|
|
|
|
delete channelJumper;
|
2013-05-26 11:38:05 +02:00
|
|
|
osdManager.deleteOsd();
|
2013-01-17 13:16:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void cTvGuideOsd::Show(void) {
|
2013-05-26 11:38:05 +02:00
|
|
|
int start = cTimeMs::Now();
|
|
|
|
bool ok = false;
|
|
|
|
ok = osdManager.setOsd();
|
|
|
|
if (ok) {
|
2013-12-21 11:25:03 +01:00
|
|
|
bool themeChanged = tvguideConfig.LoadTheme();
|
|
|
|
tvguideConfig.SetStyle();
|
|
|
|
tvguideConfig.setDynamicValues();
|
|
|
|
bool geoChanged = geoManager.SetGeometry(cOsd::OsdWidth(), cOsd::OsdHeight());
|
|
|
|
if (themeChanged || geoChanged) {
|
|
|
|
fontManager.DeleteFonts();
|
|
|
|
fontManager.SetFonts();
|
|
|
|
imgCache.Clear();
|
|
|
|
imgCache.CreateCache();
|
|
|
|
}
|
2013-05-26 11:38:05 +02:00
|
|
|
osdManager.setBackground();
|
|
|
|
myTime = new cMyTime();
|
|
|
|
myTime->Now();
|
2013-07-09 00:17:42 +02:00
|
|
|
SwitchTimers.Load(AddDirectory(cPlugin::ConfigDirectory("epgsearch"), "epgsearchswitchtimers.conf"));
|
|
|
|
recMenuManager = new cRecMenuManager();
|
2013-07-20 13:46:26 +02:00
|
|
|
pRemoteTimers = cPluginManager::CallFirstService("RemoteTimers::RefreshTimers-v1.0", NULL);
|
|
|
|
if (pRemoteTimers) {
|
|
|
|
isyslog("tvguide: remotetimers-plugin is available");
|
|
|
|
}
|
|
|
|
if (tvguideConfig.useRemoteTimers && pRemoteTimers) {
|
|
|
|
cString errorMsg;
|
|
|
|
if (!pRemoteTimers->Service("RemoteTimers::RefreshTimers-v1.0", &errorMsg)) {
|
|
|
|
esyslog("tvguide: %s", *errorMsg);
|
|
|
|
}
|
|
|
|
}
|
2013-05-26 11:38:05 +02:00
|
|
|
drawOsd();
|
|
|
|
}
|
|
|
|
esyslog("tvguide: Rendering took %d ms", int(cTimeMs::Now()-start));
|
2013-01-17 13:16:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void cTvGuideOsd::drawOsd() {
|
2013-05-26 11:38:05 +02:00
|
|
|
cPixmap::Lock();
|
2018-03-08 13:30:41 +01:00
|
|
|
#if VDRVERSNUM >= 20301
|
2018-03-08 13:02:38 +01:00
|
|
|
LOCK_CHANNELS_READ;
|
|
|
|
const cChannel *startChannel = Channels->GetByNumber(cDevice::CurrentChannel());
|
|
|
|
#else
|
2013-05-26 11:38:05 +02:00
|
|
|
cChannel *startChannel = Channels.GetByNumber(cDevice::CurrentChannel());
|
2018-03-08 13:02:38 +01:00
|
|
|
#endif
|
2014-01-02 11:45:43 +01:00
|
|
|
int numBack = tvguideConfig.numGrids / 2;
|
|
|
|
int offset = 0;
|
|
|
|
const cChannel *newStartChannel = startChannel;
|
2018-03-08 13:30:41 +01:00
|
|
|
#if VDRVERSNUM >= 20301
|
2018-03-08 13:02:38 +01:00
|
|
|
for (; newStartChannel ; newStartChannel = Channels->Prev(newStartChannel)) {
|
|
|
|
#else
|
2014-01-02 11:45:43 +01:00
|
|
|
for (; newStartChannel ; newStartChannel = Channels.Prev(newStartChannel)) {
|
2018-03-08 13:02:38 +01:00
|
|
|
#endif
|
2014-01-02 11:45:43 +01:00
|
|
|
if (newStartChannel && !newStartChannel->GroupSep()) {
|
|
|
|
offset++;
|
|
|
|
}
|
|
|
|
if (offset == numBack)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (!newStartChannel)
|
2018-03-08 13:30:41 +01:00
|
|
|
#if VDRVERSNUM >= 20301
|
2018-03-08 13:02:38 +01:00
|
|
|
newStartChannel = Channels->First();
|
|
|
|
#else
|
2014-01-02 11:45:43 +01:00
|
|
|
newStartChannel = Channels.First();
|
2018-03-08 13:02:38 +01:00
|
|
|
#endif
|
2014-01-02 11:45:43 +01:00
|
|
|
offset--;
|
|
|
|
if (offset < 0)
|
|
|
|
offset = 0;
|
|
|
|
|
2013-05-20 11:37:37 +02:00
|
|
|
if (tvguideConfig.displayStatusHeader) {
|
|
|
|
statusHeader = new cStatusHeader();
|
2013-12-21 11:25:03 +01:00
|
|
|
statusHeader->Draw();
|
2013-05-20 11:37:37 +02:00
|
|
|
statusHeader->ScaleVideo();
|
|
|
|
}
|
2013-05-26 11:38:05 +02:00
|
|
|
timeLine = new cTimeLine(myTime);
|
|
|
|
timeLine->drawDateViewer();
|
|
|
|
timeLine->drawTimeline();
|
|
|
|
timeLine->drawClock();
|
2013-05-31 13:58:22 +02:00
|
|
|
channelGroups = new cChannelGroups();
|
|
|
|
channelGroups->ReadChannelGroups();
|
|
|
|
footer = new cFooter(channelGroups);
|
2014-01-11 16:53:23 +01:00
|
|
|
recMenuManager->SetFooter(footer);
|
2013-05-26 11:38:05 +02:00
|
|
|
footer->drawRedButton();
|
2013-05-31 13:58:22 +02:00
|
|
|
if (tvguideConfig.channelJumpMode == eNumJump) {
|
|
|
|
footer->drawGreenButton();
|
|
|
|
footer->drawYellowButton();
|
|
|
|
}
|
2014-01-14 18:00:32 +01:00
|
|
|
footer->drawBlueButton(false);
|
2013-05-26 11:38:05 +02:00
|
|
|
osdManager.flush();
|
2014-01-02 11:45:43 +01:00
|
|
|
readChannels(newStartChannel);
|
|
|
|
drawGridsChannelJump(offset);
|
2013-05-26 11:38:05 +02:00
|
|
|
osdManager.flush();
|
|
|
|
cPixmap::Unlock();
|
2013-01-17 13:16:44 +01:00
|
|
|
}
|
|
|
|
|
2013-05-20 11:37:37 +02:00
|
|
|
void cTvGuideOsd::readChannels(const cChannel *channelStart) {
|
2013-05-26 11:38:05 +02:00
|
|
|
int i=0;
|
2013-05-31 13:58:22 +02:00
|
|
|
bool foundEnough = false;
|
2013-05-26 11:38:05 +02:00
|
|
|
columns.Clear();
|
|
|
|
if (!channelStart)
|
|
|
|
return;
|
2018-03-08 13:30:41 +01:00
|
|
|
#if VDRVERSNUM >= 20301
|
2018-03-08 13:02:38 +01:00
|
|
|
LOCK_CHANNELS_READ;
|
|
|
|
for (const cChannel *channel = channelStart; channel; channel = Channels->Next(channel)) {
|
|
|
|
#else
|
2013-05-26 11:38:05 +02:00
|
|
|
for (const cChannel *channel = channelStart; channel; channel = Channels.Next(channel)) {
|
2018-03-08 13:02:38 +01:00
|
|
|
#endif
|
2013-05-31 13:58:22 +02:00
|
|
|
if (!channel->GroupSep()) {
|
|
|
|
if (channelGroups->IsInLastGroup(channel)) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
cChannelColumn *column = new cChannelColumn(i, channel, myTime);
|
|
|
|
if (column->readGrids()) {
|
|
|
|
columns.Add(column);
|
|
|
|
i++;
|
|
|
|
} else {
|
|
|
|
delete column;
|
|
|
|
}
|
2013-05-26 11:38:05 +02:00
|
|
|
}
|
2013-05-31 13:58:22 +02:00
|
|
|
if (i == tvguideConfig.numGrids) {
|
|
|
|
foundEnough = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!foundEnough) {
|
|
|
|
int numCurrent = columns.Count();
|
|
|
|
int numBack = tvguideConfig.numGrids - numCurrent;
|
|
|
|
int newChannelNumber = columns.First()->getChannel()->Number() - numBack;
|
2018-03-08 13:30:41 +01:00
|
|
|
#if VDRVERSNUM >= 20301
|
2018-03-08 13:02:38 +01:00
|
|
|
const cChannel *newStart = Channels->GetByNumber(newChannelNumber);
|
|
|
|
#else
|
2013-05-31 13:58:22 +02:00
|
|
|
const cChannel *newStart = Channels.GetByNumber(newChannelNumber);
|
2018-03-08 13:02:38 +01:00
|
|
|
#endif
|
2013-05-31 13:58:22 +02:00
|
|
|
readChannels(newStart);
|
2013-01-17 13:16:44 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-15 17:27:55 +02:00
|
|
|
void cTvGuideOsd::drawGridsChannelJump(int offset) {
|
2013-05-26 11:38:05 +02:00
|
|
|
if (columns.Count() == 0)
|
|
|
|
return;
|
2013-07-15 17:27:55 +02:00
|
|
|
activeGrid = columns.Get(offset)->getActive();
|
2013-05-26 11:38:05 +02:00
|
|
|
if (activeGrid)
|
|
|
|
activeGrid->SetActive();
|
2013-05-20 11:37:37 +02:00
|
|
|
if (tvguideConfig.displayStatusHeader) {
|
|
|
|
statusHeader->DrawInfoText(activeGrid);
|
2013-05-26 11:38:05 +02:00
|
|
|
}
|
2013-05-31 13:58:22 +02:00
|
|
|
if (activeGrid && (tvguideConfig.channelJumpMode == eGroupJump)) {
|
|
|
|
footer->UpdateGroupButtons(activeGrid->column->getChannel());
|
|
|
|
}
|
|
|
|
if (tvguideConfig.displayChannelGroups) {
|
|
|
|
channelGroups->DrawChannelGroups(columns.First()->getChannel(), columns.Last()->getChannel());
|
|
|
|
}
|
2013-05-20 11:37:37 +02:00
|
|
|
for (cChannelColumn *column = columns.First(); column; column = columns.Next(column)) {
|
2013-05-26 11:38:05 +02:00
|
|
|
column->createHeader();
|
|
|
|
column->drawGrids();
|
|
|
|
}
|
2013-01-17 13:16:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void cTvGuideOsd::drawGridsTimeJump() {
|
2013-05-26 11:38:05 +02:00
|
|
|
if (columns.Count() == 0)
|
|
|
|
return;
|
|
|
|
cChannelColumn *colActive = NULL;
|
|
|
|
if (activeGrid) {
|
|
|
|
colActive = activeGrid->column;
|
|
|
|
} else {
|
|
|
|
colActive = columns.First();
|
|
|
|
}
|
|
|
|
for (cChannelColumn *column = columns.First(); column; column = columns.Next(column)) {
|
|
|
|
column->clearGrids();
|
|
|
|
column->readGrids();
|
|
|
|
column->drawGrids();
|
|
|
|
}
|
|
|
|
activeGrid = colActive->getActive();
|
|
|
|
if (activeGrid) {
|
|
|
|
activeGrid->SetActive();
|
|
|
|
activeGrid->Draw();
|
2013-05-20 11:37:37 +02:00
|
|
|
if (tvguideConfig.displayStatusHeader) {
|
|
|
|
statusHeader->DrawInfoText(activeGrid);
|
|
|
|
}
|
2013-05-26 11:38:05 +02:00
|
|
|
}
|
2013-01-17 13:16:44 +01:00
|
|
|
}
|
|
|
|
|
2013-05-20 11:37:37 +02:00
|
|
|
void cTvGuideOsd::setNextActiveGrid(cGrid *next) {
|
2013-05-26 11:38:05 +02:00
|
|
|
if (!next || !activeGrid) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
activeGrid->SetInActive();
|
|
|
|
activeGrid->Draw();
|
|
|
|
activeGrid = next;
|
|
|
|
activeGrid->SetActive();
|
|
|
|
activeGrid->Draw();
|
2013-05-20 11:37:37 +02:00
|
|
|
if (tvguideConfig.displayStatusHeader) {
|
|
|
|
statusHeader->DrawInfoText(activeGrid);
|
|
|
|
}
|
2013-01-17 13:16:44 +01:00
|
|
|
}
|
|
|
|
|
2013-05-24 16:23:23 +02:00
|
|
|
void cTvGuideOsd::channelForward() {
|
|
|
|
cChannelColumn *colRight = columns.Next(activeGrid->column);
|
2013-05-31 13:58:22 +02:00
|
|
|
bool colAdded = false;
|
2013-05-26 11:38:05 +02:00
|
|
|
if (!colRight) {
|
|
|
|
const cChannel *channelRight = activeGrid->column->getChannel();
|
2018-03-08 13:30:41 +01:00
|
|
|
#if VDRVERSNUM >= 20301
|
2018-03-08 13:02:38 +01:00
|
|
|
LOCK_CHANNELS_READ;
|
|
|
|
while (channelRight = Channels->Next(channelRight)) {
|
|
|
|
#else
|
2013-05-26 11:38:05 +02:00
|
|
|
while (channelRight = Channels.Next(channelRight)) {
|
2018-03-08 13:02:38 +01:00
|
|
|
#endif
|
2013-05-26 11:38:05 +02:00
|
|
|
if (!channelRight->GroupSep()) {
|
2013-05-31 13:58:22 +02:00
|
|
|
if (channelGroups->IsInLastGroup(channelRight)) {
|
|
|
|
break;
|
|
|
|
}
|
2013-05-26 11:38:05 +02:00
|
|
|
colRight = new cChannelColumn(tvguideConfig.numGrids - 1, channelRight, myTime);
|
|
|
|
if (colRight->readGrids()) {
|
|
|
|
break;
|
|
|
|
} else {
|
|
|
|
delete colRight;
|
|
|
|
colRight = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (colRight) {
|
2013-05-31 13:58:22 +02:00
|
|
|
colAdded = true;
|
2013-05-26 11:38:05 +02:00
|
|
|
if (columns.Count() == tvguideConfig.numGrids) {
|
|
|
|
cChannelColumn *cFirst = columns.First();
|
|
|
|
columns.Del(cFirst);
|
|
|
|
}
|
|
|
|
for (cChannelColumn *column = columns.First(); column; column = columns.Next(column)) {
|
|
|
|
column->SetNum(column->GetNum() - 1);
|
|
|
|
column->drawHeader();
|
|
|
|
column->drawGrids();
|
|
|
|
}
|
|
|
|
columns.Add(colRight);
|
|
|
|
colRight->createHeader();
|
|
|
|
colRight->drawGrids();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (colRight) {
|
|
|
|
cGrid *right = colRight->getNeighbor(activeGrid);
|
|
|
|
if (right) {
|
|
|
|
setNextActiveGrid(right);
|
|
|
|
}
|
|
|
|
}
|
2013-05-31 13:58:22 +02:00
|
|
|
if (tvguideConfig.displayChannelGroups && colAdded) {
|
|
|
|
channelGroups->DrawChannelGroups(columns.First()->getChannel(), columns.Last()->getChannel());
|
|
|
|
}
|
|
|
|
if (activeGrid && (tvguideConfig.channelJumpMode == eGroupJump)) {
|
|
|
|
footer->UpdateGroupButtons(activeGrid->column->getChannel());
|
|
|
|
}
|
2013-05-26 11:38:05 +02:00
|
|
|
osdManager.flush();
|
2013-01-17 13:16:44 +01:00
|
|
|
}
|
|
|
|
|
2013-05-24 16:23:23 +02:00
|
|
|
void cTvGuideOsd::channelBack() {
|
2013-05-26 11:38:05 +02:00
|
|
|
cChannelColumn *colLeft = columns.Prev(activeGrid->column);
|
2013-05-31 13:58:22 +02:00
|
|
|
bool colAdded = false;
|
2013-05-26 11:38:05 +02:00
|
|
|
if (!colLeft) {
|
|
|
|
const cChannel *channelLeft = activeGrid->column->getChannel();
|
2018-03-08 13:30:41 +01:00
|
|
|
#if VDRVERSNUM >= 20301
|
2018-03-08 13:02:38 +01:00
|
|
|
LOCK_CHANNELS_READ;
|
|
|
|
while (channelLeft = Channels->Prev(channelLeft)) {
|
|
|
|
#else
|
2013-05-26 11:38:05 +02:00
|
|
|
while (channelLeft = Channels.Prev(channelLeft)) {
|
2018-03-08 13:02:38 +01:00
|
|
|
#endif
|
2013-05-26 11:38:05 +02:00
|
|
|
if (!channelLeft->GroupSep()) {
|
|
|
|
colLeft = new cChannelColumn(0, channelLeft, myTime);
|
|
|
|
if (colLeft->readGrids()) {
|
|
|
|
break;
|
|
|
|
} else {
|
|
|
|
delete colLeft;
|
|
|
|
colLeft = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (colLeft) {
|
2013-05-31 13:58:22 +02:00
|
|
|
colAdded = true;
|
2013-05-26 11:38:05 +02:00
|
|
|
if (columns.Count() == tvguideConfig.numGrids) {
|
|
|
|
cChannelColumn *cLast = columns.Last();
|
|
|
|
columns.Del(cLast);
|
|
|
|
}
|
|
|
|
for (cChannelColumn *column = columns.First(); column; column = columns.Next(column)) {
|
|
|
|
column->SetNum(column->GetNum() + 1);
|
|
|
|
column->drawHeader();
|
|
|
|
column->drawGrids();
|
|
|
|
}
|
|
|
|
columns.Ins(colLeft, columns.First());
|
|
|
|
colLeft->createHeader();
|
|
|
|
colLeft->drawGrids();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (colLeft) {
|
|
|
|
cGrid *left = colLeft->getNeighbor(activeGrid);
|
|
|
|
if (left) {
|
|
|
|
setNextActiveGrid(left);
|
|
|
|
}
|
|
|
|
}
|
2013-05-31 13:58:22 +02:00
|
|
|
if (tvguideConfig.displayChannelGroups && colAdded) {
|
|
|
|
channelGroups->DrawChannelGroups(columns.First()->getChannel(), columns.Last()->getChannel());
|
|
|
|
}
|
|
|
|
|
|
|
|
if (activeGrid && (tvguideConfig.channelJumpMode == eGroupJump)) {
|
|
|
|
footer->UpdateGroupButtons(activeGrid->column->getChannel());
|
|
|
|
}
|
2013-05-26 11:38:05 +02:00
|
|
|
osdManager.flush();
|
2013-01-17 13:16:44 +01:00
|
|
|
}
|
|
|
|
|
2013-05-24 16:23:23 +02:00
|
|
|
void cTvGuideOsd::timeForward() {
|
|
|
|
bool actionDone = false;
|
|
|
|
if ( (myTime->GetEnd() - activeGrid->EndTime())/60 < 30 ) {
|
|
|
|
ScrollForward();
|
|
|
|
actionDone = true;
|
|
|
|
}
|
|
|
|
cGrid *next = activeGrid->column->getNext(activeGrid);
|
|
|
|
if (next) {
|
|
|
|
if ( (next->EndTime() < myTime->GetEnd())
|
|
|
|
|| ( (myTime->GetEnd() - next->StartTime())/60 > 30 ) ) {
|
|
|
|
setNextActiveGrid(next);
|
|
|
|
actionDone = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!actionDone) {
|
|
|
|
ScrollForward();
|
|
|
|
}
|
2013-05-26 11:38:05 +02:00
|
|
|
osdManager.flush();
|
2013-05-24 16:23:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void cTvGuideOsd::ScrollForward() {
|
|
|
|
myTime->AddStep(tvguideConfig.stepMinutes);
|
2013-05-26 11:38:05 +02:00
|
|
|
timeLine->drawDateViewer();
|
|
|
|
timeLine->drawClock();
|
|
|
|
timeLine->setTimeline();
|
|
|
|
for (cChannelColumn *column = columns.First(); column; column = columns.Next(column)) {
|
|
|
|
column->AddNewGridsAtEnd();
|
|
|
|
column->ClearOutdatedStart();
|
|
|
|
column->drawGrids();
|
|
|
|
}
|
2013-05-24 16:23:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void cTvGuideOsd::timeBack() {
|
|
|
|
bool actionDone = false;
|
|
|
|
if ( (activeGrid->StartTime() - myTime->GetStart())/60 < 30 ) {
|
|
|
|
ScrollBack();
|
|
|
|
actionDone = true;
|
|
|
|
}
|
|
|
|
cGrid *prev = activeGrid->column->getPrev(activeGrid);
|
|
|
|
if (prev) {
|
|
|
|
if ( (prev->StartTime() > myTime->GetStart())
|
|
|
|
|| ( (prev->EndTime() - myTime->GetStart())/60 > 30 )
|
|
|
|
|| ( prev->isFirst()) ) {
|
|
|
|
setNextActiveGrid(prev);
|
|
|
|
actionDone = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!actionDone) {
|
|
|
|
ScrollBack();
|
|
|
|
}
|
2013-05-26 11:38:05 +02:00
|
|
|
osdManager.flush();
|
2013-05-24 16:23:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void cTvGuideOsd::ScrollBack() {
|
2013-05-26 11:38:05 +02:00
|
|
|
bool tooFarInPast = myTime->DelStep(tvguideConfig.stepMinutes);
|
|
|
|
if (tooFarInPast)
|
|
|
|
return;
|
|
|
|
timeLine->drawDateViewer();
|
|
|
|
timeLine->drawClock();
|
|
|
|
timeLine->setTimeline();
|
|
|
|
for (cChannelColumn *column = columns.First(); column; column = columns.Next(column)) {
|
|
|
|
column->AddNewGridsAtStart();
|
|
|
|
column->ClearOutdatedEnd();
|
|
|
|
column->drawGrids();
|
|
|
|
}
|
2013-05-24 16:23:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void cTvGuideOsd::processKeyUp() {
|
|
|
|
if (!activeGrid) {
|
|
|
|
return;
|
|
|
|
}
|
2013-07-09 00:17:42 +02:00
|
|
|
if (tvguideConfig.displayMode == eVertical) {
|
|
|
|
timeBack();
|
|
|
|
} else if (tvguideConfig.displayMode == eHorizontal) {
|
|
|
|
channelBack();
|
2013-05-24 16:23:23 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void cTvGuideOsd::processKeyDown() {
|
2013-05-26 11:38:05 +02:00
|
|
|
if (!activeGrid) {
|
|
|
|
return;
|
2013-05-24 16:23:23 +02:00
|
|
|
}
|
2013-07-09 00:17:42 +02:00
|
|
|
if (tvguideConfig.displayMode == eVertical) {
|
|
|
|
timeForward();
|
|
|
|
} else if (tvguideConfig.displayMode == eHorizontal) {
|
|
|
|
channelForward();
|
2013-05-24 16:23:23 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void cTvGuideOsd::processKeyLeft() {
|
2013-05-26 11:38:05 +02:00
|
|
|
if (activeGrid == NULL)
|
|
|
|
return;
|
2013-05-24 16:23:23 +02:00
|
|
|
if (tvguideConfig.displayMode == eVertical) {
|
|
|
|
channelBack();
|
|
|
|
} else if (tvguideConfig.displayMode == eHorizontal) {
|
|
|
|
timeBack();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-01-17 13:16:44 +01:00
|
|
|
void cTvGuideOsd::processKeyRight() {
|
2013-05-26 11:38:05 +02:00
|
|
|
if (activeGrid == NULL)
|
|
|
|
return;
|
2013-05-24 16:23:23 +02:00
|
|
|
if (tvguideConfig.displayMode == eVertical) {
|
|
|
|
channelForward();
|
|
|
|
} else if (tvguideConfig.displayMode == eHorizontal) {
|
|
|
|
timeForward();
|
|
|
|
}
|
2013-01-17 13:16:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void cTvGuideOsd::processKeyRed() {
|
2013-05-26 11:38:05 +02:00
|
|
|
if ((activeGrid == NULL) || activeGrid->isDummy())
|
|
|
|
return;
|
2013-07-09 00:17:42 +02:00
|
|
|
recMenuManager->Start(activeGrid->GetEvent());
|
2013-01-17 13:16:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void cTvGuideOsd::processKeyGreen() {
|
2013-05-26 11:38:05 +02:00
|
|
|
if (activeGrid == NULL)
|
|
|
|
return;
|
2013-05-31 13:58:22 +02:00
|
|
|
|
2013-05-26 11:38:05 +02:00
|
|
|
const cChannel *currentChannel = activeGrid->column->getChannel();
|
2013-07-15 17:27:55 +02:00
|
|
|
const cChannel *firstChannel = columns.First()->getChannel();
|
|
|
|
int currentCol = activeGrid->column->GetNum();
|
2013-05-20 11:37:37 +02:00
|
|
|
const cChannel *prev = NULL;
|
2013-05-31 13:58:22 +02:00
|
|
|
|
|
|
|
if (tvguideConfig.channelJumpMode == eGroupJump) {
|
|
|
|
int prevNum = channelGroups->GetPrevGroupChannelNumber(currentChannel);
|
|
|
|
if (prevNum) {
|
2018-03-08 13:30:41 +01:00
|
|
|
#if VDRVERSNUM >= 20301
|
2018-03-08 13:02:38 +01:00
|
|
|
LOCK_CHANNELS_READ;
|
|
|
|
prev = Channels->GetByNumber(prevNum);
|
|
|
|
#else
|
2013-05-31 13:58:22 +02:00
|
|
|
prev = Channels.GetByNumber(prevNum);
|
2018-03-08 13:02:38 +01:00
|
|
|
#endif
|
2013-05-31 13:58:22 +02:00
|
|
|
}
|
|
|
|
} else if (tvguideConfig.channelJumpMode == eNumJump) {
|
|
|
|
int i = tvguideConfig.jumpChannels + 1;
|
2018-03-08 13:30:41 +01:00
|
|
|
#if VDRVERSNUM >= 20301
|
2018-03-08 13:02:38 +01:00
|
|
|
LOCK_CHANNELS_READ;
|
|
|
|
for (const cChannel *channel = firstChannel; channel; channel = Channels->Prev(channel)) {
|
|
|
|
#else
|
2013-07-15 17:27:55 +02:00
|
|
|
for (const cChannel *channel = firstChannel; channel; channel = Channels.Prev(channel)) {
|
2018-03-08 13:02:38 +01:00
|
|
|
#endif
|
2013-05-31 13:58:22 +02:00
|
|
|
if (!channel->GroupSep()) {
|
|
|
|
prev = channel;
|
|
|
|
i--;
|
|
|
|
}
|
|
|
|
if (i == 0)
|
|
|
|
break;
|
2013-05-26 11:38:05 +02:00
|
|
|
}
|
2013-05-20 11:37:37 +02:00
|
|
|
}
|
|
|
|
if (prev) {
|
2013-05-26 11:38:05 +02:00
|
|
|
readChannels(prev);
|
|
|
|
if (columns.Count() > 0) {
|
2013-12-24 11:20:25 +01:00
|
|
|
if (tvguideConfig.channelJumpMode == eGroupJump)
|
|
|
|
drawGridsChannelJump();
|
|
|
|
else
|
|
|
|
drawGridsChannelJump(currentCol);
|
2013-05-26 11:38:05 +02:00
|
|
|
}
|
|
|
|
osdManager.flush();
|
|
|
|
}
|
2013-01-17 13:16:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void cTvGuideOsd::processKeyYellow() {
|
2013-05-26 11:38:05 +02:00
|
|
|
if (activeGrid == NULL)
|
|
|
|
return;
|
|
|
|
const cChannel *currentChannel = activeGrid->column->getChannel();
|
2013-07-15 17:27:55 +02:00
|
|
|
int currentCol = activeGrid->column->GetNum();
|
|
|
|
const cChannel *firstChannel = columns.First()->getChannel();
|
2013-05-26 11:38:05 +02:00
|
|
|
const cChannel *next = NULL;
|
2013-05-31 13:58:22 +02:00
|
|
|
|
|
|
|
if (tvguideConfig.channelJumpMode == eGroupJump) {
|
|
|
|
int nextNum = channelGroups->GetNextGroupChannelNumber(currentChannel);
|
|
|
|
if (nextNum) {
|
2018-03-08 13:30:41 +01:00
|
|
|
#if VDRVERSNUM >= 20301
|
2018-03-08 13:02:38 +01:00
|
|
|
LOCK_CHANNELS_READ;
|
|
|
|
next = Channels->GetByNumber(nextNum);
|
|
|
|
#else
|
2013-05-31 13:58:22 +02:00
|
|
|
next = Channels.GetByNumber(nextNum);
|
2018-03-08 13:02:38 +01:00
|
|
|
#endif
|
2013-05-31 13:58:22 +02:00
|
|
|
}
|
|
|
|
} else if (tvguideConfig.channelJumpMode == eNumJump) {
|
|
|
|
int i=0;
|
2018-03-08 13:30:41 +01:00
|
|
|
#if VDRVERSNUM >= 20301
|
2018-03-08 13:02:38 +01:00
|
|
|
LOCK_CHANNELS_READ;
|
|
|
|
for (const cChannel *channel = firstChannel; channel; channel = Channels->Next(channel)) {
|
|
|
|
#else
|
2013-07-15 17:27:55 +02:00
|
|
|
for (const cChannel *channel = firstChannel; channel; channel = Channels.Next(channel)) {
|
2018-03-08 13:02:38 +01:00
|
|
|
#endif
|
2013-05-31 13:58:22 +02:00
|
|
|
if (channelGroups->IsInLastGroup(channel)) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (!channel->GroupSep()) {
|
|
|
|
next = channel;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
if (i == (tvguideConfig.jumpChannels+1)) {
|
|
|
|
break;
|
|
|
|
}
|
2013-05-26 11:38:05 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (next) {
|
|
|
|
readChannels(next);
|
|
|
|
if (columns.Count() > 0) {
|
2013-12-24 11:20:25 +01:00
|
|
|
if (tvguideConfig.channelJumpMode == eGroupJump)
|
|
|
|
drawGridsChannelJump();
|
|
|
|
else
|
|
|
|
drawGridsChannelJump(currentCol);
|
2013-05-26 11:38:05 +02:00
|
|
|
}
|
|
|
|
osdManager.flush();
|
|
|
|
}
|
2013-01-17 13:16:44 +01:00
|
|
|
}
|
|
|
|
|
2014-01-22 17:43:53 +01:00
|
|
|
eOSState cTvGuideOsd::processKeyBlue(bool *alreadyUnlocked) {
|
2014-01-14 18:00:32 +01:00
|
|
|
if (tvguideConfig.blueKeyMode == eBlueKeySwitch) {
|
2014-01-22 17:43:53 +01:00
|
|
|
return ChannelSwitch(alreadyUnlocked);
|
2014-01-14 18:00:32 +01:00
|
|
|
} else if (tvguideConfig.blueKeyMode == eBlueKeyEPG) {
|
2013-06-01 11:08:17 +02:00
|
|
|
DetailedEPG();
|
2014-01-14 18:00:32 +01:00
|
|
|
} else if (tvguideConfig.blueKeyMode == eBlueKeyFavorites) {
|
|
|
|
recMenuManager->StartFavorites();
|
2013-06-01 11:08:17 +02:00
|
|
|
}
|
|
|
|
return osContinue;
|
|
|
|
}
|
|
|
|
|
2014-01-22 17:43:53 +01:00
|
|
|
eOSState cTvGuideOsd::processKeyOk(bool *alreadyUnlocked) {
|
2014-01-14 18:00:32 +01:00
|
|
|
if (tvguideConfig.blueKeyMode == eBlueKeySwitch) {
|
2013-06-01 11:08:17 +02:00
|
|
|
DetailedEPG();
|
2014-01-14 18:00:32 +01:00
|
|
|
} else if (tvguideConfig.blueKeyMode == eBlueKeyEPG) {
|
2014-01-22 17:43:53 +01:00
|
|
|
return ChannelSwitch(alreadyUnlocked);
|
2014-01-14 18:00:32 +01:00
|
|
|
} else if (tvguideConfig.blueKeyMode == eBlueKeyFavorites) {
|
|
|
|
DetailedEPG();
|
2013-06-01 11:08:17 +02:00
|
|
|
}
|
|
|
|
return osContinue;
|
|
|
|
}
|
|
|
|
|
2014-01-22 17:43:53 +01:00
|
|
|
eOSState cTvGuideOsd::ChannelSwitch(bool *alreadyUnlocked) {
|
2013-05-26 11:38:05 +02:00
|
|
|
if (activeGrid == NULL)
|
|
|
|
return osContinue;
|
|
|
|
const cChannel *currentChannel = activeGrid->column->getChannel();
|
|
|
|
if (currentChannel) {
|
2014-01-22 17:43:53 +01:00
|
|
|
cPixmap::Unlock();
|
|
|
|
*alreadyUnlocked = true;
|
2013-05-26 11:38:05 +02:00
|
|
|
cDevice::PrimaryDevice()->SwitchChannel(currentChannel, true);
|
2013-12-22 11:03:52 +01:00
|
|
|
if (tvguideConfig.closeOnSwitch) {
|
|
|
|
if (detailView) {
|
|
|
|
delete detailView;
|
|
|
|
detailView = NULL;
|
2013-12-23 09:12:19 +01:00
|
|
|
detailViewActive = false;
|
2013-12-22 11:03:52 +01:00
|
|
|
}
|
2013-07-20 13:46:26 +02:00
|
|
|
return osEnd;
|
2013-12-22 11:03:52 +01:00
|
|
|
}
|
2013-05-26 11:38:05 +02:00
|
|
|
}
|
|
|
|
return osContinue;
|
2013-01-17 13:16:44 +01:00
|
|
|
}
|
|
|
|
|
2013-06-01 11:08:17 +02:00
|
|
|
void cTvGuideOsd::DetailedEPG() {
|
2013-07-09 00:17:42 +02:00
|
|
|
if (!activeGrid->isDummy()) {
|
|
|
|
detailViewActive = true;
|
2014-01-11 16:53:23 +01:00
|
|
|
detailView = new cDetailView(activeGrid->GetEvent(), footer);
|
|
|
|
footer->SetDetailedViewMode();
|
|
|
|
osdManager.flush();
|
2013-08-25 13:57:10 +02:00
|
|
|
detailView->Start();
|
2013-06-01 11:08:17 +02:00
|
|
|
osdManager.flush();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-23 09:12:19 +01:00
|
|
|
void cTvGuideOsd::processNumKey(int numKey) {
|
|
|
|
if (tvguideConfig.numkeyMode == 0) {
|
|
|
|
//timely jumps with 1,3,4,6,7,9
|
|
|
|
TimeJump(numKey);
|
|
|
|
} else {
|
|
|
|
//jump to specific channel
|
|
|
|
ChannelJump(numKey);
|
|
|
|
}
|
2013-01-17 13:16:44 +01:00
|
|
|
}
|
|
|
|
|
2013-12-23 09:12:19 +01:00
|
|
|
void cTvGuideOsd::TimeJump(int mode) {
|
|
|
|
switch (mode) {
|
|
|
|
case 1: {
|
|
|
|
bool tooFarInPast = myTime->DelStep(tvguideConfig.bigStepHours*60);
|
|
|
|
if (tooFarInPast)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 3: {
|
|
|
|
myTime->AddStep(tvguideConfig.bigStepHours*60);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 4: {
|
|
|
|
bool tooFarInPast = myTime->DelStep(tvguideConfig.hugeStepHours*60);
|
|
|
|
if (tooFarInPast)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 6: {
|
|
|
|
myTime->AddStep(tvguideConfig.hugeStepHours*60);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 7: {
|
|
|
|
cMyTime primeChecker;
|
|
|
|
primeChecker.Now();
|
|
|
|
time_t prevPrime = primeChecker.getPrevPrimetime(myTime->GetStart());
|
|
|
|
if (primeChecker.tooFarInPast(prevPrime))
|
|
|
|
return;
|
|
|
|
myTime->SetTime(prevPrime);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 9: {
|
|
|
|
cMyTime primeChecker;
|
|
|
|
time_t nextPrime = primeChecker.getNextPrimetime(myTime->GetStart());
|
|
|
|
myTime->SetTime(nextPrime);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
2013-05-26 11:38:05 +02:00
|
|
|
drawGridsTimeJump();
|
|
|
|
timeLine->drawDateViewer();
|
|
|
|
timeLine->drawClock();
|
|
|
|
timeLine->setTimeline();
|
|
|
|
osdManager.flush();
|
2013-01-17 13:16:44 +01:00
|
|
|
}
|
|
|
|
|
2013-12-23 09:12:19 +01:00
|
|
|
void cTvGuideOsd::ChannelJump(int num) {
|
|
|
|
if (!channelJumper) {
|
|
|
|
channelJumper = new cChannelJump(channelGroups);
|
|
|
|
}
|
|
|
|
channelJumper->Set(num);
|
|
|
|
channelJumper->DrawText();
|
2013-05-26 11:38:05 +02:00
|
|
|
osdManager.flush();
|
2013-01-17 13:16:44 +01:00
|
|
|
}
|
|
|
|
|
2013-12-23 09:12:19 +01:00
|
|
|
void cTvGuideOsd::CheckTimeout(void) {
|
|
|
|
if (!channelJumper)
|
2013-05-26 11:38:05 +02:00
|
|
|
return;
|
2013-12-23 09:12:19 +01:00
|
|
|
if (channelJumper->TimeOut()) {
|
|
|
|
int newChannelNum = channelJumper->GetChannel();
|
|
|
|
delete channelJumper;
|
|
|
|
channelJumper = NULL;
|
2018-03-08 13:30:41 +01:00
|
|
|
#if VDRVERSNUM >= 20301
|
2018-03-08 13:02:38 +01:00
|
|
|
LOCK_CHANNELS_READ;
|
|
|
|
const cChannel *newChannel = Channels->GetByNumber(newChannelNum);
|
|
|
|
#else
|
2013-12-23 09:12:19 +01:00
|
|
|
const cChannel *newChannel = Channels.GetByNumber(newChannelNum);
|
2018-03-08 13:02:38 +01:00
|
|
|
#endif
|
2013-12-23 09:12:19 +01:00
|
|
|
if (newChannel) {
|
|
|
|
readChannels(newChannel);
|
|
|
|
if (columns.Count() > 0) {
|
|
|
|
drawGridsChannelJump();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
osdManager.flush();
|
|
|
|
}
|
2013-01-17 13:16:44 +01:00
|
|
|
}
|
|
|
|
|
2013-07-09 00:17:42 +02:00
|
|
|
void cTvGuideOsd::SetTimers() {
|
|
|
|
for (cChannelColumn *column = columns.First(); column; column = columns.Next(column)) {
|
|
|
|
column->SetTimers();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-01-17 13:16:44 +01:00
|
|
|
eOSState cTvGuideOsd::ProcessKey(eKeys Key) {
|
2013-07-09 00:17:42 +02:00
|
|
|
eOSState state = osContinue;
|
|
|
|
cPixmap::Lock();
|
2014-01-22 17:43:53 +01:00
|
|
|
bool alreadyUnlocked = false;
|
2013-07-09 00:17:42 +02:00
|
|
|
if (recMenuManager->isActive()) {
|
|
|
|
state = recMenuManager->ProcessKey(Key);
|
|
|
|
if (state == osEnd) {
|
|
|
|
SetTimers();
|
|
|
|
osdManager.flush();
|
|
|
|
}
|
2013-05-26 11:38:05 +02:00
|
|
|
state = osContinue;
|
2013-07-09 00:17:42 +02:00
|
|
|
} else if (detailViewActive) {
|
2013-07-15 18:12:53 +02:00
|
|
|
if ((Key & ~k_Repeat) == kRed) {
|
2013-07-09 00:17:42 +02:00
|
|
|
delete detailView;
|
|
|
|
detailView = NULL;
|
|
|
|
detailViewActive = false;
|
2013-07-15 18:12:53 +02:00
|
|
|
processKeyRed();
|
2014-01-14 18:00:32 +01:00
|
|
|
} else if ((Key & ~k_Repeat) == kBlue) {
|
|
|
|
delete detailView;
|
|
|
|
detailView = NULL;
|
|
|
|
detailViewActive = false;
|
2014-01-22 17:43:53 +01:00
|
|
|
if ((tvguideConfig.blueKeyMode == eBlueKeySwitch) || (tvguideConfig.blueKeyMode == eBlueKeyFavorites)) {
|
|
|
|
state = ChannelSwitch(&alreadyUnlocked);
|
|
|
|
} else {
|
2014-01-14 18:00:32 +01:00
|
|
|
osdManager.flush();
|
|
|
|
state = osContinue;
|
|
|
|
}
|
2014-01-15 17:30:06 +01:00
|
|
|
} else if ((Key & ~k_Repeat) == kOk && (tvguideConfig.blueKeyMode == eBlueKeyEPG)) {
|
2013-07-19 15:34:52 +02:00
|
|
|
delete detailView;
|
|
|
|
detailView = NULL;
|
|
|
|
detailViewActive = false;
|
2014-01-22 17:43:53 +01:00
|
|
|
state = ChannelSwitch(&alreadyUnlocked);
|
2013-07-15 18:12:53 +02:00
|
|
|
} else {
|
|
|
|
state = detailView->ProcessKey(Key);
|
|
|
|
if (state == osEnd) {
|
|
|
|
delete detailView;
|
|
|
|
detailView = NULL;
|
|
|
|
detailViewActive = false;
|
|
|
|
osdManager.flush();
|
|
|
|
state = osContinue;
|
|
|
|
}
|
2013-07-09 00:17:42 +02:00
|
|
|
}
|
|
|
|
} else {
|
2013-05-26 11:38:05 +02:00
|
|
|
switch (Key & ~k_Repeat) {
|
|
|
|
case kUp: processKeyUp(); break;
|
|
|
|
case kDown: processKeyDown(); break;
|
|
|
|
case kLeft: processKeyLeft(); break;
|
|
|
|
case kRight: processKeyRight(); break;
|
|
|
|
case kRed: processKeyRed(); break;
|
|
|
|
case kGreen: processKeyGreen(); break;
|
|
|
|
case kYellow: processKeyYellow(); break;
|
2014-01-22 17:43:53 +01:00
|
|
|
case kBlue: state = processKeyBlue(&alreadyUnlocked); break;
|
|
|
|
case kOk: state = processKeyOk(&alreadyUnlocked); break;
|
2013-07-09 00:17:42 +02:00
|
|
|
case kBack: state=osEnd; break;
|
2013-12-23 09:12:19 +01:00
|
|
|
case k0 ... k9: processNumKey(Key - k0); break;
|
|
|
|
case kNone: if (channelJumper) CheckTimeout(); break;
|
2013-05-26 11:38:05 +02:00
|
|
|
default: break;
|
|
|
|
}
|
|
|
|
}
|
2014-01-22 17:43:53 +01:00
|
|
|
if (!alreadyUnlocked) {
|
|
|
|
cPixmap::Unlock();
|
|
|
|
}
|
2013-05-26 11:38:05 +02:00
|
|
|
return state;
|
2013-05-20 11:37:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void cTvGuideOsd::dump() {
|
2013-05-26 11:38:05 +02:00
|
|
|
esyslog("tvguide: ------Dumping Content---------");
|
2013-05-20 11:37:37 +02:00
|
|
|
activeGrid->debug();
|
|
|
|
int i=1;
|
2013-05-26 11:38:05 +02:00
|
|
|
for (cChannelColumn *col = columns.First(); col; col = columns.Next(col)) {
|
2013-05-20 11:37:37 +02:00
|
|
|
col->dumpGrids();
|
|
|
|
}
|
2013-07-09 00:44:41 +02:00
|
|
|
}
|