mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-17 11:28:07 +00:00
Remove storing core from GUI on fields. Core should never be stored in GUI because they are managed by CPP and not QML. Fix crashes on account settings. Add missing exception verbosing.
55 lines
1.3 KiB
QML
55 lines
1.3 KiB
QML
import QtQuick
|
|
import QtQuick.Controls.Basic
|
|
import QtQuick.Layouts
|
|
import Linphone
|
|
|
|
RowLayout {
|
|
id:mainItem
|
|
property string titleText
|
|
property string subTitleText
|
|
property string propertyName
|
|
property var propertyOwner
|
|
property var propertyOwnerGui
|
|
property bool enabled: true
|
|
spacing : 20 * DefaultStyle.dp
|
|
Layout.minimumHeight: 32 * DefaultStyle.dp
|
|
signal checkedChanged(bool checked)
|
|
|
|
function setChecked(value) {
|
|
switchButton.checked = value
|
|
}
|
|
|
|
ColumnLayout {
|
|
Text {
|
|
text: titleText
|
|
font: Typography.p2l
|
|
wrapMode: Text.WordWrap
|
|
color: DefaultStyle.main2_600
|
|
Layout.fillWidth: true
|
|
}
|
|
Text {
|
|
text: subTitleText
|
|
font: Typography.p1
|
|
wrapMode: Text.WordWrap
|
|
visible: subTitleText.length > 0
|
|
color: DefaultStyle.main2_600
|
|
Layout.fillWidth: true
|
|
}
|
|
}
|
|
Switch {
|
|
id: switchButton
|
|
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
|
checked: propertyOwnerGui ? propertyOwnerGui.core[mainItem.propertyName]
|
|
: propertyOwner ? propertyOwner[mainItem.propertyName] : false
|
|
enabled: mainItem.enabled
|
|
onCheckedChanged: mainItem.checkedChanged(checked)
|
|
onToggled: binding.when = true
|
|
}
|
|
Binding {
|
|
id: binding
|
|
target: propertyOwnerGui ? propertyOwnerGui : propertyOwner ? propertyOwner : null
|
|
property: mainItem.propertyName
|
|
value: switchButton.checked
|
|
when: false
|
|
}
|
|
}
|