void MythScreenStack::PopScreen(MythScreenType *screen, bool allowFade, bool deleteScreen) { if (!screen || screen->IsDeleting()) return; screen->aboutToHide(); if (m_Children.isEmpty()) return; MythMainWindow *mainwindow = GetMythMainWindow(); screen->setParent(0); if ((screen == m_topScreen) && allowFade && m_DoTransitions && !mainwindow->IsExitingToMain()) { screen->SetFullscreen(false); if (deleteScreen) { screen->SetDeleting(true); m_ToDelete.push_back(screen); } screen->AdjustAlpha(1, -kFadeVal); } else { for (int i = 0; i < m_Children.size(); ++i) { if (m_Children.at(i) == screen) m_Children.remove(i); } if (deleteScreen) delete screen; screen = NULL; mainwindow->update(); if (mainwindow->IsExitingToMain()) { QCoreApplication::postEvent( mainwindow, new QEvent(MythEvent::kExitToMainMenuEventType)); } } m_topScreen = NULL; RecalculateDrawOrder(); // If we're fading it, we still want to draw it. if (screen) m_DrawOrder.push_back(screen); if (!m_Children.isEmpty()) { QVector<MythScreenType *>::Iterator it; for (it = m_DrawOrder.begin(); it != m_DrawOrder.end(); ++it) { if (*it != screen && !(*it)->IsDeleting()) { m_topScreen = (*it); (*it)->SetAlpha(255); (*it)->aboutToShow(); } } } if (m_topScreen) { m_topScreen->SetRedraw(); if (!allowFade || !m_DoTransitions) emit topScreenChanged(m_topScreen); } else { // Screen still needs to be redrawn if we have popped the last screen // off the popup stack, or similar MythScreenType *mainscreen = mainwindow->GetMainStack()->GetTopScreen(); if (mainscreen) mainscreen->SetRedraw(); if (!allowFade || !m_DoTransitions) emit topScreenChanged(NULL); } }
void MythNotificationScreenStack::PopScreen(MythScreenType *screen, bool allowFade, bool deleteScreen) { if (!screen || screen->IsDeleting()) return; bool poppedFullscreen = screen->IsFullscreen(); screen->aboutToHide(); if (m_Children.isEmpty()) return; MythMainWindow *mainwindow = GetMythMainWindow(); screen->setParent(0); if (allowFade && m_DoTransitions && !mainwindow->IsExitingToMain()) { screen->SetFullscreen(false); if (deleteScreen) { screen->SetDeleting(true); m_ToDelete.push_back(screen); } screen->AdjustAlpha(1, -kFadeVal); } else { for (int i = 0; i < m_Children.size(); ++i) { if (m_Children.at(i) == screen) { m_Children.remove(i); break; } } if (deleteScreen) screen->deleteLater(); screen = NULL; } m_topScreen = NULL; RecalculateDrawOrder(); // If we're fading it, we still want to draw it. if (screen && !m_DrawOrder.contains(screen)) m_DrawOrder.push_back(screen); if (!m_Children.isEmpty()) { QVector<MythScreenType *>::Iterator it; for (it = m_DrawOrder.begin(); it != m_DrawOrder.end(); ++it) { if (*it != screen && !(*it)->IsDeleting()) { m_topScreen = (*it); (*it)->SetAlpha(255); if (poppedFullscreen) (*it)->aboutToShow(); } } } if (m_topScreen) { m_topScreen->SetRedraw(); } else { // Screen still needs to be redrawn if we have popped the last screen // off the popup stack, or similar if (mainwindow->GetMainStack()) { MythScreenType *mainscreen = mainwindow->GetMainStack()->GetTopScreen(); if (mainscreen) mainscreen->SetRedraw(); } } }