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