From 859e8b4ea9e8f48a5e68d3e865792992543e915d Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 9 Oct 2019 17:00:34 -0700 Subject: [PATCH] Update qt launcher messaging to reflect feedback --- .../qml/HFBase/CreateAccountBase.qml | 15 ++++++++++--- launchers/qt/resources/qml/HFBase/Error.qml | 2 +- .../qt/resources/qml/HFBase/LoginBase.qml | 8 +++---- .../qml/HFControls/HFTextRegular.qml | 10 +++++++++ launchers/qt/src/LauncherState.cpp | 21 ++++++++++++++++--- launchers/qt/src/LauncherState.h | 3 ++- 6 files changed, 46 insertions(+), 13 deletions(-) diff --git a/launchers/qt/resources/qml/HFBase/CreateAccountBase.qml b/launchers/qt/resources/qml/HFBase/CreateAccountBase.qml index 06f8aaf5f3..a3e7ee5557 100644 --- a/launchers/qt/resources/qml/HFBase/CreateAccountBase.qml +++ b/launchers/qt/resources/qml/HFBase/CreateAccountBase.qml @@ -10,7 +10,7 @@ Item { anchors.centerIn: parent property string titleText: "Sign-in and pick a password" property string usernamePlaceholder: "Username" - property string passwordPlaceholder: "Set a password" + property string passwordPlaceholder: "Set a password (must be at least 6 characters)" property int marginLeft: root.width * 0.15 property bool enabled: LauncherState.applicationState == ApplicationState.WaitingForSignup @@ -43,7 +43,7 @@ Item { id: instruction width: 425 - text: "Use the email address that you registered with." + text: "Use the email address you applied for access with." visible: LauncherState.lastSignupErrorMessage.length == 0 anchors { @@ -64,6 +64,16 @@ Item { visible: LauncherState.lastSignupErrorMessage.length > 0 text: LauncherState.lastSignupErrorMessage + textFormat: Text.StyledText + + onLinkActivated: { + if (link == "login") { + LauncherState.gotoLogin(); + } else { + LauncherState.openURLInBrowser(link) + } + } + anchors { left: root.left leftMargin: root.marginLeft @@ -194,7 +204,6 @@ Item { cursorShape: Qt.PointingHandCursor onClicked: { - console.log("clicked"); LauncherState.gotoLogin(); } } diff --git a/launchers/qt/resources/qml/HFBase/Error.qml b/launchers/qt/resources/qml/HFBase/Error.qml index 6f30a8a464..ad57f242f4 100644 --- a/launchers/qt/resources/qml/HFBase/Error.qml +++ b/launchers/qt/resources/qml/HFBase/Error.qml @@ -49,7 +49,7 @@ Item { HFTextRegular { id: description - text: "We seem to have a problem.\nPlease restart HQ Launcher" + text: "We seem to have a problem.\nPlease restart Launcher" horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter diff --git a/launchers/qt/resources/qml/HFBase/LoginBase.qml b/launchers/qt/resources/qml/HFBase/LoginBase.qml index bd8b5a4a1b..cb468f9bc1 100644 --- a/launchers/qt/resources/qml/HFBase/LoginBase.qml +++ b/launchers/qt/resources/qml/HFBase/LoginBase.qml @@ -51,11 +51,10 @@ Item { visible: LauncherState.lastLoginErrorMessage.length == 0 text: "Use the account credentials you created at sign-up" anchors { - left: parent.left - right: parent.right; - top: title.bottom topMargin: 18 + + horizontalCenter: parent.horizontalCenter } } @@ -68,8 +67,7 @@ Item { top: title.bottom topMargin: 18 - left: parent.left - right: parent.right; + horizontalCenter: parent.horizontalCenter } } diff --git a/launchers/qt/resources/qml/HFControls/HFTextRegular.qml b/launchers/qt/resources/qml/HFControls/HFTextRegular.qml index ae600c12a5..58103d6118 100644 --- a/launchers/qt/resources/qml/HFControls/HFTextRegular.qml +++ b/launchers/qt/resources/qml/HFControls/HFTextRegular.qml @@ -2,7 +2,17 @@ import QtQuick 2.3 import QtQuick 2.1 Text { + id: root + font.family: "Graphik Regular" font.pointSize: 10.5 + color: "#C4C4C4" + linkColor: color + + MouseArea { + anchors.fill: root + cursorShape: root.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor + acceptedButtons: Qt.NoButton + } } diff --git a/launchers/qt/src/LauncherState.cpp b/launchers/qt/src/LauncherState.cpp index 10c8afcdb0..f22cf6dcf0 100644 --- a/launchers/qt/src/LauncherState.cpp +++ b/launchers/qt/src/LauncherState.cpp @@ -28,6 +28,10 @@ #include +#ifdef Q_OS_WIN +#include +#endif + //#define BREAK_ON_ERROR const QString configHomeLocationKey { "homeLocation" }; @@ -35,6 +39,14 @@ const QString configLastLoginKey { "lastLogin" }; const QString configLoggedInKey{ "loggedIn" }; const QString configLauncherPathKey{ "launcherPath" }; +Q_INVOKABLE void LauncherState::openURLInBrowser(QString url) { +#ifdef Q_OS_WIN + ShellExecute(0, 0, url.toLatin1(), 0, 0 , SW_SHOW); +#elif defined(Q_OS_DARWIN) + system("open \"" + url.toLatin1() + "\"); +#endif +} + void LauncherState::toggleDebugState() { _isDebuggingScreens = !_isDebuggingScreens; @@ -293,6 +305,8 @@ void LauncherState::getCurrentClientVersion() { void LauncherState::gotoSignup() { if (_applicationState == ApplicationState::WaitingForLogin) { + setLastSignupErrorMessage(""); + _lastLoginErrorMessage = ""; setApplicationState(ApplicationState::WaitingForSignup); } else { qDebug() << "Error, can't switch to signup page, current state is: " << _applicationState; @@ -301,6 +315,7 @@ void LauncherState::gotoSignup() { void LauncherState::gotoLogin() { if (_applicationState == ApplicationState::WaitingForSignup) { + setLastLoginErrorMessage(""); setApplicationState(ApplicationState::WaitingForLogin); } else { qDebug() << "Error, can't switch to signup page, current state is: " << _applicationState; @@ -337,7 +352,7 @@ void LauncherState::signup(QString email, QString username, QString password, QS setApplicationState(ApplicationState::WaitingForSignup); return; } else if (err == SignupRequest::Error::BadPassword) { - setLastSignupErrorMessage("That's an invalid password - passwords must be at least 6 characters."); + setLastSignupErrorMessage("That's an invalid password - must be at least 6 characters."); setApplicationState(ApplicationState::WaitingForSignup); return; } else if (err == SignupRequest::Error::BadUsername) { @@ -345,11 +360,11 @@ void LauncherState::signup(QString email, QString username, QString password, QS setApplicationState(ApplicationState::WaitingForSignup); return; } else if (err == SignupRequest::Error::UserProfileAlreadyCompleted) { - setLastSignupErrorMessage("That email has already been completed."); + setLastSignupErrorMessage("This email exists, if it's yours please login."); setApplicationState(ApplicationState::WaitingForSignup); return; } else if (err == SignupRequest::Error::NoSuchEmail) { - setLastSignupErrorMessage("That email does not have an account setup for it."); + setLastSignupErrorMessage("That email isn't setup yet. Request Access."); setApplicationState(ApplicationState::WaitingForSignup); return; } else if (err != SignupRequest::Error::None) { diff --git a/launchers/qt/src/LauncherState.h b/launchers/qt/src/LauncherState.h index 7cbb09d237..32ab9bb9e9 100644 --- a/launchers/qt/src/LauncherState.h +++ b/launchers/qt/src/LauncherState.h @@ -25,7 +25,6 @@ class LauncherState : public QObject { Q_PROPERTY(UIState uiState READ getUIState NOTIFY uiStateChanged) Q_PROPERTY(ApplicationState applicationState READ getApplicationState NOTIFY applicationStateChanged) Q_PROPERTY(float downloadProgress READ getDownloadProgress NOTIFY downloadProgressChanged) - Q_PROPERTY(SignupRequest::Error lastSignupError MEMBER _lastSignupError NOTIFY lastSignupErrorChanged) Q_PROPERTY(QString lastLoginErrorMessage READ getLastLoginErrorMessage NOTIFY lastLoginErrorMessageChanged) Q_PROPERTY(QString lastSignupErrorMessage READ getLastSignupErrorMessage NOTIFY lastSignupErrorMessageChanged) Q_PROPERTY(QString buildVersion READ getBuildVersion) @@ -136,6 +135,8 @@ public: Q_INVOKABLE float getDownloadProgress() const { return calculateDownloadProgress(); } + Q_INVOKABLE void openURLInBrowser(QString url); + signals: void updateSourceUrl(QUrl sourceUrl); void uiStateChanged();