MythTV  master
mythnews.h
Go to the documentation of this file.
1 #ifndef MYTHNEWS_H
2 #define MYTHNEWS_H
3 
4 // MythTV headers
6 
7 // MythNews headers
8 #include "newssite.h"
9 
10 class QTimer;
11 class HttpComms;
12 class MythUIText;
13 class MythUIImage;
14 class MythDialogBox;
15 class MythUIButtonList;
17 
21 class MythNews : public MythScreenType
22 {
23  Q_OBJECT
24 
25  public:
26  MythNews(MythScreenStack *parent, const QString &name);
27  ~MythNews() override;
28 
29  bool Create(void) override; // MythScreenType
30  bool keyPressEvent(QKeyEvent *event) override; // MythScreenType
31  void customEvent(QEvent *event) override; // MythUIType
32 
33  private:
34  void updateInfoView(void);
35  void clearSites(void);
36  void cancelRetrieve(void);
37  void processAndShowNews(NewsSite *site);
38  static QString cleanText(const QString &text);
39 
40  static void playVideo(const NewsArticle &article);
41 
42  // menu stuff
43  void ShowMenu(void) override; // MythScreenType
44  void deleteNewsSite(void);
45  void ShowEditDialog(bool edit);
46  void ShowFeedManager() const;
47 
48 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
49  mutable QMutex m_lock {QMutex::Recursive};
50 #else
51  mutable QRecursiveMutex m_lock;
52 #endif
54 
55  QTimer *m_retrieveTimer {nullptr};
56  std::chrono::minutes m_timerTimeout {10min};
57  std::chrono::minutes m_updateFreq {30min};
58 
59  QString m_zoom {"1.0"};
60  QString m_browser;
62 
65  QMap<MythUIButtonListItem*,NewsArticle> m_articles;
66 
69  MythUIText *m_titleText {nullptr};
70  MythUIText *m_descText {nullptr};
71 
76 
77  private slots:
78  void loadSites(void);
79  void updateInfoView(MythUIButtonListItem *selected);
80  void slotViewArticle(MythUIButtonListItem *articlesListItem);
81  void slotRetrieveNews(void);
82  void slotNewsRetrieved(NewsSite *site);
84 };
85 
86 #endif /* MYTHNEWS_H */
MythNews::ShowMenu
void ShowMenu(void) override
Definition: mythnews.cpp:587
MythNews::m_updatedText
MythUIText * m_updatedText
Definition: mythnews.h:68
MythNews::m_newsSites
NewsSite::List m_newsSites
Definition: mythnews.h:53
MythNews::cleanText
static QString cleanText(const QString &text)
Definition: mythnews.cpp:671
MythUIImage
Image widget, displays a single image or multiple images in sequence.
Definition: mythuiimage.h:97
MythNews::m_nositesText
MythUIText * m_nositesText
Definition: mythnews.h:67
MythNews::slotNewsRetrieved
void slotNewsRetrieved(NewsSite *site)
Definition: mythnews.cpp:410
MythNews::m_menuPopup
MythDialogBox * m_menuPopup
Definition: mythnews.h:61
MythNews::processAndShowNews
void processAndShowNews(NewsSite *site)
Definition: mythnews.cpp:436
MythNews::slotRetrieveNews
void slotRetrieveNews(void)
Definition: mythnews.cpp:388
MythNews::customEvent
void customEvent(QEvent *event) override
Definition: mythnews.cpp:644
MythScreenStack
Definition: mythscreenstack.h:16
MythNews::keyPressEvent
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
Definition: mythnews.cpp:355
MythNews::loadSites
void loadSites(void)
Definition: mythnews.cpp:152
MythNews
Plugin for browsing RSS news feeds.
Definition: mythnews.h:21
MythScreenType
Screen in which all other widgets are contained and rendered.
Definition: mythscreentype.h:45
MythNews::m_articles
QMap< MythUIButtonListItem *, NewsArticle > m_articles
Definition: mythnews.h:65
MythNews::slotViewArticle
void slotViewArticle(MythUIButtonListItem *articlesListItem)
Definition: mythnews.cpp:494
MythNews::MythNews
MythNews(MythScreenStack *parent, const QString &name)
Creates a new MythNews Screen.
Definition: mythnews.cpp:42
MythUIButtonListItem
Definition: mythuibuttonlist.h:41
MythNews::m_browser
QString m_browser
Definition: mythnews.h:60
MythNews::m_downloadImage
MythUIImage * m_downloadImage
Definition: mythnews.h:73
MythNews::ShowFeedManager
void ShowFeedManager() const
Definition: mythnews.cpp:572
MythNews::m_zoom
QString m_zoom
Definition: mythnews.h:59
NewsArticle
Definition: newsarticle.h:10
MythDialogBox
Basic menu dialog, message and a list of options.
Definition: mythdialogbox.h:166
MythNews::playVideo
static void playVideo(const NewsArticle &article)
Definition: mythnews.cpp:637
MythNews::m_lock
QRecursiveMutex m_lock
Definition: mythnews.h:51
MythNews::deleteNewsSite
void deleteNewsSite(void)
Definition: mythnews.cpp:619
MythNews::updateInfoView
void updateInfoView(void)
MythNews::cancelRetrieve
void cancelRetrieve(void)
Definition: mythnews.cpp:425
NewsSite
Definition: newssite.h:54
MythNews::m_podcastImage
MythUIImage * m_podcastImage
Definition: mythnews.h:75
MythNews::m_titleText
MythUIText * m_titleText
Definition: mythnews.h:69
MythNews::m_articlesList
MythUIButtonList * m_articlesList
Definition: mythnews.h:64
MythNews::slotSiteSelected
void slotSiteSelected(MythUIButtonListItem *item)
Definition: mythnews.cpp:470
newssite.h
MythNews::ShowEditDialog
void ShowEditDialog(bool edit)
Definition: mythnews.cpp:542
MythNews::m_retrieveTimer
QTimer * m_retrieveTimer
Definition: mythnews.h:55
NewsSite::List
Definition: newssite.h:67
MythUIText
All purpose text widget, displays a text string.
Definition: mythuitext.h:28
MythNews::m_descText
MythUIText * m_descText
Definition: mythnews.h:70
MythNews::m_thumbnailImage
MythUIImage * m_thumbnailImage
Definition: mythnews.h:72
MythNews::Create
bool Create(void) override
Definition: mythnews.cpp:74
MythNews::m_updateFreq
std::chrono::minutes m_updateFreq
Definition: mythnews.h:57
MythNews::~MythNews
~MythNews() override
Definition: mythnews.cpp:69
MythNews::m_timerTimeout
std::chrono::minutes m_timerTimeout
Definition: mythnews.h:56
MythNews::m_sitesList
MythUIButtonList * m_sitesList
Definition: mythnews.h:63
MythUIButtonList
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
Definition: mythuibuttonlist.h:191
MythNews::m_enclosureImage
MythUIImage * m_enclosureImage
Definition: mythnews.h:74
mythscreentype.h
MythNews::clearSites
void clearSites(void)
Definition: mythnews.cpp:126