mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 06:18:52 +02:00
Fixing compiled resource access
This commit is contained in:
parent
2c35242af1
commit
97593bc4d8
15 changed files with 74 additions and 40 deletions
6
.gitignore
vendored
6
.gitignore
vendored
|
@ -77,6 +77,12 @@ TAGS
|
||||||
# ignore node files for the console
|
# ignore node files for the console
|
||||||
node_modules
|
node_modules
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
|
|
||||||
|
# Android studio files
|
||||||
*___jb_old___
|
*___jb_old___
|
||||||
|
|
||||||
|
# Generated assets for Android
|
||||||
android/app/src/main/assets
|
android/app/src/main/assets
|
||||||
|
|
||||||
|
# Resource binary file
|
||||||
|
interface/compiledResources
|
|
@ -12,7 +12,7 @@ function(JOIN VALUES GLUE OUTPUT)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
set(RESOURCES_QRC ${CMAKE_CURRENT_BINARY_DIR}/resources.qrc)
|
set(RESOURCES_QRC ${CMAKE_CURRENT_BINARY_DIR}/resources.qrc)
|
||||||
set(RESOURCES_RCC ${CMAKE_CURRENT_BINARY_DIR}/resources.rcc)
|
set(RESOURCES_RCC ${CMAKE_CURRENT_SOURCE_DIR}/compiledResources/resources.rcc)
|
||||||
generate_qrc(OUTPUT ${RESOURCES_QRC} PATH ${CMAKE_CURRENT_SOURCE_DIR}/resources GLOBS *)
|
generate_qrc(OUTPUT ${RESOURCES_QRC} PATH ${CMAKE_CURRENT_SOURCE_DIR}/resources GLOBS *)
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
|
|
|
@ -808,10 +808,13 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
|
|
||||||
{
|
{
|
||||||
#if defined(Q_OS_ANDROID)
|
#if defined(Q_OS_ANDROID)
|
||||||
const QString resourcesBinaryFile = "assets:resources.rcc";
|
const QString resourcesBinaryFile = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/resources.rcc";
|
||||||
#else
|
#else
|
||||||
const QString resourcesBinaryFile = QFileInfo(argv[0]).absolutePath() + "/resources.rcc";
|
const QString resourcesBinaryFile = applicationDirPath() + "/resources.rcc";
|
||||||
#endif
|
#endif
|
||||||
|
if (!QFile::exists(resourcesBinaryFile)) {
|
||||||
|
throw std::runtime_error("Unable to find primary resources");
|
||||||
|
}
|
||||||
if (!QResource::registerResource(resourcesBinaryFile)) {
|
if (!QResource::registerResource(resourcesBinaryFile)) {
|
||||||
throw std::runtime_error("Unable to load primary resources");
|
throw std::runtime_error("Unable to load primary resources");
|
||||||
}
|
}
|
||||||
|
@ -1037,8 +1040,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
DependencyManager::get<AddressManager>().data(), &AddressManager::storeCurrentAddress);
|
DependencyManager::get<AddressManager>().data(), &AddressManager::storeCurrentAddress);
|
||||||
|
|
||||||
// Inititalize sample before registering
|
// Inititalize sample before registering
|
||||||
QFileInfo infSample = QFileInfo(PathUtils::resourcesPath() + "sounds/sample.wav");
|
_sampleSound = DependencyManager::get<SoundCache>()->getSound(QUrl(PathUtils::resourcesUrl() + "sounds/sample.wav"));
|
||||||
_sampleSound = DependencyManager::get<SoundCache>()->getSound(QUrl::fromLocalFile(infSample.absoluteFilePath()));
|
|
||||||
|
|
||||||
auto scriptEngines = DependencyManager::get<ScriptEngines>().data();
|
auto scriptEngines = DependencyManager::get<ScriptEngines>().data();
|
||||||
scriptEngines->registerScriptInitializer([this](ScriptEnginePointer engine){
|
scriptEngines->registerScriptInitializer([this](ScriptEnginePointer engine){
|
||||||
|
@ -1823,8 +1825,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
return entityServerNode && !isPhysicsEnabled();
|
return entityServerNode && !isPhysicsEnabled();
|
||||||
});
|
});
|
||||||
|
|
||||||
QFileInfo infSnap = QFileInfo(PathUtils::resourcesPath() + "sounds/snap.wav");
|
_snapshotSound = DependencyManager::get<SoundCache>()->getSound(QUrl(PathUtils::resourcesUrl() + "sounds/snap.wav"));
|
||||||
_snapshotSound = DependencyManager::get<SoundCache>()->getSound(QUrl::fromLocalFile(infSnap.absoluteFilePath()));
|
|
||||||
|
|
||||||
QVariant testProperty = property(hifi::properties::TEST);
|
QVariant testProperty = property(hifi::properties::TEST);
|
||||||
qDebug() << testProperty;
|
qDebug() << testProperty;
|
||||||
|
@ -2356,7 +2357,7 @@ void Application::initializeUi() {
|
||||||
offscreenUi->setProxyWindow(_window->windowHandle());
|
offscreenUi->setProxyWindow(_window->windowHandle());
|
||||||
// OffscreenUi is a subclass of OffscreenQmlSurface specifically designed to
|
// OffscreenUi is a subclass of OffscreenQmlSurface specifically designed to
|
||||||
// support the window management and scripting proxies for VR use
|
// support the window management and scripting proxies for VR use
|
||||||
offscreenUi->createDesktop(PathUtils::qmlBasePath() + "hifi/Desktop.qml");
|
offscreenUi->createDesktop(PathUtils::qmlBaseUrl("hifi/Desktop.qml"));
|
||||||
// FIXME either expose so that dialogs can set this themselves or
|
// FIXME either expose so that dialogs can set this themselves or
|
||||||
// do better detection in the offscreen UI of what has focus
|
// do better detection in the offscreen UI of what has focus
|
||||||
offscreenUi->setNavigationFocused(false);
|
offscreenUi->setNavigationFocused(false);
|
||||||
|
|
|
@ -1801,7 +1801,7 @@ void MyAvatar::initAnimGraph() {
|
||||||
} else if (!_fstAnimGraphOverrideUrl.isEmpty()) {
|
} else if (!_fstAnimGraphOverrideUrl.isEmpty()) {
|
||||||
graphUrl = _fstAnimGraphOverrideUrl;
|
graphUrl = _fstAnimGraphOverrideUrl;
|
||||||
} else {
|
} else {
|
||||||
graphUrl = QUrl::fromLocalFile(PathUtils::resourcesPath() + "avatar/avatar-animation.json");
|
graphUrl = QUrl(PathUtils::resourcesUrl() + "avatar/avatar-animation.json");
|
||||||
}
|
}
|
||||||
|
|
||||||
_skeletonModel->getRig().initAnimGraph(graphUrl);
|
_skeletonModel->getRig().initAnimGraph(graphUrl);
|
||||||
|
|
|
@ -103,7 +103,7 @@ AvatarData::~AvatarData() {
|
||||||
QUrl AvatarData::_defaultFullAvatarModelUrl = {}; // In C++, if this initialization were in the AvatarInfo, every file would have it's own copy, even for class vars.
|
QUrl AvatarData::_defaultFullAvatarModelUrl = {}; // In C++, if this initialization were in the AvatarInfo, every file would have it's own copy, even for class vars.
|
||||||
const QUrl& AvatarData::defaultFullAvatarModelUrl() {
|
const QUrl& AvatarData::defaultFullAvatarModelUrl() {
|
||||||
if (_defaultFullAvatarModelUrl.isEmpty()) {
|
if (_defaultFullAvatarModelUrl.isEmpty()) {
|
||||||
_defaultFullAvatarModelUrl = QUrl::fromLocalFile(PathUtils::resourcesPath() + "/meshes/defaultAvatar_full.fst");
|
_defaultFullAvatarModelUrl = QUrl(PathUtils::resourcesUrl() + "/meshes/defaultAvatar_full.fst");
|
||||||
}
|
}
|
||||||
return _defaultFullAvatarModelUrl;
|
return _defaultFullAvatarModelUrl;
|
||||||
}
|
}
|
||||||
|
|
|
@ -262,7 +262,7 @@ gpu::TexturePointer getFallbackTextureForType(image::TextureUsage::Type type) {
|
||||||
gpu::TexturePointer TextureCache::getImageTexture(const QString& path, image::TextureUsage::Type type, QVariantMap options) {
|
gpu::TexturePointer TextureCache::getImageTexture(const QString& path, image::TextureUsage::Type type, QVariantMap options) {
|
||||||
QImage image = QImage(path);
|
QImage image = QImage(path);
|
||||||
auto loader = image::TextureUsage::getTextureLoaderForType(type, options);
|
auto loader = image::TextureUsage::getTextureLoaderForType(type, options);
|
||||||
return gpu::TexturePointer(loader(std::move(image), QUrl::fromLocalFile(path).fileName().toStdString(), false));
|
return gpu::TexturePointer(loader(std::move(image), path.toStdString(), false));
|
||||||
}
|
}
|
||||||
|
|
||||||
QSharedPointer<Resource> TextureCache::createResource(const QUrl& url, const QSharedPointer<Resource>& fallback,
|
QSharedPointer<Resource> TextureCache::createResource(const QUrl& url, const QSharedPointer<Resource>& fallback,
|
||||||
|
|
|
@ -17,18 +17,25 @@
|
||||||
|
|
||||||
#include <StatTracker.h>
|
#include <StatTracker.h>
|
||||||
|
|
||||||
|
#include "ResourceManager.h"
|
||||||
|
|
||||||
void FileResourceRequest::doSend() {
|
void FileResourceRequest::doSend() {
|
||||||
auto statTracker = DependencyManager::get<StatTracker>();
|
auto statTracker = DependencyManager::get<StatTracker>();
|
||||||
statTracker->incrementStat(STAT_FILE_REQUEST_STARTED);
|
statTracker->incrementStat(STAT_FILE_REQUEST_STARTED);
|
||||||
int fileSize = 0;
|
int fileSize = 0;
|
||||||
QString filename = _url.toLocalFile();
|
QString filename;
|
||||||
|
if (_url.scheme() == URL_SCHEME_QRC) {
|
||||||
// sometimes on windows, we see the toLocalFile() return null,
|
filename = ":/" + _url.path();
|
||||||
// in this case we will attempt to simply use the url as a string
|
} else {
|
||||||
if (filename.isEmpty()) {
|
filename = _url.toLocalFile();
|
||||||
filename = _url.toString();
|
// sometimes on windows, we see the toLocalFile() return null,
|
||||||
|
// in this case we will attempt to simply use the url as a string
|
||||||
|
if (filename.isEmpty()) {
|
||||||
|
filename = _url.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Allow platform specific versions of files loaded out of a resource cache via file://
|
// Allow platform specific versions of files loaded out of a resource cache via file://
|
||||||
filename = QFileSelector().select(filename);
|
filename = QFileSelector().select(filename);
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
|
|
||||||
#include "ResourceManager.h"
|
#include "ResourceManager.h"
|
||||||
|
|
||||||
|
#include <mutex>
|
||||||
|
|
||||||
#include <QNetworkDiskCache>
|
#include <QNetworkDiskCache>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
@ -24,7 +26,6 @@
|
||||||
#include "NetworkAccessManager.h"
|
#include "NetworkAccessManager.h"
|
||||||
#include "NetworkLogging.h"
|
#include "NetworkLogging.h"
|
||||||
|
|
||||||
|
|
||||||
ResourceManager::ResourceManager() {
|
ResourceManager::ResourceManager() {
|
||||||
_thread.setObjectName("Resource Manager Thread");
|
_thread.setObjectName("Resource Manager Thread");
|
||||||
|
|
||||||
|
@ -53,7 +54,7 @@ QString ResourceManager::normalizeURL(const QString& urlString) {
|
||||||
copy = _prefixMap;
|
copy = _prefixMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(const auto& entry, copy) {
|
foreach (const auto& entry, copy) {
|
||||||
const auto& prefix = entry.first;
|
const auto& prefix = entry.first;
|
||||||
const auto& replacement = entry.second;
|
const auto& replacement = entry.second;
|
||||||
if (result.startsWith(prefix)) {
|
if (result.startsWith(prefix)) {
|
||||||
|
@ -64,13 +65,24 @@ QString ResourceManager::normalizeURL(const QString& urlString) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QSet<QString>& getKnownUrls() {
|
||||||
|
static QSet<QString> knownUrls;
|
||||||
|
static std::once_flag once;
|
||||||
|
std::call_once(once, [] {
|
||||||
|
knownUrls.insert(URL_SCHEME_QRC);
|
||||||
|
knownUrls.insert(URL_SCHEME_FILE);
|
||||||
|
knownUrls.insert(URL_SCHEME_HTTP);
|
||||||
|
knownUrls.insert(URL_SCHEME_HTTPS);
|
||||||
|
knownUrls.insert(URL_SCHEME_FTP);
|
||||||
|
knownUrls.insert(URL_SCHEME_ATP);
|
||||||
|
});
|
||||||
|
return knownUrls;
|
||||||
|
}
|
||||||
|
|
||||||
QUrl ResourceManager::normalizeURL(const QUrl& originalUrl) {
|
QUrl ResourceManager::normalizeURL(const QUrl& originalUrl) {
|
||||||
QUrl url = QUrl(normalizeURL(originalUrl.toString()));
|
QUrl url = QUrl(normalizeURL(originalUrl.toString()));
|
||||||
auto scheme = url.scheme();
|
auto scheme = url.scheme();
|
||||||
if (!(scheme == URL_SCHEME_FILE ||
|
if (!getKnownUrls().contains(scheme)) {
|
||||||
scheme == URL_SCHEME_HTTP || scheme == URL_SCHEME_HTTPS || scheme == URL_SCHEME_FTP ||
|
|
||||||
scheme == URL_SCHEME_ATP)) {
|
|
||||||
|
|
||||||
// check the degenerative file case: on windows we can often have urls of the form c:/filename
|
// check the degenerative file case: on windows we can often have urls of the form c:/filename
|
||||||
// this checks for and works around that case.
|
// this checks for and works around that case.
|
||||||
QUrl urlWithFileScheme{ URL_SCHEME_FILE + ":///" + url.toString() };
|
QUrl urlWithFileScheme{ URL_SCHEME_FILE + ":///" + url.toString() };
|
||||||
|
@ -94,7 +106,7 @@ ResourceRequest* ResourceManager::createResourceRequest(QObject* parent, const Q
|
||||||
|
|
||||||
ResourceRequest* request = nullptr;
|
ResourceRequest* request = nullptr;
|
||||||
|
|
||||||
if (scheme == URL_SCHEME_FILE) {
|
if (scheme == URL_SCHEME_FILE || scheme == URL_SCHEME_QRC) {
|
||||||
request = new FileResourceRequest(normalizedURL);
|
request = new FileResourceRequest(normalizedURL);
|
||||||
} else if (scheme == URL_SCHEME_HTTP || scheme == URL_SCHEME_HTTPS || scheme == URL_SCHEME_FTP) {
|
} else if (scheme == URL_SCHEME_HTTP || scheme == URL_SCHEME_HTTPS || scheme == URL_SCHEME_FTP) {
|
||||||
request = new HTTPResourceRequest(normalizedURL);
|
request = new HTTPResourceRequest(normalizedURL);
|
||||||
|
@ -113,15 +125,14 @@ ResourceRequest* ResourceManager::createResourceRequest(QObject* parent, const Q
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ResourceManager::resourceExists(const QUrl& url) {
|
bool ResourceManager::resourceExists(const QUrl& url) {
|
||||||
auto scheme = url.scheme();
|
auto scheme = url.scheme();
|
||||||
if (scheme == URL_SCHEME_FILE) {
|
if (scheme == URL_SCHEME_FILE) {
|
||||||
QFileInfo file { url.toString() };
|
QFileInfo file{ url.toString() };
|
||||||
return file.exists();
|
return file.exists();
|
||||||
} else if (scheme == URL_SCHEME_HTTP || scheme == URL_SCHEME_HTTPS || scheme == URL_SCHEME_FTP) {
|
} else if (scheme == URL_SCHEME_HTTP || scheme == URL_SCHEME_HTTPS || scheme == URL_SCHEME_FTP) {
|
||||||
auto& networkAccessManager = NetworkAccessManager::getInstance();
|
auto& networkAccessManager = NetworkAccessManager::getInstance();
|
||||||
QNetworkRequest request { url };
|
QNetworkRequest request{ url };
|
||||||
|
|
||||||
request.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
request.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
||||||
request.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
|
request.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
|
||||||
|
@ -159,4 +170,3 @@ bool ResourceManager::resourceExists(const QUrl& url) {
|
||||||
qCDebug(networking) << "Unknown scheme (" << scheme << ") for URL: " << url.url();
|
qCDebug(networking) << "Unknown scheme (" << scheme << ") for URL: " << url.url();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
#include "ResourceRequest.h"
|
#include "ResourceRequest.h"
|
||||||
|
|
||||||
|
const QString URL_SCHEME_QRC = "qrc";
|
||||||
const QString URL_SCHEME_FILE = "file";
|
const QString URL_SCHEME_FILE = "file";
|
||||||
const QString URL_SCHEME_HTTP = "http";
|
const QString URL_SCHEME_HTTP = "http";
|
||||||
const QString URL_SCHEME_HTTPS = "https";
|
const QString URL_SCHEME_HTTPS = "https";
|
||||||
|
|
|
@ -61,19 +61,27 @@ const QString& PathUtils::resourcesPath() {
|
||||||
return staticResourcePath;
|
return staticResourcePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME rename to qmlBaseUrl
|
const QString& PathUtils::resourcesUrl() {
|
||||||
const QString& PathUtils::qmlBasePath() {
|
|
||||||
#if !defined(Q_OS_ANDROID) && defined(DEV_BUILD)
|
#if !defined(Q_OS_ANDROID) && defined(DEV_BUILD)
|
||||||
// For dev builds, load
|
// For dev builds, load
|
||||||
if (USE_SOURCE_TREE_RESOURCES) {
|
if (USE_SOURCE_TREE_RESOURCES) {
|
||||||
static const QString staticResourcePath = QUrl::fromLocalFile(projectRootPath() + "/interface/resources/qml").toString();
|
static const QString staticResourcePath = "file:///" + projectRootPath() + "/interface/resources/";
|
||||||
return staticResourcePath;
|
return staticResourcePath;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
static const QString staticResourcePath = "qrc:///qml/";
|
static const QString staticResourcePath = "qrc:///";
|
||||||
return staticResourcePath;
|
return staticResourcePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QString& PathUtils::qmlBaseUrl() {
|
||||||
|
static const QString staticResourcePath = resourcesUrl() + "qml/";
|
||||||
|
return staticResourcePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
QUrl PathUtils::qmlBaseUrl(const QString& relativeUrl) {
|
||||||
|
return QUrl(qmlBaseUrl() + relativeUrl);
|
||||||
|
}
|
||||||
|
|
||||||
QString PathUtils::getAppDataPath() {
|
QString PathUtils::getAppDataPath() {
|
||||||
return QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/";
|
return QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/";
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,8 +33,10 @@ class PathUtils : public QObject, public Dependency {
|
||||||
Q_PROPERTY(QString resources READ resourcesPath CONSTANT)
|
Q_PROPERTY(QString resources READ resourcesPath CONSTANT)
|
||||||
Q_PROPERTY(QUrl defaultScripts READ defaultScriptsLocation CONSTANT)
|
Q_PROPERTY(QUrl defaultScripts READ defaultScriptsLocation CONSTANT)
|
||||||
public:
|
public:
|
||||||
|
static const QString& resourcesUrl();
|
||||||
static const QString& resourcesPath();
|
static const QString& resourcesPath();
|
||||||
static const QString& qmlBasePath();
|
static const QString& qmlBaseUrl();
|
||||||
|
static QUrl qmlBaseUrl(const QString& relative);
|
||||||
#ifdef DEV_BUILD
|
#ifdef DEV_BUILD
|
||||||
static const QString& projectRootPath();
|
static const QString& projectRootPath();
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -46,7 +46,7 @@ void InfoView::show(const QString& path, bool firstOrChangedOnly, QString urlQue
|
||||||
registerType();
|
registerType();
|
||||||
QUrl url;
|
QUrl url;
|
||||||
if (QDir(path).isRelative()) {
|
if (QDir(path).isRelative()) {
|
||||||
url = QUrl::fromLocalFile(PathUtils::resourcesPath() + path);
|
url = QUrl(PathUtils::resourcesUrl() + path);
|
||||||
} else {
|
} else {
|
||||||
url = QUrl::fromLocalFile(path);
|
url = QUrl::fromLocalFile(path);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ public: \
|
||||||
private:
|
private:
|
||||||
|
|
||||||
#define HIFI_QML_DEF(x) \
|
#define HIFI_QML_DEF(x) \
|
||||||
const QUrl x::QML = QUrl(PathUtils::qmlBasePath() + #x ".qml"); \
|
const QUrl x::QML = PathUtils::qmlBaseUrl(#x ".qml"); \
|
||||||
const QString x::NAME = #x; \
|
const QString x::NAME = #x; \
|
||||||
\
|
\
|
||||||
void x::registerType() { \
|
void x::registerType() { \
|
||||||
|
|
|
@ -70,7 +70,7 @@ public:
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
for (auto url : urls) {
|
for (auto url : urls) {
|
||||||
if (url.isRelative()) {
|
if (url.isRelative()) {
|
||||||
url = QUrl(PathUtils::qmlBasePath() + url.toString());
|
url = PathUtils::qmlBaseUrl(url.toString());
|
||||||
}
|
}
|
||||||
_callbacks[url].push_back(callback);
|
_callbacks[url].push_back(callback);
|
||||||
}
|
}
|
||||||
|
@ -443,7 +443,7 @@ void initializeQmlEngine(QQmlEngine* engine, QQuickWindow* window) {
|
||||||
auto rootContext = engine->rootContext();
|
auto rootContext = engine->rootContext();
|
||||||
rootContext->setContextProperty("GL", ::getGLContextData());
|
rootContext->setContextProperty("GL", ::getGLContextData());
|
||||||
rootContext->setContextProperty("urlHandler", new UrlHandler());
|
rootContext->setContextProperty("urlHandler", new UrlHandler());
|
||||||
rootContext->setContextProperty("resourceDirectoryUrl", QUrl::fromLocalFile(PathUtils::resourcesPath()));
|
rootContext->setContextProperty("resourceDirectoryUrl", QUrl(PathUtils::resourcesUrl()));
|
||||||
rootContext->setContextProperty("pathToFonts", "../../");
|
rootContext->setContextProperty("pathToFonts", "../../");
|
||||||
rootContext->setContextProperty("ApplicationInterface", qApp);
|
rootContext->setContextProperty("ApplicationInterface", qApp);
|
||||||
auto javaScriptToInject = getEventBridgeJavascript();
|
auto javaScriptToInject = getEventBridgeJavascript();
|
||||||
|
@ -682,7 +682,7 @@ void OffscreenQmlSurface::create() {
|
||||||
auto qmlEngine = acquireEngine(_quickWindow);
|
auto qmlEngine = acquireEngine(_quickWindow);
|
||||||
|
|
||||||
_qmlContext = new QQmlContext(qmlEngine->rootContext());
|
_qmlContext = new QQmlContext(qmlEngine->rootContext());
|
||||||
_qmlContext->setBaseUrl(QUrl{ PathUtils::qmlBasePath() });
|
_qmlContext->setBaseUrl(QUrl{ PathUtils::qmlBaseUrl() });
|
||||||
_qmlContext->setContextProperty("offscreenWindow", QVariant::fromValue(getWindow()));
|
_qmlContext->setContextProperty("offscreenWindow", QVariant::fromValue(getWindow()));
|
||||||
_qmlContext->setContextProperty("eventBridge", this);
|
_qmlContext->setContextProperty("eventBridge", this);
|
||||||
_qmlContext->setContextProperty("webEntity", this);
|
_qmlContext->setContextProperty("webEntity", this);
|
||||||
|
|
|
@ -172,9 +172,8 @@ void TabletScriptingInterface::preloadSounds() {
|
||||||
//preload audio events
|
//preload audio events
|
||||||
const QStringList &audioSettings = tabletSoundsButtonClick.get();
|
const QStringList &audioSettings = tabletSoundsButtonClick.get();
|
||||||
for (int i = 0; i < TabletAudioEvents::Last; i++) {
|
for (int i = 0; i < TabletAudioEvents::Last; i++) {
|
||||||
QFileInfo inf = QFileInfo(PathUtils::resourcesPath() + audioSettings.at(i));
|
|
||||||
SharedSoundPointer sound = DependencyManager::get<SoundCache>()->
|
SharedSoundPointer sound = DependencyManager::get<SoundCache>()->
|
||||||
getSound(QUrl::fromLocalFile(inf.absoluteFilePath()));
|
getSound(QUrl(PathUtils::resourcesUrl() + audioSettings.at(i)));
|
||||||
_audioEvents.insert(static_cast<TabletAudioEvents>(i), sound);
|
_audioEvents.insert(static_cast<TabletAudioEvents>(i), sound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue