mirror of
https://github.com/overte-org/overte.git
synced 2025-07-27 04:09:58 +02:00
Merge branch 'master' of github.com:highfidelity/hifi into coco
This commit is contained in:
commit
04c139c172
30 changed files with 1100 additions and 186 deletions
|
@ -22,6 +22,7 @@
|
||||||
#include <QtCore/QThread>
|
#include <QtCore/QThread>
|
||||||
#include <QtCore/QUrl>
|
#include <QtCore/QUrl>
|
||||||
#include <QtCore/QUrlQuery>
|
#include <QtCore/QUrlQuery>
|
||||||
|
#include <QSaveFile>
|
||||||
|
|
||||||
#include <AccountManager.h>
|
#include <AccountManager.h>
|
||||||
#include <Assignment.h>
|
#include <Assignment.h>
|
||||||
|
@ -1712,28 +1713,44 @@ void DomainServerSettingsManager::sortPermissions() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DomainServerSettingsManager::persistToFile() {
|
void DomainServerSettingsManager::persistToFile() {
|
||||||
sortPermissions();
|
QString settingsFilename = _configMap.getUserConfigFilename();
|
||||||
|
QDir settingsDir = QFileInfo(settingsFilename).dir();
|
||||||
// make sure we have the dir the settings file is supposed to live in
|
if (!settingsDir.exists() && !settingsDir.mkpath(".")) {
|
||||||
QFileInfo settingsFileInfo(_configMap.getUserConfigFilename());
|
// If the path already exists when the `mkpath` method is
|
||||||
|
// called, it will return true. It will only return false if the
|
||||||
if (!settingsFileInfo.dir().exists()) {
|
// path doesn't exist after the call returns.
|
||||||
settingsFileInfo.dir().mkpath(".");
|
qCritical("Could not create the settings file parent directory. Unable to persist settings.");
|
||||||
}
|
|
||||||
|
|
||||||
QFile settingsFile(_configMap.getUserConfigFilename());
|
|
||||||
|
|
||||||
if (settingsFile.open(QIODevice::WriteOnly)) {
|
|
||||||
// take a read lock so we can grab the config and write it to file
|
|
||||||
QReadLocker locker(&_settingsLock);
|
|
||||||
settingsFile.write(QJsonDocument::fromVariant(_configMap.getConfig()).toJson());
|
|
||||||
} else {
|
|
||||||
qCritical("Could not write to JSON settings file. Unable to persist settings.");
|
|
||||||
|
|
||||||
// failed to write, reload whatever the current config state is
|
|
||||||
// with a write lock since we're about to overwrite the config map
|
|
||||||
QWriteLocker locker(&_settingsLock);
|
QWriteLocker locker(&_settingsLock);
|
||||||
_configMap.loadConfig();
|
_configMap.loadConfig();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QSaveFile settingsFile(settingsFilename);
|
||||||
|
if (!settingsFile.open(QIODevice::WriteOnly)) {
|
||||||
|
qCritical("Could not open the JSON settings file. Unable to persist settings.");
|
||||||
|
QWriteLocker locker(&_settingsLock);
|
||||||
|
_configMap.loadConfig();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
sortPermissions();
|
||||||
|
|
||||||
|
QVariantMap conf;
|
||||||
|
{
|
||||||
|
QReadLocker locker(&_settingsLock);
|
||||||
|
conf = _configMap.getConfig();
|
||||||
|
}
|
||||||
|
QByteArray json = QJsonDocument::fromVariant(conf).toJson();
|
||||||
|
if (settingsFile.write(json) == -1) {
|
||||||
|
qCritical("Could not write to JSON settings file. Unable to persist settings.");
|
||||||
|
QWriteLocker locker(&_settingsLock);
|
||||||
|
_configMap.loadConfig();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!settingsFile.commit()) {
|
||||||
|
qCritical("Could not commit writes to JSON settings file. Unable to persist settings.");
|
||||||
|
QWriteLocker locker(&_settingsLock);
|
||||||
|
_configMap.loadConfig();
|
||||||
|
return; // defend against future code
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -209,7 +209,7 @@ link_hifi_libraries(
|
||||||
model-networking model-baker entities avatars trackers
|
model-networking model-baker entities avatars trackers
|
||||||
audio audio-client animation script-engine physics
|
audio audio-client animation script-engine physics
|
||||||
render-utils entities-renderer avatars-renderer ui qml auto-updater midi
|
render-utils entities-renderer avatars-renderer ui qml auto-updater midi
|
||||||
controllers plugins image trackers
|
controllers plugins image trackers platform
|
||||||
ui-plugins display-plugins input-plugins
|
ui-plugins display-plugins input-plugins
|
||||||
# Platform specific GL libraries
|
# Platform specific GL libraries
|
||||||
${PLATFORM_GL_BACKEND}
|
${PLATFORM_GL_BACKEND}
|
||||||
|
@ -228,6 +228,7 @@ target_bullet()
|
||||||
target_opengl()
|
target_opengl()
|
||||||
add_crashpad()
|
add_crashpad()
|
||||||
target_breakpad()
|
target_breakpad()
|
||||||
|
target_json()
|
||||||
|
|
||||||
# perform standard include and linking for found externals
|
# perform standard include and linking for found externals
|
||||||
foreach(EXTERNAL ${OPTIONAL_EXTERNALS})
|
foreach(EXTERNAL ${OPTIONAL_EXTERNALS})
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
//
|
//
|
||||||
// Application.h
|
// Application.h
|
||||||
// interface/src
|
// interface/src
|
||||||
//
|
//
|
||||||
|
@ -48,7 +48,6 @@
|
||||||
#include <ThreadSafeValueCache.h>
|
#include <ThreadSafeValueCache.h>
|
||||||
#include <shared/ConicalViewFrustum.h>
|
#include <shared/ConicalViewFrustum.h>
|
||||||
#include <shared/FileLogger.h>
|
#include <shared/FileLogger.h>
|
||||||
|
|
||||||
#include <RunningMarker.h>
|
#include <RunningMarker.h>
|
||||||
|
|
||||||
#include "avatar/MyAvatar.h"
|
#include "avatar/MyAvatar.h"
|
||||||
|
|
|
@ -22,6 +22,29 @@
|
||||||
#include <DependencyManager.h>
|
#include <DependencyManager.h>
|
||||||
#include <OffscreenUi.h>
|
#include <OffscreenUi.h>
|
||||||
|
|
||||||
|
/**jsdoc
|
||||||
|
* The possible docking locations of an <code>InteractiveWindow</code>.
|
||||||
|
* @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 <code>InteractiveWindow</code>.
|
||||||
|
* <table>
|
||||||
|
* <thead>
|
||||||
|
* <tr><th>Value</th><th>Name</p><th>Description</th>
|
||||||
|
* </thead>
|
||||||
|
* <tbody>
|
||||||
|
* <tr><td><code>0</code></td><td>TOP</td><td>Dock to the top edge of the Interface window.</td></tr>
|
||||||
|
* <tr><td><code>1</code></td><td>BOTTOM</td><td>Dock to the bottom edge of the Interface window.</td></tr>
|
||||||
|
* <tr><td><code>2</code></td><td>LEFT</td><td>Dock to the left edge of the Interface window.</td></tr>
|
||||||
|
* <tr><td><code>3</code></td><td>RIGHT</td><td>Dock to the right edge of the Interface window.</td></tr>
|
||||||
|
* <tbody>
|
||||||
|
* </table>
|
||||||
|
* @typedef {number} InteractiveWindow.DockArea
|
||||||
|
*/
|
||||||
static const QVariantMap DOCK_AREA {
|
static const QVariantMap DOCK_AREA {
|
||||||
{ "TOP", DockArea::TOP },
|
{ "TOP", DockArea::TOP },
|
||||||
{ "BOTTOM", DockArea::BOTTOM },
|
{ "BOTTOM", DockArea::BOTTOM },
|
||||||
|
@ -38,6 +61,29 @@ int DesktopScriptingInterface::getHeight() {
|
||||||
return size.height();
|
return size.height();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**jsdoc
|
||||||
|
* The possible display modes for an <code>InteractiveWindow</code>.
|
||||||
|
* @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 <code>InteractiveWindow</code>.
|
||||||
|
* <table>
|
||||||
|
* <thead>
|
||||||
|
* <tr><th>Value</th><th>Name</p><th>Description</th>
|
||||||
|
* </thead>
|
||||||
|
* <tbody>
|
||||||
|
* <tr><td><code>0</code></td><td>VIRTUAL</td><td>The window is displayed inside Interface: in the desktop window in
|
||||||
|
* desktop mode or on the HUD surface in HMD mode.</td></tr>
|
||||||
|
* <tr><td><code>1</code></td><td>NATIVE</td><td>The window is displayed separately from the Interface window, as its
|
||||||
|
* own separate window.</td></tr>
|
||||||
|
* <tbody>
|
||||||
|
* </table>
|
||||||
|
* @typedef {number} InteractiveWindow.PresentationMode
|
||||||
|
*/
|
||||||
QVariantMap DesktopScriptingInterface::getPresentationMode() {
|
QVariantMap DesktopScriptingInterface::getPresentationMode() {
|
||||||
static QVariantMap presentationModes {
|
static QVariantMap presentationModes {
|
||||||
{ "VIRTUAL", Virtual },
|
{ "VIRTUAL", Virtual },
|
||||||
|
|
|
@ -20,16 +20,28 @@
|
||||||
#include "ui/InteractiveWindow.h"
|
#include "ui/InteractiveWindow.h"
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
|
* The <code>Desktop</code> API provides the dimensions of the computer screen, sets the opacity of the HUD surface, and
|
||||||
|
* enables QML and HTML windows to be shown inside or outside of Interface.
|
||||||
|
*
|
||||||
* @namespace Desktop
|
* @namespace Desktop
|
||||||
*
|
*
|
||||||
* @hifi-interface
|
* @hifi-interface
|
||||||
* @hifi-client-entity
|
* @hifi-client-entity
|
||||||
* @hifi-avatar
|
* @hifi-avatar
|
||||||
*
|
*
|
||||||
* @property {number} width
|
* @property {number} width - The width of the computer screen including task bar and system menu, in pixels.
|
||||||
* @property {number} height
|
* <em>Read-only.</em>
|
||||||
* @property {number} ALWAYS_ON_TOP - InteractiveWindow flag for always showing a window on top
|
* @property {number} height - The height of the computer screen including task bar and system menu, in pixels.
|
||||||
* @property {number} CLOSE_BUTTON_HIDES - InteractiveWindow flag for hiding the window instead of closing on window close by user
|
* <em>Read-only.</em>
|
||||||
|
* @property {InteractiveWindow.Flags} ALWAYS_ON_TOP - A flag value that makes an {@link InteractiveWindow} always display on
|
||||||
|
* top. <em>Read-only.</em>
|
||||||
|
* @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.<em> Read-only.</em>
|
||||||
|
* @property {InteractiveWindow.PresentationModes} PresentationMode - The possible display options for an
|
||||||
|
* {@link InteractiveWindow}: display inside Interface or in a separate desktop window. <em>Read-only.</em>
|
||||||
|
* @property {InteractiveWindow.DockAreas} DockArea - The possible docking locations of an {@link InteractiveWindow}: top,
|
||||||
|
* bottom, left, or right of the Interface window.
|
||||||
|
* <em>Read-only.</em>
|
||||||
*/
|
*/
|
||||||
class DesktopScriptingInterface : public QObject, public Dependency {
|
class DesktopScriptingInterface : public QObject, public Dependency {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -42,9 +54,43 @@ class DesktopScriptingInterface : public QObject, public Dependency {
|
||||||
Q_PROPERTY(int CLOSE_BUTTON_HIDES READ flagCloseButtonHides CONSTANT FINAL)
|
Q_PROPERTY(int CLOSE_BUTTON_HIDES READ flagCloseButtonHides CONSTANT FINAL)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
/**jsdoc
|
||||||
|
* Sets the opacity of the HUD surface.
|
||||||
|
* @function Desktop.setHUDAlpha
|
||||||
|
* @param {number} alpha - The opacity, <code>0.0 – 1.0</code>.
|
||||||
|
*/
|
||||||
Q_INVOKABLE void setHUDAlpha(float alpha);
|
Q_INVOKABLE void setHUDAlpha(float alpha);
|
||||||
|
|
||||||
|
/**jsdoc
|
||||||
|
* Opens a QML window within Interface: in the Interface window in desktop mode or on the HUD surface in HMD mode. If a
|
||||||
|
* window of the specified name already exists, it is shown, otherwise a new window is created from the QML.
|
||||||
|
* @function Desktop.show
|
||||||
|
* @param {string} url - The QML file that specifies the window content.
|
||||||
|
* @param {string} name - A unique name for the window.
|
||||||
|
* @example <caption>Open the general settings dialog.</caption>
|
||||||
|
* Desktop.show("hifi/dialogs/GeneralPreferencesDialog.qml", "GeneralPreferencesDialog");
|
||||||
|
*/
|
||||||
Q_INVOKABLE void show(const QString& path, const QString& title);
|
Q_INVOKABLE void show(const QString& path, const QString& title);
|
||||||
|
|
||||||
|
/**jsdoc
|
||||||
|
* Creates a new window that can be displayed either within Interface or as a separate desktop window.
|
||||||
|
* @function Desktop.createWindow
|
||||||
|
* @param {string} url - The QML file that specifies the window content. The QML file can use a <code>WebView</code>
|
||||||
|
* control (defined by "WebView.qml" included in the Interface install) to embed an HTML web page (complete with
|
||||||
|
* <code>EventBridge</code> object).
|
||||||
|
* @param {InteractiveWindow.Properties} [properties] - Initial window properties.
|
||||||
|
* @returns {InteractiveWindow} A new window object.
|
||||||
|
* @example <caption>Open a dialog in its own window separate from Interface.</caption>
|
||||||
|
* var nativeWindow = Desktop.createWindow(Script.resourcesPath() + 'qml/OverlayWindowTest.qml', {
|
||||||
|
* title: "Native Window",
|
||||||
|
* presentationMode: Desktop.PresentationMode.NATIVE,
|
||||||
|
* size: { x: 500, y: 400 }
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* Script.scriptEnding.connect(function () {
|
||||||
|
* nativeWindow.close();
|
||||||
|
* });
|
||||||
|
*/
|
||||||
Q_INVOKABLE InteractiveWindowPointer createWindow(const QString& sourceUrl, const QVariantMap& properties = QVariantMap());
|
Q_INVOKABLE InteractiveWindowPointer createWindow(const QString& sourceUrl, const QVariantMap& properties = QVariantMap());
|
||||||
|
|
||||||
int getWidth();
|
int getWidth();
|
||||||
|
|
|
@ -13,69 +13,90 @@
|
||||||
|
|
||||||
class QScriptValue;
|
class QScriptValue;
|
||||||
|
|
||||||
|
/**jsdoc
|
||||||
|
* The <code>PlatformInfo</code> API provides information about the computer and controllers being used.
|
||||||
|
*
|
||||||
|
* @namespace PlatformInfo
|
||||||
|
*
|
||||||
|
* @hifi-interface
|
||||||
|
* @hifi-client-entity
|
||||||
|
* @hifi-avatar
|
||||||
|
*/
|
||||||
class PlatformInfoScriptingInterface : public QObject {
|
class PlatformInfoScriptingInterface : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
/**jsdoc
|
||||||
|
* @function PlatformInfo.getInstance
|
||||||
|
* @deprecated This function is deprecated and will be removed.
|
||||||
|
*/
|
||||||
static PlatformInfoScriptingInterface* getInstance();
|
static PlatformInfoScriptingInterface* getInstance();
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Returns the Operating Sytem type
|
* Gets the operating system type.
|
||||||
* @function Test.getOperatingSystemType
|
* @function PlatformInfo.getOperatingSystemType
|
||||||
* @returns {string} "WINDOWS", "MACOS" or "UNKNOWN"
|
* @returns {string} <code>"WINDOWS"</code>, <code>"MACOS"</code>, or <code>"UNKNOWN"</code>.
|
||||||
*/
|
*/
|
||||||
QString getOperatingSystemType();
|
QString getOperatingSystemType();
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Returns the CPU brand
|
* Gets information on the CPU.
|
||||||
*function PlatformInfo.getCPUBrand()
|
* @function PlatformInfo.getCPUBrand
|
||||||
* @returns {string} brand of CPU
|
* @returns {string} Information on the CPU.
|
||||||
|
* @example <caption>Report the CPU being used.</caption>
|
||||||
|
* print("CPU: " + PlatformInfo.getCPUBrand());
|
||||||
|
* // Example: Intel(R) Core(TM) i7-7820HK CPU @ 2.90GHz
|
||||||
*/
|
*/
|
||||||
QString getCPUBrand();
|
QString getCPUBrand();
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Returns the number of logical CPU cores
|
* Gets the number of logical CPU cores.
|
||||||
*function PlatformInfo.getNumLogicalCores()
|
* @function PlatformInfo.getNumLogicalCores
|
||||||
* @returns {int} number of logical CPU cores
|
* @returns {number} The number of logical CPU cores.
|
||||||
*/
|
*/
|
||||||
unsigned int getNumLogicalCores();
|
unsigned int getNumLogicalCores();
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Returns the total system memory in megabyte
|
* Returns the total system memory in megabytes.
|
||||||
*function PlatformInfo.getTotalSystemMemory()
|
* @function PlatformInfo.getTotalSystemMemoryMB
|
||||||
* @returns {int} size of memory in megabytes
|
* @returns {number} The total system memory in megabytes.
|
||||||
*/
|
*/
|
||||||
int getTotalSystemMemoryMB();
|
int getTotalSystemMemoryMB();
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Returns the graphics card type
|
* Gets the graphics card type.
|
||||||
* @function Test.getGraphicsCardType
|
* @function PlatformInfo.getGraphicsCardType
|
||||||
* @returns {string} graphics card type
|
* @returns {string} The graphics card type.
|
||||||
*/
|
*/
|
||||||
QString getGraphicsCardType();
|
QString getGraphicsCardType();
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Returns true if Oculus Rift is connected (looks for hand controllers)
|
* Checks whether Oculus Touch controllers are connected.
|
||||||
* @function Window.hasRift
|
* @function PlatformInfo.hasRiftControllers
|
||||||
* @returns {boolean} <code>true</code> if running on Windows, otherwise <code>false</code>.*/
|
* @returns {boolean} <code>true</code> if Oculus Touch controllers are connected, <code>false</code> if they aren't.
|
||||||
|
*/
|
||||||
bool hasRiftControllers();
|
bool hasRiftControllers();
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Returns true if HTC Vive is connected (looks for hand controllers)
|
* Checks whether Vive controllers are connected.
|
||||||
* @function Window.hasRift
|
* @function PlatformInfo.hasViveControllers
|
||||||
* @returns {boolean} <code>true</code> if running on Windows, otherwise <code>false</code>.*/
|
* @returns {boolean} <code>true</code> if Vive controllers are connected, <code>false</code> if they aren't.
|
||||||
|
*/
|
||||||
bool hasViveControllers();
|
bool hasViveControllers();
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Returns true if device supports 3d HTML
|
* Checks whether HTML on 3D surfaces (e.g., Web entities) is supported.
|
||||||
* @function Window.has3DHTML
|
* @function PlatformInfo.has3DHTML
|
||||||
* @returns {boolean} <code>true</code> if device supports 3d HTML, otherwise <code>false</code>.*/
|
* @returns {boolean} <code>true</code> if the current display supports HTML on 3D surfaces, <code>false</code> if it
|
||||||
|
* doesn't.
|
||||||
|
*/
|
||||||
bool has3DHTML();
|
bool has3DHTML();
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Returns true if device is standalone
|
* Checks whether Interface is running on a stand-alone HMD device (CPU incorporated into the HMD display).
|
||||||
* @function Window.hasRift
|
* @function PlatformInfo.isStandalone
|
||||||
* @returns {boolean} <code>true</code> if device is a standalone device, otherwise <code>false</code>.*/
|
* @returns {boolean} <code>true</code> if Interface is running on a stand-alone device, <code>false</code> if it isn't.
|
||||||
|
*/
|
||||||
bool isStandalone();
|
bool isStandalone();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -23,9 +23,9 @@
|
||||||
#include <DependencyManager.h>
|
#include <DependencyManager.h>
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* The Window API provides various facilities not covered elsewhere: window dimensions, window focus, normal or entity camera
|
* The <code>Window</code> API provides various facilities not covered elsewhere, including: window dimensions, window focus,
|
||||||
* view, clipboard, announcements, user connections, common dialog boxes, snapshots, file import, domain changes, domain
|
* camera view, announcements, user connections, common dialog boxes, snapshots, file import, domain navigation, domain changes,
|
||||||
* physics.
|
* domain physics, OS clipboard, build number.
|
||||||
*
|
*
|
||||||
* @namespace Window
|
* @namespace Window
|
||||||
*
|
*
|
||||||
|
@ -37,13 +37,13 @@
|
||||||
* chrome), in pixels. <em>Read-only.</em>
|
* chrome), in pixels. <em>Read-only.</em>
|
||||||
* @property {number} innerHeight - The height of the drawable area of the Interface window (i.e., without borders or other
|
* @property {number} innerHeight - The height of the drawable area of the Interface window (i.e., without borders or other
|
||||||
* chrome), in pixels. <em>Read-only.</em>
|
* chrome), in pixels. <em>Read-only.</em>
|
||||||
* @property {object} location - Provides facilities for working with your current metaverse location. See {@link location}.
|
|
||||||
* @property {number} x - The x display coordinate of the top left corner of the drawable area of the Interface window.
|
* @property {number} x - The x display coordinate of the top left corner of the drawable area of the Interface window.
|
||||||
* <em>Read-only.</em>
|
* <em>Read-only.</em>
|
||||||
* @property {number} y - The y display coordinate of the top left corner of the drawable area of the Interface window.
|
* @property {number} y - The y display coordinate of the top left corner of the drawable area of the Interface window.
|
||||||
* <em>Read-only.</em>
|
* <em>Read-only.</em>
|
||||||
* @property {boolean} interstitialModeEnabled=true - <code>true</code> if the interstitial graphics are displayed when the
|
* @property {boolean} interstitialModeEnabled=false - <code>true</code> if the interstitial graphics are displayed when a
|
||||||
* domain is loading, otherwise <code>false</code>.
|
* domain is loading, otherwise <code>false</code>.
|
||||||
|
* @property {location} location - Provides facilities for working with your current metaverse location.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class WindowScriptingInterface : public QObject, public Dependency {
|
class WindowScriptingInterface : public QObject, public Dependency {
|
||||||
|
@ -65,27 +65,27 @@ public:
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Check if the Interface window has focus.
|
* Checks whether the Interface window has focus.
|
||||||
* @function Window.hasFocus
|
* @function Window.hasFocus
|
||||||
* @returns {boolean} <code>true</code> if the Interface window has focus, otherwise <code>false</code>.
|
* @returns {boolean} <code>true</code> if the Interface window has focus, <code>false</code> if it doesn't.
|
||||||
*/
|
*/
|
||||||
QScriptValue hasFocus();
|
QScriptValue hasFocus();
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Make the Interface window have focus. On Windows, if Interface doesn't already have focus, the task bar icon flashes to
|
* Makes the Interface window have focus. On Windows, if Interface doesn't already have focus, the task bar icon flashes to
|
||||||
* indicate that Interface wants attention but focus isn't taken away from the application that the user is using.
|
* indicate that Interface wants attention but focus isn't taken away from the application that the user is using.
|
||||||
* @function Window.setFocus
|
* @function Window.setFocus
|
||||||
*/
|
*/
|
||||||
void setFocus();
|
void setFocus();
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Raise the Interface window if it is minimized. If raised, the window gains focus.
|
* Raises the Interface window if it is minimized. If raised, the window gains focus.
|
||||||
* @function Window.raise
|
* @function Window.raise
|
||||||
*/
|
*/
|
||||||
void raise();
|
void raise();
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Display a dialog with the specified message and an "OK" button. The dialog is non-modal; the script continues without
|
* Displays a dialog with the specified message and an "OK" button. The dialog is non-modal; the script continues without
|
||||||
* waiting for a user response.
|
* waiting for a user response.
|
||||||
* @function Window.alert
|
* @function Window.alert
|
||||||
* @param {string} [message=""] - The message to display.
|
* @param {string} [message=""] - The message to display.
|
||||||
|
@ -96,8 +96,7 @@ public slots:
|
||||||
void alert(const QString& message = "");
|
void alert(const QString& message = "");
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Prompt the user to confirm something. Displays a modal dialog with a message plus "Yes" and "No" buttons.
|
* Prompts the user to confirm something. Displays a modal dialog with a message plus "Yes" and "No" buttons.
|
||||||
* responds.
|
|
||||||
* @function Window.confirm
|
* @function Window.confirm
|
||||||
* @param {string} [message=""] - The question to display.
|
* @param {string} [message=""] - The question to display.
|
||||||
* @returns {boolean} <code>true</code> if the user selects "Yes", otherwise <code>false</code>.
|
* @returns {boolean} <code>true</code> if the user selects "Yes", otherwise <code>false</code>.
|
||||||
|
@ -108,7 +107,7 @@ public slots:
|
||||||
QScriptValue confirm(const QString& message = "");
|
QScriptValue confirm(const QString& message = "");
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Prompt the user to enter some text. Displays a modal dialog with a message and a text box, plus "OK" and "Cancel"
|
* Prompts the user to enter some text. Displays a modal dialog with a message and a text box, plus "OK" and "Cancel"
|
||||||
* buttons.
|
* buttons.
|
||||||
* @function Window.prompt
|
* @function Window.prompt
|
||||||
* @param {string} message - The question to display.
|
* @param {string} message - The question to display.
|
||||||
|
@ -125,7 +124,7 @@ public slots:
|
||||||
QScriptValue prompt(const QString& message, const QString& defaultText);
|
QScriptValue prompt(const QString& message, const QString& defaultText);
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Prompt the user to enter some text. Displays a non-modal dialog with a message and a text box, plus "OK" and "Cancel"
|
* Prompts the user to enter some text. Displays a non-modal dialog with a message and a text box, plus "OK" and "Cancel"
|
||||||
* buttons. A {@link Window.promptTextChanged|promptTextChanged} signal is emitted when the user OKs the dialog; no signal
|
* buttons. A {@link Window.promptTextChanged|promptTextChanged} signal is emitted when the user OKs the dialog; no signal
|
||||||
* is emitted if the user cancels the dialog.
|
* is emitted if the user cancels the dialog.
|
||||||
* @function Window.promptAsync
|
* @function Window.promptAsync
|
||||||
|
@ -143,7 +142,7 @@ public slots:
|
||||||
void promptAsync(const QString& message = "", const QString& defaultText = "");
|
void promptAsync(const QString& message = "", const QString& defaultText = "");
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Prompt the user to choose a directory. Displays a modal dialog that navigates the directory tree.
|
* Prompts the user to choose a directory. Displays a modal dialog that navigates the directory tree.
|
||||||
* @function Window.browseDir
|
* @function Window.browseDir
|
||||||
* @param {string} [title=""] - The title to display at the top of the dialog.
|
* @param {string} [title=""] - The title to display at the top of the dialog.
|
||||||
* @param {string} [directory=""] - The initial directory to start browsing at.
|
* @param {string} [directory=""] - The initial directory to start browsing at.
|
||||||
|
@ -155,7 +154,7 @@ public slots:
|
||||||
QScriptValue browseDir(const QString& title = "", const QString& directory = "");
|
QScriptValue browseDir(const QString& title = "", const QString& directory = "");
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Prompt the user to choose a directory. Displays a non-modal dialog that navigates the directory tree. A
|
* Prompts the user to choose a directory. Displays a non-modal dialog that navigates the directory tree. A
|
||||||
* {@link Window.browseDirChanged|browseDirChanged} signal is emitted when a directory is chosen; no signal is emitted if
|
* {@link Window.browseDirChanged|browseDirChanged} signal is emitted when a directory is chosen; no signal is emitted if
|
||||||
* the user cancels the dialog.
|
* the user cancels the dialog.
|
||||||
* @function Window.browseDirAsync
|
* @function Window.browseDirAsync
|
||||||
|
@ -173,7 +172,7 @@ public slots:
|
||||||
void browseDirAsync(const QString& title = "", const QString& directory = "");
|
void browseDirAsync(const QString& title = "", const QString& directory = "");
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Prompt the user to choose a file. Displays a modal dialog that navigates the directory tree.
|
* Prompts the user to choose a file. Displays a modal dialog that navigates the directory tree.
|
||||||
* @function Window.browse
|
* @function Window.browse
|
||||||
* @param {string} [title=""] - The title to display at the top of the dialog.
|
* @param {string} [title=""] - The title to display at the top of the dialog.
|
||||||
* @param {string} [directory=""] - The initial directory to start browsing at.
|
* @param {string} [directory=""] - The initial directory to start browsing at.
|
||||||
|
@ -187,7 +186,7 @@ public slots:
|
||||||
QScriptValue browse(const QString& title = "", const QString& directory = "", const QString& nameFilter = "");
|
QScriptValue browse(const QString& title = "", const QString& directory = "", const QString& nameFilter = "");
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Prompt the user to choose a file. Displays a non-modal dialog that navigates the directory tree. A
|
* Prompts the user to choose a file. Displays a non-modal dialog that navigates the directory tree. A
|
||||||
* {@link Window.browseChanged|browseChanged} signal is emitted when a file is chosen; no signal is emitted if the user
|
* {@link Window.browseChanged|browseChanged} signal is emitted when a file is chosen; no signal is emitted if the user
|
||||||
* cancels the dialog.
|
* cancels the dialog.
|
||||||
* @function Window.browseAsync
|
* @function Window.browseAsync
|
||||||
|
@ -207,7 +206,7 @@ public slots:
|
||||||
void browseAsync(const QString& title = "", const QString& directory = "", const QString& nameFilter = "");
|
void browseAsync(const QString& title = "", const QString& directory = "", const QString& nameFilter = "");
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Prompt the user to specify the path and name of a file to save to. Displays a model dialog that navigates the directory
|
* Prompts the user to specify the path and name of a file to save to. Displays a model dialog that navigates the directory
|
||||||
* tree and allows the user to type in a file name.
|
* tree and allows the user to type in a file name.
|
||||||
* @function Window.save
|
* @function Window.save
|
||||||
* @param {string} [title=""] - The title to display at the top of the dialog.
|
* @param {string} [title=""] - The title to display at the top of the dialog.
|
||||||
|
@ -223,7 +222,7 @@ public slots:
|
||||||
QScriptValue save(const QString& title = "", const QString& directory = "", const QString& nameFilter = "");
|
QScriptValue save(const QString& title = "", const QString& directory = "", const QString& nameFilter = "");
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Prompt the user to specify the path and name of a file to save to. Displays a non-model dialog that navigates the
|
* Prompts the user to specify the path and name of a file to save to. Displays a non-model dialog that navigates the
|
||||||
* directory tree and allows the user to type in a file name. A {@link Window.saveFileChanged|saveFileChanged} signal is
|
* directory tree and allows the user to type in a file name. A {@link Window.saveFileChanged|saveFileChanged} signal is
|
||||||
* emitted when a file is specified; no signal is emitted if the user cancels the dialog.
|
* emitted when a file is specified; no signal is emitted if the user cancels the dialog.
|
||||||
* @function Window.saveAsync
|
* @function Window.saveAsync
|
||||||
|
@ -243,7 +242,7 @@ public slots:
|
||||||
void saveAsync(const QString& title = "", const QString& directory = "", const QString& nameFilter = "");
|
void saveAsync(const QString& title = "", const QString& directory = "", const QString& nameFilter = "");
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Prompt the user to choose an Asset Server item. Displays a modal dialog that navigates the tree of assets on the Asset
|
* Prompts the user to choose an Asset Server item. Displays a modal dialog that navigates the tree of assets on the Asset
|
||||||
* Server.
|
* Server.
|
||||||
* @function Window.browseAssets
|
* @function Window.browseAssets
|
||||||
* @param {string} [title=""] - The title to display at the top of the dialog.
|
* @param {string} [title=""] - The title to display at the top of the dialog.
|
||||||
|
@ -258,8 +257,8 @@ public slots:
|
||||||
QScriptValue browseAssets(const QString& title = "", const QString& directory = "", const QString& nameFilter = "");
|
QScriptValue browseAssets(const QString& title = "", const QString& directory = "", const QString& nameFilter = "");
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Prompt the user to choose an Asset Server item. Displays a non-modal dialog that navigates the tree of assets on the
|
* Prompts the user to choose an Asset Server item. Displays a non-modal dialog that navigates the tree of assets on the
|
||||||
* Asset Server. A {@link Window.assetsDirChanged|assetsDirChanged} signal is emitted when an asset is chosen; no signal is
|
* Asset Server. An {@link Window.assetsDirChanged|assetsDirChanged} signal is emitted when an asset is chosen; no signal is
|
||||||
* emitted if the user cancels the dialog.
|
* emitted if the user cancels the dialog.
|
||||||
* @function Window.browseAssetsAsync
|
* @function Window.browseAssetsAsync
|
||||||
* @param {string} [title=""] - The title to display at the top of the dialog.
|
* @param {string} [title=""] - The title to display at the top of the dialog.
|
||||||
|
@ -278,7 +277,7 @@ public slots:
|
||||||
void browseAssetsAsync(const QString& title = "", const QString& directory = "", const QString& nameFilter = "");
|
void browseAssetsAsync(const QString& title = "", const QString& directory = "", const QString& nameFilter = "");
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Open the Asset Browser dialog. If a file to upload is specified, the user is prompted to enter the folder and name to
|
* Opens the Asset Browser dialog. If a file to upload is specified, the user is prompted to enter the folder and name to
|
||||||
* map the file to on the asset server.
|
* map the file to on the asset server.
|
||||||
* @function Window.showAssetServer
|
* @function Window.showAssetServer
|
||||||
* @param {string} [uploadFile=""] - The path and name of a file to upload to the asset server.
|
* @param {string} [uploadFile=""] - The path and name of a file to upload to the asset server.
|
||||||
|
@ -290,14 +289,14 @@ public slots:
|
||||||
void showAssetServer(const QString& upload = "");
|
void showAssetServer(const QString& upload = "");
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Get Interface's build number.
|
* Gets Interface's build number.
|
||||||
* @function Window.checkVersion
|
* @function Window.checkVersion
|
||||||
* @returns {string} Interface's build number.
|
* @returns {string} Interface's build number.
|
||||||
*/
|
*/
|
||||||
QString checkVersion();
|
QString checkVersion();
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Get the signature for Interface's protocol version.
|
* Gets the signature for Interface's protocol version.
|
||||||
* @function Window.protocolSignature
|
* @function Window.protocolSignature
|
||||||
* @returns {string} A string uniquely identifying the version of the metaverse protocol that Interface is using.
|
* @returns {string} A string uniquely identifying the version of the metaverse protocol that Interface is using.
|
||||||
*/
|
*/
|
||||||
|
@ -317,25 +316,19 @@ public slots:
|
||||||
* are emitted. The path to store the snapshots and the length of the animated GIF to capture are specified in Settings >
|
* are emitted. The path to store the snapshots and the length of the animated GIF to capture are specified in Settings >
|
||||||
* General > Snapshots.
|
* General > Snapshots.
|
||||||
*
|
*
|
||||||
* If user has supplied a specific filename for the snapshot:
|
|
||||||
* If the user's requested filename has a suffix that's contained within SUPPORTED_IMAGE_FORMATS,
|
|
||||||
* DON'T append ".jpg" to the filename. QT will save the image in the format associated with the
|
|
||||||
* filename's suffix.
|
|
||||||
* If you want lossless Snapshots, supply a `.png` filename. Otherwise, use `.jpeg` or `.jpg`.
|
|
||||||
* Otherwise, ".jpg" is appended to the user's requested filename so that the image is saved in JPG format.
|
|
||||||
* If the user hasn't supplied a specific filename for the snapshot:
|
|
||||||
* Save the snapshot in JPG format according to FILENAME_PATH_FORMAT
|
|
||||||
* @function Window.takeSnapshot
|
* @function Window.takeSnapshot
|
||||||
* @param {boolean} [notify=true] - This value is passed on through the {@link Window.stillSnapshotTaken|stillSnapshotTaken}
|
* @param {boolean} [notify=true] - This value is passed on through the {@link Window.stillSnapshotTaken|stillSnapshotTaken}
|
||||||
* signal.
|
* signal.
|
||||||
* @param {boolean} [includeAnimated=false] - If <code>true</code>, a moving image is captured as an animated GIF in addition
|
* @param {boolean} [includeAnimated=false] - If <code>true</code>, a moving image is captured as an animated GIF in addition
|
||||||
* to a still image.
|
* to a still image.
|
||||||
* @param {number} [aspectRatio=0] - The width/height ratio of the snapshot required. If the value is <code>0</code> the
|
* @param {number} [aspectRatio=0] - The width/height ratio of the snapshot required. If the value is <code>0</code>, the
|
||||||
* full resolution is used (window dimensions in desktop mode; HMD display dimensions in HMD mode), otherwise one of the
|
* full resolution is used (window dimensions in desktop mode; HMD display dimensions in HMD mode), otherwise one of the
|
||||||
* dimensions is adjusted in order to match the aspect ratio.
|
* dimensions is adjusted in order to match the aspect ratio.
|
||||||
* @param {string} [filename=""] - If this parameter is not given, the image will be saved as "hifi-snap-by-<user name>-YYYY-MM-DD_HH-MM-SS".
|
* @param {string} [filename=""] - If a filename is not provided, the image is saved as "hifi-snap-by-<user
|
||||||
* If this parameter is <code>""</code> then the image will be saved as ".jpg".
|
* name>-on-YYYY-MM-DD_HH-MM-SS".<br />
|
||||||
* Otherwise, the image will be saved to this filename, with an appended ".jpg".
|
* Still images are saved in JPEG or PNG format according to the extension provided — <code>".jpg"</code>,
|
||||||
|
* <code>".jpeg"</code>, or <code>".png"</code> — or if not provided then in JPEG format with an extension of
|
||||||
|
* <code>".jpg"</code>. Animated images are saved in GIF format.
|
||||||
*
|
*
|
||||||
* @example <caption>Using the snapshot function and signals.</caption>
|
* @example <caption>Using the snapshot function and signals.</caption>
|
||||||
* function onStillSnapshotTaken(path, notify) {
|
* function onStillSnapshotTaken(path, notify) {
|
||||||
|
@ -368,9 +361,11 @@ public slots:
|
||||||
* @function Window.takeSecondaryCameraSnapshot
|
* @function Window.takeSecondaryCameraSnapshot
|
||||||
* @param {boolean} [notify=true] - This value is passed on through the {@link Window.stillSnapshotTaken|stillSnapshotTaken}
|
* @param {boolean} [notify=true] - This value is passed on through the {@link Window.stillSnapshotTaken|stillSnapshotTaken}
|
||||||
* signal.
|
* signal.
|
||||||
* @param {string} [filename=""] - If this parameter is not given, the image will be saved as "hifi-snap-by-<user name>-YYYY-MM-DD_HH-MM-SS".
|
* @param {string} [filename=""] - If a filename is not provided, the image is saved as "hifi-snap-by-<user
|
||||||
* If this parameter is <code>""</code> then the image will be saved as ".jpg".
|
* name>-on-YYYY-MM-DD_HH-MM-SS".<br />
|
||||||
* Otherwise, the image will be saved to this filename, with an appended ".jpg".
|
* Images are saved in JPEG or PNG format according to the extension provided — <code>".jpg"</code>,
|
||||||
|
* <code>".jpeg"</code>, or <code>".png"</code> — or if not provided then in JPEG format with an extension of
|
||||||
|
* <code>".jpg"</code>.
|
||||||
*/
|
*/
|
||||||
void takeSecondaryCameraSnapshot(const bool& notify = true, const QString& filename = QString());
|
void takeSecondaryCameraSnapshot(const bool& notify = true, const QString& filename = QString());
|
||||||
|
|
||||||
|
@ -380,17 +375,19 @@ public slots:
|
||||||
* @function Window.takeSecondaryCamera360Snapshot
|
* @function Window.takeSecondaryCamera360Snapshot
|
||||||
* @param {Vec3} cameraPosition - The position of the camera for the snapshot.
|
* @param {Vec3} cameraPosition - The position of the camera for the snapshot.
|
||||||
* @param {boolean} [cubemapOutputFormat=false] - If <code>true</code> then the snapshot is saved as a cube map image,
|
* @param {boolean} [cubemapOutputFormat=false] - If <code>true</code> then the snapshot is saved as a cube map image,
|
||||||
* otherwise is saved as an equirectangular image.
|
* otherwise it is saved as an equirectangular image.
|
||||||
* @param {boolean} [notify=true] - This value is passed on through the {@link Window.stillSnapshotTaken|stillSnapshotTaken}
|
* @param {boolean} [notify=true] - This value is passed on through the {@link Window.stillSnapshotTaken|stillSnapshotTaken}
|
||||||
* signal.
|
* signal.
|
||||||
* @param {string} [filename=""] - If this parameter is not supplied, the image will be saved as "hifi-snap-by-<user name>-YYYY-MM-DD_HH-MM-SS".
|
* @param {string} [filename=""] - If a filename is not provided, the image is saved as "hifi-snap-by-<user
|
||||||
* If this parameter is <code>""</code> then the image will be saved as ".jpg".
|
* name>-on-YYYY-MM-DD_HH-MM-SS".<br />
|
||||||
* Otherwise, the image will be saved to this filename, with an appended ".jpg".
|
* Images are saved in JPEG or PNG format according to the extension provided — <code>".jpg"</code>,
|
||||||
|
* <code>".jpeg"</code>, or <code>".png"</code> — or if not provided then in JPEG format with an extension of
|
||||||
|
* <code>".jpg"</code>.
|
||||||
*/
|
*/
|
||||||
void takeSecondaryCamera360Snapshot(const glm::vec3& cameraPosition, const bool& cubemapOutputFormat = false, const bool& notify = true, const QString& filename = QString());
|
void takeSecondaryCamera360Snapshot(const glm::vec3& cameraPosition, const bool& cubemapOutputFormat = false, const bool& notify = true, const QString& filename = QString());
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Emit a {@link Window.connectionAdded|connectionAdded} or a {@link Window.connectionError|connectionError} signal that
|
* Emits a {@link Window.connectionAdded|connectionAdded} or a {@link Window.connectionError|connectionError} signal that
|
||||||
* indicates whether or not a user connection was successfully made using the Web API.
|
* indicates whether or not a user connection was successfully made using the Web API.
|
||||||
* @function Window.makeConnection
|
* @function Window.makeConnection
|
||||||
* @param {boolean} success - If <code>true</code> then {@link Window.connectionAdded|connectionAdded} is emitted, otherwise
|
* @param {boolean} success - If <code>true</code> then {@link Window.connectionAdded|connectionAdded} is emitted, otherwise
|
||||||
|
@ -400,7 +397,7 @@ public slots:
|
||||||
void makeConnection(bool success, const QString& userNameOrError);
|
void makeConnection(bool success, const QString& userNameOrError);
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Display a notification message. Notifications are displayed in panels by the default script, nofications.js. An
|
* Displays a notification message. Notifications are displayed in panels by the default script, nofications.js. An
|
||||||
* {@link Window.announcement|announcement} signal is emitted when this function is called.
|
* {@link Window.announcement|announcement} signal is emitted when this function is called.
|
||||||
* @function Window.displayAnnouncement
|
* @function Window.displayAnnouncement
|
||||||
* @param {string} message - The announcement message.
|
* @param {string} message - The announcement message.
|
||||||
|
@ -416,7 +413,7 @@ public slots:
|
||||||
void displayAnnouncement(const QString& message);
|
void displayAnnouncement(const QString& message);
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Prepare a snapshot ready for sharing. A {@link Window.snapshotShared|snapshotShared} signal is emitted when the snapshot
|
* Prepares a snapshot ready for sharing. A {@link Window.snapshotShared|snapshotShared} signal is emitted when the snapshot
|
||||||
* has been prepared.
|
* has been prepared.
|
||||||
* @function Window.shareSnapshot
|
* @function Window.shareSnapshot
|
||||||
* @param {string} path - The path and name of the image file to share.
|
* @param {string} path - The path and name of the image file to share.
|
||||||
|
@ -425,7 +422,7 @@ public slots:
|
||||||
void shareSnapshot(const QString& path, const QUrl& href = QUrl(""));
|
void shareSnapshot(const QString& path, const QUrl& href = QUrl(""));
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Check to see if physics is active for you in the domain you're visiting - there is a delay between your arrival at a
|
* Checks to see if physics is active for you in the domain you're visiting - there is a delay between your arrival at a
|
||||||
* domain and physics becoming active for you in that domain.
|
* domain and physics becoming active for you in that domain.
|
||||||
* @function Window.isPhysicsEnabled
|
* @function Window.isPhysicsEnabled
|
||||||
* @returns {boolean} <code>true</code> if physics is currently active for you, otherwise <code>false</code>.
|
* @returns {boolean} <code>true</code> if physics is currently active for you, otherwise <code>false</code>.
|
||||||
|
@ -448,39 +445,16 @@ public slots:
|
||||||
bool isPhysicsEnabled();
|
bool isPhysicsEnabled();
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Set what to show on the PC display: normal view or entity camera view. The entity camera is configured using
|
* Sets what to show on the PC display. For entity camera view, the entity camera is configured using
|
||||||
* {@link Camera.setCameraEntity} and {@link Camera|Camera.mode}.
|
* {@link Camera.setCameraEntity} and {@link Camera|Camera.mode}.
|
||||||
* @function Window.setDisplayTexture
|
* @function Window.setDisplayTexture
|
||||||
* @param {Window.DisplayTexture} texture - The view to display.
|
* @param {Window.DisplayTexture} texture - The view to display.
|
||||||
* @returns {boolean} <code>true</code> if the display texture was successfully set, otherwise <code>false</code>.
|
* @returns {boolean} <code>true</code> if the display texture was successfully set, otherwise <code>false</code>.
|
||||||
*/
|
*/
|
||||||
// See spectatorCamera.js for Valid parameter values.
|
|
||||||
/**jsdoc
|
|
||||||
* <p>The views that may be displayed on the PC display.</p>
|
|
||||||
* <table>
|
|
||||||
* <thead>
|
|
||||||
* <tr>
|
|
||||||
* <th>Value</th>
|
|
||||||
* <th>View Displayed</th>
|
|
||||||
* </tr>
|
|
||||||
* </thead>
|
|
||||||
* <tbody>
|
|
||||||
* <tr>
|
|
||||||
* <td><code>""</code></td>
|
|
||||||
* <td>Normal view.</td>
|
|
||||||
* </tr>
|
|
||||||
* <tr>
|
|
||||||
* <td><code>"resource://spectatorCameraFrame"</code></td>
|
|
||||||
* <td>Entity camera view.</td>
|
|
||||||
* </tr>
|
|
||||||
* </tbody>
|
|
||||||
* </table>
|
|
||||||
* @typedef {string} Window.DisplayTexture
|
|
||||||
*/
|
|
||||||
bool setDisplayTexture(const QString& name);
|
bool setDisplayTexture(const QString& name);
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* 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
|
* Checks if a 2D point is within the desktop window if in desktop mode, or the drawable area of the HUD overlay if in HMD
|
||||||
* mode.
|
* mode.
|
||||||
* @function Window.isPointOnDesktopWindow
|
* @function Window.isPointOnDesktopWindow
|
||||||
* @param {Vec2} point - The point to check.
|
* @param {Vec2} point - The point to check.
|
||||||
|
@ -489,7 +463,7 @@ public slots:
|
||||||
bool isPointOnDesktopWindow(QVariant point);
|
bool isPointOnDesktopWindow(QVariant point);
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Get the size of the drawable area of the Interface window if in desktop mode or the HMD rendering surface if in HMD mode.
|
* Gets the size of the drawable area of the Interface window if in desktop mode or the HMD rendering surface if in HMD mode.
|
||||||
* @function Window.getDeviceSize
|
* @function Window.getDeviceSize
|
||||||
* @returns {Vec2} The width and height of the Interface window or HMD rendering surface, in pixels.
|
* @returns {Vec2} The width and height of the Interface window or HMD rendering surface, in pixels.
|
||||||
*/
|
*/
|
||||||
|
@ -503,7 +477,7 @@ public slots:
|
||||||
int getLastDomainConnectionError() const;
|
int getLastDomainConnectionError() const;
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Open a non-modal message box that can have a variety of button combinations. See also,
|
* Opens a non-modal message box that can have a variety of button combinations. See also,
|
||||||
* {@link Window.updateMessageBox|updateMessageBox} and {@link Window.closeMessageBox|closeMessageBox}.
|
* {@link Window.updateMessageBox|updateMessageBox} and {@link Window.closeMessageBox|closeMessageBox}.
|
||||||
* @function Window.openMessageBox
|
* @function Window.openMessageBox
|
||||||
* @param {string} title - The title to display for the message box.
|
* @param {string} title - The title to display for the message box.
|
||||||
|
@ -535,17 +509,21 @@ public slots:
|
||||||
int openMessageBox(QString title, QString text, int buttons, int defaultButton);
|
int openMessageBox(QString title, QString text, int buttons, int defaultButton);
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Open a URL in the Interface window or other application, depending on the URL's scheme. The following schemes are supported:
|
* Opens a URL in the Interface window or other application, depending on the URL's scheme. The following schemes are
|
||||||
* <code>hifi</code> (navigate to the URL in Interface), <code>hifiapp<code> (open a system app in Interface). Other schemes will either be handled by the OS
|
* supported:<br />
|
||||||
* (e.g. <code>http</code>, <code>https</code>, <code>mailto</code>) or will create a confirmation dialog asking the user to confirm that they want to try to open
|
* <ul>
|
||||||
* the URL.
|
* <li><code>hifi</code>: Navigate to the URL in Interface.</li>
|
||||||
|
* <li><code>hifiapp</code>: Open a system app in Interface.</li>
|
||||||
|
* </ul>
|
||||||
|
* Other schemes will either be handled by the OS (e.g. <code>http</code>, <code>https</code>, or <code>mailto</code>) or
|
||||||
|
* will display a dialog asking the user to confirm that they want to try to open the URL.
|
||||||
* @function Window.openUrl
|
* @function Window.openUrl
|
||||||
* @param {string} url - The URL to open.
|
* @param {string} url - The URL to open.
|
||||||
*/
|
*/
|
||||||
void openUrl(const QUrl& url);
|
void openUrl(const QUrl& url);
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Open an Android activity and optionally return back to the scene when the activity is completed. <em>Android only.</em>
|
* Opens an Android activity and optionally return back to the scene when the activity is completed. <em>Android only.</em>
|
||||||
* @function Window.openAndroidActivity
|
* @function Window.openAndroidActivity
|
||||||
* @param {string} activityName - The name of the activity to open: one of <code>"Home"</code>, <code>"Login"</code>, or
|
* @param {string} activityName - The name of the activity to open: one of <code>"Home"</code>, <code>"Login"</code>, or
|
||||||
* <code>"Privacy Policy"</code>.
|
* <code>"Privacy Policy"</code>.
|
||||||
|
@ -555,7 +533,7 @@ public slots:
|
||||||
void openAndroidActivity(const QString& activityName, const bool backToScene);
|
void openAndroidActivity(const QString& activityName, const bool backToScene);
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Update the content of a message box that was opened with {@link Window.openMessageBox|openMessageBox}.
|
* Updates the content of a message box that was opened with {@link Window.openMessageBox|openMessageBox}.
|
||||||
* @function Window.updateMessageBox
|
* @function Window.updateMessageBox
|
||||||
* @param {number} id - The ID of the message box.
|
* @param {number} id - The ID of the message box.
|
||||||
* @param {string} title - The title to display for the message box.
|
* @param {string} title - The title to display for the message box.
|
||||||
|
@ -567,12 +545,17 @@ public slots:
|
||||||
void updateMessageBox(int id, QString title, QString text, int buttons, int defaultButton);
|
void updateMessageBox(int id, QString title, QString text, int buttons, int defaultButton);
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Close a message box that was opened with {@link Window.openMessageBox|openMessageBox}.
|
* Closes a message box that was opened with {@link Window.openMessageBox|openMessageBox}.
|
||||||
* @function Window.closeMessageBox
|
* @function Window.closeMessageBox
|
||||||
* @param {number} id - The ID of the message box.
|
* @param {number} id - The ID of the message box.
|
||||||
*/
|
*/
|
||||||
void closeMessageBox(int id);
|
void closeMessageBox(int id);
|
||||||
|
|
||||||
|
/**jsdoc
|
||||||
|
* @function Window.domainLoadingProgress
|
||||||
|
* @returns {number} Progress.
|
||||||
|
* @deprecated This function is deprecated and will be removed.
|
||||||
|
*/
|
||||||
float domainLoadingProgress();
|
float domainLoadingProgress();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
|
@ -68,6 +68,23 @@ void interactiveWindowPointerFromScriptValue(const QScriptValue& object, Interac
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**jsdoc
|
||||||
|
* A set of properties used when creating an <code>InteractiveWindow</code>.
|
||||||
|
* @typedef {object} InteractiveWindow.Properties
|
||||||
|
* @property {string} [title="InteractiveWindow] - The title of the window.
|
||||||
|
* @property {Vec2} [position] - The initial position of the window, in pixels.
|
||||||
|
* @property {Vec2} [size] - The initial size of the window, in pixels
|
||||||
|
* @property {boolean} [visible=true] - <code>true</code> to make the window visible when created, <code>false</code> to make
|
||||||
|
* it invisible.
|
||||||
|
* @property {InteractiveWindow.PresentationMode} [presentationMode=Desktop.PresentationMode.VIRTUAL] -
|
||||||
|
* <code>Desktop.PresentationMode.VIRTUAL</code> to display the window inside Interface, <code>.NATIVE</code> to display it
|
||||||
|
* as its own separate window.
|
||||||
|
* @property {InteractiveWindow.PresentationWindowInfo} [presentationWindowInfo] - Controls how a <code>NATIVE</code> 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}.
|
||||||
|
*/
|
||||||
InteractiveWindow::InteractiveWindow(const QString& sourceUrl, const QVariantMap& properties) {
|
InteractiveWindow::InteractiveWindow(const QString& sourceUrl, const QVariantMap& properties) {
|
||||||
bool docked = false;
|
bool docked = false;
|
||||||
InteractiveWindowPresentationMode presentationMode = InteractiveWindowPresentationMode::Native;
|
InteractiveWindowPresentationMode presentationMode = InteractiveWindowPresentationMode::Native;
|
||||||
|
@ -95,6 +112,11 @@ InteractiveWindow::InteractiveWindow(const QString& sourceUrl, const QVariantMap
|
||||||
auto quickView = _dockWidget->getQuickView();
|
auto quickView = _dockWidget->getQuickView();
|
||||||
Application::setupQmlSurface(quickView->rootContext(), true);
|
Application::setupQmlSurface(quickView->rootContext(), true);
|
||||||
|
|
||||||
|
/**jsdoc
|
||||||
|
* Configures how a <code>NATIVE</code> 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)) {
|
if (nativeWindowInfo.contains(DOCK_AREA_PROPERTY)) {
|
||||||
DockArea dockedArea = (DockArea) nativeWindowInfo[DOCK_AREA_PROPERTY].toInt();
|
DockArea dockedArea = (DockArea) nativeWindowInfo[DOCK_AREA_PROPERTY].toInt();
|
||||||
switch (dockedArea) {
|
switch (dockedArea) {
|
||||||
|
|
|
@ -25,6 +25,21 @@
|
||||||
namespace InteractiveWindowEnums {
|
namespace InteractiveWindowEnums {
|
||||||
Q_NAMESPACE
|
Q_NAMESPACE
|
||||||
|
|
||||||
|
/**jsdoc
|
||||||
|
* A set of flags controlling <code>InteractiveWindow</code> behavior. The value is constructed by using the
|
||||||
|
* <code>|</code> (bitwise OR) operator on the individual flag values.<br />
|
||||||
|
* <table>
|
||||||
|
* <thead>
|
||||||
|
* <tr><th>Flag Name</th><th>Value</th><th>Description</th></tr>
|
||||||
|
* </thead>
|
||||||
|
* <tbody>
|
||||||
|
* <tr><td>ALWAYS_ON_TOP</td><td><code>1</code></td><td>The window always displays on top.</td></tr>
|
||||||
|
* <tr><td>CLOSE_BUTTON_HIDES</td><td><code>2</code></td><td>The window hides instead of closing when the user clicks
|
||||||
|
* the "close" button.</td></tr>
|
||||||
|
* </tbody>
|
||||||
|
* </table>
|
||||||
|
* @typedef {number} InteractiveWindow.Flags
|
||||||
|
*/
|
||||||
enum InteractiveWindowFlags : uint8_t {
|
enum InteractiveWindowFlags : uint8_t {
|
||||||
AlwaysOnTop = 1 << 0,
|
AlwaysOnTop = 1 << 0,
|
||||||
CloseButtonHides = 1 << 1
|
CloseButtonHides = 1 << 1
|
||||||
|
@ -49,18 +64,25 @@ namespace InteractiveWindowEnums {
|
||||||
using namespace InteractiveWindowEnums;
|
using namespace InteractiveWindowEnums;
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
|
* An <code>InteractiveWindow</code> can display either inside Interface or in its own window separate from the Interface
|
||||||
|
* window. The window content is defined by a QML file, which can optionally include a <code>WebView</code> control that embeds
|
||||||
|
* an HTML web page. (The <code>WebView</code> control is defined by a "WebView.qml" file included in the Interface install.)
|
||||||
|
*
|
||||||
|
* <p>Create using {@link Desktop.createWindow}.</p>
|
||||||
|
*
|
||||||
* @class InteractiveWindow
|
* @class InteractiveWindow
|
||||||
*
|
*
|
||||||
* @hifi-interface
|
* @hifi-interface
|
||||||
* @hifi-client-entity
|
* @hifi-client-entity
|
||||||
* @hifi-avatar
|
* @hifi-avatar
|
||||||
*
|
*
|
||||||
* @property {string} title
|
* @property {string} title - The title of the window.
|
||||||
* @property {Vec2} position
|
* @property {Vec2} position - The position of the window, in pixels.
|
||||||
* @property {Vec2} size
|
* @property {Vec2} size - The size of the window, in pixels.
|
||||||
* @property {boolean} visible
|
* @property {boolean} visible - <code>true</code> if the window is visible, <code>false</code> if it isn't.
|
||||||
* @property {Desktop.PresentationMode} presentationMode
|
* @property {InteractiveWindow.PresentationMode} presentationMode - The presentation mode of the window:
|
||||||
*
|
* <code>Desktop.PresentationMode.VIRTUAL</code> to display the window inside Interface, <code>.NATIVE</code> to display it
|
||||||
|
* as its own separate window.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class DockWidget;
|
class DockWidget;
|
||||||
|
@ -99,36 +121,87 @@ private:
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
|
* Sends a message to the QML page. To receive the message, the QML page must implement a function:
|
||||||
|
* <pre class="prettyprint"><code>function fromScript(message) {
|
||||||
|
* ...
|
||||||
|
* }</code></pre>
|
||||||
* @function InteractiveWindow.sendToQml
|
* @function InteractiveWindow.sendToQml
|
||||||
* @param {object} message
|
* @param {string|object} message - The message to send to the QML page.
|
||||||
|
* @example <caption>Send and receive messages with a QML window.</caption>
|
||||||
|
* // JavaScript file.
|
||||||
|
*
|
||||||
|
* var qmlWindow = Desktop.createWindow(Script.resolvePath("QMLWindow.qml"), {
|
||||||
|
* title: "QML Window",
|
||||||
|
* size: { x: 400, y: 300 }
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* qmlWindow.fromQml.connect(function (message) {
|
||||||
|
* print("Message received: " + message);
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* Script.setTimeout(function () {
|
||||||
|
* qmlWindow.sendToQml("Hello world!");
|
||||||
|
* }, 2000);
|
||||||
|
*
|
||||||
|
* Script.scriptEnding.connect(function () {
|
||||||
|
* qmlWindow.close();
|
||||||
|
* });
|
||||||
|
* @example
|
||||||
|
* // QML file, "QMLWindow.qml".
|
||||||
|
*
|
||||||
|
* import QtQuick 2.5
|
||||||
|
* import QtQuick.Controls 1.4
|
||||||
|
*
|
||||||
|
* Rectangle {
|
||||||
|
*
|
||||||
|
* function fromScript(message) {
|
||||||
|
* text.text = message;
|
||||||
|
* sendToScript("Hello back!");
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* Label {
|
||||||
|
* id: text
|
||||||
|
* anchors.centerIn: parent
|
||||||
|
* text: "..."
|
||||||
|
* }
|
||||||
|
* }
|
||||||
*/
|
*/
|
||||||
// Scripts can use this to send a message to the QML object
|
// Scripts can use this to send a message to the QML object
|
||||||
void sendToQml(const QVariant& message);
|
void sendToQml(const QVariant& message);
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
|
* Sends a message to an embedded HTML web page. To receive the message, the HTML page's script must connect to the
|
||||||
|
* <code>EventBridge</code> that is automatically provided to the script:
|
||||||
|
* <pre class="prettyprint"><code>EventBridge.scriptEventReceived.connect(function(message) {
|
||||||
|
* ...
|
||||||
|
* });</code></pre>
|
||||||
* @function InteractiveWindow.emitScriptEvent
|
* @function InteractiveWindow.emitScriptEvent
|
||||||
* @param {object} message
|
* @param {string|object} message - The message to send to the embedded HTML web page.
|
||||||
*/
|
*/
|
||||||
// QmlWindow content may include WebView requiring EventBridge.
|
// QmlWindow content may include WebView requiring EventBridge.
|
||||||
void emitScriptEvent(const QVariant& scriptMessage);
|
void emitScriptEvent(const QVariant& scriptMessage);
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* @function InteractiveWindow.emitWebEvent
|
* @function InteractiveWindow.emitWebEvent
|
||||||
* @param {object} message
|
* @param {object|string} message - The message.
|
||||||
|
* @deprecated This function is deprecated and will be removed from the API.
|
||||||
*/
|
*/
|
||||||
void emitWebEvent(const QVariant& webMessage);
|
void emitWebEvent(const QVariant& webMessage);
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
|
* Closes the window. It can then no longer be used.
|
||||||
* @function InteractiveWindow.close
|
* @function InteractiveWindow.close
|
||||||
*/
|
*/
|
||||||
Q_INVOKABLE void close();
|
Q_INVOKABLE void close();
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
|
* Makes the window visible and raises it to the top.
|
||||||
* @function InteractiveWindow.show
|
* @function InteractiveWindow.show
|
||||||
*/
|
*/
|
||||||
Q_INVOKABLE void show();
|
Q_INVOKABLE void show();
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
|
* Raises the window to the top.
|
||||||
* @function InteractiveWindow.raise
|
* @function InteractiveWindow.raise
|
||||||
*/
|
*/
|
||||||
Q_INVOKABLE void raise();
|
Q_INVOKABLE void raise();
|
||||||
|
@ -136,44 +209,52 @@ public slots:
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
|
* Triggered when the window is made visible or invisible, or is closed.
|
||||||
* @function InteractiveWindow.visibleChanged
|
* @function InteractiveWindow.visibleChanged
|
||||||
* @returns {Signal}
|
* @returns {Signal}
|
||||||
*/
|
*/
|
||||||
void visibleChanged();
|
void visibleChanged();
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
|
* Triggered when the window's position changes.
|
||||||
* @function InteractiveWindow.positionChanged
|
* @function InteractiveWindow.positionChanged
|
||||||
* @returns {Signal}
|
* @returns {Signal}
|
||||||
*/
|
*/
|
||||||
void positionChanged();
|
void positionChanged();
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
|
* Triggered when the window's size changes.
|
||||||
* @function InteractiveWindow.sizeChanged
|
* @function InteractiveWindow.sizeChanged
|
||||||
* @returns {Signal}
|
* @returns {Signal}
|
||||||
*/
|
*/
|
||||||
void sizeChanged();
|
void sizeChanged();
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
|
* Triggered when the window's presentation mode changes.
|
||||||
* @function InteractiveWindow.presentationModeChanged
|
* @function InteractiveWindow.presentationModeChanged
|
||||||
* @returns {Signal}
|
* @returns {Signal}
|
||||||
*/
|
*/
|
||||||
void presentationModeChanged();
|
void presentationModeChanged();
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
|
* Triggered when window's title changes.
|
||||||
* @function InteractiveWindow.titleChanged
|
* @function InteractiveWindow.titleChanged
|
||||||
* @returns {Signal}
|
* @returns {Signal}
|
||||||
*/
|
*/
|
||||||
void titleChanged();
|
void titleChanged();
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
|
* Triggered when the window is closed.
|
||||||
* @function InteractiveWindow.closed
|
* @function InteractiveWindow.closed
|
||||||
* @returns {Signal}
|
* @returns {Signal}
|
||||||
*/
|
*/
|
||||||
void closed();
|
void closed();
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
|
* Triggered when a message from the QML page is received. The QML page can send a message (string or object) by calling:
|
||||||
|
* <pre class="prettyprint"><code>sendToScript(message);</code></pre>
|
||||||
* @function InteractiveWindow.fromQml
|
* @function InteractiveWindow.fromQml
|
||||||
* @param {object} message
|
* @param {string|object} message - The message received.
|
||||||
* @returns {Signal}
|
* @returns {Signal}
|
||||||
*/
|
*/
|
||||||
// Scripts can connect to this signal to receive messages from the QML object
|
// Scripts can connect to this signal to receive messages from the QML object
|
||||||
|
@ -181,15 +262,18 @@ signals:
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* @function InteractiveWindow.scriptEventReceived
|
* @function InteractiveWindow.scriptEventReceived
|
||||||
* @param {object} message
|
* @param {object} message - The message.
|
||||||
* @returns {Signal}
|
* @returns {Signal}
|
||||||
|
* @deprecated This signal is deprecated and will be removed from the API.
|
||||||
*/
|
*/
|
||||||
// InteractiveWindow content may include WebView requiring EventBridge.
|
// InteractiveWindow content may include WebView requiring EventBridge.
|
||||||
void scriptEventReceived(const QVariant& message);
|
void scriptEventReceived(const QVariant& message);
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
|
* Triggered when a message from an embedded HTML web page is received. The HTML web page can send a message by calling:
|
||||||
|
* <pre class="prettyprint"><code>EventBridge.emitWebEvent(message);</code></pre>
|
||||||
* @function InteractiveWindow.webEventReceived
|
* @function InteractiveWindow.webEventReceived
|
||||||
* @param {object} message
|
* @param {string|object} message - The message received.
|
||||||
* @returns {Signal}
|
* @returns {Signal}
|
||||||
*/
|
*/
|
||||||
void webEventReceived(const QVariant& message);
|
void webEventReceived(const QVariant& message);
|
||||||
|
@ -199,6 +283,7 @@ protected slots:
|
||||||
* @function InteractiveWindow.qmlToScript
|
* @function InteractiveWindow.qmlToScript
|
||||||
* @param {object} message
|
* @param {object} message
|
||||||
* @returns {Signal}
|
* @returns {Signal}
|
||||||
|
* @deprecated This signal is deprecated and will be removed from the API.
|
||||||
*/
|
*/
|
||||||
void qmlToScript(const QVariant& message);
|
void qmlToScript(const QVariant& message);
|
||||||
|
|
||||||
|
|
|
@ -64,6 +64,32 @@ const std::string TextureCache::KTX_DIRNAME{ "ktx_cache" };
|
||||||
#endif
|
#endif
|
||||||
const std::string TextureCache::KTX_EXT { "ktx" };
|
const std::string TextureCache::KTX_EXT { "ktx" };
|
||||||
|
|
||||||
|
/**jsdoc
|
||||||
|
* <p>The views that may be visible on the PC display.</p>
|
||||||
|
* <table>
|
||||||
|
* <thead>
|
||||||
|
* <tr>
|
||||||
|
* <th>Value</th>
|
||||||
|
* <th>View Displayed</th>
|
||||||
|
* </tr>
|
||||||
|
* </thead>
|
||||||
|
* <tbody>
|
||||||
|
* <tr>
|
||||||
|
* <td><code>""</code></td>
|
||||||
|
* <td>Normal view.</td>
|
||||||
|
* </tr>
|
||||||
|
* <tr>
|
||||||
|
* <td><code>"resource://hmdPreviewFrame"</code></td>
|
||||||
|
* <td>HMD preview.</td>
|
||||||
|
* </tr>
|
||||||
|
* <tr>
|
||||||
|
* <td><code>"resource://spectatorCameraFrame"</code></td>
|
||||||
|
* <td>Entity camera view.</td>
|
||||||
|
* </tr>
|
||||||
|
* </tbody>
|
||||||
|
* </table>
|
||||||
|
* @typedef {string} Window.DisplayTexture
|
||||||
|
*/
|
||||||
static const QString RESOURCE_SCHEME = "resource";
|
static const QString RESOURCE_SCHEME = "resource";
|
||||||
static const QUrl SPECTATOR_CAMERA_FRAME_URL("resource://spectatorCameraFrame");
|
static const QUrl SPECTATOR_CAMERA_FRAME_URL("resource://spectatorCameraFrame");
|
||||||
static const QUrl HMD_PREVIEW_FRAME_URL("resource://hmdPreviewFrame");
|
static const QUrl HMD_PREVIEW_FRAME_URL("resource://hmdPreviewFrame");
|
||||||
|
|
|
@ -32,11 +32,11 @@ const QString INDEX_PATH = "/";
|
||||||
const QString GET_PLACE = "/api/v1/places/%1";
|
const QString GET_PLACE = "/api/v1/places/%1";
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* The location API provides facilities related to your current location in the metaverse.
|
* The <code>location</code> API provides facilities related to your current location in the metaverse.
|
||||||
*
|
*
|
||||||
* <h5>Getter/Setter</h5>
|
* <h3>Getter/Setter</h3>
|
||||||
* <p>You can get and set your current metaverse address by directly reading a string value from and writing a string value to
|
* <p>You can get and set your current metaverse address by directly reading a string value from and writing a string value to
|
||||||
* the <code>location</code> object. This is an alternative to using the <code>location.href</code> property or this object's
|
* the <code>location</code> object. This is an alternative to using the <code>location.href</code> property or other object
|
||||||
* functions.</p>
|
* functions.</p>
|
||||||
*
|
*
|
||||||
* @namespace location
|
* @namespace location
|
||||||
|
@ -186,19 +186,19 @@ public:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Go to a specified metaverse address.
|
* Takes you to a specified metaverse address.
|
||||||
* @function location.handleLookupString
|
* @function location.handleLookupString
|
||||||
* @param {string} address - The address to go to: a <code>"hifi://"<code> address, an IP address (e.g.,
|
* @param {string} address - The address to go to: a <code>"hifi://"<code> address, an IP address (e.g.,
|
||||||
* <code>"127.0.0.1"</code> or <code>"localhost"</code>), a domain name, a named path on a domain (starts with
|
* <code>"127.0.0.1"</code> or <code>"localhost"</code>), a domain name, a named path on a domain (starts with
|
||||||
* <code>"/"</code>), a position or position and orientation, or a user (starts with <code>"@"</code>).
|
* <code>"/"</code>), a position or position and orientation, or a user (starts with <code>"@"</code>).
|
||||||
* @param {boolean} fromSuggestions=false - Set to <code>true</code> if the address is obtained from the "Goto" dialog.
|
* @param {boolean} [fromSuggestions=false] - Set to <code>true</code> if the address is obtained from the "Goto" dialog.
|
||||||
* Helps ensure that user's location history is correctly maintained.
|
* Helps ensure that user's location history is correctly maintained.
|
||||||
*/
|
*/
|
||||||
void handleLookupString(const QString& lookupString, bool fromSuggestions = false);
|
void handleLookupString(const QString& lookupString, bool fromSuggestions = false);
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Go to a position and orientation resulting from a lookup for a named path in the domain (set in the domain server's
|
* Takes you to a position and orientation resulting from a lookup for a named path in the domain (set in the domain
|
||||||
* settings).
|
* server's settings).
|
||||||
* @function location.goToViewpointForPath
|
* @function location.goToViewpointForPath
|
||||||
* @param {string} path - The position and orientation corresponding to the named path.
|
* @param {string} path - The position and orientation corresponding to the named path.
|
||||||
* @param {string} namedPath - The named path that was looked up on the server.
|
* @param {string} namedPath - The named path that was looked up on the server.
|
||||||
|
@ -212,29 +212,29 @@ public slots:
|
||||||
{ return handleViewpoint(viewpointString, false, DomainPathResponse, false, pathString); }
|
{ return handleViewpoint(viewpointString, false, DomainPathResponse, false, pathString); }
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Go back to the previous location in your navigation history, if there is one.
|
* Takes you back to the previous location in your navigation history, if there is one.
|
||||||
* @function location.goBack
|
* @function location.goBack
|
||||||
*/
|
*/
|
||||||
void goBack();
|
void goBack();
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Go forward to the next location in your navigation history, if there is one.
|
* Takes you forward to the next location in your navigation history, if there is one.
|
||||||
* @function location.goForward
|
* @function location.goForward
|
||||||
*/
|
*/
|
||||||
void goForward();
|
void goForward();
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Go to the local Sandbox server that's running on the same PC as Interface.
|
* Takes you to the local Sandbox server that's running on the same PC as Interface.
|
||||||
* @function location.goToLocalSandbox
|
* @function location.goToLocalSandbox
|
||||||
* @param {string} path="" - The position and orientation to go to (e.g., <code>"/0,0,0"</code>).
|
* @param {string} [path=""] - The position and orientation to go to (e.g., <code>"/0,0,0"</code>).
|
||||||
* @param {location.LookupTrigger} trigger=StartupFromSettings - The reason for the function call. Helps ensure that user's
|
* @param {location.LookupTrigger} [trigger=StartupFromSettings] - The reason for the function call. Helps ensure that user's
|
||||||
* location history is correctly maintained.
|
* location history is correctly maintained.
|
||||||
*/
|
*/
|
||||||
void goToLocalSandbox(QString path = "", LookupTrigger trigger = LookupTrigger::StartupFromSettings) {
|
void goToLocalSandbox(QString path = "", LookupTrigger trigger = LookupTrigger::StartupFromSettings) {
|
||||||
handleUrl(SANDBOX_HIFI_ADDRESS + path, trigger); }
|
handleUrl(SANDBOX_HIFI_ADDRESS + path, trigger); }
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Go to the default "welcome" metaverse address.
|
* Takes you to the default "welcome" metaverse address.
|
||||||
* @function location.goToEntry
|
* @function location.goToEntry
|
||||||
* @param {location.LookupTrigger} trigger=StartupFromSettings - The reason for the function call. Helps ensure that user's
|
* @param {location.LookupTrigger} trigger=StartupFromSettings - The reason for the function call. Helps ensure that user's
|
||||||
* location history is correctly maintained.
|
* location history is correctly maintained.
|
||||||
|
@ -242,28 +242,29 @@ public slots:
|
||||||
void goToEntry(LookupTrigger trigger = LookupTrigger::StartupFromSettings) { handleUrl(DEFAULT_HIFI_ADDRESS, trigger); }
|
void goToEntry(LookupTrigger trigger = LookupTrigger::StartupFromSettings) { handleUrl(DEFAULT_HIFI_ADDRESS, trigger); }
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Go to the specified user's location.
|
* Takes you to the specified user's location.
|
||||||
* @function location.goToUser
|
* @function location.goToUser
|
||||||
* @param {string} username - The user's username.
|
* @param {string} username - The user's username.
|
||||||
* @param {boolean} matchOrientation=true - If <code>true</code> then go to a location just in front of the user and turn to face
|
* @param {boolean} [matchOrientation=true] - If <code>true</code> then go to a location just in front of the user and turn
|
||||||
* them, otherwise go to the user's exact location and orientation.
|
* to face them, otherwise go to the user's exact location and orientation.
|
||||||
*/
|
*/
|
||||||
void goToUser(const QString& username, bool shouldMatchOrientation = true);
|
void goToUser(const QString& username, bool shouldMatchOrientation = true);
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Go to the last address tried. This will be the last URL tried from location.handleLookupString
|
* Takes you to the last address tried. This will be the last URL tried from <code>location.handleLookupString</code>.
|
||||||
* @function location.goToLastAddress
|
* @function location.goToLastAddress
|
||||||
*/
|
*/
|
||||||
void goToLastAddress() { handleUrl(_lastVisitedURL, LookupTrigger::AttemptedRefresh); }
|
void goToLastAddress() { handleUrl(_lastVisitedURL, LookupTrigger::AttemptedRefresh); }
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Returns if going back is possible.
|
* Checks if going back to the previous location is possible.
|
||||||
* @function location.canGoBack
|
* @function location.canGoBack
|
||||||
|
* @returns <code>true</code> if going back is possible, <code>false</code> if it isn't.
|
||||||
*/
|
*/
|
||||||
bool canGoBack() const;
|
bool canGoBack() const;
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Refresh the current address, e.g., after connecting to a domain in order to position the user to the desired location.
|
* Refreshes the current address, e.g., after connecting to a domain in order to position the user to the desired location.
|
||||||
* @function location.refreshPreviousLookup
|
* @function location.refreshPreviousLookup
|
||||||
* @deprecated This function is deprecated and will be removed.
|
* @deprecated This function is deprecated and will be removed.
|
||||||
*/
|
*/
|
||||||
|
@ -272,27 +273,27 @@ public slots:
|
||||||
void refreshPreviousLookup();
|
void refreshPreviousLookup();
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Update your current metaverse location in Interface's {@link Settings} file as your last-known address. This can be used
|
* Updates your current metaverse location in Interface's {@link Settings} file as your last-known address. This can be used
|
||||||
* to ensure that you start up at that address if you exit Interface without a later address automatically being saved.
|
* to ensure that you start up at that address if you exit Interface without a later address automatically being saved.
|
||||||
* @function location.storeCurrentAddress
|
* @function location.storeCurrentAddress
|
||||||
*/
|
*/
|
||||||
void storeCurrentAddress();
|
void storeCurrentAddress();
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Copy your current metaverse address (i.e., <code>location.href</code> property value) to the OS clipboard.
|
* Copies your current metaverse address (i.e., <code>location.href</code> property value) to the OS clipboard.
|
||||||
* @function location.copyAddress
|
* @function location.copyAddress
|
||||||
*/
|
*/
|
||||||
void copyAddress();
|
void copyAddress();
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Copy your current metaverse location and orientation (i.e., <code>location.pathname</code> property value) to the OS
|
* Copies your current metaverse location and orientation (i.e., <code>location.pathname</code> property value) to the OS
|
||||||
* clipboard.
|
* clipboard.
|
||||||
* @function location.copyPath
|
* @function location.copyPath
|
||||||
*/
|
*/
|
||||||
void copyPath();
|
void copyPath();
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Retrieve and remember the place name for the given domain ID if the place name is not already known.
|
* Retrieves and remembers the place name for the given domain ID if the place name is not already known.
|
||||||
* @function location.lookupShareableNameForDomainID
|
* @function location.lookupShareableNameForDomainID
|
||||||
* @param {Uuid} domainID - The UUID of the domain.
|
* @param {Uuid} domainID - The UUID of the domain.
|
||||||
* @deprecated This function is deprecated and will be removed.
|
* @deprecated This function is deprecated and will be removed.
|
||||||
|
|
|
@ -142,8 +142,10 @@ SequenceNumberStats::ArrivalInfo SequenceNumberStats::sequenceNumberReceived(qui
|
||||||
if (wantExtraDebugging) {
|
if (wantExtraDebugging) {
|
||||||
qCDebug(networking) << "found it in _missingSet";
|
qCDebug(networking) << "found it in _missingSet";
|
||||||
}
|
}
|
||||||
|
if (_stats._lost > 0) {
|
||||||
_stats._lost--;
|
_stats._lost--;
|
||||||
_stats._recovered++;
|
_stats._recovered++;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// this late seq num is not in our missing set. it is possibly a duplicate, or possibly a late
|
// this late seq num is not in our missing set. it is possibly a duplicate, or possibly a late
|
||||||
// packet that should have arrived before our first received packet. we'll count these
|
// packet that should have arrived before our first received packet. we'll count these
|
||||||
|
|
5
libraries/platform/CMakeLists.txt
Normal file
5
libraries/platform/CMakeLists.txt
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
set(TARGET_NAME platform)
|
||||||
|
setup_hifi_library()
|
||||||
|
|
||||||
|
link_hifi_libraries(shared)
|
||||||
|
target_json()
|
40
libraries/platform/src/AndroidPlatform.cpp
Normal file
40
libraries/platform/src/AndroidPlatform.cpp
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
//
|
||||||
|
// Created by Amer Cerkic 05/02/2019
|
||||||
|
// Copyright 2019 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "AndroidPlatform.h"
|
||||||
|
#include "platformJsonKeys.h"
|
||||||
|
|
||||||
|
#include <GPUIdent.h>
|
||||||
|
#include <string>
|
||||||
|
using namespace platform;
|
||||||
|
|
||||||
|
void AndroidInstance::enumerateCpu() {
|
||||||
|
json cpu;
|
||||||
|
cpu["cpuBrand"] = "";
|
||||||
|
cpu["cpuModel"] = "";
|
||||||
|
cpu["cpuClockSpeed"] = "";
|
||||||
|
cpu["cpuNumCores"] = "";
|
||||||
|
_cpu.push_back(cpu);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AndroidInstance::enumerateGpu() {
|
||||||
|
GPUIdent* ident = GPUIdent::getInstance();
|
||||||
|
json gpu = {};
|
||||||
|
gpu["gpuName"] = ident->getName().toUtf8().constData();
|
||||||
|
gpu["gpuMemory"] = ident->getMemory();
|
||||||
|
gpu["gpuDriver"] = ident->getDriver().toUtf8().constData();
|
||||||
|
|
||||||
|
_gpu.push_back(gpu);
|
||||||
|
_display = ident->getOutput();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AndroidInstance::enumerateMemory() {
|
||||||
|
json ram = {};
|
||||||
|
|
||||||
|
_memory.push_back(ram);
|
||||||
|
}
|
25
libraries/platform/src/AndroidPlatform.h
Normal file
25
libraries/platform/src/AndroidPlatform.h
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
//
|
||||||
|
// Created by Amer Cerkic 05/02/2019
|
||||||
|
// Copyright 2019 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef hifi_AndroidPlatform_h
|
||||||
|
#define hifi_AndroidPlatform_h
|
||||||
|
|
||||||
|
#include "platformInstance.h"
|
||||||
|
|
||||||
|
namespace platform {
|
||||||
|
class AndroidInstance : public Instance {
|
||||||
|
|
||||||
|
public:
|
||||||
|
void enumerateCpu() override;
|
||||||
|
void enumerateMemory() override;
|
||||||
|
void enumerateGpu() override;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace platform
|
||||||
|
|
||||||
|
#endif //hifi_androidplatform_h
|
42
libraries/platform/src/LinuxPlatform.cpp
Normal file
42
libraries/platform/src/LinuxPlatform.cpp
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
//
|
||||||
|
// Created by Amer Cerkic 05/02/2019
|
||||||
|
// Copyright 2019 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "LinuxPlatform.h"
|
||||||
|
#include "platformJsonKeys.h"
|
||||||
|
#include <GPUIdent.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
using namespace platform;
|
||||||
|
void LinuxInstance::enumerateCpu() {
|
||||||
|
json cpu = {};
|
||||||
|
|
||||||
|
cpu["cpuBrand"] = "";
|
||||||
|
cpu["cpuModel"] = "";
|
||||||
|
cpu["cpuClockSpeed"] = "";
|
||||||
|
cpu["cpuNumCores"] = "";
|
||||||
|
|
||||||
|
_cpu.push_back(cpu);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LinuxInstance::enumerateGpu() {
|
||||||
|
GPUIdent* ident = GPUIdent::getInstance();
|
||||||
|
json gpu = {};
|
||||||
|
gpu["gpuName"] = ident->getName().toUtf8().constData();
|
||||||
|
gpu["gpuMemory"] = ident->getMemory();
|
||||||
|
gpu["gpuDriver"] = ident->getDriver().toUtf8().constData();
|
||||||
|
|
||||||
|
_gpu.push_back(gpu);
|
||||||
|
_display = ident->getOutput();
|
||||||
|
}
|
||||||
|
|
||||||
|
void LinuxInstance::enumerateMemory() {
|
||||||
|
json ram = {};
|
||||||
|
|
||||||
|
|
||||||
|
_memory.push_back(ram);
|
||||||
|
}
|
25
libraries/platform/src/LinuxPlatform.h
Normal file
25
libraries/platform/src/LinuxPlatform.h
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
//
|
||||||
|
// Created by Amer Cerkic 05/02/2019
|
||||||
|
// Copyright 2019 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef hifi_LinuxPlatform_h
|
||||||
|
#define hifi_LinuxPlatform_h
|
||||||
|
|
||||||
|
#include "platformInstance.h"
|
||||||
|
|
||||||
|
namespace platform {
|
||||||
|
class LinuxInstance : public Instance {
|
||||||
|
|
||||||
|
public:
|
||||||
|
void enumerateCpu() override;
|
||||||
|
void enumerateMemory() override;
|
||||||
|
void enumerateGpu() override;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace platform
|
||||||
|
|
||||||
|
#endif //hifi_linuxPlaform_h
|
86
libraries/platform/src/MACOSPlatform.cpp
Normal file
86
libraries/platform/src/MACOSPlatform.cpp
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
//
|
||||||
|
// Created by Amer Cerkic 05/02/2019
|
||||||
|
// Copyright 2019 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "MACOSPlatform.h"
|
||||||
|
#include "platformJsonKeys.h"
|
||||||
|
#include <thread>
|
||||||
|
#include <GPUIdent.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <cpuid.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
using namespace platform;
|
||||||
|
|
||||||
|
static void getCpuId( uint32_t* p, uint32_t ax )
|
||||||
|
{
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
__asm __volatile
|
||||||
|
( "movl %%ebx, %%esi\n\t"
|
||||||
|
"cpuid\n\t"
|
||||||
|
"xchgl %%ebx, %%esi"
|
||||||
|
: "=a" (p[0]), "=S" (p[1]),
|
||||||
|
"=c" (p[2]), "=d" (p[3])
|
||||||
|
: "0" (ax)
|
||||||
|
);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void MACOSInstance::enumerateCpu() {
|
||||||
|
json cpu = {};
|
||||||
|
uint32_t cpuInfo[4]={0,0,0,0};
|
||||||
|
char CPUBrandString[16];
|
||||||
|
char CPUModelString[16];
|
||||||
|
char CPUClockString[16];
|
||||||
|
uint32_t nExIds;
|
||||||
|
getCpuId(cpuInfo, 0x80000000);
|
||||||
|
nExIds = cpuInfo[0];
|
||||||
|
|
||||||
|
for (uint32_t i = 0x80000000; i <= nExIds; ++i) {
|
||||||
|
getCpuId(cpuInfo, i);
|
||||||
|
// Interpret CPU brand string
|
||||||
|
if (i == 0x80000002) {
|
||||||
|
memcpy(CPUBrandString, cpuInfo, sizeof(cpuInfo));
|
||||||
|
} else if (i == 0x80000003) {
|
||||||
|
memcpy(CPUModelString, cpuInfo, sizeof(cpuInfo));
|
||||||
|
} else if (i == 0x80000004) {
|
||||||
|
memcpy(CPUClockString, cpuInfo, sizeof(cpuInfo));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cpu["cpuBrand"] = CPUBrandString;
|
||||||
|
cpu["cpuModel"] = CPUModelString;
|
||||||
|
cpu["cpuClockSpeed"] = CPUClockString;
|
||||||
|
cpu["cpuNumCores"] = std::thread::hardware_concurrency();
|
||||||
|
|
||||||
|
_cpu.push_back(cpu);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MACOSInstance::enumerateGpu() {
|
||||||
|
GPUIdent* ident = GPUIdent::getInstance();
|
||||||
|
json gpu = {};
|
||||||
|
gpu["gpuName"] = ident->getName().toUtf8().constData();
|
||||||
|
gpu["gpuMemory"] = ident->getMemory();
|
||||||
|
gpu["gpuDriver"] = ident->getDriver().toUtf8().constData();
|
||||||
|
|
||||||
|
_gpu.push_back(gpu);
|
||||||
|
_display = ident->getOutput();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MACOSInstance::enumerateMemory() {
|
||||||
|
json ram = {};
|
||||||
|
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
long pages = sysconf(_SC_PHYS_PAGES);
|
||||||
|
long page_size = sysconf(_SC_PAGE_SIZE);
|
||||||
|
ram["totalMemory"] = pages * page_size;;
|
||||||
|
#endif
|
||||||
|
_memory.push_back(ram);
|
||||||
|
}
|
25
libraries/platform/src/MACOSPlatform.h
Normal file
25
libraries/platform/src/MACOSPlatform.h
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
//
|
||||||
|
// Created by Amer Cerkic 05/02/2019
|
||||||
|
// Copyright 2019 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef hifi_MACOSPlatform_h
|
||||||
|
#define hifi_MACOSPlatform_h
|
||||||
|
|
||||||
|
#include "platformInstance.h"
|
||||||
|
|
||||||
|
namespace platform {
|
||||||
|
class MACOSInstance : public Instance {
|
||||||
|
|
||||||
|
public:
|
||||||
|
void enumerateCpu() override;
|
||||||
|
void enumerateMemory() override;
|
||||||
|
void enumerateGpu() override;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace platform
|
||||||
|
|
||||||
|
#endif //hifi_winplatform_h
|
82
libraries/platform/src/WINPlatform.cpp
Normal file
82
libraries/platform/src/WINPlatform.cpp
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
//
|
||||||
|
// Created by Amer Cerkic 05/02/2019
|
||||||
|
// Copyright 2019 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "WINPlatform.h"
|
||||||
|
#include "platformJsonKeys.h"
|
||||||
|
#ifdef Q_OS_WINDOWS
|
||||||
|
#include <intrin.h>
|
||||||
|
#include <Windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <thread>
|
||||||
|
#include <GPUIdent.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
|
||||||
|
using namespace platform;
|
||||||
|
|
||||||
|
void WINInstance::enumerateCpu() {
|
||||||
|
json cpu = {};
|
||||||
|
|
||||||
|
#ifdef Q_OS_WINDOWS
|
||||||
|
int CPUInfo[4] = { -1 };
|
||||||
|
unsigned nExIds;
|
||||||
|
unsigned int i = 0;
|
||||||
|
char CPUBrandString[16];
|
||||||
|
char CPUModelString[16];
|
||||||
|
char CPUClockString[16];
|
||||||
|
// Get the information associated with each extended ID.
|
||||||
|
__cpuid(CPUInfo, 0x80000000);
|
||||||
|
nExIds = CPUInfo[0];
|
||||||
|
|
||||||
|
for (i = 0x80000000; i <= nExIds; ++i) {
|
||||||
|
__cpuid(CPUInfo, i);
|
||||||
|
// Interpret CPU brand string
|
||||||
|
if (i == 0x80000002) {
|
||||||
|
memcpy(CPUBrandString, CPUInfo, sizeof(CPUInfo));
|
||||||
|
} else if (i == 0x80000003) {
|
||||||
|
memcpy(CPUModelString, CPUInfo, sizeof(CPUInfo));
|
||||||
|
} else if (i == 0x80000004) {
|
||||||
|
memcpy(CPUClockString, CPUInfo, sizeof(CPUInfo));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cpu["cpuBrand"] = CPUBrandString;
|
||||||
|
cpu["cpuModel"] = CPUModelString;
|
||||||
|
cpu["cpuClockSpeed"] = CPUClockString;
|
||||||
|
cpu["cpuNumCores"] = std::thread::hardware_concurrency();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
_cpu.push_back(cpu);
|
||||||
|
}
|
||||||
|
|
||||||
|
void WINInstance::enumerateGpu() {
|
||||||
|
|
||||||
|
GPUIdent* ident = GPUIdent::getInstance();
|
||||||
|
|
||||||
|
json gpu = {};
|
||||||
|
gpu["gpuName"] = ident->getName().toUtf8().constData();
|
||||||
|
gpu["gpuMemory"] = ident->getMemory();
|
||||||
|
gpu["gpuDriver"] = ident->getDriver().toUtf8().constData();
|
||||||
|
|
||||||
|
_gpu.push_back(gpu);
|
||||||
|
_display = ident->getOutput();
|
||||||
|
}
|
||||||
|
|
||||||
|
void WINInstance::enumerateMemory() {
|
||||||
|
json ram = {};
|
||||||
|
|
||||||
|
#ifdef Q_OS_WINDOWS
|
||||||
|
MEMORYSTATUSEX statex;
|
||||||
|
statex.dwLength = sizeof(statex);
|
||||||
|
GlobalMemoryStatusEx(&statex);
|
||||||
|
int totalRam = statex.ullTotalPhys / 1024 / 1024;
|
||||||
|
ram[jsonKeys::totalMemory] = totalRam;
|
||||||
|
#endif
|
||||||
|
_memory.push_back(ram);
|
||||||
|
}
|
25
libraries/platform/src/WINPlatform.h
Normal file
25
libraries/platform/src/WINPlatform.h
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
//
|
||||||
|
// Created by Amer Cerkic 05/02/2019
|
||||||
|
// Copyright 2019 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef hifi_WinPlatform_h
|
||||||
|
#define hifi_WinPlatform_h
|
||||||
|
|
||||||
|
#include "platformInstance.h"
|
||||||
|
|
||||||
|
namespace platform {
|
||||||
|
class WINInstance : public Instance {
|
||||||
|
|
||||||
|
public:
|
||||||
|
void enumerateCpu() override;
|
||||||
|
void enumerateMemory() override;
|
||||||
|
void enumerateGpu() override;
|
||||||
|
|
||||||
|
};
|
||||||
|
} // namespace platform
|
||||||
|
|
||||||
|
#endif //hifi_winplatform_h
|
79
libraries/platform/src/platform.cpp
Normal file
79
libraries/platform/src/platform.cpp
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
//
|
||||||
|
// Created by Amer Cerkic 05/02/2019
|
||||||
|
// Copyright 2019 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#include "platform.h"
|
||||||
|
|
||||||
|
#include <qglobal.h>
|
||||||
|
|
||||||
|
#if defined(Q_OS_WIN)
|
||||||
|
#include "WINPlatform.h"
|
||||||
|
#elif defined(Q_OS_MAC)
|
||||||
|
#include "MACOSPlatform.h"
|
||||||
|
#elif defined(Q_OS_ANDROID)
|
||||||
|
#include "AndroidPlatform.h"
|
||||||
|
#elif defined(Q_OS_LINUX)
|
||||||
|
#include "LinuxPlatform.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
using namespace platform;
|
||||||
|
|
||||||
|
Instance *_instance;
|
||||||
|
|
||||||
|
void platform::create() {
|
||||||
|
#if defined(Q_OS_WIN)
|
||||||
|
_instance =new WINInstance();
|
||||||
|
#elif defined(Q_OS_MAC)
|
||||||
|
_instance = new MACOSInstance();
|
||||||
|
#elif defined(Q_OS_ANDROID)
|
||||||
|
_instance= new AndroidInstance();
|
||||||
|
#elif defined(Q_OS_LINUX)
|
||||||
|
_instance= new LinuxInstance();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void platform::destroy() {
|
||||||
|
if(_instance)
|
||||||
|
delete _instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool platform::enumeratePlatform() {
|
||||||
|
return _instance->enumeratePlatform();
|
||||||
|
}
|
||||||
|
|
||||||
|
int platform::getNumCPU() {
|
||||||
|
return _instance->getNumCPU();
|
||||||
|
}
|
||||||
|
|
||||||
|
json platform::getCPU(int index) {
|
||||||
|
return _instance->getCPU(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
int platform::getNumGPU() {
|
||||||
|
return _instance->getNumGPU();
|
||||||
|
}
|
||||||
|
|
||||||
|
json platform::getGPU(int index) {
|
||||||
|
return _instance->getGPU(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
int platform::getNumDisplay() {
|
||||||
|
return _instance->getNumDisplay();
|
||||||
|
}
|
||||||
|
|
||||||
|
json platform::getDisplay(int index) {
|
||||||
|
return _instance->getDisplay(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
int platform::getNumMemory() {
|
||||||
|
return _instance->getNumMemory();
|
||||||
|
}
|
||||||
|
|
||||||
|
json platform::getMemory(int index) {
|
||||||
|
return _instance->getMemory(index);
|
||||||
|
}
|
37
libraries/platform/src/platform.h
Normal file
37
libraries/platform/src/platform.h
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
//
|
||||||
|
// Created by Amer Cerkic 05/02/2019
|
||||||
|
// Copyright 2019 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef hifi_Platform_h
|
||||||
|
#define hifi_Platform_h
|
||||||
|
|
||||||
|
#include "platformInstance.h"
|
||||||
|
#include <vector>
|
||||||
|
#include <nlohmann/json.hpp>
|
||||||
|
|
||||||
|
namespace platform {
|
||||||
|
using json = nlohmann::json;
|
||||||
|
|
||||||
|
void create();
|
||||||
|
void destroy();
|
||||||
|
bool enumeratePlatform();
|
||||||
|
|
||||||
|
int getNumCPU();
|
||||||
|
json getCPU(int index);
|
||||||
|
|
||||||
|
int getNumGPU();
|
||||||
|
json getGPU(int index);
|
||||||
|
|
||||||
|
int getNumDisplay();
|
||||||
|
json getDisplay(int index);
|
||||||
|
|
||||||
|
int getNumMemory();
|
||||||
|
json getMemory(int index);
|
||||||
|
|
||||||
|
} // namespace platform
|
||||||
|
|
||||||
|
#endif // hifi_platform_h
|
86
libraries/platform/src/platformInstance.cpp
Normal file
86
libraries/platform/src/platformInstance.cpp
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
//
|
||||||
|
// Created by Amer Cerkic 05/02/2019
|
||||||
|
// Copyright 2019 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#include "platform.h"
|
||||||
|
|
||||||
|
#include <QtGlobal>
|
||||||
|
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
#include "WINPlatform.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef Q_OS_MACOS
|
||||||
|
#include "MACOSPlatform.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef Q_OS_LINUX
|
||||||
|
#endif
|
||||||
|
|
||||||
|
using namespace platform;
|
||||||
|
|
||||||
|
bool Instance::enumeratePlatform() {
|
||||||
|
enumerateCpu();
|
||||||
|
enumerateGpu();
|
||||||
|
enumerateMemory();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
json Instance::getCPU(int index) {
|
||||||
|
assert(index <(int) _cpu.size());
|
||||||
|
if (index >= (int)_cpu.size())
|
||||||
|
return json();
|
||||||
|
|
||||||
|
return _cpu.at(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
//These are ripe for template.. will work on that next
|
||||||
|
json Instance::getMemory(int index) {
|
||||||
|
assert(index <(int) _memory.size());
|
||||||
|
if(index >= (int)_memory.size())
|
||||||
|
return json();
|
||||||
|
|
||||||
|
return _memory.at(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
json Instance::getGPU(int index) {
|
||||||
|
assert(index <(int) _gpu.size());
|
||||||
|
|
||||||
|
if (index >=(int) _gpu.size())
|
||||||
|
return json();
|
||||||
|
|
||||||
|
return _gpu.at(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
json Instance::getDisplay(int index) {
|
||||||
|
assert(index <(int) _display.size());
|
||||||
|
|
||||||
|
if (index >=(int) _display.size())
|
||||||
|
return json();
|
||||||
|
|
||||||
|
return _display.at(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
Instance::~Instance() {
|
||||||
|
if (_cpu.size() > 0) {
|
||||||
|
_cpu.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_memory.size() > 0) {
|
||||||
|
_memory.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (_gpu.size() > 0) {
|
||||||
|
_gpu.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_display.size() > 0) {
|
||||||
|
_display.clear();
|
||||||
|
}
|
||||||
|
}
|
49
libraries/platform/src/platformInstance.h
Normal file
49
libraries/platform/src/platformInstance.h
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
//
|
||||||
|
// Created by Amer Cerkic 05/02/2019
|
||||||
|
// Copyright 2019 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef hifi_PlatformInstance_h
|
||||||
|
#define hifi_PlatformInstance_h
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <nlohmann/json.hpp>
|
||||||
|
|
||||||
|
namespace platform {
|
||||||
|
using json = nlohmann::json;
|
||||||
|
|
||||||
|
class Instance {
|
||||||
|
public:
|
||||||
|
bool virtual enumeratePlatform();
|
||||||
|
|
||||||
|
int getNumCPU() { return (int)_cpu.size(); }
|
||||||
|
json getCPU(int index);
|
||||||
|
|
||||||
|
int getNumGPU() { return (int)_gpu.size(); }
|
||||||
|
json getGPU(int index);
|
||||||
|
|
||||||
|
int getNumMemory() { return (int)_memory.size(); }
|
||||||
|
json getMemory(int index);
|
||||||
|
|
||||||
|
int getNumDisplay() { return (int)_display.size(); }
|
||||||
|
json getDisplay(int index);
|
||||||
|
|
||||||
|
void virtual enumerateCpu()=0;
|
||||||
|
void virtual enumerateMemory()=0;
|
||||||
|
void virtual enumerateGpu()=0;
|
||||||
|
|
||||||
|
virtual ~Instance();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
std::vector<json> _cpu;
|
||||||
|
std::vector<json> _memory;
|
||||||
|
std::vector<json> _gpu;
|
||||||
|
std::vector<json> _display;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace platform
|
||||||
|
|
||||||
|
#endif // hifi_platformInstance_h
|
34
libraries/platform/src/platformJsonKeys.h
Normal file
34
libraries/platform/src/platformJsonKeys.h
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
//
|
||||||
|
// Created by Amer Cerkic 05/02/2019
|
||||||
|
// Copyright 2019 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
#pragma once
|
||||||
|
#ifndef hifi_PlatformJsonKeys_h
|
||||||
|
#define hifi_PlatformJsonKeys_h
|
||||||
|
|
||||||
|
namespace platform {
|
||||||
|
namespace jsonKeys{
|
||||||
|
#if 0
|
||||||
|
static const char* cpuBrand { "cpuBrand"};
|
||||||
|
static const char* cpuModel {"cpuModel"};
|
||||||
|
static const char* cpuClockSpeed {"clockSpeed"};
|
||||||
|
static const char* cpuNumCores { "numCores"};
|
||||||
|
static const char* gpuName {"GpuName"};
|
||||||
|
static const char* gpuMemory {"gpuMemory"};
|
||||||
|
static const char* gpuDriver {"gpuDriver"};
|
||||||
|
static const char* totalMemory {"totalMem"};
|
||||||
|
static const char* displayDescription { "description"};
|
||||||
|
static const char* displayName {"deviceName"};
|
||||||
|
static const char* displayCoordsLeft {"coordinatesleft"};
|
||||||
|
static const char* displayCoordsRight { "coordinatesright"};
|
||||||
|
static const char* displayCoordsTop { "coordinatestop"};
|
||||||
|
static const char* displayCoordsBottom { "coordinatesbottom"};
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace platform
|
||||||
|
|
||||||
|
#endif
|
|
@ -15,3 +15,5 @@ endif()
|
||||||
|
|
||||||
target_zlib()
|
target_zlib()
|
||||||
target_nsight()
|
target_nsight()
|
||||||
|
target_json()
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <nlohmann/json.hpp>
|
||||||
|
|
||||||
//#include <atlbase.h>
|
//#include <atlbase.h>
|
||||||
//#include <Wbemidl.h>
|
//#include <Wbemidl.h>
|
||||||
|
@ -250,6 +251,22 @@ GPUIdent* GPUIdent::ensureQuery(const QString& vendor, const QString& renderer)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!validAdapterList.empty()) {
|
if (!validAdapterList.empty()) {
|
||||||
|
for (auto outy = adapterToOutputs.begin(); outy != adapterToOutputs.end(); ++outy) {
|
||||||
|
|
||||||
|
AdapterEntry entry = *outy;
|
||||||
|
for (auto test = entry.second.begin(); test != entry.second.end(); ++test) {
|
||||||
|
|
||||||
|
nlohmann::json output = {};
|
||||||
|
output["description"] = entry.first.first.Description;
|
||||||
|
output["deviceName"]= test->DeviceName;
|
||||||
|
output["coordinatesleft"] = test->DesktopCoordinates.left;
|
||||||
|
output["coordinatesright"] = test->DesktopCoordinates.right;
|
||||||
|
output["coordinatestop"] = test->DesktopCoordinates.top;
|
||||||
|
output["coordinatesbottom"] = test->DesktopCoordinates.bottom;
|
||||||
|
_output.push_back(output);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
auto& adapterEntry = adapterToOutputs[validAdapterList.front()];
|
auto& adapterEntry = adapterToOutputs[validAdapterList.front()];
|
||||||
|
|
||||||
std::wstring wDescription(adapterEntry.first.first.Description);
|
std::wstring wDescription(adapterEntry.first.first.Description);
|
||||||
|
|
|
@ -15,19 +15,25 @@
|
||||||
#define hifi_GPUIdent_h
|
#define hifi_GPUIdent_h
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
#include <memory>
|
||||||
|
#include <nlohmann/json.hpp>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
class GPUIdent
|
class GPUIdent
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
uint64_t getMemory() { return _dedicatedMemoryMB; }
|
uint64_t getMemory() { return _dedicatedMemoryMB; }
|
||||||
QString getName() { return _name; }
|
QString getName() { return _name; }
|
||||||
QString getDriver() { return _driver; }
|
QString getDriver() { return _driver; }
|
||||||
bool isValid() { return _isValid; }
|
bool isValid() { return _isValid; }
|
||||||
|
const std::vector<nlohmann::json>& getOutput() { return _output; }
|
||||||
|
|
||||||
// E.g., GPUIdent::getInstance()->getMemory();
|
// E.g., GPUIdent::getInstance()->getMemory();
|
||||||
static GPUIdent* getInstance(const QString& vendor = "", const QString& renderer = "") { return _instance.ensureQuery(vendor, renderer); }
|
static GPUIdent* getInstance(const QString& vendor = "", const QString& renderer = "") { return _instance.ensureQuery(vendor, renderer); }
|
||||||
private:
|
private:
|
||||||
|
std::vector<nlohmann::json> _output;
|
||||||
uint64_t _dedicatedMemoryMB { 0 };
|
uint64_t _dedicatedMemoryMB { 0 };
|
||||||
QString _name { "" };
|
QString _name { "" };
|
||||||
QString _driver { "" };
|
QString _driver { "" };
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#include "DependencyManager.h"
|
#include "DependencyManager.h"
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* The Paths API provides absolute paths to the scripts and resources directories.
|
* The <code>Paths</code> API provides absolute paths to the scripts and resources directories.
|
||||||
*
|
*
|
||||||
* @namespace Paths
|
* @namespace Paths
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue