aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--desktop/Settings.qml39
-rw-r--r--desktop/WindowButton.qml41
2 files changed, 51 insertions, 29 deletions
diff --git a/desktop/Settings.qml b/desktop/Settings.qml
index 56f911f..0fe9ab6 100644
--- a/desktop/Settings.qml
+++ b/desktop/Settings.qml
@@ -120,35 +120,16 @@ Scope {
height: 28
spacing: 6
- Repeater {
- // nf-fa-compress / nf-fa-expand and nf-fa-xmark, present
- // in Inconsolata Nerd Font.
- model: [
- { icon: win.maximized ? "\uf066" : "\uf065", act: () => win.maximized = !win.maximized, danger: false },
- { icon: "\uf00d", act: () => root.close(), danger: true },
- ]
- Rectangle {
- required property var modelData
- width: 28
- height: 28
- radius: 14
- color: btnArea.containsMouse ? Qt.alpha(modelData.danger ? Theme.red : Theme.accent, 0.25) : "transparent"
-
- Text {
- anchors.centerIn: parent
- text: parent.modelData.icon
- font { family: Theme.iconFamily; pixelSize: Theme.fontSize - 2 }
- color: Theme.text
- }
-
- MouseArea {
- id: btnArea
- anchors.fill: parent
- hoverEnabled: true
- cursorShape: Qt.PointingHandCursor
- onClicked: parent.modelData.act()
- }
- }
+ // nf-fa-compress / nf-fa-expand and nf-fa-xmark, present
+ // in Inconsolata Nerd Font.
+ WindowButton {
+ icon: win.maximized ? "\uf066" : "\uf065"
+ onClicked: win.maximized = !win.maximized
+ }
+ WindowButton {
+ icon: "\uf00d"
+ danger: true
+ onClicked: root.close()
}
}
diff --git a/desktop/WindowButton.qml b/desktop/WindowButton.qml
new file mode 100644
index 0000000..e89ee99
--- /dev/null
+++ b/desktop/WindowButton.qml
@@ -0,0 +1,41 @@
+// Copyright (C) 2026 Danilo M. <danix@danix.xyz>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2 as
+// published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+import QtQuick
+
+// A titlebar's round icon button: no box, a round tint on hover, red for a
+// danger one (close). Keystone's titlebar and the assistant card's.
+Rectangle {
+ id: btn
+ property string icon: ""
+ property bool danger: false
+ signal clicked()
+
+ width: 28
+ height: 28
+ radius: 14
+ color: area.containsMouse ? Qt.alpha(btn.danger ? Theme.red : Theme.accent, 0.25) : "transparent"
+
+ Text {
+ anchors.centerIn: parent
+ text: btn.icon
+ font { family: Theme.iconFamily; pixelSize: Theme.fontSize - 2 }
+ color: Theme.text
+ }
+
+ MouseArea {
+ id: area
+ anchors.fill: parent
+ hoverEnabled: true
+ cursorShape: Qt.PointingHandCursor
+ onClicked: btn.clicked()
+ }
+}