Use native QML switches

This commit is contained in:
Loren Burkholder 2023-03-01 11:11:06 -05:00
parent b0e4cce065
commit 5640f10294
13 changed files with 30 additions and 30 deletions

View file

@ -131,7 +131,7 @@ Item {
Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
Layout.fillWidth: true Layout.fillWidth: true
ToggleButton { Switch {
id: storeSecretsOnline id: storeSecretsOnline
checked: true checked: true
@ -161,7 +161,7 @@ Item {
Layout.fillWidth: true Layout.fillWidth: true
visible: storeSecretsOnline.checked visible: storeSecretsOnline.checked
ToggleButton { Switch {
id: usePassword id: usePassword
checked: false checked: false
@ -197,7 +197,7 @@ Item {
Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
Layout.fillWidth: true Layout.fillWidth: true
ToggleButton { Switch {
id: useOnlineKeyBackup id: useOnlineKeyBackup
checked: true checked: true

View file

@ -84,7 +84,7 @@ ApplicationWindow {
} }
} }
ToggleButton { Switch {
checked: model.allowed checked: model.allowed
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
onCheckedChanged: model.allowed = checked onCheckedChanged: model.allowed = checked

View file

@ -91,7 +91,7 @@ ApplicationWindow {
text: qsTr("Encryption") text: qsTr("Encryption")
color: Nheko.colors.text color: Nheko.colors.text
} }
ToggleButton { Switch {
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
id: encryption id: encryption
checked: otherUserHasE2ee checked: otherUserHasE2ee

View file

@ -90,7 +90,7 @@ ApplicationWindow {
ToolTip.text: qsTr("Public rooms can be joined by anyone; private rooms need explicit invites.") ToolTip.text: qsTr("Public rooms can be joined by anyone; private rooms need explicit invites.")
ToolTip.delay: Nheko.tooltipDelay ToolTip.delay: Nheko.tooltipDelay
} }
ToggleButton { Switch {
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
Layout.preferredWidth: implicitWidth Layout.preferredWidth: implicitWidth
id: isPublic id: isPublic
@ -109,7 +109,7 @@ ApplicationWindow {
ToolTip.text: qsTr("All invitees are given the same power level as the creator") ToolTip.text: qsTr("All invitees are given the same power level as the creator")
ToolTip.delay: Nheko.tooltipDelay ToolTip.delay: Nheko.tooltipDelay
} }
ToggleButton { Switch {
visible: !space visible: !space
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
Layout.preferredWidth: implicitWidth Layout.preferredWidth: implicitWidth
@ -130,7 +130,7 @@ ApplicationWindow {
ToolTip.text: qsTr("Caution: Encryption cannot be disabled") ToolTip.text: qsTr("Caution: Encryption cannot be disabled")
ToolTip.delay: Nheko.tooltipDelay ToolTip.delay: Nheko.tooltipDelay
} }
ToggleButton { Switch {
visible: !space visible: !space
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
Layout.preferredWidth: implicitWidth Layout.preferredWidth: implicitWidth

View file

@ -79,7 +79,7 @@ ApplicationWindow {
} }
} }
ToggleButton { Switch {
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
checked: !hiddenEvents.hiddenEvents.includes(MtxEvent.Member) checked: !hiddenEvents.hiddenEvents.includes(MtxEvent.Member)
onToggled: hiddenEvents.toggle(MtxEvent.Member) onToggled: hiddenEvents.toggle(MtxEvent.Member)
@ -96,7 +96,7 @@ ApplicationWindow {
} }
} }
ToggleButton { Switch {
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
checked: !hiddenEvents.hiddenEvents.includes(MtxEvent.PowerLevels) checked: !hiddenEvents.hiddenEvents.includes(MtxEvent.PowerLevels)
onToggled: hiddenEvents.toggle(MtxEvent.PowerLevels) onToggled: hiddenEvents.toggle(MtxEvent.PowerLevels)
@ -107,7 +107,7 @@ ApplicationWindow {
Layout.fillWidth: true Layout.fillWidth: true
} }
ToggleButton { Switch {
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
checked: !hiddenEvents.hiddenEvents.includes(MtxEvent.Sticker) checked: !hiddenEvents.hiddenEvents.includes(MtxEvent.Sticker)
onToggled: hiddenEvents.toggle(MtxEvent.Sticker) onToggled: hiddenEvents.toggle(MtxEvent.Sticker)

View file

@ -206,7 +206,7 @@ ApplicationWindow {
text: qsTr("Use as Emoji") text: qsTr("Use as Emoji")
} }
ToggleButton { Switch {
checked: imagePack.isEmotePack checked: imagePack.isEmotePack
onCheckedChanged: imagePack.isEmotePack = checked onCheckedChanged: imagePack.isEmotePack = checked
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
@ -219,7 +219,7 @@ ApplicationWindow {
text: qsTr("Use as Sticker") text: qsTr("Use as Sticker")
} }
ToggleButton { Switch {
checked: imagePack.isStickerPack checked: imagePack.isStickerPack
onCheckedChanged: imagePack.isStickerPack = checked onCheckedChanged: imagePack.isStickerPack = checked
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
@ -276,7 +276,7 @@ ApplicationWindow {
text: qsTr("Use as Emoji") text: qsTr("Use as Emoji")
} }
ToggleButton { Switch {
checked: imagePack.data(imagePack.index(currentImageIndex, 0), SingleImagePackModel.IsEmote) checked: imagePack.data(imagePack.index(currentImageIndex, 0), SingleImagePackModel.IsEmote)
onCheckedChanged: imagePack.setData(imagePack.index(currentImageIndex, 0), checked, SingleImagePackModel.IsEmote) onCheckedChanged: imagePack.setData(imagePack.index(currentImageIndex, 0), checked, SingleImagePackModel.IsEmote)
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
@ -289,7 +289,7 @@ ApplicationWindow {
text: qsTr("Use as Sticker") text: qsTr("Use as Sticker")
} }
ToggleButton { Switch {
checked: imagePack.data(imagePack.index(currentImageIndex, 0), SingleImagePackModel.IsSticker) checked: imagePack.data(imagePack.index(currentImageIndex, 0), SingleImagePackModel.IsSticker)
onCheckedChanged: imagePack.setData(imagePack.index(currentImageIndex, 0), checked, SingleImagePackModel.IsSticker) onCheckedChanged: imagePack.setData(imagePack.index(currentImageIndex, 0), checked, SingleImagePackModel.IsSticker)
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight

View file

@ -185,7 +185,7 @@ ApplicationWindow {
text: qsTr("Enable globally") text: qsTr("Enable globally")
} }
ToggleButton { Switch {
ToolTip.text: qsTr("Enables this pack to be used in all rooms") ToolTip.text: qsTr("Enables this pack to be used in all rooms")
checked: currentPack ? currentPack.isGloballyEnabled : false checked: currentPack ? currentPack.isGloballyEnabled : false
onCheckedChanged: currentPack.isGloballyEnabled = checked onCheckedChanged: currentPack.isGloballyEnabled = checked

View file

@ -139,7 +139,7 @@ ApplicationWindow {
} }
} }
ToggleButton { Switch {
id: searchOnServer id: searchOnServer
checked: false checked: false
onClicked: userSearch.model.setSearchString(inviteeEntry.text) onClicked: userSearch.model.setSearchString(inviteeEntry.text)

View file

@ -58,7 +58,7 @@ ApplicationWindow {
color: Nheko.colors.text color: Nheko.colors.text
} }
ToggleButton { Switch {
checked: editingModel.spaces.applyToChildren checked: editingModel.spaces.applyToChildren
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
onCheckedChanged: editingModel.spaces.applyToChildren = checked onCheckedChanged: editingModel.spaces.applyToChildren = checked
@ -70,7 +70,7 @@ ApplicationWindow {
color: Nheko.colors.text color: Nheko.colors.text
} }
ToggleButton { Switch {
checked: editingModel.spaces.overwriteDiverged checked: editingModel.spaces.overwriteDiverged
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
onCheckedChanged: editingModel.spaces.overwriteDiverged = checked onCheckedChanged: editingModel.spaces.overwriteDiverged = checked
@ -122,7 +122,7 @@ ApplicationWindow {
} }
} }
ToggleButton { Switch {
checked: model.applyPermissions checked: model.applyPermissions
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
onCheckedChanged: model.applyPermissions = checked onCheckedChanged: model.applyPermissions = checked

View file

@ -292,7 +292,7 @@ ApplicationWindow {
color: Nheko.colors.text color: Nheko.colors.text
} }
ToggleButton { Switch {
id: publicRoomButton id: publicRoomButton
enabled: roomSettings.canChangeJoinRules enabled: roomSettings.canChangeJoinRules
@ -307,7 +307,7 @@ ApplicationWindow {
visible: knockingButton.visible visible: knockingButton.visible
} }
ToggleButton { Switch {
id: knockingButton id: knockingButton
visible: !publicRoomButton.checked visible: !publicRoomButton.checked
@ -326,7 +326,7 @@ ApplicationWindow {
visible: restrictedButton.visible visible: restrictedButton.visible
} }
ToggleButton { Switch {
id: restrictedButton id: restrictedButton
visible: !publicRoomButton.checked visible: !publicRoomButton.checked
@ -363,7 +363,7 @@ ApplicationWindow {
color: Nheko.colors.text color: Nheko.colors.text
} }
ToggleButton { Switch {
id: guestAccessButton id: guestAccessButton
enabled: roomSettings.canChangeJoinRules enabled: roomSettings.canChangeJoinRules
@ -386,7 +386,7 @@ ApplicationWindow {
color: Nheko.colors.text color: Nheko.colors.text
} }
ToggleButton { Switch {
id: encryptionToggle id: encryptionToggle
checked: roomSettings.isEncryptionEnabled checked: roomSettings.isEncryptionEnabled

View file

@ -86,7 +86,7 @@ Rectangle {
DelegateChoice { DelegateChoice {
roleValue: UserSettingsModel.Toggle roleValue: UserSettingsModel.Toggle
ToggleButton { Switch {
checked: model.value checked: model.value
onCheckedChanged: model.value = checked onCheckedChanged: model.value = checked
enabled: model.enabled enabled: model.enabled

View file

@ -75,7 +75,7 @@ ColumnLayout {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.margins: Nheko.paddingLarge Layout.margins: Nheko.paddingLarge
ToggleButton { Switch {
Layout.margins: Nheko.paddingLarge Layout.margins: Nheko.paddingLarge
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
checked: Settings.reducedMotion checked: Settings.reducedMotion

View file

@ -78,7 +78,7 @@ Popup {
text: qsTr("Include your camera picture-in-picture") text: qsTr("Include your camera picture-in-picture")
} }
ToggleButton { Switch {
id: pipCheckBox id: pipCheckBox
enabled: CallManager.cameras.length > 0 enabled: CallManager.cameras.length > 0
@ -92,7 +92,7 @@ Popup {
ToolTip.visible: hovered ToolTip.visible: hovered
} }
ToggleButton { Switch {
id: remoteVideoCheckBox id: remoteVideoCheckBox
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
@ -105,7 +105,7 @@ Popup {
text: qsTr("Hide mouse cursor") text: qsTr("Hide mouse cursor")
} }
ToggleButton { Switch {
id: hideCursorCheckBox id: hideCursorCheckBox
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight