summaryrefslogtreecommitdiff
path: root/dgedit/canvastoollisten.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2014-04-18 13:16:03 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2014-04-18 13:16:03 +0200
commit68e4647e565519c57d76b95806dd9431a4ecfbb1 (patch)
treee7868dfa39dc886d21967dd6766072067d37636c /dgedit/canvastoollisten.cc
parent11b8e6db937f4c77942febb69f7b41e87ae0b6e0 (diff)
New player model (again).
Diffstat (limited to 'dgedit/canvastoollisten.cc')
-rw-r--r--dgedit/canvastoollisten.cc29
1 files changed, 2 insertions, 27 deletions
diff --git a/dgedit/canvastoollisten.cc b/dgedit/canvastoollisten.cc
index bd16b15..847c32d 100644
--- a/dgedit/canvastoollisten.cc
+++ b/dgedit/canvastoollisten.cc
@@ -39,7 +39,6 @@ bool CanvasToolListen::mousePressEvent(QMouseEvent *event)
{
if(!isActive()) return false;
player.setPosition(canvas->unmapX(event->x()));
- player.playing = true;
canvas->update();
connect(&player, SIGNAL(positionUpdate(size_t)), this, SLOT(update(size_t)));
return true;
@@ -48,7 +47,7 @@ bool CanvasToolListen::mousePressEvent(QMouseEvent *event)
bool CanvasToolListen::mouseReleaseEvent(QMouseEvent *event)
{
if(!isActive()) return false;
- player.playing = false;
+ player.stop();
disconnect(&player, SIGNAL(positionUpdate(size_t)),
this, SLOT(update(size_t)));
lastpos = 0;
@@ -60,7 +59,7 @@ void CanvasToolListen::paintEvent(QPaintEvent *event, QPainter &painter)
{
if(!isActive()) return;
- if(player.playing) {
+ if(player.pos < player.end) {
painter.setPen(QColor(0, 127, 127));
painter.drawLine(canvas->mapX(pos),
event->rect().y(),
@@ -80,27 +79,3 @@ void CanvasToolListen::update(size_t pos)
canvas->update(r);
lastpos = pos;
}
-
-void CanvasToolListen::setVolume(int v)
-{
- player.setGainScalar(v);
-}
-
-/*
- * UGLY HACK: This method is in dire need of a rewrite!
- */
-#include <unistd.h>
-void CanvasToolListen::playRange(unsigned int from, unsigned int to)
-{
- player.pos = from;
- player.playing = true;
- canvas->update();
- connect(&player, SIGNAL(positionUpdate(size_t)), this, SLOT(update(size_t)));
- while(player.pos < to) {
- qApp->processEvents();
- usleep(10000);
- }
- disconnect(&player, SIGNAL(positionUpdate(size_t)),
- this, SLOT(update(size_t)));
- player.playing = false;
-}