Remove '&' in OSD messages

Causes weird problems with previous text getting stuck.
This commit is contained in:
Jonas Kvinge
2020-10-01 19:39:49 +02:00
parent 0f284f2e1d
commit c71ccda967
3 changed files with 11 additions and 3 deletions

View File

@@ -146,11 +146,14 @@ void OSDBase::ShowPlaying(const Song &song, const QUrl &cover_url, const QImage
message_parts << tr("track %1").arg(song.track()); message_parts << tr("track %1").arg(song.track());
} }
summary = summary.remove('&').simplified();
QString message = message_parts.join(", ").remove('&').simplified();
if (show_art_) { if (show_art_) {
ShowMessage(summary, message_parts.join(", "), "notification-audio-play", image); ShowMessage(summary, message, "notification-audio-play", image);
} }
else { else {
ShowMessage(summary, message_parts.join(", "), "notification-audio-play", QImage()); ShowMessage(summary, message, "notification-audio-play", QImage());
} }
// Reload the saved settings if they were changed for preview // Reload the saved settings if they were changed for preview
@@ -179,6 +182,7 @@ void OSDBase::Paused() {
summary.prepend(last_song_.artist()); summary.prepend(last_song_.artist());
} }
} }
summary = summary.remove('&').simplified();
if (show_art_) { if (show_art_) {
ShowMessage(summary, tr("Paused"), QString(), last_image_); ShowMessage(summary, tr("Paused"), QString(), last_image_);
} }
@@ -222,6 +226,8 @@ void OSDBase::Stopped() {
} }
} }
summary = summary.remove('&').simplified();
if (show_art_) { if (show_art_) {
ShowMessage(summary, tr("Stopped"), QString(), last_image_); ShowMessage(summary, tr("Stopped"), QString(), last_image_);
} }

View File

@@ -63,6 +63,8 @@ class OSDBase : public QObject {
virtual bool SupportsNativeNotifications(); virtual bool SupportsNativeNotifications();
virtual bool SupportsTrayPopups(); virtual bool SupportsTrayPopups();
QString app_name() { return app_name_; }
public slots: public slots:
void ReloadSettings(); void ReloadSettings();

View File

@@ -146,7 +146,7 @@ void OSDDBus::ShowMessageNative(const QString &summary, const QString &message,
id = notification_id_; id = notification_id_;
} }
QDBusPendingReply<uint> reply = interface_->Notify(QCoreApplication::applicationName(), id, icon, summary, message, QStringList(), hints, timeout_msec()); QDBusPendingReply<uint> reply = interface_->Notify(app_name(), id, icon, summary, message, QStringList(), hints, timeout_msec());
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this); QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this);
connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), SLOT(CallFinished(QDBusPendingCallWatcher*))); connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), SLOT(CallFinished(QDBusPendingCallWatcher*)));