Resolving comments in PR

This commit is contained in:
Gabriel Calero 2018-01-08 17:36:08 -03:00
parent 6d732dd8ba
commit 6050737e7c
26 changed files with 58 additions and 297 deletions

View file

@ -1,19 +0,0 @@
import QtQuick 2.7
import QtWebView 1.1
Rectangle {
id: window
anchors.fill: parent
color: "red"
ColorAnimation on color { from: "blue"; to: "yellow"; duration: 1000; loops: Animation.Infinite }
Text {
text: "Hello"
anchors.top: parent.top
}
WebView {
anchors.fill: parent
anchors.margins: 10
url: "http://doc.qt.io/qt-5/qml-qtwebview-webview.html"
}
}

View file

@ -1,156 +0,0 @@
/*
The main function in this file overrides the one in interface library
#include <jni.h>
#include <android/log.h>
#include <QtCore/QDebug>
#include <QtCore/QDir>
#include <QtGui/QGuiApplication>
#include <QtGui/QScreen>
#include <QtQml/QQmlEngine>
#include <QtQml/QQmlFileSelector>
#include <QtQuick/QQuickView>
#include <QtGui/QOpenGLContext>
#include <QtCore/QLoggingCategory>
#include <QtWebView/QtWebView>
#include <gl/Config.h>
#include <gl/OffscreenGLCanvas.h>
#include <gl/GLWindow.h>
#include <ui/OffscreenQmlSurface.h>
Q_LOGGING_CATEGORY(gpugllogging, "hifi.gl")
bool checkGLError(const char* name) {
GLenum error = glGetError();
if (!error) {
return false;
} else {
switch (error) {
case GL_INVALID_ENUM:
qCDebug(gpugllogging) << "GLBackend::" << name << ": An unacceptable value is specified for an enumerated argument.The offending command is ignored and has no other side effect than to set the error flag.";
break;
case GL_INVALID_VALUE:
qCDebug(gpugllogging) << "GLBackend" << name << ": A numeric argument is out of range.The offending command is ignored and has no other side effect than to set the error flag";
break;
case GL_INVALID_OPERATION:
qCDebug(gpugllogging) << "GLBackend" << name << ": The specified operation is not allowed in the current state.The offending command is ignored and has no other side effect than to set the error flag..";
break;
case GL_INVALID_FRAMEBUFFER_OPERATION:
qCDebug(gpugllogging) << "GLBackend" << name << ": The framebuffer object is not complete.The offending command is ignored and has no other side effect than to set the error flag.";
break;
case GL_OUT_OF_MEMORY:
qCDebug(gpugllogging) << "GLBackend" << name << ": There is not enough memory left to execute the command.The state of the GL is undefined, except for the state of the error flags, after this error is recorded.";
break;
default:
qCDebug(gpugllogging) << "GLBackend" << name << ": Unknown error: " << error;
break;
}
return true;
}
}
bool checkGLErrorDebug(const char* name) {
return checkGLError(name);
}
int QtMsgTypeToAndroidPriority(QtMsgType type) {
int priority = ANDROID_LOG_UNKNOWN;
switch (type) {
case QtDebugMsg: priority = ANDROID_LOG_DEBUG; break;
case QtWarningMsg: priority = ANDROID_LOG_WARN; break;
case QtCriticalMsg: priority = ANDROID_LOG_ERROR; break;
case QtFatalMsg: priority = ANDROID_LOG_FATAL; break;
case QtInfoMsg: priority = ANDROID_LOG_INFO; break;
default: break;
}
return priority;
}
void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString& message) {
__android_log_write(QtMsgTypeToAndroidPriority(type), "Interface", message.toStdString().c_str());
}
void qt_gl_set_global_share_context(QOpenGLContext *context);
int main(int argc, char* argv[])
{
qInstallMessageHandler(messageHandler);
QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling);
QGuiApplication app(argc,argv);
app.setOrganizationName("QtProject");
app.setOrganizationDomain("qt-project.org");
app.setApplicationName(QFileInfo(app.applicationFilePath()).baseName());
QtWebView::initialize();
qputenv("QSG_RENDERER_DEBUG", (QStringList() << "render" << "build" << "change" << "upload" << "roots" << "dump").join(';').toUtf8());
OffscreenGLCanvas sharedCanvas;
if (!sharedCanvas.create()) {
qFatal("Unable to create primary offscreen context");
}
qt_gl_set_global_share_context(sharedCanvas.getContext());
auto globalContext = QOpenGLContext::globalShareContext();
GLWindow window;
window.create();
window.setGeometry(qApp->primaryScreen()->availableGeometry());
window.createContext(globalContext);
if (!window.makeCurrent()) {
qFatal("Unable to make primary window GL context current");
}
GLuint fbo = 0;
glGenFramebuffers(1, &fbo);
static const ivec2 offscreenSize { 640, 480 };
OffscreenQmlSurface::setSharedContext(sharedCanvas.getContext());
OffscreenQmlSurface* qmlSurface = new OffscreenQmlSurface();
qmlSurface->create();
qmlSurface->resize(fromGlm(offscreenSize));
qmlSurface->load("qrc:///simple.qml");
qmlSurface->resume();
auto discardLambda = qmlSurface->getDiscardLambda();
window.showFullScreen();
QTimer timer;
timer.setInterval(10);
timer.setSingleShot(false);
OffscreenQmlSurface::TextureAndFence currentTextureAndFence;
timer.connect(&timer, &QTimer::timeout, &app, [&]{
window.makeCurrent();
glClearColor(0, 1, 0, 1);
glClear(GL_COLOR_BUFFER_BIT);
OffscreenQmlSurface::TextureAndFence newTextureAndFence;
if (qmlSurface->fetchTexture(newTextureAndFence)) {
if (currentTextureAndFence.first) {
discardLambda(currentTextureAndFence.first, currentTextureAndFence.second);
}
currentTextureAndFence = newTextureAndFence;
}
checkGLErrorDebug(__FUNCTION__);
if (currentTextureAndFence.second) {
glWaitSync((GLsync)currentTextureAndFence.second, 0, GL_TIMEOUT_IGNORED);
glDeleteSync((GLsync)currentTextureAndFence.second);
currentTextureAndFence.second = nullptr;
}
if (currentTextureAndFence.first) {
glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo);
glFramebufferTexture(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, currentTextureAndFence.first, 0);
glBlitFramebuffer(0, 0, offscreenSize.x, offscreenSize.y, 100, 100, offscreenSize.x + 100, offscreenSize.y + 100, GL_COLOR_BUFFER_BIT, GL_NEAREST);
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
}
window.swapBuffers();
window.doneCurrent();
});
timer.start();
return app.exec();
}
*/

View file

@ -1,6 +0,0 @@
<RCC>
<qresource prefix="/">
<file>simple.qml</file>
<file>+android/simple.qml</file>
</qresource>
</RCC>

View file

@ -1,10 +0,0 @@
import QtQuick 2.0
Rectangle {
id: window
width: 320
height: 480
focus: true
color: "red"
ColorAnimation on color { from: "red"; to: "yellow"; duration: 1000; loops: Animation.Infinite }
}

View file

@ -40,6 +40,7 @@ ext {
BUILD_BRANCH = project.hasProperty('BUILD_BRANCH') ? project.getProperty('BUILD_BRANCH') : ''
EXEC_SUFFIX = Os.isFamily(Os.FAMILY_WINDOWS) ? '.exe' : ''
QT5_DEPS = [
'Qt5Concurrent',
'Qt5Core',
'Qt5Gui',
'Qt5Multimedia',
@ -47,14 +48,15 @@ ext {
'Qt5OpenGL',
'Qt5Qml',
'Qt5Quick',
'Qt5QuickControls2',
'Qt5QuickTemplates2',
'Qt5Script',
'Qt5ScriptTools',
'Qt5Svg',
'Qt5WebChannel',
'Qt5WebSockets',
'Qt5Widgets',
'Qt5XmlPatterns',
'Qt5Concurrent',
'Qt5Svg',
// Android specific
'Qt5AndroidExtras',
'Qt5WebView',

View file

@ -58,14 +58,6 @@ else ()
list(REMOVE_ITEM INTERFACE_SRCS ${SPEECHRECOGNIZER_CPP})
endif ()
if (ANDROID)
set(PLATFORM_QT_COMPONENTS AndroidExtras)
# set(PLATFORM_QT_LIBRARIES Qt5::AndroidExtras)
else ()
set(PLATFORM_QT_COMPONENTS WebEngine WebEngineWidgets)
set(PLATFORM_QT_LIBRARIES Qt5::WebEngine Qt5::WebEngineWidgets)
endif ()
find_package(
Qt5 COMPONENTS
Gui Multimedia Network OpenGL Qml Quick Script Svg
@ -197,13 +189,6 @@ if (WIN32)
set_property(TARGET ${TARGET_NAME} APPEND_STRING PROPERTY LINK_FLAGS_DEBUG "/OPT:NOREF /OPT:NOICF")
endif()
if (NOT ANDROID)
set(NON_ANDROID_LIBRARIES gpu-gl)
else()
set(ANDROID_LIBRARIES gpu-gles)
endif ()
# link required hifi libraries
link_hifi_libraries(
shared octree ktx gpu gl procedural model render
@ -213,8 +198,6 @@ link_hifi_libraries(
render-utils entities-renderer avatars-renderer ui auto-updater midi
controllers plugins image trackers
ui-plugins display-plugins input-plugins
${ANDROID_LIBRARIES}
${NON_ANDROID_LIBRARIES}
${PLATFORM_GL_BACKEND}
)
@ -266,19 +249,16 @@ endforeach()
include_directories("${PROJECT_SOURCE_DIR}/src")
if (ANDROID)
#set(ANDROID_PLATFORM_QT_LIBRARIES Qt5::WebView)
find_library(ANDROID_LOG_LIB log)
target_link_libraries(${TARGET_NAME} ${ANDROID_LOG_LIB})
else()
set(NON_ANDROID_PLATFORM_QT_LIBRARIES Qt5::WebEngine)
endif ()
target_link_libraries(
${TARGET_NAME}
Qt5::Gui Qt5::Network Qt5::Multimedia Qt5::OpenGL
Qt5::Qml Qt5::Quick Qt5::Script Qt5::Svg
Qt5::WebChannel ${NON_ANDROID_PLATFORM_QT_LIBRARIES}
${ANDROID_PLATFORM_QT_LIBRARIES}
Qt5::WebChannel
${PLATFORM_QT_LIBRARIES}
)
if (UNIX AND NOT ANDROID)

View file

@ -210,7 +210,7 @@
#include "commerce/QmlCommerce.h"
#include "webbrowser/WebBrowserSuggestionsEngine.h"
#ifdef ANDROID
#if defined(Q_OS_ANDROID)
#include <QtAndroidExtras/QAndroidJniObject>
#include <android/log.h>
#endif
@ -235,7 +235,7 @@ extern "C" {
}
#endif
#ifdef ANDROID
#if defined(Q_OS_ANDROID)
extern "C" {
JNIEXPORT void Java_io_highfidelity_hifiinterface_InterfaceActivity_nativeOnCreate(JNIEnv* env, jobject obj, jobject instance, jobject asset_mgr) {
@ -557,16 +557,9 @@ void messageHandler(QtMsgType type, const QMessageLogContext& context, const QSt
if (!logMessage.isEmpty()) {
#ifdef Q_OS_WIN
OutputDebugStringA(logMessage.toLocal8Bit().constData());
OutputDebugStringA("\n");i
OutputDebugStringA("\n");
#elif defined Q_OS_ANDROID
QString report=message;
if (context.file && !QString(context.file).isEmpty()) {
report+=" at ";
report+=QString(context.file);
report+=" : ";
report+=QString::number(context.line);
}
const char*const local=report.toLocal8Bit().constData();
const char * local=logMessage.toStdString().c_str();
switch (type) {
case QtDebugMsg:
__android_log_write(ANDROID_LOG_DEBUG,"Interface",local);
@ -2252,10 +2245,10 @@ void Application::initializeGL() {
// Set up the render engine
render::CullFunctor cullFunctor = LODManager::shouldRender;
static const QString RENDER_FORWARD = "HIFI_RENDER_FORWARD";
#ifndef Q_OS_ANDROID
bool isDeferred = !QProcessEnvironment::systemEnvironment().contains(RENDER_FORWARD);
#else
#ifdef Q_OS_ANDROID
bool isDeferred = false;
#else
bool isDeferred = !QProcessEnvironment::systemEnvironment().contains(RENDER_FORWARD);
#endif
_renderEngine->addJob<UpdateSceneTask>("UpdateScene");
#ifndef Q_OS_ANDROID
@ -2369,10 +2362,10 @@ void Application::initializeUi() {
offscreenUi->setProxyWindow(_window->windowHandle());
// OffscreenUi is a subclass of OffscreenQmlSurface specifically designed to
// support the window management and scripting proxies for VR use
#ifndef Q_OS_ANDROID
offscreenUi->createDesktop(QString("hifi/Desktop.qml"));
#ifdef Q_OS_ANDROID
offscreenUi->createDesktop(PathUtils::qmlBasePath() + "hifi/Desktop.qml");
#else
offscreenUi->createDesktop(QString("qrc:///qml/hifi/Desktop.qml"));
offscreenUi->createDesktop(QString("hifi/Desktop.qml"));
#endif
// FIXME either expose so that dialogs can set this themselves or
// do better detection in the offscreen UI of what has focus
@ -5960,7 +5953,7 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEnginePointe
scriptEngine->registerGetterSetter("location", LocationScriptingInterface::locationGetter,
LocationScriptingInterface::locationSetter);
#ifndef ANDROID
#if !defined(Q_OS_ANDROID)
scriptEngine->registerFunction("OverlayWebWindow", QmlWebWindowClass::constructor);
#endif
scriptEngine->registerFunction("OverlayWindow", QmlWindowClass::constructor);

View file

@ -106,6 +106,7 @@ int main(int argc, const char* argv[]) {
instanceMightBeRunning = false;
}
#if defined(Q_OS_ANDROID)
std::vector<QString> assetDirs = {
"/resources",
"/scripts",
@ -115,7 +116,7 @@ int main(int argc, const char* argv[]) {
QString dir = *it;
PathUtils::copyDirDeep("assets:" + dir, QUrl::fromLocalFile(dirInfo.canonicalPath() + dir).toLocalFile());
}
#endif
// this needs to be done here in main, as the mechanism for setting the
// scripts directory appears not to work. See the bug report
// https://highfidelity.fogbugz.com/f/cases/5759/Issues-changing-scripts-directory-in-ScriptsEngine

View file

@ -37,7 +37,7 @@ AssetMappingsScriptingInterface::AssetMappingsScriptingInterface() {
void AssetMappingsScriptingInterface::setMapping(QString path, QString hash, QJSValue callback) {
auto assetClient = DependencyManager::get<AssetClient>();
auto request = assetClient->createSetMappingRequest(path, hash);
#ifndef ANDROID
#if !defined(Q_OS_ANDROID)
// TODO: just to make android compile
connect(request, &SetMappingRequest::finished, this, [this, callback](SetMappingRequest* request) mutable {
if (callback.isCallable()) {
@ -55,7 +55,7 @@ void AssetMappingsScriptingInterface::setMapping(QString path, QString hash, QJS
void AssetMappingsScriptingInterface::getMapping(QString path, QJSValue callback) {
auto assetClient = DependencyManager::get<AssetClient>();
auto request = assetClient->createGetMappingRequest(path);
#ifndef ANDROID
#if !defined(Q_OS_ANDROID)
// TODO: just to make android compile
connect(request, &GetMappingRequest::finished, this, [this, callback](GetMappingRequest* request) mutable {
auto hash = request->getHash();
@ -144,7 +144,7 @@ void AssetMappingsScriptingInterface::uploadFile(QString path, QString mapping,
void AssetMappingsScriptingInterface::deleteMappings(QStringList paths, QJSValue callback) {
auto assetClient = DependencyManager::get<AssetClient>();
auto request = assetClient->createDeleteMappingsRequest(paths);
#ifndef ANDROID
#if !defined(Q_OS_ANDROID)
// TODO: just to make android compile
connect(request, &DeleteMappingsRequest::finished, this, [this, callback](DeleteMappingsRequest* request) mutable {
if (callback.isCallable()) {
@ -162,7 +162,7 @@ void AssetMappingsScriptingInterface::deleteMappings(QStringList paths, QJSValue
void AssetMappingsScriptingInterface::getAllMappings(QJSValue callback) {
auto assetClient = DependencyManager::get<AssetClient>();
auto request = assetClient->createGetAllMappingsRequest();
#ifndef ANDROID
#if !defined(Q_OS_ANDROID)
// TODO: just to make android compile
connect(request, &GetAllMappingsRequest::finished, this, [this, callback](GetAllMappingsRequest* request) mutable {
auto mappings = request->getMappings();
@ -187,7 +187,7 @@ void AssetMappingsScriptingInterface::getAllMappings(QJSValue callback) {
void AssetMappingsScriptingInterface::renameMapping(QString oldPath, QString newPath, QJSValue callback) {
auto assetClient = DependencyManager::get<AssetClient>();
auto request = assetClient->createRenameMappingRequest(oldPath, newPath);
#ifndef ANDROID
#if !defined(Q_OS_ANDROID)
// TODO: just to make android compile
connect(request, &RenameMappingRequest::finished, this, [this, callback](RenameMappingRequest* request) mutable {
if (callback.isCallable()) {
@ -204,7 +204,7 @@ void AssetMappingsScriptingInterface::renameMapping(QString oldPath, QString new
void AssetMappingsScriptingInterface::setBakingEnabled(QStringList paths, bool enabled, QJSValue callback) {
auto assetClient = DependencyManager::get<AssetClient>();
auto request = assetClient->createSetBakingEnabledRequest(paths, enabled);
#ifndef ANDROID
#if !defined(Q_OS_ANDROID)
// TODO: just to make android compile
connect(request, &SetBakingEnabledRequest::finished, this, [this, callback](SetBakingEnabledRequest* request) mutable {
if (callback.isCallable()) {

View file

@ -15,7 +15,7 @@
#include <AudioClient.h>
#include <QObject>
#include <QFuture>
#ifdef ANDROID
#if defined(Q_OS_ANDROID)
#include <QTcpSocket>
#endif
class LimitlessConnection : public QObject {

View file

@ -42,7 +42,7 @@ using namespace std;
static Stats* INSTANCE{ nullptr };
#ifndef ANDROID
#if !defined (Q_OS_ANDROID)
QString getTextureMemoryPressureModeString();
#endif
Stats* Stats::getInstance() {
@ -360,7 +360,7 @@ void Stats::updateStats(bool force) {
STAT_UPDATE(gpuTextureResourceMemory, (int)BYTES_TO_MB(gpu::Context::getTextureResourceGPUMemSize()));
STAT_UPDATE(gpuTextureResourcePopulatedMemory, (int)BYTES_TO_MB(gpu::Context::getTextureResourcePopulatedGPUMemSize()));
STAT_UPDATE(gpuTextureExternalMemory, (int)BYTES_TO_MB(gpu::Context::getTextureExternalGPUMemSize()));
#ifndef ANDROID
#if !defined(Q_OS_ANDROID)
STAT_UPDATE(gpuTextureMemoryPressureState, getTextureMemoryPressureModeString());
#endif
STAT_UPDATE(gpuFreeMemory, (int)BYTES_TO_MB(gpu::Context::getFreeGPUMemSize()));

View file

@ -117,7 +117,7 @@ Avatar::Avatar(QThread* thread) :
}
Avatar::~Avatar() {
auto treeRenderer = DependencyManager::get<EntityTreeRenderer>();
auto treeRenderer = DependencyManager::get<EntityTreeRenderer>();
EntityTreePointer entityTree = treeRenderer ? treeRenderer->getTree() : nullptr;
if (entityTree) {
entityTree->withWriteLock([&] {
@ -1287,7 +1287,7 @@ int Avatar::parseDataFromBuffer(const QByteArray& buffer) {
const float MOVE_DISTANCE_THRESHOLD = 0.001f;
_moving = glm::distance(oldPosition, getWorldPosition()) > MOVE_DISTANCE_THRESHOLD;
if (_moving) {
addPhysicsFlags(Simulation::DIRTY_POSITION);
addPhysicsFlags(Simulation::DIRTY_POSITION);
}
if (_moving || _hasNewJointData) {
locationChanged();

View file

@ -891,12 +891,12 @@ void OpenGLDisplayPlugin::copyTextureToQuickFramebuffer(NetworkTexturePointer ne
GLuint fbo[2] {0, 0};
// need mipmaps for blitting texture
#ifndef ANDROID
#if !defined(Q_OS_ANDROID)
glGenerateTextureMipmap(sourceTexture);
#endif
// create 2 fbos (one for initial texture, second for scaled one)
#ifndef ANDROID
#if !defined(Q_OS_ANDROID)
glCreateFramebuffers(2, fbo);
#endif
@ -928,8 +928,8 @@ void OpenGLDisplayPlugin::copyTextureToQuickFramebuffer(NetworkTexturePointer ne
} else {
newY = (target->height() - newHeight) / 2;
}
#ifndef ANDROID
glBlitNamedFramebuffer(fbo[0], fbo[1], 0, 0, texWidth, texHeight, newX, newY, newX + newWidth, newY + newHeight, GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT, GL_NEAREST);
#if !defined(Q_OS_ANDROID)
glBlitNamedFramebuffer(fbo[0], fbo[1], 0, 0, texWidth, texHeight, newX, newY, newX + newWidth, newY + newHeight, GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT, GL_NEAREST);
#endif
// don't delete the textures!

View file

@ -147,17 +147,6 @@ void GLBackend::init() {
qCDebug(gpugllogging) << "\tcard:" << gpu->getName();
qCDebug(gpugllogging) << "\tdriver:" << gpu->getDriver();
qCDebug(gpugllogging) << "\tdedicated memory:" << gpu->getMemory() << "MB";
/*glewExperimental = true;
GLenum err = glewInit();
glGetError(); // clear the potential error from glewExperimental
if (GLEW_OK != err) {
// glewInit failed, something is seriously wrong.
qCDebug(gpugllogging, "Error: %s\n", glewGetErrorString(err));
}
qCDebug(gpugllogging, "Status: Using GLEW %s\n", glewGetString(GLEW_VERSION));
*/
#if THREADED_TEXTURE_BUFFERING
// This has to happen on the main thread in order to give the thread
// pool a reasonable parent object

View file

@ -12,7 +12,7 @@ using namespace gpu;
using namespace gpu::gl;
bool GLTexelFormat::isCompressed() const {
return false;
return false;
}
GLenum GLTexelFormat::evalGLTexelFormatInternal(const gpu::Element& dstFormat) {

View file

@ -134,7 +134,7 @@ public:
float getAspectRatio() const { return getWidth() / (float) getHeight() ; }
#ifndef ANDROID
#if !defined(Q_OS_ANDROID)
static const uint32 MAX_NUM_RENDER_BUFFERS = 8;
#else
static const uint32 MAX_NUM_RENDER_BUFFERS = 4;

View file

@ -738,7 +738,7 @@ gpu::TexturePointer TextureUsage::process2DTextureColorFromImage(QImage&& srcIma
bool validAlpha = image.hasAlphaChannel();
bool alphaAsMask = false;
#ifndef ANDROID
#if !defined(Q_OS_ANDROID)
if (image.format() != QImage::Format_ARGB32) {
image = image.convertToFormat(QImage::Format_ARGB32);
}

View file

@ -19,7 +19,7 @@
#include <QtScript/QScriptEngine>
#include <QtScript/QScriptString>
#include <QtScript/QScriptValue>
#include <QDateTime>
#include <QtCore/QDateTime>
class ScriptEngine;

View file

@ -15,9 +15,9 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include <QtCore/QDateTime>
#include "ConsoleScriptingInterface.h"
#include "ScriptEngine.h"
#include <QDateTime>
#define INDENTATION 4 // 1 Tab - 4 spaces
const QString LINE_SEPARATOR = "\n ";

View file

@ -54,7 +54,7 @@ const QString& PathUtils::projectRootPath() {
const QString& PathUtils::qmlBasePath() {
#ifdef Q_OS_ANDROID
static const QString staticResourcePath = QUrl::fromLocalFile(PathUtils::resourcesPath() + "qml/").toString();
static const QString staticResourcePath = "qrc:///qml/";
#elif defined (DEV_BUILD)
static const QString staticResourcePath = QUrl::fromLocalFile(projectRootPath() + "/interface/resources/qml/").toString();
#else
@ -76,10 +76,10 @@ QString PathUtils::getAppLocalDataPath() {
}
// otherwise return standard path
#ifndef Q_OS_ANDROID
return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + "/";
#else
#ifdef Q_OS_ANDROID
return QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/";
#else
return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + "/";
#endif
}

View file

@ -84,10 +84,10 @@ void FileUtils::locateFile(QString filePath) {
QString FileUtils::standardPath(QString subfolder) {
// standard path
// Mac: ~/Library/Application Support/Interface
#ifndef Q_OS_ANDROID
QString path = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
#else
#ifdef Q_OS_ANDROID
QString path = QStandardPaths::writableLocation(QStandardPaths::CacheLocation);
#else
QString path = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
#endif
if (!subfolder.startsWith("/")) {
subfolder.prepend("/");

View file

@ -282,7 +282,7 @@ private:
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 8.0f);
#ifndef ANDROID
#if !defined(Q_OS_ANDROID)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_LOD_BIAS, -0.2f);
#endif
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 8.0f);
@ -450,7 +450,7 @@ void initializeQmlEngine(QQmlEngine* engine, QQuickWindow* window) {
if (!javaScriptToInject.isEmpty()) {
rootContext->setContextProperty("eventBridgeJavaScriptToInject", QVariant(javaScriptToInject));
}
#ifndef ANDROID
#if !defined(Q_OS_ANDROID)
rootContext->setContextProperty("FileTypeProfile", new FileTypeProfile(rootContext));
rootContext->setContextProperty("HFWebEngineProfile", new HFWebEngineProfile(rootContext));
#endif
@ -554,7 +554,7 @@ void OffscreenQmlSurface::render() {
GLuint texture = offscreenTextures.getNextTexture(_size);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, _fbo);
#ifndef ANDROID
#if !defined(Q_OS_ANDROID)
glFramebufferTexture(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, texture, 0);
#endif
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

View file

@ -268,7 +268,7 @@ static const char* WEB_VIEW_SOURCE_URL = "hifi/tablet/TabletWebView.qml";
static const char* VRMENU_SOURCE_URL = "hifi/tablet/TabletMenu.qml";
class TabletRootWindow : public QmlWindowClass {
virtual QString qmlSource() const override { return "qrc:///qml/hifi/tablet/WindowRoot.qml"; }
virtual QString qmlSource() const override { return "hifi/tablet/WindowRoot.qml"; }
};
TabletProxy::TabletProxy(QObject* parent, const QString& name) : QObject(parent), _name(name) {

View file

@ -17,17 +17,13 @@
static const QString QML_WEB_ENGINE_STORAGE_NAME = "qmlWebEngine";
FileTypeProfile::FileTypeProfile(QObject* parent)
#ifndef ANDROID
: QQuickWebEngineProfile(parent)
#endif
: QQuickWebEngineProfile(parent)
{
static const QString WEB_ENGINE_USER_AGENT = "Chrome/48.0 (HighFidelityInterface)";
#ifndef ANDROID
setHttpUserAgent(WEB_ENGINE_USER_AGENT);
auto requestInterceptor = new FileTypeRequestInterceptor(this);
setRequestInterceptor(requestInterceptor);
#endif
}
#endif

View file

@ -11,26 +11,20 @@
#ifndef hifi_HFTabletWebEngineRequestInterceptor_h
#define hifi_HFTabletWebEngineRequestInterceptor_h
#if !defined(Q_OS_ANDROID)
#include <QtCore/QObject>
#ifndef ANDROID
#include <QWebEngineUrlRequestInterceptor>
#endif
class HFTabletWebEngineRequestInterceptor
#ifndef ANDROID
: public QWebEngineUrlRequestInterceptor
#endif
: public QWebEngineUrlRequestInterceptor
{
public:
HFTabletWebEngineRequestInterceptor(QObject* parent)
#ifndef ANDROID
: QWebEngineUrlRequestInterceptor(parent)
#endif
: QWebEngineUrlRequestInterceptor(parent)
{};
#ifndef ANDROID
virtual void interceptRequest(QWebEngineUrlRequestInfo& info) override;
#endif
virtual void interceptRequest(QWebEngineUrlRequestInfo& info) override;
};
#endif
#endif // hifi_HFWebEngineRequestInterceptor_h

View file

@ -18,15 +18,12 @@
static const QString QML_WEB_ENGINE_STORAGE_NAME = "qmlWebEngine";
HFWebEngineProfile::HFWebEngineProfile(QObject* parent)
#ifndef ANDROID
: QQuickWebEngineProfile(parent)
#endif
: QQuickWebEngineProfile(parent)
{
#ifndef ANDROID setStorageName(QML_WEB_ENGINE_STORAGE_NAME);
setStorageName(QML_WEB_ENGINE_STORAGE_NAME);
// we use the HFWebEngineRequestInterceptor to make sure that web requests are authenticated for the interface user
auto requestInterceptor = new HFWebEngineRequestInterceptor(this);
setRequestInterceptor(requestInterceptor);
#endif
}
#endif