Pascal Precht aeedc87368 feat: introduce global settings
This commit introces global settings that apply across accounts used
inside the application. This is useful when settings like the selected
locale should b the same across all accounts.

Closes #2144
2021-04-19 13:53:14 +02:00

62 lines
1.8 KiB
QML

import QtQuick 2.13
import QtQuick.Controls 2.13
import "../../../../imports"
import "../../../../shared"
import "../../../../shared/status"
import "./Data/locales.js" as Locales_JSON
ModalPopup {
id: popup
//% "Language"
title: qsTrId("Language")
onClosed: {
destroy()
}
Item {
anchors.fill: parent
ButtonGroup {
id: languageGroup
}
ScrollView {
width: parent.width
anchors.top: parent.top
anchors.topMargin: Style.current.padding
anchors.bottom: parent.bottom
anchors.bottomMargin: Style.current.bigPadding
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
ScrollBar.vertical.policy: ScrollBar.AlwaysOn
clip: true
ListView {
id: languagesListView
anchors.fill: parent
anchors.rightMargin: Style.current.padding
anchors.leftMargin: Style.current.padding
model: Locales_JSON.locales
spacing: 0
delegate: Component {
StatusRadioButtonRow {
height: 64
anchors.rightMargin: 0
text: modelData.name
buttonGroup: languageGroup
checked: globalSettings.locale === modelData.locale
onRadioCheckedChanged: {
if (checked && globalSettings.locale !== modelData.locale) {
profileModel.changeLocale(modelData.locale)
globalSettings.locale = modelData.locale
}
}
}
}
}
}
}
}