qsrand(seed);
_random = false;
_repeat = false;
+ _current = -1;
}
void Player::setTrackId(int id) {
_history.push(_current % count);
if (!_queue.isEmpty()) {
_current = _queue.dequeue();
+ } else if (!_prev_history.isEmpty()) {
+ _current = _prev_history.pop();
} else {
if (_random) {
_current = (count + (qrand() + qrand() + qrand()) % count) % count;
void Player::prev() {
if (_history.count() > 0) {
- _queue.push_front(_current);
+ _prev_history.push(_current);
_current = _history.pop();
_track = _playlist.tracks().at(_current);
}
}
void Player::play() {
- _player->play();
_state = PLAYER_PLAYING;
emit stateChanged(_state);
+ if (_current == -1) {
+ _current = 0;
+ _track = _playlist.tracks().at(0);
+ _set_source();
+ }
+ _player->play();
}
void Player::enqueue(int id) {