void ExitPrompter::masterPromptExit() { if (gCoreContext->IsMasterHost() && needsMFDBReminder()) { QString label = tr("If you've added or altered channels," " please run 'mythfilldatabase' on the" " master backend to populate the" " database with guide information."); MythConfirmationDialog *dia = new MythConfirmationDialog(m_d->stk, label, false); if (!dia->Create()) { VERBOSE(VB_IMPORTANT, "Can't create fill DB prompt?"); delete dia; quit(); } else { dia->SetReturnEvent(this, "mythfillprompt"); m_d->stk->AddScreen(dia); } } else quit(); }
bool RipStatus::keyPressEvent(QKeyEvent *event) { if (GetFocusWidget() && GetFocusWidget()->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 == "ESCAPE" && m_ripperThread && m_ripperThread->isRunning()) { MythConfirmationDialog *dialog = ShowOkPopup(tr("Cancel ripping the CD?"), this, NULL, true); if (dialog) dialog->SetReturnEvent(this, "stop_ripping"); } else handled = false; } if (!handled && MythScreenType::keyPressEvent(event)) handled = true; return handled; }
void ViewScheduled::deleteRule() { MythUIButtonListItem *item = m_schedulesList->GetItemCurrent(); if (!item) return; ProgramInfo *pginfo = qVariantValue<ProgramInfo*>(item->GetData()); if (!pginfo) return; RecordingRule *record = new RecordingRule(); if (!record->LoadByProgram(pginfo)) { delete record; return; } QString message = tr("Delete '%1' %2 rule?").arg(record->m_title) .arg(toString(pginfo->GetRecordingRuleType())); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); MythConfirmationDialog *okPopup = new MythConfirmationDialog(popupStack, message, true); okPopup->SetReturnEvent(this, "deleterule"); okPopup->SetData(qVariantFromValue(record)); if (okPopup->Create()) popupStack->AddScreen(okPopup); else delete okPopup; }
bool StatusBox::keyPressEvent(QKeyEvent *event) { if (GetFocusWidget()->keyPressEvent(event)) return true; bool handled = false; QStringList actions; handled = GetMythMainWindow()->TranslateKeyPress("Status", event, actions); for (int i = 0; i < actions.size() && !handled; ++i) { QString action = actions[i]; handled = true; QRegExp logNumberKeys( "^[12345678]$" ); MythUIButtonListItem* currentButton = m_categoryList->GetItemCurrent(); QString currentItem; if (currentButton) currentItem = currentButton->GetText(); handled = true; if (action == "MENU") { if (currentItem == tr("Log Entries")) { QString message = tr("Acknowledge all log entries at " "this priority level or lower?"); MythConfirmationDialog *confirmPopup = new MythConfirmationDialog(m_popupStack, message); confirmPopup->SetReturnEvent(this, "LogAckAll"); if (confirmPopup->Create()) m_popupStack->AddScreen(confirmPopup, false); } } else if ((currentItem == tr("Log Entries")) && (logNumberKeys.indexIn(action) == 0)) { m_minLevel = action.toInt(); if (m_helpText) m_helpText->SetText(tr("Setting priority level to %1") .arg(m_minLevel)); if (m_justHelpText) m_justHelpText->SetText(tr("Setting priority level to %1") .arg(m_minLevel)); doLogEntries(); } else handled = false; } if (!handled && MythScreenType::keyPressEvent(event)) handled = true; return handled; }
void MythContextPrivate::HideConnectionFailurePopup(void) { MythConfirmationDialog *dlg = this->MBEconnectPopup; this->MBEconnectPopup = NULL; if (dlg) dlg->Close(); }
void ProgLister::ShowDeleteRuleMenu(void) { ProgramInfo *pi = GetCurrent(); if (!pi || !pi->GetRecordingRuleID()) return; RecordingRule *record = new RecordingRule(); if (!record->LoadByProgram(pi)) { delete record; return; } QString message = tr("Delete '%1' %2 rule?").arg(record->m_title) .arg(toString(pi->GetRecordingRuleType())); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); MythConfirmationDialog *okPopup = new MythConfirmationDialog( popupStack, message, true); okPopup->SetReturnEvent(this, "deleterule"); okPopup->SetData(qVariantFromValue(record)); if (okPopup->Create()) popupStack->AddScreen(okPopup); else delete okPopup; }
void showWarningDialog(const QString msg) { MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); MythConfirmationDialog *dialog = new MythConfirmationDialog(popupStack, msg, false); if (dialog->Create()) popupStack->AddScreen(dialog); }
/** \fn GalleryWidget::ShowInformation(QString &msg) * \brief Shows a message to the user * \param msg The message that shall be shown * \return void */ void GalleryWidget::ShowInformation(QString &msg) { MythConfirmationDialog *okPopup = new MythConfirmationDialog(m_popupStack, msg, false); if (okPopup->Create()) m_popupStack->AddScreen(okPopup); else delete okPopup; }
bool CustomEdit::checkSyntax(void) { bool ret = false; QString msg; QString desc = evaluate(m_descriptionEdit->GetText()); QString from = m_subtitleEdit->GetText(); if (desc.contains(QRegExp("^\\s*AND\\s", Qt::CaseInsensitive))) { msg = tr("Power Search rules no longer require a leading \"AND\"."); } else if (desc.contains(';')) { msg = tr("Power Search rules cannot include semicolon ( ; ) "); msg += tr("statement terminators."); } else { MSqlQuery query(MSqlQuery::InitCon()); query.prepare(QString("SELECT NULL FROM (program,channel) " "%1 WHERE\n%2").arg(from).arg(desc)); if (query.exec()) { ret = true; } else { msg = tr("An error was found when checking") + ":\n\n"; msg += query.executedQuery(); msg += "\n\n" + tr("The database error was") + ":\n"; msg += query.lastError().databaseText(); } } if (!msg.isEmpty()) { MythScreenStack *popupStack = GetMythMainWindow()-> GetStack("popup stack"); MythConfirmationDialog *checkSyntaxPopup = new MythConfirmationDialog(popupStack, msg, false); if (checkSyntaxPopup->Create()) { checkSyntaxPopup->SetReturnEvent(this, "checkSyntaxPopup"); popupStack->AddScreen(checkSyntaxPopup); } else { delete checkSyntaxPopup; } ret = false; } return ret; }
void GeneralSetupWizard::slotSubmit(void) { QString message = QObject::tr("Would you like to share your " "hardware profile with the MythTV developers? " "Profiles are anonymous and are a great way to " "help with future development."); MythConfirmationDialog *confirmdialog = new MythConfirmationDialog(m_popupStack,message); if (confirmdialog->Create()) m_popupStack->AddScreen(confirmdialog); connect(confirmdialog, SIGNAL(haveResult(bool)), SLOT(OnSubmitPromptReturn(bool))); }
void ImportIconsWizard::askSubmit(const QString& strParam) { m_strParam = strParam; QString message = tr("You now have the opportunity to transmit your " "choices back to mythtv.org so that others can " "benefit from your selections."); MythConfirmationDialog *confirmPopup = new MythConfirmationDialog(m_popupStack, message); confirmPopup->SetReturnEvent(this, "submitresults"); if (confirmPopup->Create()) m_popupStack->AddScreen(confirmPopup, false); }
void NetTree::slotDeleteVideo() { QString message = tr("Are you sure you want to delete this file?"); MythConfirmationDialog *confirmdialog = new MythConfirmationDialog(m_popupStack,message); if (confirmdialog->Create()) { m_popupStack->AddScreen(confirmdialog); connect(confirmdialog, SIGNAL(haveResult(bool)), SLOT(doDeleteVideo(bool))); } else delete confirmdialog; }
void BookmarkManager::slotDeleteMarked(void) { if (GetMarkedCount() == 0) return; MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); QString message = tr("Are you sure you want to delete the marked bookmarks?"); MythConfirmationDialog *dialog = new MythConfirmationDialog(popupStack, message, true); if (dialog->Create()) popupStack->AddScreen(dialog); connect(dialog, SIGNAL(haveResult(bool)), this, SLOT(slotDoDeleteMarked(bool))); }
void MythContextPrivate::HideConnectionFailurePopup(void) { if (MBEconnectPopup) { MBEconnectPopup->Close(); MBEconnectPopup = NULL; } }
void NetSearch::doDownloadAndPlay() { QMutexLocker locker(&m_lock); ResultItem *item = qVariantValue<ResultItem *>(m_searchResultList->GetDataValue()); if (!item) return; VERBOSE(VB_GENERAL, QString("Downloading and Inserting %1 " "into Recordings").arg(item->GetTitle())); QString filename = getDownloadFilename(item); // Does the file already exist? bool exists; if (filename.startsWith("myth://")) exists = RemoteFile::Exists(filename); else exists = QFile::exists(filename); if (exists) { QString message = tr("This file already downloaded to:\n%1").arg(filename); MythConfirmationDialog *confirmdialog = new MythConfirmationDialog(m_popupStack,message, false); if (confirmdialog->Create()) m_popupStack->AddScreen(confirmdialog); else delete confirmdialog; return; } if (m_progress) m_progress->SetVisible(true); // Initialize the download m_redirects = 0; m_currentDownload = filename; }
/** * Non-blocking version of MythPopupBox::showOkPopup() */ MythConfirmationDialog *ShowOkPopup(const QString &message, QObject *parent, const char *slot, bool showCancel) { QString LOC = "ShowOkPopup('" + message + "') - "; MythConfirmationDialog *pop; MythScreenStack *stk = NULL; if (!stk) { MythMainWindow *win = GetMythMainWindow(); if (win) stk = win->GetStack("popup stack"); else { LOG(VB_GENERAL, LOG_ERR, LOC + "no main window?"); return NULL; } if (!stk) { LOG(VB_GENERAL, LOG_ERR, LOC + "no popup stack? " "Is there a MythThemeBase?"); return NULL; } } pop = new MythConfirmationDialog(stk, message, showCancel); if (pop->Create()) { stk->AddScreen(pop); if (parent && slot) QObject::connect(pop, SIGNAL(haveResult(bool)), parent, slot, Qt::QueuedConnection); } else { delete pop; pop = NULL; LOG(VB_GENERAL, LOG_ERR, LOC + "Couldn't Create() Dialog"); } return pop; }
void OSD::CheckExpiry(void) { QDateTime now = MythDate::current(); QMutableHashIterator<MythScreenType*, QDateTime> it(m_ExpireTimes); while (it.hasNext()) { it.next(); if (it.value() < now) { if (it.key() == m_Dialog) DialogQuit(); else HideWindow(m_Children.key(it.key())); } else if (it.key() == m_Dialog) { if (!m_PulsedDialogText.isEmpty() && now > m_NextPulseUpdate) { QString newtext = m_PulsedDialogText; MythDialogBox *dialog = dynamic_cast<MythDialogBox*>(m_Dialog); if (dialog) { // The disambiguation string must be an empty string // and not a NULL to get extracted by the Qt tools. QString replace = QCoreApplication::translate("(Common)", "%n second(s)", "", #if QT_VERSION < 0x050000 QCoreApplication::UnicodeUTF8, #endif now.secsTo(it.value())); dialog->SetText(newtext.replace("%d", replace)); } MythConfirmationDialog *cdialog = dynamic_cast<MythConfirmationDialog*>(m_Dialog); if (cdialog) { QString replace = QString::number(now.secsTo(it.value())); cdialog->SetMessage(newtext.replace("%d", replace)); } m_NextPulseUpdate = now.addSecs(1); } } } }
void ProgramRecPriority::remove(void) { MythUIButtonListItem *item = m_programList->GetItemCurrent(); if (!item) return; ProgramRecPriorityInfo *pgRecInfo = item->GetData().value<ProgramRecPriorityInfo*>(); if (!pgRecInfo || (pgRecInfo->recType == kTemplateRecord && pgRecInfo->GetCategory() .compare("Default", Qt::CaseInsensitive) == 0)) { return; } RecordingRule *record = new RecordingRule(); record->m_recordID = pgRecInfo->GetRecordingRuleID(); if (!record->Load()) { delete record; return; } QString message = tr("Delete '%1' %2 rule?").arg(record->m_title) .arg(toString(pgRecInfo->GetRecordingRuleType())); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); MythConfirmationDialog *okPopup = new MythConfirmationDialog(popupStack, message, true); okPopup->SetReturnEvent(this, "deleterule"); okPopup->SetData(qVariantFromValue(record)); if (okPopup->Create()) popupStack->AddScreen(okPopup); else delete okPopup; }
void RSSEditor::slotDeleteSite() { QMutexLocker locker(&m_lock); QString message = tr("Are you sure you want to unsubscribe from this feed?"); MythScreenStack *m_popupStack = GetMythMainWindow()->GetStack("popup stack"); MythConfirmationDialog *confirmdialog = new MythConfirmationDialog(m_popupStack,message); if (confirmdialog->Create()) { m_popupStack->AddScreen(confirmdialog); connect(confirmdialog, SIGNAL(haveResult(bool)), SLOT(doDeleteSite(bool))); } else delete confirmdialog; }
void MythControls::Close() { if (m_bindings && m_bindings->HasChanges()) { /* prompt user to save changes */ QString label = tr("Save changes?"); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); MythConfirmationDialog *confirmPopup = new MythConfirmationDialog(popupStack, label, true); if (confirmPopup->Create()) popupStack->AddScreen(confirmPopup); confirmPopup->SetReturnEvent(this, "exit"); } else MythScreenType::Close(); }
void ChannelEditor::del() { MythUIButtonListItem *item = m_channelList->GetItemCurrent(); if (!item) return; QString message = tr("Delete channel '%1'?").arg(item->GetText("name")); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); MythConfirmationDialog *dialog = new MythConfirmationDialog(popupStack, message, true); if (dialog->Create()) { dialog->SetData(qVariantFromValue(item)); dialog->SetReturnEvent(this, "delsingle"); popupStack->AddScreen(dialog); } else delete dialog; }
void GeneralSetupWizard::slotDelete(void) { if (gCoreContext->GetSetting("HardwareProfileUUID").isEmpty()) { ShowOkPopup(tr("You haven't submitted your hardware profile yet!")); return; } QString message = QObject::tr("Are you sure you want to delete " "your online profile? Your information " "is anonymous and helps the developers " "to know what hardware the majority of users " "prefer."); MythConfirmationDialog *confirmdialog = new MythConfirmationDialog(m_popupStack,message); if (confirmdialog->Create()) m_popupStack->AddScreen(confirmdialog); connect(confirmdialog, SIGNAL(haveResult(bool)), SLOT(OnDeletePromptReturn(bool))); }
void ChannelEditor::deleteChannels(void) { const QString currentLabel = m_sourceList->GetValue(); bool del_all = m_sourceFilter == FILTER_ALL; bool del_nul = m_sourceFilter == FILTER_UNASSIGNED; QString message = (del_all) ? tr("Delete ALL channels?") : ((del_nul) ? tr("Delete all unassigned channels?") : tr("Delete all channels on %1?").arg(currentLabel)); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); MythConfirmationDialog *dialog = new MythConfirmationDialog(popupStack, message, true); if (dialog->Create()) { dialog->SetReturnEvent(this, "delall"); popupStack->AddScreen(dialog); } else delete dialog; }
/** * \brief Resolve a potential conflict * \return true if the conflict should be bound, false otherwise. */ void MythControls::ResolveConflict(ActionID *conflict, int error_level, const QString &key) { if (!conflict) return; QString label; bool error = (KeyBindings::kKeyBindingError == error_level); if (error) label = tr("This key binding conflicts with %1 in the %2 context. " "Unable to bind key.") .arg(conflict->GetAction()).arg(conflict->GetContext()); else label = tr("This key binding conflicts with %1 in the %2 context. " "Do you want to bind it anyway?") .arg(conflict->GetAction()).arg(conflict->GetContext()); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); MythConfirmationDialog *confirmPopup = new MythConfirmationDialog(popupStack, label, !error); if (!error) { confirmPopup->SetData(qVariantFromValue(key)); confirmPopup->SetReturnEvent(this, "conflict"); } if (confirmPopup->Create()) popupStack->AddScreen(confirmPopup); delete conflict; }
/** * \brief Delete the currently active key to action mapping * * TODO FIXME This code needs work to support deleteKey * in any mode exc. Context/Action */ void MythControls::DeleteKey(void) { QString context = GetCurrentContext(); QString key = GetCurrentKey(); QString action = GetCurrentAction(); if (context.isEmpty() || key.isEmpty() || action.isEmpty()) { LOG(VB_GENERAL, LOG_ERR, "Unable to delete binding, missing information"); return; } if (m_bindings->RemoveActionKey(context, action, key)) { RefreshKeyInformation(); return; } QString label = tr("This action is mandatory and needs at least one key " "bound to it. Instead, try rebinding with another key."); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); MythConfirmationDialog *confirmPopup = new MythConfirmationDialog(popupStack, label, false); if (confirmPopup->Create()) { confirmPopup->SetReturnEvent(this, "mandatorydelete"); popupStack->AddScreen(confirmPopup); } else delete confirmPopup; }
void StatusBox::clicked(MythUIButtonListItem *item) { if (!item) return; LogLine logline = qVariantValue<LogLine>(item->GetData()); MythUIButtonListItem *currentButton = m_categoryList->GetItemCurrent(); QString currentItem; if (currentButton) currentItem = currentButton->GetText(); // FIXME: Comparisons against strings here is not great, changing names // breaks everything and it's inefficient if (currentItem == tr("Log Entries")) { QString message = tr("Acknowledge this log entry?"); MythConfirmationDialog *confirmPopup = new MythConfirmationDialog(m_popupStack, message); confirmPopup->SetReturnEvent(this, "LogAck"); confirmPopup->SetData(logline.data); if (confirmPopup->Create()) m_popupStack->AddScreen(confirmPopup, false); } else if (currentItem == tr("Job Queue")) { QStringList msgs; int jobStatus; jobStatus = JobQueue::GetJobStatus(logline.data.toInt()); if (jobStatus == JOB_QUEUED) { QString message = tr("Delete Job?"); MythConfirmationDialog *confirmPopup = new MythConfirmationDialog(m_popupStack, message); confirmPopup->SetReturnEvent(this, "JobDelete"); confirmPopup->SetData(logline.data); if (confirmPopup->Create()) m_popupStack->AddScreen(confirmPopup, false); } else if ((jobStatus == JOB_PENDING) || (jobStatus == JOB_STARTING) || (jobStatus == JOB_RUNNING) || (jobStatus == JOB_PAUSED)) { QString label = tr("Job Queue Actions:"); MythDialogBox *menuPopup = new MythDialogBox(label, m_popupStack, "statusboxpopup"); if (menuPopup->Create()) m_popupStack->AddScreen(menuPopup, false); menuPopup->SetReturnEvent(this, "JobModify"); QVariant data = qVariantFromValue(logline.data); if (jobStatus == JOB_PAUSED) menuPopup->AddButton(tr("Resume"), data); else menuPopup->AddButton(tr("Pause"), data); menuPopup->AddButton(tr("Stop"), data); menuPopup->AddButton(tr("No Change"), data); } else if (jobStatus & JOB_DONE) { QString message = tr("Requeue Job?"); MythConfirmationDialog *confirmPopup = new MythConfirmationDialog(m_popupStack, message); confirmPopup->SetReturnEvent(this, "JobRequeue"); confirmPopup->SetData(logline.data); if (confirmPopup->Create()) m_popupStack->AddScreen(confirmPopup, false); } } else if (currentItem == tr("AutoExpire List")) { ProgramInfo* rec = m_expList[m_logList->GetCurrentPos()]; if (rec) { QString label = tr("AutoExpire Actions:"); MythDialogBox *menuPopup = new MythDialogBox(label, m_popupStack, "statusboxpopup"); if (menuPopup->Create()) m_popupStack->AddScreen(menuPopup, false); menuPopup->SetReturnEvent(this, "AutoExpireManage"); menuPopup->AddButton(tr("Delete Now"), qVariantFromValue(rec)); if ((rec)->GetRecordingGroup() == "LiveTV") { menuPopup->AddButton(tr("Move to Default group"), qVariantFromValue(rec)); } else if ((rec)->GetRecordingGroup() == "Deleted") menuPopup->AddButton(tr("Undelete"), qVariantFromValue(rec)); else menuPopup->AddButton(tr("Disable AutoExpire"), qVariantFromValue(rec)); menuPopup->AddButton(tr("No Change"), qVariantFromValue(rec)); } } }
void OSD::DialogShow(const QString &window, const QString &text, int updatefor) { if (m_Dialog) { QString current = m_Dialog->objectName(); if (current != window) { DialogQuit(); } else { MythDialogBox *dialog = dynamic_cast<MythDialogBox*>(m_Dialog); if (dialog) dialog->Reset(); DialogSetText(text); } } if (!m_Dialog) { OverrideUIScale(); MythScreenType *dialog; if (window == OSD_DLG_EDITOR) dialog = new ChannelEditor(m_ParentObject, window.toLatin1()); else if (window == OSD_DLG_CONFIRM) dialog = new MythConfirmationDialog(NULL, text, false); else dialog = new MythDialogBox(text, NULL, window.toLatin1(), false, true); dialog->SetPainter(m_CurrentPainter); if (dialog->Create()) { PositionWindow(dialog); m_Dialog = dialog; MythDialogBox *dbox = dynamic_cast<MythDialogBox*>(m_Dialog); if (dbox) dbox->SetReturnEvent(m_ParentObject, window); MythConfirmationDialog *cbox = dynamic_cast<MythConfirmationDialog*>(m_Dialog); if (cbox) { cbox->SetReturnEvent(m_ParentObject, window); cbox->SetData("DIALOG_CONFIRM_X_X"); } m_Children.insert(window, m_Dialog); } else { RevertUIScale(); delete dialog; return; } RevertUIScale(); } if (updatefor) { m_NextPulseUpdate = MythDate::current(); m_PulsedDialogText = text; SetExpiry(window, kOSDTimeout_None, updatefor); } DialogBack(); HideAll(true, m_Dialog); m_Dialog->SetVisible(true); }
void BackendConnectionManager::customEvent(QEvent *event) { bool reconnect = false; uint reconnect_timeout = 5000; if ((MythEvent::Type)(event->type()) == MythEvent::MythEventMessage) { MythEvent *me = (MythEvent *)event; QString message = me->Message(); if (message == "BACKEND_SOCKETS_CLOSED") { if (!m_reconnecting) { reconnect = true; reconnect_timeout = 500; } } else if (message == "RECONNECT_SUCCESS") { delete m_reconnecting; m_reconnecting = NULL; if (m_first_time && !checkTimeZone()) { // Check for different time zones, // different offsets, different times VERBOSE(VB_IMPORTANT, "The time and/or time zone settings on this " "system do not match those in use on the master " "backend. Please ensure all frontend and backend " "systems are configured to use the same time " "zone and have the current time properly set."); VERBOSE(VB_IMPORTANT, "Unable to run with invalid time settings. " "Exiting."); MythScreenStack *popupStack = GetMythMainWindow()-> GetStack("popup stack"); QString message = tr("Your frontend and backend are configured " "in different timezones. You must correct " "this mismatch to continue."); MythConfirmationDialog *error = new MythConfirmationDialog( popupStack, message, false); if (error->Create()) { QObject::connect(error, SIGNAL(haveResult(bool)), qApp, SLOT(quit())); popupStack->AddScreen(error); } else { delete error; delete popupStack; qApp->exit(GENERIC_EXIT_INVALID_TIMEZONE); } } m_first_time = false; } else if (message == "RECONNECT_FAILURE") { delete m_reconnecting; m_reconnecting = NULL; reconnect = true; } } if (reconnect) { if (!m_reconnect_timer) { m_reconnect_timer = new QTimer(this); m_reconnect_timer->setSingleShot(true); connect(m_reconnect_timer, SIGNAL(timeout()), this, SLOT(ReconnectToBackend())); } m_reconnect_timer->start(reconnect_timeout); } }