1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
|
#include "config.h"
#include "nopacity.h"
#include "displaychannel.h"
#include "imageloader.h"
#include "helpers.h"
#include <vdr/osd.h>
#include <vdr/menu.h>
cNopacityDisplayChannel::cNopacityDisplayChannel(bool WithInfo) {
groupSep = false;
present = NULL;
following = NULL;
currentLast = 0;
channelChange = false;
initial = true;
FadeTime = config.GetValue("channelFadeTime");
FrameTime = FadeTime / 10;
channelView = new cNopacityDisplayChannelView();
channelView->createOsd();
channelView->CreatePixmaps();
channelView->DrawBackground();
if (config.GetValue("displaySignalStrength")) {
channelView->DrawSignalMeter();
}
}
cNopacityDisplayChannel::~cNopacityDisplayChannel() {
Cancel(-1);
while (Active())
cCondWait::SleepMs(10);
delete channelView;
}
void cNopacityDisplayChannel::SetChannel(const cChannel *Channel, int Number) {
channelChange = true;
groupSep = false;
cString ChannelNumber("");
cString ChannelName("");
if (Channel) {
ChannelName = Channel->Name();
if (!Channel->GroupSep()) {
ChannelNumber = cString::sprintf("%d%s", Channel->Number(), Number ? "-" : "");
} else {
groupSep = true;
}
} else if (Number) {
ChannelNumber = cString::sprintf("%d-", Number);
} else {
ChannelName = ChannelString(NULL, 0);
}
channelView->ClearChannelLogo();
channelView->ClearChannelName();
channelView->ClearEPGInfo();
channelView->ClearStatusIcons();
channelView->ClearSourceInfo();
if (!groupSep) {
channelView->DrawChannelName(ChannelNumber, ChannelName);
if (Channel && config.GetValue("logoPosition") != lpNone)
channelView->DrawChannelLogo(Channel);
if (Channel)
channelView->DrawStatusIcons(Channel);
} else {
channelView->HideSignalMeter();
channelView->ClearProgressBar();
if (Channel)
channelView->DrawChannelGroups(Channel, ChannelName);
}
}
void cNopacityDisplayChannel::SetEvents(const cEvent *Present, const cEvent *Following) {
present = Present;
following = Following;
channelView->ClearProgressBar();
if (!groupSep) {
channelView->DrawProgressbarBackground();
channelView->ClearEPGInfo();
}
}
void cNopacityDisplayChannel::SetProgressBar(const cEvent *present) {
int Current = 0;
int Total = 0;
time_t t = time(NULL);
if (t > present->StartTime())
Current = t - present->StartTime();
Total = present->Duration();
if ((Current > currentLast + 3) || initial || channelChange){
currentLast = Current;
channelView->DrawProgressBar(Current, Total);
}
}
void cNopacityDisplayChannel::SetMessage(eMessageType Type, const char *Text) {
channelView->DisplayMessage(Type, Text);
}
void cNopacityDisplayChannel::Flush(void) {
if (initial || channelChange)
channelView->DrawDate();
if (present && !groupSep) {
SetProgressBar(present);
} else
channelView->ClearProgressBar();
if (!groupSep) {
channelView->ClearEPGInfo();
channelView->DrawEvents(present, following);
}
if (config.GetValue("displayPoster"))
channelView->DrawPoster(present, initial, channelChange);
if (!groupSep)
channelView->DrawScreenResolution();
else
channelView->ClearStatusIcons();
if (config.GetValue("displaySignalStrength") && !groupSep) {
channelView->ShowSignalMeter();
channelView->DrawSignal();
} else
channelView->HideSignalMeter();
if (config.GetValue("displaySourceInfo") && !groupSep) {
channelView->ClearSourceInfo();
channelView->DrawSourceInfo();
} else
channelView->ClearSourceInfo();
if (initial) {
if (config.GetValue("channelFadeTime"))
Start();
}
initial = false;
channelChange = false;
channelView->Flush();
}
void cNopacityDisplayChannel::Action(void) {
uint64_t Start = cTimeMs::Now();
while (Running()) {
uint64_t Now = cTimeMs::Now();
cPixmap::Lock();
double t = std::min(double(Now - Start) / FadeTime, 1.0);
int Alpha = t * ALPHA_OPAQUE;
channelView->SetAlpha(Alpha);
cPixmap::Unlock();
if (Running())
channelView->Flush();
int Delta = cTimeMs::Now() - Now;
if (Running() && (Delta < FrameTime))
cCondWait::SleepMs(FrameTime - Delta);
if ((int)(Now - Start) > FadeTime) {
break;
}
}
}
|