82 lines
2.2 KiB
C++
82 lines
2.2 KiB
C++
#ifndef WEATHERDETAILSDATA_H
|
|
#define WEATHERDETAILSDATA_H
|
|
|
|
#include <QObject>
|
|
#include "../controller/weathercontroller.h"
|
|
#include "enums/weatherstatus.h"
|
|
#include <QObject>
|
|
|
|
class WeatherDetailsData : public QObject {
|
|
Q_OBJECT
|
|
public:
|
|
enum LIVE_ICON_NAME {
|
|
zonnig,
|
|
bliksem,
|
|
regen,
|
|
buien,
|
|
hagel,
|
|
mist,
|
|
sneeuw,
|
|
bewolkt,
|
|
halfbewolkt,
|
|
zwaarbewolkt,
|
|
lichtbewolkt,
|
|
nachtmist,
|
|
helderenacht,
|
|
wolkennacht
|
|
};
|
|
Q_ENUM(LIVE_ICON_NAME)
|
|
|
|
explicit WeatherDetailsData(QObject *parent = nullptr);
|
|
WeatherDetailsData(std::shared_ptr<WeatherController> &ctrl);
|
|
|
|
Q_PROPERTY(double temperature READ temperature WRITE setTemperature NOTIFY
|
|
temperatureChanged FINAL)
|
|
Q_PROPERTY(double humidity READ humidity WRITE setHumidity NOTIFY
|
|
humidityChanged FINAL)
|
|
Q_PROPERTY(double windSpeed READ windSpeed WRITE setWindSpeed NOTIFY
|
|
windSpeedChanged FINAL)
|
|
Q_PROPERTY(double precipitation READ precipitation WRITE setPrecipitation
|
|
NOTIFY precipitationChanged FINAL)
|
|
Q_PROPERTY(QString weatherStatus READ weatherStatus WRITE setWeatherStatus
|
|
NOTIFY weatherStatusChanged FINAL)
|
|
|
|
QString weatherStatus() const;
|
|
void setWeatherStatus(QString newWeatherStatus);
|
|
|
|
double temperature() const;
|
|
void setTemperature(double newTemperature);
|
|
|
|
double humidity() const;
|
|
void setHumidity(double newHumidity);
|
|
|
|
double windSpeed() const;
|
|
void setWindSpeed(double newWindSpeed);
|
|
|
|
double precipitation() const;
|
|
void setPrecipitation(double newPrecipitation);
|
|
|
|
void populate(double temperature, double humidity, double windSpeed,
|
|
double precipitation, QString weatherStatus);
|
|
Q_INVOKABLE void populate(QGeoCoordinate coord);
|
|
Q_INVOKABLE QString getImgSrc(QString status);
|
|
|
|
signals:
|
|
void weatherStatusChanged();
|
|
void temperatureChanged();
|
|
void humidityChanged();
|
|
void windSpeedChanged();
|
|
void precipitationChanged();
|
|
|
|
private:
|
|
QString m_weatherStatus = "regen";
|
|
double m_temperature = 0.0;
|
|
double m_humidity = 0.0;
|
|
double m_windSpeed = 0.0;
|
|
double m_precipitation = 0.0;
|
|
std::shared_ptr<WeatherController> m_localWeatherCtrl;
|
|
QString verifyForDash(QString data);
|
|
};
|
|
|
|
#endif // WEATHERDETAILSDATA_H
|