2013-05-20 11:37:37 +02:00
|
|
|
#include "dummygrid.h"
|
|
|
|
|
|
|
|
cDummyGrid::cDummyGrid(cChannelColumn *c, time_t start, time_t end) : cGrid(c) {
|
|
|
|
this->start = start;
|
|
|
|
this->end = end;
|
|
|
|
strText = tr("No EPG Information available");
|
|
|
|
dummy = true;
|
2013-07-09 00:17:42 +02:00
|
|
|
hasTimer = false;
|
2013-05-20 11:37:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
cDummyGrid::~cDummyGrid(void) {
|
|
|
|
}
|
|
|
|
|
2013-07-12 16:00:18 +02:00
|
|
|
time_t cDummyGrid::Duration(void) {
|
|
|
|
//max Duration 5h
|
|
|
|
if (end - start > 18000)
|
|
|
|
return 18000;
|
|
|
|
return (end - start);
|
|
|
|
};
|
|
|
|
|
2013-05-20 11:37:37 +02:00
|
|
|
void cDummyGrid::SetViewportHeight() {
|
2013-05-26 11:38:05 +02:00
|
|
|
int viewportHeightOld = viewportHeight;
|
2013-05-24 16:23:23 +02:00
|
|
|
viewportHeight = Duration() / 60 * tvguideConfig.minutePixel;
|
2013-05-20 11:37:37 +02:00
|
|
|
if (viewportHeight != viewportHeightOld)
|
2013-05-26 11:38:05 +02:00
|
|
|
dirty = true;
|
2013-05-20 11:37:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void cDummyGrid::PositionPixmap() {
|
2013-05-24 16:23:23 +02:00
|
|
|
int x0, y0;
|
|
|
|
if (tvguideConfig.displayMode == eVertical) {
|
|
|
|
x0 = column->getX();
|
2013-05-31 13:58:22 +02:00
|
|
|
y0 = tvguideConfig.statusHeaderHeight + tvguideConfig.channelHeaderHeight + tvguideConfig.channelGroupsHeight;
|
2013-05-24 16:23:23 +02:00
|
|
|
if ( column->Start() < StartTime() ) {
|
|
|
|
y0 += (StartTime() - column->Start())/60*tvguideConfig.minutePixel;
|
|
|
|
}
|
|
|
|
if (!pixmap) {
|
|
|
|
pixmap = osdManager.requestPixmap(-1, cRect(x0, y0, tvguideConfig.colWidth, viewportHeight));
|
|
|
|
} else if (dirty) {
|
|
|
|
osdManager.releasePixmap(pixmap);
|
|
|
|
pixmap = osdManager.requestPixmap(-1, cRect(x0, y0, tvguideConfig.colWidth, viewportHeight));
|
|
|
|
} else {
|
|
|
|
pixmap->SetViewPort(cRect(x0, y0, tvguideConfig.colWidth, viewportHeight));
|
|
|
|
}
|
|
|
|
} else if (tvguideConfig.displayMode == eHorizontal) {
|
2013-05-31 13:58:22 +02:00
|
|
|
x0 = tvguideConfig.channelHeaderWidth + tvguideConfig.channelGroupsWidth;
|
2013-05-24 16:23:23 +02:00
|
|
|
y0 = column->getY();
|
|
|
|
if ( column->Start() < StartTime() ) {
|
|
|
|
x0 += (StartTime() - column->Start())/60*tvguideConfig.minutePixel;
|
|
|
|
}
|
|
|
|
if (!pixmap) {
|
|
|
|
pixmap = osdManager.requestPixmap(-1, cRect(x0, y0, viewportHeight, tvguideConfig.rowHeight));
|
|
|
|
} else if (dirty) {
|
|
|
|
osdManager.releasePixmap(pixmap);
|
|
|
|
pixmap = osdManager.requestPixmap(-1, cRect(x0, y0, viewportHeight, tvguideConfig.rowHeight));
|
|
|
|
} else {
|
|
|
|
pixmap->SetViewPort(cRect(x0, y0, viewportHeight, tvguideConfig.rowHeight));
|
|
|
|
}
|
|
|
|
}
|
2013-05-20 11:37:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void cDummyGrid::setText() {
|
2013-05-24 16:23:23 +02:00
|
|
|
if (tvguideConfig.displayMode == eVertical) {
|
|
|
|
text->Set(*strText, tvguideConfig.FontGrid, tvguideConfig.colWidth-2*borderWidth);
|
|
|
|
}
|
2013-05-20 11:37:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void cDummyGrid::drawText() {
|
2013-05-28 17:06:53 +02:00
|
|
|
tColor colorText = (active)?theme.Color(clrFontActive):theme.Color(clrFont);
|
2013-05-28 17:23:33 +02:00
|
|
|
tColor colorTextBack = (tvguideConfig.useBlending==0)?color:clrTransparent;
|
2013-05-26 11:38:05 +02:00
|
|
|
if (tvguideConfig.displayMode == eVertical) {
|
2013-05-24 16:23:23 +02:00
|
|
|
if (Height()/tvguideConfig.minutePixel < 6)
|
|
|
|
return;
|
|
|
|
int textHeight = tvguideConfig.FontGrid->Height();
|
|
|
|
int textLines = text->Lines();
|
|
|
|
for (int i=0; i<textLines; i++) {
|
2013-05-28 17:23:33 +02:00
|
|
|
pixmap->DrawText(cPoint(borderWidth, borderWidth + i*textHeight), text->GetLine(i), colorText, colorTextBack, tvguideConfig.FontGrid);
|
2013-05-24 16:23:23 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
} else if (tvguideConfig.displayMode == eHorizontal) {
|
2013-05-26 17:11:36 +02:00
|
|
|
if (Width()/tvguideConfig.minutePixel < 10) {
|
|
|
|
int titleY = (tvguideConfig.rowHeight - tvguideConfig.FontGridHorizontal->Height())/2;
|
2013-05-28 17:23:33 +02:00
|
|
|
pixmap->DrawText(cPoint(borderWidth - 2, titleY), "...", colorText, colorTextBack, tvguideConfig.FontGridHorizontal);
|
2013-05-26 17:11:36 +02:00
|
|
|
return;
|
|
|
|
}
|
2013-05-24 16:23:23 +02:00
|
|
|
int titleY = (tvguideConfig.rowHeight - tvguideConfig.FontGridHorizontal->Height())/2;
|
2013-05-28 17:23:33 +02:00
|
|
|
pixmap->DrawText(cPoint(borderWidth, titleY), *strText, colorText, colorTextBack, tvguideConfig.FontGridHorizontal);
|
2013-05-24 16:23:23 +02:00
|
|
|
}
|
2013-05-20 11:37:37 +02:00
|
|
|
}
|
|
|
|
cString cDummyGrid::getText(void) {
|
|
|
|
return strText;
|
|
|
|
}
|
|
|
|
|
|
|
|
cString cDummyGrid::getTimeString(void) {
|
|
|
|
return cString::sprintf("%s - %s", *TimeString(start), *TimeString(end));
|
|
|
|
}
|
|
|
|
|
|
|
|
void cDummyGrid::debug() {
|
2013-05-26 11:38:05 +02:00
|
|
|
esyslog("tvguide dummygrid: %s: %s, %s, viewportHeight: %d px, Duration: %ld min, active: %d",
|
2013-05-20 11:37:37 +02:00
|
|
|
column->Name(),
|
|
|
|
*cMyTime::printTime(start),
|
|
|
|
*cMyTime::printTime(end),
|
|
|
|
viewportHeight,
|
|
|
|
Duration()/60,
|
|
|
|
active);
|
|
|
|
}
|