modified: bottombar.cpp
[groove] / bottombar.cpp
1 #include "bottombar.h"
2 #include "ui_bottombar.h"
3
4 bottomBar::bottomBar(QWidget *parent) :
5     QWidget(parent),
6     ui(new Ui::bottomBar)
7 {
8     ui->setupUi(this);
9     QRect screenGeometry = QApplication::desktop()->screenGeometry();
10     main = new QGraphicsScene(0,0,screenGeometry.width(),15);
11     ui->graphicsView->setScene(main);
12     ui->graphicsView->setSceneRect(0,0,screenGeometry.width(),15);
13     ui->graphicsView->setTransformationAnchor(QGraphicsView::NoAnchor);
14     main->setBackgroundBrush(this->palette().window());
15     main->setSceneRect(0,0,screenGeometry.width(),15);
16     this->playbackProgress = main->addRect(0,0,screenGeometry.width()/2,15,QPen(Qt::white),QBrush(Qt::white));
17 }
18
19 bottomBar::~bottomBar()
20 {
21     delete ui;
22 }
23 void bottomBar::setPlaybackProgress(int min, int max)
24 {
25     this->playbackProgress->setRect(0,0,(min/max)*main->width(),15);
26     ui->graphicsView->update();
27 }
28
29 void bottomBar::on_nextB_clicked()
30 {
31     emit this->nextB();
32 }
33 void bottomBar::on_pauseB_clicked()
34 {
35     emit this->pause();
36 }
37
38 void bottomBar::on_addButton_clicked()
39 {
40     emit this->addB();
41 }
42 void bottomBar::on_backB_clicked()
43 {
44     emit this->back();
45 }
46
47 void bottomBar::changeEvent(QEvent *e)
48 {
49     QWidget::changeEvent(e);
50     switch (e->type()) {
51     case QEvent::LanguageChange:
52         ui->retranslateUi(this);
53         break;
54     default:
55         break;
56     }
57 }