/
Display.h
121 lines (96 loc) · 3.69 KB
/
Display.h
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
/***************************************************************************
* Copyright (c) 2014-2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
* Copyright (c) 2014 Martin Bříza <mbriza@redhat.com>
* Copyright (c) 2013 Abdurrahman AVCI <abdurrahmanavci@gmail.com>
*
* 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; either version 2 of the License, or
* (at your option) any later version.
*
* 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, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
***************************************************************************/
#ifndef SDDM_DISPLAY_H
#define SDDM_DISPLAY_H
#include <QObject>
#include <QPointer>
#include <QDir>
#include "Auth.h"
#include "Session.h"
class QLocalSocket;
namespace SDDM {
class Authenticator;
class DisplayServer;
class Seat;
class SocketServer;
class Greeter;
class Display : public QObject {
Q_OBJECT
Q_DISABLE_COPY(Display)
public:
enum DisplayServerType {
X11DisplayServerType,
X11UserDisplayServerType,
WaylandDisplayServerType
};
Q_ENUM(DisplayServerType)
static DisplayServerType defaultDisplayServerType();
explicit Display(Seat *parent, DisplayServerType serverType);
~Display();
DisplayServerType displayServerType() const;
DisplayServer *displayServer() const;
const int terminalId() const;
const QString &name() const;
QString sessionType() const;
QString reuseSessionId() const { return m_reuseSessionId; }
Seat *seat() const;
public slots:
bool start();
void stop();
void login(QLocalSocket *socket,
const QString &user, const QString &password,
const Session &session);
bool attemptAutologin();
void displayServerStarted();
signals:
void stopped();
void displayServerFailed();
void loginFailed(QLocalSocket *socket);
void loginSucceeded(QLocalSocket *socket);
private:
QString findGreeterTheme() const;
bool findSessionEntry(const QDir &dir, const QString &name) const;
void startAuth(const QString &user, const QString &password,
const Session &session);
DisplayServerType m_displayServerType = X11DisplayServerType;
bool m_relogin { true };
bool m_started { false };
int m_terminalId = 0;
int m_sessionTerminalId = 0;
QString m_passPhrase;
QString m_sessionName;
QString m_reuseSessionId;
Auth *m_auth { nullptr };
DisplayServer *m_displayServer { nullptr };
Seat *m_seat { nullptr };
SocketServer *m_socketServer { nullptr };
QPointer<QLocalSocket> m_socket;
Greeter *m_greeter { nullptr };
private slots:
void slotRequestChanged();
void slotAuthenticationFinished(const QString &user, bool success);
void slotSessionStarted(bool success);
void slotHelperFinished(Auth::HelperExitStatus status);
void slotAuthInfo(const QString &message, Auth::Info info);
void slotAuthError(const QString &message, Auth::Error error);
};
}
#endif // SDDM_DISPLAY_H