on bionic help sign in
unity8/tests/mocks/liblightdm/MockController.h
106 lines 3.4 kB history raw
1/*
2 * Copyright (C) 2016 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 */
17#pragma once
19#include <QObject>
20#include <QString>
23namespace QLightDM
25class Q_DECL_EXPORT MockController : public QObject
27 Q_OBJECT
29 Q_PROPERTY(QString selectUserHint READ selectUserHint WRITE setSelectUserHint NOTIFY selectUserHintChanged)
30 Q_PROPERTY(bool selectGuestHint READ selectGuestHint WRITE setSelectGuestHint NOTIFY selectGuestHintChanged)
31 Q_PROPERTY(bool hasGuestAccountHint READ hasGuestAccountHint WRITE setHasGuestAccountHint NOTIFY hasGuestAccountHintChanged)
32 Q_PROPERTY(bool showManualLoginHint READ showManualLoginHint WRITE setShowManualLoginHint NOTIFY showManualLoginHintChanged)
33 Q_PROPERTY(bool hideUsersHint READ hideUsersHint WRITE setHideUsersHint NOTIFY hideUsersHintChanged)
35 // single, single-pin, single-passphrase, full
36 Q_PROPERTY(QString userMode READ userMode WRITE setUserMode NOTIFY userModeChanged)
38 // single, none, full
39 Q_PROPERTY(QString sessionMode READ sessionMode WRITE setSessionMode NOTIFY sessionModeChanged)
41 Q_PROPERTY(int numAvailableSessions READ numFullSessions CONSTANT)
42 Q_PROPERTY(int numSessions READ numSessions WRITE setNumSessions NOTIFY numSessionsChanged)
44public:
45 static MockController *instance();
46 virtual ~MockController();
48 Q_INVOKABLE void reset();
50 QString selectUserHint() const;
51 void setSelectUserHint(const QString &selectUserHint);
53 bool selectGuestHint() const;
54 void setSelectGuestHint(bool selectGuestHint);
56 bool hasGuestAccountHint() const;
57 void setHasGuestAccountHint(bool hasGuestAccountHint);
59 bool showManualLoginHint() const;
60 void setShowManualLoginHint(bool showManualLoginHint);
62 bool hideUsersHint() const;
63 void setHideUsersHint(bool hideUsersHint);
65 QString userMode() const;
66 void setUserMode(const QString &userMode);
68 QString sessionMode() const;
69 void setSessionMode(const QString &sessionMode);
71 class SessionItem
72 {
73 public:
74 QString key;
75 QString name;
76 };
77 int numFullSessions() const;
78 const QList<SessionItem> &fullSessionItems() const;
80 int numSessions() const;
81 void setNumSessions(int numSessions);
83Q_SIGNALS:
84 void selectUserHintChanged();
85 void selectGuestHintChanged();
86 void hasGuestAccountHintChanged();
87 void showManualLoginHintChanged();
88 void hideUsersHintChanged();
89 void userModeChanged();
90 void sessionModeChanged();
91 void numSessionsChanged();
93private:
94 explicit MockController(QObject* parent=0);
96 QString m_selectUserHint;
97 bool m_selectGuestHint;
98 bool m_hasGuestAccountHint;
99 bool m_showManualLoginHint;
100 bool m_hideUsersHint;
101 QString m_userMode;
102 QString m_sessionMode;
103 QList<SessionItem> m_fullSessions;
104 int m_numSessions;
105};