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 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
9 #include <QMutex>
10 #else
11 #include <QRecursiveMutex>
12 #endif
13 #include <QNetworkAccessManager>
14 #include <QNetworkReply>
15 #include <QNetworkRequest>
16 #include <QString>
17 
18 // MythTV headers
19 #include <libmythbase/rssmanager.h>
21 
22 class MythUITextEdit;
23 class MythUIButton;
24 class MythUICheckBox;
25 class RSSSite;
26 
31 {
32  Q_OBJECT
33 
34  public:
42  RSSEditPopup(QString url, bool edit, MythScreenStack *parent,
43  const QString &name = "RSSEditPopup")
44  : MythScreenType(parent, name),
45  m_urlText(std::move(url)), m_editing(edit) {}
46  ~RSSEditPopup() override;
47 
48  bool Create(void) override; // MythScreenType
49  bool keyPressEvent(QKeyEvent *event) override; // MythScreenType
50 
51  private:
52  static QUrl redirectUrl(const QUrl& possibleRedirectUrl,
53  const QUrl& oldRedirectUrl) ;
54 
55  RSSSite *m_site {nullptr};
56  QString m_urlText;
57  bool m_editing;
58 
65 
68 
70 
71  QNetworkAccessManager *m_manager {nullptr};
72  QNetworkReply *m_reply {nullptr};
73 
74  signals:
75  void Saving(void);
76 
77  private slots:
78  void SlotCheckRedirect(QNetworkReply* reply);
79  void ParseAndSave(void);
80  void SlotSave(QNetworkReply *reply);
81  void DoFileBrowser(void);
82  static void SelectImagePopup(const QString &prefix,
83  QObject &inst,
84  const QString &returnEvent);
85  void customEvent(QEvent *levent) override; // MythUIType
86 };
87 
88 class RSSEditor : public MythScreenType
89 {
90  Q_OBJECT
91 
92  public:
93  explicit RSSEditor(MythScreenStack *parent, const QString &name = "RSSEditor")
94  : MythScreenType(parent, name) {}
95  ~RSSEditor() override;
96 
97  bool Create(void) override; // MythScreenType
98  bool keyPressEvent(QKeyEvent *event) override; // MythScreenType
99 
100  private:
101  void fillRSSButtonList();
102 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
103  mutable QMutex m_lock {QMutex::Recursive};
104 #else
105  mutable QRecursiveMutex m_lock;
106 #endif
107  bool m_changed {false};
108 
111  MythUIButton *m_new {nullptr};
112  MythUIButton *m_delete {nullptr};
113  MythUIButton *m_edit {nullptr};
114 
115  MythUIImage *m_image {nullptr};
116  MythUIText *m_title {nullptr};
117  MythUIText *m_url {nullptr};
118  MythUIText *m_desc {nullptr};
119  MythUIText *m_author {nullptr};
120 
121  signals:
122  void ItemsChanged(void);
123 
124  public slots:
125  void SlotItemChanged();
126  void LoadData(void);
127 
128  void SlotDeleteSite(void);
129  void DoDeleteSite(bool remove);
130  void SlotEditSite(void);
131  void SlotNewSite(void);
132  void ListChanged(void);
133 };
134 
135 #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:105
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:60
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:115
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:111
MythScreenType
Screen in which all other widgets are contained and rendered.
Definition: mythscreentype.h:45
RSSEditPopup::m_descEdit
MythUITextEdit * m_descEdit
Definition: rsseditor.h:63
RSSEditPopup::m_download
MythUICheckBox * m_download
Definition: rsseditor.h:69
hardwareprofile.distros.mythtv_data.data_mythtv.prefix
string prefix
Definition: data_mythtv.py:40
RSSEditPopup::m_cancelButton
MythUIButton * m_cancelButton
Definition: rsseditor.h:67
RSSEditor::m_edit
MythUIButton * m_edit
Definition: rsseditor.h:113
RSSEditor::m_delete
MythUIButton * m_delete
Definition: rsseditor.h:112
RSSEditor::RSSEditor
RSSEditor(MythScreenStack *parent, const QString &name="RSSEditor")
Definition: rsseditor.h:93
RSSEditPopup::m_manager
QNetworkAccessManager * m_manager
Definition: rsseditor.h:71
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:57
RSSEditPopup
Site name, URL and icon edit screen.
Definition: rsseditor.h:30
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:62
RSSEditor::Create
bool Create(void) override
Definition: rsseditor.cpp:312
RSSEditor::m_desc
MythUIText * m_desc
Definition: rsseditor.h:118
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:59
RSSEditor::m_changed
bool m_changed
Definition: rsseditor.h:107
RSSEditPopup::m_urlEdit
MythUITextEdit * m_urlEdit
Definition: rsseditor.h:61
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:117
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:88
RSSEditor::fillRSSButtonList
void fillRSSButtonList()
Definition: rsseditor.cpp:417
RSSEditPopup::m_site
RSSSite * m_site
Definition: rsseditor.h:55
RSSEditPopup::m_okButton
MythUIButton * m_okButton
Definition: rsseditor.h:66
RSSEditor::m_title
MythUIText * m_title
Definition: rsseditor.h:116
std
Definition: mythchrono.h:23
RSSEditor::LoadData
void LoadData(void)
Definition: rsseditor.cpp:365
RSSEditor::m_sites
MythUIButtonList * m_sites
Definition: rsseditor.h:110
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:42
RSSEditor::m_author
MythUIText * m_author
Definition: rsseditor.h:119
RSSEditPopup::m_urlText
QString m_urlText
Definition: rsseditor.h:56
RSSEditor::~RSSEditor
~RSSEditor() override
Definition: rsseditor.cpp:304
RSSEditPopup::m_reply
QNetworkReply * m_reply
Definition: rsseditor.h:72
RSSEditPopup::m_authorEdit
MythUITextEdit * m_authorEdit
Definition: rsseditor.h:64
RSSEditor::m_siteList
RSSSite::rssList m_siteList
Definition: rsseditor.h:109
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:25
mythscreentype.h
RSSSite::rssList
QList< RSSSite * > rssList
Definition: rssmanager.h:57
RSSEditor::DoDeleteSite
void DoDeleteSite(bool remove)
Definition: rsseditor.cpp:527