-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtasksloader.cpp
63 lines (51 loc) · 1.27 KB
/
tasksloader.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include "tasksloader.h"
TasksLoader::TasksLoader(QObject *parent)
: QObject{parent}
{
}
QList<QString> TasksLoader::getSuitableTasksWithWeather()
{
QList<QString> tasksToDo;
if (temperature() >= 30)
tasksToDo.append("Bring your fan");
if (weatherStatus().contains("rain")) {
tasksToDo.append("Bring your umbrella");
tasksToDo.append("Bring your raincoat");
}
if (temperature() <= 25)
tasksToDo.append("Wear your sweater");
return tasksToDo;
}
QList<QString> TasksLoader::tasksList() const
{
return m_tasksList;
}
void TasksLoader::setTasksList(QList<QString> newTasksList)
{
if (m_tasksList == newTasksList)
return;
m_tasksList = newTasksList;
emit tasksListChanged();
}
int TasksLoader::temperature() const
{
return m_temperature;
}
void TasksLoader::setTemperature(int newTemperature)
{
if (m_temperature == newTemperature)
return;
m_temperature = newTemperature;
emit temperatureChanged();
}
QString TasksLoader::weatherStatus() const
{
return m_weatherStatus;
}
void TasksLoader::setWeatherStatus(const QString &newWeatherStatus)
{
if (m_weatherStatus == newWeatherStatus)
return;
m_weatherStatus = newWeatherStatus;
emit weatherStatusChanged();
}