00001 #ifndef _WEATHERSCREEN_H_
00002 #define _WEATHERSCREEN_H_
00003
00004
00005 #include <QStringList>
00006 #include <QMap>
00007
00008
00009 #include <mythscreentype.h>
00010 #include <mythuitext.h>
00011 #include <mythuiimage.h>
00012
00013
00014 #include "weatherUtils.h"
00015
00016 class Weather;
00017
00018 enum DaysOfWeek {
00019 DAY_SUNDAY, DAY_MONDAY, DAY_TUESDAY, DAY_WENDESDAY, DAY_THURSDAY,
00020 DAY_FRIDAY, DAY_SATURDAY
00021 };
00022
00026 class WeatherScreen : public MythScreenType
00027 {
00028 Q_OBJECT
00029
00030 public:
00031 WeatherScreen(MythScreenStack *parent, ScreenListInfo *screenDefn, int id);
00032 ~WeatherScreen();
00033
00034 bool Create(void);
00035 bool keyPressEvent(QKeyEvent *);
00036
00037 static WeatherScreen *loadScreen(MythScreenStack *parent,
00038 ScreenListInfo *screenDefn, int id);
00039
00040 void setValue(const QString &key, const QString &value);
00041 QString getValue(const QString &key) { return m_dataValueMap[key]; }
00042 bool containsKey(const QString &key) { return m_dataValueMap.contains(key); }
00043 virtual bool canShowScreen();
00044 void setUnits(units_t units) { m_units = units; }
00045 units_t getUnits() { return m_units; }
00046 virtual bool usingKeys() { return false; }
00047 bool inUse() { return m_inuse; }
00048 void setInUse(bool inuse) { m_inuse = inuse; }
00049 int getId() { return m_id; }
00050
00051 signals:
00052 void screenReady(WeatherScreen *);
00053
00054 public slots:
00055 virtual void newData(QString loc, units_t units, DataMap data);
00056
00057 protected:
00058 units_t m_units;
00059 ScreenListInfo *m_screenDefn;
00060 QString m_name;
00061
00062 protected:
00063 virtual QString prepareDataItem(const QString &key, const QString &value);
00064 virtual void prepareWidget(MythUIType *widget);
00065 virtual bool prepareScreen(bool checkOnly = false);
00066 virtual QString getTemperatureUnit();
00067 QString formatDataItem(const QString &key, const QString &value);
00068
00069 private:
00070 QMap<QString, QString> m_dataValueMap;
00071
00072 bool m_inuse;
00073 bool m_prepared;
00074 int m_id;
00075 };
00076
00077 #endif