summaryrefslogtreecommitdiff
path: root/player.cpp
blob: 8419d8cb15049334961c23635d67186fa8c3cb52 (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
46
47
48
49
#include "player.h"

Player::Player() {
	mo = new Phonon::MediaObject();
	ao = new Phonon::AudioOutput(Phonon::MusicCategory);
	Phonon::createPath(mo, ao);
	
	mo->setTickInterval(100);
	
	connect(mo, SIGNAL(tick(qint64)), SLOT(tick(qint64)));
	connect(mo, SIGNAL(totalTimeChanged(qint64)), SLOT(newlength(qint64)));
}

void Player::prev() {
	
}

void Player::pause() {
	mo->pause();
	emit changed_state(false);
}

void Player::play() {
	static bool kake = false;
	
	if(!kake) {
		kake = true;
		mo->setCurrentSource(*(new Phonon::MediaSource("historie.tta")));
	}
	
	mo->play();
	emit changed_state(true);
}

void Player::next() {
	
}

void Player::seek(int pos) {
	mo->seek(pos * 1000);
}

void Player::tick(qint64 time) {
	emit changed_pos(time / 1000);
}

void Player::newlength(qint64 length) {
	emit changed_length(length / 1000);
}