Warning, /network/neochat/src/qml/AppearanceSettingsPage.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-FileCopyrightText: 2020 Tobias Fella <tobias.fella@kde.org> 0002 // SPDX-FileCopyrightText: 2021 Carl Schwan <carl@carlschwan.eu> 0003 // SPDX-License-Identifier: GPL-2.0-or-later 0004 0005 import QtQuick 0006 import QtQuick.Controls as QQC2 0007 import QtQuick.Layouts 0008 0009 import org.kde.kirigami as Kirigami 0010 import org.kde.kirigamiaddons.formcard as FormCard 0011 import org.kde.kirigamiaddons.labs.components as KirigamiComponents 0012 0013 import org.kde.neochat 0014 import org.kde.neochat.config 0015 0016 FormCard.FormCardPage { 0017 id: root 0018 0019 title: i18nc("@title:window", "Appearance") 0020 0021 FormCard.FormHeader { 0022 title: i18n("General theme") 0023 } 0024 FormCard.FormCard { 0025 FormCard.AbstractFormDelegate { 0026 id: timelineModeSetting 0027 background: Item {} 0028 contentItem: RowLayout { 0029 Layout.alignment: Qt.AlignCenter 0030 spacing: Kirigami.Units.largeSpacing 0031 Item { 0032 Layout.fillWidth: true 0033 } 0034 QQC2.ButtonGroup { 0035 id: themeGroup 0036 } 0037 ThemeRadioButton { 0038 thin: timelineModeSetting.width < Kirigami.Units.gridUnit * 22 0039 innerObject: [ 0040 RowLayout { 0041 Layout.fillWidth: true 0042 KirigamiComponents.Avatar { 0043 color: "#4a5bcc" 0044 Layout.alignment: Qt.AlignTop 0045 visible: Config.showAvatarInTimeline 0046 Layout.preferredWidth: Config.showAvatarInTimeline ? Kirigami.Units.largeSpacing * 2 : 0 0047 Layout.preferredHeight: Kirigami.Units.largeSpacing * 2 0048 } 0049 QQC2.Control { 0050 Layout.fillWidth: true 0051 contentItem: ColumnLayout { 0052 QQC2.Label { 0053 Layout.fillWidth: true 0054 font.weight: Font.Bold 0055 font.pixelSize: 7 0056 text: "Paul Müller" 0057 color: "#4a5bcc" 0058 wrapMode: Text.Wrap 0059 } 0060 QQC2.Label { 0061 Layout.fillWidth: true 0062 text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus facilisis porta mauris, quis finibus sem suscipit tincidunt." 0063 wrapMode: Text.Wrap 0064 font.pixelSize: 7 0065 } 0066 } 0067 background: Kirigami.ShadowedRectangle { 0068 color: Kirigami.Theme.backgroundColor 0069 radius: Kirigami.Units.smallSpacing 0070 shadow.size: Kirigami.Units.smallSpacing 0071 shadow.color: Qt.rgba(0.0, 0.0, 0.0, 0.10) 0072 border.color: Kirigami.ColorUtils.tintWithAlpha(color, Kirigami.Theme.textColor, 0.15) 0073 border.width: 1 0074 } 0075 } 0076 }, 0077 RowLayout { 0078 Layout.fillWidth: true 0079 KirigamiComponents.Avatar { 0080 color: "#9f244b" 0081 Layout.alignment: Qt.AlignTop 0082 visible: Config.showAvatarInTimeline 0083 Layout.preferredWidth: Config.showAvatarInTimeline ? Kirigami.Units.largeSpacing * 2 : 0 0084 Layout.preferredHeight: Kirigami.Units.largeSpacing * 2 0085 } 0086 QQC2.Control { 0087 Layout.fillWidth: true 0088 contentItem: ColumnLayout { 0089 QQC2.Label { 0090 Layout.fillWidth: true 0091 font.weight: Font.Bold 0092 font.pixelSize: 7 0093 text: "Jean Paul" 0094 color: "#9f244b" 0095 wrapMode: Text.Wrap 0096 } 0097 QQC2.Label { 0098 Layout.fillWidth: true 0099 text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus facilisis porta , quis sem suscipit tincidunt." 0100 wrapMode: Text.Wrap 0101 font.pixelSize: 7 0102 } 0103 } 0104 background: Kirigami.ShadowedRectangle { 0105 color: Kirigami.Theme.backgroundColor 0106 radius: Kirigami.Units.smallSpacing 0107 shadow.size: Kirigami.Units.smallSpacing 0108 shadow.color: Qt.rgba(0.0, 0.0, 0.0, 0.10) 0109 border.color: Kirigami.ColorUtils.tintWithAlpha(color, Kirigami.Theme.textColor, 0.15) 0110 border.width: 1 0111 } 0112 } 0113 } 0114 ] 0115 0116 text: i18n("Bubbles") 0117 checked: !Config.compactLayout 0118 QQC2.ButtonGroup.group: themeGroup 0119 enabled: !Config.isCompactLayoutImmutable 0120 0121 onToggled: { 0122 Config.compactLayout = !checked; 0123 Config.save(); 0124 } 0125 } 0126 ThemeRadioButton { 0127 // Layout.alignment: Qt.AlignRight 0128 thin: timelineModeSetting.width < Kirigami.Units.gridUnit * 22 0129 innerObject: [ 0130 RowLayout { 0131 Layout.fillWidth: true 0132 KirigamiComponents.Avatar { 0133 color: "#4a5bcc" 0134 Layout.alignment: Qt.AlignTop 0135 visible: Config.showAvatarInTimeline 0136 Layout.preferredWidth: Config.showAvatarInTimeline ? Kirigami.Units.largeSpacing * 2 : 0 0137 Layout.preferredHeight: Kirigami.Units.largeSpacing * 2 0138 } 0139 ColumnLayout { 0140 Layout.fillWidth: true 0141 QQC2.Label { 0142 Layout.fillWidth: true 0143 font.weight: Font.Bold 0144 font.pixelSize: 7 0145 text: "Paul Müller" 0146 color: "#4a5bcc" 0147 wrapMode: Text.Wrap 0148 } 0149 QQC2.Label { 0150 Layout.fillWidth: true 0151 text: "Lorem ipsum dolor sit amet, consectetur elit. Vivamus facilisis porta mauris, finibus sem suscipit tincidunt." 0152 wrapMode: Text.Wrap 0153 font.pixelSize: 7 0154 } 0155 } 0156 }, 0157 RowLayout { 0158 Layout.fillWidth: true 0159 KirigamiComponents.Avatar { 0160 color: "#9f244b" 0161 Layout.alignment: Qt.AlignTop 0162 visible: Config.showAvatarInTimeline 0163 Layout.preferredWidth: Config.showAvatarInTimeline ? Kirigami.Units.largeSpacing * 2 : 0 0164 Layout.preferredHeight: Kirigami.Units.largeSpacing * 2 0165 } 0166 ColumnLayout { 0167 Layout.fillWidth: true 0168 QQC2.Label { 0169 Layout.fillWidth: true 0170 font.weight: Font.Bold 0171 font.pixelSize: 7 0172 text: "Jean Paul" 0173 color: "#9f244b" 0174 wrapMode: Text.Wrap 0175 } 0176 QQC2.Label { 0177 Layout.fillWidth: true 0178 text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus facilisis porta mauris, quis finibus sem suscipit tincidunt." 0179 wrapMode: Text.Wrap 0180 font.pixelSize: 7 0181 } 0182 } 0183 } 0184 ] 0185 text: i18n("Compact") 0186 checked: Config.compactLayout 0187 QQC2.ButtonGroup.group: themeGroup 0188 enabled: !Config.isCompactLayoutImmutable 0189 0190 onToggled: { 0191 Config.compactLayout = checked; 0192 Config.save(); 0193 } 0194 } 0195 Item { 0196 Layout.fillWidth: true 0197 } 0198 } 0199 } 0200 0201 FormCard.FormDelegateSeparator { 0202 below: compactRoomListDelegate 0203 } 0204 0205 FormCard.FormCheckDelegate { 0206 id: compactRoomListDelegate 0207 text: i18n("Use compact room list") 0208 checked: Config.compactRoomList 0209 onToggled: { 0210 Config.compactRoomList = checked; 0211 Config.save(); 0212 } 0213 } 0214 0215 FormCard.FormDelegateSeparator { 0216 above: compactRoomListDelegate 0217 below: colorSchemeDelegate.item 0218 visible: colorSchemeDelegate.visible 0219 } 0220 0221 Loader { 0222 id: colorSchemeDelegate 0223 visible: item !== null 0224 source: "qrc:/org/kde/neochat/qml/ColorScheme.qml" 0225 Layout.fillWidth: true 0226 } 0227 } 0228 0229 FormCard.FormCard { 0230 Layout.topMargin: Kirigami.Units.largeSpacing 0231 FormCard.FormCheckDelegate { 0232 id: showFancyEffectsDelegate 0233 text: i18n("Show fancy effects in chat") 0234 checked: Config.showFancyEffects 0235 enabled: !Config.isShowFancyEffectsImmutable 0236 onToggled: { 0237 Config.showFancyEffects = checked; 0238 Config.save(); 0239 } 0240 } 0241 0242 FormCard.FormDelegateSeparator { 0243 above: showFancyEffectsDelegate 0244 below: hasWindowSystemDelegate 0245 } 0246 0247 FormCard.FormCheckDelegate { 0248 id: hasWindowSystemDelegate 0249 visible: WindowController.hasWindowSystem 0250 text: i18n("Use transparent chat page") 0251 enabled: !Config.compactLayout && !Config.isBlurImmutable 0252 checked: Config.blur 0253 onToggled: { 0254 Config.blur = checked; 0255 Config.save(); 0256 } 0257 } 0258 0259 FormCard.FormDelegateSeparator { 0260 above: hasWindowSystemDelegate 0261 below: transparencyDelegate 0262 } 0263 0264 FormCard.AbstractFormDelegate { 0265 id: transparencyDelegate 0266 visible: WindowController.hasWindowSystem && Config.blur 0267 enabled: !Config.isTransparancyImmutable 0268 background: Item {} 0269 contentItem: ColumnLayout { 0270 QQC2.Label { 0271 text: i18n("Transparency") 0272 Layout.fillWidth: true 0273 } 0274 QQC2.Slider { 0275 enabled: !Config.compactLayout && Config.blur 0276 from: 0 0277 to: 1 0278 stepSize: 0.05 0279 value: Config.transparency 0280 onMoved: { 0281 Config.transparency = value; 0282 Config.save(); 0283 } 0284 Layout.fillWidth: true 0285 0286 HoverHandler { 0287 id: sliderHover 0288 } 0289 QQC2.ToolTip.visible: sliderHover.hovered && !enabled 0290 QQC2.ToolTip.text: i18n("Only enabled if the transparent chat page is enabled.") 0291 } 0292 QQC2.Label { 0293 text: Math.round(Config.transparency * 100) + "%" 0294 Layout.fillWidth: true 0295 } 0296 } 0297 } 0298 0299 FormCard.FormDelegateSeparator { 0300 above: transparencyDelegate 0301 below: showLocalMessagesOnRightDelegate 0302 visible: transparencyDelegate.visible 0303 } 0304 0305 FormCard.FormCheckDelegate { 0306 id: showLocalMessagesOnRightDelegate 0307 text: i18n("Show your messages on the right") 0308 checked: Config.showLocalMessagesOnRight 0309 enabled: !Config.isShowLocalMessagesOnRightImmutable && !Config.compactLayout 0310 onToggled: { 0311 Config.showLocalMessagesOnRight = checked; 0312 Config.save(); 0313 } 0314 } 0315 0316 FormCard.FormDelegateSeparator { 0317 above: showLocalMessagesOnRightDelegate 0318 below: showLinkPreviewDelegate 0319 } 0320 0321 FormCard.FormCheckDelegate { 0322 id: showLinkPreviewDelegate 0323 text: i18n("Show links preview in the chat messages") 0324 checked: Config.showLinkPreview 0325 onToggled: { 0326 Config.showLinkPreview = checked; 0327 Config.save(); 0328 } 0329 } 0330 } 0331 0332 FormCard.FormHeader { 0333 title: i18n("Show Avatar") 0334 } 0335 FormCard.FormCard { 0336 FormCard.FormCheckDelegate { 0337 text: i18n("In chat") 0338 checked: Config.showAvatarInTimeline 0339 onToggled: { 0340 Config.showAvatarInTimeline = checked; 0341 Config.save(); 0342 } 0343 enabled: !Config.isShowAvatarInTimelineImmutable 0344 } 0345 0346 FormCard.FormCheckDelegate { 0347 text: i18n("In sidebar") 0348 checked: Config.showAvatarInRoomDrawer 0349 enabled: !Config.isShowAvatarInRoomDrawerImmutable 0350 onToggled: { 0351 Config.showAvatarInRoomDrawer = checked; 0352 Config.save(); 0353 } 0354 } 0355 } 0356 }