summaryrefslogtreecommitdiff
path: root/skinlcars.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2015-09-01 11:14:27 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2015-09-01 11:14:27 +0200
commit3cd5294d8a337ee5cd2ec894c9fbe04ad3a7690d (patch)
treeda57ce74189de9bfb27e1a747063c37cd62de501 /skinlcars.c
parent8a7bc6a0bbf60cae8b6391a630880aad5cba3363 (diff)
downloadvdr-3cd5294d8a337ee5cd2ec894c9fbe04ad3a7690d.tar.gz
vdr-3cd5294d8a337ee5cd2ec894c9fbe04ad3a7690d.tar.bz2
Implemented strict locking of global lists
Diffstat (limited to 'skinlcars.c')
-rw-r--r--skinlcars.c67
1 files changed, 38 insertions, 29 deletions
diff --git a/skinlcars.c b/skinlcars.c
index a722b521..d84a753f 100644
--- a/skinlcars.c
+++ b/skinlcars.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: skinlcars.c 3.8 2014/06/12 08:48:15 kls Exp $
+ * $Id: skinlcars.c 4.1 2015/09/01 10:07:07 kls Exp $
*/
// "Star Trek: The Next Generation"(R) is a registered trademark of Paramount Pictures,
@@ -710,7 +710,7 @@ private:
int lastDiskUsageState;
bool lastDiskAlert;
double lastSystemLoad;
- int lastTimersState;
+ cStateKey timersStateKey;
time_t lastSignalDisplay;
int lastLiveIndicatorY;
bool lastLiveIndicatorTransferring;
@@ -775,7 +775,6 @@ cSkinLCARSDisplayMenu::cSkinLCARSDisplayMenu(void)
lastEvent = NULL;
lastRecording = NULL;
lastSeen = -1;
- lastTimersState = -1;
lastSignalDisplay = 0;
lastLiveIndicatorY = -1;
lastLiveIndicatorTransferring = false;
@@ -970,7 +969,7 @@ void cSkinLCARSDisplayMenu::SetMenuCategory(eMenuCategory MenuCategory)
xi01 = xm03;
xi02 = xm04;
xi03 = xm05;
- lastTimersState = -1;
+ timersStateKey.Reset();
DrawMainFrameLower();
DrawMainBracket();
DrawStatusElbows();
@@ -1237,19 +1236,22 @@ void cSkinLCARSDisplayMenu::DrawTimer(const cTimer *Timer, int y, bool MultiRec)
}
if (Event)
osd->DrawText(xs00 + d, y + lineHeight - tinyFont->Height(), Event->Title(), ColorFg, ColorBg, tinyFont, xs03 - xs00 - 2 * d);
+ // The remote timer indicator:
+ if (Timer->Remote())
+ osd->DrawRectangle(xs00 - (lineHeight - Gap) / 2, y, xs00 - Gap - 1, y + lineHeight - 1, Timer->Recording() ? Theme.Color(clrMenuTimerRecording) : ColorBg);
// The timer recording indicator:
- if (Timer->Recording())
+ else if (Timer->Recording())
osd->DrawRectangle(xs03 + Gap, y - (MultiRec ? Gap : 0), xs04 - Gap / 2 - 1, y + lineHeight - 1, Theme.Color(clrMenuTimerRecording));
}
void cSkinLCARSDisplayMenu::DrawTimers(void)
{
- if (Timers.Modified(lastTimersState)) {
+ if (const cTimers *Timers = cTimers::GetTimersRead(timersStateKey)) {
deviceRecording.Clear();
const cFont *font = cFont::GetFont(fontOsd);
- osd->DrawRectangle(xs00, ys04, xs04 - 1, ys05 - 1, Theme.Color(clrBackground));
+ osd->DrawRectangle(xs00 - (lineHeight - Gap) / 2, ys04, xs04 - 1, ys05 - 1, Theme.Color(clrBackground));
osd->DrawRectangle(xs07, ys04, xs13 - 1, ys05 - 1, Theme.Color(clrBackground));
- cSortedTimers SortedTimers;
+ cSortedTimers SortedTimers(Timers);
cVector<int> FreeDeviceSlots;
int NumDevices = 0;
int y = ys04;
@@ -1262,7 +1264,14 @@ void cSkinLCARSDisplayMenu::DrawTimers(void)
break;
if (const cTimer *Timer = SortedTimers[i]) {
if (Timer->Recording()) {
- if (cRecordControl *RecordControl = cRecordControls::GetRecordControl(Timer)) {
+ if (Timer->Remote()) {
+ if (!Device && Timer->HasFlags(tfActive)) {
+ DrawTimer(Timer, y, false);
+ FreeDeviceSlots.Append(y);
+ y += lineHeight + Gap;
+ }
+ }
+ else if (cRecordControl *RecordControl = cRecordControls::GetRecordControl(Timer)) {
if (!Device || Device == RecordControl->Device()) {
DrawTimer(Timer, y, NumTimers > 0);
NumTimers++;
@@ -1313,7 +1322,7 @@ void cSkinLCARSDisplayMenu::DrawTimers(void)
}
// Total number of active timers:
int NumTimers = 0;
- for (cTimer *Timer = Timers.First(); Timer; Timer = Timers.Next(Timer)) {
+ for (const cTimer *Timer = Timers->First(); Timer; Timer = Timers->Next(Timer)) {
if (Timer->HasFlags(tfActive))
NumTimers++;
}
@@ -1321,6 +1330,7 @@ void cSkinLCARSDisplayMenu::DrawTimers(void)
osd->DrawText(xs08, ys00, itoa(NumDevices), Theme.Color(clrMenuFrameFg), frameColor, font, xs09 - xs08, ys01 - ys00, taBottom | taRight | taBorder);
lastSignalDisplay = 0;
initial = true; // forces redrawing of devices
+ timersStateKey.Remove();
}
}
@@ -1423,25 +1433,23 @@ void cSkinLCARSDisplayMenu::DrawLive(const cChannel *Channel)
DrawSeen(0, 0);
}
// The current programme:
- cSchedulesLock SchedulesLock;
- if (const cSchedules *Schedules = cSchedules::Schedules(SchedulesLock)) {
- if (const cSchedule *Schedule = Schedules->GetSchedule(Channel)) {
- const cEvent *Event = Schedule->GetPresentEvent();
- if (initial || Event != lastEvent) {
- DrawInfo(Event, true);
- lastEvent = Event;
- lastSeen = -1;
- }
- int Current = 0;
- int Total = 0;
- if (Event) {
- time_t t = time(NULL);
- if (t > Event->StartTime())
- Current = t - Event->StartTime();
- Total = Event->Duration();
- }
- DrawSeen(Current, Total);
+ LOCK_SCHEDULES_READ;
+ if (const cSchedule *Schedule = Schedules->GetSchedule(Channel)) {
+ const cEvent *Event = Schedule->GetPresentEvent();
+ if (initial || Event != lastEvent) {
+ DrawInfo(Event, true);
+ lastEvent = Event;
+ lastSeen = -1;
+ }
+ int Current = 0;
+ int Total = 0;
+ if (Event) {
+ time_t t = time(NULL);
+ if (t > Event->StartTime())
+ Current = t - Event->StartTime();
+ Total = Event->Duration();
}
+ DrawSeen(Current, Total);
}
}
@@ -1731,7 +1739,8 @@ void cSkinLCARSDisplayMenu::Flush(void)
if (MenuCategory() == mcMain) {
cDevice *Device = cDevice::PrimaryDevice();
if (!Device->Replaying() || Device->Transferring()) {
- const cChannel *Channel = Channels.GetByNumber(cDevice::PrimaryDevice()->CurrentChannel());
+ LOCK_CHANNELS_READ;
+ const cChannel *Channel = Channels->GetByNumber(cDevice::PrimaryDevice()->CurrentChannel());
DrawLive(Channel);
}
else if (cControl *Control = cControl::Control(true))