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

View File

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