1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-20 11:47:46 +00:00

Add more Javascript function annotations

This commit is contained in:
Joshua Goins 2025-02-01 10:13:05 -05:00
parent 539d430b43
commit e5924b16fb
8 changed files with 39 additions and 39 deletions

View file

@ -45,7 +45,7 @@ Kirigami.ApplicationWindow {
close.accepted = !LauncherCore.isPatching(); close.accepted = !LauncherCore.isPatching();
} }
function checkSetup() { function checkSetup(): void {
if (!LauncherCore.loadingFinished) { if (!LauncherCore.loadingFinished) {
return return
} }
@ -73,13 +73,13 @@ Kirigami.ApplicationWindow {
} }
} }
function cancelAutoLogin() { function cancelAutoLogin(): void {
pageStack.clear(); pageStack.clear();
pageStack.layers.clear(); pageStack.layers.clear();
pageStack.push(Qt.createComponent("zone.xiv.astra", "MainPage")); pageStack.push(Qt.createComponent("zone.xiv.astra", "MainPage"));
} }
function pushDialogLayer(url) { function pushDialogLayer(url: string): void {
if (LauncherCore.isSteamDeck) { if (LauncherCore.isSteamDeck) {
pageStack.layers.push(url) pageStack.layers.push(url)
} else { } else {
@ -87,7 +87,7 @@ Kirigami.ApplicationWindow {
} }
} }
function openUrl(url) { function openUrl(url: string): void {
if (LauncherCore.isSteamDeck) { if (LauncherCore.isSteamDeck) {
appWindow.pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "BrowserPage"), { appWindow.pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "BrowserPage"), {
url: url url: url
@ -100,11 +100,11 @@ Kirigami.ApplicationWindow {
Connections { Connections {
target: LauncherCore target: LauncherCore
function onLoadingFinished() { function onLoadingFinished(): void {
appWindow.checkSetup(); appWindow.checkSetup();
} }
function onSuccessfulLaunch() { function onSuccessfulLaunch(): void {
if (LauncherCore.settings.closeWhenLaunched) { if (LauncherCore.settings.closeWhenLaunched) {
appWindow.hide(); appWindow.hide();
} else { } else {
@ -112,17 +112,17 @@ Kirigami.ApplicationWindow {
} }
} }
function onGameClosed() { function onGameClosed(): void {
if (!LauncherCore.settings.closeWhenLaunched) { if (!LauncherCore.settings.closeWhenLaunched) {
appWindow.checkSetup(); appWindow.checkSetup();
} }
} }
function onCurrentProfileChanged() { function onCurrentProfileChanged(): void {
appWindow.checkSetup(); appWindow.checkSetup();
} }
function onShowWindow() { function onShowWindow(): void {
appWindow.show(); appWindow.show();
} }
} }
@ -130,7 +130,7 @@ Kirigami.ApplicationWindow {
Connections { Connections {
target: LauncherCore.settings target: LauncherCore.settings
function onShowNewsChanged() { function onShowNewsChanged(): void {
// workaround annoying Qt layout bug // workaround annoying Qt layout bug
// TODO: see if this changed in Qt7 // TODO: see if this changed in Qt7
appWindow.pageStack.replace(Qt.createComponent("zone.xiv.astra", "MainPage")) appWindow.pageStack.replace(Qt.createComponent("zone.xiv.astra", "MainPage"))

View file

@ -60,9 +60,9 @@ Kirigami.Page {
Connections { Connections {
target: LauncherCore target: LauncherCore
function onLoginError(message) { function onLoginError(message: string): void {
errorDialog.subtitle = message errorDialog.subtitle = message;
errorDialog.open() errorDialog.open();
} }
} }
} }

View file

@ -62,7 +62,7 @@ QQC2.Control {
return !LauncherCore.currentProfile.loggedIn; return !LauncherCore.currentProfile.loggedIn;
} }
function updateFields() { function updateFields(): void {
usernameField.text = LauncherCore.currentProfile.account.name; usernameField.text = LauncherCore.currentProfile.account.name;
passwordField.text = !LauncherCore.currentProfile.account.needsPassword && LauncherCore.currentProfile.account.rememberPassword ? LauncherCore.currentProfile.account.getPassword() : ""; passwordField.text = !LauncherCore.currentProfile.account.needsPassword && LauncherCore.currentProfile.account.rememberPassword ? LauncherCore.currentProfile.account.getPassword() : "";
if (LauncherCore.currentProfile.account.rememberOTP) { if (LauncherCore.currentProfile.account.rememberOTP) {
@ -75,7 +75,7 @@ QQC2.Control {
Connections { Connections {
target: LauncherCore.currentProfile target: LauncherCore.currentProfile
function onAccountChanged() { function onAccountChanged(): void {
page.updateFields(); page.updateFields();
if (LauncherCore.currentProfile.account.needsPassword) { if (LauncherCore.currentProfile.account.needsPassword) {

View file

@ -29,7 +29,7 @@ QQC2.Control {
Connections { Connections {
target: LauncherCore target: LauncherCore
function onNewsChanged() { function onNewsChanged(): void {
page.currentBannerIndex = 0 page.currentBannerIndex = 0
page.numBannerImages = LauncherCore.headline.banners.length page.numBannerImages = LauncherCore.headline.banners.length
} }

View file

@ -58,35 +58,35 @@ Kirigami.Page {
Connections { Connections {
target: LauncherCore target: LauncherCore
function onStageChanged(message, explanation) { function onStageChanged(message: string, explanation: string): void {
placeholder.text = message placeholder.text = message;
placeholder.explanation = explanation placeholder.explanation = explanation;
} }
function onStageIndeterminate() { function onStageIndeterminate(): void {
placeholder.determinate = false placeholder.determinate = false;
} }
function onStageDeterminate(min, max, value) { function onStageDeterminate(min: int, max: int, value: int): void {
placeholder.determinate = true placeholder.determinate = true;
placeholder.progressBar.value = value placeholder.progressBar.value = value;
placeholder.progressBar.from = min placeholder.progressBar.from = min;
placeholder.progressBar.to = max placeholder.progressBar.to = max;
} }
function onLoginError(message) { function onLoginError(message: string): void {
errorDialog.title = i18n("Login Error"); errorDialog.title = i18n("Login Error");
errorDialog.subtitle = message; errorDialog.subtitle = message;
errorDialog.open(); errorDialog.open();
} }
function onMiscError(message) { function onMiscError(message: string): void {
errorDialog.title = i18n("Error"); errorDialog.title = i18n("Error");
errorDialog.subtitle = message; errorDialog.subtitle = message;
errorDialog.open(); errorDialog.open();
} }
function onDalamudError(message) { function onDalamudError(message: string): void {
dalamudErrorDialog.subtitle = i18n("An error occured while updating Dalamud:\n\n%1.\n\nWould you like to disable Dalamud?", message); dalamudErrorDialog.subtitle = i18n("An error occured while updating Dalamud:\n\n%1.\n\nWould you like to disable Dalamud?", message);
dalamudErrorDialog.open(); dalamudErrorDialog.open();
} }

View file

@ -70,11 +70,11 @@ FormCard.FormCardPage {
enabled: page.installer !== null enabled: page.installer !== null
target: page.installer target: page.installer
function onInstallFinished() { function onInstallFinished(): void {
applicationWindow().pageStack.layers.pop() applicationWindow().pageStack.layers.pop();
} }
function onError(message) { function onError(message: string): void {
page.errorDialog.subtitle = message; page.errorDialog.subtitle = message;
page.errorDialog.open(); page.errorDialog.open();
} }

View file

@ -38,12 +38,12 @@ Kirigami.Page {
Connections { Connections {
target: page.benchmarkInstaller target: page.benchmarkInstaller
function onInstallFinished() { function onInstallFinished(): void {
// Prevents it from failing to push the page if the install happens too quickly. // Prevents it from failing to push the page if the install happens too quickly.
Qt.callLater(() => applicationWindow().checkSetup()); Qt.callLater(() => applicationWindow().checkSetup());
} }
function onError(message) { function onError(message: string): void {
errorDialog.subtitle = i18n("An error has occurred while installing the benchmark:\n\n%1", message); errorDialog.subtitle = i18n("An error has occurred while installing the benchmark:\n\n%1", message);
errorDialog.open(); errorDialog.open();
} }

View file

@ -38,12 +38,12 @@ Kirigami.Page {
Connections { Connections {
target: page.gameInstaller target: page.gameInstaller
function onInstallFinished() { function onInstallFinished(): void {
// Prevents it from failing to push the page if the install happens too quickly. // Prevents it from failing to push the page if the install happens too quickly.
Qt.callLater(() => applicationWindow().checkSetup()); Qt.callLater(() => applicationWindow().checkSetup());
} }
function onError(message) { function onError(message: string): void {
errorDialog.subtitle = i18n("An error has occurred while installing the game:\n\n%1", message); errorDialog.subtitle = i18n("An error has occurred while installing the game:\n\n%1", message);
errorDialog.open(); errorDialog.open();
} }