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