MythTV  master
themechooser.h
Go to the documentation of this file.
1 #ifndef __THEMECHOOSER_H__
2 #define __THEMECHOOSER_H__
3 
4 // Qt headers
5 #include <QString>
6 #include <QList>
7 #include <QDir>
8 #include <QFileInfo>
9 #include <QTimer>
10 #include <QObject>
11 
12 // MythTV headers
13 #include "mythdialogbox.h"
14 #include "mythdirs.h"
15 #include "mythscreenstack.h"
16 #include "mythscreentype.h"
17 #include "themeinfo.h"
18 
19 class MythDialogBox;
20 class MythUIButtonList;
21 class MythUIText;
22 class MythUIStateType;
23 
28 {
29  Q_OBJECT
30 
31  public:
32  explicit ThemeChooser(MythScreenStack *parent,
33  const QString &name = "ThemeChooser");
34  ~ThemeChooser() override;
35 
36  bool Create(void) override; // MythScreenType
37  void Load(void) override; // MythScreenType
38  void Init(void) override; // MythScreenType
39  bool keyPressEvent(QKeyEvent *event) override; // MythScreenType
40  void customEvent(QEvent *e) override; // MythUIType
41 
42  private slots:
45 
46  protected slots:
47  void popupClosed(const QString& which, int result);
48  void saveAndReload(void);
49  void toggleFullscreenPreview(void);
50  static void toggleThemeUpdateNotifications(void);
51  void refreshDownloadableThemes(void);
52  void removeTheme(void);
53 
54  signals:
55  void themeChanged(void);
56 
57  private:
58  void LoadVersion(const QString &version, QStringList &themesSeen,
59  bool alert_user);
60 
62  {
63  dsIdle = 0,
67  };
68 
69  ThemeInfo *loadThemeInfo(const QFileInfo &theme);
70  void showPopupMenu(void);
71  void updateProgressBar(int bytesReceived, int bytesTotal);
72  bool removeThemeDir(const QString &dirname);
73 
75  MythUIImage *m_preview {nullptr};
76 
77  bool m_fullPreviewShowing {false};
81 
82  QFileInfoList m_infoList;
84  QString m_userThemeDir;
85 
86  QMap<QString, ThemeInfo*> m_themeNameInfos;
87  QMap<QString, ThemeInfo*> m_themeFileNameInfos;
88  QMap<QString, QString> m_themeStatuses;
90  QString m_downloadFile;
92 
94 };
95 
97 
98 class ThemeUpdateChecker : public QObject
99 {
100  Q_OBJECT
101 
102  public:
103  ThemeUpdateChecker(void);
104  ~ThemeUpdateChecker(void) override;
105 
106  protected slots:
107  void checkForUpdate(void);
108 
109  private:
110  QTimer *m_updateTimer {nullptr};
111  QStringList m_mythVersions;
112  QString m_infoPackage;
115  QString m_newVersion;
116 };
117 
118 #endif /* THEMECHOOSER */
119 
120 /* vim: set expandtab tabstop=4 shiftwidth=4: */
This widget is used for grouping other widgets for display when a particular named state is called.
bool removeThemeDir(const QString &dirname)
unsigned int slots[4]
Definition: element.c:38
void updateProgressBar(int bytesReceived, int bytesTotal)
ThemeChooser(MythScreenStack *parent, const QString &name="ThemeChooser")
Creates a new ThemeChooser Screen.
All purpose text widget, displays a text string.
Definition: mythuitext.h:28
Image widget, displays a single image or multiple images in sequence.
Definition: mythuiimage.h:97
Basic menu dialog, message and a list of options.
QString m_userThemeDir
Definition: themechooser.h:84
void removeTheme(void)
QString m_lastKnownThemeVersion
Definition: themechooser.h:113
void popupClosed(const QString &which, int result)
QMap< QString, ThemeInfo * > m_themeFileNameInfos
Definition: themechooser.h:87
DownloadState m_downloadState
Definition: themechooser.h:91
void itemChanged(MythUIButtonListItem *item)
QString m_currentVersion
Definition: themechooser.h:114
bool m_fullPreviewShowing
Definition: themechooser.h:77
ThemeInfo * loadThemeInfo(const QFileInfo &theme)
void checkForUpdate(void)
~ThemeChooser() override
void showPopupMenu(void)
void customEvent(QEvent *e) override
~ThemeUpdateChecker(void) override
void Init(void) override
Used after calling Load() to assign data to widgets and other UI initilisation which is prohibited in...
View and select installed themes.
Definition: themechooser.h:27
MythUIImage * m_fullScreenPreview
Definition: themechooser.h:80
void refreshDownloadableThemes(void)
void themeChanged(void)
bool m_refreshDownloadableThemes
Definition: themechooser.h:83
void LoadVersion(const QString &version, QStringList &themesSeen, bool alert_user)
MythDialogBox * m_popupMenu
Definition: themechooser.h:93
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
MythUIImage * m_preview
Definition: themechooser.h:75
void toggleFullscreenPreview(void)
QMap< QString, ThemeInfo * > m_themeNameInfos
Definition: themechooser.h:86
QMap< QString, QString > m_themeStatuses
Definition: themechooser.h:88
ThemeInfo * m_downloadTheme
Definition: themechooser.h:89
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
QFileInfoList m_infoList
Definition: themechooser.h:82
QString m_downloadFile
Definition: themechooser.h:90
bool Create(void) override
static void toggleThemeUpdateNotifications(void)
void saveAndReload(void)
QTimer * m_updateTimer
Definition: themechooser.h:110
MythUIButtonList * m_themes
Definition: themechooser.h:74
Screen in which all other widgets are contained and rendered.
QStringList m_mythVersions
Definition: themechooser.h:111
void Load(void) override
Load data which will ultimately be displayed on-screen or used to determine what appears on-screen (S...
MythUIText * m_fullScreenName
Definition: themechooser.h:79
MythUIStateType * m_fullPreviewStateType
Definition: themechooser.h:78