From 92029b20f64402317acb93dacacaa69c76b66a43 Mon Sep 17 00:00:00 2001 From: Nicolas Fella Date: Tue, 28 May 2024 23:57:08 +0200 Subject: [PATCH] Let kconfigxt do QML registration --- src/CMakeLists.txt | 4 +- src/chatbar/ChatBar.qml | 6 +- src/devtools/DebugOptions.qml | 14 +-- src/devtools/FeatureFlagPage.qml | 14 +-- src/foreigntypes.h | 14 --- src/neochatconfig.kcfgc | 1 + src/qml/AccountMenu.qml | 4 +- src/qml/DelegateContextMenu.qml | 2 +- src/qml/FileDelegateContextMenu.qml | 6 +- src/qml/HoverActions.qml | 2 +- src/qml/Main.qml | 18 ++-- src/qml/NeochatMaximizeComponent.qml | 4 +- src/qml/RoomDelegate.qml | 12 +-- src/qml/RoomDrawer.qml | 12 +-- src/qml/RoomListPage.qml | 10 +- src/qml/RoomPage.qml | 2 +- src/qml/TimelineView.qml | 6 +- src/settings/AccountEditorPage.qml | 2 +- src/settings/AppearanceSettingsPage.qml | 90 ++++++++--------- src/settings/ColorScheme.qml | 6 +- src/settings/DeviceDelegate.qml | 2 +- src/settings/NeoChatGeneralPage.qml | 126 ++++++++++++------------ src/settings/NeoChatSettings.qml | 2 +- src/settings/NetworkProxyPage.qml | 32 +++--- src/timeline/EventDelegate.qml | 2 +- src/timeline/FileComponent.qml | 6 +- src/timeline/HiddenDelegate.qml | 4 +- src/timeline/LoadingDelegate.qml | 4 +- src/timeline/MessageDelegate.qml | 26 ++--- src/timeline/ReactionDelegate.qml | 2 +- src/timeline/ReadMarkerDelegate.qml | 4 +- src/timeline/SectionDelegate.qml | 2 +- src/timeline/StateDelegate.qml | 6 +- src/timeline/TimelineEndDelegate.qml | 4 +- 34 files changed, 219 insertions(+), 232 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index beaf3a5d4..98acdc752 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -191,6 +191,8 @@ set_source_files_properties(qml/OsmLocationPlugin.qml PROPERTIES QT_QML_SINGLETON_TYPE TRUE ) +kconfig_add_kcfg_files(neochat GENERATE_MOC neochatconfig.kcfgc) + qt_add_qml_module(neochat URI org.kde.neochat NO_PLUGIN OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/src/org/kde/neochat QML_FILES @@ -418,8 +420,6 @@ if (TARGET KF6::Crash) target_link_libraries(neochat PUBLIC KF6::Crash) endif() -kconfig_add_kcfg_files(neochat GENERATE_MOC neochatconfig.kcfgc) - if(NEOCHAT_FLATPAK) target_compile_definitions(neochat PUBLIC NEOCHAT_FLATPAK) endif() diff --git a/src/chatbar/ChatBar.qml b/src/chatbar/ChatBar.qml index f18b594a1..01807b4ac 100644 --- a/src/chatbar/ChatBar.qml +++ b/src/chatbar/ChatBar.qml @@ -219,7 +219,7 @@ QQC2.Control { } onTextChanged: { - if (!repeatTimer.running && Config.typingNotifications) { + if (!repeatTimer.running && NeoChatConfig.typingNotifications) { var textExists = text.length > 0; root.currentRoom.sendTypingNotification(textExists); textExists ? repeatTimer.start() : repeatTimer.stop(); @@ -353,8 +353,8 @@ QQC2.Control { startBreakpoint: Kirigami.Units.gridUnit * 46 endBreakpoint: Kirigami.Units.gridUnit * 66 startPercentWidth: 100 - endPercentWidth: Config.compactLayout ? 100 : 85 - maxWidth: Config.compactLayout ? -1 : Kirigami.Units.gridUnit * 60 + endPercentWidth: NeoChatConfig.compactLayout ? 100 : 85 + maxWidth: NeoChatConfig.compactLayout ? -1 : Kirigami.Units.gridUnit * 60 parentWidth: root.width } diff --git a/src/devtools/DebugOptions.qml b/src/devtools/DebugOptions.qml index 2c82e7fe1..cb61c3222 100644 --- a/src/devtools/DebugOptions.qml +++ b/src/devtools/DebugOptions.qml @@ -17,25 +17,25 @@ FormCard.FormCardPage { FormCard.FormCheckDelegate { text: i18nc("@option:check", "Show hidden events in the timeline") - checked: Config.showAllEvents + checked: NeoChatConfig.showAllEvents - onToggled: Config.showAllEvents = checked + onToggled: NeoChatConfig.showAllEvents = checked } FormCard.FormCheckDelegate { id: roomAccountDataVisibleCheck text: i18nc("@option:check Enable the matrix 'threads' feature", "Always allow device verification") description: i18n("Allow the user to start a verification session with devices that were already verified") - checked: Config.alwaysVerifyDevice + checked: NeoChatConfig.alwaysVerifyDevice - onToggled: Config.alwaysVerifyDevice = checked + onToggled: NeoChatConfig.alwaysVerifyDevice = checked } FormCard.FormCheckDelegate { text: i18nc("@option:check", "Show focus in window header") - checked: Config.windowTitleFocus + checked: NeoChatConfig.windowTitleFocus onToggled: { - Config.windowTitleFocus = checked; - Config.save(); + NeoChatConfig.windowTitleFocus = checked; + NeoChatConfig.save(); } } } diff --git a/src/devtools/FeatureFlagPage.qml b/src/devtools/FeatureFlagPage.qml index e17d854fb..c278bc77c 100644 --- a/src/devtools/FeatureFlagPage.qml +++ b/src/devtools/FeatureFlagPage.qml @@ -18,23 +18,23 @@ FormCard.FormCardPage { FormCard.FormCheckDelegate { id: roomAccountDataVisibleCheck text: i18nc("@option:check Enable the matrix 'threads' feature", "Threads") - checked: Config.threads + checked: NeoChatConfig.threads - onToggled: Config.threads = checked + onToggled: NeoChatConfig.threads = checked } FormCard.FormCheckDelegate { text: i18nc("@option:check Enable the matrix 'secret backup' feature", "Secret Backup") - checked: Config.secretBackup + checked: NeoChatConfig.secretBackup - onToggled: Config.secretBackup = checked + onToggled: NeoChatConfig.secretBackup = checked } FormCard.FormCheckDelegate { text: i18nc("@option:check Enable the matrix feature to add a phone number as a third party ID", "Add phone numbers as 3PIDs") - checked: Config.phone3PId + checked: NeoChatConfig.phone3PId onToggled: { - Config.phone3PId = checked - Config.save(); + NeoChatConfig.phone3PId = checked + NeoChatConfig.save(); } } } diff --git a/src/foreigntypes.h b/src/foreigntypes.h index 88d1e127e..a0500d665 100644 --- a/src/foreigntypes.h +++ b/src/foreigntypes.h @@ -12,20 +12,6 @@ #endif #include "controller.h" -#include "neochatconfig.h" - -struct ForeignConfig { - Q_GADGET - QML_FOREIGN(NeoChatConfig) - QML_NAMED_ELEMENT(Config) - QML_SINGLETON -public: - static NeoChatConfig *create(QQmlEngine *, QJSEngine *) - { - QQmlEngine::setObjectOwnership(NeoChatConfig::self(), QQmlEngine::CppOwnership); - return NeoChatConfig::self(); - } -}; struct ForeignAccountRegistry { Q_GADGET diff --git a/src/neochatconfig.kcfgc b/src/neochatconfig.kcfgc index 0ef384dd3..3b4d1bc06 100644 --- a/src/neochatconfig.kcfgc +++ b/src/neochatconfig.kcfgc @@ -7,3 +7,4 @@ DefaultValueGetters=true GenerateProperties=true ParentInConstructor=true Singleton=true +QmlRegistration=true diff --git a/src/qml/AccountMenu.qml b/src/qml/AccountMenu.qml index 7ae7edf29..a12e612b8 100644 --- a/src/qml/AccountMenu.qml +++ b/src/qml/AccountMenu.qml @@ -54,7 +54,7 @@ QQC2.Menu { QQC2.MenuItem { text: i18n("Open developer tools") icon.name: "tools" - visible: Config.developerTools + visible: NeoChatConfig.developerTools onTriggered: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat.devtools', 'DevtoolsPage'), { connection: root.connection }, { @@ -66,7 +66,7 @@ QQC2.Menu { QQC2.MenuItem { text: i18nc("@action:inmenu", "Open Secret Backup") icon.name: "unlock" - visible: Config.secretBackup + visible: NeoChatConfig.secretBackup onTriggered: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'UnlockSSSSDialog'), {}, { title: i18nc("@title:window", "Open Key Backup") }) diff --git a/src/qml/DelegateContextMenu.qml b/src/qml/DelegateContextMenu.qml index 224c15aab..05eac0ef9 100644 --- a/src/qml/DelegateContextMenu.qml +++ b/src/qml/DelegateContextMenu.qml @@ -83,7 +83,7 @@ Loader { * Some common actions shared between menus */ component ViewSourceAction: Kirigami.Action { - visible: Config.developerTools + visible: NeoChatConfig.developerTools text: i18n("View Source") icon.name: "code-context" onTriggered: RoomManager.viewEventSource(root.eventId) diff --git a/src/qml/FileDelegateContextMenu.qml b/src/qml/FileDelegateContextMenu.qml index 071beebd8..495035d18 100644 --- a/src/qml/FileDelegateContextMenu.qml +++ b/src/qml/FileDelegateContextMenu.qml @@ -101,13 +101,13 @@ DelegateContextMenu { id: saveAsDialog FileDialog { fileMode: FileDialog.SaveFile - folder: Config.lastSaveDirectory.length > 0 ? Config.lastSaveDirectory : StandardPaths.writableLocation(StandardPaths.DownloadLocation) + folder: NeoChatConfig.lastSaveDirectory.length > 0 ? NeoChatConfig.lastSaveDirectory : StandardPaths.writableLocation(StandardPaths.DownloadLocation) onAccepted: { if (!currentFile) { return; } - Config.lastSaveDirectory = folder; - Config.save(); + NeoChatConfig.lastSaveDirectory = folder; + NeoChatConfig.save(); currentRoom.downloadFile(eventId, currentFile); } } diff --git a/src/qml/HoverActions.qml b/src/qml/HoverActions.qml index f1f6eba20..d3965a0a0 100644 --- a/src/qml/HoverActions.qml +++ b/src/qml/HoverActions.qml @@ -110,7 +110,7 @@ QQC2.Control { } }, Kirigami.Action { - visible: Config.threads && !root.currentRoom.readOnly + visible: NeoChatConfig.threads && !root.currentRoom.readOnly text: i18n("Reply in Thread") icon.name: "dialog-messages" onTriggered: { diff --git a/src/qml/Main.qml b/src/qml/Main.qml index 5311fd986..bf8797fbd 100644 --- a/src/qml/Main.qml +++ b/src/qml/Main.qml @@ -18,7 +18,7 @@ Kirigami.ApplicationWindow { readonly property HoverLinkIndicator hoverLinkIndicator: linkIndicator - title: Config.windowTitleFocus ? activeFocusItem + " " + (activeFocusItem ? activeFocusItem.Accessible.name : "") : "NeoChat" + title: NeoChatConfig.windowTitleFocus ? activeFocusItem + " " + (activeFocusItem ? activeFocusItem.Accessible.name : "") : "NeoChat" minimumWidth: Kirigami.Units.gridUnit * 20 minimumHeight: Kirigami.Units.gridUnit * 15 @@ -157,7 +157,7 @@ Kirigami.ApplicationWindow { // This is a memory for all user initiated actions on the drawer, i.e. clicking the button // It is used to ensure that user choice is remembered when changing pages and expanding and contracting the window width - property bool drawerUserState: Config.autoRoomInfoDrawer + property bool drawerUserState: NeoChatConfig.autoRoomInfoDrawer connection: root.connection @@ -178,7 +178,7 @@ Kirigami.ApplicationWindow { modal: (!root.wideScreen || !enabled) onEnabledChanged: drawerOpen = enabled && !modal onModalChanged: { - if (Config.autoRoomInfoDrawer) { + if (NeoChatConfig.autoRoomInfoDrawer) { drawerOpen = !modal && drawerUserState; dim = false; } @@ -190,11 +190,11 @@ Kirigami.ApplicationWindow { Component.onCompleted: { CustomEmojiModel.connection = root.connection; SpaceHierarchyCache.connection = root.connection; - WindowController.setBlur(pageStack, Config.blur && !Config.compactLayout); + WindowController.setBlur(pageStack, NeoChatConfig.blur && !NeoChatConfig.compactLayout); if (ShareHandler.text && root.connection) { root.handleShare() } - if (Config.minimizeToSystemTrayOnStartup && !Kirigami.Settings.isMobile && Controller.supportSystemTray && Config.systemTray) { + if (NeoChatConfig.minimizeToSystemTrayOnStartup && !Kirigami.Settings.isMobile && Controller.supportSystemTray && NeoChatConfig.systemTray) { restoreWindowGeometryConnections.enabled = true; // To restore window size and position } else { visible = true; @@ -204,19 +204,19 @@ Kirigami.ApplicationWindow { Connections { target: Config function onBlurChanged() { - WindowController.setBlur(pageStack, Config.blur && !Config.compactLayout); + WindowController.setBlur(pageStack, NeoChatConfig.blur && !NeoChatConfig.compactLayout); } function onCompactLayoutChanged() { - WindowController.setBlur(pageStack, Config.blur && !Config.compactLayout); + WindowController.setBlur(pageStack, NeoChatConfig.blur && !NeoChatConfig.compactLayout); } } // blur effect - color: Config.blur && !Config.compactLayout ? "transparent" : Kirigami.Theme.backgroundColor + color: NeoChatConfig.blur && !NeoChatConfig.compactLayout ? "transparent" : Kirigami.Theme.backgroundColor // we need to apply the translucency effect separately on top of the color background: Rectangle { - color: Config.blur && !Config.compactLayout ? Qt.rgba(Kirigami.Theme.backgroundColor.r, Kirigami.Theme.backgroundColor.g, Kirigami.Theme.backgroundColor.b, 1 - Config.transparency) : "transparent" + color: NeoChatConfig.blur && !NeoChatConfig.compactLayout ? Qt.rgba(Kirigami.Theme.backgroundColor.r, Kirigami.Theme.backgroundColor.g, Kirigami.Theme.backgroundColor.b, 1 - NeoChatConfig.transparency) : "transparent" } Component { diff --git a/src/qml/NeochatMaximizeComponent.qml b/src/qml/NeochatMaximizeComponent.qml index 8126b7952..d6e6b473e 100644 --- a/src/qml/NeochatMaximizeComponent.qml +++ b/src/qml/NeochatMaximizeComponent.qml @@ -102,8 +102,8 @@ Components.AlbumMaximizeComponent { fileMode: Platform.FileDialog.SaveFile folder: root.saveFolder onAccepted: { - Config.lastSaveDirectory = folder; - Config.save(); + NeoChatConfig.lastSaveDirectory = folder; + NeoChatConfig.save(); if (!currentFile) { return; } diff --git a/src/qml/RoomDelegate.qml b/src/qml/RoomDelegate.qml index 79b6c3013..c965c4218 100644 --- a/src/qml/RoomDelegate.qml +++ b/src/qml/RoomDelegate.qml @@ -56,8 +56,8 @@ Delegates.RoundedItemDelegate { Components.Avatar { source: root.avatar ? root.connection.makeMediaUrl("mxc://" + root.avatar) : "" name: root.displayName - visible: Config.showAvatarInRoomDrawer - implicitHeight: Kirigami.Units.gridUnit + (Config.compactRoomList ? 0 : Kirigami.Units.largeSpacing * 2) + visible: NeoChatConfig.showAvatarInRoomDrawer + implicitHeight: Kirigami.Units.gridUnit + (NeoChatConfig.compactRoomList ? 0 : Kirigami.Units.largeSpacing * 2) implicitWidth: visible ? implicitHeight : 0 Layout.fillHeight: true @@ -90,7 +90,7 @@ Delegates.RoundedItemDelegate { elide: Text.ElideRight font: Kirigami.Theme.smallFont opacity: root.hasNotifications ? 0.9 : 0.7 - visible: !Config.compactRoomList && text.length > 0 + visible: !NeoChatConfig.compactRoomList && text.length > 0 textFormat: Text.PlainText Layout.fillWidth: true @@ -136,7 +136,7 @@ Delegates.RoundedItemDelegate { QQC2.Button { id: configButton - visible: root.hovered && !Kirigami.Settings.isMobile && !Config.compactRoomList && !root.collapsed && root.showConfigure + visible: root.hovered && !Kirigami.Settings.isMobile && !NeoChatConfig.compactRoomList && !root.collapsed && root.showConfigure text: i18n("Configure room") display: QQC2.Button.IconOnly @@ -154,14 +154,14 @@ Delegates.RoundedItemDelegate { room: root.currentRoom, connection: root.connection }); - if (!Kirigami.Settings.isMobile && !Config.compactRoomList) { + if (!Kirigami.Settings.isMobile && !NeoChatConfig.compactRoomList) { configButton.visible = true; configButton.down = true; } menu.closed.connect(function () { configButton.down = undefined; configButton.visible = Qt.binding(() => { - return root.hovered && !Kirigami.Settings.isMobile && !Config.compactRoomList; + return root.hovered && !Kirigami.Settings.isMobile && !NeoChatConfig.compactRoomList; }); }); menu.open(); diff --git a/src/qml/RoomDrawer.qml b/src/qml/RoomDrawer.qml index 9b78de883..1055bf137 100644 --- a/src/qml/RoomDrawer.qml +++ b/src/qml/RoomDrawer.qml @@ -24,10 +24,10 @@ Kirigami.OverlayDrawer { readonly property int maxWidth: Kirigami.Units.gridUnit * 25 readonly property int defaultWidth: Kirigami.Units.gridUnit * 20 property int actualWidth: { - if (Config.roomDrawerWidth === -1) { + if (NeoChatConfig.roomDrawerWidth === -1) { return Kirigami.Units.gridUnit * 20; } else { - return Config.roomDrawerWidth; + return NeoChatConfig.roomDrawerWidth; } } @@ -45,8 +45,8 @@ Kirigami.OverlayDrawer { visible: true onPressed: _lastX = mapToGlobal(mouseX, mouseY).x onReleased: { - Config.roomDrawerWidth = root.actualWidth; - Config.save(); + NeoChatConfig.roomDrawerWidth = root.actualWidth; + NeoChatConfig.save(); } property real _lastX: -1 @@ -55,9 +55,9 @@ Kirigami.OverlayDrawer { return; } if (Qt.application.layoutDirection === Qt.RightToLeft) { - root.actualWidth = Math.min(root.maxWidth, Math.max(root.minWidth, Config.roomDrawerWidth - _lastX + mapToGlobal(mouseX, mouseY).x)); + root.actualWidth = Math.min(root.maxWidth, Math.max(root.minWidth, NeoChatConfig.roomDrawerWidth - _lastX + mapToGlobal(mouseX, mouseY).x)); } else { - root.actualWidth = Math.min(root.maxWidth, Math.max(root.minWidth, Config.roomDrawerWidth + _lastX - mapToGlobal(mouseX, mouseY).x)); + root.actualWidth = Math.min(root.maxWidth, Math.max(root.minWidth, NeoChatConfig.roomDrawerWidth + _lastX - mapToGlobal(mouseX, mouseY).x)); } } } diff --git a/src/qml/RoomListPage.qml b/src/qml/RoomListPage.qml index 0fbe291af..dd8ffe8ce 100644 --- a/src/qml/RoomListPage.qml +++ b/src/qml/RoomListPage.qml @@ -27,7 +27,7 @@ Kirigami.Page { required property NeoChatConnection connection - readonly property bool collapsed: Config.collapsed + readonly property bool collapsed: NeoChatConfig.collapsed signal search @@ -258,7 +258,7 @@ Kirigami.Page { if (_private.currentWidth < _private.collapseWidth && _private.currentWidth + (mouse.x - _lastX) >= _private.collapseWidth) { // Here we get back directly to a more wide mode. _private.currentWidth = _private.defaultWidth; - Config.collapsed = false; + NeoChatConfig.collapsed = false; } else if (_private.currentWidth >= _private.collapseWidth) { // Increase page width _private.currentWidth = Math.min(_private.defaultWidth, _private.currentWidth + (mouse.x - _lastX)); @@ -267,7 +267,7 @@ Kirigami.Page { const tmpWidth = _private.currentWidth - (_lastX - mouse.x); if (tmpWidth < _private.collapseWidth) { _private.currentWidth = Qt.binding(() => _private.collapsedSize); - Config.collapsed = true; + NeoChatConfig.collapsed = true; } else { _private.currentWidth = tmpWidth; } @@ -324,9 +324,9 @@ Kirigami.Page { */ QtObject { id: _private - property int currentWidth: Config.collapsed ? collapsedSize : defaultWidth + property int currentWidth: NeoChatConfig.collapsed ? collapsedSize : defaultWidth readonly property int defaultWidth: Kirigami.Units.gridUnit * 17 readonly property int collapseWidth: Kirigami.Units.gridUnit * 10 - readonly property int collapsedSize: Kirigami.Units.gridUnit + (Config.compactRoomList ? 0 : Kirigami.Units.largeSpacing * 2) + Kirigami.Units.largeSpacing * 2 + (scrollView.QQC2.ScrollBar.vertical.visible ? scrollView.QQC2.ScrollBar.vertical.width : 0) + readonly property int collapsedSize: Kirigami.Units.gridUnit + (NeoChatConfig.compactRoomList ? 0 : Kirigami.Units.largeSpacing * 2) + Kirigami.Units.largeSpacing * 2 + (scrollView.QQC2.ScrollBar.vertical.visible ? scrollView.QQC2.ScrollBar.vertical.width : 0) } } diff --git a/src/qml/RoomPage.qml b/src/qml/RoomPage.qml index b0f8bba59..e22027111 100644 --- a/src/qml/RoomPage.qml +++ b/src/qml/RoomPage.qml @@ -169,7 +169,7 @@ Kirigami.Page { background: Rectangle { Kirigami.Theme.colorSet: Kirigami.Theme.View Kirigami.Theme.inherit: false - color: Config.compactLayout ? Kirigami.Theme.backgroundColor : "transparent" + color: NeoChatConfig.compactLayout ? Kirigami.Theme.backgroundColor : "transparent" } footer: Loader { diff --git a/src/qml/TimelineView.qml b/src/qml/TimelineView.qml index 1c136335b..7b3520ff4 100644 --- a/src/qml/TimelineView.qml +++ b/src/qml/TimelineView.qml @@ -142,12 +142,12 @@ QQC2.ScrollView { footer: Item { z: 3 width: root.width - visible: messageListView.sectionBannerItem && messageListView.sectionBannerItem.ListView.section !== "" && !Config.blur + visible: messageListView.sectionBannerItem && messageListView.sectionBannerItem.ListView.section !== "" && !NeoChatConfig.blur SectionDelegate { id: sectionDelegate anchors.leftMargin: state === "alignLeft" ? Kirigami.Units.largeSpacing : 0 - state: Config.compactLayout ? "alignLeft" : "alignCenter" + state: NeoChatConfig.compactLayout ? "alignLeft" : "alignCenter" // Align left when in compact mode and center when using bubbles states: [ State { @@ -170,7 +170,7 @@ QQC2.ScrollView { width: messageListView.sectionBannerItem ? messageListView.sectionBannerItem.contentItem.width : 0 labelText: messageListView.sectionBannerItem ? messageListView.sectionBannerItem.ListView.section : "" - colorSet: Config.compactLayout ? Kirigami.Theme.View : Kirigami.Theme.Window + colorSet: NeoChatConfig.compactLayout ? Kirigami.Theme.View : Kirigami.Theme.Window } } footerPositioning: ListView.OverlayHeader diff --git a/src/settings/AccountEditorPage.qml b/src/settings/AccountEditorPage.qml index 9fcddba59..13b785111 100644 --- a/src/settings/AccountEditorPage.qml +++ b/src/settings/AccountEditorPage.qml @@ -202,7 +202,7 @@ FormCard.FormCardPage { medium: "email" } ThreePIdCard { - visible: Config.phone3PId + visible: NeoChatConfig.phone3PId connection: root.connection title: i18n("Phone Numbers") medium: "msisdn" diff --git a/src/settings/AppearanceSettingsPage.qml b/src/settings/AppearanceSettingsPage.qml index a30c905a2..bddbf774d 100644 --- a/src/settings/AppearanceSettingsPage.qml +++ b/src/settings/AppearanceSettingsPage.qml @@ -41,8 +41,8 @@ FormCard.FormCardPage { KirigamiComponents.Avatar { color: "#4a5bcc" Layout.alignment: Qt.AlignTop - visible: Config.showAvatarInTimeline - Layout.preferredWidth: Config.showAvatarInTimeline ? Kirigami.Units.largeSpacing * 2 : 0 + visible: NeoChatConfig.showAvatarInTimeline + Layout.preferredWidth: NeoChatConfig.showAvatarInTimeline ? Kirigami.Units.largeSpacing * 2 : 0 Layout.preferredHeight: Kirigami.Units.largeSpacing * 2 } QQC2.Control { @@ -78,8 +78,8 @@ FormCard.FormCardPage { KirigamiComponents.Avatar { color: "#9f244b" Layout.alignment: Qt.AlignTop - visible: Config.showAvatarInTimeline - Layout.preferredWidth: Config.showAvatarInTimeline ? Kirigami.Units.largeSpacing * 2 : 0 + visible: NeoChatConfig.showAvatarInTimeline + Layout.preferredWidth: NeoChatConfig.showAvatarInTimeline ? Kirigami.Units.largeSpacing * 2 : 0 Layout.preferredHeight: Kirigami.Units.largeSpacing * 2 } QQC2.Control { @@ -113,13 +113,13 @@ FormCard.FormCardPage { ] text: i18n("Bubbles") - checked: !Config.compactLayout + checked: !NeoChatConfig.compactLayout QQC2.ButtonGroup.group: themeGroup - enabled: !Config.isCompactLayoutImmutable + enabled: !NeoChatConfig.isCompactLayoutImmutable onToggled: { - Config.compactLayout = !checked; - Config.save(); + NeoChatConfig.compactLayout = !checked; + NeoChatConfig.save(); } } ThemeRadioButton { @@ -131,8 +131,8 @@ FormCard.FormCardPage { KirigamiComponents.Avatar { color: "#4a5bcc" Layout.alignment: Qt.AlignTop - visible: Config.showAvatarInTimeline - Layout.preferredWidth: Config.showAvatarInTimeline ? Kirigami.Units.largeSpacing * 2 : 0 + visible: NeoChatConfig.showAvatarInTimeline + Layout.preferredWidth: NeoChatConfig.showAvatarInTimeline ? Kirigami.Units.largeSpacing * 2 : 0 Layout.preferredHeight: Kirigami.Units.largeSpacing * 2 } ColumnLayout { @@ -158,8 +158,8 @@ FormCard.FormCardPage { KirigamiComponents.Avatar { color: "#9f244b" Layout.alignment: Qt.AlignTop - visible: Config.showAvatarInTimeline - Layout.preferredWidth: Config.showAvatarInTimeline ? Kirigami.Units.largeSpacing * 2 : 0 + visible: NeoChatConfig.showAvatarInTimeline + Layout.preferredWidth: NeoChatConfig.showAvatarInTimeline ? Kirigami.Units.largeSpacing * 2 : 0 Layout.preferredHeight: Kirigami.Units.largeSpacing * 2 } ColumnLayout { @@ -182,13 +182,13 @@ FormCard.FormCardPage { } ] text: i18n("Compact") - checked: Config.compactLayout + checked: NeoChatConfig.compactLayout QQC2.ButtonGroup.group: themeGroup - enabled: !Config.isCompactLayoutImmutable + enabled: !NeoChatConfig.isCompactLayoutImmutable onToggled: { - Config.compactLayout = checked; - Config.save(); + NeoChatConfig.compactLayout = checked; + NeoChatConfig.save(); } } Item { @@ -204,10 +204,10 @@ FormCard.FormCardPage { FormCard.FormCheckDelegate { id: compactRoomListDelegate text: i18n("Use compact room list") - checked: Config.compactRoomList + checked: NeoChatConfig.compactRoomList onToggled: { - Config.compactRoomList = checked; - Config.save(); + NeoChatConfig.compactRoomList = checked; + NeoChatConfig.save(); } } @@ -231,11 +231,11 @@ FormCard.FormCardPage { id: hasWindowSystemDelegate visible: WindowController.hasWindowSystem text: i18n("Use transparent chat page") - enabled: !Config.compactLayout && !Config.isBlurImmutable - checked: Config.blur + enabled: !NeoChatConfig.compactLayout && !NeoChatConfig.isBlurImmutable + checked: NeoChatConfig.blur onToggled: { - Config.blur = checked; - Config.save(); + NeoChatConfig.blur = checked; + NeoChatConfig.save(); } } @@ -246,8 +246,8 @@ FormCard.FormCardPage { FormCard.AbstractFormDelegate { id: transparencyDelegate - visible: WindowController.hasWindowSystem && Config.blur - enabled: !Config.isTransparancyImmutable + visible: WindowController.hasWindowSystem && NeoChatConfig.blur + enabled: !NeoChatConfig.isTransparancyImmutable background: Item {} contentItem: ColumnLayout { QQC2.Label { @@ -255,14 +255,14 @@ FormCard.FormCardPage { Layout.fillWidth: true } QQC2.Slider { - enabled: !Config.compactLayout && Config.blur + enabled: !NeoChatConfig.compactLayout && NeoChatConfig.blur from: 0 to: 1 stepSize: 0.05 - value: Config.transparency + value: NeoChatConfig.transparency onMoved: { - Config.transparency = value; - Config.save(); + NeoChatConfig.transparency = value; + NeoChatConfig.save(); } Layout.fillWidth: true @@ -273,7 +273,7 @@ FormCard.FormCardPage { QQC2.ToolTip.text: i18n("Only enabled if the transparent chat page is enabled.") } QQC2.Label { - text: Math.round(Config.transparency * 100) + "%" + text: Math.round(NeoChatConfig.transparency * 100) + "%" Layout.fillWidth: true } } @@ -288,11 +288,11 @@ FormCard.FormCardPage { FormCard.FormCheckDelegate { id: showLocalMessagesOnRightDelegate text: i18n("Show your messages on the right") - checked: Config.showLocalMessagesOnRight - enabled: !Config.isShowLocalMessagesOnRightImmutable && !Config.compactLayout + checked: NeoChatNeoChatConfig.showLocalMessagesOnRight + enabled: !NeoChatConfig.isShowLocalMessagesOnRightImmutable && !NeoChatConfig.compactLayout onToggled: { - Config.showLocalMessagesOnRight = checked; - Config.save(); + NeoChatConfig.showLocalMessagesOnRight = checked; + NeoChatConfig.save(); } } @@ -304,10 +304,10 @@ FormCard.FormCardPage { FormCard.FormCheckDelegate { id: showLinkPreviewDelegate text: i18n("Show links preview in the chat messages") - checked: Config.showLinkPreview + checked: NeoChatConfig.showLinkPreview onToggled: { - Config.showLinkPreview = checked; - Config.save(); + NeoChatConfig.showLinkPreview = checked; + NeoChatConfig.save(); } } } @@ -318,21 +318,21 @@ FormCard.FormCardPage { FormCard.FormCard { FormCard.FormCheckDelegate { text: i18n("In chat") - checked: Config.showAvatarInTimeline + checked: NeoChatConfig.showAvatarInTimeline onToggled: { - Config.showAvatarInTimeline = checked; - Config.save(); + NeoChatConfig.showAvatarInTimeline = checked; + NeoChatConfig.save(); } - enabled: !Config.isShowAvatarInTimelineImmutable + enabled: !NeoChatConfig.isShowAvatarInTimelineImmutable } FormCard.FormCheckDelegate { text: i18n("In sidebar") - checked: Config.showAvatarInRoomDrawer - enabled: !Config.isShowAvatarInRoomDrawerImmutable + checked: NeoChatConfig.showAvatarInRoomDrawer + enabled: !NeoChatConfig.isShowAvatarInRoomDrawerImmutable onToggled: { - Config.showAvatarInRoomDrawer = checked; - Config.save(); + NeoChatConfig.showAvatarInRoomDrawer = checked; + NeoChatConfig.save(); } } } diff --git a/src/settings/ColorScheme.qml b/src/settings/ColorScheme.qml index b0acccf0f..175c7e913 100644 --- a/src/settings/ColorScheme.qml +++ b/src/settings/ColorScheme.qml @@ -15,10 +15,10 @@ FormCard.FormComboBoxDelegate { textRole: "display" valueRole: "display" model: ColorSchemer.model - Component.onCompleted: currentIndex = ColorSchemer.indexForScheme(Config.colorScheme) + Component.onCompleted: currentIndex = ColorSchemer.indexForScheme(NeoChatConfig.colorScheme) onCurrentValueChanged: { ColorSchemer.apply(currentIndex); - Config.colorScheme = ColorSchemer.nameForIndex(currentIndex); - Config.save(); + NeoChatConfig.colorScheme = ColorSchemer.nameForIndex(currentIndex); + NeoChatConfig.save(); } } diff --git a/src/settings/DeviceDelegate.qml b/src/settings/DeviceDelegate.qml index 22520510c..bd9d80966 100644 --- a/src/settings/DeviceDelegate.qml +++ b/src/settings/DeviceDelegate.qml @@ -99,7 +99,7 @@ FormCard.AbstractFormDelegate { } QQC2.ToolButton { display: QQC2.AbstractButton.IconOnly - visible: root.showVerifyButton && (root.type !== DevicesModel.Verified || Config.alwaysVerifyDevice) + visible: root.showVerifyButton && (root.type !== DevicesModel.Verified || NeoChatConfig.alwaysVerifyDevice) action: Kirigami.Action { id: verifyDeviceAction text: i18n("Verify device") diff --git a/src/settings/NeoChatGeneralPage.qml b/src/settings/NeoChatGeneralPage.qml index 913856c1f..bb2f13f3d 100644 --- a/src/settings/NeoChatGeneralPage.qml +++ b/src/settings/NeoChatGeneralPage.qml @@ -22,12 +22,12 @@ FormCard.FormCardPage { FormCard.FormCheckDelegate { id: closeDelegate text: i18n("Show in System Tray") - checked: Config.systemTray + checked: NeoChatConfig.systemTray visible: Controller.supportSystemTray - enabled: !Config.isSystemTrayImmutable + enabled: !NeoChatConfig.isSystemTrayImmutable onToggled: { - Config.systemTray = checked; - Config.save(); + NeoChatConfig.systemTray = checked; + NeoChatConfig.save(); } } @@ -39,12 +39,12 @@ FormCard.FormCardPage { FormCard.FormCheckDelegate { id: minimizeDelegate text: i18n("Minimize to system tray on startup") - checked: Config.minimizeToSystemTrayOnStartup + checked: NeoChatConfig.minimizeToSystemTrayOnStartup visible: Controller.supportSystemTray && !Kirigami.Settings.isMobile - enabled: Config.systemTray && !Config.isMinimizeToSystemTrayOnStartupImmutable + enabled: NeoChatConfig.systemTray && !NeoChatConfig.isMinimizeToSystemTrayOnStartupImmutable onToggled: { - Config.minimizeToSystemTrayOnStartup = checked; - Config.save(); + NeoChatConfig.minimizeToSystemTrayOnStartup = checked; + NeoChatConfig.save(); } } @@ -56,12 +56,12 @@ FormCard.FormCardPage { FormCard.FormCheckDelegate { id: automaticallyDelegate text: i18n("Automatically hide/unhide the room information when resizing the window") - checked: Config.autoRoomInfoDrawer - enabled: !Config.isAutoRoomInfoDrawerImmutable + checked: NeoChatConfig.autoRoomInfoDrawer + enabled: !NeoChatConfig.isAutoRoomInfoDrawerImmutable visible: Qt.platform.os !== "android" onToggled: { - Config.autoRoomInfoDrawer = checked; - Config.save(); + NeoChatConfig.autoRoomInfoDrawer = checked; + NeoChatConfig.save(); } } @@ -72,11 +72,11 @@ FormCard.FormCardPage { FormCard.FormCheckDelegate { id: categorizeDelegate text: i18n("Show all rooms in \"Home\" tab") - checked: Config.allRoomsInHome - enabled: !Config.isAllRoomsInHomeImmutable + checked: NeoChatConfig.allRoomsInHome + enabled: !NeoChatConfig.isAllRoomsInHomeImmutable onToggled: { - Config.allRoomsInHome = checked; - Config.save(); + NeoChatConfig.allRoomsInHome = checked; + NeoChatConfig.save(); } } @@ -87,20 +87,20 @@ FormCard.FormCardPage { FormCard.FormCard { FormCard.FormRadioDelegate { text: i18nc("As in 'sort something based on last activity'", "Activity") - checked: Config.sortOrder === 1 - enabled: !Config.isSortOrderImmutable + checked: NeoChatConfig.sortOrder === 1 + enabled: !NeoChatConfig.isSortOrderImmutable onToggled: { - Config.sortOrder = 1 - Config.save() + NeoChatConfig.sortOrder = 1 + NeoChatConfig.save() } } FormCard.FormRadioDelegate { text: i18nc("As in 'sort something alphabetically'", "Alphabetical") - checked: Config.sortOrder === 0 - enabled: !Config.isSortOrderImmutable + checked: NeoChatConfig.sortOrder === 0 + enabled: !NeoChatConfig.isSortOrderImmutable onToggled: { - Config.sortOrder = 0 - Config.save() + NeoChatConfig.sortOrder = 0 + NeoChatConfig.save() } } } @@ -111,11 +111,11 @@ FormCard.FormCardPage { FormCard.FormCheckDelegate { id: showDeletedMessages text: i18n("Show deleted messages") - checked: Config.showDeletedMessages - enabled: !Config.isShowDeletedMessagesImmutable + checked: NeoChatConfig.showDeletedMessages + enabled: !NeoChatConfig.isShowDeletedMessagesImmutable onToggled: { - Config.showDeletedMessages = checked; - Config.save(); + NeoChatConfig.showDeletedMessages = checked; + NeoChatConfig.save(); } } @@ -127,65 +127,65 @@ FormCard.FormCardPage { FormCard.FormCheckDelegate { id: showStateEvents text: i18n("Show state events") - checked: Config.showStateEvent - enabled: !Config.isShowStateEventImmutable + checked: NeoChatConfig.showStateEvent + enabled: !NeoChatConfig.isShowStateEventImmutable onToggled: { - Config.showStateEvent = checked; - Config.save(); + NeoChatConfig.showStateEvent = checked; + NeoChatConfig.save(); } } FormCard.FormDelegateSeparator { - visible: Config.showStateEvent + visible: NeoChatConfig.showStateEvent above: showStateEvents below: showLeaveJoinEventDelegate } FormCard.FormCheckDelegate { id: showLeaveJoinEventDelegate - visible: Config.showStateEvent + visible: NeoChatConfig.showStateEvent text: i18n("Show leave and join events") - checked: Config.showLeaveJoinEvent - enabled: !Config.isShowLeaveJoinEventImmutable + checked: NeoChatConfig.showLeaveJoinEvent + enabled: !NeoChatConfig.isShowLeaveJoinEventImmutable onToggled: { - Config.showLeaveJoinEvent = checked; - Config.save(); + NeoChatConfig.showLeaveJoinEvent = checked; + NeoChatConfig.save(); } } FormCard.FormDelegateSeparator { - visible: Config.showStateEvent + visible: NeoChatConfig.showStateEvent above: showLeaveJoinEventDelegate below: showNameDelegate } FormCard.FormCheckDelegate { id: showNameDelegate - visible: Config.showStateEvent + visible: NeoChatConfig.showStateEvent text: i18n("Show name change events") - checked: Config.showRename - enabled: !Config.isShowRenameImmutable + checked: NeoChatConfig.showRename + enabled: !NeoChatConfig.isShowRenameImmutable onToggled: { - Config.showRename = checked; - Config.save(); + NeoChatConfig.showRename = checked; + NeoChatConfig.save(); } } FormCard.FormDelegateSeparator { - visible: Config.showStateEvent + visible: NeoChatConfig.showStateEvent above: showNameDelegate below: showAvatarChangeDelegate } FormCard.FormCheckDelegate { id: showAvatarChangeDelegate - visible: Config.showStateEvent + visible: NeoChatConfig.showStateEvent text: i18n("Show avatar update events") - checked: Config.showAvatarUpdate - enabled: !Config.isShowAvatarUpdateImmutable + checked: NeoChatConfig.showAvatarUpdate + enabled: !NeoChatConfig.isShowAvatarUpdateImmutable onToggled: { - Config.showAvatarUpdate = checked; - Config.save(); + NeoChatConfig.showAvatarUpdate = checked; + NeoChatConfig.save(); } } } @@ -196,11 +196,11 @@ FormCard.FormCardPage { FormCard.FormCheckDelegate { id: quickEditCheckbox text: i18n("Use s/text/replacement syntax to edit your last message") - checked: Config.allowQuickEdit - enabled: !Config.isAllowQuickEditImmutable + checked: NeoChatConfig.allowQuickEdit + enabled: !NeoChatConfig.isAllowQuickEditImmutable onToggled: { - Config.allowQuickEdit = checked; - Config.save(); + NeoChatConfig.allowQuickEdit = checked; + NeoChatConfig.save(); } } FormCard.FormDelegateSeparator { @@ -210,11 +210,11 @@ FormCard.FormCardPage { FormCard.FormCheckDelegate { id: typingNotificationsDelegate text: i18n("Send typing notifications") - checked: Config.typingNotifications - enabled: !Config.isTypingNotificationsImmutable + checked: NeoChatConfig.typingNotifications + enabled: !NeoChatConfig.isTypingNotificationsImmutable onToggled: { - Config.typingNotifications = checked; - Config.save(); + NeoChatConfig.typingNotifications = checked; + NeoChatConfig.save(); } } } @@ -224,15 +224,15 @@ FormCard.FormCardPage { FormCard.FormCard { FormCard.FormCheckDelegate { text: i18n("Enable developer tools") - checked: Config.developerTools - enabled: !Config.isDeveloperToolsImmutable + checked: NeoChatConfig.developerTools + enabled: !NeoChatConfig.isDeveloperToolsImmutable onToggled: { - Config.developerTools = checked; - Config.save(); + NeoChatConfig.developerTools = checked; + NeoChatConfig.save(); } } FormCard.FormButtonDelegate { - visible: Config.developerTools + visible: NeoChatConfig.developerTools text: i18n("Open developer tools") onClicked: applicationWindow().pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat.devtools', 'DevtoolsPage'), { connection: root.connection diff --git a/src/settings/NeoChatSettings.qml b/src/settings/NeoChatSettings.qml index e6dd61799..62f91695b 100644 --- a/src/settings/NeoChatSettings.qml +++ b/src/settings/NeoChatSettings.qml @@ -77,7 +77,7 @@ KirigamiSettings.CategorizedSettings { actionName: "spellChecking" text: i18n("Spell Checking") icon.name: "tools-check-spelling" - page: Qt.resolvedUrl("SonnetConfigPage.qml") + page: Qt.resolvedUrl("SonnetConfigpage.qml") visible: Qt.platform.os !== "android" }, KirigamiSettings.SettingAction { diff --git a/src/settings/NetworkProxyPage.qml b/src/settings/NetworkProxyPage.qml index a8e9c8765..1abbbf9b8 100644 --- a/src/settings/NetworkProxyPage.qml +++ b/src/settings/NetworkProxyPage.qml @@ -24,7 +24,7 @@ FormCard.FormCardPage { FormCard.FormRadioDelegate { text: i18n("System Default") checked: currentType === 0 - enabled: !Config.isProxyTypeImmutable + enabled: !NeoChatConfig.isProxyTypeImmutable onToggled: { currentType = 0; } @@ -32,7 +32,7 @@ FormCard.FormCardPage { FormCard.FormRadioDelegate { text: i18n("No Proxy") checked: currentType === 3 - enabled: !Config.isProxyTypeImmutable + enabled: !NeoChatConfig.isProxyTypeImmutable onToggled: { currentType = 3; } @@ -40,7 +40,7 @@ FormCard.FormCardPage { FormCard.FormRadioDelegate { text: i18n("HTTP") checked: currentType === 1 - enabled: !Config.isProxyTypeImmutable + enabled: !NeoChatConfig.isProxyTypeImmutable onToggled: { currentType = 1; } @@ -48,7 +48,7 @@ FormCard.FormCardPage { FormCard.FormRadioDelegate { text: i18n("Socks5") checked: currentType === 2 - enabled: !Config.isProxyTypeImmutable + enabled: !NeoChatConfig.isProxyTypeImmutable onToggled: { currentType = 2; } @@ -62,7 +62,7 @@ FormCard.FormCardPage { FormCard.FormTextFieldDelegate { id: hostField label: i18n("Host") - text: Config.proxyHost + text: NeoChatConfig.proxyHost inputMethodHints: Qt.ImhUrlCharactersOnly onEditingFinished: { proxyConfigChanged = true; @@ -71,7 +71,7 @@ FormCard.FormCardPage { FormCard.FormSpinBoxDelegate { id: portField label: i18n("Port") - value: Config.proxyPort + value: NeoChatConfig.proxyPort from: 0 to: 65536 textFromValue: function (value, locale) { @@ -84,7 +84,7 @@ FormCard.FormCardPage { FormCard.FormTextFieldDelegate { id: userField label: i18n("User") - text: Config.proxyUser + text: NeoChatConfig.proxyUser inputMethodHints: Qt.ImhUrlCharactersOnly onEditingFinished: { proxyConfigChanged = true; @@ -93,7 +93,7 @@ FormCard.FormCardPage { FormCard.FormTextFieldDelegate { id: passwordField label: i18n("Password") - text: Config.proxyPassword + text: NeoChatConfig.proxyPassword echoMode: TextInput.Password inputMethodHints: Qt.ImhUrlCharactersOnly onEditingFinished: { @@ -111,14 +111,14 @@ FormCard.FormCardPage { QQC2.Button { text: i18n("Apply") - enabled: currentType !== Config.proxyType || proxyConfigChanged + enabled: currentType !== NeoChatConfig.proxyType || proxyConfigChanged onClicked: { - Config.proxyType = currentType; - Config.proxyHost = hostField.text; - Config.proxyPort = portField.value; - Config.proxyUser = userField.text; - Config.proxyPassword = passwordField.text; - Config.save(); + NeoChatConfig.proxyType = currentType; + NeoChatConfig.proxyHost = hostField.text; + NeoChatConfig.proxyPort = portField.value; + NeoChatConfig.proxyUser = userField.text; + NeoChatConfig.proxyPassword = passwordField.text; + NeoChatConfig.save(); proxyConfigChanged = false; ProxyController.setApplicationProxy(); } @@ -127,6 +127,6 @@ FormCard.FormCardPage { } Component.onCompleted: { - currentType = Config.proxyType; + currentType = NeoChatConfig.proxyType; } } diff --git a/src/timeline/EventDelegate.qml b/src/timeline/EventDelegate.qml index 910f27bfb..b345833e7 100644 --- a/src/timeline/EventDelegate.qml +++ b/src/timeline/EventDelegate.qml @@ -50,7 +50,7 @@ DelegateChooser { DelegateChoice { roleValue: DelegateType.Other - delegate: Config.showAllEvents ? hiddenDelegate : emptyDelegate + delegate: NeoChatConfig.showAllEvents ? hiddenDelegate : emptyDelegate Component { id: hiddenDelegate diff --git a/src/timeline/FileComponent.qml b/src/timeline/FileComponent.qml index 2fcbdd60b..b3ff0032a 100644 --- a/src/timeline/FileComponent.qml +++ b/src/timeline/FileComponent.qml @@ -197,10 +197,10 @@ ColumnLayout { FileDialog { fileMode: FileDialog.SaveFile - folder: Config.lastSaveDirectory.length > 0 ? Config.lastSaveDirectory : StandardPaths.writableLocation(StandardPaths.DownloadLocation) + folder: NeoChatConfig.lastSaveDirectory.length > 0 ? NeoChatConfig.lastSaveDirectory : StandardPaths.writableLocation(StandardPaths.DownloadLocation) onAccepted: { - Config.lastSaveDirectory = folder; - Config.save(); + NeoChatConfig.lastSaveDirectory = folder; + NeoChatConfig.save(); if (autoOpenFile) { UrlHelper.copyTo(root.fileTransferInfo.localPath, file); } else { diff --git a/src/timeline/HiddenDelegate.qml b/src/timeline/HiddenDelegate.qml index 7291b948a..2f21047d0 100644 --- a/src/timeline/HiddenDelegate.qml +++ b/src/timeline/HiddenDelegate.qml @@ -42,9 +42,9 @@ TimelineDelegate { required property var author width: parent?.width - rightPadding: Config.compactLayout && root.ListView.view.width >= Kirigami.Units.gridUnit * 20 ? Kirigami.Units.gridUnit * 2 + Kirigami.Units.largeSpacing : Kirigami.Units.largeSpacing + rightPadding: NeoChatConfig.compactLayout && root.ListView.view.width >= Kirigami.Units.gridUnit * 20 ? Kirigami.Units.gridUnit * 2 + Kirigami.Units.largeSpacing : Kirigami.Units.largeSpacing - alwaysFillWidth: Config.compactLayout + alwaysFillWidth: NeoChatConfig.compactLayout contentItem: QQC2.Control { id: contentControl diff --git a/src/timeline/LoadingDelegate.qml b/src/timeline/LoadingDelegate.qml index 539a5ffa0..8a45e6bdc 100644 --- a/src/timeline/LoadingDelegate.qml +++ b/src/timeline/LoadingDelegate.qml @@ -11,9 +11,9 @@ TimelineDelegate { id: root width: parent?.width - rightPadding: Config.compactLayout && root.ListView.view.width >= Kirigami.Units.gridUnit * 20 ? Kirigami.Units.gridUnit * 2 + Kirigami.Units.largeSpacing : Kirigami.Units.largeSpacing + rightPadding: NeoChatConfig.compactLayout && root.ListView.view.width >= Kirigami.Units.gridUnit * 20 ? Kirigami.Units.gridUnit * 2 + Kirigami.Units.largeSpacing : Kirigami.Units.largeSpacing - alwaysFillWidth: Config.compactLayout + alwaysFillWidth: NeoChatConfig.compactLayout contentItem: Kirigami.PlaceholderMessage { text: i18n("Loading…") diff --git a/src/timeline/MessageDelegate.qml b/src/timeline/MessageDelegate.qml index 51640385e..595e5710a 100644 --- a/src/timeline/MessageDelegate.qml +++ b/src/timeline/MessageDelegate.qml @@ -237,9 +237,9 @@ TimelineDelegate { property real contentMaxWidth: bubbleSizeHelper.currentWidth - bubble.leftPadding - bubble.rightPadding width: parent?.width - rightPadding: Config.compactLayout && root.ListView.view.width >= Kirigami.Units.gridUnit * 20 ? Kirigami.Units.gridUnit * 2 + Kirigami.Units.largeSpacing : Kirigami.Units.largeSpacing + rightPadding: NeoChatConfig.compactLayout && root.ListView.view.width >= Kirigami.Units.gridUnit * 20 ? Kirigami.Units.gridUnit * 2 + Kirigami.Units.largeSpacing : Kirigami.Units.largeSpacing - alwaysFillWidth: Config.compactLayout + alwaysFillWidth: NeoChatConfig.compactLayout contentItem: ColumnLayout { spacing: Kirigami.Units.smallSpacing @@ -249,13 +249,13 @@ TimelineDelegate { Layout.fillWidth: true visible: root.showSection labelText: root.section - colorSet: Config.compactLayout || root.alwaysFillWidth ? Kirigami.Theme.View : Kirigami.Theme.Window + colorSet: NeoChatConfig.compactLayout || root.alwaysFillWidth ? Kirigami.Theme.View : Kirigami.Theme.Window } QQC2.ItemDelegate { id: mainContainer Layout.fillWidth: true - Layout.topMargin: root.showAuthor || root.alwaysShowAuthor ? Kirigami.Units.largeSpacing : (Config.compactLayout ? 1 : Kirigami.Units.smallSpacing) + Layout.topMargin: root.showAuthor || root.alwaysShowAuthor ? Kirigami.Units.largeSpacing : (NeoChatConfig.compactLayout ? 1 : Kirigami.Units.smallSpacing) Layout.leftMargin: Kirigami.Units.smallSpacing Layout.rightMargin: Kirigami.Units.smallSpacing @@ -270,7 +270,7 @@ TimelineDelegate { KirigamiComponents.AvatarButton { id: avatar - width: visible || Config.showAvatarInTimeline ? Kirigami.Units.gridUnit + Kirigami.Units.largeSpacing * 2 : 0 + width: visible || NeoChatConfig.showAvatarInTimeline ? Kirigami.Units.gridUnit + Kirigami.Units.largeSpacing * 2 : 0 height: width anchors { left: parent.left @@ -279,7 +279,7 @@ TimelineDelegate { topMargin: Kirigami.Units.smallSpacing } - visible: (root.showAuthor || root.alwaysShowAuthor) && Config.showAvatarInTimeline && (Config.compactLayout || !_private.showUserMessageOnRight) + visible: (root.showAuthor || root.alwaysShowAuthor) && NeoChatConfig.showAvatarInTimeline && (NeoChatConfig.compactLayout || !_private.showUserMessageOnRight) name: root.author.displayName source: root.author.avatarSource color: root.author.color @@ -294,9 +294,9 @@ TimelineDelegate { anchors.rightMargin: Kirigami.Units.largeSpacing maxContentWidth: root.contentMaxWidth - topPadding: Config.compactLayout ? Kirigami.Units.smallSpacing / 2 : Kirigami.Units.largeSpacing - bottomPadding: Config.compactLayout ? Kirigami.Units.mediumSpacing / 2 : Kirigami.Units.largeSpacing - leftPadding: Config.compactLayout ? 0 : Kirigami.Units.largeSpacing + Kirigami.Units.smallSpacing + topPadding: NeoChatConfig.compactLayout ? Kirigami.Units.smallSpacing / 2 : Kirigami.Units.largeSpacing + bottomPadding: NeoChatConfig.compactLayout ? Kirigami.Units.mediumSpacing / 2 : Kirigami.Units.largeSpacing + leftPadding: NeoChatConfig.compactLayout ? 0 : Kirigami.Units.largeSpacing + Kirigami.Units.smallSpacing rightPadding: Kirigami.Units.largeSpacing + Kirigami.Units.smallSpacing state: _private.showUserMessageOnRight ? "userMessageOnRight" : "userMessageOnLeft" @@ -343,11 +343,11 @@ TimelineDelegate { } onShowMessageMenu: _private.showMessageMenu() - showBackground: root.cardBackground && !Config.compactLayout + showBackground: root.cardBackground && !NeoChatConfig.compactLayout } background: Rectangle { - visible: mainContainer.hovered && (Config.compactLayout || root.alwaysFillWidth) + visible: mainContainer.hovered && (NeoChatConfig.compactLayout || root.alwaysFillWidth) color: Kirigami.ColorUtils.tintWithAlpha(Kirigami.Theme.backgroundColor, Kirigami.Theme.highlightColor, 0.15) radius: Kirigami.Units.cornerRadius } @@ -390,7 +390,7 @@ TimelineDelegate { startPercentWidth: root.alwaysFillWidth ? 100 : 90 endPercentWidth: root.alwaysFillWidth ? 100 : 60 - parentWidth: mainContainer.availableWidth - (Config.showAvatarInTimeline ? avatar.width + bubble.anchors.leftMargin : 0) + parentWidth: mainContainer.availableWidth - (NeoChatConfig.showAvatarInTimeline ? avatar.width + bubble.anchors.leftMargin : 0) } } @@ -411,7 +411,7 @@ TimelineDelegate { /** * @brief Whether local user messages should be aligned right. */ - property bool showUserMessageOnRight: Config.showLocalMessagesOnRight && root.author.isLocalUser && !Config.compactLayout && !root.alwaysFillWidth + property bool showUserMessageOnRight: NeoChatConfig.showLocalMessagesOnRight && root.author.isLocalUser && !NeoChatConfig.compactLayout && !root.alwaysFillWidth function showMessageMenu() { RoomManager.viewEventMenu(root.eventId, root.room, root.selectedText); diff --git a/src/timeline/ReactionDelegate.qml b/src/timeline/ReactionDelegate.qml index 3b1ba1755..47817354e 100644 --- a/src/timeline/ReactionDelegate.qml +++ b/src/timeline/ReactionDelegate.qml @@ -56,7 +56,7 @@ Flow { background: Kirigami.ShadowedRectangle { color: reactionDelegate.hasLocalUser ? Kirigami.Theme.positiveBackgroundColor : Kirigami.Theme.backgroundColor Kirigami.Theme.inherit: false - Kirigami.Theme.colorSet: Config.compactLayout ? Kirigami.Theme.Window : Kirigami.Theme.View + Kirigami.Theme.colorSet: NeoChatConfig.compactLayout ? Kirigami.Theme.Window : Kirigami.Theme.View radius: height / 2 shadow { size: Kirigami.Units.smallSpacing diff --git a/src/timeline/ReadMarkerDelegate.qml b/src/timeline/ReadMarkerDelegate.qml index 54b27d400..45d4de676 100644 --- a/src/timeline/ReadMarkerDelegate.qml +++ b/src/timeline/ReadMarkerDelegate.qml @@ -19,9 +19,9 @@ TimelineDelegate { } width: parent?.width - rightPadding: Config.compactLayout && root.ListView.view.width >= Kirigami.Units.gridUnit * 20 ? Kirigami.Units.gridUnit * 2 + Kirigami.Units.largeSpacing : Kirigami.Units.largeSpacing + rightPadding: NeoChatConfig.compactLayout && root.ListView.view.width >= Kirigami.Units.gridUnit * 20 ? Kirigami.Units.gridUnit * 2 + Kirigami.Units.largeSpacing : Kirigami.Units.largeSpacing - alwaysFillWidth: Config.compactLayout + alwaysFillWidth: NeoChatConfig.compactLayout contentItem: QQC2.ItemDelegate { padding: Kirigami.Units.largeSpacing diff --git a/src/timeline/SectionDelegate.qml b/src/timeline/SectionDelegate.qml index 083ab7bc8..98687e2b5 100644 --- a/src/timeline/SectionDelegate.qml +++ b/src/timeline/SectionDelegate.qml @@ -43,7 +43,7 @@ QQC2.ItemDelegate { } background: Rectangle { - color: Config.blur ? "transparent" : Kirigami.Theme.backgroundColor + color: NeoChatConfig.blur ? "transparent" : Kirigami.Theme.backgroundColor Kirigami.Theme.inherit: false Kirigami.Theme.colorSet: root.colorSet } diff --git a/src/timeline/StateDelegate.qml b/src/timeline/StateDelegate.qml index 7b2a90d1d..8027f1675 100644 --- a/src/timeline/StateDelegate.qml +++ b/src/timeline/StateDelegate.qml @@ -74,16 +74,16 @@ TimelineDelegate { property bool folded: true width: parent?.width - rightPadding: Config.compactLayout && root.ListView.view.width >= Kirigami.Units.gridUnit * 20 ? Kirigami.Units.gridUnit * 2 + Kirigami.Units.largeSpacing : Kirigami.Units.largeSpacing + rightPadding: NeoChatConfig.compactLayout && root.ListView.view.width >= Kirigami.Units.gridUnit * 20 ? Kirigami.Units.gridUnit * 2 + Kirigami.Units.largeSpacing : Kirigami.Units.largeSpacing - alwaysFillWidth: Config.compactLayout + alwaysFillWidth: NeoChatConfig.compactLayout contentItem: ColumnLayout { SectionDelegate { Layout.fillWidth: true visible: root.showSection labelText: root.section - colorSet: Config.compactLayout ? Kirigami.Theme.View : Kirigami.Theme.Window + colorSet: NeoChatConfig.compactLayout ? Kirigami.Theme.View : Kirigami.Theme.Window } RowLayout { Layout.fillWidth: true diff --git a/src/timeline/TimelineEndDelegate.qml b/src/timeline/TimelineEndDelegate.qml index 3ef484311..ad2841765 100644 --- a/src/timeline/TimelineEndDelegate.qml +++ b/src/timeline/TimelineEndDelegate.qml @@ -18,9 +18,9 @@ TimelineDelegate { required property NeoChatRoom room width: parent?.width - rightPadding: Config.compactLayout && root.ListView.view.width >= Kirigami.Units.gridUnit * 20 ? Kirigami.Units.gridUnit * 2 + Kirigami.Units.largeSpacing : Kirigami.Units.largeSpacing + rightPadding: NeoChatConfig.compactLayout && root.ListView.view.width >= Kirigami.Units.gridUnit * 20 ? Kirigami.Units.gridUnit * 2 + Kirigami.Units.largeSpacing : Kirigami.Units.largeSpacing - alwaysFillWidth: Config.compactLayout + alwaysFillWidth: NeoChatConfig.compactLayout contentItem: ColumnLayout { RowLayout {