Port general settings page to FormCard

This commit is contained in:
Tobias Fella
2023-09-01 18:00:36 +02:00
parent cfd9f36a97
commit 40d2eb5aba

View File

@@ -6,28 +6,19 @@ import QtQuick 2.15
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.neochat 1.0 import org.kde.neochat 1.0
Kirigami.ScrollablePage { FormCard.FormCardPage {
title: i18nc("@title:window", "General") title: i18nc("@title:window", "General")
topPadding: 0
leftPadding: 0 FormCard.FormHeader {
rightPadding: 0
ColumnLayout {
spacing: 0
MobileForm.FormHeader {
Layout.fillWidth: true
title: i18n("General settings") title: i18n("General settings")
visible: Qt.platform.os !== "android" visible: Qt.platform.os !== "android"
} }
MobileForm.FormCard { FormCard.FormCard {
Layout.fillWidth: true FormCard.FormCheckDelegate {
contentItem: ColumnLayout {
spacing: 0
MobileForm.FormCheckDelegate {
id: closeDelegate id: closeDelegate
text: i18n("Show in System Tray") text: i18n("Show in System Tray")
checked: Config.systemTray checked: Config.systemTray
@@ -39,9 +30,9 @@ Kirigami.ScrollablePage {
} }
} }
MobileForm.FormDelegateSeparator { above: closeDelegate; below: minimizeDelegate } FormCard.FormDelegateSeparator { above: closeDelegate; below: minimizeDelegate }
MobileForm.FormCheckDelegate { FormCard.FormCheckDelegate {
id: minimizeDelegate id: minimizeDelegate
text: i18n("Minimize to system tray on startup") text: i18n("Minimize to system tray on startup")
checked: Config.minimizeToSystemTrayOnStartup checked: Config.minimizeToSystemTrayOnStartup
@@ -53,9 +44,9 @@ Kirigami.ScrollablePage {
} }
} }
MobileForm.FormDelegateSeparator { above: minimizeDelegate; below: automaticallyDelegate } FormCard.FormDelegateSeparator { above: minimizeDelegate; below: automaticallyDelegate }
MobileForm.FormCheckDelegate { FormCard.FormCheckDelegate {
id: automaticallyDelegate id: automaticallyDelegate
text: i18n("Automatically hide/unhide the room information when resizing the window") text: i18n("Automatically hide/unhide the room information when resizing the window")
checked: Config.autoRoomInfoDrawer checked: Config.autoRoomInfoDrawer
@@ -67,17 +58,11 @@ Kirigami.ScrollablePage {
} }
} }
} }
} FormCard.FormHeader {
MobileForm.FormHeader {
Layout.fillWidth: true
title: i18n("Timeline Events") title: i18n("Timeline Events")
} }
MobileForm.FormCard { FormCard.FormCard {
Layout.fillWidth: true FormCard.FormCheckDelegate {
contentItem: ColumnLayout {
spacing: 0
MobileForm.FormCheckDelegate {
id: showDeletedMessages id: showDeletedMessages
text: i18n("Show deleted messages") text: i18n("Show deleted messages")
checked: Config.showDeletedMessages checked: Config.showDeletedMessages
@@ -88,9 +73,9 @@ Kirigami.ScrollablePage {
} }
} }
MobileForm.FormDelegateSeparator { above: showDeletedMessages; below: showStateEvents } FormCard.FormDelegateSeparator { above: showDeletedMessages; below: showStateEvents }
MobileForm.FormCheckDelegate { FormCard.FormCheckDelegate {
id: showStateEvents id: showStateEvents
text: i18n("Show state events") text: i18n("Show state events")
checked: Config.showStateEvent checked: Config.showStateEvent
@@ -101,12 +86,12 @@ Kirigami.ScrollablePage {
} }
} }
MobileForm.FormDelegateSeparator { FormCard.FormDelegateSeparator {
visible: Config.showStateEvent visible: Config.showStateEvent
above: showStateEvents above: showStateEvents
below: showLeaveJoinEventDelegate } below: showLeaveJoinEventDelegate }
MobileForm.FormCheckDelegate { FormCard.FormCheckDelegate {
id: showLeaveJoinEventDelegate id: showLeaveJoinEventDelegate
visible: Config.showStateEvent visible: Config.showStateEvent
text: i18n("Show leave and join events") text: i18n("Show leave and join events")
@@ -118,13 +103,13 @@ Kirigami.ScrollablePage {
} }
} }
MobileForm.FormDelegateSeparator { FormCard.FormDelegateSeparator {
visible: Config.showStateEvent visible: Config.showStateEvent
above: showLeaveJoinEventDelegate above: showLeaveJoinEventDelegate
below: showNameDelegate below: showNameDelegate
} }
MobileForm.FormCheckDelegate { FormCard.FormCheckDelegate {
id: showNameDelegate id: showNameDelegate
visible: Config.showStateEvent visible: Config.showStateEvent
text: i18n("Show name change events") text: i18n("Show name change events")
@@ -136,13 +121,13 @@ Kirigami.ScrollablePage {
} }
} }
MobileForm.FormDelegateSeparator { FormCard.FormDelegateSeparator {
visible: Config.showStateEvent visible: Config.showStateEvent
above: showNameDelegate above: showNameDelegate
below: showAvatarChangeDelegate below: showAvatarChangeDelegate
} }
MobileForm.FormCheckDelegate { FormCard.FormCheckDelegate {
id: showAvatarChangeDelegate id: showAvatarChangeDelegate
visible: Config.showStateEvent visible: Config.showStateEvent
text: i18n("Show avatar update events") text: i18n("Show avatar update events")
@@ -154,16 +139,11 @@ Kirigami.ScrollablePage {
} }
} }
} }
} FormCard.FormHeader {
MobileForm.FormHeader {
Layout.fillWidth: true
title: i18n("Rooms and private chats") title: i18n("Rooms and private chats")
} }
MobileForm.FormCard { FormCard.FormCard {
Layout.fillWidth: true FormCard.FormRadioDelegate {
contentItem: ColumnLayout {
spacing: 0
MobileForm.FormRadioDelegate {
text: i18n("Separated") text: i18n("Separated")
checked: !Config.mergeRoomList checked: !Config.mergeRoomList
enabled: !Config.isMergeRoomListImmutable enabled: !Config.isMergeRoomListImmutable
@@ -172,7 +152,7 @@ Kirigami.ScrollablePage {
Config.save() Config.save()
} }
} }
MobileForm.FormRadioDelegate { FormCard.FormRadioDelegate {
text: i18n("Intermixed") text: i18n("Intermixed")
checked: Config.mergeRoomList checked: Config.mergeRoomList
enabled: !Config.isMergeRoomListImmutable enabled: !Config.isMergeRoomListImmutable
@@ -182,16 +162,11 @@ Kirigami.ScrollablePage {
} }
} }
} }
} FormCard.FormHeader {
MobileForm.FormHeader {
Layout.fillWidth: true
title: i18nc("Chat Editor", "Editor") title: i18nc("Chat Editor", "Editor")
} }
MobileForm.FormCard { FormCard.FormCard {
Layout.fillWidth: true FormCard.FormCheckDelegate {
contentItem: ColumnLayout {
spacing: 0
MobileForm.FormCheckDelegate {
id: quickEditCheckbox id: quickEditCheckbox
text: i18n("Use s/text/replacement syntax to edit your last message") text: i18n("Use s/text/replacement syntax to edit your last message")
checked: Config.allowQuickEdit checked: Config.allowQuickEdit
@@ -201,8 +176,8 @@ Kirigami.ScrollablePage {
Config.save() Config.save()
} }
} }
MobileForm.FormDelegateSeparator { above: quickEditCheckbox; below: typingNotificationsDelegate } FormCard.FormDelegateSeparator { above: quickEditCheckbox; below: typingNotificationsDelegate }
MobileForm.FormCheckDelegate { FormCard.FormCheckDelegate {
id: typingNotificationsDelegate id: typingNotificationsDelegate
text: i18n("Send typing notifications") text: i18n("Send typing notifications")
checked: Config.typingNotifications checked: Config.typingNotifications
@@ -213,16 +188,11 @@ Kirigami.ScrollablePage {
} }
} }
} }
} FormCard.FormHeader {
MobileForm.FormHeader {
Layout.fillWidth: true
title: i18n("Developer Settings") title: i18n("Developer Settings")
} }
MobileForm.FormCard { FormCard.FormCard {
Layout.fillWidth: true FormCard.FormCheckDelegate {
contentItem: ColumnLayout {
spacing: 0
MobileForm.FormCheckDelegate {
text: i18n("Enable developer tools") text: i18n("Enable developer tools")
checked: Config.developerTools checked: Config.developerTools
enabled: !Config.isDeveloperToolsImmutable enabled: !Config.isDeveloperToolsImmutable
@@ -233,5 +203,3 @@ Kirigami.ScrollablePage {
} }
} }
} }
}
}