blob: a127e0b4802c29e3353767ba8ac34ce7d4abac02 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
// 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
import "../.."
// One line of the transitions page: a frame caught halfway through the
// transition, its name, the Active mark, and the switch for Random's pool. A
// click on the line previews it; only the Active mark changes the choice.
// The line named "random" has no frame to preview and no switch.
Item {
id: row
required property string name
required property string label
// Column widths, shared with the page's headings.
required property int activeWidth
required property int randomWidth
readonly property bool random: name === "random"
readonly property bool active: Transitions.draftPick === name
signal preview
signal activated
implicitHeight: 76
Rectangle {
anchors.fill: parent
radius: 6
color: row.active ? Qt.alpha(Theme.accent, 0.14)
: area.containsMouse ? Qt.alpha(Theme.text, 0.06) : "transparent"
}
MouseArea {
id: area
anchors.fill: parent
enabled: !row.random
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: row.preview()
}
Rectangle {
id: frame
anchors { left: parent.left; leftMargin: 6; verticalCenter: parent.verticalCenter }
// DP-1's shape, like the monitor above.
width: 152; height: 64
color: Theme.surface
TransitionView {
anchors.fill: parent
visible: !row.random
name: row.random ? "burn" : row.name
progress: 0.5
origin: Qt.point(0.35, 0.6)
}
Text {
anchors.centerIn: parent
visible: row.random
// nf-fa-shuffle, present in Inconsolata Nerd Font.
text: ""
color: Theme.subtext
font { family: Theme.iconFamily; pixelSize: Theme.fontSize * 2 }
}
}
Text {
anchors { left: frame.right; leftMargin: 14; verticalCenter: parent.verticalCenter }
text: row.label
color: row.active ? Theme.text : Theme.subtext
font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2 }
}
Item {
id: randomCell
anchors { right: parent.right; top: parent.top; bottom: parent.bottom }
width: row.randomWidth
Switch {
anchors.centerIn: parent
visible: !row.random
checked: Transitions.draftPool.indexOf(row.name) >= 0
onToggled: Transitions.toggle(row.name)
}
}
Item {
anchors { right: randomCell.left; top: parent.top; bottom: parent.bottom }
width: row.activeWidth
Rectangle {
anchors.centerIn: parent
width: 20; height: 20; radius: 10
color: "transparent"
border.width: 2
border.color: row.active ? Theme.accent : Qt.alpha(Theme.text, 0.3)
Rectangle {
anchors.centerIn: parent
visible: row.active
width: 10; height: 10; radius: 5
color: Theme.accent
}
}
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: {
Transitions.draftPick = row.name;
row.activated();
}
}
}
}
|