added three new modules (Crypto.qml, Battery.qml, Network.qml), improved Stats.qml, improved Tray.qml, optimized code in general, added a polkit agent, configurations change (check configs)
This commit is contained in:
89
bar/modules/Logo.qml
Normal file
89
bar/modules/Logo.qml
Normal file
@@ -0,0 +1,89 @@
|
||||
import QtQuick
|
||||
|
||||
import "../../config" as Cfg
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
|
||||
property real panelRadius: Cfg.Config.radius / 2
|
||||
property int borderWidth: Cfg.Config.panelBorderWidth
|
||||
|
||||
property bool isTop: true
|
||||
property var targetScreen: null
|
||||
property int barHeight: Cfg.Config.barHeight
|
||||
property int barMargin: Cfg.Config.margin
|
||||
|
||||
readonly property var t: Cfg.Config.theme
|
||||
|
||||
property var launcher: null
|
||||
|
||||
readonly property bool launcherActive: !!launcher && launcher.isOpen
|
||||
readonly property bool isHovered: hoverHandler.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
|
||||
|
||||
color: isHovered ? t.logoBgHover : t.logoBg
|
||||
radius: panelRadius
|
||||
|
||||
border.color: launcherActive ? t.logoBorderActive : t.logoBorder
|
||||
border.width: borderWidth
|
||||
|
||||
Behavior on color { ColorAnimation { duration: 250 } }
|
||||
Behavior on border.color { ColorAnimation { duration: 250 } }
|
||||
|
||||
HoverHandler { id: hoverHandler }
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user