From e35905da3b8f38ef246df5316f56ae623fd3f1db Mon Sep 17 00:00:00 2001 From: anbr Date: Sat, 30 May 2009 15:20:13 +0200 Subject: Show next timer on exit (Feature #124) --- watch.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'watch.c') diff --git a/watch.c b/watch.c index 5d8a888..7441312 100644 --- a/watch.c +++ b/watch.c @@ -113,6 +113,46 @@ void ciMonWatch::close() { usleep(500000); Cancel(); } + + switch(theSetup.m_nOnExit) { + case eOnExitMode_NEXTTIMER: { + isyslog("iMonLCD: closing, show next timer."); + cTimer* t = Timers.GetNextActiveTimer(); + this->setLineLength(0,0,0,0); + + this->clear(); + if(t) { + struct tm l; + time_t tt = t->StartTime(); + localtime_r(&tt, &l); + cString topic = cString::sprintf("%d. %02d:%02d %s", l.tm_mday, l.tm_hour, l.tm_min, t->File()); + this->DrawText(0,0,topic); + this->icons(eIconALARM); + } else { + this->DrawText(0,0,tr("None active timer")); + this->icons(0); + } + this->flush(); + break; + } + case eOnExitMode_SHOWMSG: { + isyslog("iMonLCD: closing, leaving \"last\" message."); + break; + } + case eOnExitMode_BLANKSCREEN: { + isyslog("iMonLCD: closing, turning backlight off."); + SendCmdShutdown(); + break; + } + default: + case eOnExitMode_SHOWCLOCK: { + isyslog("iMonLCD: closing, showing clock."); + SendCmdClock(); + break; + } + } + + ciMonLCD::close(); } -- cgit v1.2.3