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