Deprecate items that shouldn't be in the Script API

This commit is contained in:
David Rowe 2019-05-11 09:29:13 +12:00
parent d196e35701
commit 0a0a25139c
2 changed files with 72 additions and 50 deletions

View file

@ -178,18 +178,20 @@ public:
/**jsdoc /**jsdoc
* @function Script.registerGlobalObject * @function Script.registerGlobalObject
* @param {string} name * @param {string} name - Name.
* @param {object} object * @param {object} object - Object.
* @deprecated This function is deprecated and will be removed.
*/ */
/// registers a global object by name /// registers a global object by name
Q_INVOKABLE void registerGlobalObject(const QString& name, QObject* object); Q_INVOKABLE void registerGlobalObject(const QString& name, QObject* object);
/**jsdoc /**jsdoc
* @function Script.registerGetterSetter * @function Script.registerGetterSetter
* @param {string} name * @param {string} name - Name.
* @param {object} getter * @param {object} getter - Getter.
* @param {object} setter * @param {object} setter - Setter.
* @param {string} [parent=""] * @param {string} [parent=""] - Parent.
* @deprecated This function is deprecated and will be removed.
*/ */
/// registers a global getter/setter /// registers a global getter/setter
Q_INVOKABLE void registerGetterSetter(const QString& name, QScriptEngine::FunctionSignature getter, Q_INVOKABLE void registerGetterSetter(const QString& name, QScriptEngine::FunctionSignature getter,
@ -197,19 +199,21 @@ public:
/**jsdoc /**jsdoc
* @function Script.registerFunction * @function Script.registerFunction
* @param {string} name * @param {string} name - Name.
* @param {object} function * @param {object} function - Function.
* @param {number} [numArguments=-1] * @param {number} [numArguments=-1] - Number of arguments.
* @deprecated This function is deprecated and will be removed.
*/ */
/// register a global function /// register a global function
Q_INVOKABLE void registerFunction(const QString& name, QScriptEngine::FunctionSignature fun, int numArguments = -1); Q_INVOKABLE void registerFunction(const QString& name, QScriptEngine::FunctionSignature fun, int numArguments = -1);
/**jsdoc /**jsdoc
* @function Script.registerFunction * @function Script.registerFunction
* @param {string} parent * @param {string} parent - Parent.
* @param {string} name * @param {string} name - Name.
* @param {object} function * @param {object} function - Function.
* @param {number} [numArguments=-1] * @param {number} [numArguments=-1] - Number of arguments.
* @deprecated This function is deprecated and will be removed.
*/ */
/// register a function as a method on a previously registered global object /// register a function as a method on a previously registered global object
Q_INVOKABLE void registerFunction(const QString& parent, const QString& name, QScriptEngine::FunctionSignature fun, Q_INVOKABLE void registerFunction(const QString& parent, const QString& name, QScriptEngine::FunctionSignature fun,
@ -217,27 +221,30 @@ public:
/**jsdoc /**jsdoc
* @function Script.registerValue * @function Script.registerValue
* @param {string} name * @param {string} name - Name.
* @param {object} value * @param {object} value - Value.
* @deprecated This function is deprecated and will be removed.
*/ */
/// registers a global object by name /// registers a global object by name
Q_INVOKABLE void registerValue(const QString& valueName, QScriptValue value); Q_INVOKABLE void registerValue(const QString& valueName, QScriptValue value);
/**jsdoc /**jsdoc
* @function Script.evaluate * @function Script.evaluate
* @param {string} program * @param {string} program - Program.
* @param {string} filename * @param {string} filename - File name.
* @param {number} [lineNumber=-1] * @param {number} [lineNumber=-1] - Line number.
* @returns {object} * @returns {object} Object.
* @deprecated This function is deprecated and will be removed.
*/ */
/// evaluate some code in the context of the ScriptEngine and return the result /// evaluate some code in the context of the ScriptEngine and return the result
Q_INVOKABLE QScriptValue evaluate(const QString& program, const QString& fileName, int lineNumber = 1); // this is also used by the script tool widget Q_INVOKABLE QScriptValue evaluate(const QString& program, const QString& fileName, int lineNumber = 1); // this is also used by the script tool widget
/**jsdoc /**jsdoc
* @function Script.evaluateInClosure * @function Script.evaluateInClosure
* @param {object} locals * @param {object} locals - Locals.
* @param {object} program * @param {object} program - Program.
* @returns {object} * @returns {object} Object.
* @deprecated This function is deprecated and will be removed.
*/ */
Q_INVOKABLE QScriptValue evaluateInClosure(const QScriptValue& locals, const QScriptProgram& program); Q_INVOKABLE QScriptValue evaluateInClosure(const QScriptValue& locals, const QScriptProgram& program);
@ -495,21 +502,24 @@ public:
/**jsdoc /**jsdoc
* @function Script.loadEntityScript * @function Script.loadEntityScript
* @param {Uuid} entityID * @param {Uuid} entityID - Entity IUD.
* @param {string} script * @param {string} script - Script.
* @param {boolean} forceRedownload * @param {boolean} forceRedownload - Force re-download.
* @deprecated This function is deprecated and will be removed.
*/ */
Q_INVOKABLE void loadEntityScript(const EntityItemID& entityID, const QString& entityScript, bool forceRedownload); Q_INVOKABLE void loadEntityScript(const EntityItemID& entityID, const QString& entityScript, bool forceRedownload);
/**jsdoc /**jsdoc
* @function Script.unloadEntityScript * @function Script.unloadEntityScript
* @param {Uuid} entityID * @param {Uuid} entityID - Entity ID.
* @param {boolean} [shouldRemoveFromMap=false] * @param {boolean} [shouldRemoveFromMap=false] - Should remove from map.
* @deprecated This function is deprecated and will be removed.
*/ */
Q_INVOKABLE void unloadEntityScript(const EntityItemID& entityID, bool shouldRemoveFromMap = false); // will call unload method Q_INVOKABLE void unloadEntityScript(const EntityItemID& entityID, bool shouldRemoveFromMap = false); // will call unload method
/**jsdoc /**jsdoc
* @function Script.unloadAllEntityScripts * @function Script.unloadAllEntityScripts
* @deprecated This function is deprecated and will be removed.
*/ */
Q_INVOKABLE void unloadAllEntityScripts(); Q_INVOKABLE void unloadAllEntityScripts();
@ -548,7 +558,8 @@ public:
/**jsdoc /**jsdoc
* @function Script.generateUUID * @function Script.generateUUID
* @returns {Uuid} * @returns {Uuid} A new UUID.
* @deprecated This function is deprecated and will be removed. Use {@link Uuid.generate} instead.
*/ */
Q_INVOKABLE QUuid generateUUID() { return QUuid::createUuid(); } Q_INVOKABLE QUuid generateUUID() { return QUuid::createUuid(); }
@ -605,7 +616,8 @@ public slots:
/**jsdoc /**jsdoc
* @function Script.updateMemoryCost * @function Script.updateMemoryCost
* @param {number} deltaSize * @param {number} deltaSize - Delta size.
* @deprecated This function is deprecated and will be removed.
*/ */
void updateMemoryCost(const qint64&); void updateMemoryCost(const qint64&);
@ -657,16 +669,18 @@ signals:
/**jsdoc /**jsdoc
* @function Script.finished * @function Script.finished
* @param {string} filename * @param {string} filename - File name.
* @param {object} engine * @param {object} engine - Engine.
* @returns {Signal} * @returns {Signal}
* @deprecated This signal is deprecated and will be removed.
*/ */
void finished(const QString& fileNameString, ScriptEnginePointer); void finished(const QString& fileNameString, ScriptEnginePointer);
/**jsdoc /**jsdoc
* @function Script.cleanupMenuItem * @function Script.cleanupMenuItem
* @param {string} menuItem * @param {string} menuItem - Menu item.
* @returns {Signal} * @returns {Signal}
* @deprecated This signal is deprecated and will be removed.
*/ */
void cleanupMenuItem(const QString& menuItemString); void cleanupMenuItem(const QString& menuItemString);
@ -711,6 +725,7 @@ signals:
/**jsdoc /**jsdoc
* @function Script.clearDebugWindow * @function Script.clearDebugWindow
* @returns {Signal} * @returns {Signal}
* @deprecated This signal is deprecated and will be removed.
*/ */
void clearDebugWindow(); void clearDebugWindow();
@ -739,6 +754,7 @@ signals:
/**jsdoc /**jsdoc
* @function Script.entityScriptDetailsUpdated * @function Script.entityScriptDetailsUpdated
* @returns {Signal} * @returns {Signal}
* @deprecated This signal is deprecated and will be removed.
*/ */
// Emitted when an entity script is added or removed, or when the status of an entity // Emitted when an entity script is added or removed, or when the status of an entity
// script is updated (goes from RUNNING to ERROR_RUNNING_SCRIPT, for example) // script is updated (goes from RUNNING to ERROR_RUNNING_SCRIPT, for example)
@ -757,16 +773,18 @@ protected:
/**jsdoc /**jsdoc
* @function Script.executeOnScriptThread * @function Script.executeOnScriptThread
* @param {object} function * @param {object} function - Function.
* @param {ConnectionType} [type=2] * @param {ConnectionType} [type=2] - Connection type.
* @deprecated This function is deprecated and will be removed.
*/ */
Q_INVOKABLE void executeOnScriptThread(std::function<void()> function, const Qt::ConnectionType& type = Qt::QueuedConnection ); Q_INVOKABLE void executeOnScriptThread(std::function<void()> function, const Qt::ConnectionType& type = Qt::QueuedConnection );
/**jsdoc /**jsdoc
* @function Script._requireResolve * @function Script._requireResolve
* @param {string} module * @param {string} module - Module.
* @param {string} [relativeTo=""] * @param {string} [relativeTo=""] - Relative to.
* @returns {string} * @returns {string} Result.
* @deprecated This function is deprecated and will be removed.
*/ */
// note: this is not meant to be called directly, but just to have QMetaObject take care of wiring it up in general; // note: this is not meant to be called directly, but just to have QMetaObject take care of wiring it up in general;
// then inside of init() we just have to do "Script.require.resolve = Script._requireResolve;" // then inside of init() we just have to do "Script.require.resolve = Script._requireResolve;"
@ -789,12 +807,13 @@ protected:
/**jsdoc /**jsdoc
* @function Script.entityScriptContentAvailable * @function Script.entityScriptContentAvailable
* @param {Uuid} entityID * @param {Uuid} entityID - Entity ID.
* @param {string} scriptOrURL * @param {string} scriptOrURL - Path.
* @param {string} contents * @param {string} contents - Contents.
* @param {boolean} isURL * @param {boolean} isURL - Is URL.
* @param {boolean} success * @param {boolean} success - Success.
* @param {string} status * @param {string} status - Status.
* @deprecated This function is deprecated and will be removed.
*/ */
Q_INVOKABLE void entityScriptContentAvailable(const EntityItemID& entityID, const QString& scriptOrURL, const QString& contents, bool isURL, bool success, const QString& status); Q_INVOKABLE void entityScriptContentAvailable(const EntityItemID& entityID, const QString& scriptOrURL, const QString& contents, bool isURL, bool success, const QString& status);

View file

@ -42,17 +42,19 @@ public:
/**jsdoc /**jsdoc
* @function Script.makeError * @function Script.makeError
* @param {object} [other] * @param {object} [other] - Other.
* @param {string} [type="Error"] * @param {string} [type="Error"] - Errorl
* @returns {object} * @returns {object} Object.
* @deprecated This function is deprecated and will be removed.
*/ */
Q_INVOKABLE QScriptValue makeError(const QScriptValue& other = QScriptValue(), const QString& type = "Error"); Q_INVOKABLE QScriptValue makeError(const QScriptValue& other = QScriptValue(), const QString& type = "Error");
/**jsdoc /**jsdoc
* @function Script.formatExecption * @function Script.formatExecption
* @param {object} exception * @param {object} exception - Exception.
* @param {boolean} inludeExtendeDetails * @param {boolean} inludeExtendeDetails - Include extended details.
* @returns {string} * @returns {string} String.
* @deprecated This function is deprecated and will be removed.
*/ */
Q_INVOKABLE QString formatException(const QScriptValue& exception, bool includeExtendedDetails); Q_INVOKABLE QString formatException(const QScriptValue& exception, bool includeExtendedDetails);
@ -71,8 +73,9 @@ public:
signals: signals:
/**jsdoc /**jsdoc
* @function Script.signalHandlerException * @function Script.signalHandlerException
* @param {object} exception * @param {object} exception - Exception.
* @returns {Signal} * @returns {Signal}
* @deprecated This signal is deprecated and will be removed.
*/ */
// Script.signalHandlerException is exposed by QScriptEngine. // Script.signalHandlerException is exposed by QScriptEngine.