Fix ktx_cache path for android. Load the least js scripts for android

This commit is contained in:
Gabriel Calero 2017-12-21 16:40:21 -03:00
parent ef8ba1cad0
commit fc62b2d34a
4 changed files with 65 additions and 1 deletions

View file

@ -5932,7 +5932,9 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEnginePointe
scriptEngine->registerGetterSetter("location", LocationScriptingInterface::locationGetter,
LocationScriptingInterface::locationSetter);
#ifndef ANDROID
scriptEngine->registerFunction("OverlayWebWindow", QmlWebWindowClass::constructor);
#endif
scriptEngine->registerFunction("OverlayWindow", QmlWindowClass::constructor);
scriptEngine->registerGlobalObject("Menu", MenuScriptingInterface::getInstance());
@ -5984,6 +5986,9 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEnginePointe
scriptEngine->registerGlobalObject("UserActivityLogger", DependencyManager::get<UserActivityLoggerScriptingInterface>().data());
scriptEngine->registerGlobalObject("Users", DependencyManager::get<UsersScriptingInterface>().data());
scriptEngine->registerGlobalObject("App", this);
scriptEngine->registerFunction("App", "isAndroid", Application::isAndroid, 0);
scriptEngine->registerGlobalObject("LimitlessSpeechRecognition", DependencyManager::get<LimitlessVoiceRecognitionScriptingInterface>().data());
scriptEngine->registerGlobalObject("GooglePoly", DependencyManager::get<GooglePolyScriptingInterface>().data());
@ -7567,6 +7572,18 @@ void Application::updateThreadPoolCount() const {
QThreadPool::globalInstance()->setMaxThreadCount(threadPoolSize);
}
QScriptValue Application::isAndroid(QScriptContext* context, QScriptEngine* engine) {
return QScriptValue(engine, isAndroid());
}
bool Application::isAndroid() {
#ifdef Q_OS_ANDROID
return true;
#else
return false;
#endif
}
void Application::updateSystemTabletMode() {
qApp->setProperty(hifi::properties::HMD, isHMDMode());
if (isHMDMode()) {

View file

@ -282,6 +282,9 @@ public:
bool getSaveAvatarOverrideUrl() { return _saveAvatarOverrideUrl; }
void saveNextPhysicsStats(QString filename);
static Q_INVOKABLE QScriptValue isAndroid(QScriptContext* context, QScriptEngine* engine);
static bool isAndroid();
signals:
void svoImportRequested(const QString& url);

View file

@ -32,6 +32,8 @@ QString TEMP_DIR_FORMAT { "%1-%2-%3" };
const QString& PathUtils::resourcesPath() {
#ifdef Q_OS_MAC
static const QString staticResourcePath = QCoreApplication::applicationDirPath() + "/../Resources/";
#elif defined (ANDROID)
static const QString staticResourcePath = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/resources/";
#else
static const QString staticResourcePath = QCoreApplication::applicationDirPath() + "/resources/";
#endif
@ -72,7 +74,11 @@ QString PathUtils::getAppLocalDataPath() {
}
// otherwise return standard path
#ifndef Q_OS_ANDROID
return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + "/";
#else
return QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/";
#endif
}
QString PathUtils::getAppDataFilePath(const QString& filename) {

View file

@ -12,6 +12,16 @@
//
var DEFAULT_SCRIPTS_COMBINED = [
];
function pushAll(dest, orig) {
for (var k in orig) {
dest.push(orig[k]);
}
}
if (!App.isAndroid()) {
pushAll(DEFAULT_SCRIPTS_COMBINED, [
"system/progress.js",
"system/away.js",
"system/audio.js",
@ -30,12 +40,40 @@ var DEFAULT_SCRIPTS_COMBINED = [
"system/dialTone.js",
"system/firstPersonHMD.js",
"system/tablet-ui/tabletUI.js"
];
]);
} else {
pushAll(DEFAULT_SCRIPTS_COMBINED, [
"system/progress.js"/*,
"system/away.js",
"system/controllers/controllerDisplayManager.js",
"system/controllers/handControllerGrabAndroid.js",
"system/controllers/handControllerPointerAndroid.js",
"system/controllers/squeezeHands.js",
"system/controllers/grab.js",
"system/controllers/teleport.js",
"system/controllers/toggleAdvancedMovementForHandControllers.js",
"system/dialTone.js",
"system/firstPersonHMD.js",
"system/bubble.js",
"system/android.js",
"developer/debugging/debugAndroidMouse.js"*/
]);
}
var DEFAULT_SCRIPTS_SEPARATE = [
"system/controllers/controllerScripts.js"
//"system/chat.js"
];
if (!App.isAndroid()) {
pushAll(DEFAULT_SCRIPTS_SEPARATE, [
"system/controllers/controllerScripts.js"
]);
} else {
pushAll(DEFAULT_SCRIPTS_SEPARATE, []);
}
// add a menu item for debugging
var MENU_CATEGORY = "Developer";
var MENU_ITEM = "Debug defaultScripts.js";