summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkamel5 <vdr.kamel5 (at) gmx (dot) net>2019-11-09 12:05:47 +0100
committerkamel5 <vdr.kamel5 (at) gmx (dot) net>2022-06-18 17:03:15 +0200
commitec7d45f96004275b18254f6958823a18a0ec8951 (patch)
treed8dd1b51e2f7ea254e6177b123cb57fc90a84e04
parent0837137ea813b11142756b0d8028cf3f36f098d5 (diff)
downloadvdr-plugin-tvguide-ec7d45f96004275b18254f6958823a18a0ec8951.tar.gz
vdr-plugin-tvguide-ec7d45f96004275b18254f6958823a18a0ec8951.tar.bz2
Refactor cRecMenuRerunResults
-rw-r--r--recmenus.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/recmenus.c b/recmenus.c
index 4e20d03..c2f937a 100644
--- a/recmenus.c
+++ b/recmenus.c
@@ -321,28 +321,26 @@ cRecMenuNoTimerConflict::cRecMenuNoTimerConflict(void) { // OK
}
// --- cRecMenuRerunResults ---------------------------------------------------------
-cRecMenuRerunResults::cRecMenuRerunResults(const cEvent *original, const cEvent **reruns, int numReruns) {
- this->reruns = reruns;
- this->numReruns = numReruns;
+cRecMenuRerunResults::cRecMenuRerunResults(const cEvent *original, const cEvent **reruns, int numReruns) { // OK
SetWidthPercent(70);
+
+ this->reruns = reruns;
this->numReruns = numReruns;
- cString message1 = tr("reruns for");
- cString message2 = tr("rerun for");
- cString message3 = tr("found");
- cString infoText = cString::sprintf("%d %s:\n\"%s\" %s", numReruns, (numReruns>1)?(*message1):(*message2), original->Title(), *message3);
- cRecMenuItem *infoItem = new cRecMenuItemInfo(*infoText, true);
- infoItem->CalculateHeight(width - 2 * border);
- SetHeader(infoItem);
-
- cRecMenuItem *button = new cRecMenuItemButton(tr("Ignore reruns"), rmsTimerConflictIgnoreReruns, false);
- SetFooter(button);
-
+
+ const cString line1 = cString::sprintf("%d %s:", numReruns, (numReruns > 1) ? tr("reruns for") : tr("rerun for"));
+ const cString line2 = cString::sprintf("\"%s\"", original->Title());
+ const cString line3 = tr("found");
+
+ AddHeader(new cRecMenuItemInfo(*line1, 3, *line2, *line3, "", width - 2 * border, true));
+ AddFooter(new cRecMenuItemButton(tr("Ignore reruns"), rmsTimerConflictIgnoreReruns, false));
+
if (reruns && (numReruns > 0)) {
- for (int i=0; i<numReruns; i++) {
- if (!AddMenuItemInitial(new cRecMenuItemEvent(reruns[i], rmsSearchShowInfo, rmsTimerConflictRecordRerun, (i==0)?true:false)))
+ for (int i = 0; i < numReruns; i++) {
+ if (!AddMenuItemInitial(new cRecMenuItemEvent(reruns[i], rmsSearchShowInfo, rmsTimerConflictRecordRerun, (i == 0) ? true : false)))
break;
}
}
+
CalculateHeight();
CreatePixmap();
Arrange();
@@ -361,8 +359,9 @@ int cRecMenuRerunResults::GetTotalNumMenuItems(void) {
}
const cEvent *cRecMenuRerunResults::GetRerunEvent(void) {
- cRecMenuItemEvent *activeItem = dynamic_cast<cRecMenuItemEvent*>(GetActiveMenuItem());
- return activeItem->GetEventValue();
+ if (cRecMenuItemEvent *activeItem = dynamic_cast<cRecMenuItemEvent*>(GetActiveMenuItem()))
+ return activeItem->GetEventValue();
+ return NULL;
}
// --- cRecMenuNoRerunsFound ---------------------------------------------------------