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::cRecMenuEditTimer(const cTimer *timer, eRecMenuState nextState) {
|
cRecMenuEditTimer::cRecMenuEditTimer(const cTimer *timer, eRecMenuState nextState) { // OK
|
||||||
SetWidthPercent(70);
|
|
||||||
if (!timer)
|
if (!timer)
|
||||||
return;
|
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;
|
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) {
|
if (config.useRemoteTimers && pRemoteTimers) {
|
||||||
RemoteTimers_GetMatch_v1_0 rtMatch;
|
RemoteTimers_GetMatch_v1_0 rtMatch;
|
||||||
rtMatch.event = timer->Event();
|
rtMatch.event = timer->Event();
|
||||||
@ -444,23 +442,18 @@ cRecMenuEditTimer::cRecMenuEditTimer(const cTimer *timer, eRecMenuState nextStat
|
|||||||
lifetime = timer->Lifetime();
|
lifetime = timer->Lifetime();
|
||||||
strncpy(folder, GetDirectoryFromTimer(timer->File()).c_str(), TEXTINPUTLENGTH);
|
strncpy(folder, GetDirectoryFromTimer(timer->File()).c_str(), TEXTINPUTLENGTH);
|
||||||
|
|
||||||
AddMenuItemInitial(new cRecMenuItemBool(tr("Timer Active"), true, &timerActive));
|
AddMenuItem(new cRecMenuItemBool(tr("Timer Active"), true, &timerActive));
|
||||||
AddMenuItemInitial(new cRecMenuItemInt(tr("Priority"), 0, MAXPRIORITY, false, &prio));
|
AddMenuItem(new cRecMenuItemInt(tr("Priority"), 0, MAXPRIORITY, false, &prio));
|
||||||
AddMenuItemInitial(new cRecMenuItemInt(tr("Lifetime"), 0, MAXLIFETIME, false, &lifetime));
|
AddMenuItem(new cRecMenuItemInt(tr("Lifetime"), 0, MAXLIFETIME, false, &lifetime));
|
||||||
AddMenuItemInitial(new cRecMenuItemDay(tr("Day"), false, &day));
|
AddMenuItem(new cRecMenuItemDay(tr("Day"), false, &day));
|
||||||
AddMenuItemInitial(new cRecMenuItemTime(tr("Timer start time"), false, &start));
|
AddMenuItem(new cRecMenuItemTime(tr("Timer start time"), false, &start));
|
||||||
AddMenuItemInitial(new cRecMenuItemTime(tr("Timer stop time"), false, &stop));
|
AddMenuItem(new cRecMenuItemTime(tr("Timer stop time"), false, &stop));
|
||||||
cString fileInfo = cString::sprintf("%s:\n%s", tr("Timer File"), timer->File());
|
AddMenuItem(new cRecMenuItemInfo(tr("Timer File"), 2, timer->File() ? timer->File() : "", "", "", width - 2 * border, false));
|
||||||
cRecMenuItemInfo *fileInfoItem = new cRecMenuItemInfo(*fileInfo, false);
|
AddMenuItem(new cRecMenuItemSelectDirectory(tr("New Folder"), std::string(folder), false, folder));
|
||||||
fileInfoItem->CalculateHeight(width - 2 * border);
|
|
||||||
AddMenuItemInitial(fileInfoItem);
|
if (nextState == rmsTimelineTimerSave)
|
||||||
AddMenuItemInitial(new cRecMenuItemSelectDirectory(tr("New Folder"), std::string(folder), false, folder));
|
AddMenuItem(new cRecMenuItemButton(tr("Delete Timer"), rmsTimelineTimerDelete, false));
|
||||||
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));
|
|
||||||
}
|
|
||||||
CalculateHeight();
|
CalculateHeight();
|
||||||
CreatePixmap();
|
CreatePixmap();
|
||||||
Arrange();
|
Arrange();
|
||||||
|
Loading…
Reference in New Issue
Block a user