From 25b60d0c62026d5fcf8f97f33f76ca40aaa7302a Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Tue, 9 Aug 2016 09:46:58 -0700 Subject: [PATCH] CR feedback --- interface/resources/qml/LoginDialogSave.qml | 197 ------------------ interface/src/ui/LoginDialog.cpp | 19 +- interface/src/ui/LoginDialog.h | 7 +- .../src/steamworks-wrapper/SteamClient.cpp | 3 +- 4 files changed, 7 insertions(+), 219 deletions(-) delete mode 100644 interface/resources/qml/LoginDialogSave.qml diff --git a/interface/resources/qml/LoginDialogSave.qml b/interface/resources/qml/LoginDialogSave.qml deleted file mode 100644 index 46246fc1a5..0000000000 --- a/interface/resources/qml/LoginDialogSave.qml +++ /dev/null @@ -1,197 +0,0 @@ -Window { - id: root - HifiConstants { id: hifi } - - width: 550 - height: 200 - - anchors.centerIn: parent - resizable: true - - property bool required: false - - Component { - id: welcomeBody - - Column { - anchors.centerIn: parent - - OverlayTitle { - anchors.horizontalCenter: parent.horizontalCenter - - text: "Welcomeback Atlante45!" - color: hifi.colors.baseGrayHighlight - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - } - - VerticalSpacer {} - - HorizontalRule {} - - MenuItem { - id: details - anchors.horizontalCenter: parent.horizontalCenter - - text: "You are now signed into High Fidelity" - color: hifi.colors.baseGrayHighlight - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - } - - VerticalSpacer {} - - Button { - anchors.horizontalCenter: parent.horizontalCenter - - text: "Close" - } - } - } - - Component { - id: signInBody - - Column { - anchors.centerIn: parent - - OverlayTitle { - anchors.horizontalCenter: parent.horizontalCenter - - text: required ? "Sign In Required" : "Sign In" - color: hifi.colors.baseGrayHighlight - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - } - - VerticalSpacer {} - - HorizontalRule {} - - MenuItem { - id: details - anchors.horizontalCenter: parent.horizontalCenter - - text: required ? "This domain's owner requires that you sign in:" - : "Sign in to access your user account:" - color: hifi.colors.baseGrayHighlight - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - } - - VerticalSpacer {} - - Row { - anchors.horizontalCenter: parent.horizontalCenter - - Button { - anchors.verticalCenter: parent.verticalCenter - width: undefined // invalidate so that the image's size sets the width - height: undefined // invalidate so that the image's size sets the height - - style: Original.ButtonStyle { - background: Image { - id: buttonImage - source: "../images/steam-sign-in.png" - } - } - - onClicked: body.sourceComponent = completeProfileBody - } - - HorizontalSpacer {} - - Button { - anchors.verticalCenter: parent.verticalCenter - - text: "Cancel" - - onClicked: required = !required - } - } - } - } - - Component { - id: completeProfileBody - - Column { - anchors.centerIn: parent - - Row { - anchors.horizontalCenter: parent.horizontalCenter - - HiFiGlyphs { - anchors.verticalCenter: parent.verticalCenter - - text: hifi.glyphs.avatar - } - - OverlayTitle { - anchors.verticalCenter: parent.verticalCenter - - text: "Complete Your Profile" - color: hifi.colors.baseGrayHighlight - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - } - } - - VerticalSpacer {} - - HorizontalRule {} - - VerticalSpacer {} - - Row { - anchors.horizontalCenter: parent.horizontalCenter - - Button { - anchors.verticalCenter: parent.verticalCenter - - width: 200 - - text: "Create your profile" - color: hifi.buttons.blue - - onClicked: body.sourceComponent = welcomeBody - } - - HorizontalSpacer {} - - Button { - anchors.verticalCenter: parent.verticalCenter - - text: "Cancel" - - onClicked: body.sourceComponent = signInBody - - } - } - - VerticalSpacer {} - - ShortcutText { - text: "Already have a High Fidelity profile? Link to an existing profile here." - - color: hifi.colors.blueAccent - font.underline: true - - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - } - } - } - - Rectangle { - anchors.fill: root - color: hifi.colors.faintGray - radius: hifi.dimensions.borderRadius - - Loader { - id: body - anchors.centerIn: parent - sourceComponent: signInBody - } - } -} diff --git a/interface/src/ui/LoginDialog.cpp b/interface/src/ui/LoginDialog.cpp index 78aacb1216..08e2b6479d 100644 --- a/interface/src/ui/LoginDialog.cpp +++ b/interface/src/ui/LoginDialog.cpp @@ -54,11 +54,11 @@ void LoginDialog::toggleAction() { } } -bool LoginDialog::isSteamRunning() { +bool LoginDialog::isSteamRunning() const { return SteamClient::isRunning(); } -void LoginDialog::login(const QString& username, const QString& password) { +void LoginDialog::login(const QString& username, const QString& password) const { qDebug() << "Attempting to login " << username; DependencyManager::get()->requestAccessToken(username, password); } @@ -131,25 +131,12 @@ void LoginDialog::createAccountFromStream(QString username) { } -void LoginDialog::openUrl(const QString& url) { +void LoginDialog::openUrl(const QString& url) const { auto offscreenUi = DependencyManager::get(); auto browser = offscreenUi->load("Browser.qml"); browser->setProperty("url", url); } -void LoginDialog::sendRecoveryEmail(const QString& email) { - const QString PASSWORD_RESET_PATH = "/users/password"; - - QJsonObject payload; - payload.insert("user_email", QJsonValue::fromVariant(QVariant(email))); - - - auto accountManager = DependencyManager::get(); - accountManager->sendRequest(PASSWORD_RESET_PATH, AccountManagerAuth::None, - QNetworkAccessManager::PostOperation, JSONCallbackParameters(), - QJsonDocument(payload).toJson()); -} - void LoginDialog::linkCompleted(QNetworkReply& reply) { emit handleLinkCompleted(); } diff --git a/interface/src/ui/LoginDialog.h b/interface/src/ui/LoginDialog.h index ef2c937201..8b6dc40302 100644 --- a/interface/src/ui/LoginDialog.h +++ b/interface/src/ui/LoginDialog.h @@ -45,15 +45,14 @@ public slots: void createFailed(QNetworkReply& reply); protected slots: - Q_INVOKABLE bool isSteamRunning(); + Q_INVOKABLE bool isSteamRunning() const; - Q_INVOKABLE void login(const QString& username, const QString& password); + Q_INVOKABLE void login(const QString& username, const QString& password) const; Q_INVOKABLE void loginThroughSteam(); Q_INVOKABLE void linkSteam(); Q_INVOKABLE void createAccountFromStream(QString username = QString()); - Q_INVOKABLE void openUrl(const QString& url); - Q_INVOKABLE void sendRecoveryEmail(const QString& email); + Q_INVOKABLE void openUrl(const QString& url) const; }; diff --git a/libraries/steamworks-wrapper/src/steamworks-wrapper/SteamClient.cpp b/libraries/steamworks-wrapper/src/steamworks-wrapper/SteamClient.cpp index f6cf13effd..2e8f6bd7b3 100644 --- a/libraries/steamworks-wrapper/src/steamworks-wrapper/SteamClient.cpp +++ b/libraries/steamworks-wrapper/src/steamworks-wrapper/SteamClient.cpp @@ -301,8 +301,7 @@ void SteamClient::joinLobby(QString lobbyIdStr) { if (!initialized) { if (SteamAPI_IsSteamRunning()) { init(); - } - else { + } else { qWarning() << "Steam is not running"; return; }