mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-15 17:16:26 +00:00
9374be5857
Fixes #670. Component spec based on https://www.notion.so/emizzle/Wallet-transaction-components-2003b78a8d0d41c4ab3d21eb2496fb20. Changes the current Select shared component to a model databound component. This means we can bind directly to `QAbstractListModel`'s coming from Nim instead of needing manipulating the data in to javascript objects. The changes to the Select component will be used for the upcoming Asset selector shared component.
70 lines
2.1 KiB
QML
70 lines
2.1 KiB
QML
import QtQuick 2.13
|
|
import QtQuick.Controls 2.13
|
|
import QtQuick.Layouts 1.13
|
|
import "../../../../imports"
|
|
import "../../../../shared"
|
|
import "./Data/locales.js" as Locales_JSON
|
|
|
|
Item {
|
|
id: languageContainer
|
|
Layout.fillHeight: true
|
|
Layout.fillWidth: true
|
|
|
|
StyledText {
|
|
id: title
|
|
//% "Language settings"
|
|
text: qsTrId("language-settings")
|
|
anchors.left: parent.left
|
|
anchors.leftMargin: 24
|
|
anchors.top: parent.top
|
|
anchors.topMargin: 24
|
|
font.weight: Font.Bold
|
|
font.pixelSize: 20
|
|
}
|
|
|
|
RowLayout {
|
|
property string currentLocale: appSettings.locale
|
|
id: languageSetting
|
|
anchors.top: title.bottom
|
|
anchors.topMargin: 20
|
|
anchors.left: parent.left
|
|
anchors.leftMargin: 24
|
|
StyledText {
|
|
text: qsTr("Language")
|
|
}
|
|
Select {
|
|
id: select
|
|
selectedText: languageSetting.currentLocale
|
|
anchors.right: undefined
|
|
anchors.left: undefined
|
|
width: 100
|
|
Layout.leftMargin: Style.current.padding
|
|
model: Locales_JSON.locales
|
|
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
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|