From eb41dea464c2575cce19ca4e3444f128de2ed524 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bara?= Date: Tue, 23 Nov 2010 19:38:15 +0000 Subject: [PATCH] the title and artist of the currently playing song are now the title of Clementine's window (Fixes issue #779) better unmute behavior if Clementine was muted before it was closed (Fixes issue #983) --- src/core/player.cpp | 2 +- src/ui/mainwindow.cpp | 7 +++++++ src/ui/mainwindow.h | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/core/player.cpp b/src/core/player.cpp index 33f7157ca..50bd9dce9 100644 --- a/src/core/player.cpp +++ b/src/core/player.cpp @@ -85,7 +85,7 @@ Player::Player(MainWindow* main_window, PlaylistManager* playlists, stream_change_type_(Engine::First), rain_stream_(-1), toad_stream_(-1), - volume_before_mute_(0) + volume_before_mute_(50) { #ifdef Q_WS_X11 // MPRIS DBus interface. diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index cfe4c6af2..dea9ff88b 100644 --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -357,6 +357,7 @@ MainWindow::MainWindow(Engine::Type engine, QWidget *parent) connect(player_, SIGNAL(VolumeChanged(int)), osd_, SLOT(VolumeChanged(int))); connect(player_, SIGNAL(VolumeChanged(int)), ui_->volume, SLOT(setValue(int))); connect(player_, SIGNAL(ForceShowOSD(Song)), SLOT(ForceShowOSD(Song))); + connect(playlists_, SIGNAL(CurrentSongChanged(Song)), SLOT(SongChanged(Song))); connect(playlists_, SIGNAL(CurrentSongChanged(Song)), osd_, SLOT(SongChanged(Song))); connect(playlists_, SIGNAL(CurrentSongChanged(Song)), player_, SLOT(CurrentMetadataChanged(Song))); connect(playlists_, SIGNAL(PlaylistChanged()), player_, SLOT(PlaylistChanged())); @@ -715,6 +716,8 @@ void MainWindow::AddDeviceSongsToPlaylist(bool clear_first, const SongList &song } void MainWindow::MediaStopped() { + setWindowTitle(QCoreApplication::applicationName()); + ui_->action_stop->setEnabled(false); ui_->action_stop_after_this_track->setEnabled(false); ui_->action_play_pause->setIcon(IconLoader::Load("media-playback-start")); @@ -771,6 +774,10 @@ void MainWindow::VolumeChanged(int volume) { ui_->action_mute->setChecked(!volume); } +void MainWindow::SongChanged(const Song& song) { + setWindowTitle(song.PrettyTitleWithArtist()); +} + void MainWindow::TrackSkipped(PlaylistItemPtr item) { // If it was a library item then we have to increment its skipped count in // the database. diff --git a/src/ui/mainwindow.h b/src/ui/mainwindow.h index dc1e8e1b0..07c8de2b3 100644 --- a/src/ui/mainwindow.h +++ b/src/ui/mainwindow.h @@ -130,6 +130,7 @@ class MainWindow : public QMainWindow, public PlatformInterface { void PlayIndex(const QModelIndex& index); void StopAfterCurrent(); + void SongChanged(const Song& song); void VolumeChanged(int volume); void LoadLibraryItemToPlaylist(const QModelIndexList& indexes);