Update qt launcher styling, make unpinnable, and update name

This commit is contained in:
Ryan Huffman 2019-10-04 10:50:03 -07:00
parent 5c93f1bb6e
commit fe64f6e9ec
14 changed files with 190 additions and 170 deletions

View file

@ -97,7 +97,6 @@ Item {
}
Component.onCompleted: {
root.parent.setStateInfoState("right");
root.parent.setBuildInfoState("left");
}
}

View file

@ -56,7 +56,6 @@ Item {
}
Component.onCompleted: {
root.parent.setStateInfoState("right");
root.parent.setBuildInfoState("left");
}
}

View file

@ -24,7 +24,6 @@ Item {
HFTextHeader {
id: title
width: 481
height: 27
lineHeight: 35
lineHeightMode: Text.FixedHeight
text: root.titleText
@ -40,7 +39,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 +55,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 +72,7 @@ Item {
HFTextField {
id: email
width: 430
height: 50
placeholderText: "Email Address"
seperatorColor: Qt.rgba(1, 1, 1, 0.3)
anchors {
@ -89,7 +86,7 @@ Item {
HFTextField {
id: username
width: 430
height: 50
placeholderText: root.usernamePlaceholder
seperatorColor: Qt.rgba(1, 1, 1, 0.3)
anchors {
@ -103,7 +100,7 @@ Item {
HFTextField {
id: passwordField
width: 430
height: 50
placeholderText: root.passwordPlaceholder
seperatorColor: Qt.rgba(1, 1, 1, 0.3)
togglePasswordField: true
@ -136,7 +133,6 @@ Item {
HFTextField {
id: displayName
width: 430
height: 50
placeholderText: "Display Name"
seperatorColor: Qt.rgba(1, 1, 1, 0.3)
anchors {
@ -150,7 +146,6 @@ Item {
HFButton {
id: button
width: 134
height: 50
text: "NEXT"
@ -199,7 +194,6 @@ Item {
}
Component.onCompleted: {
root.parent.setStateInfoState("right");
root.parent.setBuildInfoState("left");
}
}

View file

@ -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");
}

View file

@ -15,163 +15,172 @@ 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
}
}
HFButton {
id: button
width: 110
text: "NEXT"
anchors {
top: displayName.bottom
left: displayName.left
topMargin: 25
horizontalCenter: parent.horizontalCenter
}
}
onClicked: LauncherState.login(username.text, password.text, displayName.text)
}
HFTextRegular {
id: instruction
Text {
text: "Create New Account"
font.family: "Graphik"
font.pixelSize: 14
color: "#009EE0"
visible: LauncherState.lastLoginErrorMessage.length == 0
text: "Use the account credentials you created at sign-up"
anchors {
left: parent.left
right: parent.right;
anchors {
top: button.bottom
topMargin: 16
left: button.left
top: title.bottom
topMargin: 18
}
}
MouseArea {
anchors.fill: parent
HFTextError {
id: error
cursorShape: Qt.PointingHandCursor
visible: LauncherState.lastLoginErrorMessage.length > 0
text: LauncherState.lastLoginErrorMessage
anchors {
top: title.bottom
topMargin: 18
onClicked: {
console.log("clicked");
LauncherState.gotoSignup();
left: parent.left
right: parent.right;
}
}
HFTextField {
id: username
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
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
placeholderText: "Display name"
seperatorColor: Qt.rgba(1, 1, 1, 0.3)
anchors {
top: displayText.bottom
topMargin: 4
left: parent.left
right: parent.right;
}
}
HFButton {
id: button
width: 110
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");
}
}

View file

@ -4,6 +4,8 @@ import QtQuick.Controls 2.1
TextField {
id: control
height: 50
font.family: "Graphik Regular"
font.pointSize: 10.5
color: text.length == 0 ? "#7e8c81" : "#000000"

View file

@ -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"

View file

@ -24,7 +24,6 @@ Item {
}
Component.onCompleted: {
root.parent.setStateInfoState("left");
root.parent.setBuildInfoState("right");
}
}

View file

@ -17,10 +17,6 @@ Item {
function setBuildInfoState(state) {
buildInfo.state = state;
}
function setStateInfoState(state) {
stateInfo.state = state;
}
}
Component.onCompleted: {

View file

@ -39,8 +39,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

View file

@ -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]() {

View file

@ -4,6 +4,32 @@
#include <QCursor>
#ifdef Q_OS_WIN
#include <shellapi.h>
#include <propsys.h>
#include <propkey.h>
#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()) {

View file

@ -5,7 +5,7 @@
class LauncherWindow : public QQuickView {
public:
LauncherWindow() = default;
LauncherWindow();
~LauncherWindow() = default;
void keyPressEvent(QKeyEvent* event) override;
void mousePressEvent(QMouseEvent* event) override;

View file

@ -61,6 +61,7 @@ int main(int argc, char *argv[]) {
QString name { "High Fidelity" };
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QCoreApplication::setOrganizationName(name);
QCoreApplication::setApplicationName(name);
Launcher launcher(argc, argv);