-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsonginfo.h
66 lines (54 loc) · 1.8 KB
/
songinfo.h
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
#ifndef SONGINFO_H
#define SONGINFO_H
#include <QWidget>
#include <QLabel>
#include <QBoxLayout>
#include <pix.h>
#include "croplabel.h"
extern QString path;
class SongInfo : public QWidget
{
Q_OBJECT
public:
SongInfo()
{
setFixedWidth(180);
artWork = new QLabel();
artWork->setPixmap(r.borderRadius(QImage(":res/img/artWork.png"),10));
artWork->setScaledContents(true);
artWork->setFixedSize(50,50);
song = new CropLabel("Song","font-size:11px;color:#444;font-weight:bold");
artist = new CropLabel("Album","font-size:10px;color:#666");
layout = new QBoxLayout(QBoxLayout::LeftToRight,this);
QWidget *textFrame = new QWidget();
QBoxLayout *textLayout = new QBoxLayout(QBoxLayout::TopToBottom,textFrame);
textLayout->setMargin(0);
textLayout->setSpacing(0);
textLayout->addWidget(song);
textLayout->addWidget(artist);
layout->addWidget(artWork);
layout->addWidget(textFrame,10);
layout->setMargin(0);
}
Pix r;
QBoxLayout *layout;
QLabel *artWork;
CropLabel *song;
CropLabel *artist;
public slots:
void setData(QVariantMap data){
if(data["artWork"].toBool()){
artWork->setPixmap(r.borderRadius(QImage(path + "/Cuarzo Player/Artwork/" + data["artist"].toString() + "/" + data["album"].toString() + ".jpg") ,10));
}else{
artWork->setPixmap(r.borderRadius(QImage(":res/img/artWork.png") ,10));
}
song->changeText(data["title"].toString());
artist->changeText(data["artist"].toString());
}
void clear(){
artWork->setPixmap(r.borderRadius(QImage(":res/img/artWork.png") ,10));
song->changeText("Song");
artist->changeText("Artist");
}
};
#endif // SONGINFO_H