bool ViewScheduled::keyPressEvent(QKeyEvent *event) { // FIXME: Blackholes keypresses, not good if (m_inEvent) return true; m_inEvent = true; if (GetFocusWidget()->keyPressEvent(event)) { m_inEvent = false; return true; } bool handled = false; QStringList actions; handled = GetMythMainWindow()->TranslateKeyPress("TV Frontend", event, actions); for (int i = 0; i < actions.size() && !handled; i++) { QString action = actions[i]; handled = true; if (action == "EDIT") edit(); else if (action == "CUSTOMEDIT") customEdit(); else if (action == "DELETE") deleteRule(); else if (action == "UPCOMING") upcoming(); else if (action == "VIEWSCHEDULED") upcomingScheduled(); else if (action == "DETAILS" || action == "INFO") details(); else if (action == "1") setShowAll(true); else if (action == "2") setShowAll(false); else if (action == "PREVVIEW" || action == "NEXTVIEW") setShowAll(!m_showAll); else if (action == "VIEWCARD") viewCards(); else if (action == "VIEWINPUT") viewInputs(); else handled = false; } if (m_needFill) LoadList(); if (!handled && MythScreenType::keyPressEvent(event)) handled = true; m_inEvent = false; return handled; }
void ViewScheduled::customEvent(QEvent *event) { if ((MythEvent::Type)(event->type()) == MythEvent::MythEventMessage) { MythEvent *me = (MythEvent *)event; QString message = me->Message(); if (message != "SCHEDULE_CHANGE") return; m_needFill = true; if (m_inEvent) return; m_inEvent = true; LoadList(); m_inEvent = false; } else if (event->type() == DialogCompletionEvent::kEventType) { DialogCompletionEvent *dce = (DialogCompletionEvent*)(event); QString resultid = dce->GetId(); QString resulttext = dce->GetResultText(); int buttonnum = dce->GetResult(); if (resultid == "deleterule") { RecordingRule *record = qVariantValue<RecordingRule *>(dce->GetData()); if (record) { if (buttonnum > 0) { if (!record->Delete()) VERBOSE(VB_IMPORTANT, "Failed to delete recording rule"); } delete record; } EmbedTVWindow(); } else if (resultid == "menu") { if (resulttext == tr("Show Important")) { setShowAll(false); } else if (resulttext == tr("Show All")) { setShowAll(true); } else if (resulttext == tr("Program Details")) { details(); } else if (resulttext == tr("Upcoming by title")) { upcoming(); } else if (resulttext == tr("Upcoming scheduled")) { upcomingScheduled(); } else if (resulttext == tr("Custom Edit")) { customEdit(); } else if (resulttext == tr("Delete Rule")) { deleteRule(); } else if (resulttext == tr("Show Cards")) { viewCards(); } else if (resulttext == tr("Show Inputs")) { viewInputs(); } if (m_needFill) LoadList(); } else ScheduleCommon::customEvent(event); } }
void ViewScheduled::customEvent(QEvent *event) { if (event->type() == MythEvent::MythEventMessage) { MythEvent *me = static_cast<MythEvent *>(event); QString message = me->Message(); if (message != "SCHEDULE_CHANGE") return; m_needFill = true; if (m_inEvent) return; m_inEvent = true; LoadList(); m_inEvent = false; } else if (event->type() == DialogCompletionEvent::kEventType) { DialogCompletionEvent *dce = (DialogCompletionEvent*)(event); QString resultid = dce->GetId(); QString resulttext = dce->GetResultText(); int buttonnum = dce->GetResult(); if (resultid == "deleterule") { RecordingRule *record = dce->GetData().value<RecordingRule *>(); if (record) { if (buttonnum > 0) { if (!record->Delete()) LOG(VB_GENERAL, LOG_ERR, "Failed to delete recording rule"); } delete record; } EmbedTVWindow(); } else if (resultid == "menu") { if (resulttext == tr("Show Important")) { setShowAll(false); } else if (resulttext == tr("Show All")) { setShowAll(true); } else if (resulttext == tr("Program Details")) { ShowDetails(); } else if (resulttext == tr("Program Guide")) { ShowGuide(); } else if (resulttext == tr("Channel Search")) { ShowChannelSearch(); } else if (resulttext == tr("Upcoming by title")) { ShowUpcoming(); } else if (resulttext == tr("Upcoming scheduled")) { ShowUpcomingScheduled(); } else if (resulttext == tr("Previously Recorded")) { ShowPrevious(); } else if (resulttext == tr("Custom Edit")) { EditCustom(); } else if (resulttext == tr("Delete Rule")) { deleteRule(); } else if (resulttext == tr("Show Inputs")) { viewInputs(); } if (m_needFill) LoadList(); } else ScheduleCommon::customEvent(event); } }