summaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
authorlouis <louis.braun@gmx.de>2015-03-22 08:29:52 +0100
committerlouis <louis.braun@gmx.de>2015-03-22 08:29:52 +0100
commitd1ea7bd4a467463b939029aa76c43bae4e58b73f (patch)
treec515cf4c606e017f24b28c92e053bb385437fd47 /views
parent9c93fbc0726ff54f2070837ac821ef3d258dfd30 (diff)
downloadvdr-plugin-skindesigner-d1ea7bd4a467463b939029aa76c43bae4e58b73f.tar.gz
vdr-plugin-skindesigner-d1ea7bd4a467463b939029aa76c43bae4e58b73f.tar.bz2
add detached option for viewelements
Diffstat (limited to 'views')
-rw-r--r--views/displaychannelview.c16
-rw-r--r--views/view.c8
-rw-r--r--views/view.h1
-rw-r--r--views/viewhelpers.c26
-rw-r--r--views/viewhelpers.h1
5 files changed, 18 insertions, 34 deletions
diff --git a/views/displaychannelview.c b/views/displaychannelview.c
index 384ae67..fe127e7 100644
--- a/views/displaychannelview.c
+++ b/views/displaychannelview.c
@@ -393,20 +393,11 @@ void cDisplayChannelView::DrawSignal(void) {
if (!ExecuteViewElement(veSignalQuality)) {
return;
}
+
time_t Now = time(NULL);
if (Now != lastSignalDisplay) {
-#ifdef DOPROFILE
- cStopWatch watch("DrawSignal");
-#endif
int SignalStrength = cDevice::ActualDevice()->SignalStrength();
-#ifdef DOPROFILE
- watch.Report("SignalStrength");
-#endif
int SignalQuality = cDevice::ActualDevice()->SignalQuality();
-#ifdef DOPROFILE
- watch.Report("SignalQuality");
- watch.Stop("DrawSignal");
-#endif
if (SignalStrength < 0) SignalStrength = 0;
if (SignalQuality < 0) SignalQuality = 0;
if ((SignalStrength == 0)&&(SignalQuality==0))
@@ -445,6 +436,11 @@ void cDisplayChannelView::DrawDevices(bool initial) {
if (!ExecuteViewElement(veDevices)) {
return;
}
+
+ if (DetachViewElement(veDevices)) {
+ esyslog("skindesigner: start new thread for devices");
+ }
+
map < string, string > stringTokens;
map < string, int > intTokens;
map < string, vector< map< string, string > > > deviceLoopTokens;
diff --git a/views/view.c b/views/view.c
index 6c4cb26..0c8c584 100644
--- a/views/view.c
+++ b/views/view.c
@@ -206,12 +206,20 @@ void cView::ActivateScrolling(void) {
}
bool cView::ExecuteViewElement(eViewElement ve) {
+ if (!tmplView)
+ return false;
bool doExecute = tmplView->ExecuteView(ve);
if (!doExecute)
return false;
return tmplView->GetNumPixmapsViewElement(ve);
}
+bool cView::DetachViewElement(eViewElement ve) {
+ if (!tmplView)
+ return false;
+ return tmplView->DetachViewElement(ve);
+}
+
bool cView::ViewElementScrolls(eViewElement ve) {
if (scrollingPix < 0)
return false;
diff --git a/views/view.h b/views/view.h
index 3c19b83..3d9c501 100644
--- a/views/view.h
+++ b/views/view.h
@@ -43,6 +43,7 @@ protected:
void ClearViewElement(eViewElement ve);
void DestroyViewElement(eViewElement ve);
bool ExecuteViewElement(eViewElement ve);
+ bool DetachViewElement(eViewElement ve);
bool ViewElementScrolls(eViewElement ve);
void CreateViewPixmap(int num, cTemplatePixmap *pix, cRect *size = NULL);
void CreateScrollingPixmap(int num, cTemplatePixmap *pix, cSize &drawportSize);
diff --git a/views/viewhelpers.c b/views/viewhelpers.c
index e10798f..3ec8847 100644
--- a/views/viewhelpers.c
+++ b/views/viewhelpers.c
@@ -6,6 +6,7 @@
#include "viewhelpers.h"
cViewHelpers::cViewHelpers(void) {
+ numDevices = 0;
devicesInit = false;
lastSecond = -1;
lastMinute = -1;
@@ -20,7 +21,7 @@ cViewHelpers::~cViewHelpers() {
}
void cViewHelpers::InitDevices(void) {
- int numDevices = cDevice::NumDevices();
+ numDevices = cDevice::NumDevices();
lastSignalStrength = new int[numDevices];
lastSignalQuality = new int[numDevices];
recDevices = new bool[numDevices];
@@ -33,10 +34,6 @@ void cViewHelpers::InitDevices(void) {
}
bool cViewHelpers::SetDevices(bool initial, map<string,int> *intTokens, vector<map<string,string> > *devices) {
-#ifdef DOPROFILE
- cStopWatch watch("SetDevices");
-#endif
- int numDevices = cDevice::NumDevices();
if (!initial) {
//check if drawing is necessary
bool changed = false;
@@ -46,23 +43,13 @@ bool cViewHelpers::SetDevices(bool initial, map<string,int> *intTokens, vector<m
continue;
}
int signalStrength = device->SignalStrength();
-#ifdef DOPROFILE
- watch.Report(*cString::sprintf("SignalStrength() device %d", i));
-#endif
int signalQuality = device->SignalQuality();
-#ifdef DOPROFILE
- watch.Report(*cString::sprintf("SignalQuality() device %d", i));
-#endif
-
if ((signalStrength != lastSignalStrength[i]) || (signalQuality != lastSignalQuality[i])) {
changed = true;
break;
}
}
if (!changed) {
-#ifdef DOPROFILE
- watch.Stop("SetDevices End");
-#endif
return false;
}
}
@@ -109,13 +96,7 @@ bool cViewHelpers::SetDevices(bool initial, map<string,int> *intTokens, vector<m
deviceVals.insert(pair< string, string >("devices[hascam]", "0"));
}
int signalStrength = device->SignalStrength();
-#ifdef DOPROFILE
- watch.Report(*cString::sprintf("SignalStrength() device %d", i));
-#endif
int signalQuality = device->SignalQuality();
-#ifdef DOPROFILE
- watch.Report(*cString::sprintf("SignalQuality() device %d", i));
-#endif
stringstream strCamNumber;
strCamNumber << camNumber;
deviceVals.insert(pair< string, string >("devices[cam]", strCamNumber.str()));
@@ -157,9 +138,6 @@ bool cViewHelpers::SetDevices(bool initial, map<string,int> *intTokens, vector<m
}
intTokens->insert(pair<string, int>("numdevices", actualNumDevices));
-#ifdef DOPROFILE
- watch.Stop("SetDevices End");
-#endif
return true;
}
diff --git a/views/viewhelpers.h b/views/viewhelpers.h
index 8e49554..53209b4 100644
--- a/views/viewhelpers.h
+++ b/views/viewhelpers.h
@@ -3,6 +3,7 @@
class cViewHelpers {
private:
+ int numDevices;
bool devicesInit;
int* lastSignalStrength;
int* lastSignalQuality;