Files
quickdots/bar/modules/Logo.qml
2026-05-17 22:30:27 +00:00

77 lines
2.2 KiB
QML

import QtQuick
import "../../config" as Cfg
import "../../components"
ModuleChip {
id: root
property var launcher: null
readonly property bool launcherActive: !!launcher && launcher.isOpen
readonly property bool isHovered: hovered
property real spinTarget: 0
onTargetScreenChanged: Qt.callLater(() => {
launcher = (targetScreen && targetScreen.launcher) ? targetScreen.launcher : null
})
onLauncherActiveChanged: {
spinTarget += launcherActive ? 360 : -360
if (launcherActive && !clickAnim.running)
clickAnim.restart()
}
width: Cfg.Config.logoIconSize * 2 + 4
height: parent.height
chipColor: t.logoBg
chipColorHovered: t.logoBgHover
chipBorderColor: t.logoBorder
chipBorderColorHovered: t.logoBorderActive
popupOpen: launcherActive
chipAnimDuration: 250
TapHandler {
onTapped: {
clickAnim.restart()
if (root.targetScreen && root.targetScreen.launcher) {
root.targetScreen.launcher.toggle()
}
}
}
SequentialAnimation {
id: clickAnim
NumberAnimation { target: logoText; property: "scale"; from: 1.0; to: 0.7; duration: 60; easing.type: Easing.OutQuad }
NumberAnimation { target: logoText; property: "scale"; from: 0.7; to: 1.2; duration: 150; easing.type: Easing.OutBack }
NumberAnimation { target: logoText; property: "scale"; to: 1.0; duration: 100 }
}
Text {
id: logoText
anchors.centerIn: parent
text: Cfg.Config.logoIcon
color: launcherActive ? t.logoIconActive : t.logoIcon
font.pixelSize: Cfg.Config.logoIconSize
Behavior on color { ColorAnimation { duration: 250 } }
scale: clickAnim.running ? logoText.scale : 1.0
Behavior on scale {
enabled: !clickAnim.running
NumberAnimation { duration: 250; easing.type: Easing.OutBack }
}
rotation: root.spinTarget
Behavior on rotation {
NumberAnimation {
duration: 600
easing.type: Easing.InOutBack
}
}
}
}