Showing the changes to interface/src/scripting/WindowScriptingInterface.h (1 of 1 file). Show all
Unified · Split
| @@ -34,7 +34,9 @@ void CustomPromptResultFromScriptValue(const QScriptValue& object, CustomPromptR · 33 unmodified lines | |||
| 34 | 34 | ||
| 35 | 35 | ||
| 36 | /**jsdoc | 36 | /**jsdoc |
| 37 | * The Window API provides various facilities not covered elsewhere. | 37 | * The Window API provides various facilities not covered elsewhere: window dimensions, window focus, normal or entity camera |
| 38 | * view, clipboard, announcements, user connections, common dialog boxes, snapshots, file import, domain changes, domain | ||
| 39 | * physics. | ||
| 38 | * | 40 | * |
| 39 | * @namespace Window | 41 | * @namespace Window |
| 40 | * @property {number} innerWidth - The width of the drawable area of the Interface window (i.e., without borders or other | 42 | * @property {number} innerWidth - The width of the drawable area of the Interface window (i.e., without borders or other |
| @@ -187,8 +189,8 @@ public slots: · 146 unmodified lines | |||
| 187 | * <code>"Images (*.png *.jpg *.svg)"</code>. All files are displayed if a filter isn't specified. | 189 | * <code>"Images (*.png *.jpg *.svg)"</code>. All files are displayed if a filter isn't specified. |
| 188 | * @returns {string} The path and name of the file if one is chosen, otherwise <code>null</code>. | 190 | * @returns {string} The path and name of the file if one is chosen, otherwise <code>null</code>. |
| 189 | * @example <caption>Ask the user to choose an image file.</caption> | 191 | * @example <caption>Ask the user to choose an image file.</caption> |
| 190 | * var file = Window.browse("Select Image File", Paths.resources, "Images (*.png *.jpg *.svg)"); | 192 | * var filename = Window.browse("Select Image File", Paths.resources, "Images (*.png *.jpg *.svg)"); |
| 191 | * print("File: " + file); | 193 | * print("File: " + filename); |
| 192 | */ | 194 | */ |
| 193 | QScriptValue browse(const QString& title = "", const QString& directory = "", const QString& nameFilter = ""); | 195 | QScriptValue browse(const QString& title = "", const QString& directory = "", const QString& nameFilter = ""); |
| 194 | 196 | ||
| @@ -202,8 +204,8 @@ public slots: · 7 unmodified lines | |||
| 202 | * @param {string} nameFilter="" - The types of files to display. Examples: <code>"*.json"</code> and | 204 | * @param {string} nameFilter="" - The types of files to display. Examples: <code>"*.json"</code> and |
| 203 | * <code>"Images (*.png *.jpg *.svg)"</code>. All files are displayed if a filter isn't specified. | 205 | * <code>"Images (*.png *.jpg *.svg)"</code>. All files are displayed if a filter isn't specified. |
| 204 | * @example <caption>Ask the user to choose an image file without waiting for the answer.</caption> | 206 | * @example <caption>Ask the user to choose an image file without waiting for the answer.</caption> |
| 205 | * function onOpenFileChanged(file) { | 207 | * function onOpenFileChanged(filename) { |
| 206 | * print("File: " + file); | 208 | * print("File: " + filename); |
| 207 | * } | 209 | * } |
| 208 | * Window.openFileChanged.connect(onOpenFileChanged); | 210 | * Window.openFileChanged.connect(onOpenFileChanged); |
| 209 | * | 211 | * |
| @@ -220,11 +222,11 @@ public slots: · 10 unmodified lines | |||
| 220 | * @param {string} directory="" - The initial directory to start browsing at. | 222 | * @param {string} directory="" - The initial directory to start browsing at. |
| 221 | * @param {string} nameFilter="" - The types of files to display. Examples: <code>"*.json"</code> and | 223 | * @param {string} nameFilter="" - The types of files to display. Examples: <code>"*.json"</code> and |
| 222 | * <code>"Images (*.png *.jpg *.svg)"</code>. All files are displayed if a filter isn't specified. | 224 | * <code>"Images (*.png *.jpg *.svg)"</code>. All files are displayed if a filter isn't specified. |
| 223 | * @returns {string} The path and name of the file is one is specified, otherwise <code>null</code>. If a single file type | 225 | * @returns {string} The path and name of the file if one is specified, otherwise <code>null</code>. If a single file type |
| 224 | * is specified in the nameFilter, that file type extension is automatically appended to the result when appropriate. | 226 | * is specified in the nameFilter, that file type extension is automatically appended to the result when appropriate. |
| 225 | * @example <caption>Ask the user to specify a file to save to.</caption> | 227 | * @example <caption>Ask the user to specify a file to save to.</caption> |
| 226 | * var file = Window.save("Save to JSON file", Paths.resources, "*.json"); | 228 | * var filename = Window.save("Save to JSON file", Paths.resources, "*.json"); |
| 227 | * print("File: " + file); | 229 | * print("File: " + filename); |
| 228 | */ | 230 | */ |
| 229 | QScriptValue save(const QString& title = "", const QString& directory = "", const QString& nameFilter = ""); | 231 | QScriptValue save(const QString& title = "", const QString& directory = "", const QString& nameFilter = ""); |
| 230 | 232 | ||
| @@ -238,8 +240,8 @@ public slots: · 7 unmodified lines | |||
| 238 | * @param {string} nameFilter="" - The types of files to display. Examples: <code>"*.json"</code> and | 240 | * @param {string} nameFilter="" - The types of files to display. Examples: <code>"*.json"</code> and |
| 239 | * <code>"Images (*.png *.jpg *.svg)"</code>. All files are displayed if a filter isn't specified. | 241 | * <code>"Images (*.png *.jpg *.svg)"</code>. All files are displayed if a filter isn't specified. |
| 240 | * @example <caption>Ask the user to specify a file to save to without waiting for an answer.</caption> | 242 | * @example <caption>Ask the user to specify a file to save to without waiting for an answer.</caption> |
| 241 | * function onSaveFileChanged(file) { | 243 | * function onSaveFileChanged(filename) { |
| 242 | * print("File: " + file); | 244 | * print("File: " + filename); |
| 243 | * } | 245 | * } |
| 244 | * Window.saveFileChanged.connect(onSaveFileChanged); | 246 | * Window.saveFileChanged.connect(onSaveFileChanged); |
| 245 | * | 247 | * |
| @@ -289,9 +291,9 @@ public slots: · 43 unmodified lines | |||
| 289 | * @function Window.showAssetServer | 291 | * @function Window.showAssetServer |
| 290 | * @param {string} uploadFile="" - The path and name of a file to upload to the asset server. | 292 | * @param {string} uploadFile="" - The path and name of a file to upload to the asset server. |
| 291 | * @example <caption>Upload a file to the asset server.</caption> | 293 | * @example <caption>Upload a file to the asset server.</caption> |
| 292 | * var file = Window.browse("Select File to Add to Asset Server", Paths.resources); | 294 | * var filename = Window.browse("Select File to Add to Asset Server", Paths.resources); |
| 293 | * print("File: " + file); | 295 | * print("File: " + filename); |
| 294 | * Window.showAssetServer(file); | 296 | * Window.showAssetServer(filename); |
| 295 | */ | 297 | */ |
| 296 | void showAssetServer(const QString& upload = ""); | 298 | void showAssetServer(const QString& upload = ""); |
| 297 | 299 | ||
| @@ -321,8 +323,8 @@ public slots: · 23 unmodified lines | |||
| 321 | * @param {boolean} includeAnimated=false - If <code>true</code>, a moving image is captured as an animated GIF in addition | 323 | * @param {boolean} includeAnimated=false - If <code>true</code>, a moving image is captured as an animated GIF in addition |
| 322 | * to a still image. | 324 | * to a still image. |
| 323 | * @param {number} aspectRatio=0 - The width/height ratio of the snapshot required. If the value is <code>0</code> the | 325 | * @param {number} aspectRatio=0 - The width/height ratio of the snapshot required. If the value is <code>0</code> the |
| 324 | * full resolution is used (window dimensions in desktop mode; HMD display dimensions in HMD mode), otherwise one or | 326 | * full resolution is used (window dimensions in desktop mode; HMD display dimensions in HMD mode), otherwise one of the |
| 325 | * other dimension is adjusted in order to match the aspect ratio. | 327 | * dimensions is adjusted in order to match the aspect ratio. |
| 326 | * @example <caption>Using the snapshot function and signals.</caption> | 328 | * @example <caption>Using the snapshot function and signals.</caption> |
| 327 | * function onStillSnapshottaken(path, notify) { | 329 | * function onStillSnapshottaken(path, notify) { |
| 328 | * print("Still snapshot taken: " + path); | 330 | * print("Still snapshot taken: " + path); |
| @@ -356,7 +358,7 @@ public slots: · 27 unmodified lines | |||
| 356 | 358 | ||
| 357 | /**jsdoc | 359 | /**jsdoc |
| 358 | * Emit a {@link Window.connectionAdded|connectionAdded} or a {@link Window.connectionError|connectionError} signal that | 360 | * Emit a {@link Window.connectionAdded|connectionAdded} or a {@link Window.connectionError|connectionError} signal that |
| 359 | * indicates whether or not you successfully made a user connection. | 361 | * indicates whether or a user connection was successfully made using the Web API. |
| 360 | * @function Window.makeConnection | 362 | * @function Window.makeConnection |
| 361 | * @param {boolean} success - If <code>true</code> then {@link Window.connectionAdded|connectionAdded} is emitted, otherwise | 363 | * @param {boolean} success - If <code>true</code> then {@link Window.connectionAdded|connectionAdded} is emitted, otherwise |
| 362 | * {@link Window.connectionError|connectionError} is emitted. | 364 | * {@link Window.connectionError|connectionError} is emitted. |
| @@ -416,7 +418,7 @@ public slots: · 53 unmodified lines | |||
| 416 | * Set what to show on the PC display: normal view or entity camera view. The entity camera is configured using | 418 | * Set what to show on the PC display: normal view or entity camera view. The entity camera is configured using |
| 417 | * {@link Camera.setCameraEntity} and {@link Camera|Camera.mode}. | 419 | * {@link Camera.setCameraEntity} and {@link Camera|Camera.mode}. |
| 418 | * @function Window.setDisplayTexture | 420 | * @function Window.setDisplayTexture |
| 419 | * @param {Window.DisplayTexture} name - The view to display. | 421 | * @param {Window.DisplayTexture} texture - The view to display. |
| 420 | * @returns {boolean} <code>true</code> if the display texture was successfully set, otherwise <code>false</code>. | 422 | * @returns {boolean} <code>true</code> if the display texture was successfully set, otherwise <code>false</code>. |
| 421 | */ | 423 | */ |
| 422 | // See spectatorCamera.js for Valid parameter values. | 424 | // See spectatorCamera.js for Valid parameter values. |
| @@ -445,17 +447,18 @@ public slots: · 22 unmodified lines | |||
| 445 | bool setDisplayTexture(const QString& name); | 447 | bool setDisplayTexture(const QString& name); |
| 446 | 448 | ||
| 447 | /**jsdoc | 449 | /**jsdoc |
| 448 | * Check if a 2D point is within the drawable area of the HUD overlay. | 450 | * Check if a 2D point is within the desktop window if in desktop mode, or the drawable area of the HUD overlay if in HMD |
| 451 | * mode. | ||
| 449 | * @function Window.isPointOnDesktopWindow | 452 | * @function Window.isPointOnDesktopWindow |
| 450 | * @param {Vec2} point - The point to check in HMD display coordinates. | 453 | * @param {Vec2} point - The point to check. |
| 451 | * @returns {boolean} <code>true</code> if the point is within the window or HUD, otherwise <code>false</code>. | 454 | * @returns {boolean} <code>true</code> if the point is within the window or HUD, otherwise <code>false</code>. |
| 452 | */ | 455 | */ |
| 453 | bool isPointOnDesktopWindow(QVariant point); | 456 | bool isPointOnDesktopWindow(QVariant point); |
| 454 | 457 | ||
| 455 | /**jsdoc | 458 | /**jsdoc |
| 456 | * Get the size of the drawable area of the Interface window if in desktop mode or the HMD display if in HMD mode. | 459 | * Get the size of the drawable area of the Interface window if in desktop mode or the HMD rendering surface if in HMD mode. |
| 457 | * @function Window.getDeviceSize | 460 | * @function Window.getDeviceSize |
| 458 | * @returns {Vec2} The width and height of the Interface window or HMD display, in pixels. | 461 | * @returns {Vec2} The width and height of the Interface window or HMD rendering surface, in pixels. |
| 459 | */ | 462 | */ |
| 460 | glm::vec2 getDeviceSize() const; | 463 | glm::vec2 getDeviceSize() const; |
| 461 | 464 | ||
| @@ -521,13 +524,19 @@ signals: · 59 unmodified lines | |||
| 521 | * @function Window.domainChanged | 524 | * @function Window.domainChanged |
| 522 | * @param {string} domain - The domain's IP address. | 525 | * @param {string} domain - The domain's IP address. |
| 523 | * @returns {Signal} | 526 | * @returns {Signal} |
| 527 | * @example <caption>Report when you change domains.</caption> | ||
| 528 | * function onDomainChanged(domain) { | ||
| 529 | * print("Domain changed: " + domain); | ||
| 530 | * } | ||
| 531 | * | ||
| 532 | * Window.domainChanged.connect(onDomainChanged); | ||
| 524 | */ | 533 | */ |
| 525 | void domainChanged(const QString& domain); | 534 | void domainChanged(const QString& domain); |
| 526 | 535 | ||
| 527 | /**jsdoc | 536 | /**jsdoc |
| 528 | * Triggered when you try to navigate to a *.svo or *.svo.json URL in a Web browser within Interface. | 537 | * Triggered when you try to navigate to a *.json, *.svo, or *.svo.json URL in a Web browser within Interface. |
| 529 | * @function Window.svoImportRequested | 538 | * @function Window.svoImportRequested |
| 530 | * @param {string} url - The URL of the SVO file to import/ | 539 | * @param {string} url - The URL of the file to import. |
| 531 | * @returns {Signal} | 540 | * @returns {Signal} |
| 532 | */ | 541 | */ |
| 533 | void svoImportRequested(const QString& url); | 542 | void svoImportRequested(const QString& url); |
| @@ -543,7 +552,7 @@ signals: · 9 unmodified lines | |||
| 543 | void domainConnectionRefused(const QString& reasonMessage, int reasonCode, const QString& extraInfo); | 552 | void domainConnectionRefused(const QString& reasonMessage, int reasonCode, const QString& extraInfo); |
| 544 | 553 | ||
| 545 | /**jsdoc | 554 | /**jsdoc |
| 546 | * Triggered when a still snapshot has been taken by calling {@link Window.takeSnapshot|takeSnapshot}} with | 555 | * Triggered when a still snapshot has been taken by calling {@link Window.takeSnapshot|takeSnapshot} with |
| 547 | * <code>includeAnimated = false</code>. | 556 | * <code>includeAnimated = false</code>. |
| 548 | * @function Window.stillSnapshotTaken | 557 | * @function Window.stillSnapshotTaken |
| 549 | * @param {string} pathStillSnapshot - The path and name of the snapshot image file. | 558 | * @param {string} pathStillSnapshot - The path and name of the snapshot image file. |
| @@ -611,7 +620,7 @@ signals: · 61 unmodified lines | |||
| 611 | * Triggered when the user closes a message box that was opened with {@link Window.openMessageBox|openMessageBox}. | 620 | * Triggered when the user closes a message box that was opened with {@link Window.openMessageBox|openMessageBox}. |
| 612 | * @function Window.messageBoxClosed | 621 | * @function Window.messageBoxClosed |
| 613 | * @param {number} id - The ID of the message box that was closed. | 622 | * @param {number} id - The ID of the message box that was closed. |
| 614 | * @param {number} button - The button that the user clicked. If the user presses Esc the Cancel button value is returned, | 623 | * @param {number} button - The button that the user clicked. If the user presses Esc, the Cancel button value is returned, |
| 615 | * whether or not the Cancel button is displayed in the message box. | 624 | * whether or not the Cancel button is displayed in the message box. |
| 616 | * @returns {Signal} | 625 | * @returns {Signal} |
| 617 | */ | 626 | */ |