mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +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);
|
QDir().mkpath(_base);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString LocalDiskCache::path(const LocalSound &sound) {
|
QString LocalDiskCache::name(const LocalSound &sound) {
|
||||||
if (!sound) {
|
if (!sound) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
@ -357,4 +357,9 @@ QString LocalDiskCache::path(const LocalSound &sound) {
|
||||||
return result;
|
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
|
} // namespace Media::Audio
|
||||||
|
|
|
@ -34,6 +34,7 @@ class LocalDiskCache final {
|
||||||
public:
|
public:
|
||||||
explicit LocalDiskCache(const QString &folder);
|
explicit LocalDiskCache(const QString &folder);
|
||||||
|
|
||||||
|
[[nodiscard]] QString name(const LocalSound &sound);
|
||||||
[[nodiscard]] QString path(const LocalSound &sound);
|
[[nodiscard]] QString path(const LocalSound &sound);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -338,7 +338,7 @@ void Manager::Private::showNotification(
|
||||||
|
|
||||||
const auto sound = info.sound ? info.sound() : Media::Audio::LocalSound();
|
const auto sound = info.sound ? info.sound() : Media::Audio::LocalSound();
|
||||||
if (sound) {
|
if (sound) {
|
||||||
[notification setSoundName:Q2NSString(_sounds.path(sound))];
|
[notification setSoundName:Q2NSString(_sounds.name(sound))];
|
||||||
} else {
|
} else {
|
||||||
[notification setSoundName:nil];
|
[notification setSoundName:nil];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue