diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2012-05-12 14:20:41 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2012-05-12 14:20:41 +0200 |
commit | 5f93700e07382ec2d1ef735f36f4f988f0318ad2 (patch) | |
tree | 188c7eff4ccbae80c5c505e25039b0b91328b2ae | |
parent | 2193ea32f62c4394be13e2950896f49e01e1d14f (diff) | |
download | vdr-5f93700e07382ec2d1ef735f36f4f988f0318ad2.tar.gz vdr-5f93700e07382ec2d1ef735f36f4f988f0318ad2.tar.bz2 |
The new member function cSkinDisplayReplay::SetRecording() allows a skin to display more information about the currently played recording
-rw-r--r-- | HISTORY | 4 | ||||
-rw-r--r-- | menu.c | 38 | ||||
-rw-r--r-- | menu.h | 7 | ||||
-rw-r--r-- | skins.c | 17 | ||||
-rw-r--r-- | skins.h | 7 | ||||
-rw-r--r-- | svdrp.c | 6 | ||||
-rw-r--r-- | tools.c | 11 | ||||
-rw-r--r-- | tools.h | 4 |
8 files changed, 61 insertions, 33 deletions
@@ -7052,7 +7052,7 @@ Video Disk Recorder Revision History - Fixed handling IDLEPRIORITY in cDvbDevice::ProvidesChannel() (thanks to Frank Schmirler). -2012-05-11: Version 1.7.28 +2012-05-12: Version 1.7.28 - Fixed cPixmapMemory::DrawEllipse() for quadrants -1 and -4. - Fixed getting the maximum short channel name length in case there are no short names @@ -7104,3 +7104,5 @@ Video Disk Recorder Revision History bonded devices (reported by Michael Schneider). - Making sure setup strings don't contain any newline characters (thanks to Joachim Wilke). +- The new member function cSkinDisplayReplay::SetRecording() allows a skin to display + more information about the currently played recording. @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menu.c 2.53 2012/04/28 11:13:09 kls Exp $ + * $Id: menu.c 2.54 2012/05/12 13:08:23 kls Exp $ */ #include "menu.h" @@ -2305,7 +2305,7 @@ eOSState cMenuRecordings::Play(void) else { cRecording *recording = GetRecording(ri); if (recording) { - cReplayControl::SetRecording(recording->FileName(), recording->Title()); + cReplayControl::SetRecording(recording->FileName()); return osReplay; } } @@ -4132,7 +4132,7 @@ cRecordControl::cRecordControl(cDevice *Device, cTimer *Timer, bool Pause) else { Timers.Del(timer); if (!cReplayControl::LastReplayed()) // an instant recording, maybe from cRecordControls::PauseLiveVideo() - cReplayControl::SetRecording(fileName, Recording.Name()); + cReplayControl::SetRecording(fileName); } timer = NULL; return; @@ -4147,7 +4147,7 @@ cRecordControl::cRecordControl(cDevice *Device, cTimer *Timer, bool Pause) Recording.WriteInfo(); cStatus::MsgRecording(device, Recording.Name(), Recording.FileName(), true); if (!Timer && !cReplayControl::LastReplayed()) // an instant recording, maybe from cRecordControls::PauseLiveVideo() - cReplayControl::SetRecording(fileName, Recording.Name()); + cReplayControl::SetRecording(fileName); Recordings.AddByName(fileName); return; } @@ -4301,7 +4301,7 @@ void cRecordControls::Stop(const char *InstantId) bool cRecordControls::PauseLiveVideo(void) { Skins.Message(mtStatus, tr("Pausing live video...")); - cReplayControl::SetRecording(NULL, NULL); // make sure the new cRecordControl will set cReplayControl::LastReplayed() + cReplayControl::SetRecording(NULL); // make sure the new cRecordControl will set cReplayControl::LastReplayed() if (Start(NULL, true)) { cReplayControl *rc = new cReplayControl(true); cControl::Launch(rc); @@ -4402,8 +4402,7 @@ bool cRecordControls::StateChanged(int &State) // --- cReplayControl -------------------------------------------------------- cReplayControl *cReplayControl::currentReplayControl = NULL; -char *cReplayControl::fileName = NULL; -char *cReplayControl::title = NULL; +cString cReplayControl::fileName; cReplayControl::cReplayControl(bool PauseLive) :cDvbPlayerControl(fileName, PauseLive) @@ -4433,7 +4432,7 @@ cReplayControl::~cReplayControl() void cReplayControl::Stop(void) { - if (Setup.DelTimeshiftRec && fileName) { + if (Setup.DelTimeshiftRec && *fileName) { cRecordControl* rc = cRecordControls::GetRecordControl(fileName); if (rc && rc->InstantId()) { if (Active()) { @@ -4446,7 +4445,7 @@ void cReplayControl::Stop(void) Timers.SetModified(); } cDvbPlayerControl::Stop(); - cRecording *recording = Recordings.GetByName(fileName);; + cRecording *recording = Recordings.GetByName(fileName); if (recording) { if (recording->Delete()) { Recordings.DelByName(fileName); @@ -4463,17 +4462,14 @@ void cReplayControl::Stop(void) cDvbPlayerControl::Stop(); } -void cReplayControl::SetRecording(const char *FileName, const char *Title) +void cReplayControl::SetRecording(const char *FileName) { - free(fileName); - free(title); - fileName = FileName ? strdup(FileName) : NULL; - title = Title ? strdup(Title) : NULL; + fileName = FileName; } const char *cReplayControl::NowReplaying(void) { - return currentReplayControl ? fileName : NULL; + return currentReplayControl ? *fileName : NULL; } const char *cReplayControl::LastReplayed(void) @@ -4483,10 +4479,8 @@ const char *cReplayControl::LastReplayed(void) void cReplayControl::ClearLastReplayed(const char *FileName) { - if (fileName && FileName && strcmp(fileName, FileName) == 0) { - free(fileName); + if (*fileName && FileName && strcmp(fileName, FileName) == 0) fileName = NULL; - } } void cReplayControl::ShowTimed(int Seconds) @@ -4558,8 +4552,10 @@ bool cReplayControl::ShowProgress(bool Initial) visible = true; } if (Initial) { - if (title) - displayReplay->SetTitle(title); + if (*fileName) { + if (cRecording *Recording = Recordings.GetByName(fileName)) + displayReplay->SetRecording(Recording); + } lastCurrent = lastTotal = -1; } if (Current != lastCurrent || Total != lastTotal) { @@ -4731,7 +4727,7 @@ void cReplayControl::MarkMove(bool Forward) void cReplayControl::EditCut(void) { - if (fileName) { + if (*fileName) { Hide(); if (!cCutter::Active()) { if (!marks.Count()) @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menu.h 2.8 2012/04/28 11:13:03 kls Exp $ + * $Id: menu.h 2.9 2012/05/12 11:48:04 kls Exp $ */ #ifndef __MENU_H @@ -269,8 +269,7 @@ private: void TimeSearch(void); void ShowTimed(int Seconds = 0); static cReplayControl *currentReplayControl; - static char *fileName; - static char *title; + static cString fileName; void ShowMode(void); bool ShowProgress(bool Initial); void MarkToggle(void); @@ -288,7 +287,7 @@ public: virtual void Show(void); virtual void Hide(void); bool Visible(void) { return visible; } - static void SetRecording(const char *FileName, const char *Title); + static void SetRecording(const char *FileName); static const char *NowReplaying(void); static const char *LastReplayed(void); static void ClearLastReplayed(const char *FileName); @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: skins.c 2.7 2012/04/28 10:40:16 kls Exp $ + * $Id: skins.c 2.8 2012/05/12 11:27:23 kls Exp $ */ #include "skins.h" @@ -172,6 +172,21 @@ cSkinDisplayReplay::cSkinDisplayReplay(void) marks = NULL; } +void cSkinDisplayReplay::SetRecording(const cRecording *Recording) +{ + const char *Title = NULL; + const char *ShortText = NULL; + const cRecordingInfo *RecordingInfo = Recording->Info(); + if ((Title = RecordingInfo->Title()) != NULL) + ShortText = RecordingInfo->ShortText(); + else + Title = Recording->Name(); + if (ShortText) + SetTitle(cString::sprintf("%s: %s", Title, ShortText)); + else + SetTitle(Title); +} + void cSkinDisplayReplay::SetMarks(const cMarks *Marks) { marks = Marks; @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: skins.h 2.4 2012/04/28 10:39:54 kls Exp $ + * $Id: skins.h 2.5 2012/05/12 11:10:30 kls Exp $ */ #ifndef __SKINS_H @@ -213,6 +213,11 @@ public: virtual void SetMarks(const cMarks *Marks); ///< Sets the editing marks to Marks, which shall be used to display the ///< progress bar through a cProgressBar object. + virtual void SetRecording(const cRecording *Recording); + ///< Sets the recording that is currently being played. + ///< The default implementation calls SetTitle() with the title and short + ///< text of the Recording. A derived class can use any information provided + ///< by the given Recording and display it. virtual void SetTitle(const char *Title) = 0; ///< Sets the title of the recording. virtual void SetMode(bool Play, bool Forward, int Speed) = 0; @@ -10,7 +10,7 @@ * and interact with the Video Disk Recorder - or write a full featured * graphical interface that sits on top of an SVDRP connection. * - * $Id: svdrp.c 2.18 2012/05/08 11:23:56 kls Exp $ + * $Id: svdrp.c 2.19 2012/05/12 11:55:18 kls Exp $ */ #include "svdrp.h" @@ -1371,7 +1371,7 @@ void cSVDRP::CmdPLAY(const char *Option) if (recording) { if (c) option = skipspace(++option); - cReplayControl::SetRecording(NULL, NULL); + cReplayControl::SetRecording(NULL); cControl::Shutdown(); if (*option) { int pos = 0; @@ -1383,7 +1383,7 @@ void cSVDRP::CmdPLAY(const char *Option) else resume.Save(pos); } - cReplayControl::SetRecording(recording->FileName(), recording->Title()); + cReplayControl::SetRecording(recording->FileName()); cControl::Launch(new cReplayControl); cControl::Attach(); Reply(250, "Playing recording \"%s\" [%s]", num, recording->Title()); @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: tools.c 2.23 2012/05/08 11:13:13 kls Exp $ + * $Id: tools.c 2.24 2012/05/12 13:29:20 kls Exp $ */ #include "tools.h" @@ -1042,6 +1042,15 @@ cString DateString(time_t t) return buf; } +cString ShortDateString(time_t t) +{ + char buf[32]; + struct tm tm_r; + tm *tm = localtime_r(&t, &tm_r); + strftime(buf, sizeof(buf), "%d.%m.%y", tm); + return buf; +} + cString TimeString(time_t t) { char buf[25]; @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: tools.h 2.18 2012/05/08 11:11:33 kls Exp $ + * $Id: tools.h 2.19 2012/05/12 13:27:56 kls Exp $ */ #ifndef __TOOLS_H @@ -244,6 +244,8 @@ cString TimeToString(time_t t); ///< Converts the given time to a string of the form "www mmm dd hh:mm:ss yyyy". cString DateString(time_t t); ///< Converts the given time to a string of the form "www dd.mm.yyyy". +cString ShortDateString(time_t t); + ///< Converts the given time to a string of the form "dd.mm.yy". cString TimeString(time_t t); ///< Converts the given time to a string of the form "hh:mm". uchar *RgbToJpeg(uchar *Mem, int Width, int Height, int &Size, int Quality = 100); |