void cMenuSwitchTimerItem::Set(void) { if (!SwitchTimers.Exists(switchTimer) || !switchTimer || !switchTimer->event) return; const cEvent* event = switchTimer->event; time_t startTime = event->StartTime(); char *buffer = NULL; char datebuf[32]; struct tm tm_r; tm *tm = localtime_r(&startTime, &tm_r); strftime(datebuf, sizeof(datebuf), "%a %d", tm); cChannel* channel = Channels.GetByChannelID(event->ChannelID(),true,true); msprintf(&buffer, "%s\t%d\t%s\t%s\t%d\'\t%s~%s", switchTimer->announceOnly?"":">", channel?channel->Number():-1, datebuf, TIMESTRING(startTime), switchTimer->switchMinsBefore, event->Title()?event->Title():"", event->ShortText()?event->ShortText():""); SetText(buffer, false); // icon / channel name / date / time / event info cString buf = cString::sprintf("%s\t%s\t%s\t%s\t%s","S ", /* must be 3 chars long */ channel?channel->Name():tr("Unknown channel"), datebuf, TIMESTRING(startTime), event->Title()?event->Title():""); SetText(buf); }
void cMenuEditSwitchTimer::Set() { int current = Current(); Clear(); Add(new cMenuEditIntItem(tr("Switch ... minutes before start"), &data.switchMinsBefore, 0, 99)); cString info = cString::sprintf("%s:\t%s", tr("action at"), TIMESTRING(data.event->StartTime() - 60 * data.switchMinsBefore)); cOsdItem* pInfoItem = new cOsdItem(info); pInfoItem->SetSelectable(false); Add(pInfoItem); Add(new cMenuEditBoolItem(tr("Announce only"), &data.announceOnly, trVDR("no"), trVDR("yes"))); Add(new cMenuEditBoolItem(tr("Unmute sound"), &data.unmute, trVDR("no"), trVDR("yes"))); SetCurrent(Get(current)); }
void cMenuEditSwitchTimer::Set() { int current = Current(); Clear(); Add(new cMenuEditStraItem(tr("Action"), &data.mode, 3, SwitchModes)); if (data.mode == 0) // always switch Add(new cMenuEditIntItem(tr("Switch ... minutes before start"), &data.switchMinsBefore, 0, 99)); if (data.mode == 1) // only announce Add(new cMenuEditIntItem(tr("Announce ... minutes before start"), &data.switchMinsBefore, 0, 99)); if (data.mode == 2) // ask for switching Add(new cMenuEditIntItem(tr("Ask ... minutes before start"), &data.switchMinsBefore, 0, 99)); cString info = cString::sprintf("%s:\t%s", tr("action at"), TIMESTRING(data.startTime - 60 * data.switchMinsBefore)); cOsdItem* pInfoItem = new cOsdItem(info); pInfoItem->SetSelectable(false); Add(pInfoItem); Add(new cMenuEditBoolItem(tr("Unmute sound"), &data.unmute, trVDR("no"), trVDR("yes"))); SetCurrent(Get(current)); }
void cMenuSwitchTimerItem::Set() { if (!SwitchTimers.Exists(switchTimer) || !switchTimer || !event) return; time_t startTime = switchTimer->startTime; char *buffer = NULL; char datebuf[32]; struct tm tm_r; tm *tm = localtime_r(&startTime, &tm_r); strftime(datebuf, sizeof(datebuf), "%d.%m", tm); cChannel* channel = Channels.GetByChannelID(switchTimer->channelID,true,true); msprintf(&buffer, "%s\t%d\t%s\t%s\t%d\'\t%s~%s", switchTimer->mode==1?"":">", channel?channel->Number():-1, datebuf, TIMESTRING(startTime), switchTimer->switchMinsBefore, event->Title()?event->Title():"", event->ShortText()?event->ShortText():""); SetText(buffer, false); }