expanded shifting features

This commit is contained in:
louis 2015-05-10 12:55:23 +02:00
parent c5edc10fbd
commit 28743412fe
54 changed files with 947 additions and 619 deletions

View File

@ -309,3 +309,4 @@ Version 0.4.3
Version 0.4.4 Version 0.4.4
- feature: possibility to move viewelements when starting view - feature: possibility to move viewelements when starting view
- expanded shifting features

View File

@ -20,6 +20,8 @@ cDesignerConfig::cDesignerConfig() {
//menu display style, display menu items //menu display style, display menu items
//one after each other or in one step //one after each other or in one step
blockFlush = 1; blockFlush = 1;
//frames per second for fading and shifting
framesPerSecond = 40;
//remember current skin and theme, osd size and osd fonts //remember current skin and theme, osd size and osd fonts
SetSkin(); SetSkin();
SetOSDSize(); 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, "RerunDistance")) rerunDistance = atoi(Value);
else if (!strcasecmp(Name, "RerunMaxChannel")) rerunMaxChannel = atoi(Value); else if (!strcasecmp(Name, "RerunMaxChannel")) rerunMaxChannel = atoi(Value);
else if (!strcasecmp(Name, "BlockFlush")) blockFlush = atoi(Value); else if (!strcasecmp(Name, "BlockFlush")) blockFlush = atoi(Value);
else if (!strcasecmp(Name, "FramesPerSecond")) framesPerSecond = atoi(Value);
else pluginSetupParam = false; else pluginSetupParam = false;
if (!pluginSetupParam) { if (!pluginSetupParam) {

View File

@ -97,6 +97,7 @@ public:
int rerunDistance; int rerunDistance;
int rerunMaxChannel; int rerunMaxChannel;
int blockFlush; int blockFlush;
int framesPerSecond;
//TemplateReload on Setup Close //TemplateReload on Setup Close
bool setupCloseDoReload; bool setupCloseDoReload;
}; };

View File

@ -214,4 +214,4 @@ void cSDDisplayChannel::Flush(void) {
initial = false; initial = false;
channelChange = false; channelChange = false;
channelView->Flush(); channelView->Flush();
} }

View File

@ -286,7 +286,6 @@ bool cSDDisplayMenu::SetPluginText(map<string,string> *stringTokens, map<string,
void cSDDisplayMenu::Flush(void) { void cSDDisplayMenu::Flush(void) {
if (!doOutput) if (!doOutput)
return; return;
bool doFlush = false; bool doFlush = false;
if (state == vsInit) { if (state == vsInit) {
rootView->Start(); rootView->Start();

View File

@ -5,6 +5,7 @@
cSDDisplayReplay::cSDDisplayReplay(cTemplate *replayTemplate, bool ModeOnly) { cSDDisplayReplay::cSDDisplayReplay(cTemplate *replayTemplate, bool ModeOnly) {
doOutput = true; doOutput = true;
initial = true; initial = true;
initialModeSet = false;
modeOnly = ModeOnly; modeOnly = ModeOnly;
replayView = NULL; replayView = NULL;
if (!replayTemplate) { if (!replayTemplate) {
@ -57,6 +58,7 @@ void cSDDisplayReplay::SetMode(bool Play, bool Forward, int Speed) {
replayView->ClearOnPause(); replayView->ClearOnPause();
} }
replayView->DrawControlIcons(Play, Forward, Speed, modeOnly); replayView->DrawControlIcons(Play, Forward, Speed, modeOnly);
initialModeSet = true;
} }
void cSDDisplayReplay::SetProgress(int Current, int Total) { void cSDDisplayReplay::SetProgress(int Current, int Total) {
@ -100,7 +102,7 @@ void cSDDisplayReplay::Flush(void) {
replayView->DrawTime(); replayView->DrawTime();
} }
if (initial) { if (initial && initialModeSet) {
replayView->DrawBackground(modeOnly); replayView->DrawBackground(modeOnly);
replayView->DrawCustomTokens(); replayView->DrawCustomTokens();
replayView->DoFadeIn(); replayView->DoFadeIn();

View File

@ -11,6 +11,7 @@ class cSDDisplayReplay : public cSkinDisplayReplay {
private: private:
cDisplayReplayView *replayView; cDisplayReplayView *replayView;
bool initial; bool initial;
bool initialModeSet;
bool doOutput; bool doOutput;
bool modeOnly; bool modeOnly;
public: public:

View File

@ -9,6 +9,11 @@
width CDATA #REQUIRED width CDATA #REQUIRED
height CDATA #REQUIRED height CDATA #REQUIRED
fadetime CDATA #IMPLIED fadetime CDATA #IMPLIED
shifttime CDATA #IMPLIED
shifttype CDATA #IMPLIED
shiftmode CDATA #IMPLIED
startx CDATA #IMPLIED
starty CDATA #IMPLIED
scaletvx CDATA #IMPLIED scaletvx CDATA #IMPLIED
scaletvy CDATA #IMPLIED scaletvy CDATA #IMPLIED
scaletvwidth CDATA #IMPLIED scaletvwidth CDATA #IMPLIED

View File

@ -12,6 +12,11 @@
width CDATA #REQUIRED width CDATA #REQUIRED
height CDATA #REQUIRED height CDATA #REQUIRED
fadetime CDATA #IMPLIED fadetime CDATA #IMPLIED
shifttime CDATA #IMPLIED
shifttype CDATA #IMPLIED
shiftmode CDATA #IMPLIED
startx CDATA #IMPLIED
starty CDATA #IMPLIED
scaletvx CDATA #IMPLIED scaletvx CDATA #IMPLIED
scaletvy CDATA #IMPLIED scaletvy CDATA #IMPLIED
scaletvwidth CDATA #IMPLIED scaletvwidth CDATA #IMPLIED
@ -97,6 +102,8 @@
delay CDATA #IMPLIED delay CDATA #IMPLIED
fadetime CDATA #IMPLIED fadetime CDATA #IMPLIED
shifttime CDATA #IMPLIED shifttime CDATA #IMPLIED
shifttype CDATA #IMPLIED
shiftmode CDATA #IMPLIED
startx CDATA #IMPLIED startx CDATA #IMPLIED
starty CDATA #IMPLIED starty CDATA #IMPLIED
debug CDATA #IMPLIED debug CDATA #IMPLIED
@ -110,6 +117,8 @@
delay CDATA #IMPLIED delay CDATA #IMPLIED
fadetime CDATA #IMPLIED fadetime CDATA #IMPLIED
shifttime CDATA #IMPLIED shifttime CDATA #IMPLIED
shifttype CDATA #IMPLIED
shiftmode CDATA #IMPLIED
startx CDATA #IMPLIED startx CDATA #IMPLIED
starty CDATA #IMPLIED starty CDATA #IMPLIED
debug CDATA #IMPLIED debug CDATA #IMPLIED
@ -122,6 +131,8 @@
delay CDATA #IMPLIED delay CDATA #IMPLIED
fadetime CDATA #IMPLIED fadetime CDATA #IMPLIED
shifttime CDATA #IMPLIED shifttime CDATA #IMPLIED
shifttype CDATA #IMPLIED
shiftmode CDATA #IMPLIED
startx CDATA #IMPLIED startx CDATA #IMPLIED
starty CDATA #IMPLIED starty CDATA #IMPLIED
debug CDATA #IMPLIED debug CDATA #IMPLIED
@ -134,6 +145,8 @@
delay CDATA #IMPLIED delay CDATA #IMPLIED
fadetime CDATA #IMPLIED fadetime CDATA #IMPLIED
shifttime CDATA #IMPLIED shifttime CDATA #IMPLIED
shifttype CDATA #IMPLIED
shiftmode CDATA #IMPLIED
startx CDATA #IMPLIED startx CDATA #IMPLIED
starty CDATA #IMPLIED starty CDATA #IMPLIED
debug CDATA #IMPLIED debug CDATA #IMPLIED
@ -146,6 +159,8 @@
delay CDATA #IMPLIED delay CDATA #IMPLIED
fadetime CDATA #IMPLIED fadetime CDATA #IMPLIED
shifttime CDATA #IMPLIED shifttime CDATA #IMPLIED
shifttype CDATA #IMPLIED
shiftmode CDATA #IMPLIED
startx CDATA #IMPLIED startx CDATA #IMPLIED
starty CDATA #IMPLIED starty CDATA #IMPLIED
debug CDATA #IMPLIED debug CDATA #IMPLIED
@ -164,6 +179,7 @@
delay CDATA #IMPLIED delay CDATA #IMPLIED
fadetime CDATA #IMPLIED fadetime CDATA #IMPLIED
shifttime CDATA #IMPLIED shifttime CDATA #IMPLIED
shiftmode CDATA #IMPLIED
startx CDATA #IMPLIED startx CDATA #IMPLIED
starty CDATA #IMPLIED starty CDATA #IMPLIED
debug CDATA #IMPLIED debug CDATA #IMPLIED

View File

@ -24,18 +24,42 @@
<!ELEMENT header (area|areascroll)*> <!ELEMENT header (area|areascroll)*>
<!ATTLIST header <!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 debug CDATA #IMPLIED
condition CDATA #IMPLIED condition CDATA #IMPLIED
> >
<!ELEMENT datetime (area|areascroll)*> <!ELEMENT datetime (area|areascroll)*>
<!ATTLIST datetime <!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 debug CDATA #IMPLIED
condition CDATA #IMPLIED condition CDATA #IMPLIED
> >
<!ELEMENT time (area|areascroll)*> <!ELEMENT time (area|areascroll)*>
<!ATTLIST time <!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 debug CDATA #IMPLIED
condition CDATA #IMPLIED condition CDATA #IMPLIED
> >
@ -64,6 +88,8 @@
delay CDATA #IMPLIED delay CDATA #IMPLIED
fadetime CDATA #IMPLIED fadetime CDATA #IMPLIED
shifttime CDATA #IMPLIED shifttime CDATA #IMPLIED
shifttype CDATA #IMPLIED
shiftmode CDATA #IMPLIED
startx CDATA #IMPLIED startx CDATA #IMPLIED
starty CDATA #IMPLIED starty CDATA #IMPLIED
debug CDATA #IMPLIED debug CDATA #IMPLIED
@ -76,6 +102,8 @@
delay CDATA #IMPLIED delay CDATA #IMPLIED
fadetime CDATA #IMPLIED fadetime CDATA #IMPLIED
shifttime CDATA #IMPLIED shifttime CDATA #IMPLIED
shifttype CDATA #IMPLIED
shiftmode CDATA #IMPLIED
startx CDATA #IMPLIED startx CDATA #IMPLIED
starty CDATA #IMPLIED starty CDATA #IMPLIED
debug CDATA #IMPLIED debug CDATA #IMPLIED
@ -88,6 +116,8 @@
delay CDATA #IMPLIED delay CDATA #IMPLIED
fadetime CDATA #IMPLIED fadetime CDATA #IMPLIED
shifttime CDATA #IMPLIED shifttime CDATA #IMPLIED
shifttype CDATA #IMPLIED
shiftmode CDATA #IMPLIED
startx CDATA #IMPLIED startx CDATA #IMPLIED
starty CDATA #IMPLIED starty CDATA #IMPLIED
debug CDATA #IMPLIED debug CDATA #IMPLIED
@ -101,6 +131,8 @@
delay CDATA #IMPLIED delay CDATA #IMPLIED
fadetime CDATA #IMPLIED fadetime CDATA #IMPLIED
shifttime CDATA #IMPLIED shifttime CDATA #IMPLIED
shifttype CDATA #IMPLIED
shiftmode CDATA #IMPLIED
startx CDATA #IMPLIED startx CDATA #IMPLIED
starty CDATA #IMPLIED starty CDATA #IMPLIED
debug CDATA #IMPLIED debug CDATA #IMPLIED
@ -113,6 +145,8 @@
delay CDATA #IMPLIED delay CDATA #IMPLIED
fadetime CDATA #IMPLIED fadetime CDATA #IMPLIED
shifttime CDATA #IMPLIED shifttime CDATA #IMPLIED
shifttype CDATA #IMPLIED
shiftmode CDATA #IMPLIED
startx CDATA #IMPLIED startx CDATA #IMPLIED
starty CDATA #IMPLIED starty CDATA #IMPLIED
debug CDATA #IMPLIED debug CDATA #IMPLIED
@ -125,6 +159,8 @@
delay CDATA #IMPLIED delay CDATA #IMPLIED
fadetime CDATA #IMPLIED fadetime CDATA #IMPLIED
shifttime CDATA #IMPLIED shifttime CDATA #IMPLIED
shifttype CDATA #IMPLIED
shiftmode CDATA #IMPLIED
startx CDATA #IMPLIED startx CDATA #IMPLIED
starty CDATA #IMPLIED starty CDATA #IMPLIED
debug CDATA #IMPLIED debug CDATA #IMPLIED
@ -137,6 +173,8 @@
delay CDATA #IMPLIED delay CDATA #IMPLIED
fadetime CDATA #IMPLIED fadetime CDATA #IMPLIED
shifttime CDATA #IMPLIED shifttime CDATA #IMPLIED
shifttype CDATA #IMPLIED
shiftmode CDATA #IMPLIED
startx CDATA #IMPLIED startx CDATA #IMPLIED
starty CDATA #IMPLIED starty CDATA #IMPLIED
debug CDATA #IMPLIED debug CDATA #IMPLIED
@ -149,6 +187,8 @@
delay CDATA #IMPLIED delay CDATA #IMPLIED
fadetime CDATA #IMPLIED fadetime CDATA #IMPLIED
shifttime CDATA #IMPLIED shifttime CDATA #IMPLIED
shifttype CDATA #IMPLIED
shiftmode CDATA #IMPLIED
startx CDATA #IMPLIED startx CDATA #IMPLIED
starty CDATA #IMPLIED starty CDATA #IMPLIED
debug CDATA #IMPLIED debug CDATA #IMPLIED
@ -161,6 +201,8 @@
delay CDATA #IMPLIED delay CDATA #IMPLIED
fadetime CDATA #IMPLIED fadetime CDATA #IMPLIED
shifttime CDATA #IMPLIED shifttime CDATA #IMPLIED
shifttype CDATA #IMPLIED
shiftmode CDATA #IMPLIED
startx CDATA #IMPLIED startx CDATA #IMPLIED
starty CDATA #IMPLIED starty CDATA #IMPLIED
debug CDATA #IMPLIED debug CDATA #IMPLIED
@ -173,6 +215,8 @@
delay CDATA #IMPLIED delay CDATA #IMPLIED
fadetime CDATA #IMPLIED fadetime CDATA #IMPLIED
shifttime CDATA #IMPLIED shifttime CDATA #IMPLIED
shifttype CDATA #IMPLIED
shiftmode CDATA #IMPLIED
startx CDATA #IMPLIED startx CDATA #IMPLIED
starty CDATA #IMPLIED starty CDATA #IMPLIED
debug CDATA #IMPLIED debug CDATA #IMPLIED

View File

@ -9,6 +9,11 @@
width CDATA #REQUIRED width CDATA #REQUIRED
height CDATA #REQUIRED height CDATA #REQUIRED
fadetime CDATA #IMPLIED fadetime CDATA #IMPLIED
shifttime CDATA #IMPLIED
shifttype CDATA #IMPLIED
shiftmode CDATA #IMPLIED
startx CDATA #IMPLIED
starty CDATA #IMPLIED
scaletvx CDATA #IMPLIED scaletvx CDATA #IMPLIED
scaletvy CDATA #IMPLIED scaletvy CDATA #IMPLIED
scaletvwidth CDATA #IMPLIED scaletvwidth CDATA #IMPLIED

View File

@ -9,6 +9,11 @@
width CDATA #REQUIRED width CDATA #REQUIRED
height CDATA #REQUIRED height CDATA #REQUIRED
fadetime CDATA #IMPLIED fadetime CDATA #IMPLIED
shifttime CDATA #IMPLIED
shifttype CDATA #IMPLIED
shiftmode CDATA #IMPLIED
startx CDATA #IMPLIED
starty CDATA #IMPLIED
scaletvx CDATA #IMPLIED scaletvx CDATA #IMPLIED
scaletvy CDATA #IMPLIED scaletvy CDATA #IMPLIED
scaletvwidth CDATA #IMPLIED scaletvwidth CDATA #IMPLIED

View File

@ -13,6 +13,11 @@
width CDATA #REQUIRED width CDATA #REQUIRED
height CDATA #REQUIRED height CDATA #REQUIRED
fadetime CDATA #IMPLIED fadetime CDATA #IMPLIED
shifttime CDATA #IMPLIED
shifttype CDATA #IMPLIED
shiftmode CDATA #IMPLIED
startx CDATA #IMPLIED
starty CDATA #IMPLIED
scaletvx CDATA #IMPLIED scaletvx CDATA #IMPLIED
scaletvy CDATA #IMPLIED scaletvy CDATA #IMPLIED
scaletvwidth CDATA #IMPLIED scaletvwidth CDATA #IMPLIED
@ -44,6 +49,14 @@
<!ELEMENT scrapercontent (area|areascroll)*> <!ELEMENT scrapercontent (area|areascroll)*>
<!ATTLIST scrapercontent <!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 debug CDATA #IMPLIED
condition CDATA #IMPLIED condition CDATA #IMPLIED
> >

View File

@ -9,6 +9,11 @@
width CDATA #REQUIRED width CDATA #REQUIRED
height CDATA #REQUIRED height CDATA #REQUIRED
fadetime CDATA #IMPLIED fadetime CDATA #IMPLIED
shifttime CDATA #IMPLIED
shifttype CDATA #IMPLIED
shiftmode CDATA #IMPLIED
startx CDATA #IMPLIED
starty CDATA #IMPLIED
scaletvx CDATA #IMPLIED scaletvx CDATA #IMPLIED
scaletvy CDATA #IMPLIED scaletvy CDATA #IMPLIED
scaletvwidth CDATA #IMPLIED scaletvwidth CDATA #IMPLIED

View File

@ -1,4 +1,5 @@
#define __STL_CONFIG_H #define __STL_CONFIG_H
#include <math.h>
#include "pixmapcontainer.h" #include "pixmapcontainer.h"
#include "../config.h" #include "../config.h"
@ -21,6 +22,8 @@ cPixmapContainer::cPixmapContainer(int numPixmaps) {
checkRunning = false; checkRunning = false;
fadeTime = 0; fadeTime = 0;
shiftTime = 0; shiftTime = 0;
shiftType = stNone;
shiftMode = smLinear;
deleteOsdOnExit = false; deleteOsdOnExit = false;
} }
@ -349,8 +352,10 @@ void cPixmapContainer::FadeIn(void) {
} }
return; return;
} }
int frames = fadeTime * config.framesPerSecond / 1000;
if (frames <= 0) frames = 1;
int frameTime = fadeTime / frames;
uint64_t Start = cTimeMs::Now(); uint64_t Start = cTimeMs::Now();
int FadeFrameTime = fadeTime / 10;
while (Running()) { while (Running()) {
uint64_t Now = cTimeMs::Now(); uint64_t Now = cTimeMs::Now();
double t = min(double(Now - Start) / fadeTime, 1.0); double t = min(double(Now - Start) / fadeTime, 1.0);
@ -367,18 +372,20 @@ void cPixmapContainer::FadeIn(void) {
} }
DoFlush(); DoFlush();
int Delta = cTimeMs::Now() - Now; int Delta = cTimeMs::Now() - Now;
if (Running() && (Delta < FadeFrameTime)) if (Running() && (Delta < frameTime))
cCondWait::SleepMs(FadeFrameTime - Delta); cCondWait::SleepMs(frameTime - Delta);
if ((int)(Now - Start) > fadeTime) if ((int)(Now - Start) > fadeTime)
break; break;
} }
} }
void cPixmapContainer::FadeOut(void) { void cPixmapContainer::FadeOut(void) {
if (!fadeTime) if (!fadeTime || IsAnimated())
return; return;
int frames = fadeTime * config.framesPerSecond / 1000;
if (frames <= 0) frames = 1;
int frameTime = fadeTime / frames;
uint64_t Start = cTimeMs::Now(); uint64_t Start = cTimeMs::Now();
int FadeFrameTime = fadeTime / 10;
while (true) { while (true) {
uint64_t Now = cTimeMs::Now(); uint64_t Now = cTimeMs::Now();
double t = min(double(Now - Start) / fadeTime, 1.0); double t = min(double(Now - Start) / fadeTime, 1.0);
@ -395,8 +402,8 @@ void cPixmapContainer::FadeOut(void) {
} }
DoFlush(); DoFlush();
int Delta = cTimeMs::Now() - Now; int Delta = cTimeMs::Now() - Now;
if (Delta < FadeFrameTime) if (Delta < frameTime)
cCondWait::SleepMs(FadeFrameTime - Delta); cCondWait::SleepMs(frameTime - Delta);
if ((int)(Now - Start) > fadeTime) if ((int)(Now - Start) > fadeTime)
break; break;
} }
@ -405,6 +412,137 @@ void cPixmapContainer::FadeOut(void) {
void cPixmapContainer::ShiftIn(void) { void cPixmapContainer::ShiftIn(void) {
if (shiftTime < 1) if (shiftTime < 1)
return; 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]; cPoint destPos[numPixmaps];
for (int i = 0; i < numPixmaps; i++) { for (int i = 0; i < numPixmaps; i++) {
if (!PixmapExists(i)) if (!PixmapExists(i))
@ -418,12 +556,9 @@ void cPixmapContainer::ShiftIn(void) {
SetAlpha(i, ALPHA_OPAQUE); SetAlpha(i, ALPHA_OPAQUE);
} }
DoFlush(); DoFlush();
//Move In
int frames = shiftTime / 20;
if (frames <= 0) frames = 1;
uint64_t Start = cTimeMs::Now(); uint64_t Start = cTimeMs::Now();
int frameTime = shiftTime / frames; while (Running()) {
while (true) {
uint64_t Now = cTimeMs::Now(); uint64_t Now = cTimeMs::Now();
double t = min(double(Now - Start) / shiftTime, 1.0); double t = min(double(Now - Start) / shiftTime, 1.0);
for (int i = 0; i < numPixmaps; i++) { for (int i = 0; i < numPixmaps; i++) {
@ -437,14 +572,14 @@ void cPixmapContainer::ShiftIn(void) {
} }
DoFlush(); DoFlush();
int Delta = cTimeMs::Now() - Now; int Delta = cTimeMs::Now() - Now;
if (Delta < frameTime) if (Running() && (Delta < frameTime))
cCondWait::SleepMs(frameTime - Delta); cCondWait::SleepMs(frameTime - Delta);
if ((int)(Now - Start) > shiftTime) if ((int)(Now - Start) > shiftTime)
break; break;
} }
} }
/***************************************** /*****************************************
* scrollSpeed: 1 slow * scrollSpeed: 1 slow
* 2 medium * 2 medium

View File

@ -24,8 +24,12 @@ private:
bool checkRunning; bool checkRunning;
int fadeTime; int fadeTime;
int shiftTime; int shiftTime;
int shiftType;
int shiftMode;
cPoint startPos; cPoint startPos;
bool deleteOsdOnExit; bool deleteOsdOnExit;
void ShiftInFromBorder(int frames, int frameTime);
void ShiftInFromPoint(int frames, int frameTime);
protected: protected:
void SetInitFinished(void) { pixContainerInit = false; }; void SetInitFinished(void) { pixContainerInit = false; };
bool CreateOsd(int Left, int Top, int Width, int Height); 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 //HELPERS -- do not access the pixmaps array directly, use wrapper functions
void SetFadeTime(int fade) { fadeTime = fade; }; void SetFadeTime(int fade) { fadeTime = fade; };
void SetShiftTime(int shift) { shiftTime = shift; }; 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); }; void SetStartPos(int posX, int posY) { startPos.SetX(posX); startPos.SetY(posY); };
bool IsAnimated(void) { return (shiftTime > 0); }; bool IsAnimated(void) { return (shiftTime > 0); };
void FadeIn(void); void FadeIn(void);

View File

@ -75,6 +75,10 @@ void cTemplateFunction::SetParameters(vector<pair<string, string> > params) {
p.first = ptFadeTime; p.first = ptFadeTime;
} else if (!name.compare("shifttime")) { } else if (!name.compare("shifttime")) {
p.first = ptShiftTime; p.first = ptShiftTime;
} else if (!name.compare("shifttype")) {
p.first = ptShiftType;
} else if (!name.compare("shiftmode")) {
p.first = ptShiftMode;
} else if (!name.compare("startx")) { } else if (!name.compare("startx")) {
p.first = ptStartX; p.first = ptStartX;
} else if (!name.compare("starty")) { } else if (!name.compare("starty")) {
@ -304,6 +308,12 @@ bool cTemplateFunction::CalculateParameters(void) {
case ptAnimType: case ptAnimType:
paramValid = SetAnimType(value); paramValid = SetAnimType(value);
break; break;
case ptShiftType:
paramValid = SetShiftType(value);
break;
case ptShiftMode:
paramValid = SetShiftMode(value);
break;
default: default:
paramValid = true; paramValid = true;
break; break;
@ -442,6 +452,8 @@ int cTemplateFunction::GetNumericParameter(eParamType type) {
return 0; return 0;
else if (type == ptFadeTime) else if (type == ptFadeTime)
return 0; return 0;
else if (type == ptShiftTime)
return 0;
else if (type == ptMenuItemWidth) else if (type == ptMenuItemWidth)
return 0; return 0;
else if (type == ptHideRoot) else if (type == ptHideRoot)
@ -454,6 +466,15 @@ int cTemplateFunction::GetNumericParameter(eParamType type) {
return 0; return 0;
else if (type == ptDirection) else if (type == ptDirection)
return diBottomUp; 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 -1;
} }
return hit->second; return hit->second;
@ -1164,6 +1185,28 @@ bool cTemplateFunction::SetAnimType(string value) {
return true; 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) { void cTemplateFunction::SetDebugGrid(string value) {
int numGridsX = 0; int numGridsX = 0;
int numGridsY = 0; int numGridsY = 0;
@ -1605,6 +1648,12 @@ string cTemplateFunction::GetParamName(eParamType pt) {
case ptShiftTime: case ptShiftTime:
name = "Shift Time"; name = "Shift Time";
break; break;
case ptShiftType:
name = "Shift Type";
break;
case ptShiftMode:
name = "Shift Mode";
break;
case ptStartX: case ptStartX:
name = "Startpos X"; name = "Startpos X";
break; break;

View File

@ -52,6 +52,8 @@ enum eParamType {
ptDetached, ptDetached,
ptFadeTime, ptFadeTime,
ptShiftTime, ptShiftTime,
ptShiftType,
ptShiftMode,
ptStartX, ptStartX,
ptStartY, ptStartY,
ptDelay, ptDelay,
@ -103,6 +105,19 @@ enum eImageType {
itImage itImage
}; };
enum eShiftType {
stNone,
stLeft,
stRight,
stTop,
stBottom
};
enum eShiftMode {
smLinear,
smSlowedDown
};
enum eAnimType { enum eAnimType {
atNone, atNone,
atBlink, atBlink,
@ -180,6 +195,8 @@ protected:
bool SetBackground(string value); bool SetBackground(string value);
bool SetDirection(string value); bool SetDirection(string value);
bool SetAnimType(string value); bool SetAnimType(string value);
bool SetShiftType(string value);
bool SetShiftMode(string value);
void SetDebugGrid(string value); void SetDebugGrid(string value);
void ParseStringParameters(void); void ParseStringParameters(void);
void ParseNumericalParameters(void); void ParseNumericalParameters(void);

View File

@ -668,6 +668,8 @@ void cTemplateView::SetFunctionDefinitions(void) {
attributes.insert("delay"); attributes.insert("delay");
attributes.insert("fadetime"); attributes.insert("fadetime");
attributes.insert("shifttime"); attributes.insert("shifttime");
attributes.insert("shifttype");
attributes.insert("shiftmode");
attributes.insert("startx"); attributes.insert("startx");
attributes.insert("starty"); attributes.insert("starty");
attributes.insert("name"); attributes.insert("name");
@ -875,6 +877,11 @@ cTemplateViewChannel::cTemplateViewChannel(void) {
attributes.insert("width"); attributes.insert("width");
attributes.insert("height"); attributes.insert("height");
attributes.insert("fadetime"); attributes.insert("fadetime");
attributes.insert("shifttime");
attributes.insert("shifttype");
attributes.insert("shiftmode");
attributes.insert("startx");
attributes.insert("starty");
attributes.insert("scaletvx"); attributes.insert("scaletvx");
attributes.insert("scaletvy"); attributes.insert("scaletvy");
attributes.insert("scaletvwidth"); attributes.insert("scaletvwidth");
@ -1581,6 +1588,11 @@ cTemplateViewMessage::cTemplateViewMessage(void) {
attributes.insert("width"); attributes.insert("width");
attributes.insert("height"); attributes.insert("height");
attributes.insert("fadetime"); attributes.insert("fadetime");
attributes.insert("shifttime");
attributes.insert("shifttype");
attributes.insert("shiftmode");
attributes.insert("startx");
attributes.insert("starty");
attributes.insert("scaletvx"); attributes.insert("scaletvx");
attributes.insert("scaletvy"); attributes.insert("scaletvy");
attributes.insert("scaletvwidth"); attributes.insert("scaletvwidth");
@ -1656,6 +1668,11 @@ cTemplateViewReplay::cTemplateViewReplay(void) {
attributes.insert("width"); attributes.insert("width");
attributes.insert("height"); attributes.insert("height");
attributes.insert("fadetime"); attributes.insert("fadetime");
attributes.insert("shifttime");
attributes.insert("shifttype");
attributes.insert("shiftmode");
attributes.insert("startx");
attributes.insert("starty");
attributes.insert("scaletvx"); attributes.insert("scaletvx");
attributes.insert("scaletvy"); attributes.insert("scaletvy");
attributes.insert("scaletvwidth"); attributes.insert("scaletvwidth");
@ -1839,6 +1856,11 @@ cTemplateViewVolume::cTemplateViewVolume(void) {
attributes.insert("width"); attributes.insert("width");
attributes.insert("height"); attributes.insert("height");
attributes.insert("fadetime"); attributes.insert("fadetime");
attributes.insert("shifttime");
attributes.insert("shifttype");
attributes.insert("shiftmode");
attributes.insert("startx");
attributes.insert("starty");
attributes.insert("scaletvx"); attributes.insert("scaletvx");
attributes.insert("scaletvy"); attributes.insert("scaletvy");
attributes.insert("scaletvwidth"); attributes.insert("scaletvwidth");
@ -1914,6 +1936,11 @@ cTemplateViewAudioTracks::cTemplateViewAudioTracks(void) {
attributes.insert("width"); attributes.insert("width");
attributes.insert("height"); attributes.insert("height");
attributes.insert("fadetime"); attributes.insert("fadetime");
attributes.insert("shifttime");
attributes.insert("shifttype");
attributes.insert("shiftmode");
attributes.insert("startx");
attributes.insert("starty");
attributes.insert("scaletvx"); attributes.insert("scaletvx");
attributes.insert("scaletvy"); attributes.insert("scaletvy");
attributes.insert("scaletvwidth"); attributes.insert("scaletvwidth");
@ -2036,6 +2063,11 @@ cTemplateViewPlugin::cTemplateViewPlugin(string pluginName, int viewID) {
attributes.insert("width"); attributes.insert("width");
attributes.insert("height"); attributes.insert("height");
attributes.insert("fadetime"); attributes.insert("fadetime");
attributes.insert("shifttime");
attributes.insert("shifttype");
attributes.insert("shiftmode");
attributes.insert("startx");
attributes.insert("starty");
attributes.insert("scaletvx"); attributes.insert("scaletvx");
attributes.insert("scaletvy"); attributes.insert("scaletvy");
attributes.insert("scaletvwidth"); attributes.insert("scaletvwidth");

View File

@ -6,7 +6,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: vdr-skindesigner 0.0.1\n" "Project-Id-Version: vdr-skindesigner 0.0.1\n"
"Report-Msgid-Bugs-To: <see README>\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" "PO-Revision-Date: 2014-09-27 11:02+0200\n"
"Last-Translator: Louis Braun <louis.braun@gmx.de>\n" "Last-Translator: Louis Braun <louis.braun@gmx.de>\n"
"Language-Team: \n" "Language-Team: \n"
@ -30,6 +30,9 @@ msgstr ""
msgid "Menu Item display method" msgid "Menu Item display method"
msgstr "Art der Ausgabe der Menüelemente" msgstr "Art der Ausgabe der Menüelemente"
msgid "Frames per Second (fading and shifting)"
msgstr "Frames pro Sekunde (fading und shifting)"
msgid "Reruns" msgid "Reruns"
msgstr "Wiederholungen" msgstr "Wiederholungen"

View File

@ -6,7 +6,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: vdr-skindesigner 0.2.0\n" "Project-Id-Version: vdr-skindesigner 0.2.0\n"
"Report-Msgid-Bugs-To: <see README>\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" "PO-Revision-Date: 2015-01-25 01:25+0200\n"
"Last-Translator: Rolf Ahrenberg\n" "Last-Translator: Rolf Ahrenberg\n"
"Language-Team: Finnish\n" "Language-Team: Finnish\n"
@ -30,6 +30,9 @@ msgstr "Yleiset"
msgid "Menu Item display method" msgid "Menu Item display method"
msgstr "Valikkorivien esitystapa" msgstr "Valikkorivien esitystapa"
msgid "Frames per Second (fading and shifting)"
msgstr ""
msgid "Reruns" msgid "Reruns"
msgstr "Uusinnat" msgstr "Uusinnat"

View File

@ -9,6 +9,7 @@ cSkinDesignerSetup::cSkinDesignerSetup() {
rerunDistance = config.rerunDistance; rerunDistance = config.rerunDistance;
rerunMaxChannel = config.rerunMaxChannel; rerunMaxChannel = config.rerunMaxChannel;
blockFlush = config.blockFlush; blockFlush = config.blockFlush;
framesPerSecond = config.framesPerSecond;
menuDisplayStyle[0] = tr("after one another"); menuDisplayStyle[0] = tr("after one another");
menuDisplayStyle[1] = tr("at one go"); menuDisplayStyle[1] = tr("at one go");
Setup(); Setup();
@ -65,6 +66,7 @@ void cSkinDesignerSetup::Store(void) {
config.rerunDistance = rerunDistance; config.rerunDistance = rerunDistance;
config.rerunMaxChannel = rerunMaxChannel; config.rerunMaxChannel = rerunMaxChannel;
config.blockFlush = blockFlush; config.blockFlush = blockFlush;
config.framesPerSecond = framesPerSecond;
config.InitSetupIterator(); config.InitSetupIterator();
cSkinSetup *skinSetup = NULL; cSkinSetup *skinSetup = NULL;
@ -88,6 +90,7 @@ void cSkinDesignerSetup::Store(void) {
SetupStore("RerunDistance", rerunDistance); SetupStore("RerunDistance", rerunDistance);
SetupStore("RerunMaxChannel", rerunMaxChannel); SetupStore("RerunMaxChannel", rerunMaxChannel);
SetupStore("BlockFlush", blockFlush); SetupStore("BlockFlush", blockFlush);
SetupStore("FramesPerSecond", framesPerSecond);
} }
cOsdItem *cSkinDesignerSetup::InfoItem(const char *label) { cOsdItem *cSkinDesignerSetup::InfoItem(const char *label) {
@ -101,6 +104,7 @@ void cSkinDesignerSetup::PluginSetup(void) {
Add(InfoItem(tr("Plugin Setup"))); Add(InfoItem(tr("Plugin Setup")));
Add(new cMenuEditStraItem(tr("Menu Item display method"), &blockFlush, 2, menuDisplayStyle)); 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(InfoItem(tr("Reruns")));
Add(new cMenuEditIntItem(tr("Maximum number of reruns to display"), &rerunAmount, 1, 100)); Add(new cMenuEditIntItem(tr("Maximum number of reruns to display"), &rerunAmount, 1, 100));

View File

@ -15,6 +15,7 @@ private:
int rerunDistance; int rerunDistance;
int rerunMaxChannel; int rerunMaxChannel;
int blockFlush; int blockFlush;
int framesPerSecond;
const char *menuDisplayStyle[2]; const char *menuDisplayStyle[2];
void Setup(void); void Setup(void);

View File

@ -7,6 +7,11 @@
<parameter type="bool" name="showposter" displaytext="{tr(showpostertext)}">1</parameter> <parameter type="bool" name="showposter" displaytext="{tr(showpostertext)}">1</parameter>
<parameter type="bool" name="showmainmenuicons" displaytext="{tr(showmainmenuicons)}">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="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="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="nummenuitems" min="6" max="30" displaytext="{tr(nummenuitems)}">10</parameter>
<parameter type="int" name="nummenuitemsdefault" min="6" max="30" displaytext="{tr(nummenuitemsdefault)}">16</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> <trans lang="fi_FI">Näytä ikonit päävalikossa</trans>
</token> </token>
<token name="tr(fadetext)"> <token name="tr(fadetext)">
<trans lang="en_EN">Fade time in ms</trans> <trans lang="en_EN">Fade time [ms]</trans>
<trans lang="de_DE">Einblendzeit in ms</trans> <trans lang="de_DE">Einblendzeit [ms]</trans>
<trans lang="fi_FI">Häivytyksen kesto [ms]</trans> <trans lang="fi_FI">Häivytyksen kesto [ms]</trans>
</token> </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)"> <token name="tr(nummenuitemsmain)">
<trans lang="en_EN">Items in main menu</trans> <trans lang="en_EN">Items in main menu</trans>
<trans lang="de_DE">Elemente im Hauptmenü</trans> <trans lang="de_DE">Elemente im Hauptmenü</trans>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE displaychannel SYSTEM "../../../dtd/displaychannel.dtd"> <!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>
<!-- global background --> <!-- global background -->

View File

@ -25,12 +25,6 @@
<area x="0" y="0" width="83%" height="8%" layer="2"> <area x="0" y="0" width="83%" height="8%" layer="2">
<drawimage imagetype="skinpart" path="displaymenuheader" x="0" y="0" width="100%" height="100%"/> <drawimage imagetype="skinpart" path="displaymenuheader" x="0" y="0" width="100%" height="100%"/>
</area> </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> </background>
<!-- Available Variables header: <!-- Available Variables header:
{title} title of current menu {title} title of current menu
@ -61,9 +55,6 @@
{year} year in yyyy {year} year in yyyy
--> -->
<datetime> <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"> <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}" /> <drawtext align="right" valign="center" font="{semibold}" fontsize="90%" color="{clrWhite}" text="{daynameshort} {day}.{month}" />
</area> </area>
@ -75,7 +66,16 @@
{hour} current hours {hour} current hours
{hmins} current "hourminutes" to display an hour hand {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"> <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%"/> <drawimage imagetype="skinpart" path="watchhands/s_{sec}" x="0" y="0" width="100%" height="100%"/>
</area> </area>

View File

@ -13,12 +13,6 @@
<area x="0" y="0" width="83%" height="8%" layer="2"> <area x="0" y="0" width="83%" height="8%" layer="2">
<drawimage imagetype="skinpart" path="displaymenuheader" x="0" y="0" width="100%" height="100%"/> <drawimage imagetype="skinpart" path="displaymenuheader" x="0" y="0" width="100%" height="100%"/>
</area> </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"> <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%"/> <drawimage imagetype="skinpart" path="tachos_back" x="0" y="0" width="100%" height="100%"/>
</area> </area>
@ -75,7 +69,7 @@
{timers[channelid]} ChannelID of channel {timers[channelid]} ChannelID of channel
{timers[channellogoexists]} true if channel logo exists {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"> <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)}" /> <drawtext align="center" valign="center" font="{semibold}" fontsize="40%" color="{clrWhite}" text="{tr(noactivetimers)}" />
</area> </area>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE displaymessage SYSTEM "../../../dtd/displaymessage.dtd"> <!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>
</background> </background>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE displayreplay SYSTEM "../../../dtd/displayreplay.dtd"> <!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> <background>
<!-- global background --> <!-- global background -->
@ -81,7 +81,7 @@
{mediaheight} height of image in pixel {mediaheight} height of image in pixel
{isbanner} true if image is a banner, false if it is a poster {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"> <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%"/> <drawimage imagetype="image" path="{posterpath}" x="0" y="0" width="100%" height="100%"/>
</area> </area>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE displayvolume SYSTEM "../../../dtd/displayvolume.dtd"> <!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> <background>
<area x="0" y="0" width="100%" height="100%" layer="2"> <area x="0" y="0" width="100%" height="100%" layer="2">

View File

@ -4,15 +4,30 @@
<setup> <setup>
<menu> <menu>
<parameter type="int" name="fadetime" min="0" max="1000" displaytext="{tr(fadetext)}">0</parameter> <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> <parameter type="bool" name="showdevices" displaytext="{tr(showdevices)}">0</parameter>
</menu> </menu>
<translations> <translations>
<token name="tr(fadetext)"> <token name="tr(fadetext)">
<trans lang="en_EN">Fade time in ms</trans> <trans lang="en_EN">Fade time [ms]</trans>
<trans lang="de_DE">Einblendzeit in ms</trans> <trans lang="de_DE">Einblendzeit [ms]</trans>
<trans lang="fi_FI">Häivytyksen kesto [ms]</trans> <trans lang="fi_FI">Häivytyksen kesto [ms]</trans>
</token> </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)"> <token name="tr(showdevices)">
<trans lang="en_EN">Show DVB device info when switching channel</trans> <trans lang="en_EN">Show DVB device info when switching channel</trans>
<trans lang="de_DE">DVB Karten Info beim Umschalten anzeigen</trans> <trans lang="de_DE">DVB Karten Info beim Umschalten anzeigen</trans>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE displaychannel SYSTEM "../../../dtd/displaychannel.dtd"> <!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>
<!-- background infobar --> <!-- background infobar -->
<area x="0" y="80%" width="100%" height="20%" layer="1"> <area x="0" y="80%" width="100%" height="20%" layer="1">
@ -186,7 +186,7 @@
{devices[channelid]} ID of the currently tuned channel {devices[channelid]} ID of the currently tuned channel
{devices[source]} source 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"> <area x="70%" y="30%" width="30%" height="{areaheight}/12 * {numdevices}" layer="1" background="true">
<fill color="{clrTransBlack}"/> <fill color="{clrTransBlack}"/>
</area> </area>
@ -224,7 +224,7 @@
{pressure} pressure in HPo {pressure} pressure in HPo
{ozone} ozone value in DU {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"> <area background="true" x="70%" y="15%" width="30%" height="13%" layer="1">
<fill color="{clrTransBlack}" /> <fill color="{clrTransBlack}" />
<drawrectangle x="0" y="0" width="45%" height="100%" color="{clrTransBlueLight}" /> <drawrectangle x="0" y="0" width="45%" height="100%" color="{clrTransBlueLight}" />
@ -257,7 +257,7 @@
{mediaheight} height of image in pixel {mediaheight} height of image in pixel
{isbanner} true if image is a banner, false if it is a poster {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"> <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}"/> <drawimage imagetype="image" path="{mediapath}" align="center" valign="center" width="{areawidth}" height="{areaheight}"/>
</area> </area>
@ -277,7 +277,7 @@
{monthnameshort} 3 letter abbrivation of month name {monthnameshort} 3 letter abbrivation of month name
{year} year in yyyy {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"> <area background="true" x="70%" y="0" width="30%" height="13%" layer="1">
<fill color="{clrTransBlack}" /> <fill color="{clrTransBlack}" />
<drawrectangle x="0" y="0" width="45%" height="100%" color="{clrTransBlueLight}" /> <drawrectangle x="0" y="0" width="45%" height="100%" color="{clrTransBlueLight}" />

View File

@ -121,7 +121,7 @@
{timers[channellogoexists]} true if channel logo exists {timers[channellogoexists]} true if channel logo exists
{timers[isremotetimer]} true if timer is a remote timer from remotetimers plugin {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"> <area x="0" y="75%" width="{areawidth}/8 - 5" height="25%" layer="1">
<fill color="{clrTransBlack}" /> <fill color="{clrTransBlack}" />
</area> </area>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE displaymessage SYSTEM "../../../dtd/displaymessage.dtd"> <!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> <background>
<area x="0" y="0" width="100%" height="100%" layer="1"> <area x="0" y="0" width="100%" height="100%" layer="1">
<fill color="{clrTransBlack}" /> <fill color="{clrTransBlack}" />

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE displayvolume SYSTEM "../../../dtd/displayvolume.dtd"> <!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> <background>
<area x="0" y="0" width="100%" height="100%" layer="1"> <area x="0" y="0" width="100%" height="100%" layer="1">
<fill color="{clrTransBlack}" /> <fill color="{clrTransBlack}" />

View File

@ -4,7 +4,6 @@
cDisplayAudiotracksView::cDisplayAudiotracksView(int numTracks, cTemplateView *tmplView) : cView(tmplView) { cDisplayAudiotracksView::cDisplayAudiotracksView(int numTracks, cTemplateView *tmplView) : cView(tmplView) {
DeleteOsdOnExit(); DeleteOsdOnExit();
SetFadeTime(tmplView->GetNumericParameter(ptFadeTime));
this->numTracks = numTracks; this->numTracks = numTracks;
@ -70,10 +69,3 @@ void cDisplayAudiotracksView::RenderMenuItems(void) {
if (listView) if (listView)
listView->Render(); listView->Render();
} }
void cDisplayAudiotracksView::Action(void) {
SetInitFinished();
FadeIn();
DoFlush();
cView::Action();
}

View File

@ -8,7 +8,6 @@ class cDisplayAudiotracksView : public cView {
protected: protected:
int numTracks; int numTracks;
cDisplayMenuListView *listView; cDisplayMenuListView *listView;
virtual void Action(void);
public: public:
cDisplayAudiotracksView(int numTracks, cTemplateView *tmplView); cDisplayAudiotracksView(int numTracks, cTemplateView *tmplView);
virtual ~cDisplayAudiotracksView(); virtual ~cDisplayAudiotracksView();

View File

@ -15,7 +15,6 @@ cDisplayChannelView::cDisplayChannelView(cTemplateView *tmplView) : cView(tmplVi
lastTrackLang = ""; lastTrackLang = "";
InitDevices(); InitDevices();
DeleteOsdOnExit(); DeleteOsdOnExit();
SetFadeTime(tmplView->GetNumericParameter(ptFadeTime));
} }
cDisplayChannelView::~cDisplayChannelView() { cDisplayChannelView::~cDisplayChannelView() {
@ -61,11 +60,11 @@ void cDisplayChannelView::DrawDate(void) {
if (!ExecuteViewElement(veDateTime)) { if (!ExecuteViewElement(veDateTime)) {
return; return;
} }
if (DetachViewElement(veDateTime)) { if (DetachViewElement(veDateTime)) {
cViewElement *viewElement = GetViewElement(veDateTime); cViewElement *viewElement = GetViewElement(veDateTime);
if (!viewElement) { if (!viewElement) {
viewElement = new cViewElementDate(tmplView->GetViewElement(veDateTime)); viewElement = new cViewElement(tmplView->GetViewElement(veDateTime), this);
viewElement->SetCallback(veDateTime, &cDisplayChannelView::SetDate);
AddViewElement(veDateTime, viewElement); AddViewElement(veDateTime, viewElement);
viewElement->Start(); viewElement->Start();
} else { } else {
@ -89,11 +88,11 @@ void cDisplayChannelView::DrawTime(void) {
if (!ExecuteViewElement(veTime)) { if (!ExecuteViewElement(veTime)) {
return; return;
} }
if (DetachViewElement(veTime)) { if (DetachViewElement(veTime)) {
cViewElement *viewElement = GetViewElement(veTime); cViewElement *viewElement = GetViewElement(veTime);
if (!viewElement) { if (!viewElement) {
viewElement = new cViewElementTime(tmplView->GetViewElement(veTime)); viewElement = new cViewElement(tmplView->GetViewElement(veTime), this);
viewElement->SetCallback(veTime, &cDisplayChannelView::SetTime);
AddViewElement(veTime, viewElement); AddViewElement(veTime, viewElement);
viewElement->Start(); viewElement->Start();
} else { } else {
@ -386,7 +385,8 @@ void cDisplayChannelView::DrawSignal(void) {
if (DetachViewElement(veSignalQuality)) { if (DetachViewElement(veSignalQuality)) {
cViewElement *viewElement = GetViewElement(veSignalQuality); cViewElement *viewElement = GetViewElement(veSignalQuality);
if (!viewElement) { if (!viewElement) {
viewElement = new cViewElementSignal(tmplView->GetViewElement(veSignalQuality)); viewElement = new cViewElement(tmplView->GetViewElement(veSignalQuality), this);
viewElement->SetCallback(veSignalQuality, &cDisplayChannelView::SetSignal);
AddViewElement(veSignalQuality, viewElement); AddViewElement(veSignalQuality, viewElement);
viewElement->Start(); viewElement->Start();
} else { } else {
@ -397,7 +397,7 @@ void cDisplayChannelView::DrawSignal(void) {
map < string, string > stringTokens; map < string, string > stringTokens;
map < string, int > intTokens; map < string, int > intTokens;
bool changed = SetSignal(intTokens); bool changed = SetSignal(false, stringTokens, intTokens);
if (!changed) if (!changed)
return; return;
@ -559,7 +559,8 @@ void cDisplayChannelView::DrawCurrentWeather(void) {
if (DetachViewElement(veCurrentWeather)) { if (DetachViewElement(veCurrentWeather)) {
cViewElement *viewElement = GetViewElement(veCurrentWeather); cViewElement *viewElement = GetViewElement(veCurrentWeather);
if (!viewElement) { if (!viewElement) {
viewElement = new cViewElementWeather(tmplView->GetViewElement(veCurrentWeather)); viewElement = new cViewElement(tmplView->GetViewElement(veCurrentWeather), this);
viewElement->SetCallback(veCurrentWeather, &cDisplayChannelView::SetCurrentWeatherTokens);
AddViewElement(veCurrentWeather, viewElement); AddViewElement(veCurrentWeather, viewElement);
viewElement->Start(); viewElement->Start();
} else { } else {
@ -569,19 +570,10 @@ void cDisplayChannelView::DrawCurrentWeather(void) {
} else { } else {
map < string, string > stringTokens; map < string, string > stringTokens;
map < string, int > intTokens; map < string, int > intTokens;
if (!SetCurrentWeatherTokens(stringTokens, intTokens)){ ClearViewElement(veCurrentWeather);
ClearViewElement(veCurrentWeather); if (!SetCurrentWeatherTokens(false, stringTokens, intTokens)){
return; return;
} }
ClearViewElement(veCurrentWeather);
DrawViewElement(veCurrentWeather, &stringTokens, &intTokens); DrawViewElement(veCurrentWeather, &stringTokens, &intTokens);
} }
} }
void cDisplayChannelView::Action(void) {
SetInitFinished();
FadeIn();
DoFlush();
cView::Action();
}

View File

@ -14,7 +14,6 @@ private:
string lastTracDesc; string lastTracDesc;
string lastTrackLang; string lastTrackLang;
string GetChannelSep(const cChannel *channel, bool prev); string GetChannelSep(const cChannel *channel, bool prev);
virtual void Action(void);
public: public:
cDisplayChannelView(cTemplateView *tmplView); cDisplayChannelView(cTemplateView *tmplView);
virtual ~cDisplayChannelView(); virtual ~cDisplayChannelView();

View File

@ -322,6 +322,7 @@ cDisplayMenuItemSchedulesView::cDisplayMenuItemSchedulesView(cTemplateViewList *
eMenuCategory cat, bool isEpgSearchFav, bool current, bool selectable) eMenuCategory cat, bool isEpgSearchFav, bool current, bool selectable)
: cDisplayMenuItemView(tmplList, current, selectable) { : cDisplayMenuItemView(tmplList, current, selectable) {
this->event = event; this->event = event;
esyslog("skindesigner: constructor cDisplayMenuItemSchedulesView event %s", event->Title());
this->channel = channel; this->channel = channel;
this->timerMatch = timerMatch; this->timerMatch = timerMatch;
this->cat = cat; this->cat = cat;
@ -354,6 +355,7 @@ void cDisplayMenuItemSchedulesView::SetTokens(void) {
} }
if (event) { if (event) {
esyslog("skindesigner: setting Tokens for event %s", event->Title());
if (selectable) { if (selectable) {
stringTokens.insert(pair<string,string>("title", event->Title() ? event->Title() : "")); stringTokens.insert(pair<string,string>("title", event->Title() ? event->Title() : ""));
stringTokens.insert(pair<string,string>("shorttext", event->ShortText() ? event->ShortText() : "")); stringTokens.insert(pair<string,string>("shorttext", event->ShortText() ? event->ShortText() : ""));
@ -408,7 +410,6 @@ void cDisplayMenuItemSchedulesView::Prepare(void) {
} }
void cDisplayMenuItemSchedulesView::Render(void) { void cDisplayMenuItemSchedulesView::Render(void) {
DrawListItem(&stringTokens, &intTokens); DrawListItem(&stringTokens, &intTokens);
if (current) { if (current) {

View File

@ -35,7 +35,6 @@ cDisplayMenuRootView::cDisplayMenuRootView(cTemplateView *rootView) : cView(root
defaultMessageDrawn = false; defaultMessageDrawn = false;
defaultSortmodeDrawn = false; defaultSortmodeDrawn = false;
DeleteOsdOnExit(); DeleteOsdOnExit();
SetFadeTime(tmplView->GetNumericParameter(ptFadeTime));
} }
cDisplayMenuRootView::~cDisplayMenuRootView() { cDisplayMenuRootView::~cDisplayMenuRootView() {
@ -518,11 +517,23 @@ void cDisplayMenuRootView::DrawHeader(void) {
if (!ExecuteViewElement(veHeader)) { if (!ExecuteViewElement(veHeader)) {
return; return;
} }
map < string, string > stringTokens; if (DetachViewElement(veHeader)) {
map < string, int > intTokens; cViewElement *viewElement = GetViewElement(veHeader);
SetMenuHeader(cat, menuTitle, stringTokens, intTokens); if (!viewElement) {
ClearViewElement(veHeader); viewElement = new cViewElementMenuHeader(tmplView->GetViewElement(veHeader), cat, menuTitle);
DrawViewElement(veHeader, &stringTokens, &intTokens); 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) { void cDisplayMenuRootView::DrawDateTime(bool forced) {
@ -530,15 +541,26 @@ void cDisplayMenuRootView::DrawDateTime(bool forced) {
return; return;
} }
map < string, string > stringTokens; if (DetachViewElement(veDateTime)) {
map < string, int > intTokens; cViewElement *viewElement = GetViewElement(veDateTime);
if (!viewElement) {
if (!SetDate(forced, stringTokens, intTokens)) { viewElement = new cViewElement(tmplView->GetViewElement(veDateTime), this);
return; 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) { bool cDisplayMenuRootView::DrawTime(bool forced) {
@ -546,15 +568,30 @@ bool cDisplayMenuRootView::DrawTime(bool forced) {
return false; return false;
} }
map < string, string > stringTokens; if (DetachViewElement(veTime)) {
map < string, int > intTokens; 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)) { map < string, string > stringTokens;
return false; 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; return true;
} }

View File

@ -8,9 +8,7 @@
#include "../services/scraper2vdr.h" #include "../services/scraper2vdr.h"
cDisplayMenuView::cDisplayMenuView(cTemplateView *tmplView, bool menuInit) : cView(tmplView) { cDisplayMenuView::cDisplayMenuView(cTemplateView *tmplView, bool menuInit) : cView(tmplView) {
if (menuInit) if (!menuInit)
SetFadeTime(tmplView->GetNumericParameter(ptFadeTime));
else
SetFadeTime(0); SetFadeTime(0);
cat = mcUndefined; cat = mcUndefined;
sortMode = msmUnknown; sortMode = msmUnknown;
@ -38,11 +36,23 @@ bool cDisplayMenuView::DrawHeader(void) {
if (!ExecuteViewElement(veHeader)) { if (!ExecuteViewElement(veHeader)) {
return false; return false;
} }
map < string, string > stringTokens; if (DetachViewElement(veHeader)) {
map < string, int > intTokens; cViewElement *viewElement = GetViewElement(veHeader);
SetMenuHeader(cat, menuTitle, stringTokens, intTokens); if (!viewElement) {
ClearViewElement(veHeader); viewElement = new cViewElementMenuHeader(tmplView->GetViewElement(veHeader), cat, menuTitle);
DrawViewElement(veHeader, &stringTokens, &intTokens); 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; return true;
} }
@ -51,15 +61,29 @@ bool cDisplayMenuView::DrawDateTime(bool forced, bool &implemented) {
return false; return false;
} }
implemented = true; implemented = true;
map < string, string > stringTokens; if (DetachViewElement(veDateTime)) {
map < string, int > intTokens; cViewElement *viewElement = GetViewElement(veDateTime);
if (!viewElement) {
if (!SetDate(forced, stringTokens, intTokens)) { viewElement = new cViewElement(tmplView->GetViewElement(veDateTime), this);
return false; 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); ClearViewElement(veDateTime);
DrawViewElement(veDateTime, &stringTokens, &intTokens); DrawViewElement(veDateTime, &stringTokens, &intTokens);
}
return true; return true;
} }
@ -68,16 +92,31 @@ bool cDisplayMenuView::DrawTime(bool forced, bool &implemented) {
return false; return false;
} }
implemented = true; implemented = true;
map < string, string > stringTokens;
map < string, int > intTokens;
if (!SetTime(forced, stringTokens, intTokens)) { if (DetachViewElement(veTime)) {
return false; 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 {
ClearViewElement(veTime); map < string, string > stringTokens;
DrawViewElement(veTime, &stringTokens, &intTokens); map < string, int > intTokens;
if (!SetTime(forced, stringTokens, intTokens)) {
return false;
}
ClearViewElement(veTime);
DrawViewElement(veTime, &stringTokens, &intTokens);
}
return true; return true;
} }
@ -322,7 +361,8 @@ void cDisplayMenuMainView::DrawDiscUsage(void) {
if (DetachViewElement(veDiscUsage)) { if (DetachViewElement(veDiscUsage)) {
cViewElement *viewElement = GetViewElement(veDiscUsage); cViewElement *viewElement = GetViewElement(veDiscUsage);
if (!viewElement) { if (!viewElement) {
viewElement = new cViewElementDiscUsage(tmplView->GetViewElement(veDiscUsage)); viewElement = new cViewElement(tmplView->GetViewElement(veDiscUsage), this);
viewElement->SetCallback(veDiscUsage, &cDisplayMenuMainView::SetDiscUsage);
AddViewElement(veDiscUsage, viewElement); AddViewElement(veDiscUsage, viewElement);
viewElement->Start(); viewElement->Start();
} else { } else {
@ -332,7 +372,7 @@ void cDisplayMenuMainView::DrawDiscUsage(void) {
} else { } else {
map < string, string > stringTokens; map < string, string > stringTokens;
map < string, int > intTokens; map < string, int > intTokens;
SetDiscUsage(stringTokens, intTokens); SetDiscUsage(false, stringTokens, intTokens);
ClearViewElement(veDiscUsage); ClearViewElement(veDiscUsage);
DrawViewElement(veDiscUsage, &stringTokens, &intTokens); DrawViewElement(veDiscUsage, &stringTokens, &intTokens);
} }
@ -346,7 +386,8 @@ bool cDisplayMenuMainView::DrawLoad(void) {
if (DetachViewElement(veSystemLoad)) { if (DetachViewElement(veSystemLoad)) {
cViewElement *viewElement = GetViewElement(veSystemLoad); cViewElement *viewElement = GetViewElement(veSystemLoad);
if (!viewElement) { if (!viewElement) {
viewElement = new cViewElementSystemLoad(tmplView->GetViewElement(veSystemLoad)); viewElement = new cViewElement(tmplView->GetViewElement(veSystemLoad), this);
viewElement->SetCallback(veSystemLoad, &cDisplayMenuMainView::SetSystemLoad);
AddViewElement(veSystemLoad, viewElement); AddViewElement(veSystemLoad, viewElement);
viewElement->Start(); viewElement->Start();
changed = true; changed = true;
@ -357,7 +398,7 @@ bool cDisplayMenuMainView::DrawLoad(void) {
} else { } else {
map < string, string > stringTokens; map < string, string > stringTokens;
map < string, int > intTokens; map < string, int > intTokens;
changed = SetSystemLoad(stringTokens, intTokens); changed = SetSystemLoad(false, stringTokens, intTokens);
if (changed) { if (changed) {
ClearViewElement(veSystemLoad); ClearViewElement(veSystemLoad);
DrawViewElement(veSystemLoad, &stringTokens, &intTokens); DrawViewElement(veSystemLoad, &stringTokens, &intTokens);
@ -374,7 +415,8 @@ bool cDisplayMenuMainView::DrawMemory(void) {
if (DetachViewElement(veSystemMemory)) { if (DetachViewElement(veSystemMemory)) {
cViewElement *viewElement = GetViewElement(veSystemMemory); cViewElement *viewElement = GetViewElement(veSystemMemory);
if (!viewElement) { if (!viewElement) {
viewElement = new cViewElementSystemMemory(tmplView->GetViewElement(veSystemMemory)); viewElement = new cViewElement(tmplView->GetViewElement(veSystemMemory), this);
viewElement->SetCallback(veSystemMemory, &cDisplayMenuMainView::SetSystemMemory);
AddViewElement(veSystemMemory, viewElement); AddViewElement(veSystemMemory, viewElement);
viewElement->Start(); viewElement->Start();
changed = true; changed = true;
@ -385,7 +427,7 @@ bool cDisplayMenuMainView::DrawMemory(void) {
} else { } else {
map < string, string > stringTokens; map < string, string > stringTokens;
map < string, int > intTokens; map < string, int > intTokens;
changed = SetSystemMemory(stringTokens, intTokens); changed = SetSystemMemory(false, stringTokens, intTokens);
if (changed) { if (changed) {
ClearViewElement(veSystemMemory); ClearViewElement(veSystemMemory);
DrawViewElement(veSystemMemory, &stringTokens, &intTokens); DrawViewElement(veSystemMemory, &stringTokens, &intTokens);
@ -401,7 +443,8 @@ void cDisplayMenuMainView::DrawTemperatures(void) {
if (DetachViewElement(veTemperatures)) { if (DetachViewElement(veTemperatures)) {
cViewElement *viewElement = GetViewElement(veTemperatures); cViewElement *viewElement = GetViewElement(veTemperatures);
if (!viewElement) { if (!viewElement) {
viewElement = new cViewElementTemperature(tmplView->GetViewElement(veTemperatures)); viewElement = new cViewElement(tmplView->GetViewElement(veTemperatures), this);
viewElement->SetCallback(veTemperatures, &cDisplayMenuMainView::SetSystemTemperatures);
AddViewElement(veTemperatures, viewElement); AddViewElement(veTemperatures, viewElement);
viewElement->Start(); viewElement->Start();
} else { } else {
@ -411,7 +454,7 @@ void cDisplayMenuMainView::DrawTemperatures(void) {
} else { } else {
map < string, string > stringTokens; map < string, string > stringTokens;
map < string, int > intTokens; map < string, int > intTokens;
bool changed = SetSystemTemperatures(stringTokens, intTokens); bool changed = SetSystemTemperatures(false, stringTokens, intTokens);
if (changed) { if (changed) {
ClearViewElement(veTemperatures); ClearViewElement(veTemperatures);
DrawViewElement(veTemperatures, &stringTokens, &intTokens); DrawViewElement(veTemperatures, &stringTokens, &intTokens);
@ -487,7 +530,8 @@ void cDisplayMenuMainView::DrawCurrentWeather(void) {
if (DetachViewElement(veCurrentWeather)) { if (DetachViewElement(veCurrentWeather)) {
cViewElement *viewElement = GetViewElement(veCurrentWeather); cViewElement *viewElement = GetViewElement(veCurrentWeather);
if (!viewElement) { if (!viewElement) {
viewElement = new cViewElementWeather(tmplView->GetViewElement(veCurrentWeather)); viewElement = new cViewElement(tmplView->GetViewElement(veCurrentWeather), this);
viewElement->SetCallback(veCurrentWeather, &cDisplayMenuMainView::SetCurrentWeatherTokens);
AddViewElement(veCurrentWeather, viewElement); AddViewElement(veCurrentWeather, viewElement);
viewElement->Start(); viewElement->Start();
} else { } else {
@ -497,11 +541,10 @@ void cDisplayMenuMainView::DrawCurrentWeather(void) {
} else { } else {
map < string, string > stringTokens; map < string, string > stringTokens;
map < string, int > intTokens; map < string, int > intTokens;
if (!SetCurrentWeatherTokens(stringTokens, intTokens)){ ClearViewElement(veCurrentWeather);
ClearViewElement(veCurrentWeather); if (!SetCurrentWeatherTokens(false, stringTokens, intTokens)){
return; return;
} }
ClearViewElement(veCurrentWeather);
DrawViewElement(veCurrentWeather, &stringTokens, &intTokens); DrawViewElement(veCurrentWeather, &stringTokens, &intTokens);
} }
} }

View File

@ -4,7 +4,6 @@
cDisplayMessageView::cDisplayMessageView(cTemplateView *tmplView) : cView(tmplView) { cDisplayMessageView::cDisplayMessageView(cTemplateView *tmplView) : cView(tmplView) {
DeleteOsdOnExit(); DeleteOsdOnExit();
SetFadeTime(tmplView->GetNumericParameter(ptFadeTime));
} }
cDisplayMessageView::~cDisplayMessageView() { cDisplayMessageView::~cDisplayMessageView() {
@ -47,10 +46,3 @@ void cDisplayMessageView::DrawMessage(eMessageType type, const char *text) {
void cDisplayMessageView::ClearMessage(void) { void cDisplayMessageView::ClearMessage(void) {
ClearViewElement(veMessage); ClearViewElement(veMessage);
} }
void cDisplayMessageView::Action(void) {
SetInitFinished();
FadeIn();
DoFlush();
cView::Action();
}

View File

@ -5,8 +5,6 @@
#include "view.h" #include "view.h"
class cDisplayMessageView : public cView { class cDisplayMessageView : public cView {
private:
virtual void Action(void);
public: public:
cDisplayMessageView(cTemplateView *tmplView); cDisplayMessageView(cTemplateView *tmplView);
virtual ~cDisplayMessageView(); virtual ~cDisplayMessageView();

View File

@ -12,7 +12,6 @@ cDisplayReplayView::cDisplayReplayView(cTemplateView *tmplView) : cView(tmplView
lastMarks = NULL; lastMarks = NULL;
markActive = -1; markActive = -1;
DeleteOsdOnExit(); DeleteOsdOnExit();
SetFadeTime(tmplView->GetNumericParameter(ptFadeTime));
} }
cDisplayReplayView::~cDisplayReplayView() { cDisplayReplayView::~cDisplayReplayView() {
@ -490,10 +489,3 @@ void cDisplayReplayView::RememberMarks(const cMarks *marks) {
i++; i++;
} }
} }
void cDisplayReplayView::Action(void) {
SetInitFinished();
FadeIn();
DoFlush();
cView::Action();
}

View File

@ -15,7 +15,6 @@ private:
int markActive; int markActive;
bool MarksChanged(const cMarks *marks, int current); bool MarksChanged(const cMarks *marks, int current);
void RememberMarks(const cMarks *marks); void RememberMarks(const cMarks *marks);
virtual void Action(void);
public: public:
cDisplayReplayView(cTemplateView *tmplView); cDisplayReplayView(cTemplateView *tmplView);
virtual ~cDisplayReplayView(); virtual ~cDisplayReplayView();

View File

@ -7,8 +7,8 @@ cViewElementDevices::cViewElementDevices(bool light, cTemplateViewElement *tmplV
bool cViewElementDevices::Render(void) { bool cViewElementDevices::Render(void) {
ClearTokens(); ClearTokens();
map < string, vector< map< string, string > > > deviceLoopTokens; map < string, vector<stringmap> > deviceLoopTokens;
vector< map< string, string > > devices; vector<stringmap> devices;
if (init) if (init)
InitDevices(); 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) { cViewElementScraperContent::cViewElementScraperContent(const cEvent *event, ScraperContentType type, cTemplateViewElement *tmplViewElement) : cViewElement(tmplViewElement) {
this->event = event; this->event = event;
this->type = type; this->type = type;
@ -161,62 +96,6 @@ 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) {
}
bool cViewElementTemperature::Render(void) {
ClearTokens();
if (!SetSystemTemperatures(stringTokens, intTokens))
return false;
ClearViewElement(veTemperatures);
DrawViewElement(veTemperatures, &stringTokens, &intTokens);
return true;
}
/********************************************************************************************************************/
cViewElementCurrentSchedule::cViewElementCurrentSchedule(cTemplateViewElement *tmplViewElement, string currentRecording) : cViewElement(tmplViewElement) { cViewElementCurrentSchedule::cViewElementCurrentSchedule(cTemplateViewElement *tmplViewElement, string currentRecording) : cViewElement(tmplViewElement) {
this->currentRecording = currentRecording; this->currentRecording = currentRecording;
} }
@ -228,3 +107,18 @@ bool cViewElementCurrentSchedule::Render(void) {
DrawViewElement(veCurrentSchedule, &stringTokens, &intTokens); DrawViewElement(veCurrentSchedule, &stringTokens, &intTokens);
return true; return true;
} }
/********************************************************************************************************************/
cViewElementMenuHeader::cViewElementMenuHeader(cTemplateViewElement *tmplViewElement, eMenuCategory cat, string menuTitle) : cViewElement(tmplViewElement) {
this->cat = cat;
this->menuTitle = menuTitle;
}
bool cViewElementMenuHeader::Render(void) {
ClearTokens();
SetMenuHeader(cat, menuTitle, stringTokens, intTokens);
ClearViewElement(veHeader);
DrawViewElement(veHeader, &stringTokens, &intTokens);
return true;
}

View File

@ -15,40 +15,6 @@ public:
bool Render(void); 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 { enum ScraperContentType {
ctPosterBanner, ctPosterBanner,
ctFull ctFull
@ -89,38 +55,6 @@ public:
bool Render(void); 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 {
private:
public:
cViewElementTemperature(cTemplateViewElement *tmplViewElement);
virtual ~cViewElementTemperature() {};
bool Render(void);
};
class cViewElementCurrentSchedule : public cViewElement, public cViewHelpers { class cViewElementCurrentSchedule : public cViewElement, public cViewHelpers {
private: private:
string currentRecording; string currentRecording;
@ -130,4 +64,14 @@ public:
bool Render(void); bool Render(void);
}; };
class cViewElementMenuHeader : public cViewElement, public cViewHelpers {
private:
eMenuCategory cat;
string menuTitle;
public:
cViewElementMenuHeader(cTemplateViewElement *tmplViewElement, eMenuCategory cat, string menuTitle);
virtual ~cViewElementMenuHeader() {};
bool Render(void);
};
#endif //__DISPLAYCHANNELVIEWELEMENTS_H #endif //__DISPLAYCHANNELVIEWELEMENTS_H

View File

@ -6,7 +6,6 @@ cDisplayVolumeView::cDisplayVolumeView(cTemplateView *tmplView) : cView(tmplView
volumeLast = -1; volumeLast = -1;
muteLast = false; muteLast = false;
DeleteOsdOnExit(); DeleteOsdOnExit();
SetFadeTime(tmplView->GetNumericParameter(ptFadeTime));
} }
cDisplayVolumeView::~cDisplayVolumeView() { cDisplayVolumeView::~cDisplayVolumeView() {
@ -46,10 +45,3 @@ void cDisplayVolumeView::DrawVolume(int current, int total, bool mute) {
ClearViewElement(veVolume); ClearViewElement(veVolume);
DrawViewElement(veVolume, &stringTokens, &intTokens); DrawViewElement(veVolume, &stringTokens, &intTokens);
} }
void cDisplayVolumeView::Action(void) {
SetInitFinished();
FadeIn();
DoFlush();
cView::Action();
}

View File

@ -8,7 +8,6 @@ class cDisplayVolumeView : public cView {
private: private:
int volumeLast; int volumeLast;
bool muteLast; bool muteLast;
virtual void Action(void);
public: public:
cDisplayVolumeView(cTemplateView *tmplView); cDisplayVolumeView(cTemplateView *tmplView);
virtual ~cDisplayVolumeView(); virtual ~cDisplayVolumeView();

View File

@ -7,6 +7,11 @@ using namespace std;
cView::cView(cTemplateView *tmplView) : cPixmapContainer(tmplView->DrawGebugGrid() ? tmplView->GetNumPixmaps() + 1 : tmplView->GetNumPixmaps()) { cView::cView(cTemplateView *tmplView) : cPixmapContainer(tmplView->DrawGebugGrid() ? tmplView->GetNumPixmaps() + 1 : tmplView->GetNumPixmaps()) {
this->tmplView = tmplView; 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); tvScaled = tmplView->GetScalingWindow(scalingWindow);
if (tvScaled) { if (tvScaled) {
cDevice::PrimaryDevice()->ScaleVideo(scalingWindow); cDevice::PrimaryDevice()->ScaleVideo(scalingWindow);
@ -67,6 +72,13 @@ void cView::Init(void) {
} }
void cView::Action(void) { void cView::Action(void) {
SetInitFinished();
if (IsAnimated()) {
ShiftIn();
} else {
FadeIn();
}
DoFlush();
if (scrolling) { if (scrolling) {
DoSleep(scrollDelay); DoSleep(scrollDelay);
if (scrollOrientation == orHorizontal) { if (scrollOrientation == orHorizontal) {
@ -1045,20 +1057,57 @@ cRect cView::CalculateAnimationClip(int numPix, cRect &pos) {
************************************************************************/ ************************************************************************/
cViewElement::cViewElement(cTemplateViewElement *tmplViewElement) : cView(tmplViewElement) { cViewElement::cViewElement(cTemplateViewElement *tmplViewElement) : cView(tmplViewElement) {
init = true;
ve = veUndefined;
helper = NULL;
SetTokens = NULL;
tmplViewElement->SetPixOffset(0); tmplViewElement->SetPixOffset(0);
delay = tmplViewElement->GetNumericParameter(ptDelay); delay = tmplViewElement->GetNumericParameter(ptDelay);
SetFadeTime(tmplViewElement->GetNumericParameter(ptFadeTime)); SetFadeTime(tmplViewElement->GetNumericParameter(ptFadeTime));
SetShiftTime(tmplViewElement->GetNumericParameter(ptShiftTime)); SetShiftTime(tmplViewElement->GetNumericParameter(ptShiftTime));
SetStartPos(tmplViewElement->GetNumericParameter(ptStartX), tmplViewElement->GetNumericParameter(ptStartY)); 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() { cViewElement::~cViewElement() {
CancelSave(); 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) { void cViewElement::Action(void) {
DoSleep(delay); DoSleep(delay);
Render(); if (!Running())
return;
Render();
SetInitFinished(); SetInitFinished();
if (IsAnimated()) { if (IsAnimated()) {
ShiftIn(); ShiftIn();

View File

@ -5,6 +5,7 @@
#include "map" #include "map"
#include "../libcore/pixmapcontainer.h" #include "../libcore/pixmapcontainer.h"
#include "../libtemplate/template.h" #include "../libtemplate/template.h"
#include "viewhelpers.h"
#include "animation.h" #include "animation.h"
using namespace std; using namespace std;
@ -79,15 +80,21 @@ public:
class cViewElement : public cView { class cViewElement : public cView {
private: private:
protected: protected:
bool init;
eViewElement ve;
int delay; int delay;
map < string, string > stringTokens; stringmap stringTokens;
map < string, int > intTokens; intmap intTokens;
bool (cViewHelpers::*SetTokens)(bool, stringmap&, intmap&);
cViewHelpers *helper;
void Action(void); void Action(void);
void ClearTokens(void); void ClearTokens(void);
public: public:
cViewElement(cTemplateViewElement *tmplViewElement); cViewElement(cTemplateViewElement *tmplViewElement);
cViewElement(cTemplateViewElement *tmplViewElement, cViewHelpers *helper);
virtual ~cViewElement(); 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(); }; bool Starting(void) { return Running(); };
}; };

View File

@ -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", &currentWeather)) {
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) { void cViewHelpers::InitDevices(void) {
numDevices = cDevice::NumDevices(); numDevices = cDevice::NumDevices();
lastSignalStrength = new int[numDevices]; lastSignalStrength = new int[numDevices];
@ -49,7 +277,7 @@ void cViewHelpers::InitDevices(void) {
devicesInit = true; 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 (!initial) {
if (light) if (light)
return false; return false;
@ -99,7 +327,7 @@ bool cViewHelpers::SetDevices(bool initial, bool light, map<string,int> *intToke
continue; continue;
} }
map< string, string > deviceVals; stringmap deviceVals;
stringstream strNum; stringstream strNum;
strNum << actualNumDevices; strNum << actualNumDevices;
actualNumDevices++; actualNumDevices++;
@ -164,28 +392,6 @@ bool cViewHelpers::SetDevices(bool initial, bool light, map<string,int> *intToke
return true; 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) { bool cViewHelpers::CheckNewMails(void) {
static cPlugin *pMailbox = cPluginManager::GetPlugin("mailbox"); static cPlugin *pMailbox = cPluginManager::GetPlugin("mailbox");
if (!pMailbox) { if (!pMailbox) {
@ -198,7 +404,7 @@ bool cViewHelpers::CheckNewMails(void) {
return false; 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(); static cPlugin *pScraper = GetScraperPlugin();
if (!pScraper || (!event && !recording)) { if (!pScraper || (!event && !recording)) {
intTokens.insert(pair<string,int>("ismovie", false)); 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(); static cPlugin *pScraper = GetScraperPlugin();
if (!pScraper) { if (!pScraper) {
return; 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", &currentWeather)) {
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) { void cViewHelpers::SetTimers(map<string,int> *intTokens, map<string,string> *stringTokens, vector<map<string,string> > *timers) {
cGlobalSortedTimers SortedTimers;// local and remote timers cGlobalSortedTimers SortedTimers;// local and remote timers
int numTimers = SortedTimers.Size(); 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; 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>("title", menuTitle));
stringTokens.insert(pair<string,string>("vdrversion", VDRVERSION)); 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)); stringTokens.insert(pair<string,string>("vdrusagestring", vdrUsageString));
} }
void cViewHelpers::SetDiscUsage(map < string, string > &stringTokens, map < string, int > &intTokens) { void cViewHelpers::SetCurrentSchedule(string recName, 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));
}
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) {
cDevice *device = cDevice::PrimaryDevice(); cDevice *device = cDevice::PrimaryDevice();
const cChannel *channel = NULL; const cChannel *channel = NULL;
if (!device->Replaying() || device->Transferring()) { 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"); static cPlugin *pDVBApi = cPluginManager::GetPlugin("dvbapi");
if (!pDVBApi) if (!pDVBApi)
return false; return false;
@ -892,20 +903,6 @@ bool cViewHelpers::SetEcmInfos(int channelSid, map < string, string > &stringTok
return true; 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 * 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; const cEvent *event = NULL;
cSchedulesLock SchedulesLock; cSchedulesLock SchedulesLock;
if (const cSchedules *Schedules = cSchedules::Schedules(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)); 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)); intTokens.insert(pair<string,int>("islivetv", 0));
string recFullName = recording->Name() ? recording->Name() : ""; string recFullName = recording->Name() ? recording->Name() : "";
@ -1109,3 +1106,17 @@ void cViewHelpers::SetCurrentScheduleFromRecording(const cRecording *recording,
stringTokens.insert(pair<string,string>("bannerpath", bannerPath)); stringTokens.insert(pair<string,string>("bannerpath", bannerPath));
intTokens.insert(pair<string,int>("hasbanner", hasBanner)); 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;
}

View File

@ -3,6 +3,9 @@
#include "../services/dvbapi.h" #include "../services/dvbapi.h"
typedef map<string,string> stringmap;
typedef map<string,int> intmap;
class cViewHelpers { class cViewHelpers {
private: private:
int numDevices; int numDevices;
@ -20,31 +23,32 @@ private:
sDVBAPIEcmInfo lastEcmInfo; sDVBAPIEcmInfo lastEcmInfo;
void RecName(string &path, string &name, string &folder); void RecName(string &path, string &name, string &folder);
void RecPoster(const cRecording *rec, int &posterWidth, int &posterHeight, string &path, bool &hasPoster); 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 SetCurrentScheduleFromChannel(const cChannel *channel, stringmap &stringTokens, intmap &intTokens);
void SetCurrentScheduleFromRecording(const cRecording *recording, map < string, string > &stringTokens, map < string, int > &intTokens); void SetCurrentScheduleFromRecording(const cRecording *recording, stringmap &stringTokens, intmap &intTokens);
bool CompareECMInfos(sDVBAPIEcmInfo *ecmInfo); bool CompareECMInfos(sDVBAPIEcmInfo *ecmInfo);
protected: protected:
void InitDevices(void); void InitDevices(void);
bool SetDevices(bool initial, bool light, map<string,int> *intTokens, vector<map<string,string> > *devices); bool SetDevices(bool initial, bool light, intmap *intTokens, vector<stringmap> *devices);
bool SetSignal(map < string, int > &intTokens);
bool CheckNewMails(void); 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 SetScraperTokens(const cEvent *event, const cRecording *recording, stringmap &stringTokens, intmap &intTokens, map < string, vector<stringmap> > &loopTokens);
void SetPosterBanner(const cEvent *event, map < string, string > &stringTokens, map < string, int > &intTokens); void SetPosterBanner(const cEvent *event, stringmap &stringTokens, intmap &intTokens);
bool SetTime(bool forced, map < string, string > &stringTokens, map < string, int > &intTokens); void SetTimers(map<string,int> *intTokens, map<string,string> *stringTokens, vector<stringmap> *timers);
bool SetDate(bool forced, map < string, string > &stringTokens, map < string, int > &intTokens); void SetLastRecordings(map<string,int> *intTokens, map<string,string> *stringTokens, vector<stringmap> *lastRecordings);
bool SetCurrentWeatherTokens(map < string, string > &stringTokens, map < string, int > &intTokens); void SetMenuHeader(eMenuCategory cat, string menuTitle, stringmap &stringTokens, intmap &intTokens);
void SetTimers(map<string,int> *intTokens, map<string,string> *stringTokens, vector<map<string,string> > *timers); void SetCurrentSchedule(string recName, stringmap &stringTokens, intmap &intTokens);
void SetLastRecordings(map<string,int> *intTokens, map<string,string> *stringTokens, vector<map<string,string> > *lastRecordings); bool SetEcmInfos(int channelSid, stringmap &stringTokens, intmap &intTokens);
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);
public: public:
cViewHelpers(void); cViewHelpers(void);
virtual ~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 #endif //__VIEWHELPERS_H