whitespace cleanup

This commit is contained in:
louis 2013-05-26 11:38:05 +02:00
parent 9f47ab764e
commit 812fd1b7a5
31 changed files with 1577 additions and 1577 deletions

View File

@ -1,21 +1,21 @@
#include "channelcolumn.h" #include "channelcolumn.h"
cChannelColumn::cChannelColumn(int num, const 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); schedulesLock = new cSchedulesLock(true, 100);
} }
cChannelColumn::~cChannelColumn(void) { cChannelColumn::~cChannelColumn(void) {
delete header; delete header;
grids.Clear(); grids.Clear();
delete schedulesLock; delete schedulesLock;
} }
void cChannelColumn::clearGrids() { void cChannelColumn::clearGrids() {
grids.Clear(); grids.Clear();
} }
void cChannelColumn::createHeader() { void cChannelColumn::createHeader() {
@ -30,29 +30,29 @@ void cChannelColumn::drawHeader() {
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) {
addDummyGrid(myTime->GetStart(), myTime->GetEnd(), NULL, false); addDummyGrid(myTime->GetStart(), myTime->GetEnd(), NULL, false);
return true; return true;
} }
bool eventFound = false; bool eventFound = false;
bool dummyAtStart = false; bool dummyAtStart = false;
const cEvent *startEvent = Schedule->GetEventAround(myTime->GetStart()); const cEvent *startEvent = Schedule->GetEventAround(myTime->GetStart());
if (startEvent != NULL) { if (startEvent != NULL) {
eventFound = true; eventFound = true;
} else { } else {
for (int i=1; i<6; i++) { for (int i=1; i<6; i++) {
startEvent = Schedule->GetEventAround(myTime->GetStart()+i*5*60); startEvent = Schedule->GetEventAround(myTime->GetStart()+i*5*60);
if (startEvent) { if (startEvent) {
eventFound = true; eventFound = true;
dummyAtStart = true; dummyAtStart = true;
break; break;
} }
} }
} }
if (eventFound) { if (eventFound) {
bool col = true; bool col = true;
if (dummyAtStart) { if (dummyAtStart) {
addDummyGrid(myTime->GetStart(), startEvent->StartTime(), NULL, col); addDummyGrid(myTime->GetStart(), startEvent->StartTime(), NULL, col);
col = !col; col = !col;
@ -62,8 +62,8 @@ bool cChannelColumn::readGrids() {
time_t endLast = myTime->GetStart(); time_t endLast = myTime->GetStart();
const cEvent *event = startEvent; const cEvent *event = startEvent;
const cEvent *eventLast = NULL; const cEvent *eventLast = NULL;
for (; event; event = Schedule->Events()->Next(event)) { for (; event; event = Schedule->Events()->Next(event)) {
if (endLast < event->StartTime()) { if (endLast < event->StartTime()) {
//gap, dummy needed //gap, dummy needed
time_t endTime = event->StartTime(); time_t endTime = event->StartTime();
if (endTime > myTime->GetEnd()) { if (endTime > myTime->GetEnd()) {
@ -77,19 +77,19 @@ bool cChannelColumn::readGrids() {
break; break;
} }
addEpgGrid(event, NULL, col); addEpgGrid(event, NULL, col);
col = !col; col = !col;
endLast = event->EndTime(); endLast = event->EndTime();
if (event->EndTime() > myTime->GetEnd()) { if (event->EndTime() > myTime->GetEnd()) {
dummyNeeded = false; dummyNeeded = false;
break; break;
} }
eventLast = event; eventLast = event;
} }
if (dummyNeeded) { if (dummyNeeded) {
addDummyGrid(eventLast->EndTime(), myTime->GetEnd(), NULL, col); addDummyGrid(eventLast->EndTime(), myTime->GetEnd(), NULL, col);
} }
return true; return true;
} else { } else {
addDummyGrid(myTime->GetStart(), myTime->GetEnd(), NULL, false); addDummyGrid(myTime->GetStart(), myTime->GetEnd(), NULL, false);
return true; return true;
} }
@ -97,11 +97,11 @@ bool cChannelColumn::readGrids() {
} }
void cChannelColumn::drawGrids() { void cChannelColumn::drawGrids() {
for (cGrid *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();
} }
} }
int cChannelColumn::getX() { int cChannelColumn::getX() {
@ -113,57 +113,57 @@ int cChannelColumn::getY() {
} }
cGrid * cChannelColumn::getActive() { cGrid * cChannelColumn::getActive() {
cMyTime t; cMyTime t;
t.Now(); t.Now();
for (cGrid *grid = grids.First(); grid; grid = grids.Next(grid)) { for (cGrid *grid = grids.First(); grid; grid = grids.Next(grid)) {
if (grid->Match(t.Get())) if (grid->Match(t.Get()))
return grid; return grid;
} }
return grids.First(); return grids.First();
} }
cGrid * cChannelColumn::getNext(cGrid *activeGrid) { cGrid * cChannelColumn::getNext(cGrid *activeGrid) {
if (activeGrid == NULL) if (activeGrid == NULL)
return NULL; return NULL;
cGrid *next = grids.Next(activeGrid); cGrid *next = grids.Next(activeGrid);
if (next) if (next)
return next; return next;
return NULL; return NULL;
} }
cGrid * cChannelColumn::getPrev(cGrid *activeGrid) { cGrid * cChannelColumn::getPrev(cGrid *activeGrid) {
if (activeGrid == NULL) if (activeGrid == NULL)
return NULL; return NULL;
cGrid *prev = grids.Prev(activeGrid); cGrid *prev = grids.Prev(activeGrid);
if (prev) if (prev)
return prev; return prev;
return NULL; return NULL;
} }
cGrid * cChannelColumn::getNeighbor(cGrid *activeGrid) { cGrid * cChannelColumn::getNeighbor(cGrid *activeGrid) {
if (!activeGrid) if (!activeGrid)
return NULL; return NULL;
cGrid *neighbor = NULL; cGrid *neighbor = NULL;
int overlap = 0; int overlap = 0;
int overlapNew = 0; int overlapNew = 0;
cGrid *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)) {
if ( (grid->StartTime() == activeGrid->StartTime()) ) { if ( (grid->StartTime() == activeGrid->StartTime()) ) {
neighbor = grid; neighbor = grid;
break; break;
} }
overlapNew = activeGrid->calcOverlap(grid); overlapNew = activeGrid->calcOverlap(grid);
if (overlapNew > overlap) { if (overlapNew > overlap) {
neighbor = grid; neighbor = grid;
overlap = overlapNew; overlap = overlapNew;
} }
} }
} }
if (!neighbor) if (!neighbor)
neighbor = grids.First(); neighbor = grids.First();
return neighbor; return neighbor;
} }
bool cChannelColumn::isFirst(cGrid *grid) { bool cChannelColumn::isFirst(cGrid *grid) {
@ -173,10 +173,10 @@ bool cChannelColumn::isFirst(cGrid *grid) {
} }
void cChannelColumn::AddNewGridsAtStart() { void cChannelColumn::AddNewGridsAtStart() {
cGrid *firstGrid = NULL; cGrid *firstGrid = NULL;
firstGrid = grids.First(); firstGrid = grids.First();
if (firstGrid == NULL) if (firstGrid == NULL)
return; return;
//if first event is long enough, nothing to do. //if first event is long enough, nothing to do.
if (firstGrid->StartTime() <= myTime->GetStart()) { if (firstGrid->StartTime() <= myTime->GetStart()) {
return; return;
@ -194,20 +194,20 @@ void cChannelColumn::AddNewGridsAtStart() {
} }
bool col = !(firstGrid->IsColor1()); bool col = !(firstGrid->IsColor1());
bool dummyNeeded = true; bool dummyNeeded = true;
for (const cEvent *event = Schedule->GetEventAround(firstGrid->StartTime()-60); event; event = Schedule->Events()->Prev(event)) { for (const cEvent *event = Schedule->GetEventAround(firstGrid->StartTime()-60); event; event = Schedule->Events()->Prev(event)) {
if (!event) if (!event)
break; break;
if (event->EndTime() < myTime->GetStart()) { if (event->EndTime() < myTime->GetStart()) {
break; break;
} }
cGrid *grid = addEpgGrid(event, firstGrid, col); cGrid *grid = addEpgGrid(event, firstGrid, col);
col = !col; col = !col;
firstGrid = grid; firstGrid = grid;
if (event->StartTime() <= myTime->GetStart()) { if (event->StartTime() <= myTime->GetStart()) {
dummyNeeded = false; dummyNeeded = false;
break; break;
} }
} }
if (dummyNeeded) { if (dummyNeeded) {
firstGrid = grids.First(); firstGrid = grids.First();
if (firstGrid->isDummy()) { if (firstGrid->isDummy()) {
@ -221,40 +221,40 @@ void cChannelColumn::AddNewGridsAtStart() {
} }
void cChannelColumn::AddNewGridsAtEnd() { void cChannelColumn::AddNewGridsAtEnd() {
cGrid *lastGrid = NULL; cGrid *lastGrid = NULL;
lastGrid = grids.Last(); lastGrid = grids.Last();
if (lastGrid == NULL) if (lastGrid == NULL)
return;
//if last event is long enough, nothing to do.
if (lastGrid->EndTime() >= myTime->GetEnd()) {
return; return;
} //if last event is long enough, nothing to do.
//if not, i have to add new ones to the list if (lastGrid->EndTime() >= myTime->GetEnd()) {
schedules = cSchedules::Schedules(*schedulesLock); return;
const cSchedule *Schedule = NULL; }
Schedule = schedules->GetSchedule(channel); //if not, i have to add new ones to the list
if (!Schedule) { schedules = cSchedules::Schedules(*schedulesLock);
const cSchedule *Schedule = NULL;
Schedule = schedules->GetSchedule(channel);
if (!Schedule) {
if (lastGrid->isDummy()) { if (lastGrid->isDummy()) {
lastGrid->SetStartTime(myTime->GetStart()); lastGrid->SetStartTime(myTime->GetStart());
lastGrid->SetEndTime(myTime->GetEnd()); lastGrid->SetEndTime(myTime->GetEnd());
} }
return; return;
} }
bool col = !(lastGrid->IsColor1()); bool col = !(lastGrid->IsColor1());
bool dummyNeeded = true; bool dummyNeeded = true;
for (const cEvent *event = Schedule->GetEventAround(lastGrid->EndTime()+60); event; event = Schedule->Events()->Next(event)) { for (const cEvent *event = Schedule->GetEventAround(lastGrid->EndTime()+60); event; event = Schedule->Events()->Next(event)) {
if (!event) if (!event)
break; break;
if (event->StartTime() > myTime->GetEnd()) { if (event->StartTime() > myTime->GetEnd()) {
break; break;
} }
addEpgGrid(event, NULL, col); addEpgGrid(event, NULL, col);
col = !col; col = !col;
if (event->EndTime() > myTime->GetEnd()) { if (event->EndTime() > myTime->GetEnd()) {
dummyNeeded = false; dummyNeeded = false;
break; break;
} }
} }
if (dummyNeeded) { if (dummyNeeded) {
lastGrid = grids.Last(); lastGrid = grids.Last();
if (lastGrid->isDummy()) { if (lastGrid->isDummy()) {
@ -268,15 +268,15 @@ void cChannelColumn::AddNewGridsAtEnd() {
} }
void cChannelColumn::ClearOutdatedStart() { void cChannelColumn::ClearOutdatedStart() {
cGrid *firstGrid = NULL; cGrid *firstGrid = NULL;
while (true) { while (true) {
firstGrid = grids.First(); firstGrid = grids.First();
if (!firstGrid) if (!firstGrid)
break; break;
if (firstGrid->EndTime() <= myTime->GetStart()) { if (firstGrid->EndTime() <= myTime->GetStart()) {
grids.Del(firstGrid); grids.Del(firstGrid);
firstGrid = NULL; firstGrid = NULL;
} else { } else {
if (firstGrid->isDummy()) { if (firstGrid->isDummy()) {
firstGrid->SetStartTime(myTime->GetStart()); firstGrid->SetStartTime(myTime->GetStart());
cGrid *next = getNext(firstGrid); cGrid *next = getNext(firstGrid);
@ -287,20 +287,20 @@ void cChannelColumn::ClearOutdatedStart() {
} }
} }
break; break;
} }
} }
} }
void cChannelColumn::ClearOutdatedEnd() { void cChannelColumn::ClearOutdatedEnd() {
cGrid *lastGrid = NULL; cGrid *lastGrid = NULL;
while (true) { while (true) {
lastGrid = grids.Last(); lastGrid = grids.Last();
if (!lastGrid) if (!lastGrid)
break; break;
if (lastGrid->StartTime() >= myTime->GetEnd()) { if (lastGrid->StartTime() >= myTime->GetEnd()) {
grids.Del(lastGrid); grids.Del(lastGrid);
lastGrid = NULL; lastGrid = NULL;
} else { } else {
if (lastGrid->isDummy()) { if (lastGrid->isDummy()) {
lastGrid->SetEndTime(myTime->GetEnd()); lastGrid->SetEndTime(myTime->GetEnd());
cGrid *prev = getPrev(lastGrid); cGrid *prev = getPrev(lastGrid);
@ -311,8 +311,8 @@ void cChannelColumn::ClearOutdatedEnd() {
} }
} }
break; break;
} }
} }
} }
cGrid *cChannelColumn::addEpgGrid(const cEvent *event, cGrid *firstGrid, bool color) { cGrid *cChannelColumn::addEpgGrid(const cEvent *event, cGrid *firstGrid, bool color) {
@ -338,10 +338,10 @@ cGrid *cChannelColumn::addDummyGrid(time_t start, time_t end, cGrid *firstGrid,
} }
void cChannelColumn::dumpGrids() { void cChannelColumn::dumpGrids() {
esyslog("tvguide: ------Channel %s: %d entires ---------", channel->Name(), grids.Count()); esyslog("tvguide: ------Channel %s: %d entires ---------", channel->Name(), grids.Count());
int i=1; int i=1;
for (cGrid *grid = grids.First(); grid; grid = grids.Next(grid)) { 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())); esyslog("tvguide: grid %d: start: %s, stop: %s", i, *cMyTime::printTime(grid->StartTime()), *cMyTime::printTime(grid->EndTime()));
i++; i++;
} }
} }

View File

@ -9,43 +9,43 @@ class cHeaderGrid;
class cChannelColumn : public cListObject, public cStyledPixmap { class cChannelColumn : public cListObject, public cStyledPixmap {
private: private:
cMyTime *myTime; cMyTime *myTime;
int num; int num;
const cChannel *channel; const cChannel *channel;
cHeaderGrid *header; cHeaderGrid *header;
cList<cGrid> grids; cList<cGrid> grids;
cSchedulesLock *schedulesLock; cSchedulesLock *schedulesLock;
const cSchedules *schedules; const cSchedules *schedules;
bool hasTimer; bool hasTimer;
cGrid *addEpgGrid(const cEvent *event, cGrid *firstGrid, bool color); cGrid *addEpgGrid(const cEvent *event, cGrid *firstGrid, bool color);
cGrid *addDummyGrid(time_t start, time_t end, cGrid *firstGrid, bool color); cGrid *addDummyGrid(time_t start, time_t end, cGrid *firstGrid, bool color);
public: public:
cChannelColumn(int num, const 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();
int getY(); int getY();
int Start() { return myTime->GetStart(); }; int Start() { return myTime->GetStart(); };
int Stop() { return myTime->GetEnd(); }; int Stop() { return myTime->GetEnd(); };
const char* Name() { return channel->Name(); }; const char* Name() { return channel->Name(); };
const cChannel * getChannel() {return channel;} const cChannel * getChannel() {return channel;}
cGrid * getActive(); cGrid * getActive();
cGrid * getNext(cGrid *activeGrid); cGrid * getNext(cGrid *activeGrid);
cGrid * getPrev(cGrid *activeGrid); cGrid * getPrev(cGrid *activeGrid);
cGrid * getNeighbor(cGrid *activeGrid); cGrid * getNeighbor(cGrid *activeGrid);
bool isFirst(cGrid *grid); bool isFirst(cGrid *grid);
void AddNewGridsAtStart(); void AddNewGridsAtStart();
void AddNewGridsAtEnd(); void AddNewGridsAtEnd();
void ClearOutdatedStart(); void ClearOutdatedStart();
void ClearOutdatedEnd(); void ClearOutdatedEnd();
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; }; bool HasTimer() { return hasTimer; };
void clearGrids(); void clearGrids();
void dumpGrids(); void dumpGrids();
}; };
#endif //__TVGUIDE_CHANNELCOLUMN_H #endif //__TVGUIDE_CHANNELCOLUMN_H

278
config.c
View File

@ -1,50 +1,50 @@
#include "config.h" #include "config.h"
enum { enum {
e12Hours, e12Hours,
e24Hours e24Hours
}; };
enum { enum {
eVertical, eVertical,
eHorizontal eHorizontal
}; };
cTvguideConfig::cTvguideConfig() { cTvguideConfig::cTvguideConfig() {
osdWidth = 0; osdWidth = 0;
osdHeight = 0; osdHeight = 0;
displayMode = eHorizontal; displayMode = eHorizontal;
colWidth = 0; colWidth = 0;
rowHeight = 0; rowHeight = 0;
channelCols = 5; channelCols = 5;
channelRows = 10; channelRows = 10;
displayTime = 160; displayTime = 160;
minutePixel = 0; minutePixel = 0;
displayStatusHeader = 1; displayStatusHeader = 1;
statusHeaderPercent = 20; statusHeaderPercent = 20;
statusHeaderHeight = 0; statusHeaderHeight = 0;
scaleVideo = 1; scaleVideo = 1;
decorateVideo = 1; decorateVideo = 1;
timeLineWidthPercent = 8; timeLineWidthPercent = 8;
timeLineHeightPercent = 4; timeLineHeightPercent = 4;
displayChannelName = 1; displayChannelName = 1;
channelHeaderWidthPercent = 20; channelHeaderWidthPercent = 20;
channelHeaderHeightPercent = 15; channelHeaderHeightPercent = 15;
footerHeight = 80; footerHeight = 80;
stepMinutes = 30; stepMinutes = 30;
bigStepHours = 3; bigStepHours = 3;
hugeStepHours = 24; hugeStepHours = 24;
jumpChannels = 10; jumpChannels = 10;
hideChannelLogos = 0; hideChannelLogos = 0;
logoWidthRatio = 13; logoWidthRatio = 13;
logoHeightRatio = 10; logoHeightRatio = 10;
logoExtension = 0; logoExtension = 0;
hideEpgImages = 0; hideEpgImages = 0;
epgImageWidth = 315; epgImageWidth = 315;
epgImageHeight = 240; epgImageHeight = 240;
fontIndex = 0; fontIndex = 0;
fontNameDefault = "VDRSymbols Sans:Book"; fontNameDefault = "VDRSymbols Sans:Book";
FontButtonDelta = 0; FontButtonDelta = 0;
FontDetailViewDelta = 0; FontDetailViewDelta = 0;
FontDetailHeaderDelta = 0; FontDetailHeaderDelta = 0;
@ -64,51 +64,51 @@ cTvguideConfig::cTvguideConfig() {
FontTimeLineDateHorizontalDelta = 0; FontTimeLineDateHorizontalDelta = 0;
FontTimeLineTimeHorizontalDelta = 0; FontTimeLineTimeHorizontalDelta = 0;
//Common Fonts //Common Fonts
FontButton = NULL; FontButton = NULL;
FontDetailView = NULL; FontDetailView = NULL;
FontDetailHeader = NULL; FontDetailHeader = NULL;
FontMessageBox = NULL; FontMessageBox = NULL;
FontMessageBoxLarge = NULL; FontMessageBoxLarge = NULL;
FontStatusHeader = NULL; FontStatusHeader = NULL;
FontStatusHeaderLarge = NULL; FontStatusHeaderLarge = NULL;
//Fonts for vertical Display //Fonts for vertical Display
FontChannelHeader = NULL; FontChannelHeader = NULL;
FontGrid = NULL; FontGrid = NULL;
FontGridSmall = NULL; FontGridSmall = NULL;
FontTimeLineWeekday = NULL; FontTimeLineWeekday = NULL;
FontTimeLineDate = NULL; FontTimeLineDate = NULL;
FontTimeLineTime = NULL; FontTimeLineTime = NULL;
//Fonts for horizontal Display //Fonts for horizontal Display
FontChannelHeaderHorizontal = NULL; FontChannelHeaderHorizontal = NULL;
FontGridHorizontal = NULL; FontGridHorizontal = NULL;
FontGridHorizontalSmall = NULL; FontGridHorizontalSmall = NULL;
FontTimeLineDateHorizontal = NULL; FontTimeLineDateHorizontal = NULL;
FontTimeLineTimeHorizontal = NULL; FontTimeLineTimeHorizontal = NULL;
timeFormat = 1; timeFormat = 1;
themeIndex = 4; themeIndex = 4;
useBlending = 2; useBlending = 2;
roundedCorners = 0; roundedCorners = 0;
} }
cTvguideConfig::~cTvguideConfig() { cTvguideConfig::~cTvguideConfig() {
delete FontButton; delete FontButton;
delete FontDetailView; delete FontDetailView;
delete FontDetailHeader; delete FontDetailHeader;
delete FontMessageBox; delete FontMessageBox;
delete FontMessageBoxLarge; delete FontMessageBoxLarge;
delete FontStatusHeader; delete FontStatusHeader;
delete FontStatusHeaderLarge; delete FontStatusHeaderLarge;
delete FontChannelHeader; delete FontChannelHeader;
delete FontGrid; delete FontGrid;
delete FontGridSmall; delete FontGridSmall;
delete FontTimeLineWeekday; delete FontTimeLineWeekday;
delete FontTimeLineDate; delete FontTimeLineDate;
delete FontTimeLineTime; delete FontTimeLineTime;
delete FontChannelHeaderHorizontal; delete FontChannelHeaderHorizontal;
delete FontGridHorizontal; delete FontGridHorizontal;
delete FontGridHorizontalSmall; delete FontGridHorizontalSmall;
delete FontTimeLineDateHorizontal; delete FontTimeLineDateHorizontal;
delete FontTimeLineTimeHorizontal; delete FontTimeLineTimeHorizontal;
} }
@ -118,13 +118,13 @@ void cTvguideConfig::setDynamicValues(int width, int height) {
} }
void cTvguideConfig::SetGeometry(int width, int height) { void cTvguideConfig::SetGeometry(int width, int height) {
osdWidth = width; osdWidth = width;
osdHeight = height; osdHeight = height;
statusHeaderHeight = (displayStatusHeader)?(statusHeaderPercent * osdHeight / 100):0; statusHeaderHeight = (displayStatusHeader)?(statusHeaderPercent * osdHeight / 100):0;
channelHeaderWidth = channelHeaderWidthPercent * osdWidth / 100; channelHeaderWidth = channelHeaderWidthPercent * osdWidth / 100;
channelHeaderHeight = channelHeaderHeightPercent * osdHeight / 100; channelHeaderHeight = channelHeaderHeightPercent * osdHeight / 100;
timeLineWidth = timeLineWidthPercent * osdWidth / 100; timeLineWidth = timeLineWidthPercent * osdWidth / 100;
timeLineHeight = timeLineHeightPercent * osdHeight / 100; timeLineHeight = timeLineHeightPercent * osdHeight / 100;
if (displayMode == eVertical) { if (displayMode == eVertical) {
colWidth = (osdWidth - timeLineWidth) / channelCols; colWidth = (osdWidth - timeLineWidth) / channelCols;
@ -140,113 +140,113 @@ void cTvguideConfig::SetGeometry(int width, int height) {
} }
void cTvguideConfig::SetFonts(void){ void cTvguideConfig::SetFonts(void){
cString fontname; cString fontname;
if (fontIndex == 0) { if (fontIndex == 0) {
fontname = fontNameDefault; fontname = fontNameDefault;
} else { } else {
cStringList availableFonts; cStringList availableFonts;
cFont::GetAvailableFontNames(&availableFonts); cFont::GetAvailableFontNames(&availableFonts);
if (availableFonts[fontIndex-1]) { if (availableFonts[fontIndex-1]) {
fontname = availableFonts[fontIndex-1]; fontname = availableFonts[fontIndex-1];
} else } else
fontname = fontNameDefault; fontname = fontNameDefault;
} }
cFont *test = NULL; cFont *test = NULL;
test = cFont::CreateFont(*fontname, 30); test = cFont::CreateFont(*fontname, 30);
if (!test) { if (!test) {
fontname = DefaultFontSml; fontname = DefaultFontSml;
} }
delete test; delete test;
//Common Fonts //Common Fonts
FontButton = cFont::CreateFont(*fontname, footerHeight/3 + 4 + FontButtonDelta); FontButton = cFont::CreateFont(*fontname, footerHeight/3 + 4 + FontButtonDelta);
FontDetailView = cFont::CreateFont(*fontname, osdHeight/30 + FontDetailViewDelta); FontDetailView = cFont::CreateFont(*fontname, osdHeight/30 + FontDetailViewDelta);
FontDetailHeader = cFont::CreateFont(*fontname, osdHeight/25 + FontDetailHeaderDelta); FontDetailHeader = cFont::CreateFont(*fontname, osdHeight/25 + FontDetailHeaderDelta);
FontMessageBox = cFont::CreateFont(*fontname, osdHeight/33 + FontMessageBoxDelta); FontMessageBox = cFont::CreateFont(*fontname, osdHeight/33 + FontMessageBoxDelta);
FontMessageBoxLarge = cFont::CreateFont(*fontname, osdHeight/30 + FontMessageBoxLargeDelta); FontMessageBoxLarge = cFont::CreateFont(*fontname, osdHeight/30 + FontMessageBoxLargeDelta);
FontStatusHeader = cFont::CreateFont(*fontname, statusHeaderHeight/6 - 4 + FontStatusHeaderDelta); FontStatusHeader = cFont::CreateFont(*fontname, statusHeaderHeight/6 - 4 + FontStatusHeaderDelta);
FontStatusHeaderLarge = cFont::CreateFont(*fontname, statusHeaderHeight/5 + FontStatusHeaderLargeDelta); FontStatusHeaderLarge = cFont::CreateFont(*fontname, statusHeaderHeight/5 + FontStatusHeaderLargeDelta);
//Fonts for vertical Display //Fonts for vertical Display
FontChannelHeader = cFont::CreateFont(*fontname, colWidth/10 + FontChannelHeaderDelta); FontChannelHeader = cFont::CreateFont(*fontname, colWidth/10 + FontChannelHeaderDelta);
FontGrid = cFont::CreateFont(*fontname, colWidth/12 + FontGridDelta); FontGrid = cFont::CreateFont(*fontname, colWidth/12 + FontGridDelta);
FontGridSmall = cFont::CreateFont(*fontname, colWidth/12 + FontGridSmallDelta); FontGridSmall = cFont::CreateFont(*fontname, colWidth/12 + FontGridSmallDelta);
FontTimeLineWeekday = cFont::CreateFont(*fontname, timeLineWidth/3 + FontTimeLineWeekdayDelta); FontTimeLineWeekday = cFont::CreateFont(*fontname, timeLineWidth/3 + FontTimeLineWeekdayDelta);
FontTimeLineDate = cFont::CreateFont(*fontname, timeLineWidth/4 + FontTimeLineDateDelta); FontTimeLineDate = cFont::CreateFont(*fontname, timeLineWidth/4 + FontTimeLineDateDelta);
FontTimeLineTime = cFont::CreateFont(*fontname, timeLineWidth/4 + FontTimeLineTimeDelta); FontTimeLineTime = cFont::CreateFont(*fontname, timeLineWidth/4 + FontTimeLineTimeDelta);
//Fonts for horizontal Display //Fonts for horizontal Display
FontChannelHeaderHorizontal = cFont::CreateFont(*fontname, rowHeight/3 + FontChannelHeaderHorizontalDelta); FontChannelHeaderHorizontal = cFont::CreateFont(*fontname, rowHeight/3 + FontChannelHeaderHorizontalDelta);
FontGridHorizontal = cFont::CreateFont(*fontname, rowHeight/3 + 5 + FontGridHorizontalDelta); FontGridHorizontal = cFont::CreateFont(*fontname, rowHeight/3 + 5 + FontGridHorizontalDelta);
FontGridHorizontalSmall = cFont::CreateFont(*fontname, rowHeight/4 + FontGridHorizontalSmallDelta); FontGridHorizontalSmall = cFont::CreateFont(*fontname, rowHeight/4 + FontGridHorizontalSmallDelta);
FontTimeLineDateHorizontal = cFont::CreateFont(*fontname, timeLineHeight/2 + 5 + FontTimeLineDateHorizontalDelta); FontTimeLineDateHorizontal = cFont::CreateFont(*fontname, timeLineHeight/2 + 5 + FontTimeLineDateHorizontalDelta);
FontTimeLineTimeHorizontal = cFont::CreateFont(*fontname, timeLineHeight/2 + FontTimeLineTimeHorizontalDelta); FontTimeLineTimeHorizontal = cFont::CreateFont(*fontname, timeLineHeight/2 + FontTimeLineTimeHorizontalDelta);
} }
void cTvguideConfig::SetLogoPath(cString path) { void cTvguideConfig::SetLogoPath(cString path) {
logoPath = path; logoPath = path;
} }
void cTvguideConfig::SetImagesPath(cString path) { void cTvguideConfig::SetImagesPath(cString path) {
epgImagePath = path; epgImagePath = path;
} }
void cTvguideConfig::loadTheme() { void cTvguideConfig::loadTheme() {
cThemes themes; cThemes themes;
themes.Load(*cString("tvguide")); themes.Load(*cString("tvguide"));
const char *FileName = themes.FileName(themeIndex); const char *FileName = themes.FileName(themeIndex);
if (access(FileName, F_OK) == 0) { if (access(FileName, F_OK) == 0) {
::theme.Load(FileName); ::theme.Load(FileName);
} }
} }
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, "displayMode") == 0) displayMode = atoi(Value); else if (strcmp(Name, "displayMode") == 0) displayMode = atoi(Value);
else if (strcmp(Name, "displayStatusHeader") == 0) displayStatusHeader = atoi(Value); else if (strcmp(Name, "displayStatusHeader") == 0) displayStatusHeader = atoi(Value);
else if (strcmp(Name, "statusHeaderPercent") == 0) statusHeaderPercent = atoi(Value); else if (strcmp(Name, "statusHeaderPercent") == 0) statusHeaderPercent = atoi(Value);
else if (strcmp(Name, "scaleVideo") == 0) scaleVideo = atoi(Value); else if (strcmp(Name, "scaleVideo") == 0) scaleVideo = atoi(Value);
else if (strcmp(Name, "decorateVideo") == 0) decorateVideo = atoi(Value); else if (strcmp(Name, "decorateVideo") == 0) decorateVideo = 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);
else if (strcmp(Name, "channelRows") == 0) channelRows = atoi(Value); else if (strcmp(Name, "channelRows") == 0) channelRows = atoi(Value);
else if (strcmp(Name, "displayTime") == 0) displayTime = atoi(Value); else if (strcmp(Name, "displayTime") == 0) displayTime = atoi(Value);
else if (strcmp(Name, "hideChannelLogos") == 0) hideChannelLogos = atoi(Value); else if (strcmp(Name, "hideChannelLogos") == 0) hideChannelLogos = atoi(Value);
else if (strcmp(Name, "logoExtension") == 0) logoExtension = atoi(Value); else if (strcmp(Name, "logoExtension") == 0) logoExtension = atoi(Value);
else if (strcmp(Name, "logoWidthRatio") == 0) logoWidthRatio = atoi(Value); else if (strcmp(Name, "logoWidthRatio") == 0) logoWidthRatio = atoi(Value);
else if (strcmp(Name, "logoHeightRatio") == 0) logoHeightRatio = atoi(Value); else if (strcmp(Name, "logoHeightRatio") == 0) logoHeightRatio = atoi(Value);
else if (strcmp(Name, "bigStepHours") == 0) bigStepHours = atoi(Value); else if (strcmp(Name, "bigStepHours") == 0) bigStepHours = atoi(Value);
else if (strcmp(Name, "hugeStepHours") == 0) hugeStepHours = atoi(Value); else if (strcmp(Name, "hugeStepHours") == 0) hugeStepHours = atoi(Value);
else if (strcmp(Name, "jumpChannels") == 0) jumpChannels = atoi(Value); else if (strcmp(Name, "jumpChannels") == 0) jumpChannels = atoi(Value);
else if (strcmp(Name, "hideEpgImages") == 0) hideEpgImages = atoi(Value); else if (strcmp(Name, "hideEpgImages") == 0) hideEpgImages = atoi(Value);
else if (strcmp(Name, "epgImageWidth") == 0) epgImageWidth = atoi(Value); else if (strcmp(Name, "epgImageWidth") == 0) epgImageWidth = atoi(Value);
else if (strcmp(Name, "epgImageHeight") == 0) epgImageHeight = atoi(Value); else if (strcmp(Name, "epgImageHeight") == 0) epgImageHeight = atoi(Value);
else if (strcmp(Name, "timeLineWidthPercent") == 0) timeLineWidthPercent = atoi(Value); else if (strcmp(Name, "timeLineWidthPercent") == 0) timeLineWidthPercent = atoi(Value);
else if (strcmp(Name, "timeLineHeightPercent") == 0) timeLineHeightPercent = atoi(Value); else if (strcmp(Name, "timeLineHeightPercent") == 0) timeLineHeightPercent = atoi(Value);
else if (strcmp(Name, "displayChannelName") == 0) displayChannelName = atoi(Value); else if (strcmp(Name, "displayChannelName") == 0) displayChannelName = atoi(Value);
else if (strcmp(Name, "channelHeaderWidthPercent") == 0) channelHeaderWidthPercent = atoi(Value); else if (strcmp(Name, "channelHeaderWidthPercent") == 0) channelHeaderWidthPercent = atoi(Value);
else if (strcmp(Name, "channelHeaderHeightPercent") == 0) channelHeaderHeightPercent = atoi(Value); else if (strcmp(Name, "channelHeaderHeightPercent") == 0) channelHeaderHeightPercent = 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, "FontButtonDelta") == 0) FontButtonDelta = atoi(Value); else if (strcmp(Name, "FontButtonDelta") == 0) FontButtonDelta = atoi(Value);
else if (strcmp(Name, "FontDetailViewDelta") == 0) FontDetailViewDelta = atoi(Value); else if (strcmp(Name, "FontDetailViewDelta") == 0) FontDetailViewDelta = atoi(Value);
else if (strcmp(Name, "FontDetailHeaderDelta") == 0) FontDetailHeaderDelta = atoi(Value); else if (strcmp(Name, "FontDetailHeaderDelta") == 0) FontDetailHeaderDelta = atoi(Value);
else if (strcmp(Name, "FontMessageBoxDelta") == 0) FontMessageBoxDelta = atoi(Value); else if (strcmp(Name, "FontMessageBoxDelta") == 0) FontMessageBoxDelta = atoi(Value);
else if (strcmp(Name, "FontMessageBoxLargeDelta") == 0) FontMessageBoxLargeDelta = atoi(Value); else if (strcmp(Name, "FontMessageBoxLargeDelta") == 0) FontMessageBoxLargeDelta = atoi(Value);
else if (strcmp(Name, "FontStatusHeaderDelta") == 0) FontStatusHeaderDelta = atoi(Value); else if (strcmp(Name, "FontStatusHeaderDelta") == 0) FontStatusHeaderDelta = atoi(Value);
else if (strcmp(Name, "FontStatusHeaderLargeDelta") == 0) FontStatusHeaderLargeDelta = atoi(Value); else if (strcmp(Name, "FontStatusHeaderLargeDelta") == 0) FontStatusHeaderLargeDelta = atoi(Value);
else if (strcmp(Name, "FontChannelHeaderDelta") == 0) FontChannelHeaderDelta = atoi(Value); else if (strcmp(Name, "FontChannelHeaderDelta") == 0) FontChannelHeaderDelta = atoi(Value);
else if (strcmp(Name, "FontGridDelta") == 0) FontGridDelta = atoi(Value); else if (strcmp(Name, "FontGridDelta") == 0) FontGridDelta = atoi(Value);
else if (strcmp(Name, "FontGridSmallDelta") == 0) FontGridSmallDelta = atoi(Value); else if (strcmp(Name, "FontGridSmallDelta") == 0) FontGridSmallDelta = atoi(Value);
else if (strcmp(Name, "FontTimeLineWeekdayDelta") == 0) FontTimeLineWeekdayDelta = atoi(Value); else if (strcmp(Name, "FontTimeLineWeekdayDelta") == 0) FontTimeLineWeekdayDelta = atoi(Value);
else if (strcmp(Name, "FontTimeLineDateDelta") == 0) FontTimeLineDateDelta = atoi(Value); else if (strcmp(Name, "FontTimeLineDateDelta") == 0) FontTimeLineDateDelta = atoi(Value);
else if (strcmp(Name, "FontTimeLineTimeDelta") == 0) FontTimeLineTimeDelta = atoi(Value); else if (strcmp(Name, "FontTimeLineTimeDelta") == 0) FontTimeLineTimeDelta = atoi(Value);
else if (strcmp(Name, "FontChannelHeaderHorizontalDelta") == 0) FontChannelHeaderHorizontalDelta = atoi(Value); else if (strcmp(Name, "FontChannelHeaderHorizontalDelta") == 0) FontChannelHeaderHorizontalDelta = atoi(Value);
else if (strcmp(Name, "FontGridHorizontalDelta") == 0) FontGridHorizontalDelta = atoi(Value); else if (strcmp(Name, "FontGridHorizontalDelta") == 0) FontGridHorizontalDelta = atoi(Value);
else if (strcmp(Name, "FontGridHorizontalSmallDelta") == 0) FontGridHorizontalSmallDelta = atoi(Value); else if (strcmp(Name, "FontGridHorizontalSmallDelta") == 0) FontGridHorizontalSmallDelta = atoi(Value);
else if (strcmp(Name, "FontTimeLineDateHorizontalDelta") == 0) FontTimeLineDateHorizontalDelta = atoi(Value); else if (strcmp(Name, "FontTimeLineDateHorizontalDelta") == 0) FontTimeLineDateHorizontalDelta = atoi(Value);
else if (strcmp(Name, "FontTimeLineTimeHorizontalDelta") == 0) FontTimeLineTimeHorizontalDelta = atoi(Value); else if (strcmp(Name, "FontTimeLineTimeHorizontalDelta") == 0) FontTimeLineTimeHorizontalDelta = atoi(Value);
else return false; else return false;
return true; return true;
} }

114
config.h
View File

@ -2,53 +2,53 @@
#define __TVGUIDE_CONFIG_H #define __TVGUIDE_CONFIG_H
class cTvguideConfig { class cTvguideConfig {
public: public:
cTvguideConfig(); cTvguideConfig();
~cTvguideConfig(); ~cTvguideConfig();
void SetLogoPath(cString path); void SetLogoPath(cString path);
void SetImagesPath(cString path); void SetImagesPath(cString path);
void SetGeometry(int width, int height); void SetGeometry(int width, int height);
void SetFonts(void); void SetFonts(void);
int osdWidth; int osdWidth;
int osdHeight; int osdHeight;
int displayMode; int displayMode;
int colWidth; int colWidth;
int rowHeight; int rowHeight;
int channelCols; int channelCols;
int channelRows; int channelRows;
int numGrids; int numGrids;
int displayTime; int displayTime;
int minutePixel; int minutePixel;
int displayStatusHeader; int displayStatusHeader;
int statusHeaderPercent; int statusHeaderPercent;
int statusHeaderHeight; int statusHeaderHeight;
int scaleVideo; int scaleVideo;
int decorateVideo; int decorateVideo;
int timeLineWidthPercent; int timeLineWidthPercent;
int timeLineHeightPercent; int timeLineHeightPercent;
int timeLineWidth; int timeLineWidth;
int timeLineHeight; int timeLineHeight;
int displayChannelName; int displayChannelName;
int channelHeaderWidthPercent; int channelHeaderWidthPercent;
int channelHeaderHeightPercent; int channelHeaderHeightPercent;
int channelHeaderWidth; int channelHeaderWidth;
int channelHeaderHeight; int channelHeaderHeight;
int footerHeight; int footerHeight;
int stepMinutes; int stepMinutes;
int bigStepHours; int bigStepHours;
int hugeStepHours; int hugeStepHours;
int jumpChannels; int jumpChannels;
int hideChannelLogos; int hideChannelLogos;
int logoWidthRatio; int logoWidthRatio;
int logoHeightRatio; int logoHeightRatio;
cString logoPath; cString logoPath;
int logoExtension; int logoExtension;
int hideEpgImages; int hideEpgImages;
int epgImageWidth; int epgImageWidth;
int epgImageHeight; int epgImageHeight;
cString epgImagePath; cString epgImagePath;
int fontIndex; int fontIndex;
const char *fontNameDefault; const char *fontNameDefault;
int FontButtonDelta; int FontButtonDelta;
int FontDetailViewDelta; int FontDetailViewDelta;
int FontDetailHeaderDelta; int FontDetailHeaderDelta;
@ -67,31 +67,31 @@ class cTvguideConfig {
int FontGridHorizontalSmallDelta; int FontGridHorizontalSmallDelta;
int FontTimeLineDateHorizontalDelta; int FontTimeLineDateHorizontalDelta;
int FontTimeLineTimeHorizontalDelta; int FontTimeLineTimeHorizontalDelta;
const cFont *FontChannelHeader; const cFont *FontChannelHeader;
const cFont *FontChannelHeaderHorizontal; const cFont *FontChannelHeaderHorizontal;
const cFont *FontStatusHeader; const cFont *FontStatusHeader;
const cFont *FontStatusHeaderLarge; const cFont *FontStatusHeaderLarge;
const cFont *FontGrid; const cFont *FontGrid;
const cFont *FontGridSmall; const cFont *FontGridSmall;
const cFont *FontGridHorizontal; const cFont *FontGridHorizontal;
const cFont *FontGridHorizontalSmall; const cFont *FontGridHorizontalSmall;
const cFont *FontTimeLineWeekday; const cFont *FontTimeLineWeekday;
const cFont *FontTimeLineDate; const cFont *FontTimeLineDate;
const cFont *FontTimeLineDateHorizontal; const cFont *FontTimeLineDateHorizontal;
const cFont *FontTimeLineTime; const cFont *FontTimeLineTime;
const cFont *FontTimeLineTimeHorizontal; const cFont *FontTimeLineTimeHorizontal;
const cFont *FontButton; const cFont *FontButton;
const cFont *FontDetailView; const cFont *FontDetailView;
const cFont *FontDetailHeader; const cFont *FontDetailHeader;
const cFont *FontMessageBox; const cFont *FontMessageBox;
const cFont *FontMessageBoxLarge; const cFont *FontMessageBoxLarge;
int timeFormat; int timeFormat;
int themeIndex; int themeIndex;
int useBlending; int useBlending;
int roundedCorners; int roundedCorners;
void setDynamicValues(int width, int height); void setDynamicValues(int width, int height);
bool SetupParse(const char *Name, const char *Value); bool SetupParse(const char *Name, const char *Value);
void loadTheme(); void loadTheme();
}; };
#endif //__TVGUIDE_CONFIG_H #endif //__TVGUIDE_CONFIG_H

View File

@ -1,195 +1,195 @@
#include "detailview.h" #include "detailview.h"
cDetailView::cDetailView(cGrid *grid) { cDetailView::cDetailView(cGrid *grid) {
this->grid = grid; this->grid = grid;
this->event = grid->GetEvent(); this->event = grid->GetEvent();
imgScrollBar = NULL; imgScrollBar = NULL;
FrameTime = 40; // ms FrameTime = 40; // ms
FadeTime = 500; // ms FadeTime = 500; // ms
borderWidth = 100; //px borderWidth = 100; //px
headerHeight = max (40 + 3 * tvguideConfig.FontDetailHeader->Height(), // border + 3 Lines headerHeight = max (40 + 3 * tvguideConfig.FontDetailHeader->Height(), // border + 3 Lines
40 + tvguideConfig.epgImageHeight); 40 + tvguideConfig.epgImageHeight);
description.Set(event->Description(), tvguideConfig.FontDetailView, tvguideConfig.osdWidth-2*borderWidth - 50 - 40); description.Set(event->Description(), tvguideConfig.FontDetailView, tvguideConfig.osdWidth-2*borderWidth - 50 - 40);
contentScrollable = setContentDrawportHeight(); contentScrollable = setContentDrawportHeight();
createPixmaps(); createPixmaps();
} }
cDetailView::~cDetailView(void){ cDetailView::~cDetailView(void){
delete header; delete header;
osdManager.releasePixmap(headerLogo); osdManager.releasePixmap(headerLogo);
osdManager.releasePixmap(headerBack); osdManager.releasePixmap(headerBack);
osdManager.releasePixmap(content); osdManager.releasePixmap(content);
osdManager.releasePixmap(scrollBar); osdManager.releasePixmap(scrollBar);
osdManager.releasePixmap(footer); osdManager.releasePixmap(footer);
delete imgScrollBar; delete imgScrollBar;
} }
bool cDetailView::setContentDrawportHeight() { bool cDetailView::setContentDrawportHeight() {
int linesContent = description.Lines() + 1; int linesContent = description.Lines() + 1;
heightContent = linesContent * tvguideConfig.FontDetailView->Height(); heightContent = linesContent * tvguideConfig.FontDetailView->Height();
if (heightContent > (tvguideConfig.osdHeight - 2 * borderWidth - headerHeight)) if (heightContent > (tvguideConfig.osdHeight - 2 * borderWidth - headerHeight))
return true; return true;
else else
return false; return false;
} }
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)); 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); 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); 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));
content = osdManager.requestPixmap(5, cRect(borderWidth, borderWidth + headerHeight, tvguideConfig.osdWidth - 2*borderWidth - scrollBarWidth, tvguideConfig.osdHeight-2*borderWidth-headerHeight), content = osdManager.requestPixmap(5, cRect(borderWidth, borderWidth + headerHeight, tvguideConfig.osdWidth - 2*borderWidth - scrollBarWidth, tvguideConfig.osdHeight-2*borderWidth-headerHeight),
cRect(0,0, tvguideConfig.osdWidth - 2*borderWidth - scrollBarWidth, max(heightContent, tvguideConfig.osdHeight-2*borderWidth-headerHeight))); cRect(0,0, tvguideConfig.osdWidth - 2*borderWidth - scrollBarWidth, max(heightContent, tvguideConfig.osdHeight-2*borderWidth-headerHeight)));
content->SetAlpha(0); content->SetAlpha(0);
header->setColor(theme.Color(clrHeader), theme.Color(clrHeaderBlending)); header->setColor(theme.Color(clrHeader), theme.Color(clrHeaderBlending));
scrollBar = osdManager.requestPixmap(5, cRect(tvguideConfig.osdWidth-borderWidth-scrollBarWidth, borderWidth + headerHeight, scrollBarWidth, tvguideConfig.osdHeight-2*borderWidth-headerHeight)); scrollBar = osdManager.requestPixmap(5, cRect(tvguideConfig.osdWidth-borderWidth-scrollBarWidth, borderWidth + headerHeight, scrollBarWidth, tvguideConfig.osdHeight-2*borderWidth-headerHeight));
scrollBar->SetAlpha(0); scrollBar->SetAlpha(0);
footer = osdManager.requestPixmap(5, cRect(borderWidth, borderWidth + headerHeight + content->ViewPort().Height(), tvguideConfig.osdWidth - 2*borderWidth, 3)); footer = osdManager.requestPixmap(5, cRect(borderWidth, borderWidth + headerHeight + content->ViewPort().Height(), tvguideConfig.osdWidth - 2*borderWidth, 3));
footer->SetAlpha(0); footer->SetAlpha(0);
footer->Fill(theme.Color(clrBorder)); footer->Fill(theme.Color(clrBorder));
} }
void cDetailView::drawHeader() { void cDetailView::drawHeader() {
header->drawBackground(); header->drawBackground();
header->drawBoldBorder(); header->drawBoldBorder();
int logoHeight = header->Height() / 2; int logoHeight = header->Height() / 2;
int logoWidth = logoHeight * tvguideConfig.logoWidthRatio / tvguideConfig.logoHeightRatio; int logoWidth = logoHeight * tvguideConfig.logoWidthRatio / tvguideConfig.logoHeightRatio;
int lineHeight = tvguideConfig.FontDetailHeader->Height(); int lineHeight = tvguideConfig.FontDetailHeader->Height();
cImageLoader imgLoader; cImageLoader imgLoader;
bool logoDrawn = false; bool logoDrawn = false;
if (!tvguideConfig.hideChannelLogos) { if (!tvguideConfig.hideChannelLogos) {
if (imgLoader.LoadLogo(grid->column->getChannel()->Name(), logoWidth, logoHeight)) { if (imgLoader.LoadLogo(grid->column->getChannel()->Name(), logoWidth, logoHeight)) {
cImage logo = imgLoader.GetImage(); cImage logo = imgLoader.GetImage();
headerLogo->DrawImage(cPoint(10, (header->Height() - logoHeight)/2), logo); headerLogo->DrawImage(cPoint(10, (header->Height() - logoHeight)/2), logo);
logoDrawn = true; logoDrawn = true;
} }
} }
if (!tvguideConfig.hideEpgImages) { if (!tvguideConfig.hideEpgImages) {
if (imgLoader.LoadEPGImage(event->EventID())) { if (imgLoader.LoadEPGImage(event->EventID())) {
cImage epgImage = imgLoader.GetImage(); cImage epgImage = imgLoader.GetImage();
int epgImageX = header->Width() - 30 - tvguideConfig.epgImageWidth; int epgImageX = header->Width() - 30 - tvguideConfig.epgImageWidth;
int epgImageY = (header->Height() - 10 - tvguideConfig.epgImageHeight) / 2; int epgImageY = (header->Height() - 10 - tvguideConfig.epgImageHeight) / 2;
header->DrawRectangle(cRect(epgImageX-2, epgImageY-2, tvguideConfig.epgImageWidth + 4, tvguideConfig.epgImageHeight + 4), theme.Color(clrBorder)); header->DrawRectangle(cRect(epgImageX-2, epgImageY-2, tvguideConfig.epgImageWidth + 4, tvguideConfig.epgImageHeight + 4), theme.Color(clrBorder));
header->DrawImage(cPoint(epgImageX, epgImageY), epgImage); header->DrawImage(cPoint(epgImageX, epgImageY), epgImage);
} }
} }
int textX = logoDrawn?(20 + logoWidth):20; int textX = logoDrawn?(20 + logoWidth):20;
int textY = (header->Height() - 2*lineHeight)/2; int textY = (header->Height() - 2*lineHeight)/2;
header->DrawText(cPoint(textX, textY), event->Title(), theme.Color(clrFont), clrTransparent, tvguideConfig.FontDetailHeader); header->DrawText(cPoint(textX, textY), event->Title(), theme.Color(clrFont), clrTransparent, tvguideConfig.FontDetailHeader);
cString datetime = cString::sprintf("%s, %s - %s (%d min)", *event->GetDateString(), *event->GetTimeString(), *event->GetEndTimeString(), event->Duration()/60); cString datetime = cString::sprintf("%s, %s - %s (%d min)", *event->GetDateString(), *event->GetTimeString(), *event->GetEndTimeString(), event->Duration()/60);
header->DrawText(cPoint(textX, textY + lineHeight), *datetime, theme.Color(clrFont), clrTransparent, tvguideConfig.FontDetailView); header->DrawText(cPoint(textX, textY + lineHeight), *datetime, theme.Color(clrFont), clrTransparent, tvguideConfig.FontDetailView);
header->DrawText(cPoint(textX, textY + 2 * lineHeight), event->ShortText(), theme.Color(clrFont), clrTransparent, tvguideConfig.FontDetailView); header->DrawText(cPoint(textX, textY + 2 * lineHeight), event->ShortText(), theme.Color(clrFont), clrTransparent, tvguideConfig.FontDetailView);
} }
void cDetailView::drawContent() { void cDetailView::drawContent() {
content->Fill(theme.Color(clrBorder)); content->Fill(theme.Color(clrBorder));
content->DrawRectangle(cRect(2, 0, content->ViewPort().Width() - 2, content->DrawPort().Height()), theme.Color(clrBackground)); content->DrawRectangle(cRect(2, 0, content->ViewPort().Width() - 2, content->DrawPort().Height()), theme.Color(clrBackground));
int textHeight = tvguideConfig.FontDetailView->Height(); int textHeight = tvguideConfig.FontDetailView->Height();
int textLines = description.Lines(); int textLines = description.Lines();
for (int i=0; i<textLines; i++) { for (int i=0; i<textLines; i++) {
content->DrawText(cPoint(20, 20 + i*textHeight), description.GetLine(i), theme.Color(clrFont), clrTransparent, tvguideConfig.FontDetailView); content->DrawText(cPoint(20, 20 + i*textHeight), description.GetLine(i), theme.Color(clrFont), clrTransparent, tvguideConfig.FontDetailView);
} }
} }
void cDetailView::drawScrollbar() { void cDetailView::drawScrollbar() {
scrollBar->Fill(theme.Color(clrBorder)); scrollBar->Fill(theme.Color(clrBorder));
double scrollBarOffset = 0.0; double scrollBarOffset = 0.0;
if (contentScrollable) { if (contentScrollable) {
heightScrollbar = ( (double)scrollBar->ViewPort().Height() ) / (double)heightContent * ( (double)scrollBar->ViewPort().Height() ); heightScrollbar = ( (double)scrollBar->ViewPort().Height() ) / (double)heightContent * ( (double)scrollBar->ViewPort().Height() );
scrollBarOffset = (-1.0)*(double)content->DrawPort().Point().Y() / (double)(content->DrawPort().Height() - (tvguideConfig.osdHeight-2*borderWidth-headerHeight)); scrollBarOffset = (-1.0)*(double)content->DrawPort().Point().Y() / (double)(content->DrawPort().Height() - (tvguideConfig.osdHeight-2*borderWidth-headerHeight));
scrollBarOffset *= ( (double)scrollBar->ViewPort().Height()-7.0 - heightScrollbar); scrollBarOffset *= ( (double)scrollBar->ViewPort().Height()-7.0 - heightScrollbar);
scrollBarOffset++; scrollBarOffset++;
} else { } else {
heightScrollbar = scrollBar->ViewPort().Height(); heightScrollbar = scrollBar->ViewPort().Height();
} }
scrollBar->DrawRectangle(cRect(3,0,scrollBar->ViewPort().Width()-6, scrollBar->ViewPort().Height()), theme.Color(clrBackground)); scrollBar->DrawRectangle(cRect(3,0,scrollBar->ViewPort().Width()-6, scrollBar->ViewPort().Height()), theme.Color(clrBackground));
if (imgScrollBar == NULL) { if (imgScrollBar == NULL) {
imgScrollBar = createScrollbar(scrollBar->ViewPort().Width()-10, heightScrollbar, theme.Color(clrHighlight), theme.Color(clrHighlightBlending)); imgScrollBar = createScrollbar(scrollBar->ViewPort().Width()-10, heightScrollbar, theme.Color(clrHighlight), theme.Color(clrHighlightBlending));
} }
scrollBar->DrawImage(cPoint(5, 2 + scrollBarOffset), *imgScrollBar); scrollBar->DrawImage(cPoint(5, 2 + scrollBarOffset), *imgScrollBar);
} }
void cDetailView::scrollUp() { void cDetailView::scrollUp() {
if (contentScrollable) { if (contentScrollable) {
int newDrawportHeight = content->DrawPort().Point().Y() + tvguideConfig.FontDetailView->Height(); int newDrawportHeight = content->DrawPort().Point().Y() + tvguideConfig.FontDetailView->Height();
content->SetDrawPortPoint(cPoint(0, min(newDrawportHeight,0))); content->SetDrawPortPoint(cPoint(0, min(newDrawportHeight,0)));
drawScrollbar(); drawScrollbar();
} }
} }
void cDetailView::scrollDown() { void cDetailView::scrollDown() {
if (contentScrollable) { if (contentScrollable) {
int newDrawportHeight = content->DrawPort().Point().Y() - tvguideConfig.FontDetailView->Height(); int newDrawportHeight = content->DrawPort().Point().Y() - tvguideConfig.FontDetailView->Height();
int maxDrawportHeight = (content->DrawPort().Height() - (tvguideConfig.osdHeight-2*borderWidth-headerHeight)); int maxDrawportHeight = (content->DrawPort().Height() - (tvguideConfig.osdHeight-2*borderWidth-headerHeight));
content->SetDrawPortPoint(cPoint(0, max(newDrawportHeight,(-1)*maxDrawportHeight))); content->SetDrawPortPoint(cPoint(0, max(newDrawportHeight,(-1)*maxDrawportHeight)));
drawScrollbar(); drawScrollbar();
} }
} }
cImage *cDetailView::createScrollbar(int width, int height, tColor clrBgr, tColor clrBlend) { cImage *cDetailView::createScrollbar(int width, int height, tColor clrBgr, tColor clrBlend) {
cImage *image = new cImage(cSize(width, height)); cImage *image = new cImage(cSize(width, height));
image->Fill(clrBgr); image->Fill(clrBgr);
if (tvguideConfig.useBlending) { if (tvguideConfig.useBlending) {
int numSteps = 64; int numSteps = 64;
int alphaStep = 0x03; int alphaStep = 0x03;
if (height < 30) if (height < 30)
return image; return image;
else if (height < 100) { else if (height < 100) {
numSteps = 32; numSteps = 32;
alphaStep = 0x06; alphaStep = 0x06;
} }
int stepY = 0.5*height / numSteps; int stepY = 0.5*height / numSteps;
if (stepY == 0) if (stepY == 0)
stepY = 1; stepY = 1;
int alpha = 0x40; int alpha = 0x40;
tColor clr; tColor clr;
for (int i = 0; i<numSteps; i++) { for (int i = 0; i<numSteps; i++) {
clr = AlphaBlend(clrBgr, clrBlend, alpha); clr = AlphaBlend(clrBgr, clrBlend, alpha);
for (int y = i*stepY; y < (i+1)*stepY; y++) { for (int y = i*stepY; y < (i+1)*stepY; y++) {
for (int x=0; x<width; x++) { for (int x=0; x<width; x++) {
image->SetPixel(cPoint(x,y), clr); image->SetPixel(cPoint(x,y), clr);
} }
} }
alpha += alphaStep; alpha += alphaStep;
} }
} }
return image; return image;
} }
void cDetailView::Action(void) { void cDetailView::Action(void) {
drawHeader(); drawHeader();
drawContent(); drawContent();
drawScrollbar(); drawScrollbar();
uint64_t Start = cTimeMs::Now(); uint64_t Start = cTimeMs::Now();
while (true) { while (true) {
uint64_t Now = cTimeMs::Now(); uint64_t Now = cTimeMs::Now();
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;
header->SetAlpha(Alpha); header->SetAlpha(Alpha);
headerBack->SetAlpha(Alpha); headerBack->SetAlpha(Alpha);
headerLogo->SetAlpha(Alpha); headerLogo->SetAlpha(Alpha);
content->SetAlpha(Alpha); content->SetAlpha(Alpha);
scrollBar->SetAlpha(Alpha); scrollBar->SetAlpha(Alpha);
footer->SetAlpha(Alpha); footer->SetAlpha(Alpha);
osdManager.flush(); osdManager.flush();
cPixmap::Unlock(); cPixmap::Unlock();
int Delta = cTimeMs::Now() - Now; int Delta = cTimeMs::Now() - Now;
if (Delta < FrameTime) if (Delta < FrameTime)
cCondWait::SleepMs(FrameTime - Delta); cCondWait::SleepMs(FrameTime - Delta);
if ((Now - Start) > FadeTime) if ((Now - Start) > FadeTime)
break; break;
} }
} }

View File

@ -7,35 +7,35 @@ class cEpgGrid;
class cDetailView : public cThread { class cDetailView : public cThread {
private: private:
cGrid *grid; cGrid *grid;
cStyledPixmap *header; cStyledPixmap *header;
cPixmap *headerLogo; cPixmap *headerLogo;
cPixmap *headerBack; cPixmap *headerBack;
cPixmap *content; cPixmap *content;
cPixmap *scrollBar; cPixmap *scrollBar;
cPixmap *footer; cPixmap *footer;
const cEvent *event; const cEvent *event;
cImage *imgScrollBar; cImage *imgScrollBar;
int FrameTime; int FrameTime;
int FadeTime; int FadeTime;
cTextWrapper description; cTextWrapper description;
int borderWidth; int borderWidth;
int headerHeight; int headerHeight;
bool setContentDrawportHeight(); bool setContentDrawportHeight();
int heightContent; int heightContent;
int heightScrollbar; int heightScrollbar;
bool contentScrollable; bool contentScrollable;
virtual void Action(void); virtual void Action(void);
void drawHeader(); void drawHeader();
void drawContent(); void drawContent();
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(cGrid *grid); cDetailView(cGrid *grid);
virtual ~cDetailView(void); virtual ~cDetailView(void);
void createPixmaps(); void createPixmaps();
void scrollUp(); void scrollUp();
void scrollDown(); void scrollDown();
}; };
#endif //__TVGUIDE_DETAILVIEW_H #endif //__TVGUIDE_DETAILVIEW_H

View File

@ -11,10 +11,10 @@ cDummyGrid::~cDummyGrid(void) {
} }
void cDummyGrid::SetViewportHeight() { void cDummyGrid::SetViewportHeight() {
int viewportHeightOld = viewportHeight; int viewportHeightOld = viewportHeight;
viewportHeight = Duration() / 60 * tvguideConfig.minutePixel; viewportHeight = Duration() / 60 * tvguideConfig.minutePixel;
if (viewportHeight != viewportHeightOld) if (viewportHeight != viewportHeightOld)
dirty = true; dirty = true;
} }
void cDummyGrid::PositionPixmap() { void cDummyGrid::PositionPixmap() {
@ -57,7 +57,7 @@ void cDummyGrid::setText() {
} }
void cDummyGrid::drawText() { void cDummyGrid::drawText() {
if (tvguideConfig.displayMode == eVertical) { if (tvguideConfig.displayMode == eVertical) {
if (Height()/tvguideConfig.minutePixel < 6) if (Height()/tvguideConfig.minutePixel < 6)
return; return;
int textHeight = tvguideConfig.FontGrid->Height(); int textHeight = tvguideConfig.FontGrid->Height();
@ -80,7 +80,7 @@ cString cDummyGrid::getTimeString(void) {
} }
void cDummyGrid::debug() { void cDummyGrid::debug() {
esyslog("tvguide dummygrid: %s: %s, %s, viewportHeight: %d px, Duration: %ld min, active: %d", esyslog("tvguide dummygrid: %s: %s, %s, viewportHeight: %d px, Duration: %ld min, active: %d",
column->Name(), column->Name(),
*cMyTime::printTime(start), *cMyTime::printTime(start),
*cMyTime::printTime(end), *cMyTime::printTime(end),

View File

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

View File

@ -2,31 +2,31 @@
#include "epggrid.h" #include "epggrid.h"
cEpgGrid::cEpgGrid(cChannelColumn *c, const cEvent *event) : cGrid(c) { cEpgGrid::cEpgGrid(cChannelColumn *c, const cEvent *event) : cGrid(c) {
this->event = event; this->event = event;
extText = new cTextWrapper(); extText = new cTextWrapper();
hasTimer = false; hasTimer = false;
if (column->HasTimer()) if (column->HasTimer())
hasTimer = event->HasTimer(); hasTimer = event->HasTimer();
dummy = false; dummy = false;
} }
cEpgGrid::~cEpgGrid(void) { cEpgGrid::~cEpgGrid(void) {
delete extText; delete extText;
} }
void cEpgGrid::SetViewportHeight() { void cEpgGrid::SetViewportHeight() {
int viewportHeightOld = viewportHeight; int viewportHeightOld = viewportHeight;
if ( column->Start() > StartTime() ) { if ( column->Start() > StartTime() ) {
viewportHeight = (min((int)EndTime(), column->Stop()) - column->Start()) /60; viewportHeight = (min((int)EndTime(), column->Stop()) - column->Start()) /60;
} else if ( column->Stop() < EndTime() ) { } else if ( column->Stop() < EndTime() ) {
viewportHeight = (column->Stop() - StartTime()) /60; viewportHeight = (column->Stop() - StartTime()) /60;
if (viewportHeight < 0) viewportHeight = 0; if (viewportHeight < 0) viewportHeight = 0;
} else { } else {
viewportHeight = Duration() / 60; viewportHeight = Duration() / 60;
} }
viewportHeight *= tvguideConfig.minutePixel; viewportHeight *= tvguideConfig.minutePixel;
if (viewportHeight != viewportHeightOld) if (viewportHeight != viewportHeightOld)
dirty = true; dirty = true;
} }
void cEpgGrid::PositionPixmap() { void cEpgGrid::PositionPixmap() {
@ -103,11 +103,11 @@ void cEpgGrid::drawText() {
} }
void cEpgGrid::drawRecIcon() { void cEpgGrid::drawRecIcon() {
cString recIconText("REC"); cString recIconText("REC");
int width = tvguideConfig.FontGrid->Width(*recIconText)+2*borderWidth; int width = tvguideConfig.FontGrid->Width(*recIconText)+2*borderWidth;
int height = tvguideConfig.FontGrid->Height()+10; int height = tvguideConfig.FontGrid->Height()+10;
pixmap->DrawRectangle( cRect(Width() - width - borderWidth, Height() - height - borderWidth, width, height), theme.Color(clrButtonRed)); pixmap->DrawRectangle( cRect(Width() - width - borderWidth, Height() - height - borderWidth, width, height), theme.Color(clrButtonRed));
pixmap->DrawText(cPoint(Width() - width, Height() - height - borderWidth/2), *recIconText, theme.Color(clrFont), clrTransparent, tvguideConfig.FontGrid); pixmap->DrawText(cPoint(Width() - width, Height() - height - borderWidth/2), *recIconText, theme.Color(clrFont), clrTransparent, tvguideConfig.FontGrid);
} }
cString cEpgGrid::getTimeString(void) { cString cEpgGrid::getTimeString(void) {
@ -115,7 +115,7 @@ cString cEpgGrid::getTimeString(void) {
} }
void cEpgGrid::debug() { void cEpgGrid::debug() {
esyslog("tvguide epggrid: %s: %s, %s, viewportHeight: %d px, Duration: %d min, active: %d", esyslog("tvguide epggrid: %s: %s, %s, viewportHeight: %d px, Duration: %d min, active: %d",
column->Name(), column->Name(),
*(event->GetTimeString()), *(event->GetTimeString()),
event->Title(), event->Title(),

View File

@ -5,25 +5,25 @@
class cEpgGrid : public cGrid { class cEpgGrid : public cGrid {
private: private:
const cEvent *event; const cEvent *event;
cTextWrapper *extText; cTextWrapper *extText;
cString timeString; cString timeString;
bool hasTimer; bool hasTimer;
void drawText(); void drawText();
void drawRecIcon(); void drawRecIcon();
time_t Duration(void) { return event->Duration(); }; time_t Duration(void) { return event->Duration(); };
public: public:
cEpgGrid(cChannelColumn *c, const cEvent *event); cEpgGrid(cChannelColumn *c, const cEvent *event);
virtual ~cEpgGrid(void); virtual ~cEpgGrid(void);
void SetViewportHeight(); void SetViewportHeight();
void PositionPixmap(); void PositionPixmap();
void setText(void); void setText(void);
const cEvent *GetEvent() {return event;}; const cEvent *GetEvent() {return event;};
time_t StartTime() { return event->StartTime(); }; time_t StartTime() { return event->StartTime(); };
time_t EndTime() { return event->EndTime(); }; time_t EndTime() { return event->EndTime(); };
void setTimer() {hasTimer = true;}; void setTimer() {hasTimer = true;};
cString getTimeString(void); cString getTimeString(void);
void debug(); void debug();
}; };
#endif //__TVGUIDE_EPGGRID_H #endif //__TVGUIDE_EPGGRID_H

View File

@ -2,8 +2,8 @@
cFooter::cFooter() { cFooter::cFooter() {
buttonBorder = 20; buttonBorder = 20;
buttonWidth = (tvguideConfig.osdWidth - tvguideConfig.timeLineWidth - 5*buttonBorder)/4; buttonWidth = (tvguideConfig.osdWidth - tvguideConfig.timeLineWidth - 5*buttonBorder)/4;
buttonHeight= tvguideConfig.footerHeight - 2*buttonBorder; buttonHeight= tvguideConfig.footerHeight - 2*buttonBorder;
buttonY = (tvguideConfig.footerHeight - buttonHeight)/2; buttonY = (tvguideConfig.footerHeight - buttonHeight)/2;
footer = osdManager.requestPixmap(2, cRect( tvguideConfig.timeLineWidth, footer = osdManager.requestPixmap(2, cRect( tvguideConfig.timeLineWidth,

View File

@ -5,19 +5,19 @@
class cFooter { class cFooter {
private: private:
cPixmap *footer; cPixmap *footer;
int buttonWidth; int buttonWidth;
int buttonHeight; int buttonHeight;
int buttonY; int buttonY;
int buttonBorder; int buttonBorder;
void DrawButton(const char *text, tColor color, tColor borderColor, int num); void DrawButton(const char *text, tColor color, tColor borderColor, int num);
public: public:
cFooter(); cFooter();
virtual ~cFooter(void); virtual ~cFooter(void);
void drawRedButton(); void drawRedButton();
void drawGreenButton(); void drawGreenButton();
void drawYellowButton(); void drawYellowButton();
void drawBlueButton(); void drawBlueButton();
}; };
#endif //__TVGUIDE_FOOTER_H #endif //__TVGUIDE_FOOTER_H

94
grid.c
View File

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

54
grid.h
View File

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

View File

@ -26,11 +26,11 @@ void cHeaderGrid::createBackground(int num) {
} }
pixmap = osdManager.requestPixmap(2, cRect(x, y, width, height)); pixmap = osdManager.requestPixmap(2, cRect(x, y, width, height));
pixmapLogo = osdManager.requestPixmap(3, cRect(x, y, width, height)); pixmapLogo = osdManager.requestPixmap(3, cRect(x, y, width, height));
if ((!pixmap) || (!pixmapLogo)){ if ((!pixmap) || (!pixmapLogo)){
return; return;
} }
pixmapLogo->Fill(clrTransparent); pixmapLogo->Fill(clrTransparent);
drawBackground(); drawBackground();
} }
void cHeaderGrid::drawChannel(const cChannel *channel) { void cHeaderGrid::drawChannel(const cChannel *channel) {
@ -39,23 +39,23 @@ void cHeaderGrid::drawChannel(const cChannel *channel) {
} else if (tvguideConfig.displayMode == eHorizontal) { } else if (tvguideConfig.displayMode == eHorizontal) {
drawChannelHorizontal(channel); drawChannelHorizontal(channel);
} }
drawBorder(); drawBorder();
} }
void cHeaderGrid::drawChannelHorizontal(const cChannel *channel) { void cHeaderGrid::drawChannelHorizontal(const cChannel *channel) {
int logoWidth = Height() * tvguideConfig.logoWidthRatio / tvguideConfig.logoHeightRatio; int logoWidth = Height() * tvguideConfig.logoWidthRatio / tvguideConfig.logoHeightRatio;
int logoX = tvguideConfig.displayChannelName?2:(Width()-logoWidth)/2; int logoX = tvguideConfig.displayChannelName?2:(Width()-logoWidth)/2;
int textX = 5; int textX = 5;
int textY = (Height() - tvguideConfig.FontChannelHeaderHorizontal->Height())/2; int textY = (Height() - tvguideConfig.FontChannelHeaderHorizontal->Height())/2;
bool logoFound = false; bool logoFound = false;
if (!tvguideConfig.hideChannelLogos) { if (!tvguideConfig.hideChannelLogos) {
cImageLoader imgLoader; cImageLoader imgLoader;
if (imgLoader.LoadLogo(channel->Name(), logoWidth, Height())) { if (imgLoader.LoadLogo(channel->Name(), logoWidth, Height())) {
cImage logo = imgLoader.GetImage(); cImage logo = imgLoader.GetImage();
pixmapLogo->DrawImage(cPoint(logoX, 0), logo); pixmapLogo->DrawImage(cPoint(logoX, 0), logo);
logoFound = true; logoFound = true;
} }
} }
bool drawText = false; bool drawText = false;
int textWidthMax = Width() - 10; int textWidthMax = Width() - 10;
if (!logoFound) { if (!logoFound) {
@ -76,36 +76,36 @@ void cHeaderGrid::drawChannelVertical(const cChannel *channel) {
int logoWidth = Width()/2 - 15; int logoWidth = Width()/2 - 15;
int logoHeight = logoWidth * tvguideConfig.logoHeightRatio / tvguideConfig.logoWidthRatio; int logoHeight = logoWidth * tvguideConfig.logoHeightRatio / tvguideConfig.logoWidthRatio;
cTextWrapper tw; cTextWrapper tw;
cString headerText = cString::sprintf("%d - %s", channel->Number(), channel->Name()); cString headerText = cString::sprintf("%d - %s", channel->Number(), channel->Name());
tw.Set(*headerText, tvguideConfig.FontChannelHeader, tvguideConfig.colWidth - 8); tw.Set(*headerText, tvguideConfig.FontChannelHeader, tvguideConfig.colWidth - 8);
int lines = tw.Lines(); int lines = tw.Lines();
int lineHeight = tvguideConfig.FontChannelHeader->Height(); int lineHeight = tvguideConfig.FontChannelHeader->Height();
int yStart = (tvguideConfig.channelHeaderHeight - lines*lineHeight)/2 + 8; int yStart = (tvguideConfig.channelHeaderHeight - lines*lineHeight)/2 + 8;
bool logoFound = false; bool logoFound = false;
if (!tvguideConfig.hideChannelLogos) { if (!tvguideConfig.hideChannelLogos) {
cImageLoader imgLoader; cImageLoader imgLoader;
if (imgLoader.LoadLogo(channel->Name(), logoWidth, logoHeight)) { if (imgLoader.LoadLogo(channel->Name(), logoWidth, logoHeight)) {
cImage logo = imgLoader.GetImage(); cImage logo = imgLoader.GetImage();
pixmapLogo->DrawImage(cPoint((Width() - logoWidth)/2, 4), logo); pixmapLogo->DrawImage(cPoint((Width() - logoWidth)/2, 4), logo);
logoFound = true; logoFound = true;
} }
} }
bool drawText = false; bool drawText = false;
if (!logoFound) { if (!logoFound) {
drawText = true; drawText = true;
} else if (tvguideConfig.displayChannelName) { } else if (tvguideConfig.displayChannelName) {
drawText = true; drawText = true;
yStart = logoHeight; yStart = logoHeight;
} }
if (!drawText) if (!drawText)
return; return;
for (int i=0; i<lines; i++) { for (int i=0; i<lines; i++) {
int textWidth = tvguideConfig.FontChannelHeader->Width(tw.GetLine(i)); int textWidth = tvguideConfig.FontChannelHeader->Width(tw.GetLine(i));
int xText = (tvguideConfig.colWidth - textWidth) / 2; int xText = (tvguideConfig.colWidth - textWidth) / 2;
if (xText < 0) if (xText < 0)
xText = 0; xText = 0;
pixmap->DrawText(cPoint(xText, yStart + i*lineHeight), tw.GetLine(i), theme.Color(clrFontHeader), clrTransparent, tvguideConfig.FontChannelHeader); pixmap->DrawText(cPoint(xText, yStart + i*lineHeight), tw.GetLine(i), theme.Color(clrFontHeader), clrTransparent, tvguideConfig.FontChannelHeader);
} }
} }
void cHeaderGrid::setPosition(int num) { void cHeaderGrid::setPosition(int num) {
@ -122,5 +122,5 @@ void cHeaderGrid::setPosition(int num) {
height = tvguideConfig.rowHeight; height = tvguideConfig.rowHeight;
} }
pixmap->SetViewPort(cRect(x, y, width, height)); pixmap->SetViewPort(cRect(x, y, width, height));
pixmapLogo->SetViewPort(cRect(x, y, width, height)); pixmapLogo->SetViewPort(cRect(x, y, width, height));
} }

View File

@ -9,8 +9,8 @@ private:
void drawChannelHorizontal(const cChannel *channel); void drawChannelHorizontal(const cChannel *channel);
void drawChannelVertical(const cChannel *channel); void drawChannelVertical(const cChannel *channel);
public: public:
cHeaderGrid(void); cHeaderGrid(void);
virtual ~cHeaderGrid(void); virtual ~cHeaderGrid(void);
void createBackground(int num); void createBackground(int num);
void drawChannel(const cChannel *channel); void drawChannel(const cChannel *channel);
void setPosition(int num); void setPosition(int num);

View File

@ -21,10 +21,10 @@ bool cImageLoader::LoadLogo(const char *logo, int width, int height) {
toLowerCase(logoLower); toLowerCase(logoLower);
cString extension; cString extension;
if (tvguideConfig.logoExtension == 0) { if (tvguideConfig.logoExtension == 0) {
extension = "png"; extension = "png";
} else if (tvguideConfig.logoExtension == 1) { } else if (tvguideConfig.logoExtension == 1) {
extension = "jpg"; extension = "jpg";
} }
if (!LoadImage(logoLower.c_str(), tvguideConfig.logoPath, extension)) if (!LoadImage(logoLower.c_str(), tvguideConfig.logoPath, extension))
return false; return false;
buffer.sample( Geometry(width, height)); buffer.sample( Geometry(width, height));

View File

@ -1,55 +1,55 @@
#include "messagebox.h" #include "messagebox.h"
cMessageBoxThread::cMessageBoxThread(cPixmap *content, int displayTime) { cMessageBoxThread::cMessageBoxThread(cPixmap *content, int displayTime) {
this->content = content; this->content = content;
FrameTime = 30; // ms FrameTime = 30; // ms
FadeTime = 200; // ms FadeTime = 200; // ms
this->displayTime = displayTime; this->displayTime = displayTime;
} }
cMessageBoxThread::~cMessageBoxThread(void) { cMessageBoxThread::~cMessageBoxThread(void) {
Cancel(-1); Cancel(-1);
while (Active()) while (Active())
cCondWait::SleepMs(10); cCondWait::SleepMs(10);
} }
void cMessageBoxThread::Action(void) { void cMessageBoxThread::Action(void) {
uint64_t Start = cTimeMs::Now(); uint64_t Start = cTimeMs::Now();
while (Running()) { while (Running()) {
uint64_t Now = cTimeMs::Now(); uint64_t Now = cTimeMs::Now();
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 (Running() && content) { if (Running() && content) {
content->SetAlpha(Alpha); content->SetAlpha(Alpha);
osdManager.flush(); osdManager.flush();
} }
cPixmap::Unlock(); cPixmap::Unlock();
int Delta = cTimeMs::Now() - Now; int Delta = cTimeMs::Now() - Now;
if (Delta < FrameTime) if (Delta < FrameTime)
cCondWait::SleepMs(FrameTime - Delta); cCondWait::SleepMs(FrameTime - Delta);
if ((Now - Start) > FadeTime) if ((Now - Start) > FadeTime)
break; break;
} }
cCondWait::SleepMs(displayTime - 2*FadeTime); cCondWait::SleepMs(displayTime - 2*FadeTime);
Start = cTimeMs::Now(); Start = cTimeMs::Now();
while (Running()) { while (Running()) {
uint64_t Now = cTimeMs::Now(); uint64_t Now = cTimeMs::Now();
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 (Running() && content) { if (Running() && content) {
content->SetAlpha(Alpha); content->SetAlpha(Alpha);
osdManager.flush(); osdManager.flush();
} }
cPixmap::Unlock(); cPixmap::Unlock();
int Delta = cTimeMs::Now() - Now; int Delta = cTimeMs::Now() - Now;
if (Delta < FrameTime) if (Delta < FrameTime)
cCondWait::SleepMs(FrameTime - Delta); cCondWait::SleepMs(FrameTime - Delta);
if ((Now - Start) > FadeTime) if ((Now - Start) > FadeTime)
break; break;
} }
osdManager.flush(); osdManager.flush();
} }
//--cMessageBox------------------------------------------------------------- //--cMessageBox-------------------------------------------------------------
@ -57,55 +57,55 @@ 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) {
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));
} }
if (msgboxThread) { if (msgboxThread) {
delete msgboxThread; delete msgboxThread;
msgboxThread = NULL; msgboxThread = NULL;
} }
if (!msgboxThread) { if (!msgboxThread) {
msgboxThread = new cMessageBoxThread(content, displayTime); msgboxThread = new cMessageBoxThread(content, displayTime);
cTextWrapper message; cTextWrapper message;
message.Set(msg, tvguideConfig.FontMessageBox, width - 40); message.Set(msg, tvguideConfig.FontMessageBox, width - 40);
int textHeight = tvguideConfig.FontMessageBox->Height(); int textHeight = tvguideConfig.FontMessageBox->Height();
int textLines = message.Lines(); int textLines = message.Lines();
int height = textLines * (textHeight+20); int height = textLines * (textHeight+20);
cPixmap::Lock(); cPixmap::Lock();
content->SetViewPort(cRect((tvguideConfig.osdWidth - width)/2,(tvguideConfig.osdHeight- height)/2, width, height)); content->SetViewPort(cRect((tvguideConfig.osdWidth - width)/2,(tvguideConfig.osdHeight- height)/2, width, height));
content->SetAlpha(0); content->SetAlpha(0);
content->Fill(theme.Color(clrBorder)); content->Fill(theme.Color(clrBorder));
content->DrawRectangle(cRect(2,2,width-4, height-4), theme.Color(clrBackground)); content->DrawRectangle(cRect(2,2,width-4, height-4), theme.Color(clrBackground));
int textWidth = 0; int textWidth = 0;
for (int i=0; i<textLines; i++) { for (int i=0; i<textLines; i++) {
textWidth = tvguideConfig.FontMessageBox->Width(message.GetLine(i)); textWidth = tvguideConfig.FontMessageBox->Width(message.GetLine(i));
content->DrawText(cPoint((width - textWidth)/2, 20 + i*textHeight), message.GetLine(i), theme.Color(clrFont), clrTransparent, tvguideConfig.FontMessageBox); content->DrawText(cPoint((width - textWidth)/2, 20 + i*textHeight), message.GetLine(i), theme.Color(clrFont), clrTransparent, tvguideConfig.FontMessageBox);
} }
cPixmap::Unlock(); cPixmap::Unlock();
msgboxThread->Start(); msgboxThread->Start();
return true; return true;
} }
return false; return false;
} }
void cMessageBox::Stop(void) { void cMessageBox::Stop(void) {
if (msgboxThread) { if (msgboxThread) {
delete msgboxThread; delete msgboxThread;
msgboxThread = NULL; msgboxThread = NULL;
} }
} }
void cMessageBox::Destroy(void) { void cMessageBox::Destroy(void) {
if (msgboxThread) { if (msgboxThread) {
delete msgboxThread; delete msgboxThread;
msgboxThread = NULL; msgboxThread = NULL;
} }
if (content) { if (content) {
osdManager.releasePixmap(content); osdManager.releasePixmap(content);
content = NULL; content = NULL;
} }
} }

View File

@ -5,25 +5,25 @@
class cMessageBoxThread : public cThread { class cMessageBoxThread : public cThread {
private: private:
cPixmap *content; cPixmap *content;
int FadeTime; int FadeTime;
int FrameTime; int FrameTime;
int displayTime; int displayTime;
virtual void Action(void); virtual void Action(void);
public: public:
cMessageBoxThread(cPixmap *content, int displayTime); cMessageBoxThread(cPixmap *content, int displayTime);
virtual ~cMessageBoxThread(void); virtual ~cMessageBoxThread(void);
}; };
class cMessageBox { class cMessageBox {
private: private:
static cMutex mutex; static cMutex mutex;
static cMessageBoxThread *msgboxThread; static cMessageBoxThread *msgboxThread;
static cPixmap *content; static cPixmap *content;
public: public:
static bool Start(int displayTime, cString msg); static bool Start(int displayTime, cString msg);
static void Stop(void); static void Stop(void);
static void Destroy(void); static void Destroy(void);
}; };
#endif //__TVGUIDE_MESSAGEBOX_H #endif //__TVGUIDE_MESSAGEBOX_H

View File

@ -5,18 +5,18 @@
#define __TVGUIDE_OSDMANAGER_H #define __TVGUIDE_OSDMANAGER_H
class cOsdManager { class cOsdManager {
private: private:
cOsd *osd; cOsd *osd;
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); cPixmap *requestPixmap(int Layer, const cRect &ViewPort, const cRect &DrawPort = cRect::Null);
void releasePixmap(cPixmap *pixmap); 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(); };
}; };
#endif //__TVGUIDE_OSDMANAGER_H #endif //__TVGUIDE_OSDMANAGER_H
@ -25,14 +25,14 @@ cOsdManager::cOsdManager(void) {
} }
bool cOsdManager::setOsd() { bool cOsdManager::setOsd() {
osd = cOsdProvider::NewOsd(cOsd::OsdLeft(), cOsd::OsdTop()); osd = cOsdProvider::NewOsd(cOsd::OsdLeft(), cOsd::OsdTop());
if (osd) { if (osd) {
tArea Area = { 0, 0, cOsd::OsdWidth(), cOsd::OsdHeight(), 32 }; tArea Area = { 0, 0, cOsd::OsdWidth(), cOsd::OsdHeight(), 32 };
if (osd->SetAreas(&Area, 1) == oeOk) { if (osd->SetAreas(&Area, 1) == oeOk) {
return true; return true;
} }
} }
return false; return false;
} }
void cOsdManager::setBackground() { void cOsdManager::setBackground() {
@ -46,13 +46,13 @@ void cOsdManager::setBackground() {
} }
cPixmap *cOsdManager::requestPixmap(int Layer, const cRect &ViewPort, const cRect &DrawPort) { cPixmap *cOsdManager::requestPixmap(int Layer, const cRect &ViewPort, const cRect &DrawPort) {
return osd->CreatePixmap(Layer, ViewPort, DrawPort); return osd->CreatePixmap(Layer, ViewPort, DrawPort);
} }
void cOsdManager::releasePixmap(cPixmap *pixmap) { void cOsdManager::releasePixmap(cPixmap *pixmap) {
if (!pixmap) if (!pixmap)
return; return;
osd->DestroyPixmap(pixmap); osd->DestroyPixmap(pixmap);
} }
static std::string CutText(std::string text, int width, const cFont *font) { static std::string CutText(std::string text, int width, const cFont *font) {

254
setup.c
View File

@ -1,8 +1,8 @@
#include "setup.h" #include "setup.h"
cTvguideSetup::cTvguideSetup() { cTvguideSetup::cTvguideSetup() {
tmpTvguideConfig = tvguideConfig; tmpTvguideConfig = tvguideConfig;
Setup(); Setup();
} }
cTvguideSetup::~cTvguideSetup() { cTvguideSetup::~cTvguideSetup() {
@ -10,93 +10,93 @@ cTvguideSetup::~cTvguideSetup() {
void cTvguideSetup::Setup(void) { void cTvguideSetup::Setup(void) {
int currentItem = Current(); int currentItem = Current();
Clear(); Clear();
Add(new cOsdItem(tr("General Settings"))); Add(new cOsdItem(tr("General Settings")));
Add(new cOsdItem(tr("Screen Presentation"))); Add(new cOsdItem(tr("Screen Presentation")));
Add(new cOsdItem(tr("Fonts and Fontsizes"))); Add(new cOsdItem(tr("Fonts and Fontsizes")));
SetCurrent(Get(currentItem)); SetCurrent(Get(currentItem));
Display(); Display();
} }
eOSState cTvguideSetup::ProcessKey(eKeys Key) { eOSState cTvguideSetup::ProcessKey(eKeys Key) {
bool hadSubMenu = HasSubMenu(); bool hadSubMenu = HasSubMenu();
eOSState state = cMenuSetupPage::ProcessKey(Key); eOSState state = cMenuSetupPage::ProcessKey(Key);
if (hadSubMenu && Key == kOk) if (hadSubMenu && Key == kOk)
Store(); Store();
if (!hadSubMenu && (state == osUnknown || Key == kOk)) { if (!hadSubMenu && (state == osUnknown || Key == kOk)) {
if ((Key == kOk && !hadSubMenu)) { if ((Key == kOk && !hadSubMenu)) {
const char* ItemText = Get(Current())->Text(); const char* ItemText = Get(Current())->Text();
if (strcmp(ItemText, tr("General Settings")) == 0) if (strcmp(ItemText, tr("General Settings")) == 0)
state = AddSubMenu(new cMenuSetupGeneral(&tmpTvguideConfig)); state = AddSubMenu(new cMenuSetupGeneral(&tmpTvguideConfig));
if (strcmp(ItemText, tr("Screen Presentation")) == 0) if (strcmp(ItemText, tr("Screen Presentation")) == 0)
state = AddSubMenu(new cMenuSetupScreenLayout(&tmpTvguideConfig)); state = AddSubMenu(new cMenuSetupScreenLayout(&tmpTvguideConfig));
if (strcmp(ItemText, tr("Fonts and Fontsizes")) == 0) if (strcmp(ItemText, tr("Fonts and Fontsizes")) == 0)
state = AddSubMenu(new cMenuSetupFont(&tmpTvguideConfig)); state = AddSubMenu(new cMenuSetupFont(&tmpTvguideConfig));
} }
} }
return state; return state;
} }
void cTvguideSetup::Store(void) { void cTvguideSetup::Store(void) {
tvguideConfig = tmpTvguideConfig; tvguideConfig = tmpTvguideConfig;
SetupStore("themeIndex", tvguideConfig.themeIndex); SetupStore("themeIndex", tvguideConfig.themeIndex);
SetupStore("displayMode", tvguideConfig.displayMode); SetupStore("displayMode", tvguideConfig.displayMode);
SetupStore("displayStatusHeader", tvguideConfig.displayStatusHeader); SetupStore("displayStatusHeader", tvguideConfig.displayStatusHeader);
SetupStore("statusHeaderPercent", tvguideConfig.statusHeaderPercent); SetupStore("statusHeaderPercent", tvguideConfig.statusHeaderPercent);
SetupStore("scaleVideo", tvguideConfig.scaleVideo); SetupStore("scaleVideo", tvguideConfig.scaleVideo);
SetupStore("decorateVideo", tvguideConfig.decorateVideo); SetupStore("decorateVideo", tvguideConfig.decorateVideo);
SetupStore("useBlending", tvguideConfig.useBlending); 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);
SetupStore("channelRows", tvguideConfig.channelRows); SetupStore("channelRows", tvguideConfig.channelRows);
SetupStore("displayTime", tvguideConfig.displayTime); SetupStore("displayTime", tvguideConfig.displayTime);
SetupStore("bigStepHours", tvguideConfig.bigStepHours); SetupStore("bigStepHours", tvguideConfig.bigStepHours);
SetupStore("hugeStepHours", tvguideConfig.hugeStepHours); SetupStore("hugeStepHours", tvguideConfig.hugeStepHours);
SetupStore("jumpChannels", tvguideConfig.jumpChannels); SetupStore("jumpChannels", tvguideConfig.jumpChannels);
SetupStore("hideChannelLogos", tvguideConfig.hideChannelLogos); SetupStore("hideChannelLogos", tvguideConfig.hideChannelLogos);
SetupStore("logoExtension", tvguideConfig.logoExtension); SetupStore("logoExtension", tvguideConfig.logoExtension);
SetupStore("logoWidthRatio", tvguideConfig.logoWidthRatio); SetupStore("logoWidthRatio", tvguideConfig.logoWidthRatio);
SetupStore("logoHeightRatio", tvguideConfig.logoHeightRatio); SetupStore("logoHeightRatio", tvguideConfig.logoHeightRatio);
SetupStore("hideEpgImages", tvguideConfig.hideEpgImages); SetupStore("hideEpgImages", tvguideConfig.hideEpgImages);
SetupStore("epgImageWidth", tvguideConfig.epgImageWidth); SetupStore("epgImageWidth", tvguideConfig.epgImageWidth);
SetupStore("epgImageHeight", tvguideConfig.epgImageHeight); SetupStore("epgImageHeight", tvguideConfig.epgImageHeight);
SetupStore("epgImageHeight", tvguideConfig.epgImageHeight); SetupStore("epgImageHeight", tvguideConfig.epgImageHeight);
SetupStore("timeLineWidthPercent", tvguideConfig.timeLineWidthPercent); SetupStore("timeLineWidthPercent", tvguideConfig.timeLineWidthPercent);
SetupStore("timeLineHeightPercent", tvguideConfig.timeLineHeightPercent); SetupStore("timeLineHeightPercent", tvguideConfig.timeLineHeightPercent);
SetupStore("displayChannelName", tvguideConfig.displayChannelName); SetupStore("displayChannelName", tvguideConfig.displayChannelName);
SetupStore("channelHeaderWidthPercent", tvguideConfig.channelHeaderWidthPercent); SetupStore("channelHeaderWidthPercent", tvguideConfig.channelHeaderWidthPercent);
SetupStore("channelHeaderHeightPercent", tvguideConfig.channelHeaderHeightPercent); SetupStore("channelHeaderHeightPercent", tvguideConfig.channelHeaderHeightPercent);
SetupStore("footerHeight", tvguideConfig.footerHeight); SetupStore("footerHeight", tvguideConfig.footerHeight);
SetupStore("fontIndex", tvguideConfig.fontIndex); SetupStore("fontIndex", tvguideConfig.fontIndex);
SetupStore("FontButtonDelta", tvguideConfig.FontButtonDelta); SetupStore("FontButtonDelta", tvguideConfig.FontButtonDelta);
SetupStore("FontDetailViewDelta", tvguideConfig.FontDetailViewDelta); SetupStore("FontDetailViewDelta", tvguideConfig.FontDetailViewDelta);
SetupStore("FontDetailHeaderDelta", tvguideConfig.FontDetailHeaderDelta); SetupStore("FontDetailHeaderDelta", tvguideConfig.FontDetailHeaderDelta);
SetupStore("FontMessageBoxDelta", tvguideConfig.FontMessageBoxDelta); SetupStore("FontMessageBoxDelta", tvguideConfig.FontMessageBoxDelta);
SetupStore("FontMessageBoxLargeDelta", tvguideConfig.FontMessageBoxLargeDelta); SetupStore("FontMessageBoxLargeDelta", tvguideConfig.FontMessageBoxLargeDelta);
SetupStore("FontStatusHeaderDelta", tvguideConfig.FontStatusHeaderDelta); SetupStore("FontStatusHeaderDelta", tvguideConfig.FontStatusHeaderDelta);
SetupStore("FontStatusHeaderLargeDelta", tvguideConfig.FontStatusHeaderLargeDelta); SetupStore("FontStatusHeaderLargeDelta", tvguideConfig.FontStatusHeaderLargeDelta);
SetupStore("FontChannelHeaderDelta", tvguideConfig.FontChannelHeaderDelta); SetupStore("FontChannelHeaderDelta", tvguideConfig.FontChannelHeaderDelta);
SetupStore("FontGridDelta", tvguideConfig.FontGridDelta); SetupStore("FontGridDelta", tvguideConfig.FontGridDelta);
SetupStore("FontGridSmallDelta", tvguideConfig.FontGridSmallDelta); SetupStore("FontGridSmallDelta", tvguideConfig.FontGridSmallDelta);
SetupStore("FontTimeLineWeekdayDelta", tvguideConfig.FontTimeLineWeekdayDelta); SetupStore("FontTimeLineWeekdayDelta", tvguideConfig.FontTimeLineWeekdayDelta);
SetupStore("FontTimeLineDateDelta", tvguideConfig.FontTimeLineDateDelta); SetupStore("FontTimeLineDateDelta", tvguideConfig.FontTimeLineDateDelta);
SetupStore("FontTimeLineTimeDelta", tvguideConfig.FontTimeLineTimeDelta); SetupStore("FontTimeLineTimeDelta", tvguideConfig.FontTimeLineTimeDelta);
SetupStore("FontChannelHeaderHorizontalDelta", tvguideConfig.FontChannelHeaderHorizontalDelta); SetupStore("FontChannelHeaderHorizontalDelta", tvguideConfig.FontChannelHeaderHorizontalDelta);
SetupStore("FontGridHorizontalDelta", tvguideConfig.FontGridHorizontalDelta); SetupStore("FontGridHorizontalDelta", tvguideConfig.FontGridHorizontalDelta);
SetupStore("FontGridHorizontalSmallDelta", tvguideConfig.FontGridHorizontalSmallDelta); SetupStore("FontGridHorizontalSmallDelta", tvguideConfig.FontGridHorizontalSmallDelta);
SetupStore("FontTimeLineDateHorizontalDelta", tvguideConfig.FontTimeLineDateHorizontalDelta); SetupStore("FontTimeLineDateHorizontalDelta", tvguideConfig.FontTimeLineDateHorizontalDelta);
SetupStore("FontTimeLineTimeHorizontalDelta", tvguideConfig.FontTimeLineTimeHorizontalDelta); SetupStore("FontTimeLineTimeHorizontalDelta", tvguideConfig.FontTimeLineTimeHorizontalDelta);
} }
cMenuSetupSubMenu::cMenuSetupSubMenu(const char* Title, cTvguideConfig* data) : cOsdMenu(Title, 30) { cMenuSetupSubMenu::cMenuSetupSubMenu(const char* Title, cTvguideConfig* data) : cOsdMenu(Title, 30) {
tmpTvguideConfig = data; tmpTvguideConfig = data;
} }
cOsdItem *cMenuSetupSubMenu::InfoItem(const char *label, const char *value) { cOsdItem *cMenuSetupSubMenu::InfoItem(const char *label, const char *value) {
@ -122,49 +122,49 @@ eOSState cMenuSetupSubMenu::ProcessKey(eKeys Key) {
//------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------
cMenuSetupGeneral::cMenuSetupGeneral(cTvguideConfig* data) : cMenuSetupSubMenu(tr("General Settings"), data) { cMenuSetupGeneral::cMenuSetupGeneral(cTvguideConfig* data) : cMenuSetupSubMenu(tr("General Settings"), data) {
themes.Load(*cString("tvguide")); themes.Load(*cString("tvguide"));
timeFormatItems[0] = "12h"; timeFormatItems[0] = "12h";
timeFormatItems[1] = "24h"; timeFormatItems[1] = "24h";
blendingMethods[0] = "none"; blendingMethods[0] = "none";
blendingMethods[1] = "classic"; blendingMethods[1] = "classic";
blendingMethods[2] = "nOpacity style"; blendingMethods[2] = "nOpacity style";
Set(); Set();
} }
void cMenuSetupGeneral::Set(void) { void cMenuSetupGeneral::Set(void) {
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 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("Channels to Jump (Keys Green / Yellow)"), &tmpTvguideConfig->jumpChannels, 2, 30)); Add(new cMenuEditIntItem(tr("Channels to Jump (Keys Green / Yellow)"), &tmpTvguideConfig->jumpChannels, 2, 30));
Add(new cMenuEditIntItem(tr("Time to display in minutes"), &tmpTvguideConfig->displayTime, 120, 320)); Add(new cMenuEditIntItem(tr("Time to display in minutes"), &tmpTvguideConfig->displayTime, 120, 320));
Add(new cMenuEditIntItem(tr("Big Step (Keys 1 / 3) in hours"), &tmpTvguideConfig->bigStepHours, 1, 12)); Add(new cMenuEditIntItem(tr("Big Step (Keys 1 / 3) in hours"), &tmpTvguideConfig->bigStepHours, 1, 12));
Add(new cMenuEditIntItem(tr("Huge Step (Keys 4 / 6) in hours"), &tmpTvguideConfig->hugeStepHours, 13, 48)); Add(new cMenuEditIntItem(tr("Huge Step (Keys 4 / 6) in hours"), &tmpTvguideConfig->hugeStepHours, 13, 48));
Add(new cMenuEditStraItem(tr("Time Format (12h/24h)"), &tmpTvguideConfig->timeFormat, 2, timeFormatItems)); Add(new cMenuEditStraItem(tr("Time Format (12h/24h)"), &tmpTvguideConfig->timeFormat, 2, timeFormatItems));
SetCurrent(Get(currentItem)); SetCurrent(Get(currentItem));
Display(); Display();
} }
//------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------
cMenuSetupScreenLayout::cMenuSetupScreenLayout(cTvguideConfig* data) : cMenuSetupSubMenu(tr("Screen Presentation"), data) { cMenuSetupScreenLayout::cMenuSetupScreenLayout(cTvguideConfig* data) : cMenuSetupSubMenu(tr("Screen Presentation"), data) {
displayModeItems[0] = "vertical"; displayModeItems[0] = "vertical";
displayModeItems[1] = "horizontal"; displayModeItems[1] = "horizontal";
hideChannelLogosItems[0] = trVDR("yes"); hideChannelLogosItems[0] = trVDR("yes");
hideChannelLogosItems[1] = trVDR("no"); hideChannelLogosItems[1] = trVDR("no");
logoExtensionItems[0] = "png"; logoExtensionItems[0] = "png";
logoExtensionItems[1] = "jpg"; logoExtensionItems[1] = "jpg";
Set(); Set();
} }
void cMenuSetupScreenLayout::Set(void) { void cMenuSetupScreenLayout::Set(void) {
const char *indent = " "; const char *indent = " ";
int currentItem = Current(); int currentItem = Current();
Clear(); Clear();
Add(new cMenuEditStraItem(tr("Display Mode"), &tmpTvguideConfig->displayMode, 2, displayModeItems)); Add(new cMenuEditStraItem(tr("Display Mode"), &tmpTvguideConfig->displayMode, 2, displayModeItems));
if (tmpTvguideConfig->displayMode == eVertical) { if (tmpTvguideConfig->displayMode == eVertical) {
@ -176,7 +176,7 @@ void cMenuSetupScreenLayout::Set(void) {
Add(new cMenuEditIntItem(*cString::sprintf("%s%s", indent, tr("Height of Timeline (Perc. of osd height)")), &tmpTvguideConfig->timeLineHeightPercent, 5, 30)); Add(new cMenuEditIntItem(*cString::sprintf("%s%s", indent, tr("Height of Timeline (Perc. of osd height)")), &tmpTvguideConfig->timeLineHeightPercent, 5, 30));
Add(new cMenuEditIntItem(*cString::sprintf("%s%s", indent, tr("Number of Channels to display")), &tmpTvguideConfig->channelRows, 3, 12)); Add(new cMenuEditIntItem(*cString::sprintf("%s%s", indent, tr("Number of Channels to display")), &tmpTvguideConfig->channelRows, 3, 12));
} }
Add(new cMenuEditIntItem(tr("Height of Footer"), &tmpTvguideConfig->footerHeight, 50, 300)); Add(new cMenuEditIntItem(tr("Height of Footer"), &tmpTvguideConfig->footerHeight, 50, 300));
Add(new cMenuEditBoolItem(tr("Display status header"), &tmpTvguideConfig->displayStatusHeader)); Add(new cMenuEditBoolItem(tr("Display status header"), &tmpTvguideConfig->displayStatusHeader));
if (tmpTvguideConfig->displayStatusHeader) { if (tmpTvguideConfig->displayStatusHeader) {
@ -185,57 +185,57 @@ void cMenuSetupScreenLayout::Set(void) {
Add(new cMenuEditBoolItem(*cString::sprintf("%s%s", indent, tr("Rounded corners around video frame")), &tmpTvguideConfig->decorateVideo)); Add(new cMenuEditBoolItem(*cString::sprintf("%s%s", indent, tr("Rounded corners around video frame")), &tmpTvguideConfig->decorateVideo));
} }
Add(new cMenuEditBoolItem(tr("Display Channel Names in Header"), &tmpTvguideConfig->displayChannelName)); Add(new cMenuEditBoolItem(tr("Display Channel Names in Header"), &tmpTvguideConfig->displayChannelName));
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));
Add(new cMenuEditStraItem(*cString::sprintf("%s%s", indent, tr("Logo Extension")), &tmpTvguideConfig->logoExtension, 2, logoExtensionItems)); Add(new cMenuEditStraItem(*cString::sprintf("%s%s", indent, tr("Logo Extension")), &tmpTvguideConfig->logoExtension, 2, logoExtensionItems));
Add(new cMenuEditIntItem(*cString::sprintf("%s%s", indent, tr("Logo width ratio")), &tmpTvguideConfig->logoWidthRatio, 1, 1000)); Add(new cMenuEditIntItem(*cString::sprintf("%s%s", indent, tr("Logo width ratio")), &tmpTvguideConfig->logoWidthRatio, 1, 1000));
Add(new cMenuEditIntItem(*cString::sprintf("%s%s", indent, tr("Logo height ratio")), &tmpTvguideConfig->logoHeightRatio, 1, 1000)); Add(new cMenuEditIntItem(*cString::sprintf("%s%s", indent, tr("Logo height ratio")), &tmpTvguideConfig->logoHeightRatio, 1, 1000));
} }
Add(new cMenuEditStraItem(tr("Show EPG Images"), &tmpTvguideConfig->hideEpgImages, 2, hideChannelLogosItems)); Add(new cMenuEditStraItem(tr("Show EPG Images"), &tmpTvguideConfig->hideEpgImages, 2, hideChannelLogosItems));
if (!tmpTvguideConfig->hideEpgImages) { if (!tmpTvguideConfig->hideEpgImages) {
Add(InfoItem(tr("EPG Images Path used"), *tvguideConfig.epgImagePath)); Add(InfoItem(tr("EPG Images Path used"), *tvguideConfig.epgImagePath));
Add(new cMenuEditIntItem(*cString::sprintf("%s%s", indent, tr("EPG Image width")), &tmpTvguideConfig->epgImageWidth, 0, 800)); Add(new cMenuEditIntItem(*cString::sprintf("%s%s", indent, tr("EPG Image width")), &tmpTvguideConfig->epgImageWidth, 0, 800));
Add(new cMenuEditIntItem(*cString::sprintf("%s%s", indent, tr("EPG Image height")), &tmpTvguideConfig->epgImageHeight, 0, 800)); Add(new cMenuEditIntItem(*cString::sprintf("%s%s", indent, tr("EPG Image height")), &tmpTvguideConfig->epgImageHeight, 0, 800));
} }
SetCurrent(Get(currentItem)); SetCurrent(Get(currentItem));
Display(); Display();
} }
eOSState cMenuSetupScreenLayout::ProcessKey(eKeys Key) { eOSState cMenuSetupScreenLayout::ProcessKey(eKeys Key) {
eOSState state = cOsdMenu::ProcessKey(Key); eOSState state = cOsdMenu::ProcessKey(Key);
if (Key == kOk) { if (Key == kOk) {
state = osBack; state = osBack;
} else if (Key != kNone) { } else if (Key != kNone) {
Set(); Set();
} }
return state; return state;
} }
//------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------
cMenuSetupFont::cMenuSetupFont(cTvguideConfig* data) : cMenuSetupSubMenu(tr("Fonts and Fontsizes"), data) { cMenuSetupFont::cMenuSetupFont(cTvguideConfig* data) : cMenuSetupSubMenu(tr("Fonts and Fontsizes"), data) {
cFont::GetAvailableFontNames(&fontNames); cFont::GetAvailableFontNames(&fontNames);
fontNames.Insert(strdup(tvguideConfig.fontNameDefault)); fontNames.Insert(strdup(tvguideConfig.fontNameDefault));
Set(); Set();
} }
void cMenuSetupFont::Set(void) { void cMenuSetupFont::Set(void) {
int currentItem = Current(); int currentItem = Current();
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 Font Size"), &tmpTvguideConfig->FontStatusHeaderDelta, -30, 30)); Add(new cMenuEditIntItem(tr("Status Header Font Size"), &tmpTvguideConfig->FontStatusHeaderDelta, -30, 30));
Add(new cMenuEditIntItem(tr("Status Header Large Font Size"), &tmpTvguideConfig->FontStatusHeaderLargeDelta, -30, 30)); Add(new cMenuEditIntItem(tr("Status Header Large Font Size"), &tmpTvguideConfig->FontStatusHeaderLargeDelta, -30, 30));
Add(new cMenuEditIntItem(tr("Detail EPG View Font Size"), &tmpTvguideConfig->FontDetailViewDelta, -30, 30)); Add(new cMenuEditIntItem(tr("Detail EPG View Font Size"), &tmpTvguideConfig->FontDetailViewDelta, -30, 30));
Add(new cMenuEditIntItem(tr("Detail EPG View Header Font Size"), &tmpTvguideConfig->FontDetailHeaderDelta, -30, 30)); Add(new cMenuEditIntItem(tr("Detail EPG View Header Font Size"), &tmpTvguideConfig->FontDetailHeaderDelta, -30, 30));
Add(new cMenuEditIntItem(tr("Message Font Size"), &tmpTvguideConfig->FontMessageBoxDelta, -30, 30)); Add(new cMenuEditIntItem(tr("Message Font Size"), &tmpTvguideConfig->FontMessageBoxDelta, -30, 30));
Add(new cMenuEditIntItem(tr("Message Large Font Size"), &tmpTvguideConfig->FontMessageBoxLargeDelta, -30, 30)); Add(new cMenuEditIntItem(tr("Message Large Font Size"), &tmpTvguideConfig->FontMessageBoxLargeDelta, -30, 30));
Add(new cMenuEditIntItem(tr("Button Font Size"), &tmpTvguideConfig->FontButtonDelta, -30, 30)); Add(new cMenuEditIntItem(tr("Button Font Size"), &tmpTvguideConfig->FontButtonDelta, -30, 30));
if (tmpTvguideConfig->displayMode == eVertical) { if (tmpTvguideConfig->displayMode == eVertical) {
@ -254,6 +254,6 @@ void cMenuSetupFont::Set(void) {
} }
SetCurrent(Get(currentItem)); SetCurrent(Get(currentItem));
Display(); Display();
} }

66
setup.h
View File

@ -2,55 +2,55 @@
#define __TVGUIDE_SETUP_H #define __TVGUIDE_SETUP_H
class cTvguideSetup : public cMenuSetupPage { class cTvguideSetup : public cMenuSetupPage {
public: public:
cTvguideSetup(void); cTvguideSetup(void);
virtual ~cTvguideSetup(); virtual ~cTvguideSetup();
private: private:
cTvguideConfig tmpTvguideConfig; cTvguideConfig tmpTvguideConfig;
void Setup(void); void Setup(void);
protected: protected:
virtual eOSState ProcessKey(eKeys Key); virtual eOSState ProcessKey(eKeys Key);
virtual void Store(void); virtual void Store(void);
}; };
class cMenuSetupSubMenu : public cOsdMenu { class cMenuSetupSubMenu : public cOsdMenu {
protected: protected:
cTvguideConfig *tmpTvguideConfig; cTvguideConfig *tmpTvguideConfig;
virtual eOSState ProcessKey(eKeys Key); virtual eOSState ProcessKey(eKeys Key);
virtual void Set(void) = 0; virtual void Set(void) = 0;
cOsdItem *InfoItem(const char *label, const char *value); cOsdItem *InfoItem(const char *label, const char *value);
public: public:
cMenuSetupSubMenu(const char *Title, cTvguideConfig *data); cMenuSetupSubMenu(const char *Title, cTvguideConfig *data);
}; };
class cMenuSetupGeneral : public cMenuSetupSubMenu { class cMenuSetupGeneral : public cMenuSetupSubMenu {
protected: protected:
cThemes themes; cThemes themes;
const char * blendingMethods[3]; const char * blendingMethods[3];
const char * timeFormatItems[2]; const char * timeFormatItems[2];
void Set(void); void Set(void);
public: public:
cMenuSetupGeneral(cTvguideConfig *data); cMenuSetupGeneral(cTvguideConfig *data);
}; };
class cMenuSetupScreenLayout : public cMenuSetupSubMenu { class cMenuSetupScreenLayout : public cMenuSetupSubMenu {
protected: protected:
virtual eOSState ProcessKey(eKeys Key); virtual eOSState ProcessKey(eKeys Key);
const char * displayModeItems[2]; const char * displayModeItems[2];
const char * hideChannelLogosItems[2]; const char * hideChannelLogosItems[2];
const char * logoExtensionItems[2]; const char * logoExtensionItems[2];
void Set(void); void Set(void);
public: public:
cMenuSetupScreenLayout(cTvguideConfig *data); cMenuSetupScreenLayout(cTvguideConfig *data);
}; };
class cMenuSetupFont : public cMenuSetupSubMenu { class cMenuSetupFont : public cMenuSetupSubMenu {
protected: protected:
cStringList fontNames; cStringList fontNames;
void Set(void); void Set(void);
public: public:
cMenuSetupFont(cTvguideConfig *data); cMenuSetupFont(cTvguideConfig *data);
}; };
#endif //__TVGUIDE_SETUP_H #endif //__TVGUIDE_SETUP_H

View File

@ -8,8 +8,8 @@ private:
cPixmap *pixmapText; cPixmap *pixmapText;
cPixmap *pixmapTVFrame; cPixmap *pixmapTVFrame;
public: public:
cStatusHeader(void); cStatusHeader(void);
virtual ~cStatusHeader(void); virtual ~cStatusHeader(void);
void ScaleVideo(void); void ScaleVideo(void);
void DrawInfoText(cGrid *grid); void DrawInfoText(cGrid *grid);
}; };

View File

@ -1,60 +1,60 @@
#include "styledpixmap.h" #include "styledpixmap.h"
cStyledPixmap::cStyledPixmap(void) { cStyledPixmap::cStyledPixmap(void) {
pixmap = NULL; pixmap = NULL;
} }
cStyledPixmap::cStyledPixmap(cPixmap *pixmap) { cStyledPixmap::cStyledPixmap(cPixmap *pixmap) {
this->pixmap = pixmap; this->pixmap = pixmap;
} }
cStyledPixmap::~cStyledPixmap(void) { cStyledPixmap::~cStyledPixmap(void) {
if (pixmap) if (pixmap)
osdManager.releasePixmap(pixmap); osdManager.releasePixmap(pixmap);
} }
void cStyledPixmap::setPixmap(cPixmap *pixmap) { void cStyledPixmap::setPixmap(cPixmap *pixmap) {
if (pixmap) { if (pixmap) {
this->pixmap = pixmap; this->pixmap = pixmap;
} }
} }
void cStyledPixmap::drawBackground() { void cStyledPixmap::drawBackground() {
if (tvguideConfig.useBlending == 1){ if (tvguideConfig.useBlending == 1){
drawBlendedBackground(); drawBlendedBackground();
} else if (tvguideConfig.useBlending == 2){ } else if (tvguideConfig.useBlending == 2){
drawSparsedBackground(); drawSparsedBackground();
} else { } else {
pixmap->Fill(color); pixmap->Fill(color);
} }
} }
void cStyledPixmap::drawBlendedBackground() { void cStyledPixmap::drawBlendedBackground() {
int width = pixmap->ViewPort().Width(); int width = pixmap->ViewPort().Width();
int height = pixmap->ViewPort().Height(); int height = pixmap->ViewPort().Height();
pixmap->Fill(color); pixmap->Fill(color);
int numSteps = 64; int numSteps = 64;
int alphaStep = 0x04; int alphaStep = 0x04;
if (height < 30) if (height < 30)
return; return;
else if (height < 100) { else if (height < 100) {
numSteps = 32; numSteps = 32;
alphaStep = 0x08; alphaStep = 0x08;
} }
int stepY = 0.5*height / numSteps; int stepY = 0.5*height / numSteps;
if (stepY == 0) stepY = 1; if (stepY == 0) stepY = 1;
int alpha = 0x00; int alpha = 0x00;
tColor clr; tColor clr;
for (int i = 0; i<numSteps; i++) { for (int i = 0; i<numSteps; i++) {
clr = AlphaBlend(color, colorBlending, alpha); clr = AlphaBlend(color, colorBlending, alpha);
pixmap->DrawRectangle(cRect(0,i*stepY,width,stepY), clr); pixmap->DrawRectangle(cRect(0,i*stepY,width,stepY), clr);
alpha += alphaStep; alpha += alphaStep;
} }
} }
void cStyledPixmap::drawSparsedBackground() { void cStyledPixmap::drawSparsedBackground() {
int width = pixmap->ViewPort().Width(); int width = pixmap->ViewPort().Width();
int height = pixmap->ViewPort().Height(); int height = pixmap->ViewPort().Height();
cImageLoader imgLoader; cImageLoader imgLoader;
if (imgLoader.DrawBackground(colorBlending, color, width, height)) if (imgLoader.DrawBackground(colorBlending, color, width, height))
pixmap->DrawImage(cPoint(0,0), imgLoader.GetImage()); pixmap->DrawImage(cPoint(0,0), imgLoader.GetImage());
@ -62,73 +62,73 @@ void cStyledPixmap::drawSparsedBackground() {
} }
void cStyledPixmap::drawBorder() { void cStyledPixmap::drawBorder() {
int width = pixmap->ViewPort().Width(); int width = pixmap->ViewPort().Width();
int height = pixmap->ViewPort().Height(); int height = pixmap->ViewPort().Height();
drawDefaultBorder(width, height); drawDefaultBorder(width, height);
if (tvguideConfig.roundedCorners) { if (tvguideConfig.roundedCorners) {
int borderRadius = 12; int borderRadius = 12;
drawRoundedCorners(width, height, borderRadius); drawRoundedCorners(width, height, borderRadius);
} }
} }
void cStyledPixmap::drawDefaultBorder(int width, int height) { void cStyledPixmap::drawDefaultBorder(int width, int height) {
pixmap->DrawRectangle(cRect(0,0,width,2), theme.Color(clrBackground)); //top pixmap->DrawRectangle(cRect(0,0,width,2), theme.Color(clrBackground)); //top
pixmap->DrawRectangle(cRect(0,0,2,height), theme.Color(clrBackground)); //left pixmap->DrawRectangle(cRect(0,0,2,height), theme.Color(clrBackground)); //left
pixmap->DrawRectangle(cRect(0,height-2,width,2), theme.Color(clrBackground)); //bottom pixmap->DrawRectangle(cRect(0,height-2,width,2), theme.Color(clrBackground)); //bottom
pixmap->DrawRectangle(cRect(width-2,0,2,height), theme.Color(clrBackground)); //right pixmap->DrawRectangle(cRect(width-2,0,2,height), theme.Color(clrBackground)); //right
pixmap->DrawRectangle(cRect(2,2,width-4,1), theme.Color(clrBorder)); //top pixmap->DrawRectangle(cRect(2,2,width-4,1), theme.Color(clrBorder)); //top
pixmap->DrawRectangle(cRect(2,2,1,height-4), theme.Color(clrBorder)); //left pixmap->DrawRectangle(cRect(2,2,1,height-4), theme.Color(clrBorder)); //left
pixmap->DrawRectangle(cRect(2,height-3,width-4,1), theme.Color(clrBorder)); //bottom pixmap->DrawRectangle(cRect(2,height-3,width-4,1), theme.Color(clrBorder)); //bottom
pixmap->DrawRectangle(cRect(width-3,2,1,height-4), theme.Color(clrBorder)); //right pixmap->DrawRectangle(cRect(width-3,2,1,height-4), theme.Color(clrBorder)); //right
} }
void cStyledPixmap::drawBoldBorder() { void cStyledPixmap::drawBoldBorder() {
int width = pixmap->ViewPort().Width(); int width = pixmap->ViewPort().Width();
int height = pixmap->ViewPort().Height(); int height = pixmap->ViewPort().Height();
pixmap->DrawRectangle(cRect(0,0,width,2), theme.Color(clrBorder)); //top pixmap->DrawRectangle(cRect(0,0,width,2), theme.Color(clrBorder)); //top
pixmap->DrawRectangle(cRect(0,0,2,height), theme.Color(clrBorder)); //left pixmap->DrawRectangle(cRect(0,0,2,height), theme.Color(clrBorder)); //left
pixmap->DrawRectangle(cRect(0,height-2,width,2), theme.Color(clrBorder)); //bottom pixmap->DrawRectangle(cRect(0,height-2,width,2), theme.Color(clrBorder)); //bottom
pixmap->DrawRectangle(cRect(width-2,0,2,height), theme.Color(clrBorder)); //right pixmap->DrawRectangle(cRect(width-2,0,2,height), theme.Color(clrBorder)); //right
} }
void cStyledPixmap::drawRoundedCorners(int width, int height, int radius) { void cStyledPixmap::drawRoundedCorners(int width, int height, int radius) {
pixmap->DrawEllipse(cRect(2,2,radius,radius), theme.Color(clrBorder), -2); pixmap->DrawEllipse(cRect(2,2,radius,radius), theme.Color(clrBorder), -2);
pixmap->DrawEllipse(cRect(1,1,radius,radius), theme.Color(clrBackground), -2); pixmap->DrawEllipse(cRect(1,1,radius,radius), theme.Color(clrBackground), -2);
pixmap->DrawEllipse(cRect(width-radius - 2,2,radius,radius), theme.Color(clrBorder), -1); pixmap->DrawEllipse(cRect(width-radius - 2,2,radius,radius), theme.Color(clrBorder), -1);
pixmap->DrawEllipse(cRect(width-radius - 1,1,radius,radius), theme.Color(clrBackground), -1); pixmap->DrawEllipse(cRect(width-radius - 1,1,radius,radius), theme.Color(clrBackground), -1);
if( height > 2*radius) { if( height > 2*radius) {
pixmap->DrawEllipse(cRect(2,height-radius - 2,radius,radius), theme.Color(clrBorder), -3); pixmap->DrawEllipse(cRect(2,height-radius - 2,radius,radius), theme.Color(clrBorder), -3);
pixmap->DrawEllipse(cRect(1,height-radius - 1,radius,radius), theme.Color(clrBackground), -3); pixmap->DrawEllipse(cRect(1,height-radius - 1,radius,radius), theme.Color(clrBackground), -3);
pixmap->DrawEllipse(cRect(width-radius - 2,height-radius - 2,radius,radius), theme.Color(clrBorder), -4); pixmap->DrawEllipse(cRect(width-radius - 2,height-radius - 2,radius,radius), theme.Color(clrBorder), -4);
pixmap->DrawEllipse(cRect(width-radius - 1,height-radius - 1,radius,radius), theme.Color(clrBackground), -4); pixmap->DrawEllipse(cRect(width-radius - 1,height-radius - 1,radius,radius), theme.Color(clrBackground), -4);
} }
} }
void cStyledPixmap::drawVerticalLine(int x, int yStart, int yStop, tColor col) { void cStyledPixmap::drawVerticalLine(int x, int yStart, int yStop, tColor col) {
for (int y = yStart; y <= yStop; y++) { for (int y = yStart; y <= yStop; y++) {
pixmap->DrawPixel(cPoint(x,y), col); pixmap->DrawPixel(cPoint(x,y), col);
} }
} }
void cStyledPixmap::drawHorizontalLine(int y, int xStart, int xStop, tColor col) { void cStyledPixmap::drawHorizontalLine(int y, int xStart, int xStop, tColor col) {
for (int x = xStart; x <= xStop; x++) { for (int x = xStart; x <= xStop; x++) {
pixmap->DrawPixel(cPoint(x,y), col); pixmap->DrawPixel(cPoint(x,y), col);
} }
} }
void cStyledPixmap::DrawText(const cPoint &Point, const char *s, tColor ColorFg, tColor ColorBg, const cFont *Font) { void cStyledPixmap::DrawText(const cPoint &Point, const char *s, tColor ColorFg, tColor ColorBg, const cFont *Font) {
pixmap->DrawText(Point, s, ColorFg, ColorBg, Font); pixmap->DrawText(Point, s, ColorFg, ColorBg, Font);
} }
void cStyledPixmap::DrawImage(const cPoint &Point, const cImage &Image) { void cStyledPixmap::DrawImage(const cPoint &Point, const cImage &Image) {
pixmap->DrawImage(Point, Image); pixmap->DrawImage(Point, Image);
} }
void cStyledPixmap::DrawRectangle(const cRect &Rect, tColor Color) { void cStyledPixmap::DrawRectangle(const cRect &Rect, tColor Color) {
pixmap->DrawRectangle(Rect,Color); pixmap->DrawRectangle(Rect,Color);
} }

View File

@ -5,13 +5,13 @@
class cStyledPixmap { class cStyledPixmap {
private: private:
void drawVerticalLine(int x, int yStart, int yStop, tColor col); void drawVerticalLine(int x, int yStart, int yStop, tColor col);
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;
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); cStyledPixmap(cPixmap *pixmap);

View File

@ -1,7 +1,7 @@
#include "timeline.h" #include "timeline.h"
cTimeLine::cTimeLine(cMyTime *myTime) { cTimeLine::cTimeLine(cMyTime *myTime) {
this->myTime = myTime; this->myTime = myTime;
if (tvguideConfig.displayMode == eVertical) { if (tvguideConfig.displayMode == eVertical) {
dateViewer = new cStyledPixmap(osdManager.requestPixmap(3, cRect(0, dateViewer = new cStyledPixmap(osdManager.requestPixmap(3, cRect(0,
tvguideConfig.statusHeaderHeight, tvguideConfig.statusHeaderHeight,
@ -36,18 +36,18 @@ cTimeLine::cTimeLine(cMyTime *myTime) {
} }
cTimeLine::~cTimeLine(void) { cTimeLine::~cTimeLine(void) {
delete dateViewer; delete dateViewer;
osdManager.releasePixmap(timeline); osdManager.releasePixmap(timeline);
if (clock) if (clock)
delete clock; delete clock;
} }
void cTimeLine::drawDateViewer() { void cTimeLine::drawDateViewer() {
cString weekDay = myTime->GetWeekday(); cString weekDay = myTime->GetWeekday();
cString date = myTime->GetDate(); cString date = myTime->GetDate();
dateViewer->setColor(theme.Color(clrHeader), theme.Color(clrHeaderBlending)); dateViewer->setColor(theme.Color(clrHeader), theme.Color(clrHeaderBlending));
dateViewer->drawBackground(); dateViewer->drawBackground();
dateViewer->drawBorder(); dateViewer->drawBorder();
if (tvguideConfig.displayMode == eVertical) { if (tvguideConfig.displayMode == eVertical) {
int textHeight = tvguideConfig.FontTimeLineWeekday->Height(); int textHeight = tvguideConfig.FontTimeLineWeekday->Height();
@ -64,8 +64,8 @@ void cTimeLine::drawDateViewer() {
} }
void cTimeLine::drawTimeline() { void cTimeLine::drawTimeline() {
timeline->SetTile(true); timeline->SetTile(true);
timeline->Fill(theme.Color(clrBackground)); timeline->Fill(theme.Color(clrBackground));
tColor colorFont; tColor colorFont;
int imgWidth, imgHeight; int imgWidth, imgHeight;
@ -77,40 +77,40 @@ void cTimeLine::drawTimeline() {
imgHeight = tvguideConfig.timeLineHeight-4; imgHeight = tvguideConfig.timeLineHeight-4;
} }
const cImage *img1 = createBackgroundImage(imgWidth, imgHeight, theme.Color(clrTimeline1), theme.Color(clrTimeline1Blending)); const cImage *img1 = createBackgroundImage(imgWidth, imgHeight, theme.Color(clrTimeline1), theme.Color(clrTimeline1Blending));
const cImage *img2 = createBackgroundImage(imgWidth, imgHeight, theme.Color(clrTimeline2), theme.Color(clrTimeline2Blending)); const cImage *img2 = createBackgroundImage(imgWidth, imgHeight, theme.Color(clrTimeline2), theme.Color(clrTimeline2Blending));
const cImage *img = NULL; const cImage *img = NULL;
int textWidth, posX, posY; int textWidth, posX, posY;
char timetext[10]; char timetext[10];
for (int i=0; i<48; i++) { for (int i=0; i<48; i++) {
if (i%2==0) { if (i%2==0) {
img = img1; img = img1;
colorFont = theme.Color(clrTimeline2); colorFont = theme.Color(clrTimeline2);
if (tvguideConfig.timeFormat == e12Hours) { if (tvguideConfig.timeFormat == e12Hours) {
if (i == 0) if (i == 0)
sprintf(timetext, "12:00 PM"); sprintf(timetext, "12:00 PM");
else if (i/2 < 13) else if (i/2 < 13)
sprintf(timetext, "%d:00 AM", i/2); sprintf(timetext, "%d:00 AM", i/2);
else else
sprintf(timetext, "%d:00 PM", i/2-12); sprintf(timetext, "%d:00 PM", i/2-12);
} else { } else {
sprintf(timetext, "%d:00", i/2); sprintf(timetext, "%d:00", i/2);
} }
} else { } else {
img = img2; img = img2;
colorFont = theme.Color(clrTimeline1); colorFont = theme.Color(clrTimeline1);
if (tvguideConfig.timeFormat == e12Hours) { if (tvguideConfig.timeFormat == e12Hours) {
if (i == 1) if (i == 1)
sprintf(timetext, "12:30 PM"); sprintf(timetext, "12:30 PM");
else if (i/2 < 13) else if (i/2 < 13)
sprintf(timetext, "%d:30 AM", i/2); sprintf(timetext, "%d:30 AM", i/2);
else else
sprintf(timetext, "%d:30 PM", i/2-12); sprintf(timetext, "%d:30 PM", i/2-12);
} else { } else {
sprintf(timetext, "%d:30", i/2); sprintf(timetext, "%d:30", i/2);
} }
} }
if (tvguideConfig.displayMode == eVertical) { if (tvguideConfig.displayMode == eVertical) {
posY = i*tvguideConfig.minutePixel*30; posY = i*tvguideConfig.minutePixel*30;
timeline->DrawImage(cPoint(2, posY), *img); timeline->DrawImage(cPoint(2, posY), *img);
@ -121,30 +121,30 @@ void cTimeLine::drawTimeline() {
timeline->DrawImage(cPoint(posX, 2), *img); timeline->DrawImage(cPoint(posX, 2), *img);
timeline->DrawText(cPoint(posX + 2, (dateViewer->Height() - tvguideConfig.FontTimeLineTimeHorizontal->Height())/2), timetext, colorFont, clrTransparent, tvguideConfig.FontTimeLineTimeHorizontal); timeline->DrawText(cPoint(posX + 2, (dateViewer->Height() - tvguideConfig.FontTimeLineTimeHorizontal->Height())/2), timetext, colorFont, clrTransparent, tvguideConfig.FontTimeLineTimeHorizontal);
} }
} }
setTimeline(); setTimeline();
delete img1; delete img1;
delete img2; delete img2;
} }
cImage *cTimeLine::createBackgroundImage(int width, int height, tColor clrBgr, tColor clrBlend) { cImage *cTimeLine::createBackgroundImage(int width, int height, tColor clrBgr, tColor clrBlend) {
cImage *image = NULL; cImage *image = NULL;
if (tvguideConfig.useBlending == 1) { if (tvguideConfig.useBlending == 1) {
image = new cImage(cSize(width, height)); image = new cImage(cSize(width, height));
image->Fill(clrBgr); image->Fill(clrBgr);
int stepY = 0.5*height / 64; int stepY = 0.5*height / 64;
int alpha = 0x00; int alpha = 0x00;
tColor clr; tColor clr;
for (int i = 0; i<64; i++) { for (int i = 0; i<64; i++) {
clr = AlphaBlend(clrBgr, clrBlend, alpha); clr = AlphaBlend(clrBgr, clrBlend, alpha);
for (int y = i*stepY; y < (i+1)*stepY; y++) { for (int y = i*stepY; y < (i+1)*stepY; y++) {
for (int x=0; x<width; x++) { for (int x=0; x<width; x++) {
image->SetPixel(cPoint(x,y), clr); image->SetPixel(cPoint(x,y), clr);
} }
} }
alpha += 0x04; alpha += 0x04;
} }
} else if (tvguideConfig.useBlending == 2) { } else if (tvguideConfig.useBlending == 2) {
cImageLoader imgLoader; cImageLoader imgLoader;
if (imgLoader.DrawBackground(clrBgr, clrBlend, width, height)) { if (imgLoader.DrawBackground(clrBgr, clrBlend, width, height)) {
image = new cImage(imgLoader.GetImage()); image = new cImage(imgLoader.GetImage());
@ -153,11 +153,11 @@ cImage *cTimeLine::createBackgroundImage(int width, int height, tColor clrBgr, t
image = new cImage(cSize(width, height)); image = new cImage(cSize(width, height));
image->Fill(clrBgr); image->Fill(clrBgr);
} }
return image; return image;
} }
void cTimeLine::setTimeline() { void cTimeLine::setTimeline() {
int offset = myTime->GetTimelineOffset(); int offset = myTime->GetTimelineOffset();
int xNew, yNew; int xNew, yNew;
if (tvguideConfig.displayMode == eVertical) { if (tvguideConfig.displayMode == eVertical) {
xNew = 0; xNew = 0;
@ -170,11 +170,11 @@ void cTimeLine::setTimeline() {
} }
void cTimeLine::drawClock() { void cTimeLine::drawClock() {
cString currentTime = myTime->GetCurrentTime(); cString currentTime = myTime->GetCurrentTime();
int textHeight = tvguideConfig.FontTimeLineTime->Height(); int textHeight = tvguideConfig.FontTimeLineTime->Height();
int clockWidth = tvguideConfig.FontTimeLineTime->Width(*currentTime); int clockWidth = tvguideConfig.FontTimeLineTime->Width(*currentTime);
clock->setColor(theme.Color(clrHeader), theme.Color(clrHeaderBlending)); clock->setColor(theme.Color(clrHeader), theme.Color(clrHeaderBlending));
clock->drawBackground(); clock->drawBackground();
clock->drawBorder(); clock->drawBorder();
clock->DrawText(cPoint((tvguideConfig.timeLineWidth-clockWidth)/2, (tvguideConfig.footerHeight-textHeight)/2), *currentTime, theme.Color(clrFontHeader), clrTransparent, tvguideConfig.FontTimeLineTime); clock->DrawText(cPoint((tvguideConfig.timeLineWidth-clockWidth)/2, (tvguideConfig.footerHeight-textHeight)/2), *currentTime, theme.Color(clrFontHeader), clrTransparent, tvguideConfig.FontTimeLineTime);
} }

View File

@ -5,18 +5,18 @@
class cTimeLine { class cTimeLine {
private: private:
cMyTime *myTime; cMyTime *myTime;
cStyledPixmap *dateViewer; cStyledPixmap *dateViewer;
cPixmap *timeline; cPixmap *timeline;
cStyledPixmap *clock; cStyledPixmap *clock;
cImage *createBackgroundImage(int width, int height, tColor clrBgr, tColor clrBlend); cImage *createBackgroundImage(int width, int height, tColor clrBgr, tColor clrBlend);
public: public:
cTimeLine(cMyTime *myTime); cTimeLine(cMyTime *myTime);
virtual ~cTimeLine(void); virtual ~cTimeLine(void);
void drawDateViewer(); void drawDateViewer();
void drawTimeline(); void drawTimeline();
void setTimeline(); void setTimeline();
void drawClock(); void drawClock();
}; };
#endif //__TVGUIDE_TIMELINE_H #endif //__TVGUIDE_TIMELINE_H

120
timer.c
View File

@ -12,9 +12,9 @@ cString cMyTime::printTime(time_t displayTime) {
void cMyTime::Now() { void cMyTime::Now() {
t = time(0); t = time(0);
tStart = t; tStart = t;
tStart = GetRounded(); tStart = GetRounded();
if (tvguideConfig.displayMode == eVertical) { if (tvguideConfig.displayMode == eVertical) {
tEnd = tStart + (tvguideConfig.osdHeight - tvguideConfig.statusHeaderHeight - tvguideConfig.channelHeaderHeight - tvguideConfig.footerHeight)/tvguideConfig.minutePixel*60; tEnd = tStart + (tvguideConfig.osdHeight - tvguideConfig.statusHeaderHeight - tvguideConfig.channelHeaderHeight - tvguideConfig.footerHeight)/tvguideConfig.minutePixel*60;
} else if (tvguideConfig.displayMode == eHorizontal) { } else if (tvguideConfig.displayMode == eHorizontal) {
@ -23,21 +23,21 @@ void cMyTime::Now() {
} }
void cMyTime::AddStep(int step) { void cMyTime::AddStep(int step) {
tStart += step*60; tStart += step*60;
tEnd += step*60; tEnd += step*60;
} }
bool cMyTime::DelStep(int step) { bool cMyTime::DelStep(int step) {
if ((tStart - step*60)+30*60 < t) { if ((tStart - step*60)+30*60 < t) {
return true; return true;
} }
tStart -= step*60; tStart -= step*60;
tEnd -= 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;
if (tvguideConfig.displayMode == eVertical) { if (tvguideConfig.displayMode == eVertical) {
tEnd = tStart + (tvguideConfig.osdHeight - tvguideConfig.statusHeaderHeight - tvguideConfig.channelHeaderHeight - tvguideConfig.footerHeight)/tvguideConfig.minutePixel*60; tEnd = tStart + (tvguideConfig.osdHeight - tvguideConfig.statusHeaderHeight - tvguideConfig.channelHeaderHeight - tvguideConfig.footerHeight)/tvguideConfig.minutePixel*60;
} else if (tvguideConfig.displayMode == eHorizontal) { } else if (tvguideConfig.displayMode == eHorizontal) {
@ -46,77 +46,77 @@ void cMyTime::SetTime(time_t newTime) {
} }
time_t cMyTime::getPrevPrimetime(time_t current) { time_t cMyTime::getPrevPrimetime(time_t current) {
tm *st = localtime(&current); tm *st = localtime(&current);
if (st->tm_hour < 21) { if (st->tm_hour < 21) {
current -= 24 * 60* 60; current -= 24 * 60* 60;
st = localtime(&current); st = localtime(&current);
} }
st->tm_hour = 20; st->tm_hour = 20;
st->tm_min = 0; st->tm_min = 0;
time_t primeTime = mktime(st); time_t primeTime = mktime(st);
return primeTime; return primeTime;
} }
time_t cMyTime::getNextPrimetime(time_t current){ time_t cMyTime::getNextPrimetime(time_t current){
tm *st = localtime(&current); tm *st = localtime(&current);
if (st->tm_hour > 19) { if (st->tm_hour > 19) {
current += 24 * 60* 60; current += 24 * 60* 60;
st = localtime(&current); st = localtime(&current);
} }
st->tm_hour = 20; st->tm_hour = 20;
st->tm_min = 0; st->tm_min = 0;
time_t primeTime = mktime(st); time_t primeTime = mktime(st);
return primeTime; return primeTime;
} }
bool cMyTime::tooFarInPast(time_t current) { bool cMyTime::tooFarInPast(time_t current) {
if (current < t) { if (current < t) {
return true; return true;
} }
return false; return false;
} }
cString cMyTime::GetCurrentTime() { cString cMyTime::GetCurrentTime() {
char buf[25]; char buf[25];
t = time(0); t = time(0);
tm *st = localtime(&t); tm *st = localtime(&t);
//snprintf(text, sizeof(text), "%d:%02d", st->tm_hour, st->tm_min); //snprintf(text, sizeof(text), "%d:%02d", st->tm_hour, st->tm_min);
if (tvguideConfig.timeFormat == e12Hours) { if (tvguideConfig.timeFormat == e12Hours) {
strftime(buf, sizeof(buf), "%I:%M %p", st); strftime(buf, sizeof(buf), "%I:%M %p", st);
} else if (tvguideConfig.timeFormat == e24Hours) } else if (tvguideConfig.timeFormat == e24Hours)
strftime(buf, sizeof(buf), "%H:%M", st); strftime(buf, sizeof(buf), "%H:%M", st);
return buf; return buf;
} }
cString cMyTime::GetDate() { cString cMyTime::GetDate() {
char text[6]; char text[6];
tm *st = localtime(&tStart); tm *st = localtime(&tStart);
snprintf(text, sizeof(text), "%d.%d", st->tm_mday, st->tm_mon+1); snprintf(text, sizeof(text), "%d.%d", st->tm_mday, st->tm_mon+1);
return text; return text;
} }
cString cMyTime::GetWeekday() { cString cMyTime::GetWeekday() {
return WeekDayName(tStart); return WeekDayName(tStart);
} }
int cMyTime::GetTimelineOffset() { int cMyTime::GetTimelineOffset() {
tm *st = localtime(&tStart); tm *st = localtime(&tStart);
int offset = st->tm_hour*60; int offset = st->tm_hour*60;
offset += st->tm_min; offset += st->tm_min;
return offset; return offset;
} }
time_t cMyTime::GetRounded() { time_t cMyTime::GetRounded() {
tm *rounded = localtime ( &tStart ); tm *rounded = localtime ( &tStart );
rounded->tm_sec = 0; rounded->tm_sec = 0;
if (rounded->tm_min > 29) if (rounded->tm_min > 29)
rounded->tm_min = 30; rounded->tm_min = 30;
else else
rounded->tm_min = 0; rounded->tm_min = 0;
return mktime(rounded); return mktime(rounded);
} }
void cMyTime::debug() { void cMyTime::debug() {
esyslog("t: %s, tStart: %s, tEnd: %s", *TimeString(t), *TimeString(tStart), *TimeString(tEnd)); esyslog("t: %s, tStart: %s, tEnd: %s", *TimeString(t), *TimeString(tStart), *TimeString(tEnd));
} }

46
timer.h
View File

@ -4,30 +4,30 @@
// --- cMyTime ------------------------------------------------------------- // --- cMyTime -------------------------------------------------------------
class cMyTime { class cMyTime {
private: private:
time_t t; time_t t;
time_t tStart; time_t tStart;
time_t tEnd; time_t tEnd;
public: public:
cMyTime(){}; cMyTime(){};
virtual ~cMyTime(void); virtual ~cMyTime(void);
static cString printTime(time_t displayTime); 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 GetEnd() {return tEnd;}; time_t GetEnd() {return tEnd;};
cString GetCurrentTime(); cString GetCurrentTime();
cString GetDate(); cString GetDate();
cString GetWeekday(); cString GetWeekday();
time_t getPrevPrimetime(time_t current); time_t getPrevPrimetime(time_t current);
time_t getNextPrimetime(time_t current); time_t getNextPrimetime(time_t current);
bool tooFarInPast(time_t current); bool tooFarInPast(time_t current);
int GetTimelineOffset(); int GetTimelineOffset();
time_t GetRounded(); time_t GetRounded();
void debug(); void debug();
}; };
#endif //__TVGUIDE_TIMER_H #endif //__TVGUIDE_TIMER_H

View File

@ -85,22 +85,22 @@ bool cPluginTvguide::ProcessArgs(int argc, char *argv[])
int c; int c;
cString *path = NULL; cString *path = NULL;
while ((c = getopt_long(argc, argv, "i:f:l:", long_options, NULL)) != -1) { while ((c = getopt_long(argc, argv, "i:f:l:", long_options, NULL)) != -1) {
switch (c) { switch (c) {
case 'i': case 'i':
path = new cString(optarg); path = new cString(optarg);
tvguideConfig.SetImagesPath(*path); tvguideConfig.SetImagesPath(*path);
imagesPathSet = true; imagesPathSet = true;
break; break;
case 'l': case 'l':
path = new cString(optarg); path = new cString(optarg);
tvguideConfig.SetLogoPath(*path); tvguideConfig.SetLogoPath(*path);
logoPathSet = true; logoPathSet = true;
break; break;
default: default:
return false; return false;
} }
if (path) if (path)
delete path; delete path;
} }
return true; return true;
} }
@ -113,18 +113,18 @@ bool cPluginTvguide::Initialize(void)
bool cPluginTvguide::Start(void) bool cPluginTvguide::Start(void)
{ {
if (!logoPathSet) { if (!logoPathSet) {
cString path = cString::sprintf("%s/channellogos/", cPlugin::ConfigDirectory(PLUGIN_NAME_I18N)); cString path = cString::sprintf("%s/channellogos/", cPlugin::ConfigDirectory(PLUGIN_NAME_I18N));
tvguideConfig.SetLogoPath(path); tvguideConfig.SetLogoPath(path);
logoPathSet = true; logoPathSet = true;
} }
if (!imagesPathSet) { if (!imagesPathSet) {
cString path = cString::sprintf("%s/epgimages/", cPlugin::ConfigDirectory(PLUGIN_NAME_I18N)); cString path = cString::sprintf("%s/epgimages/", cPlugin::ConfigDirectory(PLUGIN_NAME_I18N));
tvguideConfig.SetImagesPath(path); tvguideConfig.SetImagesPath(path);
logoPathSet = true; logoPathSet = true;
} }
return true; return true;
} }
void cPluginTvguide::Stop(void) void cPluginTvguide::Stop(void)

View File

@ -56,132 +56,132 @@ cOsdManager osdManager;
#include <stdlib.h> #include <stdlib.h>
cTvGuideOsd::cTvGuideOsd(void) { cTvGuideOsd::cTvGuideOsd(void) {
detailView = NULL; detailView = NULL;
detailViewActive = false; detailViewActive = false;
activeGrid = NULL; activeGrid = NULL;
timeLine = NULL; timeLine = NULL;
} }
cTvGuideOsd::~cTvGuideOsd() { cTvGuideOsd::~cTvGuideOsd() {
delete myTime; delete myTime;
columns.Clear(); columns.Clear();
if (tvguideConfig.displayStatusHeader) { if (tvguideConfig.displayStatusHeader) {
delete statusHeader; delete statusHeader;
} }
if (detailView) if (detailView)
delete detailView; delete detailView;
delete timeLine; delete timeLine;
delete footer; delete footer;
cMessageBox::Destroy(); cMessageBox::Destroy();
osdManager.deleteOsd(); osdManager.deleteOsd();
} }
void cTvGuideOsd::Show(void) { void cTvGuideOsd::Show(void) {
int start = cTimeMs::Now(); int start = cTimeMs::Now();
bool ok = false; bool ok = false;
ok = osdManager.setOsd(); ok = osdManager.setOsd();
if (ok) { if (ok) {
tvguideConfig.setDynamicValues(osdManager.Width(), osdManager.Height()); tvguideConfig.setDynamicValues(osdManager.Width(), osdManager.Height());
tvguideConfig.loadTheme(); tvguideConfig.loadTheme();
osdManager.setBackground(); osdManager.setBackground();
myTime = new cMyTime(); myTime = new cMyTime();
myTime->Now(); myTime->Now();
drawOsd(); drawOsd();
} }
esyslog("tvguide: Rendering took %d ms", int(cTimeMs::Now()-start)); esyslog("tvguide: Rendering took %d ms", int(cTimeMs::Now()-start));
} }
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) { if (tvguideConfig.displayStatusHeader) {
statusHeader = new cStatusHeader(); statusHeader = new cStatusHeader();
statusHeader->ScaleVideo(); statusHeader->ScaleVideo();
} }
timeLine = new cTimeLine(myTime); timeLine = new cTimeLine(myTime);
timeLine->drawDateViewer(); timeLine->drawDateViewer();
timeLine->drawTimeline(); timeLine->drawTimeline();
timeLine->drawClock(); timeLine->drawClock();
footer = new cFooter(); footer = new cFooter();
footer->drawRedButton(); footer->drawRedButton();
footer->drawGreenButton(); footer->drawGreenButton();
footer->drawYellowButton(); footer->drawYellowButton();
footer->drawBlueButton(); footer->drawBlueButton();
osdManager.flush(); osdManager.flush();
readChannels(startChannel); readChannels(startChannel);
drawGridsChannelJump(); drawGridsChannelJump();
osdManager.flush(); osdManager.flush();
cPixmap::Unlock(); cPixmap::Unlock();
} }
void cTvGuideOsd::readChannels(const 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 (const 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()) {
columns.Add(column); columns.Add(column);
i++; i++;
} else { } else {
delete column; delete column;
} }
} }
if (i == tvguideConfig.numGrids) if (i == tvguideConfig.numGrids)
break; break;
} }
} }
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();
if (tvguideConfig.displayStatusHeader) { if (tvguideConfig.displayStatusHeader) {
statusHeader->DrawInfoText(activeGrid); statusHeader->DrawInfoText(activeGrid);
} }
for (cChannelColumn *column = columns.First(); column; column = columns.Next(column)) { for (cChannelColumn *column = columns.First(); column; column = columns.Next(column)) {
column->createHeader(); column->createHeader();
column->drawGrids(); column->drawGrids();
} }
} }
void cTvGuideOsd::drawGridsTimeJump() { void cTvGuideOsd::drawGridsTimeJump() {
if (columns.Count() == 0) if (columns.Count() == 0)
return; return;
cChannelColumn *colActive = NULL; cChannelColumn *colActive = NULL;
if (activeGrid) { if (activeGrid) {
colActive = activeGrid->column; colActive = activeGrid->column;
} else { } else {
colActive = columns.First(); colActive = columns.First();
} }
for (cChannelColumn *column = columns.First(); column; column = columns.Next(column)) { for (cChannelColumn *column = columns.First(); column; column = columns.Next(column)) {
column->clearGrids(); column->clearGrids();
column->readGrids(); column->readGrids();
column->drawGrids(); column->drawGrids();
} }
activeGrid = colActive->getActive(); activeGrid = colActive->getActive();
if (activeGrid) { if (activeGrid) {
activeGrid->SetActive(); activeGrid->SetActive();
activeGrid->Draw(); activeGrid->Draw();
if (tvguideConfig.displayStatusHeader) { if (tvguideConfig.displayStatusHeader) {
statusHeader->DrawInfoText(activeGrid); statusHeader->DrawInfoText(activeGrid);
} }
} }
} }
void cTvGuideOsd::setNextActiveGrid(cGrid *next) { void cTvGuideOsd::setNextActiveGrid(cGrid *next) {
if (!next || !activeGrid) { if (!next || !activeGrid) {
return; return;
} }
activeGrid->SetInActive(); activeGrid->SetInActive();
activeGrid->Draw(); activeGrid->Draw();
activeGrid = next; activeGrid = next;
activeGrid->SetActive(); activeGrid->SetActive();
activeGrid->Draw(); activeGrid->Draw();
if (tvguideConfig.displayStatusHeader) { if (tvguideConfig.displayStatusHeader) {
statusHeader->DrawInfoText(activeGrid); statusHeader->DrawInfoText(activeGrid);
} }
@ -189,81 +189,81 @@ void cTvGuideOsd::setNextActiveGrid(cGrid *next) {
void cTvGuideOsd::channelForward() { void cTvGuideOsd::channelForward() {
cChannelColumn *colRight = columns.Next(activeGrid->column); cChannelColumn *colRight = columns.Next(activeGrid->column);
if (!colRight) { if (!colRight) {
const 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.numGrids - 1, channelRight, myTime); colRight = new cChannelColumn(tvguideConfig.numGrids - 1, channelRight, myTime);
if (colRight->readGrids()) { if (colRight->readGrids()) {
break; break;
} else { } else {
delete colRight; delete colRight;
colRight = NULL; colRight = NULL;
} }
} }
} }
if (colRight) { if (colRight) {
if (columns.Count() == tvguideConfig.numGrids) { if (columns.Count() == tvguideConfig.numGrids) {
cChannelColumn *cFirst = columns.First(); cChannelColumn *cFirst = columns.First();
columns.Del(cFirst); columns.Del(cFirst);
} }
for (cChannelColumn *column = columns.First(); column; column = columns.Next(column)) { for (cChannelColumn *column = columns.First(); column; column = columns.Next(column)) {
column->SetNum(column->GetNum() - 1); column->SetNum(column->GetNum() - 1);
column->drawHeader(); column->drawHeader();
column->drawGrids(); column->drawGrids();
} }
columns.Add(colRight); columns.Add(colRight);
colRight->createHeader(); colRight->createHeader();
colRight->drawGrids(); colRight->drawGrids();
} }
} }
if (colRight) { if (colRight) {
cGrid *right = colRight->getNeighbor(activeGrid); cGrid *right = colRight->getNeighbor(activeGrid);
if (right) { if (right) {
setNextActiveGrid(right); setNextActiveGrid(right);
} }
} }
osdManager.flush(); osdManager.flush();
} }
void cTvGuideOsd::channelBack() { void cTvGuideOsd::channelBack() {
cChannelColumn *colLeft = columns.Prev(activeGrid->column); cChannelColumn *colLeft = columns.Prev(activeGrid->column);
if (!colLeft) { if (!colLeft) {
const 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);
if (colLeft->readGrids()) { if (colLeft->readGrids()) {
break; break;
} else { } else {
delete colLeft; delete colLeft;
colLeft = NULL; colLeft = NULL;
} }
} }
} }
if (colLeft) { if (colLeft) {
if (columns.Count() == tvguideConfig.numGrids) { if (columns.Count() == tvguideConfig.numGrids) {
cChannelColumn *cLast = columns.Last(); cChannelColumn *cLast = columns.Last();
columns.Del(cLast); columns.Del(cLast);
} }
for (cChannelColumn *column = columns.First(); column; column = columns.Next(column)) { for (cChannelColumn *column = columns.First(); column; column = columns.Next(column)) {
column->SetNum(column->GetNum() + 1); column->SetNum(column->GetNum() + 1);
column->drawHeader(); column->drawHeader();
column->drawGrids(); column->drawGrids();
} }
columns.Ins(colLeft, columns.First()); columns.Ins(colLeft, columns.First());
colLeft->createHeader(); colLeft->createHeader();
colLeft->drawGrids(); colLeft->drawGrids();
} }
} }
if (colLeft) { if (colLeft) {
cGrid *left = colLeft->getNeighbor(activeGrid); cGrid *left = colLeft->getNeighbor(activeGrid);
if (left) { if (left) {
setNextActiveGrid(left); setNextActiveGrid(left);
} }
} }
osdManager.flush(); osdManager.flush();
} }
void cTvGuideOsd::timeForward() { void cTvGuideOsd::timeForward() {
@ -283,19 +283,19 @@ void cTvGuideOsd::timeForward() {
if (!actionDone) { if (!actionDone) {
ScrollForward(); ScrollForward();
} }
osdManager.flush(); osdManager.flush();
} }
void cTvGuideOsd::ScrollForward() { void cTvGuideOsd::ScrollForward() {
myTime->AddStep(tvguideConfig.stepMinutes); myTime->AddStep(tvguideConfig.stepMinutes);
timeLine->drawDateViewer(); timeLine->drawDateViewer();
timeLine->drawClock(); timeLine->drawClock();
timeLine->setTimeline(); timeLine->setTimeline();
for (cChannelColumn *column = columns.First(); column; column = columns.Next(column)) { for (cChannelColumn *column = columns.First(); column; column = columns.Next(column)) {
column->AddNewGridsAtEnd(); column->AddNewGridsAtEnd();
column->ClearOutdatedStart(); column->ClearOutdatedStart();
column->drawGrids(); column->drawGrids();
} }
} }
void cTvGuideOsd::timeBack() { void cTvGuideOsd::timeBack() {
@ -316,31 +316,31 @@ void cTvGuideOsd::timeBack() {
if (!actionDone) { if (!actionDone) {
ScrollBack(); ScrollBack();
} }
osdManager.flush(); osdManager.flush();
} }
void cTvGuideOsd::ScrollBack() { void cTvGuideOsd::ScrollBack() {
bool tooFarInPast = myTime->DelStep(tvguideConfig.stepMinutes); bool tooFarInPast = myTime->DelStep(tvguideConfig.stepMinutes);
if (tooFarInPast) if (tooFarInPast)
return; return;
timeLine->drawDateViewer(); timeLine->drawDateViewer();
timeLine->drawClock(); timeLine->drawClock();
timeLine->setTimeline(); timeLine->setTimeline();
for (cChannelColumn *column = columns.First(); column; column = columns.Next(column)) { for (cChannelColumn *column = columns.First(); column; column = columns.Next(column)) {
column->AddNewGridsAtStart(); column->AddNewGridsAtStart();
column->ClearOutdatedEnd(); column->ClearOutdatedEnd();
column->drawGrids(); column->drawGrids();
} }
} }
void cTvGuideOsd::processKeyUp() { void cTvGuideOsd::processKeyUp() {
if (!activeGrid) { if (!activeGrid) {
return; return;
} }
if (detailViewActive) { if (detailViewActive) {
detailView->scrollUp(); detailView->scrollUp();
osdManager.flush(); osdManager.flush();
} else { } else {
if (tvguideConfig.displayMode == eVertical) { if (tvguideConfig.displayMode == eVertical) {
timeBack(); timeBack();
} else if (tvguideConfig.displayMode == eHorizontal) { } else if (tvguideConfig.displayMode == eHorizontal) {
@ -350,13 +350,13 @@ void cTvGuideOsd::processKeyUp() {
} }
void cTvGuideOsd::processKeyDown() { void cTvGuideOsd::processKeyDown() {
if (!activeGrid) { if (!activeGrid) {
return; return;
} }
if (detailViewActive) { if (detailViewActive) {
detailView->scrollDown(); detailView->scrollDown();
osdManager.flush(); osdManager.flush();
} else { } else {
if (tvguideConfig.displayMode == eVertical) { if (tvguideConfig.displayMode == eVertical) {
timeForward(); timeForward();
} else if (tvguideConfig.displayMode == eHorizontal) { } else if (tvguideConfig.displayMode == eHorizontal) {
@ -366,10 +366,10 @@ void cTvGuideOsd::processKeyDown() {
} }
void cTvGuideOsd::processKeyLeft() { void cTvGuideOsd::processKeyLeft() {
if (detailViewActive) if (detailViewActive)
return; return;
if (activeGrid == NULL) if (activeGrid == NULL)
return; return;
if (tvguideConfig.displayMode == eVertical) { if (tvguideConfig.displayMode == eVertical) {
channelBack(); channelBack();
} else if (tvguideConfig.displayMode == eHorizontal) { } else if (tvguideConfig.displayMode == eHorizontal) {
@ -378,10 +378,10 @@ void cTvGuideOsd::processKeyLeft() {
} }
void cTvGuideOsd::processKeyRight() { void cTvGuideOsd::processKeyRight() {
if (detailViewActive) if (detailViewActive)
return; return;
if (activeGrid == NULL) if (activeGrid == NULL)
return; return;
if (tvguideConfig.displayMode == eVertical) { if (tvguideConfig.displayMode == eVertical) {
channelForward(); channelForward();
} else if (tvguideConfig.displayMode == eHorizontal) { } else if (tvguideConfig.displayMode == eHorizontal) {
@ -390,201 +390,201 @@ void cTvGuideOsd::processKeyRight() {
} }
void cTvGuideOsd::processKeyOk() { void cTvGuideOsd::processKeyOk() {
if (detailViewActive) { if (detailViewActive) {
delete detailView; delete detailView;
detailView = NULL; detailView = NULL;
detailViewActive = false; detailViewActive = false;
osdManager.flush(); osdManager.flush();
} else { } else {
if (!activeGrid->isDummy()) { if (!activeGrid->isDummy()) {
detailViewActive = true; detailViewActive = true;
detailView = new cDetailView(activeGrid); detailView = new cDetailView(activeGrid);
detailView->Start(); detailView->Start();
} }
} }
} }
void cTvGuideOsd::processKeyRed() { void cTvGuideOsd::processKeyRed() {
if ((activeGrid == NULL) || activeGrid->isDummy()) if ((activeGrid == NULL) || activeGrid->isDummy())
return; return;
cTimer *timer = new cTimer(activeGrid->GetEvent()); cTimer *timer = new cTimer(activeGrid->GetEvent());
cTimer *t = Timers.GetTimer(timer); cTimer *t = Timers.GetTimer(timer);
cString msg; cString msg;
if (t) { if (t) {
isyslog("timer %s already exists", *timer->ToDescr()); isyslog("timer %s already exists", *timer->ToDescr());
delete timer; delete timer;
msg = cString::sprintf(tr("Timer not set! There is already a timer for this item.")); msg = cString::sprintf(tr("Timer not set! There is already a timer for this item."));
} else { } else {
Timers.Add(timer); Timers.Add(timer);
Timers.SetModified(); Timers.SetModified();
msg = cString::sprintf("%s:\n%s (%s) %s - %s", tr("Timer set"), activeGrid->GetEvent()->Title(), timer->Channel()->Name(), *DayDateTime(timer->StartTime()), *TimeString(timer->StopTime())); msg = cString::sprintf("%s:\n%s (%s) %s - %s", tr("Timer set"), activeGrid->GetEvent()->Title(), timer->Channel()->Name(), *DayDateTime(timer->StartTime()), *TimeString(timer->StopTime()));
timer->SetEvent(activeGrid->GetEvent()); timer->SetEvent(activeGrid->GetEvent());
activeGrid->setTimer(); activeGrid->setTimer();
activeGrid->column->setTimer(); activeGrid->column->setTimer();
activeGrid->SetDirty(); activeGrid->SetDirty();
activeGrid->Draw(); activeGrid->Draw();
osdManager.flush(); osdManager.flush();
isyslog("timer %s added (active)", *timer->ToDescr()); isyslog("timer %s added (active)", *timer->ToDescr());
} }
cMessageBox::Start(4000, msg); cMessageBox::Start(4000, msg);
} }
void cTvGuideOsd::processKeyGreen() { void cTvGuideOsd::processKeyGreen() {
if (activeGrid == NULL) if (activeGrid == NULL)
return; return;
const cChannel *currentChannel = activeGrid->column->getChannel(); const cChannel *currentChannel = activeGrid->column->getChannel();
const cChannel *prev = NULL; const cChannel *prev = NULL;
int i = tvguideConfig.jumpChannels + 1; int i = tvguideConfig.jumpChannels + 1;
for (const cChannel *channel = currentChannel; channel; channel = Channels.Prev(channel)) { for (const cChannel *channel = currentChannel; channel; channel = Channels.Prev(channel)) {
if (!channel->GroupSep()) { if (!channel->GroupSep()) {
prev = channel; prev = channel;
i--; i--;
} }
if (i == 0) if (i == 0)
break; break;
} }
if (prev) { if (prev) {
readChannels(prev); readChannels(prev);
if (columns.Count() > 0) { if (columns.Count() > 0) {
drawGridsChannelJump(); drawGridsChannelJump();
} }
osdManager.flush(); osdManager.flush();
} }
} }
void cTvGuideOsd::processKeyYellow() { void cTvGuideOsd::processKeyYellow() {
if (activeGrid == NULL) if (activeGrid == NULL)
return; return;
const cChannel *currentChannel = activeGrid->column->getChannel(); const cChannel *currentChannel = activeGrid->column->getChannel();
const cChannel *next = NULL; const cChannel *next = NULL;
int i=0; int i=0;
for (const 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++;
} }
if (i == (tvguideConfig.jumpChannels+1)) if (i == (tvguideConfig.jumpChannels+1))
break; break;
}
if (next) {
readChannels(next);
if (columns.Count() > 0) {
drawGridsChannelJump();
}
osdManager.flush();
} }
if (next) {
readChannels(next);
if (columns.Count() > 0) {
drawGridsChannelJump();
}
osdManager.flush();
}
} }
eOSState cTvGuideOsd::processKeyBlue() { eOSState cTvGuideOsd::processKeyBlue() {
if (activeGrid == NULL) if (activeGrid == NULL)
return osContinue; return osContinue;
const 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;
} }
return osContinue; return osContinue;
} }
void cTvGuideOsd::processKey1() { void cTvGuideOsd::processKey1() {
bool tooFarInPast = myTime->DelStep(tvguideConfig.bigStepHours*60); bool tooFarInPast = myTime->DelStep(tvguideConfig.bigStepHours*60);
if (tooFarInPast) if (tooFarInPast)
return; return;
drawGridsTimeJump(); drawGridsTimeJump();
timeLine->drawDateViewer(); timeLine->drawDateViewer();
timeLine->drawClock(); timeLine->drawClock();
timeLine->setTimeline(); timeLine->setTimeline();
osdManager.flush(); osdManager.flush();
} }
void cTvGuideOsd::processKey3() { void cTvGuideOsd::processKey3() {
myTime->AddStep(tvguideConfig.bigStepHours*60); myTime->AddStep(tvguideConfig.bigStepHours*60);
drawGridsTimeJump(); drawGridsTimeJump();
timeLine->drawDateViewer(); timeLine->drawDateViewer();
timeLine->drawClock(); timeLine->drawClock();
timeLine->setTimeline(); timeLine->setTimeline();
osdManager.flush(); osdManager.flush();
} }
void cTvGuideOsd::processKey4() { void cTvGuideOsd::processKey4() {
bool tooFarInPast = myTime->DelStep(tvguideConfig.hugeStepHours*60); bool tooFarInPast = myTime->DelStep(tvguideConfig.hugeStepHours*60);
if (tooFarInPast) if (tooFarInPast)
return; return;
drawGridsTimeJump(); drawGridsTimeJump();
timeLine->drawDateViewer(); timeLine->drawDateViewer();
timeLine->drawClock(); timeLine->drawClock();
timeLine->setTimeline(); timeLine->setTimeline();
osdManager.flush(); osdManager.flush();
} }
void cTvGuideOsd::processKey6() { void cTvGuideOsd::processKey6() {
myTime->AddStep(tvguideConfig.hugeStepHours*60); myTime->AddStep(tvguideConfig.hugeStepHours*60);
drawGridsTimeJump(); drawGridsTimeJump();
timeLine->drawDateViewer(); timeLine->drawDateViewer();
timeLine->drawClock(); timeLine->drawClock();
timeLine->setTimeline(); timeLine->setTimeline();
osdManager.flush(); osdManager.flush();
} }
void cTvGuideOsd::processKey7() { void cTvGuideOsd::processKey7() {
cMyTime *primeChecker = new cMyTime(); cMyTime *primeChecker = new cMyTime();
primeChecker->Now(); primeChecker->Now();
time_t prevPrime = primeChecker->getPrevPrimetime(myTime->GetStart()); time_t prevPrime = primeChecker->getPrevPrimetime(myTime->GetStart());
if (primeChecker->tooFarInPast(prevPrime)) if (primeChecker->tooFarInPast(prevPrime))
return; return;
myTime->SetTime(prevPrime); myTime->SetTime(prevPrime);
drawGridsTimeJump(); drawGridsTimeJump();
timeLine->drawDateViewer(); timeLine->drawDateViewer();
timeLine->drawClock(); timeLine->drawClock();
timeLine->setTimeline(); timeLine->setTimeline();
osdManager.flush(); osdManager.flush();
} }
void cTvGuideOsd::processKey9() { void cTvGuideOsd::processKey9() {
cMyTime *primeChecker = new cMyTime(); cMyTime *primeChecker = new cMyTime();
time_t nextPrime = primeChecker->getNextPrimetime(myTime->GetStart()); time_t nextPrime = primeChecker->getNextPrimetime(myTime->GetStart());
myTime->SetTime(nextPrime); myTime->SetTime(nextPrime);
drawGridsTimeJump(); drawGridsTimeJump();
timeLine->drawDateViewer(); timeLine->drawDateViewer();
timeLine->drawClock(); timeLine->drawClock();
timeLine->setTimeline(); timeLine->setTimeline();
osdManager.flush(); osdManager.flush();
} }
eOSState cTvGuideOsd::ProcessKey(eKeys Key) { eOSState cTvGuideOsd::ProcessKey(eKeys Key) {
eOSState state = cOsdObject::ProcessKey(Key); eOSState state = cOsdObject::ProcessKey(Key);
if (state == osUnknown) { if (state == osUnknown) {
cPixmap::Lock(); cPixmap::Lock();
state = osContinue; state = osContinue;
switch (Key & ~k_Repeat) { switch (Key & ~k_Repeat) {
case kUp: processKeyUp(); break; case kUp: processKeyUp(); break;
case kDown: processKeyDown(); break; case kDown: processKeyDown(); break;
case kLeft: processKeyLeft(); break; case kLeft: processKeyLeft(); break;
case kRight: processKeyRight(); break; case kRight: processKeyRight(); break;
case kRed: processKeyRed(); break; case kRed: processKeyRed(); break;
case kGreen: processKeyGreen(); break; case kGreen: processKeyGreen(); break;
case kYellow: processKeyYellow(); break; case kYellow: processKeyYellow(); break;
case kBlue: state = processKeyBlue(); break; case kBlue: state = processKeyBlue(); break;
case kOk: processKeyOk(); break; case kOk: processKeyOk(); break;
case kBack: state=osEnd; break; case kBack: state=osEnd; break;
case k1: processKey1(); break; case k1: processKey1(); break;
case k3: processKey3(); break; case k3: processKey3(); break;
case k4: processKey4(); break; case k4: processKey4(); break;
case k6: processKey6(); break; case k6: processKey6(); break;
case k7: processKey7(); break; case k7: processKey7(); break;
case k9: processKey9(); break; case k9: processKey9(); break;
default: break; default: break;
} }
cPixmap::Unlock(); cPixmap::Unlock();
} }
return state; return state;
} }
void cTvGuideOsd::dump() { void cTvGuideOsd::dump() {
esyslog("tvguide: ------Dumping Content---------"); esyslog("tvguide: ------Dumping Content---------");
activeGrid->debug(); activeGrid->debug();
int i=1; int i=1;
for (cChannelColumn *col = columns.First(); col; col = columns.Next(col)) { for (cChannelColumn *col = columns.First(); col; col = columns.Next(col)) {
col->dumpGrids(); col->dumpGrids();
} }
} }