diff options
author | Javier S. Pedro <maemo@javispedro.com> | 2013-05-06 23:13:37 +0200 |
---|---|---|
committer | Javier S. Pedro <maemo@javispedro.com> | 2013-05-06 23:13:37 +0200 |
commit | ae37832316d905889c82706b351b3c037c9e1ab6 (patch) | |
tree | d90c4a18729937b782f557e170cf95d4ef38f031 /libsowatch/weathernotification.h | |
parent | d83093df7602aa2896de71292b47948540c22a44 (diff) | |
download | sowatch-ae37832316d905889c82706b351b3c037c9e1ab6.tar.gz sowatch-ae37832316d905889c82706b351b3c037c9e1ab6.zip |
prepare for weather qml notifications
Diffstat (limited to 'libsowatch/weathernotification.h')
-rw-r--r-- | libsowatch/weathernotification.h | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/libsowatch/weathernotification.h b/libsowatch/weathernotification.h index 843a844..5fe4697 100644 --- a/libsowatch/weathernotification.h +++ b/libsowatch/weathernotification.h @@ -9,6 +9,11 @@ namespace sowatch class WeatherNotification : public Notification { Q_OBJECT + Q_ENUMS(WeatherType Unit) + Q_PROPERTY(WeatherType forecast READ forecast NOTIFY forecastChanged) + Q_PROPERTY(int temperature READ temperature NOTIFY temperatureChanged) + Q_PROPERTY(Unit temperatureUnits READ temperatureUnits NOTIFY temperatureUnitsChanged) + public: explicit WeatherNotification(QObject *parent = 0); @@ -29,17 +34,27 @@ public: Fahrenheit }; - virtual WeatherType forecast() = 0; - virtual int temperature() = 0; - virtual Unit temperatureUnits() = 0; + Priority priority() const; + + virtual WeatherType forecast() const = 0; + virtual int temperature() const = 0; + virtual Unit temperatureUnits() const = 0; + +signals: + void forecastChanged(); + void temperatureChanged(); + void temperatureUnitsChanged(); - /** Quite useful helper function. */ +protected: + /** Useful helper functions. */ static qreal convertTemperature(qreal temp, Unit from, Unit to); static int convertTemperature(int temp, Unit from, Unit to); }; - - } +QML_DECLARE_TYPE(sowatch::WeatherNotification) +QML_DECLARE_TYPE(sowatch::WeatherNotification::WeatherType) +QML_DECLARE_TYPE(sowatch::WeatherNotification::Unit) + #endif // WEATHERNOTIFICATION_H |