summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2001-08-25 13:27:26 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2001-08-25 13:27:26 +0200
commit14d3933d91af23a9d79c083163fe6f0281475001 (patch)
treecafb1cc5bb640d02f0a615a9d00c3511f5b7db40
parent8edfaa2345140bb35eeaa29e08940eb665389a65 (diff)
downloadvdr-14d3933d91af23a9d79c083163fe6f0281475001.tar.gz
vdr-14d3933d91af23a9d79c083163fe6f0281475001.tar.bz2
The menus and the channel display now show the current date and time
-rw-r--r--HISTORY4
-rw-r--r--config.h4
-rw-r--r--i18n.c11
-rw-r--r--interface.c4
-rw-r--r--menu.c12
-rw-r--r--osd.c12
-rw-r--r--osd.h6
-rw-r--r--tools.c17
-rw-r--r--tools.h3
9 files changed, 53 insertions, 20 deletions
diff --git a/HISTORY b/HISTORY
index b76067bd..05254bce 100644
--- a/HISTORY
+++ b/HISTORY
@@ -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.
diff --git a/config.h b/config.h
index ce77598b..8061dcf3 100644
--- a/config.h
+++ b/config.h
@@ -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
diff --git a/i18n.c b/i18n.c
index 98782286..18cb0e32 100644
--- a/i18n.c
+++ b/i18n.c
@@ -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",
diff --git a/interface.c b/interface.c
index e2d83b35..1e06f4af 100644
--- a/interface.c
+++ b/interface.c
@@ -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);
diff --git a/menu.c b/menu.c
index 4cc43f09..c3c8f91d 100644
--- a/menu.c
+++ b/menu.c
@@ -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)
diff --git a/osd.c b/osd.c
index daedc1ee..02f43748 100644
--- a/osd.c
+++ b/osd.c
@@ -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)
diff --git a/osd.h b/osd.h
index ec1b1157..2d243f16 100644
--- a/osd.h
+++ b/osd.h
@@ -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:
diff --git a/tools.c b/tools.c
index 30b675b2..1045a0a2 100644
--- a/tools.c
+++ b/tools.c
@@ -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 };
diff --git a/tools.h b/tools.h
index af7958fe..fc30f3f5 100644
--- a/tools.h
+++ b/tools.h
@@ -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: