2020-06-17 19:18:31 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
import QtQuick.Layouts 1.13
|
2020-05-27 21:28:25 +00:00
|
|
|
import "../../../../imports"
|
2020-06-19 18:06:58 +00:00
|
|
|
import "../../../../shared"
|
2020-07-21 21:03:22 +00:00
|
|
|
import "./Data/locales.js" as Locales_JSON
|
2020-05-27 21:28:25 +00:00
|
|
|
|
|
|
|
Item {
|
|
|
|
id: languageContainer
|
|
|
|
Layout.fillHeight: true
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
2021-03-18 09:33:39 +00:00
|
|
|
Item {
|
|
|
|
width: contentMaxWidth
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
2020-07-30 05:18:54 +00:00
|
|
|
|
2021-03-18 09:33:39 +00:00
|
|
|
RowLayout {
|
|
|
|
property string currentLocale: appSettings.locale
|
|
|
|
id: languageSetting
|
2021-03-24 17:44:35 +00:00
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: 24
|
2021-03-18 09:33:39 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: 24
|
|
|
|
StyledText {
|
|
|
|
//% "Language"
|
|
|
|
text: qsTrId("language")
|
|
|
|
}
|
|
|
|
Select {
|
|
|
|
id: select
|
|
|
|
anchors.right: undefined
|
|
|
|
anchors.left: undefined
|
|
|
|
width: 100
|
|
|
|
Layout.leftMargin: Style.current.padding
|
|
|
|
model: Locales_JSON.locales
|
|
|
|
selectedItemView: Item {
|
|
|
|
anchors.fill: parent
|
2020-07-30 05:18:54 +00:00
|
|
|
StyledText {
|
2021-03-18 09:33:39 +00:00
|
|
|
id: selectedTextField
|
|
|
|
text: languageSetting.currentLocale
|
2020-07-30 05:18:54 +00:00
|
|
|
anchors.left: parent.left
|
2021-03-18 09:33:39 +00:00
|
|
|
anchors.leftMargin: Style.current.padding
|
2020-07-30 05:18:54 +00:00
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
2021-03-18 09:33:39 +00:00
|
|
|
font.pixelSize: 15
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
height: 22
|
2020-07-30 05:18:54 +00:00
|
|
|
}
|
2021-03-18 09:33:39 +00:00
|
|
|
}
|
|
|
|
menu.delegate: Component {
|
|
|
|
MenuItem {
|
|
|
|
id: menuItem
|
|
|
|
height: itemText.height + 4
|
|
|
|
width: parent.width
|
|
|
|
padding: 10
|
|
|
|
onTriggered: function () {
|
|
|
|
const locale = Locales_JSON.locales[index]
|
|
|
|
profileModel.changeLocale(locale)
|
|
|
|
appSettings.locale = locale
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: itemText
|
|
|
|
text: Locales_JSON.locales[index]
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: 5
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
}
|
|
|
|
background: Rectangle {
|
|
|
|
color: menuItem.highlighted ? Style.current.backgroundHover : Style.current.transparent
|
|
|
|
}
|
2020-07-30 05:18:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-07-21 21:03:22 +00:00
|
|
|
}
|
|
|
|
}
|
2020-05-27 21:28:25 +00:00
|
|
|
}
|