diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2011-02-19 07:30:54 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2011-02-19 07:30:54 +0000 |
| commit | 30e11dd37f98c78193d5768c634931865821af10 (patch) | |
| tree | 2091503c63750f738be7b830a8be586ad7f9b1c7 /src/ui/display.cpp | |
| parent | 37f66aa3c4e031812b0c2a415f07c661d8ee13aa (diff) | |
| download | qmmp-30e11dd37f98c78193d5768c634931865821af10.tar.gz qmmp-30e11dd37f98c78193d5768c634931865821af10.tar.bz2 qmmp-30e11dd37f98c78193d5768c634931865821af10.zip | |
added position tracking
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@2062 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/ui/display.cpp')
| -rw-r--r-- | src/ui/display.cpp | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/ui/display.cpp b/src/ui/display.cpp index 9598262b2..9b54306d2 100644 --- a/src/ui/display.cpp +++ b/src/ui/display.cpp @@ -73,7 +73,6 @@ MainDisplay::MainDisplay (QWidget *parent) m_eject->setToolTip(tr("Add file")); connect (m_eject,SIGNAL (clicked()),parent,SLOT (addFile())); connect (m_skin, SIGNAL (skinChanged()), this, SLOT (updateSkin())); - m_posbar = new PositionBar (this); m_vis = new MainVisual (this); m_eqButton = new ToggleButton (this,Skin::BT_EQ_ON_N,Skin::BT_EQ_ON_P, @@ -110,6 +109,11 @@ MainDisplay::MainDisplay (QWidget *parent) connect(m_balanceBar, SIGNAL(sliderPressed()),SLOT(updateVolume())); connect(m_balanceBar, SIGNAL(sliderReleased()),m_text,SLOT(clear())); + m_posbar = new PositionBar(this); + connect(m_posbar, SIGNAL(sliderPressed()),SLOT(showPosition())); + connect(m_posbar, SIGNAL(sliderMoved(qint64)),SLOT(showPosition())); + connect(m_posbar, SIGNAL(sliderReleased()),SLOT(updatePosition())); + m_timeIndicator = new TimeIndicator(this); m_aboutWidget = new QWidget(this); m_core = SoundCore::instance(); @@ -168,7 +172,7 @@ void MainDisplay::setTime (qint64 t) } void MainDisplay::setDuration(qint64 t) { - m_posbar->setMax (t); + m_posbar->setMaximum (t); m_timeIndicator->setSongDuration(t/1000); } @@ -189,7 +193,7 @@ void MainDisplay::setState(Qmmp::State state) m_monoster->setChannels (0); m_timeIndicator->setNeedToShowTime(false); m_posbar->setValue (0); - m_posbar->setMax (0); + m_posbar->setMaximum (0); m_titlebar->setTime(-1); } } @@ -302,6 +306,21 @@ void MainDisplay::updateVolume() m_mw->setVolume(m_volumeBar->value(), m_balanceBar->value()); } +void MainDisplay::showPosition() +{ + int sec = m_posbar->value() / 1000; + if(sec > 3600) + sec /= 60; + QString time = QString("%1:%2").arg(sec/60, 2, 10, QChar('0')).arg(sec%60, 2, 10, QChar('0')); + m_text->setText(tr("Seek to: %1").arg(time)); +} + +void MainDisplay::updatePosition() +{ + m_text->clear(); + m_core->seek(m_posbar->value()); +} + void MainDisplay::wheelEvent (QWheelEvent *e) { m_mw->setVolume(m_volumeBar->value()+e->delta()/10, m_balanceBar->value()); |
