~nick-dedekind/unity8/indicators.hint-interval

« back to all changes in this revision

Viewing changes to tests/mocks/LightDM/single-passphrase/InfographicModelPrivate.cpp

  • Committer: Nick Dedekind
  • Date: 2014-03-07 15:54:57 UTC
  • mfrom: (638.1.118 unity8)
  • Revision ID: nicholas.dedekind@gmail.com-20140307155457-f0s1zu5ll2czt3rq
merged with trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright (C) 2013 Canonical, Ltd.
3
 
 *
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.
7
 
 *
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.
12
 
 *
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/>.
15
 
 *
16
 
 * Author: Pete Woods <pete.woods@canonical.com>
17
 
 */
18
 
 
19
 
#include "../InfographicModelPrivate.h"
20
 
 
21
 
namespace QLightDM
22
 
{
23
 
 
24
 
void InfographicModelPrivate::generateFakeData()
25
 
{
26
 
    std::default_random_engine generator;
27
 
    std::normal_distribution<qreal> distribution(0.5, 0.2);
28
 
    auto rand = std::bind(distribution, generator);
29
 
 
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));
36
 
 
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,
42
 
            lightPurple);
43
 
    InfographicColorTheme pinkTheme(pink, pink, pink);
44
 
 
45
 
    {
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);
58
 
    }
59
 
}
60
 
 
61
 
}