mirror of
https://github.com/clementine-player/Clementine
synced 2025-01-31 03:27:40 +01:00
Volume OSD
This commit is contained in:
parent
62794cdf70
commit
8095e3ce1e
@ -113,6 +113,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
|
||||
connect(player_, SIGNAL(Paused()), osd_, SLOT(Paused()));
|
||||
connect(player_, SIGNAL(Stopped()), osd_, SLOT(Stopped()));
|
||||
connect(player_, SIGNAL(VolumeChanged(int)), osd_, SLOT(VolumeChanged(int)));
|
||||
connect(playlist_, SIGNAL(CurrentSongChanged(Song)), osd_, SLOT(SongChanged(Song)));
|
||||
|
||||
connect(ui_.playlist, SIGNAL(doubleClicked(QModelIndex)), SLOT(PlayIndex(QModelIndex)));
|
||||
|
10
src/osd.cpp
10
src/osd.cpp
@ -11,9 +11,11 @@ OSD::OSD(QSystemTrayIcon* tray_icon, QObject* parent)
|
||||
}
|
||||
|
||||
void OSD::SongChanged(const Song &song) {
|
||||
QString summary(song.PrettyTitleWithArtist());
|
||||
QStringList message_parts;
|
||||
QString summary(song.PrettyTitle());
|
||||
if (!song.artist().isNull())
|
||||
summary = QString("%1 - %2").arg(song.artist(), summary);
|
||||
|
||||
QStringList message_parts;
|
||||
if (!song.album().isEmpty())
|
||||
message_parts << song.album();
|
||||
if (song.disc() > 0)
|
||||
@ -31,3 +33,7 @@ void OSD::Paused() {
|
||||
void OSD::Stopped() {
|
||||
ShowMessage(QCoreApplication::applicationName(), "Playlist finished");
|
||||
}
|
||||
|
||||
void OSD::VolumeChanged(int value) {
|
||||
ShowMessage(QCoreApplication::applicationName(), QString("Volume %1%").arg(value));
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ class OSD : public QObject {
|
||||
void SongChanged(const Song& song);
|
||||
void Paused();
|
||||
void Stopped();
|
||||
void VolumeChanged(int value);
|
||||
|
||||
private:
|
||||
QSystemTrayIcon* tray_icon_;
|
||||
|
@ -103,6 +103,7 @@ void Player::EngineStateChanged(Engine::State state) {
|
||||
void Player::SetVolume(int value) {
|
||||
settings_.setValue("volume", value);
|
||||
engine_->setVolume(value);
|
||||
emit VolumeChanged(value);
|
||||
}
|
||||
|
||||
int Player::GetVolume() const {
|
||||
|
@ -35,6 +35,7 @@ class Player : public QObject {
|
||||
void Playing();
|
||||
void Paused();
|
||||
void Stopped();
|
||||
void VolumeChanged(int volume);
|
||||
void Error(const QString& message);
|
||||
|
||||
private slots:
|
||||
|
@ -250,7 +250,7 @@ QString Song::PrettyTitleWithArtist() const {
|
||||
if (title.isEmpty())
|
||||
title = QFileInfo(filename_).baseName();
|
||||
|
||||
if (!compilation_ && !artist_.isEmpty())
|
||||
if (compilation_ && !artist_.isEmpty())
|
||||
title = artist_ + " - " + title;
|
||||
|
||||
return title;
|
||||
|
Loading…
x
Reference in New Issue
Block a user