mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-14 05:07:10 +02:00
Allow getting name or path for sound.
This commit is contained in:
parent
2e74ad6fbe
commit
2b94cffe7e
3 changed files with 8 additions and 2 deletions
|
@ -333,7 +333,7 @@ LocalDiskCache::LocalDiskCache(const QString &folder)
|
|||
QDir().mkpath(_base);
|
||||
}
|
||||
|
||||
QString LocalDiskCache::path(const LocalSound &sound) {
|
||||
QString LocalDiskCache::name(const LocalSound &sound) {
|
||||
if (!sound) {
|
||||
return {};
|
||||
}
|
||||
|
@ -357,4 +357,9 @@ QString LocalDiskCache::path(const LocalSound &sound) {
|
|||
return result;
|
||||
}
|
||||
|
||||
QString LocalDiskCache::path(const LocalSound &sound) {
|
||||
const auto part = name(sound);
|
||||
return part.isEmpty() ? QString() : _base + part + u".wav"_q;
|
||||
}
|
||||
|
||||
} // namespace Media::Audio
|
||||
|
|
|
@ -34,6 +34,7 @@ class LocalDiskCache final {
|
|||
public:
|
||||
explicit LocalDiskCache(const QString &folder);
|
||||
|
||||
[[nodiscard]] QString name(const LocalSound &sound);
|
||||
[[nodiscard]] QString path(const LocalSound &sound);
|
||||
|
||||
private:
|
||||
|
|
|
@ -338,7 +338,7 @@ void Manager::Private::showNotification(
|
|||
|
||||
const auto sound = info.sound ? info.sound() : Media::Audio::LocalSound();
|
||||
if (sound) {
|
||||
[notification setSoundName:Q2NSString(_sounds.path(sound))];
|
||||
[notification setSoundName:Q2NSString(_sounds.name(sound))];
|
||||
} else {
|
||||
[notification setSoundName:nil];
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue