blob: 1e9fcdccbe978d3f2b88ac519682856f1f168c62 (
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
46
47
48
49
50
51
52
53
|
#include "testnotification.h"
#include "testweathernotification.h"
#include "testnotificationprovider.h"
using namespace sowatch;
int TestNotificationProvider::_counter = 1;
TestNotificationProvider::TestNotificationProvider(QObject *parent) :
NotificationProvider(parent),
_timer(new QTimer(this))
{
const int initial_delay = 2000;
const int burst_num = 1;
const int burst_delay = 500;
const int extra_delay = 100 * 1000;
QTimer::singleShot(initial_delay, this, SLOT(generateInitialNotification()));
QTimer::singleShot(initial_delay + 100, this, SLOT(generateWeatherNotification()));
for (int i = 0; i < burst_num; i++) {
QTimer::singleShot(initial_delay + burst_delay * (i+1), this, SLOT(generateNotification()));
}
connect(_timer, SIGNAL(timeout()), SLOT(generateNotification()));
_timer->setInterval(extra_delay);
_timer->start();
}
TestNotificationProvider::~TestNotificationProvider()
{
}
void TestNotificationProvider::generateInitialNotification()
{
TestNotification *n = new TestNotification(Notification::MissedCallNotification,
"A friend",
"This is a test email notification");
emit incomingNotification(n);
}
void TestNotificationProvider::generateWeatherNotification()
{
TestWeatherNotification *n = new TestWeatherNotification;
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);
}
|