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"))