mirror of
https://projects.vdr-developer.org/git/vdr-plugin-skindesigner.git
synced 2023-10-19 15:58:31 +00:00
Merge branch 'master' of git://projects.vdr-developer.org/vdr-plugin-skindesigner
This commit is contained in:
@@ -17,7 +17,6 @@ cDisplayChannelView::cDisplayChannelView(cTemplateView *tmplView) : cView(tmplVi
|
||||
lastTracDesc = "";
|
||||
lastTrackLang = "";
|
||||
InitDevices();
|
||||
InitFemonReceiver();
|
||||
DeleteOsdOnExit();
|
||||
SetFadeTime(tmplView->GetNumericParameter(ptFadeTime));
|
||||
}
|
||||
@@ -424,33 +423,6 @@ void cDisplayChannelView::ClearDevices(void) {
|
||||
ClearViewElement(veDevices);
|
||||
}
|
||||
|
||||
void cDisplayChannelView::DrawBitrates(void) {
|
||||
if (!ViewElementImplemented(veBitRate)) {
|
||||
return;
|
||||
}
|
||||
double bitrateVideo;
|
||||
double bitrateAudio;
|
||||
double bitrateDolby;
|
||||
|
||||
bool changed = GetBitrates(bitrateVideo, bitrateAudio, bitrateDolby);
|
||||
if (!changed) {
|
||||
return;
|
||||
}
|
||||
map < string, string > stringTokens;
|
||||
map < string, int > intTokens;
|
||||
stringTokens.insert(pair<string,string>("bitratevideo", *cString::sprintf("%.2f", bitrateVideo)));
|
||||
intTokens.insert(pair<string,int>("bitrateaudio", bitrateAudio));
|
||||
intTokens.insert(pair<string,int>("bitratedolby", bitrateDolby));
|
||||
intTokens.insert(pair<string,int>("isdolby", (bitrateDolby > 0) ? true : false));
|
||||
|
||||
ClearBitrates();
|
||||
DrawViewElement(veBitRate, &stringTokens, &intTokens);
|
||||
}
|
||||
|
||||
void cDisplayChannelView::ClearBitrates(void) {
|
||||
ClearViewElement(veBitRate);
|
||||
}
|
||||
|
||||
void cDisplayChannelView::DrawChannelGroups(const cChannel *Channel, cString ChannelName) {
|
||||
if (!ViewElementImplemented(veChannelGroup)) {
|
||||
return;
|
||||
|
@@ -47,8 +47,6 @@ public:
|
||||
void ClearSignalBackground(void);
|
||||
void DrawDevices(bool initial);
|
||||
void ClearDevices(void);
|
||||
void DrawBitrates(void);
|
||||
void ClearBitrates(void);
|
||||
void DrawChannelGroups(const cChannel *Channel, cString ChannelName);
|
||||
void ClearChannelGroups(void);
|
||||
void DisplayMessage(eMessageType Type, const char *Text);
|
||||
|
@@ -165,7 +165,10 @@ void cDisplayMenuItemCurrentSchedulesView::Render(void) {
|
||||
SetScraperPoster(event);
|
||||
}
|
||||
if (channel) {
|
||||
stringTokens.insert(pair<string,string>("channelid", *(channel->GetChannelID().ToString())));
|
||||
stringTokens.insert(pair<string,string>("channelname", channel->Name() ? channel->Name() : ""));
|
||||
string channelID = *(channel->GetChannelID().ToString());
|
||||
stringTokens.insert(pair<string,string>("channelid", channelID));
|
||||
intTokens.insert(pair<string, int>("channellogoexists", imgCache->LogoExists(channelID)));
|
||||
}
|
||||
|
||||
vector< map<string,string> > schedulesTokens;
|
||||
@@ -454,7 +457,7 @@ void cDisplayMenuItemCurrentTimerView::Render(void) {
|
||||
SetScraperPoster(event);
|
||||
} else {
|
||||
stringTokens.insert(pair<string,string>("eventtitle", ""));
|
||||
stringTokens.insert(pair<string,string>("eventtitle", ""));
|
||||
stringTokens.insert(pair<string,string>("eventstart", ""));
|
||||
stringTokens.insert(pair<string,string>("eventstop", ""));
|
||||
stringTokens.insert(pair<string,string>("eventshorttext", ""));
|
||||
stringTokens.insert(pair<string,string>("eventdescription", ""));
|
||||
|
@@ -333,13 +333,16 @@ void cDisplayMenuItemSchedulesView::SetTokens(void) {
|
||||
}
|
||||
if (channel) {
|
||||
stringTokens.insert(pair<string,string>("channelname", channel->Name() ? channel->Name() : ""));
|
||||
stringTokens.insert(pair<string,string>("channelid", *(channel->GetChannelID().ToString())));
|
||||
string channelID = *(channel->GetChannelID().ToString());
|
||||
stringTokens.insert(pair<string,string>("channelid", channelID));
|
||||
intTokens.insert(pair<string, int>("channellogoexists", imgCache->LogoExists(channelID)));
|
||||
if (!event && !selectable) {
|
||||
stringTokens.insert(pair<string,string>("title", channel->Name() ? ParseSeparator(channel->Name()) : ""));
|
||||
}
|
||||
} else {
|
||||
stringTokens.insert(pair<string,string>("channelname", ""));
|
||||
stringTokens.insert(pair<string,string>("channelid", ""));
|
||||
intTokens.insert(pair<string, int>("channellogoexists", 0));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -95,6 +95,8 @@ void cDisplayMenuListView::Clear(void) {
|
||||
}
|
||||
|
||||
void cDisplayMenuListView::AddDefaultMenuItem(int index, string *tabTexts, bool current, bool selectable) {
|
||||
if (index >= itemCount)
|
||||
return;
|
||||
if (menuItems[index]) {
|
||||
cDisplayMenuItemDefaultView *menuItem = dynamic_cast<cDisplayMenuItemDefaultView*>(menuItems[index]);
|
||||
if (!menuItem)
|
||||
@@ -114,6 +116,8 @@ void cDisplayMenuListView::AddDefaultMenuItem(int index, string *tabTexts, bool
|
||||
}
|
||||
|
||||
void cDisplayMenuListView::AddMainMenuItem(int index, const char *itemText, bool current, bool selectable) {
|
||||
if (index >= itemCount)
|
||||
return;
|
||||
if (menuItems[index]) {
|
||||
menuItems[index]->SetCurrent(current);
|
||||
return;
|
||||
@@ -123,6 +127,8 @@ void cDisplayMenuListView::AddMainMenuItem(int index, const char *itemText, bool
|
||||
}
|
||||
|
||||
void cDisplayMenuListView::AddSetupMenuItem(int index, const char *itemText, bool current, bool selectable) {
|
||||
if (index >= itemCount)
|
||||
return;
|
||||
if (menuItems[index]) {
|
||||
menuItems[index]->SetCurrent(current);
|
||||
return;
|
||||
@@ -133,6 +139,8 @@ void cDisplayMenuListView::AddSetupMenuItem(int index, const char *itemText, boo
|
||||
|
||||
void cDisplayMenuListView::AddSchedulesMenuItem(int index, const cEvent *event, const cChannel *channel, eTimerMatch timerMatch,
|
||||
eMenuCategory cat, bool current, bool selectable) {
|
||||
if (index >= itemCount)
|
||||
return;
|
||||
if (menuItems[index]) {
|
||||
menuItems[index]->SetCurrent(current);
|
||||
return;
|
||||
@@ -142,6 +150,8 @@ void cDisplayMenuListView::AddSchedulesMenuItem(int index, const cEvent *event,
|
||||
}
|
||||
|
||||
void cDisplayMenuListView::AddChannelsMenuItem(int index, const cChannel *channel, bool withProvider, bool current, bool selectable) {
|
||||
if (index >= itemCount)
|
||||
return;
|
||||
if (menuItems[index]) {
|
||||
menuItems[index]->SetCurrent(current);
|
||||
return;
|
||||
@@ -151,6 +161,8 @@ void cDisplayMenuListView::AddChannelsMenuItem(int index, const cChannel *channe
|
||||
}
|
||||
|
||||
void cDisplayMenuListView::AddTimersMenuItem(int index, const cTimer *timer, bool current, bool selectable) {
|
||||
if (index >= itemCount)
|
||||
return;
|
||||
if (menuItems[index]) {
|
||||
menuItems[index]->SetCurrent(current);
|
||||
return;
|
||||
@@ -160,6 +172,8 @@ void cDisplayMenuListView::AddTimersMenuItem(int index, const cTimer *timer, boo
|
||||
}
|
||||
|
||||
void cDisplayMenuListView::AddRecordingMenuItem(int index, const cRecording *recording, int level, int total, int isNew, bool current, bool selectable) {
|
||||
if (index >= itemCount)
|
||||
return;
|
||||
if (menuItems[index]) {
|
||||
menuItems[index]->SetCurrent(current);
|
||||
return;
|
||||
@@ -169,6 +183,8 @@ void cDisplayMenuListView::AddRecordingMenuItem(int index, const cRecording *rec
|
||||
}
|
||||
|
||||
void cDisplayMenuListView::AddTracksMenuItem(int index, const char *title, bool current, bool selectable) {
|
||||
if (index >= itemCount)
|
||||
return;
|
||||
if (menuItems[index]) {
|
||||
menuItems[index]->SetCurrent(current);
|
||||
return;
|
||||
|
@@ -36,6 +36,7 @@ public:
|
||||
void SetMenu(eMenuCategory menuCat, bool menuInit);
|
||||
void SetTitle(const char *title);
|
||||
void SetChannel(const cChannel *channel) { view->SetChannel(channel); };
|
||||
const cChannel *GetChannel(void) { return view->GetChannel(); };
|
||||
void SetButtonTexts(const char *Red, const char *Green, const char *Yellow, const char *Blue);
|
||||
void SetTabs(int tab1, int tab2, int tab3, int tab4, int tab5);
|
||||
void SetMessage(eMessageType type, const char *text);
|
||||
|
@@ -432,8 +432,9 @@ bool cDisplayMenuSchedulesView::DrawHeader(void) {
|
||||
if (channel) {
|
||||
stringTokens.insert(pair<string,string>("channelnumber", *cString::sprintf("%d", channel->Number())));
|
||||
stringTokens.insert(pair<string,string>("channelname", channel->Name()));
|
||||
stringTokens.insert(pair<string,string>("channelid", *(channel->GetChannelID().ToString())));
|
||||
|
||||
string channelID = *(channel->GetChannelID().ToString());
|
||||
stringTokens.insert(pair<string,string>("channelid", channelID));
|
||||
intTokens.insert(pair<string, int>("channellogoexists", imgCache->LogoExists(channelID)));
|
||||
}
|
||||
bool hasIcon = false;
|
||||
string icon = imgCache->GetIconName(menuTitle, cat);
|
||||
|
@@ -17,6 +17,7 @@ public:
|
||||
void SetMenuCat(eMenuCategory newCat) { cat = newCat; };
|
||||
void SetTitle(const char *title) {menuTitle = title; };
|
||||
virtual void SetChannel(const cChannel *channel) {};
|
||||
virtual const cChannel *GetChannel(void) { return NULL; };
|
||||
void SetButtonTexts(string *buttonTexts) { this->buttonTexts = buttonTexts; };
|
||||
bool DrawBackground(void);
|
||||
virtual bool DrawHeader(void);
|
||||
@@ -51,6 +52,7 @@ public:
|
||||
cDisplayMenuSchedulesView(cTemplateView *tmplView, eMenuCategory menuCat, bool menuInit);
|
||||
virtual ~cDisplayMenuSchedulesView();
|
||||
void SetChannel(const cChannel *channel) { this->channel = channel; };
|
||||
const cChannel *GetChannel(void) { return channel; };
|
||||
bool DrawHeader(void);
|
||||
};
|
||||
|
||||
|
@@ -4,8 +4,6 @@
|
||||
|
||||
cViewHelpers::cViewHelpers(void) {
|
||||
devicesInit = false;
|
||||
femonReceiver = NULL;
|
||||
bitrateVideoLast = bitrateAudioLast = bitrateDolbyLast = 0.0;
|
||||
}
|
||||
|
||||
cViewHelpers::~cViewHelpers() {
|
||||
@@ -14,10 +12,6 @@ cViewHelpers::~cViewHelpers() {
|
||||
delete[] lastSignalQuality;
|
||||
delete[] recDevices;
|
||||
}
|
||||
if (femonReceiver) {
|
||||
femonReceiver->Deactivate();
|
||||
delete femonReceiver;
|
||||
}
|
||||
}
|
||||
|
||||
void cViewHelpers::InitDevices(void) {
|
||||
@@ -138,69 +132,3 @@ bool cViewHelpers::SetDevices(bool initial, map<string,int> *intTokens, vector<m
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void cViewHelpers::InitFemonReceiver(void) {
|
||||
const cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel());
|
||||
eTrackType track = cDevice::PrimaryDevice()->GetCurrentAudioTrack();
|
||||
if (channel) {
|
||||
femonReceiver = new cFemonReceiver(channel,
|
||||
IS_AUDIO_TRACK(track) ? int(track - ttAudioFirst) : 0,
|
||||
IS_DOLBY_TRACK(track) ? int(track - ttDolbyFirst) : 0);
|
||||
cDevice::ActualDevice()->AttachReceiver(femonReceiver);
|
||||
}
|
||||
}
|
||||
|
||||
void cViewHelpers::ChannelSwitch(const cDevice * device, int channelNumber, bool liveView) {
|
||||
if (!femonReceiver)
|
||||
return;
|
||||
bitrateVideoLast = bitrateAudioLast = bitrateDolbyLast = 0.0;
|
||||
eTrackType track = cDevice::PrimaryDevice()->GetCurrentAudioTrack();
|
||||
const cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel());
|
||||
|
||||
if (!liveView || !channelNumber || !channel || channel->Number() != channelNumber)
|
||||
return;
|
||||
|
||||
if (femonReceiver) {
|
||||
femonReceiver->Deactivate();
|
||||
delete femonReceiver;
|
||||
femonReceiver = NULL;
|
||||
}
|
||||
if (channel) {
|
||||
femonReceiver = new cFemonReceiver(channel,
|
||||
IS_AUDIO_TRACK(track) ? int(track - ttAudioFirst) : 0,
|
||||
IS_DOLBY_TRACK(track) ? int(track - ttDolbyFirst) : 0);
|
||||
cDevice::ActualDevice()->AttachReceiver(femonReceiver);
|
||||
}
|
||||
}
|
||||
|
||||
void cViewHelpers::SetAudioTrack(int Index, const char * const *Tracks) {
|
||||
if (!femonReceiver)
|
||||
return;
|
||||
bitrateVideoLast = bitrateAudioLast = bitrateDolbyLast = 0.0;
|
||||
eTrackType track = cDevice::PrimaryDevice()->GetCurrentAudioTrack();
|
||||
if (femonReceiver) {
|
||||
femonReceiver->Deactivate();
|
||||
delete femonReceiver;
|
||||
femonReceiver = NULL;
|
||||
}
|
||||
const cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel());
|
||||
if (channel) {
|
||||
femonReceiver = new cFemonReceiver(channel,
|
||||
IS_AUDIO_TRACK(track) ? int(track - ttAudioFirst) : 0,
|
||||
IS_DOLBY_TRACK(track) ? int(track - ttDolbyFirst) : 0);
|
||||
cDevice::ActualDevice()->AttachReceiver(femonReceiver);
|
||||
}
|
||||
}
|
||||
|
||||
bool cViewHelpers::GetBitrates(double &bitrateVideo, double &bitrateAudio, double &bitrateDolby) {
|
||||
bitrateVideo = (int)(femonReceiver->VideoBitrate() / 1024 / 1024 * 100 + 0.5) / 100.0;
|
||||
bitrateAudio = (int)(femonReceiver->AudioBitrate() / 1024 * 100 + 0.5) / 100.0;
|
||||
bitrateDolby = (int)(femonReceiver->AC3Bitrate() / 1024 * 100 + 0.5) / 100.0;
|
||||
if (bitrateVideo != bitrateVideoLast || bitrateAudio != bitrateAudioLast || bitrateDolby != bitrateDolbyLast) {
|
||||
bitrateVideoLast = bitrateVideo;
|
||||
bitrateAudioLast = bitrateAudio;
|
||||
bitrateDolbyLast = bitrateDolby;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@@ -1,26 +1,15 @@
|
||||
#ifndef __VIEWHELPERS_H
|
||||
#define __VIEWHELPERS_H
|
||||
|
||||
#include <vdr/status.h>
|
||||
#include "../libcore/femonreceiver.h"
|
||||
|
||||
class cViewHelpers : public cStatus {
|
||||
class cViewHelpers {
|
||||
private:
|
||||
bool devicesInit;
|
||||
int* lastSignalStrength;
|
||||
int* lastSignalQuality;
|
||||
bool* recDevices;
|
||||
cFemonReceiver *femonReceiver;
|
||||
double bitrateVideoLast;
|
||||
double bitrateAudioLast;
|
||||
double bitrateDolbyLast;
|
||||
protected:
|
||||
virtual void ChannelSwitch(const cDevice *device, int channelNumber, bool liveView);
|
||||
virtual void SetAudioTrack(int Index, const char * const *Tracks);
|
||||
void InitDevices(void);
|
||||
bool SetDevices(bool initial, map<string,int> *intTokens, vector<map<string,string> > *devices);
|
||||
void InitFemonReceiver(void);
|
||||
bool GetBitrates(double &bitrateVideo, double &bitrateAudio, double &bitrateDolby);
|
||||
public:
|
||||
cViewHelpers(void);
|
||||
virtual ~cViewHelpers(void);
|
||||
|
Reference in New Issue
Block a user