dbc16f5be981d49875898a7e32011253a38e5d60
[tlb/tlb-podcasts.git] / Show.h
1 #ifndef _SHOW_H_
2 #define _SHOW_H_
3
4 #include <QObject>
5 #include <QQmlEngine>
6 #include <QNetworkAccessManager>
7
8 struct showMetaData {
9 QString normalizedName;
10 QString realName;
11 QString rssDescription;
12 QString language;
13 QString author;
14 int episodeCount;
15 struct {
16 QString title;
17 QUrl url;
18 QUrl link;
19 } image;
20 };
21
22 class Show : public QObject
23 {
24 Q_OBJECT
25 Q_PROPERTY(QString title READ title CONSTANT)
26 Q_PROPERTY(QString description READ description CONSTANT)
27 Q_PROPERTY(QString language READ language CONSTANT)
28 Q_PROPERTY(QString author READ author CONSTANT)
29 Q_PROPERTY(int episodeCount READ episodeCount CONSTANT)
30
31 public:
32 Show(QObject *parent) :
33 Show("INAVLID", "INVALID", "INVALID", "INVALID", -1, parent)
34 {
35
36 }
37 Show(QString p_title,
38 QString p_description,
39 QString p_language,
40 QString p_author,
41 int p_episodeCount,
42 QObject *parent) :
43 QObject(parent),
44 m_title(p_title),
45 m_language(p_language),
46 m_author(p_author),
47 m_episodeCount(p_episodeCount)
48 {
49 // wrap description with <p></p> if it doesn't have it
50
51 if(p_description.contains("<p>")){
52 m_description = p_description;
53 }else{
54 m_description = "<p>" + p_description + "</p>";
55 }
56 }
57 Show(struct showMetaData p_meta, QObject *parent) :
58 Show(p_meta.realName,
59 p_meta.rssDescription,
60 p_meta.language,
61 p_meta.author,
62 p_meta.episodeCount,
63 parent) {}
64 virtual ~Show() {};
65
66 QString title() const {return m_title;}
67 QString description() const {return m_description;}
68 QString language() const {return m_language;}
69 QString author() const {return m_author;}
70 int episodeCount() const {return m_episodeCount;}
71
72 private:
73 QString m_title;
74 QString m_description;
75 QString m_language;
76 QString m_author;
77 int m_episodeCount;
78 };
79
80 #endif // _SHOW_H_