1212 implicitHeight: 20
1313
1414 Mixxx .ControlProxy {
15- id: vinylEnabledProxy
15+ id: vinylEnabledControl
1616 group: root .group
1717 key: " vinylcontrol_enabled"
1818 }
@@ -23,49 +23,47 @@ Item {
2323 key: " vinylcontrol_status"
2424 }
2525
26+ Mixxx .ControlProxy {
27+ id: passthroughControl
28+ group: root .group
29+ key: " passthrough"
30+ }
31+
2632 RowLayout {
2733 anchors .fill : parent
2834 spacing: 0
2935
3036 // Vinyl enable/disable toggle with status display.
31- // Left-click toggles vinylcontrol_enabled.
32- // Display shows vinylcontrol_status (0=off, 1=ok, 2=speed, 3=both ok).
37+ // The click requests vinylcontrol_enabled; the fill displays vinylcontrol_status.
3338 Item {
3439 Layout .preferredWidth : 40
3540 Layout .preferredHeight : 20
3641
37- Image {
42+ LateNightIconButton {
3843 anchors .fill : parent
39- source: LateNightTheme .lateNightTopRegionButton (" medium" )
40- fillMode: Image .Stretch
41- opacity: vinylEnabledProxy .value > 0 ? 0.95 : 0.72
42- }
43-
44- Image {
45- anchors .centerIn : parent
46- width: Math .min (parent .width , sourceSize .width > 0 ? sourceSize .width / 2 : parent .width )
47- height: Math .min (parent .height , sourceSize .height > 0 ? sourceSize .height / 2 : parent .height )
48- source: {
49- var status = Math .round (vinylStatusProxy .value );
50- switch (status) {
51- case 1 :
52- return LateNightTheme .assetDeckVinylControl1 ;
53- case 2 :
54- return LateNightTheme .assetDeckVinylControl2 ;
55- case 3 :
56- return LateNightTheme .assetDeckVinylControl3 ;
57- default :
58- return LateNightTheme .assetDeckVinylControl0 ;
59- }
60- }
61- fillMode: Image .PreserveAspectFit
62- opacity: vinylEnabledProxy .value > 0 ? 0.95 : 0.72
44+ backgroundSource: LateNightTheme .lateNightButton (" btn_embedded_library.svg" )
45+ activeBackgroundSuffix: " active"
46+ activeState: vinylStatusProxy .value > 0
47+ inactiveColor: LateNightTheme .deckEmbeddedButtonInactiveColor
48+ activeColor: LateNightTheme .vinylStatusColor (vinylStatusProxy .value )
49+ label: " VINYL"
50+ labelPixelSize: 11
51+ labelColor: activeState ? LateNightTheme .deckActiveButtonTextColor : LateNightTheme .textColorMuted
52+ contentOpacity: activeState ? 0.95 : 0.72
53+ useBorderImageBackground: true
54+ backgroundBorderTop: 2
55+ backgroundBorderBottom: 2
56+ backgroundBorderLeft: 2
57+ backgroundBorderRight: 2
6358 }
6459
6560 MouseArea {
6661 anchors .fill : parent
62+ acceptedButtons: Qt .LeftButton
63+ preventStealing: true
64+
6765 onClicked: {
68- vinylEnabledProxy . value = ! vinylEnabledProxy .value ;
66+ vinylEnabledControl . parameter = vinylEnabledControl .value > 0 ? 0 : 1 ;
6967 }
7068 }
7169 }
@@ -74,8 +72,18 @@ Item {
7472 LateNightCycleButton {
7573 Layout .preferredWidth : 46
7674 Layout .preferredHeight : 20
77- backgroundSource: LateNightTheme .lateNightTopRegionButton ( " medium " )
75+ backgroundSource: LateNightTheme .lateNightButton ( " btn_embedded_grid.svg " )
7876 inactiveColor: LateNightTheme .deckEmbeddedButtonInactiveColor
77+ inactiveLabelColor: LateNightTheme .textColorMuted
78+ activeLabelColor: LateNightTheme .textColorMuted
79+ activeOpacity: 0.72
80+ inactiveOpacity: 0.72
81+ labelPixelSize: 11
82+ useBorderImageBackground: true
83+ backgroundBorderTop: 2
84+ backgroundBorderBottom: 2
85+ backgroundBorderLeft: 1
86+ backgroundBorderRight: 2
7987 group: root .group
8088 key: " vinylcontrol_mode"
8189 numStates: 3
@@ -86,28 +94,87 @@ Item {
8694 LateNightCycleButton {
8795 Layout .preferredWidth : 32
8896 Layout .preferredHeight : 20
89- backgroundSource: LateNightTheme .lateNightTopRegionButton (" medium" )
97+ backgroundSource: LateNightTheme .lateNightButton (" btn_embedded_grid.svg" )
98+ activeBackgroundSuffix: " active"
99+ activeWhenNonzero: true
100+ activeColor: LateNightTheme .vinylCueingActiveColor
90101 inactiveColor: LateNightTheme .deckEmbeddedButtonInactiveColor
102+ inactiveLabelColor: LateNightTheme .textColorMuted
103+ activeLabelColor: LateNightTheme .deckActiveButtonTextColor
104+ activeOpacity: 0.95
105+ inactiveOpacity: 0.72
106+ labelPixelSize: 11
107+ useBorderImageBackground: true
108+ backgroundBorderTop: 2
109+ backgroundBorderBottom: 2
110+ backgroundBorderLeft: 1
111+ backgroundBorderRight: 2
91112 group: root .group
92113 key: " vinylcontrol_cueing"
93114 numStates: 3
94115 stateLabels: [" CUE" , " CUE" , " HOT" ]
95116 }
96117
97118 // Passthrough toggle
98- LateNightControlButton {
119+ Item {
99120 Layout .preferredWidth : 35
100121 Layout .preferredHeight : 20
101- backgroundSource: LateNightTheme .lateNightTopRegionButton (" medium" )
102- label: " PASS"
103- labelPixelSize: 9
104- inactiveColor: LateNightTheme .deckEmbeddedButtonInactiveColor
105- group: root .group
106- key: " passthrough"
107- toggleable: true
108- activeOpacity: 0.95
109- inactiveOpacity: 0.72
110- activeOverlayColor: LateNightTheme .accentColor
122+
123+ property bool rejectedPress: false
124+
125+ Timer {
126+ id: passthroughPowerWindowTimer
127+ interval: 300
128+ repeat: false
129+ }
130+
131+ LateNightIconButton {
132+ anchors .fill : parent
133+ backgroundSource: LateNightTheme .lateNightButton (" btn_embedded_grid.svg" )
134+ activeBackgroundSuffix: " active"
135+ activeState: passthroughControl .value > 0
136+ inactiveColor: LateNightTheme .deckEmbeddedButtonInactiveColor
137+ activeColor: LateNightTheme .passthroughActiveColor
138+ label: " PASS"
139+ labelPixelSize: 11
140+ labelColor: activeState ? LateNightTheme .deckActiveButtonTextColor : LateNightTheme .textColorMuted
141+ contentOpacity: activeState ? 0.95 : 0.72
142+ useBorderImageBackground: true
143+ backgroundBorderTop: 2
144+ backgroundBorderBottom: 2
145+ backgroundBorderLeft: 1
146+ backgroundBorderRight: 2
147+ }
148+
149+ MouseArea {
150+ anchors .fill : parent
151+ acceptedButtons: Qt .LeftButton
152+ preventStealing: true
153+
154+ onPressed: {
155+ const targetValue = passthroughControl .value > 0 ? 0 : 1 ;
156+ passthroughControl .parameter = targetValue;
157+ parent .rejectedPress = targetValue > 0 && passthroughControl .value <= 0 ;
158+ passthroughPowerWindowTimer .restart ();
159+ }
160+
161+ onReleased: {
162+ if (parent .rejectedPress ) {
163+ parent .rejectedPress = false ;
164+ passthroughPowerWindowTimer .stop ();
165+ return ;
166+ }
167+ if (! passthroughPowerWindowTimer .running ) {
168+ passthroughControl .parameter = passthroughControl .value > 0 ? 0 : 1 ;
169+ }
170+ passthroughPowerWindowTimer .stop ();
171+ }
172+
173+ onCanceled: {
174+ parent .rejectedPress = false ;
175+ passthroughPowerWindowTimer .stop ();
176+ }
177+ }
111178 }
112179 }
113180}
0 commit comments