Add stop after current track feature to network remote.

This commit is contained in:
Andreas 2013-07-20 19:38:37 +02:00
parent f166954495
commit 1e4819f2df
6 changed files with 15 additions and 0 deletions

View File

@ -20,6 +20,7 @@ enum MsgType {
// Lastfm
LOVE = 12;
BAN = 13;
STOP_AFTER = 17;
// Messages send by both
DISCONNECT = 2;

View File

@ -254,6 +254,10 @@ void Player::Stop() {
current_item_.reset();
}
void Player::StopAfterCurrent() {
app_->playlist_manager()->active()->StopAfter(app_->playlist_manager()->active()->current_row());
}
void Player::Previous() {
PreviousItem(Engine::Manual);
}

View File

@ -142,6 +142,7 @@ public slots:
void Mute();
void Pause();
void Stop();
void StopAfterCurrent();
void Play();
void ShowOSD();
void TogglePrettyOSD();

View File

@ -43,6 +43,8 @@ IncomingDataParser::IncomingDataParser(Application* app)
app_->player(), SLOT(Pause()));
connect(this, SIGNAL(Stop()),
app_->player(), SLOT(Stop()));
connect(this, SIGNAL(StopAfterCurrent()),
app_->player(), SLOT(StopAfterCurrent()));
connect(this, SIGNAL(Next()),
app_->player(), SLOT(Next()));
connect(this, SIGNAL(Previous()),
@ -115,6 +117,8 @@ void IncomingDataParser::Parse(const pb::remote::Message& msg) {
break;
case pb::remote::STOP: emit Stop();
break;
case pb::remote::STOP_AFTER: emit StopAfterCurrent();
break;
case pb::remote::NEXT: emit Next();
break;
case pb::remote::PREVIOUS: emit Previous();

View File

@ -33,6 +33,7 @@ signals:
void PlayPause();
void Pause();
void Stop();
void StopAfterCurrent();
void Next();
void Previous();
void SetVolume(int volume);

View File

@ -258,6 +258,10 @@ void PlaylistView::setModel(QAbstractItemModel *m) {
this, SLOT(InvalidateCachedCurrentPixmap()));
disconnect(model(), SIGNAL(layoutAboutToBeChanged()),
this, SLOT(RatingHoverOut()));
// When changing the model, always invalidate the current pixmap.
// If a remote client uses "stop after", without invaliding the stop
// mark would not appear.
InvalidateCachedCurrentPixmap();
}
QTreeView::setModel(m);