diff --git a/libukui-notification/popup-notification.cpp b/libukui-notification/popup-notification.cpp index 293b47c..1e02f14 100644 --- a/libukui-notification/popup-notification.cpp +++ b/libukui-notification/popup-notification.cpp @@ -50,6 +50,7 @@ public: bool m_resident = false; bool m_transient = false; QString m_soundFile; + QString m_soundName; bool m_suppressSound = false; QString m_display; QStringList m_actionState; @@ -317,8 +318,9 @@ void PopupNotification::setHints(const QVariantMap &hints) d->loadImageFromPath(it->toString()); } } - //暂不支持声音主题 + d->m_soundFile = hints.value(QStringLiteral("sound-file")).toString(); + d->m_soundName = hints.value(QStringLiteral("sound-name")).toString(); d->m_suppressSound = hints.value(QStringLiteral("suppress-sound")).toBool(); d->m_display = hints.value(QStringLiteral("x-ukui-display")).toString(); d->m_actionState = hints.value(QStringLiteral("x-ukui-action-state")).toStringList(); @@ -379,6 +381,10 @@ QString PopupNotification::soundFile() const { return d->m_soundFile; } +QString PopupNotification::soundName() const +{ + return d->m_soundName; +} bool PopupNotification::suppressSound() const { diff --git a/libukui-notification/popup-notification.h b/libukui-notification/popup-notification.h index e01f20d..de21d2a 100644 --- a/libukui-notification/popup-notification.h +++ b/libukui-notification/popup-notification.h @@ -51,6 +51,7 @@ class UKUINOTIFICATION_EXPORT PopupNotification Q_PROPERTY(bool resident READ resident) Q_PROPERTY(bool transient READ transient) Q_PROPERTY(QString soundFile READ soundFile) + Q_PROPERTY(QString soundName READ soundName) Q_PROPERTY(bool suppressSound READ suppressSound) Q_PROPERTY(QString category READ category) Q_PROPERTY(Urgency urgency READ urgency WRITE setUrgency) @@ -134,10 +135,15 @@ public: */ bool resident() const; /** - * 声音 + * 通知发送时播放的声音文件路径 * @return */ QString soundFile() const; + /** + * 声音主题中的声音名称 + * @return + */ + QString soundName() const; /** * 是否静音 * @return