diff options
Diffstat (limited to 'gui/mainwindow.cpp')
-rw-r--r-- | gui/mainwindow.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp new file mode 100644 index 0000000..28def13 --- /dev/null +++ b/gui/mainwindow.cpp @@ -0,0 +1,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()); +} |