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

View file

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

View file

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

View file

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

View file

@ -58,35 +58,35 @@ Kirigami.Page {
Connections {
target: LauncherCore
function onStageChanged(message, explanation) {
placeholder.text = message
placeholder.explanation = explanation
function onStageChanged(message: string, explanation: string): void {
placeholder.text = message;
placeholder.explanation = explanation;
}
function onStageIndeterminate() {
placeholder.determinate = false
function onStageIndeterminate(): void {
placeholder.determinate = false;
}
function onStageDeterminate(min, max, value) {
placeholder.determinate = true
placeholder.progressBar.value = value
placeholder.progressBar.from = min
placeholder.progressBar.to = max
function onStageDeterminate(min: int, max: int, value: int): void {
placeholder.determinate = true;
placeholder.progressBar.value = value;
placeholder.progressBar.from = min;
placeholder.progressBar.to = max;
}
function onLoginError(message) {
function onLoginError(message: string): void {
errorDialog.title = i18n("Login Error");
errorDialog.subtitle = message;
errorDialog.open();
}
function onMiscError(message) {
function onMiscError(message: string): void {
errorDialog.title = i18n("Error");
errorDialog.subtitle = message;
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.open();
}

View file

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

View file

@ -38,12 +38,12 @@ Kirigami.Page {
Connections {
target: page.benchmarkInstaller
function onInstallFinished() {
function onInstallFinished(): void {
// Prevents it from failing to push the page if the install happens too quickly.
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.open();
}

View file

@ -38,12 +38,12 @@ Kirigami.Page {
Connections {
target: page.gameInstaller
function onInstallFinished() {
function onInstallFinished(): void {
// Prevents it from failing to push the page if the install happens too quickly.
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.open();
}