Skip to content

Commit 43223b6

Browse files
committed
Refactor signals in scopicflow controllers
1 parent 4705a7b commit 43223b6

File tree

6 files changed

+32
-45
lines changed

6 files changed

+32
-45
lines changed

src/plugins/visualeditor/core/LabelViewModelContextData.cpp

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -260,25 +260,17 @@ namespace VisualEditor {
260260
controller->setInteraction(sflow::LabelSequenceInteractionController::SelectByRubberBand);
261261
controller->setItemInteraction(sflow::LabelSequenceInteractionController::Move | sflow::LabelSequenceInteractionController::Select);
262262

263-
connect(controller, &sflow::LabelSequenceInteractionController::interactionOperationStarted, this, [=](QQuickItem *, sflow::LabelSequenceInteractionController::InteractionFlag type) {
264-
if (type == sflow::LabelSequenceInteractionController::SelectByRubberBand) {
265-
Q_EMIT rubberBandDragWillStart();
266-
}
263+
connect(controller, &sflow::LabelSequenceInteractionController::rubberBandDraggingStarted, this, [=](QQuickItem *) {
264+
Q_EMIT rubberBandDragWillStart();
267265
});
268-
connect(controller, &sflow::LabelSequenceInteractionController::interactionOperationFinished, this, [=](QQuickItem *, sflow::LabelSequenceInteractionController::InteractionFlag type) {
269-
if (type == sflow::LabelSequenceInteractionController::SelectByRubberBand) {
270-
Q_EMIT rubberBandDragWillFinish();
271-
}
266+
connect(controller, &sflow::LabelSequenceInteractionController::rubberBandDraggingFinished, this, [=](QQuickItem *) {
267+
Q_EMIT rubberBandDragWillFinish();
272268
});
273-
connect(controller, &sflow::LabelSequenceInteractionController::itemInteractionOperationStarted, this, [=](QQuickItem *, sflow::LabelViewModel *, sflow::LabelSequenceInteractionController::ItemInteractionFlag type) {
274-
if (type == sflow::LabelSequenceInteractionController::Move) {
275-
Q_EMIT moveTransactionWillStart();
276-
}
269+
connect(controller, &sflow::LabelSequenceInteractionController::movingStarted, this, [=](QQuickItem *, sflow::LabelViewModel *) {
270+
Q_EMIT moveTransactionWillStart();
277271
});
278-
connect(controller, &sflow::LabelSequenceInteractionController::itemInteractionOperationFinished, this, [=](QQuickItem *, sflow::LabelViewModel *, sflow::LabelSequenceInteractionController::ItemInteractionFlag type) {
279-
if (type == sflow::LabelSequenceInteractionController::Move) {
280-
Q_EMIT moveTransactionWillFinish();
281-
}
272+
connect(controller, &sflow::LabelSequenceInteractionController::movingFinished, this, [=](QQuickItem *, sflow::LabelViewModel *) {
273+
Q_EMIT moveTransactionWillFinish();
282274
});
283275
connect(controller, &sflow::LabelSequenceInteractionController::inPlaceEditOperationTriggered, this, [=](QQuickItem *labelSequenceItem, sflow::LabelViewModel *viewItem, sflow::LabelSequenceInteractionController::InPlaceEditOperation type) {
284276
switch (type) {

src/plugins/visualeditor/core/TempoViewModelContextData.cpp

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -182,25 +182,17 @@ namespace VisualEditor {
182182
controller->setInteraction(sflow::LabelSequenceInteractionController::SelectByRubberBand);
183183
controller->setItemInteraction(sflow::LabelSequenceInteractionController::Move | sflow::LabelSequenceInteractionController::Select);
184184

185-
connect(controller, &sflow::LabelSequenceInteractionController::interactionOperationStarted, this, [=](QQuickItem *, sflow::LabelSequenceInteractionController::InteractionFlag type) {
186-
if (type == sflow::LabelSequenceInteractionController::SelectByRubberBand) {
187-
Q_EMIT rubberBandDragWillStart();
188-
}
185+
connect(controller, &sflow::LabelSequenceInteractionController::rubberBandDraggingStarted, this, [=](QQuickItem *) {
186+
Q_EMIT rubberBandDragWillStart();
189187
});
190-
connect(controller, &sflow::LabelSequenceInteractionController::interactionOperationFinished, this, [=](QQuickItem *, sflow::LabelSequenceInteractionController::InteractionFlag type) {
191-
if (type == sflow::LabelSequenceInteractionController::SelectByRubberBand) {
192-
Q_EMIT rubberBandDragWillFinish();
193-
}
188+
connect(controller, &sflow::LabelSequenceInteractionController::rubberBandDraggingFinished, this, [=](QQuickItem *) {
189+
Q_EMIT rubberBandDragWillFinish();
194190
});
195-
connect(controller, &sflow::LabelSequenceInteractionController::itemInteractionOperationStarted, this, [=](QQuickItem *, sflow::LabelViewModel *, sflow::LabelSequenceInteractionController::ItemInteractionFlag type) {
196-
if (type == sflow::LabelSequenceInteractionController::Move) {
197-
Q_EMIT moveTransactionWillStart();
198-
}
191+
connect(controller, &sflow::LabelSequenceInteractionController::movingStarted, this, [=](QQuickItem *, sflow::LabelViewModel *) {
192+
Q_EMIT moveTransactionWillStart();
199193
});
200-
connect(controller, &sflow::LabelSequenceInteractionController::itemInteractionOperationFinished, this, [=](QQuickItem *, sflow::LabelViewModel *, sflow::LabelSequenceInteractionController::ItemInteractionFlag type) {
201-
if (type == sflow::LabelSequenceInteractionController::Move) {
202-
Q_EMIT moveTransactionWillFinish();
203-
}
194+
connect(controller, &sflow::LabelSequenceInteractionController::movingFinished, this, [=](QQuickItem *, sflow::LabelViewModel *) {
195+
Q_EMIT moveTransactionWillFinish();
204196
});
205197

206198
connect(controller, &sflow::LabelSequenceInteractionController::doubleClicked, this, [=](QQuickItem *labelSequenceItem, int position) {

src/plugins/visualeditor/qml/ArrangementView.qml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ Item {
198198

199199
property bool dragging: false
200200

201+
// TODO move this to C++ code
201202
Connections {
202203
target: timeline.playbackViewModel
203204
enabled: timeline.dragging
@@ -208,13 +209,13 @@ Item {
208209

209210
Connections {
210211
target: timeline.timelineInteractionController
211-
function onInteractionOperationStarted(timeline_, interactionFlag) {
212-
if (timeline_ === timeline && interactionFlag === TimelineInteractionController.MovePositionIndicator) {
212+
function onPositionIndicatorMovingStarted(timeline_) {
213+
if (timeline_ === timeline) {
213214
timeline.dragging = true
214215
}
215216
}
216-
function onInteractionOperationFinished(timeline_, interactionFlag) {
217-
if (timeline_ === timeline && interactionFlag === LabelSequenceInteractionController.MovePositionIndicator) {
217+
function onPositionIndicatorMovingFinished(timeline_) {
218+
if (timeline_ === timeline) {
218219
timeline.dragging = false
219220
}
220221
}

src/plugins/visualeditor/qml/additionaltracks/LabelTrack.qml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ QtObject {
3434

3535
property LabelViewModel itemBeingDragged: null
3636

37+
// TODO move this to C++ code
3738
Connections {
3839
target: control.itemBeingDragged
3940
function onPositionChanged() {
@@ -43,13 +44,13 @@ QtObject {
4344

4445
Connections {
4546
target: control.labelSequenceInteractionController
46-
function onItemInteractionOperationStarted(labelSequence, item, interactionFlag) {
47-
if (labelSequence === control && interactionFlag === LabelSequenceInteractionController.Move) {
47+
function onMovingStarted(labelSequence, item) {
48+
if (labelSequence === control) {
4849
control.itemBeingDragged = item
4950
}
5051
}
51-
function onItemInteractionOperationFinished(labelSequence, item, interactionFlag) {
52-
if (labelSequence === control && interactionFlag === LabelSequenceInteractionController.Move) {
52+
function onMovingFinished(labelSequence, item) {
53+
if (labelSequence === control) {
5354
control.itemBeingDragged = null
5455
}
5556
}

src/plugins/visualeditor/qml/additionaltracks/TempoTrack.qml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ QtObject {
3434

3535
property LabelViewModel itemBeingDragged: null
3636

37+
// TODO move this to C++ code
3738
Connections {
3839
target: control.itemBeingDragged
3940
function onPositionChanged() {
@@ -43,13 +44,13 @@ QtObject {
4344

4445
Connections {
4546
target: control.labelSequenceInteractionController
46-
function onItemInteractionOperationStarted(labelSequence, item, interactionFlag) {
47-
if (labelSequence === control && interactionFlag === LabelSequenceInteractionController.Move) {
47+
function onMovingStarted(labelSequence, item, interactionFlag) {
48+
if (labelSequence === control) {
4849
control.itemBeingDragged = item
4950
}
5051
}
51-
function onItemInteractionOperationFinished(labelSequence, item, interactionFlag) {
52-
if (labelSequence === control && interactionFlag === LabelSequenceInteractionController.Move) {
52+
function onMovingFinished(labelSequence, item, interactionFlag) {
53+
if (labelSequence === control) {
5354
control.itemBeingDragged = null
5455
}
5556
}

0 commit comments

Comments
 (0)