[qml] Optimize QML files and fix syntax warnings

This commit addresses warnings that were raised by QtCreator's linter:
- IDs declared more than once
- variables declared more than once in the same scope
- type coercions
- variables declared as "var" when their type is known
- unclosed "case" in switch-case
This commit is contained in:
Candice Bentéjac 2023-01-27 11:00:51 +01:00
parent 8c2a7bba0f
commit 091346cbb8
18 changed files with 99 additions and 97 deletions

View file

@ -45,7 +45,7 @@ FloatingPane {
function getGPSCoordinates(metadata)
{
// GPS data available
if(metadata && metadata["GPS:Longitude"] != undefined && metadata["GPS:Latitude"] != undefined)
if(metadata && metadata["GPS:Longitude"] !== undefined && metadata["GPS:Latitude"] !== undefined)
{
var latitude = gpsMetadataToCoordinates(metadata["GPS:Latitude"], metadata["GPS:LatitudeRef"])
var longitude = gpsMetadataToCoordinates(metadata["GPS:Longitude"], metadata["GPS:LongitudeRef"])
@ -79,11 +79,11 @@ FloatingPane {
var entry = {}
// split on ":" to get group and key
var i = key.lastIndexOf(":")
if(i == -1)
if(i === -1)
{
i = key.lastIndexOf("/")
}
if(i != -1)
if(i !== -1)
{
entry["group"] = key.substr(0, i)
entry["key"] = key.substr(i+1)
@ -190,7 +190,7 @@ FloatingPane {
sortRole: "raw"
filters: [{role: "raw", value: searchBar.text}]
delegate: RowLayout {
width: parent.width
width: parent ? parent.width : 0
Label {
text: key
leftPadding: 6
@ -289,7 +289,7 @@ FloatingPane {
anchors.right: parent.right
anchors.top: parent.top
padding: 2
visible: map.center != coordinates
visible: map.center !== coordinates
ToolButton {
font.family: MaterialIcons.fontFamily