mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-07 03:30:44 +00:00
Fix resource paths on MacOS
This commit is contained in:
parent
caefe700ff
commit
b3b354d00d
@ -9,6 +9,8 @@
|
||||
#include <QGLWidget>
|
||||
#include <QOpenGLFunctions>
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QCoreApplication>
|
||||
|
||||
#include "SleepLib/common.h"
|
||||
#include "common_gui.h"
|
||||
@ -86,6 +88,16 @@ QString getBranchVersion()
|
||||
return version;
|
||||
}
|
||||
|
||||
QString appResourcePath()
|
||||
{
|
||||
#ifdef Q_OS_MAC
|
||||
QString path = QDir::cleanPath(QCoreApplication::applicationDirPath() + "/../Resources");
|
||||
#else
|
||||
// not sure where it goes on Linux yet
|
||||
QString path = QCoreApplication::applicationDirPath();
|
||||
#endif
|
||||
return path;
|
||||
}
|
||||
|
||||
Qt::DayOfWeek firstDayOfWeekFromLocale()
|
||||
{
|
||||
|
@ -18,6 +18,7 @@ Qt::DayOfWeek firstDayOfWeekFromLocale();
|
||||
|
||||
QString getBranchVersion();
|
||||
|
||||
QString appResourcePath();
|
||||
|
||||
const QString CSTR_GFX_ANGLE = "ANGLE";
|
||||
const QString CSTR_GFX_OpenGL = "OpenGL";
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include <QDebug>
|
||||
#include <QTimer>
|
||||
|
||||
#include "common_gui.h"
|
||||
#include "help.h"
|
||||
#include "ui_help.h"
|
||||
|
||||
@ -22,11 +23,9 @@ Help::Help(QWidget *parent) :
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
helpEngine = new QHelpEngine(QCoreApplication::applicationDirPath() + "/Help/help.qhc", this);
|
||||
helpEngine = new QHelpEngine(appResourcePath() + "/Help/help.qhc", this);
|
||||
helpEngine->setupData();
|
||||
|
||||
// QString helpFile = QCoreApplication::applicationDirPath() + "/Help/help_en.qch";
|
||||
|
||||
/*if (!helpEngine->registeredDocumentations().contains(helpFile)) {
|
||||
if (helpEngine->registerDocumentation(helpFile)) {
|
||||
qDebug() << "Registered" << helpFile;
|
||||
|
@ -321,14 +321,15 @@ win32 {
|
||||
|
||||
}
|
||||
|
||||
mac {
|
||||
macx {
|
||||
TransFiles.files = $$files(../Translations/*.qm)
|
||||
TransFiles.path = Contents/Resources/Translations
|
||||
HelpFiles.files = $$files(../Help/*.qch)
|
||||
HelpFiles.files += $$files(../Help/help.qhc)
|
||||
HelpFiles.files = $$files(help/*.qch)
|
||||
HelpFiles.files += $$files(help/help.qhc)
|
||||
HelpFiles.path = Contents/Resources/Help
|
||||
QMAKE_BUNDLE_DATA += TransFiles
|
||||
QMAKE_BUNDLE_DATA += HelpFiles
|
||||
message("Setting up Translations & Help Transfers")
|
||||
}
|
||||
|
||||
#include(../3rdparty/quazip/quazip/quazip.pri)
|
||||
|
@ -20,9 +20,11 @@
|
||||
#include <QTranslator>
|
||||
#include <QListWidget>
|
||||
|
||||
#ifndef nullptr
|
||||
#define nullptr NULL
|
||||
#endif
|
||||
#include "common_gui.h"
|
||||
|
||||
//#ifndef nullptr
|
||||
//#define nullptr NULL
|
||||
//#endif
|
||||
|
||||
#include "translation.h"
|
||||
|
||||
@ -42,11 +44,7 @@ void initTranslations(QSettings & settings) {
|
||||
|
||||
QHash<QString, QString> langFiles;
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
QString transdir = QDir::cleanPath(QCoreApplication::applicationDirPath() + "/../Resources/Translations/");
|
||||
#else
|
||||
const QString transdir = QCoreApplication::applicationDirPath() + "/Translations/";
|
||||
#endif
|
||||
const QString transdir = appResourcePath() +"/Translations";
|
||||
|
||||
QDir dir(transdir);
|
||||
qDebug() << "Scanning" << transdir.toLocal8Bit().data();
|
||||
|
Loading…
Reference in New Issue
Block a user