"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/qml/filters/size_position/SizePositionUI.qml" between
shotcut-20.09.01.tar.gz and shotcut-20.09.13.tar.gz

About: Shotcut is a cross-platform (Qt) advanced video editor.

SizePositionUI.qml  (shotcut-20.09.01):SizePositionUI.qml  (shotcut-20.09.13)
skipping to change at line 220 skipping to change at line 220
filter.set(rotationMiddleValue, filter.getDouble(rotationProperty, f ilter.animateIn + 1)) filter.set(rotationMiddleValue, filter.getDouble(rotationProperty, f ilter.animateIn + 1))
if (filter.animateIn > 0) if (filter.animateIn > 0)
filter.set(rotationStartValue, filter.getDouble(rotationProperty , 0)) filter.set(rotationStartValue, filter.getDouble(rotationProperty , 0))
if (filter.animateOut > 0) if (filter.animateOut > 0)
filter.set(rotationEndValue, filter.getRect(rotationProperty, fi lter.duration - 1)) filter.set(rotationEndValue, filter.getRect(rotationProperty, fi lter.duration - 1))
} }
filter.blockSignals = false filter.blockSignals = false
setControls() setControls()
setKeyframedControls() setKeyframedControls()
if (filter.isNew) if (filter.isNew)
filter.set(rectProperty, filter.getRect(rectProperty)) setFilter(getPosition())
} }
function getPosition() { function getPosition() {
return Math.max(producer.position - (filter.in - producer.in), 0) return Math.max(producer.position - (filter.in - producer.in), 0)
} }
function isFillMode() {
return filter.get(fillProperty) === '1' && filter.get(distortProperty) !
== '1'
}
function setFilter(position) { function setFilter(position) {
if (position !== null) { if (position !== null) {
filter.blockSignals = true filter.blockSignals = true
if (position <= 0 && filter.animateIn > 0) if (position <= 0 && filter.animateIn > 0)
filter.set(startValue, filterRect) filter.set(startValue, filterRect)
else if (position >= filter.duration - 1 && filter.animateOut > 0) else if (position >= filter.duration - 1 && filter.animateOut > 0)
filter.set(endValue, filterRect) filter.set(endValue, filterRect)
else else
filter.set(middleValue, filterRect) filter.set(middleValue, filterRect)
filter.blockSignals = false filter.blockSignals = false
skipping to change at line 286 skipping to change at line 290
filter.set(rotationProperty, filter.getDouble(rotationStartValue ), 0) filter.set(rotationProperty, filter.getDouble(rotationStartValue ), 0)
filter.set(rotationProperty, filter.getDouble(rotationMiddleValu e), filter.animateIn - 1) filter.set(rotationProperty, filter.getDouble(rotationMiddleValu e), filter.animateIn - 1)
} }
if (filter.animateOut > 0) { if (filter.animateOut > 0) {
filter.set(rotationProperty, filter.getDouble(rotationMiddleValu e), filter.duration - filter.animateOut) filter.set(rotationProperty, filter.getDouble(rotationMiddleValu e), filter.duration - filter.animateOut)
filter.set(rotationProperty, filter.getDouble(rotationEndValue), filter.duration - 1) filter.set(rotationProperty, filter.getDouble(rotationEndValue), filter.duration - 1)
} }
} else if (!rotationKeyframesButton.checked) { } else if (!rotationKeyframesButton.checked) {
filter.resetProperty(rotationProperty) filter.resetProperty(rotationProperty)
filter.set(rotationProperty, filter.getDouble(rotationMiddleValue)) filter.set(rotationProperty, filter.getDouble(rotationMiddleValue))
console.log(rotationProperty + '=' + filter.getDouble(rotationMiddle Value))
} else if (position !== null) { } else if (position !== null) {
filter.set(rotationProperty, rotationSlider.value, position) filter.set(rotationProperty, rotationSlider.value, position)
} }
} }
function setControls() { function setControls() {
if (filter.get(distortProperty) === '1') if (filter.get(distortProperty) === '1')
distortRadioButton.checked = true distortRadioButton.checked = true
else if (filter.get(fillProperty) === '1') else if (filter.get(fillProperty) === '1')
fillRadioButton.checked = true fillRadioButton.checked = true
skipping to change at line 335 skipping to change at line 338
|| (position >= (filter.animateIn - 1) && || (position >= (filter.animateIn - 1) &&
position <= (filter.duration - filter.animateOut)) position <= (filter.duration - filter.animateOut))
|| position >= (filter.duration - 1) || position >= (filter.duration - 1)
} }
function setKeyframedControls() { function setKeyframedControls() {
var enabled = isSimpleKeyframesActive() var enabled = isSimpleKeyframesActive()
var position = getPosition() var position = getPosition()
var newValue = filter.getRect(rectProperty, position) var newValue = filter.getRect(rectProperty, position)
if (filterRect !== newValue) { if (filterRect !== newValue) {
if (isFillMode()) {
// enforce the aspect ratio
if (producer.displayAspectRatio > 1.0) {
newValue.height = newValue.width / producer.displayAspectRat
io
} else {
newValue.width = newValue.height * producer.displayAspectRat
io
}
}
filterRect = newValue filterRect = newValue
rectX.value = filterRect.x.toFixed() rectX.value = filterRect.x.toFixed()
rectY.value = filterRect.y.toFixed() rectY.value = filterRect.y.toFixed()
rectW.value = filterRect.width.toFixed() rectW.value = filterRect.width.toFixed()
rectH.value = filterRect.height.toFixed() rectH.value = filterRect.height.toFixed()
blockUpdate = true blockUpdate = true
scaleSlider.value = Math.min(filterRect.width / profile.width * 100, scaleSlider.maximumValue) scaleSlider.value = Math.min(filterRect.width / profile.width * 100, scaleSlider.maximumValue)
} }
if (rotationProperty) { if (rotationProperty) {
blockUpdate = true blockUpdate = true
skipping to change at line 356 skipping to change at line 367
rotationSlider.enabled = enabled rotationSlider.enabled = enabled
} }
blockUpdate = false blockUpdate = false
rectX.enabled = enabled rectX.enabled = enabled
rectY.enabled = enabled rectY.enabled = enabled
rectW.enabled = enabled rectW.enabled = enabled
rectH.enabled = enabled rectH.enabled = enabled
scaleSlider.enabled = enabled && filter.get(fillProperty) === '1' && fil ter.get(distortProperty) !== '1' scaleSlider.enabled = enabled && filter.get(fillProperty) === '1' && fil ter.get(distortProperty) !== '1'
} }
function toggleKeyframes(isEnabled, parameter, value) {
if (isEnabled) {
blockUpdate = true
if (filter.animateIn > 0 || filter.animateOut > 0) {
// Reset all of the simple keyframes.
resetSimpleKeyframes()
filter.animateIn = 0
blockUpdate = false
filter.animateOut = 0
} else {
filter.clearSimpleAnimation(parameter)
blockUpdate = false
}
// Set this keyframe value.
filter.set(parameter, value, getPosition())
} else {
// Remove keyframes and set the parameter.
filter.resetProperty(parameter)
filter.set(parameter, value)
}
}
ExclusiveGroup { id: sizeGroup } ExclusiveGroup { id: sizeGroup }
ExclusiveGroup { id: halignGroup } ExclusiveGroup { id: halignGroup }
ExclusiveGroup { id: valignGroup } ExclusiveGroup { id: valignGroup }
GridLayout { GridLayout {
columns: 6 columns: 6
anchors.fill: parent anchors.fill: parent
anchors.margins: 8 anchors.margins: 8
Label { Label {
skipping to change at line 447 skipping to change at line 480
filterRect.x = filterRect.y = 0 filterRect.x = filterRect.y = 0
setFilter(getPosition()) setFilter(getPosition())
} }
} }
KeyframesButton { KeyframesButton {
id: positionKeyframesButton id: positionKeyframesButton
Layout.rowSpan: 2 Layout.rowSpan: 2
checked: filter.keyframeCount(rectProperty) > 0 && filter.animateIn <= 0 && filter.animateOut <= 0 checked: filter.keyframeCount(rectProperty) > 0 && filter.animateIn <= 0 && filter.animateOut <= 0
onToggled: { onToggled: {
if (checked) { if (checked) {
blockUpdate = true
filter.clearSimpleAnimation(rectProperty) filter.clearSimpleAnimation(rectProperty)
blockUpdate = false
filter.set(rectProperty, filterRect, 1.0, getPosition()) filter.set(rectProperty, filterRect, 1.0, getPosition())
} else { } else {
filter.resetProperty(rectProperty) filter.resetProperty(rectProperty)
filter.set(rectProperty, filterRect) filter.set(rectProperty, filterRect)
} }
checked = filter.keyframeCount(rectProperty) > 0 && filter.anima teIn <= 0 && filter.animateOut <= 0 checked = filter.keyframeCount(rectProperty) > 0 && filter.anima teIn <= 0 && filter.animateOut <= 0
} }
} }
Label { Label {
skipping to change at line 484 skipping to change at line 519
var rightX = filterRect.x + filterRect.width var rightX = filterRect.x + filterRect.width
filterRect.width = value filterRect.width = value
if (centerRadioButton.checked) { if (centerRadioButton.checked) {
filterRect.x = rectX.value = centerX - filterRect.wi dth / 2 filterRect.x = rectX.value = centerX - filterRect.wi dth / 2
} else if (rightRadioButton.checked) { } else if (rightRadioButton.checked) {
filterRect.x = rectX.value = rightX - filterRect.wid th filterRect.x = rectX.value = rightX - filterRect.wid th
} }
if (fillRadioButton.checked) { if (fillRadioButton.checked) {
var middleY = filterRect.y + filterRect.height / 2 var middleY = filterRect.y + filterRect.height / 2
var bottomY = filterRect.y + filterRect.height var bottomY = filterRect.y + filterRect.height
filterRect.height = rectH.value = Math.round(value * profile.height / profile.width) filterRect.height = rectH.value = Math.round(value / producer.displayAspectRatio)
if (middleRadioButton.checked) { if (middleRadioButton.checked) {
filterRect.y = rectY.value = middleY - filterRec t.height / 2 filterRect.y = rectY.value = middleY - filterRec t.height / 2
} }
else if (bottomRadioButton.checked) { else if (bottomRadioButton.checked) {
filterRect.y = rectY.value = bottomY - filterRec t.height filterRect.y = rectY.value = bottomY - filterRec t.height
} }
blockUpdate = true blockUpdate = true
scaleSlider.value = Math.min(rectW.value / profile.w idth * 100, scaleSlider.maximumValue) scaleSlider.value = Math.min(rectW.value / profile.w idth * 100, scaleSlider.maximumValue)
blockUpdate = false blockUpdate = false
} }
skipping to change at line 521 skipping to change at line 556
var bottomY = filterRect.y + filterRect.height var bottomY = filterRect.y + filterRect.height
filterRect.height = value filterRect.height = value
if (middleRadioButton.checked) { if (middleRadioButton.checked) {
filterRect.y = rectY.value = middleY - filterRect.he ight / 2 filterRect.y = rectY.value = middleY - filterRect.he ight / 2
} else if (bottomRadioButton.checked) { } else if (bottomRadioButton.checked) {
filterRect.y = rectY.value = bottomY - filterRect.he ight filterRect.y = rectY.value = bottomY - filterRect.he ight
} }
if (fillRadioButton.checked) { if (fillRadioButton.checked) {
var centerX = filterRect.x + filterRect.width / 2 var centerX = filterRect.x + filterRect.width / 2
var rightX = filterRect.x + filterRect.width var rightX = filterRect.x + filterRect.width
filterRect.width = rectW.value = Math.round(value * profile.width / profile.height) filterRect.width = rectW.value = Math.round(value * producer.displayAspectRatio)
if (centerRadioButton.checked) { if (centerRadioButton.checked) {
filterRect.x = rectX.value = centerX - filterRec t.width / 2 filterRect.x = rectX.value = centerX - filterRec t.width / 2
} }
else if (rightRadioButton.checked) { else if (rightRadioButton.checked) {
filterRect.x = rectX.value = rightX - filterRect .width filterRect.x = rectX.value = rightX - filterRect .width
} }
blockUpdate = true blockUpdate = true
scaleSlider.value = Math.min(rectH.value / profile.h eight * 100, scaleSlider.maximumValue) scaleSlider.value = Math.min(filterRect.width / prof ile.width * 100, scaleSlider.maximumValue)
blockUpdate = false blockUpdate = false
} }
setFilter(getPosition()) setFilter(getPosition())
} }
} }
} }
} }
UndoButton { UndoButton {
id: sizeUndoButton
onClicked: { onClicked: {
filterRect.width = rectW.value = profile.width filterRect.width = rectW.value = profile.width
filterRect.height = rectH.value = profile.height filterRect.height = rectH.value = profile.height
scaleSlider.value = 100 if (isFillMode()) {
// enforce the aspect ratio
if (producer.displayAspectRatio > 1.0) {
filterRect.height = rectH.value = filterRect.width / pro
ducer.displayAspectRatio
} else {
filterRect.width = rectW.value = filterRect.height * pro
ducer.displayAspectRatio
}
}
scaleSlider.value = Math.min(filterRect.width / profile.width *
100, scaleSlider.maximumValue)
setFilter(getPosition()) setFilter(getPosition())
} }
} }
Label { Label {
text: qsTr('Zoom') text: qsTr('Zoom')
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
} }
SliderSpinner { SliderSpinner {
id: scaleSlider id: scaleSlider
enabled: fillRadioButton.checked enabled: fillRadioButton.checked
Layout.columnSpan: 3 Layout.columnSpan: 3
minimumValue: 0.1 minimumValue: 0.1
maximumValue: 1000 maximumValue: 1000
decimals: 1 decimals: 1
spinnerWidth: 110
suffix: ' %' suffix: ' %'
onValueChanged: { onValueChanged: {
if (!blockUpdate && Math.abs(value - filterRect.width * 100 / pr ofile.width) > 0.1) { if (!blockUpdate && Math.abs(value - filterRect.width * 100 / pr ofile.width) > 0.1) {
var centerX = filterRect.x + filterRect.width / 2 var centerX = filterRect.x + filterRect.width / 2
var rightX = filterRect.x + filterRect.width var rightX = filterRect.x + filterRect.width
filterRect.width = rectW.value = (profile.width * scaleSlide r.value / 100) filterRect.width = rectW.value = (profile.width * scaleSlide r.value / 100)
if (centerRadioButton.checked) { if (centerRadioButton.checked) {
filterRect.x = rectX.value = centerX - filterRect.width / 2 filterRect.x = rectX.value = centerX - filterRect.width / 2
} else if (rightRadioButton.checked) { } else if (rightRadioButton.checked) {
filterRect.x = rectX.value = rightX - filterRect.width filterRect.x = rectX.value = rightX - filterRect.width
} }
var middleY = filterRect.y + filterRect.height / 2 var middleY = filterRect.y + filterRect.height / 2
var bottomY = filterRect.y + filterRect.height var bottomY = filterRect.y + filterRect.height
filterRect.height = rectH.value = (profile.height * scaleSli der.value / 100) filterRect.height = rectH.value = Math.round(filterRect.widt h / producer.displayAspectRatio)
if (middleRadioButton.checked) { if (middleRadioButton.checked) {
filterRect.y = rectY.value = middleY - filterRect.height / 2 filterRect.y = rectY.value = middleY - filterRect.height / 2
} else if (bottomRadioButton.checked) { } else if (bottomRadioButton.checked) {
filterRect.y = rectY.value = bottomY - filterRect.height filterRect.y = rectY.value = bottomY - filterRect.height
} }
setFilter(getPosition()) setFilter(getPosition())
} }
} }
} }
UndoButton { UndoButton {
enabled: scaleSlider.enabled enabled: scaleSlider.enabled
onClicked: scaleSlider.value = 100 onClicked: {
var width = (producer.displayAspectRatio > 1.0)? profile.width :
profile.height * producer.displayAspectRatio
scaleSlider.value = Math.min(width / profile.width * 100, scaleS
lider.maximumValue)
}
} }
Label { text: qsTr('(Fill only)') } Label { text: '<small>' + qsTr('(Fill only)') + '</small>' }
Label { Label {
text: qsTr('Size mode') text: qsTr('Size mode')
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
} }
RadioButton { RadioButton {
id: fitRadioButton id: fitRadioButton
text: qsTr('Fit') text: qsTr('Fit')
exclusiveGroup: sizeGroup exclusiveGroup: sizeGroup
onClicked: { onClicked: {
skipping to change at line 625 skipping to change at line 671
filter.set(distortProperty, 1) filter.set(distortProperty, 1)
} }
} }
UndoButton { UndoButton {
onClicked: { onClicked: {
fillRadioButton.checked = true fillRadioButton.checked = true
filter.set(fillProperty, 1) filter.set(fillProperty, 1)
filter.set(distortProperty, 0) filter.set(distortProperty, 0)
} }
} }
Item { Layout.fillWidth: true } Item { width: 1 }
Label { Label {
text: qsTr('Horizontal fit') text: qsTr('Horizontal fit')
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
} }
RadioButton { RadioButton {
id: leftRadioButton id: leftRadioButton
text: qsTr('Left') text: qsTr('Left')
exclusiveGroup: halignGroup exclusiveGroup: halignGroup
onClicked: filter.set(halignProperty, 'left') onClicked: filter.set(halignProperty, 'left')
skipping to change at line 655 skipping to change at line 701
text: qsTr('Right') text: qsTr('Right')
exclusiveGroup: halignGroup exclusiveGroup: halignGroup
onClicked: filter.set(halignProperty, 'right') onClicked: filter.set(halignProperty, 'right')
} }
UndoButton { UndoButton {
onClicked: { onClicked: {
leftRadioButton.checked = true leftRadioButton.checked = true
filter.set(halignProperty, 'left') filter.set(halignProperty, 'left')
} }
} }
Item { Layout.fillWidth: true } Item { width: 1 }
Label { Label {
text: qsTr('Vertical fit') text: qsTr('Vertical fit')
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
} }
RadioButton { RadioButton {
id: topRadioButton id: topRadioButton
text: qsTr('Top') text: qsTr('Top')
exclusiveGroup: valignGroup exclusiveGroup: valignGroup
onClicked: filter.set(valignProperty, 'top') onClicked: filter.set(valignProperty, 'top')
skipping to change at line 685 skipping to change at line 731
text: qsTr('Bottom') text: qsTr('Bottom')
exclusiveGroup: valignGroup exclusiveGroup: valignGroup
onClicked: filter.set(valignProperty, 'bottom') onClicked: filter.set(valignProperty, 'bottom')
} }
UndoButton { UndoButton {
onClicked: { onClicked: {
topRadioButton.checked = true topRadioButton.checked = true
filter.set(valignProperty, 'top') filter.set(valignProperty, 'top')
} }
} }
Item { Layout.fillWidth: true } Item { width: 1 }
Label { Label {
text: qsTr('Rotation') text: qsTr('Rotation')
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
visible: !!rotationProperty visible: !!rotationProperty
} }
SliderSpinner { SliderSpinner {
id: rotationSlider id: rotationSlider
Layout.columnSpan: 3 Layout.columnSpan: 3
visible: !!rotationProperty visible: !!rotationProperty
minimumValue: -360 minimumValue: -360
maximumValue: 360 maximumValue: 360
decimals: 1 decimals: 1
spinnerWidth: 110
suffix: qsTr(' °', 'degrees') suffix: qsTr(' °', 'degrees')
onValueChanged: updateRotation(getPosition()) onValueChanged: updateRotation(getPosition())
} }
UndoButton { UndoButton {
visible: !!rotationProperty visible: !!rotationProperty
onClicked: rotationSlider.value = 0 onClicked: rotationSlider.value = 0
} }
KeyframesButton { KeyframesButton {
id: rotationKeyframesButton id: rotationKeyframesButton
visible: !!rotationProperty visible: !!rotationProperty
skipping to change at line 735 skipping to change at line 780
Layout.columnSpan: 3 Layout.columnSpan: 3
eyedropper: true eyedropper: true
alpha: true alpha: true
onValueChanged: filter.set(backgroundProperty, 'color:' + value) onValueChanged: filter.set(backgroundProperty, 'color:' + value)
} }
UndoButton { UndoButton {
visible: bgColor.visible visible: bgColor.visible
onClicked: bgColor.value = '#00000000' onClicked: bgColor.value = '#00000000'
} }
Item { Item {
Layout.fillWidth: true width: 1
visible: bgColor.visible visible: bgColor.visible
} }
Item { Layout.fillHeight: true } Item { Layout.fillHeight: true }
} }
function updateSimpleKeyframes() { function updateSimpleKeyframes() {
if (rotationProperty) { if (rotationProperty) {
updateRotation() updateRotation()
} }
 End of changes. 21 change blocks. 
15 lines changed or deleted 68 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)