mirror of
https://projects.vdr-developer.org/git/vdr-plugin-tvguide.git
synced 2023-10-05 15:01:48 +02:00
Refactor cRecMenuTimeline
This commit is contained in:
parent
1f1498a734
commit
0289731158
@ -2554,6 +2554,8 @@ cRecMenuItemTimelineTimer::cRecMenuItemTimelineTimer(const cTimer *timer, time_t
|
|||||||
selectable = true;
|
selectable = true;
|
||||||
this->active = active;
|
this->active = active;
|
||||||
height = geoManager.osdHeight / 16;
|
height = geoManager.osdHeight / 16;
|
||||||
|
if (active)
|
||||||
|
setActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
cRecMenuItemTimelineTimer::~cRecMenuItemTimelineTimer(void) {
|
cRecMenuItemTimelineTimer::~cRecMenuItemTimelineTimer(void) {
|
||||||
|
40
recmenus.c
40
recmenus.c
@ -1292,16 +1292,21 @@ cRecMenuSearchConfirmTimer::cRecMenuSearchConfirmTimer(const cEvent *event, eRec
|
|||||||
******************************************************************************************/
|
******************************************************************************************/
|
||||||
|
|
||||||
// --- cRecMenuTimeline ---------------------------------------------------------
|
// --- cRecMenuTimeline ---------------------------------------------------------
|
||||||
cRecMenuTimeline::cRecMenuTimeline(cTVGuideTimerConflicts *timerConflicts) {
|
cRecMenuTimeline::cRecMenuTimeline(cTVGuideTimerConflicts *timerConflicts) { // OK
|
||||||
|
SetWidthPercent(90);
|
||||||
|
|
||||||
|
numTimersToday = 0;
|
||||||
this->timerConflicts = timerConflicts;
|
this->timerConflicts = timerConflicts;
|
||||||
SetStartStop();
|
SetStartStop();
|
||||||
conflictsToday = timerConflicts->GetConflictsBetween(timeStart, timeStop);
|
conflictsToday = timerConflicts->GetConflictsBetween(timeStart, timeStop);
|
||||||
GetTimersForDay();
|
GetTimersForDay();
|
||||||
SetWidthPercent(90);
|
|
||||||
header = new cRecMenuItemTimelineHeader(timeStart, numTimersToday, conflictsToday);
|
header = new cRecMenuItemTimelineHeader(timeStart, numTimersToday, conflictsToday);
|
||||||
SetHeader(header);
|
AddHeader(header);
|
||||||
cRecMenuItem *footer = new cRecMenuItemButton(tr("Close"), rmsClose, false, true);
|
|
||||||
SetFooter(footer);
|
footer = new cRecMenuItemButton(tr("Close"), rmsClose, false, true);
|
||||||
|
AddFooter(footer);
|
||||||
|
|
||||||
SetTimers();
|
SetTimers();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1310,10 +1315,9 @@ void cRecMenuTimeline::SetStartStop(void) {
|
|||||||
tm *timeStruct = localtime(&now);
|
tm *timeStruct = localtime(&now);
|
||||||
timeStart = now - timeStruct->tm_hour * 3600 - timeStruct->tm_min * 60 - timeStruct->tm_sec;
|
timeStart = now - timeStruct->tm_hour * 3600 - timeStruct->tm_min * 60 - timeStruct->tm_sec;
|
||||||
today = timeStart;
|
today = timeStart;
|
||||||
timeStop = timeStart + 24*3600 - 1;
|
timeStop = timeStart + 24 * 3600 - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void cRecMenuTimeline::GetTimersForDay(void) {
|
void cRecMenuTimeline::GetTimersForDay(void) {
|
||||||
timersToday.clear();
|
timersToday.clear();
|
||||||
#if VDRVERSNUM >= 20301
|
#if VDRVERSNUM >= 20301
|
||||||
@ -1351,40 +1355,36 @@ void cRecMenuTimeline::SetTimers(void) {
|
|||||||
AddMenuItem(new cRecMenuItemTimelineTimer(NULL, 0, 0, conflictsToday, header, false));
|
AddMenuItem(new cRecMenuItemTimelineTimer(NULL, 0, 0, conflictsToday, header, false));
|
||||||
footer->setActive();
|
footer->setActive();
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i<numTimersToday; i++) {
|
for (int i = 0; i < numTimersToday; i++) {
|
||||||
cRecMenuItemTimelineTimer *item = new cRecMenuItemTimelineTimer(timersToday[i], timeStart, timeStop, conflictsToday, header, false);
|
if (!AddMenuItemInitial(new cRecMenuItemTimelineTimer(timersToday[i], timeStart, timeStop, conflictsToday, header, (i == 0) ? true : false)))
|
||||||
if (i==0)
|
|
||||||
item->setActive();
|
|
||||||
if (!AddMenuItemInitial(item))
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
footer->setInactive();
|
footer->setInactive();
|
||||||
}
|
}
|
||||||
|
|
||||||
CalculateHeight();
|
CalculateHeight();
|
||||||
CreatePixmap();
|
CreatePixmap();
|
||||||
Arrange();
|
Arrange();
|
||||||
}
|
}
|
||||||
|
|
||||||
void cRecMenuTimeline::PrevDay(void) {
|
void cRecMenuTimeline::PrevDay(void) {
|
||||||
if ((timeStart - 3600*24) < today)
|
if ((timeStart - 3600 * 24) < today)
|
||||||
return;
|
return;
|
||||||
timeStart -= 3600*24;
|
timeStart -= 3600 * 24;
|
||||||
timeStop -= 3600*24;
|
timeStop -= 3600 * 24;
|
||||||
SetTimers();
|
SetTimers();
|
||||||
Display();
|
Display();
|
||||||
}
|
}
|
||||||
|
|
||||||
void cRecMenuTimeline::NextDay(void) {
|
void cRecMenuTimeline::NextDay(void) {
|
||||||
timeStart += 3600*24;
|
timeStart += 3600 * 24;
|
||||||
timeStop += 3600*24;
|
timeStop += 3600 * 24;
|
||||||
SetTimers();
|
SetTimers();
|
||||||
Display();
|
Display();
|
||||||
}
|
}
|
||||||
|
|
||||||
cRecMenuItem *cRecMenuTimeline::GetMenuItem(int number) {
|
cRecMenuItem *cRecMenuTimeline::GetMenuItem(int number) {
|
||||||
if (number < 0)
|
if ((number < 0) || (number >= numTimersToday))
|
||||||
return NULL;
|
|
||||||
if (number >= numTimersToday)
|
|
||||||
return NULL;
|
return NULL;
|
||||||
return new cRecMenuItemTimelineTimer(timersToday[number], timeStart, timeStop, conflictsToday, header, false);
|
return new cRecMenuItemTimelineTimer(timersToday[number], timeStart, timeStop, conflictsToday, header, false);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user