-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbottombar.cpp
69 lines (60 loc) · 1.72 KB
/
bottombar.cpp
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
#include "bottombar.h"
#include <QBitmap>
#include <QPainter>
extern QString blue;
extern QString lightGray;
BottomBar::BottomBar()
{
loopState = 1;
shuffleState = true;
loopButton = new OpButton(":res/img/loop.svg",27,27,blue);
shuffleButton = new OpButton(":res/img/shuffle.svg",27,27,blue);
connect(loopButton,SIGNAL(released()),this,SLOT(toggleLoop()));
connect(shuffleButton,SIGNAL(released()),this,SLOT(toggleShuffle()));
setMaximumHeight(75);
setStyleSheet("BottomBar{border:none;background:transparent;border-top:1px solid #DDD;}");
frameLayout->setSpacing(5);
frameLayout->addWidget(songInfo,0);
frameLayout->addWidget(playerButtons,0);
frameLayout->addWidget(timeBar,1);
frameLayout->addWidget(volumeBar,0);
frameLayout->addWidget(loopButton,0);
frameLayout->addWidget(shuffleButton,0);
}
void BottomBar::toggleLoop(){
setLoopMode(loopState);
}
void BottomBar::toggleShuffle(){
setShuffleMode(!shuffleState);
}
void BottomBar::setShuffleMode(bool mode)
{
if(mode){
shuffleButton->setColor(blue);
shuffleState = true;
}
else{
shuffleButton->setColor(lightGray);
shuffleState = false;
}
sendShuffleMode(!mode);
}
void BottomBar::setLoopMode(int mode)
{
if(mode == 0){
loopButton->setIcon(QIcon(":res/img/loop.svg"));
loopButton->setColor(blue);
loopState = 1;
}
else if(mode == 1){
loopButton->setIcon(QIcon(":res/img/loop-one.svg"));
loopButton->setColor(blue);
loopState = 2;
}
else if(mode == 2){
loopButton->setIcon(QIcon(":res/img/loop.svg"));
loopButton->setColor(lightGray);
loopState = 0;
}
sendLoopMode(loopState);
}