// SPDX-FileCopyrightText: 2026 Matvey Shcherbinin // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL import QtQuick import QtQuick.Layouts import QtQuick.Controls as QQC2 import org.kde.kirigami as Kirigami import org.kde.kirigamiaddons.formcard as FormCard import koutnet.app // The sections down the left and the section itself beside them, rather than a // row of tabs over the content and a column of forms under it. // // A row of tabs makes the content the width of the window whatever the window // is, and a column of forms in it is then either a narrow strip floating in the // middle of a monitor or pinned to one edge with the rest of the screen empty. // Neither is a page: both are a strip and a lot of nothing. Putting the sections // where there is room for them gives the forms the whole of the right hand side // of the window, which is what they wanted all along - it is the width that was // being wasted, not the alignment. // // Nothing here writes the config file directly, AppSettings coalesces that, // except the LAN/VPN section, which has a button because static peers are a // transport change, not a field apply. Kirigami.Page { id: root signal saved() // Pushed by the window rather than from here: layers are one deep by // design, and a page that pushes over itself is the exception that broke it. signal matrixAccountRequested() signal telegramAccountRequested() // The first-run tour is a window of its own, so it is asked for rather than // pushed: the settings page has no way to open a window it does not own. signal welcomeTourRequested() // The sections, in the order they are listed. Written down rather than read // off the widgets below it, because a list of names that had to be counted // out of a stack of pages is a list that is wrong the first time one is // added in the middle. readonly property var sections: [ { title: i18nc("@item:inlistbox settings section", "Profile"), icon: "user-identity" }, { title: i18nc("@item:inlistbox settings section", "Language"), icon: "input-keyboard" }, { title: i18nc("@item:inlistbox settings section", "Interface"), icon: "preferences-desktop-display" }, { title: i18nc("@item:inlistbox settings section", "Behavior"), icon: "preferences-system" }, { title: i18nc("@item:inlistbox settings section", "Audio"), icon: "audio-volume-high" }, { title: i18nc("@item:inlistbox settings section", "Themes"), icon: "preferences-desktop-wallpaper" }, { title: i18nc("@item:inlistbox settings section", "Protocols"), icon: "network-server" }, { title: i18nc("@item:inlistbox settings section", "Optimization"), icon: "preferences-system-performance-symbolic" }, ] title: i18nc("@title:window", "Settings") padding: 0 // The accent for the whole page, named here rather than on each card. A // form card starts a chain of its own - that is what keeps a card inside a // dark sheet a dark card - which means a card is the wrong place to name an // accent: the switch inside one takes its colour from the chain above it, // and the chain above a card is this page. Named here it reaches the // switches, the scroll handles and the buttons as well as the cards. Kirigami.Theme.colorSet: Kirigami.Theme.View Kirigami.Theme.backgroundColor: ThemePalette.surface Kirigami.Theme.textColor: ThemePalette.text Kirigami.Theme.disabledTextColor: Kirigami.ColorUtils.linearInterpolation(ThemePalette.text, ThemePalette.surface, 0.4) Kirigami.Theme.highlightColor: ThemePalette.accent Kirigami.Theme.highlightedTextColor: ThemePalette.accentText Kirigami.Theme.hoverColor: Kirigami.ColorUtils.linearInterpolation(ThemePalette.surface, ThemePalette.text, 0.06) // See Main.qml: this page and every FormCard in it start their own chains. // The width the forms are drawn in, which is now the width of the page beside // the section list rather than a share of the window. // // There is still a maximum, because a form wider than about seventy grid // units is a line of text with nothing at the end of it and a card with a // field at one end and a caption at the other and a lake in between. Past // that the space goes to the section list, which is what it is for. readonly property real kContentWidth: Math.max(Kirigami.Units.gridUnit * 20, Math.min(root.width, Kirigami.Units.gridUnit * 70)) // The page itself, in the window's palette rather than the controls style's. background: Rectangle { color: ThemePalette.surface } // A "system default" row, so an empty saved device id still selects something. function deviceList(devices) { const out = [{ id: "", description: i18nc("@item:inlistbox audio device", "System default") }] for (let i = 0; i < devices.length; ++i) out.push(devices[i]) return out } // What the catalog directory actually holds, read by TranslationCatalog off // the same directory the application loads its translations from. The first // entry is the system language and the second is the source strings, neither // of which needs a catalog to be there; the rest are the translations a // build has. The tab reads this back to front: displayName is what is drawn, // code is what is stored. readonly property var languages: TranslationCatalog.languages function languageIndex(code) { for (let i = 0; i < root.languages.length; ++i) { if (root.languages[i].code === code) return i } return 0 } // Leaving the mic open would hold the device against the next call. Component.onDestruction: audioDevices.stopMicTest() // The page folds its navigation: wide enough, the sections stand in a // column down the side; narrower, the column is dropped and the same five // sections become a row of icons above the forms. A window dragged narrow // must not be made to read a sidebar first and its content through a slit. readonly property bool narrowSidebar: root.width > 0 && root.width < Kirigami.Units.gridUnit * 36 // The sections down the side, and the section itself beside them. ColumnLayout { anchors.fill: parent spacing: 0 // The narrow form of the same navigation: icons only, one per section, // checked for the one being read. The tooltip says the word the // sidebar would have shown. RowLayout { Layout.fillWidth: true visible: root.narrowSidebar spacing: Kirigami.Units.smallSpacing Repeater { model: root.sections delegate: QQC2.ToolButton { required property int index required property var modelData display: QQC2.AbstractButton.IconOnly icon.name: modelData.icon text: modelData.title checked: index === sectionList.currentIndex QQC2.ToolTip.visible: hovered QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay QQC2.ToolTip.text: modelData.title onClicked: sectionList.currentIndex = index } } Item { Layout.fillWidth: true } } RowLayout { Layout.fillWidth: true Layout.fillHeight: true spacing: 0 Rectangle { visible: !root.narrowSidebar Layout.fillHeight: true Layout.preferredWidth: Math.max(Kirigami.Units.gridUnit * 15, Math.min(Kirigami.Units.gridUnit * 22, root.width * 0.22)) // a step sunk below the page rather than raised above it: the list is // furniture and the forms are the thing being read, and a column that // sticks out says the wrong one of the two is the content. color: ThemePalette.surfaceSunk Rectangle { anchors.right: parent.right width: 1 height: parent.height color: ThemePalette.border } ColumnLayout { anchors.fill: parent anchors.leftMargin: Kirigami.Units.largeSpacing anchors.rightMargin: Kirigami.Units.smallSpacing anchors.topMargin: Kirigami.Units.largeSpacing spacing: Kirigami.Units.smallSpacing Kirigami.Heading { Layout.fillWidth: true Layout.leftMargin: Kirigami.Units.gridUnit Layout.bottomMargin: Kirigami.Units.smallSpacing level: 3 text: i18nc("@title:heading", "Settings") } Repeater { model: root.sections delegate: QQC2.ItemDelegate { id: sectionRow required property int index required property var modelData readonly property bool chosen: sectionRow.index === sectionList.currentIndex Layout.fillWidth: true text: sectionRow.modelData.title icon.name: sectionRow.modelData.icon highlighted: sectionRow.chosen onClicked: sectionList.currentIndex = sectionRow.index // Kirigami's own delegate paints the selected row, so the // section list looks like the rest of the Qt Quick Controls // interface instead of a hand-drawn one. } } Item { Layout.fillHeight: true } } } StackLayout { id: sectionList Layout.fillWidth: true Layout.fillHeight: true Layout.leftMargin: Kirigami.Units.largeSpacing Layout.rightMargin: Kirigami.Units.largeSpacing currentIndex: 0 // ---- Profile ---- ProfileSettingsTab { Layout.fillWidth: true formWidth: root.kContentWidth } // ---- Language ---- QQC2.ScrollView { id: languageScroll contentWidth: availableWidth ColumnLayout { width: Math.min(languageScroll.availableWidth, root.kContentWidth + Kirigami.Units.gridUnit * 2) spacing: 0 ThemedFormHeader { maximumWidth: root.kContentWidth title: i18nc("@title:group the language the interface speaks", "Language") } ThemedFormCard { maximumWidth: root.kContentWidth FormCard.FormComboBoxDelegate { id: languageCombo text: i18nc("@label:listbox", "Interface language") description: i18nc("@info:whatsthis", "Follows the system until a language is picked here. Takes effect the next time KOutNet starts.") textRole: "displayName" valueRole: "code" model: root.languages currentIndex: root.languageIndex(appSettings.language) onActivated: appSettings.language = languageCombo.currentValue } FormCard.FormDelegateSeparator { above: languageCombo; below: allProtocolsChatsDelegate } FormCard.FormSwitchDelegate { id: allProtocolsChatsDelegate text: i18nc("@option:check", "Show chats from all protocols") description: i18nc("@info:whatsthis", "When disabled (default), switching protocol in the left rail shows only chats of that protocol.") checked: appSettings.showChatsFromAllProtocols onToggled: appSettings.showChatsFromAllProtocols = checked } } } } // ---- Interface ---- QQC2.ScrollView { id: interfaceScroll contentWidth: availableWidth ColumnLayout { width: Math.min(interfaceScroll.availableWidth, root.kContentWidth + Kirigami.Units.gridUnit * 2) spacing: 0 AppearancePage { Layout.fillWidth: true contentWidth: root.kContentWidth } ThemedFormHeader { maximumWidth: root.kContentWidth title: i18nc("@title:group the shape of the window", "Layout") } ThemedFormCard { maximumWidth: root.kContentWidth FormCard.FormSwitchDelegate { id: compactDelegate text: i18nc("@option:check", "Compact mode") description: i18nc("@info:whatsthis", "A reduced layout for a narrow window: the conversation list and the conversation only, with tighter rows.") checked: appSettings.compactMode onToggled: appSettings.compactMode = compactDelegate.checked } FormCard.FormComboBoxDelegate { id: roomInfoSideCombo text: i18nc("@label:listbox", "Room information panel") description: i18nc("@info:whatsthis", "Which side of the conversation the room's information is drawn beside. The first option is the one the code was written with.") model: [ i18nc("@item:inlistbox", "As the code decides"), i18nc("@item:inlistbox", "On the left"), i18nc("@item:inlistbox", "On the right"), ] currentIndex: appSettings.roomInfoSide onActivated: (index) => appSettings.roomInfoSide = index } FormCard.FormDelegateSeparator { above: roomInfoSideCombo; below: railOutlineDelegate } FormCard.FormSwitchDelegate { id: railOutlineDelegate text: i18nc("@option:check", "Outline the selected mode") description: i18nc("@info:whatsthis", "Outline the current button in the far-left rail instead of filling it.") checked: appSettings.railOutlineSelection onToggled: appSettings.railOutlineSelection = checked } FormCard.FormDelegateSeparator { above: railOutlineDelegate; below: chatOutlineDelegate } FormCard.FormSwitchDelegate { id: chatOutlineDelegate text: i18nc("@option:check", "Outline the selected chat") description: i18nc("@info:whatsthis", "Mark the open conversation with an accent ring instead of filling its row.") checked: appSettings.chatOutlineSelection onToggled: appSettings.chatOutlineSelection = checked } FormCard.FormDelegateSeparator { above: chatOutlineDelegate; below: messageBubblesDelegate } FormCard.FormSwitchDelegate { id: messageBubblesDelegate text: i18nc("@option:check", "Message blocks") description: i18nc("@info:whatsthis", "Draw each message on a themed block sized to its text instead of flat on the wallpaper.") checked: appSettings.messageBubbles onToggled: appSettings.messageBubbles = checked } FormCard.FormDelegateSeparator { above: messageBubblesDelegate; below: bubbleRadiusDelegate } FormCard.FormSpinBoxDelegate { id: bubbleRadiusDelegate label: i18nc("@label:spinbox the rounding of message blocks in pixels", "Message block rounding") from: 0 to: 24 stepSize: 1 value: appSettings.bubbleRadius enabled: appSettings.messageBubbles onValueChanged: appSettings.bubbleRadius = bubbleRadiusDelegate.value } FormCard.FormDelegateSeparator { above: bubbleRadiusDelegate; below: messageAlignmentCombo } FormCard.FormComboBoxDelegate { id: messageAlignmentCombo text: i18nc("@label:listbox which side message runs start from", "Message alignment") model: [ i18nc("@item:inlistbox", "All on the left"), i18nc("@item:inlistbox", "All on the right"), i18nc("@item:inlistbox", "Mine right, others left"), ] currentIndex: appSettings.messageAlignment onActivated: (index) => appSettings.messageAlignment = index } } } } // ---- Behavior ---- QQC2.ScrollView { id: behaviorScroll contentWidth: availableWidth ColumnLayout { width: Math.min(behaviorScroll.availableWidth, root.kContentWidth + Kirigami.Units.gridUnit * 2) spacing: 0 ThemedFormHeader { maximumWidth: root.kContentWidth title: i18nc("@title:group what happens when the application starts", "Startup") } ThemedFormCard { maximumWidth: root.kContentWidth FormCard.FormSwitchDelegate { id: welcomeDelegate text: i18nc("@option:check", "Show the welcome tour at startup") checked: appSettings.showWelcome onToggled: appSettings.showWelcome = welcomeDelegate.checked } FormCard.FormDelegateSeparator { above: welcomeDelegate; below: showTourButton } FormCard.FormButtonDelegate { id: showTourButton text: i18nc("@action:button show the first-run tour again now", "Show the welcome tour now") icon.name: "help-about" onClicked: root.welcomeTourRequested() } } ThemedFormHeader { maximumWidth: root.kContentWidth title: i18nc("@title:group the system tray icon and notifications", "Tray and notifications") } ThemedFormCard { maximumWidth: root.kContentWidth FormCard.FormSwitchDelegate { id: trayDelegate text: i18nc("@option:check", "Show an icon in the system tray") // Registering a status notifier item is a D-Bus name claim, and dropping // it while the window was hidden would leave no way back, so the switch is // read at start rather than applied live - and says so. description: i18nc("@info:whatsthis", "Takes effect the next time KOutNet starts.") checked: appSettings.trayEnabled onToggled: appSettings.trayEnabled = trayDelegate.checked } FormCard.FormDelegateSeparator { above: trayDelegate; below: minimizeDelegate } FormCard.FormSwitchDelegate { id: minimizeDelegate text: i18nc("@option:check", "Close to the tray instead of quitting") enabled: appSettings.trayEnabled checked: appSettings.minimizeToTray onToggled: appSettings.minimizeToTray = minimizeDelegate.checked } FormCard.FormDelegateSeparator { above: minimizeDelegate; below: awayDelegate } // the three cases themselves are switches in System Settings, next to every // other application's, rather than here. FormCard.FormSpinBoxDelegate { id: awayDelegate label: i18nc("@label:spinbox minutes of no input before counting as away", "Count as away after (minutes)") from: 1 to: 240 stepSize: 1 value: appSettings.awayAfterMinutes onValueChanged: appSettings.awayAfterMinutes = awayDelegate.value } } } } // ---- Audio ---- QQC2.ScrollView { id: audioScroll contentWidth: availableWidth ColumnLayout { width: Math.min(audioScroll.availableWidth, root.kContentWidth + Kirigami.Units.gridUnit * 2) spacing: 0 ThemedFormHeader { maximumWidth: root.kContentWidth title: i18nc("@title:group", "Audio") } ThemedFormCard { maximumWidth: root.kContentWidth FormCard.FormComboBoxDelegate { id: micCombo text: i18nc("@label:listbox", "Microphone") textRole: "description" valueRole: "id" model: root.deviceList(audioDevices.inputs) currentIndex: micCombo.indexOfValue(appSettings.audioInputId) onActivated: appSettings.audioInputId = micCombo.currentValue } FormCard.FormDelegateSeparator { above: micCombo; below: micTestDelegate } // A level meter is not one of the form delegates, hence AbstractFormDelegate. FormCard.AbstractFormDelegate { id: micTestDelegate background: null contentItem: RowLayout { spacing: Kirigami.Units.largeSpacing QQC2.Button { text: audioDevices.micTestRunning ? i18nc("@action:button", "Stop test") : i18nc("@action:button", "Test microphone") onClicked: { if (audioDevices.micTestRunning) audioDevices.stopMicTest() else audioDevices.startMicTest(appSettings.audioInputId) } } QQC2.ProgressBar { Layout.fillWidth: true from: 0 to: 1 value: audioDevices.micLevel } } } FormCard.FormDelegateSeparator { above: micTestDelegate; below: speakerCombo } FormCard.FormComboBoxDelegate { id: speakerCombo text: i18nc("@label:listbox", "Speakers") textRole: "description" valueRole: "id" model: root.deviceList(audioDevices.outputs) currentIndex: speakerCombo.indexOfValue(appSettings.audioOutputId) onActivated: appSettings.audioOutputId = speakerCombo.currentValue } FormCard.FormDelegateSeparator { above: speakerCombo; below: speakerTestDelegate } FormCard.FormButtonDelegate { id: speakerTestDelegate text: i18nc("@action:button", "Test speakers") icon.name: "audio-volume-high" enabled: !audioDevices.tonePlaying onClicked: audioDevices.playTestTone(appSettings.audioOutputId) } FormCard.FormDelegateSeparator { above: speakerTestDelegate; below: volumeDelegate } FormCard.FormSpinBoxDelegate { id: volumeDelegate label: i18nc("@label:spinbox playback volume in percent", "Volume") from: 0 to: 100 stepSize: 1 value: appSettings.audioVolume onValueChanged: appSettings.audioVolume = volumeDelegate.value } FormCard.FormDelegateSeparator { above: volumeDelegate; below: muteDelegate } FormCard.FormSwitchDelegate { id: muteDelegate text: i18nc("@option:check", "Mute microphone") checked: appSettings.micMuted onToggled: appSettings.micMuted = muteDelegate.checked } FormCard.FormDelegateSeparator { above: muteDelegate; below: vadDelegate } FormCard.FormSwitchDelegate { id: vadDelegate text: i18nc("@option:check", "Voice activity detection") description: i18nc("@info:whatsthis", "Only send audio while you are speaking.") checked: appSettings.vadEnabled onToggled: appSettings.vadEnabled = vadDelegate.checked } } } } // ---- Themes ---- ThemeGallery { kFormWidth: root.kContentWidth // the same setting the wallpaper button on the Interface tab writes, // read back the way that button leaves it, so that a wallpaper // picked there shows up here as the theme it is selectedPath: FsUtils.toLocalPath(appSettings.wallpaperPath) onChosen: (path) => { appSettings.wallpaperPath = path // A wallpaper at no opacity is hidden outright - the scrim over // it reaches full strength - so a theme picked while the slider // is at zero looks like a theme that does not work. The number // is the setting's own default, koutnetsettings.kcfg. if (path.length > 0 && appSettings.wallpaperOpacity === 0) appSettings.wallpaperOpacity = 40 } } // ---- Protocols ---- ColumnLayout { Layout.fillWidth: true Layout.fillHeight: true QQC2.TabBar { id: protocolTabs Layout.fillWidth: true QQC2.TabButton { text: i18nc("@title:backend", "Matrix") } QQC2.TabButton { text: i18nc("@title:backend", "LAN / VPN") } QQC2.TabButton { text: i18nc("@title:backend", "Telegram") } QQC2.TabButton { text: i18nc("@title:backend", "Rocket.Chat") } QQC2.TabButton { text: i18nc("@title:backend", "IRC") } } StackLayout { Layout.fillWidth: true Layout.fillHeight: true currentIndex: protocolTabs.currentIndex MatrixSettingsTab { Layout.fillWidth: true formWidth: root.kContentWidth onMatrixAccountRequested: root.matrixAccountRequested() } LanSettingsTab { Layout.fillWidth: true formWidth: root.kContentWidth onSaved: root.saved() } TelegramSettingsTab { Layout.fillWidth: true formWidth: root.kContentWidth onSaved: root.saved() onTelegramAccountRequested: root.telegramAccountRequested() } Item { Kirigami.PlaceholderMessage { anchors.centerIn: parent width: parent.width - Kirigami.Units.largeSpacing * 4 icon.name: "chat-partner" text: i18nc("@title:backend", "Rocket.Chat") explanation: i18nc("@info a transport that is not implemented yet", "Not built yet.") } } Item { Kirigami.PlaceholderMessage { anchors.centerIn: parent text: i18nc("@title:backend", "IRC") explanation: i18nc("@info", "Sign-in is not implemented yet.") } } } } // ---- Optimization ---- QQC2.ScrollView { id: optimizationScroll Layout.fillWidth: true Layout.fillHeight: true contentWidth: availableWidth ColumnLayout { width: Math.min(optimizationScroll.availableWidth, root.kContentWidth + Kirigami.Units.gridUnit * 2) spacing: 0 ThemedFormCard { maximumWidth: root.kContentWidth FormCard.FormHeader { title: i18nc("@title:group ways to use less memory and disk", "Optimization") } FormCard.FormSwitchDelegate { id: lowBlurDelegate text: i18nc("@option:check", "Lower blur detail") description: i18nc("@info:whatsthis", "Cap the wallpaper blur at a lower radius so the effects keep fewer texture levels. Slightly less smooth, noticeably lighter.") checked: appSettings.lowBlurDetail onToggled: appSettings.lowBlurDetail = checked } FormCard.FormDelegateSeparator { above: lowBlurDelegate; below: reuseBlurDelegate } FormCard.FormSwitchDelegate { id: reuseBlurDelegate text: i18nc("@option:check", "Reuse the chat list's blur") description: i18nc("@info:whatsthis", "Do not run a separate blur for the profile row; it wears whatever the chat list already drew behind it.") checked: appSettings.reuseWindowBlur onToggled: appSettings.reuseWindowBlur = checked } FormCard.FormDelegateSeparator { above: reuseBlurDelegate; below: smallerAttachmentsDelegate } FormCard.FormSwitchDelegate { id: smallerAttachmentsDelegate text: i18nc("@option:check", "Smaller attachment previews") description: i18nc("@info:whatsthis", "Decode pictures in messages at a smaller size. Thumbnails stay the same on screen; large originals use less memory.") checked: appSettings.smallerAttachments onToggled: appSettings.smallerAttachments = checked } FormCard.FormDelegateSeparator { above: smallerAttachmentsDelegate; below: cacheLimitDelegate } FormCard.FormSpinBoxDelegate { id: cacheLimitDelegate label: i18nc("@label:spinbox the largest the downloaded media cache may grow, in megabytes", "Media cache limit") description: i18nc("@info:whatsthis", "Zero leaves the cache unbounded. A limit drops the oldest downloaded pictures when it is reached.") from: 0 to: 512 stepSize: 8 value: appSettings.mediaCacheLimitMb onValueChanged: appSettings.mediaCacheLimitMb = cacheLimitDelegate.value } FormCard.FormDelegateSeparator { above: cacheLimitDelegate; below: disableWallpaperDelegate } FormCard.FormSwitchDelegate { id: disableWallpaperDelegate text: i18nc("@option:check", "Disable wallpaper") description: i18nc("@info:whatsthis", "Do not load or draw the window wallpaper. Uses plain surfaces and skips wallpaper decode, textures and blur work.") checked: appSettings.disableWallpaper onToggled: appSettings.disableWallpaper = checked } FormCard.FormDelegateSeparator { above: disableWallpaperDelegate; below: wallpaperDecodeLimitDelegate } FormCard.FormSpinBoxDelegate { id: wallpaperDecodeLimitDelegate label: i18nc("@label:spinbox maximum wallpaper decode size in pixels", "Wallpaper decode limit") description: i18nc("@info:whatsthis", "Maximum decoded wallpaper size in pixels (bounding box). Zero keeps native resolution for non-tiled modes. Lower values greatly reduce RAM for large wallpapers; tiled modes keep native size to preserve tile scale.") from: 0 to: 8192 stepSize: 256 value: appSettings.wallpaperDecodeLimit onValueChanged: appSettings.wallpaperDecodeLimit = wallpaperDecodeLimitDelegate.value } FormCard.FormDelegateSeparator { above: wallpaperDecodeLimitDelegate; below: disableWallpaperBlurDelegate } FormCard.FormSwitchDelegate { id: disableWallpaperBlurDelegate text: i18nc("@option:check", "Disable wallpaper blur") description: i18nc("@info:whatsthis", "Turn off the main window wallpaper blur effect to reduce GPU memory and shader work.") checked: appSettings.disableWallpaperBlur onToggled: appSettings.disableWallpaperBlur = checked } FormCard.FormDelegateSeparator { above: disableWallpaperBlurDelegate; below: disableOverlayBlurDelegate } FormCard.FormSwitchDelegate { id: disableOverlayBlurDelegate text: i18nc("@option:check", "Disable panel/profile blur overlays") description: i18nc("@info:whatsthis", "Turn off extra blur layers behind the chat list and profile bar to save textures and render passes.") checked: appSettings.disableOverlayBlur onToggled: appSettings.disableOverlayBlur = checked } FormCard.FormDelegateSeparator { above: disableOverlayBlurDelegate; below: freezeAnimatedImagesDelegate } FormCard.FormSwitchDelegate { id: freezeAnimatedImagesDelegate text: i18nc("@option:check", "Freeze animated images") description: i18nc("@info:whatsthis", "Stop playback of animated images (GIF wallpapers, avatars, banners) and keep them on the first frame to save CPU and memory.") checked: appSettings.freezeAnimatedImages onToggled: appSettings.freezeAnimatedImages = checked } FormCard.FormDelegateSeparator { above: freezeAnimatedImagesDelegate; below: avatarDecodeLimitDelegate } FormCard.FormSpinBoxDelegate { id: avatarDecodeLimitDelegate label: i18nc("@label:spinbox maximum avatar decode size in pixels", "Avatar decode limit") description: i18nc("@info:whatsthis", "Maximum decoded avatar size in pixels. Zero keeps native size. Lower values reduce memory when many avatars are visible.") from: 0 to: 2048 stepSize: 32 value: appSettings.avatarDecodeLimit onValueChanged: appSettings.avatarDecodeLimit = avatarDecodeLimitDelegate.value } FormCard.FormDelegateSeparator { above: avatarDecodeLimitDelegate; below: maxHistoryMessagesDelegate } FormCard.FormSpinBoxDelegate { id: maxHistoryMessagesDelegate label: i18nc("@label:spinbox maximum stored messages per chat", "Max messages per chat") description: i18nc("@info:whatsthis", "How many messages per chat are kept in memory and in local history. Lower values reduce RAM and disk usage at the cost of shorter history.") from: 50 to: 10000 stepSize: 50 value: appSettings.maxHistoryMessages onValueChanged: appSettings.maxHistoryMessages = maxHistoryMessagesDelegate.value } FormCard.FormDelegateSeparator { above: maxHistoryMessagesDelegate; below: pixmapCacheLimitDelegate } FormCard.FormSpinBoxDelegate { id: pixmapCacheLimitDelegate label: i18nc("@label:spinbox QPixmapCache size limit in kilobytes", "Pixmap cache limit (KB)") description: i18nc("@info:whatsthis", "Global QPixmapCache limit in kilobytes. Zero keeps Qt's default limit. Lowering it can reduce memory used by cached pixmaps/icons.") from: 0 to: 262144 stepSize: 1024 value: appSettings.pixmapCacheLimitKb onValueChanged: appSettings.pixmapCacheLimitKb = pixmapCacheLimitDelegate.value } FormCard.FormDelegateSeparator { above: pixmapCacheLimitDelegate; below: releaseResourcesDelegate } FormCard.FormSwitchDelegate { id: releaseResourcesDelegate text: i18nc("@option:check", "Release graphics resources when hidden") description: i18nc("@info:whatsthis", "Ask the scene graph to free cached graphics resources when the window is minimized or hidden. May reduce memory while hidden at the cost of a reload when shown again.") checked: appSettings.releaseResourcesOnHidden onToggled: appSettings.releaseResourcesOnHidden = checked } FormCard.FormDelegateSeparator { above: releaseResourcesDelegate; below: trimMemoryDelegate } FormCard.FormSwitchDelegate { id: trimMemoryDelegate text: i18nc("@option:check", "Trim memory when hidden (Linux)") description: i18nc("@info:whatsthis", "On glibc/Linux, return free heap pages to the OS when the window is minimized or hidden. May reduce reported RSS after hiding.") checked: appSettings.trimMemoryOnHidden onToggled: appSettings.trimMemoryOnHidden = checked } FormCard.FormDelegateSeparator { above: trimMemoryDelegate; below: connectMatrixOnStartDelegate } FormCard.FormSwitchDelegate { id: connectMatrixOnStartDelegate text: i18nc("@option:check", "Connect Matrix on startup") description: i18nc("@info:whatsthis", "Resume the saved Matrix session automatically when the app starts. Disable to avoid Matrix background work and memory use until you connect manually.") checked: appSettings.connectMatrixOnStart onToggled: appSettings.connectMatrixOnStart = checked } FormCard.FormDelegateSeparator { above: connectMatrixOnStartDelegate; below: connectTelegramOnStartDelegate } FormCard.FormSwitchDelegate { id: connectTelegramOnStartDelegate text: i18nc("@option:check", "Connect Telegram on startup") description: i18nc("@info:whatsthis", "Start the Telegram (TDLib) backend automatically when the app starts. Disable to avoid TDLib background work and memory use until you start it manually.") checked: appSettings.connectTelegramOnStart onToggled: appSettings.connectTelegramOnStart = checked } FormCard.FormDelegateSeparator { above: connectTelegramOnStartDelegate; below: clearMediaCacheOnExitDelegate } FormCard.FormSwitchDelegate { id: clearMediaCacheOnExitDelegate text: i18nc("@option:check", "Clear media cache on exit") description: i18nc("@info:whatsthis", "Delete all files in the on-disk media cache when the application exits.") checked: appSettings.clearMediaCacheOnExit onToggled: appSettings.clearMediaCacheOnExit = checked } FormCard.FormDelegateSeparator { above: clearMediaCacheOnExitDelegate; below: clearMediaCacheNowDelegate } FormCard.FormButtonDelegate { id: clearMediaCacheNowDelegate text: i18nc("@action:button", "Clear media cache now") description: i18nc("@info:whatsthis", "Immediately remove all cached media files from disk.") icon.name: "edit-clear-history" onClicked: MediaCache.clear() } } } } } } } }