diff options
54 files changed, 944 insertions, 616 deletions
@@ -309,3 +309,4 @@ Version 0.4.3 Version 0.4.4 - feature: possibility to move viewelements when starting view +- expanded shifting features @@ -20,6 +20,8 @@ cDesignerConfig::cDesignerConfig() { //menu display style, display menu items //one after each other or in one step blockFlush = 1; + //frames per second for fading and shifting + framesPerSecond = 40; //remember current skin and theme, osd size and osd fonts SetSkin(); SetOSDSize(); @@ -398,6 +400,7 @@ bool cDesignerConfig::SetupParse(const char *Name, const char *Value) { else if (!strcasecmp(Name, "RerunDistance")) rerunDistance = atoi(Value); else if (!strcasecmp(Name, "RerunMaxChannel")) rerunMaxChannel = atoi(Value); else if (!strcasecmp(Name, "BlockFlush")) blockFlush = atoi(Value); + else if (!strcasecmp(Name, "FramesPerSecond")) framesPerSecond = atoi(Value); else pluginSetupParam = false; if (!pluginSetupParam) { @@ -97,6 +97,7 @@ public: int rerunDistance; int rerunMaxChannel; int blockFlush; + int framesPerSecond; //TemplateReload on Setup Close bool setupCloseDoReload; }; diff --git a/displaychannel.c b/displaychannel.c index 05c12d3..4d67fab 100644 --- a/displaychannel.c +++ b/displaychannel.c @@ -214,4 +214,4 @@ void cSDDisplayChannel::Flush(void) { initial = false; channelChange = false; channelView->Flush(); -}
\ No newline at end of file +} diff --git a/displaymenu.c b/displaymenu.c index b38ab7a..c533032 100644 --- a/displaymenu.c +++ b/displaymenu.c @@ -286,7 +286,6 @@ bool cSDDisplayMenu::SetPluginText(map<string,string> *stringTokens, map<string, void cSDDisplayMenu::Flush(void) { if (!doOutput) return; - bool doFlush = false; if (state == vsInit) { rootView->Start(); diff --git a/displayreplay.c b/displayreplay.c index 9a68761..baea3b8 100644 --- a/displayreplay.c +++ b/displayreplay.c @@ -5,6 +5,7 @@ cSDDisplayReplay::cSDDisplayReplay(cTemplate *replayTemplate, bool ModeOnly) { doOutput = true; initial = true; + initialModeSet = false; modeOnly = ModeOnly; replayView = NULL; if (!replayTemplate) { @@ -57,6 +58,7 @@ void cSDDisplayReplay::SetMode(bool Play, bool Forward, int Speed) { replayView->ClearOnPause(); } replayView->DrawControlIcons(Play, Forward, Speed, modeOnly); + initialModeSet = true; } void cSDDisplayReplay::SetProgress(int Current, int Total) { @@ -100,7 +102,7 @@ void cSDDisplayReplay::Flush(void) { replayView->DrawTime(); } - if (initial) { + if (initial && initialModeSet) { replayView->DrawBackground(modeOnly); replayView->DrawCustomTokens(); replayView->DoFadeIn(); diff --git a/displayreplay.h b/displayreplay.h index 836febb..9d83850 100644 --- a/displayreplay.h +++ b/displayreplay.h @@ -11,6 +11,7 @@ class cSDDisplayReplay : public cSkinDisplayReplay { private: cDisplayReplayView *replayView; bool initial; + bool initialModeSet; bool doOutput; bool modeOnly; public: diff --git a/dtd/displayaudiotracks.dtd b/dtd/displayaudiotracks.dtd index 3d54644..0ebdf80 100644 --- a/dtd/displayaudiotracks.dtd +++ b/dtd/displayaudiotracks.dtd @@ -9,6 +9,11 @@ width CDATA #REQUIRED
height CDATA #REQUIRED
fadetime CDATA #IMPLIED
+ shifttime CDATA #IMPLIED
+ shifttype CDATA #IMPLIED
+ shiftmode CDATA #IMPLIED
+ startx CDATA #IMPLIED
+ starty CDATA #IMPLIED
scaletvx CDATA #IMPLIED
scaletvy CDATA #IMPLIED
scaletvwidth CDATA #IMPLIED
diff --git a/dtd/displaychannel.dtd b/dtd/displaychannel.dtd index 94b736d..e0f718b 100644 --- a/dtd/displaychannel.dtd +++ b/dtd/displaychannel.dtd @@ -12,6 +12,11 @@ width CDATA #REQUIRED
height CDATA #REQUIRED
fadetime CDATA #IMPLIED
+ shifttime CDATA #IMPLIED
+ shifttype CDATA #IMPLIED
+ shiftmode CDATA #IMPLIED
+ startx CDATA #IMPLIED
+ starty CDATA #IMPLIED
scaletvx CDATA #IMPLIED
scaletvy CDATA #IMPLIED
scaletvwidth CDATA #IMPLIED
@@ -97,6 +102,8 @@ delay CDATA #IMPLIED
fadetime CDATA #IMPLIED
shifttime CDATA #IMPLIED
+ shifttype CDATA #IMPLIED
+ shiftmode CDATA #IMPLIED
startx CDATA #IMPLIED
starty CDATA #IMPLIED
debug CDATA #IMPLIED
@@ -110,6 +117,8 @@ delay CDATA #IMPLIED
fadetime CDATA #IMPLIED
shifttime CDATA #IMPLIED
+ shifttype CDATA #IMPLIED
+ shiftmode CDATA #IMPLIED
startx CDATA #IMPLIED
starty CDATA #IMPLIED
debug CDATA #IMPLIED
@@ -122,6 +131,8 @@ delay CDATA #IMPLIED
fadetime CDATA #IMPLIED
shifttime CDATA #IMPLIED
+ shifttype CDATA #IMPLIED
+ shiftmode CDATA #IMPLIED
startx CDATA #IMPLIED
starty CDATA #IMPLIED
debug CDATA #IMPLIED
@@ -134,6 +145,8 @@ delay CDATA #IMPLIED
fadetime CDATA #IMPLIED
shifttime CDATA #IMPLIED
+ shifttype CDATA #IMPLIED
+ shiftmode CDATA #IMPLIED
startx CDATA #IMPLIED
starty CDATA #IMPLIED
debug CDATA #IMPLIED
@@ -146,6 +159,8 @@ delay CDATA #IMPLIED
fadetime CDATA #IMPLIED
shifttime CDATA #IMPLIED
+ shifttype CDATA #IMPLIED
+ shiftmode CDATA #IMPLIED
startx CDATA #IMPLIED
starty CDATA #IMPLIED
debug CDATA #IMPLIED
@@ -164,6 +179,7 @@ delay CDATA #IMPLIED
fadetime CDATA #IMPLIED
shifttime CDATA #IMPLIED
+ shiftmode CDATA #IMPLIED
startx CDATA #IMPLIED
starty CDATA #IMPLIED
debug CDATA #IMPLIED
diff --git a/dtd/displaymenu.dtd b/dtd/displaymenu.dtd index 8626689..3f1747a 100644 --- a/dtd/displaymenu.dtd +++ b/dtd/displaymenu.dtd @@ -24,18 +24,42 @@ <!ELEMENT header (area|areascroll)*>
<!ATTLIST header
+ detached CDATA #IMPLIED
+ delay CDATA #IMPLIED
+ fadetime CDATA #IMPLIED
+ shifttime CDATA #IMPLIED
+ shifttype CDATA #IMPLIED
+ shiftmode CDATA #IMPLIED
+ startx CDATA #IMPLIED
+ starty CDATA #IMPLIED
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
<!ELEMENT datetime (area|areascroll)*>
<!ATTLIST datetime
+ detached CDATA #IMPLIED
+ delay CDATA #IMPLIED
+ fadetime CDATA #IMPLIED
+ shifttime CDATA #IMPLIED
+ shifttype CDATA #IMPLIED
+ shiftmode CDATA #IMPLIED
+ startx CDATA #IMPLIED
+ starty CDATA #IMPLIED
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
<!ELEMENT time (area|areascroll)*>
<!ATTLIST time
+ detached CDATA #IMPLIED
+ delay CDATA #IMPLIED
+ fadetime CDATA #IMPLIED
+ shifttime CDATA #IMPLIED
+ shifttype CDATA #IMPLIED
+ shiftmode CDATA #IMPLIED
+ startx CDATA #IMPLIED
+ starty CDATA #IMPLIED
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
@@ -64,6 +88,8 @@ delay CDATA #IMPLIED
fadetime CDATA #IMPLIED
shifttime CDATA #IMPLIED
+ shifttype CDATA #IMPLIED
+ shiftmode CDATA #IMPLIED
startx CDATA #IMPLIED
starty CDATA #IMPLIED
debug CDATA #IMPLIED
@@ -76,6 +102,8 @@ delay CDATA #IMPLIED
fadetime CDATA #IMPLIED
shifttime CDATA #IMPLIED
+ shifttype CDATA #IMPLIED
+ shiftmode CDATA #IMPLIED
startx CDATA #IMPLIED
starty CDATA #IMPLIED
debug CDATA #IMPLIED
@@ -88,6 +116,8 @@ delay CDATA #IMPLIED
fadetime CDATA #IMPLIED
shifttime CDATA #IMPLIED
+ shifttype CDATA #IMPLIED
+ shiftmode CDATA #IMPLIED
startx CDATA #IMPLIED
starty CDATA #IMPLIED
debug CDATA #IMPLIED
@@ -101,6 +131,8 @@ delay CDATA #IMPLIED
fadetime CDATA #IMPLIED
shifttime CDATA #IMPLIED
+ shifttype CDATA #IMPLIED
+ shiftmode CDATA #IMPLIED
startx CDATA #IMPLIED
starty CDATA #IMPLIED
debug CDATA #IMPLIED
@@ -113,6 +145,8 @@ delay CDATA #IMPLIED
fadetime CDATA #IMPLIED
shifttime CDATA #IMPLIED
+ shifttype CDATA #IMPLIED
+ shiftmode CDATA #IMPLIED
startx CDATA #IMPLIED
starty CDATA #IMPLIED
debug CDATA #IMPLIED
@@ -125,6 +159,8 @@ delay CDATA #IMPLIED
fadetime CDATA #IMPLIED
shifttime CDATA #IMPLIED
+ shifttype CDATA #IMPLIED
+ shiftmode CDATA #IMPLIED
startx CDATA #IMPLIED
starty CDATA #IMPLIED
debug CDATA #IMPLIED
@@ -137,6 +173,8 @@ delay CDATA #IMPLIED
fadetime CDATA #IMPLIED
shifttime CDATA #IMPLIED
+ shifttype CDATA #IMPLIED
+ shiftmode CDATA #IMPLIED
startx CDATA #IMPLIED
starty CDATA #IMPLIED
debug CDATA #IMPLIED
@@ -149,6 +187,8 @@ delay CDATA #IMPLIED
fadetime CDATA #IMPLIED
shifttime CDATA #IMPLIED
+ shifttype CDATA #IMPLIED
+ shiftmode CDATA #IMPLIED
startx CDATA #IMPLIED
starty CDATA #IMPLIED
debug CDATA #IMPLIED
@@ -161,6 +201,8 @@ delay CDATA #IMPLIED
fadetime CDATA #IMPLIED
shifttime CDATA #IMPLIED
+ shifttype CDATA #IMPLIED
+ shiftmode CDATA #IMPLIED
startx CDATA #IMPLIED
starty CDATA #IMPLIED
debug CDATA #IMPLIED
@@ -173,6 +215,8 @@ delay CDATA #IMPLIED
fadetime CDATA #IMPLIED
shifttime CDATA #IMPLIED
+ shifttype CDATA #IMPLIED
+ shiftmode CDATA #IMPLIED
startx CDATA #IMPLIED
starty CDATA #IMPLIED
debug CDATA #IMPLIED
diff --git a/dtd/displaymessage.dtd b/dtd/displaymessage.dtd index b9849bd..1b85442 100644 --- a/dtd/displaymessage.dtd +++ b/dtd/displaymessage.dtd @@ -9,6 +9,11 @@ width CDATA #REQUIRED
height CDATA #REQUIRED
fadetime CDATA #IMPLIED
+ shifttime CDATA #IMPLIED
+ shifttype CDATA #IMPLIED
+ shiftmode CDATA #IMPLIED
+ startx CDATA #IMPLIED
+ starty CDATA #IMPLIED
scaletvx CDATA #IMPLIED
scaletvy CDATA #IMPLIED
scaletvwidth CDATA #IMPLIED
diff --git a/dtd/displayplugin.dtd b/dtd/displayplugin.dtd index 8bc0c47..2e436d9 100644 --- a/dtd/displayplugin.dtd +++ b/dtd/displayplugin.dtd @@ -9,6 +9,11 @@ width CDATA #REQUIRED
height CDATA #REQUIRED
fadetime CDATA #IMPLIED
+ shifttime CDATA #IMPLIED
+ shifttype CDATA #IMPLIED
+ shiftmode CDATA #IMPLIED
+ startx CDATA #IMPLIED
+ starty CDATA #IMPLIED
scaletvx CDATA #IMPLIED
scaletvy CDATA #IMPLIED
scaletvwidth CDATA #IMPLIED
diff --git a/dtd/displayreplay.dtd b/dtd/displayreplay.dtd index d5f7ff8..d5d47fc 100644 --- a/dtd/displayreplay.dtd +++ b/dtd/displayreplay.dtd @@ -13,6 +13,11 @@ width CDATA #REQUIRED
height CDATA #REQUIRED
fadetime CDATA #IMPLIED
+ shifttime CDATA #IMPLIED
+ shifttype CDATA #IMPLIED
+ shiftmode CDATA #IMPLIED
+ startx CDATA #IMPLIED
+ starty CDATA #IMPLIED
scaletvx CDATA #IMPLIED
scaletvy CDATA #IMPLIED
scaletvwidth CDATA #IMPLIED
@@ -44,6 +49,14 @@ <!ELEMENT scrapercontent (area|areascroll)*>
<!ATTLIST scrapercontent
+ detached CDATA #IMPLIED
+ delay CDATA #IMPLIED
+ fadetime CDATA #IMPLIED
+ shifttime CDATA #IMPLIED
+ shifttype CDATA #IMPLIED
+ shiftmode CDATA #IMPLIED
+ startx CDATA #IMPLIED
+ starty CDATA #IMPLIED
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
diff --git a/dtd/displayvolume.dtd b/dtd/displayvolume.dtd index 278346f..63613a0 100644 --- a/dtd/displayvolume.dtd +++ b/dtd/displayvolume.dtd @@ -9,6 +9,11 @@ width CDATA #REQUIRED
height CDATA #REQUIRED
fadetime CDATA #IMPLIED
+ shifttime CDATA #IMPLIED
+ shifttype CDATA #IMPLIED
+ shiftmode CDATA #IMPLIED
+ startx CDATA #IMPLIED
+ starty CDATA #IMPLIED
scaletvx CDATA #IMPLIED
scaletvy CDATA #IMPLIED
scaletvwidth CDATA #IMPLIED
diff --git a/libcore/pixmapcontainer.c b/libcore/pixmapcontainer.c index 2f498e0..cab356e 100644 --- a/libcore/pixmapcontainer.c +++ b/libcore/pixmapcontainer.c @@ -1,4 +1,5 @@ #define __STL_CONFIG_H +#include <math.h> #include "pixmapcontainer.h" #include "../config.h" @@ -21,6 +22,8 @@ cPixmapContainer::cPixmapContainer(int numPixmaps) { checkRunning = false; fadeTime = 0; shiftTime = 0; + shiftType = stNone; + shiftMode = smLinear; deleteOsdOnExit = false; } @@ -349,8 +352,10 @@ void cPixmapContainer::FadeIn(void) { } return; } + int frames = fadeTime * config.framesPerSecond / 1000; + if (frames <= 0) frames = 1; + int frameTime = fadeTime / frames; uint64_t Start = cTimeMs::Now(); - int FadeFrameTime = fadeTime / 10; while (Running()) { uint64_t Now = cTimeMs::Now(); double t = min(double(Now - Start) / fadeTime, 1.0); @@ -367,18 +372,20 @@ void cPixmapContainer::FadeIn(void) { } DoFlush(); int Delta = cTimeMs::Now() - Now; - if (Running() && (Delta < FadeFrameTime)) - cCondWait::SleepMs(FadeFrameTime - Delta); + if (Running() && (Delta < frameTime)) + cCondWait::SleepMs(frameTime - Delta); if ((int)(Now - Start) > fadeTime) break; } } void cPixmapContainer::FadeOut(void) { - if (!fadeTime) + if (!fadeTime || IsAnimated()) return; + int frames = fadeTime * config.framesPerSecond / 1000; + if (frames <= 0) frames = 1; + int frameTime = fadeTime / frames; uint64_t Start = cTimeMs::Now(); - int FadeFrameTime = fadeTime / 10; while (true) { uint64_t Now = cTimeMs::Now(); double t = min(double(Now - Start) / fadeTime, 1.0); @@ -395,8 +402,8 @@ void cPixmapContainer::FadeOut(void) { } DoFlush(); int Delta = cTimeMs::Now() - Now; - if (Delta < FadeFrameTime) - cCondWait::SleepMs(FadeFrameTime - Delta); + if (Delta < frameTime) + cCondWait::SleepMs(frameTime - Delta); if ((int)(Now - Start) > fadeTime) break; } @@ -405,6 +412,137 @@ void cPixmapContainer::FadeOut(void) { void cPixmapContainer::ShiftIn(void) { if (shiftTime < 1) return; + + int frames = shiftTime * config.framesPerSecond / 1000; + if (frames <= 0) frames = 1; + int frameTime = shiftTime / frames; + + if (shiftType > stNone) { + ShiftInFromBorder(frames, frameTime); + } else { + ShiftInFromPoint(frames, frameTime); + } +} + +void cPixmapContainer::ShiftInFromBorder(int frames, int frameTime) { + //calculating union rectangle of all pixmaps viewports + cRect unionArea; + bool isNew = true; + for (int i = 0; i < numPixmaps; i++) { + if (!PixmapExists(i)) + continue; + if (isNew) { + unionArea = ViewPort(i); + isNew = false; + } else { + unionArea.Combine(ViewPort(i)); + } + } + //shifthing all pixmaps to dedicated start positions + cPoint startPositions[numPixmaps]; + int osdWidth = osd->Width(); + int osdHeight = osd->Height(); + int xStart = 0; + int yStart = 0; + for (int i = 0; i < numPixmaps; i++) { + if (!PixmapExists(i)) + continue; + cPoint pos; + Pos(i, pos); + switch (shiftType) { + case stLeft: + xStart = pos.X() - (unionArea.X() + unionArea.Width()); + pos.SetX(xStart); + break; + case stRight: + xStart = osdWidth + (pos.X() - unionArea.X()); + pos.SetX(xStart); + break; + case stTop: + yStart = pos.Y() - (unionArea.Y() + unionArea.Height()); + pos.SetY(yStart); + break; + case stBottom: + yStart = osdHeight + (pos.Y() - unionArea.Y()); + pos.SetY(yStart); + break; + default: + break; + } + startPositions[i] = pos; + cRect r = ViewPort(i); + r.SetPoint(pos.X(), pos.Y()); + SetViewPort(i, r); + SetAlpha(i, ALPHA_OPAQUE); + } + DoFlush(); + //Calculating total shifting distance + int shiftTotal = 0; + switch (shiftType) { + case stLeft: + shiftTotal = unionArea.X() + unionArea.Width(); + break; + case stRight: + shiftTotal = unionArea.Width() + (osdWidth - (unionArea.X() + unionArea.Width())); + break; + case stTop: + shiftTotal = unionArea.Y() + unionArea.Height(); + break; + case stBottom: + shiftTotal = unionArea.Height() + (osdHeight - (unionArea.Y() + unionArea.Height())); + break; + default: + break; + } + //Moving In + uint64_t Start = cTimeMs::Now(); + while (Running()) { + uint64_t Now = cTimeMs::Now(); + double t = min(double(Now - Start) / shiftTime, 1.0); + if (shiftMode == smSlowedDown) { + //using f(x) = -(x-1)^2 + 1 as mapping function + t = (-1)*pow(t - 1, 2) + 1; + } + int xNew = 0; + int yNew = 0; + for (int i = 0; i < numPixmaps; i++) { + if (!PixmapExists(i)) + continue; + cRect r = ViewPort(i); + switch (shiftType) { + case stLeft: + xNew = startPositions[i].X() + t * shiftTotal; + r.SetPoint(xNew, r.Y()); + break; + case stRight: + xNew = startPositions[i].X() - t * shiftTotal; + r.SetPoint(xNew, r.Y()); + break; + case stTop: + yNew = startPositions[i].Y() + t * shiftTotal; + r.SetPoint(r.X(), yNew); + break; + case stBottom: + yNew = startPositions[i].Y() - t * shiftTotal; + r.SetPoint(r.X(), yNew); + break; + default: + break; + } + SetViewPort(i, r); + } + DoFlush(); + int Delta = cTimeMs::Now() - Now; + if (Running() && (Delta < frameTime)) { + cCondWait::SleepMs(frameTime - Delta); + } + if ((int)(Now - Start) > shiftTime) + break; + } +} + +void cPixmapContainer::ShiftInFromPoint(int frames, int frameTime) { + //store original positions of pixmaps and move to StartPosition cPoint destPos[numPixmaps]; for (int i = 0; i < numPixmaps; i++) { if (!PixmapExists(i)) @@ -418,12 +556,9 @@ void cPixmapContainer::ShiftIn(void) { SetAlpha(i, ALPHA_OPAQUE); } DoFlush(); - - int frames = shiftTime / 20; - if (frames <= 0) frames = 1; + //Move In uint64_t Start = cTimeMs::Now(); - int frameTime = shiftTime / frames; - while (true) { + while (Running()) { uint64_t Now = cTimeMs::Now(); double t = min(double(Now - Start) / shiftTime, 1.0); for (int i = 0; i < numPixmaps; i++) { @@ -437,14 +572,14 @@ void cPixmapContainer::ShiftIn(void) { } DoFlush(); int Delta = cTimeMs::Now() - Now; - if (Delta < frameTime) + if (Running() && (Delta < frameTime)) cCondWait::SleepMs(frameTime - Delta); if ((int)(Now - Start) > shiftTime) break; } - } + /***************************************** * scrollSpeed: 1 slow * 2 medium diff --git a/libcore/pixmapcontainer.h b/libcore/pixmapcontainer.h index d17753c..e924126 100644 --- a/libcore/pixmapcontainer.h +++ b/libcore/pixmapcontainer.h @@ -24,8 +24,12 @@ private: bool checkRunning; int fadeTime; int shiftTime; + int shiftType; + int shiftMode; cPoint startPos; bool deleteOsdOnExit; + void ShiftInFromBorder(int frames, int frameTime); + void ShiftInFromPoint(int frames, int frameTime); protected: void SetInitFinished(void) { pixContainerInit = false; }; bool CreateOsd(int Left, int Top, int Width, int Height); @@ -61,6 +65,8 @@ protected: //HELPERS -- do not access the pixmaps array directly, use wrapper functions void SetFadeTime(int fade) { fadeTime = fade; }; void SetShiftTime(int shift) { shiftTime = shift; }; + void SetShiftType(int type) { shiftType = type; }; + void SetShiftMode(int mode) { shiftMode = mode; }; void SetStartPos(int posX, int posY) { startPos.SetX(posX); startPos.SetY(posY); }; bool IsAnimated(void) { return (shiftTime > 0); }; void FadeIn(void); diff --git a/libtemplate/templatefunction.c b/libtemplate/templatefunction.c index 9855066..246db23 100644 --- a/libtemplate/templatefunction.c +++ b/libtemplate/templatefunction.c @@ -75,6 +75,10 @@ void cTemplateFunction::SetParameters(vector<pair<string, string> > params) { p.first = ptFadeTime;
} else if (!name.compare("shifttime")) {
p.first = ptShiftTime;
+ } else if (!name.compare("shifttype")) {
+ p.first = ptShiftType;
+ } else if (!name.compare("shiftmode")) {
+ p.first = ptShiftMode;
} else if (!name.compare("startx")) {
p.first = ptStartX;
} else if (!name.compare("starty")) {
@@ -304,6 +308,12 @@ bool cTemplateFunction::CalculateParameters(void) { case ptAnimType:
paramValid = SetAnimType(value);
break;
+ case ptShiftType:
+ paramValid = SetShiftType(value);
+ break;
+ case ptShiftMode:
+ paramValid = SetShiftMode(value);
+ break;
default:
paramValid = true;
break;
@@ -442,6 +452,8 @@ int cTemplateFunction::GetNumericParameter(eParamType type) { return 0;
else if (type == ptFadeTime)
return 0;
+ else if (type == ptShiftTime)
+ return 0;
else if (type == ptMenuItemWidth)
return 0;
else if (type == ptHideRoot)
@@ -454,6 +466,15 @@ int cTemplateFunction::GetNumericParameter(eParamType type) { return 0;
else if (type == ptDirection)
return diBottomUp;
+ else if (type == ptStartX)
+ return 0;
+ else if (type == ptStartY)
+ return 0;
+ else if (type == ptShiftType)
+ return stNone;
+ else if (type == ptShiftMode)
+ return smLinear;
+ //default default ;)
return -1;
}
return hit->second;
@@ -1164,6 +1185,28 @@ bool cTemplateFunction::SetAnimType(string value) { return true;
}
+bool cTemplateFunction::SetShiftType(string value) {
+ int shiftType = stNone;
+ if (!value.compare("left"))
+ shiftType = stLeft;
+ else if (!value.compare("right"))
+ shiftType = stRight;
+ else if (!value.compare("top"))
+ shiftType = stTop;
+ else if (!value.compare("bottom"))
+ shiftType = stBottom;
+ numericParameters.insert(pair<eParamType, int>(ptShiftType, shiftType));
+ return true;
+}
+
+bool cTemplateFunction::SetShiftMode(string value) {
+ int shiftMode = smLinear;
+ if (!value.compare("slowed"))
+ shiftMode = smSlowedDown;
+ numericParameters.insert(pair<eParamType, int>(ptShiftMode, shiftMode));
+ return true;
+}
+
void cTemplateFunction::SetDebugGrid(string value) {
int numGridsX = 0;
int numGridsY = 0;
@@ -1605,6 +1648,12 @@ string cTemplateFunction::GetParamName(eParamType pt) { case ptShiftTime:
name = "Shift Time";
break;
+ case ptShiftType:
+ name = "Shift Type";
+ break;
+ case ptShiftMode:
+ name = "Shift Mode";
+ break;
case ptStartX:
name = "Startpos X";
break;
diff --git a/libtemplate/templatefunction.h b/libtemplate/templatefunction.h index 508615d..43cb106 100644 --- a/libtemplate/templatefunction.h +++ b/libtemplate/templatefunction.h @@ -52,6 +52,8 @@ enum eParamType { ptDetached, ptFadeTime, ptShiftTime, + ptShiftType, + ptShiftMode, ptStartX, ptStartY, ptDelay, @@ -103,6 +105,19 @@ enum eImageType { itImage }; +enum eShiftType { + stNone, + stLeft, + stRight, + stTop, + stBottom +}; + +enum eShiftMode { + smLinear, + smSlowedDown +}; + enum eAnimType { atNone, atBlink, @@ -180,6 +195,8 @@ protected: bool SetBackground(string value); bool SetDirection(string value); bool SetAnimType(string value); + bool SetShiftType(string value); + bool SetShiftMode(string value); void SetDebugGrid(string value); void ParseStringParameters(void); void ParseNumericalParameters(void); diff --git a/libtemplate/templateview.c b/libtemplate/templateview.c index 2e7782b..3fcdd86 100644 --- a/libtemplate/templateview.c +++ b/libtemplate/templateview.c @@ -668,6 +668,8 @@ void cTemplateView::SetFunctionDefinitions(void) { attributes.insert("delay"); attributes.insert("fadetime"); attributes.insert("shifttime"); + attributes.insert("shifttype"); + attributes.insert("shiftmode"); attributes.insert("startx"); attributes.insert("starty"); attributes.insert("name"); @@ -875,6 +877,11 @@ cTemplateViewChannel::cTemplateViewChannel(void) { attributes.insert("width"); attributes.insert("height"); attributes.insert("fadetime"); + attributes.insert("shifttime"); + attributes.insert("shifttype"); + attributes.insert("shiftmode"); + attributes.insert("startx"); + attributes.insert("starty"); attributes.insert("scaletvx"); attributes.insert("scaletvy"); attributes.insert("scaletvwidth"); @@ -1581,6 +1588,11 @@ cTemplateViewMessage::cTemplateViewMessage(void) { attributes.insert("width"); attributes.insert("height"); attributes.insert("fadetime"); + attributes.insert("shifttime"); + attributes.insert("shifttype"); + attributes.insert("shiftmode"); + attributes.insert("startx"); + attributes.insert("starty"); attributes.insert("scaletvx"); attributes.insert("scaletvy"); attributes.insert("scaletvwidth"); @@ -1656,6 +1668,11 @@ cTemplateViewReplay::cTemplateViewReplay(void) { attributes.insert("width"); attributes.insert("height"); attributes.insert("fadetime"); + attributes.insert("shifttime"); + attributes.insert("shifttype"); + attributes.insert("shiftmode"); + attributes.insert("startx"); + attributes.insert("starty"); attributes.insert("scaletvx"); attributes.insert("scaletvy"); attributes.insert("scaletvwidth"); @@ -1839,6 +1856,11 @@ cTemplateViewVolume::cTemplateViewVolume(void) { attributes.insert("width"); attributes.insert("height"); attributes.insert("fadetime"); + attributes.insert("shifttime"); + attributes.insert("shifttype"); + attributes.insert("shiftmode"); + attributes.insert("startx"); + attributes.insert("starty"); attributes.insert("scaletvx"); attributes.insert("scaletvy"); attributes.insert("scaletvwidth"); @@ -1914,6 +1936,11 @@ cTemplateViewAudioTracks::cTemplateViewAudioTracks(void) { attributes.insert("width"); attributes.insert("height"); attributes.insert("fadetime"); + attributes.insert("shifttime"); + attributes.insert("shifttype"); + attributes.insert("shiftmode"); + attributes.insert("startx"); + attributes.insert("starty"); attributes.insert("scaletvx"); attributes.insert("scaletvy"); attributes.insert("scaletvwidth"); @@ -2036,6 +2063,11 @@ cTemplateViewPlugin::cTemplateViewPlugin(string pluginName, int viewID) { attributes.insert("width"); attributes.insert("height"); attributes.insert("fadetime"); + attributes.insert("shifttime"); + attributes.insert("shifttype"); + attributes.insert("shiftmode"); + attributes.insert("startx"); + attributes.insert("starty"); attributes.insert("scaletvx"); attributes.insert("scaletvy"); attributes.insert("scaletvwidth"); diff --git a/po/de_DE.po b/po/de_DE.po index d3bc9d2..850370f 100644 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: vdr-skindesigner 0.0.1\n" "Report-Msgid-Bugs-To: <see README>\n" -"POT-Creation-Date: 2015-01-19 17:09+0100\n" +"POT-Creation-Date: 2015-05-09 10:38+0200\n" "PO-Revision-Date: 2014-09-27 11:02+0200\n" "Last-Translator: Louis Braun <louis.braun@gmx.de>\n" "Language-Team: \n" @@ -30,6 +30,9 @@ msgstr "" msgid "Menu Item display method" msgstr "Art der Ausgabe der Menüelemente" +msgid "Frames per Second (fading and shifting)" +msgstr "Frames pro Sekunde (fading und shifting)" + msgid "Reruns" msgstr "Wiederholungen" diff --git a/po/fi_FI.po b/po/fi_FI.po index 93872ef..8baebda 100644 --- a/po/fi_FI.po +++ b/po/fi_FI.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: vdr-skindesigner 0.2.0\n" "Report-Msgid-Bugs-To: <see README>\n" -"POT-Creation-Date: 2015-01-25 01:25+0200\n" +"POT-Creation-Date: 2015-05-09 10:38+0200\n" "PO-Revision-Date: 2015-01-25 01:25+0200\n" "Last-Translator: Rolf Ahrenberg\n" "Language-Team: Finnish\n" @@ -30,6 +30,9 @@ msgstr "Yleiset" msgid "Menu Item display method" msgstr "Valikkorivien esitystapa" +msgid "Frames per Second (fading and shifting)" +msgstr "" + msgid "Reruns" msgstr "Uusinnat" @@ -9,6 +9,7 @@ cSkinDesignerSetup::cSkinDesignerSetup() { rerunDistance = config.rerunDistance; rerunMaxChannel = config.rerunMaxChannel; blockFlush = config.blockFlush; + framesPerSecond = config.framesPerSecond; menuDisplayStyle[0] = tr("after one another"); menuDisplayStyle[1] = tr("at one go"); Setup(); @@ -65,6 +66,7 @@ void cSkinDesignerSetup::Store(void) { config.rerunDistance = rerunDistance; config.rerunMaxChannel = rerunMaxChannel; config.blockFlush = blockFlush; + config.framesPerSecond = framesPerSecond; config.InitSetupIterator(); cSkinSetup *skinSetup = NULL; @@ -88,6 +90,7 @@ void cSkinDesignerSetup::Store(void) { SetupStore("RerunDistance", rerunDistance); SetupStore("RerunMaxChannel", rerunMaxChannel); SetupStore("BlockFlush", blockFlush); + SetupStore("FramesPerSecond", framesPerSecond); } cOsdItem *cSkinDesignerSetup::InfoItem(const char *label) { @@ -101,6 +104,7 @@ void cSkinDesignerSetup::PluginSetup(void) { Add(InfoItem(tr("Plugin Setup"))); Add(new cMenuEditStraItem(tr("Menu Item display method"), &blockFlush, 2, menuDisplayStyle)); + Add(new cMenuEditIntItem(tr("Frames per Second (fading and shifting)"), &framesPerSecond, 10, 100)); Add(InfoItem(tr("Reruns"))); Add(new cMenuEditIntItem(tr("Maximum number of reruns to display"), &rerunAmount, 1, 100)); @@ -15,6 +15,7 @@ private: int rerunDistance; int rerunMaxChannel; int blockFlush; + int framesPerSecond; const char *menuDisplayStyle[2]; void Setup(void); diff --git a/skins/blackhole/setup.xml b/skins/blackhole/setup.xml index e590344..0383788 100644 --- a/skins/blackhole/setup.xml +++ b/skins/blackhole/setup.xml @@ -7,6 +7,11 @@ <parameter type="bool" name="showposter" displaytext="{tr(showpostertext)}">1</parameter> <parameter type="bool" name="showmainmenuicons" displaytext="{tr(showmainmenuicons)}">1</parameter> <parameter type="int" name="fadetime" min="0" max="1000" displaytext="{tr(fadetext)}">300</parameter> + <parameter type="int" name="shifttimechannel" min="0" max="1000" displaytext="{tr(shiftchanneltext)}">0</parameter> + <parameter type="int" name="shifttimevolume" min="0" max="1000" displaytext="{tr(shiftvolumetext)}">0</parameter> + <parameter type="int" name="shifttimereplay" min="0" max="1000" displaytext="{tr(shiftreplaytext)}">0</parameter> + <parameter type="int" name="shifttimemessage" min="0" max="1000" displaytext="{tr(shiftmessagetext)}">0</parameter> + <parameter type="int" name="shifttimemenu" min="0" max="1000" displaytext="{tr(shiftmenutext)}">0</parameter> <parameter type="int" name="nummenuitemsmain" min="6" max="30" displaytext="{tr(nummenuitemsmain)}">10</parameter> <parameter type="int" name="nummenuitems" min="6" max="30" displaytext="{tr(nummenuitems)}">10</parameter> <parameter type="int" name="nummenuitemsdefault" min="6" max="30" displaytext="{tr(nummenuitemsdefault)}">16</parameter> @@ -30,10 +35,30 @@ <trans lang="fi_FI">Näytä ikonit päävalikossa</trans> </token> <token name="tr(fadetext)"> - <trans lang="en_EN">Fade time in ms</trans> - <trans lang="de_DE">Einblendzeit in ms</trans> + <trans lang="en_EN">Fade time [ms]</trans> + <trans lang="de_DE">Einblendzeit [ms]</trans> <trans lang="fi_FI">Häivytyksen kesto [ms]</trans> </token> + <token name="tr(shiftchanneltext)"> + <trans lang="en_EN">Shift time for Channel Display [ms]</trans> + <trans lang="de_DE">Einfahrzeit für Channel Display [ms]</trans> + </token> + <token name="tr(shiftvolumetext)"> + <trans lang="en_EN">Shift time for Volume Display [ms]</trans> + <trans lang="de_DE">Einfahrzeit für Volume Display [ms]</trans> + </token> + <token name="tr(shiftreplaytext)"> + <trans lang="en_EN">Shift time for Replay Display [ms]</trans> + <trans lang="de_DE">Einfahrzeit für Replay Display [ms]</trans> + </token> + <token name="tr(shiftmessagetext)"> + <trans lang="en_EN">Shift time for Message Display [ms]</trans> + <trans lang="de_DE">Einfahrzeit für Message Display [ms]</trans> + </token> + <token name="tr(shiftmenutext)"> + <trans lang="en_EN">Shift time for Clock in Menu [ms]</trans> + <trans lang="de_DE">Einfahrzeit für Uhr im Menü [ms]</trans> + </token> <token name="tr(nummenuitemsmain)"> <trans lang="en_EN">Items in main menu</trans> <trans lang="de_DE">Elemente im Hauptmenü</trans> diff --git a/skins/blackhole/xmlfiles/displaychannel.xml b/skins/blackhole/xmlfiles/displaychannel.xml index 9ee79e6..0b86fef 100644 --- a/skins/blackhole/xmlfiles/displaychannel.xml +++ b/skins/blackhole/xmlfiles/displaychannel.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE displaychannel SYSTEM "../../../dtd/displaychannel.dtd"> -<displaychannel x="0" y="0" width="100%" height="100%" fadetime="{fadetime}"> +<displaychannel x="0" y="0" width="100%" height="100%" fadetime="{fadetime}" shifttime="{shifttimechannel}" shifttype="bottom" shiftmode="slowed"> <background> <!-- global background --> diff --git a/skins/blackhole/xmlfiles/displaymenu.xml b/skins/blackhole/xmlfiles/displaymenu.xml index 22e80a5..a96521e 100644 --- a/skins/blackhole/xmlfiles/displaymenu.xml +++ b/skins/blackhole/xmlfiles/displaymenu.xml @@ -25,12 +25,6 @@ <area x="0" y="0" width="83%" height="8%" layer="2"> <drawimage imagetype="skinpart" path="displaymenuheader" x="0" y="0" width="100%" height="100%"/> </area> - <area x="74%" y="0" width="26%" height="46%" layer="3"> - <drawimage imagetype="skinpart" path="displaymenucorner" x="0" y="0" width="100%" height="100%"/> - </area> - <area x="{areawidth}*0.865" y="{areawidth}*0.005" width="13%" height="{areawidth}*0.13" layer="4"> - <drawimage imagetype="skinpart" path="watchback" x="0" y="0" width="100%" height="100%"/> - </area> </background> <!-- Available Variables header: {title} title of current menu @@ -61,9 +55,6 @@ {year} year in yyyy --> <datetime> - <area x="81%" y="0" width="7%" height="5%" layer="5"> - <drawtext x="0" valign="center" font="{digital}" fontsize="90%" color="{clrWhite}" text="{time}" /> - </area> <area x="50%" y="0" width="27%" height="8%" layer="3"> <drawtext align="right" valign="center" font="{semibold}" fontsize="90%" color="{clrWhite}" text="{daynameshort} {day}.{month}" /> </area> @@ -75,7 +66,16 @@ {hour} current hours {hmins} current "hourminutes" to display an hour hand --> - <time> + <time detached="true" delay="50" shifttime="{shifttimemenu}" shifttype="right" shiftmode="slowed"> + <area background="true" x="74%" y="0" width="26%" height="46%" layer="3"> + <drawimage imagetype="skinpart" path="displaymenucorner" x="0" y="0" width="100%" height="100%"/> + </area> + <area background="true" x="{areawidth}*0.865" y="{areawidth}*0.005" width="13%" height="{areawidth}*0.13" layer="4"> + <drawimage imagetype="skinpart" path="watchback" x="0" y="0" width="100%" height="100%"/> + </area> + <area x="80%" y="0" width="10%" height="5%" layer="5"> + <drawtext x="0" valign="center" font="{digital}" fontsize="75%" color="{clrWhite}" text="{printf('%02d:%02d.%02d', hour, min, sec)}" /> + </area> <area x="{areawidth}*0.865" y="{areawidth}*0.005" width="13%" height="{areawidth}*0.13" layer="5"> <drawimage imagetype="skinpart" path="watchhands/s_{sec}" x="0" y="0" width="100%" height="100%"/> </area> diff --git a/skins/blackhole/xmlfiles/displaymenumain.xml b/skins/blackhole/xmlfiles/displaymenumain.xml index acbd883..734605a 100644 --- a/skins/blackhole/xmlfiles/displaymenumain.xml +++ b/skins/blackhole/xmlfiles/displaymenumain.xml @@ -13,12 +13,6 @@ <area x="0" y="0" width="83%" height="8%" layer="2"> <drawimage imagetype="skinpart" path="displaymenuheader" x="0" y="0" width="100%" height="100%"/> </area> - <area x="74%" y="0" width="26%" height="46%" layer="3"> - <drawimage imagetype="skinpart" path="displaymenucorner" x="0" y="0" width="100%" height="100%"/> - </area> - <area x="{areawidth}*0.865" y="{areawidth}*0.005" width="13%" height="{areawidth}*0.13" layer="4"> - <drawimage imagetype="skinpart" path="watchback" x="0" y="0" width="100%" height="100%"/> - </area> <area x="55%" y="51%" width="44%" height="19%" layer="2"> <drawimage imagetype="skinpart" path="tachos_back" x="0" y="0" width="100%" height="100%"/> </area> @@ -75,7 +69,7 @@ {timers[channelid]} ChannelID of channel {timers[channellogoexists]} true if channel logo exists --> - <timers detached="true" delay="100" fadetime="0"> + <timers> <area condition="not{numtimers}" x="55%" y="71%" width="44%" height="19%" layer="2"> <drawtext align="center" valign="center" font="{semibold}" fontsize="40%" color="{clrWhite}" text="{tr(noactivetimers)}" /> </area> diff --git a/skins/blackhole/xmlfiles/displaymessage.xml b/skins/blackhole/xmlfiles/displaymessage.xml index 1f18edf..eb272ca 100644 --- a/skins/blackhole/xmlfiles/displaymessage.xml +++ b/skins/blackhole/xmlfiles/displaymessage.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE displaymessage SYSTEM "../../../dtd/displaymessage.dtd">
-<displaymessage x="0" y="0" width="100%" height="100%" fadetime="{fadetime}">
+<displaymessage x="0" y="0" width="100%" height="100%" fadetime="{fadetime}" shifttime="{shifttimemessage}" shifttype="bottom" shiftmode="slowed">
<background>
</background>
diff --git a/skins/blackhole/xmlfiles/displayreplay.xml b/skins/blackhole/xmlfiles/displayreplay.xml index 4ea2577..512dd5d 100644 --- a/skins/blackhole/xmlfiles/displayreplay.xml +++ b/skins/blackhole/xmlfiles/displayreplay.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE displayreplay SYSTEM "../../../dtd/displayreplay.dtd"> -<displayreplay x="0" y="0" width="100%" height="100%" fadetime="{fadetime}"> +<displayreplay x="0" y="0" width="100%" height="100%" fadetime="{fadetime}" shifttime="{shifttimereplay}" shifttype="bottom" shiftmode="slowed"> <background> <!-- global background --> @@ -81,7 +81,7 @@ {mediaheight} height of image in pixel {isbanner} true if image is a banner, false if it is a poster --> - <scrapercontent> + <scrapercontent detached="true" shifttime="{shifttimereplay}" shifttype="left" shiftmode="slowed"> <area condition="{hasposter}" x="1%" y="75%" width="{areaheight}*0.21*{posterwidth}/{posterheight}" height="21%" layer="3"> <drawimage imagetype="image" path="{posterpath}" x="0" y="0" width="100%" height="100%"/> </area> diff --git a/skins/blackhole/xmlfiles/displayvolume.xml b/skins/blackhole/xmlfiles/displayvolume.xml index 7768aff..f004b86 100644 --- a/skins/blackhole/xmlfiles/displayvolume.xml +++ b/skins/blackhole/xmlfiles/displayvolume.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE displayvolume SYSTEM "../../../dtd/displayvolume.dtd"> -<displayvolume x="79%" y="{areaheight} - {areawidth}*0.26" width="20%" height="{areawidth}*0.25" fadetime="{fadetime}"> +<displayvolume x="79%" y="{areaheight} - {areawidth}*0.26" width="20%" height="{areawidth}*0.25" fadetime="{fadetime}" shifttime="{shifttimevolume}" shifttype="right" shiftmode="slowed"> <background> <area x="0" y="0" width="100%" height="100%" layer="2"> diff --git a/skins/metrixhd/setup.xml b/skins/metrixhd/setup.xml index abaf1c6..4ed34b8 100644 --- a/skins/metrixhd/setup.xml +++ b/skins/metrixhd/setup.xml @@ -4,15 +4,30 @@ <setup> <menu> <parameter type="int" name="fadetime" min="0" max="1000" displaytext="{tr(fadetext)}">0</parameter> + <parameter type="int" name="shifttimechannel" min="0" max="1000" displaytext="{tr(shifttimechanneltext)}">0</parameter> + <parameter type="int" name="shifttimedatetime" min="0" max="1000" displaytext="{tr(shifttimedatetimetext)}">0</parameter> + <parameter type="int" name="shifttimetimers" min="0" max="1000" displaytext="{tr(shifttimetimerstext)}">0</parameter> <parameter type="bool" name="showdevices" displaytext="{tr(showdevices)}">0</parameter> </menu> <translations> <token name="tr(fadetext)"> - <trans lang="en_EN">Fade time in ms</trans> - <trans lang="de_DE">Einblendzeit in ms</trans> + <trans lang="en_EN">Fade time [ms]</trans> + <trans lang="de_DE">Einblendzeit [ms]</trans> <trans lang="fi_FI">Häivytyksen kesto [ms]</trans> </token> + <token name="tr(shifttimechanneltext)"> + <trans lang="en_EN">Shift time Channel Display [ms]</trans> + <trans lang="de_DE">Einfahrzeit Channel Display [ms]</trans> + </token> + <token name="tr(shifttimedatetimetext)"> + <trans lang="en_EN">Shift time Channel Date, Time, Weather [ms]</trans> + <trans lang="de_DE">Einfahrzeit Channel Date, Time, Wetter [ms]</trans> + </token> + <token name="tr(shifttimetimerstext)"> + <trans lang="en_EN">Shift time Timers Main Menu [ms]</trans> + <trans lang="de_DE">Einfahrzeit Timer Hauptmenü [ms]</trans> + </token> <token name="tr(showdevices)"> <trans lang="en_EN">Show DVB device info when switching channel</trans> <trans lang="de_DE">DVB Karten Info beim Umschalten anzeigen</trans> diff --git a/skins/metrixhd/xmlfiles/displaychannel.xml b/skins/metrixhd/xmlfiles/displaychannel.xml index 14547f8..c9dbb6f 100644 --- a/skins/metrixhd/xmlfiles/displaychannel.xml +++ b/skins/metrixhd/xmlfiles/displaychannel.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE displaychannel SYSTEM "../../../dtd/displaychannel.dtd"> -<displaychannel x="0" y="0" width="100%" height="100%" fadetime="{fadetime}"> +<displaychannel x="0" y="0" width="100%" height="100%" fadetime="{fadetime}" shifttime="{shifttimechannel}" shifttype="bottom" shiftmode="slowed"> <background> <!-- background infobar --> <area x="0" y="80%" width="100%" height="20%" layer="1"> @@ -186,7 +186,7 @@ {devices[channelid]} ID of the currently tuned channel {devices[source]} source of the currently tuned channel --> - <devices condition="{showdevices}" detached="true" delay="300" shifttime="500" startx="100%" starty="30%"> + <devices condition="{showdevices}" detached="true" delay="100" shifttime="{shifttimedatetime}" shifttype="right" shiftmode="slowed"> <area x="70%" y="30%" width="30%" height="{areaheight}/12 * {numdevices}" layer="1" background="true"> <fill color="{clrTransBlack}"/> </area> @@ -224,7 +224,7 @@ {pressure} pressure in HPo {ozone} ozone value in DU --> - <currentweather detached="true" delay="100" shifttime="300" startx="100%" starty="15%" > + <currentweather detached="true" delay="100" shifttime="{shifttimedatetime}" shifttype="right" shiftmode="slowed"> <area background="true" x="70%" y="15%" width="30%" height="13%" layer="1"> <fill color="{clrTransBlack}" /> <drawrectangle x="0" y="0" width="45%" height="100%" color="{clrTransBlueLight}" /> @@ -257,7 +257,7 @@ {mediaheight} height of image in pixel {isbanner} true if image is a banner, false if it is a poster --> - <scrapercontent> + <scrapercontent detached="true" delay="0" fadetime="0"> <area condition="{isbanner}" x="0" y="0" width="{areaheight}*0.13*{mediawidth}/{mediaheight}" height="13%" layer="2"> <drawimage imagetype="image" path="{mediapath}" align="center" valign="center" width="{areawidth}" height="{areaheight}"/> </area> @@ -277,7 +277,7 @@ {monthnameshort} 3 letter abbrivation of month name {year} year in yyyy --> - <datetime detached="true" delay="100" shifttime="300" startx="100%" starty="0"> + <datetime detached="true" delay="100" shifttime="{shifttimedatetime}" shifttype="right" shiftmode="slowed"> <area background="true" x="70%" y="0" width="30%" height="13%" layer="1"> <fill color="{clrTransBlack}" /> <drawrectangle x="0" y="0" width="45%" height="100%" color="{clrTransBlueLight}" /> diff --git a/skins/metrixhd/xmlfiles/displaymenumain.xml b/skins/metrixhd/xmlfiles/displaymenumain.xml index 77fd24b..140d599 100644 --- a/skins/metrixhd/xmlfiles/displaymenumain.xml +++ b/skins/metrixhd/xmlfiles/displaymenumain.xml @@ -121,7 +121,7 @@ {timers[channellogoexists]} true if channel logo exists {timers[isremotetimer]} true if timer is a remote timer from remotetimers plugin --> - <timers detached="true" delay="100" shifttime="500" startx="0" starty="100%"> + <timers detached="true" delay="100" shifttime="{shifttimetimers}" startx="0" starty="100%"> <area x="0" y="75%" width="{areawidth}/8 - 5" height="25%" layer="1"> <fill color="{clrTransBlack}" /> </area> diff --git a/skins/metrixhd/xmlfiles/displaymessage.xml b/skins/metrixhd/xmlfiles/displaymessage.xml index 0ff98b2..3a398bf 100644 --- a/skins/metrixhd/xmlfiles/displaymessage.xml +++ b/skins/metrixhd/xmlfiles/displaymessage.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE displaymessage SYSTEM "../../../dtd/displaymessage.dtd">
-<displaymessage x="5%" y="80%" width="90%" height="15%" fadetime="{fadetime}">
+<displaymessage x="5%" y="80%" width="90%" height="15%" shifttime="{fadetime}" shifttype="bottom" shiftmode="slowed">
<background>
<area x="0" y="0" width="100%" height="100%" layer="1">
<fill color="{clrTransBlack}" />
diff --git a/skins/metrixhd/xmlfiles/displayvolume.xml b/skins/metrixhd/xmlfiles/displayvolume.xml index 604f7e5..f33f653 100644 --- a/skins/metrixhd/xmlfiles/displayvolume.xml +++ b/skins/metrixhd/xmlfiles/displayvolume.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE displayvolume SYSTEM "../../../dtd/displayvolume.dtd"> -<displayvolume x="20%" y="75%" width="60%" height="20%" fadetime="{fadetime}"> +<displayvolume x="20%" y="75%" width="60%" height="20%" shifttime="{fadetime}" shifttype="bottom" shiftmode="slowed"> <background> <area x="0" y="0" width="100%" height="100%" layer="1"> <fill color="{clrTransBlack}" /> diff --git a/views/displayaudiotracksview.c b/views/displayaudiotracksview.c index c97bc5e..f2f6a32 100644 --- a/views/displayaudiotracksview.c +++ b/views/displayaudiotracksview.c @@ -4,7 +4,6 @@ cDisplayAudiotracksView::cDisplayAudiotracksView(int numTracks, cTemplateView *tmplView) : cView(tmplView) { DeleteOsdOnExit(); - SetFadeTime(tmplView->GetNumericParameter(ptFadeTime)); this->numTracks = numTracks; @@ -70,10 +69,3 @@ void cDisplayAudiotracksView::RenderMenuItems(void) { if (listView) listView->Render(); } - -void cDisplayAudiotracksView::Action(void) { - SetInitFinished(); - FadeIn(); - DoFlush(); - cView::Action(); -} diff --git a/views/displayaudiotracksview.h b/views/displayaudiotracksview.h index 3414d66..1a2e4c0 100644 --- a/views/displayaudiotracksview.h +++ b/views/displayaudiotracksview.h @@ -8,7 +8,6 @@ class cDisplayAudiotracksView : public cView { protected: int numTracks; cDisplayMenuListView *listView; - virtual void Action(void); public: cDisplayAudiotracksView(int numTracks, cTemplateView *tmplView); virtual ~cDisplayAudiotracksView(); diff --git a/views/displaychannelview.c b/views/displaychannelview.c index a189429..bcb7ad8 100644 --- a/views/displaychannelview.c +++ b/views/displaychannelview.c @@ -15,7 +15,6 @@ cDisplayChannelView::cDisplayChannelView(cTemplateView *tmplView) : cView(tmplVi lastTrackLang = ""; InitDevices(); DeleteOsdOnExit(); - SetFadeTime(tmplView->GetNumericParameter(ptFadeTime)); } cDisplayChannelView::~cDisplayChannelView() { @@ -61,11 +60,11 @@ void cDisplayChannelView::DrawDate(void) { if (!ExecuteViewElement(veDateTime)) { return; } - if (DetachViewElement(veDateTime)) { cViewElement *viewElement = GetViewElement(veDateTime); if (!viewElement) { - viewElement = new cViewElementDate(tmplView->GetViewElement(veDateTime)); + viewElement = new cViewElement(tmplView->GetViewElement(veDateTime), this); + viewElement->SetCallback(veDateTime, &cDisplayChannelView::SetDate); AddViewElement(veDateTime, viewElement); viewElement->Start(); } else { @@ -89,11 +88,11 @@ void cDisplayChannelView::DrawTime(void) { if (!ExecuteViewElement(veTime)) { return; } - if (DetachViewElement(veTime)) { cViewElement *viewElement = GetViewElement(veTime); if (!viewElement) { - viewElement = new cViewElementTime(tmplView->GetViewElement(veTime)); + viewElement = new cViewElement(tmplView->GetViewElement(veTime), this); + viewElement->SetCallback(veTime, &cDisplayChannelView::SetTime); AddViewElement(veTime, viewElement); viewElement->Start(); } else { @@ -386,7 +385,8 @@ void cDisplayChannelView::DrawSignal(void) { if (DetachViewElement(veSignalQuality)) { cViewElement *viewElement = GetViewElement(veSignalQuality); if (!viewElement) { - viewElement = new cViewElementSignal(tmplView->GetViewElement(veSignalQuality)); + viewElement = new cViewElement(tmplView->GetViewElement(veSignalQuality), this); + viewElement->SetCallback(veSignalQuality, &cDisplayChannelView::SetSignal); AddViewElement(veSignalQuality, viewElement); viewElement->Start(); } else { @@ -397,7 +397,7 @@ void cDisplayChannelView::DrawSignal(void) { map < string, string > stringTokens; map < string, int > intTokens; - bool changed = SetSignal(intTokens); + bool changed = SetSignal(false, stringTokens, intTokens); if (!changed) return; @@ -559,7 +559,8 @@ void cDisplayChannelView::DrawCurrentWeather(void) { if (DetachViewElement(veCurrentWeather)) { cViewElement *viewElement = GetViewElement(veCurrentWeather); if (!viewElement) { - viewElement = new cViewElementWeather(tmplView->GetViewElement(veCurrentWeather)); + viewElement = new cViewElement(tmplView->GetViewElement(veCurrentWeather), this); + viewElement->SetCallback(veCurrentWeather, &cDisplayChannelView::SetCurrentWeatherTokens); AddViewElement(veCurrentWeather, viewElement); viewElement->Start(); } else { @@ -569,19 +570,10 @@ void cDisplayChannelView::DrawCurrentWeather(void) { } else { map < string, string > stringTokens; map < string, int > intTokens; - if (!SetCurrentWeatherTokens(stringTokens, intTokens)){ - ClearViewElement(veCurrentWeather); + ClearViewElement(veCurrentWeather); + if (!SetCurrentWeatherTokens(false, stringTokens, intTokens)){ return; } - ClearViewElement(veCurrentWeather); DrawViewElement(veCurrentWeather, &stringTokens, &intTokens); } } - - -void cDisplayChannelView::Action(void) { - SetInitFinished(); - FadeIn(); - DoFlush(); - cView::Action(); -} diff --git a/views/displaychannelview.h b/views/displaychannelview.h index f533e1c..068b27a 100644 --- a/views/displaychannelview.h +++ b/views/displaychannelview.h @@ -14,7 +14,6 @@ private: string lastTracDesc; string lastTrackLang; string GetChannelSep(const cChannel *channel, bool prev); - virtual void Action(void); public: cDisplayChannelView(cTemplateView *tmplView); virtual ~cDisplayChannelView(); diff --git a/views/displaymenuitemview.c b/views/displaymenuitemview.c index acfee64..b9bce04 100644 --- a/views/displaymenuitemview.c +++ b/views/displaymenuitemview.c @@ -322,6 +322,7 @@ cDisplayMenuItemSchedulesView::cDisplayMenuItemSchedulesView(cTemplateViewList * eMenuCategory cat, bool isEpgSearchFav, bool current, bool selectable)
: cDisplayMenuItemView(tmplList, current, selectable) {
this->event = event;
+ esyslog("skindesigner: constructor cDisplayMenuItemSchedulesView event %s", event->Title());
this->channel = channel;
this->timerMatch = timerMatch;
this->cat = cat;
@@ -354,6 +355,7 @@ void cDisplayMenuItemSchedulesView::SetTokens(void) { }
if (event) {
+ esyslog("skindesigner: setting Tokens for event %s", event->Title());
if (selectable) {
stringTokens.insert(pair<string,string>("title", event->Title() ? event->Title() : ""));
stringTokens.insert(pair<string,string>("shorttext", event->ShortText() ? event->ShortText() : ""));
@@ -408,7 +410,6 @@ void cDisplayMenuItemSchedulesView::Prepare(void) { }
void cDisplayMenuItemSchedulesView::Render(void) {
-
DrawListItem(&stringTokens, &intTokens);
if (current) {
diff --git a/views/displaymenurootview.c b/views/displaymenurootview.c index a29f56d..74e805f 100644 --- a/views/displaymenurootview.c +++ b/views/displaymenurootview.c @@ -35,7 +35,6 @@ cDisplayMenuRootView::cDisplayMenuRootView(cTemplateView *rootView) : cView(root defaultMessageDrawn = false; defaultSortmodeDrawn = false; DeleteOsdOnExit(); - SetFadeTime(tmplView->GetNumericParameter(ptFadeTime)); } cDisplayMenuRootView::~cDisplayMenuRootView() { @@ -518,11 +517,23 @@ void cDisplayMenuRootView::DrawHeader(void) { if (!ExecuteViewElement(veHeader)) { return; } - map < string, string > stringTokens; - map < string, int > intTokens; - SetMenuHeader(cat, menuTitle, stringTokens, intTokens); - ClearViewElement(veHeader); - DrawViewElement(veHeader, &stringTokens, &intTokens); + if (DetachViewElement(veHeader)) { + cViewElement *viewElement = GetViewElement(veHeader); + if (!viewElement) { + viewElement = new cViewElementMenuHeader(tmplView->GetViewElement(veHeader), cat, menuTitle); + AddViewElement(veHeader, viewElement); + viewElement->Start(); + } else { + if (!viewElement->Starting()) + viewElement->Render(); + } + } else { + map < string, string > stringTokens; + map < string, int > intTokens; + SetMenuHeader(cat, menuTitle, stringTokens, intTokens); + ClearViewElement(veHeader); + DrawViewElement(veHeader, &stringTokens, &intTokens); + } } void cDisplayMenuRootView::DrawDateTime(bool forced) { @@ -530,15 +541,26 @@ void cDisplayMenuRootView::DrawDateTime(bool forced) { return; } - map < string, string > stringTokens; - map < string, int > intTokens; - - if (!SetDate(forced, stringTokens, intTokens)) { - return; + if (DetachViewElement(veDateTime)) { + cViewElement *viewElement = GetViewElement(veDateTime); + if (!viewElement) { + viewElement = new cViewElement(tmplView->GetViewElement(veDateTime), this); + viewElement->SetCallback(veDateTime, &cDisplayMenuRootView::SetDate); + AddViewElement(veDateTime, viewElement); + viewElement->Start(); + } else { + if (!viewElement->Starting()) + viewElement->Render(); + } + } else { + map < string, string > stringTokens; + map < string, int > intTokens; + + if (!SetDate(forced, stringTokens, intTokens)) + return; + ClearViewElement(veDateTime); + DrawViewElement(veDateTime, &stringTokens, &intTokens); } - - ClearViewElement(veDateTime); - DrawViewElement(veDateTime, &stringTokens, &intTokens); } bool cDisplayMenuRootView::DrawTime(bool forced) { @@ -546,15 +568,30 @@ bool cDisplayMenuRootView::DrawTime(bool forced) { return false; } - map < string, string > stringTokens; - map < string, int > intTokens; + if (DetachViewElement(veTime)) { + cViewElement *viewElement = GetViewElement(veTime); + if (!viewElement) { + viewElement = new cViewElement(tmplView->GetViewElement(veTime), this); + viewElement->SetCallback(veTime, &cDisplayMenuRootView::SetTime); + AddViewElement(veTime, viewElement); + viewElement->Start(); + } else { + if (!viewElement->Starting()) + if (!viewElement->Render()) + return false; + } + } else { - if (!SetTime(forced, stringTokens, intTokens)) { - return false; - } + map < string, string > stringTokens; + map < string, int > intTokens; + + if (!SetTime(forced, stringTokens, intTokens)) { + return false; + } - ClearViewElement(veTime); - DrawViewElement(veTime, &stringTokens, &intTokens); + ClearViewElement(veTime); + DrawViewElement(veTime, &stringTokens, &intTokens); + } return true; } diff --git a/views/displaymenuview.c b/views/displaymenuview.c index 16492b5..5a08844 100644 --- a/views/displaymenuview.c +++ b/views/displaymenuview.c @@ -8,9 +8,7 @@ #include "../services/scraper2vdr.h" cDisplayMenuView::cDisplayMenuView(cTemplateView *tmplView, bool menuInit) : cView(tmplView) { - if (menuInit) - SetFadeTime(tmplView->GetNumericParameter(ptFadeTime)); - else + if (!menuInit) SetFadeTime(0); cat = mcUndefined; sortMode = msmUnknown; @@ -38,11 +36,23 @@ bool cDisplayMenuView::DrawHeader(void) { if (!ExecuteViewElement(veHeader)) { return false; } - map < string, string > stringTokens; - map < string, int > intTokens; - SetMenuHeader(cat, menuTitle, stringTokens, intTokens); - ClearViewElement(veHeader); - DrawViewElement(veHeader, &stringTokens, &intTokens); + if (DetachViewElement(veHeader)) { + cViewElement *viewElement = GetViewElement(veHeader); + if (!viewElement) { + viewElement = new cViewElementMenuHeader(tmplView->GetViewElement(veHeader), cat, menuTitle); + AddViewElement(veHeader, viewElement); + viewElement->Start(); + } else { + if (!viewElement->Starting()) + viewElement->Render(); + } + } else { + map < string, string > stringTokens; + map < string, int > intTokens; + SetMenuHeader(cat, menuTitle, stringTokens, intTokens); + ClearViewElement(veHeader); + DrawViewElement(veHeader, &stringTokens, &intTokens); + } return true; } @@ -51,15 +61,29 @@ bool cDisplayMenuView::DrawDateTime(bool forced, bool &implemented) { return false; } implemented = true; - map < string, string > stringTokens; - map < string, int > intTokens; - - if (!SetDate(forced, stringTokens, intTokens)) { - return false; - } + if (DetachViewElement(veDateTime)) { + cViewElement *viewElement = GetViewElement(veDateTime); + if (!viewElement) { + viewElement = new cViewElement(tmplView->GetViewElement(veDateTime), this); + viewElement->SetCallback(veDateTime, &cDisplayMenuView::SetDate); + AddViewElement(veDateTime, viewElement); + viewElement->Start(); + } else { + if (!viewElement->Starting()) + if (!viewElement->Render()) + return false; + } + } else { + map < string, string > stringTokens; + map < string, int > intTokens; + + if (!SetDate(forced, stringTokens, intTokens)) { + return false; + } - ClearViewElement(veDateTime); - DrawViewElement(veDateTime, &stringTokens, &intTokens); + ClearViewElement(veDateTime); + DrawViewElement(veDateTime, &stringTokens, &intTokens); + } return true; } @@ -68,16 +92,31 @@ bool cDisplayMenuView::DrawTime(bool forced, bool &implemented) { return false; } implemented = true; - map < string, string > stringTokens; - map < string, int > intTokens; - if (!SetTime(forced, stringTokens, intTokens)) { - return false; - } + if (DetachViewElement(veTime)) { + cViewElement *viewElement = GetViewElement(veTime); + if (!viewElement) { + viewElement = new cViewElement(tmplView->GetViewElement(veTime), this); + viewElement->SetCallback(veTime, &cDisplayMenuView::SetTime); + AddViewElement(veTime, viewElement); + viewElement->Start(); + } else { + if (!viewElement->Starting()) + if (!viewElement->Render()) + return false; + } + } else { + + map < string, string > stringTokens; + map < string, int > intTokens; - ClearViewElement(veTime); - DrawViewElement(veTime, &stringTokens, &intTokens); + if (!SetTime(forced, stringTokens, intTokens)) { + return false; + } + ClearViewElement(veTime); + DrawViewElement(veTime, &stringTokens, &intTokens); + } return true; } @@ -322,7 +361,8 @@ void cDisplayMenuMainView::DrawDiscUsage(void) { if (DetachViewElement(veDiscUsage)) { cViewElement *viewElement = GetViewElement(veDiscUsage); if (!viewElement) { - viewElement = new cViewElementDiscUsage(tmplView->GetViewElement(veDiscUsage)); + viewElement = new cViewElement(tmplView->GetViewElement(veDiscUsage), this); + viewElement->SetCallback(veDiscUsage, &cDisplayMenuMainView::SetDiscUsage); AddViewElement(veDiscUsage, viewElement); viewElement->Start(); } else { @@ -332,7 +372,7 @@ void cDisplayMenuMainView::DrawDiscUsage(void) { } else { map < string, string > stringTokens; map < string, int > intTokens; - SetDiscUsage(stringTokens, intTokens); + SetDiscUsage(false, stringTokens, intTokens); ClearViewElement(veDiscUsage); DrawViewElement(veDiscUsage, &stringTokens, &intTokens); } @@ -346,7 +386,8 @@ bool cDisplayMenuMainView::DrawLoad(void) { if (DetachViewElement(veSystemLoad)) { cViewElement *viewElement = GetViewElement(veSystemLoad); if (!viewElement) { - viewElement = new cViewElementSystemLoad(tmplView->GetViewElement(veSystemLoad)); + viewElement = new cViewElement(tmplView->GetViewElement(veSystemLoad), this); + viewElement->SetCallback(veSystemLoad, &cDisplayMenuMainView::SetSystemLoad); AddViewElement(veSystemLoad, viewElement); viewElement->Start(); changed = true; @@ -357,7 +398,7 @@ bool cDisplayMenuMainView::DrawLoad(void) { } else { map < string, string > stringTokens; map < string, int > intTokens; - changed = SetSystemLoad(stringTokens, intTokens); + changed = SetSystemLoad(false, stringTokens, intTokens); if (changed) { ClearViewElement(veSystemLoad); DrawViewElement(veSystemLoad, &stringTokens, &intTokens); @@ -374,7 +415,8 @@ bool cDisplayMenuMainView::DrawMemory(void) { if (DetachViewElement(veSystemMemory)) { cViewElement *viewElement = GetViewElement(veSystemMemory); if (!viewElement) { - viewElement = new cViewElementSystemMemory(tmplView->GetViewElement(veSystemMemory)); + viewElement = new cViewElement(tmplView->GetViewElement(veSystemMemory), this); + viewElement->SetCallback(veSystemMemory, &cDisplayMenuMainView::SetSystemMemory); AddViewElement(veSystemMemory, viewElement); viewElement->Start(); changed = true; @@ -385,7 +427,7 @@ bool cDisplayMenuMainView::DrawMemory(void) { } else { map < string, string > stringTokens; map < string, int > intTokens; - changed = SetSystemMemory(stringTokens, intTokens); + changed = SetSystemMemory(false, stringTokens, intTokens); if (changed) { ClearViewElement(veSystemMemory); DrawViewElement(veSystemMemory, &stringTokens, &intTokens); @@ -401,7 +443,8 @@ void cDisplayMenuMainView::DrawTemperatures(void) { if (DetachViewElement(veTemperatures)) { cViewElement *viewElement = GetViewElement(veTemperatures); if (!viewElement) { - viewElement = new cViewElementTemperature(tmplView->GetViewElement(veTemperatures)); + viewElement = new cViewElement(tmplView->GetViewElement(veTemperatures), this); + viewElement->SetCallback(veTemperatures, &cDisplayMenuMainView::SetSystemTemperatures); AddViewElement(veTemperatures, viewElement); viewElement->Start(); } else { @@ -411,7 +454,7 @@ void cDisplayMenuMainView::DrawTemperatures(void) { } else { map < string, string > stringTokens; map < string, int > intTokens; - bool changed = SetSystemTemperatures(stringTokens, intTokens); + bool changed = SetSystemTemperatures(false, stringTokens, intTokens); if (changed) { ClearViewElement(veTemperatures); DrawViewElement(veTemperatures, &stringTokens, &intTokens); @@ -487,7 +530,8 @@ void cDisplayMenuMainView::DrawCurrentWeather(void) { if (DetachViewElement(veCurrentWeather)) { cViewElement *viewElement = GetViewElement(veCurrentWeather); if (!viewElement) { - viewElement = new cViewElementWeather(tmplView->GetViewElement(veCurrentWeather)); + viewElement = new cViewElement(tmplView->GetViewElement(veCurrentWeather), this); + viewElement->SetCallback(veCurrentWeather, &cDisplayMenuMainView::SetCurrentWeatherTokens); AddViewElement(veCurrentWeather, viewElement); viewElement->Start(); } else { @@ -497,11 +541,10 @@ void cDisplayMenuMainView::DrawCurrentWeather(void) { } else { map < string, string > stringTokens; map < string, int > intTokens; - if (!SetCurrentWeatherTokens(stringTokens, intTokens)){ - ClearViewElement(veCurrentWeather); + ClearViewElement(veCurrentWeather); + if (!SetCurrentWeatherTokens(false, stringTokens, intTokens)){ return; } - ClearViewElement(veCurrentWeather); DrawViewElement(veCurrentWeather, &stringTokens, &intTokens); } } diff --git a/views/displaymessageview.c b/views/displaymessageview.c index b51802b..25f41fb 100644 --- a/views/displaymessageview.c +++ b/views/displaymessageview.c @@ -4,7 +4,6 @@ cDisplayMessageView::cDisplayMessageView(cTemplateView *tmplView) : cView(tmplView) { DeleteOsdOnExit(); - SetFadeTime(tmplView->GetNumericParameter(ptFadeTime)); } cDisplayMessageView::~cDisplayMessageView() { @@ -47,10 +46,3 @@ void cDisplayMessageView::DrawMessage(eMessageType type, const char *text) { void cDisplayMessageView::ClearMessage(void) { ClearViewElement(veMessage); } - -void cDisplayMessageView::Action(void) { - SetInitFinished(); - FadeIn(); - DoFlush(); - cView::Action(); -} diff --git a/views/displaymessageview.h b/views/displaymessageview.h index 2fc1428..8e68d49 100644 --- a/views/displaymessageview.h +++ b/views/displaymessageview.h @@ -5,8 +5,6 @@ #include "view.h" class cDisplayMessageView : public cView { -private: - virtual void Action(void); public: cDisplayMessageView(cTemplateView *tmplView); virtual ~cDisplayMessageView(); diff --git a/views/displayreplayview.c b/views/displayreplayview.c index a8f2fca..3436d5b 100644 --- a/views/displayreplayview.c +++ b/views/displayreplayview.c @@ -12,7 +12,6 @@ cDisplayReplayView::cDisplayReplayView(cTemplateView *tmplView) : cView(tmplView lastMarks = NULL; markActive = -1; DeleteOsdOnExit(); - SetFadeTime(tmplView->GetNumericParameter(ptFadeTime)); } cDisplayReplayView::~cDisplayReplayView() { @@ -490,10 +489,3 @@ void cDisplayReplayView::RememberMarks(const cMarks *marks) { i++; } } - -void cDisplayReplayView::Action(void) { - SetInitFinished(); - FadeIn(); - DoFlush(); - cView::Action(); -} diff --git a/views/displayreplayview.h b/views/displayreplayview.h index 3b7c3e9..1cfc634 100644 --- a/views/displayreplayview.h +++ b/views/displayreplayview.h @@ -15,7 +15,6 @@ private: int markActive; bool MarksChanged(const cMarks *marks, int current); void RememberMarks(const cMarks *marks); - virtual void Action(void); public: cDisplayReplayView(cTemplateView *tmplView); virtual ~cDisplayReplayView(); diff --git a/views/displayviewelements.c b/views/displayviewelements.c index 7f88990..5f337a3 100644 --- a/views/displayviewelements.c +++ b/views/displayviewelements.c @@ -7,8 +7,8 @@ cViewElementDevices::cViewElementDevices(bool light, cTemplateViewElement *tmplV bool cViewElementDevices::Render(void) { ClearTokens(); - map < string, vector< map< string, string > > > deviceLoopTokens; - vector< map< string, string > > devices; + map < string, vector<stringmap> > deviceLoopTokens; + vector<stringmap> devices; if (init) InitDevices(); @@ -27,71 +27,6 @@ bool cViewElementDevices::Render(void) { /********************************************************************************************************************/ -cViewElementSignal::cViewElementSignal(cTemplateViewElement *tmplViewElement) : cViewElement(tmplViewElement) { -} - -bool cViewElementSignal::Render(void) { - ClearTokens(); - bool changed = SetSignal(intTokens); - if (!changed) - return false; - ClearViewElement(veSignalQuality); - DrawViewElement(veSignalQuality, &stringTokens, &intTokens); - return true; -} - -/********************************************************************************************************************/ - -cViewElementWeather::cViewElementWeather(cTemplateViewElement *tmplViewElement) : cViewElement(tmplViewElement) { -} - -bool cViewElementWeather::Render(void) { - ClearTokens(); - if (!SetCurrentWeatherTokens(stringTokens, intTokens)){ - ClearViewElement(veCurrentWeather); - return false; - } - ClearViewElement(veCurrentWeather); - DrawViewElement(veCurrentWeather, &stringTokens, &intTokens); - return true; -} - -/********************************************************************************************************************/ - -cViewElementDate::cViewElementDate(cTemplateViewElement *tmplViewElement) : cViewElement(tmplViewElement) { - init = true; -} - -bool cViewElementDate::Render(void) { - ClearTokens(); - if (!SetDate(init, stringTokens, intTokens)) { - return false; - } - init = false; - ClearViewElement(veDateTime); - DrawViewElement(veDateTime, &stringTokens, &intTokens); - return true; -} - -/********************************************************************************************************************/ - -cViewElementTime::cViewElementTime(cTemplateViewElement *tmplViewElement) : cViewElement(tmplViewElement) { - init = true; -} - -bool cViewElementTime::Render(void) { - ClearTokens(); - if (!SetTime(init, stringTokens, intTokens)) { - return false; - } - init = false; - ClearViewElement(veTime); - DrawViewElement(veTime, &stringTokens, &intTokens); - return true; -} - -/********************************************************************************************************************/ - cViewElementScraperContent::cViewElementScraperContent(const cEvent *event, ScraperContentType type, cTemplateViewElement *tmplViewElement) : cViewElement(tmplViewElement) { this->event = event; this->type = type; @@ -161,70 +96,29 @@ bool cViewElementLastRecordings::Render(void) { /********************************************************************************************************************/ -cViewElementDiscUsage::cViewElementDiscUsage(cTemplateViewElement *tmplViewElement) : cViewElement(tmplViewElement) { -} - -bool cViewElementDiscUsage::Render(void) { - ClearTokens(); - SetDiscUsage(stringTokens, intTokens); - - ClearViewElement(veDiscUsage); - DrawViewElement(veDiscUsage, &stringTokens, &intTokens); - return true; -} - -/********************************************************************************************************************/ - -cViewElementSystemLoad::cViewElementSystemLoad(cTemplateViewElement *tmplViewElement) : cViewElement(tmplViewElement) { -} - -bool cViewElementSystemLoad::Render(void) { - ClearTokens(); - if (!SetSystemLoad(stringTokens, intTokens)) - return false; - ClearViewElement(veSystemLoad); - DrawViewElement(veSystemLoad, &stringTokens, &intTokens); - return true; -} - -/********************************************************************************************************************/ - -cViewElementSystemMemory::cViewElementSystemMemory(cTemplateViewElement *tmplViewElement) : cViewElement(tmplViewElement) { -} - -bool cViewElementSystemMemory::Render(void) { - ClearTokens(); - if (!SetSystemMemory(stringTokens, intTokens)) - return false; - ClearViewElement(veSystemMemory); - DrawViewElement(veSystemMemory, &stringTokens, &intTokens); - return true; -} - -/********************************************************************************************************************/ - -cViewElementTemperature::cViewElementTemperature(cTemplateViewElement *tmplViewElement) : cViewElement(tmplViewElement) { +cViewElementCurrentSchedule::cViewElementCurrentSchedule(cTemplateViewElement *tmplViewElement, string currentRecording) : cViewElement(tmplViewElement) { + this->currentRecording = currentRecording; } -bool cViewElementTemperature::Render(void) { +bool cViewElementCurrentSchedule::Render(void) { ClearTokens(); - if (!SetSystemTemperatures(stringTokens, intTokens)) - return false; - ClearViewElement(veTemperatures); - DrawViewElement(veTemperatures, &stringTokens, &intTokens); + SetCurrentSchedule(currentRecording, stringTokens, intTokens); + ClearViewElement(veCurrentSchedule); + DrawViewElement(veCurrentSchedule, &stringTokens, &intTokens); return true; } /********************************************************************************************************************/ -cViewElementCurrentSchedule::cViewElementCurrentSchedule(cTemplateViewElement *tmplViewElement, string currentRecording) : cViewElement(tmplViewElement) { - this->currentRecording = currentRecording; +cViewElementMenuHeader::cViewElementMenuHeader(cTemplateViewElement *tmplViewElement, eMenuCategory cat, string menuTitle) : cViewElement(tmplViewElement) { + this->cat = cat; + this->menuTitle = menuTitle; } -bool cViewElementCurrentSchedule::Render(void) { +bool cViewElementMenuHeader::Render(void) { ClearTokens(); - SetCurrentSchedule(currentRecording, stringTokens, intTokens); - ClearViewElement(veCurrentSchedule); - DrawViewElement(veCurrentSchedule, &stringTokens, &intTokens); + SetMenuHeader(cat, menuTitle, stringTokens, intTokens); + ClearViewElement(veHeader); + DrawViewElement(veHeader, &stringTokens, &intTokens); return true; } diff --git a/views/displayviewelements.h b/views/displayviewelements.h index 070d205..cb02c39 100644 --- a/views/displayviewelements.h +++ b/views/displayviewelements.h @@ -15,40 +15,6 @@ public: bool Render(void); }; -class cViewElementSignal : public cViewElement, public cViewHelpers { -private: -public: - cViewElementSignal(cTemplateViewElement *tmplViewElement); - virtual ~cViewElementSignal() {}; - bool Render(void); -}; - -class cViewElementWeather : public cViewElement, public cViewHelpers { -private: -public: - cViewElementWeather(cTemplateViewElement *tmplViewElement); - virtual ~cViewElementWeather() {}; - bool Render(void); -}; - -class cViewElementDate : public cViewElement, public cViewHelpers { -private: - bool init; -public: - cViewElementDate(cTemplateViewElement *tmplViewElement); - virtual ~cViewElementDate() {}; - bool Render(void); -}; - -class cViewElementTime : public cViewElement, public cViewHelpers { -private: - bool init; -public: - cViewElementTime(cTemplateViewElement *tmplViewElement); - virtual ~cViewElementTime() {}; - bool Render(void); -}; - enum ScraperContentType { ctPosterBanner, ctFull @@ -89,44 +55,22 @@ public: bool Render(void); }; -class cViewElementDiscUsage : public cViewElement, public cViewHelpers { -private: -public: - cViewElementDiscUsage(cTemplateViewElement *tmplViewElement); - virtual ~cViewElementDiscUsage() {}; - bool Render(void); -}; - -class cViewElementSystemLoad : public cViewElement, public cViewHelpers { -private: -public: - cViewElementSystemLoad(cTemplateViewElement *tmplViewElement); - virtual ~cViewElementSystemLoad() {}; - bool Render(void); -}; - -class cViewElementSystemMemory : public cViewElement, public cViewHelpers { -private: -public: - cViewElementSystemMemory(cTemplateViewElement *tmplViewElement); - virtual ~cViewElementSystemMemory() {}; - bool Render(void); -}; - -class cViewElementTemperature : public cViewElement, public cViewHelpers { +class cViewElementCurrentSchedule : public cViewElement, public cViewHelpers { private: + string currentRecording; public: - cViewElementTemperature(cTemplateViewElement *tmplViewElement); - virtual ~cViewElementTemperature() {}; + cViewElementCurrentSchedule(cTemplateViewElement *tmplViewElement, string currentRecording); + virtual ~cViewElementCurrentSchedule() {}; bool Render(void); }; -class cViewElementCurrentSchedule : public cViewElement, public cViewHelpers { +class cViewElementMenuHeader : public cViewElement, public cViewHelpers { private: - string currentRecording; + eMenuCategory cat; + string menuTitle; public: - cViewElementCurrentSchedule(cTemplateViewElement *tmplViewElement, string currentRecording); - virtual ~cViewElementCurrentSchedule() {}; + cViewElementMenuHeader(cTemplateViewElement *tmplViewElement, eMenuCategory cat, string menuTitle); + virtual ~cViewElementMenuHeader() {}; bool Render(void); }; diff --git a/views/displayvolumeview.c b/views/displayvolumeview.c index 4ab2fdd..94b073d 100644 --- a/views/displayvolumeview.c +++ b/views/displayvolumeview.c @@ -6,7 +6,6 @@ cDisplayVolumeView::cDisplayVolumeView(cTemplateView *tmplView) : cView(tmplView volumeLast = -1; muteLast = false; DeleteOsdOnExit(); - SetFadeTime(tmplView->GetNumericParameter(ptFadeTime)); } cDisplayVolumeView::~cDisplayVolumeView() { @@ -46,10 +45,3 @@ void cDisplayVolumeView::DrawVolume(int current, int total, bool mute) { ClearViewElement(veVolume); DrawViewElement(veVolume, &stringTokens, &intTokens); } - -void cDisplayVolumeView::Action(void) { - SetInitFinished(); - FadeIn(); - DoFlush(); - cView::Action(); -} diff --git a/views/displayvolumeview.h b/views/displayvolumeview.h index 544426e..9ad9eab 100644 --- a/views/displayvolumeview.h +++ b/views/displayvolumeview.h @@ -8,7 +8,6 @@ class cDisplayVolumeView : public cView { private: int volumeLast; bool muteLast; - virtual void Action(void); public: cDisplayVolumeView(cTemplateView *tmplView); virtual ~cDisplayVolumeView(); diff --git a/views/view.c b/views/view.c index 0bdf019..125f5c3 100644 --- a/views/view.c +++ b/views/view.c @@ -7,6 +7,11 @@ using namespace std; cView::cView(cTemplateView *tmplView) : cPixmapContainer(tmplView->DrawGebugGrid() ? tmplView->GetNumPixmaps() + 1 : tmplView->GetNumPixmaps()) {
this->tmplView = tmplView;
+ SetFadeTime(tmplView->GetNumericParameter(ptFadeTime));
+ SetShiftTime(tmplView->GetNumericParameter(ptShiftTime));
+ SetStartPos(tmplView->GetNumericParameter(ptStartX), tmplView->GetNumericParameter(ptStartY));
+ SetShiftType(tmplView->GetNumericParameter(ptShiftType));
+ SetShiftMode(tmplView->GetNumericParameter(ptShiftMode));
tvScaled = tmplView->GetScalingWindow(scalingWindow);
if (tvScaled) {
cDevice::PrimaryDevice()->ScaleVideo(scalingWindow);
@@ -67,6 +72,13 @@ void cView::Init(void) { }
void cView::Action(void) {
+ SetInitFinished();
+ if (IsAnimated()) {
+ ShiftIn();
+ } else {
+ FadeIn();
+ }
+ DoFlush();
if (scrolling) {
DoSleep(scrollDelay);
if (scrollOrientation == orHorizontal) {
@@ -1045,20 +1057,57 @@ cRect cView::CalculateAnimationClip(int numPix, cRect &pos) { ************************************************************************/
cViewElement::cViewElement(cTemplateViewElement *tmplViewElement) : cView(tmplViewElement) {
+ init = true;
+ ve = veUndefined;
+ helper = NULL;
+ SetTokens = NULL;
tmplViewElement->SetPixOffset(0);
delay = tmplViewElement->GetNumericParameter(ptDelay);
SetFadeTime(tmplViewElement->GetNumericParameter(ptFadeTime));
SetShiftTime(tmplViewElement->GetNumericParameter(ptShiftTime));
SetStartPos(tmplViewElement->GetNumericParameter(ptStartX), tmplViewElement->GetNumericParameter(ptStartY));
+ SetShiftType(tmplViewElement->GetNumericParameter(ptShiftType));
+ SetShiftMode(tmplViewElement->GetNumericParameter(ptShiftMode));
}
+cViewElement::cViewElement(cTemplateViewElement *tmplViewElement, cViewHelpers *helper) : cView(tmplViewElement) {
+ init = true;
+ ve = veUndefined;
+ this->helper = helper;
+ SetTokens = NULL;
+ tmplViewElement->SetPixOffset(0);
+ delay = tmplViewElement->GetNumericParameter(ptDelay);
+ SetFadeTime(tmplViewElement->GetNumericParameter(ptFadeTime));
+ SetShiftTime(tmplViewElement->GetNumericParameter(ptShiftTime));
+ SetStartPos(tmplViewElement->GetNumericParameter(ptStartX), tmplViewElement->GetNumericParameter(ptStartY));
+ SetShiftType(tmplViewElement->GetNumericParameter(ptShiftType));
+ SetShiftMode(tmplViewElement->GetNumericParameter(ptShiftMode));
+}
+
cViewElement::~cViewElement() {
CancelSave();
}
+bool cViewElement::Render(void) {
+ if (!helper || !SetTokens) {
+ return false;
+ }
+ ClearTokens();
+ bool done = (helper->*SetTokens)(init, stringTokens, intTokens);
+ if (!done) {
+ return false;
+ }
+ init = false;
+ ClearViewElement(ve);
+ DrawViewElement(ve, &stringTokens, &intTokens);
+ return true;
+}
+
void cViewElement::Action(void) {
DoSleep(delay);
- Render();
+ if (!Running())
+ return;
+ Render();
SetInitFinished();
if (IsAnimated()) {
ShiftIn();
diff --git a/views/view.h b/views/view.h index b7918ca..7b85a6c 100644 --- a/views/view.h +++ b/views/view.h @@ -5,6 +5,7 @@ #include "map"
#include "../libcore/pixmapcontainer.h"
#include "../libtemplate/template.h"
+#include "viewhelpers.h"
#include "animation.h"
using namespace std;
@@ -79,15 +80,21 @@ public: class cViewElement : public cView {
private:
protected:
+ bool init;
+ eViewElement ve;
int delay;
- map < string, string > stringTokens;
- map < string, int > intTokens;
+ stringmap stringTokens;
+ intmap intTokens;
+ bool (cViewHelpers::*SetTokens)(bool, stringmap&, intmap&);
+ cViewHelpers *helper;
void Action(void);
void ClearTokens(void);
public:
cViewElement(cTemplateViewElement *tmplViewElement);
+ cViewElement(cTemplateViewElement *tmplViewElement, cViewHelpers *helper);
virtual ~cViewElement();
- virtual bool Render(void) { return false; };
+ void SetCallback(eViewElement ve, bool (cViewHelpers::*SetTokens)(bool, stringmap&, intmap&)) { this->ve = ve; this->SetTokens = SetTokens; };
+ virtual bool Render(void);
bool Starting(void) { return Running(); };
};
diff --git a/views/viewhelpers.c b/views/viewhelpers.c index 2be6d8f..47aa83b 100644 --- a/views/viewhelpers.c +++ b/views/viewhelpers.c @@ -36,6 +36,234 @@ cViewHelpers::~cViewHelpers() { } } +/****************************************************************** +* Public Functions +******************************************************************/ +bool cViewHelpers::SetDate(bool forced, stringmap &stringTokens, intmap &intTokens) { + time_t t = time(0); // get time now + struct tm * now = localtime(&t); + int min = now->tm_min; + if (!forced && min == lastMinute) { + return false; + } + lastMinute = min; + + intTokens.insert(pair<string, int>("year", now->tm_year + 1900)); + intTokens.insert(pair<string, int>("day", now->tm_mday)); + + char monthname[20]; + char monthshort[10]; + strftime(monthshort, sizeof(monthshort), "%b", now); + strftime(monthname, sizeof(monthname), "%B", now); + + stringTokens.insert(pair<string,string>("monthname", monthname)); + stringTokens.insert(pair<string,string>("monthnameshort", monthshort)); + stringTokens.insert(pair<string,string>("month", *cString::sprintf("%02d", now->tm_mon + 1))); + stringTokens.insert(pair<string,string>("dayleadingzero", *cString::sprintf("%02d", now->tm_mday))); + stringTokens.insert(pair<string,string>("dayname", *WeekDayNameFull(now->tm_wday))); + stringTokens.insert(pair<string,string>("daynameshort", *WeekDayName(now->tm_wday))); + stringTokens.insert(pair<string,string>("time", *TimeString(t))); + + return true; +} + +bool cViewHelpers::SetTime(bool forced, stringmap &stringTokens, intmap &intTokens) { + time_t t = time(0); // get time now + struct tm * now = localtime(&t); + int sec = now->tm_sec; + if (!forced && sec == lastSecond) { + return false; + } + int min = now->tm_min; + int hour = now->tm_hour; + int hourMinutes = hour%12 * 5 + min / 12; + + intTokens.insert(pair<string, int>("sec", sec)); + intTokens.insert(pair<string, int>("min", min)); + intTokens.insert(pair<string, int>("hour", hour)); + intTokens.insert(pair<string, int>("hmins", hourMinutes)); + + lastSecond = sec; + return true; +} + +bool cViewHelpers::SetSignal(bool forced, stringmap &stringTokens, intmap &intTokens) { + bool done = false; + time_t Now = time(NULL); + if (Now != lSignalDisplay) { + int SignalStrength = cDevice::ActualDevice()->SignalStrength(); + int SignalQuality = cDevice::ActualDevice()->SignalQuality(); + if (SignalStrength < 0) SignalStrength = 0; + if (SignalQuality < 0) SignalQuality = 0; + if ((SignalStrength == 0)&&(SignalQuality==0)) + return done; + if ((lSignalStrength != SignalStrength) || (lSignalQuality != SignalQuality)) { + intTokens.insert(pair<string,int>("signalstrength", SignalStrength)); + intTokens.insert(pair<string,int>("signalquality", SignalQuality)); + lSignalStrength = SignalStrength; + lSignalQuality = SignalQuality; + done = true; + } + lSignalDisplay = Now; + } + return done; +} + +bool cViewHelpers::SetCurrentWeatherTokens(bool forced, stringmap &stringTokens, intmap &intTokens) { + static cPlugin *pWeatherForecast = cPluginManager::GetPlugin("weatherforecast"); + if (!pWeatherForecast) + return false; + cServiceCurrentWeather currentWeather; + if (!pWeatherForecast->Service("GetCurrentWeather", ¤tWeather)) { + return false; + } + stringTokens.insert(pair<string,string>("timestamp", currentWeather.timeStamp)); + stringTokens.insert(pair<string,string>("temperature", currentWeather.temperature)); + stringTokens.insert(pair<string,string>("apparenttemperature", currentWeather.apparentTemperature)); + stringTokens.insert(pair<string,string>("mintemperature", currentWeather.minTemperature)); + stringTokens.insert(pair<string,string>("maxtemperature", currentWeather.maxTemperature)); + stringTokens.insert(pair<string,string>("summary", currentWeather.summary)); + stringTokens.insert(pair<string,string>("icon", currentWeather.icon)); + stringTokens.insert(pair<string,string>("precipitationintensity", currentWeather.precipitationIntensity)); + intTokens.insert(pair<string,int>("precipitationprobability", currentWeather.precipitationProbability)); + stringTokens.insert(pair<string,string>("precipitationtype", currentWeather.precipitationType)); + intTokens.insert(pair<string,int>("humidity", currentWeather.humidity)); + stringTokens.insert(pair<string,string>("windspeed", currentWeather.windSpeed)); + intTokens.insert(pair<string,int>("windbearing", currentWeather.windBearing)); + stringTokens.insert(pair<string,string>("windbearingstring", currentWeather.windBearingString)); + stringTokens.insert(pair<string,string>("visibility", currentWeather.visibility)); + intTokens.insert(pair<string,int>("cloudcover", currentWeather.cloudCover)); + stringTokens.insert(pair<string,string>("pressure", currentWeather.pressure)); + stringTokens.insert(pair<string,string>("ozone", currentWeather.ozone)); + return true; +} + +bool cViewHelpers::SetDiscUsage(bool forced, stringmap &stringTokens, intmap &intTokens) { + string vdrUsageString = *cVideoDiskUsage::String(); + int discUsage = cVideoDiskUsage::UsedPercent(); + bool discAlert = (discUsage > 95) ? true : false; + string freeTime = *cString::sprintf("%02d:%02d", cVideoDiskUsage::FreeMinutes() / 60, cVideoDiskUsage::FreeMinutes() % 60); + int freeGB = cVideoDiskUsage::FreeMB() / 1024; + + intTokens.insert(pair<string, int>("usedpercent", discUsage)); + intTokens.insert(pair<string, int>("freepercent", 100-discUsage)); + intTokens.insert(pair<string, int>("discalert", discAlert)); + intTokens.insert(pair<string, int>("freegb", freeGB)); + stringTokens.insert(pair<string,string>("freetime", freeTime)); + stringTokens.insert(pair<string,string>("vdrusagestring", vdrUsageString)); + return true; +} + +bool cViewHelpers::SetSystemLoad(bool forced, stringmap &stringTokens, intmap &intTokens) { + double systemLoad; + if (getloadavg(&systemLoad, 1) > 0) { + if (lastSystemLoad == systemLoad) { + return false; + } + string load = *cString::sprintf("%.2f", systemLoad); + int loadHand = systemLoad * 1000; + int loadHandValue = 0; + if (loadHand > 2500) + loadHandValue = 2525; + else { + + int loadHandDec = loadHand - (loadHand / 100) * 100; + + if (loadHandDec <= 12) + loadHandDec = 0; + else if (loadHandDec <= 37) + loadHandDec = 25; + else if (loadHandDec <= 62) + loadHandDec = 50; + else if (loadHandDec <= 87) + loadHandDec = 75; + else + loadHandDec = 0; + + loadHandValue = loadHand / 100 * 100 + loadHandDec; + } + stringTokens.insert(pair<string,string>("load", load)); + intTokens.insert(pair<string,int>("loadhand", loadHandValue)); + lastSystemLoad = systemLoad; + } else { + return false; + } + return true; +} + +bool cViewHelpers::SetSystemMemory(bool forced, stringmap &stringTokens, intmap &intTokens) { + struct sysinfo memInfo; + sysinfo (&memInfo); + + long long totalMem = memInfo.totalram; + totalMem += memInfo.totalswap; + totalMem *= memInfo.mem_unit; + int totalMemMB = totalMem / 1024 / 1024; + + long long usedMem = memInfo.totalram - memInfo.freeram; + usedMem += memInfo.totalswap - memInfo.freeswap; + usedMem *= memInfo.mem_unit; + int usedMemMB = usedMem / 1024 / 1024; + + if (lastMemUsage == usedMemMB) { + return false; + } + lastMemUsage = usedMemMB; + + intTokens.insert(pair<string,int>("totalmem", totalMemMB)); + intTokens.insert(pair<string,int>("usedmem", usedMemMB)); + if (totalMemMB > 0) + intTokens.insert(pair<string,int>("usedmempercent", usedMemMB * 100 / totalMemMB)); + return true; +} + +bool cViewHelpers::SetSystemTemperatures(bool forced, stringmap &stringTokens, intmap &intTokens) { + cString execCommand = cString::sprintf("cd \"%s/\"; \"%s/temperatures\"", SCRIPTFOLDER, SCRIPTFOLDER); + system(*execCommand); + + string tempCPU, tempGPU; + int cpu, gpu; + + cString itemFilename = cString::sprintf("%s/cpu", SCRIPTOUTPUTPATH ); + ifstream file(*itemFilename, ifstream::in); + if( file.is_open() ) { + std::getline(file, tempCPU); + if (tempCPU.size() > 2) { + cpu = atoi(tempCPU.substr(0,2).c_str()); + } else + cpu = 0; + file.close(); + } else { + tempCPU = "0°C"; + cpu = 0; + } + + itemFilename = cString::sprintf("%s/gpu", SCRIPTOUTPUTPATH ); + ifstream file2(*itemFilename, ifstream::in); + if( file2.is_open() ) { + std::getline(file2, tempGPU); + if (tempGPU.size() > 2) { + gpu = atoi(tempGPU.substr(0,2).c_str()); + } else + gpu = 0; + file2.close(); + } else { + tempGPU = "0°C"; + gpu = 0; + } + + intTokens.insert(pair<string,int>("cputemp", cpu)); + intTokens.insert(pair<string,int>("gputemp", gpu)); + return true; +} + +bool cViewHelpers::SetDummy(bool forced, stringmap &stringTokens, intmap &intTokens) { + return true; +} + +/****************************************************************** +* Protected Functions +******************************************************************/ void cViewHelpers::InitDevices(void) { numDevices = cDevice::NumDevices(); lastSignalStrength = new int[numDevices]; @@ -49,7 +277,7 @@ void cViewHelpers::InitDevices(void) { devicesInit = true; } -bool cViewHelpers::SetDevices(bool initial, bool light, map<string,int> *intTokens, vector<map<string,string> > *devices) { +bool cViewHelpers::SetDevices(bool initial, bool light, intmap *intTokens, vector<stringmap> *devices) { if (!initial) { if (light) return false; @@ -99,7 +327,7 @@ bool cViewHelpers::SetDevices(bool initial, bool light, map<string,int> *intToke continue; } - map< string, string > deviceVals; + stringmap deviceVals; stringstream strNum; strNum << actualNumDevices; actualNumDevices++; @@ -164,28 +392,6 @@ bool cViewHelpers::SetDevices(bool initial, bool light, map<string,int> *intToke return true; } -bool cViewHelpers::SetSignal(map < string, int > &intTokens) { - bool done = false; - time_t Now = time(NULL); - if (Now != lSignalDisplay) { - int SignalStrength = cDevice::ActualDevice()->SignalStrength(); - int SignalQuality = cDevice::ActualDevice()->SignalQuality(); - if (SignalStrength < 0) SignalStrength = 0; - if (SignalQuality < 0) SignalQuality = 0; - if ((SignalStrength == 0)&&(SignalQuality==0)) - return done; - if ((lSignalStrength != SignalStrength) || (lSignalQuality != SignalQuality)) { - intTokens.insert(pair<string,int>("signalstrength", SignalStrength)); - intTokens.insert(pair<string,int>("signalquality", SignalQuality)); - lSignalStrength = SignalStrength; - lSignalQuality = SignalQuality; - done = true; - } - lSignalDisplay = Now; - } - return done; -} - bool cViewHelpers::CheckNewMails(void) { static cPlugin *pMailbox = cPluginManager::GetPlugin("mailbox"); if (!pMailbox) { @@ -198,7 +404,7 @@ bool cViewHelpers::CheckNewMails(void) { return false; } -void cViewHelpers::SetScraperTokens(const cEvent *event, const cRecording *recording, map < string, string > &stringTokens, map < string, int > &intTokens, map < string, vector< map< string, string > > > &loopTokens) { +void cViewHelpers::SetScraperTokens(const cEvent *event, const cRecording *recording, stringmap &stringTokens, intmap &intTokens, map < string, vector<stringmap> > &loopTokens) { static cPlugin *pScraper = GetScraperPlugin(); if (!pScraper || (!event && !recording)) { intTokens.insert(pair<string,int>("ismovie", false)); @@ -404,7 +610,7 @@ void cViewHelpers::SetScraperTokens(const cEvent *event, const cRecording *recor } -void cViewHelpers::SetPosterBanner(const cEvent *event, map < string, string > &stringTokens, map < string, int > &intTokens) { +void cViewHelpers::SetPosterBanner(const cEvent *event, stringmap &stringTokens, intmap &intTokens) { static cPlugin *pScraper = GetScraperPlugin(); if (!pScraper) { return; @@ -471,83 +677,6 @@ void cViewHelpers::SetPosterBanner(const cEvent *event, map < string, string > & } } -bool cViewHelpers::SetTime(bool forced, map < string, string > &stringTokens, map < string, int > &intTokens) { - time_t t = time(0); // get time now - struct tm * now = localtime(&t); - int sec = now->tm_sec; - if (!forced && sec == lastSecond) { - return false; - } - int min = now->tm_min; - int hour = now->tm_hour; - int hourMinutes = hour%12 * 5 + min / 12; - - intTokens.insert(pair<string, int>("sec", sec)); - intTokens.insert(pair<string, int>("min", min)); - intTokens.insert(pair<string, int>("hour", hour)); - intTokens.insert(pair<string, int>("hmins", hourMinutes)); - - lastSecond = sec; - return true; -} - -bool cViewHelpers::SetDate(bool forced, map < string, string > &stringTokens, map < string, int > &intTokens) { - time_t t = time(0); // get time now - struct tm * now = localtime(&t); - int min = now->tm_min; - if (!forced && min == lastMinute) { - return false; - } - lastMinute = min; - - intTokens.insert(pair<string, int>("year", now->tm_year + 1900)); - intTokens.insert(pair<string, int>("day", now->tm_mday)); - - char monthname[20]; - char monthshort[10]; - strftime(monthshort, sizeof(monthshort), "%b", now); - strftime(monthname, sizeof(monthname), "%B", now); - - stringTokens.insert(pair<string,string>("monthname", monthname)); - stringTokens.insert(pair<string,string>("monthnameshort", monthshort)); - stringTokens.insert(pair<string,string>("month", *cString::sprintf("%02d", now->tm_mon + 1))); - stringTokens.insert(pair<string,string>("dayleadingzero", *cString::sprintf("%02d", now->tm_mday))); - stringTokens.insert(pair<string,string>("dayname", *WeekDayNameFull(now->tm_wday))); - stringTokens.insert(pair<string,string>("daynameshort", *WeekDayName(now->tm_wday))); - stringTokens.insert(pair<string,string>("time", *TimeString(t))); - - return true; -} - -bool cViewHelpers::SetCurrentWeatherTokens(map < string, string > &stringTokens, map < string, int > &intTokens) { - static cPlugin *pWeatherForecast = cPluginManager::GetPlugin("weatherforecast"); - if (!pWeatherForecast) - return false; - cServiceCurrentWeather currentWeather; - if (!pWeatherForecast->Service("GetCurrentWeather", ¤tWeather)) { - return false; - } - stringTokens.insert(pair<string,string>("timestamp", currentWeather.timeStamp)); - stringTokens.insert(pair<string,string>("temperature", currentWeather.temperature)); - stringTokens.insert(pair<string,string>("apparenttemperature", currentWeather.apparentTemperature)); - stringTokens.insert(pair<string,string>("mintemperature", currentWeather.minTemperature)); - stringTokens.insert(pair<string,string>("maxtemperature", currentWeather.maxTemperature)); - stringTokens.insert(pair<string,string>("summary", currentWeather.summary)); - stringTokens.insert(pair<string,string>("icon", currentWeather.icon)); - stringTokens.insert(pair<string,string>("precipitationintensity", currentWeather.precipitationIntensity)); - intTokens.insert(pair<string,int>("precipitationprobability", currentWeather.precipitationProbability)); - stringTokens.insert(pair<string,string>("precipitationtype", currentWeather.precipitationType)); - intTokens.insert(pair<string,int>("humidity", currentWeather.humidity)); - stringTokens.insert(pair<string,string>("windspeed", currentWeather.windSpeed)); - intTokens.insert(pair<string,int>("windbearing", currentWeather.windBearing)); - stringTokens.insert(pair<string,string>("windbearingstring", currentWeather.windBearingString)); - stringTokens.insert(pair<string,string>("visibility", currentWeather.visibility)); - intTokens.insert(pair<string,int>("cloudcover", currentWeather.cloudCover)); - stringTokens.insert(pair<string,string>("pressure", currentWeather.pressure)); - stringTokens.insert(pair<string,string>("ozone", currentWeather.ozone)); - return true; -} - void cViewHelpers::SetTimers(map<string,int> *intTokens, map<string,string> *stringTokens, vector<map<string,string> > *timers) { cGlobalSortedTimers SortedTimers;// local and remote timers int numTimers = SortedTimers.Size(); @@ -629,7 +758,7 @@ void cViewHelpers::SetTimers(map<string,int> *intTokens, map<string,string> *str } } -void cViewHelpers::SetLastRecordings(map<string,int> *intTokens, map<string,string> *stringTokens, vector<map<string,string> > *lastRecordings) { +void cViewHelpers::SetLastRecordings(map<string,int> *intTokens, map<string,string> *stringTokens, vector<stringmap> *lastRecordings) { list<cRecording*> orderedRecs; @@ -694,7 +823,7 @@ void cViewHelpers::SetLastRecordings(map<string,int> *intTokens, map<string,stri } } -void cViewHelpers::SetMenuHeader(eMenuCategory cat, string menuTitle, map < string, string > &stringTokens, map < string, int > &intTokens) { +void cViewHelpers::SetMenuHeader(eMenuCategory cat, string menuTitle, stringmap &stringTokens, intmap &intTokens) { stringTokens.insert(pair<string,string>("title", menuTitle)); stringTokens.insert(pair<string,string>("vdrversion", VDRVERSION)); @@ -723,125 +852,7 @@ void cViewHelpers::SetMenuHeader(eMenuCategory cat, string menuTitle, map < stri stringTokens.insert(pair<string,string>("vdrusagestring", vdrUsageString)); } -void cViewHelpers::SetDiscUsage(map < string, string > &stringTokens, map < string, int > &intTokens) { - string vdrUsageString = *cVideoDiskUsage::String(); - int discUsage = cVideoDiskUsage::UsedPercent(); - bool discAlert = (discUsage > 95) ? true : false; - string freeTime = *cString::sprintf("%02d:%02d", cVideoDiskUsage::FreeMinutes() / 60, cVideoDiskUsage::FreeMinutes() % 60); - int freeGB = cVideoDiskUsage::FreeMB() / 1024; - - intTokens.insert(pair<string, int>("usedpercent", discUsage)); - intTokens.insert(pair<string, int>("freepercent", 100-discUsage)); - intTokens.insert(pair<string, int>("discalert", discAlert)); - intTokens.insert(pair<string, int>("freegb", freeGB)); - stringTokens.insert(pair<string,string>("freetime", freeTime)); - stringTokens.insert(pair<string,string>("vdrusagestring", vdrUsageString)); -} - -bool cViewHelpers::SetSystemLoad(map < string, string > &stringTokens, map < string, int > &intTokens) { - double systemLoad; - if (getloadavg(&systemLoad, 1) > 0) { - if (lastSystemLoad == systemLoad) { - return false; - } - string load = *cString::sprintf("%.2f", systemLoad); - int loadHand = systemLoad * 1000; - int loadHandValue = 0; - if (loadHand > 2500) - loadHandValue = 2525; - else { - - int loadHandDec = loadHand - (loadHand / 100) * 100; - - if (loadHandDec <= 12) - loadHandDec = 0; - else if (loadHandDec <= 37) - loadHandDec = 25; - else if (loadHandDec <= 62) - loadHandDec = 50; - else if (loadHandDec <= 87) - loadHandDec = 75; - else - loadHandDec = 0; - - loadHandValue = loadHand / 100 * 100 + loadHandDec; - } - stringTokens.insert(pair<string,string>("load", load)); - intTokens.insert(pair<string,int>("loadhand", loadHandValue)); - lastSystemLoad = systemLoad; - } else { - return false; - } - return true; -} - -bool cViewHelpers::SetSystemMemory(map < string, string > &stringTokens, map < string, int > &intTokens) { - struct sysinfo memInfo; - sysinfo (&memInfo); - - long long totalMem = memInfo.totalram; - totalMem += memInfo.totalswap; - totalMem *= memInfo.mem_unit; - int totalMemMB = totalMem / 1024 / 1024; - - long long usedMem = memInfo.totalram - memInfo.freeram; - usedMem += memInfo.totalswap - memInfo.freeswap; - usedMem *= memInfo.mem_unit; - int usedMemMB = usedMem / 1024 / 1024; - - if (lastMemUsage == usedMemMB) { - return false; - } - lastMemUsage = usedMemMB; - - intTokens.insert(pair<string,int>("totalmem", totalMemMB)); - intTokens.insert(pair<string,int>("usedmem", usedMemMB)); - if (totalMemMB > 0) - intTokens.insert(pair<string,int>("usedmempercent", usedMemMB * 100 / totalMemMB)); - return true; -} - -bool cViewHelpers::SetSystemTemperatures(map < string, string > &stringTokens, map < string, int > &intTokens) { - cString execCommand = cString::sprintf("cd \"%s/\"; \"%s/temperatures\"", SCRIPTFOLDER, SCRIPTFOLDER); - system(*execCommand); - - string tempCPU, tempGPU; - int cpu, gpu; - - cString itemFilename = cString::sprintf("%s/cpu", SCRIPTOUTPUTPATH ); - ifstream file(*itemFilename, ifstream::in); - if( file.is_open() ) { - std::getline(file, tempCPU); - if (tempCPU.size() > 2) { - cpu = atoi(tempCPU.substr(0,2).c_str()); - } else - cpu = 0; - file.close(); - } else { - tempCPU = "0°C"; - cpu = 0; - } - - itemFilename = cString::sprintf("%s/gpu", SCRIPTOUTPUTPATH ); - ifstream file2(*itemFilename, ifstream::in); - if( file2.is_open() ) { - std::getline(file2, tempGPU); - if (tempGPU.size() > 2) { - gpu = atoi(tempGPU.substr(0,2).c_str()); - } else - gpu = 0; - file2.close(); - } else { - tempGPU = "0°C"; - gpu = 0; - } - - intTokens.insert(pair<string,int>("cputemp", cpu)); - intTokens.insert(pair<string,int>("gputemp", gpu)); - return true; -} - -void cViewHelpers::SetCurrentSchedule(string recName, map < string, string > &stringTokens, map < string, int > &intTokens) { +void cViewHelpers::SetCurrentSchedule(string recName, stringmap &stringTokens, intmap &intTokens) { cDevice *device = cDevice::PrimaryDevice(); const cChannel *channel = NULL; if (!device->Replaying() || device->Transferring()) { @@ -860,7 +871,7 @@ void cViewHelpers::SetCurrentSchedule(string recName, map < string, string > &st } } -bool cViewHelpers::SetEcmInfos(int channelSid, map < string, string > &stringTokens, map < string, int > &intTokens) { +bool cViewHelpers::SetEcmInfos(int channelSid, stringmap &stringTokens, intmap &intTokens) { static cPlugin *pDVBApi = cPluginManager::GetPlugin("dvbapi"); if (!pDVBApi) return false; @@ -892,20 +903,6 @@ bool cViewHelpers::SetEcmInfos(int channelSid, map < string, string > &stringTok return true; } -bool cViewHelpers::CompareECMInfos(sDVBAPIEcmInfo *ecmInfo) { - if (ecmInfo->caid != lastEcmInfo.caid) - return false; - if (ecmInfo->pid != lastEcmInfo.pid) - return false; - if (ecmInfo->prid != lastEcmInfo.prid) - return false; - if (ecmInfo->ecmtime != lastEcmInfo.ecmtime) - return false; - if (ecmInfo->hops != lastEcmInfo.hops) - return false; - return true; -} - /******************************************************************************** * Private Functions ********************************************************************************/ @@ -946,7 +943,7 @@ void cViewHelpers::RecPoster(const cRecording *rec, int &posterWidth, int &poste } } -void cViewHelpers::SetCurrentScheduleFromChannel(const cChannel *channel, map < string, string > &stringTokens, map < string, int > &intTokens) { +void cViewHelpers::SetCurrentScheduleFromChannel(const cChannel *channel, stringmap &stringTokens, intmap &intTokens) { const cEvent *event = NULL; cSchedulesLock SchedulesLock; if (const cSchedules *Schedules = cSchedules::Schedules(SchedulesLock)) @@ -1026,7 +1023,7 @@ void cViewHelpers::SetCurrentScheduleFromChannel(const cChannel *channel, map < intTokens.insert(pair<string,int>("hasbanner", hasBanner)); } -void cViewHelpers::SetCurrentScheduleFromRecording(const cRecording *recording, map < string, string > &stringTokens, map < string, int > &intTokens) { +void cViewHelpers::SetCurrentScheduleFromRecording(const cRecording *recording, stringmap &stringTokens, intmap &intTokens) { intTokens.insert(pair<string,int>("islivetv", 0)); string recFullName = recording->Name() ? recording->Name() : ""; @@ -1109,3 +1106,17 @@ void cViewHelpers::SetCurrentScheduleFromRecording(const cRecording *recording, stringTokens.insert(pair<string,string>("bannerpath", bannerPath)); intTokens.insert(pair<string,int>("hasbanner", hasBanner)); } + +bool cViewHelpers::CompareECMInfos(sDVBAPIEcmInfo *ecmInfo) { + if (ecmInfo->caid != lastEcmInfo.caid) + return false; + if (ecmInfo->pid != lastEcmInfo.pid) + return false; + if (ecmInfo->prid != lastEcmInfo.prid) + return false; + if (ecmInfo->ecmtime != lastEcmInfo.ecmtime) + return false; + if (ecmInfo->hops != lastEcmInfo.hops) + return false; + return true; +} diff --git a/views/viewhelpers.h b/views/viewhelpers.h index bc0adcf..3ba13b3 100644 --- a/views/viewhelpers.h +++ b/views/viewhelpers.h @@ -3,6 +3,9 @@ #include "../services/dvbapi.h" +typedef map<string,string> stringmap; +typedef map<string,int> intmap; + class cViewHelpers { private: int numDevices; @@ -20,31 +23,32 @@ private: sDVBAPIEcmInfo lastEcmInfo; void RecName(string &path, string &name, string &folder); void RecPoster(const cRecording *rec, int &posterWidth, int &posterHeight, string &path, bool &hasPoster); - void SetCurrentScheduleFromChannel(const cChannel *channel, map < string, string > &stringTokens, map < string, int > &intTokens); - void SetCurrentScheduleFromRecording(const cRecording *recording, map < string, string > &stringTokens, map < string, int > &intTokens); + void SetCurrentScheduleFromChannel(const cChannel *channel, stringmap &stringTokens, intmap &intTokens); + void SetCurrentScheduleFromRecording(const cRecording *recording, stringmap &stringTokens, intmap &intTokens); bool CompareECMInfos(sDVBAPIEcmInfo *ecmInfo); protected: void InitDevices(void); - bool SetDevices(bool initial, bool light, map<string,int> *intTokens, vector<map<string,string> > *devices); - bool SetSignal(map < string, int > &intTokens); + bool SetDevices(bool initial, bool light, intmap *intTokens, vector<stringmap> *devices); bool CheckNewMails(void); - void SetScraperTokens(const cEvent *event, const cRecording *recording, map < string, string > &stringTokens, map < string, int > &intTokens, map < string, vector< map< string, string > > > &loopTokens); - void SetPosterBanner(const cEvent *event, map < string, string > &stringTokens, map < string, int > &intTokens); - bool SetTime(bool forced, map < string, string > &stringTokens, map < string, int > &intTokens); - bool SetDate(bool forced, map < string, string > &stringTokens, map < string, int > &intTokens); - bool SetCurrentWeatherTokens(map < string, string > &stringTokens, map < string, int > &intTokens); - void SetTimers(map<string,int> *intTokens, map<string,string> *stringTokens, vector<map<string,string> > *timers); - void SetLastRecordings(map<string,int> *intTokens, map<string,string> *stringTokens, vector<map<string,string> > *lastRecordings); - void SetMenuHeader(eMenuCategory cat, string menuTitle, map < string, string > &stringTokens, map < string, int > &intTokens); - void SetDiscUsage(map < string, string > &stringTokens, map < string, int > &intTokens); - bool SetSystemLoad(map < string, string > &stringTokens, map < string, int > &intTokens); - bool SetSystemMemory(map < string, string > &stringTokens, map < string, int > &intTokens); - bool SetSystemTemperatures(map < string, string > &stringTokens, map < string, int > &intTokens); - void SetCurrentSchedule(string recName, map < string, string > &stringTokens, map < string, int > &intTokens); - bool SetEcmInfos(int channelSid, map < string, string > &stringTokens, map < string, int > &intTokens); + void SetScraperTokens(const cEvent *event, const cRecording *recording, stringmap &stringTokens, intmap &intTokens, map < string, vector<stringmap> > &loopTokens); + void SetPosterBanner(const cEvent *event, stringmap &stringTokens, intmap &intTokens); + void SetTimers(map<string,int> *intTokens, map<string,string> *stringTokens, vector<stringmap> *timers); + void SetLastRecordings(map<string,int> *intTokens, map<string,string> *stringTokens, vector<stringmap> *lastRecordings); + void SetMenuHeader(eMenuCategory cat, string menuTitle, stringmap &stringTokens, intmap &intTokens); + void SetCurrentSchedule(string recName, stringmap &stringTokens, intmap &intTokens); + bool SetEcmInfos(int channelSid, stringmap &stringTokens, intmap &intTokens); public: cViewHelpers(void); virtual ~cViewHelpers(void); + bool SetDate (bool forced, stringmap &stringTokens, intmap &intTokens); + bool SetTime (bool forced, stringmap &stringTokens, intmap &intTokens); + bool SetSignal (bool forced, stringmap &stringTokens, intmap &intTokens); + bool SetCurrentWeatherTokens(bool forced, stringmap &stringTokens, intmap &intTokens); + bool SetDiscUsage (bool forced, stringmap &stringTokens, intmap &intTokens); + bool SetSystemLoad (bool forced, stringmap &stringTokens, intmap &intTokens); + bool SetSystemMemory (bool forced, stringmap &stringTokens, intmap &intTokens); + bool SetSystemTemperatures (bool forced, stringmap &stringTokens, intmap &intTokens); + bool SetDummy (bool forced, stringmap &stringTokens, intmap &intTokens); }; #endif //__VIEWHELPERS_H
\ No newline at end of file |