diff options
Diffstat (limited to 'components')
| -rw-r--r-- | components/filedialog/CurrentItem.qml | 102 | ||||
| -rw-r--r-- | components/filedialog/DialogButtons.qml | 93 | ||||
| -rw-r--r-- | components/filedialog/FileDialog.qml | 102 | ||||
| -rw-r--r-- | components/filedialog/Sidebar.qml | 113 | ||||
| -rw-r--r-- | components/filedialog/Sizes.qml | 8 | ||||
| -rw-r--r-- | components/images/CachingIconImage.qml | 42 | ||||
| -rw-r--r-- | components/images/CachingImage.qml | 28 |
7 files changed, 0 insertions, 488 deletions
diff --git a/components/filedialog/CurrentItem.qml b/components/filedialog/CurrentItem.qml deleted file mode 100644 index bb87133..0000000 --- a/components/filedialog/CurrentItem.qml +++ /dev/null @@ -1,102 +0,0 @@ -import ".." -import qs.services -import qs.config -import QtQuick -import QtQuick.Shapes - -Item { - id: root - - required property var currentItem - - implicitWidth: content.implicitWidth + Appearance.padding.larger + content.anchors.rightMargin - implicitHeight: currentItem ? content.implicitHeight + Appearance.padding.normal + content.anchors.bottomMargin : 0 - - Shape { - preferredRendererType: Shape.CurveRenderer - - ShapePath { - id: path - - readonly property real rounding: Appearance.rounding.small - readonly property bool flatten: root.implicitHeight < rounding * 2 - readonly property real roundingY: flatten ? root.implicitHeight / 2 : rounding - - strokeWidth: -1 - fillColor: Colours.tPalette.m3surfaceContainer - - startX: root.implicitWidth - startY: root.implicitHeight - - PathLine { - relativeX: -(root.implicitWidth + path.rounding) - relativeY: 0 - } - PathArc { - relativeX: path.rounding - relativeY: -path.roundingY - radiusX: path.rounding - radiusY: Math.min(path.rounding, root.implicitHeight) - direction: PathArc.Counterclockwise - } - PathLine { - relativeX: 0 - relativeY: -(root.implicitHeight - path.roundingY * 2) - } - PathArc { - relativeX: path.rounding - relativeY: -path.roundingY - radiusX: path.rounding - radiusY: Math.min(path.rounding, root.implicitHeight) - } - PathLine { - relativeX: root.implicitHeight > 0 ? root.implicitWidth - path.rounding * 2 : root.implicitWidth - relativeY: 0 - } - PathArc { - relativeX: path.rounding - relativeY: -path.rounding - radiusX: path.rounding - radiusY: path.rounding - direction: PathArc.Counterclockwise - } - - Behavior on fillColor { - CAnim {} - } - } - } - - Item { - anchors.fill: parent - clip: true - - StyledText { - id: content - - anchors.right: parent.right - anchors.bottom: parent.bottom - anchors.rightMargin: Appearance.padding.larger - Appearance.padding.small - anchors.bottomMargin: Appearance.padding.normal - Appearance.padding.small - - Connections { - target: root - - function onCurrentItemChanged(): void { - if (root.currentItem) - content.text = qsTr(`"%1" selected`).arg(root.currentItem.modelData.name); - } - } - } - } - - Behavior on implicitWidth { - enabled: !!root.currentItem - - Anim {} - } - - Behavior on implicitHeight { - Anim {} - } -} diff --git a/components/filedialog/DialogButtons.qml b/components/filedialog/DialogButtons.qml deleted file mode 100644 index bde9ac2..0000000 --- a/components/filedialog/DialogButtons.qml +++ /dev/null @@ -1,93 +0,0 @@ -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.tPalette.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.tPalette.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.tPalette.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.modelData.path); - } - } - - 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.tPalette.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") - } - } - } -} diff --git a/components/filedialog/FileDialog.qml b/components/filedialog/FileDialog.qml deleted file mode 100644 index f3187a5..0000000 --- a/components/filedialog/FileDialog.qml +++ /dev/null @@ -1,102 +0,0 @@ -pragma ComponentBehavior: Bound - -import qs.components -import qs.services -import Quickshell -import QtQuick -import QtQuick.Layouts - -LazyLoader { - id: loader - - property list<string> cwd: ["Home"] - property string filterLabel: "All files" - property list<string> filters: ["*"] - property string title: qsTr("Select a file") - - signal accepted(path: string) - signal rejected - - function open(): void { - activeAsync = true; - } - - function close(): void { - rejected(); - } - - onAccepted: activeAsync = false - onRejected: activeAsync = false - - FloatingWindow { - id: root - - property list<string> cwd: loader.cwd - property string filterLabel: loader.filterLabel - property list<string> filters: loader.filters - - readonly property bool selectionValid: { - const file = folderContents.currentItem?.modelData; - return (file && !file.isDir && (filters.includes("*") || filters.includes(file.suffix))) ?? false; - } - - function accepted(path: string): void { - loader.accepted(path); - } - - function rejected(): void { - loader.rejected(); - } - - implicitWidth: 1000 - implicitHeight: 600 - color: Colours.tPalette.m3surface - title: loader.title - - onVisibleChanged: { - if (!visible) - rejected(); - } - - RowLayout { - anchors.fill: parent - - spacing: 0 - - Sidebar { - Layout.fillHeight: true - dialog: root - } - - ColumnLayout { - Layout.fillWidth: true - Layout.fillHeight: true - - spacing: 0 - - HeaderBar { - Layout.fillWidth: true - dialog: root - } - - FolderContents { - id: folderContents - - Layout.fillWidth: true - Layout.fillHeight: true - dialog: root - } - - DialogButtons { - Layout.fillWidth: true - dialog: root - folder: folderContents - } - } - } - - Behavior on color { - CAnim {} - } - } -} diff --git a/components/filedialog/Sidebar.qml b/components/filedialog/Sidebar.qml deleted file mode 100644 index b55d7b3..0000000 --- a/components/filedialog/Sidebar.qml +++ /dev/null @@ -1,113 +0,0 @@ -pragma ComponentBehavior: Bound - -import ".." -import qs.services -import qs.config -import QtQuick -import QtQuick.Layouts - -StyledRect { - id: root - - required property var dialog - - implicitWidth: Sizes.sidebarWidth - implicitHeight: inner.implicitHeight + Appearance.padding.normal * 2 - - color: Colours.tPalette.m3surfaceContainer - - ColumnLayout { - id: inner - - anchors.left: parent.left - anchors.right: parent.right - anchors.top: parent.top - anchors.margins: Appearance.padding.normal - spacing: Appearance.spacing.small / 2 - - StyledText { - Layout.alignment: Qt.AlignHCenter - Layout.topMargin: Appearance.padding.small / 2 - Layout.bottomMargin: Appearance.spacing.normal - text: qsTr("Files") - color: Colours.palette.m3onSurface - font.pointSize: Appearance.font.size.larger - font.bold: true - } - - Repeater { - model: ["Home", "Downloads", "Desktop", "Documents", "Music", "Pictures", "Videos"] - - StyledRect { - id: place - - required property string modelData - readonly property bool selected: modelData === root.dialog.cwd[root.dialog.cwd.length - 1] - - Layout.fillWidth: true - implicitHeight: placeInner.implicitHeight + Appearance.padding.normal * 2 - - radius: Appearance.rounding.full - color: Qt.alpha(Colours.palette.m3secondaryContainer, selected ? 1 : 0) - - StateLayer { - color: place.selected ? Colours.palette.m3onSecondaryContainer : Colours.palette.m3onSurface - - function onClicked(): void { - if (place.modelData === "Home") - root.dialog.cwd = ["Home"]; - else - root.dialog.cwd = ["Home", place.modelData]; - } - } - - RowLayout { - id: placeInner - - anchors.fill: parent - anchors.margins: Appearance.padding.normal - anchors.leftMargin: Appearance.padding.large - anchors.rightMargin: Appearance.padding.large - - spacing: Appearance.spacing.normal - - MaterialIcon { - text: { - const p = place.modelData; - if (p === "Home") - return "home"; - if (p === "Downloads") - return "file_download"; - if (p === "Desktop") - return "desktop_windows"; - if (p === "Documents") - return "description"; - if (p === "Music") - return "music_note"; - if (p === "Pictures") - return "image"; - if (p === "Videos") - return "video_library"; - return "folder"; - } - color: place.selected ? Colours.palette.m3onSecondaryContainer : Colours.palette.m3onSurface - font.pointSize: Appearance.font.size.large - fill: place.selected ? 1 : 0 - - Behavior on fill { - Anim {} - } - } - - StyledText { - Layout.fillWidth: true - text: place.modelData - color: place.selected ? Colours.palette.m3onSecondaryContainer : Colours.palette.m3onSurface - font.pointSize: Appearance.font.size.normal - elide: Text.ElideRight - } - } - } - } - } -} diff --git a/components/filedialog/Sizes.qml b/components/filedialog/Sizes.qml deleted file mode 100644 index 2ad31f9..0000000 --- a/components/filedialog/Sizes.qml +++ /dev/null @@ -1,8 +0,0 @@ -pragma Singleton - -import Quickshell - -Singleton { - property int itemWidth: 103 - property int sidebarWidth: 200 -} diff --git a/components/images/CachingIconImage.qml b/components/images/CachingIconImage.qml deleted file mode 100644 index 1acc6a1..0000000 --- a/components/images/CachingIconImage.qml +++ /dev/null @@ -1,42 +0,0 @@ -pragma ComponentBehavior: Bound - -import qs.utils -import Quickshell.Widgets -import QtQuick - -Item { - id: root - - readonly property int status: loader.item?.status ?? Image.Null - readonly property real actualSize: Math.min(width, height) - property real implicitSize - property url source - - implicitWidth: implicitSize - implicitHeight: implicitSize - - Loader { - id: loader - - anchors.fill: parent - sourceComponent: root.source ? root.source.toString().startsWith("image://icon/") ? iconImage : cachingImage : null - } - - Component { - id: cachingImage - - CachingImage { - path: Paths.toLocalFile(root.source) - fillMode: Image.PreserveAspectFit - } - } - - Component { - id: iconImage - - IconImage { - source: root.source - asynchronous: true - } - } -} diff --git a/components/images/CachingImage.qml b/components/images/CachingImage.qml deleted file mode 100644 index e8f957a..0000000 --- a/components/images/CachingImage.qml +++ /dev/null @@ -1,28 +0,0 @@ -import qs.utils -import Caelestia.Internal -import Quickshell -import QtQuick - -Image { - id: root - - property alias path: manager.path - - asynchronous: true - fillMode: Image.PreserveAspectCrop - - Connections { - target: QsWindow.window - - function onDevicePixelRatioChanged(): void { - manager.updateSource(); - } - } - - CachingImageManager { - id: manager - - item: root - cacheDir: Qt.resolvedUrl(Paths.imagecache) - } -} |