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 <mythscreentype.h>
20 
21 #include "mythrssmanager.h"
22 
23 class MythUITextEdit;
24 class MythUIButton;
25 class MythUICheckBox;
26 class RSSSite;
27 
32 {
33  Q_OBJECT
34 
35  public:
43  RSSEditPopup(QString url, bool edit, MythScreenStack *parent,
44  const QString &name = "RSSEditPopup")
45  : MythScreenType(parent, name),
46  m_urlText(std::move(url)), m_editing(edit) {}
47  ~RSSEditPopup() override;
48 
49  bool Create(void) override; // MythScreenType
50  bool keyPressEvent(QKeyEvent *event) override; // MythScreenType
51 
52  private:
53  static QUrl redirectUrl(const QUrl& possibleRedirectUrl,
54  const QUrl& oldRedirectUrl) ;
55 
56  RSSSite *m_site {nullptr};
57  QString m_urlText;
58  bool m_editing;
59 
66 
69 
71 
72  QNetworkAccessManager *m_manager {nullptr};
73  QNetworkReply *m_reply {nullptr};
74 
75  signals:
76  void Saving(void);
77 
78  private slots:
79  void SlotCheckRedirect(QNetworkReply* reply);
80  void ParseAndSave(void);
81  void SlotSave(QNetworkReply *reply);
82  void DoFileBrowser(void);
83  static void SelectImagePopup(const QString &prefix,
84  QObject &inst,
85  const QString &returnEvent);
86  void customEvent(QEvent *levent) override; // MythUIType
87 };
88 
89 class RSSEditor : public MythScreenType
90 {
91  Q_OBJECT
92 
93  public:
94  explicit RSSEditor(MythScreenStack *parent, const QString &name = "RSSEditor")
95  : MythScreenType(parent, name) {}
96  ~RSSEditor() override;
97 
98  bool Create(void) override; // MythScreenType
99  bool keyPressEvent(QKeyEvent *event) override; // MythScreenType
100 
101  private:
102  void fillRSSButtonList();
103 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
104  mutable QMutex m_lock {QMutex::Recursive};
105 #else
106  mutable QRecursiveMutex m_lock;
107 #endif
108  bool m_changed {false};
109 
112  MythUIButton *m_new {nullptr};
113  MythUIButton *m_delete {nullptr};
114  MythUIButton *m_edit {nullptr};
115 
116  MythUIImage *m_image {nullptr};
117  MythUIText *m_title {nullptr};
118  MythUIText *m_url {nullptr};
119  MythUIText *m_desc {nullptr};
120  MythUIText *m_author {nullptr};
121 
122  signals:
123  void ItemsChanged(void);
124 
125  public slots:
126  void SlotItemChanged();
127  void LoadData(void);
128 
129  void SlotDeleteSite(void);
130  void DoDeleteSite(bool remove);
131  void SlotEditSite(void);
132  void SlotNewSite(void);
133  void ListChanged(void);
134 };
135 
136 #endif /* RSSEDITOR_H */
RSSEditor::ItemsChanged
void ItemsChanged(void)
RSSEditPopup::customEvent
void customEvent(QEvent *levent) override
Definition: rsseditor.cpp:289
RSSEditPopup::DoFileBrowser
void DoFileBrowser(void)
Definition: rsseditor.cpp:267
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:117
mythrssmanager.h
RSSEditPopup::Saving
void Saving(void)
RSSEditPopup::Create
bool Create(void) override
Definition: rsseditor.cpp:57
RSSEditor::m_lock
QRecursiveMutex m_lock
Definition: rsseditor.h:106
RSSEditPopup::SelectImagePopup
static void SelectImagePopup(const QString &prefix, QObject &inst, const QString &returnEvent)
Definition: rsseditor.cpp:273
RSSEditPopup::m_thumbButton
MythUIButton * m_thumbButton
Definition: rsseditor.h:61
RSSEditor::SlotItemChanged
void SlotItemChanged()
Definition: rsseditor.cpp:434
RSSEditPopup::SlotCheckRedirect
void SlotCheckRedirect(QNetworkReply *reply)
Definition: rsseditor.cpp:173
RSSEditor::m_image
MythUIImage * m_image
Definition: rsseditor.h:116
MythScreenStack
Definition: mythscreenstack.h:16
MythUITextEdit
A text entry and edit widget.
Definition: mythuitextedit.h:32
RSSEditor::SlotDeleteSite
void SlotDeleteSite(void)
Definition: rsseditor.cpp:462
RSSEditor::m_new
MythUIButton * m_new
Definition: rsseditor.h:112
MythScreenType
Screen in which all other widgets are contained and rendered.
Definition: mythscreentype.h:44
RSSEditPopup::m_descEdit
MythUITextEdit * m_descEdit
Definition: rsseditor.h:64
RSSEditPopup::m_download
MythUICheckBox * m_download
Definition: rsseditor.h:70
hardwareprofile.distros.mythtv_data.data_mythtv.prefix
string prefix
Definition: data_mythtv.py:40
RSSEditPopup::m_cancelButton
MythUIButton * m_cancelButton
Definition: rsseditor.h:68
RSSEditor::m_edit
MythUIButton * m_edit
Definition: rsseditor.h:114
RSSEditor::m_delete
MythUIButton * m_delete
Definition: rsseditor.h:113
RSSEditor::RSSEditor
RSSEditor(MythScreenStack *parent, const QString &name="RSSEditor")
Definition: rsseditor.h:94
RSSEditPopup::m_manager
QNetworkAccessManager * m_manager
Definition: rsseditor.h:72
RSSEditPopup::~RSSEditPopup
~RSSEditPopup() override
Definition: rsseditor.cpp:47
RSSEditPopup::SlotSave
void SlotSave(QNetworkReply *reply)
Definition: rsseditor.cpp:195
RSSEditPopup::m_editing
bool m_editing
Definition: rsseditor.h:58
RSSEditPopup
Site name, URL and icon edit screen.
Definition: rsseditor.h:31
MythUIButton
A single button widget.
Definition: mythuibutton.h:21
RSSEditor::SlotNewSite
void SlotNewSite(void)
Definition: rsseditor.cpp:508
RSSEditPopup::m_titleEdit
MythUITextEdit * m_titleEdit
Definition: rsseditor.h:63
RSSEditor::Create
bool Create(void) override
Definition: rsseditor.cpp:311
RSSEditor::m_desc
MythUIText * m_desc
Definition: rsseditor.h:119
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:60
RSSEditor::m_changed
bool m_changed
Definition: rsseditor.h:108
RSSEditPopup::m_urlEdit
MythUITextEdit * m_urlEdit
Definition: rsseditor.h:62
RSSEditPopup::redirectUrl
static QUrl redirectUrl(const QUrl &possibleRedirectUrl, const QUrl &oldRedirectUrl)
Definition: rsseditor.cpp:164
RSSEditPopup::ParseAndSave
void ParseAndSave(void)
Definition: rsseditor.cpp:132
RSSEditor::m_url
MythUIText * m_url
Definition: rsseditor.h:118
RSSEditor::ListChanged
void ListChanged(void)
Definition: rsseditor.cpp:539
RSSEditor::keyPressEvent
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
Definition: rsseditor.cpp:383
MythUIText
All purpose text widget, displays a text string.
Definition: mythuitext.h:30
RSSEditor
Definition: rsseditor.h:89
RSSEditor::fillRSSButtonList
void fillRSSButtonList()
Definition: rsseditor.cpp:416
RSSEditPopup::m_site
RSSSite * m_site
Definition: rsseditor.h:56
RSSEditPopup::m_okButton
MythUIButton * m_okButton
Definition: rsseditor.h:67
RSSEditor::m_title
MythUIText * m_title
Definition: rsseditor.h:117
std
Definition: mythchrono.h:23
RSSEditor::LoadData
void LoadData(void)
Definition: rsseditor.cpp:364
RSSEditor::m_sites
MythUIButtonList * m_sites
Definition: rsseditor.h:111
RSSEditor::SlotEditSite
void SlotEditSite(void)
Definition: rsseditor.cpp:485
RSSEditPopup::RSSEditPopup
RSSEditPopup(QString url, bool edit, MythScreenStack *parent, const QString &name="RSSEditPopup")
Creates a new RSS Edit Popup.
Definition: rsseditor.h:43
RSSEditor::m_author
MythUIText * m_author
Definition: rsseditor.h:120
RSSEditPopup::m_urlText
QString m_urlText
Definition: rsseditor.h:57
RSSEditor::~RSSEditor
~RSSEditor() override
Definition: rsseditor.cpp:303
RSSEditPopup::m_reply
QNetworkReply * m_reply
Definition: rsseditor.h:73
RSSEditPopup::m_authorEdit
MythUITextEdit * m_authorEdit
Definition: rsseditor.h:65
RSSEditor::m_siteList
RSSSite::rssList m_siteList
Definition: rsseditor.h:110
MythUIButtonList
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
Definition: mythuibuttonlist.h:177
RSSSite
Definition: mythrssmanager.h:24
mythscreentype.h
RSSSite::rssList
QList< RSSSite * > rssList
Definition: mythrssmanager.h:56
RSSEditor::DoDeleteSite
void DoDeleteSite(bool remove)
Definition: rsseditor.cpp:526