mirror of
https://projects.vdr-developer.org/git/vdr-plugin-skindesigner.git
synced 2023-10-19 17:58:31 +02:00
added device info in displaychannel
This commit is contained in:
parent
ce67dea08a
commit
1e20f0c893
1
HISTORY
1
HISTORY
@ -34,6 +34,7 @@ Version 0.0.2
|
|||||||
- fixed a bug if displaydetailedtext is called without correct menucat (mailbox plugin)
|
- fixed a bug if displaydetailedtext is called without correct menucat (mailbox plugin)
|
||||||
- implemented function drawslope, see Wiki for documentation
|
- implemented function drawslope, see Wiki for documentation
|
||||||
- using default menu list in case an invalid MenuCategory is set
|
- using default menu list in case an invalid MenuCategory is set
|
||||||
|
- added device info in displaychannel, example in metrixHD
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
1
Makefile
1
Makefile
@ -90,6 +90,7 @@ OBJS = $(PLUGIN).o \
|
|||||||
libtemplate/templateloopfunction.o \
|
libtemplate/templateloopfunction.o \
|
||||||
libtemplate/xmlparser.o \
|
libtemplate/xmlparser.o \
|
||||||
views/view.o \
|
views/view.o \
|
||||||
|
views/viewhelpers.o \
|
||||||
views/displaychannelview.o \
|
views/displaychannelview.o \
|
||||||
views/displaymenurootview.o \
|
views/displaymenurootview.o \
|
||||||
views/displaymenuview.o \
|
views/displaymenuview.o \
|
||||||
|
@ -185,11 +185,13 @@ void cSDDisplayChannel::Flush(void) {
|
|||||||
channelView->DrawScreenResolution();
|
channelView->DrawScreenResolution();
|
||||||
channelView->DrawSignal();
|
channelView->DrawSignal();
|
||||||
channelView->DrawAudioInfo();
|
channelView->DrawAudioInfo();
|
||||||
|
channelView->DrawDevices(initial);
|
||||||
} else {
|
} else {
|
||||||
channelView->ClearStatusIcons();
|
channelView->ClearStatusIcons();
|
||||||
channelView->ClearScreenResolution();
|
channelView->ClearScreenResolution();
|
||||||
channelView->ClearSignal();
|
channelView->ClearSignal();
|
||||||
channelView->ClearSignalBackground();
|
channelView->ClearSignalBackground();
|
||||||
|
channelView->ClearDevices();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (initial) {
|
if (initial) {
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<!ELEMENT displaychannel (background | channelinfo | epginfo | progressbar | progressbarback |
|
<!ELEMENT displaychannel (background | channelinfo | epginfo | progressbar | progressbarback |
|
||||||
statusinfo | audioinfo | screenresolution | channelgroup |
|
statusinfo | audioinfo | screenresolution | channelgroup |
|
||||||
signalquality | signalqualityback | scrapercontent |
|
signalquality | signalqualityback | devices | scrapercontent |
|
||||||
datetime | message | customtokens)* >
|
datetime | message | customtokens)* >
|
||||||
<!ATTLIST displaychannel
|
<!ATTLIST displaychannel
|
||||||
x CDATA #REQUIRED
|
x CDATA #REQUIRED
|
||||||
@ -73,6 +73,11 @@
|
|||||||
debug CDATA #IMPLIED
|
debug CDATA #IMPLIED
|
||||||
>
|
>
|
||||||
|
|
||||||
|
<!ELEMENT devices (area|areascroll)*>
|
||||||
|
<!ATTLIST devices
|
||||||
|
debug CDATA #IMPLIED
|
||||||
|
>
|
||||||
|
|
||||||
<!ELEMENT scrapercontent (area|areascroll)*>
|
<!ELEMENT scrapercontent (area|areascroll)*>
|
||||||
<!ATTLIST scrapercontent
|
<!ATTLIST scrapercontent
|
||||||
debug CDATA #IMPLIED
|
debug CDATA #IMPLIED
|
||||||
|
@ -612,6 +612,7 @@ void cTemplateViewChannel::SetViewElements(void) {
|
|||||||
viewElementsAllowed.insert("screenresolution");
|
viewElementsAllowed.insert("screenresolution");
|
||||||
viewElementsAllowed.insert("signalquality");
|
viewElementsAllowed.insert("signalquality");
|
||||||
viewElementsAllowed.insert("signalqualityback");
|
viewElementsAllowed.insert("signalqualityback");
|
||||||
|
viewElementsAllowed.insert("devices");
|
||||||
viewElementsAllowed.insert("scrapercontent");
|
viewElementsAllowed.insert("scrapercontent");
|
||||||
viewElementsAllowed.insert("datetime");
|
viewElementsAllowed.insert("datetime");
|
||||||
viewElementsAllowed.insert("message");
|
viewElementsAllowed.insert("message");
|
||||||
@ -654,6 +655,9 @@ string cTemplateViewChannel::GetViewElementName(eViewElement ve) {
|
|||||||
case veSignalQualityBack:
|
case veSignalQualityBack:
|
||||||
name = "Signal Quality Background";
|
name = "Signal Quality Background";
|
||||||
break;
|
break;
|
||||||
|
case veDevices:
|
||||||
|
name = "Devices";
|
||||||
|
break;
|
||||||
case veScraperContent:
|
case veScraperContent:
|
||||||
name = "Scraper Content";
|
name = "Scraper Content";
|
||||||
break;
|
break;
|
||||||
@ -698,6 +702,8 @@ void cTemplateViewChannel::AddPixmap(string sViewElement, cTemplatePixmap *pix,
|
|||||||
ve = veSignalQuality;
|
ve = veSignalQuality;
|
||||||
} else if (!sViewElement.compare("signalqualityback")) {
|
} else if (!sViewElement.compare("signalqualityback")) {
|
||||||
ve = veSignalQualityBack;
|
ve = veSignalQualityBack;
|
||||||
|
} else if (!sViewElement.compare("devices")) {
|
||||||
|
ve = veDevices;
|
||||||
} else if (!sViewElement.compare("scrapercontent")) {
|
} else if (!sViewElement.compare("scrapercontent")) {
|
||||||
ve = veScraperContent;
|
ve = veScraperContent;
|
||||||
} else if (!sViewElement.compare("datetime")) {
|
} else if (!sViewElement.compare("datetime")) {
|
||||||
|
@ -24,6 +24,7 @@ enum eViewElement {
|
|||||||
veBackground,
|
veBackground,
|
||||||
veDateTime,
|
veDateTime,
|
||||||
veMessage,
|
veMessage,
|
||||||
|
veDevices,
|
||||||
veCustomTokens,
|
veCustomTokens,
|
||||||
//DisplayChannel ViewElements
|
//DisplayChannel ViewElements
|
||||||
veChannelInfo,
|
veChannelInfo,
|
||||||
@ -43,7 +44,6 @@ enum eViewElement {
|
|||||||
veDiscUsage,
|
veDiscUsage,
|
||||||
veSystemLoad,
|
veSystemLoad,
|
||||||
veTimers,
|
veTimers,
|
||||||
veDevices,
|
|
||||||
veMenuItem,
|
veMenuItem,
|
||||||
veMenuCurrentItemDetail,
|
veMenuCurrentItemDetail,
|
||||||
veScrollbar,
|
veScrollbar,
|
||||||
|
@ -173,6 +173,41 @@
|
|||||||
<signalqualityback>
|
<signalqualityback>
|
||||||
</signalqualityback>
|
</signalqualityback>
|
||||||
|
|
||||||
|
<!-- Available Variables devices:
|
||||||
|
{numdevices} number of available devices
|
||||||
|
{devices[]} array with available devices
|
||||||
|
{devices[num]} number of current device
|
||||||
|
{devices[type]} type of device (DVB-S, DVB-C, ...)
|
||||||
|
{devices[istuned]} true if device is currently tuned to a transponder
|
||||||
|
{devices[livetv]} true if device is currently playing livetv
|
||||||
|
{devices[recording]} true if device is currently recording
|
||||||
|
{devices[hascam]} true if device has a CAM
|
||||||
|
{devices[cam]} number of CAM
|
||||||
|
{devices[signalstrength]} signalstrength of devcie
|
||||||
|
{devices[signalquality]} signalstrength of devcie
|
||||||
|
{devices[channelnumber]} number of the currently tuned channel
|
||||||
|
{devices[channelname]} name of the currently tuned channel
|
||||||
|
{devices[channelid]} ID of the currently tuned channel
|
||||||
|
{devices[source]} source of the currently tuned channel
|
||||||
|
-->
|
||||||
|
<devices>
|
||||||
|
<area x="70%" y="15%" width="30%" height="{areaheight}/12 * {numdevices}" layer="1">
|
||||||
|
<fill color="{clrTransBlack}"/>
|
||||||
|
</area>
|
||||||
|
<area x="70%" y="15%" width="30%" height="{areaheight}/12 * {numdevices}" layer="2">
|
||||||
|
<loop name="devices" x="0" y="0" orientation="vertical" columnwidth="{areawidth}" rowheight="{areaheight} / {numdevices}" overflow="cut">
|
||||||
|
<drawtext name="label" x="5" y="0" font="{light}" fontsize="{rowheight}*0.35" color="{clrWhite}" text="{devices[num]}: {devices[type]}" />
|
||||||
|
<drawtext condition="{devices[hascam]}" x="{width(label)} + 15" y="0" font="{light}" fontsize="{rowheight}*0.35" color="{clrWhite}" text="(CAM {devices[cam]})" />
|
||||||
|
<drawtext condition="{devices[recording]} ++ {devices[livetv]}" align="right" y="0" font="{light}" fontsize="{rowheight}*0.35" color="{clrRed}" text="LiveTV, Recording ({devices[channelname]}) " />
|
||||||
|
<drawtext condition="{devices[recording]} ++ not{devices[livetv]}" align="right" y="0" font="{light}" fontsize="{rowheight}*0.35" color="{clrRed}" text="Recording ({devices[channelname]}) " />
|
||||||
|
<drawtext condition="not{devices[recording]} ++ {devices[livetv]}" align="right" y="0" font="{light}" fontsize="{rowheight}*0.35" color="{clrWhite}" text="LiveTV ({devices[channelname]}) " />
|
||||||
|
<drawrectangle condition="{devices[istuned]}" x="5" y="{rowheight}/3 + 5" width="{areawidth} * {devices[signalstrength]} / 100 - 10 * {devices[signalstrength]} / 100" height="{rowheight}/3 - 10" color="{clrTransWhite}" />
|
||||||
|
<drawrectangle condition="{devices[istuned]}" x="5" y="2*{rowheight}/3 + 5" width="{areawidth} * {devices[signalquality]} / 100 - 10 * {devices[signalquality]} / 100" height="{rowheight}/3 - 10" color="{clrTransWhite}" />
|
||||||
|
<drawtext condition="not{devices[istuned]}" align="center" y="{rowheight}/2" font="{light}" fontsize="{rowheight}*0.40" color="{clrWhite}" text="not tuned" />
|
||||||
|
</loop>
|
||||||
|
</area>
|
||||||
|
</devices>
|
||||||
|
|
||||||
<!-- Available Variables scrapercontent:
|
<!-- Available Variables scrapercontent:
|
||||||
{mediapath} Full Path of Poster or Banner to use in image path attribute
|
{mediapath} Full Path of Poster or Banner to use in image path attribute
|
||||||
{mediawidth} width of image in pixel
|
{mediawidth} width of image in pixel
|
||||||
|
@ -105,6 +105,26 @@
|
|||||||
<signalqualityback>
|
<signalqualityback>
|
||||||
</signalqualityback>
|
</signalqualityback>
|
||||||
|
|
||||||
|
<!-- Available Variables devices:
|
||||||
|
{numdevices} number of available devices
|
||||||
|
{devices[]} array with available devices
|
||||||
|
{devices[num]} number of current device
|
||||||
|
{devices[type]} type of device (DVB-S, DVB-C, ...)
|
||||||
|
{devices[istuned]} true if device is currently tuned to a transponder
|
||||||
|
{devices[livetv]} true if device is currently playing livetv
|
||||||
|
{devices[recording]} true if device is currently recording
|
||||||
|
{devices[hascam]} true if device has a CAM
|
||||||
|
{devices[cam]} number of CAM
|
||||||
|
{devices[signalstrength]} signalstrength of devcie
|
||||||
|
{devices[signalquality]} signalstrength of devcie
|
||||||
|
{devices[channelnumber]} number of the currently tuned channel
|
||||||
|
{devices[channelname]} name of the currently tuned channel
|
||||||
|
{devices[channelid]} ID of the currently tuned channel
|
||||||
|
{devices[source]} source of the currently tuned channel
|
||||||
|
-->
|
||||||
|
<devices>
|
||||||
|
</devices>
|
||||||
|
|
||||||
<!-- Available Variables scrapercontent:
|
<!-- Available Variables scrapercontent:
|
||||||
{mediapath} Full Path of Poster or Banner to use in image path attribute
|
{mediapath} Full Path of Poster or Banner to use in image path attribute
|
||||||
{mediawidth} width of image in pixel
|
{mediawidth} width of image in pixel
|
||||||
|
@ -17,6 +17,7 @@ cDisplayChannelView::cDisplayChannelView(cTemplateView *tmplView) : cView(tmplVi
|
|||||||
lastAudioChannel = -1;
|
lastAudioChannel = -1;
|
||||||
lastTracDesc = "";
|
lastTracDesc = "";
|
||||||
lastTrackLang = "";
|
lastTrackLang = "";
|
||||||
|
InitDevices();
|
||||||
DeleteOsdOnExit();
|
DeleteOsdOnExit();
|
||||||
SetFadeTime(tmplView->GetNumericParameter(ptFadeTime));
|
SetFadeTime(tmplView->GetNumericParameter(ptFadeTime));
|
||||||
}
|
}
|
||||||
@ -109,7 +110,8 @@ void cDisplayChannelView::DrawProgressBar(cString &start, cString &stop, int Cur
|
|||||||
intTokens.insert(pair<string, int>("duration", Total));
|
intTokens.insert(pair<string, int>("duration", Total));
|
||||||
intTokens.insert(pair<string, int>("elapsed", Current));
|
intTokens.insert(pair<string, int>("elapsed", Current));
|
||||||
intTokens.insert(pair<string, int>("remaining", Total - Current));
|
intTokens.insert(pair<string, int>("remaining", Total - Current));
|
||||||
|
|
||||||
|
ClearProgressBar();
|
||||||
DrawViewElement(veProgressBar, &stringTokens, &intTokens);
|
DrawViewElement(veProgressBar, &stringTokens, &intTokens);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -399,6 +401,29 @@ void cDisplayChannelView::ClearSignalBackground(void) {
|
|||||||
ClearViewElement(veSignalQualityBack);
|
ClearViewElement(veSignalQualityBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cDisplayChannelView::DrawDevices(bool initial) {
|
||||||
|
if (!ViewElementImplemented(veDevices)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
map < string, string > stringTokens;
|
||||||
|
map < string, int > intTokens;
|
||||||
|
map < string, vector< map< string, string > > > deviceLoopTokens;
|
||||||
|
vector< map< string, string > > devices;
|
||||||
|
|
||||||
|
bool changed = SetDevices(initial, &intTokens, &devices);
|
||||||
|
if (!changed)
|
||||||
|
return;
|
||||||
|
|
||||||
|
deviceLoopTokens.insert(pair< string, vector< map< string, string > > >("devices", devices));
|
||||||
|
|
||||||
|
ClearViewElement(veDevices);
|
||||||
|
DrawViewElement(veDevices, &stringTokens, &intTokens, &deviceLoopTokens);
|
||||||
|
}
|
||||||
|
|
||||||
|
void cDisplayChannelView::ClearDevices(void) {
|
||||||
|
ClearViewElement(veDevices);
|
||||||
|
}
|
||||||
|
|
||||||
void cDisplayChannelView::DrawChannelGroups(const cChannel *Channel, cString ChannelName) {
|
void cDisplayChannelView::DrawChannelGroups(const cChannel *Channel, cString ChannelName) {
|
||||||
if (!ViewElementImplemented(veChannelGroup)) {
|
if (!ViewElementImplemented(veChannelGroup)) {
|
||||||
return;
|
return;
|
||||||
|
@ -3,8 +3,9 @@
|
|||||||
|
|
||||||
#include "../libtemplate/template.h"
|
#include "../libtemplate/template.h"
|
||||||
#include "view.h"
|
#include "view.h"
|
||||||
|
#include "viewhelpers.h"
|
||||||
|
|
||||||
class cDisplayChannelView : public cView {
|
class cDisplayChannelView : public cView, public cViewHelpers {
|
||||||
private:
|
private:
|
||||||
cString lastDate;
|
cString lastDate;
|
||||||
int lastScreenWidth;
|
int lastScreenWidth;
|
||||||
@ -44,6 +45,8 @@ public:
|
|||||||
void DrawSignalBackground(void);
|
void DrawSignalBackground(void);
|
||||||
void ClearSignal(void);
|
void ClearSignal(void);
|
||||||
void ClearSignalBackground(void);
|
void ClearSignalBackground(void);
|
||||||
|
void DrawDevices(bool initial);
|
||||||
|
void ClearDevices(void);
|
||||||
void DrawChannelGroups(const cChannel *Channel, cString ChannelName);
|
void DrawChannelGroups(const cChannel *Channel, cString ChannelName);
|
||||||
void ClearChannelGroups(void);
|
void ClearChannelGroups(void);
|
||||||
void DisplayMessage(eMessageType Type, const char *Text);
|
void DisplayMessage(eMessageType Type, const char *Text);
|
||||||
|
@ -223,9 +223,6 @@ cDisplayMenuMainView::cDisplayMenuMainView(cTemplateView *tmplView, bool menuIni
|
|||||||
cDisplayMenuMainView::~cDisplayMenuMainView() {
|
cDisplayMenuMainView::~cDisplayMenuMainView() {
|
||||||
CancelSave();
|
CancelSave();
|
||||||
FadeOut();
|
FadeOut();
|
||||||
delete[] lastSignalStrength;
|
|
||||||
delete[] lastSignalQuality;
|
|
||||||
delete[] recDevices;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cDisplayMenuMainView::DrawStaticViewElements(void) {
|
void cDisplayMenuMainView::DrawStaticViewElements(void) {
|
||||||
@ -360,18 +357,6 @@ void cDisplayMenuMainView::DrawDiscUsage(void) {
|
|||||||
DrawViewElement(veDiscUsage, &stringTokens, &intTokens);
|
DrawViewElement(veDiscUsage, &stringTokens, &intTokens);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cDisplayMenuMainView::InitDevices(void) {
|
|
||||||
int numDevices = cDevice::NumDevices();
|
|
||||||
lastSignalStrength = new int[numDevices];
|
|
||||||
lastSignalQuality = new int[numDevices];
|
|
||||||
recDevices = new bool[numDevices];
|
|
||||||
for (int i=0; i<numDevices; i++) {
|
|
||||||
lastSignalStrength[i] = 0;
|
|
||||||
lastSignalQuality[i] = 0;
|
|
||||||
recDevices[i] = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool cDisplayMenuMainView::DrawLoad(void) {
|
bool cDisplayMenuMainView::DrawLoad(void) {
|
||||||
if (!ViewElementImplemented(veSystemLoad)) {
|
if (!ViewElementImplemented(veSystemLoad)) {
|
||||||
return false;
|
return false;
|
||||||
@ -400,120 +385,22 @@ bool cDisplayMenuMainView::DrawDevices(void) {
|
|||||||
if (!ViewElementImplemented(veDevices)) {
|
if (!ViewElementImplemented(veDevices)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int numDevices = cDevice::NumDevices();
|
|
||||||
if (!initial) {
|
|
||||||
//check if drawing is necessary
|
|
||||||
bool changed = false;
|
|
||||||
for (int i = 0; i < numDevices; i++) {
|
|
||||||
const cDevice *device = cDevice::GetDevice(i);
|
|
||||||
if (!device || !device->NumProvidedSystems()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if ((device->SignalStrength() != lastSignalStrength[i]) || (device->SignalQuality() != lastSignalQuality[i])) {
|
|
||||||
changed = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!changed) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
map < string, string > stringTokens;
|
map < string, string > stringTokens;
|
||||||
map < string, int > intTokens;
|
map < string, int > intTokens;
|
||||||
|
|
||||||
map < string, vector< map< string, string > > > deviceLoopTokens;
|
map < string, vector< map< string, string > > > deviceLoopTokens;
|
||||||
vector< map< string, string > > devices;
|
vector< map< string, string > > devices;
|
||||||
|
|
||||||
//check device which currently displays live tv
|
bool changed = SetDevices(initial, &intTokens, &devices);
|
||||||
int deviceLiveTV = -1;
|
if (!changed)
|
||||||
cDevice *primaryDevice = cDevice::PrimaryDevice();
|
return false;
|
||||||
if (primaryDevice) {
|
|
||||||
if (!primaryDevice->Replaying() || primaryDevice->Transferring())
|
|
||||||
deviceLiveTV = cDevice::ActualDevice()->DeviceNumber();
|
|
||||||
else
|
|
||||||
deviceLiveTV = primaryDevice->DeviceNumber();
|
|
||||||
}
|
|
||||||
|
|
||||||
//check currently recording devices
|
|
||||||
for (cTimer *timer = Timers.First(); timer; timer = Timers.Next(timer)) {
|
|
||||||
if (!timer->Recording()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (cRecordControl *RecordControl = cRecordControls::GetRecordControl(timer)) {
|
|
||||||
const cDevice *recDevice = RecordControl->Device();
|
|
||||||
if (recDevice) {
|
|
||||||
recDevices[recDevice->DeviceNumber()] = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
int actualNumDevices = 0;
|
|
||||||
for (int i = 0; i < numDevices; i++) {
|
|
||||||
const cDevice *device = cDevice::GetDevice(i);
|
|
||||||
if (!device || !device->NumProvidedSystems()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
actualNumDevices++;
|
|
||||||
map< string, string > deviceVals;
|
|
||||||
stringstream strNum;
|
|
||||||
strNum << actualNumDevices;
|
|
||||||
deviceVals.insert(pair< string, string >("devices[num]", strNum.str()));
|
|
||||||
deviceVals.insert(pair< string, string >("devices[type]", *(device->DeviceType())));
|
|
||||||
cCamSlot *camSlot = device->CamSlot();
|
|
||||||
int camNumber = -1;
|
|
||||||
if (camSlot) {
|
|
||||||
camNumber = camSlot->SlotNumber();
|
|
||||||
deviceVals.insert(pair< string, string >("devices[hascam]", "1"));
|
|
||||||
} else {
|
|
||||||
deviceVals.insert(pair< string, string >("devices[hascam]", "0"));
|
|
||||||
}
|
|
||||||
int signalStrength = device->SignalStrength();
|
|
||||||
int signalQuality = device->SignalQuality();
|
|
||||||
stringstream strCamNumber;
|
|
||||||
strCamNumber << camNumber;
|
|
||||||
deviceVals.insert(pair< string, string >("devices[cam]", strCamNumber.str()));
|
|
||||||
stringstream strStrength;
|
|
||||||
strStrength << signalStrength;
|
|
||||||
deviceVals.insert(pair< string, string >("devices[signalstrength]", strStrength.str()));
|
|
||||||
stringstream strQuality;
|
|
||||||
strQuality << signalQuality;
|
|
||||||
deviceVals.insert(pair< string, string >("devices[signalquality]", strQuality.str()));
|
|
||||||
|
|
||||||
deviceVals.insert(pair< string, string >("devices[livetv]", i == deviceLiveTV ? "1" : "0"));
|
|
||||||
deviceVals.insert(pair< string, string >("devices[recording]", recDevices[i] ? "1" : "0"));
|
|
||||||
|
|
||||||
const cChannel *channel = device->GetCurrentlyTunedTransponder();
|
|
||||||
const cSource *source = (channel) ? Sources.Get(channel->Source()) : NULL;
|
|
||||||
if (channel && channel->Number() > 0) {
|
|
||||||
stringstream strChanNum;
|
|
||||||
strChanNum << channel->Number();
|
|
||||||
deviceVals.insert(pair< string, string >("devices[channelnumber]", strChanNum.str()));
|
|
||||||
deviceVals.insert(pair< string, string >("devices[channelname]", channel->Name()));
|
|
||||||
deviceVals.insert(pair< string, string >("devices[channelid]", *(channel->GetChannelID().ToString())));
|
|
||||||
deviceVals.insert(pair< string, string >("devices[istuned]", "1"));
|
|
||||||
} else {
|
|
||||||
deviceVals.insert(pair< string, string >("devices[channelnumber]", "0"));
|
|
||||||
deviceVals.insert(pair< string, string >("devices[channelname]", ""));
|
|
||||||
deviceVals.insert(pair< string, string >("devices[channelid]", ""));
|
|
||||||
deviceVals.insert(pair< string, string >("devices[istuned]", "0"));
|
|
||||||
}
|
|
||||||
|
|
||||||
deviceVals.insert(pair< string, string >("devices[source]", source ? source->Description() : ""));
|
|
||||||
|
|
||||||
devices.push_back(deviceVals);
|
|
||||||
|
|
||||||
lastSignalStrength[i] = signalStrength;
|
|
||||||
lastSignalQuality[i] = signalQuality;
|
|
||||||
}
|
|
||||||
deviceLoopTokens.insert(pair< string, vector< map< string, string > > >("devices", devices));
|
deviceLoopTokens.insert(pair< string, vector< map< string, string > > >("devices", devices));
|
||||||
|
|
||||||
intTokens.insert(pair<string, int>("numdevices", actualNumDevices));
|
|
||||||
|
|
||||||
ClearViewElement(veDevices);
|
ClearViewElement(veDevices);
|
||||||
DrawViewElement(veDevices, &stringTokens, &intTokens, &deviceLoopTokens);
|
DrawViewElement(veDevices, &stringTokens, &intTokens, &deviceLoopTokens);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* cDisplayMenuSchedulesView
|
* cDisplayMenuSchedulesView
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#define __DISPLAYMENUVIEW_H
|
#define __DISPLAYMENUVIEW_H
|
||||||
|
|
||||||
#include "../libtemplate/template.h"
|
#include "../libtemplate/template.h"
|
||||||
|
#include "viewhelpers.h"
|
||||||
#include "displaymenulistview.h"
|
#include "displaymenulistview.h"
|
||||||
|
|
||||||
class cDisplayMenuView : public cView {
|
class cDisplayMenuView : public cView {
|
||||||
@ -28,17 +29,13 @@ public:
|
|||||||
bool BackgroundImplemented(void);
|
bool BackgroundImplemented(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
class cDisplayMenuMainView : public cDisplayMenuView {
|
class cDisplayMenuMainView : public cDisplayMenuView, public cViewHelpers {
|
||||||
private:
|
private:
|
||||||
bool initial;
|
bool initial;
|
||||||
int* lastSignalStrength;
|
|
||||||
int* lastSignalQuality;
|
|
||||||
double lastSystemLoad;
|
double lastSystemLoad;
|
||||||
bool* recDevices;
|
|
||||||
void DrawTimers(void);
|
void DrawTimers(void);
|
||||||
void DrawDiscUsage(void);
|
void DrawDiscUsage(void);
|
||||||
bool DrawLoad(void);
|
bool DrawLoad(void);
|
||||||
void InitDevices(void);
|
|
||||||
bool DrawDevices(void);
|
bool DrawDevices(void);
|
||||||
public:
|
public:
|
||||||
cDisplayMenuMainView(cTemplateView *tmplView, bool menuInit);
|
cDisplayMenuMainView(cTemplateView *tmplView, bool menuInit);
|
||||||
|
133
views/viewhelpers.c
Normal file
133
views/viewhelpers.c
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
#include <vdr/menu.h>
|
||||||
|
#include "../config.h"
|
||||||
|
#include "viewhelpers.h"
|
||||||
|
|
||||||
|
cViewHelpers::cViewHelpers(void) {
|
||||||
|
devicesInit = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
cViewHelpers::~cViewHelpers() {
|
||||||
|
if (devicesInit) {
|
||||||
|
delete[] lastSignalStrength;
|
||||||
|
delete[] lastSignalQuality;
|
||||||
|
delete[] recDevices;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void cViewHelpers::InitDevices(void) {
|
||||||
|
int numDevices = cDevice::NumDevices();
|
||||||
|
lastSignalStrength = new int[numDevices];
|
||||||
|
lastSignalQuality = new int[numDevices];
|
||||||
|
recDevices = new bool[numDevices];
|
||||||
|
for (int i=0; i<numDevices; i++) {
|
||||||
|
lastSignalStrength[i] = 0;
|
||||||
|
lastSignalQuality[i] = 0;
|
||||||
|
recDevices[i] = false;
|
||||||
|
}
|
||||||
|
devicesInit = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool cViewHelpers::SetDevices(bool initial, map<string,int> *intTokens, vector<map<string,string> > *devices) {
|
||||||
|
int numDevices = cDevice::NumDevices();
|
||||||
|
if (!initial) {
|
||||||
|
//check if drawing is necessary
|
||||||
|
bool changed = false;
|
||||||
|
for (int i = 0; i < numDevices; i++) {
|
||||||
|
const cDevice *device = cDevice::GetDevice(i);
|
||||||
|
if (!device || !device->NumProvidedSystems()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ((device->SignalStrength() != lastSignalStrength[i]) || (device->SignalQuality() != lastSignalQuality[i])) {
|
||||||
|
changed = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!changed) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//check device which currently displays live tv
|
||||||
|
int deviceLiveTV = -1;
|
||||||
|
cDevice *primaryDevice = cDevice::PrimaryDevice();
|
||||||
|
if (primaryDevice) {
|
||||||
|
if (!primaryDevice->Replaying() || primaryDevice->Transferring())
|
||||||
|
deviceLiveTV = cDevice::ActualDevice()->DeviceNumber();
|
||||||
|
else
|
||||||
|
deviceLiveTV = primaryDevice->DeviceNumber();
|
||||||
|
}
|
||||||
|
|
||||||
|
//check currently recording devices
|
||||||
|
for (cTimer *timer = Timers.First(); timer; timer = Timers.Next(timer)) {
|
||||||
|
if (!timer->Recording()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (cRecordControl *RecordControl = cRecordControls::GetRecordControl(timer)) {
|
||||||
|
const cDevice *recDevice = RecordControl->Device();
|
||||||
|
if (recDevice) {
|
||||||
|
recDevices[recDevice->DeviceNumber()] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int actualNumDevices = 0;
|
||||||
|
for (int i = 0; i < numDevices; i++) {
|
||||||
|
const cDevice *device = cDevice::GetDevice(i);
|
||||||
|
if (!device || !device->NumProvidedSystems()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
actualNumDevices++;
|
||||||
|
map< string, string > deviceVals;
|
||||||
|
stringstream strNum;
|
||||||
|
strNum << actualNumDevices;
|
||||||
|
deviceVals.insert(pair< string, string >("devices[num]", strNum.str()));
|
||||||
|
deviceVals.insert(pair< string, string >("devices[type]", *(device->DeviceType())));
|
||||||
|
cCamSlot *camSlot = device->CamSlot();
|
||||||
|
int camNumber = -1;
|
||||||
|
if (camSlot) {
|
||||||
|
camNumber = camSlot->SlotNumber();
|
||||||
|
deviceVals.insert(pair< string, string >("devices[hascam]", "1"));
|
||||||
|
} else {
|
||||||
|
deviceVals.insert(pair< string, string >("devices[hascam]", "0"));
|
||||||
|
}
|
||||||
|
int signalStrength = device->SignalStrength();
|
||||||
|
int signalQuality = device->SignalQuality();
|
||||||
|
stringstream strCamNumber;
|
||||||
|
strCamNumber << camNumber;
|
||||||
|
deviceVals.insert(pair< string, string >("devices[cam]", strCamNumber.str()));
|
||||||
|
stringstream strStrength;
|
||||||
|
strStrength << signalStrength;
|
||||||
|
deviceVals.insert(pair< string, string >("devices[signalstrength]", strStrength.str()));
|
||||||
|
stringstream strQuality;
|
||||||
|
strQuality << signalQuality;
|
||||||
|
deviceVals.insert(pair< string, string >("devices[signalquality]", strQuality.str()));
|
||||||
|
|
||||||
|
deviceVals.insert(pair< string, string >("devices[livetv]", i == deviceLiveTV ? "1" : "0"));
|
||||||
|
deviceVals.insert(pair< string, string >("devices[recording]", recDevices[i] ? "1" : "0"));
|
||||||
|
|
||||||
|
const cChannel *channel = device->GetCurrentlyTunedTransponder();
|
||||||
|
const cSource *source = (channel) ? Sources.Get(channel->Source()) : NULL;
|
||||||
|
if (channel && channel->Number() > 0) {
|
||||||
|
stringstream strChanNum;
|
||||||
|
strChanNum << channel->Number();
|
||||||
|
deviceVals.insert(pair< string, string >("devices[channelnumber]", strChanNum.str()));
|
||||||
|
deviceVals.insert(pair< string, string >("devices[channelname]", channel->Name()));
|
||||||
|
deviceVals.insert(pair< string, string >("devices[channelid]", *(channel->GetChannelID().ToString())));
|
||||||
|
deviceVals.insert(pair< string, string >("devices[istuned]", "1"));
|
||||||
|
} else {
|
||||||
|
deviceVals.insert(pair< string, string >("devices[channelnumber]", "0"));
|
||||||
|
deviceVals.insert(pair< string, string >("devices[channelname]", ""));
|
||||||
|
deviceVals.insert(pair< string, string >("devices[channelid]", ""));
|
||||||
|
deviceVals.insert(pair< string, string >("devices[istuned]", "0"));
|
||||||
|
}
|
||||||
|
|
||||||
|
deviceVals.insert(pair< string, string >("devices[source]", source ? source->Description() : ""));
|
||||||
|
|
||||||
|
devices->push_back(deviceVals);
|
||||||
|
|
||||||
|
lastSignalStrength[i] = signalStrength;
|
||||||
|
lastSignalQuality[i] = signalQuality;
|
||||||
|
}
|
||||||
|
|
||||||
|
intTokens->insert(pair<string, int>("numdevices", actualNumDevices));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
18
views/viewhelpers.h
Normal file
18
views/viewhelpers.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#ifndef __VIEWHELPERS_H
|
||||||
|
#define __VIEWHELPERS_H
|
||||||
|
|
||||||
|
class cViewHelpers {
|
||||||
|
private:
|
||||||
|
bool devicesInit;
|
||||||
|
int* lastSignalStrength;
|
||||||
|
int* lastSignalQuality;
|
||||||
|
bool* recDevices;
|
||||||
|
protected:
|
||||||
|
public:
|
||||||
|
cViewHelpers(void);
|
||||||
|
virtual ~cViewHelpers(void);
|
||||||
|
void InitDevices(void);
|
||||||
|
bool SetDevices(bool initial, map<string,int> *intTokens, vector<map<string,string> > *devices);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //__VIEWHELPERS_H
|
Loading…
Reference in New Issue
Block a user