MythTV master
metadataimagedownload.h
Go to the documentation of this file.
1#ifndef METADATAIMAGEDOWNLOAD_H
2#define METADATAIMAGEDOWNLOAD_H
3
4#include <QString>
5#include <QStringList>
6#include <QMutex>
7
11
13 QString title;
14 QVariant data;
15 QString url;
16};
17
18class META_PUBLIC ImageDLEvent : public QEvent
19{
20 public:
21 explicit ImageDLEvent(MetadataLookup *lookup) :
22 QEvent(kEventType),
23 m_item(lookup)
24 {
25 if (m_item)
26 {
27 m_item->IncrRef();
28 }
29 }
30 ~ImageDLEvent() override
31 {
32 if (m_item)
33 {
34 m_item->DecrRef();
35 m_item = nullptr;
36 }
37 }
38
39 MetadataLookup *m_item {nullptr};
40
41 static const Type kEventType;
42};
43
44class META_PUBLIC ImageDLFailureEvent : public QEvent
45{
46 public:
48 QEvent(kEventType),
49 m_item(lookup)
50 {
51 if (m_item)
52 {
53 m_item->IncrRef();
54 }
55 }
57 {
58 if (m_item)
59 {
60 m_item->DecrRef();
61 m_item = nullptr;
62 }
63 }
64
65 MetadataLookup *m_item {nullptr};
66
67 static const Type kEventType;
68};
69
70class META_PUBLIC ThumbnailDLEvent : public QEvent
71{
72 public:
74 QEvent(kEventType),
75 m_thumb(data) {}
77 {
78 delete m_thumb;
79 m_thumb = nullptr;
80 }
81
82 ThumbnailData *m_thumb {nullptr};
83
84 static const Type kEventType;
85};
86
88{
89 public:
90
91 explicit MetadataImageDownload(QObject *parent)
92 : MThread("MetadataImageDownload"), m_parent(parent) {}
93 ~MetadataImageDownload() override;
94
95 void addThumb(QString title, QString url, QVariant data);
96 void addDownloads(MetadataLookup *lookup);
97 void cancel();
98
99 protected:
100
101 void run() override; // MThread
102
103 private:
104
105 ThumbnailData* moreThumbs();
106
107 QObject *m_parent;
109 QList<ThumbnailData*> m_thumbnailList;
110 QMutex m_mutex;
111};
112
113META_PUBLIC QString getDownloadFilename(const QString& title, const QString& url);
115 const QString& url);
116
118META_PUBLIC QString getStorageGroupURL(VideoArtworkType type, const QString& host);
119META_PUBLIC QString getLocalStorageGroupPath(VideoArtworkType type, const QString& host);
121
123
124#endif /* METADATAIMAGEDOWNLOAD_H */
static const Type kEventType
~ImageDLEvent() override
ImageDLEvent(MetadataLookup *lookup)
static const Type kEventType
ImageDLFailureEvent(MetadataLookup *lookup)
This is a wrapper around QThread that does several additional things.
Definition: mthread.h:49
MetadataLookupList m_downloadList
QList< ThumbnailData * > m_thumbnailList
MetadataImageDownload(QObject *parent)
ThumbnailDLEvent(ThumbnailData *data)
static const Type kEventType
MetadataType
META_PUBLIC QString getStorageGroupName(VideoArtworkType type)
META_PUBLIC QString getLocalStorageGroupPath(VideoArtworkType type, const QString &host)
META_PUBLIC QString getDownloadFilename(const QString &title, const QString &url)
META_PUBLIC void cleanThumbnailCacheDir(void)
META_PUBLIC QString getLocalWritePath(MetadataType metadatatype, VideoArtworkType type)
META_PUBLIC QString getStorageGroupURL(VideoArtworkType type, const QString &host)
VideoArtworkType
#define META_PUBLIC
Definition: mythmetaexp.h:9
void run(const QString &name, Class *object, void(Class::*fn)())
Definition: mconcurrent.h:137