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-pin", data);