*/ void updateMessageBox(int id, QString title, QString text, int buttons, int defaultButton); /**jsdoc * Close a message box that was opened with {@link Window.openMessageBox|openMessageBox}. * @function Window.closeMessageBox * @param {number} id - The ID of the message box. */ void closeMessageBox(int id); private slots: void onMessageBoxSelected(int button); void disconnectedFromDomain(); signals: /**jsdoc * Triggered when you change the domain you're visiting. <strong>Warning:</strong> Is not emitted if you go to domain that * isn't running. * @function Window.domainChanged * @param {string} domain - The domain's IP address. * @returns {Signal} * @example <caption>Report when you change domains.</caption> * function onDomainChanged(domain) { * print("Domain changed: " + domain); * } * * Window.domainChanged.connect(onDomainChanged); */ void domainChanged(const QString& domain, const QUrl& serverlessDomainURL); /**jsdoc * Triggered when you try to navigate to a *.json, *.svo, or *.svo.json URL in a Web browser within Interface. * @function Window.svoImportRequested * @param {string} url - The URL of the file to import. * @returns {Signal} */ void svoImportRequested(const QString& url); /**jsdoc * Triggered when you try to visit a domain but are refused connection. * @function Window.domainConnectionRefused * @param {string} reasonMessage - A description of the refusal. * @param {Window.ConnectionRefusedReason} reasonCode - Integer number that enumerates the reason for the refusal. * @param {string} extraInfo - Extra information about the refusal. * @returns {Signal} */ void domainConnectionRefused(const QString& reasonMessage, int reasonCode, const QString& extraInfo); /**jsdoc * Triggered when a still snapshot has been taken by calling {@link Window.takeSnapshot|takeSnapshot} with * <code>includeAnimated = false</code> or {@link Window.takeSecondaryCameraSnapshot|takeSecondaryCameraSnapshot}. * @function Window.stillSnapshotTaken * @param {string} pathStillSnapshot - The path and name of the snapshot image file. * @param {boolean} notify - The value of the <code>notify</code> parameter that {@link Window.takeSnapshot|takeSnapshot} * was called with. * @returns {Signal} */ void stillSnapshotTaken(const QString& pathStillSnapshot, bool notify); /**jsdoc * Triggered when a snapshot submitted via {@link Window.shareSnapshot|shareSnapshot} is ready for sharing. The snapshot * may then be shared via the {@link Account.metaverseServerURL} Web API. * @function Window.snapshotShared * @param {boolean} isError - <code>true</code> if an error was encountered preparing the snapshot for sharing, otherwise * <code>false</code>. * @param {string} reply - JSON-formatted information about the snapshot. * @returns {Signal} */ void snapshotShared(bool isError, const QString& reply); /**jsdoc * Triggered when the snapshot images have been captured by {@link Window.takeSnapshot|takeSnapshot} and the GIF is * starting to be processed. * @function Window.processingGifStarted * @param {string} pathStillSnapshot - The path and name of the still snapshot image file. * @returns {Signal} */ void processingGifStarted(const QString& pathStillSnapshot); /**jsdoc * Triggered when a GIF has been prepared of the snapshot images captured by {@link Window.takeSnapshot|takeSnapshot}. * @function Window.processingGifCompleted * @param {string} pathAnimatedSnapshot - The path and name of the moving snapshot GIF file. * @returns {Signal} */ void processingGifCompleted(const QString& pathAnimatedSnapshot); /**jsdoc * Triggered when you've successfully made a user connection. * @function Window.connectionAdded * @param {string} message - A description of the success. * @returns {Signal} */ void connectionAdded(const QString& connectionName); /**jsdoc * Triggered when you failed to make a user connection. * @function Window.connectionError * @param {string} message - A description of the error. * @returns {Signal} */ void connectionError(const QString& errorString); /**jsdoc * Triggered when a message is announced by {@link Window.displayAnnouncement|displayAnnouncement}. * @function Window.announcement * @param {string} message - The message text. * @returns {Signal} */ void announcement(const QString& message); /**jsdoc * Triggered when the user closes a message box that was opened with {@link Window.openMessageBox|openMessageBox}. * @function Window.messageBoxClosed * @param {number} id - The ID of the message box that was closed. * @param {number} button - The button that the user clicked. If the user presses Esc, the Cancel button value is returned, * whether or not the Cancel button is displayed in the message box. * @returns {Signal} */ void messageBoxClosed(int id, int button); /**jsdoc * Triggered when the user chooses a directory in a {@link Window.browseDirAsync|browseDirAsync} dialog. * @function Window.browseDirChanged * @param {string} directory - The directory the user chose in the dialog. * @returns {Signal} */ void browseDirChanged(QString browseDir); /**jsdoc * Triggered when the user chooses an asset in a {@link Window.browseAssetsAsync|browseAssetsAsync} dialog. * @function Window.assetsDirChanged * @param {string} asset - The path and name of the asset the user chose in the dialog. * @returns {Signal} */ void assetsDirChanged(QString assetsDir); /**jsdoc * Triggered when the user specifies a file in a {@link Window.saveAsync|saveAsync} dialog. * @function Window.saveFileChanged * @param {string} filename - The path and name of the file that the user specified in the dialog. * @returns {Signal} */ void saveFileChanged(QString filename); /**jsdoc * Triggered when the user chooses a file in a {@link Window.browseAsync|browseAsync} dialog. * @function Window.browseChanged * @param {string} filename - The path and name of the file the user chose in the dialog. * @returns {Signal} */ void browseChanged(QString filename); /**jsdoc * Triggered when the user chooses a file in a {@link Window.browseAsync|browseAsync} dialog. * @function Window.openFileChanged * @deprecated This signal is being replaced with {@link Window.browseChanged|browseChanged} and will be removed. * @param {string} filename - The path and name of the file the user chose in the dialog. * @returns {Signal} */ void openFileChanged(QString filename); /**jsdoc * Triggered when the user OKs a {@link Window.promptAsync|promptAsync} dialog. * @function Window.promptTextChanged * @param {string} text - The text the user entered in the dialog. * @returns {Signal} */ void promptTextChanged(QString text); /**jsdoc * Triggered when the position or size of the Interface window changes. * @function Window.geometryChanged * @param {Rect} geometry - The position and size of the drawable area of the Interface window. * @returns {Signal} * @example <caption>Report the position of size of the Interface window when it changes.</caption> * function onWindowGeometryChanged(rect) { * print("Window geometry: " + JSON.stringify(rect)); * } * * Window.geometryChanged.connect(onWindowGeometryChanged); */ void geometryChanged(QRect geometry); private: QString getPreviousBrowseLocation() const; void setPreviousBrowseLocation(const QString& location); QString getPreviousBrowseAssetLocation() const; void setPreviousBrowseAssetLocation(const QString& location); void ensureReticleVisible() const; int createMessageBox(QString title, QString text, int buttons, int defaultButton); QHash<int, QQuickItem*> _messageBoxes; int _lastMessageBoxID{ -1 };}; #endif // hifi_WindowScriptingInterface_hLines 501–703 of 703. Previous lines
*/ void updateMessageBox(int id, QString title, QString text, int buttons, int defaultButton); /**jsdoc * Close a message box that was opened with {@link Window.openMessageBox|openMessageBox}. * @function Window.closeMessageBox * @param {number} id - The ID of the message box. */ void closeMessageBox(int id); private slots: void onMessageBoxSelected(int button); void disconnectedFromDomain(); signals: /**jsdoc * Triggered when you change the domain you're visiting. <strong>Warning:</strong> Is not emitted if you go to domain that * isn't running. * @function Window.domainChanged * @param {string} domain - The domain's IP address. * @returns {Signal} * @example <caption>Report when you change domains.</caption> * function onDomainChanged(domain) { * print("Domain changed: " + domain); * } * * Window.domainChanged.connect(onDomainChanged); */ void domainChanged(const QString& domain, const QUrl& serverlessDomainURL); /**jsdoc * Triggered when you try to navigate to a *.json, *.svo, or *.svo.json URL in a Web browser within Interface. * @function Window.svoImportRequested * @param {string} url - The URL of the file to import. * @returns {Signal} */ void svoImportRequested(const QString& url); /**jsdoc * Triggered when you try to visit a domain but are refused connection. * @function Window.domainConnectionRefused * @param {string} reasonMessage - A description of the refusal. * @param {Window.ConnectionRefusedReason} reasonCode - Integer number that enumerates the reason for the refusal. * @param {string} extraInfo - Extra information about the refusal. * @returns {Signal} */ void domainConnectionRefused(const QString& reasonMessage, int reasonCode, const QString& extraInfo); /**jsdoc * Triggered when a still snapshot has been taken by calling {@link Window.takeSnapshot|takeSnapshot} with * <code>includeAnimated = false</code> or {@link Window.takeSecondaryCameraSnapshot|takeSecondaryCameraSnapshot}. * @function Window.stillSnapshotTaken * @param {string} pathStillSnapshot - The path and name of the snapshot image file. * @param {boolean} notify - The value of the <code>notify</code> parameter that {@link Window.takeSnapshot|takeSnapshot} * was called with. * @returns {Signal} */ void stillSnapshotTaken(const QString& pathStillSnapshot, bool notify); /**jsdoc * Triggered when a snapshot submitted via {@link Window.shareSnapshot|shareSnapshot} is ready for sharing. The snapshot * may then be shared via the {@link Account.metaverseServerURL} Web API. * @function Window.snapshotShared * @param {boolean} isError - <code>true</code> if an error was encountered preparing the snapshot for sharing, otherwise * <code>false</code>. * @param {string} reply - JSON-formatted information about the snapshot. * @returns {Signal} */ void snapshotShared(bool isError, const QString& reply); /**jsdoc * Triggered when the snapshot images have been captured by {@link Window.takeSnapshot|takeSnapshot} and the GIF is * starting to be processed. * @function Window.processingGifStarted * @param {string} pathStillSnapshot - The path and name of the still snapshot image file. * @returns {Signal} */ void processingGifStarted(const QString& pathStillSnapshot); /**jsdoc * Triggered when a GIF has been prepared of the snapshot images captured by {@link Window.takeSnapshot|takeSnapshot}. * @function Window.processingGifCompleted * @param {string} pathAnimatedSnapshot - The path and name of the moving snapshot GIF file. * @returns {Signal} */ void processingGifCompleted(const QString& pathAnimatedSnapshot); /**jsdoc * Triggered when you've successfully made a user connection. * @function Window.connectionAdded * @param {string} message - A description of the success. * @returns {Signal} */ void connectionAdded(const QString& connectionName); /**jsdoc * Triggered when you failed to make a user connection. * @function Window.connectionError * @param {string} message - A description of the error. * @returns {Signal} */ void connectionError(const QString& errorString); /**jsdoc * Triggered when a message is announced by {@link Window.displayAnnouncement|displayAnnouncement}. * @function Window.announcement * @param {string} message - The message text. * @returns {Signal} */ void announcement(const QString& message); /**jsdoc * Triggered when the user closes a message box that was opened with {@link Window.openMessageBox|openMessageBox}. * @function Window.messageBoxClosed * @param {number} id - The ID of the message box that was closed. * @param {number} button - The button that the user clicked. If the user presses Esc, the Cancel button value is returned, * whether or not the Cancel button is displayed in the message box. * @returns {Signal} */ void messageBoxClosed(int id, int button); /**jsdoc * Triggered when the user chooses a directory in a {@link Window.browseDirAsync|browseDirAsync} dialog. * @function Window.browseDirChanged * @param {string} directory - The directory the user chose in the dialog. * @returns {Signal} */ void browseDirChanged(QString browseDir); /**jsdoc * Triggered when the user chooses an asset in a {@link Window.browseAssetsAsync|browseAssetsAsync} dialog. * @function Window.assetsDirChanged * @param {string} asset - The path and name of the asset the user chose in the dialog. * @returns {Signal} */ void assetsDirChanged(QString assetsDir); /**jsdoc * Triggered when the user specifies a file in a {@link Window.saveAsync|saveAsync} dialog. * @function Window.saveFileChanged * @param {string} filename - The path and name of the file that the user specified in the dialog. * @returns {Signal} */ void saveFileChanged(QString filename); /**jsdoc * Triggered when the user chooses a file in a {@link Window.browseAsync|browseAsync} dialog. * @function Window.browseChanged * @param {string} filename - The path and name of the file the user chose in the dialog. * @returns {Signal} */ void browseChanged(QString filename); /**jsdoc * Triggered when the user chooses a file in a {@link Window.browseAsync|browseAsync} dialog. * @function Window.openFileChanged * @deprecated This signal is being replaced with {@link Window.browseChanged|browseChanged} and will be removed. * @param {string} filename - The path and name of the file the user chose in the dialog. * @returns {Signal} */ void openFileChanged(QString filename); /**jsdoc * Triggered when the user OKs a {@link Window.promptAsync|promptAsync} dialog. * @function Window.promptTextChanged * @param {string} text - The text the user entered in the dialog. * @returns {Signal} */ void promptTextChanged(QString text); /**jsdoc * Triggered when the position or size of the Interface window changes. * @function Window.geometryChanged * @param {Rect} geometry - The position and size of the drawable area of the Interface window. * @returns {Signal} * @example <caption>Report the position of size of the Interface window when it changes.</caption> * function onWindowGeometryChanged(rect) { * print("Window geometry: " + JSON.stringify(rect)); * } * * Window.geometryChanged.connect(onWindowGeometryChanged); */ void geometryChanged(QRect geometry); private: QString getPreviousBrowseLocation() const; void setPreviousBrowseLocation(const QString& location); QString getPreviousBrowseAssetLocation() const; void setPreviousBrowseAssetLocation(const QString& location); void ensureReticleVisible() const; int createMessageBox(QString title, QString text, int buttons, int defaultButton); QHash<int, QQuickItem*> _messageBoxes; int _lastMessageBoxID{ -1 }; }; #endif // hifi_WindowScriptingInterface_h