Commit 96a6f883 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Ensure a group/ungroup operation cannot be performed while dragging / resizing a group.

Related to #904
parent 9e335520
Pipeline #48350 passed with stage
in 10 minutes and 55 seconds
......@@ -78,7 +78,6 @@ Rectangle {
property bool forceReloadThumb
property bool isComposition: false
property bool hideClipViews: false
property var groupTrimData
property int scrollStart: scrollView.contentX - (clipRoot.modelStart * timeline.scaleFactor)
property int mouseXPos: mouseArea.mouseX
width : clipDuration * timeScale
......
......@@ -284,7 +284,7 @@ Item{
height: trackRoot.height
onInitGroupTrim: {
// We are resizing a group, remember coordinates of all elements
clip.groupTrimData = controller.getGroupData(clip.clipId)
root.groupTrimData = controller.getGroupData(clip.clipId)
}
onTrimmingIn: {
if (controlTrim) {
......@@ -320,7 +320,7 @@ Item{
onTrimmedIn: {
//bubbleHelp.hide()
timeline.showToolTip();
if (shiftTrim || clip.groupTrimData == undefined || controlTrim) {
if (shiftTrim || root.groupTrimData == undefined || controlTrim) {
// We only resize one element
controller.requestItemResize(clip.clipId, clip.originalDuration, false, false, 0, shiftTrim)
if (controlTrim) {
......@@ -333,9 +333,9 @@ Item{
}
} else {
var updatedGroupData = controller.getGroupData(clip.clipId)
controller.processGroupResize(clip.groupTrimData, updatedGroupData, false)
controller.processGroupResize(root.groupTrimData, updatedGroupData, false)
}
clip.groupTrimData = undefined
root.groupTrimData = undefined
}
onTrimmingOut: {
if (controlTrim) {
......@@ -369,7 +369,7 @@ Item{
onTrimmedOut: {
timeline.showToolTip();
//bubbleHelp.hide()
if (shiftTrim || clip.groupTrimData == undefined || controlTrim) {
if (shiftTrim || root.groupTrimData == undefined || controlTrim) {
controller.requestItemResize(clip.clipId, clip.originalDuration, true, false, 0, shiftTrim)
if (controlTrim) {
speedController.visible = false
......@@ -381,9 +381,9 @@ Item{
}
} else {
var updatedGroupData = controller.getGroupData(clip.clipId)
controller.processGroupResize(clip.groupTrimData, updatedGroupData, true)
controller.processGroupResize(root.groupTrimData, updatedGroupData, true)
}
clip.groupTrimData = undefined
root.groupTrimData = undefined
}
}
}
......
......@@ -11,7 +11,8 @@ Rectangle {
color: activePalette.window
property bool validMenu: false
property color textColor: activePalette.text
property bool dragInProgress: dragProxyArea.pressed || dragProxyArea.drag.active
property var groupTrimData
property bool dragInProgress: dragProxyArea.pressed || dragProxyArea.drag.active || groupTrimData != undefined
signal clipClicked()
signal mousePosChanged(int position)
......
......@@ -808,6 +808,11 @@ void TimelineController::gotoPreviousGuide()
void TimelineController::groupSelection()
{
if (dragOperationRunning()) {
// Don't allow timeline operation while drag in progress
pCore->displayMessage(i18n("Cannot perform operation while dragging in timeline"), ErrorMessage);
return;
}
const auto selection = m_model->getCurrentSelection();
if (selection.size() < 2) {
pCore->displayMessage(i18n("Select at least 2 items to group"), ErrorMessage, 500);
......@@ -820,6 +825,11 @@ void TimelineController::groupSelection()
void TimelineController::unGroupSelection(int cid)
{
if (dragOperationRunning()) {
// Don't allow timeline operation while drag in progress
pCore->displayMessage(i18n("Cannot perform operation while dragging in timeline"), ErrorMessage);
return;
}
auto ids = m_model->getCurrentSelection();
// ask to unselect if needed
m_model->requestClearSelection();
......@@ -842,7 +852,8 @@ void TimelineController::setInPoint()
{
if (dragOperationRunning()) {
// Don't allow timeline operation while drag in progress
qDebug() << "Cannot operate while dragging";
pCore->displayMessage(i18n("Cannot perform operation while dragging in timeline"), ErrorMessage);
qDebug()<< "Cannot operate while dragging";
return;
}
......@@ -885,6 +896,7 @@ void TimelineController::setOutPoint()
{
if (dragOperationRunning()) {
// Don't allow timeline operation while drag in progress
pCore->displayMessage(i18n("Cannot perform operation while dragging in timeline"), ErrorMessage);
qDebug() << "Cannot operate while dragging";
return;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment