Skip to content

Commit

Permalink
chore: switch animation tweak
Browse files Browse the repository at this point in the history
remove static dci icon
  • Loading branch information
kegechen committed Aug 9, 2024
1 parent 2578119 commit 0f81b16
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
12 changes: 5 additions & 7 deletions qt6/src/qml/Switch.qml
Original file line number Diff line number Diff line change
Expand Up @@ -33,30 +33,28 @@ T.Switch {
width: DS.Style.switchButton.handleWidth
height: DS.Style.switchButton.handleHeight
sourceSize: Qt.size(DS.Style.switchButton.indicatorWidth, DS.Style.switchButton.indicatorWidth)
name: control.checked ? "switch_on_static" : "switch_off_static"
name: !control.checked ? "switch_on" : "switch_off"
opacity: control.D.ColorSelector.controlState === D.DTK.DisabledState && control.checked ? 0.4 : 1
palette {
highlight: control.checked ? control.palette.highlight : control.D.ColorSelector.handleColor
palette: DTK.makeIconPalette(control.palette)/* {
highlight: control.palette.highlight
highlightForeground: control.palette.highlightedText
foreground: control.palette.windowText
background: control.palette.window
}
}*/
mode: control.D.ColorSelector.controlState
theme: control.D.ColorSelector.controlTheme
fallbackToQIcon: false
}

Timer {
id: toggletimer
interval: 200
interval: 300
onTriggered: {
control.toggle()
handle.name = control.checked ? "switch_on_static" : "switch_off_static"
}
}

function palyAndSetImage() {
handle.name = !control.checked ? "switch_on" : "switch_off"
handle.play(D.DTK.NormalState)
toggletimer.start();
}
Expand Down
2 changes: 0 additions & 2 deletions src/dtkdeclarative_assets.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@
<file alias="built-in-icons/slider_round_ver.dci">icons/bloom/slider_round_ver.dci</file>
<file alias="built-in-icons/switch_on.dci">icons/bloom/switch_on.dci</file>
<file alias="built-in-icons/switch_off.dci">icons/bloom/switch_off.dci</file>
<file alias="built-in-icons/switch_on_static.dci">icons/bloom/switch_on_static.dci</file>
<file alias="built-in-icons/switch_off_static.dci">icons/bloom/switch_off_static.dci</file>
<file alias="built-in-icons/slider_point_up.dci">icons/bloom/slider_point_up.dci</file>
<file alias="built-in-icons/checkbox_mix.dci">icons/bloom/checkbox_mix.dci</file>
<file alias="built-in-icons/checkbox_checked.dci">icons/bloom/checkbox_checked.dci</file>
Expand Down
Binary file removed src/icons/bloom/switch_off_static.dci
Binary file not shown.
Binary file removed src/icons/bloom/switch_on_static.dci
Binary file not shown.

0 comments on commit 0f81b16

Please sign in to comment.