mirror of
https://invent.kde.org/marcoa/a-la-karte.git
synced 2026-02-09 21:13:08 +00:00
Refine Settings and About sheets
Make Settings/About sheets easier to dismiss via close affordances and press-outside behavior. Lazy-load the AboutPage to avoid KirigamiAddons null window warnings. Simplify About metadata and provide non-empty license text.
This commit is contained in:
parent
946baee9cf
commit
394227f9a5
1 changed files with 141 additions and 40 deletions
179
src/qml/Main.qml
179
src/qml/Main.qml
|
|
@ -39,6 +39,10 @@ Kirigami.ApplicationWindow {
|
||||||
settingsSheet.close()
|
settingsSheet.close()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
if (aboutSheet.opened) {
|
||||||
|
aboutSheet.close()
|
||||||
|
return true
|
||||||
|
}
|
||||||
if (sidebar.modal && sidebar.opened) {
|
if (sidebar.modal && sidebar.opened) {
|
||||||
sidebar.close()
|
sidebar.close()
|
||||||
return true
|
return true
|
||||||
|
|
@ -59,6 +63,7 @@ Kirigami.ApplicationWindow {
|
||||||
return !gameEditDialog.visible
|
return !gameEditDialog.visible
|
||||||
&& !detailsSheet.opened
|
&& !detailsSheet.opened
|
||||||
&& !importSheet.opened
|
&& !importSheet.opened
|
||||||
|
&& !aboutSheet.opened
|
||||||
&& !sidebar.opened
|
&& !sidebar.opened
|
||||||
&& root.pageStack.layers.depth <= 1
|
&& root.pageStack.layers.depth <= 1
|
||||||
}
|
}
|
||||||
|
|
@ -160,42 +165,6 @@ Kirigami.ApplicationWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component {
|
|
||||||
id: aboutPageComponent
|
|
||||||
FormCard.AboutPage {
|
|
||||||
title: i18n("About")
|
|
||||||
aboutData: ({
|
|
||||||
"displayName": i18n("A-La-Karte"),
|
|
||||||
"componentName": "alakarte",
|
|
||||||
"shortDescription": i18n("A unified game launcher for KDE Plasma"),
|
|
||||||
"homepage": "",
|
|
||||||
"bugAddress": "",
|
|
||||||
"version": Qt.application.version,
|
|
||||||
"otherText": "",
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": i18n("A-La-Karte Contributors"),
|
|
||||||
"task": i18n("Contributors"),
|
|
||||||
"emailAddress": "",
|
|
||||||
"webAddress": "",
|
|
||||||
"ocsUsername": ""
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"credits": [],
|
|
||||||
"translators": [],
|
|
||||||
"licenses": [
|
|
||||||
{
|
|
||||||
"name": i18n("GNU General Public License v3.0 or later"),
|
|
||||||
"text": "",
|
|
||||||
"spdx": "GPL-3.0-or-later"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"copyrightStatement": i18n("© 2026 A-La-Karte Contributors"),
|
|
||||||
"desktopFileName": "org.kde.alakarte"
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
globalDrawer: Kirigami.OverlayDrawer {
|
globalDrawer: Kirigami.OverlayDrawer {
|
||||||
id: sidebar
|
id: sidebar
|
||||||
edge: Qt.LeftEdge
|
edge: Qt.LeftEdge
|
||||||
|
|
@ -286,7 +255,7 @@ Kirigami.ApplicationWindow {
|
||||||
if (sidebar.modal) {
|
if (sidebar.modal) {
|
||||||
sidebar.close()
|
sidebar.close()
|
||||||
}
|
}
|
||||||
root.pageStack.layers.push(aboutPageComponent)
|
aboutSheet.open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -671,6 +640,8 @@ Kirigami.ApplicationWindow {
|
||||||
id: settingsSheet
|
id: settingsSheet
|
||||||
title: i18n("Settings")
|
title: i18n("Settings")
|
||||||
|
|
||||||
|
closePolicy: QQC2.Popup.CloseOnEscape | QQC2.Popup.CloseOnPressOutside
|
||||||
|
|
||||||
implicitWidth: {
|
implicitWidth: {
|
||||||
if (root.isMobile) return applicationWindow().width
|
if (root.isMobile) return applicationWindow().width
|
||||||
if (root.isNarrowScreen) return applicationWindow().width - Kirigami.Units.largeSpacing * 2
|
if (root.isNarrowScreen) return applicationWindow().width - Kirigami.Units.largeSpacing * 2
|
||||||
|
|
@ -678,12 +649,50 @@ Kirigami.ApplicationWindow {
|
||||||
}
|
}
|
||||||
implicitHeight: {
|
implicitHeight: {
|
||||||
if (root.isMobile) return applicationWindow().height
|
if (root.isMobile) return applicationWindow().height
|
||||||
return Math.min(applicationWindow().height - Kirigami.Units.gridUnit * 2, settingsContent.implicitHeight + Kirigami.Units.gridUnit * 2)
|
return Math.min(applicationWindow().height - Kirigami.Units.gridUnit * 2, Kirigami.Units.gridUnit * 42)
|
||||||
}
|
}
|
||||||
|
|
||||||
onOpened: settingsContent.focusFirstControl()
|
onOpened: settingsContent.focusFirstControl()
|
||||||
onClosed: libraryView.restoreFocus()
|
onClosed: libraryView.restoreFocus()
|
||||||
|
|
||||||
|
header: Kirigami.ShadowedRectangle {
|
||||||
|
id: settingsHeader
|
||||||
|
implicitWidth: settingsSheet.implicitWidth
|
||||||
|
implicitHeight: settingsHeaderRow.implicitHeight + Kirigami.Units.largeSpacing * 2
|
||||||
|
|
||||||
|
radius: Kirigami.Units.mediumSpacing
|
||||||
|
color: Kirigami.Theme.backgroundColor
|
||||||
|
|
||||||
|
shadow {
|
||||||
|
size: Kirigami.Units.smallSpacing
|
||||||
|
color: Qt.rgba(0, 0, 0, 0.20)
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
id: settingsHeaderRow
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: Kirigami.Units.largeSpacing
|
||||||
|
spacing: Kirigami.Units.mediumSpacing
|
||||||
|
|
||||||
|
Kirigami.Heading {
|
||||||
|
text: settingsSheet.title
|
||||||
|
level: 2
|
||||||
|
Layout.fillWidth: true
|
||||||
|
elide: Text.ElideRight
|
||||||
|
}
|
||||||
|
|
||||||
|
QQC2.ToolButton {
|
||||||
|
text: i18n("Close")
|
||||||
|
icon.name: "dialog-close"
|
||||||
|
display: QQC2.AbstractButton.IconOnly
|
||||||
|
onClicked: settingsSheet.close()
|
||||||
|
|
||||||
|
QQC2.ToolTip.visible: hovered
|
||||||
|
QQC2.ToolTip.text: text
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function isDescendant(item, ancestor) {
|
function isDescendant(item, ancestor) {
|
||||||
let p = item
|
let p = item
|
||||||
while (p) {
|
while (p) {
|
||||||
|
|
@ -700,9 +709,11 @@ Kirigami.ApplicationWindow {
|
||||||
for (let i = 0; i < 50; i++) {
|
for (let i = 0; i < 50; i++) {
|
||||||
next = next.nextItemInFocusChain(forward)
|
next = next.nextItemInFocusChain(forward)
|
||||||
if (!next) return
|
if (!next) return
|
||||||
if (settingsSheet.isDescendant(next, settingsContent)) {
|
if (settingsSheet.isDescendant(next, settingsSheet)) {
|
||||||
next.forceActiveFocus()
|
next.forceActiveFocus()
|
||||||
|
if (settingsSheet.isDescendant(next, settingsContent)) {
|
||||||
settingsScroll.ensureItemVisible(next)
|
settingsScroll.ensureItemVisible(next)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -788,6 +799,96 @@ Kirigami.ApplicationWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Kirigami.OverlaySheet {
|
||||||
|
id: aboutSheet
|
||||||
|
title: i18n("About")
|
||||||
|
|
||||||
|
closePolicy: QQC2.Popup.CloseOnEscape | QQC2.Popup.CloseOnPressOutside
|
||||||
|
|
||||||
|
implicitWidth: {
|
||||||
|
if (root.isMobile) return applicationWindow().width
|
||||||
|
if (root.isNarrowScreen) return applicationWindow().width - Kirigami.Units.largeSpacing * 2
|
||||||
|
return Math.min(applicationWindow().width - Kirigami.Units.gridUnit * 2, Kirigami.Units.gridUnit * 30)
|
||||||
|
}
|
||||||
|
implicitHeight: {
|
||||||
|
if (root.isMobile) return applicationWindow().height
|
||||||
|
return Math.min(applicationWindow().height - Kirigami.Units.gridUnit * 2, Kirigami.Units.gridUnit * 42)
|
||||||
|
}
|
||||||
|
|
||||||
|
onClosed: libraryView.restoreFocus()
|
||||||
|
|
||||||
|
header: Kirigami.ShadowedRectangle {
|
||||||
|
id: aboutHeader
|
||||||
|
implicitWidth: aboutSheet.implicitWidth
|
||||||
|
implicitHeight: aboutHeaderRow.implicitHeight + Kirigami.Units.largeSpacing * 2
|
||||||
|
|
||||||
|
radius: Kirigami.Units.mediumSpacing
|
||||||
|
color: Kirigami.Theme.backgroundColor
|
||||||
|
|
||||||
|
shadow {
|
||||||
|
size: Kirigami.Units.smallSpacing
|
||||||
|
color: Qt.rgba(0, 0, 0, 0.20)
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
id: aboutHeaderRow
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: Kirigami.Units.largeSpacing
|
||||||
|
spacing: Kirigami.Units.mediumSpacing
|
||||||
|
|
||||||
|
Kirigami.Heading {
|
||||||
|
text: aboutSheet.title
|
||||||
|
level: 2
|
||||||
|
Layout.fillWidth: true
|
||||||
|
elide: Text.ElideRight
|
||||||
|
}
|
||||||
|
|
||||||
|
QQC2.ToolButton {
|
||||||
|
text: i18n("Close")
|
||||||
|
icon.name: "dialog-close"
|
||||||
|
display: QQC2.AbstractButton.IconOnly
|
||||||
|
onClicked: aboutSheet.close()
|
||||||
|
|
||||||
|
QQC2.ToolTip.visible: hovered
|
||||||
|
QQC2.ToolTip.text: text
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
contentItem: Item {
|
||||||
|
Loader {
|
||||||
|
id: aboutPageLoader
|
||||||
|
anchors.fill: parent
|
||||||
|
active: aboutSheet.opened
|
||||||
|
|
||||||
|
sourceComponent: FormCard.AboutPage {
|
||||||
|
title: i18n("About")
|
||||||
|
aboutData: ({
|
||||||
|
"displayName": i18n("A-La-Karte"),
|
||||||
|
"componentName": "alakarte",
|
||||||
|
"shortDescription": i18n("A unified game launcher for KDE Plasma"),
|
||||||
|
"homepage": "",
|
||||||
|
"bugAddress": "",
|
||||||
|
"version": Qt.application.version,
|
||||||
|
"otherText": "",
|
||||||
|
"authors": [],
|
||||||
|
"credits": [],
|
||||||
|
"translators": [],
|
||||||
|
"licenses": [
|
||||||
|
{
|
||||||
|
"name": i18n("GNU General Public License v3.0 or later"),
|
||||||
|
"text": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\n\nThe full license text is available at:\nhttps://www.gnu.org/licenses/gpl-3.0.txt",
|
||||||
|
"spdx": "GPL-3.0-or-later"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"copyrightStatement": "",
|
||||||
|
"desktopFileName": "org.kde.alakarte"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
GameEditDialog {
|
GameEditDialog {
|
||||||
id: gameEditDialog
|
id: gameEditDialog
|
||||||
parent: root.overlay
|
parent: root.overlay
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue