add anti flashbang

could be improve with smooth fading
This commit is contained in:
end-4
2025-10-22 23:56:50 +02:00
parent a4d2a720d0
commit b35ef90916
5 changed files with 105 additions and 8 deletions
@@ -303,6 +303,9 @@ Singleton {
property string to: "06:30" // Format: "HH:mm", 24-hour time
property int colorTemperature: 5000
}
property JsonObject antiFlashbang: JsonObject {
property bool enable: false
}
}
property JsonObject lock: JsonObject {
@@ -50,7 +50,7 @@ Rectangle {
property real targetY: root.height / 2 - root.backgroundHeight / 2
y: root.show ? targetY : (targetY - root.backgroundAnimationMovementDistance)
implicitWidth: 350
implicitHeight: 0
implicitHeight: contentColumn.implicitHeight + dialogBackground.radius * 2
Behavior on implicitHeight {
NumberAnimation {
id: dialogBackgroundHeightAnimation
@@ -34,7 +34,6 @@ WindowDialog {
id: nightLightColumn
Layout.topMargin: -16
Layout.fillWidth: true
Layout.fillHeight: true
ConfigSwitch {
anchors {
@@ -81,6 +80,39 @@ WindowDialog {
}
}
WindowDialogSectionHeader {
text: Translation.tr("Anti-flashbang (experimental)")
}
WindowDialogSeparator {
Layout.topMargin: -22
Layout.leftMargin: 0
Layout.rightMargin: 0
}
Column {
id: antiFlashbangColumn
Layout.topMargin: -16
Layout.fillWidth: true
ConfigSwitch {
anchors {
left: parent.left
right: parent.right
}
iconSize: Appearance.font.pixelSize.larger
buttonIcon: "destruction"
text: Translation.tr("Enable")
checked: Config.options.light.antiFlashbang.enable
onCheckedChanged: {
Config.options.light.antiFlashbang.enable = checked;
}
StyledToolTip {
text: Translation.tr("Example use case: eroge on one workspace, dark Discord window on another")
}
}
}
WindowDialogSectionHeader {
text: Translation.tr("Brightness")
}
@@ -95,7 +127,7 @@ WindowDialog {
id: brightnessColumn
Layout.topMargin: -16
Layout.fillWidth: true
// Layout.fillHeight: true
Layout.fillHeight: true
WindowDialogSlider {
anchors {
@@ -79,10 +79,7 @@ AbstractQuickPanel {
delegate: ButtonGroup {
id: toggleRow
required property int index
property var modelData: {
print(JSON.stringify(root.toggleRows[index]))
return root.toggleRows[index]
}
property var modelData: root.toggleRows[index]
property int startingIndex: {
const rows = root.toggleRows;
let sum = 0;