Skip to content

Commit 5584305

Browse files
committed
Make velocity interpolation dialog remember the previous values
1 parent c600092 commit 5584305

4 files changed

Lines changed: 61 additions & 16 deletions

File tree

CHANGELOG

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ New features:
1010

1111
* Extend chord automation with an arpeggiator
1212

13+
* Make velocity interpolation dialog remember the previous values
14+
1315
Bug fixes:
1416

1517
Other:

src/view/qml/Dialogs/InterpolationDialog.qml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,15 @@ Dialog {
2020
function setStartValue(value) {
2121
startValueSpinBox.value = value;
2222
}
23-
function endValue(value) {
23+
function endValue() {
2424
return endValueSpinBox.value;
2525
}
2626
function setEndValue(value) {
2727
endValueSpinBox.value = value;
2828
}
29+
function setUsePercentages(value) {
30+
percentageCheckBox.checked = value;
31+
}
2932
function startLine() {
3033
return startLineSpinBox.value;
3134
}

src/view/qml/Main.qml

Lines changed: 49 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -261,19 +261,40 @@ ApplicationWindow {
261261
id: columnVelocityInterpolationDialog
262262
anchors.centerIn: parent
263263
width: parent.width * Constants.defaultDialogScale
264-
onAccepted: editorService.requestLinearVelocityInterpolationOnColumn(startLine(), endLine(), startValue(), endValue(), usePercentages())
264+
onAccepted: {
265+
UiService.interpolationStartLine = startLine();
266+
UiService.interpolationEndLine = endLine();
267+
UiService.interpolationStartValue = startValue();
268+
UiService.interpolationEndValue = endValue();
269+
UiService.interpolationUsePercentages = usePercentages();
270+
editorService.requestLinearVelocityInterpolationOnColumn(startLine(), endLine(), startValue(), endValue(), usePercentages());
271+
}
265272
}
266273
InterpolationDialog {
267274
id: trackVelocityInterpolationDialog
268275
anchors.centerIn: parent
269276
width: parent.width * Constants.defaultDialogScale
270-
onAccepted: editorService.requestLinearVelocityInterpolationOnTrack(startLine(), endLine(), startValue(), endValue(), usePercentages())
277+
onAccepted: {
278+
UiService.interpolationStartLine = startLine();
279+
UiService.interpolationEndLine = endLine();
280+
UiService.interpolationStartValue = startValue();
281+
UiService.interpolationEndValue = endValue();
282+
UiService.interpolationUsePercentages = usePercentages();
283+
editorService.requestLinearVelocityInterpolationOnTrack(startLine(), endLine(), startValue(), endValue(), usePercentages());
284+
}
271285
}
272286
InterpolationDialog {
273287
id: selectionVelocityInterpolationDialog
274288
anchors.centerIn: parent
275289
width: parent.width * Constants.defaultDialogScale
276-
onAccepted: editorService.requestLinearVelocityInterpolationOnSelection(startLine(), endLine(), startValue(), endValue(), usePercentages())
290+
onAccepted: {
291+
UiService.interpolationStartLine = startLine();
292+
UiService.interpolationEndLine = endLine();
293+
UiService.interpolationStartValue = startValue();
294+
UiService.interpolationEndValue = endValue();
295+
UiService.interpolationUsePercentages = usePercentages();
296+
editorService.requestLinearVelocityInterpolationOnSelection(startLine(), endLine(), startValue(), endValue(), usePercentages());
297+
}
277298
}
278299
AddMidiCcAutomationDialog {
279300
id: addMidiCcAutomationDialog
@@ -419,26 +440,39 @@ ApplicationWindow {
419440
});
420441
UiService.columnVelocityInterpolationDialogRequested.connect(() => {
421442
columnVelocityInterpolationDialog.setTitle(qsTr("Interpolate velocity"));
422-
columnVelocityInterpolationDialog.setStartLine(0);
423-
columnVelocityInterpolationDialog.setEndLine(editorService.currentLineCount - 1);
424-
columnVelocityInterpolationDialog.setStartValue(0);
425-
columnVelocityInterpolationDialog.setEndValue(100);
443+
if (UiService.interpolationEndLine === 0) {
444+
UiService.interpolationEndLine = editorService.currentLineCount - 1;
445+
}
446+
columnVelocityInterpolationDialog.setStartLine(UiService.interpolationStartLine);
447+
columnVelocityInterpolationDialog.setEndLine(UiService.interpolationEndLine);
448+
columnVelocityInterpolationDialog.setStartValue(UiService.interpolationStartValue);
449+
columnVelocityInterpolationDialog.setEndValue(UiService.interpolationEndValue);
450+
columnVelocityInterpolationDialog.setUsePercentages(UiService.interpolationUsePercentages);
426451
columnVelocityInterpolationDialog.open();
427452
});
428453
UiService.selectionVelocityInterpolationDialogRequested.connect(() => {
429454
selectionVelocityInterpolationDialog.setTitle(qsTr("Interpolate velocity"));
430-
selectionVelocityInterpolationDialog.setStartLine(selectionService.minLine());
431-
selectionVelocityInterpolationDialog.setEndLine(selectionService.maxLine());
432-
selectionVelocityInterpolationDialog.setStartValue(0);
433-
selectionVelocityInterpolationDialog.setEndValue(100);
455+
if (UiService.interpolationEndLine === 0) {
456+
UiService.interpolationStartLine = selectionService.minLine();
457+
UiService.interpolationEndLine = selectionService.maxLine();
458+
}
459+
selectionVelocityInterpolationDialog.setStartLine(UiService.interpolationStartLine);
460+
selectionVelocityInterpolationDialog.setEndLine(UiService.interpolationEndLine);
461+
selectionVelocityInterpolationDialog.setStartValue(UiService.interpolationStartValue);
462+
selectionVelocityInterpolationDialog.setEndValue(UiService.interpolationEndValue);
463+
selectionVelocityInterpolationDialog.setUsePercentages(UiService.interpolationUsePercentages);
434464
selectionVelocityInterpolationDialog.open();
435465
});
436466
UiService.trackVelocityInterpolationDialogRequested.connect(() => {
437467
trackVelocityInterpolationDialog.setTitle(qsTr("Interpolate velocity"));
438-
trackVelocityInterpolationDialog.setStartLine(0);
439-
trackVelocityInterpolationDialog.setEndLine(editorService.currentLineCount - 1);
440-
trackVelocityInterpolationDialog.setStartValue(0);
441-
trackVelocityInterpolationDialog.setEndValue(100);
468+
if (UiService.interpolationEndLine === 0) {
469+
UiService.interpolationEndLine = editorService.currentLineCount - 1;
470+
}
471+
trackVelocityInterpolationDialog.setStartLine(UiService.interpolationStartLine);
472+
trackVelocityInterpolationDialog.setEndLine(UiService.interpolationEndLine);
473+
trackVelocityInterpolationDialog.setStartValue(UiService.interpolationStartValue);
474+
trackVelocityInterpolationDialog.setEndValue(UiService.interpolationEndValue);
475+
trackVelocityInterpolationDialog.setUsePercentages(UiService.interpolationUsePercentages);
442476
trackVelocityInterpolationDialog.open();
443477
});
444478
UiService.lineDelayDialogRequested.connect(() => {

src/view/qml/UiService.qml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,12 @@ QtObject {
264264
uiLogger.info("UiService", "Confirming unused pattern deletion");
265265
deleteUnusedPatternsConfirmed();
266266
}
267+
property int interpolationStartLine: 0
268+
property int interpolationEndLine: 0
269+
property int interpolationStartValue: 0
270+
property int interpolationEndValue: 100
271+
property bool interpolationUsePercentages: false
272+
267273
signal quitRequested
268274
function requestQuit(): void {
269275
quitRequested();

0 commit comments

Comments
 (0)