From 5640f10294a0ecba4a417cd7bdd6d9303203b2a3 Mon Sep 17 00:00:00 2001 From: Loren Burkholder Date: Wed, 1 Mar 2023 11:11:06 -0500 Subject: [PATCH] Use native QML switches --- resources/qml/SelfVerificationCheck.qml | 6 +++--- resources/qml/dialogs/AllowedRoomsSettingsDialog.qml | 2 +- resources/qml/dialogs/CreateDirect.qml | 2 +- resources/qml/dialogs/CreateRoom.qml | 6 +++--- resources/qml/dialogs/HiddenEventsDialog.qml | 6 +++--- resources/qml/dialogs/ImagePackEditorDialog.qml | 8 ++++---- resources/qml/dialogs/ImagePackSettingsDialog.qml | 2 +- resources/qml/dialogs/InviteDialog.qml | 2 +- resources/qml/dialogs/PowerLevelSpacesApplyDialog.qml | 6 +++--- resources/qml/dialogs/RoomSettings.qml | 10 +++++----- resources/qml/pages/UserSettingsPage.qml | 2 +- resources/qml/pages/WelcomePage.qml | 2 +- resources/qml/voip/ScreenShare.qml | 6 +++--- 13 files changed, 30 insertions(+), 30 deletions(-) diff --git a/resources/qml/SelfVerificationCheck.qml b/resources/qml/SelfVerificationCheck.qml index 4f2d9202..7f26ff92 100644 --- a/resources/qml/SelfVerificationCheck.qml +++ b/resources/qml/SelfVerificationCheck.qml @@ -131,7 +131,7 @@ Item { Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter Layout.fillWidth: true - ToggleButton { + Switch { id: storeSecretsOnline checked: true @@ -161,7 +161,7 @@ Item { Layout.fillWidth: true visible: storeSecretsOnline.checked - ToggleButton { + Switch { id: usePassword checked: false @@ -197,7 +197,7 @@ Item { Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter Layout.fillWidth: true - ToggleButton { + Switch { id: useOnlineKeyBackup checked: true diff --git a/resources/qml/dialogs/AllowedRoomsSettingsDialog.qml b/resources/qml/dialogs/AllowedRoomsSettingsDialog.qml index d93f1f18..68dbfc4f 100644 --- a/resources/qml/dialogs/AllowedRoomsSettingsDialog.qml +++ b/resources/qml/dialogs/AllowedRoomsSettingsDialog.qml @@ -84,7 +84,7 @@ ApplicationWindow { } } - ToggleButton { + Switch { checked: model.allowed Layout.alignment: Qt.AlignRight onCheckedChanged: model.allowed = checked diff --git a/resources/qml/dialogs/CreateDirect.qml b/resources/qml/dialogs/CreateDirect.qml index 4ce568bb..4a8e9fee 100644 --- a/resources/qml/dialogs/CreateDirect.qml +++ b/resources/qml/dialogs/CreateDirect.qml @@ -91,7 +91,7 @@ ApplicationWindow { text: qsTr("Encryption") color: Nheko.colors.text } - ToggleButton { + Switch { Layout.alignment: Qt.AlignRight id: encryption checked: otherUserHasE2ee diff --git a/resources/qml/dialogs/CreateRoom.qml b/resources/qml/dialogs/CreateRoom.qml index cb198bb8..f7180f2f 100644 --- a/resources/qml/dialogs/CreateRoom.qml +++ b/resources/qml/dialogs/CreateRoom.qml @@ -90,7 +90,7 @@ ApplicationWindow { ToolTip.text: qsTr("Public rooms can be joined by anyone; private rooms need explicit invites.") ToolTip.delay: Nheko.tooltipDelay } - ToggleButton { + Switch { Layout.alignment: Qt.AlignRight Layout.preferredWidth: implicitWidth id: isPublic @@ -109,7 +109,7 @@ ApplicationWindow { ToolTip.text: qsTr("All invitees are given the same power level as the creator") ToolTip.delay: Nheko.tooltipDelay } - ToggleButton { + Switch { visible: !space Layout.alignment: Qt.AlignRight Layout.preferredWidth: implicitWidth @@ -130,7 +130,7 @@ ApplicationWindow { ToolTip.text: qsTr("Caution: Encryption cannot be disabled") ToolTip.delay: Nheko.tooltipDelay } - ToggleButton { + Switch { visible: !space Layout.alignment: Qt.AlignRight Layout.preferredWidth: implicitWidth diff --git a/resources/qml/dialogs/HiddenEventsDialog.qml b/resources/qml/dialogs/HiddenEventsDialog.qml index a66a78f1..dbb17373 100644 --- a/resources/qml/dialogs/HiddenEventsDialog.qml +++ b/resources/qml/dialogs/HiddenEventsDialog.qml @@ -79,7 +79,7 @@ ApplicationWindow { } } - ToggleButton { + Switch { Layout.alignment: Qt.AlignRight checked: !hiddenEvents.hiddenEvents.includes(MtxEvent.Member) onToggled: hiddenEvents.toggle(MtxEvent.Member) @@ -96,7 +96,7 @@ ApplicationWindow { } } - ToggleButton { + Switch { Layout.alignment: Qt.AlignRight checked: !hiddenEvents.hiddenEvents.includes(MtxEvent.PowerLevels) onToggled: hiddenEvents.toggle(MtxEvent.PowerLevels) @@ -107,7 +107,7 @@ ApplicationWindow { Layout.fillWidth: true } - ToggleButton { + Switch { Layout.alignment: Qt.AlignRight checked: !hiddenEvents.hiddenEvents.includes(MtxEvent.Sticker) onToggled: hiddenEvents.toggle(MtxEvent.Sticker) diff --git a/resources/qml/dialogs/ImagePackEditorDialog.qml b/resources/qml/dialogs/ImagePackEditorDialog.qml index de516dd9..5c977446 100644 --- a/resources/qml/dialogs/ImagePackEditorDialog.qml +++ b/resources/qml/dialogs/ImagePackEditorDialog.qml @@ -206,7 +206,7 @@ ApplicationWindow { text: qsTr("Use as Emoji") } - ToggleButton { + Switch { checked: imagePack.isEmotePack onCheckedChanged: imagePack.isEmotePack = checked Layout.alignment: Qt.AlignRight @@ -219,7 +219,7 @@ ApplicationWindow { text: qsTr("Use as Sticker") } - ToggleButton { + Switch { checked: imagePack.isStickerPack onCheckedChanged: imagePack.isStickerPack = checked Layout.alignment: Qt.AlignRight @@ -276,7 +276,7 @@ ApplicationWindow { text: qsTr("Use as Emoji") } - ToggleButton { + Switch { checked: imagePack.data(imagePack.index(currentImageIndex, 0), SingleImagePackModel.IsEmote) onCheckedChanged: imagePack.setData(imagePack.index(currentImageIndex, 0), checked, SingleImagePackModel.IsEmote) Layout.alignment: Qt.AlignRight @@ -289,7 +289,7 @@ ApplicationWindow { text: qsTr("Use as Sticker") } - ToggleButton { + Switch { checked: imagePack.data(imagePack.index(currentImageIndex, 0), SingleImagePackModel.IsSticker) onCheckedChanged: imagePack.setData(imagePack.index(currentImageIndex, 0), checked, SingleImagePackModel.IsSticker) Layout.alignment: Qt.AlignRight diff --git a/resources/qml/dialogs/ImagePackSettingsDialog.qml b/resources/qml/dialogs/ImagePackSettingsDialog.qml index a938bab8..a81d7fb0 100644 --- a/resources/qml/dialogs/ImagePackSettingsDialog.qml +++ b/resources/qml/dialogs/ImagePackSettingsDialog.qml @@ -185,7 +185,7 @@ ApplicationWindow { text: qsTr("Enable globally") } - ToggleButton { + Switch { ToolTip.text: qsTr("Enables this pack to be used in all rooms") checked: currentPack ? currentPack.isGloballyEnabled : false onCheckedChanged: currentPack.isGloballyEnabled = checked diff --git a/resources/qml/dialogs/InviteDialog.qml b/resources/qml/dialogs/InviteDialog.qml index ee555795..01a47111 100644 --- a/resources/qml/dialogs/InviteDialog.qml +++ b/resources/qml/dialogs/InviteDialog.qml @@ -139,7 +139,7 @@ ApplicationWindow { } } - ToggleButton { + Switch { id: searchOnServer checked: false onClicked: userSearch.model.setSearchString(inviteeEntry.text) diff --git a/resources/qml/dialogs/PowerLevelSpacesApplyDialog.qml b/resources/qml/dialogs/PowerLevelSpacesApplyDialog.qml index e66f92a2..f27a0fae 100644 --- a/resources/qml/dialogs/PowerLevelSpacesApplyDialog.qml +++ b/resources/qml/dialogs/PowerLevelSpacesApplyDialog.qml @@ -58,7 +58,7 @@ ApplicationWindow { color: Nheko.colors.text } - ToggleButton { + Switch { checked: editingModel.spaces.applyToChildren Layout.alignment: Qt.AlignRight onCheckedChanged: editingModel.spaces.applyToChildren = checked @@ -70,7 +70,7 @@ ApplicationWindow { color: Nheko.colors.text } - ToggleButton { + Switch { checked: editingModel.spaces.overwriteDiverged Layout.alignment: Qt.AlignRight onCheckedChanged: editingModel.spaces.overwriteDiverged = checked @@ -122,7 +122,7 @@ ApplicationWindow { } } - ToggleButton { + Switch { checked: model.applyPermissions Layout.alignment: Qt.AlignRight onCheckedChanged: model.applyPermissions = checked diff --git a/resources/qml/dialogs/RoomSettings.qml b/resources/qml/dialogs/RoomSettings.qml index 5544841f..2807e6fd 100644 --- a/resources/qml/dialogs/RoomSettings.qml +++ b/resources/qml/dialogs/RoomSettings.qml @@ -292,7 +292,7 @@ ApplicationWindow { color: Nheko.colors.text } - ToggleButton { + Switch { id: publicRoomButton enabled: roomSettings.canChangeJoinRules @@ -307,7 +307,7 @@ ApplicationWindow { visible: knockingButton.visible } - ToggleButton { + Switch { id: knockingButton visible: !publicRoomButton.checked @@ -326,7 +326,7 @@ ApplicationWindow { visible: restrictedButton.visible } - ToggleButton { + Switch { id: restrictedButton visible: !publicRoomButton.checked @@ -363,7 +363,7 @@ ApplicationWindow { color: Nheko.colors.text } - ToggleButton { + Switch { id: guestAccessButton enabled: roomSettings.canChangeJoinRules @@ -386,7 +386,7 @@ ApplicationWindow { color: Nheko.colors.text } - ToggleButton { + Switch { id: encryptionToggle checked: roomSettings.isEncryptionEnabled diff --git a/resources/qml/pages/UserSettingsPage.qml b/resources/qml/pages/UserSettingsPage.qml index 5c2ebf5f..f1001d73 100644 --- a/resources/qml/pages/UserSettingsPage.qml +++ b/resources/qml/pages/UserSettingsPage.qml @@ -86,7 +86,7 @@ Rectangle { DelegateChoice { roleValue: UserSettingsModel.Toggle - ToggleButton { + Switch { checked: model.value onCheckedChanged: model.value = checked enabled: model.enabled diff --git a/resources/qml/pages/WelcomePage.qml b/resources/qml/pages/WelcomePage.qml index 6555cc29..c3593cb4 100644 --- a/resources/qml/pages/WelcomePage.qml +++ b/resources/qml/pages/WelcomePage.qml @@ -75,7 +75,7 @@ ColumnLayout { Layout.alignment: Qt.AlignHCenter Layout.margins: Nheko.paddingLarge - ToggleButton { + Switch { Layout.margins: Nheko.paddingLarge Layout.alignment: Qt.AlignRight checked: Settings.reducedMotion diff --git a/resources/qml/voip/ScreenShare.qml b/resources/qml/voip/ScreenShare.qml index 2859eac4..bebe30a5 100644 --- a/resources/qml/voip/ScreenShare.qml +++ b/resources/qml/voip/ScreenShare.qml @@ -78,7 +78,7 @@ Popup { text: qsTr("Include your camera picture-in-picture") } - ToggleButton { + Switch { id: pipCheckBox enabled: CallManager.cameras.length > 0 @@ -92,7 +92,7 @@ Popup { ToolTip.visible: hovered } - ToggleButton { + Switch { id: remoteVideoCheckBox Layout.alignment: Qt.AlignRight @@ -105,7 +105,7 @@ Popup { text: qsTr("Hide mouse cursor") } - ToggleButton { + Switch { id: hideCursorCheckBox Layout.alignment: Qt.AlignRight