using namespace SomePlayer::Playback;
using namespace SomePlayer::DataObjects;
+using namespace SomePlayer::Storage;
Player::Player(QObject *parent) :
QObject(parent)
Phonon::createPath(_player, _output);
int seed = reinterpret_cast<int> (_player);
qsrand(seed);
- _random = false;
- _repeat = false;
+ _random = _config.getValue("playback/random").toBool();
+ _repeat = _config.getValue("playback/repeat").toBool();
_current = -1;
}
play();
}
-void Player::_stateChanged(Phonon::State newState, Phonon::State oldState) {
+void Player::_stateChanged(Phonon::State newState, Phonon::State /*oldState*/) {
switch (newState) {
case Phonon::PlayingState:
if (_state == PLAYER_LOADING) {
}
void Player::play() {
+ if (_playlist.tracks().isEmpty())
+ return;
_state = PLAYER_PLAYING;
emit stateChanged(_state);
if (_current == -1) {
void Player::enqueue(int id) {
_queue.enqueue(id);
}
+
+void Player::toggleRandom() {
+ _random = !_random;
+ _config.setValue("playback/random", _random);
+}
+
+void Player::toggleRepeat() {
+ _repeat = !_repeat;
+ _config.setValue("playback/repeat", _repeat);
+}
+
+void Player::setVolume(int v) {
+ _output->setVolume(v*0.01);
+}