From 6534312968fa0779e0dd4e102a60821739c47a34 Mon Sep 17 00:00:00 2001 From: Srivats P Date: Sun, 30 Jan 2022 12:15:17 +0530 Subject: [PATCH] Look for themes in different locations on Mac/Unix Not tested yet - since I'm coding this currently on Windows --- client/thememanager.cpp | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/client/thememanager.cpp b/client/thememanager.cpp index 234d44d..00696a3 100644 --- a/client/thememanager.cpp +++ b/client/thememanager.cpp @@ -25,18 +25,39 @@ along with this program. If not, see #include #include #include +#include #include ThemeManager *ThemeManager::instance_{nullptr}; ThemeManager::ThemeManager() { -#ifdef Q_OS_WIN32 themeDir_ = QCoreApplication::applicationDirPath() + "/themes/"; -#elif Q_OS_MAC - // TODO -#else - // TODO +#if defined(Q_OS_MAC) + /* + * Executable and Theme directory location inside app bundle - + * Ostinato.app/Contents/MacOS/ + * Ostinato.app/Contents/SharedSupport/themes/ + */ + themeDir_.replace("/MacOS/", "/SharedSupport/"); +#elif defined(Q_OS_UNIX) + /* + * Possible (but not comprehensive) locations for Ostinato executable + * and theme directory locations + * + * non-install-dir/ + * non-install-dir/themes/ + * + * /usr/[local]/bin/ + * /usr/[local]/share/ostinato/themes/ + * + * /opt/ostinato/bin/ + * /opt/ostinato/share/themes/ + */ + if (themeDir_.contains(QRegularExpression("^/usr/.*/bin/"))) + themeDir_.replace("/bin/", "/share/ostinato/"); + else if (themeDir_.contains(QRegularExpression("^/opt/.*/bin/"))) + themeDir_.replace("/bin/", "/share/"); #endif }