Compare commits

...

1 Commits

Author SHA1 Message Date
Tobias Fella
092e092e18 WIP 2026-02-06 05:02:58 -05:00

View File

@@ -7,354 +7,329 @@ import QtQuick.Controls as QQC2
import QtQuick.Layouts import QtQuick.Layouts
import org.kde.kirigami as Kirigami import org.kde.kirigami as Kirigami
import org.kde.kirigamiaddons.formcard as FormCard
import org.kde.neochat import org.kde.neochat
import org.kde.neochat.devtools import org.kde.neochat.devtools
FormCard.FormCardPage { Kirigami.ScrollablePage {
id: root id: root
required property NeoChatConnection connection required property NeoChatConnection connection
title: i18nc("@title:window", "General") title: i18nc("@title:window", "General")
FormCard.FormHeader { Kirigami.Form {
title: i18nc("@title:group", "General Settings") Kirigami.FormGroup {
visible: Qt.platform.os !== "android" title: i18nc("@title:group", "General Settings")
}
FormCard.FormCard {
FormCard.FormCheckDelegate {
id: closeDelegate
text: i18n("Show in System Tray")
checked: NeoChatConfig.systemTray
visible: Controller.supportSystemTray
enabled: !NeoChatConfig.isSystemTrayImmutable
onToggled: {
NeoChatConfig.systemTray = checked;
NeoChatConfig.save();
}
}
FormCard.FormDelegateSeparator {
above: closeDelegate
below: minimizeDelegate
}
FormCard.FormCheckDelegate {
id: minimizeDelegate
text: i18n("Minimize to system tray on startup")
checked: NeoChatConfig.minimizeToSystemTrayOnStartup
visible: Controller.supportSystemTray && !Kirigami.Settings.isMobile && NeoChatConfig.systemTray
enabled: NeoChatConfig.systemTray && !NeoChatConfig.isMinimizeToSystemTrayOnStartupImmutable
onToggled: {
NeoChatConfig.minimizeToSystemTrayOnStartup = checked;
NeoChatConfig.save();
}
}
FormCard.FormDelegateSeparator {
above: minimizeDelegate
below: automaticallyDelegate
visible: minimizeDelegate.visible
}
FormCard.FormCheckDelegate {
id: automaticallyDelegate
text: i18n("Automatically hide/unhide the room information when resizing the window")
checked: NeoChatConfig.autoRoomInfoDrawer
enabled: !NeoChatConfig.isAutoRoomInfoDrawerImmutable
visible: Qt.platform.os !== "android" visible: Qt.platform.os !== "android"
onToggled: {
NeoChatConfig.autoRoomInfoDrawer = checked;
NeoChatConfig.save();
}
}
FormCard.FormDelegateSeparator { Kirigami.FormEntry {
above: automaticallyDelegate contentItem: QQC2.CheckBox {
below: categorizeDelegate text: i18n("Show in System Tray")
} checked: NeoChatConfig.systemTray
FormCard.FormCheckDelegate { visible: Controller.supportSystemTray
id: categorizeDelegate enabled: !NeoChatConfig.isSystemTrayImmutable
text: i18n("Show all rooms in \"Home\" tab") onToggled: {
checked: NeoChatConfig.allRoomsInHome NeoChatConfig.systemTray = checked;
enabled: !NeoChatConfig.isAllRoomsInHomeImmutable NeoChatConfig.save();
onToggled: { }
NeoChatConfig.allRoomsInHome = checked;
NeoChatConfig.save();
}
}
}
FormCard.FormHeader {
title: i18nc("@title:group", "Room List Sort Order")
}
FormCard.FormCard {
FormCard.FormTextDelegate {
text: i18nc("@info:label", "Hidden events are not considered as recent activity when sorting rooms.")
}
FormCard.FormDelegateSeparator {}
FormCard.FormRadioDelegate {
text: i18nc("As in 'sort something based on last activity'", "Importance")
description: i18nc("@info", "Rooms with unread notifications will be shown first.")
checked: NeoChatConfig.sortOrder === 1
enabled: !NeoChatConfig.isSortOrderImmutable
onToggled: {
NeoChatConfig.sortOrder = 1
NeoChatConfig.customSortOrder = []
NeoChatConfig.save()
}
}
FormCard.FormRadioDelegate {
text: i18nc("As in 'sort something alphabetically'", "Alphabetical")
checked: NeoChatConfig.sortOrder === 0
enabled: !NeoChatConfig.isSortOrderImmutable
onToggled: {
NeoChatConfig.sortOrder = 0
NeoChatConfig.customSortOrder = []
NeoChatConfig.save()
}
}
FormCard.FormRadioDelegate {
text: i18nc("As in 'sort something based on the last event'", "Newest Events")
description: i18nc("@info", "Rooms with the newest events will be shown first.")
checked: NeoChatConfig.sortOrder === 2
enabled: !NeoChatConfig.isSortOrderImmutable
onToggled: {
NeoChatConfig.sortOrder = 2
NeoChatConfig.customSortOrder = []
NeoChatConfig.save()
}
}
FormCard.FormRadioDelegate {
id: openCustomRoomSortButton
text: i18nc("@option:radio", "Custom")
checked: NeoChatConfig.sortOrder === 3
enabled: !NeoChatConfig.isSortOrderImmutable
onClicked: {
Qt.createComponent('org.kde.neochat.settings', 'RoomSortParameterDialog').createObject(root).open();
}
}
}
FormCard.FormHeader {
title: i18nc("@title", "Timeline")
}
FormCard.FormCard {
FormCard.FormComboBoxDelegate {
id: markAsReadCombo
text: i18n("Mark messages as read when:")
textRole: "name"
valueRole: "value"
model: [
{
name: i18n("Never"),
value: 0
},
{
name: i18nc("@item:inlistbox As in mark messages in the room as read when entering the room", "Entering the room"),
value: 1
},
{
name: i18nc("@item:inlistbox As in mark messages in the room as read when entering the room and all messages are visible on screen", "Entering the room and all unread messages are visible"),
value: 2
},
{
name: i18nc("@item:inlistbox As in mark messages in the room as read when exiting the room", "Exiting the room"),
value: 3
},
{
name: i18nc("@item:inlistbox As in mark messages in the room as read when exiting the room and all messages are visible on screen", "Exiting the room and all unread messages are visible"),
value: 4
} }
] }
Component.onCompleted: currentIndex = NeoChatConfig.markReadCondition
onCurrentValueChanged: NeoChatConfig.markReadCondition = currentValue
}
FormCard.FormDelegateSeparator { Kirigami.FormSeparator {}
above: markAsReadCombo
below: showDeletedMessages
}
FormCard.FormCheckDelegate { Kirigami.FormEntry {
id: showDeletedMessages id: trayOnStartup
text: i18n("Show deleted messages") visible: Controller.supportSystemTray && !Kirigami.Settings.isMobile && NeoChatConfig.systemTray
checked: NeoChatConfig.showDeletedMessages contentItem: QQC2.CheckBox {
enabled: !NeoChatConfig.isShowDeletedMessagesImmutable text: i18n("Minimize to system tray on startup")
onToggled: { checked: NeoChatConfig.minimizeToSystemTrayOnStartup
NeoChatConfig.showDeletedMessages = checked; enabled: NeoChatConfig.systemTray && !NeoChatConfig.isMinimizeToSystemTrayOnStartupImmutable
NeoChatConfig.save(); onToggled: {
NeoChatConfig.minimizeToSystemTrayOnStartup = checked;
NeoChatConfig.save();
}
}
}
Kirigami.FormSeparator {
visible: trayOnStartup.visible
}
Kirigami.FormEntry {
contentItem: QQC2.CheckBox {
text: i18n("Automatically hide/unhide the room information when resizing the window")
checked: NeoChatConfig.autoRoomInfoDrawer
enabled: !NeoChatConfig.isAutoRoomInfoDrawerImmutable
visible: Qt.platform.os !== "android"
onToggled: {
NeoChatConfig.autoRoomInfoDrawer = checked;
NeoChatConfig.save();
}
}
}
Kirigami.FormSeparator {}
Kirigami.FormEntry {
contentItem: QQC2.CheckBox {
text: i18n("Show all rooms in \"Home\" tab")
checked: NeoChatConfig.allRoomsInHome
enabled: !NeoChatConfig.isAllRoomsInHomeImmutable
onToggled: {
NeoChatConfig.allRoomsInHome = checked;
NeoChatConfig.save();
}
}
} }
} }
FormCard.FormDelegateSeparator { Kirigami.FormGroup {
above: showDeletedMessages title: i18nc("@title:group", "Room List Sort Order")
below: showStateEvents
Kirigami.FormEntry {
contentItem: QQC2.Label {
text: i18nc("@info:label", "Hidden events are not considered as recent activity when sorting rooms.")
}
}
// FormCard.FormDelegateSeparator {}
// FormCard.FormRadioDelegate {
// text: i18nc("As in 'sort something based on last activity'", "Importance")
// description: i18nc("@info", "Rooms with unread notifications will be shown first.")
// checked: NeoChatConfig.sortOrder === 1
// enabled: !NeoChatConfig.isSortOrderImmutable
// onToggled: {
// NeoChatConfig.sortOrder = 1
// NeoChatConfig.customSortOrder = []
// NeoChatConfig.save()
// }
// }
// FormCard.FormRadioDelegate {
// text: i18nc("As in 'sort something alphabetically'", "Alphabetical")
// checked: NeoChatConfig.sortOrder === 0
// enabled: !NeoChatConfig.isSortOrderImmutable
// onToggled: {
// NeoChatConfig.sortOrder = 0
// NeoChatConfig.customSortOrder = []
// NeoChatConfig.save()
// }
// }
// FormCard.FormRadioDelegate {
// text: i18nc("As in 'sort something based on the last event'", "Newest Events")
// description: i18nc("@info", "Rooms with the newest events will be shown first.")
// checked: NeoChatConfig.sortOrder === 2
// enabled: !NeoChatConfig.isSortOrderImmutable
// onToggled: {
// NeoChatConfig.sortOrder = 2
// NeoChatConfig.customSortOrder = []
// NeoChatConfig.save()
// }
// }
// FormCard.FormRadioDelegate {
// id: openCustomRoomSortButton
// text: i18nc("@option:radio", "Custom")
// checked: NeoChatConfig.sortOrder === 3
// enabled: !NeoChatConfig.isSortOrderImmutable
// onClicked: {
// Qt.createComponent('org.kde.neochat.settings', 'RoomSortParameterDialog').createObject(root).open();
// }
// }
} }
FormCard.FormCheckDelegate { Kirigami.FormGroup {
id: showStateEvents title: i18nc("@title", "Timeline")
text: i18n("Show state events") Kirigami.FormEntry {
checked: NeoChatConfig.showStateEvent title: i18n("Mark messages as read when:")
enabled: !NeoChatConfig.isShowStateEventImmutable contentItem: QQC2.ComboBox {
onToggled: { id: markAsReadCombo
NeoChatConfig.showStateEvent = checked; textRole: "name"
NeoChatConfig.save(); valueRole: "value"
model: [
{
name: i18n("Never"),
value: 0
},
{
name: i18nc("@item:inlistbox As in mark messages in the room as read when entering the room", "Entering the room"),
value: 1
},
{
name: i18nc("@item:inlistbox As in mark messages in the room as read when entering the room and all messages are visible on screen", "Entering the room and all unread messages are visible"),
value: 2
},
{
name: i18nc("@item:inlistbox As in mark messages in the room as read when exiting the room", "Exiting the room"),
value: 3
},
{
name: i18nc("@item:inlistbox As in mark messages in the room as read when exiting the room and all messages are visible on screen", "Exiting the room and all unread messages are visible"),
value: 4
}
]
Component.onCompleted: currentIndex = NeoChatConfig.markReadCondition
onCurrentValueChanged: NeoChatConfig.markReadCondition = currentValue
}
}
Kirigami.FormSeparator {}
Kirigami.FormEntry {
contentItem: QQC2.CheckBox {
id: showDeletedMessages
text: i18n("Show deleted messages")
checked: NeoChatConfig.showDeletedMessages
enabled: !NeoChatConfig.isShowDeletedMessagesImmutable
onToggled: {
NeoChatConfig.showDeletedMessages = checked;
NeoChatConfig.save();
}
}
}
Kirigami.FormSeparator {}
Kirigami.FormEntry {
contentItem: QQC2.CheckBox {
id: showStateEvents
text: i18n("Show state events")
checked: NeoChatConfig.showStateEvent
enabled: !NeoChatConfig.isShowStateEventImmutable
onToggled: {
NeoChatConfig.showStateEvent = checked;
NeoChatConfig.save();
}
}
}
Kirigami.FormSeparator {
visible: NeoChatConfig.showStateEvent
}
Kirigami.FormEntry {
contentItem: QQC2.CheckBox {
id: showLeaveJoinEventDelegate
visible: NeoChatConfig.showStateEvent
text: i18n("Show leave and join events")
checked: NeoChatConfig.showLeaveJoinEvent
enabled: !NeoChatConfig.isShowLeaveJoinEventImmutable
onToggled: {
NeoChatConfig.showLeaveJoinEvent = checked;
NeoChatConfig.save();
}
}
}
Kirigami.FormSeparator {
visible: NeoChatConfig.showStateEvent
}
Kirigami.FormEntry {
visible: NeoChatConfig.showStateEvent
contentItem: QQC2.CheckBox {
id: showNameDelegate
text: i18n("Show name change events")
checked: NeoChatConfig.showRename
enabled: !NeoChatConfig.isShowRenameImmutable
onToggled: {
NeoChatConfig.showRename = checked;
NeoChatConfig.save();
}
}
}
Kirigami.FormSeparator {
visible: NeoChatConfig.showStateEvent
}
Kirigami.FormEntry {
visible: NeoChatConfig.showStateEvent
contentItem: QQC2.CheckBox {
id: showAvatarChangeDelegate
text: i18n("Show avatar update events")
checked: NeoChatConfig.showAvatarUpdate
enabled: !NeoChatConfig.isShowAvatarUpdateImmutable
onToggled: {
NeoChatConfig.showAvatarUpdate = checked;
NeoChatConfig.save();
}
}
} }
} }
FormCard.FormDelegateSeparator { Kirigami.FormGroup {
visible: NeoChatConfig.showStateEvent title: i18nc("Chat Editor", "Editor")
above: showStateEvents
below: showLeaveJoinEventDelegate
}
FormCard.FormCheckDelegate { Kirigami.FormEntry {
id: showLeaveJoinEventDelegate contentItem: QQC2.CheckBox {
visible: NeoChatConfig.showStateEvent id: quickEditCheckbox
text: i18n("Show leave and join events") text: i18n("Use s/text/replacement syntax to edit your last message")
checked: NeoChatConfig.showLeaveJoinEvent checked: NeoChatConfig.allowQuickEdit
enabled: !NeoChatConfig.isShowLeaveJoinEventImmutable enabled: !NeoChatConfig.isAllowQuickEditImmutable
onToggled: { onToggled: {
NeoChatConfig.showLeaveJoinEvent = checked; NeoChatConfig.allowQuickEdit = checked;
NeoChatConfig.save(); NeoChatConfig.save();
}
}
}
Kirigami.FormSeparator {}
Kirigami.FormEntry {
contentItem: QQC2.CheckBox {
id: typingNotificationsDelegate
text: i18n("Send typing notifications")
checked: NeoChatConfig.typingNotifications
enabled: !NeoChatConfig.isTypingNotificationsImmutable
onToggled: {
NeoChatConfig.typingNotifications = checked;
NeoChatConfig.save();
}
}
} }
} }
FormCard.FormDelegateSeparator { Kirigami.FormGroup {
visible: NeoChatConfig.showStateEvent title: i18n("Developer Settings")
above: showLeaveJoinEventDelegate Kirigami.FormEntry {
below: showNameDelegate contentItem: QQC2.CheckBox {
} id: enableDeveloperToolsDelegate
text: i18n("Enable developer tools")
checked: NeoChatConfig.developerTools
enabled: !NeoChatConfig.isDeveloperToolsImmutable
onToggled: {
NeoChatConfig.developerTools = checked;
NeoChatConfig.save();
}
}
}
Kirigami.FormSeparator {}
FormCard.FormCheckDelegate { Kirigami.FormEntry {
id: showNameDelegate visible: NeoChatConfig.developerTools
visible: NeoChatConfig.showStateEvent contentItem: QQC2.Button {
text: i18n("Show name change events") id: openDeveloperToolsDelegate
checked: NeoChatConfig.showRename icon.name: "tools"
enabled: !NeoChatConfig.isShowRenameImmutable text: i18n("Open Developer Tools")
onToggled: { onClicked: root.QQC2.ApplicationWindow.window.pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat.devtools', 'DevtoolsPage'), {
NeoChatConfig.showRename = checked; connection: root.connection
NeoChatConfig.save(); }, {
title: i18n("Developer Tools")
});
}
} }
} }
Kirigami.FormGroup {
title: i18nc("@title:group", "Default Settings")
FormCard.FormDelegateSeparator { Kirigami.FormEntry {
visible: NeoChatConfig.showStateEvent contentItem: QQC2.Button {
above: showNameDelegate icon.name: "kt-restore-defaults-symbolic"
below: showAvatarChangeDelegate text: i18nc("@action:button", "Reset all configuration values to their default…")
} onClicked: resetDialog.open()
}
FormCard.FormCheckDelegate {
id: showAvatarChangeDelegate
visible: NeoChatConfig.showStateEvent
text: i18n("Show avatar update events")
checked: NeoChatConfig.showAvatarUpdate
enabled: !NeoChatConfig.isShowAvatarUpdateImmutable
onToggled: {
NeoChatConfig.showAvatarUpdate = checked;
NeoChatConfig.save();
} }
} }
} }
FormCard.FormHeader {
title: i18nc("Chat Editor", "Editor")
}
FormCard.FormCard {
FormCard.FormRadioDelegate {
text: i18nc("@option:radio", "Send messages with Enter")
checked: NeoChatConfig.sendMessageWith === 0
visible: !Kirigami.Settings.isMobile
enabled: !NeoChatConfig.isSendMessageWithImmutable
onToggled: {
NeoChatConfig.sendMessageWith = 0
NeoChatConfig.save()
}
}
FormCard.FormRadioDelegate {
id: sendWithEnterRadio
text: i18nc("@option:radio", "Send messages with Ctrl+Enter")
checked: NeoChatConfig.sendMessageWith === 1
visible: !Kirigami.Settings.isMobile
enabled: !NeoChatConfig.isSendMessageWithImmutable
onToggled: {
NeoChatConfig.sendMessageWith = 1
NeoChatConfig.save()
}
}
FormCard.FormDelegateSeparator {
visible: !Kirigami.Settings.isMobile
above: sendWithEnterRadio
below: quickEditCheckbox
}
FormCard.FormCheckDelegate {
id: quickEditCheckbox
text: i18n("Use s/text/replacement syntax to edit your last message")
checked: NeoChatConfig.allowQuickEdit
enabled: !NeoChatConfig.isAllowQuickEditImmutable
onToggled: {
NeoChatConfig.allowQuickEdit = checked;
NeoChatConfig.save();
}
}
FormCard.FormDelegateSeparator {
above: quickEditCheckbox
below: typingNotificationsDelegate
}
FormCard.FormCheckDelegate {
id: typingNotificationsDelegate
text: i18n("Send typing notifications")
checked: NeoChatConfig.typingNotifications
enabled: !NeoChatConfig.isTypingNotificationsImmutable
onToggled: {
NeoChatConfig.typingNotifications = checked;
NeoChatConfig.save();
}
}
}
FormCard.FormHeader {
title: i18n("Developer Settings")
}
FormCard.FormCard {
FormCard.FormCheckDelegate {
id: enableDeveloperToolsDelegate
text: i18n("Enable developer tools")
checked: NeoChatConfig.developerTools
enabled: !NeoChatConfig.isDeveloperToolsImmutable
onToggled: {
NeoChatConfig.developerTools = checked;
NeoChatConfig.save();
}
}
FormCard.FormDelegateSeparator {
above: enableDeveloperToolsDelegate
below: openDeveloperToolsDelegate
}
FormCard.FormButtonDelegate {
id: openDeveloperToolsDelegate
visible: NeoChatConfig.developerTools
icon.name: "tools"
text: i18n("Open Developer Tools")
onClicked: root.QQC2.ApplicationWindow.window.pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat.devtools', 'DevtoolsPage'), {
connection: root.connection
}, {
title: i18n("Developer Tools")
});
}
}
FormCard.FormHeader {
title: i18nc("@title:group", "Default Settings")
}
FormCard.FormCard {
FormCard.FormButtonDelegate {
icon.name: "kt-restore-defaults-symbolic"
text: i18nc("@action:button", "Reset all configuration values to their default…")
onClicked: resetDialog.open()
}
}
Kirigami.PromptDialog { Kirigami.PromptDialog {
id: resetDialog id: resetDialog
title: i18nc("@title:dialog", "Reset Configuration") title: i18nc("@title:dialog", "Reset Configuration")