mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 10:43:45 +02:00
Add userAgent property for web entities.
This commit is contained in:
parent
06b1a8e17c
commit
82313eccbf
11 changed files with 59 additions and 0 deletions
|
@ -39,6 +39,7 @@ const char* WebEntityRenderer::URL_PROPERTY = "url";
|
||||||
const char* WebEntityRenderer::SCRIPT_URL_PROPERTY = "scriptURL";
|
const char* WebEntityRenderer::SCRIPT_URL_PROPERTY = "scriptURL";
|
||||||
const char* WebEntityRenderer::GLOBAL_POSITION_PROPERTY = "globalPosition";
|
const char* WebEntityRenderer::GLOBAL_POSITION_PROPERTY = "globalPosition";
|
||||||
const char* WebEntityRenderer::USE_BACKGROUND_PROPERTY = "useBackground";
|
const char* WebEntityRenderer::USE_BACKGROUND_PROPERTY = "useBackground";
|
||||||
|
const char* WebEntityRenderer::USER_AGENT_PROPERTY = "userAgent";
|
||||||
|
|
||||||
std::function<void(QString, bool, QSharedPointer<OffscreenQmlSurface>&, bool&)> WebEntityRenderer::_acquireWebSurfaceOperator = nullptr;
|
std::function<void(QString, bool, QSharedPointer<OffscreenQmlSurface>&, bool&)> WebEntityRenderer::_acquireWebSurfaceOperator = nullptr;
|
||||||
std::function<void(QSharedPointer<OffscreenQmlSurface>&, bool&, std::vector<QMetaObject::Connection>&)> WebEntityRenderer::_releaseWebSurfaceOperator = nullptr;
|
std::function<void(QSharedPointer<OffscreenQmlSurface>&, bool&, std::vector<QMetaObject::Connection>&)> WebEntityRenderer::_releaseWebSurfaceOperator = nullptr;
|
||||||
|
@ -194,6 +195,7 @@ void WebEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& scene
|
||||||
_webSurface->getRootItem()->setProperty(URL_PROPERTY, newSourceURL);
|
_webSurface->getRootItem()->setProperty(URL_PROPERTY, newSourceURL);
|
||||||
_webSurface->getRootItem()->setProperty(SCRIPT_URL_PROPERTY, _scriptURL);
|
_webSurface->getRootItem()->setProperty(SCRIPT_URL_PROPERTY, _scriptURL);
|
||||||
_webSurface->getRootItem()->setProperty(USE_BACKGROUND_PROPERTY, _useBackground);
|
_webSurface->getRootItem()->setProperty(USE_BACKGROUND_PROPERTY, _useBackground);
|
||||||
|
_webSurface->getRootItem()->setProperty(USER_AGENT_PROPERTY, _userAgent);
|
||||||
_webSurface->getSurfaceContext()->setContextProperty(GLOBAL_POSITION_PROPERTY, vec3toVariant(_contextPosition));
|
_webSurface->getSurfaceContext()->setContextProperty(GLOBAL_POSITION_PROPERTY, vec3toVariant(_contextPosition));
|
||||||
_webSurface->setMaxFps((QUrl(newSourceURL).host().endsWith("youtube.com", Qt::CaseInsensitive)) ? YOUTUBE_MAX_FPS : _maxFPS);
|
_webSurface->setMaxFps((QUrl(newSourceURL).host().endsWith("youtube.com", Qt::CaseInsensitive)) ? YOUTUBE_MAX_FPS : _maxFPS);
|
||||||
::hifi::scripting::setLocalAccessSafeThread(false);
|
::hifi::scripting::setLocalAccessSafeThread(false);
|
||||||
|
@ -231,6 +233,14 @@ void WebEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& scene
|
||||||
_useBackground = useBackground;
|
_useBackground = useBackground;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
auto userAgent = entity->getUserAgent();
|
||||||
|
if (_userAgent != userAgent) {
|
||||||
|
_webSurface->getRootItem()->setProperty(USER_AGENT_PROPERTY, userAgent);
|
||||||
|
_userAgent = userAgent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
auto contextPosition = entity->getWorldPosition();
|
auto contextPosition = entity->getWorldPosition();
|
||||||
|
|
|
@ -36,6 +36,7 @@ public:
|
||||||
static const char* SCRIPT_URL_PROPERTY;
|
static const char* SCRIPT_URL_PROPERTY;
|
||||||
static const char* GLOBAL_POSITION_PROPERTY;
|
static const char* GLOBAL_POSITION_PROPERTY;
|
||||||
static const char* USE_BACKGROUND_PROPERTY;
|
static const char* USE_BACKGROUND_PROPERTY;
|
||||||
|
static const char* USER_AGENT_PROPERTY;
|
||||||
|
|
||||||
static void setAcquireWebSurfaceOperator(std::function<void(const QString&, bool, QSharedPointer<OffscreenQmlSurface>&, bool&)> acquireWebSurfaceOperator) { _acquireWebSurfaceOperator = acquireWebSurfaceOperator; }
|
static void setAcquireWebSurfaceOperator(std::function<void(const QString&, bool, QSharedPointer<OffscreenQmlSurface>&, bool&)> acquireWebSurfaceOperator) { _acquireWebSurfaceOperator = acquireWebSurfaceOperator; }
|
||||||
static void acquireWebSurface(const QString& url, bool htmlContent, QSharedPointer<OffscreenQmlSurface>& webSurface, bool& cachedWebSurface) {
|
static void acquireWebSurface(const QString& url, bool htmlContent, QSharedPointer<OffscreenQmlSurface>& webSurface, bool& cachedWebSurface) {
|
||||||
|
@ -97,6 +98,7 @@ private:
|
||||||
QString _scriptURL;
|
QString _scriptURL;
|
||||||
uint8_t _maxFPS;
|
uint8_t _maxFPS;
|
||||||
bool _useBackground;
|
bool _useBackground;
|
||||||
|
QString _userAgent;
|
||||||
WebInputMode _inputMode;
|
WebInputMode _inputMode;
|
||||||
|
|
||||||
glm::vec3 _contextPosition;
|
glm::vec3 _contextPosition;
|
||||||
|
|
|
@ -603,6 +603,7 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
|
||||||
CHECK_PROPERTY_CHANGE(PROP_INPUT_MODE, inputMode);
|
CHECK_PROPERTY_CHANGE(PROP_INPUT_MODE, inputMode);
|
||||||
CHECK_PROPERTY_CHANGE(PROP_SHOW_KEYBOARD_FOCUS_HIGHLIGHT, showKeyboardFocusHighlight);
|
CHECK_PROPERTY_CHANGE(PROP_SHOW_KEYBOARD_FOCUS_HIGHLIGHT, showKeyboardFocusHighlight);
|
||||||
CHECK_PROPERTY_CHANGE(PROP_WEB_USE_BACKGROUND, useBackground);
|
CHECK_PROPERTY_CHANGE(PROP_WEB_USE_BACKGROUND, useBackground);
|
||||||
|
CHECK_PROPERTY_CHANGE(PROP_USER_AGENT, userAgent);
|
||||||
|
|
||||||
// Polyline
|
// Polyline
|
||||||
CHECK_PROPERTY_CHANGE(PROP_LINE_POINTS, linePoints);
|
CHECK_PROPERTY_CHANGE(PROP_LINE_POINTS, linePoints);
|
||||||
|
@ -1387,6 +1388,7 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
|
||||||
* @property {boolean} useBackground=true - <code>true</code> if the web entity should have a background,
|
* @property {boolean} useBackground=true - <code>true</code> if the web entity should have a background,
|
||||||
* <code>false</code> if the web entity's background should be transparent. The webpage must have CSS properties for transparency set
|
* <code>false</code> if the web entity's background should be transparent. The webpage must have CSS properties for transparency set
|
||||||
* on the <code>background-color</code> for this property to have an effect.
|
* on the <code>background-color</code> for this property to have an effect.
|
||||||
|
* @property {string} userAgent="Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Mobile Safari/537.36" - The user agent for the web entity to use when visiting web pages.
|
||||||
* @example <caption>Create a Web entity displaying at 1920 x 1080 resolution.</caption>
|
* @example <caption>Create a Web entity displaying at 1920 x 1080 resolution.</caption>
|
||||||
* var METERS_TO_INCHES = 39.3701;
|
* var METERS_TO_INCHES = 39.3701;
|
||||||
* var entity = Entities.addEntity({
|
* var entity = Entities.addEntity({
|
||||||
|
@ -1825,6 +1827,7 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool
|
||||||
COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_INPUT_MODE, inputMode, getInputModeAsString());
|
COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_INPUT_MODE, inputMode, getInputModeAsString());
|
||||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_SHOW_KEYBOARD_FOCUS_HIGHLIGHT, showKeyboardFocusHighlight);
|
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_SHOW_KEYBOARD_FOCUS_HIGHLIGHT, showKeyboardFocusHighlight);
|
||||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_WEB_USE_BACKGROUND, useBackground);
|
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_WEB_USE_BACKGROUND, useBackground);
|
||||||
|
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_USER_AGENT, userAgent);
|
||||||
}
|
}
|
||||||
|
|
||||||
// PolyVoxel only
|
// PolyVoxel only
|
||||||
|
@ -2207,6 +2210,7 @@ void EntityItemProperties::copyFromScriptValue(const QScriptValue& object, bool
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE_ENUM(inputMode, InputMode);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE_ENUM(inputMode, InputMode);
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(showKeyboardFocusHighlight, bool, setShowKeyboardFocusHighlight);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(showKeyboardFocusHighlight, bool, setShowKeyboardFocusHighlight);
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(useBackground, bool, setUseBackground);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(useBackground, bool, setUseBackground);
|
||||||
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(userAgent, QString, setUserAgent);
|
||||||
|
|
||||||
// Polyline
|
// Polyline
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(linePoints, qVectorVec3, setLinePoints);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(linePoints, qVectorVec3, setLinePoints);
|
||||||
|
@ -2499,6 +2503,7 @@ void EntityItemProperties::merge(const EntityItemProperties& other) {
|
||||||
COPY_PROPERTY_IF_CHANGED(inputMode);
|
COPY_PROPERTY_IF_CHANGED(inputMode);
|
||||||
COPY_PROPERTY_IF_CHANGED(showKeyboardFocusHighlight);
|
COPY_PROPERTY_IF_CHANGED(showKeyboardFocusHighlight);
|
||||||
COPY_PROPERTY_IF_CHANGED(useBackground);
|
COPY_PROPERTY_IF_CHANGED(useBackground);
|
||||||
|
COPY_PROPERTY_IF_CHANGED(userAgent);
|
||||||
|
|
||||||
// Polyline
|
// Polyline
|
||||||
COPY_PROPERTY_IF_CHANGED(linePoints);
|
COPY_PROPERTY_IF_CHANGED(linePoints);
|
||||||
|
@ -2899,6 +2904,7 @@ bool EntityItemProperties::getPropertyInfo(const QString& propertyName, EntityPr
|
||||||
ADD_PROPERTY_TO_MAP(PROP_INPUT_MODE, InputMode, inputMode, WebInputMode);
|
ADD_PROPERTY_TO_MAP(PROP_INPUT_MODE, InputMode, inputMode, WebInputMode);
|
||||||
ADD_PROPERTY_TO_MAP(PROP_SHOW_KEYBOARD_FOCUS_HIGHLIGHT, ShowKeyboardFocusHighlight, showKeyboardFocusHighlight, bool);
|
ADD_PROPERTY_TO_MAP(PROP_SHOW_KEYBOARD_FOCUS_HIGHLIGHT, ShowKeyboardFocusHighlight, showKeyboardFocusHighlight, bool);
|
||||||
ADD_PROPERTY_TO_MAP(PROP_WEB_USE_BACKGROUND, useBackground, useBackground, bool);
|
ADD_PROPERTY_TO_MAP(PROP_WEB_USE_BACKGROUND, useBackground, useBackground, bool);
|
||||||
|
ADD_PROPERTY_TO_MAP(PROP_USER_AGENT, UserAgent, userAgent, QString);
|
||||||
|
|
||||||
// Polyline
|
// Polyline
|
||||||
ADD_PROPERTY_TO_MAP(PROP_LINE_POINTS, LinePoints, linePoints, QVector<vec3>);
|
ADD_PROPERTY_TO_MAP(PROP_LINE_POINTS, LinePoints, linePoints, QVector<vec3>);
|
||||||
|
@ -3330,6 +3336,7 @@ OctreeElement::AppendState EntityItemProperties::encodeEntityEditPacket(PacketTy
|
||||||
APPEND_ENTITY_PROPERTY(PROP_INPUT_MODE, (uint32_t)properties.getInputMode());
|
APPEND_ENTITY_PROPERTY(PROP_INPUT_MODE, (uint32_t)properties.getInputMode());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_SHOW_KEYBOARD_FOCUS_HIGHLIGHT, properties.getShowKeyboardFocusHighlight());
|
APPEND_ENTITY_PROPERTY(PROP_SHOW_KEYBOARD_FOCUS_HIGHLIGHT, properties.getShowKeyboardFocusHighlight());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_WEB_USE_BACKGROUND, properties.getUseBackground());
|
APPEND_ENTITY_PROPERTY(PROP_WEB_USE_BACKGROUND, properties.getUseBackground());
|
||||||
|
APPEND_ENTITY_PROPERTY(PROP_USER_AGENT, properties.getUserAgent());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (properties.getType() == EntityTypes::Line) {
|
if (properties.getType() == EntityTypes::Line) {
|
||||||
|
@ -3806,6 +3813,7 @@ bool EntityItemProperties::decodeEntityEditPacket(const unsigned char* data, int
|
||||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_INPUT_MODE, WebInputMode, setInputMode);
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_INPUT_MODE, WebInputMode, setInputMode);
|
||||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_SHOW_KEYBOARD_FOCUS_HIGHLIGHT, bool, setShowKeyboardFocusHighlight);
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_SHOW_KEYBOARD_FOCUS_HIGHLIGHT, bool, setShowKeyboardFocusHighlight);
|
||||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_WEB_USE_BACKGROUND, bool, setUseBackground);
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_WEB_USE_BACKGROUND, bool, setUseBackground);
|
||||||
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_USER_AGENT, QString, setUserAgent);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (properties.getType() == EntityTypes::Line) {
|
if (properties.getType() == EntityTypes::Line) {
|
||||||
|
@ -4194,6 +4202,7 @@ void EntityItemProperties::markAllChanged() {
|
||||||
_inputModeChanged = true;
|
_inputModeChanged = true;
|
||||||
_showKeyboardFocusHighlightChanged = true;
|
_showKeyboardFocusHighlightChanged = true;
|
||||||
_useBackgroundChanged = true;
|
_useBackgroundChanged = true;
|
||||||
|
_userAgentChanged = true;
|
||||||
|
|
||||||
// Polyline
|
// Polyline
|
||||||
_linePointsChanged = true;
|
_linePointsChanged = true;
|
||||||
|
@ -4887,6 +4896,9 @@ QList<QString> EntityItemProperties::listChangedProperties() {
|
||||||
if (useBackgroundChanged()) {
|
if (useBackgroundChanged()) {
|
||||||
out += "useBackground";
|
out += "useBackground";
|
||||||
}
|
}
|
||||||
|
if (userAgentChanged()) {
|
||||||
|
out += "userAgent";
|
||||||
|
}
|
||||||
|
|
||||||
// Shape
|
// Shape
|
||||||
if (shapeChanged()) {
|
if (shapeChanged()) {
|
||||||
|
|
|
@ -367,6 +367,7 @@ public:
|
||||||
DEFINE_PROPERTY_REF_ENUM(PROP_INPUT_MODE, InputMode, inputMode, WebInputMode, WebInputMode::TOUCH);
|
DEFINE_PROPERTY_REF_ENUM(PROP_INPUT_MODE, InputMode, inputMode, WebInputMode, WebInputMode::TOUCH);
|
||||||
DEFINE_PROPERTY_REF(PROP_SHOW_KEYBOARD_FOCUS_HIGHLIGHT, ShowKeyboardFocusHighlight, showKeyboardFocusHighlight, bool, true);
|
DEFINE_PROPERTY_REF(PROP_SHOW_KEYBOARD_FOCUS_HIGHLIGHT, ShowKeyboardFocusHighlight, showKeyboardFocusHighlight, bool, true);
|
||||||
DEFINE_PROPERTY_REF(PROP_WEB_USE_BACKGROUND, UseBackground, useBackground, bool, true);
|
DEFINE_PROPERTY_REF(PROP_WEB_USE_BACKGROUND, UseBackground, useBackground, bool, true);
|
||||||
|
DEFINE_PROPERTY_REF(PROP_USER_AGENT, UserAgent, userAgent, QString, WebEntityItem::DEFAULT_USER_AGENT);
|
||||||
|
|
||||||
// Polyline
|
// Polyline
|
||||||
DEFINE_PROPERTY_REF(PROP_LINE_POINTS, LinePoints, linePoints, QVector<glm::vec3>, ENTITY_ITEM_DEFAULT_EMPTY_VEC3_QVEC);
|
DEFINE_PROPERTY_REF(PROP_LINE_POINTS, LinePoints, linePoints, QVector<glm::vec3>, ENTITY_ITEM_DEFAULT_EMPTY_VEC3_QVEC);
|
||||||
|
|
|
@ -319,6 +319,7 @@ enum EntityPropertyList {
|
||||||
PROP_INPUT_MODE = PROP_DERIVED_4,
|
PROP_INPUT_MODE = PROP_DERIVED_4,
|
||||||
PROP_SHOW_KEYBOARD_FOCUS_HIGHLIGHT = PROP_DERIVED_5,
|
PROP_SHOW_KEYBOARD_FOCUS_HIGHLIGHT = PROP_DERIVED_5,
|
||||||
PROP_WEB_USE_BACKGROUND = PROP_DERIVED_6,
|
PROP_WEB_USE_BACKGROUND = PROP_DERIVED_6,
|
||||||
|
PROP_USER_AGENT = PROP_DERIVED_7,
|
||||||
|
|
||||||
// Polyline
|
// Polyline
|
||||||
PROP_LINE_POINTS = PROP_DERIVED_0,
|
PROP_LINE_POINTS = PROP_DERIVED_0,
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "EntityTreeElement.h"
|
#include "EntityTreeElement.h"
|
||||||
|
|
||||||
const QString WebEntityItem::DEFAULT_SOURCE_URL = NetworkingConstants::WEB_ENTITY_DEFAULT_SOURCE_URL;
|
const QString WebEntityItem::DEFAULT_SOURCE_URL = NetworkingConstants::WEB_ENTITY_DEFAULT_SOURCE_URL;
|
||||||
|
const QString WebEntityItem::DEFAULT_USER_AGENT = NetworkingConstants::WEB_ENTITY_DEFAULT_USER_AGENT;
|
||||||
const uint8_t WebEntityItem::DEFAULT_MAX_FPS = 10;
|
const uint8_t WebEntityItem::DEFAULT_MAX_FPS = 10;
|
||||||
|
|
||||||
EntityItemPointer WebEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
|
EntityItemPointer WebEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
|
||||||
|
@ -63,6 +64,7 @@ EntityItemProperties WebEntityItem::getProperties(const EntityPropertyFlags& des
|
||||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(inputMode, getInputMode);
|
COPY_ENTITY_PROPERTY_TO_PROPERTIES(inputMode, getInputMode);
|
||||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(showKeyboardFocusHighlight, getShowKeyboardFocusHighlight);
|
COPY_ENTITY_PROPERTY_TO_PROPERTIES(showKeyboardFocusHighlight, getShowKeyboardFocusHighlight);
|
||||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(useBackground, getUseBackground);
|
COPY_ENTITY_PROPERTY_TO_PROPERTIES(useBackground, getUseBackground);
|
||||||
|
COPY_ENTITY_PROPERTY_TO_PROPERTIES(userAgent, getUserAgent);
|
||||||
return properties;
|
return properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,6 +87,7 @@ bool WebEntityItem::setSubClassProperties(const EntityItemProperties& properties
|
||||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(inputMode, setInputMode);
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(inputMode, setInputMode);
|
||||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(showKeyboardFocusHighlight, setShowKeyboardFocusHighlight);
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(showKeyboardFocusHighlight, setShowKeyboardFocusHighlight);
|
||||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(useBackground, setUseBackground);
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(useBackground, setUseBackground);
|
||||||
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(userAgent, setUserAgent);
|
||||||
|
|
||||||
return somethingChanged;
|
return somethingChanged;
|
||||||
}
|
}
|
||||||
|
@ -115,6 +118,7 @@ int WebEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, i
|
||||||
READ_ENTITY_PROPERTY(PROP_INPUT_MODE, WebInputMode, setInputMode);
|
READ_ENTITY_PROPERTY(PROP_INPUT_MODE, WebInputMode, setInputMode);
|
||||||
READ_ENTITY_PROPERTY(PROP_SHOW_KEYBOARD_FOCUS_HIGHLIGHT, bool, setShowKeyboardFocusHighlight);
|
READ_ENTITY_PROPERTY(PROP_SHOW_KEYBOARD_FOCUS_HIGHLIGHT, bool, setShowKeyboardFocusHighlight);
|
||||||
READ_ENTITY_PROPERTY(PROP_WEB_USE_BACKGROUND, bool, setUseBackground);
|
READ_ENTITY_PROPERTY(PROP_WEB_USE_BACKGROUND, bool, setUseBackground);
|
||||||
|
READ_ENTITY_PROPERTY(PROP_USER_AGENT, QString, setUserAgent);
|
||||||
|
|
||||||
return bytesRead;
|
return bytesRead;
|
||||||
}
|
}
|
||||||
|
@ -133,6 +137,7 @@ EntityPropertyFlags WebEntityItem::getEntityProperties(EncodeBitstreamParams& pa
|
||||||
requestedProperties += PROP_INPUT_MODE;
|
requestedProperties += PROP_INPUT_MODE;
|
||||||
requestedProperties += PROP_SHOW_KEYBOARD_FOCUS_HIGHLIGHT;
|
requestedProperties += PROP_SHOW_KEYBOARD_FOCUS_HIGHLIGHT;
|
||||||
requestedProperties += PROP_WEB_USE_BACKGROUND;
|
requestedProperties += PROP_WEB_USE_BACKGROUND;
|
||||||
|
requestedProperties += PROP_USER_AGENT;
|
||||||
return requestedProperties;
|
return requestedProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,6 +165,7 @@ void WebEntityItem::appendSubclassData(OctreePacketData* packetData, EncodeBitst
|
||||||
APPEND_ENTITY_PROPERTY(PROP_INPUT_MODE, (uint32_t)getInputMode());
|
APPEND_ENTITY_PROPERTY(PROP_INPUT_MODE, (uint32_t)getInputMode());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_SHOW_KEYBOARD_FOCUS_HIGHLIGHT, getShowKeyboardFocusHighlight());
|
APPEND_ENTITY_PROPERTY(PROP_SHOW_KEYBOARD_FOCUS_HIGHLIGHT, getShowKeyboardFocusHighlight());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_WEB_USE_BACKGROUND, getUseBackground());
|
APPEND_ENTITY_PROPERTY(PROP_WEB_USE_BACKGROUND, getUseBackground());
|
||||||
|
APPEND_ENTITY_PROPERTY(PROP_USER_AGENT, getUserAgent());
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::vec3 WebEntityItem::getRaycastDimensions() const {
|
glm::vec3 WebEntityItem::getRaycastDimensions() const {
|
||||||
|
@ -365,6 +371,17 @@ bool WebEntityItem::getUseBackground() const {
|
||||||
return resultWithReadLock<bool>([&] { return _useBackground; });
|
return resultWithReadLock<bool>([&] { return _useBackground; });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WebEntityItem::setUserAgent(const QString& value) {
|
||||||
|
withWriteLock([&] {
|
||||||
|
_needsRenderUpdate |= _userAgent != value;
|
||||||
|
_userAgent = value;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
QString WebEntityItem::getUserAgent() const {
|
||||||
|
return resultWithReadLock<QString>([&] { return _userAgent; });
|
||||||
|
}
|
||||||
|
|
||||||
PulsePropertyGroup WebEntityItem::getPulseProperties() const {
|
PulsePropertyGroup WebEntityItem::getPulseProperties() const {
|
||||||
return resultWithReadLock<PulsePropertyGroup>([&] {
|
return resultWithReadLock<PulsePropertyGroup>([&] {
|
||||||
return _pulseProperties;
|
return _pulseProperties;
|
||||||
|
|
|
@ -89,6 +89,10 @@ public:
|
||||||
|
|
||||||
bool getUseBackground() const;
|
bool getUseBackground() const;
|
||||||
void setUseBackground(bool value);
|
void setUseBackground(bool value);
|
||||||
|
|
||||||
|
static const QString DEFAULT_USER_AGENT;
|
||||||
|
QString getUserAgent() const;
|
||||||
|
void setUserAgent(const QString& value);
|
||||||
|
|
||||||
PulsePropertyGroup getPulseProperties() const;
|
PulsePropertyGroup getPulseProperties() const;
|
||||||
|
|
||||||
|
@ -105,6 +109,7 @@ protected:
|
||||||
WebInputMode _inputMode;
|
WebInputMode _inputMode;
|
||||||
bool _showKeyboardFocusHighlight;
|
bool _showKeyboardFocusHighlight;
|
||||||
bool _useBackground;
|
bool _useBackground;
|
||||||
|
QString _userAgent;
|
||||||
bool _localSafeContext { false };
|
bool _localSafeContext { false };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,7 @@ namespace NetworkingConstants {
|
||||||
|
|
||||||
// WebEntity Defaults
|
// WebEntity Defaults
|
||||||
const QString WEB_ENTITY_DEFAULT_SOURCE_URL = "https://vircadia.com/";
|
const QString WEB_ENTITY_DEFAULT_SOURCE_URL = "https://vircadia.com/";
|
||||||
|
const QString WEB_ENTITY_DEFAULT_USER_AGENT = "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Mobile Safari/537.36";
|
||||||
|
|
||||||
const QString DEFAULT_AVATAR_COLLISION_SOUND_URL = "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/Body_Hits_Impact.wav";
|
const QString DEFAULT_AVATAR_COLLISION_SOUND_URL = "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/Body_Hits_Impact.wav";
|
||||||
|
|
||||||
|
|
|
@ -283,6 +283,7 @@ enum class EntityVersion : PacketVersion {
|
||||||
ZoneOcclusion,
|
ZoneOcclusion,
|
||||||
ModelBlendshapes,
|
ModelBlendshapes,
|
||||||
TransparentWeb,
|
TransparentWeb,
|
||||||
|
UserAgent,
|
||||||
|
|
||||||
// Add new versions above here
|
// Add new versions above here
|
||||||
NUM_PACKET_TYPE,
|
NUM_PACKET_TYPE,
|
||||||
|
|
|
@ -616,6 +616,9 @@
|
||||||
"scriptURL": {
|
"scriptURL": {
|
||||||
"tooltip": "The URL of a script to inject into the web page."
|
"tooltip": "The URL of a script to inject into the web page."
|
||||||
},
|
},
|
||||||
|
"userAgent": {
|
||||||
|
"tooltip": "The user agent that the web entity will use when visiting web pages."
|
||||||
|
},
|
||||||
"alignToGrid": {
|
"alignToGrid": {
|
||||||
"tooltip": "Used to align entities to the grid, or floor of the environment.",
|
"tooltip": "Used to align entities to the grid, or floor of the environment.",
|
||||||
"skipJSProperty": true
|
"skipJSProperty": true
|
||||||
|
|
|
@ -800,6 +800,12 @@ const GROUPS = [
|
||||||
type: "string",
|
type: "string",
|
||||||
propertyID: "scriptURL",
|
propertyID: "scriptURL",
|
||||||
placeholder: "URL",
|
placeholder: "URL",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "User Agent",
|
||||||
|
type: "string",
|
||||||
|
propertyID: "userAgent",
|
||||||
|
placeholder: "User Agent",
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue