From 7d2a5fec1e0f7f2ec079a4b8477a26ded11a53fc Mon Sep 17 00:00:00 2001 From: Jasmin Jessich Date: Sun, 14 May 2017 00:50:30 +0200 Subject: Added SortedTimers::Modified --- timers.cpp | 34 ++++++++++++++++++++++++++++++++++ timers.h | 2 +- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/timers.cpp b/timers.cpp index 327d239..6991e91 100644 --- a/timers.cpp +++ b/timers.cpp @@ -135,6 +135,40 @@ namespace vdrlive { return info.str(); } + bool SortedTimers::Modified() + { + // the global(!) list of known timers + static vector knownTimers; + + bool modified = false; + + LOCK_TIMERS_READ; + for ( const cTimer* timer = Timers->First(); timer; timer = Timers->Next( timer ) ) { + bool known_id = false; + for (vector::iterator it = knownTimers.begin(); it != knownTimers.end(); ++it) { + if (timer->Id() == it->Id()) { + known_id = true; + string timer_txt = *timer->ToText (true); + string known_txt = *it->ToText (true); + modified = timer_txt != known_txt; + break; + } + } + if (!known_id) { + modified = true; + break; + } + } + if (modified) { + knownTimers.clear(); + for (const cTimer* Timer = Timers->First(); Timer; Timer = Timers->Next (Timer)) { + knownTimers.push_back (*Timer); + } + } + + return modified; + } + TimerManager::TimerManager() { } diff --git a/timers.h b/timers.h index 10395ef..44dec10 100644 --- a/timers.h +++ b/timers.h @@ -24,7 +24,7 @@ namespace vdrlive { static std::string DecodeDomId(std::string const &timerDomId); #if VDRVERSNUM >= 20301 - bool Modified() { return true; } + bool Modified(); #else bool Modified() { return Timers.Modified(m_state); } #endif -- cgit v1.2.3