142 lines
4.8 KiB
QML
142 lines
4.8 KiB
QML
import QtQuick 2.0
|
|
import Sailfish.Silica 1.0
|
|
import "../js/tides.js" as Tides
|
|
|
|
Page {
|
|
id: page
|
|
|
|
PageHeader { title: qsTr("Settings") }
|
|
|
|
SilicaFlickable {
|
|
anchors.fill: parent
|
|
contentHeight: col.height
|
|
|
|
Column {
|
|
id: col
|
|
width: parent.width
|
|
|
|
ComboBox {
|
|
id: langBox
|
|
label: qsTr("Language")
|
|
currentIndex: appSettings.language === "it" ? 2
|
|
: (appSettings.language === "en" ? 1 : 0)
|
|
menu: ContextMenu {
|
|
MenuItem {
|
|
text: qsTr("System")
|
|
onClicked: appSettings.language = "system"
|
|
}
|
|
MenuItem {
|
|
text: "English"
|
|
onClicked: appSettings.language = "en"
|
|
}
|
|
MenuItem {
|
|
text: "Italiano"
|
|
onClicked: appSettings.language = "it"
|
|
}
|
|
}
|
|
}
|
|
|
|
Label {
|
|
text: qsTr("Language changes on restart")
|
|
color: Theme.secondaryColor
|
|
font.pixelSize: Theme.fontSizeSmall
|
|
anchors.left: parent.left
|
|
anchors.leftMargin: Theme.horizontalPageMargin
|
|
anchors.right: parent.right
|
|
anchors.rightMargin: Theme.horizontalPageMargin
|
|
wrapMode: Text.Wrap
|
|
}
|
|
|
|
Item { width: parent.width; height: Theme.paddingMedium }
|
|
|
|
ComboBox {
|
|
id: unitBox
|
|
label: qsTr("Units")
|
|
currentIndex: appSettings.unit === "ft" ? 1 : 0
|
|
menu: ContextMenu {
|
|
MenuItem {
|
|
text: qsTr("metres")
|
|
onClicked: appSettings.unit = "m"
|
|
}
|
|
MenuItem {
|
|
text: qsTr("feet")
|
|
onClicked: appSettings.unit = "ft"
|
|
}
|
|
}
|
|
}
|
|
|
|
ComboBox {
|
|
id: daysBox
|
|
label: qsTr("Default range")
|
|
currentIndex: Math.max(0, appSettings.days - 1)
|
|
menu: ContextMenu {
|
|
MenuItem {
|
|
text: qsTr("24 h")
|
|
onClicked: appSettings.days = 1
|
|
}
|
|
MenuItem {
|
|
text: qsTr("48 h")
|
|
onClicked: appSettings.days = 2
|
|
}
|
|
MenuItem {
|
|
text: qsTr("72 h")
|
|
onClicked: appSettings.days = 3
|
|
}
|
|
}
|
|
}
|
|
|
|
ComboBox {
|
|
id: prefBox
|
|
label: qsTr("Preferred port")
|
|
currentIndex: prefIndex()
|
|
menu: ContextMenu {
|
|
MenuItem {
|
|
text: qsTr("None")
|
|
onClicked: appSettings.preferredPort = ""
|
|
}
|
|
Repeater {
|
|
model: Tides.PORTS.length
|
|
delegate: MenuItem {
|
|
text: Tides.PORTS[index][0]
|
|
onClicked: appSettings.preferredPort = Tides.PORTS[index][0]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function prefIndex() {
|
|
var p = appSettings.preferredPort
|
|
if (p === "") return 0
|
|
for (var i = 0; i < Tides.PORTS.length; i++)
|
|
if (Tides.PORTS[i][0] === p) return i + 1
|
|
return 0
|
|
}
|
|
|
|
SectionHeader { text: qsTr("About") }
|
|
|
|
Label {
|
|
text: "Maree " + appVersion + "\n" + qsTr("Universal tide predictions")
|
|
color: Theme.secondaryColor
|
|
font.pixelSize: Theme.fontSizeSmall
|
|
anchors.left: parent.left
|
|
anchors.leftMargin: Theme.horizontalPageMargin
|
|
anchors.right: parent.right
|
|
anchors.rightMargin: Theme.horizontalPageMargin
|
|
wrapMode: Text.Wrap
|
|
}
|
|
Label {
|
|
text: qsTr("Harmonic model: M2, S2, N2, K1, O1, P1, K2 — known ports or synthetic estimate from lat/lon. Not for navigation.")
|
|
color: Theme.secondaryColor
|
|
font.pixelSize: Theme.fontSizeSmall
|
|
anchors.left: parent.left
|
|
anchors.leftMargin: Theme.horizontalPageMargin
|
|
anchors.right: parent.right
|
|
anchors.rightMargin: Theme.horizontalPageMargin
|
|
wrapMode: Text.Wrap
|
|
}
|
|
|
|
Item { width: parent.width; height: Theme.paddingLarge }
|
|
}
|
|
}
|
|
}
|