overlays: add optional sound to trophy popup

This commit is contained in:
Megamouse 2021-10-29 22:04:49 +02:00
parent f262e77fbd
commit 0e20acdf55
5 changed files with 22 additions and 0 deletions

View file

@ -39,6 +39,7 @@
#include <QLibraryInfo>
#include <QDirIterator>
#include <QFileInfo>
#include <QSound>
#include <clocale>
@ -412,6 +413,17 @@ void gui_application::InitializeCallbacks()
return localized_emu::get_u32string(id, args);
};
callbacks.play_sound = [](const std::string& path)
{
Emu.CallAfter([path]()
{
if (fs::is_file(path))
{
QSound::play(qstr(path));
}
});
};
callbacks.resolve_path = [](std::string_view sv)
{
return QFileInfo(QString::fromUtf8(sv.data(), static_cast<int>(sv.size()))).canonicalFilePath().toStdString();