From 6050737e7c7c3b7ed42e62f948944473f9ecc3ed Mon Sep 17 00:00:00 2001 From: Gabriel Calero Date: Mon, 8 Jan 2018 17:36:08 -0300 Subject: [PATCH] Resolving comments in PR --- android/app/src/main/cpp/+android/simple.qml | 19 --- android/app/src/main/cpp/main.cpp | 156 ------------------ android/app/src/main/cpp/main.qrc | 6 - android/app/src/main/cpp/simple.qml | 10 -- android/build.gradle | 6 +- interface/CMakeLists.txt | 24 +-- interface/src/Application.cpp | 29 ++-- interface/src/main.cpp | 3 +- .../AssetMappingsScriptingInterface.cpp | 12 +- interface/src/scripting/LimitlessConnection.h | 2 +- interface/src/ui/Stats.cpp | 4 +- .../src/avatars-renderer/Avatar.cpp | 4 +- .../display-plugins/OpenGLDisplayPlugin.cpp | 8 +- libraries/gpu-gles/src/gpu/gl/GLBackend.cpp | 11 -- .../gpu-gles/src/gpu/gl/GLTexelFormat.cpp | 2 +- libraries/gpu/src/gpu/Framebuffer.h | 2 +- libraries/image/src/image/Image.cpp | 2 +- .../script-engine/src/ArrayBufferClass.h | 2 +- .../src/ConsoleScriptingInterface.cpp | 2 +- libraries/shared/src/PathUtils.cpp | 8 +- libraries/shared/src/shared/FileUtils.cpp | 6 +- libraries/ui/src/ui/OffscreenQmlSurface.cpp | 6 +- .../ui/src/ui/TabletScriptingInterface.cpp | 2 +- libraries/ui/src/ui/types/FileTypeProfile.cpp | 6 +- .../HFTabletWebEngineRequestInterceptor.h | 16 +- .../ui/src/ui/types/HFWebEngineProfile.cpp | 7 +- 26 files changed, 58 insertions(+), 297 deletions(-) delete mode 100644 android/app/src/main/cpp/+android/simple.qml delete mode 100644 android/app/src/main/cpp/main.cpp delete mode 100644 android/app/src/main/cpp/main.qrc delete mode 100644 android/app/src/main/cpp/simple.qml diff --git a/android/app/src/main/cpp/+android/simple.qml b/android/app/src/main/cpp/+android/simple.qml deleted file mode 100644 index fc722d7e2c..0000000000 --- a/android/app/src/main/cpp/+android/simple.qml +++ /dev/null @@ -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" - } -} diff --git a/android/app/src/main/cpp/main.cpp b/android/app/src/main/cpp/main.cpp deleted file mode 100644 index 27d43e34aa..0000000000 --- a/android/app/src/main/cpp/main.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/* - The main function in this file overrides the one in interface library - #include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -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(); -} -*/ \ No newline at end of file diff --git a/android/app/src/main/cpp/main.qrc b/android/app/src/main/cpp/main.qrc deleted file mode 100644 index 81cf8ef111..0000000000 --- a/android/app/src/main/cpp/main.qrc +++ /dev/null @@ -1,6 +0,0 @@ - - - simple.qml - +android/simple.qml - - diff --git a/android/app/src/main/cpp/simple.qml b/android/app/src/main/cpp/simple.qml deleted file mode 100644 index 38f3c80374..0000000000 --- a/android/app/src/main/cpp/simple.qml +++ /dev/null @@ -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 } -} diff --git a/android/build.gradle b/android/build.gradle index 239d98f0bd..b164ed5cca 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -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', diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index 08d5778f18..8d58d4a6e8 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -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) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 65005d0605..633cad14a7 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -210,7 +210,7 @@ #include "commerce/QmlCommerce.h" #include "webbrowser/WebBrowserSuggestionsEngine.h" -#ifdef ANDROID +#if defined(Q_OS_ANDROID) #include #include #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("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); diff --git a/interface/src/main.cpp b/interface/src/main.cpp index 3a21f5fadf..b8b3f4ab97 100644 --- a/interface/src/main.cpp +++ b/interface/src/main.cpp @@ -106,6 +106,7 @@ int main(int argc, const char* argv[]) { instanceMightBeRunning = false; } +#if defined(Q_OS_ANDROID) std::vector 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 diff --git a/interface/src/scripting/AssetMappingsScriptingInterface.cpp b/interface/src/scripting/AssetMappingsScriptingInterface.cpp index 5c27de84c9..499f1829b6 100644 --- a/interface/src/scripting/AssetMappingsScriptingInterface.cpp +++ b/interface/src/scripting/AssetMappingsScriptingInterface.cpp @@ -37,7 +37,7 @@ AssetMappingsScriptingInterface::AssetMappingsScriptingInterface() { void AssetMappingsScriptingInterface::setMapping(QString path, QString hash, QJSValue callback) { auto assetClient = DependencyManager::get(); 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(); 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(); 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(); 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(); 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(); 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()) { diff --git a/interface/src/scripting/LimitlessConnection.h b/interface/src/scripting/LimitlessConnection.h index cdb64a8197..6acf651c4e 100644 --- a/interface/src/scripting/LimitlessConnection.h +++ b/interface/src/scripting/LimitlessConnection.h @@ -15,7 +15,7 @@ #include #include #include -#ifdef ANDROID +#if defined(Q_OS_ANDROID) #include #endif class LimitlessConnection : public QObject { diff --git a/interface/src/ui/Stats.cpp b/interface/src/ui/Stats.cpp index 2e15f11c3e..c157898e74 100644 --- a/interface/src/ui/Stats.cpp +++ b/interface/src/ui/Stats.cpp @@ -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())); diff --git a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp index c41372ee55..c532e7659f 100644 --- a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp +++ b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp @@ -117,7 +117,7 @@ Avatar::Avatar(QThread* thread) : } Avatar::~Avatar() { - auto treeRenderer = DependencyManager::get(); + auto treeRenderer = DependencyManager::get(); 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(); diff --git a/libraries/display-plugins/src/display-plugins/OpenGLDisplayPlugin.cpp b/libraries/display-plugins/src/display-plugins/OpenGLDisplayPlugin.cpp index 90a4e75669..0facf5f2d0 100644 --- a/libraries/display-plugins/src/display-plugins/OpenGLDisplayPlugin.cpp +++ b/libraries/display-plugins/src/display-plugins/OpenGLDisplayPlugin.cpp @@ -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! diff --git a/libraries/gpu-gles/src/gpu/gl/GLBackend.cpp b/libraries/gpu-gles/src/gpu/gl/GLBackend.cpp index 667b408801..7d00552663 100644 --- a/libraries/gpu-gles/src/gpu/gl/GLBackend.cpp +++ b/libraries/gpu-gles/src/gpu/gl/GLBackend.cpp @@ -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 diff --git a/libraries/gpu-gles/src/gpu/gl/GLTexelFormat.cpp b/libraries/gpu-gles/src/gpu/gl/GLTexelFormat.cpp index a390079322..bff3998573 100644 --- a/libraries/gpu-gles/src/gpu/gl/GLTexelFormat.cpp +++ b/libraries/gpu-gles/src/gpu/gl/GLTexelFormat.cpp @@ -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) { diff --git a/libraries/gpu/src/gpu/Framebuffer.h b/libraries/gpu/src/gpu/Framebuffer.h index b3cf0fbba3..f470cc8aa9 100755 --- a/libraries/gpu/src/gpu/Framebuffer.h +++ b/libraries/gpu/src/gpu/Framebuffer.h @@ -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; diff --git a/libraries/image/src/image/Image.cpp b/libraries/image/src/image/Image.cpp index 172903a65b..58c2b5f938 100644 --- a/libraries/image/src/image/Image.cpp +++ b/libraries/image/src/image/Image.cpp @@ -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); } diff --git a/libraries/script-engine/src/ArrayBufferClass.h b/libraries/script-engine/src/ArrayBufferClass.h index d65693bece..166a21b773 100644 --- a/libraries/script-engine/src/ArrayBufferClass.h +++ b/libraries/script-engine/src/ArrayBufferClass.h @@ -19,7 +19,7 @@ #include #include #include -#include +#include class ScriptEngine; diff --git a/libraries/script-engine/src/ConsoleScriptingInterface.cpp b/libraries/script-engine/src/ConsoleScriptingInterface.cpp index 1e0ca2e42f..b4ef98938d 100644 --- a/libraries/script-engine/src/ConsoleScriptingInterface.cpp +++ b/libraries/script-engine/src/ConsoleScriptingInterface.cpp @@ -15,9 +15,9 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include #include "ConsoleScriptingInterface.h" #include "ScriptEngine.h" -#include #define INDENTATION 4 // 1 Tab - 4 spaces const QString LINE_SEPARATOR = "\n "; diff --git a/libraries/shared/src/PathUtils.cpp b/libraries/shared/src/PathUtils.cpp index cf33cbed2b..22e11464bd 100644 --- a/libraries/shared/src/PathUtils.cpp +++ b/libraries/shared/src/PathUtils.cpp @@ -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 } diff --git a/libraries/shared/src/shared/FileUtils.cpp b/libraries/shared/src/shared/FileUtils.cpp index d326bff1d4..7e1db8b4ca 100644 --- a/libraries/shared/src/shared/FileUtils.cpp +++ b/libraries/shared/src/shared/FileUtils.cpp @@ -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("/"); diff --git a/libraries/ui/src/ui/OffscreenQmlSurface.cpp b/libraries/ui/src/ui/OffscreenQmlSurface.cpp index aa64610930..19ffe96148 100644 --- a/libraries/ui/src/ui/OffscreenQmlSurface.cpp +++ b/libraries/ui/src/ui/OffscreenQmlSurface.cpp @@ -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); diff --git a/libraries/ui/src/ui/TabletScriptingInterface.cpp b/libraries/ui/src/ui/TabletScriptingInterface.cpp index 6e86d75940..0e793fef21 100644 --- a/libraries/ui/src/ui/TabletScriptingInterface.cpp +++ b/libraries/ui/src/ui/TabletScriptingInterface.cpp @@ -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) { diff --git a/libraries/ui/src/ui/types/FileTypeProfile.cpp b/libraries/ui/src/ui/types/FileTypeProfile.cpp index d31f09a981..d090ae6f5d 100644 --- a/libraries/ui/src/ui/types/FileTypeProfile.cpp +++ b/libraries/ui/src/ui/types/FileTypeProfile.cpp @@ -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 \ No newline at end of file diff --git a/libraries/ui/src/ui/types/HFTabletWebEngineRequestInterceptor.h b/libraries/ui/src/ui/types/HFTabletWebEngineRequestInterceptor.h index 5c5f30ce0b..8be2974782 100644 --- a/libraries/ui/src/ui/types/HFTabletWebEngineRequestInterceptor.h +++ b/libraries/ui/src/ui/types/HFTabletWebEngineRequestInterceptor.h @@ -11,26 +11,20 @@ #ifndef hifi_HFTabletWebEngineRequestInterceptor_h #define hifi_HFTabletWebEngineRequestInterceptor_h +#if !defined(Q_OS_ANDROID) #include -#ifndef ANDROID #include -#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 diff --git a/libraries/ui/src/ui/types/HFWebEngineProfile.cpp b/libraries/ui/src/ui/types/HFWebEngineProfile.cpp index a443a7c160..8962a9d61d 100644 --- a/libraries/ui/src/ui/types/HFWebEngineProfile.cpp +++ b/libraries/ui/src/ui/types/HFWebEngineProfile.cpp @@ -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 \ No newline at end of file