~robertcarr/unity/phablet-monday

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/*
 * Copyright (C) 2013 Canonical, Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 3.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Author: Pete Woods <pete.woods@canonical.com>
 */

#ifndef LIGHTDM_INFOGRAPHICMODEL_H
#define LIGHTDM_INFOGRAPHICMODEL_H

#include <QtCore/QString>
#include <QtGui/qcolor.h>
#include <QAbstractListModel>

namespace QLightDM
{
class InfographicColorThemePrivate;

class Q_DECL_EXPORT InfographicColorTheme: public QObject
{
Q_OBJECT

Q_PROPERTY(QColor start READ start NOTIFY startChanged FINAL)
Q_PROPERTY(QColor main READ main NOTIFY mainChanged FINAL)
Q_PROPERTY(QColor end READ end NOTIFY endChanged FINAL)

public:
    explicit InfographicColorTheme(QObject *parent = 0);

    explicit InfographicColorTheme(QColor &first, QColor &main, QColor &end,
            QObject *parent = 0);

    InfographicColorTheme & operator=(const InfographicColorTheme & other);

    ~InfographicColorTheme();

    QColor start() const;

    QColor main() const;

    QColor end() const;

Q_SIGNALS:
    void startChanged(const QColor &color);

    void mainChanged(const QColor &color);

    void endChanged(const QColor &color);

protected:
    InfographicColorThemePrivate * const d_ptr;

    Q_DECLARE_PRIVATE(InfographicColorTheme)

};

class InfographicModelPrivate;

class Q_DECL_EXPORT InfographicModel: public QObject
{
Q_OBJECT

Q_PROPERTY(QString label READ label NOTIFY labelChanged FINAL)
Q_PROPERTY(QString username READ username WRITE setUsername NOTIFY usernameChanged FINAL)
Q_PROPERTY(QLightDM::InfographicColorTheme* firstColor READ firstColor NOTIFY firstColorChanged FINAL)
Q_PROPERTY(QLightDM::InfographicColorTheme* secondColor READ secondColor NOTIFY secondColorChanged FINAL)
Q_PROPERTY(QAbstractItemModel *firstMonth READ firstMonth NOTIFY firstMonthChanged FINAL)
Q_PROPERTY(QAbstractItemModel *secondMonth READ secondMonth NOTIFY secondMonthChanged FINAL)
Q_PROPERTY(int currentDay READ currentDay NOTIFY currentDayChanged FINAL)

public:
    static InfographicModel *getInstance();

    explicit InfographicModel(QObject *parent = 0);
    ~InfographicModel();

    QString label() const;

    QString username() const;

    void setUsername(const QString &username);

    InfographicColorTheme * firstColor() const;

    QAbstractItemModel *firstMonth() const;

    int currentDay() const;

    InfographicColorTheme * secondColor() const;

    QAbstractItemModel *secondMonth() const;

Q_SIGNALS:
    void labelChanged(const QString &label);

    void usernameChanged(const QString &username);

    void firstColorChanged(InfographicColorTheme *color);

    void firstMonthChanged(QAbstractItemModel *firstMonth);

    void currentDayChanged(int length);

    void secondColorChanged(InfographicColorTheme *color);

    void secondMonthChanged(QAbstractItemModel *secondMonth);

    void nextDataSource();

    void readyForDataChange();

    void dataAboutToAppear();

    void dataAppeared();

    void dataAboutToChange();

    void dataChanged();

    void dataAboutToDisappear();

    void dataDisappeared();

protected Q_SLOTS:
    void nextDataSourceSlot();

    void readyForDataChangeSlot();

protected:
    InfographicModelPrivate * const d_ptr;

    Q_DISABLE_COPY(InfographicModel)
    Q_DECLARE_PRIVATE(InfographicModel)

};

}

#endif // LIGHTDM_INFOGRAPHICMODEL_H