diff options
author | Klaus Schmidinger <kls (at) cadsoft (dot) de> | 2005-03-20 18:00:00 +0100 |
---|---|---|
committer | Klaus Schmidinger <kls (at) cadsoft (dot) de> | 2005-03-20 18:00:00 +0100 |
commit | 782b517c51eaa6d2641fe9b6801afdad50be8586 (patch) | |
tree | 0d7b59865417ded6a8dfcb22b97ad2e32260982a /menuitems.c | |
parent | 05402c740765e6e0ca2aaf1760c77d9e3d3ed5a5 (diff) | |
download | vdr-patch-lnbsharing-782b517c51eaa6d2641fe9b6801afdad50be8586.tar.gz vdr-patch-lnbsharing-782b517c51eaa6d2641fe9b6801afdad50be8586.tar.bz2 |
Version 1.3.23vdr-1.3.23
- The setup option "DVB/Video display format" is now only available if "Video format"
is set to "4:3" (suggested by Mikko Salo).
- Updated the Russian OSD texts (thanks to Vyacheslav Dikonov).
- Dropped CA support for the old '-icam' firmware.
- Updated the Finnish OSD texts (thanks to Rolf Ahrenberg).
- Updated the Swedish OSD texts (thanks to Tomas Prybil).
- Fixed a few French OSD texts that were in the wrong place.
- Improved matching timers to EPG events, especially in case there are several events
with the same VPS time.
- Fixed cDolbyRepacker to allow recording ProSieben HD broadcasts (thanks to Reinhard
Nissl).
- Fixed cDvbDevice::SetVideoDisplayFormat() in case of 16:9 (thanks to Marco Schlüßler).
- The running status of a VPS event is now only taken seriously if that event has been
seen within the last 30 seconds - otherwise recording is done as if no VPS was
available.
- The day of a timer is now stored as a full date in ISO notation ("YYYY-MM-DD") in
'timers.conf' and for the result of the SVDRP command LSTT (based in parts on a
patch by Roman Krenický).
- Some fixes to avoid compiler warnings in gcc 4.0 (thanks to Ville Skyttä for reporting
these).
- Single shot timers are now reliably deleted when they have expired.
- Fixed setting the colored button help after deleting a recording in case the next
menu entry is a directory (thanks to Steffen Beyer).
- Improved falling back to normal recording if the VPS data hasn't been seen for more
than 30 seconds.
- Added a missing cMutexLock to cRemote::HasKeys() (thanks to Wolfgang Rohdewald).
- All log entries regarding timers now contain a short description of the timer.
Diffstat (limited to 'menuitems.c')
-rw-r--r-- | menuitems.c | 202 |
1 files changed, 91 insertions, 111 deletions
diff --git a/menuitems.c b/menuitems.c index 9b86db4..18b001e 100644 --- a/menuitems.c +++ b/menuitems.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menuitems.c 1.21 2004/11/21 13:24:10 kls Exp $ + * $Id: menuitems.c 1.22 2005/03/19 15:33:34 kls Exp $ */ #include "menuitems.h" @@ -535,117 +535,35 @@ eOSState cMenuEditTranItem::ProcessKey(eKeys Key) return state; } -// --- cMenuEditDayItem ------------------------------------------------------ - -int cMenuEditDayItem::days[] ={ cTimer::ParseDay("M------"), - cTimer::ParseDay("-T-----"), - cTimer::ParseDay("--W----"), - cTimer::ParseDay("---T---"), - cTimer::ParseDay("----F--"), - cTimer::ParseDay("-----S-"), - cTimer::ParseDay("------S"), - cTimer::ParseDay("MTWTF--"), - cTimer::ParseDay("MTWTFS-"), - cTimer::ParseDay("MTWTFSS"), - cTimer::ParseDay("-----SS"), - 0 }; - -cMenuEditDayItem::cMenuEditDayItem(const char *Name, int *Value) -:cMenuEditIntItem(Name, Value, -INT_MAX, 31) -{ - d = -1; - md = 0; - if (*value < 0) { - int n = 0; - while (days[n]) { - if (days[n] == *value) { - d = n; - break; - } - n++; - } - } - Set(); -} - -void cMenuEditDayItem::Set(void) -{ - SetValue(cTimer::PrintDay(*value)); -} +// --- cMenuEditDateItem ----------------------------------------------------- -eOSState cMenuEditDayItem::ProcessKey(eKeys Key) +static int ParseWeekDays(const char *s) { - switch (Key) { - case kLeft|k_Repeat: - case kLeft: if (d > 0) - *value = days[--d]; - else if (d == 0) { - *value = 31; - d = -1; - } - else if (*value == 1) { - d = sizeof(days) / sizeof(int) - 2; - *value = days[d]; - } - else - return cMenuEditIntItem::ProcessKey(Key); - Set(); - break; - case kRight|k_Repeat: - case kRight: if (d >= 0) { - *value = days[++d]; - if (*value == 0) { - *value = 1; - d = -1; - } - } - else if (*value == 31) { - d = 0; - *value = days[d]; - } - else - return cMenuEditIntItem::ProcessKey(Key); - Set(); - break; - default: { - if (d >= 0) { - if (k1 <= Key && Key <= k7) { - int v = *value ^ (1 << (Key - k1)); - if ((v & 0xFF) != 0) { - *value = v; // can't let this become all 0 - Set(); - } - break; - } - } - int v = *value; - eOSState result = cMenuEditIntItem::ProcessKey(Key); - if (result == osContinue && Key == k0) { - if (d >= 0) { - *value = md ? md : cTimer::GetMDay(time(NULL)); - md = 0; - d = -1; - Set(); - } - else if (*value == 0 || *value == v) { - md = v; - d = cTimer::GetWDayFromMDay(v); - *value = days[d]; - Set(); - } - } - return result; - } - } - return osContinue; + time_t day; + int weekdays; + return cTimer::ParseDay(s, day, weekdays) ? weekdays : 0; } -// --- cMenuEditDateItem ----------------------------------------------------- +int cMenuEditDateItem::days[] = { ParseWeekDays("M------"), + ParseWeekDays("-T-----"), + ParseWeekDays("--W----"), + ParseWeekDays("---T---"), + ParseWeekDays("----F--"), + ParseWeekDays("-----S-"), + ParseWeekDays("------S"), + ParseWeekDays("MTWTF--"), + ParseWeekDays("MTWTFS-"), + ParseWeekDays("MTWTFSS"), + ParseWeekDays("-----SS"), + 0 }; -cMenuEditDateItem::cMenuEditDateItem(const char *Name, time_t *Value) +cMenuEditDateItem::cMenuEditDateItem(const char *Name, time_t *Value, int *WeekDays) :cMenuEditItem(Name) { value = Value; + weekdays = WeekDays; + oldvalue = 0; + dayindex = 0; Set(); } @@ -653,7 +571,11 @@ void cMenuEditDateItem::Set(void) { #define DATEBUFFERSIZE 32 char buf[DATEBUFFERSIZE]; - if (*value) { + if (weekdays && *weekdays) { + SetValue(cTimer::PrintDay(0, *weekdays)); + return; + } + else if (*value) { struct tm tm_r; localtime_r(value, &tm_r); strftime(buf, DATEBUFFERSIZE, "%Y-%m-%d ", &tm_r); @@ -669,15 +591,73 @@ eOSState cMenuEditDateItem::ProcessKey(eKeys Key) eOSState state = cMenuEditItem::ProcessKey(Key); if (state == osUnknown) { + time_t now = time(NULL); if (NORMALKEY(Key) == kLeft) { // TODO might want to increase the delta if repeated quickly? - *value -= SECSINDAY; - if (*value < time(NULL)) - *value = 0; + if (!weekdays || !*weekdays) { + // Decrement single day: + time_t v = *value; + v -= SECSINDAY; + if (v < now) { + if (now <= v + SECSINDAY) { // switched from tomorrow to today + if (!weekdays) + v = 0; + } + else if (weekdays) { // switched from today to yesterday, so enter weekdays mode + v = 0; + dayindex = sizeof(days) / sizeof(int) - 2; + *weekdays = days[dayindex]; + } + else // don't go before today + v = *value; + } + *value = v; + } + else { + // Decrement weekday index: + if (dayindex > 0) + *weekdays = days[--dayindex]; + } } else if (NORMALKEY(Key) == kRight) { - if (!*value) - *value = cTimer::SetTime(time(NULL), 0); - *value += SECSINDAY; + if (!weekdays || !*weekdays) { + // Increment single day: + if (!*value) + *value = cTimer::SetTime(now, 0); + *value += SECSINDAY; + } + else { + // Increment weekday index: + *weekdays = days[++dayindex]; + if (!*weekdays) { // was last weekday entry, so switch to today + *value = cTimer::SetTime(now, 0); + dayindex = 0; + } + } + } + else if (weekdays) { + if (Key == k0) { + // Toggle between weekdays and single day: + if (*weekdays) { + *value = cTimer::SetTime(oldvalue ? oldvalue : now, 0); + oldvalue = 0; + *weekdays = 0; + } + else { + *weekdays = days[cTimer::GetWDay(*value)]; + oldvalue = *value; + *value = 0; + } + } + else if (k1 <= Key && Key <= k7) { + // Toggle individual weekdays: + if (*weekdays) { + int v = *weekdays ^ (1 << (Key - k1)); + if (v != 0) + *weekdays = v; // can't let this become all 0 + } + } + else + return state; } else return state; |