feat: impl lang & region page
This commit is contained in:
parent
6f51a1a561
commit
c006377c57
2 changed files with 183 additions and 0 deletions
|
|
@ -124,6 +124,14 @@ QtObject {
|
||||||
ServicesPage {}
|
ServicesPage {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
Component {
|
||||||
|
// Language & region
|
||||||
|
StackPage {
|
||||||
|
Component {
|
||||||
|
LanguageAndRegion {}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
||||||
175
modules/nexus/pages/LanguageAndRegion.qml
Normal file
175
modules/nexus/pages/LanguageAndRegion.qml
Normal file
|
|
@ -0,0 +1,175 @@
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import Caelestia.Config
|
||||||
|
import qs.components
|
||||||
|
import qs.components.controls
|
||||||
|
import qs.services
|
||||||
|
import qs.modules.nexus.common
|
||||||
|
|
||||||
|
PageBase {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
// Temperature units (index 0 = Celsius, 1 = Fahrenheit — matches Weather.formatTemp)
|
||||||
|
readonly property list<MenuItem> tempItems: [
|
||||||
|
MenuItem {
|
||||||
|
text: "°C"
|
||||||
|
},
|
||||||
|
MenuItem {
|
||||||
|
text: "°F"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
// Clock format (index 0 = 24-hour, 1 = 12-hour — matches Time.useTwelveHourClock)
|
||||||
|
readonly property list<MenuItem> clockItems: [
|
||||||
|
MenuItem {
|
||||||
|
text: qsTr("24-hour")
|
||||||
|
},
|
||||||
|
MenuItem {
|
||||||
|
text: qsTr("12-hour")
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
title: qsTr("Language & region")
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
anchors.top: parent.top
|
||||||
|
width: root.cappedWidth
|
||||||
|
spacing: Tokens.spacing.extraSmall / 2
|
||||||
|
|
||||||
|
// Language
|
||||||
|
SectionHeader {
|
||||||
|
first: true
|
||||||
|
text: qsTr("Language")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read-only: the shell follows the system locale (no in-shell translations yet)
|
||||||
|
ConnectedRect {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
first: true
|
||||||
|
last: true
|
||||||
|
implicitHeight: localeLayout.implicitHeight + localeLayout.anchors.margins * 2
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
id: localeLayout
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: Tokens.padding.medium
|
||||||
|
anchors.leftMargin: Tokens.padding.largeIncreased
|
||||||
|
anchors.rightMargin: Tokens.padding.largeIncreased
|
||||||
|
spacing: Tokens.spacing.medium
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
text: qsTr("System language")
|
||||||
|
font: Tokens.font.body.small
|
||||||
|
elide: Text.ElideRight
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
text: qsTr("Follows your system locale (%1)").arg(Qt.locale().name)
|
||||||
|
color: Colours.palette.m3outline
|
||||||
|
font: Tokens.font.label.small
|
||||||
|
elide: Text.ElideRight
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: Qt.locale().nativeLanguageName || Qt.locale().name
|
||||||
|
color: Colours.palette.m3onSurfaceVariant
|
||||||
|
font: Tokens.font.body.small
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Weather
|
||||||
|
SectionHeader {
|
||||||
|
text: qsTr("Weather")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Placeholder until the map-based location picker lands
|
||||||
|
ConnectedRect {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
first: true
|
||||||
|
last: true
|
||||||
|
implicitHeight: comingSoon.implicitHeight + Tokens.padding.extraLarge * 2
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
id: comingSoon
|
||||||
|
|
||||||
|
anchors.centerIn: parent
|
||||||
|
width: parent.width - Tokens.padding.largeIncreased * 2
|
||||||
|
spacing: Tokens.padding.extraSmall
|
||||||
|
|
||||||
|
MaterialIcon {
|
||||||
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
text: "map"
|
||||||
|
color: Colours.palette.m3outlineVariant
|
||||||
|
font: Tokens.font.icon.extraLarge
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
text: qsTr("Location picker coming soon")
|
||||||
|
color: Colours.palette.m3outlineVariant
|
||||||
|
font: Tokens.font.title.small
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
text: qsTr("Choose your weather location on a map in a future update")
|
||||||
|
color: Colours.palette.m3outlineVariant
|
||||||
|
font: Tokens.font.body.small
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Units
|
||||||
|
SectionHeader {
|
||||||
|
text: qsTr("Units")
|
||||||
|
}
|
||||||
|
|
||||||
|
SelectRow {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
first: true
|
||||||
|
label: qsTr("Temperature")
|
||||||
|
subtext: qsTr("Units for weather temperatures")
|
||||||
|
menuItems: root.tempItems
|
||||||
|
active: root.tempItems[GlobalConfig.services.useFahrenheit ? 1 : 0]
|
||||||
|
onSelected: item => GlobalConfig.services.useFahrenheit = root.tempItems.indexOf(item) === 1
|
||||||
|
}
|
||||||
|
|
||||||
|
SelectRow {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
last: true
|
||||||
|
label: qsTr("System temperatures")
|
||||||
|
subtext: qsTr("Units for CPU and GPU temperatures")
|
||||||
|
menuItems: root.tempItems
|
||||||
|
active: root.tempItems[GlobalConfig.services.useFahrenheitPerformance ? 1 : 0]
|
||||||
|
onSelected: item => GlobalConfig.services.useFahrenheitPerformance = root.tempItems.indexOf(item) === 1
|
||||||
|
}
|
||||||
|
|
||||||
|
// Time & date
|
||||||
|
SectionHeader {
|
||||||
|
text: qsTr("Time & date")
|
||||||
|
}
|
||||||
|
|
||||||
|
SelectRow {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
first: true
|
||||||
|
last: true
|
||||||
|
label: qsTr("Clock format")
|
||||||
|
subtext: qsTr("How times are shown across the shell")
|
||||||
|
menuItems: root.clockItems
|
||||||
|
active: root.clockItems[GlobalConfig.services.useTwelveHourClock ? 1 : 0]
|
||||||
|
onSelected: item => GlobalConfig.services.useTwelveHourClock = root.clockItems.indexOf(item) === 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue