Show OSD with current song after resuming from paused state, closes #6052

This commit is contained in:
Victor Parmar 2018-10-16 01:11:47 +02:00
parent 107e945872
commit cef7da6caf
3 changed files with 14 additions and 0 deletions

View File

@ -571,6 +571,7 @@ MainWindow::MainWindow(Application* app, SystemTrayIcon* tray_icon, OSD* osd,
connect(app_->player(), SIGNAL(Paused()), osd_, SLOT(Paused()));
connect(app_->player(), SIGNAL(Stopped()), osd_, SLOT(Stopped()));
connect(app_->player(), SIGNAL(Playing()), osd_, SLOT(ResumedPlayback()));
connect(app_->player(), SIGNAL(PlaylistFinished()), osd_,
SLOT(PlaylistFinished()));
connect(app_->player(), SIGNAL(VolumeChanged(int)), osd_,

View File

@ -50,6 +50,7 @@ OSD::OSD(SystemTrayIcon* tray_icon, Application* app, QObject* parent)
preview_mode_(false),
force_show_next_(false),
ignore_next_stopped_(false),
is_player_paused_(false),
pretty_popup_(new OSDPretty(OSDPretty::Mode_Popup)) {
connect(app_->current_art_loader(),
SIGNAL(ThumbnailLoaded(Song, QString, QImage)),
@ -152,8 +153,18 @@ void OSD::AlbumArtLoaded(const Song& song, const QString& uri,
}
}
void OSD::ResumedPlayback() {
if (show_on_pause_) {
if (is_player_paused_) {
ReshowCurrentSong();
}
is_player_paused_ = false;
}
}
void OSD::Paused() {
if (show_on_pause_) {
is_player_paused_ = true;
ShowMessage(QCoreApplication::applicationName(), tr("Paused"));
}
}

View File

@ -72,6 +72,7 @@ class OSD : public QObject {
void Paused();
void Stopped();
void ResumedPlayback();
void StopAfterToggle(bool stop);
void PlaylistFinished();
void VolumeChanged(int value);
@ -126,6 +127,7 @@ class OSD : public QObject {
bool force_show_next_;
bool ignore_next_stopped_;
bool is_player_paused_;
OSDPretty* pretty_popup_;