diff options
Diffstat (limited to 'status.c')
-rw-r--r-- | status.c | 287 |
1 files changed, 283 insertions, 4 deletions
@@ -4,6 +4,10 @@ #include "status.h" #include "render.h" +#include "menu.h" +#include <vdr/timers.h> +#include <vdr/plugin.h> +#include <vdr/menu.h> const std::string ReplayNames[__REPLAY_COUNT__] = { "", "normal", "mp3", "mplayer", "dvd", "vcd", "image" }; @@ -29,7 +33,12 @@ void cText2SkinStatus::SetRender(cText2SkinRender *Render) mNextRecording = 0; } -void cText2SkinStatus::Replaying(const cControl* /*Control*/, const char *Name) { +#if VDRVERSNUM >= 10338 +void cText2SkinStatus::Replaying(const cControl* /*Control*/, const char *Name, const char *FileName, bool On) +#else +void cText2SkinStatus::Replaying(const cControl* /*Control*/, const char *Name) +#endif +{ Dprintf("cText2SkinStatus::Replaying(%s)\n", Name); eReplayMode oldMode = mReplayMode; @@ -49,9 +58,20 @@ void cText2SkinStatus::Replaying(const cControl* /*Control*/, const char *Name) mReplayIsLoop = Name[1] == 'L'; mReplayIsShuffle = Name[2] == 'S'; } - } - else if (GetRecordingByName(Name) != NULL) + } +#if VDRVERSNUM >= 10338 + else if (const cRecording *rec = GetRecordingByFileName(FileName)) + { + mReplay = rec; mReplayMode = replayNormal; + } +#else + else if (const cRecording *rec = GetRecordingByName(Name)) + { + mReplay = rec; + mReplayMode = replayNormal; + } +#endif else if (strcmp(Name, "DVD") == 0) mReplayMode = replayDVD; else if (strcmp(Name, "VCD") == 0) @@ -83,7 +103,11 @@ void cText2SkinStatus::Replaying(const cControl* /*Control*/, const char *Name) } } -void cText2SkinStatus::Recording(const cDevice *Device, const char *Name) +#if VDRVERSNUM >= 10338 +void cText2SkinStatus::Recording(const cDevice *Device, const char *Name, const char *FileName, bool On) +#else +void cText2SkinStatus::Recording(const cDevice *Device, const char *Name) +#endif { if (mRender != NULL) mRender->UpdateLock(); @@ -112,12 +136,267 @@ void cText2SkinStatus::OsdClear(void) } } +void cText2SkinStatus::OsdCurrentItem(const char *Text) +{ + if (mRender != NULL) + { + static std::string lastItem; + + lastItem = mRender->mUpdate.currentItem; + mRender->mUpdate.currentItem = Text; + mRender->mUpdate.resetMarquee = true; + mRender->mUpdate.foundFirstItem = false; + } +} + +void cText2SkinStatus::UpdateEvents(void) +{ + if (mRender->mUpdate.events) + { + mRender->mUpdate.events = false; + + mEvents.clear(); + Timers.IncBeingEdited(); + + for (cTimer *tim = Timers.First(); tim != NULL; tim = Timers.Next(tim)) + { + if (tim->HasFlags(tfActive)) + { + int i = 0; + cTimer dummy; + dummy = *tim; // copy the timer + + do + { + tEvent ev; + + ev.title = dummy.File(); + ev.isRecording = dummy.Recording(); + ev.channelName = dummy.Channel()->Name(); + ev.channelNumber = dummy.Channel()->Number(); + ev.startTime = dummy.StartTime(); + ev.stopTime = dummy.StopTime(); + ev.priority = dummy.Priority(); + + mEvents.push_back(ev); + + if (!dummy.IsSingleEvent()) // add 4 additional rep. timer + { + do + { + dummy.Skip(); + dummy.Matches(); // Refresh start- and end-time + } while (!dummy.DayMatches(dummy.Day())); + } + + i++; + } while (!dummy.IsSingleEvent() && i < 5); + } + } + + Timers.DecBeingEdited(); + std::sort(mEvents.rbegin(), mEvents.rend()); + } +} + cxType cText2SkinStatus::GetTokenData(const txToken &Token) { + uint event = 0; + switch (Token.Type) { case tReplayMode: return ReplayNames[mReplayMode]; + case tCurrentEventsTitle3: + event++; + case tCurrentEventsTitle2: + event++; + case tCurrentEventsTitle1: + UpdateEvents(); + return mEvents.size() > event + ? (cxType)mEvents[event].title.c_str() + : (cxType)false; + + case tCurrentEventsStartDateTime3: + event++; + case tCurrentEventsStartDateTime2: + event++; + case tCurrentEventsStartDateTime1: + UpdateEvents(); + return mEvents.size() > event + ? (cxType)TimeType(mEvents[event].startTime, Token.Attrib.Text) + : (cxType)false; + + case tCurrentEventsStopDateTime3: + event++; + case tCurrentEventsStopDateTime2: + event++; + case tCurrentEventsStopDateTime1: + UpdateEvents(); + return mEvents.size() > event + ? (cxType)TimeType(mEvents[event].stopTime, Token.Attrib.Text) + : (cxType)false; + + case tCurrentEventsChannelNumber3: + event++; + case tCurrentEventsChannelNumber2: + event++; + case tCurrentEventsChannelNumber1: + UpdateEvents(); + return mEvents.size() > event + ? (cxType)mEvents[event].channelNumber + : (cxType)false; + + case tCurrentEventsChannelName3: + event++; + case tCurrentEventsChannelName2: + event++; + case tCurrentEventsChannelName1: + UpdateEvents(); + return mEvents.size() > event + ? (cxType)mEvents[event].channelName.c_str() + : (cxType)false; + + case tCurrentEventsIsRecording3: + event++; + case tCurrentEventsIsRecording2: + event++; + case tCurrentEventsIsRecording1: + UpdateEvents(); + return mEvents.size() > event + ? (cxType)mEvents[event].isRecording + : (cxType)false; + + case tTimerConflict: +#if VDRVERSNUM >= 10330 + if (Text2SkinSetup.CheckTimerConflict) + { + bool conflict; + + if (mRender->mUpdate.timerConflict) + { + mRender->mUpdate.timerConflict = false; + + if (cPluginManager::CallFirstService("CheckTimerConflict-v1.0", &conflict) ) + { + mTimerConflict = conflict; + } + else + { + mTimerConflict = false; + } + } + + return mTimerConflict; + } + else + { + return false; + } +#endif + +#if VDRVERSNUM >= 10325 +#if VDRVERSNUM >= 10338 + case tReplayName: + return mReplay != NULL + ? (cxType)mReplay->Name() + : (cxType)false; + + case tReplayDateTime: + return mReplay != NULL + ? (cxType)TimeType(mReplay->start, Token.Attrib.Text) + : (cxType)false; + + case tReplayShortText: + return mReplay != NULL + ? (cxType)mReplay->Info()->ShortText() + : (cxType)false; + + case tReplayDescription: + return mReplay != NULL + ? (cxType)mReplay->Info()->Description() + : (cxType)false; +#else + case tReplayName: + return (cxType)false; + + case tReplayDateTime: + return (cxType)false; + + case tReplayShortText: + return (cxType)false; + + case tReplayDescription: + return (cxType)false; +#endif + + case tReplayLanguageCode: + if (mReplay) + { + const cComponents *components = mReplay->Info()->Components(); + if (components) + { + int index = Token.Attrib.Number; + + // don't return language-code for the video-stream + for (int i = 0; i < components->NumComponents(); i++) + { + const tComponent *c = components->Component(i); + if (c->stream != 2) index++; // only audio-streams + { + std::string buffer(c->language); + if (c->type == 1) buffer.append("MONO"); + if (c->type == 2) buffer.append("DUAL"); + if (c->type == 5) buffer.append("DD"); + return (cxType)buffer.c_str(); + } + } + } + } + return false; + + case tReplayLanguageDescription: + if (mReplay) + { + const cComponents *components = mReplay->Info()->Components(); + if (components) + { + int index = Token.Attrib.Number; + + // don't return language-code for the video-stream + for (int i = 0; i < components->NumComponents(); i++) + { + const tComponent *c = components->Component(i); + if (c->stream != 2) index++; // only audio-streams + if (i == index) return (cxType)c->description; + } + } + } + return false; + + case tReplayVideoAR: + if (mReplay) + { + const cComponents *components = mReplay->Info()->Components(); + if (components) + { + for (int i = 0; i < components->NumComponents(); i++) + { + const tComponent *c = components->Component(i); + if (c->stream == 1) + { + switch (c->type) + { + case 1: return "4:3"; + case 3: return "16:9"; + } + } + } + } + } + return false; +#endif + case tCurrentRecording: Dprintf("token attrib type is: %d, number: %d\n", Token.Attrib.Type, Token.Attrib.Number); if (Token.Attrib.Type == aNumber) { |