Refactor cRecMenuAskDeleteTimer

This commit is contained in:
kamel5 2019-11-09 11:31:38 +01:00
parent a4294b1f54
commit 56cab4a666
1 changed files with 15 additions and 12 deletions

View File

@ -170,23 +170,26 @@ cRecMenuConfirmDeleteTimer::cRecMenuConfirmDeleteTimer(const cEvent *event) { //
}
// --- cRecMenuAskDeleteTimer ---------------------------------------------------------
cRecMenuAskDeleteTimer::cRecMenuAskDeleteTimer(const cEvent *event) {
cRecMenuAskDeleteTimer::cRecMenuAskDeleteTimer(const cEvent *event) { // OK
SetWidthPercent(50);
const cChannels *channels = NULL;
#if VDRVERSNUM >= 20301
{
LOCK_CHANNELS_READ;
const cString channelName = Channels->GetByChannelID(event->ChannelID())->Name();
channels = Channels;
}
#else
const cString channelName = Channels.GetByChannelID(event->ChannelID())->Name();
channels = &Channels;
#endif
cString text = cString::sprintf("%s \"%s, %s\" %s",
tr("Timer"),
*channelName,
event->Title(),
tr("still recording - really delete?"));
cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*text);
infoItem->CalculateHeight(width - 4 * border);
AddMenuItem(infoItem);
AddMenuItem(new cRecMenuItemButtonYesNo(tr("Yes"), tr("No"), rmsDeleteTimerConfirmation, rmsClose, true));
const cString channelName = channels->GetByChannelID(event->ChannelID())->Name();
const cString line1 = tr("Timer");
const cString line3 = (event && event->Title()) ? cString::sprintf("\"%s\"", event->Title()) : "";
const cString line4 = tr("still recording - really delete?");
AddHeader(new cRecMenuItemInfo(*line1, 4, *channelName, *line3, *line4, width - 2 * border));
AddFooter(new cRecMenuItemButtonYesNo(tr("Yes"), tr("No"), rmsDeleteTimerConfirmation, rmsClose, true));
CalculateHeight();
CreatePixmap();
Arrange();