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