Skip to content

Commit 54226ef

Browse files
committed
Add track property editor
1 parent 5cb6863 commit 54226ef

7 files changed

Lines changed: 133 additions & 29 deletions

File tree

src/plugins/coreplugin/internal/CorePlugin.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@ namespace Core::Internal {
390390
f("TempoPropertyEditor", &PropertyEditorManager::addTempoComponent);
391391
f("TrackPropertyEditor", &PropertyEditorManager::addTrackComponent);
392392
f("ControlPropertyEditor", &PropertyEditorManager::addTrackComponent);
393+
f("TrackDisplayPropertyEditor", &PropertyEditorManager::addTrackComponent);
393394
f("MetadataPropertyEditor", &PropertyEditorManager::addNoneComponent);
394395
f("GlobalCentShiftPropertyEditor", &PropertyEditorManager::addNoneComponent);
395396
f("MasterControlPropertyEditor", &PropertyEditorManager::addNoneComponent);

src/plugins/coreplugin/qml/dialogs/PickTrackColorDialog.qml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Dialog {
3333
autoExclusive: true
3434
required property color modelData
3535
required property int index
36+
text: qsTr("Track Color %L1").arg(index + 1)
3637
background: Rectangle {
3738
color: modelData
3839
border.color: control.checked ? Theme.foregroundPrimaryColor : Theme.borderColor

src/plugins/coreplugin/qml/panels/PropertiesPanel.qml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ QtObject {
7171
readonly property QtObject tempoPropertyMapper: TempoPropertyMapper {
7272
selectionModel: d.addOn?.windowHandle.projectDocumentContext.document.selectionModel ?? null
7373
}
74-
readonly property QtObject trackPropertyMapper: null
74+
readonly property QtObject trackPropertyMapper: TrackPropertyMapper {
75+
selectionModel: d.addOn?.windowHandle.projectDocumentContext.document.selectionModel ?? null
76+
}
7577
}
7678
StackLayout {
7779
id: tabBarStackLayout

src/plugins/coreplugin/qml/propertyeditors/ControlPropertyEditor.qml

Lines changed: 45 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,37 +16,60 @@ PropertyEditorGroupBox {
1616
ColumnLayout {
1717
id: columnLayout
1818
width: parent.width
19-
CheckBox {
19+
BooleanPropertyEditorField {
20+
windowHandle: groupBox.windowHandle
21+
propertyMapper: groupBox.propertyMapper
22+
key: "mute"
2023
text: qsTr("Mute")
21-
tristate: true
24+
transactionName: qsTr("Toggling mute")
2225
}
23-
CheckBox {
26+
BooleanPropertyEditorField {
27+
windowHandle: groupBox.windowHandle
28+
propertyMapper: groupBox.propertyMapper
29+
visible: groupBox.propertyMapper && ("solo" in groupBox.propertyMapper)
30+
key: "solo"
2431
text: qsTr("Solo")
25-
tristate: true
32+
transactionName: qsTr("Toggling solo")
2633
}
27-
CheckBox {
34+
BooleanPropertyEditorField {
35+
windowHandle: groupBox.windowHandle
36+
propertyMapper: groupBox.propertyMapper
37+
visible: groupBox.propertyMapper && ("record" in groupBox.propertyMapper)
38+
key: "record"
2839
text: qsTr("Record")
29-
tristate: true
40+
transactionName: qsTr("Toggling record")
3041
}
31-
FormGroup {
32-
Layout.fillWidth: true
33-
label: qsTr("Gain")
34-
rowItem: SpinBox {
35-
42+
IntegerPropertyEditorField {
43+
windowHandle: groupBox.windowHandle
44+
propertyMapper: groupBox.propertyMapper
45+
key: "gain"
46+
label: qsTr("Gain (dB)")
47+
useSlider: true
48+
from: SVS.decibelsToGain(-96)
49+
to: SVS.decibelsToGain(6)
50+
spinBoxValueFromProperty: v => Math.round(SVS.gainToDecibels(v) * 10)
51+
propertyFromSpinBoxValue: v => SVS.decibelsToGain(v / 10)
52+
sliderValueFromProperty: v => SVS.decibelToLinearValue(SVS.gainToDecibels(v)) - SVS.decibelToLinearValue(0)
53+
propertyFromSliderValue: v => SVS.decibelsToGain(SVS.linearValueToDecibel(v + SVS.decibelToLinearValue(0)))
54+
transactionName: qsTr("Editing gain")
55+
spinBox.textFromValue: function(value, locale) {
56+
return Number(value / 10).toLocaleString(locale, 'f', 1)
3657
}
37-
columnItem: Slider {
38-
58+
spinBox.valueFromText: function(text, locale) {
59+
return Math.round(Number.fromLocaleString(locale, text) * 10)
3960
}
4061
}
41-
FormGroup {
42-
Layout.fillWidth: true
43-
label: qsTr("Pan")
44-
rowItem: SpinBox {
45-
46-
}
47-
columnItem: Slider {
48-
49-
}
62+
IntegerPropertyEditorField {
63+
windowHandle: groupBox.windowHandle
64+
propertyMapper: groupBox.propertyMapper
65+
key: "pan"
66+
label: qsTr("Pan (%)")
67+
useSlider: true
68+
from: -1
69+
to: 1
70+
spinBoxValueFromProperty: v => v * 100
71+
propertyFromSpinBoxValue: v => v * 0.01
72+
transactionName: qsTr("Editing pan")
5073
}
5174
}
5275
}

src/plugins/coreplugin/qml/propertyeditors/GlobalCentShiftPropertyEditor.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ PropertyEditorGroupBox {
2020
propertyMapper: groupBox.windowHandle?.projectDocumentContext.document.model.global ?? null
2121
useSlider: true
2222
key: "centShift"
23-
label: qsTr("Cent Shift")
23+
label: qsTr("Cent shift")
2424
from: -50
2525
to: 50
2626
transactionName: qsTr("Editing cent shift")
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import QtQml
2+
import QtQuick
3+
import QtQuick.Controls
4+
import QtQuick.Layouts
5+
6+
import SVSCraft
7+
import SVSCraft.UIComponents
8+
9+
import DiffScope.UIShell
10+
11+
PropertyEditorGroupBox {
12+
id: groupBox
13+
required property ProjectWindowInterface windowHandle
14+
required property QtObject propertyMapper
15+
title: qsTr("Display")
16+
ColumnLayout {
17+
id: columnLayout
18+
width: parent.width
19+
IntegerPropertyEditorField {
20+
windowHandle: groupBox.windowHandle
21+
propertyMapper: groupBox.propertyMapper
22+
key: "height"
23+
label: qsTr("View height")
24+
from: 40
25+
transactionName: qsTr("Resizing track")
26+
}
27+
}
28+
}

src/plugins/coreplugin/qml/propertyeditors/TrackPropertyEditor.qml

Lines changed: 54 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import QtQml
22
import QtQuick
33
import QtQuick.Controls
44
import QtQuick.Layouts
5+
import QtQuick.Templates as T
56

67
import SVSCraft
78
import SVSCraft.UIComponents
@@ -15,16 +16,64 @@ PropertyEditorGroupBox {
1516
title: qsTr("Basic")
1617
ColumnLayout {
1718
width: parent.width
18-
FormGroup {
19-
Layout.fillWidth: true
19+
TextPropertyEditorField {
20+
windowHandle: groupBox.windowHandle
21+
propertyMapper: groupBox.propertyMapper
22+
key: "name"
2023
label: qsTr("Name")
21-
columnItem: TextField {
22-
23-
}
24+
transactionName: qsTr("Renaming track")
2425
}
2526
FormGroup {
27+
id: colorControl
2628
Layout.fillWidth: true
2729
label: qsTr("Color")
30+
readonly property var colorId: groupBox.propertyMapper?.colorId
31+
property int transactionId: 0
32+
function beginTransaction() {
33+
let a = groupBox.windowHandle.projectDocumentContext.document.transactionController.beginTransaction()
34+
if (a) {
35+
transactionId = a
36+
return true
37+
}
38+
return false
39+
}
40+
function commitTransaction() {
41+
groupBox.windowHandle.projectDocumentContext.document.transactionController.commitTransaction(transactionId, "Picking track color")
42+
transactionId = 0
43+
}
44+
columnItem: Flow {
45+
spacing: 16
46+
topPadding: 8
47+
Repeater {
48+
model: CoreInterface.trackColorSchema.colors
49+
delegate: T.Button {
50+
id: control
51+
implicitWidth: 16
52+
implicitHeight: 16
53+
checkable: true
54+
checked: index === colorControl.colorId
55+
autoExclusive: true
56+
required property color modelData
57+
required property int index
58+
background: Rectangle {
59+
color: modelData
60+
border.color: control.checked ? Theme.foregroundPrimaryColor : Theme.borderColor
61+
border.width: control.checked ? 2 : 1
62+
}
63+
text: qsTr("Track Color %L1").arg(index + 1)
64+
onClicked: {
65+
if (colorControl.colorId === index) {
66+
return
67+
}
68+
colorControl.beginTransaction()
69+
if (!colorControl.transactionId)
70+
return
71+
groupBox.propertyMapper.colorId = index
72+
colorControl.commitTransaction()
73+
}
74+
}
75+
}
76+
}
2877
}
2978
}
3079
}

0 commit comments

Comments
 (0)