diff --git a/launchers/qt/resources/qml/Download.qml b/launchers/qt/resources/qml/Download.qml index 04c2adacd2..00542d02d0 100644 --- a/launchers/qt/resources/qml/Download.qml +++ b/launchers/qt/resources/qml/Download.qml @@ -97,7 +97,6 @@ Item { } Component.onCompleted: { - root.parent.setStateInfoState("right"); root.parent.setBuildInfoState("left"); } } diff --git a/launchers/qt/resources/qml/DownloadFinished.qml b/launchers/qt/resources/qml/DownloadFinished.qml index efe5b26925..9a4b3e2f3d 100644 --- a/launchers/qt/resources/qml/DownloadFinished.qml +++ b/launchers/qt/resources/qml/DownloadFinished.qml @@ -56,7 +56,6 @@ Item { } Component.onCompleted: { - root.parent.setStateInfoState("right"); root.parent.setBuildInfoState("left"); } } diff --git a/launchers/qt/resources/qml/HFBase/CreateAccountBase.qml b/launchers/qt/resources/qml/HFBase/CreateAccountBase.qml index 283c7d7841..cf03b282bf 100644 --- a/launchers/qt/resources/qml/HFBase/CreateAccountBase.qml +++ b/launchers/qt/resources/qml/HFBase/CreateAccountBase.qml @@ -1,6 +1,8 @@ import QtQuick 2.3 import QtQuick 2.1 + import "../HFControls" +import HQLauncher 1.0 Item { @@ -11,6 +13,8 @@ Item { property string passwordPlaceholder: "Set a password" property int marginLeft: root.width * 0.15 + property bool enabled: LauncherState.applicationState == ApplicationState.WaitingForSignup + Image { anchors.centerIn: parent width: parent.width @@ -24,10 +28,9 @@ Item { HFTextHeader { id: title width: 481 - height: 27 lineHeight: 35 lineHeightMode: Text.FixedHeight - text: root.titleText + text: root.titleText + " " + LauncherState.applicationState visible: LauncherState.lastSignupErrorMessage.length == 0 ? root.titleText : "Uh oh." anchors { top: root.top @@ -40,7 +43,6 @@ Item { HFTextRegular { id: instruction width: 425 - height: 22 text: "Use the email address that you registered with." visible: LauncherState.lastSignupErrorMessage.length == 0 @@ -57,16 +59,15 @@ Item { id: error width: 425 - height: 22 - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter + wrapMode: Text.Wrap visible: LauncherState.lastSignupErrorMessage.length > 0 text: LauncherState.lastSignupErrorMessage + anchors { left: root.left - right: root.right + leftMargin: root.marginLeft top: title.bottom topMargin: 18 } @@ -75,7 +76,9 @@ Item { HFTextField { id: email width: 430 - height: 50 + + enabled: root.enabled + placeholderText: "Email Address" seperatorColor: Qt.rgba(1, 1, 1, 0.3) anchors { @@ -89,7 +92,9 @@ Item { HFTextField { id: username width: 430 - height: 50 + + enabled: root.enabled + placeholderText: root.usernamePlaceholder seperatorColor: Qt.rgba(1, 1, 1, 0.3) anchors { @@ -103,7 +108,9 @@ Item { HFTextField { id: passwordField width: 430 - height: 50 + + enabled: root.enabled + placeholderText: root.passwordPlaceholder seperatorColor: Qt.rgba(1, 1, 1, 0.3) togglePasswordField: true @@ -136,7 +143,9 @@ Item { HFTextField { id: displayName width: 430 - height: 50 + + enabled: root.enabled + placeholderText: "Display Name" seperatorColor: Qt.rgba(1, 1, 1, 0.3) anchors { @@ -152,7 +161,8 @@ Item { HFButton { id: button width: 134 - height: 50 + + enabled: root.enabled text: "NEXT" @@ -201,7 +211,6 @@ Item { } Component.onCompleted: { - root.parent.setStateInfoState("right"); root.parent.setBuildInfoState("left"); } } diff --git a/launchers/qt/resources/qml/HFBase/Error.qml b/launchers/qt/resources/qml/HFBase/Error.qml index 9c176d5349..6f30a8a464 100644 --- a/launchers/qt/resources/qml/HFBase/Error.qml +++ b/launchers/qt/resources/qml/HFBase/Error.qml @@ -49,10 +49,7 @@ Item { HFTextRegular { id: description - width: 100 - height: 40 - - text: "We seem to have a problem.\n Please restart HQ Launcher" + text: "We seem to have a problem.\nPlease restart HQ Launcher" horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter @@ -83,7 +80,6 @@ Item { } Component.onCompleted: { - root.parent.setStateInfoState("left"); root.parent.setBuildInfoState("right"); } diff --git a/launchers/qt/resources/qml/HFBase/LoginBase.qml b/launchers/qt/resources/qml/HFBase/LoginBase.qml index 13c00dff19..f30ce7bcd5 100644 --- a/launchers/qt/resources/qml/HFBase/LoginBase.qml +++ b/launchers/qt/resources/qml/HFBase/LoginBase.qml @@ -1,11 +1,15 @@ import QtQuick 2.3 import QtQuick 2.1 + import "../HFControls" +import HQLauncher 1.0 Item { id: root anchors.fill: parent + property bool enabled: LauncherState.applicationState == ApplicationState.WaitingForLogin + Image { anchors.centerIn: parent width: parent.width @@ -15,165 +19,181 @@ Item { transformOrigin: Item.Center rotation: 0 } - HFTextHeader { - id: title - width: 325 - height: 26 - font.bold: true - text: "Please Log in" - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter + + Item { + width: 353 + height: root.height + + anchors { top: root.top - topMargin: 40 horizontalCenter: root.horizontalCenter } - } - HFTextRegular { - id: instruction - width: 425 - height: 22 + HFTextHeader { + id: title - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter + font.bold: true - visible: LauncherState.lastLoginErrorMessage.length == 0 - text: "Use the account credentials you created at sign-up" - anchors { - left: root.left - right: root.right - top: title.bottom - topMargin: 18 - } - } + text: "Please Log in" - HFTextError { - id: error - width: 425 - height: 22 + anchors { + top: parent.top + topMargin: 40 - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - - visible: LauncherState.lastLoginErrorMessage.length > 0 - text: LauncherState.lastLoginErrorMessage - anchors { - left: root.left - right: root.right - top: title.bottom - topMargin: 18 - } - } - - HFTextField { - id: username - width: 353 - height: 50 - - placeholderText: "Username" - - seperatorColor: Qt.rgba(1, 1, 1, 0.3) - anchors { - top: error.bottom - horizontalCenter: error.horizontalCenter - topMargin: 24 - } - } - - HFTextField { - id: password - width: 353 - height: 50 - placeholderText: "Password" - togglePasswordField: true - echoMode: TextInput.Password - seperatorColor: Qt.rgba(1, 1, 1, 0.3) - anchors { - top: username.bottom - horizontalCenter: instruction.horizontalCenter - topMargin: 25 - } - } - - - HFTextRegular { - id: displayText - - text: "You can change this at anytime from your profile." - - anchors { - top: password.bottom - topMargin: 50 - left: password.left - } - } - - HFTextField { - id: displayName - width: 353 - height: 50 - placeholderText: "Display name" - seperatorColor: Qt.rgba(1, 1, 1, 0.3) - anchors { - top: displayText.bottom - horizontalCenter: instruction.horizontalCenter - topMargin: 4 + horizontalCenter: parent.horizontalCenter + } } - onAccepted: LauncherState.login(username.text, password.text, displayName.text) - } + HFTextRegular { + id: instruction - HFButton { - id: button - width: 110 + visible: LauncherState.lastLoginErrorMessage.length == 0 + text: "Use the account credentials you created at sign-up" + anchors { + left: parent.left + right: parent.right; - text: "NEXT" - - anchors { - top: displayName.bottom - left: displayName.left - topMargin: 25 + top: title.bottom + topMargin: 18 + } } - onClicked: LauncherState.login(username.text, password.text, displayName.text) - } + HFTextError { + id: error - Text { - text: "Create New Account" - font.family: "Graphik" - font.pixelSize: 14 - color: "#009EE0" + visible: LauncherState.lastLoginErrorMessage.length > 0 + text: LauncherState.lastLoginErrorMessage + anchors { + top: title.bottom + topMargin: 18 - anchors { - top: button.bottom - topMargin: 16 - left: button.left + left: parent.left + right: parent.right; + } } - MouseArea { - anchors.fill: parent + HFTextField { + id: username - cursorShape: Qt.PointingHandCursor + enabled: root.enabled - onClicked: { - console.log("clicked"); - LauncherState.gotoSignup(); + placeholderText: "Username" + + seperatorColor: Qt.rgba(1, 1, 1, 0.3) + anchors { + top: error.bottom + topMargin: 24 + + left: parent.left + right: parent.right; + } + } + + HFTextField { + id: password + + enabled: root.enabled + + placeholderText: "Password" + togglePasswordField: true + echoMode: TextInput.Password + seperatorColor: Qt.rgba(1, 1, 1, 0.3) + anchors { + top: username.bottom + topMargin: 25 + + left: parent.left + right: parent.right; + } + } + + + HFTextRegular { + id: displayText + + text: "You can change this at anytime from your profile." + + anchors { + top: password.bottom + topMargin: 50 + + left: parent.left + right: parent.right; + } + } + + HFTextField { + id: displayName + + enabled: root.enabled + + placeholderText: "Display name" + seperatorColor: Qt.rgba(1, 1, 1, 0.3) + anchors { + top: displayText.bottom + topMargin: 4 + + left: parent.left + right: parent.right; + } + onAccepted: LauncherState.login(username.text, password.text, displayName.text) + } + + HFButton { + id: button + width: 110 + + enabled: root.enabled + + text: "NEXT" + + anchors { + top: displayName.bottom + topMargin: 25 + + left: parent.left + } + + onClicked: LauncherState.login(username.text, password.text, displayName.text) + } + + Text { + id: createAccountLink + + text: "Create New Account" + font.family: "Graphik" + font.pixelSize: 14 + color: "#009EE0" + + anchors { + top: button.bottom + topMargin: 16 + left: parent.left + } + + MouseArea { + anchors.fill: parent + + cursorShape: Qt.PointingHandCursor + + onClicked: { + console.log("clicked"); + LauncherState.gotoSignup(); + } + } + } + + HFTextLogo { + anchors { + bottom: createAccountLink.bottom + + right: parent.right } } } - HFTextLogo { - anchors { - bottom: root.bottom - bottomMargin: 58 - right: root.right - rightMargin: 136 - } - } - Component.onCompleted: { - root.parent.setStateInfoState("left"); root.parent.setBuildInfoState("right"); } } diff --git a/launchers/qt/resources/qml/HFControls/HFButton.qml b/launchers/qt/resources/qml/HFControls/HFButton.qml index ad04286114..a4d077a1e7 100644 --- a/launchers/qt/resources/qml/HFControls/HFButton.qml +++ b/launchers/qt/resources/qml/HFControls/HFButton.qml @@ -7,8 +7,8 @@ Button { height: 50 property string backgroundColor: "#00000000" - property string borderColor: "#FFFFFF" - property string textColor: "#FFFFFF" + property string borderColor: enabled ? "#FFFFFF" : "#7e8c81" + property string textColor: borderColor property int backgroundOpacity: 1 property int backgroundRadius: 1 property int backgroundWidth: 2 diff --git a/launchers/qt/resources/qml/HFControls/HFTextField.qml b/launchers/qt/resources/qml/HFControls/HFTextField.qml index 361e81b951..a98e73c659 100644 --- a/launchers/qt/resources/qml/HFControls/HFTextField.qml +++ b/launchers/qt/resources/qml/HFControls/HFTextField.qml @@ -4,9 +4,11 @@ import QtQuick.Controls 2.1 TextField { id: control + height: 50 + font.family: "Graphik Regular" font.pointSize: 10.5 - color: text.length == 0 ? "#7e8c81" : "#000000" + color: (text.length == 0 || !enabled) ? "#7e8c81" : "#000000" property bool togglePasswordField: false verticalAlignment: TextInput.AlignVCenter diff --git a/launchers/qt/resources/qml/HFControls/HFTextLogo.qml b/launchers/qt/resources/qml/HFControls/HFTextLogo.qml index f3c7468373..08025ef715 100644 --- a/launchers/qt/resources/qml/HFControls/HFTextLogo.qml +++ b/launchers/qt/resources/qml/HFControls/HFTextLogo.qml @@ -2,9 +2,6 @@ import QtQuick 2.3 import QtQuick 2.1 Text { - width: 100 - height: 17 - text: "High Fidelity" font.bold: true font.family: "Graphik Semibold" diff --git a/launchers/qt/resources/qml/SplashScreen.qml b/launchers/qt/resources/qml/SplashScreen.qml index 47dff2aa9d..acbb7b900f 100644 --- a/launchers/qt/resources/qml/SplashScreen.qml +++ b/launchers/qt/resources/qml/SplashScreen.qml @@ -5,7 +5,6 @@ Item { id: root anchors.fill: parent - Image { anchors.centerIn: parent width: parent.width @@ -24,7 +23,6 @@ Item { } Component.onCompleted: { - root.parent.setStateInfoState("left"); root.parent.setBuildInfoState("right"); } } diff --git a/launchers/qt/resources/qml/root.qml b/launchers/qt/resources/qml/root.qml index c7281919fe..e3f82450f2 100644 --- a/launchers/qt/resources/qml/root.qml +++ b/launchers/qt/resources/qml/root.qml @@ -17,10 +17,6 @@ Item { function setBuildInfoState(state) { buildInfo.state = state; } - - function setStateInfoState(state) { - //stateInfo.state = state; - } } Component.onCompleted: { diff --git a/launchers/qt/src/BuildsRequest.cpp b/launchers/qt/src/BuildsRequest.cpp index 5986bf085f..e7ec02c380 100644 --- a/launchers/qt/src/BuildsRequest.cpp +++ b/launchers/qt/src/BuildsRequest.cpp @@ -64,7 +64,6 @@ void BuildsRequest::receivedResponse() { } else { auto root = doc.object(); if (!root.contains("default_tag")) { - //setApplicationState(ApplicationState::UnexpectedError); _error = Error::MissingDefaultTag; emit finished(); return; @@ -74,7 +73,6 @@ void BuildsRequest::receivedResponse() { auto results = root["results"]; if (!results.isArray()) { - //setApplicationState(ApplicationState::UnexpectedError); _error = Error::MalformedResponse; emit finished(); return; diff --git a/launchers/qt/src/Helper_windows.cpp b/launchers/qt/src/Helper_windows.cpp index a6bb1dabd5..ebbf1fab72 100644 --- a/launchers/qt/src/Helper_windows.cpp +++ b/launchers/qt/src/Helper_windows.cpp @@ -40,8 +40,8 @@ void launchClient(const QString& clientPath, const QString& homePath, const QStr // start the program up BOOL success = CreateProcess( - clientPath.toUtf8().data(), - params.toUtf8().data(), + clientPath.toLatin1().data(), + params.toLatin1().data(), nullptr, // Process handle not inheritable nullptr, // Thread handle not inheritable FALSE, // Set handle inheritance to FALSE diff --git a/launchers/qt/src/Launcher.cpp b/launchers/qt/src/Launcher.cpp index b0566eee0a..e2d660e782 100644 --- a/launchers/qt/src/Launcher.cpp +++ b/launchers/qt/src/Launcher.cpp @@ -15,6 +15,7 @@ Launcher::Launcher(int& argc, char**argv) : QGuiApplication(argc, argv) { _launcherWindow = std::make_unique(); _launcherWindow->rootContext()->setContextProperty("LauncherState", _launcherState.get()); _launcherWindow->rootContext()->setContextProperty("PathUtils", new PathUtils()); + _launcherWindow->setTitle("High Fidelity"); _launcherWindow->setFlags(Qt::FramelessWindowHint | Qt::Window); _launcherWindow->setLauncherStatePtr(_launcherState); diff --git a/launchers/qt/src/LauncherState.cpp b/launchers/qt/src/LauncherState.cpp index a2f5892055..ddb5ab2dd8 100644 --- a/launchers/qt/src/LauncherState.cpp +++ b/launchers/qt/src/LauncherState.cpp @@ -111,7 +111,7 @@ static const std::array QML_FILE_ { { "qml/SplashScreen.qml", "qml/HFBase/CreateAccountBase.qml", "qml/HFBase/LoginBase.qml", "qml/Download.qml", "qml/DownloadFinished.qml", "qml/HFBase/Error.qml" } }; -void LauncherState::ASSERT_STATE(LauncherState::ApplicationState state) { +void LauncherState::ASSERT_STATE(ApplicationState state) { if (_applicationState != state) { qDebug() << "Unexpected state, current: " << _applicationState << ", expected: " << state; #ifdef BREAK_ON_ERROR @@ -120,7 +120,7 @@ void LauncherState::ASSERT_STATE(LauncherState::ApplicationState state) { } } -void LauncherState::ASSERT_STATE(const std::vector& states) { +void LauncherState::ASSERT_STATE(const std::vector& states) { for (auto state : states) { if (_applicationState == state) { return; @@ -146,7 +146,7 @@ QString LauncherState::getCurrentUISource() const { } void LauncherState::declareQML() { - qmlRegisterType("HQLauncher", 1, 0, "LauncherStateEnums"); + qmlRegisterType("HQLauncher", 1, 0, "ApplicationState"); } LauncherState::UIState LauncherState::getUIState() const { @@ -325,15 +325,19 @@ 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 - please try another password."); + setLastSignupErrorMessage("That's an invalid password - passwords must be at least 6 characters."); setApplicationState(ApplicationState::WaitingForSignup); return; } else if (err == SignupRequest::Error::BadUsername) { setLastSignupErrorMessage("That's an invalid username - please try another username."); setApplicationState(ApplicationState::WaitingForSignup); return; - } else if (err == SignupRequest::Error::UserProfileAlreadyCompleted || err == SignupRequest::Error::NoSuchEmail) { - setLastSignupErrorMessage("That email does not have an account setup for it, or it was previously completed."); + } else if (err == SignupRequest::Error::UserProfileAlreadyCompleted) { + setLastSignupErrorMessage("That email has already been completed."); + setApplicationState(ApplicationState::WaitingForSignup); + return; + } else if (err == SignupRequest::Error::NoSuchEmail) { + setLastSignupErrorMessage("That email does not have an account setup for it."); setApplicationState(ApplicationState::WaitingForSignup); return; } else if (err != SignupRequest::Error::None) { @@ -383,8 +387,6 @@ void LauncherState::login(QString username, QString password, QString displayNam _displayName = displayName; - qDebug() << "Got login: " << username << password; - auto request = new LoginRequest(); connect(request, &LoginRequest::finished, this, [this, request]() { @@ -533,7 +535,6 @@ void LauncherState::installClient() { auto unzipper = new Unzipper(_clientZipFile.fileName(), QDir(installDir)); unzipper->setAutoDelete(true); connect(unzipper, &Unzipper::progress, this, [this](float progress) { - //qDebug() << "Unzipper progress: " << progress; _interfaceInstallProgress = progress; emit downloadProgressChanged(); }); @@ -547,8 +548,6 @@ void LauncherState::installClient() { } }); QThreadPool::globalInstance()->start(unzipper); - - //launchClient(); } void LauncherState::downloadLauncher() { @@ -770,3 +769,4 @@ void LauncherState::setApplicationState(ApplicationState state) { LauncherState::ApplicationState LauncherState::getApplicationState() const { return _applicationState; } + diff --git a/launchers/qt/src/LauncherState.h b/launchers/qt/src/LauncherState.h index 6c5015fe77..7d902417ac 100644 --- a/launchers/qt/src/LauncherState.h +++ b/launchers/qt/src/LauncherState.h @@ -70,19 +70,18 @@ public: LaunchingHighFidelity, }; + Q_ENUM(ApplicationState) + bool _isDebuggingScreens{ false }; UIState _currentDebugScreen{ UIState::SplashScreen }; void toggleDebugState(); void gotoNextDebugScreen(); void gotoPreviousDebugScreen(); - Q_ENUM(UIState); - Q_ENUM(ApplicationState) - Q_INVOKABLE QString getCurrentUISource() const; - void ASSERT_STATE(LauncherState::ApplicationState state); - void ASSERT_STATE(const std::vector& states); + void ASSERT_STATE(ApplicationState state); + void ASSERT_STATE(const std::vector& states); static void declareQML(); diff --git a/launchers/qt/src/LauncherWindow.cpp b/launchers/qt/src/LauncherWindow.cpp index 3c13e5908a..53a781f1e1 100644 --- a/launchers/qt/src/LauncherWindow.cpp +++ b/launchers/qt/src/LauncherWindow.cpp @@ -4,6 +4,32 @@ #include +#ifdef Q_OS_WIN +#include +#include +#include +#endif + +LauncherWindow::LauncherWindow() { +#ifdef Q_OS_WIN + // On Windows, disable pinning of the launcher. + IPropertyStore* pps; + HWND id = (HWND)this->winId(); + if (id == NULL) { + qDebug() << "Failed to disable pinning, window id is null"; + } else { + HRESULT hr = SHGetPropertyStoreForWindow(id, IID_PPV_ARGS(&pps)); + if (SUCCEEDED(hr)) { + PROPVARIANT var; + var.vt = VT_BOOL; + var.boolVal = VARIANT_TRUE; + hr = pps->SetValue(PKEY_AppUserModel_PreventPinning, var); + pps->Release(); + } + } +#endif +} + void LauncherWindow::keyPressEvent(QKeyEvent* event) { QQuickView::keyPressEvent(event); if (!event->isAccepted()) { diff --git a/launchers/qt/src/LauncherWindow.h b/launchers/qt/src/LauncherWindow.h index 08e8cf4825..52b83b88c0 100644 --- a/launchers/qt/src/LauncherWindow.h +++ b/launchers/qt/src/LauncherWindow.h @@ -5,7 +5,7 @@ class LauncherWindow : public QQuickView { public: - LauncherWindow() = default; + LauncherWindow(); ~LauncherWindow() = default; void keyPressEvent(QKeyEvent* event) override; void mousePressEvent(QMouseEvent* event) override; diff --git a/launchers/qt/src/main.cpp b/launchers/qt/src/main.cpp index 0965a5742f..a6d512b593 100644 --- a/launchers/qt/src/main.cpp +++ b/launchers/qt/src/main.cpp @@ -58,9 +58,11 @@ int main(int argc, char *argv[]) { } #endif + QString name { "High Fidelity" }; QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QCoreApplication::setOrganizationName(name); + QCoreApplication::setApplicationName("HQ Launcher"); Launcher launcher(argc, argv);