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