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 "Pages"
Kirigami.ApplicationWindow {
id: appWindow
@ -78,7 +76,7 @@ Kirigami.ApplicationWindow {
function openUrl(url) {
if (LauncherCore.isSteamDeck) {
pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "BrowserPage"), {
appWindow.pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "BrowserPage"), {
url: url
})
} else {
@ -90,14 +88,14 @@ Kirigami.ApplicationWindow {
target: LauncherCore
function onLoadingFinished() {
checkSetup();
appWindow.checkSetup();
}
function onSuccessfulLaunch() {
if (LauncherCore.settings.closeWhenLaunched) {
hide();
appWindow.hide();
} else {
checkSetup();
appWindow.checkSetup();
}
}
@ -105,12 +103,12 @@ Kirigami.ApplicationWindow {
if (LauncherCore.settings.closeWhenLaunched) {
Qt.callLater(Qt.quit);
} else {
checkSetup();
appWindow.checkSetup();
}
}
function onCurrentProfileChanged() {
checkSetup();
appWindow.checkSetup();
}
}
@ -120,14 +118,14 @@ Kirigami.ApplicationWindow {
function onShowNewsChanged() {
// workaround annoying Qt layout bug
// 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()
property Item hoverLinkIndicator: QQC2.Control {
parent: overlay.parent
parent: appWindow.overlay.parent
property alias text: linkText.text
opacity: text.length > 0 ? 1 : 0

View file

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

View file

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

View file

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

View file

@ -1,6 +1,8 @@
// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
// SPDX-License-Identifier: GPL-3.0-or-later
pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Window
import QtQuick.Controls as QQC2
@ -12,6 +14,8 @@ import org.kde.kirigamiaddons.formcard as FormCard
import zone.xiv.astra
FormCard.FormCardPage {
id: page
title: i18nc("@title:window", "General")
FormCard.FormCard {
@ -74,7 +78,9 @@ FormCard.FormCardPage {
checked: LauncherCore.settings.showNews
onCheckedChanged: {
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-License-Identifier: GPL-3.0-or-later
pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Layouts
import QtQuick.Window
@ -23,6 +25,8 @@ FormCard.FormCardPage {
model: LauncherCore.profileManager
ColumnLayout {
id: layout
required property var profile
required property int index
@ -31,14 +35,14 @@ FormCard.FormCardPage {
FormCard.FormButtonDelegate {
id: buttonDelegate
text: profile.name
text: layout.profile.name
onClicked: page.Window.window.pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "ProfileSettings"), {
profile: profile
profile: layout.profile
})
}
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-License-Identifier: GPL-3.0-or-later
pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Layouts
@ -72,7 +74,7 @@ FormCard.FormCardPage {
text: i18n("Add Square Enix Account")
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
})
}
@ -87,7 +89,7 @@ FormCard.FormCardPage {
text: i18n("Add Sapphire Account")
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
})
}

View file

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

View file

@ -32,7 +32,7 @@ FormCard.FormCardPage {
FormCard.FormTextDelegate {
text: {
if (isInitialSetup) {
if (page.isInitialSetup) {
return i18n("You must have a legitimate installation of the FFXIV to continue.");
} else {
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")
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
})
}
@ -103,7 +103,7 @@ FormCard.FormCardPage {
text: i18n("Download Game")
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
})
}