bool ZMEvents::keyPressEvent(QKeyEvent *event) { if (GetFocusWidget()->keyPressEvent(event)) return true; bool handled = false; QStringList actions; handled = GetMythMainWindow()->TranslateKeyPress("TV Playback", event, actions); for (int i = 0; i < actions.size() && !handled; i++) { QString action = actions[i]; handled = true; if (action == "MENU") { showMenu(); } else if (action == "ESCAPE") { if (GetFocusWidget() == m_eventGrid) SetFocusWidget(m_cameraSelector); else handled = false; } else if (action == "DELETE") { if (m_deleteButton) m_deleteButton->Push(); } else if (action == "PAUSE") { if (m_playButton) m_playButton->Push(); } else if (action == "INFO") { m_oldestFirst = !m_oldestFirst; getEventList(); } else if (action == "1") setGridLayout(1); else if (action == "2") setGridLayout(2); else if (action == "3") setGridLayout(3); else handled = false; } if (!handled && MythScreenType::keyPressEvent(event)) handled = true; return handled; }
bool ZMEvents::Create(void) { bool foundtheme = false; // Load the theme for this screen foundtheme = LoadWindowFromXML("zoneminder-ui.xml", "zmevents", this); if (!foundtheme) return false; bool err = false; UIUtilE::Assign(this, m_eventNoText, "eventno_text", &err); UIUtilE::Assign(this, m_playButton, "play_button", &err); UIUtilE::Assign(this, m_deleteButton, "delete_button", &err); UIUtilE::Assign(this, m_cameraSelector, "camera_selector", &err); UIUtilE::Assign(this, m_dateSelector, "date_selector", &err); if (err) { LOG(VB_GENERAL, LOG_ERR, "Cannot load screen 'zmevents'"); return false; } BuildFocusList(); getCameraList(); getDateList(); connect(m_cameraSelector, SIGNAL(itemSelected(MythUIButtonListItem*)), this, SLOT(cameraChanged())); connect(m_dateSelector, SIGNAL(itemSelected(MythUIButtonListItem*)), this, SLOT(dateChanged())); // play button if (m_playButton) { m_playButton->SetText(tr("Play")); connect(m_playButton, SIGNAL(Clicked()), this, SLOT(playPressed())); } // delete button if (m_deleteButton) { m_deleteButton->SetText(tr("Delete")); connect(m_deleteButton, SIGNAL(Clicked()), this, SLOT(deletePressed())); } m_oldestFirst = (gCoreContext->GetNumSetting("ZoneMinderOldestFirst", 1) == 1); m_showContinuous = (gCoreContext->GetNumSetting("ZoneMinderShowContinuous", 0) == 1); getEventList(); setGridLayout(gCoreContext->GetNumSetting("ZoneMinderGridLayout", 1)); return true; }