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(yellow, orange, red);
38
InfographicColorTheme yellowTheme(orange, yellow, orange);
39
InfographicColorTheme redTheme(red, red, red);
40
InfographicColorTheme darkPurpleTheme(lightPurple, darkPurple, pink);
41
InfographicColorTheme lightPurpleTheme(lightPurple, lightPurple,
43
InfographicColorTheme pinkTheme(lightPurple, pink, darkPurple);
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>52km</b> travelled", yellowTheme, firstMonth,
56
orangeTheme, secondMonth, this));
57
m_fakeData.insert("phablet", 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("phablet", 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>69</b> minutes talk time", darkPurpleTheme,
86
firstMonth, redTheme, secondMonth, this));
87
m_fakeData.insert("phablet", data);