Compare commits

...

1 Commits

Author SHA1 Message Date
Tobias Fella
b3736882f1 Port General RoomSettings to FormCard 2023-09-01 14:55:18 +02:00

View File

@@ -8,32 +8,24 @@ import QtQuick.Layouts 1.15
import QtQuick.Window 2.15
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.neochat 1.0
Kirigami.ScrollablePage {
FormCard.FormCardPage {
id: root
property NeoChatRoom room
title: i18n("General")
topPadding: 0
leftPadding: 0
rightPadding: 0
ColumnLayout {
spacing: 0
MobileForm.FormHeader {
Layout.fillWidth: true
FormCard.FormHeader {
title: i18n("Room Information")
}
MobileForm.FormCard {
Layout.fillWidth: true
contentItem: ColumnLayout {
spacing: 0
MobileForm.AbstractFormDelegate {
Layout.fillWidth: true
FormCard.FormCard {
FormCard.AbstractFormDelegate {
background: Item {}
contentItem: RowLayout {
Item {
@@ -69,21 +61,29 @@ Kirigami.ScrollablePage {
QQC2.ToolTip.text: text
QQC2.ToolTip.visible: hovered
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
Component {
id: openFileDialog
OpenFileDialog {
parentWindow: root.Window.window
}
}
}
Item {
Layout.fillWidth: true
}
}
}
MobileForm.FormTextFieldDelegate {
FormCard.FormTextFieldDelegate {
id: roomNameField
label: i18n("Room name:")
text: room.name
enabled: room.canSendState("m.room.name")
}
MobileForm.AbstractFormDelegate {
FormCard.AbstractFormDelegate {
id: roomTopicField
Layout.fillWidth: true
enabled: room.canSendState("m.room.topic")
background: Item {}
contentItem: ColumnLayout {
@@ -100,8 +100,7 @@ Kirigami.ScrollablePage {
}
}
}
MobileForm.AbstractFormDelegate {
Layout.fillWidth: true
FormCard.AbstractFormDelegate {
background: Item {}
contentItem: RowLayout {
Item {
@@ -124,7 +123,7 @@ Kirigami.ScrollablePage {
}
}
}
MobileForm.FormTextDelegate {
FormCard.FormTextDelegate {
id: roomIdDelegate
text: i18n("Room ID")
description: room.id
@@ -144,7 +143,7 @@ Kirigami.ScrollablePage {
QQC2.ToolTip.visible: hovered
}
}
MobileForm.FormTextDelegate {
FormCard.FormTextDelegate {
text: i18n("Room version")
description: room.version
@@ -165,20 +164,39 @@ Kirigami.ScrollablePage {
text: text
delay: Kirigami.Units.toolTipDelay
}
Kirigami.OverlaySheet {
id: roomUpgradeSheet
property var currentRoomVersion
title: i18n("Upgrade the Room")
Kirigami.FormLayout {
QQC2.SpinBox {
id: spinBox
Kirigami.FormData.label: i18n("Select new version")
from: room.version
to: room.maxRoomVersion
value: room.version
}
QQC2.Button {
text: i18n("Confirm")
onClicked: {
room.switchVersion(spinBox.value)
roomUpgradeSheet.close()
}
}
}
}
}
}
}
MobileForm.FormHeader {
Layout.fillWidth: true
FormCard.FormHeader {
title: i18n("Aliases")
}
MobileForm.FormCard {
Layout.fillWidth: true
contentItem: ColumnLayout {
spacing: 0
MobileForm.FormTextDelegate {
FormCard.FormCard {
FormCard.FormTextDelegate {
visible: room.aliases.length <= 0
text: i18n("No canonical alias set")
}
@@ -186,7 +204,7 @@ Kirigami.ScrollablePage {
id: altAliasRepeater
model: room.aliases.slice().reverse()
delegate: MobileForm.FormTextDelegate {
delegate: FormCard.FormTextDelegate {
text: modelData
description: room.canonicalAlias.length > 0 && modelData === room.canonicalAlias ? "Canonical alias" : ""
contentItem.children: [
@@ -224,8 +242,7 @@ Kirigami.ScrollablePage {
}
}
MobileForm.AbstractFormDelegate {
Layout.fillWidth: true
FormCard.AbstractFormDelegate {
visible: room.canSendState("m.room.canonical_alias")
contentItem : RowLayout {
@@ -268,17 +285,12 @@ Kirigami.ScrollablePage {
}
}
}
}
MobileForm.FormHeader {
Layout.fillWidth: true
FormCard.FormHeader {
title: i18n("URL Previews")
}
MobileForm.FormCard {
Layout.fillWidth: true
contentItem: ColumnLayout {
spacing: 0
MobileForm.FormCheckDelegate {
FormCard.FormCard {
FormCard.FormCheckDelegate {
text: i18n("Enable URL previews by default for room members")
checked: room.defaultUrlPreviewState
visible: room.canSendState("org.matrix.room.preview_urls")
@@ -286,7 +298,7 @@ Kirigami.ScrollablePage {
room.defaultUrlPreviewState = checked
}
}
MobileForm.FormCheckDelegate {
FormCard.FormCheckDelegate {
text: i18n("Enable URL previews")
// Most users won't see the above setting so tell them the default.
description: room.defaultUrlPreviewState ? i18n("URL previews are enabled by default in this room") : i18n("URL previews are disabled by default in this room")
@@ -296,7 +308,6 @@ Kirigami.ScrollablePage {
}
}
}
}
Kirigami.InlineMessage {
Layout.fillWidth: true
@@ -328,38 +339,5 @@ Kirigami.ScrollablePage {
}
}
}
Component {
id: openFileDialog
OpenFileDialog {
parentWindow: root.Window.window
}
}
Kirigami.OverlaySheet {
id: roomUpgradeSheet
property var currentRoomVersion
title: i18n("Upgrade the Room")
Kirigami.FormLayout {
QQC2.SpinBox {
id: spinBox
Kirigami.FormData.label: i18n("Select new version")
from: room.version
to: room.maxRoomVersion
value: room.version
}
QQC2.Button {
text: i18n("Confirm")
onClicked: {
room.switchVersion(spinBox.value)
roomUpgradeSheet.close()
}
}
}
}
}
}