void MythNews::ShowEditDialog(bool edit) { QMutexLocker locker(&m_lock); NewsSite *site = NULL; if (edit) { MythUIButtonListItem *siteListItem = m_sitesList->GetItemCurrent(); if (!siteListItem || siteListItem->GetData().isNull()) return; site = qVariantValue<NewsSite*>(siteListItem->GetData()); } MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); MythNewsEditor *mythnewseditor = new MythNewsEditor(site, edit, mainStack, "mythnewseditor"); if (mythnewseditor->Create()) { connect(mythnewseditor, SIGNAL(Exiting()), SLOT(loadSites())); mainStack->AddScreen(mythnewseditor); } else delete mythnewseditor; }
void Weather::setupPage() { m_srcMan->stopTimers(); m_nextpage_Timer->stop(); m_srcMan->clearSources(); m_srcMan->findScripts(); MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); ScreenSetup *ssetup = new ScreenSetup(mainStack, "weatherscreensetup", m_srcMan); connect(ssetup, SIGNAL(Exiting()), this, SLOT(setupScreens())); if (ssetup->Create()) { clearScreens(); mainStack->AddScreen(ssetup); } else { delete ssetup; } m_firstRun = true; }
MythScreenType::~MythScreenType() { // gCoreContext->SendSystemEvent( // QString("SCREEN_TYPE DESTROYED %1").arg(objectName())); // locking ensures background screen load can finish running QMutexLocker locker(&m_LoadLock); m_CurrentFocusWidget = NULL; emit Exiting(); }
MythScreenType::~MythScreenType() { if (QCoreApplication::applicationName() == MYTH_APPNAME_MYTHFRONTEND) gCoreContext->SendSystemEvent( QString("SCREEN_TYPE DESTROYED %1").arg(objectName())); // locking ensures background screen load can finish running SemaphoreLocker locker(&m_LoadLock); m_CurrentFocusWidget = NULL; emit Exiting(); }
void MythNews::ShowFeedManager() { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); MythNewsConfig *mythnewsconfig = new MythNewsConfig(mainStack, "mythnewsconfig"); if (mythnewsconfig->Create()) { connect(mythnewsconfig, SIGNAL(Exiting()), SLOT(loadSites())); mainStack->AddScreen(mythnewsconfig); } else delete mythnewsconfig; }
void ZMEvents::playPressed(void) { if (!m_eventList || m_eventList->empty()) return; m_savedPosition = m_eventGrid->GetCurrentPos(); Event *event = m_eventList->at(m_savedPosition); if (event) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); ZMPlayer *player = new ZMPlayer(mainStack, "ZMPlayer", m_eventList, &m_savedPosition); connect(player, SIGNAL(Exiting()), this, SLOT(playerExited())); if (player->Create()) mainStack->AddScreen(player); } }
void Game::OnExiting(Object * const sender, EventArgs * const args) { Exiting(sender, args); }
// returns true if no completion is required bool DoCheck() { ParentalLevel which_level(m_toLevel); // No password for level 1 and you can always switch down from your // current level. if (which_level == ParentalLevel::plLowest || which_level <= ParentalLevel(m_fromLevel)) return true; // If there isn't a password at the current level, and // none of the levels below, we are done. // The assumption is that if you password protected lower levels, // and a higher level does not have a password it is something // you've overlooked (rather than intended). if (!m_pm.FirstAtOrBelow(which_level.GetLevel()).length()) return true; // See if we recently (and successfully) asked for a password QString last_time_stamp = gCoreContext->GetSetting("VideoPasswordTime"); int last_parent_lvl = gCoreContext->GetNumSetting("VideoPasswordLevel", -1); if (!last_time_stamp.length() || last_parent_lvl == -1) { VERBOSE(VB_IMPORTANT, QString("%1: Could not read password/pin time " "stamp. This is only an issue if it " "happens repeatedly.").arg(__FILE__)); } else { QDateTime curr_time = QDateTime::currentDateTime(); QDateTime last_time = QDateTime::fromString(last_time_stamp, Qt::ISODate); if (ParentalLevel(last_parent_lvl) >= which_level && last_time.secsTo(curr_time) < 120) { // Two minute window last_time_stamp = curr_time.toString(Qt::ISODate); gCoreContext->SetSetting("VideoPasswordTime", last_time_stamp); gCoreContext->SaveSetting("VideoPasswordTime", last_time_stamp); return true; } } m_validPasswords = m_pm.AtOrAbove(which_level.GetLevel()); // If there isn't a password for this level or higher levels, treat // the next lower password as valid. This is only done so people // cannot lock themselves out of the setup. if (!m_validPasswords.size()) { QString pw = m_pm.FirstAtOrBelow(which_level.GetLevel()); if (pw.length()) m_validPasswords.push_back(pw); } // There are no suitable passwords. if (!m_validPasswords.size()) return true; // If we got here, there is a password, and there's no backing down. MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); MythTextInputDialog *pwd = new MythTextInputDialog(popupStack, QObject::tr("Parental PIN:"), FilterNone, true); connect(pwd, SIGNAL(haveResult(QString)), SLOT(OnPasswordEntered(QString))); connect(pwd, SIGNAL(Exiting()), SLOT(OnPasswordExit())); if (pwd->Create()) popupStack->AddScreen(pwd, false); return false; }
bool Weather::SetupScreens() { // Delete any existing screens clearScreens(); m_paused = false; m_pauseText->Hide(); // Refresh sources m_srcMan->clearSources(); m_srcMan->findScriptsDB(); m_srcMan->setupSources(); MSqlQuery db(MSqlQuery::InitCon()); QString query = "SELECT screen_id, container, units, draworder FROM weatherscreens " " WHERE hostname = :HOST ORDER BY draworder;"; db.prepare(query); db.bindValue(":HOST", gCoreContext->GetHostName()); if (!db.exec()) { MythDB::DBError("Selecting weather screens.", db); return false; } if (!db.size()) { if (m_firstSetup) { // If no screens exist, run the setup MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); ScreenSetup *ssetup = new ScreenSetup(mainStack, "weatherscreensetup", m_srcMan); connect(ssetup, SIGNAL(Exiting()), this, SLOT(setupScreens())); if (ssetup->Create()) { mainStack->AddScreen(ssetup); } else { delete ssetup; } m_firstSetup = false; } else { Close(); } } else { while (db.next()) { int id = db.value(0).toInt(); QString container = db.value(1).toString(); units_t units = db.value(2).toUInt(); uint draworder = db.value(3).toUInt(); ScreenListInfo &screenListInfo = m_allScreens[container]; WeatherScreen *ws = WeatherScreen::loadScreen(m_weatherStack, &screenListInfo, id); if (!ws->Create()) { delete ws; continue; } ws->setUnits(units); ws->setInUse(true); m_screens.insert(draworder, ws); connect(ws, SIGNAL(screenReady(WeatherScreen *)), this, SLOT(screenReady(WeatherScreen *))); m_srcMan->connectScreen(id, ws); } if( m_screens.empty() ) { // We rejected every screen... sit on this and rotate. LOG(VB_GENERAL, LOG_ERR, "No weather screens left, aborting."); m_nextpage_Timer->stop(); if( m_updatedText ) { m_updatedText->SetText(tr("None of the configured screens are complete in this theme (missing copyright information).")); m_updatedText->Show(); return true; } return false; } m_srcMan->startTimers(); m_srcMan->doUpdate(true); } return true; }
void ChannelEditor::customEvent(QEvent *event) { if (event->type() == DialogCompletionEvent::kEventType) { DialogCompletionEvent *dce = (DialogCompletionEvent*)(event); QString resultid= dce->GetId(); int buttonnum = dce->GetResult(); if (resultid == "channelopts") { switch (buttonnum) { case 0 : edit(m_channelList->GetItemCurrent()); break; case 1 : del(); break; } } else if (resultid == "delsingle" && buttonnum == 1) { MythUIButtonListItem *item = qVariantValue<MythUIButtonListItem *>(dce->GetData()); if (!item) return; uint chanid = item->GetData().toUInt(); if (chanid && ChannelUtil::DeleteChannel(chanid)) m_channelList->RemoveItem(item); } else if (resultid == "delall" && buttonnum == 1) { bool del_all = m_sourceFilter == FILTER_ALL; bool del_nul = m_sourceFilter == FILTER_UNASSIGNED; MSqlQuery query(MSqlQuery::InitCon()); if (del_all) { query.prepare("TRUNCATE TABLE channel"); } else if (del_nul) { query.prepare("SELECT sourceid " "FROM videosource " "GROUP BY sourceid"); if (!query.exec() || !query.isActive()) { MythDB::DBError("ChannelEditor Delete Channels", query); return; } QString tmp = ""; while (query.next()) tmp += "'" + query.value(0).toString() + "',"; if (tmp.isEmpty()) { query.prepare("TRUNCATE TABLE channel"); } else { tmp = tmp.left(tmp.length() - 1); query.prepare(QString("DELETE FROM channel " "WHERE sourceid NOT IN (%1)").arg(tmp)); } } else { query.prepare("DELETE FROM channel " "WHERE sourceid = :SOURCEID"); query.bindValue(":SOURCEID", m_sourceFilter); } if (!query.exec()) MythDB::DBError("ChannelEditor Delete Channels", query); fillList(); } else if (resultid == "iconimportopt") { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); ImportIconsWizard *iconwizard; QString channelname = dce->GetData().toString(); switch (buttonnum) { case 0 : // Import all icons iconwizard = new ImportIconsWizard(mainStack, false); break; case 1 : // Rescan for missing iconwizard = new ImportIconsWizard(mainStack, true); break; case 2 : // Import a single channel icon iconwizard = new ImportIconsWizard(mainStack, true, channelname); break; default: return; } if (iconwizard->Create()) { connect(iconwizard, SIGNAL(Exiting()), SLOT(fillList())); mainStack->AddScreen(iconwizard); } else delete iconwizard; } } }
MythScreenType::~MythScreenType() { m_CurrentFocusWidget = NULL; emit Exiting(); }