diff options
author | Dieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de> | 2008-02-22 00:36:05 +0100 |
---|---|---|
committer | Dieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de> | 2008-02-22 00:36:05 +0100 |
commit | 47365a8e84d30c44e12b5e5f6220c691a0bf074d (patch) | |
tree | 9108ccf4a6910dead6f8cdc43ba56c3c1bc3090e /timerconflict.cpp | |
parent | 7ce0e43c812f4a25048e47d135cec14307480fef (diff) | |
download | vdr-plugin-live-47365a8e84d30c44e12b5e5f6220c691a0bf074d.tar.gz vdr-plugin-live-47365a8e84d30c44e12b5e5f6220c691a0bf074d.tar.bz2 |
First implementation of a notification about timer conflicts in LIVE.
Based on the work of winni in epgsearch and its service interface.
Diffstat (limited to 'timerconflict.cpp')
-rw-r--r-- | timerconflict.cpp | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/timerconflict.cpp b/timerconflict.cpp index a08a836..6f2c95c 100644 --- a/timerconflict.cpp +++ b/timerconflict.cpp @@ -1,10 +1,15 @@ +#include <time.h> + #include <vector> -#include "timerconflict.h" + +#include <vdr/plugin.h> + #include "tools.h" -#include "epgsearch/services.h" #include "exception.h" #include "epgsearch.h" -#include <vdr/plugin.h> +#include "epgsearch/services.h" + +#include "timerconflict.h" namespace vdrlive { @@ -80,4 +85,33 @@ namespace vdrlive { return service.handler->IsConflictCheckAdvised(); } + TimerConflictNotifier::TimerConflictNotifier() + : lastCheck(0) + , conflicts() + { + } + + TimerConflictNotifier::~TimerConflictNotifier() + { + } + + bool TimerConflictNotifier::ShouldNotify() + { + time_t now = time(0); + bool reCheckAdvised((now - lastCheck) > CHECKINTERVAL); + + if (reCheckAdvised && TimerConflicts::CheckAdvised()) { + lastCheck = now; + conflicts.reset(new TimerConflicts()); + return conflicts->size() > 0; + } + return false; + } + + std::string TimerConflictNotifier::Message() const + { + int count = conflicts ? conflicts->size() : 0; + return count > 0 ? tr("Timer conflicts detected! You should check the conflicting timers.") : ""; + } + } // namespace vdrlive |