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 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);
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
61 enum DownloadState : std::uint8_t
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
76
81
82 QFileInfoList m_infoList;
85
86 QMap<QString, ThemeInfo*> m_themeNameInfos;
87 QMap<QString, ThemeInfo*> m_themeFileNameInfos;
88 QMap<QString, QString> m_themeStatuses;
92
94};
95
97
98class 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;
116};
117
118#endif /* THEMECHOOSER_H */
119
120/* 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:82
void refreshDownloadableThemes(void)
ThemeInfo * loadThemeInfo(const QFileInfo &theme)
bool removeThemeDir(const QString &dirname)
MythUIImage * m_fullScreenPreview
Definition: themechooser.h:80
bool m_fullPreviewShowing
Definition: themechooser.h:77
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
void itemChanged(MythUIButtonListItem *item)
ThemeInfo * m_downloadTheme
Definition: themechooser.h:89
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:79
void saveAndReload(void)
MythUIButtonList * m_themes
Definition: themechooser.h:74
QMap< QString, QString > m_themeStatuses
Definition: themechooser.h:88
QString m_downloadFile
Definition: themechooser.h:90
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:86
MythUIImage * m_preview
Definition: themechooser.h:75
bool m_refreshDownloadableThemes
Definition: themechooser.h:83
bool Create(void) override
DownloadState m_downloadState
Definition: themechooser.h:91
QString m_userThemeDir
Definition: themechooser.h:84
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:87
@ dsDownloadingOnFrontend
Definition: themechooser.h:65
@ dsDownloadingOnBackend
Definition: themechooser.h:64
void customEvent(QEvent *e) override
MythDialogBox * m_popupMenu
Definition: themechooser.h:93
void showPopupMenu(void)
ThemeChooser(MythScreenStack *parent, const QString &name="ThemeChooser")
Creates a new ThemeChooser Screen.
MythUIStateType * m_fullPreviewStateType
Definition: themechooser.h:78
QString m_lastKnownThemeVersion
Definition: themechooser.h:113
QString m_currentVersion
Definition: themechooser.h:114
~ThemeUpdateChecker(void) override
QTimer * m_updateTimer
Definition: themechooser.h:110
QStringList m_mythVersions
Definition: themechooser.h:111
void checkForUpdate(void)
string version
Definition: giantbomb.py:185