Unity 8
 All Classes Functions Properties
AccountsService.h
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  * Authors: Michael Terry <michael.terry@canonical.com>
17  */
18 
19 #ifndef UNITY_ACCOUNTSSERVICE_H
20 #define UNITY_ACCOUNTSSERVICE_H
21 
22 #include <QObject>
23 #include <QString>
24 
25 class AccountsServiceDBusAdaptor;
26 
27 class AccountsService: public QObject
28 {
29  Q_OBJECT
30  Q_PROPERTY (QString user
31  READ user
32  WRITE setUser
33  NOTIFY userChanged)
34  Q_PROPERTY (bool demoEdges
35  READ demoEdges
36  WRITE setDemoEdges
37  NOTIFY demoEdgesChanged)
38  Q_PROPERTY (QString backgroundFile
39  READ backgroundFile
40  NOTIFY backgroundFileChanged)
41  Q_PROPERTY (bool statsWelcomeScreen
42  READ statsWelcomeScreen
43  NOTIFY statsWelcomeScreenChanged)
44 
45 public:
46  explicit AccountsService(QObject *parent = 0);
47 
48  QString user() const;
49  void setUser(const QString &user);
50  bool demoEdges() const;
51  void setDemoEdges(bool demoEdges);
52  QString backgroundFile() const;
53  bool statsWelcomeScreen() const;
54 
55 Q_SIGNALS:
56  void userChanged();
57  void demoEdgesChanged();
58  void backgroundFileChanged();
59  void statsWelcomeScreenChanged();
60 
61 private Q_SLOTS:
62  void propertiesChanged(const QString &user, const QString &interface, const QStringList &changed);
63  void maybeChanged(const QString &user);
64 
65 private:
66  void updateDemoEdges();
67  void updateBackgroundFile();
68  void updateStatsWelcomeScreen();
69 
70  AccountsServiceDBusAdaptor *m_service;
71  QString m_user;
72  bool m_demoEdges;
73  QString m_backgroundFile;
74  bool m_statsWelcomeScreen;
75 };
76 
77 #endif