QtPdCom  1.3.3
LoginManager.h
Go to the documentation of this file.
1 /*****************************************************************************
2  *
3  * Copyright (C) 2009-2023 Bjarne von Horn <vh@igh.de>
4  *
5  * This file is part of the QtPdCom library.
6  *
7  * The QtPdCom library is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU Lesser General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or (at your
10  * option) any later version.
11  *
12  * The QtPdCom library is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15  * License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with the QtPdCom Library. If not, see <http://www.gnu.org/licenses/>.
19  *
20  ****************************************************************************/
21 
22 #ifndef QTPDCOM_LOGINMANAGER_H
23 #define QTPDCOM_LOGINMANAGER_H
24 
25 #include "Export.h"
26 
27 #include <QObject>
28 #include <QScopedPointer>
29 #include <QString>
30 
31 namespace QtPdCom {
32 
33 class LoginManagerPrivate;
34 class Process;
35 
36 class QTPDCOM_PUBLIC LoginManager: public QObject
37 {
38  Q_OBJECT
39 
40  public:
41  explicit LoginManager(QString server_name = QString(), QObject *parent = nullptr);
42  ~LoginManager();
43 
49  Q_INVOKABLE void setAuthName(QString name);
55  Q_INVOKABLE void setPassword(QString password);
56 
61  Q_INVOKABLE void clearCredentials();
62 
73  Q_INVOKABLE void login();
77  Q_INVOKABLE void logout();
78 
79  /* Retrieve reason for login failure.
80  */
81  Q_INVOKABLE QString getErrorMessage();
82 
91  static void InitLibrary(const char *plugin_path = nullptr);
94  static void FinalizeLibrary();
95 
96  signals:
97 
101  void needCredentials();
105  void loginSuccessful();
110  void loginFailed();
111 
112  private:
113  Q_DECLARE_PRIVATE(LoginManager);
114  Q_DISABLE_COPY(LoginManager);
115  LoginManager& operator=(LoginManager&&) = delete;
116  LoginManager(LoginManager&&) = delete;
117 
118  QScopedPointer<LoginManagerPrivate> d_ptr;
119  friend Process;
120 };
121 
122 } // namespace QtPdCom
123 
124 #endif // QTPDCOM_LOGINMANAGER_H
Definition: BroadcastModel.h:32
#define QTPDCOM_PUBLIC
Definition: Export.h:30
Definition: LoginManager.h:36
friend Process
Definition: LoginManager.h:119
QScopedPointer< LoginManagerPrivate > d_ptr
Definition: LoginManager.h:118