1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Single shot timers and events now show the day of week

This commit is contained in:
Klaus Schmidinger 2004-05-22 13:23:22 +02:00
parent bcbb3137e7
commit 5aacc51c14
8 changed files with 33 additions and 14 deletions

View File

@ -863,6 +863,7 @@ Christoph Hermanns <christoph.hermanns@gmx.de>
Oskar Signell <oskar@signell.net>
for pointing out a problem with setting an editing mark while in "Pause" mode,
where replay was not immediately positioned to the marked frame
for making single shot timers and events show the day of week
Dirk Essl <de@floydworld.de>
for reporting a wrong URL to the 'Doxygen' tool in INSTALL

View File

@ -2814,3 +2814,8 @@ Video Disk Recorder Revision History
Wiesweg).
- Added a hint to PLUGINS.html about how to name a plugin that implements a skin.
- Completed the Finnish OSD texts (thanks to Rolf Ahrenberg).
- Single shot timers and events now show the day of week (adopted with some changes
from the "elchi" patch, orginally introduced by Oskar Signell). Plugins that use
cEvent::GetDateString() should note that this function now returns a longer
string, including the day of week. The new function const char *WeekDayName(time_t t)
can be called with a time_t value to get the day of week for that time.

9
epg.c
View File

@ -7,7 +7,7 @@
* Original version (as used in VDR before 1.3.0) written by
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
*
* $Id: epg.c 1.18 2004/03/13 15:01:05 kls Exp $
* $Id: epg.c 1.19 2004/05/22 12:37:07 kls Exp $
*/
#include "epg.h"
@ -115,9 +115,12 @@ bool cEvent::IsRunning(bool OrAboutToStart) const
const char *cEvent::GetDateString(void) const
{
static char buf[25];
static char buf[32];
struct tm tm_r;
strftime(buf, sizeof(buf), "%d.%m.%Y", localtime_r(&startTime, &tm_r));
tm *tm = localtime_r(&startTime, &tm_r);
char *p = stpcpy(buf, WeekDayName(tm->tm_wday));
*p++ = ' ';
strftime(p, sizeof(buf) - (p - buf), "%d.%m.%Y", tm);
return buf;
}

13
menu.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: menu.c 1.300 2004/05/16 12:47:22 kls Exp $
* $Id: menu.c 1.302 2004/05/22 13:23:22 kls Exp $
*/
#include "menu.h"
@ -633,6 +633,7 @@ eOSState cMenuEditTimer::ProcessKey(eKeys Key)
}
if (addIfConfirmed)
Timers.Add(timer);
timer->Matches();
Timers.Save();
isyslog("timer %d %s (%s)", timer->Index() + 1, addIfConfirmed ? "added" : "modified", timer->HasFlags(tfActive) ? "active" : "inactive");
addIfConfirmed = false;
@ -677,9 +678,11 @@ bool cMenuTimerItem::operator< (const cListObject &ListObject)
void cMenuTimerItem::Set(void)
{
char *buffer = NULL;
asprintf(&buffer, "%c\t%d\t%s\t%02d:%02d\t%02d:%02d\t%s",
asprintf(&buffer, "%c\t%d\t%s%s%s\t%02d:%02d\t%02d:%02d\t%s",
!(timer->HasFlags(tfActive)) ? ' ' : timer->FirstDay() ? '!' : timer->Recording() ? '#' : '>',
timer->Channel()->Number(),
timer->IsSingleEvent() ? WeekDayName(timer->StartTime()) : "",
timer->IsSingleEvent() ? " " : "",
timer->PrintDay(timer->Day()),
timer->Start() / 100,
timer->Start() % 100,
@ -908,7 +911,7 @@ cMenuWhatsOnItem::cMenuWhatsOnItem(const cEvent *Event, cChannel *Channel)
char t = Timers.GetMatch(Event, &TimerMatch) ? (TimerMatch == tmFull) ? 'T' : 't' : ' ';
char v = event->Vps() && (event->Vps() - event->StartTime()) ? 'V' : ' ';
char r = event->IsRunning() ? '*' : ' ';
asprintf(&buffer, "%d\t%.*s\t%.*s\t%c%c%c\t%s", channel->Number(), 6, channel->Name(), 5, event->GetTimeString(), t, v, r, event->Title());
asprintf(&buffer, "%d\t%.*s\t%s\t%c%c%c\t%s", channel->Number(), 6, channel->Name(), event->GetTimeString(), t, v, r, event->Title());
SetText(buffer, false);
}
@ -1026,7 +1029,7 @@ cMenuScheduleItem::cMenuScheduleItem(const cEvent *Event)
char t = Timers.GetMatch(Event, &TimerMatch) ? (TimerMatch == tmFull) ? 'T' : 't' : ' ';
char v = event->Vps() && (event->Vps() - event->StartTime()) ? 'V' : ' ';
char r = event->IsRunning() ? '*' : ' ';
asprintf(&buffer, "%.*s\t%.*s\t%c%c%c\t%s", 5, event->GetDateString(), 5, event->GetTimeString(), t, v, r, event->Title());
asprintf(&buffer, "%.*s\t%s\t%c%c%c\t%s", 6, event->GetDateString(), event->GetTimeString(), t, v, r, event->Title());
SetText(buffer, false);
}
@ -1048,7 +1051,7 @@ public:
};
cMenuSchedule::cMenuSchedule(void)
:cOsdMenu("", 6, 6, 4)
:cOsdMenu("", 7, 6, 4)
{
now = next = false;
otherChannel = 0;

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: skinclassic.c 1.1 2004/05/15 14:51:18 kls Exp $
* $Id: skinclassic.c 1.2 2004/05/22 13:04:54 kls Exp $
*/
#include "skinclassic.h"
@ -280,7 +280,7 @@ void cSkinClassicDisplayMenu::SetEvent(const cEvent *Event)
int y = y2;
cTextScroller ts;
char t[32];
snprintf(t, sizeof(t), "%s %s - %s", Event->GetDateString(), Event->GetTimeString(), Event->GetEndTimeString());//TODO dayname, no year
snprintf(t, sizeof(t), "%s %s - %s", Event->GetDateString(), Event->GetTimeString(), Event->GetEndTimeString());
ts.Set(osd, xl, y, x1 - xl, y3 - y, t, font, Theme.Color(clrMenuEventTime), Theme.Color(clrBackground));
if (Event->Vps() && Event->Vps() != Event->StartTime()) {
char *buffer;

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: skinsttng.c 1.1 2004/05/16 09:27:35 kls Exp $
* $Id: skinsttng.c 1.2 2004/05/22 13:05:07 kls Exp $
*/
// Star Trek: The Next Generation® is a registered trademark of Paramount Pictures
@ -515,7 +515,7 @@ void cSkinSTTNGDisplayMenu::SetEvent(const cEvent *Event)
int y = y3;
cTextScroller ts;
char t[32];
snprintf(t, sizeof(t), "%s %s - %s", Event->GetDateString(), Event->GetTimeString(), Event->GetEndTimeString());//TODO dayname, no year
snprintf(t, sizeof(t), "%s %s - %s", Event->GetDateString(), Event->GetTimeString(), Event->GetEndTimeString());
ts.Set(osd, xl, y, x4 - xl, y4 - y, t, font, Theme.Color(clrMenuEventTime), Theme.Color(clrBackground));
if (Event->Vps() && Event->Vps() != Event->StartTime()) {
char *buffer;

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: tools.c 1.78 2004/01/11 15:42:30 kls Exp $
* $Id: tools.c 1.79 2004/05/22 12:13:27 kls Exp $
*/
#include "tools.h"
@ -495,6 +495,12 @@ const char *WeekDayName(int WeekDay)
return "???";
}
const char *WeekDayName(time_t t)
{
struct tm tm_r;
return WeekDayName(localtime_r(&t, &tm_r)->tm_wday);
}
const char *DayDateTime(time_t t)
{
static char buffer[32];

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: tools.h 1.55 2004/01/11 15:42:15 kls Exp $
* $Id: tools.h 1.56 2004/05/22 12:11:44 kls Exp $
*/
#ifndef __TOOLS_H
@ -84,6 +84,7 @@ bool RemoveEmptyDirectories(const char *DirName, bool RemoveThis = false);
char *ReadLink(const char *FileName);
bool SpinUpDisk(const char *FileName);
const char *WeekDayName(int WeekDay); ///< \warning returns a statically allocated string!
const char *WeekDayName(time_t t); ///< \warning returns a statically allocated string!
const char *DayDateTime(time_t t = 0); ///< \warning returns a statically allocated string!
class cPoller {