-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathglmenuplaylist.cpp
More file actions
113 lines (92 loc) · 2.98 KB
/
Copy pathglmenuplaylist.cpp
File metadata and controls
113 lines (92 loc) · 2.98 KB
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
#include "glmenuplaylist.h"
GlMenuPlaylist::GlMenuPlaylist(GlObject* parent) : GlObject(parent)
{
backGroundColor = QColor(Qt::black);
setGeometry(0,0,800,600);
setVisible(false);
listWidget = new GlListWidget(this);
listWidget->setGeometry(30,20,400,560);
connect(listWidget, SIGNAL(itemClicked(QString)), this, SIGNAL(playlistSelected(QString)));
//listWidget->setImage();
buttonMain = new GlButton(this);
buttonMain->setGeometry(530, 48,200,30);
buttonMain->setBackGroundPixmap(QPixmap(":/images/button.png"));
buttonMain->setBackGroundPixmapPressed(QPixmap(":/images/button_pressed.png"));
buttonMain->setText("Main");
buttonMain->setImage();
connect(buttonMain, SIGNAL(clicked()), this, SIGNAL(buttonMainClicked()));
buttonPlayer = new GlButton(this);
buttonPlayer->setGeometry(530,108,200,30);
buttonPlayer->setBackGroundPixmap(QPixmap(":/images/button.png"));
buttonPlayer->setBackGroundPixmapPressed(QPixmap(":/images/button_pressed.png"));
buttonPlayer->setText("Player");
buttonPlayer->setImage();
connect(buttonPlayer, SIGNAL(clicked()), this, SIGNAL(buttonPlayerClicked()));
}
void GlMenuPlaylist::draw(QPainter *p)
{
if(backGroundColor.isValid())
{
p->setBrush(backGroundColor);
p->drawRect(geometry());
}
for(int i = 0; i < listChilds.size(); i++)
listChilds.at(i)->draw(p);
}
void GlMenuPlaylist::mousePressEvent(QMouseEvent *event)
{
QRect rect;
for(int i = 0; i < listChilds.size(); i++)
{
rect = listChilds.at(i)->geometry();
if(listChilds.at(i)->isVisible() && rect.contains(event->pos()))
{
listChilds.at(i)->mousePressEvent(event);
}
}
}
void GlMenuPlaylist::mouseReleaseEvent(QMouseEvent *event)
{
QRect rect;
for(int i = 0; i < listChilds.size(); i++)
{
rect = listChilds.at(i)->geometry();
if(listChilds.at(i)->isVisible() && rect.contains(event->pos()))
{
listChilds.at(i)->mouseReleaseEvent(event);
}
}
}
void GlMenuPlaylist::rollIn(QPainter *p)
{
/*Alle Kindobjekte werden eingerollt*/
int per = getPercent();
int angle = int((per/100.)* -90);
if(per < 0 || per > 100) return;
buttonMain->drawImageAt(p, angle, per);
buttonPlayer->drawImageAt(p, angle, per);
listWidget->drawImageAt(p, angle, per);
}
void GlMenuPlaylist::rollOut(QPainter *p)
{
int per = getPercent();
int angle = int((per/100.) * 90);
if(per < 0 || per > 100) return;
buttonMain->drawImageAt(p, angle, per);
buttonPlayer->drawImageAt(p, angle, per);
listWidget->drawImageAt(p, angle, per);
}
void GlMenuPlaylist::setDatabase(Database *d)
{
db = d;
listWidget->insertItem(db->getPlaylist(), false);
}
void GlMenuPlaylist::setLarge()
{
/*Alles auf 1024 x 768 zoomen*/
setGeometry(0,0,1024,768);
for(int i = 0; i < listChilds.size(); i++)
{
listChilds.at(i)->setLarge();
}
}