Commit eb7f5026 authored by Vincent Pinon's avatar Vincent Pinon
Browse files

fix QML comparisons warnings

parent 7a00c571
......@@ -54,7 +54,7 @@ Item {
height: recbutton.height
color: Qt.lighter(activePalette.base)
Repeater {
model: audiorec.levels.length == 0 ? 2 : audiorec.levels.length
model: audiorec.levels.length === 0 ? 2 : audiorec.levels.length
id: bgRepeater
Rectangle {
color: 'transparent'
......@@ -77,7 +77,7 @@ Item {
}
}
Repeater {
model: audiorec.levels.length == 0 ? 2 : audiorec.levels.length
model: audiorec.levels.length === 0 ? 2 : audiorec.levels.length
id: levelRepeater
Item {
anchors.fill: parent
......
......@@ -69,7 +69,7 @@ Rectangle {
property int lastValidDuration: clipDuration
property int draggedX: x
property bool selected: false
property bool isLocked: parentTrack && parentTrack.isLocked == true
property bool isLocked: parentTrack && parentTrack.isLocked === true
property bool hasAudio
property bool canBeAudio
property bool canBeVideo
......@@ -114,7 +114,7 @@ Rectangle {
}
onClipResourceChanged: {
if (itemType == ProducerType.Color) {
if (itemType === ProducerType.Color) {
color: Qt.darker(getColor(), 1.5)
}
}
......@@ -176,7 +176,7 @@ Rectangle {
labelRect.x = scrollX > modelStart * timeScale ? scrollX - modelStart * timeScale : 0
}
border.color: (clipStatus == ClipStatus.StatusMissing || ClipStatus == ClipStatus.StatusWaiting || clipStatus == ClipStatus.StatusDeleting) ? "#ff0000" : selected ? root.selectionColor : grouped ? root.groupColor : borderColor
border.color: (clipStatus === ClipStatus.StatusMissing || ClipStatus === ClipStatus.StatusWaiting || clipStatus === ClipStatus.StatusDeleting) ? "#ff0000" : selected ? root.selectionColor : grouped ? root.groupColor : borderColor
border.width: isGrabbed ? 8 : 2
function updateDrag() {
......@@ -194,24 +194,24 @@ Rectangle {
}
function getColor() {
if (clipRoot.clipState == ClipState.Disabled) {
if (clipRoot.clipState === ClipState.Disabled) {
return '#888'
}
if (clipRoot.tagColor) {
return clipRoot.tagColor
}
if (itemType == ProducerType.Text) {
if (itemType === ProducerType.Text) {
return titleColor
}
if (itemType == ProducerType.Image) {
if (itemType === ProducerType.Image) {
return imageColor
}
if (itemType == ProducerType.SlideShow) {
if (itemType === ProducerType.SlideShow) {
return slideshowColor
}
if (itemType == ProducerType.Color) {
if (itemType === ProducerType.Color) {
var color = clipResource.substring(clipResource.length - 9)
if (color[0] == '#') {
if (color[0] === '#') {
return color
}
return '#' + color.substring(color.length - 8, color.length - 2)
......@@ -229,7 +229,7 @@ Rectangle {
//generateWaveform()
}
*/
property bool noThumbs: (isAudio || itemType == ProducerType.Color || mltService === '')
property bool noThumbs: (isAudio || itemType === ProducerType.Color || mltService === '')
property string baseThumbPath: noThumbs ? '' : 'image://thumbnail/' + binId + '/' + documentId + '/#'
DropArea { //Drop area for clips
......@@ -266,7 +266,7 @@ Rectangle {
root.autoScrolling = false
root.mainItemId = clipRoot.clipId
if (mouse.button == Qt.RightButton) {
if (timeline.selection.indexOf(clipRoot.clipId) == -1) {
if (timeline.selection.indexOf(clipRoot.clipId) === -1) {
controller.requestAddToSelection(clipRoot.clipId, true)
}
root.mainFrame = Math.round(mouse.x / timeline.scaleFactor)
......@@ -884,7 +884,7 @@ Rectangle {
x: labelRect.x
anchors.top: labelRect.top
anchors.left: labelRect.right
visible: !clipRoot.isAudio && clipRoot.clipStatus == ClipStatus.StatusProxy || clipRoot.clipStatus == ClipStatus.StatusProxyOnly
visible: !clipRoot.isAudio && clipRoot.clipStatus === ClipStatus.StatusProxy || clipRoot.clipStatus === ClipStatus.StatusProxyOnly
Text {
// Proxy P
id: proxyLabel
......
......@@ -6,7 +6,7 @@ import com.enums 1.0
Row {
id: waveform
opacity: clipState == ClipState.Disabled ? 0.2 : 1
opacity: clipState === ClipState.Disabled ? 0.2 : 1
property int maxWidth: 500 - (500 % timeline.scaleFactor) + 100 * timeline.scaleFactor
anchors.fill: parent
......@@ -17,7 +17,7 @@ Row {
}
function reload(reset) {
if (reset == 0) {
if (reset === 0) {
waveformRepeater.model = 0
}
waveTimer.start()
......@@ -33,7 +33,7 @@ Row {
return;
}
var chunks = Math.ceil(waveform.width / waveform.maxWidth)
if (waveformRepeater.model == undefined || chunks != waveformRepeater.model) {
if (waveformRepeater.model === undefined || chunks !== waveformRepeater.model) {
waveformRepeater.model = chunks
}
}
......
......@@ -8,10 +8,10 @@ Row {
id: thumbRow
anchors.fill: parent
visible: !isAudio
opacity: clipState == ClipState.Disabled ? 0.2 : 1
property bool fixedThumbs: clipRoot.itemType == ProducerType.Image || clipRoot.itemType == ProducerType.Text || clipRoot.itemType == ProducerType.TextTemplate
opacity: clipState === ClipState.Disabled ? 0.2 : 1
property bool fixedThumbs: clipRoot.itemType === ProducerType.Image || clipRoot.itemType === ProducerType.Text || clipRoot.itemType === ProducerType.TextTemplate
property int thumbWidth: container.height * root.dar
property bool enableCache: clipRoot.itemType == ProducerType.Video || clipRoot.itemType == ProducerType.AV
property bool enableCache: clipRoot.itemType === ProducerType.Video || clipRoot.itemType === ProducerType.AV
function reload(reset) {
//console.log('+++++\n\ntriggered ML thumb reload\n\n++++++++++++++')
clipRoot.baseThumbPath = clipRoot.variableThumbs ? '' : 'image://thumbnail/' + clipRoot.binId + '/' + Math.random() + '/#'
......@@ -24,7 +24,7 @@ Row {
// container.width / thumbRow.thumbWidth will display all frames showThumbnails
// 1: only show first thumbnail
// 0: will disable thumbnails
model: parentTrack.trackThumbsFormat == 0 ? 2 : parentTrack.trackThumbsFormat == 1 ? Math.ceil(container.width / thumbRow.thumbWidth) : parentTrack.trackThumbsFormat == 2 ? 1 : 0
model: parentTrack.trackThumbsFormat === 0 ? 2 : parentTrack.trackThumbsFormat === 1 ? Math.ceil(container.width / thumbRow.thumbWidth) : parentTrack.trackThumbsFormat === 2 ? 1 : 0
property int startFrame: clipRoot.inPoint
property int endFrame: clipRoot.outPoint
property real imageWidth: Math.max(thumbRow.thumbWidth, container.width / thumbRepeater.count)
......
......@@ -158,7 +158,7 @@ Item {
compositionRoot.forceActiveFocus();
root.mainItemId = compositionRoot.clipId
if (mouse.button == Qt.RightButton) {
if (timeline.selection.indexOf(compositionRoot.clipId) == -1) {
if (timeline.selection.indexOf(compositionRoot.clipId) === -1) {
controller.requestAddToSelection(compositionRoot.clipId, true)
}
root.showCompositionMenu()
......
......@@ -42,7 +42,7 @@ Rectangle
}
Keys.onShortcutOverride: {
if (event.key == Qt.Key_Left) {
if (event.key === Qt.Key_Left) {
if (event.modifiers & Qt.AltModifier) {
activeFrame = keyframes.itemAt(Math.max(0, --activeIndex)).frame
} else {
......@@ -56,7 +56,7 @@ Rectangle
}
event.accepted = true
}
else if (event.key == Qt.Key_Right) {
else if (event.key === Qt.Key_Right) {
if (event.modifiers & Qt.AltModifier) {
activeFrame = keyframes.itemAt(Math.min(keyframes.count - 1, ++activeIndex)).frame
} else {
......@@ -69,16 +69,16 @@ Rectangle
}
event.accepted = true
}
else if (event.key == Qt.Key_Return || event.key == Qt.Key_Escape) {
else if (event.key === Qt.Key_Return || event.key === Qt.Key_Escape) {
keyframeContainer.focus = false
event.accepted = true
}
if ((event.key == Qt.Key_Plus) && !(event.modifiers & Qt.ControlModifier)) {
if ((event.key === Qt.Key_Plus) && !(event.modifiers & Qt.ControlModifier)) {
var newVal = Math.min(keyframes.itemAt(activeIndex).value / parent.height + .05, 1)
kfrModel.updateKeyframe(activeFrame, newVal)
event.accepted = true
}
else if ((event.key == Qt.Key_Minus) && !(event.modifiers & Qt.ControlModifier)) {
else if ((event.key === Qt.Key_Minus) && !(event.modifiers & Qt.ControlModifier)) {
var newVal = Math.max(keyframes.itemAt(activeIndex).value / parent.height - .05, 0)
kfrModel.updateKeyframe(activeFrame, newVal)
event.accepted = true
......@@ -185,7 +185,7 @@ Rectangle
onReleased: {
root.autoScrolling = timeline.autoScroll
var newPos = frame == inPoint ? inPoint : Math.round((keyframe.x + parent.x + root.baseUnit / 2) / timeScale) + inPoint
if (newPos == frame && keyframe.value == keyframe.height - parent.y - root.baseUnit / 2) {
if (newPos === frame && keyframe.value == keyframe.height - parent.y - root.baseUnit / 2) {
var pos = masterObject.modelStart + frame - inPoint
if (proxy.position != pos) {
proxy.position = pos
......@@ -276,7 +276,7 @@ Rectangle
{
var type = i > 0 ? keyframes.itemAt(i-1).frameType : keyframes.itemAt(i).frameType
xpos = keyframes.itemAt(i).tmpPos
if (type == 0) {
if (type === 0) {
// discrete
paths.push(compline.createObject(keyframecanvas, {"x": xpos, "y": ypos} ))
}
......@@ -284,7 +284,7 @@ Rectangle
if (type < 2) {
// linear
paths.push(compline.createObject(keyframecanvas, {"x": xpos, "y": ypos} ))
} else if (type == 2) {
} else if (type === 2) {
// curve
paths.push(comp.createObject(keyframecanvas, {"x": xpos, "y": ypos} ))
}
......
......@@ -88,7 +88,7 @@ Item {
snappedFrame = oldStartFrame
x = subtitleBase.x
startMove = mouse.button & Qt.LeftButton
if (timeline.selection.indexOf(subtitleRoot.subId) == -1) {
if (timeline.selection.indexOf(subtitleRoot.subId) === -1) {
controller.requestAddToSelection(subtitleRoot.subId, !(mouse.modifiers & Qt.ShiftModifier))
timeline.showAsset(subtitleRoot.subId);
} else if (mouse.modifiers & Qt.ShiftModifier) {
......
......@@ -42,7 +42,7 @@ function getTrackIndexFromPos(pos) {
function getTrackIdFromPos(pos) {
var index = getTrackIndexFromPos(pos);
if (index != -1) {
if (index !== -1) {
return tracksRepeater.itemAt(index).trackInternalId
}
return -1
......@@ -51,7 +51,7 @@ function getTrackIdFromPos(pos) {
function getTrackYFromId(id) {
var result = 0
for (var i = 0; i < trackHeaderRepeater.count; i++) {
if (trackHeaderRepeater.itemAt(i).trackId == id) {
if (trackHeaderRepeater.itemAt(i).trackId === id) {
break;
}
result += trackHeaderRepeater.itemAt(i).height
......@@ -62,7 +62,7 @@ function getTrackYFromId(id) {
function getTrackIndexFromId(id) {
var i = 0;
for (; i < trackHeaderRepeater.count; i++) {
if (trackHeaderRepeater.itemAt(i).trackId == id) {
if (trackHeaderRepeater.itemAt(i).trackId === id) {
break;
}
}
......@@ -72,7 +72,7 @@ function getTrackIndexFromId(id) {
function getTrackById(id) {
var i = 0;
for (; i < tracksRepeater.count; i++) {
if (tracksRepeater.itemAt(i).trackInternalId == id) {
if (tracksRepeater.itemAt(i).trackInternalId === id) {
return tracksRepeater.itemAt(i);
}
}
......
......@@ -38,7 +38,7 @@ Item{
}
function isClip(type) {
return type != ProducerType.Composition && type != ProducerType.Track;
return type !== ProducerType.Composition && type !== ProducerType.Track;
}
width: clipRow.width
......@@ -48,7 +48,7 @@ Item{
delegate: Item {
property var itemModel : model
property bool clipItem: isClip(model.clipType)
z: model.clipType == ProducerType.Composition ? 5 : model.mixDuration > 0 ? model.start / 25 : 0
z: model.clipType === ProducerType.Composition ? 5 : model.mixDuration > 0 ? model.start / 25 : 0
Loader {
id: loader
Binding {
......@@ -91,7 +91,7 @@ Item{
target: loader.item
property: "selected"
value: model.selected
when: loader.status == Loader.Ready && model.clipType != ProducerType.Track
when: loader.status == Loader.Ready && model.clipType !== ProducerType.Track
}
Binding {
target: loader.item
......@@ -163,13 +163,13 @@ Item{
target: loader.item
property: "aTrack"
value: model.a_track
when: loader.status == Loader.Ready && model.clipType == ProducerType.Composition
when: loader.status == Loader.Ready && model.clipType === ProducerType.Composition
}
Binding {
target: loader.item
property: "trackHeight"
value: root.trackHeight
when: loader.status == Loader.Ready && model.clipType == ProducerType.Composition
when: loader.status == Loader.Ready && model.clipType === ProducerType.Composition
}
Binding {
target: loader.item
......@@ -234,7 +234,7 @@ Item{
sourceComponent: {
if (clipItem) {
return clipDelegate
} else if (model.clipType == ProducerType.Composition) {
} else if (model.clipType === ProducerType.Composition) {
return compositionDelegate
} else {
// Track
......@@ -259,7 +259,7 @@ Item{
console.log('loaded clip with Astream: ', model.audioStream)
// Speed change triggers a new clip insert so no binding necessary
item.speed = model.speed
} else if (model.clipType == ProducerType.Composition) {
} else if (model.clipType === ProducerType.Composition) {
console.log('loaded composition: ', model.start, ', ID: ', model.item, ', index: ', trackRoot.DelegateModel.itemsIndex)
//item.aTrack = model.a_track
} else {
......@@ -321,7 +321,7 @@ Item{
onTrimmedIn: {
//bubbleHelp.hide()
timeline.showToolTip();
if (shiftTrim || root.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) {
......@@ -370,7 +370,7 @@ Item{
onTrimmedOut: {
timeline.showToolTip();
//bubbleHelp.hide()
if (shiftTrim || root.groupTrimData == undefined || controlTrim) {
if (shiftTrim || root.groupTrimData === undefined || controlTrim) {
controller.requestItemResize(clip.clipId, clip.originalDuration, true, false, 0, shiftTrim)
if (controlTrim) {
speedController.visible = false
......
......@@ -128,7 +128,7 @@ Rectangle {
if (trackHeadRoot.isAudio) {
timeline.switchAudioTarget(trackHeadRoot.trackId);
} else {
if (trackHeadRoot.trackId == timeline.videoTarget) {
if (trackHeadRoot.trackId === timeline.videoTarget) {
timeline.videoTarget = -1;
} else if (timeline.hasVideoTarget) {
timeline.videoTarget = trackHeadRoot.trackId;
......@@ -190,7 +190,7 @@ Rectangle {
states: [
State {
name: 'target'
when: (trackHeadRoot.isAudio && timeline.audioTarget.indexOf(trackHeadRoot.trackId) > -1) || (!trackHeadRoot.isAudio && trackHeadRoot.trackId == timeline.videoTarget)
when: (trackHeadRoot.isAudio && timeline.audioTarget.indexOf(trackHeadRoot.trackId) > -1) || (!trackHeadRoot.isAudio && trackHeadRoot.trackId === timeline.videoTarget)
PropertyChanges {
target: trackTarget
bgColor: timeline.targetColor
......
......@@ -70,7 +70,7 @@ Rectangle {
}
onDoubleClicked: {
// Switch between current zoom and fit all project
if (zoomBar.x == 0 && timeline.scaleFactor == root.fitZoom()) {
if (zoomBar.x == 0 && timeline.scaleFactor === root.fitZoom()) {
// Restore previous pos
if (zoomHandleContainer.previousScale > -1) {
root.zoomOnBar = zoomHandleContainer.previousX
......
......@@ -13,7 +13,7 @@ Rectangle {
property bool validMenu: false
property color textColor: activePalette.text
property var groupTrimData
property bool dragInProgress: dragProxyArea.pressed || dragProxyArea.drag.active || groupTrimData != undefined
property bool dragInProgress: dragProxyArea.pressed || dragProxyArea.drag.active || groupTrimData !== undefined
signal clipClicked()
signal mousePosChanged(int position)
......@@ -71,10 +71,10 @@ Rectangle {
}
function checkDeletion(itemId) {
if (dragProxy.draggedItem == itemId) {
if (dragProxy.draggedItem === itemId) {
endDrag()
}
if (itemId == mainItemId) {
if (itemId === mainItemId) {
mainItemId = -1
}
}
......@@ -107,7 +107,7 @@ Rectangle {
}
var max = tracksRepeater.count;
if (newTrack < 0) {
if (showSubtitles && newTrack == -1) {
if (showSubtitles && newTrack === -1) {
timeline.activeTrack = -2
return
}
......@@ -332,11 +332,11 @@ Rectangle {
var container = track.children[0]
var tentativeClip = undefined
for (var i = 0 ; i < container.children.length; i++) {
if (container.children[i].children.length == 0 || container.children[i].children[0].children.length == 0) {
if (container.children[i].children.length === 0 || container.children[i].children[0].children.length === 0) {
continue
}
tentativeClip = container.children[i].children[0].childAt(posx, 1)
if (tentativeClip && tentativeClip.clipId && (tentativeClip.isComposition == isComposition)) {
if (tentativeClip && tentativeClip.clipId && (tentativeClip.isComposition === isComposition)) {
break
}
}
......@@ -440,7 +440,7 @@ Rectangle {
}
onViewActiveTrackChanged: {
if (timeline.activeTrack == -2) {
if (timeline.activeTrack === -2) {
// subtitle track
scrollView.contentY = 0
return
......@@ -505,7 +505,7 @@ Rectangle {
onPositionChanged: {
if (clipBeingMovedId == -1) {
var track = Logic.getTrackIdFromPos(drag.y + scrollView.contentY - subtitleTrack.height)
if (track !=-1) {
if (track !== -1) {
var frame = Math.round((drag.x + scrollView.contentX) / timeline.scaleFactor)
if (clipBeingDroppedId >= 0){
if (controller.isAudioTrack(track)) {
......@@ -547,12 +547,12 @@ Rectangle {
/** @brief local helper function to handle the insertion of multiple dragged items */
function insertAndMaybeGroup(track, frame, droppedData) {
var binIds = droppedData.split(";")
if (binIds.length == 0) {
if (binIds.length === 0) {
return -1
}
var id = -1
if (binIds.length == 1) {
if (binIds.length === 1) {
id = timeline.insertClip(timeline.activeTrack, frame, clipBeingDroppedData, false, true, false)
} else {
var ids = timeline.insertClips(timeline.activeTrack, frame, binIds, false, true, false)
......@@ -846,7 +846,7 @@ Rectangle {
height: subtitleTrack.height
property bool collapsed: subtitleTrack.height == root.collapsedHeight
visible: height > 0
color: (timeline.activeTrack == -2) ? Qt.tint(getTrackColor(false, false), selectedTrackColor) : getTrackColor(false, false)
color: (timeline.activeTrack === -2) ? Qt.tint(getTrackColor(false, false), selectedTrackColor) : getTrackColor(false, false)
MouseArea {
anchors.fill: parent
onClicked: {
......@@ -1312,7 +1312,7 @@ Rectangle {
proxy.position = Math.min((scrollView.contentX + mouse.x) / timeline.scaleFactor, timeline.fullDuration - 1)
} else if (dragProxy.draggedItem > -1) {
// Select item
if (timeline.selection.indexOf(dragProxy.draggedItem) == -1) {
if (timeline.selection.indexOf(dragProxy.draggedItem) === -1) {
controller.requestAddToSelection(dragProxy.draggedItem)
} else {
controller.requestRemoveFromSelection(dragProxy.draggedItem)
......@@ -1414,7 +1414,7 @@ Rectangle {
border.width: 1
border.color: root.frameColor
height: subtitleTrack.height
color: (timeline.activeTrack == -2) ? Qt.tint(getTrackColor(false, false), selectedTrackColor) : getTrackColor(false, false)
color: (timeline.activeTrack === -2) ? Qt.tint(getTrackColor(false, false), selectedTrackColor) : getTrackColor(false, false)
}
Column {
y: subtitleTrack.height
......@@ -1427,7 +1427,7 @@ Rectangle {
border.width: 1
border.color: root.frameColor
height: model.trackHeight
color: (model.item == timeline.activeTrack) ? Qt.tint(getTrackColor(model.audio, false), selectedTrackColor) : getTrackColor(model.audio, false)
color: (model.item === timeline.activeTrack) ? Qt.tint(getTrackColor(model.audio, false), selectedTrackColor) : getTrackColor(model.audio, false)
}
}
}
......@@ -1523,7 +1523,7 @@ Rectangle {
dragFrame = -1
moveMirrorTracks = !(mouse.modifiers & Qt.MetaModifier) && (Qt.platform.os != "windows" || !(mouse.modifiers & Qt.AltModifier))
timeline.activeTrack = dragProxy.sourceTrack
if (timeline.selection.indexOf(dragProxy.draggedItem) == -1) {
if (timeline.selection.indexOf(dragProxy.draggedItem) === -1) {
controller.requestAddToSelection(dragProxy.draggedItem, /*clear=*/ true)
}
timeline.showAsset(dragProxy.draggedItem)
......@@ -1535,7 +1535,7 @@ Rectangle {
var posx = Math.round((parent.x)/ root.timeScale)
var clickAccepted = true
var currentMouseTrack = Logic.getTrackIdFromPos(parent.y)
if (controller.normalEdit() && (tk != currentMouseTrack || x != posx)) {
if (controller.normalEdit() && (tk !== currentMouseTrack || x !== posx)) {
console.log('incorrect drag, Trying to recover item', parent.y,'xpos',x,'=',posx,'track',tk)
// Try to find correct item
var tentativeClip = getItemAtPos(currentMouseTrack, mouseX + parent.x, dragProxy.isComposition)
......@@ -1601,7 +1601,7 @@ Rectangle {
var posx = Math.round((parent.x)/ root.timeScale)
var posy = Math.min(Math.max(0, dragProxyArea.mouseY + parent.y - dragProxy.verticalOffset), tracksContainerArea.height)
var tId = Logic.getTrackIdFromPos(posy)
if (dragProxy.masterObject && tId == dragProxy.masterObject.trackId) {
if (dragProxy.masterObject && tId === dragProxy.masterObject.trackId) {
if (posx == dragFrame && controller.normalEdit()) {
return
}
......@@ -1611,7 +1611,7 @@ Rectangle {
dragFrame = moveData[0]
timeline.activeTrack = moveData[1]
} else {
if (!controller.normalEdit() && dragProxy.masterObject.parent != dragContainer) {
if (!controller.normalEdit() && dragProxy.masterObject.parent !== dragContainer) {
var pos = dragProxy.masterObject.mapToGlobal(dragProxy.masterObject.x, dragProxy.masterObject.y)
dragProxy.masterObject.parent = dragContainer
pos = dragProxy.masterObject.mapFromGlobal(pos.x, pos.y)
......
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