diff --git a/launchers/qt/CMakeLists.txt b/launchers/qt/CMakeLists.txt index 14fb0f590e..9bd4436073 100644 --- a/launchers/qt/CMakeLists.txt +++ b/launchers/qt/CMakeLists.txt @@ -62,7 +62,6 @@ if (WIN32) endif () - if (APPLE) ExternalProject_Add( qtlite @@ -127,6 +126,8 @@ set(src_files src/LauncherState.cpp src/LauncherWindow.h src/LauncherWindow.cpp + src/PathUtils.cpp + src/PathUtils.h src/Unzipper.h src/Unzipper.cpp deps/miniz/miniz.h @@ -201,6 +202,13 @@ add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD "${INTERFACE_EXEC_DIR}") +if (LAUNCHER_SOURCE_TREE_RESOURCES) + target_compile_definitions(${PROJECT_NAME} PRIVATE RESOURCE_PREFIX_URL="${CMAKE_CURRENT_SOURCE_DIR}/resources/") + message("Use source tree resources path: file://${CMAKE_CURRENT_SOURCE_DIR}/resources/") +else() + target_compile_definitions(${PROJECT_NAME} PRIVATE RESOURCE_PREFIX_URL="qrc:/") + message("Use resource.rcc path: qrc:/") +endif() if (APPLE) install( diff --git a/launchers/qt/resources/qml/DownloadFinished.qml b/launchers/qt/resources/qml/DownloadFinished.qml new file mode 100644 index 0000000000..a16800fa49 --- /dev/null +++ b/launchers/qt/resources/qml/DownloadFinished.qml @@ -0,0 +1,68 @@ +import QtQuick 2.3 +import QtQuick.Controls 2.1 +import "HFControls" + +Item { + id: root + anchors.centerIn: parent + + Image { + anchors.centerIn: parent + width: parent.width + height: parent.height + mirror: true + source: PathUtils.resourcePath("images/hifi_window@2x.png"); + transformOrigin: Item.Center + rotation: 0 + } + + + Image { + id: logo + width: 132 + height: 134 + source: PathUtils.resourcePath("images/HiFi_Voxel.png"); + + anchors { + top: root.top + topMargin: 84 + horizontalCenter: root.horizontalCenter + } + } + + Text { + id: header + width: 87 + height: 31 + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + font.family: "Graphik" + font.bold: true + font.pixelSize: 28 + color: "#FFFFFF" + text: "You're all set!" + anchors { + top: logo.bottom + topMargin: 26 + horizontalCenter: logo.horizontalCenter + } + } + + Text { + id: description + width: 100 + height: 40 + font.family: "Graphik" + font.pixelSize: 14 + color: "#FFFFFF" + text: "We will see you in world." + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + anchors { + top: header.bottom + topMargin: 8 + horizontalCenter: header.horizontalCenter + } + } + +} diff --git a/launchers/qt/resources/qml/HFBase/CreateAccountBase.qml b/launchers/qt/resources/qml/HFBase/CreateAccountBase.qml new file mode 100644 index 0000000000..563e12f924 --- /dev/null +++ b/launchers/qt/resources/qml/HFBase/CreateAccountBase.qml @@ -0,0 +1,159 @@ +import QtQuick 2.3 +import QtQuick 2.1 +import "../HFControls" + + +Item { + id: root + anchors.centerIn: parent + property string titleText: "Create your account" + property string usernamePlaceholder: "User name" + property string passwordPlaceholder: "Set a password" + property int marginLeft: root.width * 0.15 + + Image { + anchors.centerIn: parent + width: parent.width + height: parent.height + mirror: true + source: "qrc:/images/hifi_window@2x.png" + transformOrigin: Item.Center + rotation: 180 + } + + Text { + id: title + width: 325 + height: 26 + font.family: "Graphik" + font.bold: true + font.pixelSize: 24 + color: "#FFFFFF" + text: root.titleText + anchors { + top: root.top + topMargin: 29 + left: root.left + leftMargin: root.marginLeft + } + } + + Text { + id: instruction + width: 425 + height: 22 + font.family: "Graphik" + font.pixelSize: 10 + color: "#C4C4C4" + text: "Use the email address that you regisetered with." + anchors { + left: root.left + leftMargin: root.marginLeft + top: title.bottom + topMargin: 9 + } + } + + HFTextField { + id: organization + width: 353 + height: 40 + font.family: "Graphik" + font.pixelSize: 18 + placeholderText: "Organization name" + color: "#808080" + seperatorColor: Qt.rgba(1, 1, 1, 0.3) + anchors { + top: instruction.bottom + left: root.left + leftMargin: root.marginLeft + topMargin: 4 + } + } + + HFTextField { + id: username + width: 353 + height: 40 + font.family: "Graphik" + font.pixelSize: 18 + placeholderText: root.usernamePlaceholder + color: "#808080" + seperatorColor: Qt.rgba(1, 1, 1, 0.3) + anchors { + top: organization.bottom + left: root.left + leftMargin: root.marginLeft + topMargin: 10 + } + } + + HFTextField { + id: passwordField + width: 353 + height: 40 + font.family: "Graphik" + font.pixelSize: 18 + placeholderText: root.passwordPlaceholder + color: "#808080" + seperatorColor: Qt.rgba(1, 1, 1, 0.3) + echoMode: TextInput.Password + anchors { + top: username.bottom + left: root.left + leftMargin: root.marginLeft + topMargin: 10 + } + } + + + Text { + id: displayNameText + text: "This is the display name other people see in world. It can be changed at \nanytime, from your profile" + font.family: "Graphik" + font.pixelSize: 10 + color: "#FFFFFF" + anchors { + top: passwordField.bottom + left: root.left + leftMargin: root.marginLeft + topMargin: 15 + } + } + + HFTextField { + id: displayName + width: 353 + height: 40 + font.family: "Graphik" + font.pixelSize: 18 + placeholderText: "Password" + color: "#C4C4C4" + seperatorColor: Qt.rgba(1, 1, 1, 0.3) + anchors { + top: displayNameText.bottom + left: root.left + leftMargin: root.marginLeft + topMargin: 8 + } + } + + HFButton { + id: button + width: 122 + height: 36 + + font.family: "Graphik" + font.pixelSize: 18 + text: "NEXT" + + anchors { + top: displayName.bottom + left: root.left + leftMargin: root.marginLeft + topMargin: 15 + } + + onClicked: LauncherState.login(username.text, password.text) + } +} diff --git a/launchers/qt/resources/qml/HFBase/Error.qml b/launchers/qt/resources/qml/HFBase/Error.qml new file mode 100644 index 0000000000..d05ef01413 --- /dev/null +++ b/launchers/qt/resources/qml/HFBase/Error.qml @@ -0,0 +1,105 @@ +import QtQuick 2.3 +import QtQuick 2.1 +import "../HFControls" + + +Item { + id: root + anchors.centerIn: parent + + Image { + anchors.centerIn: parent + width: parent.width + height: parent.height + mirror: false + source: "qrc:/images/hifi_window@2x.png" + //fillMode: Image.PreserveAspectFit + transformOrigin: Item.Center + //rotation: 90 + } + + Image { + id: logo + width: 132 + height: 134 + source: "qrc:/images/HiFi_Voxel.png" + + anchors { + top: root.top + topMargin: 84 + horizontalCenter: root.horizontalCenter + } + } + + Text { + id: header + width: 87 + height: 31 + font.family: "Graphik" + font.bold: true + font.pixelSize: 28 + color: "#FFFFFF" + text: "Uh oh." + anchors { + top: logo.bottom + topMargin: 26 + horizontalCenter: logo.horizontalCenter + } + } + + Text { + id: description + width: 100 + height: 40 + font.family: "Graphik" + font.pixelSize: 14 + color: "#FFFFFF" + text: "We seem to have a problem.\n Please restart HQ Launcher" + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + anchors { + top: header.bottom + topMargin: 8 + horizontalCenter: header.horizontalCenter + } + } + + + HFButton { + id: button + width: 166 + height: 35 + font.family: "Graphik" + font.pixelSize: 18 + text: "Restart" + + anchors { + top: description.bottom + topMargin: 15 + horizontalCenter: description.horizontalCenter + } + } + + + Text { + id: hifilogo + width: 100 + height: 18 + + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + font.family: "Graphik" + font.pixelSize: 18 + font.bold: true + color: "#FFFFFF" + + text: "High Fidelity" + anchors { + right: root.right + rightMargin: 17 + bottom: root.bottom + bottomMargin: 17 + } + } + +} diff --git a/launchers/qt/resources/qml/HFControls/HFTextField.qml b/launchers/qt/resources/qml/HFControls/HFTextField.qml index 547cd94843..41d7dbc968 100644 --- a/launchers/qt/resources/qml/HFControls/HFTextField.qml +++ b/launchers/qt/resources/qml/HFControls/HFTextField.qml @@ -3,7 +3,7 @@ import QtQuick.Controls 2.1 TextField { id: control - color: "#FFFFFF" + //color: "#000000" font.family: "Graphik Medium" font.pixelSize: 22 verticalAlignment: TextInput.AlignVCenter @@ -14,14 +14,8 @@ TextField { background: Item { anchors.fill: parent Rectangle { - anchors { - bottom: parent.bottom - left: parent.left - leftMargin: 7 - right: parent.right - } - height: 1 - color: control.seperatorColor + color: "#FFFFFF" + anchors.fill: parent } } } diff --git a/launchers/qt/resources/qml/SplashScreen.qml b/launchers/qt/resources/qml/SplashScreen.qml index 793536205a..a710a7245c 100644 --- a/launchers/qt/resources/qml/SplashScreen.qml +++ b/launchers/qt/resources/qml/SplashScreen.qml @@ -4,10 +4,21 @@ import QtQuick.Controls 2.1 Item { anchors.fill: parent + + Image { + anchors.centerIn: parent + width: parent.width + height: parent.height + mirror: true + source: PathUtils.resourcePath("images/hifi_window@2x.png"); + transformOrigin: Item.Center + rotation: 0 + } + Image { anchors.centerIn: parent width: 225 height: 205 - source: "../images/hifi_logo_large@2x.png" + source: PathUtils.resourcePath("images/hifi_logo_large@2x.png"); } } diff --git a/launchers/qt/resources/qml/root.qml b/launchers/qt/resources/qml/root.qml index e80466a6eb..bcba440afb 100644 --- a/launchers/qt/resources/qml/root.qml +++ b/launchers/qt/resources/qml/root.qml @@ -5,11 +5,11 @@ import QtQuick.Controls 2.1 import HQLauncher 1.0 import "HFControls" -Image { +Item { id: root width: 515 - height: 450 - source: "../images/hifi_window@2x.png" + height: 390 + //source: "../images/hifi_window@2x.png" Loader { anchors.fill: parent diff --git a/launchers/qt/src/Launcher.cpp b/launchers/qt/src/Launcher.cpp index 23467624f8..2daaa415de 100644 --- a/launchers/qt/src/Launcher.cpp +++ b/launchers/qt/src/Launcher.cpp @@ -6,6 +6,7 @@ #include "LauncherWindow.h" #include "LauncherState.h" +#include "PathUtils.h" Launcher::Launcher(int& argc, char**argv) : QGuiApplication(argc, argv) { QString resourceBinaryLocation = QGuiApplication::applicationDirPath() + "/resources.rcc"; @@ -14,9 +15,10 @@ Launcher::Launcher(int& argc, char**argv) : QGuiApplication(argc, argv) { //_launcherState->setUIState(LauncherState::SPLASH_SCREEN); _launcherWindow = std::make_unique(); _launcherWindow->rootContext()->setContextProperty("LauncherState", _launcherState.get()); + _launcherWindow->rootContext()->setContextProperty("PathUtils", new PathUtils()); _launcherWindow->setFlags(Qt::FramelessWindowHint); LauncherState::declareQML(); - _launcherWindow->setSource(QUrl("qrc:/qml/root.qml")); + _launcherWindow->setSource(QUrl(PathUtils::resourcePath("qml/root.qml"))); _launcherWindow->setResizeMode(QQuickView::SizeRootObjectToView); _launcherWindow->show(); } diff --git a/launchers/qt/src/Launcher.h b/launchers/qt/src/Launcher.h index 2310c6ba08..7b939485d6 100644 --- a/launchers/qt/src/Launcher.h +++ b/launchers/qt/src/Launcher.h @@ -1,3 +1,4 @@ +#pragma once #include #include diff --git a/launchers/qt/src/LauncherState.cpp b/launchers/qt/src/LauncherState.cpp index 02adbdbdb3..71e4fb28ce 100644 --- a/launchers/qt/src/LauncherState.cpp +++ b/launchers/qt/src/LauncherState.cpp @@ -1,9 +1,11 @@ #include "LauncherState.h" +#include "PathUtils.h" #include "Unzipper.h" +#ifdef Q_OS_WIN #include - +#endif #include #include @@ -43,8 +45,8 @@ bool LatestBuilds::getBuild(QString tag, Build* outBuild) { } static const std::array QML_FILE_FOR_UI_STATE = - { { "qrc:/qml/SplashScreen.qml", "qrc:/qml/Login.qml", "qrc:/qml/DisplayName.qml", - "qrc:/qml/Download.qml", "qrc:/qml/DownloadFinshed.qml", "qrc:/qml/Error.qml" } }; + { { "SplashScreen.qml", "qml/HFBase/CreateAccountBase.qml", "DisplayName.qml", + "Download.qml", "DownloadFinished.qml", "qml/HFBase/Error.qml" } }; void LauncherState::ASSERT_STATE(LauncherState::ApplicationState state) { if (_applicationState != state) { @@ -61,6 +63,7 @@ void LauncherState::ASSERT_STATE(std::vector st return; } } + #ifdef Q_OS_WIN __debugbreak(); #endif @@ -99,11 +102,15 @@ LauncherState::UIState LauncherState::getUIState() const { case ApplicationState::LaunchingHighFidelity: return DOWNLOAD_FINSISHED; case ApplicationState::UnexpectedError: + #ifdef Q_OS_WIN __debugbreak(); + #endif return ERROR_SCREEN; default: qDebug() << "FATAL: No UI for" << _applicationState; + #ifdef Q_OS_WIN __debugbreak(); + #endif return ERROR_SCREEN; } } @@ -477,13 +484,15 @@ void LauncherState::setApplicationState(ApplicationState state) { qDebug() << "Changing application state: " << _applicationState << " -> " << state; if (state == ApplicationState::UnexpectedError) { + #ifdef Q_OS_WIN __debugbreak(); + #endif } _applicationState = state; emit uiStateChanged(); - emit updateSourceUrl(getCurrentUISource()); + emit updateSourceUrl(PathUtils::resourcePath(getCurrentUISource())); emit applicationStateChanged(); } diff --git a/launchers/qt/src/LauncherState.h b/launchers/qt/src/LauncherState.h index 691ea23ebf..d4590519a1 100644 --- a/launchers/qt/src/LauncherState.h +++ b/launchers/qt/src/LauncherState.h @@ -3,6 +3,7 @@ #include #include #include +#include #include #include diff --git a/launchers/qt/src/LauncherWindow.h b/launchers/qt/src/LauncherWindow.h index 394d9aed41..376ab9ae7b 100644 --- a/launchers/qt/src/LauncherWindow.h +++ b/launchers/qt/src/LauncherWindow.h @@ -1,5 +1,6 @@ #include #include +#include class LauncherWindow : public QQuickView { public: @@ -7,8 +8,10 @@ public: void mousePressEvent(QMouseEvent* event) override; void mouseReleaseEvent(QMouseEvent* event) override; void mouseMoveEvent(QMouseEvent* event) override; - + //void setLauncherState(std::shared_ptr launcherState) { _launcherState = launcherState; } private: bool _drag { false }; QPoint _previousMousePos; + + ///std::shared_ptr _launcherState { nullptr }; }; diff --git a/launchers/qt/src/PathUtils.cpp b/launchers/qt/src/PathUtils.cpp new file mode 100644 index 0000000000..ae02585788 --- /dev/null +++ b/launchers/qt/src/PathUtils.cpp @@ -0,0 +1,7 @@ +#include "PathUtils.h" + +#include + +QString PathUtils::resourcePath(const QString& source) { + return QString(RESOURCE_PREFIX_URL + source); +} diff --git a/launchers/qt/src/PathUtils.h b/launchers/qt/src/PathUtils.h new file mode 100644 index 0000000000..29d9b609d6 --- /dev/null +++ b/launchers/qt/src/PathUtils.h @@ -0,0 +1,11 @@ +#pragma once + +#include +#include +class PathUtils : public QObject { + Q_OBJECT +public: + PathUtils() = default; + ~PathUtils() = default; + Q_INVOKABLE static QString resourcePath(const QString& source); +}; diff --git a/launchers/qt/src/Unzipper.cpp b/launchers/qt/src/Unzipper.cpp index c7cca0b5e3..a650a4540a 100644 --- a/launchers/qt/src/Unzipper.cpp +++ b/launchers/qt/src/Unzipper.cpp @@ -3,7 +3,6 @@ #include #include #include -#include Unzipper::Unzipper(const QString& zipFilePath, const QDir& outputDirectory) : _zipFilePath(zipFilePath), _outputDirectory(outputDirectory) {