Handle immutable settings

This commit is contained in:
Carl Schwan
2021-08-15 01:00:34 +02:00
parent 17bbc60f6f
commit 21bd5fa94e
2 changed files with 14 additions and 1 deletions

View File

@@ -98,6 +98,7 @@ Kirigami.ScrollablePage {
text: i18n("Bubbles") text: i18n("Bubbles")
checked: !Config.compactLayout checked: !Config.compactLayout
QQC2.ButtonGroup.group: themeGroup QQC2.ButtonGroup.group: themeGroup
enabled: !Config.isCompactLayoutImmutable
onToggled: { onToggled: {
Config.compactLayout = !checked; Config.compactLayout = !checked;
@@ -164,6 +165,7 @@ Kirigami.ScrollablePage {
text: i18n("Compact") text: i18n("Compact")
checked: Config.compactLayout checked: Config.compactLayout
QQC2.ButtonGroup.group: themeGroup QQC2.ButtonGroup.group: themeGroup
enabled: !Config.isCompactLayoutImmutable
onToggled: { onToggled: {
Config.compactLayout = checked; Config.compactLayout = checked;
@@ -180,10 +182,12 @@ Kirigami.ScrollablePage {
Config.showAvatarInTimeline = checked Config.showAvatarInTimeline = checked
Config.save() Config.save()
} }
enabled: !Config.isShowAvatarInTimelineImmutable
} }
QQC2.CheckBox { QQC2.CheckBox {
text: i18n("In Sidebar") text: i18n("In Sidebar")
checked: Config.showAvatarInRoomDrawer checked: Config.showAvatarInRoomDrawer
enabled: !Config.isShowAvatarInRoomDrawerImmutable
onToggled: { onToggled: {
Config.showAvatarInRoomDrawer = checked Config.showAvatarInRoomDrawer = checked
Config.save() Config.save()
@@ -192,6 +196,7 @@ Kirigami.ScrollablePage {
QQC2.CheckBox { QQC2.CheckBox {
text: i18n("Show Fancy Effects") text: i18n("Show Fancy Effects")
checked: Config.showFancyEffects checked: Config.showFancyEffects
enabled: !Config.isShowFancyEffectsImmutable
onToggled: { onToggled: {
Config.showFancyEffects = checked; Config.showFancyEffects = checked;
Config.save(); Config.save();
@@ -205,7 +210,7 @@ Kirigami.ScrollablePage {
QQC2.CheckBox { QQC2.CheckBox {
visible: Controller.hasWindowSystem visible: Controller.hasWindowSystem
text: i18n("Use transparent chat page") text: i18n("Use transparent chat page")
enabled: !Config.compactLayout enabled: !Config.compactLayout && !Config.isBlurImmutable
checked: Config.blur checked: Config.blur
onToggled: { onToggled: {
Config.blur = checked; Config.blur = checked;
@@ -214,6 +219,7 @@ Kirigami.ScrollablePage {
} }
RowLayout { RowLayout {
visible: Controller.hasWindowSystem && Config.blur visible: Controller.hasWindowSystem && Config.blur
enabled: !Config.isTransparancyImmutable
Kirigami.FormData.label: i18n("Transparency:") Kirigami.FormData.label: i18n("Transparency:")
QQC2.Slider { QQC2.Slider {
enabled: !Config.compactLayout && Config.blur enabled: !Config.compactLayout && Config.blur
@@ -237,6 +243,7 @@ Kirigami.ScrollablePage {
QQC2.CheckBox { QQC2.CheckBox {
text: i18n("Show your messages on the right") text: i18n("Show your messages on the right")
checked: Config.showLocalMessagesOnRight checked: Config.showLocalMessagesOnRight
enabled: !Config.isShowLocalMessagesOnRightImmutable
onToggled: { onToggled: {
Config.showLocalMessagesOnRight = checked Config.showLocalMessagesOnRight = checked
Config.save() Config.save()

View File

@@ -18,6 +18,7 @@ Kirigami.ScrollablePage {
text: i18n("Close to system tray") text: i18n("Close to system tray")
checked: Config.systemTray checked: Config.systemTray
visible: Controller.supportSystemTray visible: Controller.supportSystemTray
enabled: !Config.isSystemTrayImmutable
onToggled: { onToggled: {
Config.systemTray = checked Config.systemTray = checked
Config.save() Config.save()
@@ -29,6 +30,7 @@ Kirigami.ScrollablePage {
Kirigami.FormData.label: i18n("Notifications and events:") Kirigami.FormData.label: i18n("Notifications and events:")
text: i18n("Show notifications") text: i18n("Show notifications")
checked: Config.showNotifications checked: Config.showNotifications
enabled: !Config.isShowNotificationsImmutable
onToggled: { onToggled: {
Config.showNotifications = checked Config.showNotifications = checked
Config.save() Config.save()
@@ -37,6 +39,7 @@ Kirigami.ScrollablePage {
QQC2.CheckBox { QQC2.CheckBox {
text: i18n("Show leave and join events") text: i18n("Show leave and join events")
checked: Config.showLeaveJoinEvent checked: Config.showLeaveJoinEvent
enabled: !Config.isShowLeaveJoinEventImmutable
onToggled: { onToggled: {
Config.showLeaveJoinEvent = checked Config.showLeaveJoinEvent = checked
Config.save() Config.save()
@@ -46,6 +49,7 @@ Kirigami.ScrollablePage {
Kirigami.FormData.label: i18n("Rooms and private chats:") Kirigami.FormData.label: i18n("Rooms and private chats:")
text: i18n("Separated") text: i18n("Separated")
checked: !Config.mergeRoomList checked: !Config.mergeRoomList
enabled: !Config.isMergeRoomListImmutable
onToggled: { onToggled: {
Config.mergeRoomList = false Config.mergeRoomList = false
Config.save() Config.save()
@@ -54,6 +58,7 @@ Kirigami.ScrollablePage {
QQC2.RadioButton { QQC2.RadioButton {
text: i18n("Intermixed") text: i18n("Intermixed")
checked: Config.mergeRoomList checked: Config.mergeRoomList
enabled: !Config.isMergeRoomListImmutable
onToggled: { onToggled: {
Config.mergeRoomList = true Config.mergeRoomList = true
Config.save() Config.save()
@@ -62,6 +67,7 @@ Kirigami.ScrollablePage {
QQC2.CheckBox { QQC2.CheckBox {
text: i18n("Use s/text/replacement syntax to edit your last message") text: i18n("Use s/text/replacement syntax to edit your last message")
checked: Config.allowQuickEdit checked: Config.allowQuickEdit
enabled: !Config.isAllowQuickEditImmutable
onToggled: { onToggled: {
Config.allowQuickEdit = checked Config.allowQuickEdit = checked
Config.save() Config.save()