00001 #ifndef __THEMECHOOSER_H__ 00002 #define __THEMECHOOSER_H__ 00003 00004 // Qt headers 00005 #include <QString> 00006 #include <QList> 00007 #include <QDir> 00008 #include <QFileInfo> 00009 #include <QTimer> 00010 #include <QObject> 00011 00012 // MythTV headers 00013 #include "mythdialogbox.h" 00014 #include "mythdirs.h" 00015 #include "mythscreenstack.h" 00016 #include "mythscreentype.h" 00017 #include "themeinfo.h" 00018 00019 class MythDialogBox; 00020 class MythUIButtonList; 00021 class MythUIText; 00022 class MythUIStateType; 00023 00027 class ThemeChooser : public MythScreenType 00028 { 00029 Q_OBJECT 00030 00031 public: 00032 ThemeChooser(MythScreenStack *parent, 00033 const QString name = "ThemeChooser"); 00034 ~ThemeChooser(); 00035 00036 bool Create(void); 00037 void Load(void); 00038 void Init(void); 00039 bool keyPressEvent(QKeyEvent*); 00040 void customEvent(QEvent *e); 00041 00042 private slots: 00043 void itemChanged(MythUIButtonListItem *item); 00044 void saveAndReload(MythUIButtonListItem *item); 00045 00046 protected slots: 00047 void popupClosed(QString which, int result); 00048 void saveAndReload(void); 00049 void toggleFullscreenPreview(void); 00050 void toggleThemeUpdateNotifications(void); 00051 void refreshDownloadableThemes(void); 00052 void removeTheme(void); 00053 00054 signals: 00055 void themeChanged(void); 00056 00057 private: 00058 enum DownloadState 00059 { 00060 dsIdle = 0, 00061 dsDownloadingOnBackend, 00062 dsDownloadingOnFrontend, 00063 dsExtractingTheme 00064 }; 00065 00066 ThemeInfo *loadThemeInfo(QFileInfo &theme); 00067 void showPopupMenu(void); 00068 void updateProgressBar(int bytesReceived, int bytesTotal); 00069 void removeThemeDir(const QString &dirname); 00070 00071 MythUIButtonList *m_themes; 00072 MythUIImage *m_preview; 00073 00074 bool m_fullPreviewShowing; 00075 MythUIStateType *m_fullPreviewStateType; 00076 MythUIText *m_fullScreenName; 00077 MythUIImage *m_fullScreenPreview; 00078 00079 QFileInfoList m_infoList; 00080 bool m_refreshDownloadableThemes; 00081 QString m_userThemeDir; 00082 00083 QMap<QString, ThemeInfo*> m_themeNameInfos; 00084 QMap<QString, ThemeInfo*> m_themeFileNameInfos; 00085 QMap<QString, QString> m_themeStatuses; 00086 ThemeInfo *m_downloadTheme; 00087 QString m_downloadFile; 00088 DownloadState m_downloadState; 00089 00090 MythDialogBox *m_popupMenu; 00091 }; 00092 00094 00095 class ThemeUpdateChecker : public QObject 00096 { 00097 Q_OBJECT 00098 00099 public: 00100 ThemeUpdateChecker(); 00101 ~ThemeUpdateChecker(); 00102 00103 protected slots: 00104 void checkForUpdate(void); 00105 00106 private: 00107 QTimer *m_updateTimer; 00108 QString m_mythVersion; 00109 QString m_infoPackage; 00110 QString m_lastKnownThemeVersion; 00111 QString m_currentVersion; 00112 QString m_newVersion; 00113 }; 00114 00115 #endif /* THEMECHOOSER */ 00116 00117 /* vim: set expandtab tabstop=4 shiftwidth=4: */
1.6.3