The menus and the channel display now show the current date and time

This commit is contained in:
Klaus Schmidinger 2001-08-25 13:27:26 +02:00
parent 8edfaa2345
commit 14d3933d91
9 changed files with 53 additions and 20 deletions

View File

@ -663,3 +663,7 @@ Video Disk Recorder Revision History
- Fixed broken recordings after a driver buffer overflow.
- Fixed the chirping sound after Pause/Play of a DVD (thanks to Andreas
Schultz).
2001-08-25: Version 0.93
- The menus and the channel display now show the current date and time.

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: config.h 1.61 2001/08/17 13:00:48 kls Exp $
* $Id: config.h 1.62 2001/08/25 11:50:24 kls Exp $
*/
#ifndef __CONFIG_H
@ -19,7 +19,7 @@
#include "eit.h"
#include "tools.h"
#define VDRVERSION "0.92"
#define VDRVERSION "0.93"
#define MaxBuffer 10000

11
i18n.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: i18n.c 1.32 2001/08/17 13:03:15 kls Exp $
* $Id: i18n.c 1.33 2001/08/25 12:27:03 kls Exp $
*
* Slovenian translations provided by Miha Setina <mihasetina@softhome.net>
* Italian translations provided by Alberto Carraro <bertocar@tin.it>
@ -867,6 +867,15 @@ const tPhrase Phrases[] = {
"LMMJVSD",
"MTOTFLS",
},
{ "MonTueWedThuFriSatSun", // must all be 3 letters!
"MonDieMitDonFreSamSon",
"", // TODO
"", // TODO
"", // TODO
"", // TODO
"", // TODO
"", // TODO
},
// Learning keys:
{ "Learning Remote Control Keys",
"Fernbedienungs-Codes lernen",

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: interface.c 1.40 2001/08/07 16:23:28 kls Exp $
* $Id: interface.c 1.41 2001/08/25 13:15:00 kls Exp $
*/
#include "interface.h"
@ -271,7 +271,7 @@ void cInterface::Title(const char *s)
unsigned int n = t - s;
if (n >= sizeof(buffer))
n = sizeof(buffer) - 1;
strn0cpy(buffer, s, n);
strn0cpy(buffer, s, n + 1);
Write(1, 0, buffer, clrBlack, clrCyan);
t++;
Write(-(cDvbApi::PrimaryDvbApi->WidthInCells(t) + 1), 0, t, clrBlack, clrCyan);

12
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.105 2001/08/19 14:45:31 kls Exp $
* $Id: menu.c 1.106 2001/08/25 13:27:26 kls Exp $
*/
#include "menu.h"
@ -1137,6 +1137,7 @@ cMenuEvent::cMenuEvent(const cEventInfo *EventInfo, bool CanSwitch)
char *buffer;
asprintf(&buffer, "%-17.*s\t%.*s %s - %s", 17, channel->name, 5, eventInfo->GetDate(), eventInfo->GetTimeString(), eventInfo->GetEndTimeString());
SetTitle(buffer, false);
delete buffer;
int Line = 2;
cMenuTextItem *item;
const char *Title = eventInfo->GetTitle();
@ -1377,7 +1378,8 @@ void cMenuSchedule::PrepareSchedule(cChannel *Channel)
Clear();
char *buffer = NULL;
asprintf(&buffer, tr("Schedule - %s"), Channel->name);
SetTitle(buffer, false);
SetTitle(buffer);
delete buffer;
if (schedules) {
const cSchedule *Schedule = Channel->pnr ? schedules->GetSchedule(Channel->pnr) : schedules->GetSchedule();
int num = Schedule->NumEvents();
@ -1951,10 +1953,8 @@ void cDisplayChannel::DisplayChannel(const cChannel *Channel)
snprintf(buffer, BufSize, "%s", Channel ? Channel->name : tr("*** Invalid Channel ***"));
Interface->Fill(0, 0, Setup.OSDwidth, 1, clrBackground);
Interface->Write(0, 0, buffer);
time_t t = time(NULL);
struct tm *now = localtime(&t);
snprintf(buffer, BufSize, "%02d:%02d", now->tm_hour, now->tm_min);
Interface->Write(-5, 0, buffer);
const char *date = DayDateTime();
Interface->Write(-strlen(date), 0, date);
}
void cDisplayChannel::DisplayInfo(void)

12
osd.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: osd.c 1.17 2001/08/02 14:18:17 kls Exp $
* $Id: osd.c 1.18 2001/08/25 13:15:16 kls Exp $
*/
#include "osd.h"
@ -78,7 +78,8 @@ cOsdMenu::cOsdMenu(const char *Title, int c0, int c1, int c2, int c3, int c4)
{
hasHotkeys = false;
visible = false;
title = strdup(Title);
title = NULL;
SetTitle(Title);
cols[0] = c0;
cols[1] = c1;
cols[2] = c2;
@ -109,10 +110,13 @@ void cOsdMenu::SetStatus(const char *s)
Interface->Status(status);
}
void cOsdMenu::SetTitle(const char *Title, bool Copy)
void cOsdMenu::SetTitle(const char *Title, bool ShowDate)
{
delete title;
title = Copy ? strdup(Title) : Title;
if (ShowDate)
asprintf(&title, "%s\t%s", Title, DayDateTime(time(NULL)));
else
title = strdup(Title);
}
void cOsdMenu::SetHelp(const char *Red, const char *Green, const char *Yellow, const char *Blue)

6
osd.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: osd.h 1.23 2001/08/02 13:48:34 kls Exp $
* $Id: osd.h 1.24 2001/08/25 12:56:46 kls Exp $
*/
#ifndef __OSD_H
@ -72,7 +72,7 @@ public:
class cOsdMenu : public cOsdBase, public cList<cOsdItem> {
private:
const char *title;
char *title;
int cols[cInterface::MaxCols];
int first, current, marked;
cOsdMenu *subMenu;
@ -94,7 +94,7 @@ protected:
eOSState AddSubMenu(cOsdMenu *SubMenu);
bool HasSubMenu(void) { return subMenu; }
void SetStatus(const char *s);
void SetTitle(const char *Title, bool Copy = true);
void SetTitle(const char *Title, bool ShowDate = true);
void SetHelp(const char *Red, const char *Green = NULL, const char *Yellow = NULL, const char *Blue = NULL);
virtual void Del(int Index);
public:

17
tools.c
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.40 2001/08/17 12:45:42 kls Exp $
* $Id: tools.c 1.41 2001/08/25 13:21:22 kls Exp $
*/
#define _GNU_SOURCE
@ -18,6 +18,7 @@
#include <stdlib.h>
#include <sys/time.h>
#include <unistd.h>
#include "i18n.h"
#define MaxBuffer 1000
@ -395,6 +396,20 @@ bool SpinUpDisk(const char *FileName)
return false;
}
const char *DayDateTime(time_t t)
{
static char buffer[32];
if (t == 0)
time(&t);
tm *tm = localtime(&t);
int weekday = tm->tm_wday == 0 ? 6 : tm->tm_wday - 1; // we start with monday==0!
const char *day = tr("MonTueWedThuFriSatSun");
day += weekday * 3;
strncpy(buffer, day, 3);
snprintf(buffer + 3, sizeof(buffer) - 3, " %2d.%02d %02d:%02d", tm->tm_mday, tm->tm_mon + 1, tm->tm_hour, tm->tm_min);
return buffer;
}
// --- cFile -----------------------------------------------------------------
bool cFile::files[FD_SETSIZE] = { false };

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.29 2001/08/17 12:44:39 kls Exp $
* $Id: tools.h 1.30 2001/08/25 13:20:54 kls Exp $
*/
#ifndef __TOOLS_H
@ -55,6 +55,7 @@ bool RemoveFileOrDir(const char *FileName, bool FollowSymlinks = false);
bool RemoveEmptyDirectories(const char *DirName, bool RemoveThis = false);
char *ReadLink(const char *FileName);
bool SpinUpDisk(const char *FileName);
const char *DayDateTime(time_t t = 0);
class cFile {
private: