mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-20 19:57:45 +00:00
Better handle bad login cases
Now the code is much cleaner, and the if-clauses are now cleanly seperated based on which lobby you're attempting to sign into. Also, the "Register" button for Sapphire servers is now disabled when login is disabled too.
This commit is contained in:
parent
cbb36e910a
commit
08c86c07dc
2 changed files with 26 additions and 11 deletions
|
@ -289,20 +289,33 @@ void LauncherWindow::reloadControls() {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const bool canLogin = currentProfile().isSapphire || (!currentProfile().isSapphire && core.squareLauncher->isGateOpen) && currentProfile().isGameInstalled();
|
bool canLogin = true;
|
||||||
|
if(currentProfile().isSapphire) {
|
||||||
if(canLogin) {
|
if(currentProfile().lobbyURL.isEmpty()) {
|
||||||
loginButton->setText("Login");
|
loginButton->setText("Login (Lobby URL is invalid)");
|
||||||
} else if(!core.squareLauncher->isGateOpen) {
|
canLogin = false;
|
||||||
loginButton->setText("Login (Maintenance is in progress)");
|
}
|
||||||
#if defined(Q_OS_LINUX) || defined(Q_OS_MAC)
|
|
||||||
} else if(!currentProfile().isWineInstalled()) {
|
|
||||||
loginButton->setText("Login (Wine is not installed)");
|
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
loginButton->setText("Login (Game is not installed)");
|
if(!core.squareLauncher->isGateOpen) {
|
||||||
|
loginButton->setText("Login (Maintenance is in progress)");
|
||||||
|
canLogin = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(Q_OS_LINUX) || defined(Q_OS_MAC)
|
||||||
|
if(!currentProfile().isWineInstalled()) {
|
||||||
|
loginButton->setText("Login (Wine is not installed)");
|
||||||
|
canLogin = false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
if(!currentProfile().isGameInstalled()) {
|
||||||
|
loginButton->setText("Login (Game is not installed)");
|
||||||
|
canLogin = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(canLogin)
|
||||||
|
loginButton->setText("Login");
|
||||||
|
|
||||||
launchOfficial->setEnabled(currentProfile().isGameInstalled());
|
launchOfficial->setEnabled(currentProfile().isGameInstalled());
|
||||||
launchSysInfo->setEnabled(currentProfile().isGameInstalled());
|
launchSysInfo->setEnabled(currentProfile().isGameInstalled());
|
||||||
launchCfgBackup->setEnabled(currentProfile().isGameInstalled());
|
launchCfgBackup->setEnabled(currentProfile().isGameInstalled());
|
||||||
|
@ -331,6 +344,7 @@ void LauncherWindow::reloadControls() {
|
||||||
|
|
||||||
loginLayout->takeRow(loginButton);
|
loginLayout->takeRow(loginButton);
|
||||||
loginButton->setEnabled(canLogin);
|
loginButton->setEnabled(canLogin);
|
||||||
|
registerButton->setEnabled(canLogin);
|
||||||
loginLayout->addRow(loginButton);
|
loginLayout->addRow(loginButton);
|
||||||
|
|
||||||
loginLayout->takeRow(registerButton);
|
loginLayout->takeRow(registerButton);
|
||||||
|
|
|
@ -538,6 +538,7 @@ void SettingsWindow::reloadControls() {
|
||||||
lobbyServerURL->setEnabled(profile.isSapphire);
|
lobbyServerURL->setEnabled(profile.isSapphire);
|
||||||
if(profile.isSapphire) {
|
if(profile.isSapphire) {
|
||||||
lobbyServerURL->setText(profile.lobbyURL);
|
lobbyServerURL->setText(profile.lobbyURL);
|
||||||
|
lobbyServerURL->setPlaceholderText("Required...");
|
||||||
} else {
|
} else {
|
||||||
lobbyServerURL->setText("neolobby0X.ffxiv.com");
|
lobbyServerURL->setText("neolobby0X.ffxiv.com");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue