History

Continued tightening and testing of the scripting engine "glue" logic - QObject wrappers will now be reused when asked to wrap the same QObject multiple times - improved error reporting when we can't form a native call from script - dropped support for having the existing QtScript logic handle Qt object transformations - assuming that our code will handle all calls into native objects - changing timer functions to use CTimer* publicly rather than casted QObject*

Heather Anderson committed 4 years ago

Commit 55b5a2c1 parent 742fa2211 files · +262 −382Browse files

Showing the changes to libraries/script-engine/src/ScriptManager.cpp (1 of 11 files). Show all

Unified · Split

libraries/script-engine/src/ScriptManager.cpp+3−6
@@ -79,9 +79,6 @@ static const ScriptValue::PropertyFlags READONLY_HIDDEN_PROP_FLAGS{ READONLY_PRO · 78 unmodified lines
79 79
80static const bool HIFI_AUTOREFRESH_FILE_SCRIPTS { true };80static const bool HIFI_AUTOREFRESH_FILE_SCRIPTS { true };
81 81
82Q_DECLARE_METATYPE(ScriptEngine::FunctionSignature)
83int functionSignatureMetaID = qRegisterMetaType<ScriptEngine::FunctionSignature>();
84
85int scriptManagerPointerMetaID = qRegisterMetaType<ScriptManagerPointer>();82int scriptManagerPointerMetaID = qRegisterMetaType<ScriptManagerPointer>();
86 83
87Q_DECLARE_METATYPE(ExternalResource::Bucket);84Q_DECLARE_METATYPE(ExternalResource::Bucket);
@@ -1054,7 +1051,7 @@ void ScriptManager::timerFired() { · 966 unmodified lines
1054 }1051 }
1055}1052}
1056 1053
1057QObject* ScriptManager::setupTimerWithInterval(const ScriptValue& function, int intervalMS, bool isSingleShot) {1054QTimer* ScriptManager::setupTimerWithInterval(const ScriptValue& function, int intervalMS, bool isSingleShot) {
1058 // create the timer, add it to the map, and start it1055 // create the timer, add it to the map, and start it
1059 QTimer* newTimer = new QTimer(this);1056 QTimer* newTimer = new QTimer(this);
1060 newTimer->setSingleShot(isSingleShot);1057 newTimer->setSingleShot(isSingleShot);
@@ -1078,7 +1075,7 @@ QObject* ScriptManager::setupTimerWithInterval(const ScriptValue& function, int · 17 unmodified lines
1078 return newTimer;1075 return newTimer;
1079}1076}
1080 1077
1081QObject* ScriptManager::setInterval(const ScriptValue& function, int intervalMS) {1078QTimer* ScriptManager::setInterval(const ScriptValue& function, int intervalMS) {
1082 if (isStopped()) {1079 if (isStopped()) {
1083 scriptWarningMessage("Script.setInterval() while shutting down is ignored... parent script:" + getFilename());1080 scriptWarningMessage("Script.setInterval() while shutting down is ignored... parent script:" + getFilename());
1084 return NULL; // bail early1081 return NULL; // bail early
@@ -1087,7 +1084,7 @@ QObject* ScriptManager::setInterval(const ScriptValue& function, int intervalMS) · 2 unmodified lines
1087 return setupTimerWithInterval(function, intervalMS, false);1084 return setupTimerWithInterval(function, intervalMS, false);
1088}1085}
1089 1086
1090QObject* ScriptManager::setTimeout(const ScriptValue& function, int timeoutMS) {1087QTimer* ScriptManager::setTimeout(const ScriptValue& function, int timeoutMS) {
1091 if (isStopped()) {1088 if (isStopped()) {
1092 scriptWarningMessage("Script.setTimeout() while shutting down is ignored... parent script:" + getFilename());1089 scriptWarningMessage("Script.setTimeout() while shutting down is ignored... parent script:" + getFilename());
1093 return NULL; // bail early1090 return NULL; // bail early