~robertcarr/unity/phablet-monday

« back to all changes in this revision

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

  • Committer: Daniel d'Andrada
  • Date: 2013-06-05 14:11:51 UTC
  • mfrom: (651.2.83 phablet)
  • Revision ID: daniel.dandrada@canonical.com-20130605141151-6gfzljhtew6yqru0
Merge with lp: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 LIGHTDM_INFOGRAPHICMODEL_H
 
20
#define LIGHTDM_INFOGRAPHICMODEL_H
 
21
 
 
22
#include <QtCore/QString>
 
23
#include <QtGui/qcolor.h>
 
24
#include <QAbstractListModel>
 
25
 
 
26
namespace QLightDM
 
27
{
 
28
class InfographicColorThemePrivate;
 
29
 
 
30
class Q_DECL_EXPORT InfographicColorTheme: public QObject
 
31
{
 
32
Q_OBJECT
 
33
 
 
34
Q_PROPERTY(QColor start READ start NOTIFY startChanged FINAL)
 
35
Q_PROPERTY(QColor main READ main NOTIFY mainChanged FINAL)
 
36
Q_PROPERTY(QColor end READ end NOTIFY endChanged FINAL)
 
37
 
 
38
public:
 
39
    explicit InfographicColorTheme(QObject *parent = 0);
 
40
 
 
41
    explicit InfographicColorTheme(QColor &first, QColor &main, QColor &end,
 
42
            QObject *parent = 0);
 
43
 
 
44
    InfographicColorTheme & operator=(const InfographicColorTheme & other);
 
45
 
 
46
    ~InfographicColorTheme();
 
47
 
 
48
    QColor start() const;
 
49
 
 
50
    QColor main() const;
 
51
 
 
52
    QColor end() const;
 
53
 
 
54
Q_SIGNALS:
 
55
    void startChanged(const QColor &color);
 
56
 
 
57
    void mainChanged(const QColor &color);
 
58
 
 
59
    void endChanged(const QColor &color);
 
60
 
 
61
protected:
 
62
    InfographicColorThemePrivate * const d_ptr;
 
63
 
 
64
    Q_DECLARE_PRIVATE(InfographicColorTheme)
 
65
 
 
66
};
 
67
 
 
68
class InfographicModelPrivate;
 
69
 
 
70
class Q_DECL_EXPORT InfographicModel: public QObject
 
71
{
 
72
Q_OBJECT
 
73
 
 
74
Q_PROPERTY(QString label READ label NOTIFY labelChanged FINAL)
 
75
Q_PROPERTY(QString username READ username WRITE setUsername NOTIFY usernameChanged FINAL)
 
76
Q_PROPERTY(QLightDM::InfographicColorTheme* firstColor READ firstColor NOTIFY firstColorChanged FINAL)
 
77
Q_PROPERTY(QLightDM::InfographicColorTheme* secondColor READ secondColor NOTIFY secondColorChanged FINAL)
 
78
Q_PROPERTY(QAbstractItemModel *firstMonth READ firstMonth NOTIFY firstMonthChanged FINAL)
 
79
Q_PROPERTY(QAbstractItemModel *secondMonth READ secondMonth NOTIFY secondMonthChanged FINAL)
 
80
Q_PROPERTY(int currentDay READ currentDay NOTIFY currentDayChanged FINAL)
 
81
 
 
82
public:
 
83
    static InfographicModel *getInstance();
 
84
 
 
85
    explicit InfographicModel(QObject *parent = 0);
 
86
    ~InfographicModel();
 
87
 
 
88
    QString label() const;
 
89
 
 
90
    QString username() const;
 
91
 
 
92
    void setUsername(const QString &username);
 
93
 
 
94
    InfographicColorTheme * firstColor() const;
 
95
 
 
96
    QAbstractItemModel *firstMonth() const;
 
97
 
 
98
    int currentDay() const;
 
99
 
 
100
    InfographicColorTheme * secondColor() const;
 
101
 
 
102
    QAbstractItemModel *secondMonth() const;
 
103
 
 
104
Q_SIGNALS:
 
105
    void labelChanged(const QString &label);
 
106
 
 
107
    void usernameChanged(const QString &username);
 
108
 
 
109
    void firstColorChanged(InfographicColorTheme *color);
 
110
 
 
111
    void firstMonthChanged(QAbstractItemModel *firstMonth);
 
112
 
 
113
    void currentDayChanged(int length);
 
114
 
 
115
    void secondColorChanged(InfographicColorTheme *color);
 
116
 
 
117
    void secondMonthChanged(QAbstractItemModel *secondMonth);
 
118
 
 
119
    void nextDataSource();
 
120
 
 
121
    void readyForDataChange();
 
122
 
 
123
    void dataAboutToAppear();
 
124
 
 
125
    void dataAppeared();
 
126
 
 
127
    void dataAboutToChange();
 
128
 
 
129
    void dataChanged();
 
130
 
 
131
    void dataAboutToDisappear();
 
132
 
 
133
    void dataDisappeared();
 
134
 
 
135
protected Q_SLOTS:
 
136
    void nextDataSourceSlot();
 
137
 
 
138
    void readyForDataChangeSlot();
 
139
 
 
140
protected:
 
141
    InfographicModelPrivate * const d_ptr;
 
142
 
 
143
    Q_DISABLE_COPY(InfographicModel)
 
144
    Q_DECLARE_PRIVATE(InfographicModel)
 
145
 
 
146
};
 
147
 
 
148
}
 
149
 
 
150
#endif // LIGHTDM_INFOGRAPHICMODEL_H