This repository has been archived by the owner on Jan 28, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 22
/
Button.qml
executable file
·77 lines (67 loc) · 2.05 KB
/
Button.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import QtQuick 2.11
import QtQuick.Controls 2.5
import QtGraphicalEffects 1.0
import "qrc:/scripts/helper.js" as JSHelper
import "qrc:/components" as Comp
import "qrc:/basic_ui" as BasicUI
import MediaPlayerUtils 1.0
Comp.ButtonBase {
id: mediaplayerButton
icon: "\uE903"
cardLoader.source: "qrc:/components/media_player/ui/Card.qml"
// override default settings
title.anchors.verticalCenterOffset: obj.source === "" ? 0 : -15
button.enabled: obj.supported_features.indexOf("TURN_ON") > -1 ? true : false
// include mediaplayer utils
MediaPlayerUtils {
id: mediaplayerUtils
}
// additional UI elements
Text {
id: info
color: colorText
opacity: 0.5
text: obj.source
elide: Text.ElideRight
wrapMode: Text.WordWrap
width: title.width
anchors.left: parent.left
anchors.leftMargin: title.x
anchors.top: parent.top
anchors.topMargin: title.y + title.height
font.family: "Open Sans"
font.weight: Font.Normal
font.pixelSize: 20
lineHeight: 1
visible: mediaplayerButton.state == "closed" ? true : false
}
closeButtonMouseArea.onClicked: {
inputPanel.active = false
}
// album art
property string m_image: obj.mediaImage
onM_imageChanged: {
mediaplayerUtils.imageURL = obj.mediaImage
}
BasicUI.CustomImageLoader {
id: image
visible: mediaplayerButton.state == "closed" ? true : false
width: 80
height: 80
anchors.left: parent.left
anchors.leftMargin: 20
anchors.verticalCenter: parent.verticalCenter
url: mediaplayerUtils.smallImage == "" ? "" : mediaplayerUtils.smallImage
layer.enabled: true
layer.effect: OpacityMask {
maskSource: Item {
width: image.width
height: image.height
Rectangle {
anchors.fill: parent
radius: cornerRadius/2
}
}
}
}
}