fix some OS X warnings, add description to tooltip

This commit is contained in:
Stephen Birarda 2015-06-26 10:50:31 -07:00
parent 1a523297ba
commit c6df573933
10 changed files with 113 additions and 77 deletions

View file

@ -18,7 +18,7 @@ Hifi.Tooltip {
offsetX = (lastMousePosition.x > surfaceSize.width/2) ? -root.width : 0 offsetX = (lastMousePosition.x > surfaceSize.width/2) ? -root.width : 0
offsetY = (lastMousePosition.y > surfaceSize.height/2) ? -root.height : 0 offsetY = (lastMousePosition.y > surfaceSize.height/2) ? -root.height : 0
} }
Rectangle { Rectangle {
id: border id: border
color: "#7f000000" color: "#7f000000"
@ -42,10 +42,10 @@ Hifi.Tooltip {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
font.pixelSize: hifi.fonts.pixelSize / 2 font.pixelSize: hifi.fonts.pixelSize / 2
text: root.text text: root.title
wrapMode: Text.WrapAnywhere wrapMode: Text.WrapAnywhere
/* Uncomment for debugging to see the extent of the /* Uncomment for debugging to see the extent of the
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
color: "#7fff00ff" color: "#7fff00ff"
@ -68,9 +68,9 @@ Hifi.Tooltip {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
font.pixelSize: hifi.fonts.pixelSize / 2 font.pixelSize: hifi.fonts.pixelSize / 2
text: root.text text: root.description
wrapMode: Text.WrapAnywhere wrapMode: Text.WrapAnywhere
} }
} }
} }
} }

View file

@ -13,14 +13,14 @@
#include <QScriptEngine> #include <QScriptEngine>
#ifdef __GNUC__ #if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdouble-promotion" #pragma GCC diagnostic ignored "-Wdouble-promotion"
#endif #endif
#include <glm/gtx/string_cast.hpp> #include <glm/gtx/string_cast.hpp>
#ifdef __GNUC__ #if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#endif #endif
@ -74,19 +74,19 @@ void AvatarManager::init() {
render::ScenePointer scene = Application::getInstance()->getMain3DScene(); render::ScenePointer scene = Application::getInstance()->getMain3DScene();
render::PendingChanges pendingChanges; render::PendingChanges pendingChanges;
_myAvatar->addToScene(_myAvatar, scene, pendingChanges); _myAvatar->addToScene(_myAvatar, scene, pendingChanges);
scene->enqueuePendingChanges(pendingChanges); scene->enqueuePendingChanges(pendingChanges);
} }
void AvatarManager::updateMyAvatar(float deltaTime) { void AvatarManager::updateMyAvatar(float deltaTime) {
bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
PerformanceWarning warn(showWarnings, "AvatarManager::updateMyAvatar()"); PerformanceWarning warn(showWarnings, "AvatarManager::updateMyAvatar()");
_myAvatar->update(deltaTime); _myAvatar->update(deltaTime);
quint64 now = usecTimestampNow(); quint64 now = usecTimestampNow();
quint64 dt = now - _lastSendAvatarDataTime; quint64 dt = now - _lastSendAvatarDataTime;
if (dt > MIN_TIME_BETWEEN_MY_AVATAR_DATA_SENDS) { if (dt > MIN_TIME_BETWEEN_MY_AVATAR_DATA_SENDS) {
// send head/hand data to the avatar mixer and voxel server // send head/hand data to the avatar mixer and voxel server
PerformanceTimer perfTimer("send"); PerformanceTimer perfTimer("send");
@ -103,12 +103,12 @@ void AvatarManager::updateOtherAvatars(float deltaTime) {
PerformanceWarning warn(showWarnings, "Application::updateAvatars()"); PerformanceWarning warn(showWarnings, "Application::updateAvatars()");
PerformanceTimer perfTimer("otherAvatars"); PerformanceTimer perfTimer("otherAvatars");
// simulate avatars // simulate avatars
AvatarHash::iterator avatarIterator = _avatarHash.begin(); AvatarHash::iterator avatarIterator = _avatarHash.begin();
while (avatarIterator != _avatarHash.end()) { while (avatarIterator != _avatarHash.end()) {
auto avatar = std::dynamic_pointer_cast<Avatar>(avatarIterator.value()); auto avatar = std::dynamic_pointer_cast<Avatar>(avatarIterator.value());
if (avatar == _myAvatar || !avatar->isInitialized()) { if (avatar == _myAvatar || !avatar->isInitialized()) {
// DO NOT update _myAvatar! Its update has already been done earlier in the main loop. // DO NOT update _myAvatar! Its update has already been done earlier in the main loop.
// DO NOT update or fade out uninitialized Avatars // DO NOT update or fade out uninitialized Avatars
@ -122,17 +122,17 @@ void AvatarManager::updateOtherAvatars(float deltaTime) {
++avatarIterator; ++avatarIterator;
} }
} }
// simulate avatar fades // simulate avatar fades
simulateAvatarFades(deltaTime); simulateAvatarFades(deltaTime);
} }
void AvatarManager::simulateAvatarFades(float deltaTime) { void AvatarManager::simulateAvatarFades(float deltaTime) {
QVector<AvatarSharedPointer>::iterator fadingIterator = _avatarFades.begin(); QVector<AvatarSharedPointer>::iterator fadingIterator = _avatarFades.begin();
const float SHRINK_RATE = 0.9f; const float SHRINK_RATE = 0.9f;
const float MIN_FADE_SCALE = 0.001f; const float MIN_FADE_SCALE = 0.001f;
render::ScenePointer scene = Application::getInstance()->getMain3DScene(); render::ScenePointer scene = Application::getInstance()->getMain3DScene();
render::PendingChanges pendingChanges; render::PendingChanges pendingChanges;
while (fadingIterator != _avatarFades.end()) { while (fadingIterator != _avatarFades.end()) {
@ -153,12 +153,12 @@ AvatarSharedPointer AvatarManager::newSharedAvatar() {
return AvatarSharedPointer(std::make_shared<Avatar>()); return AvatarSharedPointer(std::make_shared<Avatar>());
} }
// virtual // virtual
AvatarSharedPointer AvatarManager::addAvatar(const QUuid& sessionUUID, const QWeakPointer<Node>& mixerWeakPointer) { AvatarSharedPointer AvatarManager::addAvatar(const QUuid& sessionUUID, const QWeakPointer<Node>& mixerWeakPointer) {
auto avatar = std::dynamic_pointer_cast<Avatar>(AvatarHashMap::addAvatar(sessionUUID, mixerWeakPointer)); auto avatar = std::dynamic_pointer_cast<Avatar>(AvatarHashMap::addAvatar(sessionUUID, mixerWeakPointer));
render::ScenePointer scene = Application::getInstance()->getMain3DScene(); render::ScenePointer scene = Application::getInstance()->getMain3DScene();
render::PendingChanges pendingChanges; render::PendingChanges pendingChanges;
avatar->addToScene(avatar, scene, pendingChanges); avatar->addToScene(avatar, scene, pendingChanges);
scene->enqueuePendingChanges(pendingChanges); scene->enqueuePendingChanges(pendingChanges);
return avatar; return avatar;
} }
@ -177,7 +177,7 @@ void AvatarManager::removeAvatarMotionState(AvatarSharedPointer avatar) {
} }
} }
// virtual // virtual
void AvatarManager::removeAvatar(const QUuid& sessionUUID) { void AvatarManager::removeAvatar(const QUuid& sessionUUID) {
AvatarHash::iterator avatarIterator = _avatarHash.find(sessionUUID); AvatarHash::iterator avatarIterator = _avatarHash.find(sessionUUID);
if (avatarIterator != _avatarHash.end()) { if (avatarIterator != _avatarHash.end()) {

View file

@ -117,7 +117,7 @@ ApplicationCompositor::ApplicationCompositor() {
memset(_magSizeMult, 0, sizeof(_magSizeMult)); memset(_magSizeMult, 0, sizeof(_magSizeMult));
auto geometryCache = DependencyManager::get<GeometryCache>(); auto geometryCache = DependencyManager::get<GeometryCache>();
_reticleQuad = geometryCache->allocateID(); _reticleQuad = geometryCache->allocateID();
_magnifierQuad = geometryCache->allocateID(); _magnifierQuad = geometryCache->allocateID();
_magnifierBorder = geometryCache->allocateID(); _magnifierBorder = geometryCache->allocateID();
@ -128,9 +128,22 @@ ApplicationCompositor::ApplicationCompositor() {
_hoverItemId = entityItemID; _hoverItemId = entityItemID;
_hoverItemEnterUsecs = usecTimestampNow(); _hoverItemEnterUsecs = usecTimestampNow();
auto properties = entityScriptingInterface->getEntityProperties(_hoverItemId); auto properties = entityScriptingInterface->getEntityProperties(_hoverItemId);
_hoverItemHref = properties.getHref();
// check the format of this href string before we parse it
QString hrefString = properties.getHref();
if (!hrefString.startsWith("hifi:")) {
hrefString.prepend("hifi://");
}
// parse out a QUrl from the hrefString
QUrl href = QUrl(hrefString);
_hoverItemTitle = href.host();
_hoverItemDescription = properties.getDescription();
auto cursor = Cursor::Manager::instance().getCursor(); auto cursor = Cursor::Manager::instance().getCursor();
if (!_hoverItemHref.isEmpty()) {
if (!href.isEmpty()) {
cursor->setIcon(Cursor::Icon::LINK); cursor->setIcon(Cursor::Icon::LINK);
} else { } else {
cursor->setIcon(Cursor::Icon::DEFAULT); cursor->setIcon(Cursor::Icon::DEFAULT);
@ -141,7 +154,10 @@ ApplicationCompositor::ApplicationCompositor() {
connect(entityScriptingInterface.data(), &EntityScriptingInterface::hoverLeaveEntity, [=](const EntityItemID& entityItemID, const MouseEvent& event) { connect(entityScriptingInterface.data(), &EntityScriptingInterface::hoverLeaveEntity, [=](const EntityItemID& entityItemID, const MouseEvent& event) {
if (_hoverItemId == entityItemID) { if (_hoverItemId == entityItemID) {
_hoverItemId = _noItemId; _hoverItemId = _noItemId;
_hoverItemHref.clear();
_hoverItemTitle.clear();
_hoverItemDescription.clear();
auto cursor = Cursor::Manager::instance().getCursor(); auto cursor = Cursor::Manager::instance().getCursor();
cursor->setIcon(Cursor::Icon::DEFAULT); cursor->setIcon(Cursor::Icon::DEFAULT);
if (!_tooltipId.isEmpty()) { if (!_tooltipId.isEmpty()) {
@ -314,7 +330,7 @@ void ApplicationCompositor::displayOverlayTextureHmd(RenderArgs* renderArgs, int
batch.setModelTransform(reticleXfm); batch.setModelTransform(reticleXfm);
geometryCache->renderUnitQuad(batch, glm::vec4(1), _reticleQuad); geometryCache->renderUnitQuad(batch, glm::vec4(1), _reticleQuad);
} }
renderArgs->_context->render(batch); renderArgs->_context->render(batch);
} }
@ -324,7 +340,7 @@ void ApplicationCompositor::computeHmdPickRay(glm::vec2 cursorPos, glm::vec3& or
const glm::vec2 projection = screenToSpherical(cursorPos); const glm::vec2 projection = screenToSpherical(cursorPos);
// The overlay space orientation of the mouse coordinates // The overlay space orientation of the mouse coordinates
const glm::quat orientation(glm::vec3(-projection.y, projection.x, 0.0f)); const glm::quat orientation(glm::vec3(-projection.y, projection.x, 0.0f));
// FIXME We now have the direction of the ray FROM THE DEFAULT HEAD POSE. // FIXME We now have the direction of the ray FROM THE DEFAULT HEAD POSE.
// Now we need to account for the actual camera position relative to the overlay // Now we need to account for the actual camera position relative to the overlay
glm::vec3 overlaySpaceDirection = glm::normalize(orientation * IDENTITY_FRONT); glm::vec3 overlaySpaceDirection = glm::normalize(orientation * IDENTITY_FRONT);
@ -377,7 +393,7 @@ QPoint ApplicationCompositor::getPalmClickLocation(const PalmData *palm) const {
//Finds the collision point of a world space ray //Finds the collision point of a world space ray
bool ApplicationCompositor::calculateRayUICollisionPoint(const glm::vec3& position, const glm::vec3& direction, glm::vec3& result) const { bool ApplicationCompositor::calculateRayUICollisionPoint(const glm::vec3& position, const glm::vec3& direction, glm::vec3& result) const {
MyAvatar* myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar(); MyAvatar* myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
glm::quat inverseOrientation = glm::inverse(myAvatar->getOrientation()); glm::quat inverseOrientation = glm::inverse(myAvatar->getOrientation());
glm::vec3 relativePosition = inverseOrientation * (position - myAvatar->getDefaultEyePosition()); glm::vec3 relativePosition = inverseOrientation * (position - myAvatar->getDefaultEyePosition());
@ -409,7 +425,7 @@ void ApplicationCompositor::renderPointers(gpu::Batch& batch) {
renderControllerPointers(batch); renderControllerPointers(batch);
} }
} }
void ApplicationCompositor::renderControllerPointers(gpu::Batch& batch) { void ApplicationCompositor::renderControllerPointers(gpu::Batch& batch) {
MyAvatar* myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar(); MyAvatar* myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
@ -517,7 +533,7 @@ void ApplicationCompositor::renderControllerPointers(gpu::Batch& batch) {
DependencyManager::get<GeometryCache>()->renderQuad(topLeft, bottomRight, texCoordTopLeft, texCoordBottomRight, DependencyManager::get<GeometryCache>()->renderQuad(topLeft, bottomRight, texCoordTopLeft, texCoordBottomRight,
glm::vec4(RETICLE_COLOR[0], RETICLE_COLOR[1], RETICLE_COLOR[2], 1.0f)); glm::vec4(RETICLE_COLOR[0], RETICLE_COLOR[1], RETICLE_COLOR[2], 1.0f));
} }
} }
@ -527,10 +543,10 @@ void ApplicationCompositor::renderMagnifier(gpu::Batch& batch, const glm::vec2&
return; return;
} }
auto canvasSize = qApp->getCanvasSize(); auto canvasSize = qApp->getCanvasSize();
const int widgetWidth = canvasSize.x; const int widgetWidth = canvasSize.x;
const int widgetHeight = canvasSize.y; const int widgetHeight = canvasSize.y;
const float halfWidth = (MAGNIFY_WIDTH / _textureAspectRatio) * sizeMult / 2.0f; const float halfWidth = (MAGNIFY_WIDTH / _textureAspectRatio) * sizeMult / 2.0f;
const float halfHeight = MAGNIFY_HEIGHT * sizeMult / 2.0f; const float halfHeight = MAGNIFY_HEIGHT * sizeMult / 2.0f;
// Magnification Texture Coordinates // Magnification Texture Coordinates
@ -538,7 +554,7 @@ void ApplicationCompositor::renderMagnifier(gpu::Batch& batch, const glm::vec2&
const float magnifyURight = (magPos.x + halfWidth) / (float)widgetWidth; const float magnifyURight = (magPos.x + halfWidth) / (float)widgetWidth;
const float magnifyVTop = 1.0f - (magPos.y - halfHeight) / (float)widgetHeight; const float magnifyVTop = 1.0f - (magPos.y - halfHeight) / (float)widgetHeight;
const float magnifyVBottom = 1.0f - (magPos.y + halfHeight) / (float)widgetHeight; const float magnifyVBottom = 1.0f - (magPos.y + halfHeight) / (float)widgetHeight;
const float newHalfWidth = halfWidth * MAGNIFY_MULT; const float newHalfWidth = halfWidth * MAGNIFY_MULT;
const float newHalfHeight = halfHeight * MAGNIFY_MULT; const float newHalfHeight = halfHeight * MAGNIFY_MULT;
//Get yaw / pitch value for the corners //Get yaw / pitch value for the corners
@ -546,7 +562,7 @@ void ApplicationCompositor::renderMagnifier(gpu::Batch& batch, const glm::vec2&
magPos.y - newHalfHeight)); magPos.y - newHalfHeight));
const glm::vec2 bottomRightYawPitch = overlayToSpherical(glm::vec2(magPos.x + newHalfWidth, const glm::vec2 bottomRightYawPitch = overlayToSpherical(glm::vec2(magPos.x + newHalfWidth,
magPos.y + newHalfHeight)); magPos.y + newHalfHeight));
const glm::vec3 bottomLeft = getPoint(topLeftYawPitch.x, bottomRightYawPitch.y); const glm::vec3 bottomLeft = getPoint(topLeftYawPitch.x, bottomRightYawPitch.y);
const glm::vec3 bottomRight = getPoint(bottomRightYawPitch.x, bottomRightYawPitch.y); const glm::vec3 bottomRight = getPoint(bottomRightYawPitch.x, bottomRightYawPitch.y);
const glm::vec3 topLeft = getPoint(topLeftYawPitch.x, topLeftYawPitch.y); const glm::vec3 topLeft = getPoint(topLeftYawPitch.x, topLeftYawPitch.y);
@ -569,7 +585,7 @@ void ApplicationCompositor::renderMagnifier(gpu::Batch& batch, const glm::vec2&
_previousMagnifierTopLeft = topLeft; _previousMagnifierTopLeft = topLeft;
_previousMagnifierTopRight = topRight; _previousMagnifierTopRight = topRight;
} }
glPushMatrix(); { glPushMatrix(); {
if (showBorder) { if (showBorder) {
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
@ -581,12 +597,12 @@ void ApplicationCompositor::renderMagnifier(gpu::Batch& batch, const glm::vec2&
glm::vec4 magnifierColor = { 1.0f, 1.0f, 1.0f, _alpha }; glm::vec4 magnifierColor = { 1.0f, 1.0f, 1.0f, _alpha };
DependencyManager::get<GeometryCache>()->renderQuad(bottomLeft, bottomRight, topRight, topLeft, DependencyManager::get<GeometryCache>()->renderQuad(bottomLeft, bottomRight, topRight, topLeft,
glm::vec2(magnifyULeft, magnifyVBottom), glm::vec2(magnifyULeft, magnifyVBottom),
glm::vec2(magnifyURight, magnifyVBottom), glm::vec2(magnifyURight, magnifyVBottom),
glm::vec2(magnifyURight, magnifyVTop), glm::vec2(magnifyURight, magnifyVTop),
glm::vec2(magnifyULeft, magnifyVTop), glm::vec2(magnifyULeft, magnifyVTop),
magnifierColor, _magnifierQuad); magnifierColor, _magnifierQuad);
} glPopMatrix(); } glPopMatrix();
} }
@ -611,8 +627,8 @@ void ApplicationCompositor::buildHemiVertices(
} }
//UV mapping source: http://www.mvps.org/directx/articles/spheremap.htm //UV mapping source: http://www.mvps.org/directx/articles/spheremap.htm
vec3 pos; vec3 pos;
vec2 uv; vec2 uv;
// Compute vertices positions and texture UV coordinate // Compute vertices positions and texture UV coordinate
// Create and write to buffer // Create and write to buffer
@ -631,13 +647,13 @@ void ApplicationCompositor::buildHemiVertices(
_hemiVertices->append(sizeof(vec4), (gpu::Byte*)&color); _hemiVertices->append(sizeof(vec4), (gpu::Byte*)&color);
} }
} }
// Compute number of indices needed // Compute number of indices needed
static const int VERTEX_PER_TRANGLE = 3; static const int VERTEX_PER_TRANGLE = 3;
static const int TRIANGLE_PER_RECTANGLE = 2; static const int TRIANGLE_PER_RECTANGLE = 2;
int numberOfRectangles = (slices - 1) * (stacks - 1); int numberOfRectangles = (slices - 1) * (stacks - 1);
_hemiIndexCount = numberOfRectangles * TRIANGLE_PER_RECTANGLE * VERTEX_PER_TRANGLE; _hemiIndexCount = numberOfRectangles * TRIANGLE_PER_RECTANGLE * VERTEX_PER_TRANGLE;
// Compute indices order // Compute indices order
std::vector<GLushort> indices; std::vector<GLushort> indices;
for (int i = 0; i < stacks - 1; i++) { for (int i = 0; i < stacks - 1; i++) {
@ -694,7 +710,7 @@ glm::vec2 ApplicationCompositor::directionToSpherical(const glm::vec3& direction
} }
// Compute pitch // Compute pitch
result.y = angleBetween(IDENTITY_UP, direction) - PI_OVER_TWO; result.y = angleBetween(IDENTITY_UP, direction) - PI_OVER_TWO;
return result; return result;
} }
@ -710,7 +726,7 @@ glm::vec2 ApplicationCompositor::screenToSpherical(const glm::vec2& screenPos) {
result.y = (screenPos.y / screenSize.y - 0.5f); result.y = (screenPos.y / screenSize.y - 0.5f);
result.x *= MOUSE_YAW_RANGE; result.x *= MOUSE_YAW_RANGE;
result.y *= MOUSE_PITCH_RANGE; result.y *= MOUSE_PITCH_RANGE;
return result; return result;
} }
@ -720,7 +736,7 @@ glm::vec2 ApplicationCompositor::sphericalToScreen(const glm::vec2& sphericalPos
result /= MOUSE_RANGE; result /= MOUSE_RANGE;
result += 0.5f; result += 0.5f;
result *= qApp->getCanvasSize(); result *= qApp->getCanvasSize();
return result; return result;
} }
glm::vec2 ApplicationCompositor::sphericalToOverlay(const glm::vec2& sphericalPos) const { glm::vec2 ApplicationCompositor::sphericalToOverlay(const glm::vec2& sphericalPos) const {
@ -737,7 +753,7 @@ glm::vec2 ApplicationCompositor::overlayToSpherical(const glm::vec2& overlayPos
glm::vec2 result = overlayPos; glm::vec2 result = overlayPos;
result /= qApp->getCanvasSize(); result /= qApp->getCanvasSize();
result -= 0.5f; result -= 0.5f;
result *= _textureFov; result *= _textureFov;
result.x *= _textureAspectRatio; result.x *= _textureAspectRatio;
result.x *= -1.0f; result.x *= -1.0f;
return result; return result;
@ -754,10 +770,10 @@ glm::vec2 ApplicationCompositor::overlayToScreen(const glm::vec2& overlayPos) co
void ApplicationCompositor::updateTooltips() { void ApplicationCompositor::updateTooltips() {
if (_hoverItemId != _noItemId) { if (_hoverItemId != _noItemId) {
quint64 hoverDuration = usecTimestampNow() - _hoverItemEnterUsecs; quint64 hoverDuration = usecTimestampNow() - _hoverItemEnterUsecs;
if (_hoverItemEnterUsecs != UINT64_MAX && !_hoverItemHref.isEmpty() && hoverDuration > TOOLTIP_DELAY) { if (_hoverItemEnterUsecs != UINT64_MAX && !_hoverItemTitle.isEmpty() && hoverDuration > TOOLTIP_DELAY) {
// TODO Enable and position the tooltip // TODO Enable and position the tooltip
_hoverItemEnterUsecs = UINT64_MAX; _hoverItemEnterUsecs = UINT64_MAX;
_tooltipId = Tooltip::showTip("URL: " + _hoverItemHref); _tooltipId = Tooltip::showTip(_hoverItemTitle, _hoverItemDescription);
} }
} }
} }

View file

@ -42,7 +42,7 @@ public:
QPoint getPalmClickLocation(const PalmData *palm) const; QPoint getPalmClickLocation(const PalmData *palm) const;
bool calculateRayUICollisionPoint(const glm::vec3& position, const glm::vec3& direction, glm::vec3& result) const; bool calculateRayUICollisionPoint(const glm::vec3& position, const glm::vec3& direction, glm::vec3& result) const;
bool hasMagnifier() const { return _magnifier; } bool hasMagnifier() const { return _magnifier; }
void toggleMagnifier() { _magnifier = !_magnifier; } void toggleMagnifier() { _magnifier = !_magnifier; }
@ -68,7 +68,7 @@ public:
static glm::vec3 sphericalToDirection(const glm::vec2 & sphericalPos); static glm::vec3 sphericalToDirection(const glm::vec2 & sphericalPos);
static glm::vec2 screenToSpherical(const glm::vec2 & screenPos); static glm::vec2 screenToSpherical(const glm::vec2 & screenPos);
static glm::vec2 sphericalToScreen(const glm::vec2 & sphericalPos); static glm::vec2 sphericalToScreen(const glm::vec2 & sphericalPos);
private: private:
void displayOverlayTextureStereo(RenderArgs* renderArgs, float aspectRatio, float fov); void displayOverlayTextureStereo(RenderArgs* renderArgs, float aspectRatio, float fov);
void bindCursorTexture(gpu::Batch& batch, uint8_t cursorId = 0); void bindCursorTexture(gpu::Batch& batch, uint8_t cursorId = 0);
@ -83,9 +83,10 @@ private:
// Support for hovering and tooltips // Support for hovering and tooltips
static EntityItemID _noItemId; static EntityItemID _noItemId;
EntityItemID _hoverItemId{ _noItemId }; EntityItemID _hoverItemId { _noItemId };
QString _hoverItemHref; QString _hoverItemTitle;
quint64 _hoverItemEnterUsecs{ 0 }; QString _hoverItemDescription;
quint64 _hoverItemEnterUsecs { 0 };
float _hmdUIAngularSize = DEFAULT_HMD_UI_ANGULAR_SIZE; float _hmdUIAngularSize = DEFAULT_HMD_UI_ANGULAR_SIZE;
float _textureFov{ glm::radians(DEFAULT_HMD_UI_ANGULAR_SIZE) }; float _textureFov{ glm::radians(DEFAULT_HMD_UI_ANGULAR_SIZE) };

View file

@ -11,7 +11,7 @@
#include "InterfaceConfig.h" #include "InterfaceConfig.h"
#ifdef __GNUC__ #if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdouble-promotion" #pragma GCC diagnostic ignored "-Wdouble-promotion"
#endif #endif
@ -20,7 +20,7 @@
#include <QTextBlock> #include <QTextBlock>
#include <QtGui> #include <QtGui>
#ifdef __GNUC__ #if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#endif #endif

View file

@ -11,7 +11,7 @@
#include <QByteArray> #include <QByteArray>
#ifdef __GNUC__ #if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdouble-promotion" #pragma GCC diagnostic ignored "-Wdouble-promotion"
#endif #endif
@ -19,7 +19,7 @@
#include <glm/gtx/quaternion.hpp> #include <glm/gtx/quaternion.hpp>
#include <glm/gtx/string_cast.hpp> #include <glm/gtx/string_cast.hpp>
#ifdef __GNUC__ #if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#endif #endif
@ -458,7 +458,7 @@ bool RenderablePolyVoxEntityItem::findDetailedRayIntersection(const glm::vec3& o
const glm::vec3& direction, const glm::vec3& direction,
bool& keepSearching, bool& keepSearching,
OctreeElement*& element, OctreeElement*& element,
float& distance, BoxFace& face, float& distance, BoxFace& face,
void** intersectedObject, void** intersectedObject,
bool precisionPicking) const bool precisionPicking) const
{ {

View file

@ -12,14 +12,14 @@
#ifndef hifi_ProgramObject_h #ifndef hifi_ProgramObject_h
#define hifi_ProgramObject_h #define hifi_ProgramObject_h
#ifdef __GNUC__ #if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdouble-promotion" #pragma GCC diagnostic ignored "-Wdouble-promotion"
#endif #endif
#include <QGLShaderProgram> #include <QGLShaderProgram>
#ifdef __GNUC__ #if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#endif #endif

View file

@ -28,7 +28,7 @@ using glm::vec3;
using glm::vec4; using glm::vec4;
using glm::quat; using glm::quat;
#ifdef __GNUC__ #if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdouble-promotion" #pragma GCC diagnostic ignored "-Wdouble-promotion"
#endif #endif
@ -37,7 +37,7 @@ using glm::quat;
#include <QtGui/QMatrix4x4> #include <QtGui/QMatrix4x4>
#include <QtGui/QColor> #include <QtGui/QColor>
#ifdef __GNUC__ #if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#endif #endif

View file

@ -18,14 +18,25 @@ Tooltip::Tooltip(QQuickItem* parent) : QQuickItem(parent) {
Tooltip::~Tooltip() { Tooltip::~Tooltip() {
} }
QString Tooltip::text() const { const QString& Tooltip::getTitle() const {
return _text; return _title;
} }
void Tooltip::setText(const QString& arg) { const QString& Tooltip::getDescription() const {
if (arg != _text) { return _description;
_text = arg; }
emit textChanged();
void Tooltip::setTitle(const QString& title) {
if (title != _title) {
_title = title;
emit titleChanged();
}
}
void Tooltip::setDescription(const QString& description) {
if (description != _description) {
_description = description;
emit descriptionChanged();
} }
} }
@ -33,11 +44,14 @@ void Tooltip::setVisible(bool visible) {
QQuickItem::setVisible(visible); QQuickItem::setVisible(visible);
} }
QString Tooltip::showTip(const QString& text) { QString Tooltip::showTip(const QString& title, const QString& description) {
const QString newTipId = QUuid().createUuid().toString(); const QString newTipId = QUuid().createUuid().toString();
qDebug() << "THE NEW TIP ID IS" << newTipId;
Tooltip::show([&](QQmlContext*, QObject* object) { Tooltip::show([&](QQmlContext*, QObject* object) {
object->setObjectName(newTipId); object->setObjectName(newTipId);
object->setProperty("text", text); object->setProperty("title", title);
object->setProperty("description", description);
}); });
return newTipId; return newTipId;
} }
@ -48,4 +62,4 @@ void Tooltip::closeTip(const QString& tipId) {
if (that) { if (that) {
that->deleteLater(); that->deleteLater();
} }
} }

View file

@ -20,26 +20,31 @@ class Tooltip : public QQuickItem
HIFI_QML_DECL HIFI_QML_DECL
private: private:
Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged) Q_PROPERTY(QString title READ getTitle WRITE setTitle NOTIFY titleChanged)
Q_PROPERTY(QString description READ getDescription WRITE setDescription NOTIFY descriptionChanged)
public: public:
Tooltip(QQuickItem* parent = 0); Tooltip(QQuickItem* parent = 0);
virtual ~Tooltip(); virtual ~Tooltip();
QString text() const; const QString& getTitle() const;
const QString& getDescription() const;
static QString showTip(const QString& text); static QString showTip(const QString& title, const QString& description);
static void closeTip(const QString& tipId); static void closeTip(const QString& tipId);
public slots: public slots:
virtual void setVisible(bool v); virtual void setVisible(bool v);
void setText(const QString& arg); void setTitle(const QString& title);
void setDescription(const QString& description);
signals: signals:
void textChanged(); void titleChanged();
void descriptionChanged();
private: private:
QString _text; QString _title;
QString _description;
}; };
#endif // hifi_Tooltip_h #endif // hifi_Tooltip_h