/** * \brief Handle keypresses * \param event The pressed key * \return True if key was used, otherwise false */ bool GallerySlideView::keyPressEvent(QKeyEvent *event) { if (GetFocusWidget()->keyPressEvent(event)) return true; QStringList actions; bool handled = GetMythMainWindow()->TranslateKeyPress("Images", event, actions); for (int i = 0; i < actions.size() && !handled; i++) { QString action = actions[i]; handled = true; if (action == "LEFT") ShowPrevSlide(); else if (action == "RIGHT") ShowNextSlide(); else if (action == "INFO") ShowInfo(); else if (action == "MENU") MenuMain(); else if (action == "PLAY") { if (m_playing) Stop(); else Play(); } else if (action == "SELECT") PlayVideo(); else if (action == "STOP") Stop(); else if (action == "ROTRIGHT") Transform(kRotateCW); else if (action == "ROTLEFT") Transform(kRotateCCW); else if (action == "FLIPHORIZONTAL") Transform(kFlipHorizontal); else if (action == "FLIPVERTICAL") Transform(kFlipVertical); else if (action == "ZOOMIN") Zoom(10); else if (action == "ZOOMOUT") Zoom(-10); else if (action == "FULLSIZE") Zoom(); else if (action == "SCROLLUP") Pan(QPoint(0, 100)); else if (action == "SCROLLDOWN") Pan(QPoint(0, -100)); else if (action == "SCROLLLEFT") Pan(QPoint(-120, 0)); else if (action == "SCROLLRIGHT") Pan(QPoint(120, 0)); else if (action == "RECENTER") Pan(); else if (action == "ESCAPE" && !GetMythMainWindow()->IsExitingToMain()) // Exit info details, if shown handled = m_infoList.Hide(); else handled = false; } if (!handled) handled = MythScreenType::keyPressEvent(event); return handled; }
/**************************************************************************** * MainMenu ***************************************************************************/ void MainMenu(int menu) { int currentMenu = menu; // position der letzten app for(int i = 0; i < (signed)vechomebrew_list_category[Settings.current_category].size(); i++) { string name = vechomebrew_list_category[Settings.current_category][i].foldername; if((signed)name.rfind("/") != -1) name.erase(name.rfind("/")); name.erase(0, name.rfind("/") +1); if(name == Settings.startingAppName) { Settings.last_app_pos = i; break; } } bgImg = new GuiImage(new GuiImageData(Theme.background)); mainWindow->Append(bgImg); while(currentMenu != MENU_EXIT) { switch (currentMenu) { case MENU_MAIN: currentMenu = MenuMain(); break; case MENU_SETTINGS: currentMenu = MenuSettings(); break; case MENU_SETTINGS_FILE: currentMenu = MenuSettingsFile(); break; case MENU_SETTINGS_THEME: currentMenu = MenuSettingsTheme(); break; case MENU_SETTINGS_LANGUAGE: currentMenu = MenuSettingsLanguage(); break; case MENU_SETTINGS_FONT: currentMenu = MenuSettingsFont(); break; case MENU_SETTINGS_DISPLAY: currentMenu = MenuSettingsDisplay(); break; case MENU_SETTINGS_CHILDLOCK: currentMenu = MenuSettingsChildlock(); break; case MENU_SETTINGS_NETWORK: currentMenu = MenuSettingsNetwork(); break; default: // unrecognized menu currentMenu = MenuMain(); break; } } ResumeGui(); ExitRequested = 1; HaltGui(); delete mainWindow; delete pointer; mainWindow = NULL; }
/** \fn GalleryWidget::keyPressEvent(QKeyEvent *) * \brief Translates the keypresses and keys bound to the * plugin to specific actions within the plugin * \param event The pressed key * \return True if key was used, otherwise false */ bool GalleryWidget::keyPressEvent(QKeyEvent *event) { if (GetFocusWidget()->keyPressEvent(event)) return true; bool handled = false; QStringList actions; handled = GetMythMainWindow()->TranslateKeyPress("Images", event, actions); for (int i = 0; i < actions.size() && !handled; i++) { QString action = actions[i]; handled = true; if (action == "LEFT") ShowPrevFile(); else if (action == "RIGHT") ShowNextFile(); else if (action == "INFO") ShowFileDetails(); else if (action == "MENU") MenuMain(); else if (action == "PLAY") { // If no slideshow is active and the user presses the play // button then start a normal slideshow. But if a slideshow // is already running then start or pause it. if (m_slideShowType == kNoSlideShow) StartNormalSlideShow(); else { if (m_timer->isActive()) PauseSlideShow(); else ResumeSlideShow(); } } else if (action == "PAUSE") PauseSlideShow(); else if (action == "STOP") StopSlideShow(); else if (action == "ROTRIGHT") { m_gvh->SetFileOrientation(kFileRotateCW); LoadFile(); } else if (action == "ROTLEFT") { m_gvh->SetFileOrientation(kFileRotateCCW); LoadFile(); } else if (action == "FLIPHORIZONTAL") { m_gvh->SetFileOrientation(kFileFlipHorizontal); LoadFile(); } else if (action == "FLIPVERTICAL") { m_gvh->SetFileOrientation(kFileFlipVertical); LoadFile(); } else if (action == "ZOOMIN") { m_gvh->SetFileZoom(kFileZoomIn); LoadFile(); } else if (action == "ZOOMOUT") { m_gvh->SetFileZoom(kFileZoomOut); LoadFile(); } else if (action == "ESCAPE") { if (m_infoVisible) HideFileDetails(); else handled = false; } } if (!handled && MythScreenType::keyPressEvent(event)) handled = true; return handled; }
/** \fn GalleryView::keyPressEvent(QKeyEvent *) * \brief Translates the keypresses and keys bound to the * plugin to specific actions within the plugin * \param event The pressed key * \return True if key was used, otherwise false */ bool GalleryView::keyPressEvent(QKeyEvent *event) { if (GetFocusWidget()->keyPressEvent(event)) return true; bool handled = false; QStringList actions; handled = GetMythMainWindow()->TranslateKeyPress("Images", event, actions); for (int i = 0; i < actions.size() && !handled; i++) { QString action = actions[i]; handled = true; if (action == "MENU") MenuMain(); else if (action == "INFO") MenuInformation(); else if (action == "ROTRIGHT") FileRotateCW(); else if (action == "ROTLEFT") FileRotateCCW(); else if (action == "FLIPHORIZONTAL") FileFlipHorizontal(); else if (action == "FLIPVERTICAL") FileFlipVertical(); else if (action == "ZOOMIN") FileZoomIn(); else if (action == "ZOOMOUT") FileZoomOut(); else if (action == "SLIDESHOW") ShowFiles(); else if (action == "RANDOMSHOW") ShowRandomFiles(); else if (action == "MARK") { ImageMetadata *im = GetImageMetadataFromSelectedButton(); if (im) { if (im->m_selected) FileSelectOne(); else FileDeselectOne(); } } else if (action == "ESCAPE") { // If the jumppoint is not active and the first node is of // the type kUpFolder then allow going up one directory if (!GetMythMainWindow()->IsExitingToMain()) { ImageMetadata *data = m_galleryViewHelper->GetImageMetadataFromNode(0); if (data && data->m_type == kUpDirectory) handled = DirSelectUp(); else handled = false; } else handled = false; } else handled = false; } if (!handled && MythScreenType::keyPressEvent(event)) handled = true; return handled; }