bool MythScreenType::keyPressEvent(QKeyEvent *event) { if (m_CurrentFocusWidget && m_CurrentFocusWidget->keyPressEvent(event)) return true; bool handled = false; QStringList actions; handled = GetMythMainWindow()->TranslateKeyPress("Global", event, actions); for (int i = 0; i < actions.size() && !handled; i++) { QString action = actions[i]; handled = true; if (action == "LEFT" || action == "UP" || action == "PREVIOUS") NextPrevWidgetFocus(false); else if (action == "RIGHT" || action == "DOWN" || action == "NEXT") NextPrevWidgetFocus(true); else if (action == "ESCAPE") Close(); else if (action == "MENU") ShowMenu(); else if (action.startsWith("SYSEVENT")) { MythEvent me(QString("GLOBAL_SYSTEM_EVENT KEY_%1") .arg(action.mid(8))); QCoreApplication::postEvent( GetMythMainWindow()->GetSystemEventHandler(), me.clone()); } else handled = false; } return handled; }
bool MythScreenType::keyPressEvent(QKeyEvent *event) { if (!GetMythMainWindow()->IsExitingToMain() && m_CurrentFocusWidget && m_CurrentFocusWidget->keyPressEvent(event)) return true; bool handled = false; QStringList actions; handled = GetMythMainWindow()->TranslateKeyPress("Global", event, actions); for (int i = 0; i < actions.size() && !handled; i++) { QString action = actions[i]; handled = true; if (action == "LEFT" || action == "UP" || action == "PREVIOUS") { if (!NextPrevWidgetFocus(false)) handled = false; } else if (action == "RIGHT" || action == "DOWN" || action == "NEXT") { if (!NextPrevWidgetFocus(true)) handled = false; } else if (action == "ESCAPE") Close(); else if (action == "MENU") ShowMenu(); else if (action.startsWith("SYSEVENT")) gCoreContext->SendSystemEvent(QString("KEY_%1").arg(action.mid(8))); else if (action == ACTION_SCREENSHOT) GetMythMainWindow()->ScreenShot(); else if (action == ACTION_TVPOWERON) GetMythMainWindow()->HandleTVPower(true); else if (action == ACTION_TVPOWEROFF) GetMythMainWindow()->HandleTVPower(false); else handled = false; } return handled; }
void ScreenSetup::deleteScreen() { MythUIButtonListItem *item = m_activeList->GetItemCurrent(); if (item) { if (item->GetData().isValid()) delete item->GetData().value<ScreenListInfo *>(); delete item; } if (!m_activeList->GetCount()) { NextPrevWidgetFocus(false); m_activeList->SetEnabled(false); } }
bool ThumbFinder::keyPressEvent(QKeyEvent *event) { if (GetFocusWidget()->keyPressEvent(event)) return true; QStringList actions; bool handled = GetMythMainWindow()->TranslateKeyPress("Archive", event, actions); for (int i = 0; i < actions.size() && !handled; i++) { QString action = actions[i]; handled = true; if (action == "MENU") { NextPrevWidgetFocus(true); return true; } if (action == "ESCAPE") { ShowMenu(); return true; } if (action == "0" || action == "1" || action == "2" || action == "3" || action == "4" || action == "5" || action == "6" || action == "7" || action == "8" || action == "9") { m_imageGrid->SetItemCurrent(action.toInt()); int itemNo = m_imageGrid->GetCurrentPos(); ThumbImage *thumb = m_thumbList.at(itemNo); if (thumb) seekToFrame(thumb->frame); return true; } if (GetFocusWidget() == m_frameButton) { if (action == "UP") { changeSeekAmount(true); } else if (action == "DOWN") { changeSeekAmount(false); } else if (action == "LEFT") { seekBackward(); } else if (action == "RIGHT") { seekForward(); } else if (action == "SELECT") { updateThumb(); } else handled = false; } else handled = false; } if (!handled && MythScreenType::keyPressEvent(event)) handled = true; return handled; }
/** * \brief Slot handling a button being pressed in the left list */ void MythControls::LeftPressed(MythUIButtonListItem *item) { (void) item; NextPrevWidgetFocus(true); }
void ScreenSetup::doListSelect(MythUIButtonListItem *selected) { if (!selected) return; QString txt = selected->GetText(); if (GetFocusWidget() == m_activeList) { ScreenListInfo *si = selected->GetData().value<ScreenListInfo *>(); QString label = tr("Manipulate Screen"); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); MythDialogBox *menuPopup = new MythDialogBox(label, popupStack, "screensetupmenupopup"); if (menuPopup->Create()) { popupStack->AddScreen(menuPopup); menuPopup->SetReturnEvent(this, "options"); menuPopup->AddButton(tr("Move Up"), qVariantFromValue(selected)); menuPopup->AddButton(tr("Move Down"), qVariantFromValue(selected)); menuPopup->AddButton(tr("Remove"), qVariantFromValue(selected)); menuPopup->AddButton(tr("Change Location"), qVariantFromValue(selected)); if (si->hasUnits) menuPopup->AddButton(tr("Change Units"), qVariantFromValue(selected)); menuPopup->AddButton(tr("Cancel"), qVariantFromValue(selected)); } else { delete menuPopup; } } else if (GetFocusWidget() == m_inactiveList) { ScreenListInfo *si = selected->GetData().value<ScreenListInfo *>(); QStringList type_strs; TypeListMap::iterator it = si->types.begin(); TypeListMap types; for (; it != si->types.end(); ++it) { types.insert(it.key(), TypeListInfo(*it)); type_strs << it.key(); } bool hasUnits = si->hasUnits; QList<ScriptInfo *> tmp; if (m_sourceManager->findPossibleSources(type_strs, tmp)) { if (!m_inactiveList->GetCount()) { //m_inactiveList->SetActive(false); NextPrevWidgetFocus(true); } if (hasUnits) showUnitsPopup(selected->GetText(), si); else doLocationDialog(si); } else LOG(VB_GENERAL, LOG_ERR, "Screen cannot be used, not all required " "data is supplied by existing sources"); } }