mirror of
https://github.com/lubosz/overte.git
synced 2025-04-16 21:46:34 +02:00
Don't save test scripts
This commit is contained in:
parent
481eddb2a3
commit
c3ef6aab1c
3 changed files with 11 additions and 13 deletions
|
@ -526,6 +526,9 @@ public:
|
|||
void setUserLoaded(bool isUserLoaded) { _isUserLoaded = isUserLoaded; }
|
||||
bool isUserLoaded() const { return _isUserLoaded; }
|
||||
|
||||
void setQuitWhenFinished(const bool quitWhenFinished) { _quitWhenFinished = quitWhenFinished; }
|
||||
bool isQuitWhenFinished() const { return _quitWhenFinished; }
|
||||
|
||||
// NOTE - this is used by the TypedArray implementation. we need to review this for thread safety
|
||||
ArrayBufferClass* getArrayBufferClass() { return _arrayBufferClass; }
|
||||
|
||||
|
@ -768,6 +771,8 @@ protected:
|
|||
std::atomic<bool> _isUserLoaded { false };
|
||||
bool _isReloading { false };
|
||||
|
||||
std::atomic<bool> _quitWhenFinished;
|
||||
|
||||
ArrayBufferClass* _arrayBufferClass;
|
||||
|
||||
AssetScriptingInterface* _assetScriptingInterface;
|
||||
|
|
|
@ -347,7 +347,8 @@ void ScriptEngines::saveScripts() {
|
|||
{
|
||||
QReadLocker lock(&_scriptEnginesHashLock);
|
||||
for (auto it = _scriptEnginesHash.begin(); it != _scriptEnginesHash.end(); ++it) {
|
||||
if (it.value() && it.value()->isUserLoaded()) {
|
||||
// Save user-loaded scripts, only if they are set to quit when finished
|
||||
if (it.value() && it.value()->isUserLoaded() && !it.value()->isQuitWhenFinished()) {
|
||||
auto normalizedUrl = normalizeScriptURL(it.key());
|
||||
list.append(normalizedUrl.toString());
|
||||
}
|
||||
|
@ -456,7 +457,7 @@ void ScriptEngines::reloadAllScripts() {
|
|||
}
|
||||
|
||||
ScriptEnginePointer ScriptEngines::loadScript(const QUrl& scriptFilename, bool isUserLoaded, bool loadScriptFromEditor,
|
||||
bool activateMainWindow, bool reload, bool exitWhenFinished) {
|
||||
bool activateMainWindow, bool reload, bool quitWhenFinished) {
|
||||
if (thread() != QThread::currentThread()) {
|
||||
ScriptEnginePointer result { nullptr };
|
||||
BLOCKING_INVOKE_METHOD(this, "loadScript", Q_RETURN_ARG(ScriptEnginePointer, result),
|
||||
|
@ -488,6 +489,7 @@ ScriptEnginePointer ScriptEngines::loadScript(const QUrl& scriptFilename, bool i
|
|||
scriptEngine = ScriptEnginePointer(new ScriptEngine(_context, NO_SCRIPT, "about:" + scriptFilename.fileName()));
|
||||
addScriptEngine(scriptEngine);
|
||||
scriptEngine->setUserLoaded(isUserLoaded);
|
||||
scriptEngine->setQuitWhenFinished(quitWhenFinished);
|
||||
|
||||
if (scriptFilename.isEmpty() || !scriptUrl.isValid()) {
|
||||
launchScriptEngine(scriptEngine);
|
||||
|
@ -496,11 +498,6 @@ ScriptEnginePointer ScriptEngines::loadScript(const QUrl& scriptFilename, bool i
|
|||
connect(scriptEngine.data(), &ScriptEngine::scriptLoaded, this, &ScriptEngines::onScriptEngineLoaded);
|
||||
connect(scriptEngine.data(), &ScriptEngine::errorLoadingScript, this, &ScriptEngines::onScriptEngineError);
|
||||
|
||||
// Shutdown Interface when script finishes, if requested
|
||||
if (exitWhenFinished) {
|
||||
connect(scriptEngine.data(), &ScriptEngine::finished, this, &ScriptEngines::exitWhenFinished);
|
||||
}
|
||||
|
||||
// get the script engine object to load the script at the designated script URL
|
||||
scriptEngine->loadURL(scriptUrl, reload);
|
||||
}
|
||||
|
@ -541,10 +538,6 @@ void ScriptEngines::onScriptEngineLoaded(const QString& rawScriptURL) {
|
|||
emit scriptCountChanged();
|
||||
}
|
||||
|
||||
void ScriptEngines::exitWhenFinished() {
|
||||
qApp->quit();
|
||||
}
|
||||
|
||||
int ScriptEngines::runScriptInitializers(ScriptEnginePointer scriptEngine) {
|
||||
int ii=0;
|
||||
for (auto initializer : _scriptInitializers) {
|
||||
|
|
|
@ -88,10 +88,11 @@ public:
|
|||
* @param {boolean} [loadScriptFromEditor=false]
|
||||
* @param {boolean} [activateMainWindow=false]
|
||||
* @param {boolean} [reload=false]
|
||||
* @param {boolean} [quitWhenFinished=false]
|
||||
* @returns {boolean}
|
||||
*/
|
||||
Q_INVOKABLE ScriptEnginePointer loadScript(const QUrl& scriptFilename = QString(),
|
||||
bool isUserLoaded = true, bool loadScriptFromEditor = false, bool activateMainWindow = false, bool reload = false, bool exitWhenFinished = false);
|
||||
bool isUserLoaded = true, bool loadScriptFromEditor = false, bool activateMainWindow = false, bool reload = false, bool quitWhenFinished = false);
|
||||
|
||||
/**jsdoc
|
||||
* @function ScriptDiscoveryService.stopScript
|
||||
|
@ -266,7 +267,6 @@ protected:
|
|||
ScriptEnginePointer reloadScript(const QString& scriptName, bool isUserLoaded = true) { return loadScript(scriptName, isUserLoaded, false, false, true); }
|
||||
void removeScriptEngine(ScriptEnginePointer);
|
||||
void onScriptEngineLoaded(const QString& scriptFilename);
|
||||
void exitWhenFinished();
|
||||
void onScriptEngineError(const QString& scriptFilename);
|
||||
void launchScriptEngine(ScriptEnginePointer);
|
||||
|
||||
|
|
Loading…
Reference in a new issue