Go to the documentation of this file.
5 #include <QImageReader>
40 m_origMetadata(source_metadata),
80 LOG(VB_GENERAL, LOG_ERR,
"Cannot load screen 'edit_metadata'");
204 template <
typename T>
207 bool operator()(
const T &lhs,
const T &rhs)
213 QStringList GetSupportedImageExtensionFilter()
217 QList<QByteArray> exts = QImageReader::supportedImageFormats();
218 for (
const auto & ext : qAsConst(exts))
219 ret.append(QString(
"*.").append(ext));
223 void FindImagePopup(
const QString &
prefix,
const QString &prefixAlt,
224 QObject &inst,
const QString &returnEvent)
228 if (
prefix.startsWith(
"myth://"))
237 fb->SetNameFilter(GetSupportedImageExtensionFilter());
240 fb->SetReturnEvent(&inst, returnEvent);
247 void FindVideoFilePopup(
const QString &
prefix,
const QString &prefixAlt,
248 QObject &inst,
const QString &returnEvent)
252 if (
prefix.startsWith(
"myth://"))
263 for (
const auto & fa : fa_list)
264 exts << QString(
"*.%1").arg(fa.extension.toUpper());
267 fb->SetNameFilter(exts);
270 fb->SetReturnEvent(&inst, returnEvent);
277 const QString CEID_COVERARTFILE =
"coverartfile";
278 const QString CEID_BANNERFILE =
"bannerfile";
279 const QString CEID_FANARTFILE =
"fanartfile";
280 const QString CEID_SCREENSHOTFILE =
"screenshotfile";
281 const QString CEID_TRAILERFILE =
"trailerfile";
282 const QString CEID_NEWCATEGORY =
"newcategory";
290 const QString& message = title;
293 "mythvideobusydialog");
329 for (
const auto & vc : vcl)
334 button->SetData(vc.first);
344 tr(
"Level %1").arg(i.GetLevel()));
345 button->SetData(i.GetLevel());
360 using title_list = std::vector<std::pair<unsigned int, QString> >;
363 tc.reserve(mdl.size());
364 for (
const auto & md : mdl)
367 if (md->GetSeason() > 0 || md->GetEpisode() > 0)
369 title = QString(
"%1 %2x%3").arg(md->GetTitle(),
370 QString::number(md->GetSeason()),
371 QString::number(md->GetEpisode()));
375 title = md->GetTitle();
377 tc.emplace_back(md->GetID(), title);
379 std::sort(tc.begin(), tc.end(), title_sort<title_list::value_type>());
381 for (
const auto &
t : tc)
386 button->SetData(
t.first);
493 QString message = tr(
"Enter new category");
499 if (categorydialog->Create())
501 categorydialog->SetReturnEvent(
this, CEID_NEWCATEGORY);
630 FindImagePopup(url,
"", *
this, CEID_COVERARTFILE);
635 GetConfDir() +
"/MythVideo", *
this, CEID_COVERARTFILE);
664 if (resultsdialog->Create())
670 QString msg = tr(
"Downloading selected artwork...");
678 lookup->SetAutomatic(
true);
679 lookup->SetData(QVariant::fromValue<VideoArtworkType>(
type));
682 downloads.insert(
type, info);
683 lookup->SetDownloads(downloads);
684 lookup->SetAllowOverwrites(
true);
708 if (map.count() >= 1)
726 QString msg = tr(
"Searching for available artwork...");
732 lookup->SetAutomatic(
true);
740 lookup->SetData(QVariant::fromValue<VideoArtworkType>(
type));
776 QString origfile =
file;
778 if (
file.startsWith(
"myth://"))
783 if (!
file.endsWith(
"/"))
807 FindImagePopup(url,
"", *
this, CEID_BANNERFILE);
812 GetConfDir() +
"/MythVideo/Banners", *
this, CEID_BANNERFILE);
821 QString origfile =
file;
823 if (
file.startsWith(
"myth://"))
828 if (!
file.endsWith(
"/"))
852 FindImagePopup(url,
"", *
this, CEID_FANARTFILE);
857 GetConfDir() +
"/MythVideo/Fanart", *
this, CEID_FANARTFILE);
866 QString origfile =
file;
868 if (
file.startsWith(
"myth://"))
873 if (!
file.endsWith(
"/"))
897 FindImagePopup(url,
"", *
this, CEID_SCREENSHOTFILE);
903 *
this, CEID_SCREENSHOTFILE);
912 QString origfile =
file;
914 if (
file.startsWith(
"myth://"))
919 if (!
file.endsWith(
"/"))
943 FindVideoFilePopup(url,
"", *
this, CEID_TRAILERFILE);
948 GetConfDir() +
"/MythVideo/Trailers", *
this, CEID_TRAILERFILE);
957 if (
file.startsWith(
"myth://"))
962 if (!
file.endsWith(
"/"))
978 const QString resultid = dce->GetId();
980 if (resultid == CEID_COVERARTFILE)
982 else if (resultid == CEID_BANNERFILE)
984 else if (resultid == CEID_FANARTFILE)
986 else if (resultid == CEID_SCREENSHOTFILE)
988 else if (resultid == CEID_TRAILERFILE)
990 else if (resultid == CEID_NEWCATEGORY)
1004 if (lul.count() == 1)
1032 LOG(VB_GENERAL, LOG_INFO,
1033 QString(
"No results found for %1 %2 %3").arg(lookup->
GetTitle())
1051 tr(
"Metadata Editor"),
QString generate_file_url(const QString &storage_group, const QString &host, const QString &path)
void SetMaxLength(int length)
int add(const QString &name)
bool naturalSortCompare(const QString &a, const QString &b, Qt::CaseSensitivity caseSensitivity=Qt::CaseSensitive)
naturalCompare as a std::sort compatible function (ignoring the third parameter, which is never used)...
bool Load(bool allowLoadInBackground=true, bool forceStat=false)
Load the image(s), wraps ImageLoader::LoadImage()
bool Create(void) override
bool GetBooleanCheckState(void) const
void CheckedSet(MythUIStateType *uiItem, const QString &value)
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
const association_list & getList() const
Screen in which all other widgets are contained and rendered.
QString GetText(void) const
void SetRange(int low, int high, int step, uint pageMultiple=5)
Set the lower and upper bounds of the spinbox, the interval and page amount.
const QString VIDEO_CATEGORY_UNKNOWN
void SetValue(int val) override
void SetText(const QString &text, bool moveCursor=true)
std::vector< file_association > association_list
std::enable_if< std::chrono::__is_duration< T >::value, T >::type GetDuration()
int GetIntValue(void) const override
void BuildFocusList(void)
static VideoCategory & GetCategory()
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
static bool Assign(ContainerType *container, UIType *&item, const QString &name, bool *err=nullptr)
static FileAssociations & getFileAssociation()
const entry_list & getList()
void SetCheckState(MythUIStateType::StateType state)
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
void haveResult(ArtworkInfo, VideoArtworkType)
Event dispatched from MythUI modal dialogs to a listening class containing a result of some form.
virtual void SetText(const QString &text)
MythNotificationCenter * GetNotificationCenter(void)
MythMainWindow * GetMythMainWindow(void)
MythScreenStack * GetStack(const QString &Stackname)
std::vector< entry > entry_list
Dialog prompting the user to enter a text string.
void SetFilename(const QString &filename)
Must be followed by a call to Load() to load the image.
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
QString GetSetting(const QString &key, const QString &defaultval="")
bool Queue(const MythNotification ¬ification)
Queue a notification Queue() is thread-safe and can be called from anywhere.