Skip to content

Commit fb35f76

Browse files
committed
fix(LateNightQML): address deck review feedback
1 parent 6355228 commit fb35f76

12 files changed

Lines changed: 198 additions & 135 deletions

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3973,6 +3973,7 @@ if(QML)
39733973
src/qml/qmlconfigproxybase.cpp
39743974
src/qml/qmlcontrolproxy.cpp
39753975
src/qml/qmlcuesmodel.cpp
3976+
src/qml/qmldurationformatter.cpp
39763977
src/qml/qmldlgpreferencesproxy.cpp
39773978
src/qml/qmleffectmanifestparametersmodel.cpp
39783979
src/qml/qmleffectslotproxy.cpp

res/qml/Deck/TrackTime.qml

Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -26,41 +26,12 @@ Skin.EmbeddedText {
2626
property double remaining: durationControl.value * (1 - playPositionControl.value)
2727

2828
function toTime(value) {
29-
let result = "";
30-
switch (root.mode) {
31-
case TrackTime.Mode.Seconds:
32-
case TrackTime.Mode.SecondsLong:
33-
{
34-
let seconds = parseInt(value).toString();
35-
let subs = value % 1;
36-
return `${seconds.padStart(root.mode === TrackTime.Mode.SecondsLong ? 3 : 0, '0')}.${subs.toFixed(2).slice(-2)}`;
37-
}
38-
case TrackTime.Mode.KiloSeconds:
39-
{
40-
let kilos = parseInt(value / 1000);
41-
let seconds = parseInt(value % 1000).toString();
42-
let subs = value % 1;
43-
return `${kilos}.${seconds.padStart(3, '0')} ${subs.toFixed(2).slice(-2)}`;
44-
}
45-
case TrackTime.Mode.HectoSeconds:
46-
return `???`;
47-
default:
48-
console.warn(`Unsupported track time mode: ${root.mode}. Defaulting to traditional`);
49-
case TrackTime.Mode.Traditional:
50-
case TrackTime.Mode.TraditionalCoarse:
51-
{
52-
let component = [];
53-
if (remaining + elapsed > 3600) {
54-
component.push(parseInt(value / 3600).toString().padStart(2, '0'));
55-
}
56-
component.push(parseInt(value / 60).toString().padStart(2, '0'));
57-
component.push(parseInt(value % 60).toString().padStart(2, '0'));
58-
if (root.mode !== TrackTime.Mode.TraditionalCoarse) {
59-
component[component.length - 1] += `.${(value % 1).toFixed(2).slice(-2)}`;
60-
}
61-
return component.join(':');
62-
}
29+
if (!Number.isFinite(value)) {
30+
return "";
6331
}
32+
33+
const sign = value < 0 ? "-" : "";
34+
return sign + Mixxx.DurationFormatter.format(Math.abs(value), root.mode);
6435
}
6536

6637
text: {

res/skins/LateNightQML/Deck/LateNightBpmTapEditor.qml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
pragma ComponentBehavior: Bound
2+
13
import QtQuick
24
import Mixxx 1.0 as Mixxx
35
import "../LateNightTheme"
@@ -82,8 +84,14 @@ Item {
8284
}
8385

8486
function applyEditValueAndQuit() {
85-
const parsedValue = Number(editInput.text);
86-
if (!isFinite(parsedValue)) {
87+
const input = editInput.text.trim();
88+
if (input.length === 0) {
89+
switchMode("listen");
90+
return;
91+
}
92+
93+
const parsedValue = Number(input);
94+
if (!Number.isFinite(parsedValue)) {
8795
switchMode("listen");
8896
return;
8997
}

res/skins/LateNightQML/Deck/LateNightTrackPropertyText.qml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
pragma ComponentBehavior: Bound
2+
13
import QtQuick
24
import Mixxx 1.0 as Mixxx
35
import "../LateNightTheme"
@@ -6,7 +8,7 @@ Item {
68
id: root
79

810
required property string group
9-
required property var track
11+
required property Mixxx.Track track
1012
required property string text
1113
required property string displayProperty
1214
property string editProperty: displayProperty
@@ -23,6 +25,7 @@ Item {
2325

2426
property bool selected: false
2527
property bool editing: false
28+
readonly property bool highlighted: root.selected || mouseArea.containsMouse || root.editing
2629

2730
implicitWidth: textLabel.implicitWidth + horizontalPadding * 2
2831
implicitHeight: textLabel.implicitHeight
@@ -126,10 +129,10 @@ Item {
126129

127130
Rectangle {
128131
anchors.fill: parent
129-
color: root.selected || mouseArea.containsMouse || root.editing ? "#151515" : "transparent"
132+
color: root.highlighted ? LateNightTheme.trackPropertyHighlightColor : "transparent"
130133
border.width: root.editing ? 1 : 0
131134
border.color: LateNightTheme.secondaryWaveformSignalColor
132-
visible: root.selected || mouseArea.containsMouse || root.editing
135+
visible: root.highlighted
133136
}
134137

135138
Text {
@@ -156,8 +159,8 @@ Item {
156159
font.family: "Open Sans"
157160
font.pixelSize: root.pixelSize
158161
color: root.textColor
159-
selectedTextColor: "#111111"
160-
selectionColor: "#d9d9d9"
162+
selectedTextColor: LateNightTheme.trackPropertySelectedTextColor
163+
selectionColor: LateNightTheme.trackPropertySelectionColor
161164
horizontalAlignment: root.horizontalAlignment
162165
verticalAlignment: TextInput.AlignVCenter
163166
selectByMouse: true

res/skins/LateNightQML/Deck/OverviewRow.qml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
pragma ComponentBehavior: Bound
2+
13
import QtQuick
24
import QtQuick.Layouts
35
import Mixxx 1.0 as Mixxx
@@ -67,9 +69,9 @@ Item {
6769
anchors.fill: parent
6870
anchors.margins: 1
6971
group: root.group
70-
colorLow: root.useFilteredOverview ? root.waveformSignalColor : "#0000ff"
71-
colorMid: root.useFilteredOverview ? root.waveformSignalColor : "#00ff00"
72-
colorHigh: root.useFilteredOverview ? root.waveformSignalColor : "#ff0000"
72+
colorLow: root.useFilteredOverview ? root.waveformSignalColor : LateNightTheme.overviewRgbLowColor
73+
colorMid: root.useFilteredOverview ? root.waveformSignalColor : LateNightTheme.overviewRgbMidColor
74+
colorHigh: root.useFilteredOverview ? root.waveformSignalColor : LateNightTheme.overviewRgbHighColor
7375
renderer: root.useFilteredOverview ? Mixxx.WaveformOverview.Renderer.Filtered : Mixxx.WaveformOverview.Renderer.RGB
7476
}
7577

@@ -139,9 +141,9 @@ Item {
139141
key: "show_intro_outro_cues"
140142
}
141143

142-
readonly property string cueColor: LateNightTheme.isPaleMoon ? "#ff7a01" : "#ff001c"
143-
readonly property string loopColor: LateNightTheme.isPaleMoon ? "#00b400" : "#00ff00"
144-
readonly property string introOutroColor: LateNightTheme.isPaleMoon ? "#2c5c9a" : "#0000ff"
144+
readonly property color cueColor: LateNightTheme.waveformCueColor
145+
readonly property color loopColor: LateNightTheme.waveformLoopColor
146+
readonly property color introOutroColor: LateNightTheme.waveformIntroOutroColor
145147

146148
function mapX(pos) {
147149
if (trackSamplesProxy.value <= 0 || pos < 0) {
@@ -181,7 +183,7 @@ Item {
181183
width: 12
182184
height: 10
183185
text: hotcueMarker.hotcueNumber
184-
color: "#FFFFFF"
186+
color: LateNightTheme.overviewHotcueTextColor(hotcueMarker.markerColor)
185187
font.family: "Open Sans"
186188
font.pixelSize: 10
187189
font.bold: true
@@ -241,7 +243,7 @@ Item {
241243
anchors.top: parent.top
242244
anchors.topMargin: 2
243245
text: ""
244-
color: "#FFFFFF"
246+
color: LateNightTheme.overviewMarkerTextColor
245247
font.family: "Open Sans"
246248
font.pixelSize: 10
247249
font.bold: true
@@ -275,7 +277,7 @@ Item {
275277
anchors.top: parent.top
276278
anchors.topMargin: 2
277279
text: "C"
278-
color: "#FFFFFF"
280+
color: LateNightTheme.overviewMarkerTextColor
279281
font.family: "Open Sans"
280282
font.pixelSize: 10
281283
font.bold: true
@@ -321,7 +323,7 @@ Item {
321323
anchors.top: parent.top
322324
anchors.topMargin: 2
323325
text: ""
324-
color: "#FFFFFF"
326+
color: LateNightTheme.overviewMarkerTextColor
325327
font.family: "Open Sans"
326328
font.pixelSize: 10
327329
font.bold: true
@@ -367,7 +369,7 @@ Item {
367369
anchors.top: parent.top
368370
anchors.topMargin: 2
369371
text: ""
370-
color: "#FFFFFF"
372+
color: LateNightTheme.overviewMarkerTextColor
371373
font.family: "Open Sans"
372374
font.pixelSize: 10
373375
font.bold: true

res/skins/LateNightQML/Deck/TitleTimeRows.qml

Lines changed: 12 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
pragma ComponentBehavior: Bound
2+
13
import QtQuick
24
import QtQuick.Layouts
35
import Mixxx 1.0 as Mixxx
@@ -9,8 +11,8 @@ Item {
911

1012
required property string group
1113

12-
readonly property var deckPlayer: Mixxx.PlayerManager.getPlayer(root.group)
13-
readonly property var currentTrack: deckPlayer?.currentTrack
14+
readonly property Mixxx.Player deckPlayer: Mixxx.PlayerManager.getPlayer(root.group)
15+
readonly property Mixxx.Track currentTrack: root.deckPlayer?.currentTrack
1416
readonly property bool isLoaded: deckPlayer?.isLoaded ?? false
1517
readonly property bool useSecondaryDeckText: root.group === "[Channel3]" || root.group === "[Channel4]"
1618
readonly property color loadedDeckTextColor: useSecondaryDeckText ? LateNightTheme.secondaryDeckTextColor : LateNightTheme.primaryDeckTextColor
@@ -25,16 +27,7 @@ Item {
2527
if (!Number.isFinite(value) || value <= 0) {
2628
return "";
2729
}
28-
const totalSeconds = Math.floor(value);
29-
const hours = Math.floor(totalSeconds / 3600);
30-
const minutes = Math.floor((totalSeconds % 3600) / 60);
31-
const seconds = totalSeconds % 60;
32-
if (hours > 0) {
33-
return hours.toString() + ":" +
34-
minutes.toString().padStart(2, "0") + ":" +
35-
seconds.toString().padStart(2, "0");
36-
}
37-
return minutes.toString() + ":" + seconds.toString().padStart(2, "0");
30+
return Mixxx.DurationFormatter.format(value, Mixxx.DurationFormatter.TraditionalCoarse);
3831
}
3932

4033
function formatTrackTime(value, mode) {
@@ -43,45 +36,7 @@ Item {
4336
}
4437

4538
const sign = value < 0 ? "-" : "";
46-
const absoluteValue = Math.abs(value);
47-
48-
switch (mode) {
49-
case SharedDeck.TrackTime.Mode.Seconds:
50-
case SharedDeck.TrackTime.Mode.SecondsLong:
51-
{
52-
const seconds = Math.floor(absoluteValue).toString();
53-
const centiseconds = Math.floor((absoluteValue % 1) * 100).toString().padStart(2, "0");
54-
return sign + seconds.padStart(mode === SharedDeck.TrackTime.Mode.SecondsLong ? 3 : 0, "0") +
55-
"." + centiseconds;
56-
}
57-
case SharedDeck.TrackTime.Mode.KiloSeconds:
58-
{
59-
const kilos = Math.floor(absoluteValue / 1000);
60-
const seconds = Math.floor(absoluteValue % 1000).toString().padStart(3, "0");
61-
const centiseconds = Math.floor((absoluteValue % 1) * 100).toString().padStart(2, "0");
62-
return sign + kilos.toString() + "." + seconds + " " + centiseconds;
63-
}
64-
case SharedDeck.TrackTime.Mode.HectoSeconds:
65-
return "???";
66-
default:
67-
break;
68-
}
69-
70-
const totalSeconds = Math.floor(absoluteValue);
71-
const centiseconds = Math.floor((absoluteValue - totalSeconds) * 100);
72-
const hours = Math.floor(totalSeconds / 3600);
73-
const minutes = Math.floor((totalSeconds % 3600) / 60);
74-
const seconds = totalSeconds % 60;
75-
let text = durationProxy.value > 3600
76-
? Math.floor(totalSeconds / 3600).toString().padStart(2, "0") + ":" +
77-
minutes.toString().padStart(2, "0") + ":" +
78-
seconds.toString().padStart(2, "0")
79-
: minutes.toString() + ":" + seconds.toString().padStart(2, "0");
80-
81-
if (mode !== SharedDeck.TrackTime.Mode.TraditionalCoarse) {
82-
text += "." + centiseconds.toString().padStart(2, "0");
83-
}
84-
return sign + text;
39+
return sign + Mixxx.DurationFormatter.format(Math.abs(value), mode);
8540
}
8641

8742
function formatPositionTime() {
@@ -141,8 +96,8 @@ Item {
14196
Layout.fillWidth: true
14297
Layout.fillHeight: true
14398
group: root.group
144-
track: currentTrack
145-
text: root.isLoaded ? (currentTrack?.title || "Unknown Title") : ""
99+
track: root.currentTrack
100+
text: root.isLoaded ? (root.currentTrack?.title || "Unknown Title") : ""
146101
displayProperty: "titleInfo"
147102
editProperty: "title"
148103
editable: true
@@ -162,7 +117,7 @@ Item {
162117
pixelSize: 16
163118
showTrackPropertiesOnDoubleClick: false
164119
textColor: root.isLoaded ? LateNightTheme.deckTimeTextColor : LateNightTheme.textColorMuted
165-
track: currentTrack
120+
track: root.currentTrack
166121
text: root.formatPositionTime()
167122
visible: root.isLoaded
168123

@@ -198,8 +153,8 @@ Item {
198153
Layout.fillWidth: true
199154
Layout.fillHeight: true
200155
group: root.group
201-
track: currentTrack
202-
text: root.isLoaded ? (currentTrack?.artist || "Unknown Artist") : ""
156+
track: root.currentTrack
157+
text: root.isLoaded ? (root.currentTrack?.artist || "Unknown Artist") : ""
203158
displayProperty: "artist"
204159
editProperty: "artist"
205160
editable: true
@@ -211,7 +166,7 @@ Item {
211166
id: durationText
212167
Layout.fillHeight: true
213168
group: root.group
214-
track: currentTrack
169+
track: root.currentTrack
215170
text: root.isLoaded ? root.formatDuration(durationProxy.value) : ""
216171
displayProperty: "durationTextSeconds"
217172
editable: false

res/skins/LateNightQML/Deck/VinylControlsPlaceholder.qml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
pragma ComponentBehavior: Bound
2+
13
import QtQuick
24
import QtQuick.Layouts
35
import Mixxx 1.0 as Mixxx

res/skins/LateNightQML/LateNightTheme/LateNightTheme.qml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ QtObject {
3838
readonly property color primaryDeckTextColor: isClassic ? "#f0bb2b" : "#c2b3a5"
3939
readonly property color overviewSettingsBackgroundColor: isClassic ? "#151515" : "#19191a"
4040
readonly property color primaryOverviewBackgroundColor: isClassic ? "#0f0f0f" : "#19191a"
41+
readonly property color waveformPrimaryBackgroundColor: "#0f0f0e"
42+
readonly property color waveformSecondaryBackgroundColor: "#001b23"
4143
readonly property color primaryWaveformSignalColor: isClassic ? "#e7c413" : "#d9b28c"
4244
readonly property color secondaryDeckTextColor: isClassic ? "#0bd9d1" : "#85bdbb"
4345
readonly property color secondaryOverviewBackgroundColor: "#001b23"
@@ -84,6 +86,10 @@ QtObject {
8486
readonly property color bpmTapEditorSelectBorderColor: isPaleMoon ? "#7d350d" : "#5E4507"
8587
readonly property color bpmTapEditorEditBorderColor: isPaleMoon ? "#257b82" : "#d08e00"
8688
readonly property color bpmTapEditorButtonColor: "#171719"
89+
readonly property color beatgridDisabledCoverColor: "#b4151517"
90+
readonly property color trackPropertyHighlightColor: "#151515"
91+
readonly property color trackPropertySelectedTextColor: "#111111"
92+
readonly property color trackPropertySelectionColor: white
8793
readonly property color keyControlsPressedColor: isPaleMoon ? "#7d350d" : "#db0000"
8894
readonly property string keyControlsPressedIconSuffix: isPaleMoon ? "active" : ""
8995
readonly property string playCueActiveIconSuffix: isPaleMoon ? "active" : ""
@@ -92,6 +98,24 @@ QtObject {
9298
readonly property color vinylStatusSignalAndSpeedColor: "#f856e7"
9399
readonly property color vinylCueingActiveColor: "#888888"
94100
readonly property color passthroughActiveColor: vinylStatusSpeedColor
101+
readonly property color waveformCueColor: isPaleMoon ? "#ff7a01" : "#ff001c"
102+
readonly property color waveformLoopColor: isPaleMoon ? "#00b400" : "#00ff00"
103+
readonly property color waveformIntroOutroColor: isPaleMoon ? "#2c5c9a" : "#0000ff"
104+
readonly property color waveformPlayPositionColor: isPaleMoon ? "#00c6ff" : "#00c8ff"
105+
readonly property color waveformBeatAxesColor: isPaleMoon ? "#999999" : "#ffffff"
106+
readonly property color waveformEndOfTrackWarningColor: "#ff8872"
107+
readonly property color waveformDisabledMarkColor: "#ffffff"
108+
readonly property color waveformMarkerTextColor: "#ffffff"
109+
readonly property color waveformDefaultMarkColor: "#ff0000"
110+
readonly property color waveformFilteredHighColor: "#d5c2a2"
111+
readonly property color waveformFilteredMidColor: "#97632d"
112+
readonly property color waveformFilteredLowColor: "#2154d7"
113+
readonly property color overviewRgbLowColor: "#0000ff"
114+
readonly property color overviewRgbMidColor: "#00ff00"
115+
readonly property color overviewRgbHighColor: "#ff0000"
116+
readonly property color overviewMarkerTextColor: "#ffffff"
117+
readonly property color overviewHotcueBrightTextColor: "#000000"
118+
readonly property int overviewHotcueBrightnessThreshold: 127
95119
readonly property color white: "#D9D9D9"
96120

97121
readonly property url assetDeckArrowLeftUpButton: lateNightAsset("buttons", "btn__arrow_left_up.svg")
@@ -206,6 +230,16 @@ QtObject {
206230
}
207231
}
208232

233+
function overviewHotcueTextColor(hotcueColor) {
234+
const red = hotcueColor.r * 255;
235+
const green = hotcueColor.g * 255;
236+
const blue = hotcueColor.b * 255;
237+
const brightness = Math.sqrt(red * red * 0.241 + green * green * 0.691 + blue * blue * 0.068);
238+
return brightness <= overviewHotcueBrightnessThreshold
239+
? overviewMarkerTextColor
240+
: overviewHotcueBrightTextColor;
241+
}
242+
209243
function sharedImage(fileName) {
210244
return Qt.resolvedUrl("../../../qml/images/" + fileName);
211245
}

0 commit comments

Comments
 (0)