mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
move value sanitizing to WebEntityItem
This commit is contained in:
parent
99e0c8c0e7
commit
d7651e9838
2 changed files with 15 additions and 15 deletions
|
@ -246,21 +246,14 @@ void RenderableWebEntityItem::render(RenderArgs* args) {
|
|||
}
|
||||
|
||||
void RenderableWebEntityItem::setSourceUrl(const QString& value) {
|
||||
if (_sourceUrl != value) {
|
||||
auto newURL = QUrl::fromUserInput(value);
|
||||
auto valueBeforeSuperclassSet = _sourceUrl;
|
||||
|
||||
if (newURL.isValid()) {
|
||||
qCDebug(entities) << "Setting web entity source URL to " << value;
|
||||
_sourceUrl = newURL.toDisplayString();
|
||||
} else {
|
||||
qCDebug(entities) << "Clearing web entity source URL since" << value << "cannot be parsed to a valid URL.";
|
||||
}
|
||||
|
||||
if (_webSurface) {
|
||||
AbstractViewStateInterface::instance()->postLambdaEvent([this] {
|
||||
_webSurface->getRootItem()->setProperty("url", _sourceUrl);
|
||||
});
|
||||
}
|
||||
WebEntityItem::setSourceUrl(value);
|
||||
|
||||
if (_sourceUrl != valueBeforeSuperclassSet && _webSurface) {
|
||||
AbstractViewStateInterface::instance()->postLambdaEvent([this] {
|
||||
_webSurface->getRootItem()->setProperty("url", _sourceUrl);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -125,7 +125,14 @@ bool WebEntityItem::findDetailedRayIntersection(const glm::vec3& origin, const g
|
|||
|
||||
void WebEntityItem::setSourceUrl(const QString& value) {
|
||||
if (_sourceUrl != value) {
|
||||
_sourceUrl = value;
|
||||
auto newURL = QUrl::fromUserInput(value);
|
||||
|
||||
if (newURL.isValid()) {
|
||||
qCDebug(entities) << "Setting web entity source URL to " << value;
|
||||
_sourceUrl = newURL.toDisplayString();
|
||||
} else {
|
||||
qCDebug(entities) << "Clearing web entity source URL since" << value << "cannot be parsed to a valid URL.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue