Overte C++ Documentation
LoginDialog.h
1 //
2 // LoginDialog.h
3 // interface/src/ui
4 //
5 // Created by Bradley Austin Davis on 2015/04/14
6 // Copyright 2015 High Fidelity, Inc.
7 // Copyright 2020 Vircadia contributors.
8 //
9 // Distributed under the Apache License, Version 2.0.
10 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
11 //
12 
13 #pragma once
14 
15 #ifndef hifi_LoginDialog_h
16 #define hifi_LoginDialog_h
17 
18 #include <OffscreenQmlDialog.h>
19 
20 class QNetworkReply;
21 
22 extern const QUrl LOGIN_DIALOG;
23 
24 class LoginDialog : public OffscreenQmlDialog {
25  Q_OBJECT
26  HIFI_QML_DECL
27 
28 public:
29  static void toggleAction();
30 
31  LoginDialog(QQuickItem* parent = nullptr);
32 
33  ~LoginDialog();
34 
35  static void showWithSelection();
36 
37 signals:
38  void handleLoginCompleted();
39  void handleLoginFailed();
40 
41  void handleLinkCompleted();
42  void handleLinkFailed(QString error);
43 
44  void handleCreateCompleted();
45  void handleCreateFailed(QString error);
46 
47  void handleSignupCompleted();
48  void handleSignupFailed(QString errorString);
49 
50  // occurs upon dismissing the encouraging log in.
51  void dismissedLoginDialog();
52 
53  void focusEnabled();
54  void focusDisabled();
55 
56 public slots:
57  void linkCompleted(QNetworkReply* reply);
58  void linkFailed(QNetworkReply* reply);
59 
60  void createCompleted(QNetworkReply* reply);
61  void createFailed(QNetworkReply* reply);
62 
63  void signupCompleted(QNetworkReply* reply);
64  void signupFailed(QNetworkReply* reply);
65 
66 protected slots:
67  Q_INVOKABLE void dismissLoginDialog();
68 
69  Q_INVOKABLE bool isSteamRunning() const;
70  Q_INVOKABLE bool isOculusRunning() const;
71 
72  Q_INVOKABLE QString oculusUserID() const;
73 
74  Q_INVOKABLE void login(const QString& username, const QString& password) const;
75  Q_INVOKABLE void loginDomain(const QString& username, const QString& password) const;
76  Q_INVOKABLE void loginThroughSteam();
77  Q_INVOKABLE void linkSteam();
78  Q_INVOKABLE void createAccountFromSteam(QString username = QString());
79  Q_INVOKABLE void loginThroughOculus();
80  Q_INVOKABLE void linkOculus();
81  Q_INVOKABLE void createAccountFromOculus(QString email = QString(), QString username = QString(), QString password = QString());
82 
83  Q_INVOKABLE void signup(const QString& email, const QString& username, const QString& password);
84 
85  Q_INVOKABLE bool getLoginDialogPoppedUp() const;
86 
87  Q_INVOKABLE bool getDomainLoginRequested() const;
88  Q_INVOKABLE QString getDomainLoginDomain() const;
89 
90 };
91 
92 #endif // hifi_LoginDialog_h