summaryrefslogtreecommitdiff
path: root/harmaccuweather/harmaccuprovider.cpp
blob: 2c26b67a50e8f7ec73aa8cec75386b0f7b6c1155 (plain)
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
#include <QtCore/QtDebug>
#include <QtCore/QTimer>
#include "harmaccuweather.h"
#include "harmaccuprovider.h"

using namespace sowatch;

HarmAccuProvider::HarmAccuProvider(QObject *parent) :
	NotificationProvider(parent)
{
	// Give some time to send the first notification
	QTimer::singleShot(2000, this, SLOT(generateNotification()));
}

HarmAccuProvider::~HarmAccuProvider()
{
}

void HarmAccuProvider::generateNotification()
{
	QSettings* s = HarmAccuWeather::getAccuweatherData();
	if (s->contains("LastUpdate")) {
		qDebug() << "generating harmaccuweather notification";
		emit incomingNotification(new HarmAccuWeather(this));
	} else {
		qWarning() << "Accuweather config file does not seem to exist";
	}
	delete s;
}