61 lines
1.5 KiB
QML
61 lines
1.5 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
|
|
}
|
|
|
|
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: {
|
|
if (root.targetScreen && root.targetScreen.launcher) {
|
|
root.targetScreen.launcher.toggle()
|
|
}
|
|
}
|
|
}
|
|
|
|
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 } }
|
|
|
|
rotation: root.spinTarget
|
|
Behavior on rotation {
|
|
NumberAnimation {
|
|
duration: Cfg.Config.logoSpinDuration
|
|
easing.type: Easing.InOutBack
|
|
}
|
|
}
|
|
}
|
|
}
|