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
QColor orange = QColor::fromRgbF(0.9, 0.3, 0.1, 1.0);
31
QColor yellow = QColor::fromRgbF(1.0, 0.6, 0.0, 1.0);
32
QColor red = QColor::fromRgbF(0.8, 0.0, 0.0, 1.0);
33
QColor darkPurple = QColor::fromRgbF(0.5, 0.2, 0.3, 1.0);
34
QColor lightPurple = QColor::fromRgbF(0.8, 0.1, 0.8, 1.0);
35
QColor pink(QColor::fromRgbF(0.75, 0.13, 0.75));
37
InfographicColorTheme orangeTheme(orange, orange, orange);
38
InfographicColorTheme yellowTheme(yellow, yellow, yellow);
39
InfographicColorTheme redTheme(red, red, red);
40
InfographicColorTheme darkPurpleTheme(darkPurple, darkPurple, darkPurple);
41
InfographicColorTheme lightPurpleTheme(lightPurple, lightPurple,
43
InfographicColorTheme pinkTheme(pink, pink, pink);
46
QVariantList firstMonth;
47
while (firstMonth.size() < 17)
48
firstMonth.push_back(QVariant(rand()));
49
while (firstMonth.size() < 31)
50
firstMonth.push_back(QVariant());
51
QVariantList secondMonth;
52
while (secondMonth.size() < 31)
53
secondMonth.push_back(QVariant(rand()));
54
QSharedPointer<InfographicData> data(
55
new InfographicData("<b>5km</b> travelled", yellowTheme,
56
firstMonth, orangeTheme, secondMonth, this));
57
m_fakeData.insert("has-password", data);
61
QVariantList firstMonth;
62
while (firstMonth.size() < 17)
63
firstMonth.push_back(QVariant(rand()));
64
while (firstMonth.size() < 31)
65
firstMonth.push_back(QVariant());
66
QVariantList secondMonth;
67
while (secondMonth.size() < 31)
68
secondMonth.push_back(QVariant(rand()));
69
QSharedPointer<InfographicData> data(
70
new InfographicData("<b>33</b> messages today", pinkTheme,
71
firstMonth, orangeTheme, secondMonth, this));
72
m_fakeData.insert("has-password", data);
76
QVariantList firstMonth;
77
while (firstMonth.size() < 17)
78
firstMonth.push_back(QVariant(rand()));
79
while (firstMonth.size() < 31)
80
firstMonth.push_back(QVariant());
81
QVariantList secondMonth;
82
while (secondMonth.size() < 31)
83
secondMonth.push_back(QVariant(rand()));
84
QSharedPointer<InfographicData> data(
85
new InfographicData("<b>19</b> minutes talk time", orangeTheme,
86
firstMonth, redTheme, secondMonth, this));
87
m_fakeData.insert("has-password", data);
91
QVariantList firstMonth;
92
while (firstMonth.size() < 17)
93
firstMonth.push_back(QVariant(rand()));
94
while (firstMonth.size() < 31)
95
firstMonth.push_back(QVariant());
96
QVariantList secondMonth;
97
while (secondMonth.size() < 31)
98
secondMonth.push_back(QVariant(rand()));
99
QSharedPointer<InfographicData> data(
100
new InfographicData("<b>5km</b> travelled", redTheme,
101
firstMonth, darkPurpleTheme, secondMonth, this));
102
m_fakeData.insert("no-password", data);
106
QVariantList firstMonth;
107
while (firstMonth.size() < 17)
108
firstMonth.push_back(QVariant(rand()));
109
while (firstMonth.size() < 31)
110
firstMonth.push_back(QVariant());
111
QVariantList secondMonth;
112
while (secondMonth.size() < 31)
113
secondMonth.push_back(QVariant(rand()));
114
QSharedPointer<InfographicData> data(
115
new InfographicData("<b>33</b> messages today",
116
lightPurpleTheme, firstMonth, darkPurpleTheme,
118
m_fakeData.insert("no-password", data);
122
QVariantList firstMonth;
123
while (firstMonth.size() < 17)
124
firstMonth.push_back(QVariant(rand()));
125
while (firstMonth.size() < 31)
126
firstMonth.push_back(QVariant());
127
QVariantList secondMonth;
128
while (secondMonth.size() < 31)
129
secondMonth.push_back(QVariant());
130
QSharedPointer<InfographicData> data(
131
new InfographicData("<b>19</b> minutes talk time", orangeTheme,
132
firstMonth, redTheme, secondMonth, this));
133
m_fakeData.insert("no-password", data);
137
QVariantList firstMonth;
138
while (firstMonth.size() < 29)
139
firstMonth.push_back(QVariant(rand()));
140
while (firstMonth.size() < 31)
141
firstMonth.push_back(QVariant());
142
QVariantList secondMonth;
143
while (secondMonth.size() < 31)
144
secondMonth.push_back(QVariant(rand()));
145
QSharedPointer<InfographicData> data(
146
new InfographicData("<b>5km</b> travelled", redTheme,
147
firstMonth, darkPurpleTheme, secondMonth, this));
148
m_fakeData.insert("empty-name", data);
152
QVariantList firstMonth;
153
while (firstMonth.size() < 29)
154
firstMonth.push_back(QVariant(rand()));
155
while (firstMonth.size() < 31)
156
firstMonth.push_back(QVariant());
157
QVariantList secondMonth;
158
while (secondMonth.size() < 31)
159
secondMonth.push_back(QVariant(rand()));
160
QSharedPointer<InfographicData> data(
161
new InfographicData("<b>33</b> messages today", yellowTheme,
162
firstMonth, orangeTheme, secondMonth, this));
163
m_fakeData.insert("empty-name", data);
167
QVariantList firstMonth;
168
while (firstMonth.size() < 29)
169
firstMonth.push_back(QVariant(rand()));
170
while (firstMonth.size() < 31)
171
firstMonth.push_back(QVariant());
172
QVariantList secondMonth;
173
while (secondMonth.size() < 31)
174
secondMonth.push_back(QVariant());
175
QSharedPointer<InfographicData> data(
176
new InfographicData("<b>19</b> minutes talk time", pinkTheme,
177
firstMonth, orangeTheme, secondMonth, this));
178
m_fakeData.insert("empty-name", data);