summaryrefslogtreecommitdiff
path: root/testnotification/testnotificationprovider.cpp
blob: 230237f6fdc9f1002e8d5ea135bc36cd9942537a (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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "testnotification.h"
#include "testnotificationprovider.h"

using namespace sowatch;

int TestNotificationProvider::_counter = 1;

TestNotificationProvider::TestNotificationProvider(QObject *parent) :
    NotificationProvider(parent),
    _timer(new QTimer(this))
{
	QTimer::singleShot(1000, this, SLOT(generateInitialNotification()));
	QTimer::singleShot(1200, this, SLOT(generateNotification()));
	QTimer::singleShot(1400, this, SLOT(generateNotification()));
	QTimer::singleShot(1600, this, SLOT(generateNotification()));
	QTimer::singleShot(1800, this, SLOT(generateNotification()));
	QTimer::singleShot(2000, this, SLOT(generateNotification()));
	QTimer::singleShot(2200, this, SLOT(generateNotification()));
	QTimer::singleShot(2400, this, SLOT(generateInitialNotification()));
	connect(_timer, SIGNAL(timeout()), SLOT(generateNotification()));
	_timer->setInterval(60000);
	//_timer->start();
}

TestNotificationProvider::~TestNotificationProvider()
{
}

void TestNotificationProvider::generateInitialNotification()
{
	TestNotification *n = new TestNotification(Notification::EmailNotification,
	                                           "A friend",
	                                           "This is a test email notification");
	emit incomingNotification(n);
}

void TestNotificationProvider::generateNotification()
{
	TestNotification *n = new TestNotification(Notification::ImNotification,
	                                           QString("Friend %1").arg(_counter++),
	                                           "Lorem ipsum dolor sit amet. "
	                                           "Consectetur adipiscing elit. "
	                                           "Donec non congue augue.");
	emit incomingNotification(n);
}