Commit e9d586b4 authored by Gus Grubba's avatar Gus Grubba
Browse files

Sanitizing QML and JavaScript

Adding missing qgcView to QGCMapPolygonVisuals instance in SurveyMapVisual.qml
parent 61cc29df
......@@ -233,7 +233,7 @@ Item {
var clickCoordinate = map.toCoordinate(Qt.point(mouse.x, mouse.y), false /* clipToViewPort */)
var polygonPath = _newPolygon.path
if (polygonPath.length == 0) {
if (polygonPath.length === 0) {
// Add first coordinate
polygonPath.push(clickCoordinate)
} else {
......@@ -252,10 +252,10 @@ Item {
_currentPolygon.path = polygonPath
_newPolygon.path = polygonPath
if (_mobile && _currentPolygon.path.length == 1) {
if (_mobile && _currentPolygon.path.length === 1) {
_mobilePoint.coordinate = _currentPolygon.path[0]
_mobilePoint.visible = true
} else if (_mobile && _currentPolygon.path.length == 2) {
} else if (_mobile && _currentPolygon.path.length === 2) {
// Show initial line segment on mobile
_mobileSegment.path = [ _currentPolygon.path[0], _currentPolygon.path[1] ]
_mobileSegment.visible = true
......
......@@ -115,7 +115,7 @@ Item {
var rightCoord = mapControl.toCoordinate(Qt.point(scaleLinePixelLength, scale.y), false /* clipToViewPort */)
var scaleLineMeters = Math.round(leftCoord.distanceTo(rightCoord))
if (QGroundControl.settingsManager.unitsSettings.distanceUnits.value == UnitsSettings.DistanceUnitsFeet) {
if (QGroundControl.settingsManager.unitsSettings.distanceUnits.value === UnitsSettings.DistanceUnitsFeet) {
calculateFeetRatio(scaleLineMeters, scaleLinePixelLength)
} else {
calculateMetersRatio(scaleLineMeters, scaleLinePixelLength)
......
......@@ -61,7 +61,7 @@ DropButton {
/// Fits the visible region of the map to inclues all of the specified coordinates. If no coordinates
/// are specified the map will center to fitHomePosition()
function fitMapViewportToAllCoordinates(coordList) {
if (coordList.length == 0) {
if (coordList.length === 0) {
map.center = fitHomePosition()
return
}
......@@ -115,16 +115,17 @@ DropButton {
}
function addFenceItemCoordsForFit(coordList) {
var i
var homePosition = fitHomePosition()
if (homePosition.isValid && geoFenceController.circleEnabled) {
var azimuthList = [ 0, 180, 90, 270 ]
for (var i=0; i<azimuthList.length; i++) {
for (i = 0; i < azimuthList.length; i++) {
var edgeCoordinate = homePosition.atDistanceAndAzimuth(geoFenceController.circleRadius, azimuthList[i])
coordList.push(edgeCoordinate)
}
}
if (geoFenceController.polygonEnabled && geoFenceController.polygon.count() > 2) {
for (var i=0; i<geoFenceController.polygon.count(); i++) {
for (i = 0; i < geoFenceController.polygon.count(); i++) {
coordList.push(geoFenceController.polygon.path[i])
}
}
......
......@@ -49,7 +49,7 @@ Item {
/// are specified the map will center to fitHomePosition()
function fitMapViewportToAllCoordinates(coordList) {
var mapFitViewport = Qt.rect(0, 0, map.width, map.height)
if (coordList.length == 0) {
if (coordList.length === 0) {
var homeCoord = fitHomePosition()
if (homeCoord.isValid) {
map.center = homeCoord
......@@ -113,16 +113,17 @@ Item {
}
function addFenceItemCoordsForFit(coordList) {
var i
var homePosition = fitHomePosition()
if (homePosition.isValid && _geoFenceController.circleEnabled) {
var azimuthList = [ 0, 180, 90, 270 ]
for (var i=0; i<azimuthList.length; i++) {
for (i = 0; i < azimuthList.length; i++) {
var edgeCoordinate = homePosition.atDistanceAndAzimuth(_geoFenceController.circleRadius, azimuthList[i])
coordList.push(edgeCoordinate)
}
}
if (_geoFenceController.polygonEnabled && _geoFenceController.mapPolygon.path.count > 2) {
for (var i=0; i<_geoFenceController.mapPolygon.path.count; i++) {
for (i = 0; i < _geoFenceController.mapPolygon.path.count; i++) {
coordList.push(_geoFenceController.mapPolygon.path[i])
}
}
......
......@@ -174,8 +174,8 @@ Column {
anchors.right: parent.right
sourceComponent: factGroupList
property var factGroup: _activeVehicle
property var factGroupName: "Vehicle"
property var factGroup: _activeVehicle
property string factGroupName: "Vehicle"
}
}
}
......
......@@ -39,7 +39,7 @@ Column {
}
gridTypeCombo.model = _cameraList
var knownCameraIndex = gridTypeCombo.find(cameraCalc.cameraName)
if (knownCameraIndex != -1) {
if (knownCameraIndex !== -1) {
gridTypeCombo.currentIndex = knownCameraIndex
} else {
console.log("Internal error: Known camera not found", cameraCalc.cameraName)
......
......@@ -46,7 +46,7 @@ Column {
anchors.left: parent.left
anchors.right: parent.right
spacing: ScreenTools.defaultFontPixelWidth
visible: _camera.cameraAction.rawValue == 1
visible: _camera.cameraAction.rawValue === 1
QGCLabel {
text: qsTr("Time")
......@@ -62,7 +62,7 @@ Column {
anchors.left: parent.left
anchors.right: parent.right
spacing: ScreenTools.defaultFontPixelWidth
visible: _camera.cameraAction.rawValue == 2
visible: _camera.cameraAction.rawValue === 2
QGCLabel {
text: qsTr("Distance")
......
......@@ -154,7 +154,7 @@ QGCFlickable {
QGCLabel {
text: qsTr("None")
visible: polygonSection.checked && myGeoFenceController.polygons.count == 0
visible: polygonSection.checked && myGeoFenceController.polygons.count === 0
}
GridLayout {
......@@ -239,7 +239,7 @@ QGCFlickable {
QGCLabel {
text: qsTr("None")
visible: circleSection.checked && myGeoFenceController.circles.count == 0
visible: circleSection.checked && myGeoFenceController.circles.count === 0
}
GridLayout {
......
......@@ -89,7 +89,7 @@ Rectangle {
height: _hamburgerSize
sourceSize.height: _hamburgerSize
source: "qrc:/qmlimages/Hamburger.svg"
visible: missionItem.isCurrentItem && missionItem.sequenceNumber != 0
visible: missionItem.isCurrentItem && missionItem.sequenceNumber !== 0
color: qgcPal.windowShade
}
......
......@@ -32,13 +32,13 @@ Rectangle {
property real missionMaxTelemetry: _controllerValid ? planMasterController.missionController.missionMaxTelemetry : NaN
property bool missionDirty: _controllerValid ? planMasterController.missionController.dirty : false
property bool _controllerValid: planMasterController != undefined
property bool _controllerValid: planMasterController !== undefined
property bool _controllerOffline: _controllerValid ? planMasterController.offline : true
property var _controllerDirty: _controllerValid ? planMasterController.dirty : false
property var _controllerSyncInProgress: _controllerValid ? planMasterController.syncInProgress : false
property bool _statusValid: currentMissionItem != undefined
property bool _missionValid: missionItems != undefined
property bool _statusValid: currentMissionItem !== undefined
property bool _missionValid: missionItems !== undefined
property real _dataFontSize: ScreenTools.defaultFontPointSize
property real _largeValueWidth: ScreenTools.defaultFontPixelWidth * 8
......
......@@ -238,7 +238,7 @@ QGCView {
QGCFileDialog {
id: fileDialog
qgcView: _qgcView
property var plan: true
property bool plan: true
folder: QGroundControl.settingsManager.appSettings.missionSavePath
fileExtension: QGroundControl.settingsManager.appSettings.planFileExtension
fileExtension2: QGroundControl.settingsManager.appSettings.missionFileExtension
......@@ -263,7 +263,7 @@ QGCView {
function accept() {
var toIndex = toCombo.currentIndex
if (toIndex == 0) {
if (toIndex === 0) {
toIndex = 1
}
_missionController.moveMissionItem(_moveDialogMissionItemIndex, toIndex)
......
......@@ -17,7 +17,7 @@ Rectangle {
property var rallyPoint ///< RallyPoint object associated with editor
property var controller ///< RallyPointController
property bool _currentItem: rallyPoint ? rallyPoint == controller.currentRallyPoint : false
property bool _currentItem: rallyPoint ? rallyPoint === controller.currentRallyPoint : false
property color _outerTextColor: _currentItem ? "black" : qgcPal.text
readonly property real _margin: ScreenTools.defaultFontPixelWidth / 2
......
......@@ -45,7 +45,7 @@ Item {
MissionItemIndicatorDrag {
itemCoordinate: rallyPointObject.coordinate
visible: rallyPointObject == myRallyPointController.currentRallyPoint
visible: rallyPointObject === myRallyPointController.currentRallyPoint
property var rallyPointObject
......@@ -67,7 +67,7 @@ Item {
sourceItem: MissionItemIndexLabel {
id: itemIndexLabel
label: qsTr("R", "rally point map item label")
checked: _editingLayer == _layerRallyPoints ? rallyPointObject == myRallyPointController.currentRallyPoint : false
checked: _editingLayer == _layerRallyPoints ? rallyPointObject === myRallyPointController.currentRallyPoint : false
onClicked: myRallyPointController.currentRallyPoint = rallyPointObject
}
......
......@@ -44,7 +44,7 @@ Rectangle {
QGCLabel {
text: object.name
visible: object.name != ""
visible: object.name !== ""
Layout.column: 0
Layout.row: index
}
......
......@@ -46,7 +46,7 @@ Rectangle {
} else {
var index = -1
for (index=0; index<_cameraList.length; index++) {
if (_cameraList[index] == missionItem.camera.value) {
if (_cameraList[index] === missionItem.camera.value) {
break;
}
}
......@@ -243,7 +243,7 @@ Rectangle {
anchors.left: parent.left
anchors.right: parent.right
spacing: _margin
visible: missionItem.manualGrid.value == true
visible: missionItem.manualGrid.value
QGCCheckBox {
id: cameraTriggerDistanceCheckBox
......@@ -273,7 +273,7 @@ Rectangle {
anchors.left: parent.left
anchors.right: parent.right
spacing: _margin
visible: gridTypeCombo.currentIndex != _gridTypeManual
visible: gridTypeCombo.currentIndex !== _gridTypeManual
Row {
spacing: _margin
......@@ -443,7 +443,7 @@ Rectangle {
id: windRoseButton
anchors.verticalCenter: angleText.verticalCenter
iconSource: qgcPal.globalTheme === QGCPalette.Light ? "/res/wind-roseBlack.svg" : "/res/wind-rose.svg"
visible: _vehicle.fixedWing
visible: _vehicle ? _vehicle.fixedWing : false
onClicked: {
windRosePie.angle = Number(gridAngleText.text)
......@@ -522,7 +522,7 @@ Rectangle {
SectionHeader {
id: manualGridHeader
text: qsTr("Grid")
visible: gridTypeCombo.currentIndex == _gridTypeManual
visible: gridTypeCombo.currentIndex === _gridTypeManual
}
GridLayout {
......@@ -547,7 +547,7 @@ Rectangle {
anchors.verticalCenter: manualAngleText.verticalCenter
Layout.columnSpan: 1
iconSource: qgcPal.globalTheme === QGCPalette.Light ? "/res/wind-roseBlack.svg" : "/res/wind-rose.svg"
visible: _vehicle.fixedWing
visible: _vehicle ? _vehicle.fixedWing : false
onClicked: {
var cords = manualWindRoseButton.mapToItem(_root, 0, 0)
......
......@@ -90,6 +90,7 @@ Item {
QGCMapPolygonVisuals {
id: mapPolygonVisuals
qgcView: _root.qgcView
mapControl: map
mapPolygon: _mapPolygon
interactive: _missionItem.isCurrentItem
......
......@@ -175,9 +175,9 @@ Item {
id: arrowCanvas
anchors.fill: parent
property var arrowPoint: Qt.point(0, 0)
property var arrowBase1: Qt.point(0, 0)
property var arrowBase2: Qt.point(0, 0)
property point arrowPoint: Qt.point(0, 0)
property point arrowBase1: Qt.point(0, 0)
property point arrowBase2: Qt.point(0, 0)
onPaint: {
var context = getContext("2d")
......
......@@ -124,9 +124,9 @@ Item {
id: arrowCanvas
anchors.fill: parent
property var arrowPoint: Qt.point(0, 0)
property var arrowBase1: Qt.point(0, 0)
property var arrowBase2: Qt.point(0, 0)
property point arrowPoint: Qt.point(0, 0)
property point arrowBase1: Qt.point(0, 0)
property point arrowBase2: Qt.point(0, 0)
onPaint: {
var context = getContext("2d")
......
......@@ -37,13 +37,14 @@ QGCLabel {
function updateFlightModesMenu() {
if (activeVehicle && activeVehicle.flightModeSetAvailable) {
var i;
// Remove old menu items
for (var i = 0; i < flightModesMenuItems.length; i++) {
for (i = 0; i < flightModesMenuItems.length; i++) {
flightModesMenu.removeItem(flightModesMenuItems[i])
}
flightModesMenuItems.length = 0
// Add new items
for (var i = 0; i < activeVehicle.flightModes.length; i++) {
for (i = 0; i < activeVehicle.flightModes.length; i++) {
var menuItem = flightModeMenuItemComponent.createObject(null, { "text": activeVehicle.flightModes[i] })
flightModesMenuItems.push(menuItem)
flightModesMenu.insertItem(i, menuItem)
......
......@@ -68,7 +68,7 @@ QGCViewDialog {
color: qgcPal.button
property var mavCmdInfo: modelData
property var textColor: qgcPal.buttonText
property color textColor: qgcPal.buttonText
Column {
id: commandColumn
......
Supports Markdown
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