diff --git a/CMakeLists.txt b/CMakeLists.txt index fbd1ac2c5..0c44b275c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,7 +14,7 @@ set(RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_ project(NeoChat VERSION ${RELEASE_SERVICE_VERSION}) -set(KF_MIN_VERSION "6.0") +set(KF_MIN_VERSION "6.4") set(QT_MIN_VERSION "6.5") find_package(ECM ${KF_MIN_VERSION} REQUIRED NO_MODULE) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 30a66547c..4a15d7bcb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -423,7 +423,7 @@ if (TARGET KF6::Crash) target_link_libraries(neochat PUBLIC KF6::Crash) endif() -kconfig_target_kcfg_file(neochat FILE neochatconfig.kcfg CLASS_NAME NeoChatConfig MUTATORS GENERATE_PROPERTIES DEFAULT_VALUE_GETTERS PARENT_IN_CONSTRUCTOR SINGLETON GENERATE_MOC ) +kconfig_target_kcfg_file(neochat FILE neochatconfig.kcfg CLASS_NAME NeoChatConfig MUTATORS GENERATE_PROPERTIES DEFAULT_VALUE_GETTERS PARENT_IN_CONSTRUCTOR SINGLETON GENERATE_MOC QML_REGISTRATION) if(NEOCHAT_FLATPAK) target_compile_definitions(neochat PUBLIC NEOCHAT_FLATPAK) diff --git a/src/chatbar/ChatBar.qml b/src/chatbar/ChatBar.qml index f30fec940..02fe20e1e 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 cadcae4bd..b55333686 100644 --- a/src/foreigntypes.h +++ b/src/foreigntypes.h @@ -13,19 +13,6 @@ #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 QML_FOREIGN(Quotient::AccountRegistry) diff --git a/src/qml/AccountMenu.qml b/src/qml/AccountMenu.qml index b9618e8a1..60d83619f 100644 --- a/src/qml/AccountMenu.qml +++ b/src/qml/AccountMenu.qml @@ -45,7 +45,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 }, { @@ -57,7 +57,7 @@ QQC2.Menu { QQC2.MenuItem { text: i18nc("@action:inmenu", "Open Secret Backup") icon.name: "unlock" - visible: Config.secretBackup + visible: NeoChatConfig.secretBackup onTriggered: root.window.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 e12781807..4ef2ab1bb 100644 --- a/src/qml/DelegateContextMenu.qml +++ b/src/qml/DelegateContextMenu.qml @@ -74,7 +74,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 d24ca547e..88a919211 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 d45a54c49..7d965bdf1 100644 --- a/src/qml/HoverActions.qml +++ b/src/qml/HoverActions.qml @@ -117,7 +117,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 b5e3c1910..557d92ef8 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 @@ -158,7 +158,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 @@ -179,7 +179,7 @@ Kirigami.ApplicationWindow { modal: (!root.wideScreen || !enabled) onEnabledChanged: drawerOpen = enabled && !modal onModalChanged: { - if (Config.autoRoomInfoDrawer) { + if (NeoChatConfig.autoRoomInfoDrawer) { drawerOpen = !modal && drawerUserState; dim = false; } @@ -194,11 +194,11 @@ Kirigami.ApplicationWindow { RoomSettingsView.window = root; NeoChatSettingsView.window = root; NeoChatSettingsView.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; @@ -206,21 +206,21 @@ Kirigami.ApplicationWindow { } } Connections { - target: Config + target: NeoChatConfig 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 4fe726ff2..844e90141 100644 --- a/src/qml/NeochatMaximizeComponent.qml +++ b/src/qml/NeochatMaximizeComponent.qml @@ -119,8 +119,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 4e582cbcc..17d1a5a51 100644 --- a/src/qml/RoomDelegate.qml +++ b/src/qml/RoomDelegate.qml @@ -57,8 +57,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 @@ -91,7 +91,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 @@ -137,7 +137,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 @@ -155,14 +155,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 bcce3c4c5..2c2df0d8a 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 383361201..f9069b662 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 04b0657e8..5e58284cb 100644 --- a/src/qml/TimelineView.qml +++ b/src/qml/TimelineView.qml @@ -143,12 +143,12 @@ QQC2.ScrollView { footer: Item { z: 3 width: root.width - visible: !Config.blur + visible: !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 { @@ -171,7 +171,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 729baaa7c..6a3b8d9ee 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..647f158aa 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: NeoChatConfig.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 0c19c7dcc..c6019afc9 100644 --- a/src/settings/NeoChatGeneralPage.qml +++ b/src/settings/NeoChatGeneralPage.qml @@ -27,12 +27,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(); } } @@ -44,12 +44,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(); } } @@ -61,12 +61,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(); } } @@ -77,11 +77,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(); } } @@ -92,20 +92,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() } } } @@ -116,11 +116,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(); } } @@ -132,65 +132,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(); } } } @@ -201,11 +201,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 { @@ -215,11 +215,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(); } } } @@ -229,15 +229,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: root.QQC2.ApplicationWindow.window.pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat.devtools', 'DevtoolsPage'), { connection: root.connection 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 7e8322113..42a6a8141 100644 --- a/src/timeline/FileComponent.qml +++ b/src/timeline/FileComponent.qml @@ -193,10 +193,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 6c66557b0..4f4a3a2ec 100644 --- a/src/timeline/HiddenDelegate.qml +++ b/src/timeline/HiddenDelegate.qml @@ -29,9 +29,9 @@ TimelineDelegate { required property RoomMember 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 d7664cf43..f717dfc6c 100644 --- a/src/timeline/MessageDelegate.qml +++ b/src/timeline/MessageDelegate.qml @@ -193,9 +193,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 @@ -205,13 +205,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.contentModel?.showAuthor ? Kirigami.Units.largeSpacing : (Config.compactLayout ? 1 : Kirigami.Units.smallSpacing) + Layout.topMargin: root.contentModel?.showAuthor ? Kirigami.Units.largeSpacing : (NeoChatConfig.compactLayout ? 1 : Kirigami.Units.smallSpacing) Layout.leftMargin: Kirigami.Units.smallSpacing Layout.rightMargin: Kirigami.Units.smallSpacing @@ -226,7 +226,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 @@ -235,7 +235,7 @@ TimelineDelegate { topMargin: Kirigami.Units.smallSpacing } - visible: (root.contentModel?.showAuthor ?? false) && Config.showAvatarInTimeline && (Config.compactLayout || !_private.showUserMessageOnRight) + visible: (root.contentModel?.showAuthor ?? false) && NeoChatConfig.showAvatarInTimeline && (NeoChatConfig.compactLayout || !_private.showUserMessageOnRight) name: root.author.displayName source: root.author.avatarUrl color: root.author.color @@ -250,9 +250,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" @@ -296,11 +296,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 } @@ -341,7 +341,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) } } @@ -362,7 +362,7 @@ TimelineDelegate { /** * @brief Whether local user messages should be aligned right. */ - property bool showUserMessageOnRight: Config.showLocalMessagesOnRight && root.author.isLocalMember && !Config.compactLayout && !root.alwaysFillWidth + property bool showUserMessageOnRight: NeoChatConfig.showLocalMessagesOnRight && root.author.isLocalMember && !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 0ec944b8d..16901e231 100644 --- a/src/timeline/ReactionDelegate.qml +++ b/src/timeline/ReactionDelegate.qml @@ -56,7 +56,7 @@ Flow { background: Kirigami.ShadowedRectangle { color: reactionDelegate.hasLocalMember ? 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 b2dbfd824..1bce89897 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 a984763e2..b27090f67 100644 --- a/src/timeline/StateDelegate.qml +++ b/src/timeline/StateDelegate.qml @@ -64,16 +64,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 {