From 9e7c97786a36d265f4fa9bdf16e15dfad26e36f6 Mon Sep 17 00:00:00 2001 From: Carlo Baratto Date: Wed, 2 Sep 2026 11:46:50 +0200 Subject: [PATCH] =?UTF-8?q?ricerca=20citt=C3=A0:=20voce=20del=20porto=20di?= =?UTF-8?q?=20riferimento=20con=20distanza=20km,=20apertura=20diretta=20se?= =?UTF-8?q?=20la=20citt=C3=A0=20=C3=A8=20un=20porto;=20eventi:=20layout=20?= =?UTF-8?q?sequenziale=20kind=E2=86=92data=E2=86=92altezza=20senza=20sovra?= =?UTF-8?q?pposizioni?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- qml/pages/DetailPage.qml | 9 +++++++-- qml/pages/MainPage.qml | 18 +++++++++++++++++- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/qml/pages/DetailPage.qml b/qml/pages/DetailPage.qml index 19ed09b..b41175e 100644 --- a/qml/pages/DetailPage.qml +++ b/qml/pages/DetailPage.qml @@ -237,19 +237,24 @@ Page { width: parent.width height: Theme.itemSizeSmall Label { + id: kindLbl text: model.kind === "high" ? "▲ " + qsTr("High") : "▼ " + qsTr("Low") color: model.kind === "high" ? Theme.highlightColor : Theme.errorColor font.pixelSize: Theme.fontSizeSmall anchors.left: parent.left anchors.leftMargin: Theme.horizontalPageMargin anchors.verticalCenter: parent.verticalCenter + width: 110 } Label { text: model.date + " " + model.time color: Theme.primaryColor - anchors.left: parent.left - anchors.leftMargin: Theme.horizontalPageMargin + 100 + anchors.left: kindLbl.right + anchors.leftMargin: Theme.paddingSmall + anchors.right: parent.right + anchors.rightMargin: Theme.horizontalPageMargin + 70 anchors.verticalCenter: parent.verticalCenter + truncationMode: TruncationMode.Fade } Label { text: model.height diff --git a/qml/pages/MainPage.qml b/qml/pages/MainPage.qml index abb88d0..d54f61d 100644 --- a/qml/pages/MainPage.qml +++ b/qml/pages/MainPage.qml @@ -146,7 +146,8 @@ Page { if (f !== "" && p[0].toLowerCase().indexOf(f) === -1) continue 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", realIndex: -1, customIndex: i, custom: true, isPreferred: (pref === p[0]) @@ -183,6 +184,12 @@ Page { } var port = [name, "", lat, lon, cost, flag] 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() geoMsg.text = qsTr("Found %1 (via %2)").arg(name).arg(src) geoMsg.visible = true @@ -246,6 +253,15 @@ Page { geoMsg.text = qsTr("Searching…") geoMsg.visible = true 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) if (loc) { geoFound(loc[0], loc[2], loc[3], qsTr("local dataset"))