rewrote epg grid handling and scrolling, added status header

This commit is contained in:
louis 2013-05-20 11:37:37 +02:00
parent 063094f442
commit c611e00458
32 changed files with 982 additions and 463 deletions

View File

@ -10,3 +10,12 @@ VDR Plugin 'tvguide' Revision History
- Changed color buttons to nOpacity style - Changed color buttons to nOpacity style
- Changed channelheader to display transparent logos properly - Changed channelheader to display transparent logos properly
- Added "style nOpacity" for backgrounds and theme nOpacity - Added "style nOpacity" for backgrounds and theme nOpacity
Version 0.0.3
- Added dummy grids if no EPG information is available for a certain
time
- Completely rewrote code for creation of epg grids for a channel column
- Completely rewrote code for scrolling forward and backward in time
- Added status header with epg information of currently selected
schedule and scaled video picture

View File

@ -1,15 +1,17 @@
#include "channelcolumn.h" #include "channelcolumn.h"
cChannelColumn::cChannelColumn(int num, cChannel *channel, cMyTime *myTime) { cChannelColumn::cChannelColumn(int num, const cChannel *channel, cMyTime *myTime) {
this->channel = channel; this->channel = channel;
this->num = num; this->num = num;
this->myTime = myTime; this->myTime = myTime;
hasTimer = channel->HasTimer(); hasTimer = channel->HasTimer();
schedulesLock = new cSchedulesLock(true, 100);
} }
cChannelColumn::~cChannelColumn(void) { cChannelColumn::~cChannelColumn(void) {
osdManager.releasePixmap(pixmapLogo, cString::sprintf("channelcolumn logo %s", channel->Name())); delete header;
grids.Clear(); grids.Clear();
delete schedulesLock;
} }
void cChannelColumn::clearGrids() { void cChannelColumn::clearGrids() {
@ -17,94 +19,85 @@ void cChannelColumn::clearGrids() {
} }
void cChannelColumn::createHeader() { void cChannelColumn::createHeader() {
color = theme.Color(clrHeader); header = new cHeaderGrid();
colorBlending = theme.Color(clrHeaderBlending); header->createBackground(num);
caller = cString::sprintf("channelcolumn %s", channel->Name()); header->drawChannel(channel);
pixmap = osdManager.requestPixmap(2, cRect(tvguideConfig.timeColWidth + num*tvguideConfig.colWidth, 0, tvguideConfig.colWidth, tvguideConfig.headerHeight),
cRect::Null, *caller);
if (!pixmap) {
return;
}
pixmapLogo = osdManager.requestPixmap(3, cRect(tvguideConfig.timeColWidth + num*tvguideConfig.colWidth, 0, tvguideConfig.colWidth, tvguideConfig.headerHeight),
cRect::Null, *caller);
if (!pixmapLogo) {
return;
}
pixmapLogo->Fill(clrTransparent);
drawBackground();
cTextWrapper tw;
cString headerText = cString::sprintf("%d - %s", channel->Number(), channel->Name());
tw.Set(*headerText, tvguideConfig.FontHeader, tvguideConfig.colWidth - 8);
int lines = tw.Lines();
int lineHeight = tvguideConfig.FontHeader->Height();
int yStart = (tvguideConfig.headerHeight - lines*lineHeight)/2 + 8;
if (!tvguideConfig.hideChannelLogos) {
cImageLoader imgLoader;
if (imgLoader.LoadLogo(channel->Name())) {
cImage logo = imgLoader.GetImage();
int logoX = (tvguideConfig.colWidth - tvguideConfig.logoWidth)/2;
pixmapLogo->DrawImage(cPoint(logoX, 5), logo);
}
yStart = tvguideConfig.logoHeight + 8;
}
for (int i=0; i<lines; i++) {
int textWidth = tvguideConfig.FontHeader->Width(tw.GetLine(i));
int xText = (tvguideConfig.colWidth - textWidth) / 2;
if (xText < 0)
xText = 0;
pixmap->DrawText(cPoint(xText, yStart + i*lineHeight), tw.GetLine(i), theme.Color(clrFontHeader), clrTransparent, tvguideConfig.FontHeader);
}
drawBorder();
} }
void cChannelColumn::drawHeader() { void cChannelColumn::drawHeader() {
pixmap->SetViewPort(cRect(tvguideConfig.timeColWidth + num*tvguideConfig.colWidth, 0, tvguideConfig.colWidth, tvguideConfig.headerHeight)); header->setPosition(num);
pixmapLogo->SetViewPort(cRect(tvguideConfig.timeColWidth + num*tvguideConfig.colWidth, 0, tvguideConfig.colWidth, tvguideConfig.headerHeight));
} }
bool cChannelColumn::readGrids() { bool cChannelColumn::readGrids() {
schedules = cSchedules::Schedules(schedulesLock); schedules = cSchedules::Schedules(*schedulesLock);
const cSchedule *Schedule = NULL; const cSchedule *Schedule = NULL;
Schedule = schedules->GetSchedule(channel); Schedule = schedules->GetSchedule(channel);
if (!Schedule) { if (!Schedule) {
return false; addDummyGrid(myTime->GetStart(), myTime->GetEnd(), NULL, false);
return true;
} }
bool eventFound = false; bool eventFound = false;
const cEvent *event = Schedule->GetEventAround(myTime->GetStart()); bool dummyAtStart = false;
if (event != NULL) { const cEvent *startEvent = Schedule->GetEventAround(myTime->GetStart());
if (startEvent != NULL) {
eventFound = true; eventFound = true;
} else { } else {
for (int i=1; i<6; i++) { for (int i=1; i<6; i++) {
event = Schedule->GetEventAround(myTime->GetStart()+i*5*60); startEvent = Schedule->GetEventAround(myTime->GetStart()+i*5*60);
if (event) { if (startEvent) {
eventFound = true; eventFound = true;
dummyAtStart = true;
break; break;
} }
} }
} }
if (eventFound) { if (eventFound) {
bool col = true; bool col = true;
if (dummyAtStart) {
addDummyGrid(myTime->GetStart(), startEvent->StartTime(), NULL, col);
col = !col;
}
bool dummyNeeded = true;
bool toFarInFuture = false;
time_t endLast = myTime->GetStart();
const cEvent *event = startEvent;
const cEvent *eventLast = NULL;
for (; event; event = Schedule->Events()->Next(event)) { for (; event; event = Schedule->Events()->Next(event)) {
cEpgGrid *grid = new cEpgGrid(this, event); if (endLast < event->StartTime()) {
grid->setText(); //gap, dummy needed
grid->SetColor(col); time_t endTime = event->StartTime();
if (endTime > myTime->GetEnd()) {
endTime = myTime->GetEnd();
toFarInFuture = true;
}
addDummyGrid(endLast, endTime, NULL, col);
col = !col;
}
if (toFarInFuture) {
break;
}
addEpgGrid(event, NULL, col);
col = !col; col = !col;
grids.Add(grid); endLast = event->EndTime();
if (event->EndTime() > myTime->GetStop()) { if (event->EndTime() > myTime->GetEnd()) {
dummyNeeded = false;
break; break;
} }
eventLast = event;
} }
if (dummyNeeded) {
addDummyGrid(eventLast->EndTime(), myTime->GetEnd(), NULL, col);
}
return true; return true;
} else { } else {
return false; addDummyGrid(myTime->GetStart(), myTime->GetEnd(), NULL, false);
} return true;
}
return false;
} }
void cChannelColumn::drawGrids() { void cChannelColumn::drawGrids() {
for (cEpgGrid *grid = grids.First(); grid; grid = grids.Next(grid)) { for (cGrid *grid = grids.First(); grid; grid = grids.Next(grid)) {
grid->SetViewportHeight(); grid->SetViewportHeight();
grid->PositionPixmap(); grid->PositionPixmap();
grid->Draw(); grid->Draw();
@ -115,41 +108,41 @@ int cChannelColumn::getX() {
return tvguideConfig.timeColWidth + num*tvguideConfig.colWidth; return tvguideConfig.timeColWidth + num*tvguideConfig.colWidth;
} }
cEpgGrid * cChannelColumn::getActive() { cGrid * cChannelColumn::getActive() {
cMyTime t; cMyTime t;
t.Now(); t.Now();
for (cEpgGrid *grid = grids.First(); grid; grid = grids.Next(grid)) { for (cGrid *grid = grids.First(); grid; grid = grids.Next(grid)) {
if (grid->isActiveInitial(t.Get())) if (grid->Match(t.Get()))
return grid; return grid;
} }
return grids.First(); return grids.First();
} }
cEpgGrid * cChannelColumn::getNext(cEpgGrid *activeGrid) { cGrid * cChannelColumn::getNext(cGrid *activeGrid) {
if (activeGrid == NULL) if (activeGrid == NULL)
return NULL; return NULL;
cEpgGrid *next = grids.Next(activeGrid); cGrid *next = grids.Next(activeGrid);
if (next) if (next)
return next; return next;
return NULL; return NULL;
} }
cEpgGrid * cChannelColumn::getPrev(cEpgGrid *activeGrid) { cGrid * cChannelColumn::getPrev(cGrid *activeGrid) {
if (activeGrid == NULL) if (activeGrid == NULL)
return NULL; return NULL;
cEpgGrid *prev = grids.Prev(activeGrid); cGrid *prev = grids.Prev(activeGrid);
if (prev) if (prev)
return prev; return prev;
return NULL; return NULL;
} }
cEpgGrid * cChannelColumn::getNeighbor(cEpgGrid *activeGrid) { cGrid * cChannelColumn::getNeighbor(cGrid *activeGrid) {
if (!activeGrid) if (!activeGrid)
return NULL; return NULL;
cEpgGrid *neighbor = NULL; cGrid *neighbor = NULL;
int overlap = 0; int overlap = 0;
int overlapNew = 0; int overlapNew = 0;
cEpgGrid *grid = NULL; cGrid *grid = NULL;
grid = grids.First(); grid = grids.First();
if (grid) { if (grid) {
for (; grid; grid = grids.Next(grid)) { for (; grid; grid = grids.Next(grid)) {
@ -169,115 +162,182 @@ cEpgGrid * cChannelColumn::getNeighbor(cEpgGrid *activeGrid) {
return neighbor; return neighbor;
} }
void cChannelColumn::AddNewGridsAtStart() { bool cChannelColumn::isFirst(cGrid *grid) {
cEpgGrid *firstGrid = NULL; if (grid == grids.First())
firstGrid = grids.First(); return true;
if (firstGrid == NULL) { return false;
//no epg, completely new.
schedules = cSchedules::Schedules(schedulesLock);
const cSchedule *Schedule = NULL;
Schedule = schedules->GetSchedule(channel);
if (!Schedule)
return;
const cEvent *event = Schedule->GetEventAround(myTime->GetStart());
if (!event)
return;
cEpgGrid *grid = new cEpgGrid(this, event);
grid->setText();
grid->SetColor(true);
grids.Ins(grid, grids.First());
return;
} else {
//if first event is long enough, nothing to do.
if (firstGrid->StartTime() <= myTime->GetStart()) {
return;
}
//if not, i have to add new ones to the list
schedules = cSchedules::Schedules(schedulesLock);
const cSchedule *Schedule = NULL;
Schedule = schedules->GetSchedule(channel);
if (!Schedule)
return;
bool col = !(firstGrid->IsColor1());
for (const cEvent *event = Schedule->GetEventAround(firstGrid->StartTime()-60); event; event = Schedule->Events()->Prev(event)) {
if (!event)
return;
cEpgGrid *grid = new cEpgGrid(this, event);
grid->setText();
grid->SetColor(col);
col = !col;
grids.Ins(grid, firstGrid);
firstGrid = grid;
if (event->StartTime() <= myTime->GetStart()) {
break;
}
}
}
} }
void cChannelColumn::AddNewGridsAtEnd() { void cChannelColumn::AddNewGridsAtStart() {
cEpgGrid *lastGrid = NULL; cGrid *firstGrid = NULL;
lastGrid = grids.Last(); firstGrid = grids.First();
if (lastGrid == NULL) if (firstGrid == NULL)
return; return;
//if last event is long enough, nothing to do. //if first event is long enough, nothing to do.
if (lastGrid->EndTime() > myTime->GetStop()) { if (firstGrid->StartTime() <= myTime->GetStart()) {
return; return;
} }
//if not, i have to add new ones to the list //if not, i have to add new ones to the list
schedules = cSchedules::Schedules(schedulesLock); schedules = cSchedules::Schedules(*schedulesLock);
const cSchedule *Schedule = NULL; const cSchedule *Schedule = NULL;
Schedule = schedules->GetSchedule(channel); Schedule = schedules->GetSchedule(channel);
if (!Schedule) if (!Schedule) {
return; if (firstGrid->isDummy()) {
bool col = !(lastGrid->IsColor1()); firstGrid->SetStartTime(myTime->GetStart());
for (const cEvent *event = Schedule->GetEventAround(lastGrid->EndTime()+60); event; event = Schedule->Events()->Next(event)) { firstGrid->SetEndTime(myTime->GetEnd());
}
return;
}
bool col = !(firstGrid->IsColor1());
bool dummyNeeded = true;
for (const cEvent *event = Schedule->GetEventAround(firstGrid->StartTime()-60); event; event = Schedule->Events()->Prev(event)) {
if (!event) if (!event)
return; break;
cEpgGrid *grid = new cEpgGrid(this, event); if (event->EndTime() < myTime->GetStart()) {
grid->setText(); break;
grid->SetColor(col); }
col = !col; cGrid *grid = addEpgGrid(event, firstGrid, col);
grids.Add(grid); col = !col;
if (event->EndTime() > myTime->GetStop()) { firstGrid = grid;
if (event->StartTime() <= myTime->GetStart()) {
dummyNeeded = false;
break; break;
} }
} }
if (dummyNeeded) {
firstGrid = grids.First();
if (firstGrid->isDummy()) {
firstGrid->SetStartTime(myTime->GetStart());
if (firstGrid->EndTime() >= myTime->GetEnd())
firstGrid->SetEndTime(myTime->GetEnd());
} else {
addDummyGrid(myTime->GetStart(), firstGrid->StartTime(), firstGrid, col);
}
}
}
void cChannelColumn::AddNewGridsAtEnd() {
cGrid *lastGrid = NULL;
lastGrid = grids.Last();
if (lastGrid == NULL)
return;
//if last event is long enough, nothing to do.
if (lastGrid->EndTime() >= myTime->GetEnd()) {
return;
}
//if not, i have to add new ones to the list
schedules = cSchedules::Schedules(*schedulesLock);
const cSchedule *Schedule = NULL;
Schedule = schedules->GetSchedule(channel);
if (!Schedule) {
if (lastGrid->isDummy()) {
lastGrid->SetStartTime(myTime->GetStart());
lastGrid->SetEndTime(myTime->GetEnd());
}
return;
}
bool col = !(lastGrid->IsColor1());
bool dummyNeeded = true;
for (const cEvent *event = Schedule->GetEventAround(lastGrid->EndTime()+60); event; event = Schedule->Events()->Next(event)) {
if (!event)
break;
if (event->StartTime() > myTime->GetEnd()) {
break;
}
addEpgGrid(event, NULL, col);
col = !col;
if (event->EndTime() > myTime->GetEnd()) {
dummyNeeded = false;
break;
}
}
if (dummyNeeded) {
lastGrid = grids.Last();
if (lastGrid->isDummy()) {
lastGrid->SetEndTime(myTime->GetEnd());
if (lastGrid->StartTime() <= myTime->GetStart())
lastGrid->SetStartTime(myTime->GetStart());
} else {
addDummyGrid(lastGrid->EndTime(), myTime->GetEnd(), NULL, col);
}
}
} }
void cChannelColumn::ClearOutdatedStart() { void cChannelColumn::ClearOutdatedStart() {
bool goOn = true; cGrid *firstGrid = NULL;
cEpgGrid *firstGrid = NULL; while (true) {
while (goOn) { firstGrid = grids.First();
firstGrid = grids.First(); if (!firstGrid)
if ((firstGrid != NULL)&&(firstGrid->EndTime() < myTime->GetStart())) { break;
grids.Del(firstGrid); if (firstGrid->EndTime() <= myTime->GetStart()) {
firstGrid = NULL; grids.Del(firstGrid);
firstGrid = NULL;
} else { } else {
goOn = false; if (firstGrid->isDummy()) {
firstGrid->SetStartTime(myTime->GetStart());
cGrid *next = getNext(firstGrid);
if (next) {
firstGrid->SetEndTime(next->StartTime());
} else {
firstGrid->SetEndTime(myTime->GetEnd());
}
}
break;
} }
} }
} }
void cChannelColumn::ClearOutdatedEnd() { void cChannelColumn::ClearOutdatedEnd() {
bool goOn = true; cGrid *lastGrid = NULL;
cEpgGrid *lastGrid = NULL; while (true) {
while (goOn) {
lastGrid = grids.Last(); lastGrid = grids.Last();
if ((lastGrid != NULL)&&(lastGrid->StartTime() > myTime->GetStop())) { if (!lastGrid)
grids.Del(lastGrid); break;
lastGrid = NULL; if (lastGrid->StartTime() >= myTime->GetEnd()) {
grids.Del(lastGrid);
lastGrid = NULL;
} else { } else {
goOn = false; if (lastGrid->isDummy()) {
lastGrid->SetEndTime(myTime->GetEnd());
cGrid *prev = getPrev(lastGrid);
if (prev) {
lastGrid->SetStartTime(prev->EndTime());
} else {
lastGrid->SetStartTime(myTime->GetStart());
}
}
break;
} }
} }
} }
void cChannelColumn::dumpGrids() { cGrid *cChannelColumn::addEpgGrid(const cEvent *event, cGrid *firstGrid, bool color) {
esyslog("------Channel %s ---------", channel->Name()); cGrid *grid = new cEpgGrid(this, event);
grid->setText();
for (cEpgGrid *grid = grids.First(); grid; grid = grids.Next(grid)) { grid->SetColor(color);
grid->debug(); if (!firstGrid)
} grids.Add(grid);
else
grids.Ins(grid, firstGrid);
return grid;
} }
cGrid *cChannelColumn::addDummyGrid(time_t start, time_t end, cGrid *firstGrid, bool color) {
cGrid *dummy = new cDummyGrid(this, start, end);
dummy->setText();
dummy->SetColor(color);
if (!firstGrid)
grids.Add(dummy);
else
grids.Ins(dummy, firstGrid);
return dummy;
}
void cChannelColumn::dumpGrids() {
esyslog("tvguide: ------Channel %s: %d entires ---------", channel->Name(), grids.Count());
int i=1;
for (cGrid *grid = grids.First(); grid; grid = grids.Next(grid)) {
esyslog("tvguide: grid %d: start: %s, stop: %s", i, *cMyTime::printTime(grid->StartTime()), *cMyTime::printTime(grid->EndTime()));
i++;
}
}

View File

@ -1,33 +1,40 @@
#ifndef __TVGUIDE_CHANNELCOLUMN_H #ifndef __TVGUIDE_CHANNELCOLUMN_H
#define __TVGUIDE_CHANNELCOLUMN_H #define __TVGUIDE_CHANNELCOLUMN_H
class cGrid;
class cEpgGrid; class cEpgGrid;
class cHeaderGrid;
// --- cChannelColumn ------------------------------------------------------------- // --- cChannelColumn -------------------------------------------------------------
class cChannelColumn : public cListObject, public cStyledPixmap { class cChannelColumn : public cListObject, public cStyledPixmap {
friend class cEpgGrid;
private: private:
cPixmap *pixmapLogo; cMyTime *myTime;
cMyTime *myTime;
int num; int num;
cChannel *channel; const cChannel *channel;
cList<cEpgGrid> grids; cHeaderGrid *header;
cSchedulesLock schedulesLock; cList<cGrid> grids;
cSchedulesLock *schedulesLock;
const cSchedules *schedules; const cSchedules *schedules;
bool hasTimer; bool hasTimer;
cGrid *addEpgGrid(const cEvent *event, cGrid *firstGrid, bool color);
cGrid *addDummyGrid(time_t start, time_t end, cGrid *firstGrid, bool color);
public: public:
cChannelColumn(int num, cChannel *channel, cMyTime *myTime); cChannelColumn(int num, const cChannel *channel, cMyTime *myTime);
virtual ~cChannelColumn(void); virtual ~cChannelColumn(void);
void createHeader(); void createHeader();
void drawHeader(); void drawHeader();
bool readGrids(); bool readGrids();
void drawGrids(); void drawGrids();
int getX(); int getX();
cChannel * getChannel() {return channel;} int Start() { return myTime->GetStart(); };
cEpgGrid * getActive(); int Stop() { return myTime->GetEnd(); };
cEpgGrid * getNext(cEpgGrid *activeGrid); const char* Name() { return channel->Name(); };
cEpgGrid * getPrev(cEpgGrid *activeGrid); const cChannel * getChannel() {return channel;}
cEpgGrid * getNeighbor(cEpgGrid *activeGrid); cGrid * getActive();
cGrid * getNext(cGrid *activeGrid);
cGrid * getPrev(cGrid *activeGrid);
cGrid * getNeighbor(cGrid *activeGrid);
bool isFirst(cGrid *grid);
void AddNewGridsAtStart(); void AddNewGridsAtStart();
void AddNewGridsAtEnd(); void AddNewGridsAtEnd();
void ClearOutdatedStart(); void ClearOutdatedStart();
@ -35,8 +42,9 @@ public:
int GetNum() {return num;}; int GetNum() {return num;};
void SetNum(int num) {this->num = num;}; void SetNum(int num) {this->num = num;};
void setTimer() {hasTimer = true;}; void setTimer() {hasTimer = true;};
bool HasTimer() { return hasTimer; };
void clearGrids(); void clearGrids();
void dumpGrids(); void dumpGrids();
}; };
#endif //__TVGUIDE_CHANNELCOLUMN_H #endif //__TVGUIDE_CHANNELCOLUMN_H

View File

@ -12,6 +12,10 @@ cTvguideConfig::cTvguideConfig() {
channelCols = 5; channelCols = 5;
displayTime = 160; displayTime = 160;
minuteHeight = 0; minuteHeight = 0;
displayStatusHeader = 1;
statusHeaderPercent = 20;
statusHeaderHeight = 0;
scaleVideo = 1;
timeColWidth = 120; timeColWidth = 120;
headerHeight = 150; headerHeight = 150;
footerHeight = 80; footerHeight = 80;
@ -29,6 +33,8 @@ cTvguideConfig::cTvguideConfig() {
fontIndex = 0; fontIndex = 0;
fontNameDefault = "VDRSymbols Sans:Book"; fontNameDefault = "VDRSymbols Sans:Book";
fontHeaderSize = 33; fontHeaderSize = 33;
fontStatusHeaderSize = 27;
fontStatusHeaderLargeSize = 33;
fontGridSize = 27; fontGridSize = 27;
fontGridSmallSize = 24; fontGridSmallSize = 24;
fontTimeLineWeekdaySize = 40; fontTimeLineWeekdaySize = 40;
@ -41,8 +47,6 @@ cTvguideConfig::cTvguideConfig() {
fontDetailHeaderSize = 40; fontDetailHeaderSize = 40;
fontMessageBoxSize = 33; fontMessageBoxSize = 33;
fontMessageBoxLargeSize = 40; fontMessageBoxLargeSize = 40;
FontHeader = NULL; FontHeader = NULL;
FontGrid = NULL; FontGrid = NULL;
FontGridSmall = NULL; FontGridSmall = NULL;
@ -63,6 +67,8 @@ cTvguideConfig::cTvguideConfig() {
cTvguideConfig::~cTvguideConfig() { cTvguideConfig::~cTvguideConfig() {
delete FontHeader; delete FontHeader;
delete FontStatusHeader;
delete FontStatusHeaderLarge;
delete FontGrid; delete FontGrid;
delete FontGridSmall; delete FontGridSmall;
delete FontTimeLineWeekday; delete FontTimeLineWeekday;
@ -79,7 +85,8 @@ void cTvguideConfig::setDynamicValues(int width, int height) {
osdWidth = width; osdWidth = width;
osdHeight = height; osdHeight = height;
colWidth = (osdWidth - timeColWidth) / channelCols; colWidth = (osdWidth - timeColWidth) / channelCols;
minuteHeight = (osdHeight - headerHeight - footerHeight) / displayTime; statusHeaderHeight = (displayStatusHeader)?(statusHeaderPercent * osdHeight / 100):0;
minuteHeight = (osdHeight - statusHeaderHeight - headerHeight - footerHeight) / displayTime;
if (!fontTimeLineTimeSize) { if (!fontTimeLineTimeSize) {
if (timeFormat == e12Hours) { if (timeFormat == e12Hours) {
@ -110,6 +117,8 @@ void cTvguideConfig::setDynamicValues(int width, int height) {
} }
delete test; delete test;
FontHeader = cFont::CreateFont(*fontname, fontHeaderSize); FontHeader = cFont::CreateFont(*fontname, fontHeaderSize);
FontStatusHeader = cFont::CreateFont(*fontname, fontStatusHeaderSize);
FontStatusHeaderLarge = cFont::CreateFont(*fontname, fontStatusHeaderLargeSize);
FontGrid = cFont::CreateFont(*fontname, fontGridSize); FontGrid = cFont::CreateFont(*fontname, fontGridSize);
FontGridSmall = cFont::CreateFont(*fontname, fontGridSmallSize); FontGridSmall = cFont::CreateFont(*fontname, fontGridSmallSize);
FontTimeLineWeekday = cFont::CreateFont(*fontname, fontTimeLineWeekdaySize); FontTimeLineWeekday = cFont::CreateFont(*fontname, fontTimeLineWeekdaySize);
@ -142,6 +151,9 @@ void cTvguideConfig::loadTheme() {
bool cTvguideConfig::SetupParse(const char *Name, const char *Value) { bool cTvguideConfig::SetupParse(const char *Name, const char *Value) {
if (strcmp(Name, "timeFormat") == 0) timeFormat = atoi(Value); if (strcmp(Name, "timeFormat") == 0) timeFormat = atoi(Value);
else if (strcmp(Name, "themeIndex") == 0) themeIndex = atoi(Value); else if (strcmp(Name, "themeIndex") == 0) themeIndex = atoi(Value);
else if (strcmp(Name, "displayStatusHeader") == 0) displayStatusHeader = atoi(Value);
else if (strcmp(Name, "statusHeaderPercent") == 0) statusHeaderPercent = atoi(Value);
else if (strcmp(Name, "scaleVideo") == 0) scaleVideo = atoi(Value);
else if (strcmp(Name, "useBlending") == 0) useBlending = atoi(Value); else if (strcmp(Name, "useBlending") == 0) useBlending = atoi(Value);
else if (strcmp(Name, "roundedCorners") == 0) roundedCorners = atoi(Value); else if (strcmp(Name, "roundedCorners") == 0) roundedCorners = atoi(Value);
else if (strcmp(Name, "channelCols") == 0) channelCols = atoi(Value); else if (strcmp(Name, "channelCols") == 0) channelCols = atoi(Value);
@ -160,7 +172,9 @@ bool cTvguideConfig::SetupParse(const char *Name, const char *Value) {
else if (strcmp(Name, "headerHeight") == 0) headerHeight = atoi(Value); else if (strcmp(Name, "headerHeight") == 0) headerHeight = atoi(Value);
else if (strcmp(Name, "footerHeight") == 0) footerHeight = atoi(Value); else if (strcmp(Name, "footerHeight") == 0) footerHeight = atoi(Value);
else if (strcmp(Name, "fontIndex") == 0) fontIndex = atoi(Value); else if (strcmp(Name, "fontIndex") == 0) fontIndex = atoi(Value);
else if (strcmp(Name, "fontHeaderSize") == 0) fontHeaderSize = atoi(Value); else if (strcmp(Name, "fontHeaderSize") == 0) fontHeaderSize = atoi(Value);
else if (strcmp(Name, "fontStatusHeaderSize") == 0) fontStatusHeaderSize = atoi(Value);
else if (strcmp(Name, "fontStatusHeaderLargeSize") == 0) fontStatusHeaderLargeSize = atoi(Value);
else if (strcmp(Name, "fontGridSize") == 0) fontGridSize = atoi(Value); else if (strcmp(Name, "fontGridSize") == 0) fontGridSize = atoi(Value);
else if (strcmp(Name, "fontGridSmallSize") == 0) fontGridSmallSize = atoi(Value); else if (strcmp(Name, "fontGridSmallSize") == 0) fontGridSmallSize = atoi(Value);
else if (strcmp(Name, "fontTimeLineWeekdaySize") == 0) fontTimeLineWeekdaySize = atoi(Value); else if (strcmp(Name, "fontTimeLineWeekdaySize") == 0) fontTimeLineWeekdaySize = atoi(Value);

View File

@ -13,6 +13,10 @@ class cTvguideConfig {
int channelCols; int channelCols;
int displayTime; int displayTime;
int minuteHeight; int minuteHeight;
int displayStatusHeader;
int statusHeaderPercent;
int statusHeaderHeight;
int scaleVideo;
int timeColWidth; int timeColWidth;
int headerHeight; int headerHeight;
int footerHeight; int footerHeight;
@ -32,6 +36,8 @@ class cTvguideConfig {
int fontIndex; int fontIndex;
const char *fontNameDefault; const char *fontNameDefault;
int fontHeaderSize; int fontHeaderSize;
int fontStatusHeaderSize;
int fontStatusHeaderLargeSize;
int fontGridSize; int fontGridSize;
int fontGridSmallSize; int fontGridSmallSize;
int fontTimeLineWeekdaySize; int fontTimeLineWeekdaySize;
@ -45,6 +51,8 @@ class cTvguideConfig {
int fontMessageBoxSize; int fontMessageBoxSize;
int fontMessageBoxLargeSize; int fontMessageBoxLargeSize;
const cFont *FontHeader; const cFont *FontHeader;
const cFont *FontStatusHeader;
const cFont *FontStatusHeaderLarge;
const cFont *FontGrid; const cFont *FontGrid;
const cFont *FontGridSmall; const cFont *FontGridSmall;
const cFont *FontTimeLineWeekday; const cFont *FontTimeLineWeekday;

View File

@ -1,6 +1,6 @@
#include "detailview.h" #include "detailview.h"
cDetailView::cDetailView(cEpgGrid *grid) { cDetailView::cDetailView(cGrid *grid) {
this->grid = grid; this->grid = grid;
this->event = grid->GetEvent(); this->event = grid->GetEvent();
imgScrollBar = NULL; imgScrollBar = NULL;
@ -36,12 +36,12 @@ bool cDetailView::setContentDrawportHeight() {
void cDetailView::createPixmaps() { void cDetailView::createPixmaps() {
int scrollBarWidth = 50; int scrollBarWidth = 50;
header = new cStyledPixmap(osdManager.requestPixmap(5, cRect(borderWidth, borderWidth, tvguideConfig.osdWidth - 2*borderWidth, headerHeight), cRect::Null, "detailViewHeader"), "detailViewHeader"); header = new cStyledPixmap(osdManager.requestPixmap(5, cRect(borderWidth, borderWidth, tvguideConfig.osdWidth - 2*borderWidth, headerHeight), cRect::Null));
header->SetAlpha(0); header->SetAlpha(0);
headerLogo = osdManager.requestPixmap(6, cRect(borderWidth, borderWidth, tvguideConfig.osdWidth - 2*borderWidth, headerHeight), cRect::Null, "detailViewHeaderLogo"); headerLogo = osdManager.requestPixmap(6, cRect(borderWidth, borderWidth, tvguideConfig.osdWidth - 2*borderWidth, headerHeight), cRect::Null);
headerLogo->Fill(clrTransparent); headerLogo->Fill(clrTransparent);
headerLogo->SetAlpha(0); headerLogo->SetAlpha(0);
headerBack = osdManager.requestPixmap(4, cRect(borderWidth, borderWidth, tvguideConfig.osdWidth - 2*borderWidth, headerHeight), cRect::Null, "detailViewHeaderBack"); headerBack = osdManager.requestPixmap(4, cRect(borderWidth, borderWidth, tvguideConfig.osdWidth - 2*borderWidth, headerHeight), cRect::Null);
headerBack->SetAlpha(0); headerBack->SetAlpha(0);
headerBack->Fill(clrBlack); headerBack->Fill(clrBlack);
header->setColor(theme.Color(clrHeader), theme.Color(clrHeaderBlending)); header->setColor(theme.Color(clrHeader), theme.Color(clrHeaderBlending));

View File

@ -7,7 +7,7 @@ class cEpgGrid;
class cDetailView : public cThread { class cDetailView : public cThread {
private: private:
cEpgGrid *grid; cGrid *grid;
cStyledPixmap *header; cStyledPixmap *header;
cPixmap *headerLogo; cPixmap *headerLogo;
cPixmap *headerBack; cPixmap *headerBack;
@ -31,7 +31,7 @@ private:
void drawScrollbar(); void drawScrollbar();
cImage *createScrollbar(int width, int height, tColor clrBgr, tColor clrBlend); cImage *createScrollbar(int width, int height, tColor clrBgr, tColor clrBlend);
public: public:
cDetailView(cEpgGrid *grid); cDetailView(cGrid *grid);
virtual ~cDetailView(void); virtual ~cDetailView(void);
void createPixmaps(); void createPixmaps();
void scrollUp(); void scrollUp();

65
dummygrid.c Normal file
View File

@ -0,0 +1,65 @@
#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;
}
cDummyGrid::~cDummyGrid(void) {
}
void cDummyGrid::SetViewportHeight() {
int viewportHeightOld = viewportHeight;
viewportHeight = Duration() / 60 * tvguideConfig.minuteHeight;
if (viewportHeight != viewportHeightOld)
dirty = true;
}
void cDummyGrid::PositionPixmap() {
int x0 = column->getX();
int y0 = tvguideConfig.statusHeaderHeight + tvguideConfig.headerHeight;
if ( column->Start() < StartTime() ) {
y0 += (StartTime() - column->Start())/60*tvguideConfig.minuteHeight;
}
if (!pixmap) {
pixmap = osdManager.requestPixmap(-1, cRect(x0, y0, tvguideConfig.colWidth, viewportHeight), cRect::Null);
} else if (dirty) {
osdManager.releasePixmap(pixmap);
pixmap = osdManager.requestPixmap(-1, cRect(x0, y0, tvguideConfig.colWidth, viewportHeight), cRect::Null);
} else {
pixmap->SetViewPort(cRect(x0, y0, tvguideConfig.colWidth, viewportHeight));
}
}
void cDummyGrid::setText() {
text->Set(*(strText), tvguideConfig.FontGrid, tvguideConfig.colWidth-2*borderWidth);
}
void cDummyGrid::drawText() {
if (Height()/tvguideConfig.minuteHeight < 6)
return;
int textHeight = tvguideConfig.FontGrid->Height();
int textLines = text->Lines();
for (int i=0; i<textLines; i++) {
pixmap->DrawText(cPoint(borderWidth, borderWidth + i*textHeight), text->GetLine(i), theme.Color(clrFont), clrTransparent, tvguideConfig.FontGrid);
}
}
cString cDummyGrid::getText(void) {
return strText;
}
cString cDummyGrid::getTimeString(void) {
return cString::sprintf("%s - %s", *TimeString(start), *TimeString(end));
}
void cDummyGrid::debug() {
esyslog("tvguide dummygrid: %s: %s, %s, viewportHeight: %d px, Duration: %ld min, active: %d",
column->Name(),
*cMyTime::printTime(start),
*cMyTime::printTime(end),
viewportHeight,
Duration()/60,
active);
}

31
dummygrid.h Normal file
View File

@ -0,0 +1,31 @@
#ifndef __TVGUIDE_DUMMYGRID_H
#define __TVGUIDE_DUMMYGRID_H
// --- cDummyGrid -------------------------------------------------------------
class cDummyGrid : public cGrid {
private:
time_t start;
time_t end;
cString strText;
void drawText();
time_t Duration(void) { return (end - start); };
public:
cDummyGrid(cChannelColumn *c, time_t start, time_t end);
virtual ~cDummyGrid(void);
void SetViewportHeight();
void PositionPixmap();
void setText(void);
const cEvent *GetEvent() {return NULL;};
time_t StartTime() { return start; };
time_t EndTime() { return end; };
void SetStartTime(time_t start) { this->start = start; };
void SetEndTime(time_t end) { this->end = end; };
int calcOverlap(cGrid *neighbor);
void setTimer() {};
cString getText(void);
cString getTimeString(void);
void debug();
};
#endif //__TVGUIDE_DUMMYGRID_H

125
epggrid.c
View File

@ -1,93 +1,48 @@
#include "channelcolumn.h" #include "channelcolumn.h"
#include "epggrid.h" #include "epggrid.h"
cEpgGrid::cEpgGrid(cChannelColumn *c, const cEvent *event) { cEpgGrid::cEpgGrid(cChannelColumn *c, const cEvent *event) : cGrid(c) {
this->event = event; this->event = event;
this->column = c;
text = new cTextWrapper();
extText = new cTextWrapper(); extText = new cTextWrapper();
dirty = true;
active = false;
viewportHeight = 0;
borderWidth = 10;
hasTimer = false; hasTimer = false;
if (column->hasTimer) if (column->HasTimer())
hasTimer = event->HasTimer(); hasTimer = event->HasTimer();
dummy = false;
} }
cEpgGrid::~cEpgGrid(void) { cEpgGrid::~cEpgGrid(void) {
delete text;
delete extText; delete extText;
} }
void cEpgGrid::SetViewportHeight() { void cEpgGrid::SetViewportHeight() {
int viewportHeightOld = viewportHeight; int viewportHeightOld = viewportHeight;
if ( column->myTime->GetStart() > event->StartTime() ) { if ( column->Start() > StartTime() ) {
viewportHeight = (min(event->EndTime(), column->myTime->GetStop()) - column->myTime->GetStart()) /60; viewportHeight = (min((int)EndTime(), column->Stop()) - column->Start()) /60;
} else if ( column->myTime->GetStop() < event->EndTime() ) { } else if ( column->Stop() < EndTime() ) {
viewportHeight = (column->myTime->GetStop() - event->StartTime()) /60; viewportHeight = (column->Stop() - StartTime()) /60;
if (viewportHeight < 0) viewportHeight = 0;
} else { } else {
viewportHeight = event->Duration() / 60; viewportHeight = Duration() / 60;
} }
viewportHeight *= tvguideConfig.minuteHeight;
if (viewportHeight != viewportHeightOld) if (viewportHeight != viewportHeightOld)
dirty = true; dirty = true;
} }
void cEpgGrid::PositionPixmap() { void cEpgGrid::PositionPixmap() {
int x0 = column->getX(); int x0 = column->getX();
int y0 = tvguideConfig.headerHeight; int y0 = tvguideConfig.statusHeaderHeight + tvguideConfig.headerHeight;
if ( column->myTime->GetStart() < event->StartTime() ) { if ( column->Start() < StartTime() ) {
y0 += (event->StartTime() - column->myTime->GetStart())/60*tvguideConfig.minuteHeight; y0 += (StartTime() - column->Start())/60*tvguideConfig.minuteHeight;
} }
if (!pixmap) { if (!pixmap) {
caller = cString::sprintf("epggrid %s %s", column->channel->Name(), event->Title()); pixmap = osdManager.requestPixmap(-1, cRect(x0, y0, tvguideConfig.colWidth, viewportHeight),
pixmap = osdManager.requestPixmap(-1, cRect(x0, y0, tvguideConfig.colWidth, viewportHeight * tvguideConfig.minuteHeight), cRect(0, 0, tvguideConfig.colWidth, Duration()/60*tvguideConfig.minuteHeight));
cRect(0, 0, tvguideConfig.colWidth, event->Duration()/60*tvguideConfig.minuteHeight), *caller);
} else { } else {
pixmap->SetViewPort(cRect(x0, y0, tvguideConfig.colWidth, viewportHeight * tvguideConfig.minuteHeight)); pixmap->SetViewPort(cRect(x0, y0, tvguideConfig.colWidth, viewportHeight));
} }
} }
void cEpgGrid::setBackground() {
if (active) {
color = theme.Color(clrHighlight);
colorBlending = theme.Color(clrHighlightBlending);
} else {
if (isColor1) {
color = theme.Color(clrGrid1);
colorBlending = theme.Color(clrGrid1Blending);
} else {
color = theme.Color(clrGrid2);
colorBlending = theme.Color(clrGrid2Blending);
}
}
}
void cEpgGrid::Draw() {
if (!pixmap) {
return;
}
if (dirty) {
setBackground();
drawBackground();
drawText();
if (hasTimer)
DrawRecIcon();
drawBorder();
pixmap->SetLayer(1);
dirty = false;
}
}
void cEpgGrid::DrawRecIcon() {
cString recIconText("REC");
int width = tvguideConfig.FontGrid->Width(*recIconText)+2*borderWidth;
int height = tvguideConfig.FontGrid->Height()+10;
pixmap->DrawRectangle( cRect(pixmap->ViewPort().Width() - width - borderWidth, pixmap->ViewPort().Height() - height - borderWidth, width, height), theme.Color(clrButtonRed));
pixmap->DrawText(cPoint(pixmap->ViewPort().Width() - width, pixmap->ViewPort().Height() - height - borderWidth/2), *recIconText, theme.Color(clrFont), clrTransparent, tvguideConfig.FontGrid);
}
void cEpgGrid::setText() { void cEpgGrid::setText() {
cString strText; cString strText;
strText = cString::sprintf("%s - %s:\n%s", *(event->GetTimeString()), *(event->GetEndTimeString()), event->Title()); strText = cString::sprintf("%s - %s:\n%s", *(event->GetTimeString()), *(event->GetEndTimeString()), event->Title());
@ -96,8 +51,7 @@ void cEpgGrid::setText() {
} }
void cEpgGrid::drawText() { void cEpgGrid::drawText() {
int gridHeight = pixmap->ViewPort().Height(); if (Height()/tvguideConfig.minuteHeight < 6)
if (gridHeight/tvguideConfig.minuteHeight < 6)
return; return;
int textHeight = tvguideConfig.FontGrid->Height(); int textHeight = tvguideConfig.FontGrid->Height();
int textLines = text->Lines(); int textLines = text->Lines();
@ -107,40 +61,33 @@ void cEpgGrid::drawText() {
int extTextLines = extText->Lines(); int extTextLines = extText->Lines();
int offset = (textLines+1)*textHeight - 0.5*textHeight; int offset = (textLines+1)*textHeight - 0.5*textHeight;
textHeight = tvguideConfig.FontGridSmall->Height(); textHeight = tvguideConfig.FontGridSmall->Height();
if ((pixmap->ViewPort().Height()-textHeight-10) > offset) { if ((Height()-textHeight-10) > offset) {
for (int i=0; i<extTextLines; i++) { for (int i=0; i<extTextLines; i++) {
pixmap->DrawText(cPoint(borderWidth, borderWidth + offset + i*textHeight), extText->GetLine(i), theme.Color(clrFont), clrTransparent, tvguideConfig.FontGridSmall); pixmap->DrawText(cPoint(borderWidth, borderWidth + offset + i*textHeight), extText->GetLine(i), theme.Color(clrFont), clrTransparent, tvguideConfig.FontGridSmall);
} }
} }
if (hasTimer)
drawRecIcon();
} }
int cEpgGrid::calcOverlap(cEpgGrid *neighbor) { void cEpgGrid::drawRecIcon() {
int overlap = 0; cString recIconText("REC");
if (intersects(neighbor)) { int width = tvguideConfig.FontGrid->Width(*recIconText)+2*borderWidth;
if ((event->StartTime() <= neighbor->StartTime()) && (event->EndTime() <= neighbor->EndTime())) { int height = tvguideConfig.FontGrid->Height()+10;
overlap = event->EndTime() - neighbor->StartTime(); pixmap->DrawRectangle( cRect(Width() - width - borderWidth, Height() - height - borderWidth, width, height), theme.Color(clrButtonRed));
} else if ((event->StartTime() >= neighbor->StartTime()) && (event->EndTime() >= neighbor->EndTime())) { pixmap->DrawText(cPoint(Width() - width, Height() - height - borderWidth/2), *recIconText, theme.Color(clrFont), clrTransparent, tvguideConfig.FontGrid);
overlap = neighbor->EndTime() - event->StartTime();
} else if ((event->StartTime() >= neighbor->StartTime()) && (event->EndTime() <= neighbor->EndTime())) {
overlap = event->Duration();
} else if ((event->StartTime() <= neighbor->StartTime()) && (event->EndTime() >= neighbor->EndTime())) {
overlap = neighbor->EndTime() - neighbor->StartTime();
}
}
return overlap;
} }
bool cEpgGrid::intersects(cEpgGrid *neighbor) { cString cEpgGrid::getTimeString(void) {
return ! ( (neighbor->EndTime() <= event->StartTime()) || (neighbor->StartTime() >= event->EndTime()) ); return cString::sprintf("%s - %s", *(event->GetTimeString()), *(event->GetEndTimeString()));
}
bool cEpgGrid::isActiveInitial(time_t t) {
if ((event->StartTime() < t) && (event->EndTime() > t))
return true;
else
return false;
} }
void cEpgGrid::debug() { void cEpgGrid::debug() {
esyslog("tvguide Grid: %s, %s, viewportHeight: %d, Duration: %d", *(event->GetTimeString()), event->Title(), viewportHeight, event->Duration()/60); esyslog("tvguide epggrid: %s: %s, %s, viewportHeight: %d px, Duration: %d min, active: %d",
column->Name(),
*(event->GetTimeString()),
event->Title(),
viewportHeight,
event->Duration()/60,
active);
} }

View File

@ -3,41 +3,25 @@
// --- cEpgGrid ------------------------------------------------------------- // --- cEpgGrid -------------------------------------------------------------
class cEpgGrid : public cListObject, public cStyledPixmap { class cEpgGrid : public cGrid {
private: private:
const cEvent *event; const cEvent *event;
cTextWrapper *text;
cTextWrapper *extText; cTextWrapper *extText;
int viewportHeight; bool hasTimer;
int borderWidth;
void drawText(); void drawText();
void setBackground(); void drawRecIcon();
bool isColor1; time_t Duration(void) { return event->Duration(); };
bool active;
bool dirty;
bool intersects(cEpgGrid *neighbor);
bool hasTimer;
void DrawRecIcon();
public: public:
cEpgGrid(cChannelColumn *c, const cEvent *event); cEpgGrid(cChannelColumn *c, const cEvent *event);
virtual ~cEpgGrid(void); virtual ~cEpgGrid(void);
cChannelColumn *column;
void SetViewportHeight(); void SetViewportHeight();
void PositionPixmap(); void PositionPixmap();
void setText(); void setText(void);
void Draw();
void SetDirty() {dirty = true;};
void SetActive() {dirty = true; active = true;};
void SetInActive() {dirty = true; active = false;};
void SetColor(bool color) {isColor1 = color;};
bool IsColor1() {return isColor1;};
int GetViewportHeight() {return viewportHeight;};
const cEvent *GetEvent() {return event;}; const cEvent *GetEvent() {return event;};
bool isActiveInitial(time_t t);
time_t StartTime() { return event->StartTime(); }; time_t StartTime() { return event->StartTime(); };
time_t EndTime() { return event->EndTime(); }; time_t EndTime() { return event->EndTime(); };
int calcOverlap(cEpgGrid *neighbor);
void setTimer() {hasTimer = true;}; void setTimer() {hasTimer = true;};
cString getTimeString(void);
void debug(); void debug();
}; };

View File

@ -10,12 +10,12 @@ cFooter::cFooter() {
tvguideConfig.osdHeight - tvguideConfig.footerHeight, tvguideConfig.osdHeight - tvguideConfig.footerHeight,
tvguideConfig.osdWidth - tvguideConfig.timeColWidth, tvguideConfig.osdWidth - tvguideConfig.timeColWidth,
tvguideConfig.footerHeight), tvguideConfig.footerHeight),
cRect::Null, "footer"); cRect::Null);
footer->Fill(clrTransparent); footer->Fill(clrTransparent);
} }
cFooter::~cFooter(void) { cFooter::~cFooter(void) {
osdManager.releasePixmap(footer, "footer");; osdManager.releasePixmap(footer);
} }
void cFooter::drawRedButton() { void cFooter::drawRedButton() {

77
grid.c Normal file
View File

@ -0,0 +1,77 @@
#include "channelcolumn.h"
#include "grid.h"
cGrid::cGrid(cChannelColumn *c) {
this->column = c;
text = new cTextWrapper();
dirty = true;
active = false;
viewportHeight = 0;
borderWidth = 10;
}
cGrid::~cGrid(void) {
delete text;
}
void cGrid::setBackground() {
if (active) {
color = theme.Color(clrHighlight);
colorBlending = theme.Color(clrHighlightBlending);
} else {
if (isColor1) {
color = theme.Color(clrGrid1);
colorBlending = theme.Color(clrGrid1Blending);
} else {
color = theme.Color(clrGrid2);
colorBlending = theme.Color(clrGrid2Blending);
}
}
}
void cGrid::Draw() {
if (!pixmap) {
return;
}
if (dirty) {
setBackground();
drawBackground();
drawText();
drawBorder();
pixmap->SetLayer(1);
dirty = false;
}
}
bool cGrid::isFirst(void) {
if (column->isFirst(this))
return true;
return false;
}
bool cGrid::Match(time_t t) {
if ((StartTime() < t) && (EndTime() > t))
return true;
else
return false;
}
int cGrid::calcOverlap(cGrid *neighbor) {
int overlap = 0;
if (intersects(neighbor)) {
if ((StartTime() <= neighbor->StartTime()) && (EndTime() <= neighbor->EndTime())) {
overlap = EndTime() - neighbor->StartTime();
} else if ((StartTime() >= neighbor->StartTime()) && (EndTime() >= neighbor->EndTime())) {
overlap = neighbor->EndTime() - StartTime();
} else if ((StartTime() >= neighbor->StartTime()) && (EndTime() <= neighbor->EndTime())) {
overlap = Duration();
} else if ((StartTime() <= neighbor->StartTime()) && (EndTime() >= neighbor->EndTime())) {
overlap = neighbor->EndTime() - neighbor->StartTime();
}
}
return overlap;
}
bool cGrid::intersects(cGrid *neighbor) {
return ! ( (neighbor->EndTime() <= StartTime()) || (neighbor->StartTime() >= EndTime()) );
}

48
grid.h Normal file
View File

@ -0,0 +1,48 @@
#ifndef __TVGUIDE_GRID_H
#define __TVGUIDE_GRID_H
// --- cEpgGrid -------------------------------------------------------------
class cGrid : public cListObject, public cStyledPixmap {
protected:
cTextWrapper *text;
int viewportHeight;
int borderWidth;
void setBackground();
bool isColor1;
bool active;
bool dirty;
bool intersects(cGrid *neighbor);
virtual time_t Duration(void) {};
virtual void drawText(void) {};
bool dummy;
public:
cGrid(cChannelColumn *c);
virtual ~cGrid(void);
cChannelColumn *column;
virtual void SetViewportHeight() {};
virtual void PositionPixmap() {};
virtual void setText(void) {};
void Draw();
void SetDirty() {dirty = true;};
void SetActive() {dirty = true; active = true;};
void SetInActive() {dirty = true; active = false;};
void SetColor(bool color) {isColor1 = color;};
bool IsColor1() {return isColor1;};
bool isFirst(void);
virtual const cEvent *GetEvent() {};
bool Match(time_t t);
virtual time_t StartTime() {};
virtual time_t EndTime() {};
virtual void SetStartTime(time_t start) {};
virtual void SetEndTime(time_t end) {};
int calcOverlap(cGrid *neighbor);
virtual void setTimer() {};
virtual cString getText(void) { return cString("");};
virtual cString getTimeString(void) { return cString("");};
bool Active(void) { return active; };
bool isDummy() { return dummy; };
virtual void debug() {};
};
#endif //__TVGUIDE_GRID_H

70
headergrid.c Normal file
View File

@ -0,0 +1,70 @@
#include "headergrid.h"
cHeaderGrid::cHeaderGrid(void) : cGrid(NULL) {
pixmap = NULL;
pixmapLogo = NULL;
}
cHeaderGrid::~cHeaderGrid(void) {
osdManager.releasePixmap(pixmapLogo);
}
void cHeaderGrid::createBackground(int num) {
color = theme.Color(clrHeader);
colorBlending = theme.Color(clrHeaderBlending);
pixmap = osdManager.requestPixmap(2, cRect( tvguideConfig.timeColWidth + num*tvguideConfig.colWidth,
tvguideConfig.statusHeaderHeight,
tvguideConfig.colWidth,
tvguideConfig.headerHeight)
, cRect::Null);
if (!pixmap) {
return;
}
pixmapLogo = osdManager.requestPixmap(3, cRect( tvguideConfig.timeColWidth + num*tvguideConfig.colWidth,
tvguideConfig.statusHeaderHeight,
tvguideConfig.colWidth,
tvguideConfig.headerHeight)
, cRect::Null);
if (!pixmapLogo) {
return;
}
pixmapLogo->Fill(clrTransparent);
drawBackground();
}
void cHeaderGrid::drawChannel(const cChannel *channel) {
cTextWrapper tw;
cString headerText = cString::sprintf("%d - %s", channel->Number(), channel->Name());
tw.Set(*headerText, tvguideConfig.FontHeader, tvguideConfig.colWidth - 8);
int lines = tw.Lines();
int lineHeight = tvguideConfig.FontHeader->Height();
int yStart = (tvguideConfig.headerHeight - lines*lineHeight)/2 + 8;
if (!tvguideConfig.hideChannelLogos) {
cImageLoader imgLoader;
if (imgLoader.LoadLogo(channel->Name())) {
cImage logo = imgLoader.GetImage();
int logoX = (tvguideConfig.colWidth - tvguideConfig.logoWidth)/2;
pixmapLogo->DrawImage(cPoint(logoX, 5), logo);
}
yStart = tvguideConfig.logoHeight + 8;
}
for (int i=0; i<lines; i++) {
int textWidth = tvguideConfig.FontHeader->Width(tw.GetLine(i));
int xText = (tvguideConfig.colWidth - textWidth) / 2;
if (xText < 0)
xText = 0;
pixmap->DrawText(cPoint(xText, yStart + i*lineHeight), tw.GetLine(i), theme.Color(clrFontHeader), clrTransparent, tvguideConfig.FontHeader);
}
drawBorder();
}
void cHeaderGrid::setPosition(int num) {
pixmap->SetViewPort(cRect( tvguideConfig.timeColWidth + num*tvguideConfig.colWidth,
tvguideConfig.statusHeaderHeight,
tvguideConfig.colWidth,
tvguideConfig.headerHeight));
pixmapLogo->SetViewPort(cRect( tvguideConfig.timeColWidth + num*tvguideConfig.colWidth,
tvguideConfig.statusHeaderHeight,
tvguideConfig.colWidth,
tvguideConfig.headerHeight));
}

17
headergrid.h Normal file
View File

@ -0,0 +1,17 @@
#ifndef __TVGUIDE_HEADERGRID_H
#define __TVGUIDE_HEADERGRID_H
// --- cHeaderGrid -------------------------------------------------------------
class cHeaderGrid : public cGrid {
private:
cPixmap *pixmapLogo;
public:
cHeaderGrid(void);
virtual ~cHeaderGrid(void);
void createBackground(int num);
void drawChannel(const cChannel *channel);
void setPosition(int num);
};
#endif //__TVGUIDE_HEADERGRID_H

View File

@ -97,9 +97,9 @@ void cImageLoader::toLowerCase(std::string &str) {
bool cImageLoader::LoadImage(cString FileName, cString Path, cString Extension) { bool cImageLoader::LoadImage(cString FileName, cString Path, cString Extension) {
try { try {
cString File = cString::sprintf("%s%s.%s", *Path, *FileName, *Extension); cString File = cString::sprintf("%s%s.%s", *Path, *FileName, *Extension);
dsyslog("tvguide: trying to load: %s", *File); //dsyslog("tvguide: trying to load: %s", *File);
buffer.read(*File); buffer.read(*File);
dsyslog("tvguide: %s sucessfully loaded", *File); //dsyslog("tvguide: %s sucessfully loaded", *File);
} catch (...) { } catch (...) {
return false; return false;
} }

View File

@ -8,7 +8,9 @@ cMessageBoxThread::cMessageBoxThread(cPixmap *content, int displayTime) {
} }
cMessageBoxThread::~cMessageBoxThread(void) { cMessageBoxThread::~cMessageBoxThread(void) {
Cancel(0); Cancel(-1);
while (Active())
cCondWait::SleepMs(10);
} }
void cMessageBoxThread::Action(void) { void cMessageBoxThread::Action(void) {
@ -18,7 +20,7 @@ void cMessageBoxThread::Action(void) {
cPixmap::Lock(); cPixmap::Lock();
double t = min(double(Now - Start) / FadeTime, 1.0); double t = min(double(Now - Start) / FadeTime, 1.0);
int Alpha = t * ALPHA_OPAQUE; int Alpha = t * ALPHA_OPAQUE;
if (content) { if (Running() && content) {
content->SetAlpha(Alpha); content->SetAlpha(Alpha);
osdManager.flush(); osdManager.flush();
} }
@ -36,7 +38,7 @@ void cMessageBoxThread::Action(void) {
cPixmap::Lock(); cPixmap::Lock();
double t = min(double(Now - Start) / FadeTime, 1.0); double t = min(double(Now - Start) / FadeTime, 1.0);
int Alpha = (1-t) * ALPHA_OPAQUE; int Alpha = (1-t) * ALPHA_OPAQUE;
if (content) { if (Running() && content) {
content->SetAlpha(Alpha); content->SetAlpha(Alpha);
osdManager.flush(); osdManager.flush();
} }
@ -51,19 +53,16 @@ void cMessageBoxThread::Action(void) {
} }
//--cMessageBox------------------------------------------------------------- //--cMessageBox-------------------------------------------------------------
cMutex cMessageBox::mutex;
cMessageBoxThread *cMessageBox::msgboxThread = NULL; cMessageBoxThread *cMessageBox::msgboxThread = NULL;
cPixmap *cMessageBox::content = NULL; cPixmap *cMessageBox::content = NULL;
bool cMessageBox::Start(int displayTime, cString msg) { bool cMessageBox::Start(int displayTime, cString msg) {
cMutexLock MutexLock(&mutex);
int width = (tvguideConfig.osdWidth - 600)/2; int width = (tvguideConfig.osdWidth - 600)/2;
if (!content) { if (!content) {
int height = 400; int height = 400;
content = osdManager.requestPixmap(5, cRect((tvguideConfig.osdWidth - width)/2, content = osdManager.requestPixmap(5, cRect((tvguideConfig.osdWidth - width)/2,
(tvguideConfig.osdHeight- height)/2, (tvguideConfig.osdHeight- height)/2,
width, height), width, height));
cRect::Null, "msgbox");
} }
if (msgboxThread) { if (msgboxThread) {
delete msgboxThread; delete msgboxThread;
@ -94,7 +93,6 @@ bool cMessageBox::Start(int displayTime, cString msg) {
} }
void cMessageBox::Stop(void) { void cMessageBox::Stop(void) {
cMutexLock MutexLock(&mutex);
if (msgboxThread) { if (msgboxThread) {
delete msgboxThread; delete msgboxThread;
msgboxThread = NULL; msgboxThread = NULL;
@ -102,13 +100,12 @@ void cMessageBox::Stop(void) {
} }
void cMessageBox::Destroy(void) { void cMessageBox::Destroy(void) {
cMutexLock MutexLock(&mutex);
if (msgboxThread) { if (msgboxThread) {
delete msgboxThread; delete msgboxThread;
msgboxThread = NULL; msgboxThread = NULL;
} }
if (content) { if (content) {
osdManager.releasePixmap(content, "msgboxDestroy"); osdManager.releasePixmap(content);
content = NULL; content = NULL;
} }
} }

View File

@ -1,8 +1,6 @@
#ifndef __TVGUIDE_MESSAGEBOX_H #ifndef __TVGUIDE_MESSAGEBOX_H
#define __TVGUIDE_MESSAGEBOX_H #define __TVGUIDE_MESSAGEBOX_H
class cMessageBoxThreadPool;
// --- cMessageBox ------------------------------------------------------------- // --- cMessageBox -------------------------------------------------------------
class cMessageBoxThread : public cThread { class cMessageBoxThread : public cThread {

View File

@ -1,17 +1,19 @@
#include <string>
#include <sstream>
#ifndef __TVGUIDE_OSDMANAGER_H #ifndef __TVGUIDE_OSDMANAGER_H
#define __TVGUIDE_OSDMANAGER_H #define __TVGUIDE_OSDMANAGER_H
class cOsdManager { class cOsdManager {
private: private:
cOsd *osd; cOsd *osd;
int activePixmaps;
public: public:
cOsdManager(void); cOsdManager(void);
bool setOsd(); bool setOsd();
void setBackground(); void setBackground();
void flush() {osd->Flush();}; void flush() {osd->Flush();};
cPixmap *requestPixmap(int Layer, const cRect &ViewPort, const cRect &DrawPort = cRect::Null, const char *caller = "anonymous"); cPixmap *requestPixmap(int Layer, const cRect &ViewPort, const cRect &DrawPort = cRect::Null);
void releasePixmap(cPixmap *pixmap, const char *caller = "anonymous"); void releasePixmap(cPixmap *pixmap);
void deleteOsd() {delete osd;}; void deleteOsd() {delete osd;};
int Width() { return osd->Width(); }; int Width() { return osd->Width(); };
int Height() { return osd->Height(); }; int Height() { return osd->Height(); };
@ -20,7 +22,6 @@ class cOsdManager {
#endif //__TVGUIDE_OSDMANAGER_H #endif //__TVGUIDE_OSDMANAGER_H
cOsdManager::cOsdManager(void) { cOsdManager::cOsdManager(void) {
activePixmaps = 0;
} }
bool cOsdManager::setOsd() { bool cOsdManager::setOsd() {
@ -35,18 +36,48 @@ bool cOsdManager::setOsd() {
} }
void cOsdManager::setBackground() { void cOsdManager::setBackground() {
osd->DrawRectangle(0, 0, cOsd::OsdWidth(), cOsd::OsdHeight(), theme.Color(clrBackgroundOSD)); if (tvguideConfig.displayStatusHeader && tvguideConfig.scaleVideo) {
osd->DrawRectangle(0, 0, cOsd::OsdWidth() - tvguideConfig.statusHeaderHeight * 16 / 9, tvguideConfig.statusHeaderHeight, theme.Color(clrBackgroundOSD));
osd->DrawRectangle(0, tvguideConfig.statusHeaderHeight, cOsd::OsdWidth(), cOsd::OsdHeight() - tvguideConfig.statusHeaderHeight, theme.Color(clrBackgroundOSD));
}
else
osd->DrawRectangle(0, 0, cOsd::OsdWidth(), cOsd::OsdHeight(), theme.Color(clrBackgroundOSD));
} }
cPixmap *cOsdManager::requestPixmap(int Layer, const cRect &ViewPort, const cRect &DrawPort, const char *caller) {
if (activePixmaps >= 64)
return NULL;
activePixmaps++;
//esyslog("tvguide: Pixmap angefordert von %s, verwendet: %d", caller, activePixmaps);
return osd->CreatePixmap(Layer, ViewPort, DrawPort);
}
void cOsdManager::releasePixmap(cPixmap *pixmap, const char *caller) { cPixmap *cOsdManager::requestPixmap(int Layer, const cRect &ViewPort, const cRect &DrawPort) {
activePixmaps--; return osd->CreatePixmap(Layer, ViewPort, DrawPort);
//esyslog("tvguide: Pixmap geloescht von %s, verwendet: %d", caller, activePixmaps); }
void cOsdManager::releasePixmap(cPixmap *pixmap) {
if (!pixmap)
return;
osd->DestroyPixmap(pixmap); osd->DestroyPixmap(pixmap);
}
static std::string CutText(std::string text, int width, const cFont *font) {
if (width <= font->Size())
return text.c_str();
if (font->Width(text.c_str()) < width)
return text.c_str();
cTextWrapper twText;
twText.Set(text.c_str(), font, width);
std::string cuttedTextNative = twText.GetLine(0);
std::stringstream sstrText;
sstrText << cuttedTextNative << "...";
std::string cuttedText = sstrText.str();
int actWidth = font->Width(cuttedText.c_str());
if (actWidth > width) {
int overlap = actWidth - width;
int charWidth = font->Width(".");
if (charWidth == 0)
charWidth = 1;
int cutChars = overlap / charWidth;
if (cutChars > 0) {
cuttedTextNative = cuttedTextNative.substr(0, cuttedTextNative.length() - cutChars);
std::stringstream sstrText2;
sstrText2 << cuttedTextNative << "...";
cuttedText = sstrText2.str();
}
}
return cuttedText;
} }

View File

@ -3,7 +3,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: vdr-tvguide 0.0.1\n" "Project-Id-Version: vdr-tvguide 0.0.1\n"
"Report-Msgid-Bugs-To: <see README>\n" "Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2013-01-17 14:01+0100\n" "POT-Creation-Date: 2013-05-20 11:27+0200\n"
"PO-Revision-Date: 2012-08-25 17:49+0200\n" "PO-Revision-Date: 2012-08-25 17:49+0200\n"
"Last-Translator: Horst\n" "Last-Translator: Horst\n"
"Language-Team: \n" "Language-Team: \n"
@ -12,6 +12,9 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n" "Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
msgid "No EPG Information available"
msgstr "Keine EPG Daten verfügbar"
msgid "Set Timer" msgid "Set Timer"
msgstr "Aufnehmen" msgstr "Aufnehmen"
@ -54,6 +57,15 @@ msgstr "Zeitformat (12h/24h)"
msgid "Theme" msgid "Theme"
msgstr "Theme" msgstr "Theme"
msgid "Display status header"
msgstr "Status Header anzeigen"
msgid "Scale video to upper right corner"
msgstr "Video in obere rechte Ecke skalieren"
msgid "Height of status header (Perc. of osd height)"
msgstr "Höhe des Status Headers (% der OSD Höhe)"
msgid "Use color gradients" msgid "Use color gradients"
msgstr "Farbverläufe verwenden" msgstr "Farbverläufe verwenden"
@ -99,6 +111,12 @@ msgstr "Höhe der EPG Bilder"
msgid "Font" msgid "Font"
msgstr "Schriftart" msgstr "Schriftart"
msgid "Status Header Large Font Size"
msgstr "Status Header große Schriftgröße"
msgid "Status Header Font Size"
msgstr "Status Header Schriftgröße"
msgid "Channel Header Font Size" msgid "Channel Header Font Size"
msgstr "Kanal Header Schriftgröße" msgstr "Kanal Header Schriftgröße"

17
setup.c
View File

@ -46,7 +46,10 @@ void cTvguideSetup::Store(void) {
tvguideConfig = tmpTvguideConfig; tvguideConfig = tmpTvguideConfig;
SetupStore("themeIndex", tvguideConfig.themeIndex); SetupStore("themeIndex", tvguideConfig.themeIndex);
SetupStore("useBlending", tvguideConfig.useBlending); SetupStore("displayStatusHeader", tvguideConfig.displayStatusHeader);
SetupStore("statusHeaderPercent", tvguideConfig.statusHeaderPercent);
SetupStore("scaleVideo", tvguideConfig.scaleVideo);
SetupStore("useBlending", tvguideConfig.useBlending);
SetupStore("roundedCorners", tvguideConfig.roundedCorners); SetupStore("roundedCorners", tvguideConfig.roundedCorners);
SetupStore("timeFormat", tvguideConfig.timeFormat); SetupStore("timeFormat", tvguideConfig.timeFormat);
SetupStore("channelCols", tvguideConfig.channelCols); SetupStore("channelCols", tvguideConfig.channelCols);
@ -67,6 +70,8 @@ void cTvguideSetup::Store(void) {
SetupStore("footerHeight", tvguideConfig.footerHeight); SetupStore("footerHeight", tvguideConfig.footerHeight);
SetupStore("fontIndex", tvguideConfig.fontIndex); SetupStore("fontIndex", tvguideConfig.fontIndex);
SetupStore("fontHeaderSize", tvguideConfig.fontHeaderSize); SetupStore("fontHeaderSize", tvguideConfig.fontHeaderSize);
SetupStore("fontStatusHeaderSize", tvguideConfig.fontStatusHeaderSize);
SetupStore("fontStatusHeaderLargeSize", tvguideConfig.fontStatusHeaderLargeSize);
SetupStore("fontGridSize", tvguideConfig.fontGridSize); SetupStore("fontGridSize", tvguideConfig.fontGridSize);
SetupStore("fontGridSmallSize", tvguideConfig.fontGridSmallSize); SetupStore("fontGridSmallSize", tvguideConfig.fontGridSmallSize);
SetupStore("fontTimeLineWeekdaySize", tvguideConfig.fontTimeLineWeekdaySize); SetupStore("fontTimeLineWeekdaySize", tvguideConfig.fontTimeLineWeekdaySize);
@ -142,17 +147,23 @@ cMenuSetupScreenLayout::cMenuSetupScreenLayout(cTvguideConfig* data) : cMenuSet
} }
void cMenuSetupScreenLayout::Set(void) { void cMenuSetupScreenLayout::Set(void) {
const char *indent = " ";
int currentItem = Current(); int currentItem = Current();
Clear(); Clear();
if (themes.NumThemes()) if (themes.NumThemes())
Add(new cMenuEditStraItem(tr("Theme"), &tmpTvguideConfig->themeIndex, themes.NumThemes(), themes.Descriptions())); Add(new cMenuEditStraItem(tr("Theme"), &tmpTvguideConfig->themeIndex, themes.NumThemes(), themes.Descriptions()));
Add(new cMenuEditBoolItem(tr("Display status header"), &tmpTvguideConfig->displayStatusHeader));
if (tmpTvguideConfig->displayStatusHeader) {
Add(new cMenuEditBoolItem(*cString::sprintf("%s%s", indent, tr("Scale video to upper right corner")), &tmpTvguideConfig->scaleVideo));
Add(new cMenuEditIntItem(*cString::sprintf("%s%s", indent, tr("Height of status header (Perc. of osd height)")), &tmpTvguideConfig->statusHeaderPercent, 5, 50));
}
Add(new cMenuEditStraItem(tr("Use color gradients"), &tmpTvguideConfig->useBlending, 3, blendingMethods)); Add(new cMenuEditStraItem(tr("Use color gradients"), &tmpTvguideConfig->useBlending, 3, blendingMethods));
Add(new cMenuEditBoolItem(tr("Rounded Corners"), &tmpTvguideConfig->roundedCorners)); Add(new cMenuEditBoolItem(tr("Rounded Corners"), &tmpTvguideConfig->roundedCorners));
Add(new cMenuEditIntItem(tr("Width of Timeline"), &tmpTvguideConfig->timeColWidth, 50, 300)); Add(new cMenuEditIntItem(tr("Width of Timeline"), &tmpTvguideConfig->timeColWidth, 50, 300));
Add(new cMenuEditIntItem(tr("Height of Header"), &tmpTvguideConfig->headerHeight, 50, 300)); Add(new cMenuEditIntItem(tr("Height of Header"), &tmpTvguideConfig->headerHeight, 50, 300));
Add(new cMenuEditIntItem(tr("Height of Footer"), &tmpTvguideConfig->footerHeight, 50, 300)); Add(new cMenuEditIntItem(tr("Height of Footer"), &tmpTvguideConfig->footerHeight, 50, 300));
const char *indent = " ";
Add(new cMenuEditStraItem(tr("Show Channel Logos"), &tmpTvguideConfig->hideChannelLogos, 2, hideChannelLogosItems)); Add(new cMenuEditStraItem(tr("Show Channel Logos"), &tmpTvguideConfig->hideChannelLogos, 2, hideChannelLogosItems));
if (!tmpTvguideConfig->hideChannelLogos) { if (!tmpTvguideConfig->hideChannelLogos) {
Add(InfoItem(tr("Logo Path used"), *tvguideConfig.logoPath)); Add(InfoItem(tr("Logo Path used"), *tvguideConfig.logoPath));
@ -195,6 +206,8 @@ void cMenuSetupFont::Set(void) {
Clear(); Clear();
Add(new cMenuEditStraItem(tr("Font"), &tmpTvguideConfig->fontIndex, fontNames.Size(), &fontNames[0])); Add(new cMenuEditStraItem(tr("Font"), &tmpTvguideConfig->fontIndex, fontNames.Size(), &fontNames[0]));
Add(new cMenuEditIntItem(tr("Status Header Large Font Size"), &tmpTvguideConfig->fontStatusHeaderLargeSize, 10, 70));
Add(new cMenuEditIntItem(tr("Status Header Font Size"), &tmpTvguideConfig->fontStatusHeaderSize, 10, 70));
Add(new cMenuEditIntItem(tr("Channel Header Font Size"), &tmpTvguideConfig->fontHeaderSize, 10, 70)); Add(new cMenuEditIntItem(tr("Channel Header Font Size"), &tmpTvguideConfig->fontHeaderSize, 10, 70));
Add(new cMenuEditIntItem(tr("Grid Font Size"), &tmpTvguideConfig->fontGridSize, 10, 70)); Add(new cMenuEditIntItem(tr("Grid Font Size"), &tmpTvguideConfig->fontGridSize, 10, 70));
Add(new cMenuEditIntItem(tr("Grid Font Small Size"), &tmpTvguideConfig->fontGridSmallSize, 10, 70)); Add(new cMenuEditIntItem(tr("Grid Font Small Size"), &tmpTvguideConfig->fontGridSmallSize, 10, 70));

74
statusheader.c Normal file
View File

@ -0,0 +1,74 @@
#include "statusheader.h"
cStatusHeader::cStatusHeader(void) {
color = theme.Color(clrStatusHeader);
colorBlending = theme.Color(clrStatusHeaderBlending);
int height = tvguideConfig.statusHeaderHeight;
int width;
if (tvguideConfig.scaleVideo) {
width = tvguideConfig.osdWidth - height * 16 / 9;
} else {
width = tvguideConfig.osdWidth;
}
pixmap = osdManager.requestPixmap(1, cRect(0, 0, width, height));
pixmapText = osdManager.requestPixmap(2, cRect(0, 0, width, height));
pixmapText->Fill(clrTransparent);
drawBackground();
drawBorder();
}
cStatusHeader::~cStatusHeader(void) {
if (tvguideConfig.scaleVideo) {
cRect vidWin = cDevice::PrimaryDevice()->CanScaleVideo(cRect::Null);
cDevice::PrimaryDevice()->ScaleVideo(vidWin);
}
}
void cStatusHeader::ScaleVideo(void) {
if (tvguideConfig.scaleVideo) {
int height = tvguideConfig.statusHeaderHeight;
int width = height * 16 / 9;
int x = tvguideConfig.osdWidth - width;
int y = 0;
cRect availableRect(x, y, width, height);
cRect vidWin = cDevice::PrimaryDevice()->CanScaleVideo(availableRect);
cDevice::PrimaryDevice()->ScaleVideo(vidWin);
}
}
void cStatusHeader::DrawInfoText(cGrid *grid) {
int border = 5;
pixmapText->Fill(clrTransparent);
int x = border;
int y = border;
if (!grid->isDummy()) {
cString time = grid->getTimeString();
cString title("");
const cEvent *event = grid->GetEvent();
title = cString::sprintf(": %s", event->Title());
cString header = cString::sprintf("%s%s", *time, *title);
header = CutText(*header, pixmapText->ViewPort().Width() - 2 * border, tvguideConfig.FontStatusHeaderLarge).c_str();
pixmapText->DrawText(cPoint(x,y), *header, theme.Color(clrFont), clrTransparent, tvguideConfig.FontStatusHeaderLarge);
y += tvguideConfig.FontStatusHeaderLarge->Height() + border;
int heightText = pixmapText->ViewPort().Height() - y;
cTextWrapper description;
description.Set(event->Description(), tvguideConfig.FontStatusHeader, pixmapText->ViewPort().Width() - 2 * border);
int lineHeight = tvguideConfig.FontStatusHeader->Height();
int textLines = description.Lines();
int maxLines = heightText / lineHeight;
int lines = min(textLines, maxLines);
for (int i = 0; i < lines-1; i++) {
pixmapText->DrawText(cPoint(x,y), description.GetLine(i), theme.Color(clrFont), clrTransparent, tvguideConfig.FontStatusHeader);
y += lineHeight;
}
cString lastLine = description.GetLine(lines-1);
if (textLines > maxLines) {
lastLine = cString::sprintf("%s...", *lastLine);
}
pixmapText->DrawText(cPoint(x,y), *lastLine, theme.Color(clrFont), clrTransparent, tvguideConfig.FontStatusHeader);
} else {
int heightText = pixmapText->ViewPort().Height() - y;
y += (heightText - tvguideConfig.FontStatusHeaderLarge->Height() - 2*border)/2;
pixmapText->DrawText(cPoint(x,y), *grid->getText(), theme.Color(clrFont), clrTransparent, tvguideConfig.FontStatusHeaderLarge);
}
}

16
statusheader.h Normal file
View File

@ -0,0 +1,16 @@
#ifndef __TVGUIDE_STATUSHEADER_H
#define __TVGUIDE_STATUSHEADER_H
// --- cStatusHeader -------------------------------------------------------------
class cStatusHeader : public cStyledPixmap {
private:
cPixmap *pixmapText;
public:
cStatusHeader(void);
virtual ~cStatusHeader(void);
void ScaleVideo(void);
void DrawInfoText(cGrid *grid);
};
#endif //__TVGUIDE_STATUSHEADER_H

View File

@ -2,17 +2,15 @@
cStyledPixmap::cStyledPixmap(void) { cStyledPixmap::cStyledPixmap(void) {
pixmap = NULL; pixmap = NULL;
caller = NULL;
} }
cStyledPixmap::cStyledPixmap(cPixmap *pixmap, cString caller) { cStyledPixmap::cStyledPixmap(cPixmap *pixmap) {
this->pixmap = pixmap; this->pixmap = pixmap;
this->caller = caller;
} }
cStyledPixmap::~cStyledPixmap(void) { cStyledPixmap::~cStyledPixmap(void) {
if (pixmap) if (pixmap)
osdManager.releasePixmap(pixmap, *caller); osdManager.releasePixmap(pixmap);
} }
void cStyledPixmap::setPixmap(cPixmap *pixmap) { void cStyledPixmap::setPixmap(cPixmap *pixmap) {

View File

@ -9,13 +9,12 @@ private:
void drawHorizontalLine(int y, int xStart, int xStop, tColor col); void drawHorizontalLine(int y, int xStart, int xStop, tColor col);
protected: protected:
cPixmap *pixmap; cPixmap *pixmap;
cString caller;
tColor color; tColor color;
tColor colorBlending; tColor colorBlending;
void setPixmap(cPixmap *pixmap); void setPixmap(cPixmap *pixmap);
public: public:
cStyledPixmap(void); cStyledPixmap(void);
cStyledPixmap(cPixmap *pixmap, cString caller); cStyledPixmap(cPixmap *pixmap);
virtual ~cStyledPixmap(void); virtual ~cStyledPixmap(void);
void drawBackground(); void drawBackground();
void drawBlendedBackground(); void drawBlendedBackground();

View File

@ -2,10 +2,24 @@
cTimeLine::cTimeLine(cMyTime *myTime) { cTimeLine::cTimeLine(cMyTime *myTime) {
this->myTime = myTime; this->myTime = myTime;
dateViewer = new cStyledPixmap(osdManager.requestPixmap(3, cRect(0, 0, tvguideConfig.timeColWidth, tvguideConfig.headerHeight), cRect::Null, "dateViewer"), "dateViewer"); dateViewer = new cStyledPixmap(osdManager.requestPixmap(3, cRect(0,
timeline = osdManager.requestPixmap(2, cRect(0, tvguideConfig.headerHeight, tvguideConfig.timeColWidth, tvguideConfig.osdHeight - tvguideConfig.headerHeight - tvguideConfig.footerHeight), tvguideConfig.statusHeaderHeight,
cRect(0,0, tvguideConfig.timeColWidth, 1440*tvguideConfig.minuteHeight), "timeline"); tvguideConfig.timeColWidth,
clock = new cStyledPixmap(osdManager.requestPixmap(3, cRect(0, tvguideConfig.osdHeight-tvguideConfig.footerHeight, tvguideConfig.timeColWidth, tvguideConfig.footerHeight-9), cRect::Null, "timeViewer"), "timeViewer"); tvguideConfig.headerHeight)
, cRect::Null));
timeline = osdManager.requestPixmap(2, cRect(0,
tvguideConfig.statusHeaderHeight + tvguideConfig.headerHeight,
tvguideConfig.timeColWidth,
tvguideConfig.osdHeight - tvguideConfig.statusHeaderHeight - tvguideConfig.headerHeight - tvguideConfig.footerHeight)
, cRect(0,
0,
tvguideConfig.timeColWidth,
1440*tvguideConfig.minuteHeight));
clock = new cStyledPixmap(osdManager.requestPixmap(3, cRect(0,
tvguideConfig.osdHeight- tvguideConfig.footerHeight,
tvguideConfig.timeColWidth,
tvguideConfig.footerHeight-9)
, cRect::Null));
} }
cTimeLine::~cTimeLine(void) { cTimeLine::~cTimeLine(void) {

18
timer.c
View File

@ -3,16 +3,24 @@
cMyTime::~cMyTime(void) { cMyTime::~cMyTime(void) {
} }
cString cMyTime::printTime(time_t displayTime) {
struct tm *ts;
ts = localtime(&displayTime);
cString strTime = cString::sprintf("%d.%d-%d:%d.%d", ts->tm_mday, ts->tm_mon+1, ts->tm_hour, ts->tm_min, ts->tm_sec);
return strTime;
}
void cMyTime::Now() { void cMyTime::Now() {
t = time(0); t = time(0);
tStart = t; tStart = t;
tStart = GetRounded(); tStart = GetRounded();
tStop = tStart + (tvguideConfig.osdHeight - tvguideConfig.headerHeight - tvguideConfig.footerHeight)/tvguideConfig.minuteHeight*60; tEnd = tStart + (tvguideConfig.osdHeight - tvguideConfig.statusHeaderHeight - tvguideConfig.headerHeight - tvguideConfig.footerHeight)/tvguideConfig.minuteHeight*60;
} }
void cMyTime::AddStep(int step) { void cMyTime::AddStep(int step) {
tStart += step*60; tStart += step*60;
tStop += step*60; tEnd += step*60;
} }
bool cMyTime::DelStep(int step) { bool cMyTime::DelStep(int step) {
@ -20,13 +28,13 @@ bool cMyTime::DelStep(int step) {
return true; return true;
} }
tStart -= step*60; tStart -= step*60;
tStop -= step*60; tEnd -= step*60;
return false; return false;
} }
void cMyTime::SetTime(time_t newTime) { void cMyTime::SetTime(time_t newTime) {
tStart = newTime; tStart = newTime;
tStop = tStart + (tvguideConfig.osdHeight - tvguideConfig.headerHeight - tvguideConfig.footerHeight)/tvguideConfig.minuteHeight*60; tEnd = tStart + (tvguideConfig.osdHeight - tvguideConfig.statusHeaderHeight - tvguideConfig.headerHeight - tvguideConfig.footerHeight)/tvguideConfig.minuteHeight*60;
} }
time_t cMyTime::getPrevPrimetime(time_t current) { time_t cMyTime::getPrevPrimetime(time_t current) {
@ -102,5 +110,5 @@ time_t cMyTime::GetRounded() {
} }
void cMyTime::debug() { void cMyTime::debug() {
esyslog("t: %s, tStart: %s, tStop: %s", *TimeString(t), *TimeString(tStart), *TimeString(tStop)); esyslog("t: %s, tStart: %s, tEnd: %s", *TimeString(t), *TimeString(tStart), *TimeString(tEnd));
} }

View File

@ -7,17 +7,18 @@ class cMyTime {
private: private:
time_t t; time_t t;
time_t tStart; time_t tStart;
time_t tStop; time_t tEnd;
public: public:
cMyTime(){}; cMyTime(){};
virtual ~cMyTime(void); virtual ~cMyTime(void);
static cString printTime(time_t displayTime);
void Now(); void Now();
void AddStep(int step); void AddStep(int step);
bool DelStep(int step); bool DelStep(int step);
void SetTime(time_t newTime); void SetTime(time_t newTime);
time_t Get() {return t;}; time_t Get() {return t;};
time_t GetStart() {return tStart;}; time_t GetStart() {return tStart;};
time_t GetStop() {return tStop;}; time_t GetEnd() {return tEnd;};
cString GetCurrentTime(); cString GetCurrentTime();
cString GetDate(); cString GetDate();
cString GetWeekday(); cString GetWeekday();

View File

@ -20,7 +20,7 @@
static const char *VERSION = "0.0.2"; static const char *VERSION = "0.0.3";
static const char *DESCRIPTION = "A fancy 2d EPG Viewer"; static const char *DESCRIPTION = "A fancy 2d EPG Viewer";
static const char *MAINMENUENTRY = "Tvguide"; static const char *MAINMENUENTRY = "Tvguide";

View File

@ -12,6 +12,8 @@ THEME_CLR(theme, clrHighlightBlending, 0xFF000000);
THEME_CLR(theme, clrFont, clrWhite); THEME_CLR(theme, clrFont, clrWhite);
THEME_CLR(theme, clrFontHeader, clrWhite); THEME_CLR(theme, clrFontHeader, clrWhite);
THEME_CLR(theme, clrFontButtons, clrWhite); THEME_CLR(theme, clrFontButtons, clrWhite);
THEME_CLR(theme, clrStatusHeader, clrBlack);
THEME_CLR(theme, clrStatusHeaderBlending, clrBlack);
THEME_CLR(theme, clrHeader, clrBlack); THEME_CLR(theme, clrHeader, clrBlack);
THEME_CLR(theme, clrHeaderBlending, 0xFFE0E0E0); THEME_CLR(theme, clrHeaderBlending, 0xFFE0E0E0);
THEME_CLR(theme, clrBorder, clrWhite); THEME_CLR(theme, clrBorder, clrWhite);
@ -41,7 +43,11 @@ cOsdManager osdManager;
#include "timer.c" #include "timer.c"
#include "messagebox.c" #include "messagebox.c"
#include "timeline.c" #include "timeline.c"
#include "grid.c"
#include "headergrid.c"
#include "dummygrid.c"
#include "epggrid.c" #include "epggrid.c"
#include "statusheader.c"
#include "detailview.c" #include "detailview.c"
#include "channelcolumn.c" #include "channelcolumn.c"
#include "footer.c" #include "footer.c"
@ -52,13 +58,17 @@ cOsdManager osdManager;
cTvGuideOsd::cTvGuideOsd(void) { cTvGuideOsd::cTvGuideOsd(void) {
detailView = NULL; detailView = NULL;
detailViewActive = false; detailViewActive = false;
activeGrid = NULL;
timeLine = NULL; timeLine = NULL;
} }
cTvGuideOsd::~cTvGuideOsd() { cTvGuideOsd::~cTvGuideOsd() {
delete myTime; delete myTime;
columns.Clear(); columns.Clear();
if (detailView) if (tvguideConfig.displayStatusHeader) {
delete statusHeader;
}
if (detailView)
delete detailView; delete detailView;
delete timeLine; delete timeLine;
delete footer; delete footer;
@ -84,6 +94,10 @@ void cTvGuideOsd::Show(void) {
void cTvGuideOsd::drawOsd() { void cTvGuideOsd::drawOsd() {
cPixmap::Lock(); cPixmap::Lock();
cChannel *startChannel = Channels.GetByNumber(cDevice::CurrentChannel()); cChannel *startChannel = Channels.GetByNumber(cDevice::CurrentChannel());
if (tvguideConfig.displayStatusHeader) {
statusHeader = new cStatusHeader();
statusHeader->ScaleVideo();
}
timeLine = new cTimeLine(myTime); timeLine = new cTimeLine(myTime);
timeLine->drawDateViewer(); timeLine->drawDateViewer();
timeLine->drawTimeline(); timeLine->drawTimeline();
@ -100,12 +114,12 @@ void cTvGuideOsd::drawOsd() {
cPixmap::Unlock(); cPixmap::Unlock();
} }
void cTvGuideOsd::readChannels(cChannel *channelStart) { void cTvGuideOsd::readChannels(const cChannel *channelStart) {
int i=0; int i=0;
columns.Clear(); columns.Clear();
if (!channelStart) if (!channelStart)
return; return;
for (cChannel *channel = channelStart; channel; channel = Channels.Next(channel)) { for (const cChannel *channel = channelStart; channel; channel = Channels.Next(channel)) {
if (!channel->GroupSep()) { if (!channel->GroupSep()) {
cChannelColumn *column = new cChannelColumn(i, channel, myTime); cChannelColumn *column = new cChannelColumn(i, channel, myTime);
if (column->readGrids()) { if (column->readGrids()) {
@ -120,38 +134,16 @@ void cTvGuideOsd::readChannels(cChannel *channelStart) {
} }
} }
bool cTvGuideOsd::readChannelsReverse(cChannel *channelStart) {
bool doUpdate = false;
int i = tvguideConfig.channelCols;
if (!channelStart)
return false;
for (cChannel *channel = Channels.Prev(channelStart); channel; channel = Channels.Prev(channel)) {
if (!channel->GroupSep()) {
cChannelColumn *column = new cChannelColumn(i-1, channel, myTime);
if (column->readGrids()) {
if (i == tvguideConfig.channelCols) {
columns.Clear();
doUpdate = true;
}
columns.Ins(column, columns.First());
i--;
} else {
delete column;
}
}
if (i == 0)
break;
}
return doUpdate;
}
void cTvGuideOsd::drawGridsChannelJump() { void cTvGuideOsd::drawGridsChannelJump() {
if (columns.Count() == 0) if (columns.Count() == 0)
return; return;
activeGrid = columns.First()->getActive(); activeGrid = columns.First()->getActive();
if (activeGrid) if (activeGrid)
activeGrid->SetActive(); activeGrid->SetActive();
for (cChannelColumn *column = columns.First(); column; column = columns.Next(column)) { if (tvguideConfig.displayStatusHeader) {
statusHeader->DrawInfoText(activeGrid);
}
for (cChannelColumn *column = columns.First(); column; column = columns.Next(column)) {
column->createHeader(); column->createHeader();
column->drawGrids(); column->drawGrids();
} }
@ -175,10 +167,13 @@ void cTvGuideOsd::drawGridsTimeJump() {
if (activeGrid) { if (activeGrid) {
activeGrid->SetActive(); activeGrid->SetActive();
activeGrid->Draw(); activeGrid->Draw();
if (tvguideConfig.displayStatusHeader) {
statusHeader->DrawInfoText(activeGrid);
}
} }
} }
void cTvGuideOsd::setNextActiveGrid(cEpgGrid *next) { void cTvGuideOsd::setNextActiveGrid(cGrid *next) {
if (!next || !activeGrid) { if (!next || !activeGrid) {
return; return;
} }
@ -187,82 +182,38 @@ void cTvGuideOsd::setNextActiveGrid(cEpgGrid *next) {
activeGrid = next; activeGrid = next;
activeGrid->SetActive(); activeGrid->SetActive();
activeGrid->Draw(); activeGrid->Draw();
if (tvguideConfig.displayStatusHeader) {
statusHeader->DrawInfoText(activeGrid);
}
} }
void cTvGuideOsd::processKeyUp() { void cTvGuideOsd::processKeyUp() {
if (!activeGrid) {
return;
}
if (detailViewActive) { if (detailViewActive) {
detailView->scrollUp(); detailView->scrollUp();
} else { } else {
if (activeGrid == NULL) { bool actionDone = false;
ScrollBack(); if ( (activeGrid->StartTime() - myTime->GetStart())/60 < 30 ) {
//Search for new active Grid ScrollBack();
cEpgGrid *actGrid = NULL; actionDone = true;
for (cChannelColumn *column = columns.First(); column; column = columns.Next(column)) { }
actGrid = column->getActive(); cGrid *prev = activeGrid->column->getPrev(activeGrid);
if (actGrid) { if (prev) {
activeGrid = actGrid; if ( (prev->StartTime() > myTime->GetStart())
activeGrid->SetActive(); || ( (prev->EndTime() - myTime->GetStart())/60 > 30 )
activeGrid->Draw(); || ( prev->isFirst()) ) {
break; setNextActiveGrid(prev);
} actionDone = true;
} }
} else if (activeGrid->StartTime() <= myTime->GetStart()) { }
activeGrid->debug(); if (!actionDone) {
ScrollBack(); ScrollBack();
} else { }
cEpgGrid *prev = NULL;
prev = activeGrid->column->getPrev(activeGrid);
if (prev) {
setNextActiveGrid(prev);
} else {
ScrollBack();
prev = activeGrid->column->getPrev(activeGrid);
if (prev) {
setNextActiveGrid(prev);
}
}
}
} }
osdManager.flush(); osdManager.flush();
} }
void cTvGuideOsd::processKeyDown() {
if (detailViewActive) {
detailView->scrollDown();
} else {
if (activeGrid == NULL) {
ScrollForward();
} else if (activeGrid->EndTime() > myTime->GetStop()) {
ScrollForward();
} else {
cEpgGrid *next = NULL;
next = activeGrid->column->getNext(activeGrid);
if (next) {
setNextActiveGrid(next);
} else {
ScrollForward();
next = activeGrid->column->getNext(activeGrid);
if (next) {
setNextActiveGrid(next);
}
}
}
}
osdManager.flush();
}
void cTvGuideOsd::ScrollForward() {
myTime->AddStep(tvguideConfig.stepMinutes);
timeLine->drawDateViewer();
timeLine->drawClock();
timeLine->setTimeline();
for (cChannelColumn *column = columns.First(); column; column = columns.Next(column)) {
column->AddNewGridsAtEnd();
column->ClearOutdatedStart();
column->drawGrids();
}
}
void cTvGuideOsd::ScrollBack() { void cTvGuideOsd::ScrollBack() {
bool tooFarInPast = myTime->DelStep(tvguideConfig.stepMinutes); bool tooFarInPast = myTime->DelStep(tvguideConfig.stepMinutes);
if (tooFarInPast) if (tooFarInPast)
@ -277,6 +228,45 @@ void cTvGuideOsd::ScrollBack() {
} }
} }
void cTvGuideOsd::processKeyDown() {
if (!activeGrid) {
return;
}
if (detailViewActive) {
detailView->scrollDown();
} else {
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();
}
}
osdManager.flush();
}
void cTvGuideOsd::ScrollForward() {
myTime->AddStep(tvguideConfig.stepMinutes);
timeLine->drawDateViewer();
timeLine->drawClock();
timeLine->setTimeline();
for (cChannelColumn *column = columns.First(); column; column = columns.Next(column)) {
column->AddNewGridsAtEnd();
column->ClearOutdatedStart();
column->drawGrids();
}
}
void cTvGuideOsd::processKeyLeft() { void cTvGuideOsd::processKeyLeft() {
if (detailViewActive) if (detailViewActive)
return; return;
@ -284,7 +274,7 @@ void cTvGuideOsd::processKeyLeft() {
return; return;
cChannelColumn *colLeft = columns.Prev(activeGrid->column); cChannelColumn *colLeft = columns.Prev(activeGrid->column);
if (!colLeft) { if (!colLeft) {
cChannel *channelLeft = activeGrid->column->getChannel(); const cChannel *channelLeft = activeGrid->column->getChannel();
while (channelLeft = Channels.Prev(channelLeft)) { while (channelLeft = Channels.Prev(channelLeft)) {
if (!channelLeft->GroupSep()) { if (!channelLeft->GroupSep()) {
colLeft = new cChannelColumn(0, channelLeft, myTime); colLeft = new cChannelColumn(0, channelLeft, myTime);
@ -313,7 +303,7 @@ void cTvGuideOsd::processKeyLeft() {
} }
if (colLeft) { if (colLeft) {
cEpgGrid *left = colLeft->getNeighbor(activeGrid); cGrid *left = colLeft->getNeighbor(activeGrid);
if (left) { if (left) {
setNextActiveGrid(left); setNextActiveGrid(left);
} }
@ -328,7 +318,7 @@ void cTvGuideOsd::processKeyRight() {
return; return;
cChannelColumn *colRight = columns.Next(activeGrid->column); cChannelColumn *colRight = columns.Next(activeGrid->column);
if (!colRight) { if (!colRight) {
cChannel *channelRight = activeGrid->column->getChannel(); const cChannel *channelRight = activeGrid->column->getChannel();
while (channelRight = Channels.Next(channelRight)) { while (channelRight = Channels.Next(channelRight)) {
if (!channelRight->GroupSep()) { if (!channelRight->GroupSep()) {
colRight = new cChannelColumn(tvguideConfig.channelCols - 1, channelRight, myTime); colRight = new cChannelColumn(tvguideConfig.channelCols - 1, channelRight, myTime);
@ -356,7 +346,7 @@ void cTvGuideOsd::processKeyRight() {
} }
} }
if (colRight) { if (colRight) {
cEpgGrid *right = colRight->getNeighbor(activeGrid); cGrid *right = colRight->getNeighbor(activeGrid);
if (right) { if (right) {
setNextActiveGrid(right); setNextActiveGrid(right);
} }
@ -371,9 +361,11 @@ void cTvGuideOsd::processKeyOk() {
detailViewActive = false; detailViewActive = false;
osdManager.flush(); osdManager.flush();
} else { } else {
detailViewActive = true; if (!activeGrid->isDummy()) {
detailView = new cDetailView(activeGrid); detailViewActive = true;
detailView->Start(); detailView = new cDetailView(activeGrid);
detailView->Start();
}
} }
} }
@ -405,21 +397,33 @@ void cTvGuideOsd::processKeyRed() {
void cTvGuideOsd::processKeyGreen() { void cTvGuideOsd::processKeyGreen() {
if (activeGrid == NULL) if (activeGrid == NULL)
return; return;
cChannel *currentChannel = activeGrid->column->getChannel(); const cChannel *currentChannel = activeGrid->column->getChannel();
bool doUpdate = readChannelsReverse(currentChannel); const cChannel *prev = NULL;
if (doUpdate && (columns.Count() > 0)) { int i = tvguideConfig.jumpChannels + 1;
drawGridsChannelJump(); for (const cChannel *channel = currentChannel; channel; channel = Channels.Prev(channel)) {
if (!channel->GroupSep()) {
prev = channel;
i--;
}
if (i == 0)
break;
}
if (prev) {
readChannels(prev);
if (columns.Count() > 0) {
drawGridsChannelJump();
}
osdManager.flush();
} }
osdManager.flush();
} }
void cTvGuideOsd::processKeyYellow() { void cTvGuideOsd::processKeyYellow() {
if (activeGrid == NULL) if (activeGrid == NULL)
return; return;
cChannel *currentChannel = activeGrid->column->getChannel(); const cChannel *currentChannel = activeGrid->column->getChannel();
cChannel *next = NULL; const cChannel *next = NULL;
int i=0; int i=0;
for (cChannel *channel = currentChannel; channel; channel = Channels.Next(channel)) { for (const cChannel *channel = currentChannel; channel; channel = Channels.Next(channel)) {
if (!channel->GroupSep()) { if (!channel->GroupSep()) {
next = channel; next = channel;
i++; i++;
@ -439,7 +443,7 @@ void cTvGuideOsd::processKeyYellow() {
eOSState cTvGuideOsd::processKeyBlue() { eOSState cTvGuideOsd::processKeyBlue() {
if (activeGrid == NULL) if (activeGrid == NULL)
return osContinue; return osContinue;
cChannel *currentChannel = activeGrid->column->getChannel(); const cChannel *currentChannel = activeGrid->column->getChannel();
if (currentChannel) { if (currentChannel) {
cDevice::PrimaryDevice()->SwitchChannel(currentChannel, true); cDevice::PrimaryDevice()->SwitchChannel(currentChannel, true);
return osEnd; return osEnd;
@ -539,4 +543,13 @@ eOSState cTvGuideOsd::ProcessKey(eKeys Key) {
cPixmap::Unlock(); cPixmap::Unlock();
} }
return state; return state;
}
void cTvGuideOsd::dump() {
esyslog("tvguide: ------Dumping Content---------");
activeGrid->debug();
int i=1;
for (cChannelColumn *col = columns.First(); col; col = columns.Next(col)) {
col->dumpGrids();
}
} }

View File

@ -7,14 +7,14 @@ class cTvGuideOsd : public cOsdObject {
private: private:
cMyTime *myTime; cMyTime *myTime;
cList<cChannelColumn> columns; cList<cChannelColumn> columns;
cEpgGrid *activeGrid; cGrid *activeGrid;
cStatusHeader *statusHeader;
cDetailView *detailView; cDetailView *detailView;
cTimeLine *timeLine; cTimeLine *timeLine;
cFooter *footer; cFooter *footer;
bool detailViewActive; bool detailViewActive;
void drawOsd(); void drawOsd();
void readChannels(cChannel *channelStart); void readChannels(const cChannel *channelStart);
bool readChannelsReverse(cChannel *channelStart);
void drawGridsChannelJump(); void drawGridsChannelJump();
void drawGridsTimeJump(); void drawGridsTimeJump();
void processKeyUp(); void processKeyUp();
@ -32,9 +32,10 @@ private:
void processKey6(); void processKey6();
void processKey7(); void processKey7();
void processKey9(); void processKey9();
void setNextActiveGrid(cEpgGrid *next); void setNextActiveGrid(cGrid *next);
void ScrollForward(); void ScrollForward();
void ScrollBack(); void ScrollBack();
void dump();
public: public:
cTvGuideOsd(void); cTvGuideOsd(void);
virtual ~cTvGuideOsd(void); virtual ~cTvGuideOsd(void);
@ -42,4 +43,4 @@ public:
virtual eOSState ProcessKey(eKeys Key); virtual eOSState ProcessKey(eKeys Key);
}; };
#endif //__TVGUIDE_TVGUIDEOSD_H #endif //__TVGUIDE_TVGUIDEOSD_H