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
17#include "libmythui/themeinfo.h"
18
19class MythDialogBox;
21class MythUIText;
22class 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 bool keyPressEvent(QKeyEvent *event) override; // MythScreenType
38
39 protected:
40 void customEvent(QEvent *e) override; // MythUIType
41 void Load(void) override; // MythScreenType
42 void Init(void) override; // MythScreenType
43
44 private slots:
47
48 protected slots:
49 void popupClosed(const QString& which, int result);
50 void saveAndReload(void);
51 void toggleFullscreenPreview(void);
52 static void toggleThemeUpdateNotifications(void);
54 void removeTheme(void);
55
56 signals:
57 void themeChanged(void);
58
59 private:
60 bool LoadVersion(const QString &version, QStringList &themesSeen,
61 bool alert_user);
62
63 enum DownloadState : std::uint8_t
64 {
65 dsIdle = 0,
69 };
70
71 ThemeInfo *loadThemeInfo(const QFileInfo &theme);
72 void showPopupMenu(void);
73 void updateProgressBar(int bytesReceived, int bytesTotal);
74 bool removeThemeDir(const QString &dirname);
75
78
83
84 QFileInfoList m_infoList;
87
88 QMap<QString, ThemeInfo*> m_themeNameInfos;
89 QMap<QString, ThemeInfo*> m_themeFileNameInfos;
90 QMap<QString, QString> m_themeStatuses;
94
96};
97
99
100class ThemeUpdateChecker : public QObject
101{
102 Q_OBJECT
103
104 public:
105 ThemeUpdateChecker(void);
106 ~ThemeUpdateChecker(void) override;
107
108 protected slots:
109 void checkForUpdate(void);
110
111 private:
112 QTimer *m_updateTimer {nullptr};
113 QStringList m_mythVersions;
118};
119
120#endif /* THEMECHOOSER_H */
121
122/* vim: set expandtab tabstop=4 shiftwidth=4: */
Basic menu dialog, message and a list of options.
Screen in which all other widgets are contained and rendered.
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
Image widget, displays a single image or multiple images in sequence.
Definition: mythuiimage.h:98
This widget is used for grouping other widgets for display when a particular named state is called.
All purpose text widget, displays a text string.
Definition: mythuitext.h:29
View and select installed themes.
Definition: themechooser.h:28
QFileInfoList m_infoList
Definition: themechooser.h:84
void refreshDownloadableThemes(void)
ThemeInfo * loadThemeInfo(const QFileInfo &theme)
bool removeThemeDir(const QString &dirname)
MythUIImage * m_fullScreenPreview
Definition: themechooser.h:82
bool m_fullPreviewShowing
Definition: themechooser.h:79
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
void itemChanged(MythUIButtonListItem *item)
ThemeInfo * m_downloadTheme
Definition: themechooser.h:91
void removeTheme(void)
void updateProgressBar(int bytesReceived, int bytesTotal)
~ThemeChooser() override
void toggleFullscreenPreview(void)
void popupClosed(const QString &which, int result)
MythUIText * m_fullScreenName
Definition: themechooser.h:81
void saveAndReload(void)
MythUIButtonList * m_themes
Definition: themechooser.h:76
QMap< QString, QString > m_themeStatuses
Definition: themechooser.h:90
QString m_downloadFile
Definition: themechooser.h:92
void Init(void) override
Used after calling Load() to assign data to widgets and other UI initilisation which is prohibited in...
void themeChanged(void)
QMap< QString, ThemeInfo * > m_themeNameInfos
Definition: themechooser.h:88
MythUIImage * m_preview
Definition: themechooser.h:77
bool m_refreshDownloadableThemes
Definition: themechooser.h:85
bool Create(void) override
DownloadState m_downloadState
Definition: themechooser.h:93
QString m_userThemeDir
Definition: themechooser.h:86
void Load(void) override
Load data which will ultimately be displayed on-screen or used to determine what appears on-screen (S...
bool LoadVersion(const QString &version, QStringList &themesSeen, bool alert_user)
static void toggleThemeUpdateNotifications(void)
QMap< QString, ThemeInfo * > m_themeFileNameInfos
Definition: themechooser.h:89
@ dsDownloadingOnFrontend
Definition: themechooser.h:67
@ dsDownloadingOnBackend
Definition: themechooser.h:66
void customEvent(QEvent *e) override
MythDialogBox * m_popupMenu
Definition: themechooser.h:95
void showPopupMenu(void)
ThemeChooser(MythScreenStack *parent, const QString &name="ThemeChooser")
Creates a new ThemeChooser Screen.
MythUIStateType * m_fullPreviewStateType
Definition: themechooser.h:80
QString m_lastKnownThemeVersion
Definition: themechooser.h:115
QString m_currentVersion
Definition: themechooser.h:116
~ThemeUpdateChecker(void) override
QTimer * m_updateTimer
Definition: themechooser.h:112
QStringList m_mythVersions
Definition: themechooser.h:113
void checkForUpdate(void)
string version
Definition: giantbomb.py:185