mirror of
https://projects.vdr-developer.org/git/vdr-plugin-tvguide.git
synced 2023-10-05 15:01:48 +02:00
Refactor cRecMenuEditTimer
This commit is contained in:
parent
e4ef6c4ee5
commit
37db3b185c
53
recmenus.c
53
recmenus.c
@ -409,23 +409,21 @@ cRecMenuConfirmRerunUsed::cRecMenuConfirmRerunUsed(const cEvent *original, const
|
||||
}
|
||||
|
||||
// --- cRecMenuEditTimer ---------------------------------------------------------
|
||||
cRecMenuEditTimer::cRecMenuEditTimer(const cTimer *timer, eRecMenuState nextState) {
|
||||
SetWidthPercent(70);
|
||||
cRecMenuEditTimer::cRecMenuEditTimer(const cTimer *timer, eRecMenuState nextState) { // OK
|
||||
if (!timer)
|
||||
return;
|
||||
originalTimer = timer;
|
||||
cString title("");
|
||||
cString channelName("");
|
||||
if (timer->Event())
|
||||
title = timer->Event()->Title();
|
||||
if (timer->Channel())
|
||||
channelName = timer->Channel()->Name();
|
||||
cString infoText = cString::sprintf("%s:\n %s, %s", tr("Edit Timer"), *title, *channelName);
|
||||
cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*infoText, true);
|
||||
infoItem->CalculateHeight(width - 2 * border);
|
||||
AddMenuItemInitial(infoItem);
|
||||
|
||||
SetWidthPercent(70);
|
||||
originalTimer = timer;
|
||||
timerActive = false;
|
||||
|
||||
const cString line1 = tr("Edit Timer");
|
||||
const cString line2 = (timer->Event() && timer->Event()->Title()) ? timer->Event()->Title() : "";
|
||||
const cString line3 = (timer->Channel() && timer->Channel()->Name()) ? timer->Channel()->Name() : "";
|
||||
|
||||
AddHeader(new cRecMenuItemInfo(*line1, 3, *line2, *line3, "", width - 2 * border, true));
|
||||
AddFooter(new cRecMenuItemButtonYesNo(tr("Save"), tr("Cancel"), nextState, (nextState == rmsTimelineTimerSave) ? rmsTimeline : rmsClose, false));
|
||||
|
||||
if (config.useRemoteTimers && pRemoteTimers) {
|
||||
RemoteTimers_GetMatch_v1_0 rtMatch;
|
||||
rtMatch.event = timer->Event();
|
||||
@ -444,23 +442,18 @@ cRecMenuEditTimer::cRecMenuEditTimer(const cTimer *timer, eRecMenuState nextStat
|
||||
lifetime = timer->Lifetime();
|
||||
strncpy(folder, GetDirectoryFromTimer(timer->File()).c_str(), TEXTINPUTLENGTH);
|
||||
|
||||
AddMenuItemInitial(new cRecMenuItemBool(tr("Timer Active"), true, &timerActive));
|
||||
AddMenuItemInitial(new cRecMenuItemInt(tr("Priority"), 0, MAXPRIORITY, false, &prio));
|
||||
AddMenuItemInitial(new cRecMenuItemInt(tr("Lifetime"), 0, MAXLIFETIME, false, &lifetime));
|
||||
AddMenuItemInitial(new cRecMenuItemDay(tr("Day"), false, &day));
|
||||
AddMenuItemInitial(new cRecMenuItemTime(tr("Timer start time"), false, &start));
|
||||
AddMenuItemInitial(new cRecMenuItemTime(tr("Timer stop time"), false, &stop));
|
||||
cString fileInfo = cString::sprintf("%s:\n%s", tr("Timer File"), timer->File());
|
||||
cRecMenuItemInfo *fileInfoItem = new cRecMenuItemInfo(*fileInfo, false);
|
||||
fileInfoItem->CalculateHeight(width - 2 * border);
|
||||
AddMenuItemInitial(fileInfoItem);
|
||||
AddMenuItemInitial(new cRecMenuItemSelectDirectory(tr("New Folder"), std::string(folder), false, folder));
|
||||
if (nextState == rmsTimelineTimerSave) {
|
||||
AddMenuItemInitial(new cRecMenuItemButton(tr("Delete Timer"), rmsTimelineTimerDelete, false, false));
|
||||
AddMenuItemInitial(new cRecMenuItemButtonYesNo(tr("Save"), tr("Cancel"), nextState, rmsTimeline, false));
|
||||
} else {
|
||||
AddMenuItemInitial(new cRecMenuItemButtonYesNo(tr("Save"), tr("Cancel"), nextState, rmsClose, false));
|
||||
}
|
||||
AddMenuItem(new cRecMenuItemBool(tr("Timer Active"), true, &timerActive));
|
||||
AddMenuItem(new cRecMenuItemInt(tr("Priority"), 0, MAXPRIORITY, false, &prio));
|
||||
AddMenuItem(new cRecMenuItemInt(tr("Lifetime"), 0, MAXLIFETIME, false, &lifetime));
|
||||
AddMenuItem(new cRecMenuItemDay(tr("Day"), false, &day));
|
||||
AddMenuItem(new cRecMenuItemTime(tr("Timer start time"), false, &start));
|
||||
AddMenuItem(new cRecMenuItemTime(tr("Timer stop time"), false, &stop));
|
||||
AddMenuItem(new cRecMenuItemInfo(tr("Timer File"), 2, timer->File() ? timer->File() : "", "", "", width - 2 * border, false));
|
||||
AddMenuItem(new cRecMenuItemSelectDirectory(tr("New Folder"), std::string(folder), false, folder));
|
||||
|
||||
if (nextState == rmsTimelineTimerSave)
|
||||
AddMenuItem(new cRecMenuItemButton(tr("Delete Timer"), rmsTimelineTimerDelete, false));
|
||||
|
||||
CalculateHeight();
|
||||
CreatePixmap();
|
||||
Arrange();
|
||||
|
Loading…
Reference in New Issue
Block a user