status_t ThemeInterfaceView::ThemeSelected() { status_t err; ThemeManager* tman = GetThemeManager(); int32 id; ThemeItem *item; BString desc; BBitmap *sshot = NULL; // find selected theme id = fThemeList->CurrentSelection(0); if (id < 0) { fScreenshotPane->ClearViewBitmap(); fScreenshotPane->Invalidate(fScreenshotPane->Bounds()); while(true == fScreenshotText->IsHidden()) fScreenshotText->Show(); fScreenshotText->SetText(B_TRANSLATE("No theme selected")); return ENOENT; } item = dynamic_cast<ThemeItem *>(fThemeList->ItemAt(id)); if (!item) return ENOENT; id = item->ThemeId(); if (id < 0) return ENOENT; // then apply err = tman->ThemeScreenShot(id, &sshot); if (err) sshot = NULL; if (sshot == NULL) { SetScreenshot(NULL); fprintf(stderr, "ThemeManager: no screenshot; error 0x%08lx\n", err); while(true == fScreenshotText->IsHidden()) fScreenshotText->Show(); fScreenshotText->SetText(B_TRANSLATE("No screenshot")); return err; } SetScreenshot(sshot); while(false == fScreenshotText->IsHidden()) fScreenshotText->Hide(); //err = tman->ApplyTheme(theme); return err; }
void EditMetadataDialog::handleDownloadedImages(MetadataLookup *lookup) { if (!lookup) return; if (m_busyPopup) { m_busyPopup->Close(); m_busyPopup = NULL; } VideoArtworkType type = lookup->GetData().value<VideoArtworkType>(); ArtworkMap map = lookup->GetDownloads(); if (map.count() >= 1) { ArtworkInfo info = map.value(type); QString filename = info.url; if (type == kArtworkCoverart) SetCoverArt(filename); else if (type == kArtworkFanart) SetFanart(filename); else if (type == kArtworkBanner) SetBanner(filename); else if (type == kArtworkScreenshot) SetScreenshot(filename); } }
void EditRomInfoDialog::customEvent(QEvent *event) { if (event->type() == DialogCompletionEvent::kEventType) { DialogCompletionEvent *dce = (DialogCompletionEvent*)(event); const QString resultid = dce->GetId(); if (resultid == CEID_FANARTFILE) SetFanart(dce->GetResultText()); else if (resultid == CEID_SCREENSHOTFILE) SetScreenshot(dce->GetResultText()); else if (resultid == CEID_BOXARTFILE) SetBoxart(dce->GetResultText()); } }
void EditMetadataDialog::customEvent(QEvent *levent) { if (levent->type() == DialogCompletionEvent::kEventType) { DialogCompletionEvent *dce = (DialogCompletionEvent*)(levent); const QString resultid = dce->GetId(); if (resultid == CEID_COVERARTFILE) SetCoverArt(dce->GetResultText()); else if (resultid == CEID_BANNERFILE) SetBanner(dce->GetResultText()); else if (resultid == CEID_FANARTFILE) SetFanart(dce->GetResultText()); else if (resultid == CEID_SCREENSHOTFILE) SetScreenshot(dce->GetResultText()); else if (resultid == CEID_TRAILERFILE) SetTrailer(dce->GetResultText()); else if (resultid == CEID_NEWCATEGORY) AddCategory(dce->GetResultText()); } else if (levent->type() == MetadataLookupEvent::kEventType) { MetadataLookupEvent *lue = (MetadataLookupEvent *)levent; MetadataLookupList lul = lue->lookupList; if (lul.isEmpty()) return; // There should really only be one result here. // If not, USER ERROR! if (lul.count() == 1) { OnArtworkSearchDone(lul[0]); } else { if (m_busyPopup) { m_busyPopup->Close(); m_busyPopup = NULL; } } } else if (levent->type() == MetadataLookupFailure::kEventType) { MetadataLookupFailure *luf = (MetadataLookupFailure *)levent; MetadataLookupList lul = luf->lookupList; if (m_busyPopup) { m_busyPopup->Close(); m_busyPopup = NULL; } if (lul.size()) { MetadataLookup *lookup = lul[0]; LOG(VB_GENERAL, LOG_INFO, QString("No results found for %1 %2 %3").arg(lookup->GetTitle()) .arg(lookup->GetSeason()).arg(lookup->GetEpisode())); } } else if (levent->type() == ImageDLEvent::kEventType) { ImageDLEvent *ide = (ImageDLEvent *)levent; MetadataLookup *lookup = ide->item; if (!lookup) return; handleDownloadedImages(lookup); } else if (levent->type() == ImageDLFailureEvent::kEventType) { MythErrorNotification n(tr("Failed to retrieve image"), tr("Metadata Editor"), tr("Check logs")); GetNotificationCenter()->Queue(n); } }