Refactor cRecMenuConfirmRerunUsed

This commit is contained in:
kamel5 2019-11-09 13:06:00 +01:00
parent 51b1896c6d
commit e4ef6c4ee5

View File

@ -380,33 +380,29 @@ cRecMenuNoRerunsFound::cRecMenuNoRerunsFound(cString searchString) { // OK
} }
// --- cRecMenuConfirmRerunUsed --------------------------------------------------------- // --- cRecMenuConfirmRerunUsed ---------------------------------------------------------
cRecMenuConfirmRerunUsed::cRecMenuConfirmRerunUsed(const cEvent *original, const cEvent *replace) { cRecMenuConfirmRerunUsed::cRecMenuConfirmRerunUsed(const cEvent *original, const cEvent *replace) { // OK
SetWidthPercent(70); SetWidthPercent(70);
const cChannels *channels = NULL;
#if VDRVERSNUM >= 20301 #if VDRVERSNUM >= 20301
{
LOCK_CHANNELS_READ; LOCK_CHANNELS_READ;
const cString channelOrig = Channels->GetByChannelID(original->ChannelID())->Name(); channels = Channels;
const cString channelReplace = Channels->GetByChannelID(replace->ChannelID())->Name(); }
#else #else
const cString channelOrig = Channels.GetByChannelID(original->ChannelID())->Name(); channels = &Channels;
const cString channelReplace = Channels.GetByChannelID(replace->ChannelID())->Name();
#endif #endif
cString message1 = tr("Timer for"); const cString channelOrig = channels->GetByChannelID(original->ChannelID())->Name();
cString message2 = tr("replaced by rerun"); const cString channelReplace = channels->GetByChannelID(replace->ChannelID())->Name();
cString text = cString::sprintf("%s\n\"%s\", %s %s, %s\n%s\n\"%s\", %s %s, %s",
*message1, const cString line1 = tr("Timer for");
original->Title(), const cString line2 = *cString::sprintf("\"%s\", %s %s, %s", original->Title(), *original->GetDateString(), *original->GetTimeString(), *channelOrig);
*original->GetDateString(), const cString line3 = tr("replaced by rerun");
*original->GetTimeString(), const cString line4 = *cString::sprintf("\"%s\", %s %s, %s", replace->Title(), *replace->GetDateString(), *replace->GetTimeString(), *channelReplace);
*channelOrig,
*message2, AddHeader(new cRecMenuItemInfo(*line1, 4, *line2, *line3, *line4, width - 2 * border));
replace->Title(), AddFooter(new cRecMenuItemButton(tr("OK"), rmsTimerConflicts, true, true));
*replace->GetDateString(),
*replace->GetTimeString(),
*channelReplace);
cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*text);
infoItem->CalculateHeight(width - 2 * border);
AddMenuItem(infoItem);
AddMenuItem(new cRecMenuItemButton(tr("OK"), rmsTimerConflicts, true, true));
CalculateHeight(); CalculateHeight();
CreatePixmap(); CreatePixmap();
Arrange(); Arrange();