2
* Copyright (C) 2013 Canonical, Ltd.
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; version 3.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
* Author: Pete Woods <pete.woods@canonical.com>
19
#include "../InfographicModelPrivate.h"
24
void InfographicModelPrivate::generateFakeData()
26
std::default_random_engine generator;
27
std::normal_distribution<qreal> distribution(0.5, 0.2);
28
auto rand = std::bind(distribution, generator);
30
QVector<QColor> colours;
31
colours.push_back(QColor::fromRgbF(0.3, 0.27, 0.32));
32
colours.push_back(QColor::fromRgbF(0.83, 0.49, 0.58));
33
colours.push_back(QColor::fromRgbF(0.63, 0.51, 0.59));
35
colours.push_back(QColor::fromRgbF(0.28, 0.26, 0.4));
36
colours.push_back(QColor::fromRgbF(0.47, 0.38, 0.56));
37
colours.push_back(QColor::fromRgbF(0.69, 0.65, 0.78));
39
colours.push_back(QColor::fromRgbF(0.32, 0.21, 0.16));
40
colours.push_back(QColor::fromRgbF(0.55, 0.45, 0.32));
41
colours.push_back(QColor::fromRgbF(0.85, 0.74, 0.53));
43
colours.push_back(QColor::fromRgbF(0.25, 0.31, 0.19));
44
colours.push_back(QColor::fromRgbF(0.63, 0.53, 0.3));
45
colours.push_back(QColor::fromRgbF(0.89, 0.56, 0.31));
47
InfographicColorTheme first(colours[0], colours[1], colours[2]);
48
InfographicColorTheme second(colours[3], colours[4], colours[5]);
49
InfographicColorTheme eighth(colours[6], colours[7], colours[8]);
50
InfographicColorTheme ninth(colours[9], colours[10], colours[11]);
53
QVariantList firstMonth;
54
while (firstMonth.size() < 17)
55
firstMonth.push_back(QVariant(rand()));
56
while (firstMonth.size() < 31)
57
firstMonth.push_back(QVariant());
58
QVariantList secondMonth;
59
while (secondMonth.size() < 31)
60
secondMonth.push_back(QVariant(rand()));
61
QSharedPointer<InfographicData> data(
62
new InfographicData("<b>52km</b> travelled", first, firstMonth,
63
ninth, secondMonth, this));
64
m_fakeData.insert("guest", data);
68
QVariantList firstMonth;
69
while (firstMonth.size() < 17)
70
firstMonth.push_back(QVariant(rand()));
71
while (firstMonth.size() < 31)
72
firstMonth.push_back(QVariant());
73
QVariantList secondMonth;
74
while (secondMonth.size() < 31)
75
secondMonth.push_back(QVariant(rand()));
76
QSharedPointer<InfographicData> data(
77
new InfographicData("<b>33</b> messages today", second,
78
firstMonth, eighth, secondMonth, this));
79
m_fakeData.insert("guest", data);
83
QVariantList firstMonth;
84
while (firstMonth.size() < 17)
85
firstMonth.push_back(QVariant(rand()));
86
while (firstMonth.size() < 31)
87
firstMonth.push_back(QVariant());
88
QVariantList secondMonth;
89
while (secondMonth.size() < 31)
90
secondMonth.push_back(QVariant(rand()));
91
QSharedPointer<InfographicData> data(
92
new InfographicData("<b>69</b> minutes talk time", eighth,
93
firstMonth, second, secondMonth, this));
94
m_fakeData.insert("guest", data);