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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
|
import QtQuick
import qs.Common
import qs.Widgets
Column {
id: root
property string outputName: ""
property var outputData: null
property bool expanded: false
width: parent.width
spacing: 0
Rectangle {
width: parent.width
height: headerRow.implicitHeight + Theme.spacingS * 2
color: headerMouse.containsMouse ? Theme.withAlpha(Theme.primary, 0.1) : "transparent"
radius: Theme.cornerRadius / 2
Row {
id: headerRow
anchors.left: parent.left
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: Theme.spacingS
anchors.rightMargin: Theme.spacingS
spacing: Theme.spacingS
DankIcon {
name: root.expanded ? "expand_more" : "chevron_right"
size: Theme.iconSize
color: Theme.primary
anchors.verticalCenter: parent.verticalCenter
}
StyledText {
text: I18n.tr("Compositor Settings")
font.pixelSize: Theme.fontSizeMedium
font.weight: Font.Medium
color: Theme.primary
anchors.verticalCenter: parent.verticalCenter
}
}
MouseArea {
id: headerMouse
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: root.expanded = !root.expanded
}
}
Column {
id: settingsColumn
width: parent.width
spacing: Theme.spacingS
visible: root.expanded
topPadding: Theme.spacingS
property int currentBitdepth: {
DisplayConfigState.pendingHyprlandChanges;
return DisplayConfigState.getHyprlandSetting(root.outputData, root.outputName, "bitdepth", 8);
}
property bool is10Bit: currentBitdepth === 10
property string currentCm: {
DisplayConfigState.pendingHyprlandChanges;
return DisplayConfigState.getHyprlandSetting(root.outputData, root.outputName, "colorManagement", "auto");
}
property bool isHdrMode: currentCm === "hdr" || currentCm === "hdredid"
DankToggle {
width: parent.width
text: I18n.tr("Disable Output")
checked: DisplayConfigState.getHyprlandSetting(root.outputData, root.outputName, "disabled", false)
onToggled: checked => DisplayConfigState.setHyprlandSetting(root.outputData, root.outputName, "disabled", checked)
}
DankDropdown {
width: parent.width
text: I18n.tr("Mirror Display")
addHorizontalPadding: true
property var otherOutputs: {
const list = [I18n.tr("None")];
for (const name in DisplayConfigState.outputs) {
if (name !== root.outputName)
list.push(name);
}
return list;
}
options: otherOutputs
currentValue: {
DisplayConfigState.pendingChanges;
const pending = DisplayConfigState.getPendingValue(root.outputName, "mirror");
const val = pending !== undefined ? pending : (root.outputData.mirror || "");
return val === "" ? I18n.tr("None") : val;
}
onValueChanged: value => {
const realVal = value === I18n.tr("None") ? "" : value;
DisplayConfigState.setPendingChange(root.outputName, "mirror", realVal);
}
}
DankToggle {
width: parent.width
text: I18n.tr("10-bit Color")
description: I18n.tr("Enable 10-bit color depth for wider color gamut and HDR support")
checked: settingsColumn.is10Bit
onToggled: checked => {
if (checked) {
DisplayConfigState.setHyprlandSetting(root.outputData, root.outputName, "bitdepth", 10);
} else {
DisplayConfigState.setHyprlandSetting(root.outputData, root.outputName, "bitdepth", null);
if (settingsColumn.isHdrMode)
DisplayConfigState.setHyprlandSetting(root.outputData, root.outputName, "colorManagement", "auto");
}
}
}
Column {
width: parent.width
spacing: Theme.spacingS
visible: settingsColumn.is10Bit
Rectangle {
width: parent.width
height: 1
color: Theme.withAlpha(Theme.outline, 0.15)
}
DankDropdown {
width: parent.width
text: I18n.tr("Color Gamut")
addHorizontalPadding: true
currentValue: {
DisplayConfigState.pendingHyprlandChanges;
const val = DisplayConfigState.getHyprlandSetting(root.outputData, root.outputName, "colorManagement", "auto");
return cmLabelMap[val] || I18n.tr("Auto (Wide)");
}
options: [I18n.tr("Auto (Wide)"), I18n.tr("Wide (BT2020)"), "DCI-P3", "Apple P3", "Adobe RGB", "EDID", "HDR", I18n.tr("HDR (EDID)")]
property var cmValueMap: ({
[I18n.tr("Auto (Wide)")]: "auto",
[I18n.tr("Wide (BT2020)")]: "wide",
"DCI-P3": "dcip3",
"Apple P3": "dp3",
"Adobe RGB": "adobe",
"EDID": "edid",
"HDR": "hdr",
[I18n.tr("HDR (EDID)")]: "hdredid"
})
property var cmLabelMap: ({
"auto": I18n.tr("Auto (Wide)"),
"wide": I18n.tr("Wide (BT2020)"),
"dcip3": "DCI-P3",
"dp3": "Apple P3",
"adobe": "Adobe RGB",
"edid": "EDID",
"hdr": "HDR",
"hdredid": I18n.tr("HDR (EDID)")
})
onValueChanged: value => {
const cmValue = cmValueMap[value] || "auto";
DisplayConfigState.setHyprlandSetting(root.outputData, root.outputName, "colorManagement", cmValue);
}
}
Rectangle {
width: parent.width - Theme.spacingM * 2
anchors.horizontalCenter: parent.horizontalCenter
height: warningColumn.implicitHeight + Theme.spacingM * 2
radius: Theme.cornerRadius / 2
color: Theme.withAlpha(Theme.warning, 0.15)
border.color: Theme.withAlpha(Theme.warning, 0.3)
border.width: 1
visible: settingsColumn.isHdrMode
Column {
id: warningColumn
anchors.fill: parent
anchors.margins: Theme.spacingM
spacing: Theme.spacingXS
Row {
spacing: Theme.spacingS
DankIcon {
name: "warning"
size: Theme.iconSize - 4
color: Theme.warning
anchors.verticalCenter: parent.verticalCenter
}
StyledText {
text: I18n.tr("Experimental Feature")
font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Medium
color: Theme.warning
anchors.verticalCenter: parent.verticalCenter
}
}
StyledText {
text: I18n.tr("HDR mode is experimental. Verify your monitor supports HDR before enabling.")
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
wrapMode: Text.WordWrap
width: parent.width
}
}
}
Column {
width: parent.width
spacing: Theme.spacingS
visible: settingsColumn.isHdrMode
Rectangle {
width: parent.width
height: 1
color: Theme.withAlpha(Theme.outline, 0.15)
}
StyledText {
text: I18n.tr("HDR Tone Mapping")
font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Medium
color: Theme.surfaceVariantText
leftPadding: Theme.spacingM
}
Row {
width: parent.width - Theme.spacingM * 2
anchors.horizontalCenter: parent.horizontalCenter
spacing: Theme.spacingM
Column {
width: (parent.width - Theme.spacingM) / 2
spacing: Theme.spacingXS
StyledText {
text: I18n.tr("SDR Brightness")
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
DankTextField {
width: parent.width
height: 40
placeholderText: "1.0 - 2.0"
text: {
DisplayConfigState.pendingHyprlandChanges;
const val = DisplayConfigState.getHyprlandSetting(root.outputData, root.outputName, "sdrBrightness", null);
return val !== null ? val.toString() : "";
}
onEditingFinished: {
const trimmed = text.trim();
if (!trimmed) {
DisplayConfigState.setHyprlandSetting(root.outputData, root.outputName, "sdrBrightness", null);
return;
}
const val = parseFloat(trimmed);
if (isNaN(val) || val < 0.1 || val > 5.0)
return;
DisplayConfigState.setHyprlandSetting(root.outputData, root.outputName, "sdrBrightness", parseFloat(val.toFixed(2)));
}
}
}
Column {
width: (parent.width - Theme.spacingM) / 2
spacing: Theme.spacingXS
StyledText {
text: I18n.tr("SDR Saturation")
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
DankTextField {
width: parent.width
height: 40
placeholderText: "0.5 - 1.5"
text: {
DisplayConfigState.pendingHyprlandChanges;
const val = DisplayConfigState.getHyprlandSetting(root.outputData, root.outputName, "sdrSaturation", null);
return val !== null ? val.toString() : "";
}
onEditingFinished: {
const trimmed = text.trim();
if (!trimmed) {
DisplayConfigState.setHyprlandSetting(root.outputData, root.outputName, "sdrSaturation", null);
return;
}
const val = parseFloat(trimmed);
if (isNaN(val) || val < 0.0 || val > 3.0)
return;
DisplayConfigState.setHyprlandSetting(root.outputData, root.outputName, "sdrSaturation", parseFloat(val.toFixed(2)));
}
}
}
}
}
}
}
}
|