void RSSEditor::slotNewSite() { QMutexLocker locker(&m_lock); MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); RSSEditPopup *rsseditpopup = new RSSEditPopup("", false, mainStack, "rsseditpopup"); if (rsseditpopup->Create()) { connect(rsseditpopup, SIGNAL(saving()), this, SLOT(listChanged())); mainStack->AddScreen(rsseditpopup); } else { delete rsseditpopup; } }
/** * \brief Change the view. */ void MythControls::ChangeView(void) { QString label = tr("Change View"); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); m_menuPopup = new MythDialogBox(label, popupStack, "mcviewmenu"); if (m_menuPopup->Create()) popupStack->AddScreen(m_menuPopup); m_menuPopup->SetReturnEvent(this, "view"); m_menuPopup->AddButton(tr("Actions By Context")); m_menuPopup->AddButton(tr("Contexts By Key")); m_menuPopup->AddButton(tr("Keys By Context")); }
static void startRipper(void) { loadMusic(); #if defined HAVE_CDIO MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); Ripper *rip = new Ripper(mainStack, chooseCD()); if (rip->Create()) { mainStack->AddScreen(rip); QObject::connect(rip, SIGNAL(ripFinished()), gMusicData, SLOT(reloadMusic()), Qt::QueuedConnection); } else delete rip; #endif }
void ChannelRecPriority::upcoming() { MythUIButtonListItem *item = m_channelList->GetItemCurrent(); if (!item) return; ChannelInfo *chanInfo = item->GetData().value<ChannelInfo *>(); if (!chanInfo || chanInfo->chanid < 1) return; QString chanID = QString("%1").arg(chanInfo->chanid); MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); ProgLister *pl = new ProgLister(mainStack, plChannel, chanID, ""); if (pl->Create()) mainStack->AddScreen(pl); else delete pl; }
/** * \brief Show the upcoming recordings for this recording rule */ void ScheduleCommon::ShowUpcomingScheduled(ProgramInfo *pginfo) const { if (!pginfo) return; RecordingInfo ri(*pginfo); uint id; if ((id = ri.GetRecordingRuleID()) <= 0) return ShowUpcoming(pginfo->GetTitle(), pginfo->GetSeriesID()); MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); ProgLister *pl = new ProgLister(mainStack, plRecordid, QString::number(id), ""); if (pl->Create()) mainStack->AddScreen(pl); else delete pl; }
void GameHandler::CreateProgress(QString message) { if (m_progressDlg) return; MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); m_progressDlg = new MythUIProgressDialog(message, popupStack, "gameprogress"); if (m_progressDlg->Create()) { popupStack->AddScreen(m_progressDlg, false); } else { delete m_progressDlg; m_progressDlg = NULL; } }
void AudioSetupWizard::slotNext(void) { if (m_testThread) { toggleSpeakers(); } save(); MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); VideoSetupWizard *sw = new VideoSetupWizard(mainStack, m_generalScreen, this, "videosetupwizard"); if (sw->Create()) { mainStack->AddScreen(sw); } else delete sw; }
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); } }
static int RunNetTree(void) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); DialogType type = static_cast<DialogType>(gCoreContext->GetNumSetting( "mythnetvision.ViewMode", DLG_TREE)); NetTree *nettree = new NetTree(type, mainStack, "mythnettree"); if (nettree->Create()) { mainStack->AddScreen(nettree); return 0; } else { delete nettree; return -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; }
/** * \brief Creates a dialog displaying current recording status and options * available */ void ScheduleCommon::ShowNotScheduledDialog(const RecordingInfo& recinfo) { QString message = recinfo.toString(ProgramInfo::kTitleSubtitle, " - "); message += "\n\n"; message += toDescription(recinfo.GetRecordingStatus(), recinfo.GetRecordingRuleType(), recinfo.GetRecordingStartTime()); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); MythDialogBox *menuPopup = new MythDialogBox(message, popupStack, "notSchedOptionPopup", true); if (menuPopup->Create()) { menuPopup->SetReturnEvent(this, "schedulenotscheduled"); QDateTime now = MythDate::current(); if (recinfo.GetRecordingEndTime() > now) menuPopup->AddButton(tr("Record only this showing"), qVariantFromValue(recinfo)); menuPopup->AddButton(tr("Record all showings"), qVariantFromValue(recinfo)); if (!recinfo.IsGeneric()) menuPopup->AddButton(tr("Record one showing of this episode"), qVariantFromValue(recinfo)); menuPopup->AddButton(tr("Record all showings on this channel"), qVariantFromValue(recinfo)); menuPopup->AddButton(tr("Record with more options"), qVariantFromValue(recinfo)); popupStack->AddScreen(menuPopup); } else delete menuPopup; }
/** * 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; 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; }
static int handleMedia(const QString &url, const QString &directory, const QString &filename, const QString &, const QString &, int, int, const QString &, int, const QString &, const QString &, bool) { if (url.isEmpty()) { LOG(VB_GENERAL, LOG_ERR, "MythBrowser: handleMedia got empty url!"); return 1; } QStringList urls = url.split(" ", QString::SkipEmptyParts); float zoom = gCoreContext->GetSetting("WebBrowserZoomLevel", "1.0").toFloat(); MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); if (urls[0].startsWith("mythflash://")) { MythFlashPlayer *flashplayer = new MythFlashPlayer(mainStack, urls); if (flashplayer->Create()) mainStack->AddScreen(flashplayer); else delete flashplayer; } else { MythBrowser *mythbrowser = new MythBrowser(mainStack, urls, zoom); if (!directory.isEmpty()) mythbrowser->setDefaultSaveDirectory(directory); if (!filename.isEmpty()) mythbrowser->setDefaultSaveFilename(filename); if (mythbrowser->Create()) mainStack->AddScreen(mythbrowser); else delete mythbrowser; } return 0; }
void SearchView::ShowMenu(void) { if (GetFocusWidget() == m_tracksList) { QString label = tr("Search Actions"); MythMenu *menu = new MythMenu(label, this, "searchviewmenu"); MythUIButtonListItem *item = m_tracksList->GetItemCurrent(); if (item) { MusicMetadata *mdata = qVariantValue<MusicMetadata*> (item->GetData()); if (mdata) { if (gPlayer->getCurrentPlaylist() && gPlayer->getCurrentPlaylist()->checkTrack(mdata->ID())) menu->AddItem(tr("Remove From Playlist")); else { menu->AddItem(tr("Add To Playlist")); menu->AddItem(tr("Add To Playlist And Play")); } } } if (GetFocusWidget() == m_tracksList || GetFocusWidget() == m_currentPlaylist) menu->AddItem(tr("Search List...")); menu->AddItem(tr("More Options"), NULL, createSubMenu()); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); MythDialogBox *menuPopup = new MythDialogBox(menu, popupStack, "actionmenu"); if (menuPopup->Create()) popupStack->AddScreen(menuPopup); else delete menu; } else MusicCommon::ShowMenu(); }
void GameUI::showInfo() { MythGenericTree *node = m_gameUITree->GetCurrentNode(); if (isLeaf(node)) { RomInfo *romInfo = qVariantValue<RomInfo *>(node->GetData()); if (!romInfo) return; MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); GameDetailsPopup *details_dialog = new GameDetailsPopup(mainStack, romInfo); if (details_dialog->Create()) { mainStack->AddScreen(details_dialog); details_dialog->SetReturnEvent(this, "detailsPopup"); } else delete details_dialog; } }
static void startImport(void) { if (!checkStorageGroup()) return; gMusicData->loadMusic(); MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); ImportMusicDialog *import = new ImportMusicDialog(mainStack); if (import->Create()) { mainStack->AddScreen(import); QObject::connect(import, SIGNAL(importFinished()), gMusicData, SLOT(reloadMusic()), Qt::QueuedConnection); } else delete import; }
void EditAlbumartDialog::startCopyImageToTag(void) { QString lastLocation = gCoreContext->GetSetting("MusicLastImageLocation", "/"); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); MythUIFileBrowser *fb = new MythUIFileBrowser(popupStack, lastLocation); fb->SetTypeFilter(QDir::AllDirs | QDir::Files | QDir::Readable); QStringList filters; filters << "*.png" << "*.jpg" << "*.jpeg" << "*.gif"; fb->SetNameFilter(filters); if (fb->Create()) { fb->SetReturnEvent(this, "imagelocation"); popupStack->AddScreen(fb); } else delete fb; }
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; } }
void ProgLister::ShowSortMenu(void) { MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); MythDialogBox *menuPopup = new MythDialogBox( tr("Sort Options"), popupStack, "menuPopup"); if (!menuPopup->Create()) { delete menuPopup; return; } menuPopup->SetReturnEvent(this, "sortmenu"); menuPopup->AddButton(tr("Reverse Sort Order")); menuPopup->AddButton(tr("Sort By Title")); menuPopup->AddButton(tr("Sort By Time")); menuPopup->AddButton(tr("Cancel")); popupStack->AddScreen(menuPopup); }
void Ripper::ShowMenu() { if (m_tracks->empty()) return; MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); MythDialogBox *menu = new MythDialogBox("", popupStack, "ripmusicmenu"); if (menu->Create()) popupStack->AddScreen(menu); else { delete menu; return; } menu->SetReturnEvent(this, "menu"); menu->AddButton(tr("Select Where To Save Tracks"), SLOT(chooseBackend())); menu->AddButton(tr("Edit Track Metadata"), SLOT(showEditMetadataDialog())); }
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 SelectDestination::handleNextPage() { saveConfiguration(); MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); if (m_nativeMode) { ExportNative *native = new ExportNative(mainStack, this, m_archiveDestination, "ExportNative"); if (native->Create()) mainStack->AddScreen(native); } else { DVDThemeSelector *theme = new DVDThemeSelector(mainStack, this, m_archiveDestination, "ThemeSelector"); if (theme->Create()) mainStack->AddScreen(theme); } }
int mythplugin_run (void) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); try { QDir imageDir(GetConfDir() + "/mythsvtplay/images/"); imageDir.mkpath(imageDir.path()); MainWindow* mainWindow = new MainWindow(mainStack); mainStack->AddScreen(mainWindow); mainWindow->beginProgramDownload(); } catch (...) { return -1; } return 0; }
void Ripper::chooseBackend(void) { QStringList hostList; // get a list of hosts with a directory defined for the 'Music' storage group MSqlQuery query(MSqlQuery::InitCon()); QString sql = "SELECT DISTINCT hostname " "FROM storagegroup " "WHERE groupname = 'Music'"; if (!query.exec(sql) || !query.isActive()) MythDB::DBError("Ripper::chooseBackend get host list", query); else { while(query.next()) { hostList.append(query.value(0).toString()); } } if (hostList.isEmpty()) { LOG(VB_GENERAL, LOG_ERR, "Ripper::chooseBackend: No backends found"); return; } QString msg = tr("Select where to save tracks"); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); MythUISearchDialog *searchDlg = new MythUISearchDialog(popupStack, msg, hostList, false, ""); if (!searchDlg->Create()) { delete searchDlg; return; } connect(searchDlg, SIGNAL(haveResult(QString)), SLOT(setSaveHost(QString))); popupStack->AddScreen(searchDlg); }
void ImportFile::recordFile(void) { MythUIButtonListItem *item = m_recordingButtonList->GetItemCurrent(); if (!item) return; ImportItem *i = item->GetData().value<ImportItem *>(); if (!i) return; if (!doPlayFile(i, false)) return; QString message = tr("Getting List Of Recording.\nPlease Wait..."); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); MythUIBusyDialog *busyPopup = new MythUIBusyDialog(message, popupStack, "recordingbusydialog"); if (busyPopup->Create()) popupStack->AddScreen(busyPopup, false); else { delete busyPopup; busyPopup = NULL; } GetImportRecordingThread *thread = new GetImportRecordingThread(this); while (thread->isRunning()) { qApp->processEvents(); usleep(2000); } if (busyPopup) busyPopup->Close(); }
void EditAlbumartDialog::showTypeMenu(bool changeType) { if (changeType && m_coverartList->GetCount() == 0) return; QString label; if (changeType) label = tr("Change Image Type"); else label = tr("What image type do you want to use for this image?"); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); MythDialogBox *menu = new MythDialogBox(label, popupStack, "typemenu"); if (!menu->Create()) { delete menu; return; } ImageType imageType = IT_UNKNOWN; if (changeType) menu->SetReturnEvent(this, "changetypemenu"); else { menu->SetReturnEvent(this, "asktypemenu"); imageType = AlbumArtImages::guessImageType(m_imageFilename); } menu->AddButton(m_albumArt->getTypeName(IT_UNKNOWN), qVariantFromValue((int)IT_UNKNOWN), false, (imageType == IT_UNKNOWN)); menu->AddButton(m_albumArt->getTypeName(IT_FRONTCOVER), qVariantFromValue((int)IT_FRONTCOVER), false, (imageType == IT_FRONTCOVER)); menu->AddButton(m_albumArt->getTypeName(IT_BACKCOVER), qVariantFromValue((int)IT_BACKCOVER), false, (imageType == IT_BACKCOVER)); menu->AddButton(m_albumArt->getTypeName(IT_CD), qVariantFromValue((int)IT_CD), false, (imageType == IT_CD)); menu->AddButton(m_albumArt->getTypeName(IT_INLAY), qVariantFromValue((int)IT_INLAY), false, (imageType == IT_INLAY)); menu->AddButton(m_albumArt->getTypeName(IT_ARTIST), qVariantFromValue((int)IT_ARTIST), false, (imageType == IT_ARTIST)); popupStack->AddScreen(menu); }
void GameUI::itemClicked(MythUIButtonListItem*) { MythGenericTree *node = m_gameUITree->GetCurrentNode(); if (isLeaf(node)) { RomInfo *romInfo = qVariantValue<RomInfo *>(node->GetData()); if (!romInfo) return; if (romInfo->RomCount() == 1) { GameHandler::Launchgame(romInfo, NULL); } else { //: %1 is the game name QString msg = QString(tr("Choose System for:\n%1")) .arg(node->getString()); MythScreenStack *popupStack = GetMythMainWindow()-> GetStack("popup stack"); MythDialogBox *chooseSystemPopup = new MythDialogBox( msg, popupStack, "chooseSystemPopup"); if (chooseSystemPopup->Create()) { chooseSystemPopup->SetReturnEvent(this, "chooseSystemPopup"); QString all_systems = romInfo->AllSystems(); QStringList players = all_systems.split(","); for (QStringList::Iterator it = players.begin(); it != players.end(); ++it) { chooseSystemPopup->AddButton(*it); } chooseSystemPopup->AddButton(tr("Cancel")); popupStack->AddScreen(chooseSystemPopup); } else delete chooseSystemPopup; } } }
void ImportMusicDialog::showEditMetadataDialog() { if (m_tracks->size() == 0) return; Metadata *editMeta = m_tracks->at(m_currentTrack)->metadata; MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); EditMetadataDialog *editDialog = new EditMetadataDialog(mainStack, editMeta); editDialog->setSaveMetadataOnly(); if (!editDialog->Create()) { delete editDialog; return; } connect(editDialog, SIGNAL(metadataChanged()), this, SLOT(metadataChanged())); mainStack->AddScreen(editDialog); }
void VideoScanner::doScan(const QStringList &dirs) { if (m_scanThread->isRunning()) return; if (gCoreContext->HasGUI()) { MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); MythUIProgressDialog *progressDlg = new MythUIProgressDialog("", popupStack, "videoscanprogressdialog"); if (progressDlg->Create()) { popupStack->AddScreen(progressDlg, false); connect(m_scanThread->qthread(), SIGNAL(finished()), progressDlg, SLOT(Close())); connect(m_scanThread->qthread(), SIGNAL(finished()), SLOT(finishedScan())); } else { delete progressDlg; progressDlg = NULL; } m_scanThread->SetProgressDialog(progressDlg); } QStringList hosts; if (!RemoteGetActiveBackends(&hosts)) { LOG(VB_GENERAL, LOG_WARNING, "Could not retrieve list of " "available backends."); hosts.clear(); } m_scanThread->SetHosts(hosts); m_scanThread->SetDirs(dirs); m_scanThread->start(); }
void MythNews::createProgress(const QString &title) { QMutexLocker locker(&m_lock); if (m_progressPopup) return; QString message = title; MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); m_progressPopup = new MythUIProgressDialog(message, popupStack, "mythnewsprogressdialog"); if (m_progressPopup->Create()) popupStack->AddScreen(m_progressPopup, false); else { delete m_progressPopup; m_progressPopup = NULL; } }