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)
29 {"ubuntu-2d", "Ubuntu 2D"},
31 {"gnome-classic", "GNOME Classic"},
32 {"gnome-flashback-compiz", "GNOME Flashback (Compiz)"},
33 {"gnome-flashback-metacity", "GNOME Flashback (Metacity)"},
34 {"gnome-wayland", "GNOME on Wayland"},
37 {"xterm", "Recovery Console"},
44MockController::~MockController()
49MockController *MockController::instance()
52 m_instance = new MockController;
57void MockController::reset()
59 auto userMode = qgetenv("LIBLIGHTDM_MOCK_MODE");
60 if (userMode.isEmpty()) {
64 setSelectUserHint("");
65 setSelectGuestHint(false);
66 setHasGuestAccountHint(false);
67 setUserMode(userMode);
68 setSessionMode("full");
69 setNumSessions(numFullSessions());
70 setShowManualLoginHint(false);
71 setHideUsersHint(false);
74QString MockController::selectUserHint() const
76 return m_selectUserHint;
79void MockController::setSelectUserHint(const QString &selectUserHint)
81 if (m_selectUserHint != selectUserHint) {
82 m_selectUserHint = selectUserHint;
83 Q_EMIT selectUserHintChanged();
87bool MockController::selectGuestHint() const
89 return m_selectGuestHint;
92void MockController::setSelectGuestHint(bool selectGuestHint)
94 if (m_selectGuestHint != selectGuestHint) {
95 m_selectGuestHint = selectGuestHint;
96 Q_EMIT selectGuestHintChanged();
100bool MockController::hasGuestAccountHint() const
102 return m_hasGuestAccountHint;
105void MockController::setHasGuestAccountHint(bool hasGuestAccountHint)
107 if (m_hasGuestAccountHint != hasGuestAccountHint) {
108 m_hasGuestAccountHint = hasGuestAccountHint;
109 Q_EMIT hasGuestAccountHintChanged();
113bool MockController::showManualLoginHint() const
115 return m_showManualLoginHint;
118void MockController::setShowManualLoginHint(bool showManualLoginHint)
120 if (m_showManualLoginHint != showManualLoginHint) {
121 m_showManualLoginHint = showManualLoginHint;
122 Q_EMIT showManualLoginHintChanged();
126bool MockController::hideUsersHint() const
128 return m_hideUsersHint;
131void MockController::setHideUsersHint(bool hideUsersHint)
133 if (m_hideUsersHint != hideUsersHint) {
134 m_hideUsersHint = hideUsersHint;
135 Q_EMIT hideUsersHintChanged();
139QString MockController::userMode() const
144void MockController::setUserMode(const QString &userMode)
146 if (m_userMode != userMode) {
147 m_userMode = userMode;
148 Q_EMIT userModeChanged();
152QString MockController::sessionMode() const
154 return m_sessionMode;
157void MockController::setSessionMode(const QString &sessionMode)
159 if (m_sessionMode != sessionMode) {
160 m_sessionMode = sessionMode;
161 Q_EMIT sessionModeChanged();
165const QList<MockController::SessionItem> &MockController::fullSessionItems() const
167 return m_fullSessions;
170int MockController::numFullSessions() const
172 return m_fullSessions.size();
175int MockController::numSessions() const
177 return m_numSessions;
180void MockController::setNumSessions(int numSessions)
182 if (m_numSessions != numSessions) {
183 m_numSessions = numSessions;
184 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