diff options
| -rw-r--r-- | appearance/IconsTab.qml | 46 |
1 files changed, 41 insertions, 5 deletions
diff --git a/appearance/IconsTab.qml b/appearance/IconsTab.qml index b2c7ee4..908a003 100644 --- a/appearance/IconsTab.qml +++ b/appearance/IconsTab.qml @@ -18,6 +18,10 @@ Flickable { clip: true property string liveCursorCursor: "" + // Clicking a cursor card stages it; Apply commits. The hover preview above + // switches the real cursor and reverts, so staging must not be confused + // with it: pendingCursor survives unhover, liveCursorCursor does not. + property string pendingCursor: "" Column { id: col @@ -131,10 +135,13 @@ Flickable { id: cursorCard required property string modelData readonly property bool current: Icons.currentCursor === modelData + readonly property bool staged: pendingCursor === modelData width: 230; height: 150; radius: 10 - color: current ? Qt.alpha(Theme.accent, 0.2) : Qt.alpha(Theme.surface, 0.35) - border.width: current ? 2 : 1 - border.color: current ? Theme.accent : "transparent" + color: current || staged ? Qt.alpha(Theme.accent, 0.2) : Qt.alpha(Theme.surface, 0.35) + border.width: current || staged ? 2 : 1 + border.color: staged ? Theme.accent + : current ? Qt.alpha(Theme.accent, 0.5) + : "transparent" HoverHandler { onHoveredChanged: { @@ -154,7 +161,7 @@ Flickable { MouseArea { anchors.fill: parent cursorShape: Qt.PointingHandCursor - onClicked: Icons.applyCursor(modelData) + onClicked: pendingCursor = modelData } Column { @@ -181,7 +188,9 @@ Flickable { Text { width: parent.width horizontalAlignment: Text.AlignHCenter - text: cursorCard.current ? modelData + " current" : modelData + text: cursorCard.staged ? modelData + " staged" + : cursorCard.current ? modelData + " current" + : modelData color: Theme.text font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 3 } wrapMode: Text.WrapAnywhere @@ -193,6 +202,33 @@ Flickable { } } + Row { + spacing: 8 + Text { + anchors.verticalCenter: parent.verticalCenter + text: pendingCursor !== "" ? "click Apply to set" : "click a cursor theme to stage it" + color: Theme.overlay + font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 4 } + } + Tab { + text: "Apply" + selected: pendingCursor !== "" + enabled: pendingCursor !== "" + onClicked: { + // The hover revert would otherwise fire on the way out and + // set the old theme back over the one just applied. + liveCursorCursor = ""; + Icons.applyCursor(pendingCursor); + pendingCursor = ""; + } + } + Tab { + text: "Reset" + enabled: pendingCursor !== "" + onClicked: pendingCursor = "" + } + } + Text { width: parent.width wrapMode: Text.Wrap |
