From e5924b16fb3e1aa9f05bd02c024238c19c3ad575 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Sat, 1 Feb 2025 10:13:05 -0500 Subject: [PATCH] Add more Javascript function annotations --- launcher/ui/Main.qml | 20 +++++++------- launcher/ui/Pages/AutoLoginPage.qml | 6 ++--- launcher/ui/Pages/LoginPage.qml | 4 +-- launcher/ui/Pages/NewsPage.qml | 4 +-- launcher/ui/Pages/StatusPage.qml | 26 +++++++++---------- .../ui/Settings/CompatibilityToolSetup.qml | 6 ++--- .../ui/Setup/BenchmarkInstallProgress.qml | 6 ++--- launcher/ui/Setup/InstallProgress.qml | 6 ++--- 8 files changed, 39 insertions(+), 39 deletions(-) diff --git a/launcher/ui/Main.qml b/launcher/ui/Main.qml index 7252fae..db88b20 100644 --- a/launcher/ui/Main.qml +++ b/launcher/ui/Main.qml @@ -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")) diff --git a/launcher/ui/Pages/AutoLoginPage.qml b/launcher/ui/Pages/AutoLoginPage.qml index a7f1240..a5e3c39 100644 --- a/launcher/ui/Pages/AutoLoginPage.qml +++ b/launcher/ui/Pages/AutoLoginPage.qml @@ -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(); } } } diff --git a/launcher/ui/Pages/LoginPage.qml b/launcher/ui/Pages/LoginPage.qml index 37c3bbf..3b43ccb 100644 --- a/launcher/ui/Pages/LoginPage.qml +++ b/launcher/ui/Pages/LoginPage.qml @@ -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) { diff --git a/launcher/ui/Pages/NewsPage.qml b/launcher/ui/Pages/NewsPage.qml index c7bb078..042b19f 100644 --- a/launcher/ui/Pages/NewsPage.qml +++ b/launcher/ui/Pages/NewsPage.qml @@ -29,7 +29,7 @@ QQC2.Control { Connections { target: LauncherCore - function onNewsChanged() { + function onNewsChanged(): void { page.currentBannerIndex = 0 page.numBannerImages = LauncherCore.headline.banners.length } @@ -198,4 +198,4 @@ QQC2.Control { anchors.centerIn: parent visible: LauncherCore.headline === null } -} \ No newline at end of file +} diff --git a/launcher/ui/Pages/StatusPage.qml b/launcher/ui/Pages/StatusPage.qml index bbf5798..1245e20 100644 --- a/launcher/ui/Pages/StatusPage.qml +++ b/launcher/ui/Pages/StatusPage.qml @@ -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(); } diff --git a/launcher/ui/Settings/CompatibilityToolSetup.qml b/launcher/ui/Settings/CompatibilityToolSetup.qml index 6a5b9fa..9026530 100644 --- a/launcher/ui/Settings/CompatibilityToolSetup.qml +++ b/launcher/ui/Settings/CompatibilityToolSetup.qml @@ -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(); } diff --git a/launcher/ui/Setup/BenchmarkInstallProgress.qml b/launcher/ui/Setup/BenchmarkInstallProgress.qml index 13d1db3..84ad903 100644 --- a/launcher/ui/Setup/BenchmarkInstallProgress.qml +++ b/launcher/ui/Setup/BenchmarkInstallProgress.qml @@ -38,14 +38,14 @@ 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(); } } -} \ No newline at end of file +} diff --git a/launcher/ui/Setup/InstallProgress.qml b/launcher/ui/Setup/InstallProgress.qml index 7de2c86..173cd29 100644 --- a/launcher/ui/Setup/InstallProgress.qml +++ b/launcher/ui/Setup/InstallProgress.qml @@ -38,14 +38,14 @@ 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(); } } -} \ No newline at end of file +}