Look for themes in different locations on Mac/Unix
Not tested yet - since I'm coding this currently on Windows
This commit is contained in:
parent
a089cc1751
commit
6534312968
@ -25,18 +25,39 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QDirIterator>
|
#include <QDirIterator>
|
||||||
|
#include <QRegularExpression>
|
||||||
#include <QResource>
|
#include <QResource>
|
||||||
|
|
||||||
ThemeManager *ThemeManager::instance_{nullptr};
|
ThemeManager *ThemeManager::instance_{nullptr};
|
||||||
|
|
||||||
ThemeManager::ThemeManager()
|
ThemeManager::ThemeManager()
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN32
|
|
||||||
themeDir_ = QCoreApplication::applicationDirPath() + "/themes/";
|
themeDir_ = QCoreApplication::applicationDirPath() + "/themes/";
|
||||||
#elif Q_OS_MAC
|
#if defined(Q_OS_MAC)
|
||||||
// TODO
|
/*
|
||||||
#else
|
* Executable and Theme directory location inside app bundle -
|
||||||
// TODO
|
* 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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user