void ViewScheduled::Close() { // don't fade the screen if we are returning to the player if (m_player) GetScreenStack()->PopScreen(this, false); else GetScreenStack()->PopScreen(this, true); }
bool ProgFinder::keyPressEvent(QKeyEvent *event) { if (!m_allowKeypress) return true; m_allowKeypress = false; if (GetFocusWidget() && GetFocusWidget()->keyPressEvent(event)) { m_allowKeypress = true; 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 == "UPCOMING") upcoming(); else if (action == "DETAILS" || action == "INFO") details(); else if (action == "TOGGLERECORD") quickRecord(); else if (action == "GUIDE" || action == "4") showGuide(); else if (action == "ESCAPE") { // don't fade the screen if we are returning to the player if (m_player && m_allowEPG) GetScreenStack()->PopScreen(this, false); else GetScreenStack()->PopScreen(this, true); } else handled = false; } if (!handled && MythScreenType::keyPressEvent(event)) handled = true; m_allowKeypress = true; return handled; }
void TeaTime::Setup() { MythScreenStack *stack = GetScreenStack(); if (stack == NULL) { LOG_Tea(LOG_WARNING, "Could not get screenstack."); return; } TeaTimerSettings *settings = new TeaTimerSettings(stack); if (!settings->Create()) { LOG_Tea(LOG_WARNING, "Could not load teatime settings window."); return; } stack->AddScreen(settings); }
void NetTree::switchView() { NetTree *nettree = new NetTree(m_type, GetMythMainWindow()->GetMainStack(), "nettree"); if (nettree->Create()) { gCoreContext->SaveSetting("mythnetvision.ViewMode", m_type); MythScreenStack *screenStack = GetScreenStack(); screenStack->AddScreen(nettree); screenStack->PopScreen(this, false, false); deleteLater(); } else delete nettree; }
void GameUI::edit(void) { MythGenericTree *node = m_gameUITree->GetCurrentNode(); if (isLeaf(node)) { RomInfo *romInfo = qVariantValue<RomInfo *>(node->GetData()); MythScreenStack *screenStack = GetScreenStack(); EditRomInfoDialog *md_editor = new EditRomInfoDialog(screenStack, "mythgameeditmetadata", romInfo); if (md_editor->Create()) { screenStack->AddScreen(md_editor); md_editor->SetReturnEvent(this, "editMetadata"); } else delete md_editor; } }
/** \brief Handle a MythTV action for the Menus. * * \param action single action to be handled * \return true if the action is not to EXEC another program */ bool MythThemedMenu::handleAction(const QString &action, const QString &password) { MythUIMenuCallbacks *cbs = GetMythUI()->GetMenuCBs(); if (((password == "SetupPinCode") && GetMythDB()->GetNumSetting("SetupPinCodeRequired", 0)) || (!password.isEmpty() && password != "SetupPinCode")) { if (!checkPinCode(password)) return true; } if (action.left(5) == "EXEC ") { QString rest = action.right(action.length() - 5); if (cbs && cbs->exec_program) cbs->exec_program(rest); return false; } else if (action.left(7) == "EXECTV ") { QString rest = action.right(action.length() - 7).trimmed(); if (cbs && cbs->exec_program_tv) cbs->exec_program_tv(rest); } else if (action.left(5) == "MENU ") { QString menu = action.right(action.length() - 5); MythScreenStack *stack = GetScreenStack(); MythThemedMenu *newmenu = new MythThemedMenu("", menu, stack, menu, false, m_state); if (newmenu->foundTheme()) stack->AddScreen(newmenu); else delete newmenu; } else if (action.left(6) == "UPMENU") { m_wantpop = true; } else if (action.left(12) == "CONFIGPLUGIN") { QString rest = action.right(action.length() - 13); if (cbs && cbs->configplugin) cbs->configplugin(rest); } else if (action.left(6) == "PLUGIN") { QString rest = action.right(action.length() - 7); if (cbs && cbs->plugin) cbs->plugin(rest); } else if (action.left(8) == "SHUTDOWN") { if (m_allocedstate) { m_wantpop = true; } } else if (action.left(5) == "EJECT") { if (cbs && cbs->eject) cbs->eject(); } else if (action.left(5) == "JUMP ") { QString rest = action.right(action.length() - 5); GetMythMainWindow()->JumpTo(rest, false); } else if (action.left(6) == "MEDIA ") { // the format is MEDIA HANDLER URL // TODO: allow spaces in the url QStringList list = action.simplified().split(' '); if (list.size() >= 3) GetMythMainWindow()->HandleMedia(list[1], list[2]); } else { m_selection = action; if (m_state->m_callback) m_state->m_callback(m_state->m_callbackdata, m_selection); else LOG(VB_GENERAL, LOG_ERR, "Unknown menu action: " + action); } return true; }
void MythNotificationScreen::ProcessTimer(void) { LOG(VB_GUI, LOG_DEBUG, LOC + "ProcessTimer()"); // delete screen GetScreenStack()->PopScreen(this, true, true); }
/** * Update the various fields of a MythNotificationScreen. */ void MythNotificationScreen::Init(void) { if (!m_refresh) // nothing got changed so far, return return; AdjustYPosition(); if (m_artworkImage && (m_update & kImage)) { if (!m_imagePath.isNull()) { // We have a path to the image, use it m_artworkImage->SetFilename(m_imagePath); m_artworkImage->Load(); } else if (!m_image.isNull()) { // We don't have a path to the image, but the image itself MythImage *img = m_artworkImage->GetPainter()->GetFormatImage(); img->Assign(m_image); m_artworkImage->SetImage(img); img->DecrRef(); } else { // Will default to displaying whatever placeholder image is defined // in the xml by the themer, means we can show _something_ rather than // a big empty hole. Generally you always want to call Reset() in // these circumstances m_artworkImage->Reset(); } } if (m_update != kNone) { InfoMap tmap; tmap["title"] = m_title; if (m_update & kImage) { tmap["image"] = m_imagePath; } tmap["origin"] = m_origin; tmap["description"] = m_description; tmap["extra"] = m_extra; if (m_update & kDuration) { tmap["progress_text"] = m_progresstext; tmap["progress"] = QString("%1").arg((int)(m_progress * 100)); } SetTextFromMap(tmap); } if (m_update & kMetaData) { if (m_titleText && m_title.isNull()) { m_titleText->Reset(); } if (m_originText && m_origin.isNull()) { m_originText->Reset(); } if (m_descriptionText && m_description.isNull()) { m_descriptionText->Reset(); } if (m_extraText && m_extra.isNull()) { m_extraText->Reset(); } } if (m_update & kDuration) { if (m_progresstextText && m_progresstext.isEmpty()) { m_progresstextText->Reset(); } if (m_progressBar) { if (m_progress >= 0) { m_progressBar->SetStart(0); m_progressBar->SetTotal(100); m_progressBar->SetUsed(100 * m_progress); } else { // Same as above, calling Reset() allows for a sane, themer defined //default to be displayed m_progressBar->Reset(); } } } if (m_progressBar) { m_progressBar->SetVisible((m_content & kDuration) != 0); } SetErrorState(); if (m_mediaState && (m_update & kImage)) { m_mediaState->DisplayState(m_update & kNoArtwork ? "noartwork" : "ok"); LOG(VB_GUI, LOG_DEBUG, LOC + QString("Init: Set media state to %1").arg(m_update & kNoArtwork ? "noartwork" : "ok")); } // No field will be refreshed the next time unless specified otherwise m_update = kNone; if (GetScreenStack() && !m_added) { GetScreenStack()->AddScreen(this); m_added = true; } m_refresh = false; }
void MythScreenType::Close(void) { CloseBusyPopup(); if (GetScreenStack()) GetScreenStack()->PopScreen(this); }