summaryrefstree
path: root/usr/bin/qmldashboard/USB/USBaudio/USBAudio.qml
blob: 70859b542a940e8039190396af91d30bfeada2b5 (plain)
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
import QtQuick 2.0
import Label 2.0
import "../../com/neusoft/auto/widgets"
import "../../windowsList.js" as WindowsList
import "../../layoutList.js" as Layout
HMICenterWindow
{
    id:main_play_window

    property string usb_ptime: "00:00:00"
    property string usb_totaltime:"00:00:00"
    property double usb_playbarscale: 0
    property string songtitle: dashUSBCtrl.filename
    property string coverpath: dashUSBCtrl.coverPath
    property string artistname: dashUSBCtrl.artistName
    property string albumname: dashUSBCtrl.albumName

    onVisibleChanged:
    {
        console.log("[Audio_QML_MAIN]### onVisibleChanged main_play_window.visible ===###"+main_play_window.visible)
        console.log("[Audio]### NOFILE!!!!!!!!!!!1");
    }

    Item
    {
        x:comX
        y:comY
        Image{
            id:bgAll
            width: 800
            height: 350
            source: "../../images/Common/Background/Media_BG.png"
            anchors.top:main_play_window.top
            anchors.left: main_play_window.left
        }

        Image{
            id:imgUsbDevice
            x:36
            y:7
            source:"../../images/Type_E_Audio/Media_Playing/Media_icon_USB.png"
        }

        HMILabel{
            id: usbName
            color: "#FFFFFF"
            text: "  "
            font.pixelSize:20
            horizontalAlignment: Label.AlignLeft
            anchors.left:imgUsbDevice.right
            anchors.leftMargin: 8
            elide: Label.ElideRight
            width:440
            height: 30
            anchors.verticalCenter: imgUsbDevice.verticalCenter
        }

        Image {
            id: imgAlbumWhiteBg
            anchors.top: imgUsbDevice.bottom
            anchors.topMargin: 31
            x:imgUsbDevice.x + 15
            width:221;height: 230
            source:"../../images/Type_E_Audio/Media_Playing/Media_Album_cover_Transparent.png"
        }

        Image {
            id: imgAlbum
            anchors.top: imgUsbDevice.bottom
            anchors.topMargin: 31
            x:imgUsbDevice.x + 15
            width:221;height: 230
            fillMode: Image.PreserveAspectFit
            source:
            {
                if(coverpath === "")
                {
                      imgAlbum.source = "../../images/Type_E_Audio/Media_Playing/Media_Album_cover_default.png"
                }
                else
                {
                      imgAlbum.source = coverpath
                }
            }
        }

        Image {
            id: imgAlbumBg
            anchors.top: imgUsbDevice.bottom
            anchors.topMargin: 25
    //        anchors.left: bgAll.left
    //        anchors.leftMargin: 33
            x:imgUsbDevice.x
            width:344;height: 244
            source:
            {
                source="../../images/Type_E_Audio/Media_Playing/Media_Album cover.png"

            }
        }

        HMILabel
        {

            id: current_play_song

            anchors.top: imgAlbum.top
            anchors.topMargin: 5
            x:405

            wrapMode: Label.NoWrap
            horizontalAlignment: Label.AlignHCenter
            text: (songtitle==""?"Unknow":songtitle.substring(0,songtitle.length - 4))//(usb_scanstatus == StatusList.USB_SCAN_START)?usb_songfilename:"Song  Name"
            color: "#FFFFFF"
            width:300
            height: 40
            font.pixelSize: 30
            elide: Label.ElideRight

            onTextChanged: {
                if(current_play_song.width <= contentWidth)
                {
                    current_play_song.horizontalAlignment = Label.AlignLeft
                }
                else
                {
                    current_play_song.horizontalAlignment = Label.AlignHCenter
                }
            }
        }
        HMILabel
        {
            id: albumName
            text: (albumname==""?" ":albumname)//qsTr("Album Name")

            anchors.top: current_play_song.bottom
            anchors.topMargin: 10
            x:405

            font.pixelSize: 22
            width:300
            height: 30
            horizontalAlignment: Label.AlignHCenter

            elide: Label.ElideRight

            onTextChanged: {
                if(albumName.width <= contentWidth)
                {
                    albumName.horizontalAlignment = Label.AlignLeft
                }
                else
                {
                    albumName.horizontalAlignment = Label.AlignHCenter
                }
            }
        }

        HMILabel{
            id: artistName
            text:  (artistname==""?" ":artistname)//qsTr("Artist Name")

            anchors.top: albumName.bottom
            anchors.topMargin: 10
            x:405

            horizontalAlignment: Label.AlignHCenter
            elide: Label.ElideRight
            font.pixelSize: 22
            width:300
            height: 30

            onTextChanged: {
                if(artistName.width <= contentWidth)
                {
                    artistName.horizontalAlignment = Label.AlignLeft
                }
                else
                {
                    artistName.horizontalAlignment = Label.AlignHCenter
                }
            }
        }

        HMILabel{
            id: play_time
            color: "#FFFFFF"
            text:(usb_ptime==""?"00:00:00":usb_ptime)//usb_ptime//qsTr("01:40")

            anchors.top: imgAlbum.bottom
            anchors.topMargin: 27
            anchors.left: bgAll.left
            anchors.leftMargin: 80

    //        anchors.verticalCenter: btnPlayRepeat.verticalCenter

            font.pixelSize: 18
            width:75//47
            height: 20
            horizontalAlignment: Label.AlignLeft
            visible: true
        }

        HMIProcessBarDrag
        {
            id:main_processbar
            anchors.verticalCenter:play_time.verticalCenter
            anchors.left: play_time.right
            anchors.leftMargin: 15
            barBackgroundMiddlewidth:460//464-10
            enterValue: usb_playbarscale * totalValue
        }


        HMILabel{
            id: total_time
            color: "#FFFFFF"
            text: (usb_totaltime==""?"00:00:00":usb_totaltime)//"04:30"//usb_totaltime

            anchors.verticalCenter: play_time.verticalCenter
            anchors.left: main_processbar.right
            anchors.leftMargin: 15

            horizontalAlignment: Label.AlignLeft
            font.pixelSize: 18
            width:75//47
            height: 20
        }
    }

     Connections
     {
         target:dashUSBCtrl

         onPtimechange:
         {
             console.debug("onPtimechange = "+usbPtime)
             usb_ptime = usbPtime;
             usb_totaltime = usbTotaltime;
             usb_playbarscale = usbPlaybarscale
         }
         onArtistNameChange:
         {
             console.debug("onArtistNameChange = "+dashUSBCtrl.artistName)
             artistname = dashUSBCtrl.artistName;
         }
         onAlbumNameChange:
         {
             console.debug("onAlbumNameChange = "+dashUSBCtrl.albumName)
             albumname = dashUSBCtrl.albumName;
         }
         onFileNameChange:
         {
             console.debug("onFileNameChange = "+dashUSBCtrl.filename)
             songtitle = dashUSBCtrl.filename;
         }
         onCoverPathChange:
         {
             console.debug("onCoverPathChange = "+dashUSBCtrl.coverPath)
             coverpath = dashUSBCtrl.coverPath;
             if(coverpath === "")
             {
                 imgAlbum.source = "../../images/Type_E_Audio/Media_Playing/Media_Album_cover_default.png"
             }
             else
             {
                 imgAlbum.source = coverpath
             }
         }
         onSongInfoClr:
         {
             artistname = dashUSBCtrl.artistName;
             albumname = dashUSBCtrl.albumName;
             songtitle = dashUSBCtrl.filename;
             coverpath = dashUSBCtrl.coverPath;
             imgAlbum.source = "../../images/Type_E_Audio/Media_Playing/Media_Album_cover_default.png"
         }
//         onUsbDisconnect:
//         {
//             imgAlbum.source = "../images/Type_E_Audio/Media_Playing/Media_Album_cover_default.png"
//            ScreenManager.changeLayout(Layout.LT_CALL, Layout.USB, WindowsList.USB_NOCONNECTED)
//         }
     }
}