diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-08-04 22:45:15 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-08-04 22:45:15 +1000 |
| commit | c5381c5194adf97c240acb98eb4c4c950633b325 (patch) | |
| tree | 52b18eb1771ec6708c86f11d786684f03b8a7c48 /components/filedialog/DialogButtons.qml | |
| parent | dashboard: display correct temp units (diff) | |
| download | caelestia-shell-c5381c5194adf97c240acb98eb4c4c950633b325.tar.gz caelestia-shell-c5381c5194adf97c240acb98eb4c4c950633b325.tar.bz2 caelestia-shell-c5381c5194adf97c240acb98eb4c4c950633b325.zip | |
internal: refactor widgets folder
Split into subdirs and rename to components
Diffstat (limited to 'components/filedialog/DialogButtons.qml')
| -rw-r--r-- | components/filedialog/DialogButtons.qml | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/components/filedialog/DialogButtons.qml b/components/filedialog/DialogButtons.qml new file mode 100644 index 0000000..a64195a --- /dev/null +++ b/components/filedialog/DialogButtons.qml @@ -0,0 +1,93 @@ +import ".." +import qs.services +import qs.config +import QtQuick.Layouts + +StyledRect { + id: root + + required property var dialog + required property FolderContents folder + + implicitHeight: inner.implicitHeight + Appearance.padding.normal * 2 + + color: Colours.palette.m3surfaceContainer + + RowLayout { + id: inner + + anchors.fill: parent + anchors.margins: Appearance.padding.normal + + spacing: Appearance.spacing.small + + StyledText { + text: qsTr("Filter:") + } + + StyledRect { + Layout.fillWidth: true + Layout.fillHeight: true + Layout.rightMargin: Appearance.spacing.normal + + color: Colours.palette.m3surfaceContainerHigh + radius: Appearance.rounding.small + + StyledText { + anchors.fill: parent + anchors.margins: Appearance.padding.normal + + text: `${root.dialog.filterLabel} (${root.dialog.filters.map(f => `*.${f}`).join(", ")})` + } + } + + StyledRect { + color: Colours.palette.m3surfaceContainerHigh + radius: Appearance.rounding.small + + implicitWidth: cancelText.implicitWidth + Appearance.padding.normal * 2 + implicitHeight: cancelText.implicitHeight + Appearance.padding.normal * 2 + + StateLayer { + disabled: !root.dialog.selectionValid + + function onClicked(): void { + root.dialog.accepted(root.folder.currentItem.filePath); + } + } + + StyledText { + id: selectText + + anchors.centerIn: parent + anchors.margins: Appearance.padding.normal + + text: qsTr("Select") + color: root.dialog.selectionValid ? Colours.palette.m3onSurface : Colours.palette.m3outline + } + } + + StyledRect { + color: Colours.palette.m3surfaceContainerHigh + radius: Appearance.rounding.small + + implicitWidth: cancelText.implicitWidth + Appearance.padding.normal * 2 + implicitHeight: cancelText.implicitHeight + Appearance.padding.normal * 2 + + StateLayer { + function onClicked(): void { + root.dialog.rejected(); + } + } + + StyledText { + id: cancelText + + anchors.centerIn: parent + anchors.margins: Appearance.padding.normal + + text: qsTr("Cancel") + } + } + } +} |