Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/ui/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_,
Expand Down
11 changes: 11 additions & 0 deletions src/widgets/osd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down Expand Up @@ -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"));
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/widgets/osd.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class OSD : public QObject {

void Paused();
void Stopped();
void ResumedPlayback();
void StopAfterToggle(bool stop);
void PlaylistFinished();
void VolumeChanged(int value);
Expand Down Expand Up @@ -126,6 +127,7 @@ class OSD : public QObject {

bool force_show_next_;
bool ignore_next_stopped_;
bool is_player_paused_;

OSDPretty* pretty_popup_;

Expand Down