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(Paused()), osd_, SLOT(Paused()));
|
||||||
connect(player_, SIGNAL(Stopped()), osd_, SLOT(Stopped()));
|
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(playlist_, SIGNAL(CurrentSongChanged(Song)), osd_, SLOT(SongChanged(Song)));
|
||||||
|
|
||||||
connect(ui_.playlist, SIGNAL(doubleClicked(QModelIndex)), SLOT(PlayIndex(QModelIndex)));
|
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) {
|
void OSD::SongChanged(const Song &song) {
|
||||||
QString summary(song.PrettyTitleWithArtist());
|
QString summary(song.PrettyTitle());
|
||||||
QStringList message_parts;
|
if (!song.artist().isNull())
|
||||||
|
summary = QString("%1 - %2").arg(song.artist(), summary);
|
||||||
|
|
||||||
|
QStringList message_parts;
|
||||||
if (!song.album().isEmpty())
|
if (!song.album().isEmpty())
|
||||||
message_parts << song.album();
|
message_parts << song.album();
|
||||||
if (song.disc() > 0)
|
if (song.disc() > 0)
|
||||||
@ -31,3 +33,7 @@ void OSD::Paused() {
|
|||||||
void OSD::Stopped() {
|
void OSD::Stopped() {
|
||||||
ShowMessage(QCoreApplication::applicationName(), "Playlist finished");
|
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 SongChanged(const Song& song);
|
||||||
void Paused();
|
void Paused();
|
||||||
void Stopped();
|
void Stopped();
|
||||||
|
void VolumeChanged(int value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QSystemTrayIcon* tray_icon_;
|
QSystemTrayIcon* tray_icon_;
|
||||||
|
@ -103,6 +103,7 @@ void Player::EngineStateChanged(Engine::State state) {
|
|||||||
void Player::SetVolume(int value) {
|
void Player::SetVolume(int value) {
|
||||||
settings_.setValue("volume", value);
|
settings_.setValue("volume", value);
|
||||||
engine_->setVolume(value);
|
engine_->setVolume(value);
|
||||||
|
emit VolumeChanged(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Player::GetVolume() const {
|
int Player::GetVolume() const {
|
||||||
|
@ -35,6 +35,7 @@ class Player : public QObject {
|
|||||||
void Playing();
|
void Playing();
|
||||||
void Paused();
|
void Paused();
|
||||||
void Stopped();
|
void Stopped();
|
||||||
|
void VolumeChanged(int volume);
|
||||||
void Error(const QString& message);
|
void Error(const QString& message);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -250,7 +250,7 @@ QString Song::PrettyTitleWithArtist() const {
|
|||||||
if (title.isEmpty())
|
if (title.isEmpty())
|
||||||
title = QFileInfo(filename_).baseName();
|
title = QFileInfo(filename_).baseName();
|
||||||
|
|
||||||
if (!compilation_ && !artist_.isEmpty())
|
if (compilation_ && !artist_.isEmpty())
|
||||||
title = artist_ + " - " + title;
|
title = artist_ + " - " + title;
|
||||||
|
|
||||||
return title;
|
return title;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user