summaryrefslogtreecommitdiff
path: root/qml/DesktopGridView.qml
diff options
context:
space:
mode:
authorFabien Proriol <fabien.proriol@kazoe.org>2025-05-25 17:58:09 +0200
committerFabien Proriol <fabien.proriol@kazoe.org>2025-05-26 18:01:49 +0200
commit49daa163530ceabc9eaa8911ab96b5f799cfb552 (patch)
tree080d0b31eafd138cd8d47d5c2a52b75d3cfa6f28 /qml/DesktopGridView.qml
Initial Commit
Diffstat (limited to 'qml/DesktopGridView.qml')
-rw-r--r--qml/DesktopGridView.qml116
1 files changed, 116 insertions, 0 deletions
diff --git a/qml/DesktopGridView.qml b/qml/DesktopGridView.qml
new file mode 100644
index 0000000..c5bf588
--- /dev/null
+++ b/qml/DesktopGridView.qml
@@ -0,0 +1,116 @@
+import QtQuick
+import QtQuick.Controls
+import org.kazoe.xdg
+
+ListView {
+ id: desktopgridview
+ property string category
+ property int nbrow
+ clip: true
+ orientation: ListView.Horizontal
+ anchors.margins: 5
+ height: 150
+ spacing: 15
+
+
+ model: DesktopFilter {
+ id: filtermodel
+ model: xdgEntries
+ category: desktopgridview.category
+ onRowsInserted: {
+ desktopgridview.nbrow = rowCount()
+ }
+
+ onRowsRemoved: {
+ desktopgridview.nbrow = rowCount()
+ }
+
+ Component.onCompleted: {
+ desktopgridview.nbrow = rowCount()
+ }
+ }
+
+ delegate: Rectangle {
+ property string applicationIcon: appIcon
+ property string applicationTitle: name
+ property string xdgPath: path
+ property alias highlighted: btn.highlighted
+ id: entryItem
+ width: desktopgridview.height * 0.8
+ height: desktopgridview.height * 0.8
+ highlighted: keywords.includes("running")
+ color: (btn.highlighted)?(currentTheme.highlight):(currentTheme.window)
+ radius: 4
+
+ Button {
+ id: btn
+ icon.source: "file://" + entryItem.applicationIcon
+ icon.name: entryItem.applicationIcon
+ icon.width: btn.width
+ icon.height: btn.height
+
+ font.pixelSize: 12
+ font.bold: true
+ height: entryItem.height * 0.5
+ width: entryItem.width * 0.5
+ anchors.top: parent.top
+ anchors.topMargin: 10
+ anchors.horizontalCenter: parent.horizontalCenter
+
+ background: Rectangle {
+ color: "transparent"
+ }
+ }
+
+ Text {
+ anchors.top: btn.bottom
+ anchors.left: parent.left
+ anchors.right: parent.right
+ height: entryItem.height * 0.4
+ text: entryItem.applicationTitle
+ font: btn.font
+ fontSizeMode: Text.Fit
+ opacity: enabled ? 1.0 : 0.3
+ color: (btn.highlighted)?("white"):("grey")
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ elide: Text.ElideRight
+ }
+
+ MouseArea {
+ id: zone
+ anchors.fill: parent
+ enabled: parent.enabled
+ property bool locked: false
+
+ onClicked: {
+ if(zone.locked)
+ zone.locked = false
+ else
+ xdgEntries.start(entryItem.xdgPath)
+ }
+
+
+ Timer {
+ id: longPressTimer
+
+ interval: 1000
+ repeat: false
+ running: false
+
+ onTriggered: {
+ xdgEntries.stop(entryItem.xdgPath)
+ zone.locked = true
+ }
+ }
+
+ onPressedChanged: {
+ if ( pressed ) {
+ longPressTimer.running = true;
+ } else {
+ longPressTimer.running = false;
+ }
+ }
+ }
+ }
+}