2021-10-06 09:16:39 +00:00
import QtQuick 2.13
import QtQuick . Controls 2.13
import QtQuick . Layouts 1.13
import utils 1.0
2022-04-01 10:30:55 +00:00
import shared . panels 1.0
import shared . popups 1.0
2021-10-06 09:16:39 +00:00
import StatusQ . Core 0.1
import StatusQ . Core . Theme 0.1
import StatusQ . Components 0.1
import "../popups"
2021-12-30 12:39:47 +00:00
import "../stores"
2021-10-06 09:16:39 +00:00
Item {
2022-04-01 10:30:55 +00:00
id: root
2021-10-06 09:16:39 +00:00
2021-12-30 12:39:47 +00:00
property LanguageStore languageStore
2021-12-09 13:28:02 +00:00
property int profileContentWidth
2022-04-01 10:30:55 +00:00
QtObject {
id: d
property int margins: 64
property int zOnTop: 100
function setViewIdleState ( ) {
languagePicker . close ( )
}
2021-10-06 09:16:39 +00:00
}
2022-04-01 10:30:55 +00:00
z: d . zOnTop
Layout.fillHeight: true
Layout.fillWidth: true
clip: true
onVisibleChanged: { if ( ! visible ) d . setViewIdleState ( ) }
Component.onCompleted: { root . languageStore . initializeLanguageModel ( ) }
Column {
z: d . zOnTop
width: 560 - ( 2 * Style . current . padding )
anchors.margins: d . margins
2021-10-06 09:16:39 +00:00
anchors.top: parent . top
anchors.bottom: parent . bottom
2022-04-01 10:30:55 +00:00
anchors.left: parent . left
spacing: 45
2021-10-06 09:16:39 +00:00
2022-04-01 10:30:55 +00:00
StatusBaseText {
id: title
text: qsTr ( "Language & Currency" )
font.weight: Font . Bold
font.pixelSize: 22
color: Theme . palette . directColor1
anchors.bottomMargin: Style . current . padding
}
2021-10-06 09:16:39 +00:00
2022-04-01 10:30:55 +00:00
Item {
id: language
2021-10-06 09:16:39 +00:00
width: parent . width
2022-04-01 10:30:55 +00:00
height: 38
z: d . zOnTop
2021-10-06 09:16:39 +00:00
2022-04-01 10:30:55 +00:00
StatusBaseText {
text: qsTr ( "Language" )
anchors.left: parent . left
font.pixelSize: 15
color: Theme . palette . directColor1
}
StatusListPicker {
id: languagePicker
property string newKey
Timer {
id: pause
interval: 100
onTriggered: {
// changeLocale function operation blocks a little bit the UI so getting around it with a small pause (timer) in order to get the desired visual behavior
root . languageStore . changeLocale ( languagePicker . newKey )
2021-10-06 09:16:39 +00:00
}
2022-04-01 10:30:55 +00:00
}
z: d . zOnTop
width: 104
height: parent . height
anchors.right: parent . right
inputList: root . languageStore . languageModel
searchText: qsTr ( "Search Languages" )
onItemPickerChanged: {
if ( selected && localAppSettings . locale !== key ) {
// TEMPORARY: It should be removed as it is only used in Linux OS but it must be investigated how to change language in execution time, as well, in Linux (will be addressed in another task)
if ( Qt . platform . os === Constants . linux ) {
linuxConfirmationDialog . active = true
linuxConfirmationDialog . item . newLocale = key
linuxConfirmationDialog . item . open ( )
}
else {
languagePicker . newKey = key
pause . start ( )
}
}
}
2021-10-06 09:16:39 +00:00
}
}
2022-04-01 10:30:55 +00:00
Separator {
anchors.left: parent . left
anchors.leftMargin: - Style . current . padding
anchors.right: parent . right
anchors.rightMargin: - Style . current . padding
}
}
// TEMPORARY: It should be removed as it is only used in Linux OS but it must be investigated how to change language in execution time, as well, in Linux (will be addressed in another task)
Loader {
id: linuxConfirmationDialog
active: false
sourceComponent: ConfirmationDialog {
property string newLocale
header.title: qsTr ( "Change language" )
confirmationText: qsTr ( "Display language has been changed. You must restart the application for changes to take effect." )
confirmButtonLabel: qsTr ( "Close the app now" )
onConfirmButtonClicked: {
root . languageStore . changeLocale ( newLocale )
loader . active = false
Qt . quit ( )
}
}
}
// Outsite area
MouseArea {
anchors.fill: parent
onClicked: { d . setViewIdleState ( ) }
2021-10-06 09:16:39 +00:00
}
}