mirror of
https://github.com/JulianGro/overte.git
synced 2025-08-04 21:28:01 +02:00
Update qt launcher to disable inputs when making requests
This commit is contained in:
parent
a661d62959
commit
f912268129
10 changed files with 42 additions and 19 deletions
|
@ -1,6 +1,8 @@
|
||||||
import QtQuick 2.3
|
import QtQuick 2.3
|
||||||
import QtQuick 2.1
|
import QtQuick 2.1
|
||||||
|
|
||||||
import "../HFControls"
|
import "../HFControls"
|
||||||
|
import HQLauncher 1.0
|
||||||
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
@ -11,6 +13,8 @@ Item {
|
||||||
property string passwordPlaceholder: "Set a password"
|
property string passwordPlaceholder: "Set a password"
|
||||||
property int marginLeft: root.width * 0.15
|
property int marginLeft: root.width * 0.15
|
||||||
|
|
||||||
|
property bool enabled: LauncherState.applicationState == ApplicationState.WaitingForSignup
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
@ -26,7 +30,7 @@ Item {
|
||||||
width: 481
|
width: 481
|
||||||
lineHeight: 35
|
lineHeight: 35
|
||||||
lineHeightMode: Text.FixedHeight
|
lineHeightMode: Text.FixedHeight
|
||||||
text: root.titleText
|
text: root.titleText + " " + LauncherState.applicationState
|
||||||
visible: LauncherState.lastSignupErrorMessage.length == 0 ? root.titleText : "Uh oh."
|
visible: LauncherState.lastSignupErrorMessage.length == 0 ? root.titleText : "Uh oh."
|
||||||
anchors {
|
anchors {
|
||||||
top: root.top
|
top: root.top
|
||||||
|
@ -73,6 +77,8 @@ Item {
|
||||||
id: email
|
id: email
|
||||||
width: 430
|
width: 430
|
||||||
|
|
||||||
|
enabled: root.enabled
|
||||||
|
|
||||||
placeholderText: "Email Address"
|
placeholderText: "Email Address"
|
||||||
seperatorColor: Qt.rgba(1, 1, 1, 0.3)
|
seperatorColor: Qt.rgba(1, 1, 1, 0.3)
|
||||||
anchors {
|
anchors {
|
||||||
|
@ -87,6 +93,8 @@ Item {
|
||||||
id: username
|
id: username
|
||||||
width: 430
|
width: 430
|
||||||
|
|
||||||
|
enabled: root.enabled
|
||||||
|
|
||||||
placeholderText: root.usernamePlaceholder
|
placeholderText: root.usernamePlaceholder
|
||||||
seperatorColor: Qt.rgba(1, 1, 1, 0.3)
|
seperatorColor: Qt.rgba(1, 1, 1, 0.3)
|
||||||
anchors {
|
anchors {
|
||||||
|
@ -101,6 +109,8 @@ Item {
|
||||||
id: passwordField
|
id: passwordField
|
||||||
width: 430
|
width: 430
|
||||||
|
|
||||||
|
enabled: root.enabled
|
||||||
|
|
||||||
placeholderText: root.passwordPlaceholder
|
placeholderText: root.passwordPlaceholder
|
||||||
seperatorColor: Qt.rgba(1, 1, 1, 0.3)
|
seperatorColor: Qt.rgba(1, 1, 1, 0.3)
|
||||||
togglePasswordField: true
|
togglePasswordField: true
|
||||||
|
@ -133,6 +143,9 @@ Item {
|
||||||
HFTextField {
|
HFTextField {
|
||||||
id: displayName
|
id: displayName
|
||||||
width: 430
|
width: 430
|
||||||
|
|
||||||
|
enabled: root.enabled
|
||||||
|
|
||||||
placeholderText: "Display Name"
|
placeholderText: "Display Name"
|
||||||
seperatorColor: Qt.rgba(1, 1, 1, 0.3)
|
seperatorColor: Qt.rgba(1, 1, 1, 0.3)
|
||||||
anchors {
|
anchors {
|
||||||
|
@ -149,6 +162,8 @@ Item {
|
||||||
id: button
|
id: button
|
||||||
width: 134
|
width: 134
|
||||||
|
|
||||||
|
enabled: root.enabled
|
||||||
|
|
||||||
text: "NEXT"
|
text: "NEXT"
|
||||||
|
|
||||||
anchors {
|
anchors {
|
||||||
|
|
|
@ -1,11 +1,15 @@
|
||||||
import QtQuick 2.3
|
import QtQuick 2.3
|
||||||
import QtQuick 2.1
|
import QtQuick 2.1
|
||||||
|
|
||||||
import "../HFControls"
|
import "../HFControls"
|
||||||
|
import HQLauncher 1.0
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
|
property bool enabled: LauncherState.applicationState == ApplicationState.WaitingForLogin
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
@ -72,6 +76,8 @@ Item {
|
||||||
HFTextField {
|
HFTextField {
|
||||||
id: username
|
id: username
|
||||||
|
|
||||||
|
enabled: root.enabled
|
||||||
|
|
||||||
placeholderText: "Username"
|
placeholderText: "Username"
|
||||||
|
|
||||||
seperatorColor: Qt.rgba(1, 1, 1, 0.3)
|
seperatorColor: Qt.rgba(1, 1, 1, 0.3)
|
||||||
|
@ -87,6 +93,8 @@ Item {
|
||||||
HFTextField {
|
HFTextField {
|
||||||
id: password
|
id: password
|
||||||
|
|
||||||
|
enabled: root.enabled
|
||||||
|
|
||||||
placeholderText: "Password"
|
placeholderText: "Password"
|
||||||
togglePasswordField: true
|
togglePasswordField: true
|
||||||
echoMode: TextInput.Password
|
echoMode: TextInput.Password
|
||||||
|
@ -118,6 +126,8 @@ Item {
|
||||||
HFTextField {
|
HFTextField {
|
||||||
id: displayName
|
id: displayName
|
||||||
|
|
||||||
|
enabled: root.enabled
|
||||||
|
|
||||||
placeholderText: "Display name"
|
placeholderText: "Display name"
|
||||||
seperatorColor: Qt.rgba(1, 1, 1, 0.3)
|
seperatorColor: Qt.rgba(1, 1, 1, 0.3)
|
||||||
anchors {
|
anchors {
|
||||||
|
@ -134,6 +144,8 @@ Item {
|
||||||
id: button
|
id: button
|
||||||
width: 110
|
width: 110
|
||||||
|
|
||||||
|
enabled: root.enabled
|
||||||
|
|
||||||
text: "NEXT"
|
text: "NEXT"
|
||||||
|
|
||||||
anchors {
|
anchors {
|
||||||
|
|
|
@ -7,8 +7,8 @@ Button {
|
||||||
height: 50
|
height: 50
|
||||||
|
|
||||||
property string backgroundColor: "#00000000"
|
property string backgroundColor: "#00000000"
|
||||||
property string borderColor: "#FFFFFF"
|
property string borderColor: enabled ? "#FFFFFF" : "#7e8c81"
|
||||||
property string textColor: "#FFFFFF"
|
property string textColor: borderColor
|
||||||
property int backgroundOpacity: 1
|
property int backgroundOpacity: 1
|
||||||
property int backgroundRadius: 1
|
property int backgroundRadius: 1
|
||||||
property int backgroundWidth: 2
|
property int backgroundWidth: 2
|
||||||
|
|
|
@ -8,7 +8,7 @@ TextField {
|
||||||
|
|
||||||
font.family: "Graphik Regular"
|
font.family: "Graphik Regular"
|
||||||
font.pointSize: 10.5
|
font.pointSize: 10.5
|
||||||
color: text.length == 0 ? "#7e8c81" : "#000000"
|
color: (text.length == 0 || !enabled) ? "#7e8c81" : "#000000"
|
||||||
|
|
||||||
property bool togglePasswordField: false
|
property bool togglePasswordField: false
|
||||||
verticalAlignment: TextInput.AlignVCenter
|
verticalAlignment: TextInput.AlignVCenter
|
||||||
|
|
|
@ -5,7 +5,6 @@ Item {
|
||||||
id: root
|
id: root
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
|
|
@ -64,7 +64,6 @@ void BuildsRequest::receivedResponse() {
|
||||||
} else {
|
} else {
|
||||||
auto root = doc.object();
|
auto root = doc.object();
|
||||||
if (!root.contains("default_tag")) {
|
if (!root.contains("default_tag")) {
|
||||||
//setApplicationState(ApplicationState::UnexpectedError);
|
|
||||||
_error = Error::MissingDefaultTag;
|
_error = Error::MissingDefaultTag;
|
||||||
emit finished();
|
emit finished();
|
||||||
return;
|
return;
|
||||||
|
@ -74,7 +73,6 @@ void BuildsRequest::receivedResponse() {
|
||||||
|
|
||||||
auto results = root["results"];
|
auto results = root["results"];
|
||||||
if (!results.isArray()) {
|
if (!results.isArray()) {
|
||||||
//setApplicationState(ApplicationState::UnexpectedError);
|
|
||||||
_error = Error::MalformedResponse;
|
_error = Error::MalformedResponse;
|
||||||
emit finished();
|
emit finished();
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -15,6 +15,7 @@ Launcher::Launcher(int& argc, char**argv) : QGuiApplication(argc, argv) {
|
||||||
_launcherWindow = std::make_unique<LauncherWindow>();
|
_launcherWindow = std::make_unique<LauncherWindow>();
|
||||||
_launcherWindow->rootContext()->setContextProperty("LauncherState", _launcherState.get());
|
_launcherWindow->rootContext()->setContextProperty("LauncherState", _launcherState.get());
|
||||||
_launcherWindow->rootContext()->setContextProperty("PathUtils", new PathUtils());
|
_launcherWindow->rootContext()->setContextProperty("PathUtils", new PathUtils());
|
||||||
|
_launcherWindow->setTitle("High Fidelity");
|
||||||
_launcherWindow->setFlags(Qt::FramelessWindowHint | Qt::Window);
|
_launcherWindow->setFlags(Qt::FramelessWindowHint | Qt::Window);
|
||||||
_launcherWindow->setLauncherStatePtr(_launcherState);
|
_launcherWindow->setLauncherStatePtr(_launcherState);
|
||||||
|
|
||||||
|
|
|
@ -111,7 +111,7 @@ static const std::array<QString, LauncherState::UIState::UI_STATE_NUM> QML_FILE_
|
||||||
{ { "qml/SplashScreen.qml", "qml/HFBase/CreateAccountBase.qml", "qml/HFBase/LoginBase.qml",
|
{ { "qml/SplashScreen.qml", "qml/HFBase/CreateAccountBase.qml", "qml/HFBase/LoginBase.qml",
|
||||||
"qml/Download.qml", "qml/DownloadFinished.qml", "qml/HFBase/Error.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) {
|
if (_applicationState != state) {
|
||||||
qDebug() << "Unexpected state, current: " << _applicationState << ", expected: " << state;
|
qDebug() << "Unexpected state, current: " << _applicationState << ", expected: " << state;
|
||||||
#ifdef BREAK_ON_ERROR
|
#ifdef BREAK_ON_ERROR
|
||||||
|
@ -120,7 +120,7 @@ void LauncherState::ASSERT_STATE(LauncherState::ApplicationState state) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LauncherState::ASSERT_STATE(const std::vector<LauncherState::ApplicationState>& states) {
|
void LauncherState::ASSERT_STATE(const std::vector<ApplicationState>& states) {
|
||||||
for (auto state : states) {
|
for (auto state : states) {
|
||||||
if (_applicationState == state) {
|
if (_applicationState == state) {
|
||||||
return;
|
return;
|
||||||
|
@ -146,7 +146,7 @@ QString LauncherState::getCurrentUISource() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void LauncherState::declareQML() {
|
void LauncherState::declareQML() {
|
||||||
qmlRegisterType<LauncherState>("HQLauncher", 1, 0, "LauncherStateEnums");
|
qmlRegisterType<LauncherState>("HQLauncher", 1, 0, "ApplicationState");
|
||||||
}
|
}
|
||||||
|
|
||||||
LauncherState::UIState LauncherState::getUIState() const {
|
LauncherState::UIState LauncherState::getUIState() const {
|
||||||
|
@ -535,7 +535,6 @@ void LauncherState::installClient() {
|
||||||
auto unzipper = new Unzipper(_clientZipFile.fileName(), QDir(installDir));
|
auto unzipper = new Unzipper(_clientZipFile.fileName(), QDir(installDir));
|
||||||
unzipper->setAutoDelete(true);
|
unzipper->setAutoDelete(true);
|
||||||
connect(unzipper, &Unzipper::progress, this, [this](float progress) {
|
connect(unzipper, &Unzipper::progress, this, [this](float progress) {
|
||||||
//qDebug() << "Unzipper progress: " << progress;
|
|
||||||
_interfaceInstallProgress = progress;
|
_interfaceInstallProgress = progress;
|
||||||
emit downloadProgressChanged();
|
emit downloadProgressChanged();
|
||||||
});
|
});
|
||||||
|
@ -549,8 +548,6 @@ void LauncherState::installClient() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
QThreadPool::globalInstance()->start(unzipper);
|
QThreadPool::globalInstance()->start(unzipper);
|
||||||
|
|
||||||
//launchClient();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LauncherState::downloadLauncher() {
|
void LauncherState::downloadLauncher() {
|
||||||
|
@ -772,3 +769,4 @@ void LauncherState::setApplicationState(ApplicationState state) {
|
||||||
LauncherState::ApplicationState LauncherState::getApplicationState() const {
|
LauncherState::ApplicationState LauncherState::getApplicationState() const {
|
||||||
return _applicationState;
|
return _applicationState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,19 +70,18 @@ public:
|
||||||
LaunchingHighFidelity,
|
LaunchingHighFidelity,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Q_ENUM(ApplicationState)
|
||||||
|
|
||||||
bool _isDebuggingScreens{ false };
|
bool _isDebuggingScreens{ false };
|
||||||
UIState _currentDebugScreen{ UIState::SplashScreen };
|
UIState _currentDebugScreen{ UIState::SplashScreen };
|
||||||
void toggleDebugState();
|
void toggleDebugState();
|
||||||
void gotoNextDebugScreen();
|
void gotoNextDebugScreen();
|
||||||
void gotoPreviousDebugScreen();
|
void gotoPreviousDebugScreen();
|
||||||
|
|
||||||
Q_ENUM(UIState);
|
|
||||||
Q_ENUM(ApplicationState)
|
|
||||||
|
|
||||||
Q_INVOKABLE QString getCurrentUISource() const;
|
Q_INVOKABLE QString getCurrentUISource() const;
|
||||||
|
|
||||||
void ASSERT_STATE(LauncherState::ApplicationState state);
|
void ASSERT_STATE(ApplicationState state);
|
||||||
void ASSERT_STATE(const std::vector<LauncherState::ApplicationState>& states);
|
void ASSERT_STATE(const std::vector<ApplicationState>& states);
|
||||||
|
|
||||||
static void declareQML();
|
static void declareQML();
|
||||||
|
|
||||||
|
|
|
@ -58,10 +58,11 @@ int main(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QString name { "High Fidelity" };
|
QString name { "High Fidelity" };
|
||||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||||
QCoreApplication::setOrganizationName(name);
|
QCoreApplication::setOrganizationName(name);
|
||||||
QCoreApplication::setApplicationName(name);
|
QCoreApplication::setApplicationName("HQ Launcher");
|
||||||
|
|
||||||
Launcher launcher(argc, argv);
|
Launcher launcher(argc, argv);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue