finish touch up of UI

This commit is contained in:
danteruiz 2019-10-02 15:43:32 -07:00
parent dbc136c438
commit 509545601e
12 changed files with 184 additions and 31 deletions

View file

@ -16,6 +16,10 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
include("cmake/init.cmake")
include("cmake/macros/SetPackagingParameters.cmake")
if(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif()
if (WIN32)
set(CMAKE_MFC_FLAG 1)
endif()
@ -233,13 +237,14 @@ endif()
if (LAUNCHER_SOURCE_TREE_RESOURCES)
target_compile_definitions(${PROJECT_NAME} PRIVATE RESOURCE_PREFIX_URL="${CMAKE_CURRENT_SOURCE_DIR}/resources/")
target_compile_definitions(${PROJECT_NAME} PRIVATE HIFI_USE_LOCAL_FILE)
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()
target_compile_definitions(${PROJECT_NAME} PRIVATE LAUNCHER_BUILD_VERSION="${BUILD_VERSION}")
target_compile_definitions(${PROJECT_NAME} PRIVATE LAUNCHER_BUILD_VERSION="${BUILD_VERSION}")
if (APPLE)
install(

View file

@ -99,16 +99,32 @@ Item {
color: "#01B2ED"
}
}
}
//PropertyAnimation {
//target: progressBar;
//loops: Animation.Infinite
//property: "value"
//from: 0;
//to: 1;
//duration: 5000
//running: true
//}
Text {
width: 100
height: 17
text: "High Fidelity"
font.bold: true
font.family: "Graphik"
font.pixelSize: 24
font.letterSpacing: -1
color: "#FFFFFF"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
anchors {
bottom: root.bottom
bottomMargin: 15
left: root.left
leftMargin: 30
}
}
Component.onCompleted: {
root.parent.setStateInfoState("right");
root.parent.setBuildInfoState("left");
}
}

View file

@ -65,4 +65,8 @@ Item {
}
}
Component.onCompleted: {
root.parent.setStateInfoState("right");
root.parent.setBuildInfoState("left");
}
}

View file

@ -206,4 +206,9 @@ Item {
rightMargin: 30
}
}
Component.onCompleted: {
root.parent.setStateInfoState("right");
root.parent.setBuildInfoState("left");
}
}

View file

@ -106,4 +106,9 @@ Item {
}
}
Component.onCompleted: {
root.parent.setStateInfoState("left");
root.parent.setBuildInfoState("right");
}
}

View file

@ -179,4 +179,9 @@ Item {
rightMargin: 136
}
}
Component.onCompleted: {
root.parent.setStateInfoState("left");
root.parent.setBuildInfoState("right");
}
}

View file

@ -2,6 +2,7 @@ import QtQuick 2.3
import QtQuick.Controls 2.1
Item {
id: root
anchors.fill: parent
@ -9,7 +10,7 @@ Item {
anchors.centerIn: parent
width: parent.width
height: parent.height
mirror: true
mirror: false
source: PathUtils.resourcePath("images/hifi_window@2x.png");
transformOrigin: Item.Center
rotation: 0
@ -21,4 +22,9 @@ Item {
height: 205
source: PathUtils.resourcePath("images/hifi_logo_large@2x.png");
}
Component.onCompleted: {
root.parent.setStateInfoState("left");
root.parent.setBuildInfoState("right");
}
}

View file

@ -12,6 +12,15 @@ Item {
Loader {
anchors.fill: parent
id: loader
function setBuildInfoState(state) {
buildInfo.state = state;
}
function setStateInfoState(state) {
stateInfo.state = state;
}
}
Component.onCompleted: {
@ -31,9 +40,61 @@ Item {
font.pixelSize: 12
anchors.right: root.right
anchors.bottom: root.bottom
anchors.top: root.top
color: "#FFFFFF"
text: LauncherState.uiState.toString() + " - " + LauncherState.applicationState
states: [
State {
name: "left"
AnchorChanges {
target: stateInfo
anchors.left: root.left
anchors.right: undefined
}
},
State {
name: "right"
AnchorChanges {
target: stateInfo
anchors.right: root.right
anchors.left: undefined
}
}
]
}
Text {
id: buildInfo
font.pixelSize: 12
anchors.right: root.right
anchors.bottom: root.bottom
color: "#FFFFFF"
text: "v." + LauncherState.buildVersion;
states: [
State {
name: "left"
AnchorChanges {
target: buildInfo
anchors.left: root.left
anchors.right: undefined
}
},
State {
name: "right"
AnchorChanges {
target: buildInfo
anchors.right: root.right
anchors.left: undefined
}
}
]
}
}

View file

@ -2,6 +2,10 @@
#include "Helper.h"
#include <string>
#include <chrono>
#include <iomanip>
#include <ctime>
#include <sstream>
#include <QStandardPaths>
#include <QFileInfo>
@ -101,6 +105,8 @@ void LauncherInstaller::uninstall() {
if (QFile::exists(desktopAppLinkPath)) {
QFile::remove(desktopAppLinkPath);
}
deleteApplicationRegistryKeys();
}
@ -115,13 +121,22 @@ void LauncherInstaller::createApplicationRegistryKeys() {
success = insertRegistryKey(REGISTRY_PATH, "DisplayVersion", "DEV");
success = insertRegistryKey(REGISTRY_PATH, "DisplayIcon", applicationExe);
success = insertRegistryKey(REGISTRY_PATH, "Publisher", "High Fidelity");
//success = LauncherUtils::insertRegistryKey(REGISTRY_PATH, "InstallDate", LauncherUtils::cStringToStd(CTime::GetCurrentTime().Format("%Y%m%d")));
auto now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
std::stringstream date;
date << std::put_time(std::localtime(&now), "%Y-%m-%d") ;
success = insertRegistryKey(REGISTRY_PATH, "InstallDate", date.str());
//success = LauncherUtils::insertRegistryKey(REGISTRY_PATH, "EstimatedSize", (DWORD)size);
success = insertRegistryKey(REGISTRY_PATH, "NoModify", (DWORD)1);
success = insertRegistryKey(REGISTRY_PATH, "NoRepair", (DWORD)1);
qDebug() << "--------: " << success;
qDebug() << "Did succcessfully insertRegistyKeys: " << success;
}
void LauncherInstaller::deleteApplicationRegistryKeys() {
const std::string regPath= "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\HQ";
if (!deleteRegistryKey(regPath.c_str())) {
qDebug() << "Failed to delete registryKeys";
}
}

View file

@ -46,7 +46,7 @@ QString LauncherState::getClientExecutablePath() const {
}
bool LauncherState::shouldDownloadContentCache() const {
return !_contentCacheURL.isNull() && !QFile::exists(getContentCachePath());
return !_contentCacheURL.isEmpty() && !QFile::exists(getContentCachePath());
}
bool LatestBuilds::getBuild(QString tag, Build* outBuild) {
@ -233,7 +233,7 @@ void LauncherState::receivedBuildsReply() {
}
if (shouldDownloadLauncher()) {
//downloadLauncher();
downloadLauncher();
}
getCurrentClientVersion();
}
@ -390,12 +390,15 @@ void LauncherState::requestSettings() {
connect(request, &UserSettingsRequest::finished, this, [this, request]() {
auto userSettings = request->getUserSettings();
if (userSettings.homeLocation.isEmpty()) {
qDebug() << "UserSettings is empty";
_homeLocation = "hifi://hq";
_contentCacheURL = "";
} else {
_homeLocation = userSettings.homeLocation;
auto host = QUrl(_homeLocation).host();
_contentCacheURL = "http://orgs.highfidelity.com/host-content-cache/" + host + ".zip";
qDebug() << "Content cache url: " << _contentCacheURL;
}
qDebug() << "Home location is: " << _homeLocation;
@ -423,7 +426,7 @@ void LauncherState::downloadClient() {
return;
}
_downloadProgress = 0;
_interfaceDownloadProgress = 0;
setApplicationState(ApplicationState::DownloadingClient);
// Start client download
@ -453,7 +456,7 @@ void LauncherState::downloadClient() {
}
});
connect(reply, &QNetworkReply::downloadProgress, this, [this](qint64 received, qint64 total) {
_downloadProgress = (float)received / (float)total;
_interfaceDownloadProgress = (float)received / (float)total;
emit downloadProgressChanged();
});
}
@ -465,7 +468,7 @@ void LauncherState::launcherDownloadComplete() {
#ifdef Q_OS_MAC
installLauncher();
#elif defined(Q_OS_WIN)
//launchAutoUpdater(_launcherZipFile.fileName());
launchAutoUpdater(_launcherZipFile.fileName());
#endif
}
@ -475,6 +478,16 @@ void LauncherState::clientDownloadComplete() {
installClient();
}
float LauncherState::calculateDownloadProgress() const{
if (shouldDownloadContentCache()) {
return (_interfaceDownloadProgress * 0.40f) + (_interfaceInstallProgress * 0.10f) +
(_contentInstallProgress * 0.40f) + (_contentDownloadProgress * 0.10f);
}
return (_interfaceDownloadProgress * 0.80f) + (_interfaceInstallProgress * 0.20f);
}
void LauncherState::installClient() {
ASSERT_STATE(ApplicationState::DownloadingClient);
setApplicationState(ApplicationState::InstallingClient);
@ -483,7 +496,7 @@ void LauncherState::installClient() {
_launcherDirectory.mkpath("interface_install");
auto installDir = _launcherDirectory.absoluteFilePath("interface_install");
_downloadProgress = 0;
_interfaceInstallProgress = 0;
qDebug() << "Unzipping " << _clientZipFile.fileName() << " to " << installDir;
@ -491,7 +504,7 @@ void LauncherState::installClient() {
unzipper->setAutoDelete(true);
connect(unzipper, &Unzipper::progress, this, [this](float progress) {
//qDebug() << "Unzipper progress: " << progress;
_downloadProgress = progress;
_interfaceInstallProgress = progress;
emit downloadProgressChanged();
});
connect(unzipper, &Unzipper::finished, this, [this](bool error, QString errorMessage) {
@ -575,7 +588,7 @@ void LauncherState::downloadContentCache() {
if (shouldDownloadContentCache()) {
setApplicationState(ApplicationState::DownloadingContentCache);
_downloadProgress = 0;
_contentDownloadProgress = 0;
qDebug() << "Downloading content cache from: " << _contentCacheURL;
QNetworkRequest request{ QUrl(_contentCacheURL) };
@ -592,7 +605,7 @@ void LauncherState::downloadContentCache() {
connect(reply, &QNetworkReply::finished, this, &LauncherState::contentCacheDownloadComplete);
connect(reply, &QNetworkReply::downloadProgress, this, [this](qint64 received, qint64 total) {
_downloadProgress = (float)received / (float)total;
_contentDownloadProgress = (float)received / (float)total;
emit downloadProgressChanged();
});
} else {
@ -633,13 +646,13 @@ void LauncherState::installContentCache() {
qDebug() << "Unzipping " << _contentZipFile.fileName() << " to " << installDir;
_downloadProgress = 0;
_contentInstallProgress = 0;
auto unzipper = new Unzipper(_contentZipFile.fileName(), QDir(installDir));
unzipper->setAutoDelete(true);
connect(unzipper, &Unzipper::progress, this, [this](float progress) {
qDebug() << "Unzipper progress (content cache): " << progress;
_downloadProgress = progress;
_contentInstallProgress = progress;
emit downloadProgressChanged();
});
connect(unzipper, &Unzipper::finished, this, [this](bool error, QString errorMessage) {
@ -700,9 +713,12 @@ void LauncherState::setApplicationState(ApplicationState state) {
}
_applicationState = state;
emit uiStateChanged();
emit updateSourceUrl(PathUtils::resourcePath(getCurrentUISource()));
UIState updatedUIState = getUIState();
if (_uiState != updatedUIState) {
emit uiStateChanged();
emit updateSourceUrl(PathUtils::resourcePath(getCurrentUISource()));
_uiState = getUIState();
}
emit applicationStateChanged();
}

View file

@ -32,7 +32,8 @@ 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(SignupRequest::Error lastSignupError MEMBER _lastSignupError NOTIFY lastSignupErrorChanged)
Q_PROPERTY(QString buildVersion READ getBuildVersion)
public:
LauncherState();
@ -95,6 +96,8 @@ public:
UIState getUIState() const;
QString getBuildVersion() { return QString(LAUNCHER_BUILD_VERSION); }
void setLastLoginError(LastLoginError lastLoginError);
LastLoginError getLastLoginError() const;
@ -135,7 +138,7 @@ public:
// Launching
void launchClient();
Q_INVOKABLE float getDownloadProgress() const { return _downloadProgress; }
Q_INVOKABLE float getDownloadProgress() const { return calculateDownloadProgress(); }
signals:
void updateSourceUrl(QUrl sourceUrl);
@ -157,6 +160,8 @@ private:
QString getClientDirectory() const;
QString getClientExecutablePath() const;
float calculateDownloadProgress() const;
bool shouldDownloadLauncher();
QNetworkAccessManager _networkAccessManager;
@ -165,6 +170,7 @@ private:
// Application State
ApplicationState _applicationState { ApplicationState::Init };
UIState _uiState { UIState::SPLASH_SCREEN };
LoginToken _loginResponse;
LastLoginError _lastLoginError { NONE };
SignupRequest::Error _lastSignupError{ SignupRequest::Error::None };
@ -183,4 +189,8 @@ private:
QString _password;
float _downloadProgress { 0 };
float _contentDownloadProgress { 0 };
float _contentInstallProgress { 0 };
float _interfaceDownloadProgress { 0 };
float _interfaceInstallProgress { 0 };
};

View file

@ -3,5 +3,10 @@
#include <QDebug>
QUrl PathUtils::resourcePath(const QString& source) {
return QUrl(RESOURCE_PREFIX_URL + source);
QString filePath = RESOURCE_PREFIX_URL + source;
#ifdef HIFI_USE_LOCAL_FILE
return QUrl::fromLocalFile(filePath);
#else
return QUrl(filePath);
#endif
}