cover: preferito custom (comune) con coordinate salvate (preferredLat/Lon); riga eventi: colonna Alta/Bassa con fade (mai sovrapposta)

This commit is contained in:
2026-09-02 12:41:50 +02:00
parent 4794f5d467
commit 9765250531
5 changed files with 69 additions and 2 deletions
+10 -1
View File
@@ -244,7 +244,8 @@ Page {
anchors.left: parent.left
anchors.leftMargin: Theme.horizontalPageMargin
anchors.verticalCenter: parent.verticalCenter
width: 110
width: 130
truncationMode: TruncationMode.Fade
}
Label {
text: model.date + " " + model.time
@@ -366,6 +367,14 @@ Page {
visible: page.port && page.port[0] !== appSettings.preferredPort
onClicked: {
appSettings.preferredPort = page.port[0]
// se è un comune (custom) salva le coordinate per la cover
if (page.custom) {
appSettings.preferredLat = page.port[2]
appSettings.preferredLon = page.port[3]
} else {
appSettings.preferredLat = -1
appSettings.preferredLon = -1
}
pageStack.replace(Qt.resolvedUrl("MainPage.qml"))
}
}
+13
View File
@@ -265,12 +265,25 @@ Page {
updateList()
var pref = appSettings.preferredPort
if (pref !== "") {
var found = false
for (var i = 0; i < Tides.PORTS.length; i++) {
if (Tides.PORTS[i][0] === pref) {
page.openDetail(Tides.PORTS[i], i, false)
found = true
break
}
}
// preferito custom (comune): ricostruisci e apri il dettaglio
if (!found && appSettings.preferredLat >= 0) {
var lat = appSettings.preferredLat
var lon = appSettings.preferredLon
var np = Tides.nearestPort(lat, lon)
var cost = np.km < 222 ? np.port[4].slice()
: Tides.synthConst(lat, lon)
page.openDetail([pref, qsTr("Italy"), lat, lon, cost,
np.km < 222 ? "near:" + np.port[0] : "synth"],
-1, true)
}
}
}
}