Skip to content

Commit c66c107

Browse files
committed
Use accent color in Sampler's slicers
1 parent b834a24 commit c66c107

1 file changed

Lines changed: 35 additions & 44 deletions

File tree

src/view/qml/Dialogs/SamplerDialog.qml

Lines changed: 35 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -235,32 +235,53 @@ Dialog {
235235
Layout.alignment: Qt.AlignTop
236236
spacing: 15
237237

238+
component ThemedSlider : Slider {
239+
id: control
240+
Layout.fillWidth: true
241+
handle: Rectangle {
242+
x: control.leftPadding + control.visualPosition * (control.availableWidth - width)
243+
y: control.topPadding + control.availableHeight / 2 - height / 2
244+
implicitWidth: 16
245+
implicitHeight: 16
246+
radius: 8
247+
color: control.pressed ? "#f0f0f0" : "#f6f6f6"
248+
border.color: themeService.accentColor
249+
}
250+
background: Rectangle {
251+
x: control.leftPadding
252+
y: control.topPadding + control.availableHeight / 2 - height / 2
253+
implicitWidth: 200
254+
implicitHeight: 4
255+
width: control.availableWidth
256+
height: implicitHeight
257+
radius: 2
258+
color: "#444"
259+
260+
Rectangle {
261+
width: control.visualPosition * parent.width
262+
height: parent.height
263+
color: themeService.accentColor
264+
radius: 2
265+
}
266+
}
267+
}
268+
238269
// Pan Slider
239270
ColumnLayout {
240271
Layout.fillWidth: true
241272
Label {
242273
text: qsTr("Pan: ") + (panSlider.value > 0 ? "+" : "") + Math.round(panSlider.value) + "%"
243274
color: "white"
244275
}
245-
Slider {
276+
ThemedSlider {
246277
id: panSlider
247-
Layout.fillWidth: true
248278
from: -100
249279
to: 100
250280
stepSize: 1
251281
value: (samplerController.selectedPadPan * 200) - 100
252282
onMoved: {
253283
samplerController.selectedPadPan = (value + 100) / 200
254284
}
255-
handle: Rectangle {
256-
x: panSlider.leftPadding + panSlider.visualPosition * (panSlider.availableWidth - width)
257-
y: panSlider.topPadding + panSlider.availableHeight / 2 - height / 2
258-
implicitWidth: 16
259-
implicitHeight: 16
260-
radius: 8
261-
color: panSlider.pressed ? "#f0f0f0" : "#f6f6f6"
262-
border.color: "#bdbebf"
263-
}
264285
}
265286
}
266287

@@ -271,25 +292,15 @@ Dialog {
271292
text: qsTr("Volume: ") + Math.round(volumeSlider.value) + "%"
272293
color: "white"
273294
}
274-
Slider {
295+
ThemedSlider {
275296
id: volumeSlider
276-
Layout.fillWidth: true
277297
from: 0
278298
to: 100
279299
stepSize: 1
280300
value: samplerController.selectedPadVolume * 100
281301
onMoved: {
282302
samplerController.selectedPadVolume = value / 100
283303
}
284-
handle: Rectangle {
285-
x: volumeSlider.leftPadding + volumeSlider.visualPosition * (volumeSlider.availableWidth - width)
286-
y: volumeSlider.topPadding + volumeSlider.availableHeight / 2 - height / 2
287-
implicitWidth: 16
288-
implicitHeight: 16
289-
radius: 8
290-
color: volumeSlider.pressed ? "#f0f0f0" : "#f6f6f6"
291-
border.color: "#bdbebf"
292-
}
293304
}
294305
}
295306

@@ -300,25 +311,15 @@ Dialog {
300311
text: qsTr("LPF Cutoff: ") + Math.round(cutoffSlider.value) + "%"
301312
color: "white"
302313
}
303-
Slider {
314+
ThemedSlider {
304315
id: cutoffSlider
305-
Layout.fillWidth: true
306316
from: 0
307317
to: 100
308318
stepSize: 1
309319
value: samplerController.selectedPadCutoff * 100
310320
onMoved: {
311321
samplerController.selectedPadCutoff = value / 100
312322
}
313-
handle: Rectangle {
314-
x: cutoffSlider.leftPadding + cutoffSlider.visualPosition * (cutoffSlider.availableWidth - width)
315-
y: cutoffSlider.topPadding + cutoffSlider.availableHeight / 2 - height / 2
316-
implicitWidth: 16
317-
implicitHeight: 16
318-
radius: 8
319-
color: cutoffSlider.pressed ? "#f0f0f0" : "#f6f6f6"
320-
border.color: "#bdbebf"
321-
}
322323
}
323324
}
324325

@@ -329,25 +330,15 @@ Dialog {
329330
text: qsTr("HPF Cutoff: ") + Math.round(hpfCutoffSlider.value) + "%"
330331
color: "white"
331332
}
332-
Slider {
333+
ThemedSlider {
333334
id: hpfCutoffSlider
334-
Layout.fillWidth: true
335335
from: 0
336336
to: 100
337337
stepSize: 1
338338
value: samplerController.selectedPadHpfCutoff * 100
339339
onMoved: {
340340
samplerController.selectedPadHpfCutoff = value / 100
341341
}
342-
handle: Rectangle {
343-
x: hpfCutoffSlider.leftPadding + hpfCutoffSlider.visualPosition * (hpfCutoffSlider.availableWidth - width)
344-
y: hpfCutoffSlider.topPadding + hpfCutoffSlider.availableHeight / 2 - height / 2
345-
implicitWidth: 16
346-
implicitHeight: 16
347-
radius: 8
348-
color: hpfCutoffSlider.pressed ? "#f0f0f0" : "#f6f6f6"
349-
border.color: "#bdbebf"
350-
}
351342
}
352343
}
353344

0 commit comments

Comments
 (0)