added two new themes, reworked Crypto.qml and Stats.qml, standardized the buttons for the modules, added a new Sidebar widget which contains new 3 modules
This commit is contained in:
63
widgets/sidebar/mpris/MediaButton.qml
Normal file
63
widgets/sidebar/mpris/MediaButton.qml
Normal file
@@ -0,0 +1,63 @@
|
||||
import QtQuick
|
||||
import "../../../config" as Cfg
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
|
||||
property string icon: ""
|
||||
property bool enabled: true
|
||||
property bool primary: false
|
||||
signal clicked()
|
||||
|
||||
property bool _hovered: false
|
||||
|
||||
readonly property var t: Cfg.Config.theme
|
||||
|
||||
width: primary ? 44 : 36
|
||||
height: width
|
||||
radius: width / 2
|
||||
|
||||
border.width: 1
|
||||
scale: _hovered && enabled ? 1.08 : 1
|
||||
|
||||
readonly property color _bgDefault: enabled
|
||||
? (primary ? t.accent : t.mprisBtnBg)
|
||||
: "transparent"
|
||||
readonly property color _bgHovered: primary
|
||||
? Qt.lighter(t.accent, 1.2)
|
||||
: t.mprisBtnBgHover
|
||||
|
||||
color: _hovered && enabled ? _bgHovered : _bgDefault
|
||||
border.color: primary ? color : (
|
||||
enabled
|
||||
? (_hovered ? t.mprisBtnBorderHover : t.mprisBtnBorder)
|
||||
: t.mprisBtnBorder
|
||||
)
|
||||
|
||||
Behavior on color { ColorAnimation { duration: 150 } }
|
||||
Behavior on border.color { ColorAnimation { duration: 150 } }
|
||||
Behavior on scale { NumberAnimation { duration: 150; easing.type: Easing.OutBack } }
|
||||
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: root.icon
|
||||
color: root.primary ? root.t.mprisButtonText : (
|
||||
root.enabled
|
||||
? (root._hovered ? root.t.mprisBtnIconHover : root.t.mprisBtnIcon)
|
||||
: root.t.mprisTextDim
|
||||
)
|
||||
font.pixelSize: primary ? 22 : 18
|
||||
Behavior on color { ColorAnimation { duration: 150 } }
|
||||
}
|
||||
|
||||
HoverHandler {
|
||||
cursorShape: root.enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
onHoveredChanged: root._hovered = hovered
|
||||
}
|
||||
|
||||
TapHandler {
|
||||
onTapped: {
|
||||
if (root.enabled) root.clicked()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user