ricerca città: voce del porto di riferimento con distanza km, apertura diretta se la città è un porto; eventi: layout sequenziale kind→data→altezza senza sovrapposizioni

This commit is contained in:
2026-09-02 11:46:50 +02:00
parent d74f417a67
commit 9e7c97786a
2 changed files with 24 additions and 3 deletions
+7 -2
View File
@@ -237,19 +237,24 @@ Page {
width: parent.width width: parent.width
height: Theme.itemSizeSmall height: Theme.itemSizeSmall
Label { Label {
id: kindLbl
text: model.kind === "high" ? "▲ " + qsTr("High") : "▼ " + qsTr("Low") text: model.kind === "high" ? "▲ " + qsTr("High") : "▼ " + qsTr("Low")
color: model.kind === "high" ? Theme.highlightColor : Theme.errorColor color: model.kind === "high" ? Theme.highlightColor : Theme.errorColor
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: Theme.horizontalPageMargin anchors.leftMargin: Theme.horizontalPageMargin
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
width: 110
} }
Label { Label {
text: model.date + " " + model.time text: model.date + " " + model.time
color: Theme.primaryColor color: Theme.primaryColor
anchors.left: parent.left anchors.left: kindLbl.right
anchors.leftMargin: Theme.horizontalPageMargin + 100 anchors.leftMargin: Theme.paddingSmall
anchors.right: parent.right
anchors.rightMargin: Theme.horizontalPageMargin + 70
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
truncationMode: TruncationMode.Fade
} }
Label { Label {
text: model.height text: model.height
+17 -1
View File
@@ -146,7 +146,8 @@ Page {
if (f !== "" && p[0].toLowerCase().indexOf(f) === -1) if (f !== "" && p[0].toLowerCase().indexOf(f) === -1)
continue continue
portModel.append({ portModel.append({
name: p[0], country: qsTr("searched city"), name: p[0],
country: p[1] !== "" ? p[1] : qsTr("searched city"),
range: "±" + (p[4][1][0] + p[4][2][0]).toFixed(2) + " m", range: "±" + (p[4][1][0] + p[4][2][0]).toFixed(2) + " m",
realIndex: -1, customIndex: i, custom: true, realIndex: -1, customIndex: i, custom: true,
isPreferred: (pref === p[0]) isPreferred: (pref === p[0])
@@ -183,6 +184,12 @@ Page {
} }
var port = [name, "", lat, lon, cost, flag] var port = [name, "", lat, lon, cost, flag]
customPorts.push(port) customPorts.push(port)
// voce del porto di riferimento con la distanza dalla città cercata
if (np.port !== null && np.port[0].toLowerCase() !== name.toLowerCase()) {
customPorts.push([np.port[0],
"(" + Math.round(np.km) + " km da " + name + ")",
np.port[2], np.port[3], np.port[4].slice(), np.port[5] || ""])
}
rebuild() rebuild()
geoMsg.text = qsTr("Found %1 (via %2)").arg(name).arg(src) geoMsg.text = qsTr("Found %1 (via %2)").arg(name).arg(src)
geoMsg.visible = true geoMsg.visible = true
@@ -246,6 +253,15 @@ Page {
geoMsg.text = qsTr("Searching…") geoMsg.text = qsTr("Searching…")
geoMsg.visible = true geoMsg.visible = true
geoMsg.color = Theme.secondaryColor geoMsg.color = Theme.secondaryColor
// la città cercata è già un porto noto? aprilo direttamente
var ql = q.toLowerCase()
for (var i = 0; i < Tides.PORTS.length; i++) {
if (Tides.PORTS[i][0].toLowerCase() === ql) {
geoMsg.visible = false
page.openDetail(Tides.PORTS[i], i, false)
return
}
}
var loc = Tides.findCityLocal(q) var loc = Tides.findCityLocal(q)
if (loc) { if (loc) {
geoFound(loc[0], loc[2], loc[3], qsTr("local dataset")) geoFound(loc[0], loc[2], loc[3], qsTr("local dataset"))