From 302e876857358d9bb32f827675d23f7c4fba3f18 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Thu, 9 May 2019 10:26:16 +1200 Subject: [PATCH] Update InteractiveWindow JSDoc per changes in master --- .../scripting/DesktopScriptingInterface.cpp | 49 +++++++++++++++++-- .../src/scripting/DesktopScriptingInterface.h | 5 +- interface/src/ui/InteractiveWindow.cpp | 8 +++ 3 files changed, 56 insertions(+), 6 deletions(-) diff --git a/interface/src/scripting/DesktopScriptingInterface.cpp b/interface/src/scripting/DesktopScriptingInterface.cpp index 093678c474..8a34c8f2ba 100644 --- a/interface/src/scripting/DesktopScriptingInterface.cpp +++ b/interface/src/scripting/DesktopScriptingInterface.cpp @@ -22,6 +22,29 @@ #include #include +/**jsdoc + * The possible docking locations of an InteractiveWindow. + * @typedef {object} InteractiveWindow.DockAreas + * @property {InteractiveWindow.DockArea} TOP - Dock to the top edge of the Interface window. + * @property {InteractiveWindow.DockArea} BOTTOM - Dock to the bottom edge of the Interface window. + * @property {InteractiveWindow.DockArea} LEFT - Dock to the left edge of the Interface window. + * @property {InteractiveWindow.DockArea} RIGHT - Dock to the right edge of the Interface window. + */ +/**jsdoc + * A docking location of an InteractiveWindow. + * + * + * + * + * + * + * + * + * + * + *
ValueName

Description
0TOPDock to the top edge of the Interface window.
1BOTTOMDock to the bottom edge of the Interface window.
2LEFTDock to the left edge of the Interface window.
3RIGHTDock to the right edge of the Interface window.
+ * @typedef {number} InteractiveWindow.DockArea + */ static const QVariantMap DOCK_AREA { { "TOP", DockArea::TOP }, { "BOTTOM", DockArea::BOTTOM }, @@ -39,11 +62,27 @@ int DesktopScriptingInterface::getHeight() { } /**jsdoc - * The presentation mode specifies how an {@link InteractiveWindow} is displayed. - * @typedef {object} InteractiveWindow.PresentationMode - * @property {number} VIRTUAL - The window is displayed inside Interface: in the desktop window in desktop mode or on the HUD - * surface in HMD mode. - * @property {number} NATIVE - The window is displayed separately from the Interface window, as its own separate window. + * The possible display modes for an InteractiveWindow. + * @typedef {object} InteractiveWindow.PresentationModes + * @property {InteractiveWindow.PresentationMode} VIRTUAL - The window is displayed inside Interface: in the desktop window in + * desktop mode or on the HUD surface in HMD mode. + * @property {InteractiveWindow.PresentationMode} NATIVE - The window is displayed separately from the Interface window, as its + * own separate window. + */ +/**jsdoc + * A display mode for an InteractiveWindow. + * + * + * + * + * + * + * + * + *
ValueName

Description
0VIRTUALThe window is displayed inside Interface: in the desktop window in + * desktop mode or on the HUD surface in HMD mode.
1NATIVEThe window is displayed separately from the Interface window, as its + * own separate window.
+ * @typedef {number} InteractiveWindow.PresentationMode */ QVariantMap DesktopScriptingInterface::getPresentationMode() { static QVariantMap presentationModes { diff --git a/interface/src/scripting/DesktopScriptingInterface.h b/interface/src/scripting/DesktopScriptingInterface.h index 895594a264..5cd264606e 100644 --- a/interface/src/scripting/DesktopScriptingInterface.h +++ b/interface/src/scripting/DesktopScriptingInterface.h @@ -37,8 +37,11 @@ * top. Read-only. * @property {InteractiveWindow.Flags} CLOSE_BUTTON_HIDES - A flag value that makes an {@link InteractiveWindow} hide instead * of closing when the user clicks the "close" button. Read-only. - * @property {InteractiveWindow.PresentationMode} PresentationMode - The different display options for an + * @property {InteractiveWindow.PresentationModes} PresentationMode - The possible display options for an * {@link InteractiveWindow}: display inside Interface or in a separate desktop window. Read-only. + * @property {InteractiveWindow.DockAreas} DockArea - The possible docking locations of an {@link InteractiveWindow}: top, + * bottom, left, or right of the Interface window. + * Read-only. */ class DesktopScriptingInterface : public QObject, public Dependency { Q_OBJECT diff --git a/interface/src/ui/InteractiveWindow.cpp b/interface/src/ui/InteractiveWindow.cpp index a850c14b6f..72714ea8e8 100644 --- a/interface/src/ui/InteractiveWindow.cpp +++ b/interface/src/ui/InteractiveWindow.cpp @@ -79,6 +79,9 @@ void interactiveWindowPointerFromScriptValue(const QScriptValue& object, Interac * @property {InteractiveWindow.PresentationMode} [presentationMode=Desktop.PresentationMode.VIRTUAL] - * Desktop.PresentationMode.VIRTUAL to display the window inside Interface, .NATIVE to display it * as its own separate window. + * @property {InteractiveWindow.PresentationWindowInfo} [presentationWindowInfo] - Controls how a NATIVE window is + * displayed. If used, the window is docked to the specified edge of the Interface window, otherwise the window is + * displayed as its own separate window. * @property {InteractiveWindow.Flags} [flags=0] - Window behavior flags, set at window creation. Possible flag values are * provided as {@link Desktop|Desktop.ALWAYS_ON_TOP} and {@link Desktop|Desktop.CLOSE_BUTTON_HIDES}. */ @@ -107,6 +110,11 @@ InteractiveWindow::InteractiveWindow(const QString& sourceUrl, const QVariantMap auto mainWindow = qApp->getWindow(); _dockWidget = std::shared_ptr(new DockWidget(title, mainWindow), dockWidgetDeleter); + /**jsdoc + * Configures how a NATIVE window is displayed. + * @typedef {object} InteractiveWindow.PresentationWindowInfo + * @property {InteractiveWindow.DockArea} dockArea - The edge of the Interface window to dock to. + */ if (nativeWindowInfo.contains(DOCK_AREA_PROPERTY)) { DockArea dockedArea = (DockArea) nativeWindowInfo[DOCK_AREA_PROPERTY].toInt(); switch (dockedArea) {