diff --git a/src/qml/Main.qml b/src/qml/Main.qml index 5e17085..621a53a 100644 --- a/src/qml/Main.qml +++ b/src/qml/Main.qml @@ -39,6 +39,10 @@ Kirigami.ApplicationWindow { settingsSheet.close() return true } + if (aboutSheet.opened) { + aboutSheet.close() + return true + } if (sidebar.modal && sidebar.opened) { sidebar.close() return true @@ -59,6 +63,7 @@ Kirigami.ApplicationWindow { return !gameEditDialog.visible && !detailsSheet.opened && !importSheet.opened + && !aboutSheet.opened && !sidebar.opened && 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 { id: sidebar edge: Qt.LeftEdge @@ -286,7 +255,7 @@ Kirigami.ApplicationWindow { if (sidebar.modal) { sidebar.close() } - root.pageStack.layers.push(aboutPageComponent) + aboutSheet.open() } } } @@ -671,6 +640,8 @@ Kirigami.ApplicationWindow { id: settingsSheet title: i18n("Settings") + closePolicy: QQC2.Popup.CloseOnEscape | QQC2.Popup.CloseOnPressOutside + implicitWidth: { if (root.isMobile) return applicationWindow().width if (root.isNarrowScreen) return applicationWindow().width - Kirigami.Units.largeSpacing * 2 @@ -678,12 +649,50 @@ Kirigami.ApplicationWindow { } implicitHeight: { 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() 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) { let p = item while (p) { @@ -700,9 +709,11 @@ Kirigami.ApplicationWindow { for (let i = 0; i < 50; i++) { next = next.nextItemInFocusChain(forward) if (!next) return - if (settingsSheet.isDescendant(next, settingsContent)) { + if (settingsSheet.isDescendant(next, settingsSheet)) { next.forceActiveFocus() - settingsScroll.ensureItemVisible(next) + if (settingsSheet.isDescendant(next, settingsContent)) { + settingsScroll.ensureItemVisible(next) + } 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 { id: gameEditDialog parent: root.overlay