summaryrefslogtreecommitdiff
path: root/gui/mainwindow.cpp
blob: 28def130fa032243d08707586ffb9764708b26fd (plain)
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
#include "mainwindow.h"

MainWindow::MainWindow() {
	//setAttribute(Qt::WA_MacBrushedMetal, true);
	setupUi(this);
	
	connect(button_prev, SIGNAL(clicked()), SIGNAL(prev()));
	connect(button_pause, SIGNAL(clicked()), SIGNAL(pause()));
	connect(button_play, SIGNAL(clicked()), SIGNAL(play()));
	connect(button_next, SIGNAL(clicked()), SIGNAL(next()));
	
	connect(slider_seek, SIGNAL(sliderReleased()), SLOT(slider_released()));
	
	button_pause->hide();
}

void MainWindow::update_track(const QUrl& track) {
	
}

void MainWindow::update_state(bool playing) {
	if(playing) {
		button_play->hide();
		button_pause->show();
	} else {
		button_pause->hide();
		button_play->show();
	}
}

void MainWindow::update_pos(int pos) {
	label_pos->setText(QString("%1:%2").arg(pos / 60).arg(pos % 60, 2, 10, QChar('0')));
	if(!slider_seek->isSliderDown()) {
		slider_seek->setValue(pos);
	}
}

void MainWindow::update_length(int length) {
	label_length->setText(QString("%1:%2").arg(length / 60).arg(length % 60, 2, 10, QChar('0')));
	slider_seek->setMaximum(length);
}

void MainWindow::slider_released() {
	emit seek(slider_seek->value());
}