Showing the changes to interface/src/scripting/WindowScriptingInterface.h (1 of 124 files). Show all
Unified · Split
| @@ -33,6 +33,21 @@ QScriptValue CustomPromptResultToScriptValue(QScriptEngine* engine, const Custom · 32 unmodified lines | ||
| 33 | 33 | void CustomPromptResultFromScriptValue(const QScriptValue& object, CustomPromptResult& result); |
| 34 | 34 | |
| 35 | 35 | |
| 36 | +/**jsdoc | |
| 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. | |
| 40 | + * | |
| 41 | + * @namespace Window | |
| 42 | + * @property {number} innerWidth - The width of the drawable area of the Interface window (i.e., without borders or other | |
| 43 | + * chrome), in pixels. <em>Read-only.</em> | |
| 44 | + * @property {number} innerHeight - The height of the drawable area of the Interface window (i.e., without borders or other | |
| 45 | + * chrome) plus the height of the menu bar, in pixels. <em>Read-only.</em> | |
| 46 | + * @property {object} location - Provides facilities for working with your current metaverse location. See {@link location}. | |
| 47 | + * @property {number} x - The x coordinate of the top left corner of the Interface window on the display. <em>Read-only.</em> | |
| 48 | + * @property {number} y - The y coordinate of the top left corner of the Interface window on the display. <em>Read-only.</em> | |
| 49 | + */ | |
| 50 | + | |
| 36 | 51 | class WindowScriptingInterface : public QObject, public Dependency { |
| 37 | 52 | Q_OBJECT |
| 38 | 53 | Q_PROPERTY(int innerWidth READ getInnerWidth) |
| @@ -48,37 +63,454 @@ public: · 9 unmodified lines | ||
| 48 | 63 | int getY(); |
| 49 | 64 | |
| 50 | 65 | public slots: |
| 66 | + | |
| 67 | + /**jsdoc | |
| 68 | + * Check if the Interface window has focus. | |
| 69 | + * @function Window.hasFocus | |
| 70 | + * @returns {boolean} <code>true</code> if the Interface window has focus, otherwise <code>false</code>. | |
| 71 | + */ | |
| 51 | 72 | QScriptValue hasFocus(); |
| 73 | + | |
| 74 | + /**jsdoc | |
| 75 | + * Make the Interface window have focus. | |
| 76 | + * @function Window.setFocus | |
| 77 | + */ | |
| 52 | 78 | void setFocus(); |
| 79 | + | |
| 80 | + /**jsdoc | |
| 81 | + * Raise the Interface window if it is minimized, and give it focus. | |
| 82 | + * @function Window.raiseMainWindow | |
| 83 | + */ | |
| 53 | 84 | void raiseMainWindow(); |
| 85 | + | |
| 86 | + /**jsdoc | |
| 87 | + * Display a dialog with the specified message and an "OK" button. The dialog is non-modal; the script continues without | |
| 88 | + * waiting for a user response. | |
| 89 | + * @function Window.alert | |
| 90 | + * @param {string} message="" - The message to display. | |
| 91 | + * @example <caption>Display a friendly greeting.</caption> | |
| 92 | + * Window.alert("Welcome!"); | |
| 93 | + * print("Script continues without waiting"); | |
| 94 | + */ | |
| 54 | 95 | void alert(const QString& message = ""); |
| 96 | + | |
| 97 | + /**jsdoc | |
| 98 | + * Prompt the user to confirm something. Displays a modal dialog with a message plus "Yes" and "No" buttons. | |
| 99 | + * responds. | |
| 100 | + * @function Window.confirm | |
| 101 | + * @param {string} message="" - The question to display. | |
| 102 | + * @returns {boolean} <code>true</code> if the user selects "Yes", otherwise <code>false</code>. | |
| 103 | + * @example <caption>Ask the user a question requiring a yes/no answer.</caption> | |
| 104 | + * var answer = Window.confirm("Are you sure?"); | |
| 105 | + * print(answer); // true or false | |
| 106 | + */ | |
| 55 | 107 | QScriptValue confirm(const QString& message = ""); |
| 108 | + | |
| 109 | + /**jsdoc | |
| 110 | + * Prompt the user to enter some text. Displays a modal dialog with a message and a text box, plus "OK" and "Cancel" | |
| 111 | + * buttons. | |
| 112 | + * @function Window.prompt | |
| 113 | + * @param {string} message - The question to display. | |
| 114 | + * @param {string} defaultText - The default answer text. | |
| 115 | + * @returns {string} The text that the user entered if they select "OK", otherwise "". | |
| 116 | + * @example <caption>Ask the user a question requiring a text answer.</caption> | |
| 117 | + * var answer = Window.prompt("Question", "answer"); | |
| 118 | + * if (answer === "") { | |
| 119 | + * print("User canceled"); | |
| 120 | + * } else { | |
| 121 | + * print("User answer: " + answer); | |
| 122 | + * } | |
| 123 | + */ | |
| 56 | 124 | QScriptValue prompt(const QString& message, const QString& defaultText); |
| 125 | + | |
| 126 | + /**jsdoc | |
| 127 | + * Prompt the user to enter some text. Displays a non-modal dialog with a message and a text box, plus "OK" and "Cancel" | |
| 128 | + * buttons. A {@link Window.promptTextChanged|promptTextChanged} signal is emitted when the user OKs the dialog; no signal | |
| 129 | + * is emitted if the user cancels the dialog. | |
| 130 | + * @function Window.promptAsync | |
| 131 | + * @param {string} message - The question to display. | |
| 132 | + * @param {string} defaultText - The default answer text. | |
| 133 | + * @example <caption>Ask the user a question requiring a text answer without waiting for the answer.</caption> | |
| 134 | + * function onPromptTextChanged(text) { | |
| 135 | + * print("User answer: " + text); | |
| 136 | + * } | |
| 137 | + * Window.promptTextChanged.connect(onPromptTextChanged); | |
| 138 | + * | |
| 139 | + * Window.promptAsync("Question", "answer"); | |
| 140 | + * print("Script continues without waiting"); | |
| 141 | + */ | |
| 57 | 142 | void promptAsync(const QString& message = "", const QString& defaultText = ""); |
| 143 | + | |
| 144 | + /**jsdoc | |
| 145 | + * Prompt the user for input in a custom, modal dialog. | |
| 146 | + * @deprecated This funtion is deprecated and will be removed. | |
| 147 | + * @function Window.customPrompt | |
| 148 | + * @param {object} config - Configures the modal dialog. | |
| 149 | + * @returns {object} The user's response. | |
| 150 | + */ | |
| 58 | 151 | CustomPromptResult customPrompt(const QVariant& config); |
| 152 | + | |
| 153 | + /**jsdoc | |
| 154 | + * Prompt the user to choose a directory. Displays a modal dialog that navigates the directory tree. | |
| 155 | + * @function Window.browseDir | |
| 156 | + * @param {string} title="" - The title to display at the top of the dialog. | |
| 157 | + * @param {string} directory="" - The initial directory to start browsing at. | |
| 158 | + * @returns {string} The path of the directory if one is chosen, otherwise <code>null</code>. | |
| 159 | + * @example <caption>Ask the user to choose a directory.</caption> | |
| 160 | + * var directory = Window.browseDir("Select Directory", Paths.resources); | |
| 161 | + * print("Directory: " + directory); | |
| 162 | + */ | |
| 59 | 163 | QScriptValue browseDir(const QString& title = "", const QString& directory = ""); |
| 164 | + | |
| 165 | + /**jsdoc | |
| 166 | + * Prompt the user to choose a directory. Displays a non-modal dialog that navigates the directory tree. A | |
| 167 | + * {@link Window.browseDirChanged|browseDirChanged} signal is emitted when a directory is chosen; no signal is emitted if | |
| 168 | + * the user cancels the dialog. | |
| 169 | + * @function Window.browseDirAsync | |
| 170 | + * @param {string} title="" - The title to display at the top of the dialog. | |
| 171 | + * @param {string} directory="" - The initial directory to start browsing at. | |
| 172 | + * @example <caption>Ask the user to choose a directory without waiting for the answer.</caption> | |
| 173 | + * function onBrowseDirChanged(directory) { | |
| 174 | + * print("Directory: " + directory); | |
| 175 | + * } | |
| 176 | + * Window.browseDirChanged.connect(onBrowseDirChanged); | |
| 177 | + * | |
| 178 | + * Window.browseDirAsync("Select Directory", Paths.resources); | |
| 179 | + * print("Script continues without waiting"); | |
| 180 | + */ | |
| 60 | 181 | void browseDirAsync(const QString& title = "", const QString& directory = ""); |
| 182 | + | |
| 183 | + /**jsdoc | |
| 184 | + * Prompt the user to choose a file. Displays a modal dialog that navigates the directory tree. | |
| 185 | + * @function Window.browse | |
| 186 | + * @param {string} title="" - The title to display at the top of the dialog. | |
| 187 | + * @param {string} directory="" - The initial directory to start browsing at. | |
| 188 | + * @param {string} nameFilter="" - The types of files to display. Examples: <code>"*.json"</code> and | |
| 189 | + * <code>"Images (*.png *.jpg *.svg)"</code>. All files are displayed if a filter isn't specified. | |
| 190 | + * @returns {string} The path and name of the file if one is chosen, otherwise <code>null</code>. | |
| 191 | + * @example <caption>Ask the user to choose an image file.</caption> | |
| 192 | + * var filename = Window.browse("Select Image File", Paths.resources, "Images (*.png *.jpg *.svg)"); | |
| 193 | + * print("File: " + filename); | |
| 194 | + */ | |
| 61 | 195 | QScriptValue browse(const QString& title = "", const QString& directory = "", const QString& nameFilter = ""); |
| 196 | + | |
| 197 | + /**jsdoc | |
| 198 | + * Prompt the user to choose a file. Displays a non-modal dialog that navigates the directory tree. A | |
| 199 | + * {@link Window.openFileChanged|openFileChanged} signal is emitted when a file is chosen; no signal is emitted if the user | |
| 200 | + * cancels the dialog. | |
| 201 | + * @function Window.browseAsync | |
| 202 | + * @param {string} title="" - The title to display at the top of the dialog. | |
| 203 | + * @param {string} directory="" - The initial directory to start browsing at. | |
| 204 | + * @param {string} nameFilter="" - The types of files to display. Examples: <code>"*.json"</code> and | |
| 205 | + * <code>"Images (*.png *.jpg *.svg)"</code>. All files are displayed if a filter isn't specified. | |
| 206 | + * @example <caption>Ask the user to choose an image file without waiting for the answer.</caption> | |
| 207 | + * function onOpenFileChanged(filename) { | |
| 208 | + * print("File: " + filename); | |
| 209 | + * } | |
| 210 | + * Window.openFileChanged.connect(onOpenFileChanged); | |
| 211 | + * | |
| 212 | + * Window.browseAsync("Select Image File", Paths.resources, "Images (*.png *.jpg *.svg)"); | |
| 213 | + * print("Script continues without waiting"); | |
| 214 | + */ | |
| 62 | 215 | void browseAsync(const QString& title = "", const QString& directory = "", const QString& nameFilter = ""); |
| 216 | + | |
| 217 | + /**jsdoc | |
| 218 | + * Prompt the user to specify the path and name of a file to save to. Displays a model dialog that navigates the directory | |
| 219 | + * tree and allows the user to type in a file name. | |
| 220 | + * @function Window.save | |
| 221 | + * @param {string} title="" - The title to display at the top of the dialog. | |
| 222 | + * @param {string} directory="" - The initial directory to start browsing at. | |
| 223 | + * @param {string} nameFilter="" - The types of files to display. Examples: <code>"*.json"</code> and | |
| 224 | + * <code>"Images (*.png *.jpg *.svg)"</code>. All files are displayed if a filter isn't specified. | |
| 225 | + * @returns {string} The path and name of the file if one is specified, otherwise <code>null</code>. If a single file type | |
| 226 | + * is specified in the nameFilter, that file type extension is automatically appended to the result when appropriate. | |
| 227 | + * @example <caption>Ask the user to specify a file to save to.</caption> | |
| 228 | + * var filename = Window.save("Save to JSON file", Paths.resources, "*.json"); | |
| 229 | + * print("File: " + filename); | |
| 230 | + */ | |
| 63 | 231 | QScriptValue save(const QString& title = "", const QString& directory = "", const QString& nameFilter = ""); |
| 232 | + | |
| 233 | + /**jsdoc | |
| 234 | + * Prompt the user to specify the path and name of a file to save to. Displays a non-model dialog that navigates the | |
| 235 | + * directory tree and allows the user to type in a file name. A {@link Window.saveFileChanged|saveFileChanged} signal is | |
| 236 | + * emitted when a file is specified; no signal is emitted if the user cancels the dialog. | |
| 237 | + * @function Window.saveAsync | |
| 238 | + * @param {string} title="" - The title to display at the top of the dialog. | |
| 239 | + * @param {string} directory="" - The initial directory to start browsing at. | |
| 240 | + * @param {string} nameFilter="" - The types of files to display. Examples: <code>"*.json"</code> and | |
| 241 | + * <code>"Images (*.png *.jpg *.svg)"</code>. All files are displayed if a filter isn't specified. | |
| 242 | + * @example <caption>Ask the user to specify a file to save to without waiting for an answer.</caption> | |
| 243 | + * function onSaveFileChanged(filename) { | |
| 244 | + * print("File: " + filename); | |
| 245 | + * } | |
| 246 | + * Window.saveFileChanged.connect(onSaveFileChanged); | |
| 247 | + * | |
| 248 | + * Window.saveAsync("Save to JSON file", Paths.resources, "*.json"); | |
| 249 | + * print("Script continues without waiting"); | |
| 250 | + */ | |
| 64 | 251 | void saveAsync(const QString& title = "", const QString& directory = "", const QString& nameFilter = ""); |
| 252 | + | |
| 253 | + /**jsdoc | |
| 254 | + * Prompt the user to choose an Asset Server item. Displays a modal dialog that navigates the tree of assets on the Asset | |
| 255 | + * Server. | |
| 256 | + * @function Window.browseAssets | |
| 257 | + * @param {string} title="" - The title to display at the top of the dialog. | |
| 258 | + * @param {string} directory="" - The initial directory to start browsing at. | |
| 259 | + * @param {string} nameFilter="" - The types of files to display. Examples: <code>"*.json"</code> and | |
| 260 | + * <code>"Images (*.png *.jpg *.svg)"</code>. All files are displayed if a filter isn't specified. | |
| 261 | + * @returns {string} The path and name of the asset if one is chosen, otherwise <code>null</code>. | |
| 262 | + * @example <caption>Ask the user to select an FBX asset.</caption> | |
| 263 | + * var asset = Window.browseAssets("Select FBX File", "/", "*.fbx"); | |
| 264 | + * print("FBX file: " + asset); | |
| 265 | + */ | |
| 65 | 266 | QScriptValue browseAssets(const QString& title = "", const QString& directory = "", const QString& nameFilter = ""); |
| 267 | + | |
| 268 | + /**jsdoc | |
| 269 | + * Prompt the user to choose an Asset Server item. Displays a non-modal dialog that navigates the tree of assets on the | |
| 270 | + * Asset Server. A {@link Window.assetsDirChanged|assetsDirChanged} signal is emitted when an asset is chosen; no signal is | |
| 271 | + * emitted if the user cancels the dialog. | |
| 272 | + * @function Window.browseAssetsAsync | |
| 273 | + * @param {string} title="" - The title to display at the top of the dialog. | |
| 274 | + * @param {string} directory="" - The initial directory to start browsing at. | |
| 275 | + * @param {string} nameFilter="" - The types of files to display. Examples: <code>"*.json"</code> and | |
| 276 | + * <code>"Images (*.png *.jpg *.svg)"</code>. All files are displayed if a filter isn't specified. | |
| 277 | + * @example | |
| 278 | + * function onAssetsDirChanged(asset) { | |
| 279 | + * print("FBX file: " + asset); | |
| 280 | + * } | |
| 281 | + * Window.assetsDirChanged.connect(onAssetsDirChanged); | |
| 282 | + * | |
| 283 | + * Window.browseAssetsAsync("Select FBX File", "/", "*.fbx"); | |
| 284 | + * print("Script continues without waiting"); | |
| 285 | + */ | |
| 66 | 286 | void browseAssetsAsync(const QString& title = "", const QString& directory = "", const QString& nameFilter = ""); |
| 287 | + | |
| 288 | + /**jsdoc | |
| 289 | + * Open the Asset Browser dialog. If a file to upload is specified, the user is prompted to enter the folder and name to | |
| 290 | + * map the file to on the asset server. | |
| 291 | + * @function Window.showAssetServer | |
| 292 | + * @param {string} uploadFile="" - The path and name of a file to upload to the asset server. | |
| 293 | + * @example <caption>Upload a file to the asset server.</caption> | |
| 294 | + * var filename = Window.browse("Select File to Add to Asset Server", Paths.resources); | |
| 295 | + * print("File: " + filename); | |
| 296 | + * Window.showAssetServer(filename); | |
| 297 | + */ | |
| 67 | 298 | void showAssetServer(const QString& upload = ""); |
| 299 | + | |
| 300 | + /**jsdoc | |
| 301 | + * Get Interface's build number. | |
| 302 | + * @function Window.checkVersion | |
| 303 | + * @returns {string} - Interface's build number. | |
| 304 | + */ | |
| 68 | 305 | QString checkVersion(); |
| 306 | + | |
| 307 | + /**jsdoc | |
| 308 | + * Copies text to the operating system's clipboard. | |
| 309 | + * @function Window.copyToClipboard | |
| 310 | + * @param {string} text - The text to copy to the operating system's clipboard. | |
| 311 | + */ | |
| 69 | 312 | void copyToClipboard(const QString& text); |
| 313 | + | |
| 314 | + /**jsdoc | |
| 315 | + * Takes a snapshot of the current Interface view from the primary camera. When a still image only is captured, | |
| 316 | + * {@link Window.stillSnapshotTaken|stillSnapshotTaken} is emitted; when a still image plus moving images are captured, | |
| 317 | + * {@link Window.processingGifStarted|processingGifStarted} and {@link Window.processingGifCompleted|processingGifCompleted} | |
| 318 | + * are emitted. The path to store the snapshots and the length of the animated GIF to capture are specified in Settings > | |
| 319 | + * General > Snapshots. | |
| 320 | + * @function Window.takeSnapshot | |
| 321 | + * @param {boolean} notify=true - This value is passed on through the {@link Window.stillSnapshotTaken|stillSnapshotTaken} | |
| 322 | + * signal. | |
| 323 | + * @param {boolean} includeAnimated=false - If <code>true</code>, a moving image is captured as an animated GIF in addition | |
| 324 | + * to a still image. | |
| 325 | + * @param {number} aspectRatio=0 - The width/height ratio of the snapshot required. If the value is <code>0</code> the | |
| 326 | + * full resolution is used (window dimensions in desktop mode; HMD display dimensions in HMD mode), otherwise one of the | |
| 327 | + * dimensions is adjusted in order to match the aspect ratio. | |
| 328 | + * @example <caption>Using the snapshot function and signals.</caption> | |
| 329 | + * function onStillSnapshottaken(path, notify) { | |
| 330 | + * print("Still snapshot taken: " + path); | |
| 331 | + * print("Notify: " + notify); | |
| 332 | + * } | |
| 333 | + * | |
| 334 | + * function onProcessingGifStarted(stillPath) { | |
| 335 | + * print("Still snapshot taken: " + stillPath); | |
| 336 | + * } | |
| 337 | + * | |
| 338 | + * function onProcessingGifCompleted(animatedPath) { | |
| 339 | + * print("Animated snapshot taken: " + animatedPath); | |
| 340 | + * } | |
| 341 | + * | |
| 342 | + * Window.stillSnapshotTaken.connect(onStillSnapshottaken); | |
| 343 | + * Window.processingGifStarted.connect(onProcessingGifStarted); | |
| 344 | + * Window.processingGifCompleted.connect(onProcessingGifCompleted); | |
| 345 | + * | |
| 346 | + * var notify = true; | |
| 347 | + * var animated = true; | |
| 348 | + * var aspect = 1920 / 1080; | |
| 349 | + * Window.takeSnapshot(notify, animated, aspect); | |
| 350 | + */ | |
| 70 | 351 | void takeSnapshot(bool notify = true, bool includeAnimated = false, float aspectRatio = 0.0f); |
| 352 | + | |
| 353 | + /**jsdoc | |
| 354 | + * Takes a still snapshot of the current view from the secondary camera that can be set up through the {@link Render} API. | |
| 355 | + * @function Window.takeSecondaryCameraSnapshot | |
| 356 | + */ | |
| 71 | 357 | void takeSecondaryCameraSnapshot(); |
| 358 | + | |
| 359 | + /**jsdoc | |
| 360 | + * Emit a {@link Window.connectionAdded|connectionAdded} or a {@link Window.connectionError|connectionError} signal that | |
| 361 | + * indicates whether or not a user connection was successfully made using the Web API. | |
| 362 | + * @function Window.makeConnection | |
| 363 | + * @param {boolean} success - If <code>true</code> then {@link Window.connectionAdded|connectionAdded} is emitted, otherwise | |
| 364 | + * {@link Window.connectionError|connectionError} is emitted. | |
| 365 | + * @param {string} description - Descriptive text about the connection success or error. This is sent in the signal emitted. | |
| 366 | + */ | |
| 72 | 367 | void makeConnection(bool success, const QString& userNameOrError); |
| 368 | + | |
| 369 | + /**jsdoc | |
| 370 | + * Display a notification message. Notifications are displayed in panels by the default script, nofications.js. An | |
| 371 | + * {@link Window.announcement|announcement} signal is emitted when this function is called. | |
| 372 | + * @function Window.displayAnnouncement | |
| 373 | + * @param {string} message - The announcement message. | |
| 374 | + * @example <caption>Send and capture an announcement message.</caption> | |
| 375 | + * function onAnnouncement(message) { | |
| 376 | + * // The message is also displayed as a notification by notifications.js. | |
| 377 | + * print("Announcement: " + message); | |
| 378 | + * } | |
| 379 | + * Window.announcement.connect(onAnnouncement); | |
| 380 | + * | |
| 381 | + * Window.displayAnnouncement("Hello"); | |
| 382 | + */ | |
| 73 | 383 | void displayAnnouncement(const QString& message); |
| 384 | + | |
| 385 | + /**jsdoc | |
| 386 | + * Prepare a snapshot ready for sharing. A {@link Window.snapshotShared|snapshotShared} signal is emitted when the snapshot | |
| 387 | + * has been prepared. | |
| 388 | + * @function Window.shareSnapshot | |
| 389 | + * @param {string} path - The path and name of the image file to share. | |
| 390 | + * @param {string} href="" - The metaverse location where the snapshot was taken. | |
| 391 | + */ | |
| 74 | 392 | void shareSnapshot(const QString& path, const QUrl& href = QUrl("")); |
| 393 | + | |
| 394 | + /**jsdoc | |
| 395 | + * Check to see if physics is active for you in the domain you're visiting - there is a delay between your arrival at a | |
| 396 | + * domain and physics becoming active for you in that domain. | |
| 397 | + * @function Window.isPhysicsEnabled | |
| 398 | + * @returns {boolean} <code>true</code> if physics is currently active for you, otherwise <code>false</code>. | |
| 399 | + * @example <caption>Wait for physics to be enabled when you change domains.</caption> | |
| 400 | + * function checkForPhysics() { | |
| 401 | + * var isPhysicsEnabled = Window.isPhysicsEnabled(); | |
| 402 | + * print("Physics enabled: " + isPhysicsEnabled); | |
| 403 | + * if (!isPhysicsEnabled) { | |
| 404 | + * Script.setTimeout(checkForPhysics, 1000); | |
| 405 | + * } | |
| 406 | + * } | |
| 407 | + * | |
| 408 | + * function onDomainChanged(domain) { | |
| 409 | + * print("Domain changed: " + domain); | |
| 410 | + * Script.setTimeout(checkForPhysics, 1000); | |
| 411 | + * } | |
| 412 | + * | |
| 413 | + * Window.domainChanged.connect(onDomainChanged); | |
| 414 | + */ | |
| 75 | 415 | bool isPhysicsEnabled(); |
| 416 | + | |
| 417 | + /**jsdoc | |
| 418 | + * Set what to show on the PC display: normal view or entity camera view. The entity camera is configured using | |
| 419 | + * {@link Camera.setCameraEntity} and {@link Camera|Camera.mode}. | |
| 420 | + * @function Window.setDisplayTexture | |
| 421 | + * @param {Window.DisplayTexture} texture - The view to display. | |
| 422 | + * @returns {boolean} <code>true</code> if the display texture was successfully set, otherwise <code>false</code>. | |
| 423 | + */ | |
| 424 | + // See spectatorCamera.js for Valid parameter values. | |
| 425 | + /**jsdoc | |
| 426 | + * <p>The views that may be displayed on the PC display.</p> | |
| 427 | + * <table> | |
| 428 | + * <thead> | |
| 429 | + * <tr> | |
| 430 | + * <th>Value</th> | |
| 431 | + * <th>View Displayed</th> | |
| 432 | + * </tr> | |
| 433 | + * </thead> | |
| 434 | + * <tbody> | |
| 435 | + * <tr> | |
| 436 | + * <td><code>""</code></td> | |
| 437 | + * <td>Normal view.</td> | |
| 438 | + * </tr> | |
| 439 | + * <tr> | |
| 440 | + * <td><code>"resource://spectatorCameraFrame"</code></td> | |
| 441 | + * <td>Entity camera view.</td> | |
| 442 | + * </tr> | |
| 443 | + * </tbody> | |
| 444 | + * </table> | |
| 445 | + * @typedef Window.DisplayTexture | |
| 446 | + */ | |
| 76 | 447 | bool setDisplayTexture(const QString& name); |
| 448 | + | |
| 449 | + /**jsdoc | |
| 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. | |
| 452 | + * @function Window.isPointOnDesktopWindow | |
| 453 | + * @param {Vec2} point - The point to check. | |
| 454 | + * @returns {boolean} <code>true</code> if the point is within the window or HUD, otherwise <code>false</code>. | |
| 455 | + */ | |
| 77 | 456 | bool isPointOnDesktopWindow(QVariant point); |
| 457 | + | |
| 458 | + /**jsdoc | |
| 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. | |
| 460 | + * @function Window.getDeviceSize | |
| 461 | + * @returns {Vec2} The width and height of the Interface window or HMD rendering surface, in pixels. | |
| 462 | + */ | |
| 78 | 463 | glm::vec2 getDeviceSize() const; |
| 79 | 464 | |
| 465 | + /**jsdoc | |
| 466 | + * Open a non-modal message box that can have a variety of button combinations. See also, | |
| 467 | + * {@link Window.updateMessageBox|updateMessageBox} and {@link Window.closeMessageBox|closeMessageBox}. | |
| 468 | + * @function Window.openMessageBox | |
| 469 | + * @param {string} title - The title to display for the message box. | |
| 470 | + * @param {string} text - Text to display in the message box. | |
| 471 | + * @param {Window.MessageBoxButton} buttons - The buttons to display on the message box; one or more button values added | |
| 472 | + * together. | |
| 473 | + * @param {Window.MessageBoxButton} defaultButton - The button that has focus when the message box is opened. | |
| 474 | + * @returns {number} The ID of the message box created. | |
| 475 | + * @example <caption>Ask the user whether that want to reset something.</caption> | |
| 476 | + * var messageBox; | |
| 477 | + * var resetButton = 0x4000000; | |
| 478 | + * var cancelButton = 0x400000; | |
| 479 | + * | |
| 480 | + * function onMessageBoxClosed(id, button) { | |
| 481 | + * if (id === messageBox) { | |
| 482 | + * if (button === resetButton) { | |
| 483 | + * print("Reset"); | |
| 484 | + * } else { | |
| 485 | + * print("Don't reset"); | |
| 486 | + * } | |
| 487 | + * } | |
| 488 | + * } | |
| 489 | + * Window.messageBoxClosed.connect(onMessageBoxClosed); | |
| 490 | + * | |
| 491 | + * messageBox = Window.openMessageBox("Reset Something", | |
| 492 | + * "Do you want to reset something?", | |
| 493 | + * resetButton + cancelButton, cancelButton); | |
| 494 | + */ | |
| 80 | 495 | int openMessageBox(QString title, QString text, int buttons, int defaultButton); |
| 496 | + | |
| 497 | + /**jsdoc | |
| 498 | + * Update the content of a message box that was opened with {@link Window.openMessageBox|openMessageBox}. | |
| 499 | + * @function Window.updateMessageBox | |
| 500 | + * @param {number} id - The ID of the message box. | |
| 501 | + * @param {string} title - The title to display for the message box. | |
| 502 | + * @param {string} text - Text to display in the message box. | |
| 503 | + * @param {Window.MessageBoxButton} buttons - The buttons to display on the message box; one or more button values added | |
| 504 | + * together. | |
| 505 | + * @param {Window.MessageBoxButton} defaultButton - The button that has focus when the message box is opened. | |
| 506 | + */ | |
| 81 | 507 | void updateMessageBox(int id, QString title, QString text, int buttons, int defaultButton); |
| 508 | + | |
| 509 | + /**jsdoc | |
| 510 | + * Close a message box that was opened with {@link Window.openMessageBox|openMessageBox}. | |
| 511 | + * @function Window.closeMessageBox | |
| 512 | + * @param {number} id - The ID of the message box. | |
| 513 | + */ | |
| 82 | 514 | void closeMessageBox(int id); |
| 83 | 515 | |
| 84 | 516 | private slots: |
| @@ -86,26 +518,168 @@ private slots: · 1 unmodified line | ||
| 86 | 518 | void disconnectedFromDomain(); |
| 87 | 519 | |
| 88 | 520 | signals: |
| 89 | − void domainChanged(const QString& domainHostname); | |
| 521 | + | |
| 522 | + /**jsdoc | |
| 523 | + * Triggered when you change the domain you're visiting. <strong>Warning:</strong> Is not emitted if you go to domain that | |
| 524 | + * isn't running. | |
| 525 | + * @function Window.domainChanged | |
| 526 | + * @param {string} domain - The domain's IP address. | |
| 527 | + * @returns {Signal} | |
| 528 | + * @example <caption>Report when you change domains.</caption> | |
| 529 | + * function onDomainChanged(domain) { | |
| 530 | + * print("Domain changed: " + domain); | |
| 531 | + * } | |
| 532 | + * | |
| 533 | + * Window.domainChanged.connect(onDomainChanged); | |
| 534 | + */ | |
| 535 | + void domainChanged(const QString& domain); | |
| 536 | + | |
| 537 | + /**jsdoc | |
| 538 | + * Triggered when you try to navigate to a *.json, *.svo, or *.svo.json URL in a Web browser within Interface. | |
| 539 | + * @function Window.svoImportRequested | |
| 540 | + * @param {string} url - The URL of the file to import. | |
| 541 | + * @returns {Signal} | |
| 542 | + */ | |
| 90 | 543 | void svoImportRequested(const QString& url); |
| 544 | + | |
| 545 | + /**jsdoc | |
| 546 | + * Triggered when you try to visit a domain but are refused connection. | |
| 547 | + * @function Window.domainConnectionRefused | |
| 548 | + * @param {string} reasonMessage - A description of the refusal. | |
| 549 | + * @param {Window.ConnectionRefusedReason} reasonCode - Integer number that enumerates the reason for the refusal. | |
| 550 | + * @param {string} extraInfo - Extra information about the refusal. | |
| 551 | + * @returns {Signal} | |
| 552 | + */ | |
| 91 | 553 | void domainConnectionRefused(const QString& reasonMessage, int reasonCode, const QString& extraInfo); |
| 554 | + | |
| 555 | + /**jsdoc | |
| 556 | + * Triggered when a still snapshot has been taken by calling {@link Window.takeSnapshot|takeSnapshot} with | |
| 557 | + * <code>includeAnimated = false</code>. | |
| 558 | + * @function Window.stillSnapshotTaken | |
| 559 | + * @param {string} pathStillSnapshot - The path and name of the snapshot image file. | |
| 560 | + * @param {boolean} notify - The value of the <code>notify</code> parameter that {@link Window.takeSnapshot|takeSnapshot} | |
| 561 | + * was called with. | |
| 562 | + * @returns {Signal} | |
| 563 | + */ | |
| 92 | 564 | void stillSnapshotTaken(const QString& pathStillSnapshot, bool notify); |
| 565 | + | |
| 566 | + /**jsdoc | |
| 567 | + * Triggered when a snapshot submitted via {@link Window.shareSnapshot|shareSnapshot} is ready for sharing. The snapshot | |
| 568 | + * may then be shared via the {@link Account.metaverseServerURL} Web API. | |
| 569 | + * @function Window.snapshotShared | |
| 570 | + * @param {boolean} isError - <code>true</code> if an error was encountered preparing the snapshot for sharing, otherwise | |
| 571 | + * <code>false</code>. | |
| 572 | + * @param {string} reply - JSON-formatted information about the snapshot. | |
| 573 | + * @returns {Signal} | |
| 574 | + */ | |
| 93 | 575 | void snapshotShared(bool isError, const QString& reply); |
| 576 | + | |
| 577 | + /**jsdoc | |
| 578 | + * Triggered when the snapshot images have been captured by {@link Window.takeSnapshot|takeSnapshot} and the GIF is | |
| 579 | + * starting to be processed. | |
| 580 | + * @function Window.processingGifStarted | |
| 581 | + * @param {string} pathStillSnapshot - The path and name of the still snapshot image file. | |
| 582 | + * @returns {Signal} | |
| 583 | + */ | |
| 94 | 584 | void processingGifStarted(const QString& pathStillSnapshot); |
| 585 | + | |
| 586 | + /**jsdoc | |
| 587 | + * Triggered when a GIF has been prepared of the snapshot images captured by {@link Window.takeSnapshot|takeSnapshot}. | |
| 588 | + * @function Window.processingGifCompleted | |
| 589 | + * @param {string} pathAnimatedSnapshot - The path and name of the moving snapshot GIF file. | |
| 590 | + * @returns {Signal} | |
| 591 | + */ | |
| 95 | 592 | void processingGifCompleted(const QString& pathAnimatedSnapshot); |
| 96 | 593 | |
| 594 | + | |
| 595 | + /**jsdoc | |
| 596 | + * Triggered when you've successfully made a user connection. | |
| 597 | + * @function Window.connectionAdded | |
| 598 | + * @param {string} message - A description of the success. | |
| 599 | + * @returns {Signal} | |
| 600 | + */ | |
| 97 | 601 | void connectionAdded(const QString& connectionName); |
| 602 | + | |
| 603 | + /**jsdoc | |
| 604 | + * Triggered when you failed to make a user connection. | |
| 605 | + * @function Window.connectionError | |
| 606 | + * @param {string} message - A description of the error. | |
| 607 | + * @returns {Signal} | |
| 608 | + */ | |
| 98 | 609 | void connectionError(const QString& errorString); |
| 610 | + | |
| 611 | + /**jsdoc | |
| 612 | + * Triggered when a message is announced by {@link Window.displayAnnouncement|displayAnnouncement}. | |
| 613 | + * @function Window.announcement | |
| 614 | + * @param {string} message - The message text. | |
| 615 | + * @returns {Signal} | |
| 616 | + */ | |
| 99 | 617 | void announcement(const QString& message); |
| 100 | 618 | |
| 619 | + | |
| 620 | + /**jsdoc | |
| 621 | + * Triggered when the user closes a message box that was opened with {@link Window.openMessageBox|openMessageBox}. | |
| 622 | + * @function Window.messageBoxClosed | |
| 623 | + * @param {number} id - The ID of the message box that was closed. | |
| 624 | + * @param {number} button - The button that the user clicked. If the user presses Esc, the Cancel button value is returned, | |
| 625 | + * whether or not the Cancel button is displayed in the message box. | |
| 626 | + * @returns {Signal} | |
| 627 | + */ | |
| 101 | 628 | void messageBoxClosed(int id, int button); |
| 629 | + | |
| 630 | + /**jsdoc | |
| 631 | + * Triggered when the user chooses a directory in a {@link Window.browseDirAsync|browseDirAsync} dialog. | |
| 632 | + * @function Window.browseDirChanged | |
| 633 | + * @param {string} directory - The directory the user chose in the dialog. | |
| 634 | + * @returns {Signal} | |
| 635 | + */ | |
| 102 | 636 | void browseDirChanged(QString browseDir); |
| 637 | + | |
| 638 | + /**jsdoc | |
| 639 | + * Triggered when the user chooses an asset in a {@link Window.browseAssetsAsync|browseAssetsAsync} dialog. | |
| 640 | + * @function Window.assetsDirChanged | |
| 641 | + * @param {string} asset - The path and name of the asset the user chose in the dialog. | |
| 642 | + * @returns {Signal} | |
| 643 | + */ | |
| 103 | 644 | void assetsDirChanged(QString assetsDir); |
| 645 | + | |
| 646 | + /**jsdoc | |
| 647 | + * Triggered when the user specifies a file in a {@link Window.saveAsync|saveAsync} dialog. | |
| 648 | + * @function Window.saveFileChanged | |
| 649 | + * @param {string} filename - The path and name of the file that the user specified in the dialog. | |
| 650 | + * @returns {Signal} | |
| 651 | + */ | |
| 104 | 652 | void saveFileChanged(QString filename); |
| 653 | + | |
| 654 | + /**jsdoc | |
| 655 | + * Triggered when the user chooses a file in a {@link Window.browseAsync|browseAsync} dialog. | |
| 656 | + * @function Window.openFileChanged | |
| 657 | + * @param {string} filename - The path and name of the file the user chose in the dialog. | |
| 658 | + * @returns {Signal} | |
| 659 | + */ | |
| 105 | 660 | void openFileChanged(QString filename); |
| 661 | + | |
| 662 | + /**jsdoc | |
| 663 | + * Triggered when the user OKs a {@link Window.promptAsync|promptAsync} dialog. | |
| 664 | + * @function Window.promptTextChanged | |
| 665 | + * @param {string} text - The text the user entered in the dialog. | |
| 666 | + * @returns {Signal} | |
| 667 | + */ | |
| 106 | 668 | void promptTextChanged(QString text); |
| 107 | 669 | |
| 108 | − // triggered when window size or position changes | |
| 670 | + | |
| 671 | + /**jsdoc | |
| 672 | + * Triggered when the position or size of the Interface window changes. | |
| 673 | + * @function Window.geometryChanged | |
| 674 | + * @param {Rect} geometry - The position and size of the drawable area of the Interface window. | |
| 675 | + * @returns {Signal} | |
| 676 | + * @example <caption>Report the position of size of the Interface window when it changes.</caption> | |
| 677 | + * function onWindowGeometryChanged(rect) { | |
| 678 | + * print("Window geometry: " + JSON.stringify(rect)); | |
| 679 | + * } | |
| 680 | + * | |
| 681 | + * Window.geometryChanged.connect(onWindowGeometryChanged); | |
| 682 | + */ | |
| 109 | 683 | void geometryChanged(QRect geometry); |
| 110 | 684 | |
| 111 | 685 | private: |