diff --git a/libraries/ui/src/ui/TabletScriptingInterface.h b/libraries/ui/src/ui/TabletScriptingInterface.h index 88d4ebe267..04222b3ea1 100644 --- a/libraries/ui/src/ui/TabletScriptingInterface.h +++ b/libraries/ui/src/ui/TabletScriptingInterface.h @@ -39,9 +39,10 @@ class QmlWindowClass; class OffscreenQmlSurface; /**jsdoc - * The Tablet API provides the facilities to work with the system or other tablet. In toolbar mode (Developer > - * UI > Tablet Becomes Toolbar), the tablet's menu buttons are displayed in a toolbar and other tablet content is displayed - * in a dialog. + * The Tablet API provides the facilities to work with the system or other tablet. In toolbar mode (see Developer + * > UI options), the tablet's menu buttons are displayed in a toolbar and other tablet content is displayed in a dialog. + * + *

See also the {@link Toolbars} API for working with toolbars.

* * @namespace Tablet * @@ -98,7 +99,7 @@ public: void setToolbarScriptingInterface(ToolbarScriptingInterface* toolbarScriptingInterface) { _toolbarScriptingInterface = toolbarScriptingInterface; } /**jsdoc - * Gets an instance of a tablet. A new tablet is created if one with the specified ID doesn't already exist. + * Gets an instance of a tablet. A new tablet is created if one with the specified name doesn't already exist. * @function Tablet.getTablet * @param {string} name - A unique name that identifies the tablet. * @returns {TabletProxy} The tablet instance. @@ -210,11 +211,10 @@ private: Q_DECLARE_METATYPE(TabletButtonsProxyModel*); /**jsdoc - * An instance of a tablet. In toolbar mode (Developer > - * UI > Tablet Becomes Toolbar), the tablet's menu buttons are displayed in a toolbar and other tablet content is displayed - * in a dialog. + * An instance of a tablet. In toolbar mode (see Developer > UI options), the tablet's menu buttons are displayed in a + * toolbar and other tablet content is displayed in a dialog. * - *

Create a new tablet or retrieve an existing tablet using {@link Tablet.getTablet}.

+ *

Retrieve an existing tablet or create a new tablet using {@link Tablet.getTablet}.

* * @class TabletProxy * @@ -317,7 +317,7 @@ public: Q_INVOKABLE void returnToPreviousAppImpl(bool localSafeContext); /**jsdoc - *@function TabletProxy#loadQMLOnTopImpl + * @function TabletProxy#loadQMLOnTopImpl * @deprecated This function is deprecated and will be removed. */ // Internal function, do not call from scripts. diff --git a/libraries/ui/src/ui/ToolbarScriptingInterface.h b/libraries/ui/src/ui/ToolbarScriptingInterface.h index 3d38aa296b..746ba2894e 100644 --- a/libraries/ui/src/ui/ToolbarScriptingInterface.h +++ b/libraries/ui/src/ui/ToolbarScriptingInterface.h @@ -19,57 +19,16 @@ class QQuickItem; -/**jsdoc - * @class ToolbarButtonProxy - * - * @hifi-interface - * @hifi-client-entity - * @hifi-avatar - */ +// No JSDoc for ToolbarButtonProxy because ToolbarProxy#addButton() doesn't work. class ToolbarButtonProxy : public QmlWrapper { Q_OBJECT public: ToolbarButtonProxy(QObject* qmlObject, QObject* parent = nullptr); - /**jsdoc - * @function ToolbarButtonProxy#editProperties - * @param {object} properties - */ Q_INVOKABLE void editProperties(const QVariantMap& properties); - - // QmlWrapper methods. - - /**jsdoc - * @function ToolbarButtonProxy#writeProperty - * @parm {string} propertyName - * @param {object} propertyValue - */ - - /**jsdoc - * @function ToolbarButtonProxy#writeProperties - * @param {object} properties - */ - - /**jsdoc - * @function ToolbarButtonProxy#readProperty - * @param {string} propertyName - * @returns {object} - */ - - /**jsdoc - * @function ToolbarButtonProxy#readProperties - * @param {string[]} propertyList - * @returns {object} - */ - signals: - - /**jsdoc - * @function ToolbarButtonProxy#clicked - * @returns {Signal} - */ void clicked(); protected: @@ -80,7 +39,12 @@ protected: Q_DECLARE_METATYPE(ToolbarButtonProxy*); /**jsdoc + * An instance of a toolbar. + * + *

Retrieve an existing toolbar or create a new toolbar using {@link Toolbars.getToolbar}.

+ * * @class ToolbarProxy + * @hideconstructor * * @hifi-interface * @hifi-client-entity @@ -112,32 +76,46 @@ public: // QmlWrapper methods. /**jsdoc + * Sets the value of a toolbar property. A property is added to the toolbar if the named property doesn't already + * exist. * @function ToolbarProxy#writeProperty - * @parm {string} propertyName - * @param {object} propertyValue + * @parm {string} propertyName - The name of the property. Toolbar properties are those in the QML implementation of the + * toolbar. + * @param {object} propertyValue - The value of the property. */ /**jsdoc + * Sets the values of toolbar properties. A property is added to the toolbar if a named property doesn't already + * exist. * @function ToolbarProxy#writeProperties - * @param {object} properties + * @param {object} properties - The names and values of the properties to set. Toolbar properties are those in the QML + * implementation of the toolbar. */ /**jsdoc + * Gets the value of a toolbar property. * @function ToolbarProxy#readProperty - * @param {string} propertyName - * @returns {object} + * @param {string} propertyName - The property name. Toolbar properties are those in the QML implementation of the toolbar. + * @returns {object} The value of the property if the property name is valid, otherwise undefined. */ /**jsdoc + * Gets the values of toolbar properties. * @function ToolbarProxy#readProperties - * @param {string[]} propertyList - * @returns {object} + * @param {string[]} propertyList - The names of the properties to get the values of. Toolbar properties are those in the + * QML implementation of the toolbar. + * @returns {object} The names and values of the specified properties. If the toolbar doesn't have a particular property + * then the result doesn't include that property. */ }; Q_DECLARE_METATYPE(ToolbarProxy*); /**jsdoc + * The Toolbars API provides facilities to work with the system or other toolbar. + * + *

See also the {@link Tablet} API for use of the system tablet and toolbar in desktop and HMD modes.

+ * * @namespace Toolbars * * @hifi-interface @@ -149,13 +127,33 @@ class ToolbarScriptingInterface : public QObject, public Dependency { public: /**jsdoc + * Gets an instance of a toolbar. A new toolbar is created if one with the specified name doesn't already exist. * @function Toolbars.getToolbar - * @param {string} toolbarID - * @returns {ToolbarProxy} + * @param {string} name - A unique name that identifies the toolbar. + * @returns {ToolbarProxy} The toolbar instance. */ Q_INVOKABLE ToolbarProxy* getToolbar(const QString& toolbarId); signals: + /**jsdoc + * Triggered when the visibility of a toolbar changes. + * @function Toolbars.toolbarVisibleChanged + * @param {boolean} isVisible - true if the toolbar is visible, false if it is hidden. + * @param {string} toolbarName - The name of the toolbar. + * @returns {Signal} + * @example Briefly hide the system toolbar. + * Toolbars.toolbarVisibleChanged.connect(function(visible, name) { + * print("Toolbar " + name + " visible changed to " + visible); + * }); + * + * var toolbar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system"); + * if (toolbar) { + * toolbar.writeProperty("visible", false); + * Script.setTimeout(function () { + * toolbar.writeProperty("visible", true); + * }, 2000); + * } + */ void toolbarVisibleChanged(bool isVisible, QString toolbarName); };