From d83a420f0517d7fc47aeb288a6a0cf4891784fcc Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Mon, 22 Jun 2026 12:03:44 +0200 Subject: New upstream version 3.0.2+dfsg --- qt_helpers.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'qt_helpers.cpp') diff --git a/qt_helpers.cpp b/qt_helpers.cpp index dd474e19..5e4b233a 100644 --- a/qt_helpers.cpp +++ b/qt_helpers.cpp @@ -6,6 +6,8 @@ #include #include #include +#include +#include QString font_as_stylesheet (QFont const& font) { @@ -48,3 +50,21 @@ QDateTime qt_truncate_date_time_to (QDateTime dt, int milliseconds) dt.setMSecsSinceEpoch (dt.toMSecsSinceEpoch () / milliseconds * milliseconds); return dt; } + +QString app_sounds_directory (QString const& subdirectory) +{ +#if defined (__APPLE__) + QString root {QCoreApplication::applicationDirPath () + "/../Resources/sounds"}; +#else + QString root {QCoreApplication::applicationDirPath () + "/sounds"}; +#endif + auto child = subdirectory; + while (child.startsWith (QChar {'/'})) + { + child.remove (0, 1); + } + + QDir dir {root}; + auto path = child.isEmpty () ? dir.absolutePath () : dir.absoluteFilePath (child); + return QDir::cleanPath (path) + QChar {'/'}; +} -- cgit v1.2.3