Add an option to turn off album art in the OSD

This commit is contained in:
David Sansome 2010-02-28 01:08:18 +00:00
parent 6436c53705
commit 4d8636874e
4 changed files with 15 additions and 2 deletions

View File

@ -11,7 +11,8 @@ OSD::OSD(QSystemTrayIcon* tray_icon, QObject* parent)
tray_icon_(tray_icon),
timeout_(5000),
behaviour_(Native),
show_on_volume_change_(false)
show_on_volume_change_(false),
show_art_(true)
{
ReloadSettings();
Init();
@ -23,6 +24,7 @@ void OSD::ReloadSettings() {
behaviour_ = OSD::Behaviour(s.value("Behaviour", Native).toInt());
timeout_ = s.value("Timeout", 5000).toInt();
show_on_volume_change_ = s.value("ShowOnVolumeChange", false).toBool();
show_art_ = s.value("ShowArt", true).toBool();
if (!SupportsNativeNotifications() && behaviour_ == Native)
behaviour_ = TrayPopup;
@ -44,7 +46,8 @@ void OSD::SongChanged(const Song &song) {
if (song.track() > 0)
message_parts << QString("track %1").arg(song.track());
ShowMessage(summary, message_parts.join(", "), "notification-audio-play", song.GetBestImage());
ShowMessage(summary, message_parts.join(", "), "notification-audio-play",
show_art_ ? song.GetBestImage() : QImage());
}
void OSD::Paused() {

View File

@ -61,6 +61,7 @@ class OSD : public QObject {
int timeout_;
Behaviour behaviour_;
bool show_on_volume_change_;
bool show_art_;
#ifdef Q_WS_X11
NotifyNotification* notification_;

View File

@ -69,6 +69,7 @@ void SettingsDialog::accept() {
s.setValue("Behaviour", int(osd_behaviour));
s.setValue("Timeout", ui_.notifications_duration->value() * 1000);
s.setValue("ShowOnVolumeChange", ui_.notifications_volume->isChecked());
s.setValue("ShowArt", ui_.notifications_art->isChecked());
s.endGroup();
QDialog::accept();
@ -114,6 +115,7 @@ void SettingsDialog::showEvent(QShowEvent*) {
}
ui_.notifications_duration->setValue(s.value("Timeout", 5000).toInt() / 1000);
ui_.notifications_volume->setChecked(s.value("ShowOnVolumeChange", false).toBool());
ui_.notifications_art->setChecked(s.value("ShowArt", true).toBool());
s.endGroup();
}

View File

@ -280,6 +280,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="notifications_art">
<property name="text">
<string>Include album art in the notification</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">