~mhr3/unity8/fix-1297246

« back to all changes in this revision

Viewing changes to tests/mocks/LightDM/InfographicModelPrivate.h

  • Committer: Michał Sawicz
  • Date: 2013-06-05 22:03:08 UTC
  • Revision ID: michal.sawicz@canonical.com-20130605220308-yny8fv3futtr04fg
Inital unity8 commit.

Previous history can be found at https://code.launchpad.net/~unity-team/unity/phablet

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
#ifndef INFOGRAPHICMODEL_PRIVATE_H
 
20
#define INFOGRAPHICMODEL_PRIVATE_H
 
21
 
 
22
#include <QtCore/QSharedPointer>
 
23
 
 
24
#include "InfographicModel.h"
 
25
#include "plugins/Utils/qvariantlistmodel.h"
 
26
 
 
27
namespace QLightDM
 
28
{
 
29
class InfographicDataPrivate;
 
30
 
 
31
class Q_DECL_EXPORT InfographicData: public QObject
 
32
{
 
33
public:
 
34
    explicit InfographicData(QObject *parent);
 
35
 
 
36
    InfographicData(const QString &label,
 
37
            const InfographicColorTheme &firstColor,
 
38
            const QVariantList &firstMonth,
 
39
            const InfographicColorTheme &secondColor,
 
40
            const QVariantList &secondMonth, QObject* parent);
 
41
 
 
42
    ~InfographicData();
 
43
 
 
44
protected:
 
45
    InfographicDataPrivate * const d_ptr;
 
46
 
 
47
public:
 
48
    const QString & label() const;
 
49
    const InfographicColorTheme & firstColor() const;
 
50
    const QVariantList & firstMonth() const;
 
51
    const InfographicColorTheme & secondColor() const;
 
52
    const QVariantList & secondMonth() const;
 
53
    int length() const;
 
54
 
 
55
private:
 
56
    Q_DECLARE_PRIVATE(InfographicData)
 
57
};
 
58
 
 
59
class InfographicModelPrivate: QObject
 
60
{
 
61
 
 
62
public:
 
63
    explicit InfographicModelPrivate(InfographicModel *parent);
 
64
 
 
65
    ~InfographicModelPrivate();
 
66
 
 
67
public:
 
68
    typedef QSharedPointer<InfographicData> InfographicDataPtr;
 
69
    typedef QMultiMap<QString, InfographicDataPtr> FakeDataMap;
 
70
 
 
71
    InfographicModel * const q_ptr;
 
72
    QString m_label;
 
73
    InfographicColorTheme m_firstColor;
 
74
    QVariantListModel m_firstMonth;
 
75
    InfographicColorTheme m_secondColor;
 
76
    QVariantListModel m_secondMonth;
 
77
    int m_currentDay;
 
78
    QString m_username;
 
79
    FakeDataMap::const_iterator m_dataIndex;
 
80
    InfographicDataPtr m_newData;
 
81
    FakeDataMap m_fakeData;
 
82
 
 
83
    void setUsername(const QString &username);
 
84
 
 
85
protected:
 
86
    void nextFakeData();
 
87
 
 
88
    void generateFakeData();
 
89
 
 
90
    void loadFakeData();
 
91
 
 
92
    void finishSetFakeData();
 
93
 
 
94
private:
 
95
    Q_DECLARE_PUBLIC(InfographicModel)
 
96
};
 
97
}
 
98
 
 
99
#endif // INFOGRAPHICMODEL_PRIVATE_H