2 * Copyright (C) 2016 Canonical, Ltd.
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.
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.
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/>.
17#include "MockController.h"
19static QLightDM::MockController *m_instance = nullptr;
24MockController::MockController(QObject *parent)
26 , m_selectGuestHint(false)
27 , m_hasGuestAccountHint(false)
28 , m_sessionMode("single")
32 {"ubuntu-2d", "Ubuntu 2D"},
34 {"gnome-classic", "GNOME Classic"},
35 {"gnome-flashback-compiz", "GNOME Flashback (Compiz)"},
36 {"gnome-flashback-metacity", "GNOME Flashback (Metacity)"},
37 {"gnome-wayland", "GNOME on Wayland"},
40 {"xterm", "Recovery Console"},
48MockController::~MockController()
53MockController *MockController::instance()
56 m_instance = new MockController;
61void MockController::reset()
63 auto userMode = qgetenv("LIBLIGHTDM_MOCK_MODE");
64 if (userMode.isEmpty()) {
68 setSelectUserHint("");
69 setSelectGuestHint(false);
70 setHasGuestAccountHint(false);
71 setUserMode(userMode);
72 setSessionMode("single");
73 setNumSessions(numFullSessions());
74 setShowManualLoginHint(false);
75 setHideUsersHint(false);
78QString MockController::selectUserHint() const
80 return m_selectUserHint;
83void MockController::setSelectUserHint(const QString &selectUserHint)
85 if (m_selectUserHint != selectUserHint) {
86 m_selectUserHint = selectUserHint;
87 Q_EMIT selectUserHintChanged();
91bool MockController::selectGuestHint() const
93 return m_selectGuestHint;
96void MockController::setSelectGuestHint(bool selectGuestHint)
98 if (m_selectGuestHint != selectGuestHint) {
99 m_selectGuestHint = selectGuestHint;
100 Q_EMIT selectGuestHintChanged();
104bool MockController::hasGuestAccountHint() const
106 return m_hasGuestAccountHint;
109void MockController::setHasGuestAccountHint(bool hasGuestAccountHint)
111 if (m_hasGuestAccountHint != hasGuestAccountHint) {
112 m_hasGuestAccountHint = hasGuestAccountHint;
113 Q_EMIT hasGuestAccountHintChanged();
117bool MockController::showManualLoginHint() const
119 return m_showManualLoginHint;
122void MockController::setShowManualLoginHint(bool showManualLoginHint)
124 if (m_showManualLoginHint != showManualLoginHint) {
125 m_showManualLoginHint = showManualLoginHint;
126 Q_EMIT showManualLoginHintChanged();
130bool MockController::hideUsersHint() const
132 return m_hideUsersHint;
135void MockController::setHideUsersHint(bool hideUsersHint)
137 if (m_hideUsersHint != hideUsersHint) {
138 m_hideUsersHint = hideUsersHint;
139 Q_EMIT hideUsersHintChanged();
143QString MockController::userMode() const
148void MockController::setUserMode(const QString &userMode)
150 if (m_userMode != userMode) {
151 m_userMode = userMode;
152 Q_EMIT userModeChanged();
156QString MockController::sessionMode() const
158 return m_sessionMode;
161void MockController::setSessionMode(const QString &sessionMode)
163 if (m_sessionMode != sessionMode) {
164 m_sessionMode = sessionMode;
165 Q_EMIT sessionModeChanged();
169const QList<MockController::SessionItem> &MockController::fullSessionItems() const
171 return m_fullSessions;
174int MockController::numFullSessions() const
176 return m_fullSessions.size();
179int MockController::numSessions() const
181 return m_numSessions;
184void MockController::setNumSessions(int numSessions)
186 if (m_numSessions != numSessions) {
187 m_numSessions = numSessions;
188 Q_EMIT numSessionsChanged();
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list