void EditStreamMetadata::searchClicked(void ) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); MythScreenType *screen = new SearchStream(mainStack, this); if (screen->Create()) mainStack->AddScreen(screen); else delete screen; }
void BookmarkManager::slotBookmarkClicked(MythUIButtonListItem *item) { if (!item) return; Bookmark *site = qVariantValue<Bookmark*>(item->GetData()); if (!site) return; m_savedBookmark = *site; QString cmd = gCoreContext->GetSetting("WebBrowserCommand", "Internal"); QString zoom = gCoreContext->GetSetting("WebBrowserZoomLevel", "1.0"); QStringList urls; urls.append(site->url); if (cmd.toLower() == "internal") { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); MythScreenType *mythbrowser; if (urls[0].startsWith("mythflash://")) mythbrowser = new MythFlashPlayer(mainStack, urls); else mythbrowser = new MythBrowser(mainStack, urls); if (mythbrowser->Create()) { connect(mythbrowser, SIGNAL(Exiting()), SLOT(slotBrowserClosed())); mainStack->AddScreen(mythbrowser); } else delete mythbrowser; } else { cmd.replace("%ZOOM%", zoom); cmd.replace("%URL%", urls.join(" ")); cmd.replace("&","\\&"); cmd.replace(";","\\;"); GetMythMainWindow()->AllowInput(false); myth_system(cmd, kMSDontDisableDrawing); GetMythMainWindow()->AllowInput(true); // we need to reload the bookmarks incase the user added/deleted // any while in MythBrowser ReloadBookmarks(); } }
void StreamView::editStream(void) { MythUIButtonListItem *item = m_streamList->GetItemCurrent(); if (item) { Metadata *mdata = qVariantValue<Metadata*> (item->GetData()); MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); MythScreenType *screen = new EditStreamMetadata(mainStack, this, mdata); if (screen->Create()) mainStack->AddScreen(screen); else delete screen; } }
void StreamView::customEvent(QEvent *event) { bool handled = true; if (event->type() == MusicPlayerEvent::PlayedTracksChangedEvent) { if (gPlayer->getPlayedTracksList().count()) updateTrackInfo(gPlayer->getCurrentMetadata()); // add the new track to the list if (m_playedTracksList && gPlayer->getPlayedTracksList().count()) { Metadata *mdata = gPlayer->getPlayedTracksList().last(); MythUIButtonListItem *item = new MythUIButtonListItem(m_playedTracksList, "", qVariantFromValue(mdata), 0); MetadataMap metadataMap; mdata->toMap(metadataMap); item->SetTextFromMap(metadataMap); item->SetFontState("normal"); item->DisplayState("default", "playstate"); item->SetImage(mdata->getAlbumArtFile()); m_playedTracksList->SetItemCurrent(item); } } else if (event->type() == MusicPlayerEvent::TrackChangeEvent) { MusicPlayerEvent *mpe = dynamic_cast<MusicPlayerEvent *>(event); if (!mpe) return; int trackNo = mpe->TrackID; if (m_streamList) { if (m_currentTrack >= 0 && m_currentTrack < m_streamList->GetCount()) { MythUIButtonListItem *item = m_streamList->GetItemAt(m_currentTrack); if (item) { item->SetFontState("normal"); item->DisplayState("default", "playstate"); } } if (trackNo >= 0 && trackNo < m_streamList->GetCount()) { if (m_currentTrack == m_streamList->GetCurrentPos()) m_streamList->SetItemCurrent(trackNo); MythUIButtonListItem *item = m_streamList->GetItemAt(trackNo); if (item) { item->SetFontState("running"); item->DisplayState("playing", "playstate"); } } } m_currentTrack = trackNo; updateTrackInfo(gPlayer->getCurrentMetadata()); } else if (event->type() == OutputEvent::Playing) { if (gPlayer->isPlaying()) { if (m_streamList) { MythUIButtonListItem *item = m_streamList->GetItemAt(m_currentTrack); if (item) { item->SetFontState("running"); item->DisplayState("playing", "playstate"); } } } // pass it on to the default handler in MusicCommon handled = false; } else if (event->type() == OutputEvent::Stopped) { if (m_streamList) { MythUIButtonListItem *item = m_streamList->GetItemAt(m_currentTrack); if (item) { item->SetFontState("normal"); item->DisplayState("stopped", "playstate"); } } // pass it on to the default handler in MusicCommon handled = false; } else if (event->type() == OutputEvent::Buffering) { } else if (event->type() == MythEvent::MythEventMessage) { MythEvent *me = (MythEvent *)event; QStringList tokens = me->Message().split(" ", QString::SkipEmptyParts); if (tokens.isEmpty()) return; if (tokens[0] == "DOWNLOAD_FILE") { QStringList args = me->ExtraDataList(); if (tokens[1] == "UPDATE") { } else if (tokens[1] == "FINISHED") { QString url = args[0]; int fileSize = args[2].toInt(); int errorCode = args[4].toInt(); QString filename = args[1]; if ((errorCode != 0) || (fileSize == 0)) LOG(VB_GENERAL, LOG_ERR, QString("StreamView: failed to download radio icon from '%1'").arg(url)); else { for (int x = 0; x < m_streamList->GetCount(); x++) { MythUIButtonListItem *item = m_streamList->GetItemAt(x); Metadata *mdata = qVariantValue<Metadata*> (item->GetData()); if (mdata && mdata->LogoUrl() == url) item->SetImage(filename); } } } } } else if (event->type() == DecoderHandlerEvent::OperationStart) { DecoderHandlerEvent *dhe = dynamic_cast<DecoderHandlerEvent*>(event); if (!dhe) return; if (dhe->getMessage() && m_bufferStatus) { m_bufferStatus->SetText(*dhe->getMessage()); } } else if (event->type() == DecoderHandlerEvent::BufferStatus) { DecoderHandlerEvent *dhe = dynamic_cast<DecoderHandlerEvent*>(event); if (!dhe) return; int available, maxSize; dhe->getBufferStatus(&available, &maxSize); if (m_bufferStatus) { QString status = QString("%1%").arg((int)(100.0 / ((double)maxSize / (double)available))); m_bufferStatus->SetText(status); } if (m_bufferProgress) { m_bufferProgress->SetTotal(maxSize); m_bufferProgress->SetUsed(available); } } else if (event->type() == DecoderHandlerEvent::OperationStop) { if (m_bufferStatus) m_bufferStatus->SetText(""); } else if (event->type() == DialogCompletionEvent::kEventType) { DialogCompletionEvent *dce = static_cast<DialogCompletionEvent*>(event); // make sure the user didn't ESCAPE out of the menu if (dce->GetResult() < 0) return; QString resultid = dce->GetId(); QString resulttext = dce->GetResultText(); if (resultid == "streammenu") { if (resulttext == tr("Add Stream")) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); MythScreenType *screen = new EditStreamMetadata(mainStack, this, NULL); if (screen->Create()) mainStack->AddScreen(screen); else delete screen; } else if (resulttext == tr("Remove Stream")) { removeStream(); } else if (resulttext == tr("Edit Stream")) { editStream(); } } else handled = false; } else handled = false; if (!handled) MusicCommon::customEvent(event); }
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 ProgLister::ShowChooseViewMenu(void) { MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); MythScreenType *screen = NULL; bool connect_string = true; switch (m_type) { case plChannel: case plCategory: case plMovies: case plNewListings: case plStoredSearch: { if (m_viewList.empty()) return; QString msg; switch (m_type) { case plMovies: msg = tr("Select Rating"); break; case plChannel: msg = tr("Select Channel"); break; case plCategory: msg = tr("Select Category"); break; case plNewListings: msg = tr("Select List"); break; case plStoredSearch: msg = QString("%1\n%2") .arg(tr("Select a search stored from")) .arg(tr("Custom Record")); break; } screen = new MythUISearchDialog( popupStack, msg, m_viewTextList, true, ""); break; } case plTitleSearch: case plKeywordSearch: case plPeopleSearch: screen = new PhrasePopup( popupStack, this, m_searchType, m_viewTextList, (m_curView >= 0) ? m_viewList[m_curView] : QString()); break; case plPowerSearch: screen = new PowerSearchPopup( popupStack, this, m_searchType, m_viewTextList, (m_curView >= 0) ? m_viewList[m_curView] : QString()); break; case plTime: screen = new TimePopup(popupStack, this); connect_string = false; break; } if (!screen) return; if (!screen->Create()) { delete screen; return; } if (connect_string) { connect(screen, SIGNAL(haveResult( QString)), this, SLOT( SetViewFromList(QString))); } else { connect(screen, SIGNAL(haveResult( QDateTime)), this, SLOT( SetViewFromTime(QDateTime))); } popupStack->AddScreen(screen); }