Port to form card

This commit is contained in:
Carl Schwan
2023-08-08 21:58:40 +02:00
committed by Tobias Fella
parent 9f3012061d
commit 6aa2e586de
2 changed files with 364 additions and 370 deletions

View File

@@ -7,27 +7,25 @@ import QtQuick.Controls 2.15 as QQC2
import QtQuick.Layouts 1.15
import org.kde.kirigami 2.15 as Kirigami
import org.kde.kirigamiaddons.labs.mobileform 0.1 as MobileForm
import org.kde.kirigamiaddons.labs.components 1.0 as KirigamiComponents
import org.kde.kirigamiaddons.formcard 1.0 as FormCard
import org.kde.kirigamiaddons.components 1.0 as KirigamiComponents
import org.kde.neochat 1.0
Kirigami.ScrollablePage {
FormCard.FormCardPage {
id: root
title: i18nc("@title:window", "Appearance")
topPadding: 0
leftPadding: 0
rightPadding: 0
ColumnLayout {
spacing: 0
MobileForm.FormHeader {
FormCard.FormHeader {
Layout.fillWidth: true
title: i18n("General theme")
}
MobileForm.FormCard {
FormCard.FormCard {
Layout.fillWidth: true
contentItem: ColumnLayout {
spacing: 0
MobileForm.AbstractFormDelegate {
FormCard.AbstractFormDelegate {
id: timelineModeSetting
Layout.fillWidth: true
background: Item {}
@@ -202,9 +200,9 @@ Kirigami.ScrollablePage {
}
}
MobileForm.FormDelegateSeparator { below: compactRoomListDelegate }
FormCard.FormDelegateSeparator { below: compactRoomListDelegate }
MobileForm.FormCheckDelegate {
FormCard.FormCheckDelegate {
id: compactRoomListDelegate
text: i18n("Use compact room list")
checked: Config.compactRoomList
@@ -214,7 +212,7 @@ Kirigami.ScrollablePage {
}
}
MobileForm.FormDelegateSeparator { above: compactRoomListDelegate ; below: colorSchemeDelegate.item ; visible: colorSchemeDelegate.visible }
FormCard.FormDelegateSeparator { above: compactRoomListDelegate ; below: colorSchemeDelegate.item ; visible: colorSchemeDelegate.visible }
Loader {
id: colorSchemeDelegate
@@ -223,14 +221,12 @@ Kirigami.ScrollablePage {
Layout.fillWidth: true
}
}
}
MobileForm.FormCard {
Layout.topMargin: Kirigami.Units.largeSpacing
FormCard.FormCard {
Layout.topMargin: Kirigami.Units.largeSpacing * 2
Layout.fillWidth: true
contentItem: ColumnLayout {
spacing: 0
MobileForm.FormCheckDelegate {
FormCard.FormCheckDelegate {
id: showFancyEffectsDelegate
text: i18n("Show fancy effects in chat")
checked: Config.showFancyEffects
@@ -241,9 +237,9 @@ Kirigami.ScrollablePage {
}
}
MobileForm.FormDelegateSeparator { above: showFancyEffectsDelegate ; below: hasWindowSystemDelegate }
FormCard.FormDelegateSeparator { above: showFancyEffectsDelegate ; below: hasWindowSystemDelegate }
MobileForm.FormCheckDelegate {
FormCard.FormCheckDelegate {
id: hasWindowSystemDelegate
visible: Controller.hasWindowSystem
text: i18n("Use transparent chat page")
@@ -255,9 +251,9 @@ Kirigami.ScrollablePage {
}
}
MobileForm.FormDelegateSeparator { above: hasWindowSystemDelegate; below: transparencyDelegate }
FormCard.FormDelegateSeparator { above: hasWindowSystemDelegate; below: transparencyDelegate }
MobileForm.AbstractFormDelegate {
FormCard.AbstractFormDelegate {
id: transparencyDelegate
Layout.fillWidth: true
visible: Controller.hasWindowSystem && Config.blur
@@ -291,9 +287,9 @@ Kirigami.ScrollablePage {
}
}
MobileForm.FormDelegateSeparator { above: transparencyDelegate; below: showLocalMessagesOnRightDelegate; visible: transparencyDelegate.visible }
FormCard.FormDelegateSeparator { above: transparencyDelegate; below: showLocalMessagesOnRightDelegate; visible: transparencyDelegate.visible }
MobileForm.FormCheckDelegate {
FormCard.FormCheckDelegate {
id: showLocalMessagesOnRightDelegate
text: i18n("Show your messages on the right")
checked: Config.showLocalMessagesOnRight
@@ -304,9 +300,9 @@ Kirigami.ScrollablePage {
}
}
MobileForm.FormDelegateSeparator { above: showLocalMessagesOnRightDelegate; below: showLinkPreviewDelegate }
FormCard.FormDelegateSeparator { above: showLocalMessagesOnRightDelegate; below: showLinkPreviewDelegate }
MobileForm.FormCheckDelegate {
FormCard.FormCheckDelegate {
id: showLinkPreviewDelegate
text: i18n("Show links preview in the chat messages")
checked: Config.showLinkPreview
@@ -316,17 +312,16 @@ Kirigami.ScrollablePage {
}
}
}
}
MobileForm.FormHeader {
FormCard.FormHeader {
Layout.fillWidth: true
title: i18n("Show Avatar")
}
MobileForm.FormCard {
FormCard.FormCard {
Layout.fillWidth: true
contentItem: ColumnLayout {
spacing: 0
MobileForm.FormCheckDelegate {
FormCard.FormCheckDelegate {
text: i18n("In chat")
checked: Config.showAvatarInTimeline
onToggled: {
@@ -336,7 +331,7 @@ Kirigami.ScrollablePage {
enabled: !Config.isShowAvatarInTimelineImmutable
}
MobileForm.FormCheckDelegate {
FormCard.FormCheckDelegate {
text: i18n("In sidebar")
checked: Config.showAvatarInRoomDrawer
enabled: !Config.isShowAvatarInRoomDrawerImmutable
@@ -347,5 +342,3 @@ Kirigami.ScrollablePage {
}
}
}
}
}

View File

@@ -7,23 +7,17 @@ import QtQuick.Controls 2.15 as QQC2
import QtQuick.Layouts 1.15
import org.kde.kirigami 2.19 as Kirigami
import org.kde.kirigamiaddons.labs.mobileform 0.1 as MobileForm
import org.kde.kirigamiaddons.formcard 1.0 as FormCard
import org.kde.neochat 1.0
Kirigami.ScrollablePage {
FormCard.FormCardPage {
id: root
title: i18n("Devices")
property alias connection: devicesModel.connection
leftPadding: 0
rightPadding: 0
DevicesModel {
id: devicesModel
}
ColumnLayout {
DevicesCard {
title: i18n("This Device")
type: DevicesModel.This
@@ -45,7 +39,7 @@ Kirigami.ScrollablePage {
showVerifyButton: false
}
MobileForm.AbstractFormDelegate {
FormCard.AbstractFormDelegate {
Layout.fillWidth: true
visible: Controller.activeConnection && devicesModel.count === 0 // We can assume 0 means loading since there is at least one device
contentItem: Kirigami.LoadingPlaceholder { }
@@ -59,28 +53,35 @@ Kirigami.ScrollablePage {
type: Kirigami.MessageType.Information
visible: !Controller.activeConnection
}
}
Kirigami.OverlaySheet {
data: [
DevicesModel {
id: devicesModel
},
Kirigami.PromptDialog {
id: passwordSheet
property string deviceId
parent: applicationWindow().overlay
title: i18n("Remove device")
Kirigami.FormLayout {
QQC2.TextField {
id: passwordField
Kirigami.FormData.label: i18n("Password:")
echoMode: TextInput.Password
}
QQC2.Button {
text: i18n("Confirm")
onClicked: {
standardButtons: Kirigami.Dialog.Ok | Kirigami.Dialog.Cancel
leftPadding: 0
rightPadding: 0
topPadding: 0
bottomPadding: 0
onAccepted: {
devicesModel.logout(passwordSheet.deviceId, passwordField.text)
passwordField.text = ""
passwordSheet.close()
}
FormCard.FormTextFieldDelegate {
id: passwordField
label: i18n("Password:")
echoMode: TextInput.Password
}
}
}
]
}