MythTV  master
rsseditor.h
Go to the documentation of this file.
1 #ifndef RSSEDITOR_H
2 #define RSSEDITOR_H
3 
4 #include <utility>
5 
6 // Qt headers
7 #include <QDomDocument>
8 #include <QMutex>
9 #include <QNetworkAccessManager>
10 #include <QNetworkReply>
11 #include <QNetworkRequest>
12 #include <QString>
13 
14 // MythTV headers
15 #include <mythscreentype.h>
16 
17 #include "mythrssmanager.h"
18 
19 class MythUITextEdit;
20 class MythUIButton;
21 class MythUICheckBox;
22 class RSSSite;
23 
28 {
29  Q_OBJECT
30 
31  public:
39  RSSEditPopup(QString url, bool edit, MythScreenStack *parent,
40  const QString &name = "RSSEditPopup")
41  : MythScreenType(parent, name),
42  m_urlText(std::move(url)), m_editing(edit) {}
43  ~RSSEditPopup() override;
44 
45  bool Create(void) override; // MythScreenType
46  bool keyPressEvent(QKeyEvent *event) override; // MythScreenType
47 
48  private:
49  static QUrl redirectUrl(const QUrl& possibleRedirectUrl,
50  const QUrl& oldRedirectUrl) ;
51 
52  RSSSite *m_site {nullptr};
53  QString m_urlText;
54  bool m_editing;
55 
62 
65 
67 
68  QNetworkAccessManager *m_manager {nullptr};
69  QNetworkReply *m_reply {nullptr};
70 
71  signals:
72  void Saving(void);
73 
74  private slots:
75  void SlotCheckRedirect(QNetworkReply* reply);
76  void ParseAndSave(void);
77  void SlotSave(QNetworkReply *reply);
78  void DoFileBrowser(void);
79  static void SelectImagePopup(const QString &prefix,
80  QObject &inst,
81  const QString &returnEvent);
82  void customEvent(QEvent *levent) override; // MythUIType
83 };
84 
85 class RSSEditor : public MythScreenType
86 {
87  Q_OBJECT
88 
89  public:
90  explicit RSSEditor(MythScreenStack *parent, const QString &name = "RSSEditor")
91  : MythScreenType(parent, name) {}
92  ~RSSEditor() override;
93 
94  bool Create(void) override; // MythScreenType
95  bool keyPressEvent(QKeyEvent *event) override; // MythScreenType
96 
97  private:
98  void fillRSSButtonList();
99  mutable QMutex m_lock {QMutex::Recursive};
100  bool m_changed {false};
101 
104  MythUIButton *m_new {nullptr};
105  MythUIButton *m_delete {nullptr};
106  MythUIButton *m_edit {nullptr};
107 
108  MythUIImage *m_image {nullptr};
109  MythUIText *m_title {nullptr};
110  MythUIText *m_url {nullptr};
111  MythUIText *m_desc {nullptr};
112  MythUIText *m_author {nullptr};
113 
114  signals:
115  void ItemsChanged(void);
116 
117  public slots:
118  void SlotItemChanged();
119  void LoadData(void);
120 
121  void SlotDeleteSite(void);
122  void DoDeleteSite(bool remove);
123  void SlotEditSite(void);
124  void SlotNewSite(void);
125  void ListChanged(void);
126 };
127 
128 #endif /* RSSEDITOR_H */
QNetworkReply * m_reply
Definition: rsseditor.h:69
MythUITextEdit * m_authorEdit
Definition: rsseditor.h:61
unsigned int slots[4]
Definition: element.c:38
bool Create(void) override
Definition: rsseditor.cpp:312
void ItemsChanged(void)
MythUITextEdit * m_descEdit
Definition: rsseditor.h:60
void SlotNewSite(void)
Definition: rsseditor.cpp:509
All purpose text widget, displays a text string.
Definition: mythuitext.h:28
MythUICheckBox * m_download
Definition: rsseditor.h:66
A checkbox widget supporting three check states - on,off,half and two conditions - selected and unsel...
void LoadData(void)
Definition: rsseditor.cpp:365
void ListChanged(void)
Definition: rsseditor.cpp:540
Image widget, displays a single image or multiple images in sequence.
Definition: mythuiimage.h:97
void SlotDeleteSite(void)
Definition: rsseditor.cpp:463
~RSSEditPopup() override
Definition: rsseditor.cpp:47
void SlotItemChanged()
Definition: rsseditor.cpp:435
QMutex m_lock
Definition: rsseditor.h:99
void fillRSSButtonList()
Definition: rsseditor.cpp:417
void SlotSave(QNetworkReply *reply)
Definition: rsseditor.cpp:195
void Saving(void)
void DoFileBrowser(void)
Definition: rsseditor.cpp:268
void SlotEditSite(void)
Definition: rsseditor.cpp:486
void DoDeleteSite(bool remove)
Definition: rsseditor.cpp:527
~RSSEditor() override
Definition: rsseditor.cpp:304
void SlotCheckRedirect(QNetworkReply *reply)
Definition: rsseditor.cpp:173
static QUrl redirectUrl(const QUrl &possibleRedirectUrl, const QUrl &oldRedirectUrl)
Definition: rsseditor.cpp:164
void ParseAndSave(void)
Definition: rsseditor.cpp:132
A text entry and edit widget.
MythUIButton * m_okButton
Definition: rsseditor.h:63
MythUIText * m_desc
Definition: rsseditor.h:111
MythUIButton * m_cancelButton
Definition: rsseditor.h:64
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
Site name, URL and icon edit screen.
Definition: rsseditor.h:27
QNetworkAccessManager * m_manager
Definition: rsseditor.h:68
bool m_editing
Definition: rsseditor.h:54
A single button widget.
Definition: mythuibutton.h:21
MythUIButton * m_new
Definition: rsseditor.h:104
RSSEditPopup(QString url, bool edit, MythScreenStack *parent, const QString &name="RSSEditPopup")
Creates a new RSS Edit Popup.
Definition: rsseditor.h:39
QList< RSSSite * > rssList
QString m_urlText
Definition: rsseditor.h:53
MythUIImage * m_image
Definition: rsseditor.h:108
bool m_changed
Definition: rsseditor.h:100
MythUIText * m_url
Definition: rsseditor.h:110
MythUIText * m_title
Definition: rsseditor.h:109
MythUITextEdit * m_titleEdit
Definition: rsseditor.h:59
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
Definition: rsseditor.cpp:384
RSSEditor(MythScreenStack *parent, const QString &name="RSSEditor")
Definition: rsseditor.h:90
MythUITextEdit * m_urlEdit
Definition: rsseditor.h:58
MythUIImage * m_thumbImage
Definition: rsseditor.h:56
MythUIButtonList * m_sites
Definition: rsseditor.h:103
MythUIButton * m_delete
Definition: rsseditor.h:105
MythUIText * m_author
Definition: rsseditor.h:112
MythUIButton * m_edit
Definition: rsseditor.h:106
Screen in which all other widgets are contained and rendered.
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
Definition: rsseditor.cpp:117
void customEvent(QEvent *levent) override
Definition: rsseditor.cpp:290
RSSSite::rssList m_siteList
Definition: rsseditor.h:102
RSSSite * m_site
Definition: rsseditor.h:52
bool Create(void) override
Definition: rsseditor.cpp:57
static void SelectImagePopup(const QString &prefix, QObject &inst, const QString &returnEvent)
Definition: rsseditor.cpp:274
MythUIButton * m_thumbButton
Definition: rsseditor.h:57