From ae37832316d905889c82706b351b3c037c9e1ab6 Mon Sep 17 00:00:00 2001 From: "Javier S. Pedro" Date: Mon, 6 May 2013 23:13:37 +0200 Subject: prepare for weather qml notifications --- libsowatch/weathernotification.h | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'libsowatch/weathernotification.h') 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 -- cgit v1.2.3