1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-21 20:27:45 +00:00

Fix more unqualified accesses in QML

This commit is contained in:
Joshua Goins 2023-12-17 12:47:13 -05:00
parent 6e33379f4f
commit 2ee37827ec
11 changed files with 68 additions and 40 deletions

View file

@ -8,8 +8,6 @@ import org.kde.kirigami as Kirigami
import zone.xiv.astra import zone.xiv.astra
import "Pages"
Kirigami.ApplicationWindow { Kirigami.ApplicationWindow {
id: appWindow id: appWindow
@ -78,7 +76,7 @@ Kirigami.ApplicationWindow {
function openUrl(url) { function openUrl(url) {
if (LauncherCore.isSteamDeck) { if (LauncherCore.isSteamDeck) {
pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "BrowserPage"), { appWindow.pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "BrowserPage"), {
url: url url: url
}) })
} else { } else {
@ -90,14 +88,14 @@ Kirigami.ApplicationWindow {
target: LauncherCore target: LauncherCore
function onLoadingFinished() { function onLoadingFinished() {
checkSetup(); appWindow.checkSetup();
} }
function onSuccessfulLaunch() { function onSuccessfulLaunch() {
if (LauncherCore.settings.closeWhenLaunched) { if (LauncherCore.settings.closeWhenLaunched) {
hide(); appWindow.hide();
} else { } else {
checkSetup(); appWindow.checkSetup();
} }
} }
@ -105,12 +103,12 @@ Kirigami.ApplicationWindow {
if (LauncherCore.settings.closeWhenLaunched) { if (LauncherCore.settings.closeWhenLaunched) {
Qt.callLater(Qt.quit); Qt.callLater(Qt.quit);
} else { } else {
checkSetup(); appWindow.checkSetup();
} }
} }
function onCurrentProfileChanged() { function onCurrentProfileChanged() {
checkSetup(); appWindow.checkSetup();
} }
} }
@ -120,14 +118,14 @@ Kirigami.ApplicationWindow {
function onShowNewsChanged() { function onShowNewsChanged() {
// workaround annoying Qt layout bug // workaround annoying Qt layout bug
// TODO: see if this changed in Qt7 // TODO: see if this changed in Qt7
pageStack.layers.replace(Qt.createComponent("zone.xiv.astra", "MainPage")) appWindow.pageStack.layers.replace(Qt.createComponent("zone.xiv.astra", "MainPage"))
} }
} }
Component.onCompleted: checkSetup() Component.onCompleted: checkSetup()
property Item hoverLinkIndicator: QQC2.Control { property Item hoverLinkIndicator: QQC2.Control {
parent: overlay.parent parent: appWindow.overlay.parent
property alias text: linkText.text property alias text: linkText.text
opacity: text.length > 0 ? 1 : 0 opacity: text.length > 0 ? 1 : 0

View file

@ -41,7 +41,7 @@ Kirigami.Page {
onTriggered: { onTriggered: {
autoLoginTimer.stop(); autoLoginTimer.stop();
if (LauncherCore.autoLogin(LauncherCore.autoLoginProfile)) { if (LauncherCore.autoLogin(LauncherCore.autoLoginProfile)) {
pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "StatusPage")); root.Window.window.pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "StatusPage"));
} }
} }
} }

View file

@ -1,6 +1,8 @@
// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com> // SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
pragma ComponentBehavior: Bound
import QtQuick import QtQuick
import QtQuick.Controls as QQC2 import QtQuick.Controls as QQC2
import QtQuick.Layouts import QtQuick.Layouts
@ -72,7 +74,7 @@ QQC2.Control {
target: LauncherCore target: LauncherCore
function onCurrentProfileChanged() { function onCurrentProfileChanged() {
updateFields(); page.updateFields();
} }
} }
@ -80,7 +82,7 @@ QQC2.Control {
target: LauncherCore.currentProfile target: LauncherCore.currentProfile
function onAccountChanged() { function onAccountChanged() {
updateFields(); page.updateFields();
if (!LauncherCore.currentProfile.account.rememberPassword) { if (!LauncherCore.currentProfile.account.rememberPassword) {
passwordField.forceActiveFocus(); passwordField.forceActiveFocus();
@ -117,14 +119,16 @@ QQC2.Control {
model: LauncherCore.profileManager model: LauncherCore.profileManager
QQC2.MenuItem { QQC2.MenuItem {
id: profileMenuItem
required property var profile required property var profile
QQC2.MenuItem { QQC2.MenuItem {
text: profile.name text: profileMenuItem.profile.name
onClicked: { onClicked: {
LauncherCore.currentProfile = profile LauncherCore.currentProfile = profileMenuItem.profile;
profileMenu.close() profileMenu.close();
} }
} }
} }
@ -160,16 +164,18 @@ QQC2.Control {
model: LauncherCore.accountManager model: LauncherCore.accountManager
QQC2.MenuItem { QQC2.MenuItem {
id: menuItem
required property var account required property var account
QQC2.MenuItem { QQC2.MenuItem {
text: account.name text: menuItem.account.name
icon.name: account.avatarUrl.length === 0 ? "actor" : "" icon.name: menuItem.account.avatarUrl.length === 0 ? "actor" : ""
icon.source: account.avatarUrl icon.source: menuItem.account.avatarUrl
onClicked: { onClicked: {
LauncherCore.currentProfile.account = account LauncherCore.currentProfile.account = menuItem.account;
accountMenu.close() accountMenu.close();
} }
} }
} }
@ -238,7 +244,7 @@ QQC2.Control {
id: loginButton id: loginButton
text: i18n("Log In") text: i18n("Log In")
description: invalidLoginReason description: page.invalidLoginReason
icon.name: "unlock" icon.name: "unlock"
enabled: page.isLoginValid enabled: page.isLoginValid
onClicked: { onClicked: {

View file

@ -1,6 +1,8 @@
// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com> // SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
pragma ComponentBehavior: Bound
import QtQuick import QtQuick
import QtQuick.Controls as QQC2 import QtQuick.Controls as QQC2
import QtQuick.Layouts import QtQuick.Layouts
@ -118,6 +120,8 @@ QQC2.Control {
model: LauncherCore.headline !== null ? LauncherCore.headline.news : undefined model: LauncherCore.headline !== null ? LauncherCore.headline.news : undefined
FormCard.FormButtonDelegate { FormCard.FormButtonDelegate {
required property var modelData
text: modelData.title text: modelData.title
description: Qt.formatDate(modelData.date) description: Qt.formatDate(modelData.date)
@ -156,6 +160,8 @@ QQC2.Control {
model: LauncherCore.headline !== null ? LauncherCore.headline.topics : undefined model: LauncherCore.headline !== null ? LauncherCore.headline.topics : undefined
FormCard.FormButtonDelegate { FormCard.FormButtonDelegate {
required property var modelData
text: modelData.title text: modelData.title
description: Qt.formatDate(modelData.date) description: Qt.formatDate(modelData.date)

View file

@ -1,6 +1,8 @@
// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com> // SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
pragma ComponentBehavior: Bound
import QtQuick import QtQuick
import QtQuick.Layouts import QtQuick.Layouts
import QtQuick.Window import QtQuick.Window
@ -24,29 +26,31 @@ FormCard.FormCardPage {
model: LauncherCore.accountManager model: LauncherCore.accountManager
ColumnLayout { ColumnLayout {
id: layout
required property var account required property var account
required property int index required property int index
spacing: 0 spacing: 0
FormCard.FormButtonDelegate { FormCard.FormButtonDelegate {
text: account.name text: layout.account.name
description: account.isSapphire ? i18n("Sapphire") : i18n("Square Enix") description: layout.account.isSapphire ? i18n("Sapphire") : i18n("Square Enix")
leading: Components.Avatar { leading: Components.Avatar {
name: account.name name: layout.account.name
source: account.avatarUrl source: layout.account.avatarUrl
} }
leadingPadding: Kirigami.Units.largeSpacing * 2 leadingPadding: Kirigami.Units.largeSpacing * 2
onClicked: root.Window.window.pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "AccountSettings"), { onClicked: root.Window.window.pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "AccountSettings"), {
account: account account: layout.account
}) })
} }
FormCard.FormDelegateSeparator { FormCard.FormDelegateSeparator {
visible: index + 1 < LauncherCore.accountManager.numAccounts() visible: layout.index + 1 < LauncherCore.accountManager.numAccounts()
} }
} }
} }

View file

@ -75,8 +75,8 @@ FormCard.FormCardPage {
} }
function onError(message) { function onError(message) {
errorDialog.subtitle = message page.errorDialog.subtitle = message;
errorDialog.open() page.errorDialog.open();
} }
} }
} }

View file

@ -1,6 +1,8 @@
// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com> // SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
pragma ComponentBehavior: Bound
import QtQuick import QtQuick
import QtQuick.Window import QtQuick.Window
import QtQuick.Controls as QQC2 import QtQuick.Controls as QQC2
@ -12,6 +14,8 @@ import org.kde.kirigamiaddons.formcard as FormCard
import zone.xiv.astra import zone.xiv.astra
FormCard.FormCardPage { FormCard.FormCardPage {
id: page
title: i18nc("@title:window", "General") title: i18nc("@title:window", "General")
FormCard.FormCard { FormCard.FormCard {
@ -74,7 +78,9 @@ FormCard.FormCardPage {
checked: LauncherCore.settings.showNews checked: LauncherCore.settings.showNews
onCheckedChanged: { onCheckedChanged: {
LauncherCore.settings.showNews = checked; LauncherCore.settings.showNews = checked;
Window.window.close(); // if we don't close the dialog it crashes! if (page.Window.window !== null) {
page.Window.window.close(); // if we don't close the dialog it crashes!
}
} }
} }

View file

@ -1,6 +1,8 @@
// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com> // SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
pragma ComponentBehavior: Bound
import QtQuick import QtQuick
import QtQuick.Layouts import QtQuick.Layouts
import QtQuick.Window import QtQuick.Window
@ -23,6 +25,8 @@ FormCard.FormCardPage {
model: LauncherCore.profileManager model: LauncherCore.profileManager
ColumnLayout { ColumnLayout {
id: layout
required property var profile required property var profile
required property int index required property int index
@ -31,14 +35,14 @@ FormCard.FormCardPage {
FormCard.FormButtonDelegate { FormCard.FormButtonDelegate {
id: buttonDelegate id: buttonDelegate
text: profile.name text: layout.profile.name
onClicked: page.Window.window.pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "ProfileSettings"), { onClicked: page.Window.window.pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "ProfileSettings"), {
profile: profile profile: layout.profile
}) })
} }
FormCard.FormDelegateSeparator { FormCard.FormDelegateSeparator {
visible: index + 1 < LauncherCore.profileManager.numProfiles() visible: layout.index + 1 < LauncherCore.profileManager.numProfiles()
} }
} }
} }

View file

@ -1,6 +1,8 @@
// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com> // SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
pragma ComponentBehavior: Bound
import QtQuick import QtQuick
import QtQuick.Layouts import QtQuick.Layouts
@ -72,7 +74,7 @@ FormCard.FormCardPage {
text: i18n("Add Square Enix Account") text: i18n("Add Square Enix Account")
icon.name: "list-add-symbolic" icon.name: "list-add-symbolic"
onClicked: pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "AddSquareEnix"), { onClicked: page.Window.window.pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "AddSquareEnix"), {
profile: page.profile profile: page.profile
}) })
} }
@ -87,7 +89,7 @@ FormCard.FormCardPage {
text: i18n("Add Sapphire Account") text: i18n("Add Sapphire Account")
icon.name: "list-add-symbolic" icon.name: "list-add-symbolic"
onClicked: pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "AddSapphire"), { onClicked: page.Window.window.pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "AddSapphire"), {
profile: page.profile profile: page.profile
}) })
} }

View file

@ -9,6 +9,8 @@ import org.kde.kirigami as Kirigami
import zone.xiv.astra import zone.xiv.astra
Kirigami.Page { Kirigami.Page {
id: page
property var gameInstaller property var gameInstaller
title: i18n("Game Installation") title: i18n("Game Installation")
@ -33,7 +35,7 @@ Kirigami.Page {
Component.onCompleted: gameInstaller.installGame() Component.onCompleted: gameInstaller.installGame()
Connections { Connections {
target: gameInstaller target: page.gameInstaller
function onInstallFinished() { function onInstallFinished() {
applicationWindow().checkSetup(); applicationWindow().checkSetup();

View file

@ -32,7 +32,7 @@ FormCard.FormCardPage {
FormCard.FormTextDelegate { FormCard.FormTextDelegate {
text: { text: {
if (isInitialSetup) { if (page.isInitialSetup) {
return i18n("You must have a legitimate installation of the FFXIV to continue."); return i18n("You must have a legitimate installation of the FFXIV to continue.");
} else { } else {
return i18n("You must select a legitimate installation of FFXIV for '%1'", page.profile.name); return i18n("You must select a legitimate installation of FFXIV for '%1'", page.profile.name);
@ -88,7 +88,7 @@ FormCard.FormCardPage {
text: i18n("Find Existing Installation") text: i18n("Find Existing Installation")
icon.name: "edit-find" icon.name: "edit-find"
onClicked: pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "ExistingSetup"), { onClicked: page.Window.window.pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "ExistingSetup"), {
profile: page.profile profile: page.profile
}) })
} }
@ -103,7 +103,7 @@ FormCard.FormCardPage {
text: i18n("Download Game") text: i18n("Download Game")
icon.name: "cloud-download" icon.name: "cloud-download"
onClicked: pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "DownloadSetup"), { onClicked: page.Window.window.pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "DownloadSetup"), {
profile: page.profile profile: page.profile
}) })
} }