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 "libmythbase/mythdirs.h"
17 #include "libmythui/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  bool 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_H */
119 
120 /* vim: set expandtab tabstop=4 shiftwidth=4: */
ThemeChooser::m_themeNameInfos
QMap< QString, ThemeInfo * > m_themeNameInfos
Definition: themechooser.h:86
ThemeUpdateChecker::m_lastKnownThemeVersion
QString m_lastKnownThemeVersion
Definition: themechooser.h:113
ThemeChooser
View and select installed themes.
Definition: themechooser.h:27
ThemeChooser::m_themes
MythUIButtonList * m_themes
Definition: themechooser.h:74
MythUIImage
Image widget, displays a single image or multiple images in sequence.
Definition: mythuiimage.h:97
mythscreenstack.h
ThemeChooser::customEvent
void customEvent(QEvent *e) override
Definition: themechooser.cpp:811
mythdialogbox.h
MythScreenStack
Definition: mythscreenstack.h:16
ThemeUpdateChecker
Definition: themechooser.h:98
ThemeChooser::m_popupMenu
MythDialogBox * m_popupMenu
Definition: themechooser.h:93
ThemeChooser::refreshDownloadableThemes
void refreshDownloadableThemes(void)
Definition: themechooser.cpp:667
ThemeChooser::m_refreshDownloadableThemes
bool m_refreshDownloadableThemes
Definition: themechooser.h:83
MythScreenType
Screen in which all other widgets are contained and rendered.
Definition: mythscreentype.h:45
ThemeUpdateChecker::m_newVersion
QString m_newVersion
Definition: themechooser.h:115
mythdirs.h
ThemeChooser::popupClosed
void popupClosed(const QString &which, int result)
Definition: themechooser.cpp:584
ThemeUpdateChecker::m_updateTimer
QTimer * m_updateTimer
Definition: themechooser.h:110
ThemeChooser::updateProgressBar
void updateProgressBar(int bytesReceived, int bytesTotal)
Definition: themechooser.cpp:798
ThemeUpdateChecker::m_mythVersions
QStringList m_mythVersions
Definition: themechooser.h:111
ThemeChooser::ThemeChooser
ThemeChooser(MythScreenStack *parent, const QString &name="ThemeChooser")
Creates a new ThemeChooser Screen.
Definition: themechooser.cpp:75
ThemeChooser::LoadVersion
bool LoadVersion(const QString &version, QStringList &themesSeen, bool alert_user)
Definition: themechooser.cpp:238
MythUIButtonListItem
Definition: mythuibuttonlist.h:41
ThemeChooser::showPopupMenu
void showPopupMenu(void)
Definition: themechooser.cpp:515
themeinfo.h
ThemeChooser::Create
bool Create(void) override
Definition: themechooser.cpp:94
MythDialogBox
Basic menu dialog, message and a list of options.
Definition: mythdialogbox.h:166
ThemeChooser::loadThemeInfo
ThemeInfo * loadThemeInfo(const QFileInfo &theme)
Definition: themechooser.cpp:489
ThemeChooser::m_downloadTheme
ThemeInfo * m_downloadTheme
Definition: themechooser.h:89
ThemeUpdateChecker::checkForUpdate
void checkForUpdate(void)
Definition: themechooser.cpp:1067
ThemeChooser::Load
void Load(void) override
Load data which will ultimately be displayed on-screen or used to determine what appears on-screen (S...
Definition: themechooser.cpp:137
ThemeChooser::DownloadState
DownloadState
Definition: themechooser.h:61
ThemeChooser::dsDownloadingOnFrontend
@ dsDownloadingOnFrontend
Definition: themechooser.h:65
ThemeInfo
Definition: themeinfo.h:20
ThemeChooser::dsExtractingTheme
@ dsExtractingTheme
Definition: themechooser.h:66
ThemeChooser::saveAndReload
void saveAndReload(void)
Definition: themechooser.cpp:675
ThemeChooser::m_userThemeDir
QString m_userThemeDir
Definition: themechooser.h:84
ThemeUpdateChecker::~ThemeUpdateChecker
~ThemeUpdateChecker(void) override
Definition: themechooser.cpp:1057
ThemeChooser::toggleFullscreenPreview
void toggleFullscreenPreview(void)
Definition: themechooser.cpp:622
ThemeUpdateChecker::ThemeUpdateChecker
ThemeUpdateChecker(void)
Definition: themechooser.cpp:1008
MythUIText
All purpose text widget, displays a text string.
Definition: mythuitext.h:28
ThemeChooser::m_fullPreviewShowing
bool m_fullPreviewShowing
Definition: themechooser.h:77
ThemeChooser::m_downloadState
DownloadState m_downloadState
Definition: themechooser.h:91
ThemeChooser::m_themeStatuses
QMap< QString, QString > m_themeStatuses
Definition: themechooser.h:88
ThemeChooser::dsDownloadingOnBackend
@ dsDownloadingOnBackend
Definition: themechooser.h:64
ThemeChooser::m_themeFileNameInfos
QMap< QString, ThemeInfo * > m_themeFileNameInfos
Definition: themechooser.h:87
ThemeUpdateChecker::m_currentVersion
QString m_currentVersion
Definition: themechooser.h:114
ThemeChooser::m_fullScreenName
MythUIText * m_fullScreenName
Definition: themechooser.h:79
ThemeChooser::m_fullScreenPreview
MythUIImage * m_fullScreenPreview
Definition: themechooser.h:80
ThemeChooser::toggleThemeUpdateNotifications
static void toggleThemeUpdateNotifications(void)
Definition: themechooser.cpp:659
ThemeChooser::m_fullPreviewStateType
MythUIStateType * m_fullPreviewStateType
Definition: themechooser.h:78
ThemeUpdateChecker::m_infoPackage
QString m_infoPackage
Definition: themechooser.h:112
ThemeChooser::keyPressEvent
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
Definition: themechooser.cpp:590
ThemeChooser::~ThemeChooser
~ThemeChooser() override
Definition: themechooser.cpp:84
ThemeChooser::themeChanged
void themeChanged(void)
ThemeChooser::m_downloadFile
QString m_downloadFile
Definition: themechooser.h:90
MythUIButtonList
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
Definition: mythuibuttonlist.h:191
ThemeChooser::m_infoList
QFileInfoList m_infoList
Definition: themechooser.h:82
ThemeChooser::Init
void Init(void) override
Used after calling Load() to assign data to widgets and other UI initilisation which is prohibited in...
Definition: themechooser.cpp:418
ThemeChooser::dsIdle
@ dsIdle
Definition: themechooser.h:63
nv_python_libs.bbciplayer.bbciplayer_api.version
string version
Definition: bbciplayer_api.py:77
ThemeChooser::removeTheme
void removeTheme(void)
Definition: themechooser.cpp:946
ThemeChooser::m_preview
MythUIImage * m_preview
Definition: themechooser.h:75
MythUIStateType
This widget is used for grouping other widgets for display when a particular named state is called....
Definition: mythuistatetype.h:22
mythscreentype.h
ThemeChooser::removeThemeDir
bool removeThemeDir(const QString &dirname)
Definition: themechooser.cpp:975
ThemeChooser::itemChanged
void itemChanged(MythUIButtonListItem *item)
Definition: themechooser.cpp:744