mirror of
https://projects.vdr-developer.org/git/vdr-plugin-tvguide.git
synced 2023-10-05 13:01:48 +00:00
Change cMyTime to cTimeManager
This commit is contained in:
parent
107f3f945f
commit
6b3eda282f
76
channelepg.c
76
channelepg.c
@ -1,10 +1,10 @@
|
|||||||
#include "channelepg.h"
|
#include "channelepg.h"
|
||||||
#include "dummygrid.h"
|
#include "dummygrid.h"
|
||||||
|
|
||||||
cChannelEpg::cChannelEpg(int num, const cChannel *channel, cMyTime *myTime) {
|
cChannelEpg::cChannelEpg(int num, const cChannel *channel, cTimeManager *timeManager) {
|
||||||
this->channel = channel;
|
this->channel = channel;
|
||||||
this->num = num;
|
this->num = num;
|
||||||
this->myTime = myTime;
|
this->timeManager = timeManager;
|
||||||
#if VDRVERSNUM < 20301
|
#if VDRVERSNUM < 20301
|
||||||
hasTimer = channel->HasTimer();
|
hasTimer = channel->HasTimer();
|
||||||
#endif
|
#endif
|
||||||
@ -51,17 +51,17 @@ bool cChannelEpg::readGrids() {
|
|||||||
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(timeManager->GetStart(), timeManager->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(timeManager->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(timeManager->GetStart()+i*5*60);
|
||||||
if (startEvent) {
|
if (startEvent) {
|
||||||
eventFound = true;
|
eventFound = true;
|
||||||
dummyAtStart = true;
|
dummyAtStart = true;
|
||||||
@ -72,20 +72,20 @@ bool cChannelEpg::readGrids() {
|
|||||||
if (eventFound) {
|
if (eventFound) {
|
||||||
bool col = true;
|
bool col = true;
|
||||||
if (dummyAtStart) {
|
if (dummyAtStart) {
|
||||||
addDummyGrid(myTime->GetStart(), startEvent->StartTime(), NULL, col);
|
addDummyGrid(timeManager->GetStart(), startEvent->StartTime(), NULL, col);
|
||||||
col = !col;
|
col = !col;
|
||||||
}
|
}
|
||||||
bool dummyNeeded = true;
|
bool dummyNeeded = true;
|
||||||
bool toFarInFuture = false;
|
bool toFarInFuture = false;
|
||||||
time_t endLast = myTime->GetStart();
|
time_t endLast = timeManager->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 > timeManager->GetEnd()) {
|
||||||
endTime = myTime->GetEnd();
|
endTime = timeManager->GetEnd();
|
||||||
toFarInFuture = true;
|
toFarInFuture = true;
|
||||||
}
|
}
|
||||||
addDummyGrid(endLast, endTime, NULL, col);
|
addDummyGrid(endLast, endTime, NULL, col);
|
||||||
@ -97,18 +97,18 @@ bool cChannelEpg::readGrids() {
|
|||||||
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() > timeManager->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(), timeManager->GetEnd(), NULL, col);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
addDummyGrid(myTime->GetStart(), myTime->GetEnd(), NULL, false);
|
addDummyGrid(timeManager->GetStart(), timeManager->GetEnd(), NULL, false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -131,7 +131,7 @@ int cChannelEpg::getY() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cGrid * cChannelEpg::getActive() {
|
cGrid * cChannelEpg::getActive() {
|
||||||
cMyTime t;
|
cTimeManager 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()))
|
||||||
@ -196,7 +196,7 @@ void cChannelEpg::AddNewGridsAtStart() {
|
|||||||
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() <= timeManager->GetStart()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//if not, i have to add new ones to the list
|
//if not, i have to add new ones to the list
|
||||||
@ -213,8 +213,8 @@ void cChannelEpg::AddNewGridsAtStart() {
|
|||||||
Schedule = schedules->GetSchedule(channel);
|
Schedule = schedules->GetSchedule(channel);
|
||||||
if (!Schedule) {
|
if (!Schedule) {
|
||||||
if (firstGrid->isDummy()) {
|
if (firstGrid->isDummy()) {
|
||||||
firstGrid->SetStartTime(myTime->GetStart());
|
firstGrid->SetStartTime(timeManager->GetStart());
|
||||||
firstGrid->SetEndTime(myTime->GetEnd());
|
firstGrid->SetEndTime(timeManager->GetEnd());
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -223,13 +223,13 @@ void cChannelEpg::AddNewGridsAtStart() {
|
|||||||
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() < timeManager->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() <= timeManager->GetStart()) {
|
||||||
dummyNeeded = false;
|
dummyNeeded = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -237,11 +237,11 @@ void cChannelEpg::AddNewGridsAtStart() {
|
|||||||
if (dummyNeeded) {
|
if (dummyNeeded) {
|
||||||
firstGrid = grids.First();
|
firstGrid = grids.First();
|
||||||
if (firstGrid->isDummy()) {
|
if (firstGrid->isDummy()) {
|
||||||
firstGrid->SetStartTime(myTime->GetStart());
|
firstGrid->SetStartTime(timeManager->GetStart());
|
||||||
if (firstGrid->EndTime() >= myTime->GetEnd())
|
if (firstGrid->EndTime() >= timeManager->GetEnd())
|
||||||
firstGrid->SetEndTime(myTime->GetEnd());
|
firstGrid->SetEndTime(timeManager->GetEnd());
|
||||||
} else {
|
} else {
|
||||||
addDummyGrid(myTime->GetStart(), firstGrid->StartTime(), firstGrid, col);
|
addDummyGrid(timeManager->GetStart(), firstGrid->StartTime(), firstGrid, col);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -252,7 +252,7 @@ void cChannelEpg::AddNewGridsAtEnd() {
|
|||||||
if (lastGrid == NULL)
|
if (lastGrid == NULL)
|
||||||
return;
|
return;
|
||||||
//if last event is long enough, nothing to do.
|
//if last event is long enough, nothing to do.
|
||||||
if (lastGrid->EndTime() >= myTime->GetEnd()) {
|
if (lastGrid->EndTime() >= timeManager->GetEnd()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//if not, i have to add new ones to the list
|
//if not, i have to add new ones to the list
|
||||||
@ -269,8 +269,8 @@ void cChannelEpg::AddNewGridsAtEnd() {
|
|||||||
Schedule = schedules->GetSchedule(channel);
|
Schedule = schedules->GetSchedule(channel);
|
||||||
if (!Schedule) {
|
if (!Schedule) {
|
||||||
if (lastGrid->isDummy()) {
|
if (lastGrid->isDummy()) {
|
||||||
lastGrid->SetStartTime(myTime->GetStart());
|
lastGrid->SetStartTime(timeManager->GetStart());
|
||||||
lastGrid->SetEndTime(myTime->GetEnd());
|
lastGrid->SetEndTime(timeManager->GetEnd());
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -279,12 +279,12 @@ void cChannelEpg::AddNewGridsAtEnd() {
|
|||||||
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() > timeManager->GetEnd()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
addEpgGrid(event, NULL, col);
|
addEpgGrid(event, NULL, col);
|
||||||
col = !col;
|
col = !col;
|
||||||
if (event->EndTime() > myTime->GetEnd()) {
|
if (event->EndTime() > timeManager->GetEnd()) {
|
||||||
dummyNeeded = false;
|
dummyNeeded = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -292,11 +292,11 @@ void cChannelEpg::AddNewGridsAtEnd() {
|
|||||||
if (dummyNeeded) {
|
if (dummyNeeded) {
|
||||||
lastGrid = grids.Last();
|
lastGrid = grids.Last();
|
||||||
if (lastGrid->isDummy()) {
|
if (lastGrid->isDummy()) {
|
||||||
lastGrid->SetEndTime(myTime->GetEnd());
|
lastGrid->SetEndTime(timeManager->GetEnd());
|
||||||
if (lastGrid->StartTime() <= myTime->GetStart())
|
if (lastGrid->StartTime() <= timeManager->GetStart())
|
||||||
lastGrid->SetStartTime(myTime->GetStart());
|
lastGrid->SetStartTime(timeManager->GetStart());
|
||||||
} else {
|
} else {
|
||||||
addDummyGrid(lastGrid->EndTime(), myTime->GetEnd(), NULL, col);
|
addDummyGrid(lastGrid->EndTime(), timeManager->GetEnd(), NULL, col);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -307,17 +307,17 @@ void cChannelEpg::ClearOutdatedStart() {
|
|||||||
firstGrid = grids.First();
|
firstGrid = grids.First();
|
||||||
if (!firstGrid)
|
if (!firstGrid)
|
||||||
break;
|
break;
|
||||||
if (firstGrid->EndTime() <= myTime->GetStart()) {
|
if (firstGrid->EndTime() <= timeManager->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(timeManager->GetStart());
|
||||||
cGrid *next = getNext(firstGrid);
|
cGrid *next = getNext(firstGrid);
|
||||||
if (next) {
|
if (next) {
|
||||||
firstGrid->SetEndTime(next->StartTime());
|
firstGrid->SetEndTime(next->StartTime());
|
||||||
} else {
|
} else {
|
||||||
firstGrid->SetEndTime(myTime->GetEnd());
|
firstGrid->SetEndTime(timeManager->GetEnd());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -331,17 +331,17 @@ void cChannelEpg::ClearOutdatedEnd() {
|
|||||||
lastGrid = grids.Last();
|
lastGrid = grids.Last();
|
||||||
if (!lastGrid)
|
if (!lastGrid)
|
||||||
break;
|
break;
|
||||||
if (lastGrid->StartTime() >= myTime->GetEnd()) {
|
if (lastGrid->StartTime() >= timeManager->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(timeManager->GetEnd());
|
||||||
cGrid *prev = getPrev(lastGrid);
|
cGrid *prev = getPrev(lastGrid);
|
||||||
if (prev) {
|
if (prev) {
|
||||||
lastGrid->SetStartTime(prev->EndTime());
|
lastGrid->SetStartTime(prev->EndTime());
|
||||||
} else {
|
} else {
|
||||||
lastGrid->SetStartTime(myTime->GetStart());
|
lastGrid->SetStartTime(timeManager->GetStart());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -393,7 +393,7 @@ void cChannelEpg::dumpGrids() {
|
|||||||
esyslog("tvguide: ------Channel %s %d: %d entires ---------", channel->Name(), num, grids.Count());
|
esyslog("tvguide: ------Channel %s %d: %d entires ---------", channel->Name(), num, 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, *cTimeManager::printTime(grid->StartTime()), *cTimeManager::printTime(grid->EndTime()));
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ class cHeaderGrid;
|
|||||||
|
|
||||||
class cChannelEpg : public cListObject, public cStyledPixmap {
|
class cChannelEpg : public cListObject, public cStyledPixmap {
|
||||||
private:
|
private:
|
||||||
cMyTime *myTime;
|
cTimeManager *timeManager;
|
||||||
int num;
|
int num;
|
||||||
const cChannel *channel;
|
const cChannel *channel;
|
||||||
cHeaderGrid *header;
|
cHeaderGrid *header;
|
||||||
@ -30,7 +30,7 @@ private:
|
|||||||
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:
|
||||||
cChannelEpg(int num, const cChannel *channel, cMyTime *myTime);
|
cChannelEpg(int num, const cChannel *channel, cTimeManager *timeManager);
|
||||||
virtual ~cChannelEpg(void);
|
virtual ~cChannelEpg(void);
|
||||||
void createHeader();
|
void createHeader();
|
||||||
void drawHeader();
|
void drawHeader();
|
||||||
@ -38,8 +38,8 @@ public:
|
|||||||
void drawGrids();
|
void drawGrids();
|
||||||
int getX();
|
int getX();
|
||||||
int getY();
|
int getY();
|
||||||
int Start() { return myTime->GetStart(); };
|
int Start() { return timeManager->GetStart(); };
|
||||||
int Stop() { return myTime->GetEnd(); };
|
int Stop() { return timeManager->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();
|
||||||
|
@ -103,8 +103,8 @@ 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),
|
*cTimeManager::printTime(start),
|
||||||
*cMyTime::printTime(end),
|
*cTimeManager::printTime(end),
|
||||||
viewportHeight,
|
viewportHeight,
|
||||||
Duration()/60,
|
Duration()/60,
|
||||||
active);
|
active);
|
||||||
|
16
timeline.c
16
timeline.c
@ -1,8 +1,8 @@
|
|||||||
#include "imageloader.h"
|
#include "imageloader.h"
|
||||||
#include "timeline.h"
|
#include "timeline.h"
|
||||||
|
|
||||||
cTimeLine::cTimeLine(cMyTime *myTime) {
|
cTimeLine::cTimeLine(cTimeManager *timeManager) {
|
||||||
this->myTime = myTime;
|
this->timeManager = timeManager;
|
||||||
if (config.displayMode == eVertical) {
|
if (config.displayMode == eVertical) {
|
||||||
dateViewer = new cStyledPixmap(osdManager.requestPixmap(1, cRect(0,
|
dateViewer = new cStyledPixmap(osdManager.requestPixmap(1, cRect(0,
|
||||||
geoManager.statusHeaderHeight + geoManager.clockHeight,
|
geoManager.statusHeaderHeight + geoManager.clockHeight,
|
||||||
@ -63,8 +63,8 @@ cTimeLine::~cTimeLine(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void cTimeLine::drawDateViewer() {
|
void cTimeLine::drawDateViewer() {
|
||||||
cString weekDay = myTime->GetWeekday();
|
cString weekDay = timeManager->GetWeekday();
|
||||||
cString date = myTime->GetDate();
|
cString date = timeManager->GetDate();
|
||||||
if (config.style != eStyleGraphical) {
|
if (config.style != eStyleGraphical) {
|
||||||
dateViewer->setColor(theme.Color(clrHeader), theme.Color(clrHeaderBlending));
|
dateViewer->setColor(theme.Color(clrHeader), theme.Color(clrHeaderBlending));
|
||||||
dateViewer->drawBackground();
|
dateViewer->drawBackground();
|
||||||
@ -207,10 +207,10 @@ void cTimeLine::drawRoundedCorners(int posX, int posY, int width, int height, in
|
|||||||
|
|
||||||
void cTimeLine::drawCurrentTimeBase(void) {
|
void cTimeLine::drawCurrentTimeBase(void) {
|
||||||
timeBase->Fill(clrTransparent);
|
timeBase->Fill(clrTransparent);
|
||||||
bool nowVisible = myTime->NowVisible();
|
bool nowVisible = timeManager->NowVisible();
|
||||||
if (!nowVisible)
|
if (!nowVisible)
|
||||||
return;
|
return;
|
||||||
int deltaTime = (myTime->GetNow() - myTime->GetStart()) / 60 * geoManager.minutePixel;
|
int deltaTime = (timeManager->GetNow() - timeManager->GetStart()) / 60 * geoManager.minutePixel;
|
||||||
if (config.displayMode == eVertical) {
|
if (config.displayMode == eVertical) {
|
||||||
timeBase->DrawRectangle(cRect(0, deltaTime - 2, timeBase->ViewPort().Width(), 4), theme.Color(clrTimeBase));
|
timeBase->DrawRectangle(cRect(0, deltaTime - 2, timeBase->ViewPort().Width(), 4), theme.Color(clrTimeBase));
|
||||||
} else {
|
} else {
|
||||||
@ -249,7 +249,7 @@ cImage *cTimeLine::createBackgroundImage(int width, int height, tColor clrBgr, t
|
|||||||
}
|
}
|
||||||
|
|
||||||
void cTimeLine::setTimeline() {
|
void cTimeLine::setTimeline() {
|
||||||
int offset = myTime->GetTimelineOffset();
|
int offset = timeManager->GetTimelineOffset();
|
||||||
int xNew, yNew;
|
int xNew, yNew;
|
||||||
if (config.displayMode == eVertical) {
|
if (config.displayMode == eVertical) {
|
||||||
xNew = 0;
|
xNew = 0;
|
||||||
@ -266,7 +266,7 @@ void cTimeLine::setTimeline() {
|
|||||||
void cTimeLine::drawClock() {
|
void cTimeLine::drawClock() {
|
||||||
if (config.displayMode == eVertical)
|
if (config.displayMode == eVertical)
|
||||||
clock->Fill(clrTransparent);
|
clock->Fill(clrTransparent);
|
||||||
cString currentTime = myTime->GetCurrentTime();
|
cString currentTime = timeManager->GetCurrentTime();
|
||||||
const cFont *font = (config.displayMode == eVertical)?fontManager.FontTimeLineTime:fontManager.FontTimeLineTimeHorizontal;
|
const cFont *font = (config.displayMode == eVertical)?fontManager.FontTimeLineTime:fontManager.FontTimeLineTimeHorizontal;
|
||||||
int textHeight = font->Height();
|
int textHeight = font->Height();
|
||||||
int clockTextWidth = font->Width(*currentTime);
|
int clockTextWidth = font->Width(*currentTime);
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
class cTimeLine {
|
class cTimeLine {
|
||||||
private:
|
private:
|
||||||
cMyTime *myTime;
|
cTimeManager *timeManager;
|
||||||
cStyledPixmap *dateViewer;
|
cStyledPixmap *dateViewer;
|
||||||
cPixmap *timeline;
|
cPixmap *timeline;
|
||||||
cStyledPixmap *clock;
|
cStyledPixmap *clock;
|
||||||
@ -18,7 +18,7 @@ private:
|
|||||||
cImage *createBackgroundImage(int width, int height, tColor clrBgr, tColor clrBlend);
|
cImage *createBackgroundImage(int width, int height, tColor clrBgr, tColor clrBlend);
|
||||||
void drawCurrentTimeBase(void);
|
void drawCurrentTimeBase(void);
|
||||||
public:
|
public:
|
||||||
cTimeLine(cMyTime *myTime);
|
cTimeLine(cTimeManager *timeManager);
|
||||||
virtual ~cTimeLine(void);
|
virtual ~cTimeLine(void);
|
||||||
void setTimeline();
|
void setTimeline();
|
||||||
void drawDateViewer();
|
void drawDateViewer();
|
||||||
|
32
timer.c
32
timer.c
@ -3,10 +3,10 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
|
|
||||||
cMyTime::~cMyTime(void) {
|
cTimeManager::~cTimeManager(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
cString cMyTime::printTime(time_t displayTime) {
|
cString cTimeManager::printTime(time_t displayTime) {
|
||||||
struct tm *ts;
|
struct tm *ts;
|
||||||
ts = localtime(&displayTime);
|
ts = localtime(&displayTime);
|
||||||
cString strTime = cString::sprintf("%d.%d-%d:%d.%d", ts->tm_mday, ts->tm_mon+1, ts->tm_hour, ts->tm_min, ts->tm_sec);
|
cString strTime = cString::sprintf("%d.%d-%d:%d.%d", ts->tm_mday, ts->tm_mon+1, ts->tm_hour, ts->tm_min, ts->tm_sec);
|
||||||
@ -14,7 +14,7 @@ cString cMyTime::printTime(time_t displayTime) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void cMyTime::Now() {
|
void cTimeManager::Now() {
|
||||||
t = time(0);
|
t = time(0);
|
||||||
tStart = t;
|
tStart = t;
|
||||||
tStart = GetRounded();
|
tStart = GetRounded();
|
||||||
@ -25,12 +25,12 @@ void cMyTime::Now() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cMyTime::AddStep(int step) {
|
void cTimeManager::AddStep(int step) {
|
||||||
tStart += step*60;
|
tStart += step*60;
|
||||||
tEnd += step*60;
|
tEnd += step*60;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cMyTime::DelStep(int step) {
|
bool cTimeManager::DelStep(int step) {
|
||||||
if ((tStart - step*60)+30*60 < t) {
|
if ((tStart - step*60)+30*60 < t) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -39,7 +39,7 @@ bool cMyTime::DelStep(int step) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cMyTime::SetTime(time_t newTime) {
|
void cTimeManager::SetTime(time_t newTime) {
|
||||||
tStart = newTime;
|
tStart = newTime;
|
||||||
if (config.displayMode == eVertical) {
|
if (config.displayMode == eVertical) {
|
||||||
tEnd = tStart + (geoManager.osdHeight - geoManager.statusHeaderHeight - geoManager.channelHeaderHeight - geoManager.channelGroupsHeight - geoManager.footerHeight)/geoManager.minutePixel*60;
|
tEnd = tStart + (geoManager.osdHeight - geoManager.statusHeaderHeight - geoManager.channelHeaderHeight - geoManager.channelGroupsHeight - geoManager.footerHeight)/geoManager.minutePixel*60;
|
||||||
@ -48,7 +48,7 @@ void cMyTime::SetTime(time_t newTime) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
time_t cMyTime::getPrevPrimetime(time_t current) {
|
time_t cTimeManager::getPrevPrimetime(time_t current) {
|
||||||
tm *st = localtime(¤t);
|
tm *st = localtime(¤t);
|
||||||
if (st->tm_hour < 21) {
|
if (st->tm_hour < 21) {
|
||||||
current -= 24 * 60* 60;
|
current -= 24 * 60* 60;
|
||||||
@ -60,7 +60,7 @@ time_t cMyTime::getPrevPrimetime(time_t current) {
|
|||||||
return primeTime;
|
return primeTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
time_t cMyTime::getNextPrimetime(time_t current){
|
time_t cTimeManager::getNextPrimetime(time_t current){
|
||||||
tm *st = localtime(¤t);
|
tm *st = localtime(¤t);
|
||||||
if (st->tm_hour > 19) {
|
if (st->tm_hour > 19) {
|
||||||
current += 24 * 60* 60;
|
current += 24 * 60* 60;
|
||||||
@ -72,14 +72,14 @@ time_t cMyTime::getNextPrimetime(time_t current){
|
|||||||
return primeTime;
|
return primeTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cMyTime::tooFarInPast(time_t current) {
|
bool cTimeManager::tooFarInPast(time_t current) {
|
||||||
if (current < t) {
|
if (current < t) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
cString cMyTime::GetCurrentTime() {
|
cString cTimeManager::GetCurrentTime() {
|
||||||
char buf[25];
|
char buf[25];
|
||||||
t = time(0);
|
t = time(0);
|
||||||
tm *st = localtime(&t);
|
tm *st = localtime(&t);
|
||||||
@ -92,25 +92,25 @@ cString cMyTime::GetCurrentTime() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cString cMyTime::GetDate() {
|
cString cTimeManager::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 cTimeManager::GetWeekday() {
|
||||||
return WeekDayName(tStart);
|
return WeekDayName(tStart);
|
||||||
}
|
}
|
||||||
|
|
||||||
int cMyTime::GetTimelineOffset() {
|
int cTimeManager::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 cTimeManager::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)
|
||||||
@ -120,14 +120,14 @@ time_t cMyTime::GetRounded() {
|
|||||||
return mktime(rounded);
|
return mktime(rounded);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cMyTime::NowVisible(void) {
|
bool cTimeManager::NowVisible(void) {
|
||||||
if (t > tStart)
|
if (t > tStart)
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void cMyTime::debug() {
|
void cTimeManager::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));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
14
timer.h
14
timer.h
@ -1,18 +1,18 @@
|
|||||||
#ifndef __TVGUIDE_TIMER_H
|
#ifndef __TVGUIDE_TIMEMANAGER_H
|
||||||
#define __TVGUIDE_TIMER_H
|
#define __TVGUIDE_TIMEMANAGER_H
|
||||||
|
|
||||||
#include <vdr/tools.h>
|
#include <vdr/tools.h>
|
||||||
|
|
||||||
// --- cMyTime -------------------------------------------------------------
|
// --- cTimeManager -------------------------------------------------------------
|
||||||
|
|
||||||
class cMyTime {
|
class cTimeManager {
|
||||||
private:
|
private:
|
||||||
time_t t;
|
time_t t;
|
||||||
time_t tStart;
|
time_t tStart;
|
||||||
time_t tEnd;
|
time_t tEnd;
|
||||||
public:
|
public:
|
||||||
cMyTime(){};
|
cTimeManager(){};
|
||||||
virtual ~cMyTime(void);
|
virtual ~cTimeManager(void);
|
||||||
static cString printTime(time_t displayTime);
|
static cString printTime(time_t displayTime);
|
||||||
void Now();
|
void Now();
|
||||||
time_t GetNow() { return t; };
|
time_t GetNow() { return t; };
|
||||||
@ -49,4 +49,4 @@ class cTimeInterval {
|
|||||||
cTimeInterval *Union(cTimeInterval *interval);
|
cTimeInterval *Union(cTimeInterval *interval);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //__TVGUIDE_TIMER_H
|
#endif //__TVGUIDE_TIMEMANAGER_H
|
||||||
|
50
tvguideosd.c
50
tvguideosd.c
@ -20,7 +20,7 @@ cTvGuideOsd::cTvGuideOsd(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cTvGuideOsd::~cTvGuideOsd() {
|
cTvGuideOsd::~cTvGuideOsd() {
|
||||||
delete myTime;
|
delete timeManager;
|
||||||
columns.Clear();
|
columns.Clear();
|
||||||
if (config.displayStatusHeader) {
|
if (config.displayStatusHeader) {
|
||||||
delete statusHeader;
|
delete statusHeader;
|
||||||
@ -52,8 +52,8 @@ void cTvGuideOsd::Show(void) {
|
|||||||
imgCache.CreateCache();
|
imgCache.CreateCache();
|
||||||
}
|
}
|
||||||
osdManager.setBackground();
|
osdManager.setBackground();
|
||||||
myTime = new cMyTime();
|
timeManager = new cTimeManager();
|
||||||
myTime->Now();
|
timeManager->Now();
|
||||||
SwitchTimers.Load(AddDirectory(cPlugin::ConfigDirectory("epgsearch"), "epgsearchswitchtimers.conf"));
|
SwitchTimers.Load(AddDirectory(cPlugin::ConfigDirectory("epgsearch"), "epgsearchswitchtimers.conf"));
|
||||||
recMenuView = new cRecMenuView();
|
recMenuView = new cRecMenuView();
|
||||||
pRemoteTimers = cPluginManager::CallFirstService("RemoteTimers::RefreshTimers-v1.0", NULL);
|
pRemoteTimers = cPluginManager::CallFirstService("RemoteTimers::RefreshTimers-v1.0", NULL);
|
||||||
@ -111,7 +111,7 @@ void cTvGuideOsd::drawOsd() {
|
|||||||
statusHeader->Draw();
|
statusHeader->Draw();
|
||||||
statusHeader->ScaleVideo();
|
statusHeader->ScaleVideo();
|
||||||
}
|
}
|
||||||
timeLine = new cTimeLine(myTime);
|
timeLine = new cTimeLine(timeManager);
|
||||||
timeLine->drawDateViewer();
|
timeLine->drawDateViewer();
|
||||||
timeLine->drawTimeline();
|
timeLine->drawTimeline();
|
||||||
timeLine->drawClock();
|
timeLine->drawClock();
|
||||||
@ -152,7 +152,7 @@ void cTvGuideOsd::readChannels(const cChannel *channelStart) {
|
|||||||
if (channelGroups->IsInLastGroup(channel)) {
|
if (channelGroups->IsInLastGroup(channel)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
cChannelEpg *column = new cChannelEpg(i, channel, myTime);
|
cChannelEpg *column = new cChannelEpg(i, channel, timeManager);
|
||||||
if (column->readGrids()) {
|
if (column->readGrids()) {
|
||||||
columns.Add(column);
|
columns.Add(column);
|
||||||
i++;
|
i++;
|
||||||
@ -252,7 +252,7 @@ void cTvGuideOsd::channelForward() {
|
|||||||
if (channelGroups->IsInLastGroup(channelRight)) {
|
if (channelGroups->IsInLastGroup(channelRight)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
colRight = new cChannelEpg(config.numGrids - 1, channelRight, myTime);
|
colRight = new cChannelEpg(config.numGrids - 1, channelRight, timeManager);
|
||||||
if (colRight->readGrids()) {
|
if (colRight->readGrids()) {
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
@ -308,7 +308,7 @@ void cTvGuideOsd::channelBack() {
|
|||||||
#endif
|
#endif
|
||||||
while (channelLeft = channels->Prev(channelLeft)) {
|
while (channelLeft = channels->Prev(channelLeft)) {
|
||||||
if (!channelLeft->GroupSep()) {
|
if (!channelLeft->GroupSep()) {
|
||||||
colLeft = new cChannelEpg(0, channelLeft, myTime);
|
colLeft = new cChannelEpg(0, channelLeft, timeManager);
|
||||||
if (colLeft->readGrids()) {
|
if (colLeft->readGrids()) {
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
@ -352,14 +352,14 @@ void cTvGuideOsd::channelBack() {
|
|||||||
|
|
||||||
void cTvGuideOsd::timeForward() {
|
void cTvGuideOsd::timeForward() {
|
||||||
bool actionDone = false;
|
bool actionDone = false;
|
||||||
if ( (myTime->GetEnd() - activeGrid->EndTime())/60 < 30 ) {
|
if ( (timeManager->GetEnd() - activeGrid->EndTime())/60 < 30 ) {
|
||||||
ScrollForward();
|
ScrollForward();
|
||||||
actionDone = true;
|
actionDone = true;
|
||||||
}
|
}
|
||||||
cGrid *next = activeGrid->column->getNext(activeGrid);
|
cGrid *next = activeGrid->column->getNext(activeGrid);
|
||||||
if (next) {
|
if (next) {
|
||||||
if ( (next->EndTime() < myTime->GetEnd())
|
if ( (next->EndTime() < timeManager->GetEnd())
|
||||||
|| ( (myTime->GetEnd() - next->StartTime())/60 > 30 ) ) {
|
|| ( (timeManager->GetEnd() - next->StartTime())/60 > 30 ) ) {
|
||||||
setNextActiveGrid(next);
|
setNextActiveGrid(next);
|
||||||
actionDone = true;
|
actionDone = true;
|
||||||
}
|
}
|
||||||
@ -371,7 +371,7 @@ void cTvGuideOsd::timeForward() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void cTvGuideOsd::ScrollForward() {
|
void cTvGuideOsd::ScrollForward() {
|
||||||
myTime->AddStep(config.stepMinutes);
|
timeManager->AddStep(config.stepMinutes);
|
||||||
timeLine->drawDateViewer();
|
timeLine->drawDateViewer();
|
||||||
timeLine->drawClock();
|
timeLine->drawClock();
|
||||||
timeLine->setTimeline();
|
timeLine->setTimeline();
|
||||||
@ -384,14 +384,14 @@ void cTvGuideOsd::ScrollForward() {
|
|||||||
|
|
||||||
void cTvGuideOsd::timeBack() {
|
void cTvGuideOsd::timeBack() {
|
||||||
bool actionDone = false;
|
bool actionDone = false;
|
||||||
if ( (activeGrid->StartTime() - myTime->GetStart())/60 < 30 ) {
|
if ( (activeGrid->StartTime() - timeManager->GetStart())/60 < 30 ) {
|
||||||
ScrollBack();
|
ScrollBack();
|
||||||
actionDone = true;
|
actionDone = true;
|
||||||
}
|
}
|
||||||
cGrid *prev = activeGrid->column->getPrev(activeGrid);
|
cGrid *prev = activeGrid->column->getPrev(activeGrid);
|
||||||
if (prev) {
|
if (prev) {
|
||||||
if ( (prev->StartTime() > myTime->GetStart())
|
if ( (prev->StartTime() > timeManager->GetStart())
|
||||||
|| ( (prev->EndTime() - myTime->GetStart())/60 > 30 )
|
|| ( (prev->EndTime() - timeManager->GetStart())/60 > 30 )
|
||||||
|| ( prev->isFirst()) ) {
|
|| ( prev->isFirst()) ) {
|
||||||
setNextActiveGrid(prev);
|
setNextActiveGrid(prev);
|
||||||
actionDone = true;
|
actionDone = true;
|
||||||
@ -404,7 +404,7 @@ void cTvGuideOsd::timeBack() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void cTvGuideOsd::ScrollBack() {
|
void cTvGuideOsd::ScrollBack() {
|
||||||
bool tooFarInPast = myTime->DelStep(config.stepMinutes);
|
bool tooFarInPast = timeManager->DelStep(config.stepMinutes);
|
||||||
if (tooFarInPast)
|
if (tooFarInPast)
|
||||||
return;
|
return;
|
||||||
timeLine->drawDateViewer();
|
timeLine->drawDateViewer();
|
||||||
@ -628,38 +628,38 @@ void cTvGuideOsd::processNumKey(int numKey) {
|
|||||||
void cTvGuideOsd::TimeJump(int mode) {
|
void cTvGuideOsd::TimeJump(int mode) {
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case 1: {
|
case 1: {
|
||||||
bool tooFarInPast = myTime->DelStep(config.bigStepHours*60);
|
bool tooFarInPast = timeManager->DelStep(config.bigStepHours*60);
|
||||||
if (tooFarInPast)
|
if (tooFarInPast)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3: {
|
case 3: {
|
||||||
myTime->AddStep(config.bigStepHours*60);
|
timeManager->AddStep(config.bigStepHours*60);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4: {
|
case 4: {
|
||||||
bool tooFarInPast = myTime->DelStep(config.hugeStepHours*60);
|
bool tooFarInPast = timeManager->DelStep(config.hugeStepHours*60);
|
||||||
if (tooFarInPast)
|
if (tooFarInPast)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 6: {
|
case 6: {
|
||||||
myTime->AddStep(config.hugeStepHours*60);
|
timeManager->AddStep(config.hugeStepHours*60);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 7: {
|
case 7: {
|
||||||
cMyTime primeChecker;
|
cTimeManager primeChecker;
|
||||||
primeChecker.Now();
|
primeChecker.Now();
|
||||||
time_t prevPrime = primeChecker.getPrevPrimetime(myTime->GetStart());
|
time_t prevPrime = primeChecker.getPrevPrimetime(timeManager->GetStart());
|
||||||
if (primeChecker.tooFarInPast(prevPrime))
|
if (primeChecker.tooFarInPast(prevPrime))
|
||||||
return;
|
return;
|
||||||
myTime->SetTime(prevPrime);
|
timeManager->SetTime(prevPrime);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 9: {
|
case 9: {
|
||||||
cMyTime primeChecker;
|
cTimeManager primeChecker;
|
||||||
time_t nextPrime = primeChecker.getNextPrimetime(myTime->GetStart());
|
time_t nextPrime = primeChecker.getNextPrimetime(timeManager->GetStart());
|
||||||
myTime->SetTime(nextPrime);
|
timeManager->SetTime(nextPrime);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
class cTvGuideOsd : public cOsdObject {
|
class cTvGuideOsd : public cOsdObject {
|
||||||
private:
|
private:
|
||||||
cMyTime *myTime;
|
cTimeManager *timeManager;
|
||||||
cList<cChannelEpg> columns;
|
cList<cChannelEpg> columns;
|
||||||
cGrid *activeGrid;
|
cGrid *activeGrid;
|
||||||
cStatusHeader *statusHeader;
|
cStatusHeader *statusHeader;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user