mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 04:44:11 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi into clockSkew_win_bug
This commit is contained in:
commit
85d007adfd
20 changed files with 1011 additions and 138 deletions
|
@ -12,18 +12,63 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
var numberOfButtons = 3;
|
||||
// misc global constants
|
||||
var NUMBER_OF_COLLISION_BUTTONS = 3;
|
||||
var NUMBER_OF_BUTTONS = 4;
|
||||
var DOWN = { x: 0.0, y: -1.0, z: 0.0 };
|
||||
var MAX_VOXEL_SCAN_DISTANCE = 30.0;
|
||||
|
||||
var enabledColors = new Array();
|
||||
enabledColors[0] = { red: 255, green: 0, blue: 0};
|
||||
enabledColors[1] = { red: 0, green: 255, blue: 0};
|
||||
enabledColors[2] = { red: 0, green: 0, blue: 255};
|
||||
// behavior transition thresholds
|
||||
var MIN_FLYING_SPEED = 3.0;
|
||||
var MIN_COLLISIONLESS_SPEED = 5.0;
|
||||
var MAX_WALKING_SPEED = 30.0;
|
||||
var MAX_COLLIDABLE_SPEED = 35.0;
|
||||
|
||||
var disabledColors = new Array();
|
||||
disabledColors[0] = { red: 90, green: 75, blue: 75};
|
||||
disabledColors[1] = { red: 75, green: 90, blue: 75};
|
||||
disabledColors[2] = { red: 75, green: 90, blue: 90};
|
||||
// button URL and geometry/UI tuning
|
||||
var BUTTON_IMAGE_URL = "http://highfidelity-public.s3-us-west-1.amazonaws.com/images/testing-swatches.svg";
|
||||
var DISABLED_OFFSET_Y = 12;
|
||||
var ENABLED_OFFSET_Y = 55 + 12;
|
||||
var UI_BUFFER = 1;
|
||||
var OFFSET_X = UI_BUFFER;
|
||||
var OFFSET_Y = 200;
|
||||
var BUTTON_WIDTH = 30;
|
||||
var BUTTON_HEIGHT = 30;
|
||||
var TEXT_OFFSET_X = OFFSET_X + BUTTON_WIDTH + UI_BUFFER;
|
||||
var TEXT_HEIGHT = BUTTON_HEIGHT;
|
||||
var TEXT_WIDTH = 210;
|
||||
|
||||
var MSEC_PER_SECOND = 1000;
|
||||
var RAYCAST_EXPIRY_PERIOD = MSEC_PER_SECOND / 16;
|
||||
var COLLISION_EXPIRY_PERIOD = 2 * MSEC_PER_SECOND;
|
||||
var GRAVITY_ON_EXPIRY_PERIOD = MSEC_PER_SECOND / 2;
|
||||
var GRAVITY_OFF_EXPIRY_PERIOD = MSEC_PER_SECOND / 8;
|
||||
|
||||
var dater = new Date();
|
||||
var raycastExpiry = dater.getTime() + RAYCAST_EXPIRY_PERIOD;
|
||||
var gravityOnExpiry = dater.getTime() + GRAVITY_ON_EXPIRY_PERIOD;
|
||||
var gravityOffExpiry = dater.getTime() + GRAVITY_OFF_EXPIRY_PERIOD;
|
||||
var collisionOnExpiry = dater.getTime() + COLLISION_EXPIRY_PERIOD;
|
||||
|
||||
// avatar state
|
||||
var velocity = { x: 0.0, y: 0.0, z: 0.0 };
|
||||
var standing = false;
|
||||
|
||||
// speedometer globals
|
||||
var speed = 0.0;
|
||||
var lastPosition = MyAvatar.position;
|
||||
var speedometer = Overlays.addOverlay("text", {
|
||||
x: OFFSET_X,
|
||||
y: OFFSET_Y - BUTTON_HEIGHT,
|
||||
width: BUTTON_WIDTH + UI_BUFFER + TEXT_WIDTH,
|
||||
height: TEXT_HEIGHT,
|
||||
color: { red: 0, green: 0, blue: 0 },
|
||||
textColor: { red: 255, green: 0, blue: 0},
|
||||
topMargin: 4,
|
||||
leftMargin: 4,
|
||||
text: "Speed: 0.0"
|
||||
});
|
||||
|
||||
// collision group buttons
|
||||
var buttons = new Array();
|
||||
var labels = new Array();
|
||||
|
||||
|
@ -31,40 +76,43 @@ var labelContents = new Array();
|
|||
labelContents[0] = "Collide with Avatars";
|
||||
labelContents[1] = "Collide with Voxels";
|
||||
labelContents[2] = "Collide with Particles";
|
||||
labelContents[3] = "Use local gravity";
|
||||
var groupBits = 0;
|
||||
|
||||
var enabledColors = new Array();
|
||||
enabledColors[0] = { red: 255, green: 0, blue: 0};
|
||||
enabledColors[1] = { red: 0, green: 255, blue: 0};
|
||||
enabledColors[2] = { red: 0, green: 0, blue: 255};
|
||||
enabledColors[3] = { red: 255, green: 255, blue: 0};
|
||||
|
||||
var disabledColors = new Array();
|
||||
disabledColors[0] = { red: 90, green: 75, blue: 75};
|
||||
disabledColors[1] = { red: 75, green: 90, blue: 75};
|
||||
disabledColors[2] = { red: 75, green: 75, blue: 90};
|
||||
disabledColors[3] = { red: 90, green: 90, blue: 75};
|
||||
|
||||
var buttonStates = new Array();
|
||||
|
||||
var disabledOffsetT = 0;
|
||||
var enabledOffsetT = 55;
|
||||
|
||||
var buttonX = 50;
|
||||
var buttonY = 200;
|
||||
var buttonWidth = 30;
|
||||
var buttonHeight = 54;
|
||||
var textX = buttonX + buttonWidth + 10;
|
||||
|
||||
for (i = 0; i < numberOfButtons; i++) {
|
||||
for (i = 0; i < NUMBER_OF_BUTTONS; i++) {
|
||||
var offsetS = 12
|
||||
var offsetT = disabledOffsetT;
|
||||
var offsetT = DISABLED_OFFSET_Y;
|
||||
|
||||
buttons[i] = Overlays.addOverlay("image", {
|
||||
//x: buttonX + (buttonWidth * i),
|
||||
x: buttonX,
|
||||
y: buttonY + (buttonHeight * i),
|
||||
width: buttonWidth,
|
||||
height: buttonHeight,
|
||||
subImage: { x: offsetS, y: offsetT, width: buttonWidth, height: buttonHeight },
|
||||
imageURL: "http://highfidelity-public.s3-us-west-1.amazonaws.com/images/testing-swatches.svg",
|
||||
x: OFFSET_X,
|
||||
y: OFFSET_Y + (BUTTON_HEIGHT * i),
|
||||
width: BUTTON_WIDTH,
|
||||
height: BUTTON_HEIGHT,
|
||||
subImage: { x: offsetS, y: offsetT, width: BUTTON_WIDTH, height: BUTTON_HEIGHT },
|
||||
imageURL: BUTTON_IMAGE_URL,
|
||||
color: disabledColors[i],
|
||||
alpha: 1,
|
||||
});
|
||||
|
||||
labels[i] = Overlays.addOverlay("text", {
|
||||
x: textX,
|
||||
y: buttonY + (buttonHeight * i) + 12,
|
||||
width: 150,
|
||||
height: 50,
|
||||
x: TEXT_OFFSET_X,
|
||||
y: OFFSET_Y + (BUTTON_HEIGHT * i),
|
||||
width: TEXT_WIDTH,
|
||||
height: TEXT_HEIGHT,
|
||||
color: { red: 0, green: 0, blue: 0},
|
||||
textColor: { red: 255, green: 0, blue: 0},
|
||||
topMargin: 4,
|
||||
|
@ -75,12 +123,14 @@ for (i = 0; i < numberOfButtons; i++) {
|
|||
buttonStates[i] = false;
|
||||
}
|
||||
|
||||
|
||||
// functions
|
||||
|
||||
function updateButton(i, enabled) {
|
||||
var offsetY = disabledOffsetT;
|
||||
var offsetY = DISABLED_OFFSET_Y;
|
||||
var buttonColor = disabledColors[i];
|
||||
groupBits
|
||||
if (enabled) {
|
||||
offsetY = enabledOffsetT;
|
||||
offsetY = ENABLED_OFFSET_Y;
|
||||
buttonColor = enabledColors[i];
|
||||
if (i == 0) {
|
||||
groupBits |= COLLISION_GROUP_AVATARS;
|
||||
|
@ -98,24 +148,46 @@ function updateButton(i, enabled) {
|
|||
groupBits &= ~COLLISION_GROUP_PARTICLES;
|
||||
}
|
||||
}
|
||||
MyAvatar.collisionGroups = groupBits;
|
||||
if (groupBits != MyAvatar.collisionGroups) {
|
||||
MyAvatar.collisionGroups = groupBits;
|
||||
}
|
||||
|
||||
Overlays.editOverlay(buttons[i], { subImage: { y: offsetY } } );
|
||||
Overlays.editOverlay(buttons[i], { color: buttonColor } );
|
||||
buttonStates[i] = enabled;
|
||||
}
|
||||
|
||||
|
||||
// When our script shuts down, we should clean up all of our overlays
|
||||
function scriptEnding() {
|
||||
for (i = 0; i < numberOfButtons; i++) {
|
||||
print("adebug deleting overlay " + i);
|
||||
for (i = 0; i < NUMBER_OF_BUTTONS; i++) {
|
||||
Overlays.deleteOverlay(buttons[i]);
|
||||
Overlays.deleteOverlay(labels[i]);
|
||||
}
|
||||
Overlays.deleteOverlay(speedometer);
|
||||
}
|
||||
Script.scriptEnding.connect(scriptEnding);
|
||||
|
||||
|
||||
function updateSpeedometerDisplay() {
|
||||
Overlays.editOverlay(speedometer, { text: "Speed: " + speed.toFixed(2) });
|
||||
}
|
||||
Script.setInterval(updateSpeedometerDisplay, 100);
|
||||
|
||||
function disableArtificialGravity() {
|
||||
MyAvatar.motionBehaviors = MyAvatar.motionBehaviors & ~AVATAR_MOTION_OBEY_LOCAL_GRAVITY;
|
||||
updateButton(3, false);
|
||||
}
|
||||
|
||||
function enableArtificialGravity() {
|
||||
// NOTE: setting the gravity automatically sets the AVATAR_MOTION_OBEY_LOCAL_GRAVITY behavior bit.
|
||||
MyAvatar.gravity = DOWN;
|
||||
updateButton(3, true);
|
||||
// also enable collisions with voxels
|
||||
groupBits |= COLLISION_GROUP_VOXELS;
|
||||
updateButton(1, groupBits & COLLISION_GROUP_VOXELS);
|
||||
}
|
||||
|
||||
// Our update() function is called at approximately 60fps, and we will use it to animate our various overlays
|
||||
function update(deltaTime) {
|
||||
if (groupBits != MyAvatar.collisionGroups) {
|
||||
|
@ -124,6 +196,83 @@ function update(deltaTime) {
|
|||
updateButton(1, groupBits & COLLISION_GROUP_VOXELS);
|
||||
updateButton(2, groupBits & COLLISION_GROUP_PARTICLES);
|
||||
}
|
||||
|
||||
// measure speed
|
||||
var distance = Vec3.distance(MyAvatar.position, lastPosition);
|
||||
speed = 0.8 * speed + 0.2 * distance / deltaTime;
|
||||
lastPosition = MyAvatar.position;
|
||||
|
||||
dater = new Date();
|
||||
var now = dater.getTime();
|
||||
|
||||
// transition gravity
|
||||
if (raycastExpiry < now) {
|
||||
// scan for landing platform
|
||||
ray = { origin: MyAvatar.position, direction: DOWN };
|
||||
var intersection = Voxels.findRayIntersection(ray);
|
||||
// NOTE: it is possible for intersection.intersects to be false when it should be true
|
||||
// (perhaps the raycast failed to lock the octree thread?). To workaround this problem
|
||||
// we only transition on repeated failures.
|
||||
|
||||
if (intersection.intersects) {
|
||||
// compute distance to voxel
|
||||
var v = intersection.voxel;
|
||||
var maxCorner = Vec3.sum({ x: v.x, y: v.y, z: v.z }, {x: v.s, y: v.s, z: v.s });
|
||||
var distance = lastPosition.y - maxCorner.y;
|
||||
|
||||
if (distance < MAX_VOXEL_SCAN_DISTANCE) {
|
||||
if (speed < MIN_FLYING_SPEED &&
|
||||
gravityOnExpiry < now &&
|
||||
!(MyAvatar.motionBehaviors & AVATAR_MOTION_OBEY_LOCAL_GRAVITY)) {
|
||||
enableArtificialGravity();
|
||||
}
|
||||
if (speed < MAX_WALKING_SPEED) {
|
||||
gravityOffExpiry = now + GRAVITY_OFF_EXPIRY_PERIOD;
|
||||
} else if (gravityOffExpiry < now && MyAvatar.motionBehaviors & AVATAR_MOTION_OBEY_LOCAL_GRAVITY) {
|
||||
disableArtificialGravity();
|
||||
}
|
||||
} else {
|
||||
// distance too far
|
||||
if (gravityOffExpiry < now && MyAvatar.motionBehaviors & AVATAR_MOTION_OBEY_LOCAL_GRAVITY) {
|
||||
disableArtificialGravity();
|
||||
}
|
||||
gravityOnExpiry = now + GRAVITY_ON_EXPIRY_PERIOD;
|
||||
}
|
||||
} else {
|
||||
// no intersection
|
||||
if (gravityOffExpiry < now && MyAvatar.motionBehaviors & AVATAR_MOTION_OBEY_LOCAL_GRAVITY) {
|
||||
disableArtificialGravity();
|
||||
}
|
||||
gravityOnExpiry = now + GRAVITY_ON_EXPIRY_PERIOD;
|
||||
}
|
||||
}
|
||||
if (speed > MAX_WALKING_SPEED && gravityOffExpiry < now) {
|
||||
if (MyAvatar.motionBehaviors & AVATAR_MOTION_OBEY_LOCAL_GRAVITY) {
|
||||
// turn off gravity
|
||||
MyAvatar.motionBehaviors = MyAvatar.motionBehaviors & ~AVATAR_MOTION_OBEY_LOCAL_GRAVITY;
|
||||
updateButton(3, false);
|
||||
}
|
||||
gravityOnExpiry = now + GRAVITY_ON_EXPIRY_PERIOD;
|
||||
}
|
||||
|
||||
// transition collidability with voxels
|
||||
if (speed < MIN_COLLISIONLESS_SPEED) {
|
||||
if (collisionOnExpiry < now && !(MyAvatar.collisionGroups & COLLISION_GROUP_VOXELS)) {
|
||||
// TODO: check to make sure not already colliding
|
||||
// enable collision with voxels
|
||||
groupBits |= COLLISION_GROUP_VOXELS;
|
||||
updateButton(1, groupBits & COLLISION_GROUP_VOXELS);
|
||||
}
|
||||
} else {
|
||||
collisionOnExpiry = now + COLLISION_EXPIRY_PERIOD;
|
||||
}
|
||||
if (speed > MAX_COLLIDABLE_SPEED) {
|
||||
if (MyAvatar.collisionGroups & COLLISION_GROUP_VOXELS) {
|
||||
// disable collisions with voxels
|
||||
groupBits &= ~COLLISION_GROUP_VOXELS;
|
||||
updateButton(1, groupBits & COLLISION_GROUP_VOXELS);
|
||||
}
|
||||
}
|
||||
}
|
||||
Script.update.connect(update);
|
||||
|
||||
|
@ -131,7 +280,7 @@ Script.update.connect(update);
|
|||
// we also handle click detection in our mousePressEvent()
|
||||
function mousePressEvent(event) {
|
||||
var clickedOverlay = Overlays.getOverlayAtPoint({x: event.x, y: event.y});
|
||||
for (i = 0; i < numberOfButtons; i++) {
|
||||
for (i = 0; i < NUMBER_OF_COLLISION_BUTTONS; i++) {
|
||||
if (clickedOverlay == buttons[i]) {
|
||||
var enabled = !(buttonStates[i]);
|
||||
updateButton(i, enabled);
|
||||
|
|
58
interface/resources/images/hifi-logo.svg
Normal file
58
interface/resources/images/hifi-logo.svg
Normal file
|
@ -0,0 +1,58 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 17.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 55.5 55.5" enable-background="new 0 0 55.5 55.5" xml:space="preserve">
|
||||
<g>
|
||||
<g>
|
||||
<path fill="#0E7077" d="M47.4,8.1C42.1,2.9,35.2,0,27.8,0C20.3,0,13.4,2.9,8.1,8.1C2.9,13.4,0,20.3,0,27.8
|
||||
c0,7.4,2.9,14.4,8.1,19.6c5.2,5.2,12.2,8.1,19.6,8.1c7.4,0,14.4-2.9,19.6-8.1c5.2-5.2,8.1-12.2,8.1-19.6
|
||||
C55.5,20.3,52.6,13.4,47.4,8.1z M45.4,45.4c-4.7,4.7-11,7.3-17.7,7.3c-6.7,0-12.9-2.6-17.7-7.3c-4.7-4.7-7.3-11-7.3-17.7
|
||||
c0-6.7,2.6-12.9,7.3-17.7c4.7-4.7,11-7.3,17.7-7.3c6.7,0,12.9,2.6,17.7,7.3c4.7,4.7,7.3,11,7.3,17.7
|
||||
C52.7,34.4,50.1,40.7,45.4,45.4z"/>
|
||||
<g>
|
||||
<path fill="#0E7077" d="M20.3,37.6c-0.6,0-1.2-0.5-1.2-1.2V15c0-0.6,0.5-1.2,1.2-1.2c0.6,0,1.2,0.5,1.2,1.2v21.5
|
||||
C21.5,37.1,21,37.6,20.3,37.6z"/>
|
||||
<path fill="#0E7077" d="M21.7,14.4c-0.8,0.8-2,0.8-2.7,0c-0.8-0.8-0.8-2,0-2.7c0.8-0.8,2-0.8,2.7,0
|
||||
C22.5,12.5,22.5,13.7,21.7,14.4"/>
|
||||
<g>
|
||||
<path fill="#0E7077" d="M20.3,16.2c-0.8,0-1.6-0.3-2.2-0.9c-1.2-1.2-1.2-3.2,0-4.4c0.6-0.6,1.4-0.9,2.2-0.9
|
||||
c0.8,0,1.6,0.3,2.2,0.9c0.6,0.6,0.9,1.4,0.9,2.2c0,0.8-0.3,1.6-0.9,2.2C21.9,15.8,21.2,16.2,20.3,16.2z M20.3,12.3
|
||||
c-0.2,0-0.4,0.1-0.6,0.2c-0.3,0.3-0.3,0.8,0,1.1c0.3,0.3,0.8,0.3,1.1,0c0.1-0.1,0.2-0.3,0.2-0.6c0-0.2-0.1-0.4-0.2-0.6
|
||||
C20.7,12.4,20.5,12.3,20.3,12.3z"/>
|
||||
</g>
|
||||
<path fill="#0E7077" d="M19,37c0.8-0.8,2-0.8,2.7,0c0.8,0.8,0.8,2,0,2.7c-0.8,0.8-2,0.8-2.7,0C18.2,39,18.2,37.8,19,37"/>
|
||||
<g>
|
||||
<path fill="#0E7077" d="M20.3,41.5c-0.8,0-1.6-0.3-2.2-0.9c-0.6-0.6-0.9-1.4-0.9-2.2c0-0.8,0.3-1.6,0.9-2.2
|
||||
c0.6-0.6,1.4-0.9,2.2-0.9c0.8,0,1.6,0.3,2.2,0.9c0.6,0.6,0.9,1.4,0.9,2.2c0,0.8-0.3,1.6-0.9,2.2C21.9,41.2,21.2,41.5,20.3,41.5z
|
||||
M20.3,37.6c-0.2,0-0.4,0.1-0.6,0.2c-0.1,0.1-0.2,0.3-0.2,0.6c0,0.2,0.1,0.4,0.2,0.6c0.3,0.3,0.8,0.3,1.1,0
|
||||
c0.1-0.1,0.2-0.3,0.2-0.6c0-0.2-0.1-0.4-0.2-0.6C20.7,37.7,20.5,37.6,20.3,37.6z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#0E7077" d="M35.2,41.7c-0.6,0-1.2-0.5-1.2-1.2V19c0-0.6,0.5-1.2,1.2-1.2c0.6,0,1.2,0.5,1.2,1.2v21.5
|
||||
C36.4,41.2,35.8,41.7,35.2,41.7z"/>
|
||||
</g>
|
||||
<path fill="#0E7077" d="M36.6,18.5c-0.8,0.8-2,0.8-2.7,0c-0.8-0.8-0.8-2,0-2.7c0.8-0.8,2-0.8,2.7,0
|
||||
C37.3,16.5,37.3,17.7,36.6,18.5"/>
|
||||
<g>
|
||||
<path fill="#0E7077" d="M35.2,20.2c-0.8,0-1.6-0.3-2.2-0.9c-1.2-1.2-1.2-3.2,0-4.4c0.6-0.6,1.4-0.9,2.2-0.9
|
||||
c0.8,0,1.6,0.3,2.2,0.9c0.6,0.6,0.9,1.4,0.9,2.2c0,0.8-0.3,1.6-0.9,2.2C36.8,19.9,36,20.2,35.2,20.2z M35.2,16.3
|
||||
c-0.2,0-0.4,0.1-0.6,0.2c-0.3,0.3-0.3,0.8,0,1.1c0.3,0.3,0.8,0.3,1.1,0c0.1-0.1,0.2-0.3,0.2-0.6c0-0.2-0.1-0.4-0.2-0.6
|
||||
C35.6,16.4,35.4,16.3,35.2,16.3z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#0E7077" d="M35.2,45.6c-0.8,0-1.6-0.3-2.2-0.9c-1.2-1.2-1.2-3.2,0-4.4c0.6-0.6,1.4-0.9,2.2-0.9
|
||||
c0.8,0,1.6,0.3,2.2,0.9c0.6,0.6,0.9,1.4,0.9,2.2c0,0.8-0.3,1.6-0.9,2.2C36.8,45.2,36,45.6,35.2,45.6z M35.2,41.7
|
||||
c-0.2,0-0.4,0.1-0.6,0.2c-0.3,0.3-0.3,0.8,0,1.1c0.3,0.3,0.8,0.3,1.1,0c0.1-0.1,0.2-0.3,0.2-0.6s-0.1-0.4-0.2-0.6
|
||||
C35.6,41.8,35.4,41.7,35.2,41.7z"/>
|
||||
</g>
|
||||
<path fill="#0E7077" d="M33.8,41.1c0.8-0.8,2-0.8,2.7,0c0.8,0.8,0.8,2,0,2.7c-0.8,0.8-2,0.8-2.7,0C33.1,43.1,33.1,41.8,33.8,41.1
|
||||
"/>
|
||||
<g>
|
||||
|
||||
<rect x="19.6" y="26.2" transform="matrix(0.9064 0.4224 -0.4224 0.9064 14.1626 -9.1647)" fill="#0E7077" width="16.4" height="2.3"/>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 3.6 KiB |
17
interface/resources/images/login.svg
Normal file
17
interface/resources/images/login.svg
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 17.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 23.6 22.3" enable-background="new 0 0 23.6 22.3" xml:space="preserve">
|
||||
<g>
|
||||
<g id="Your_Icon_8_">
|
||||
<g>
|
||||
<polygon fill="#E7EEEE" points="6.8,7.8 0,7.8 0,14.1 6.8,14.1 6.8,19 14.4,11 6.8,3.1 "/>
|
||||
<polygon fill="#E7EEEE" points="12.9,3.1 14.3,3.1 14.3,1.4 12.9,1.4 12.9,1.4 11.2,1.4 11.2,6.5 12.9,8.2 "/>
|
||||
<polygon fill="#E7EEEE" points="12.9,13.7 11.2,15.5 11.2,20.7 14.3,20.7 14.3,19.1 12.9,19.1 "/>
|
||||
<path fill="#E7EEEE" d="M15,0v22.3l8.5-2.4V2.4L15,0z M17.8,12.2h-0.3c-0.4,0-0.7-0.4-0.8-0.9h-0.3v-0.7h0.3
|
||||
c0.1-0.5,0.4-0.9,0.8-0.9h0.3c0.5,0,0.8,0.5,0.8,1.2C18.7,11.6,18.3,12.2,17.8,12.2z"/>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1 KiB |
|
@ -33,6 +33,7 @@ QPushButton#searchButton {
|
|||
}
|
||||
|
||||
QPushButton#revealLogButton {
|
||||
font-family: Helvetica, Arial, sans-serif;
|
||||
background: url(styles/txt-file.svg);
|
||||
background-repeat: none;
|
||||
background-position: left center;
|
||||
|
@ -50,9 +51,9 @@ QCheckBox {
|
|||
}
|
||||
|
||||
QCheckBox::indicator:unchecked {
|
||||
image: url(:/styles/unchecked.svg);
|
||||
image: url(styles/unchecked.svg);
|
||||
}
|
||||
|
||||
QCheckBox::indicator:checked {
|
||||
image: url(:/styles/checked.svg);
|
||||
image: url(styles/checked.svg);
|
||||
}
|
|
@ -316,6 +316,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
|||
Particle::setVoxelEditPacketSender(&_voxelEditSender);
|
||||
Particle::setParticleEditPacketSender(&_particleEditSender);
|
||||
|
||||
// when -url in command line, teleport to location
|
||||
urlGoTo(argc, constArgv);
|
||||
|
||||
// For now we're going to set the PPS for outbound packets to be super high, this is
|
||||
// probably not the right long term solution. But for now, we're going to do this to
|
||||
// allow you to move a particle around in your hand
|
||||
|
@ -352,8 +355,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
|||
QMutexLocker locker(&_settingsMutex);
|
||||
_previousScriptLocation = _settings->value("LastScriptLocation", QVariant("")).toString();
|
||||
}
|
||||
//When -url in command line, teleport to location
|
||||
urlGoTo(argc, constArgv);
|
||||
}
|
||||
|
||||
Application::~Application() {
|
||||
|
@ -857,7 +858,7 @@ void Application::keyPressEvent(QKeyEvent* event) {
|
|||
|
||||
case Qt::Key_G:
|
||||
if (isShifted) {
|
||||
Menu::getInstance()->triggerOption(MenuOption::ObeyGravity);
|
||||
Menu::getInstance()->triggerOption(MenuOption::ObeyEnvironmentalGravity);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -3576,34 +3577,33 @@ void Application::takeSnapshot() {
|
|||
void Application::urlGoTo(int argc, const char * constArgv[]) {
|
||||
//Gets the url (hifi://domain/destination/orientation)
|
||||
QString customUrl = getCmdOption(argc, constArgv, "-url");
|
||||
|
||||
if (customUrl.startsWith("hifi://")) {
|
||||
if(customUrl.startsWith(CUSTOM_URL_SCHEME + "//")) {
|
||||
QStringList urlParts = customUrl.remove(0, CUSTOM_URL_SCHEME.length() + 2).split('/', QString::SkipEmptyParts);
|
||||
if (urlParts.count() > 1) {
|
||||
if (urlParts.count() == 1) {
|
||||
// location coordinates or place name
|
||||
QString domain = urlParts[0];
|
||||
Menu::goToDomain(domain);
|
||||
} else if (urlParts.count() > 1) {
|
||||
// if url has 2 or more parts, the first one is domain name
|
||||
QString domain = urlParts[0];
|
||||
|
||||
|
||||
// second part is either a destination coordinate or
|
||||
// a place name
|
||||
QString destination = urlParts[1];
|
||||
|
||||
|
||||
// any third part is an avatar orientation.
|
||||
QString orientation = urlParts.count() > 2 ? urlParts[2] : QString();
|
||||
|
||||
|
||||
Menu::goToDomain(domain);
|
||||
|
||||
|
||||
// goto either @user, #place, or x-xx,y-yy,z-zz
|
||||
// style co-ordinate.
|
||||
Menu::goTo(destination);
|
||||
|
||||
|
||||
if (!orientation.isEmpty()) {
|
||||
// location orientation
|
||||
Menu::goToOrientation(orientation);
|
||||
}
|
||||
} else if (urlParts.count() == 1) {
|
||||
// location coordinates or place name
|
||||
QString destination = urlParts[0];
|
||||
Menu::goTo(destination);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "ui/InfoView.h"
|
||||
#include "ui/MetavoxelEditor.h"
|
||||
#include "ui/ModelsBrowser.h"
|
||||
#include "ui/LoginDialog.h"
|
||||
|
||||
|
||||
Menu* Menu::_instance = NULL;
|
||||
|
@ -188,8 +189,8 @@ Menu::Menu() :
|
|||
|
||||
addDisabledActionAndSeparator(editMenu, "Physics");
|
||||
QObject* avatar = appInstance->getAvatar();
|
||||
addCheckableActionToQMenuAndActionHash(editMenu, MenuOption::ObeyGravity, Qt::SHIFT | Qt::Key_G, true,
|
||||
avatar, SLOT(updateMotionBehaviorFlags()));
|
||||
addCheckableActionToQMenuAndActionHash(editMenu, MenuOption::ObeyEnvironmentalGravity, Qt::SHIFT | Qt::Key_G, true,
|
||||
avatar, SLOT(updateMotionBehaviors()));
|
||||
|
||||
|
||||
addAvatarCollisionSubMenu(editMenu);
|
||||
|
@ -817,38 +818,9 @@ const int QLINE_MINIMUM_WIDTH = 400;
|
|||
const float DIALOG_RATIO_OF_WINDOW = 0.30f;
|
||||
|
||||
void Menu::loginForCurrentDomain() {
|
||||
QDialog loginDialog(Application::getInstance()->getWindow());
|
||||
loginDialog.setWindowTitle("Login");
|
||||
|
||||
QBoxLayout* layout = new QBoxLayout(QBoxLayout::TopToBottom);
|
||||
loginDialog.setLayout(layout);
|
||||
loginDialog.setWindowFlags(Qt::Sheet);
|
||||
|
||||
QFormLayout* form = new QFormLayout();
|
||||
layout->addLayout(form, 1);
|
||||
|
||||
QLineEdit* loginLineEdit = new QLineEdit();
|
||||
loginLineEdit->setMinimumWidth(QLINE_MINIMUM_WIDTH);
|
||||
form->addRow("Login:", loginLineEdit);
|
||||
|
||||
QLineEdit* passwordLineEdit = new QLineEdit();
|
||||
passwordLineEdit->setMinimumWidth(QLINE_MINIMUM_WIDTH);
|
||||
passwordLineEdit->setEchoMode(QLineEdit::Password);
|
||||
form->addRow("Password:", passwordLineEdit);
|
||||
|
||||
QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||
loginDialog.connect(buttons, SIGNAL(accepted()), SLOT(accept()));
|
||||
loginDialog.connect(buttons, SIGNAL(rejected()), SLOT(reject()));
|
||||
layout->addWidget(buttons);
|
||||
|
||||
int dialogReturn = loginDialog.exec();
|
||||
|
||||
if (dialogReturn == QDialog::Accepted && !loginLineEdit->text().isEmpty() && !passwordLineEdit->text().isEmpty()) {
|
||||
// attempt to get an access token given this username and password
|
||||
AccountManager::getInstance().requestAccessToken(loginLineEdit->text(), passwordLineEdit->text());
|
||||
}
|
||||
|
||||
sendFakeEnterEvent();
|
||||
LoginDialog* loginDialog = new LoginDialog(Application::getInstance()->getWindow());
|
||||
loginDialog->show();
|
||||
loginDialog->resizeAndPosition(false);
|
||||
}
|
||||
|
||||
void Menu::editPreferences() {
|
||||
|
@ -931,7 +903,12 @@ void Menu::goTo() {
|
|||
if (desiredDestination.startsWith(CUSTOM_URL_SCHEME + "//")) {
|
||||
QStringList urlParts = desiredDestination.remove(0, CUSTOM_URL_SCHEME.length() + 2).split('/', QString::SkipEmptyParts);
|
||||
|
||||
if (urlParts.count() > 1) {
|
||||
if (urlParts.count() == 1) {
|
||||
// location coordinates or place name
|
||||
QString domain = urlParts[0];
|
||||
goToDomain(domain);
|
||||
}
|
||||
else if (urlParts.count() > 1) {
|
||||
// if url has 2 or more parts, the first one is domain name
|
||||
QString domain = urlParts[0];
|
||||
|
||||
|
@ -952,12 +929,7 @@ void Menu::goTo() {
|
|||
// location orientation
|
||||
goToOrientation(orientation);
|
||||
}
|
||||
} else if (urlParts.count() == 1) {
|
||||
// location coordinates or place name
|
||||
QString destination = urlParts[0];
|
||||
goTo(destination);
|
||||
}
|
||||
|
||||
} else {
|
||||
goToUser(gotoDialog.textValue());
|
||||
}
|
||||
|
|
|
@ -315,7 +315,7 @@ namespace MenuOption {
|
|||
const QString GoTo = "Go To...";
|
||||
const QString GoToDomain = "Go To Domain...";
|
||||
const QString GoToLocation = "Go To Location...";
|
||||
const QString ObeyGravity = "Obey Gravity";
|
||||
const QString ObeyEnvironmentalGravity = "Obey Environmental Gravity";
|
||||
const QString HandsCollideWithSelf = "Collide With Self";
|
||||
const QString HeadMouse = "Head Mouse";
|
||||
const QString IncreaseAvatarSize = "Increase Avatar Size";
|
||||
|
|
|
@ -125,10 +125,8 @@ void MyAvatar::update(float deltaTime) {
|
|||
head->setAudioLoudness(audio->getLastInputLoudness());
|
||||
head->setAudioAverageLoudness(audio->getAudioAverageInputLoudness());
|
||||
|
||||
if (_motionBehaviors & AVATAR_MOTION_OBEY_GRAVITY) {
|
||||
if (_motionBehaviors & AVATAR_MOTION_OBEY_ENVIRONMENTAL_GRAVITY) {
|
||||
setGravity(Application::getInstance()->getEnvironment()->getGravity(getPosition()));
|
||||
} else {
|
||||
setGravity(glm::vec3(0.0f, 0.0f, 0.0f));
|
||||
}
|
||||
|
||||
simulate(deltaTime);
|
||||
|
@ -463,6 +461,27 @@ void MyAvatar::renderHeadMouse() const {
|
|||
*/
|
||||
}
|
||||
|
||||
void MyAvatar::setLocalGravity(glm::vec3 gravity) {
|
||||
_motionBehaviors |= AVATAR_MOTION_OBEY_LOCAL_GRAVITY;
|
||||
// Environmental and Local gravities are incompatible. Since Local is being set here
|
||||
// the environmental setting must be removed.
|
||||
_motionBehaviors &= ~AVATAR_MOTION_OBEY_ENVIRONMENTAL_GRAVITY;
|
||||
setGravity(gravity);
|
||||
}
|
||||
|
||||
void MyAvatar::setGravity(const glm::vec3& gravity) {
|
||||
_gravity = gravity;
|
||||
getHead()->setGravity(_gravity);
|
||||
|
||||
// use the gravity to determine the new world up direction, if possible
|
||||
float gravityLength = glm::length(gravity);
|
||||
if (gravityLength > EPSILON) {
|
||||
_worldUpDirection = _gravity / -gravityLength;
|
||||
} else {
|
||||
_worldUpDirection = DEFAULT_UP_DIRECTION;
|
||||
}
|
||||
}
|
||||
|
||||
void MyAvatar::saveData(QSettings* settings) {
|
||||
settings->beginGroup("Avatar");
|
||||
|
||||
|
@ -1046,19 +1065,6 @@ void MyAvatar::maybeUpdateBillboard() {
|
|||
sendBillboardPacket();
|
||||
}
|
||||
|
||||
void MyAvatar::setGravity(glm::vec3 gravity) {
|
||||
_gravity = gravity;
|
||||
getHead()->setGravity(_gravity);
|
||||
|
||||
// use the gravity to determine the new world up direction, if possible
|
||||
float gravityLength = glm::length(gravity);
|
||||
if (gravityLength > EPSILON) {
|
||||
_worldUpDirection = _gravity / -gravityLength;
|
||||
} else {
|
||||
_worldUpDirection = DEFAULT_UP_DIRECTION;
|
||||
}
|
||||
}
|
||||
|
||||
void MyAvatar::goHome() {
|
||||
qDebug("Going Home!");
|
||||
setPosition(START_LOCATION);
|
||||
|
@ -1147,8 +1153,13 @@ void MyAvatar::goToLocationFromResponse(const QJsonObject& jsonObject) {
|
|||
|
||||
void MyAvatar::updateMotionBehaviors() {
|
||||
_motionBehaviors = 0;
|
||||
if (Menu::getInstance()->isOptionChecked(MenuOption::ObeyGravity)) {
|
||||
_motionBehaviors |= AVATAR_MOTION_OBEY_GRAVITY;
|
||||
if (Menu::getInstance()->isOptionChecked(MenuOption::ObeyEnvironmentalGravity)) {
|
||||
_motionBehaviors |= AVATAR_MOTION_OBEY_ENVIRONMENTAL_GRAVITY;
|
||||
// Environmental and Local gravities are incompatible. Environmental setting trumps local.
|
||||
_motionBehaviors &= ~AVATAR_MOTION_OBEY_LOCAL_GRAVITY;
|
||||
}
|
||||
if (! (_motionBehaviors & (AVATAR_MOTION_OBEY_ENVIRONMENTAL_GRAVITY | AVATAR_MOTION_OBEY_LOCAL_GRAVITY))) {
|
||||
setGravity(glm::vec3(0.0f));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1164,7 +1175,14 @@ void MyAvatar::setCollisionGroups(quint32 collisionGroups) {
|
|||
void MyAvatar::setMotionBehaviors(quint32 flags) {
|
||||
_motionBehaviors = flags;
|
||||
Menu* menu = Menu::getInstance();
|
||||
menu->setIsOptionChecked(MenuOption::ObeyGravity, (bool)(_motionBehaviors & AVATAR_MOTION_OBEY_GRAVITY));
|
||||
menu->setIsOptionChecked(MenuOption::ObeyEnvironmentalGravity, (bool)(_motionBehaviors & AVATAR_MOTION_OBEY_ENVIRONMENTAL_GRAVITY));
|
||||
// Environmental and Local gravities are incompatible. Environmental setting trumps local.
|
||||
if (_motionBehaviors & AVATAR_MOTION_OBEY_ENVIRONMENTAL_GRAVITY) {
|
||||
_motionBehaviors &= ~AVATAR_MOTION_OBEY_LOCAL_GRAVITY;
|
||||
setGravity(Application::getInstance()->getEnvironment()->getGravity(getPosition()));
|
||||
} else if (! (_motionBehaviors & (AVATAR_MOTION_OBEY_ENVIRONMENTAL_GRAVITY | AVATAR_MOTION_OBEY_LOCAL_GRAVITY))) {
|
||||
setGravity(glm::vec3(0.0f));
|
||||
}
|
||||
}
|
||||
|
||||
void MyAvatar::applyCollision(const glm::vec3& contactPoint, const glm::vec3& penetration) {
|
||||
|
|
|
@ -25,12 +25,11 @@ enum AvatarHandState
|
|||
NUM_HAND_STATES
|
||||
};
|
||||
|
||||
const quint32 AVATAR_MOTION_OBEY_GRAVITY = 1U << 0;
|
||||
|
||||
class MyAvatar : public Avatar {
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool shouldRenderLocally READ getShouldRenderLocally WRITE setShouldRenderLocally)
|
||||
Q_PROPERTY(quint32 motionBehaviors READ getMotionBehaviors WRITE setMotionBehaviors)
|
||||
Q_PROPERTY(glm::vec3 gravity READ getGravity WRITE setLocalGravity)
|
||||
|
||||
public:
|
||||
MyAvatar();
|
||||
|
@ -52,8 +51,7 @@ public:
|
|||
void setMousePressed(bool mousePressed) { _mousePressed = mousePressed; }
|
||||
void setVelocity(const glm::vec3 velocity) { _velocity = velocity; }
|
||||
void setLeanScale(float scale) { _leanScale = scale; }
|
||||
void setGravity(glm::vec3 gravity);
|
||||
void setMoveTarget(const glm::vec3 moveTarget);
|
||||
void setLocalGravity(glm::vec3 gravity);
|
||||
void setShouldRenderLocally(bool shouldRender) { _shouldRender = shouldRender; }
|
||||
|
||||
// getters
|
||||
|
@ -123,6 +121,7 @@ private:
|
|||
bool _shouldJump;
|
||||
float _driveKeys[MAX_DRIVE_KEYS];
|
||||
glm::vec3 _gravity;
|
||||
glm::vec3 _environmentGravity;
|
||||
float _distanceToNearestAvatar; // How close is the nearest avatar?
|
||||
|
||||
// motion stuff
|
||||
|
@ -151,6 +150,7 @@ private:
|
|||
void updateCollisionSound(const glm::vec3& penetration, float deltaTime, float frequency);
|
||||
void updateChatCircle(float deltaTime);
|
||||
void maybeUpdateBillboard();
|
||||
void setGravity(const glm::vec3& gravity);
|
||||
};
|
||||
|
||||
#endif // hifi_MyAvatar_h
|
||||
|
|
|
@ -19,7 +19,8 @@ FramelessDialog::FramelessDialog(QWidget *parent, Qt::WindowFlags flags, Positio
|
|||
_isResizing(false),
|
||||
_resizeInitialWidth(0),
|
||||
_selfHidden(false),
|
||||
_position(position) {
|
||||
_position(position),
|
||||
_hideOnBlur(true) {
|
||||
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
|
@ -43,7 +44,7 @@ bool FramelessDialog::eventFilter(QObject* sender, QEvent* event) {
|
|||
}
|
||||
break;
|
||||
case QEvent::WindowStateChange:
|
||||
if (parentWidget()->isMinimized()) {
|
||||
if (_hideOnBlur && parentWidget()->isMinimized()) {
|
||||
if (isVisible()) {
|
||||
_selfHidden = true;
|
||||
setHidden(true);
|
||||
|
@ -55,7 +56,7 @@ bool FramelessDialog::eventFilter(QObject* sender, QEvent* event) {
|
|||
break;
|
||||
case QEvent::ApplicationDeactivate:
|
||||
// hide on minimize and focus lost
|
||||
if (isVisible()) {
|
||||
if (_hideOnBlur && isVisible()) {
|
||||
_selfHidden = true;
|
||||
setHidden(true);
|
||||
}
|
||||
|
@ -84,18 +85,23 @@ void FramelessDialog::setStyleSheetFile(const QString& fileName) {
|
|||
|
||||
void FramelessDialog::showEvent(QShowEvent* event) {
|
||||
resizeAndPosition();
|
||||
QDialog::showEvent(event);
|
||||
}
|
||||
|
||||
void FramelessDialog::resizeAndPosition(bool resizeParent) {
|
||||
// keep full app height
|
||||
setFixedHeight(parentWidget()->size().height());
|
||||
// keep full app height or width depending on position
|
||||
if (_position == POSITION_LEFT || _position == POSITION_RIGHT) {
|
||||
setFixedHeight(parentWidget()->size().height());
|
||||
} else {
|
||||
setFixedWidth(parentWidget()->size().width());
|
||||
}
|
||||
|
||||
// resize parrent if width is smaller than this dialog
|
||||
if (resizeParent && parentWidget()->size().width() < size().width()) {
|
||||
parentWidget()->resize(size().width(), parentWidget()->size().height());
|
||||
}
|
||||
|
||||
if (_position == POSITION_LEFT) {
|
||||
if (_position == POSITION_LEFT || _position == POSITION_TOP) {
|
||||
// move to upper left corner
|
||||
move(parentWidget()->geometry().topLeft());
|
||||
} else if (_position == POSITION_RIGHT) {
|
||||
|
@ -104,16 +110,26 @@ void FramelessDialog::resizeAndPosition(bool resizeParent) {
|
|||
pos.setX(pos.x() - size().width());
|
||||
move(pos);
|
||||
}
|
||||
repaint();
|
||||
}
|
||||
|
||||
void FramelessDialog::mousePressEvent(QMouseEvent* mouseEvent) {
|
||||
if (mouseEvent->button() == Qt::LeftButton) {
|
||||
bool hitLeft = _position == POSITION_LEFT && abs(mouseEvent->pos().x() - size().width()) < RESIZE_HANDLE_WIDTH;
|
||||
bool hitRight = _position == POSITION_RIGHT && mouseEvent->pos().x() < RESIZE_HANDLE_WIDTH;
|
||||
if (hitLeft || hitRight) {
|
||||
_isResizing = true;
|
||||
_resizeInitialWidth = size().width();
|
||||
QApplication::setOverrideCursor(Qt::SizeHorCursor);
|
||||
if (_position == POSITION_LEFT || _position == POSITION_RIGHT) {
|
||||
bool hitLeft = (_position == POSITION_LEFT) && (abs(mouseEvent->pos().x() - size().width()) < RESIZE_HANDLE_WIDTH);
|
||||
bool hitRight = (_position == POSITION_RIGHT) && (mouseEvent->pos().x() < RESIZE_HANDLE_WIDTH);
|
||||
if (hitLeft || hitRight) {
|
||||
_isResizing = true;
|
||||
_resizeInitialWidth = size().width();
|
||||
QApplication::setOverrideCursor(Qt::SizeHorCursor);
|
||||
}
|
||||
} else {
|
||||
bool hitTop = (_position == POSITION_TOP) && (abs(mouseEvent->pos().y() - size().height()) < RESIZE_HANDLE_WIDTH);
|
||||
if (hitTop) {
|
||||
_isResizing = true;
|
||||
_resizeInitialWidth = size().height();
|
||||
QApplication::setOverrideCursor(Qt::SizeHorCursor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -133,6 +149,8 @@ void FramelessDialog::mouseMoveEvent(QMouseEvent* mouseEvent) {
|
|||
resizeAndPosition();
|
||||
_resizeInitialWidth = size().width();
|
||||
setUpdatesEnabled(true);
|
||||
} else if (_position == POSITION_TOP) {
|
||||
resize(size().width(), mouseEvent->pos().y());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,12 +17,15 @@
|
|||
|
||||
class FramelessDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum Position { POSITION_LEFT, POSITION_RIGHT };
|
||||
|
||||
FramelessDialog(QWidget* parent = 0, Qt::WindowFlags flags = 0, Position position = POSITION_LEFT);
|
||||
public:
|
||||
enum Position { POSITION_LEFT, POSITION_RIGHT, POSITION_TOP };
|
||||
|
||||
FramelessDialog(QWidget* parent, Qt::WindowFlags flags = 0, Position position = POSITION_LEFT);
|
||||
void setStyleSheetFile(const QString& fileName);
|
||||
void setHideOnBlur(bool hideOnBlur) { _hideOnBlur = hideOnBlur; };
|
||||
bool getHideOnBlur() { return _hideOnBlur; };
|
||||
void resizeAndPosition(bool resizeParent = true);
|
||||
|
||||
protected:
|
||||
virtual void mouseMoveEvent(QMouseEvent* mouseEvent);
|
||||
|
@ -33,12 +36,11 @@ protected:
|
|||
bool eventFilter(QObject* sender, QEvent* event);
|
||||
|
||||
private:
|
||||
void resizeAndPosition(bool resizeParent = true);
|
||||
|
||||
bool _isResizing;
|
||||
int _resizeInitialWidth;
|
||||
bool _selfHidden; ///< true when the dialog itself because of a window event (deactivation or minimization)
|
||||
Position _position;
|
||||
bool _hideOnBlur;
|
||||
|
||||
};
|
||||
|
||||
|
|
91
interface/src/ui/LoginDialog.cpp
Normal file
91
interface/src/ui/LoginDialog.cpp
Normal file
|
@ -0,0 +1,91 @@
|
|||
//
|
||||
// LoginDialog.cpp
|
||||
// interface/src/ui
|
||||
//
|
||||
// Created by Ryan Huffman on 4/23/14.
|
||||
// Copyright 2014 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 <QWidget>
|
||||
#include <QPushButton>
|
||||
#include <QPixmap>
|
||||
|
||||
#include "Application.h"
|
||||
#include "Menu.h"
|
||||
#include "AccountManager.h"
|
||||
#include "ui_loginDialog.h"
|
||||
|
||||
#include "LoginDialog.h"
|
||||
|
||||
const QString FORGOT_PASSWORD_URL = "https://data-web.highfidelity.io/password/new";
|
||||
|
||||
LoginDialog::LoginDialog(QWidget* parent) :
|
||||
FramelessDialog(parent, 0, FramelessDialog::POSITION_TOP),
|
||||
_ui(new Ui::LoginDialog) {
|
||||
|
||||
_ui->setupUi(this);
|
||||
_ui->errorLabel->hide();
|
||||
_ui->emailLineEdit->setFocus();
|
||||
_ui->logoLabel->setPixmap(QPixmap(Application::resourcesPath() + "images/hifi-logo.svg"));
|
||||
_ui->loginButton->setIcon(QIcon(Application::resourcesPath() + "images/login.svg"));
|
||||
_ui->infoLabel->setVisible(false);
|
||||
_ui->errorLabel->setVisible(false);
|
||||
|
||||
setModal(true);
|
||||
setHideOnBlur(false);
|
||||
|
||||
connect(&AccountManager::getInstance(), &AccountManager::loginComplete,
|
||||
this, &LoginDialog::handleLoginCompleted);
|
||||
connect(&AccountManager::getInstance(), &AccountManager::loginFailed,
|
||||
this, &LoginDialog::handleLoginFailed);
|
||||
connect(_ui->loginButton, &QPushButton::clicked,
|
||||
this, &LoginDialog::handleLoginClicked);
|
||||
connect(_ui->closeButton, &QPushButton::clicked,
|
||||
this, &LoginDialog::close);
|
||||
};
|
||||
|
||||
LoginDialog::~LoginDialog() {
|
||||
delete _ui;
|
||||
};
|
||||
|
||||
void LoginDialog::handleLoginCompleted(const QUrl& authURL) {
|
||||
_ui->infoLabel->setVisible(false);
|
||||
_ui->errorLabel->setVisible(false);
|
||||
close();
|
||||
};
|
||||
|
||||
void LoginDialog::handleLoginFailed() {
|
||||
_ui->infoLabel->setVisible(false);
|
||||
_ui->errorLabel->setVisible(true);
|
||||
|
||||
_ui->errorLabel->show();
|
||||
_ui->loginArea->setDisabled(false);
|
||||
|
||||
// Move focus to password and select the entire line
|
||||
_ui->passwordLineEdit->setFocus();
|
||||
_ui->passwordLineEdit->setSelection(0, _ui->emailLineEdit->maxLength());
|
||||
};
|
||||
|
||||
void LoginDialog::handleLoginClicked() {
|
||||
// If the email or password inputs are empty, move focus to them, otherwise attempt to login.
|
||||
if (_ui->emailLineEdit->text().isEmpty()) {
|
||||
_ui->emailLineEdit->setFocus();
|
||||
} else if (_ui->passwordLineEdit->text().isEmpty()) {
|
||||
_ui->passwordLineEdit->setFocus();
|
||||
} else {
|
||||
_ui->infoLabel->setVisible(true);
|
||||
_ui->errorLabel->setVisible(false);
|
||||
|
||||
_ui->loginArea->setDisabled(true);
|
||||
AccountManager::getInstance().requestAccessToken(_ui->emailLineEdit->text(), _ui->passwordLineEdit->text());
|
||||
}
|
||||
};
|
||||
|
||||
void LoginDialog::moveEvent(QMoveEvent* event) {
|
||||
// Modal dialogs seemed to get repositioned automatically. Combat this by moving the window if needed.
|
||||
resizeAndPosition();
|
||||
};
|
42
interface/src/ui/LoginDialog.h
Normal file
42
interface/src/ui/LoginDialog.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
//
|
||||
// LoginDialog.h
|
||||
// interface/src/ui
|
||||
//
|
||||
// Created by Ryan Huffman on 4/23/14.
|
||||
// Copyright 2014 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_LoginDialog_h
|
||||
#define hifi_LoginDialog_h
|
||||
|
||||
#include <QObject>
|
||||
#include "FramelessDialog.h"
|
||||
|
||||
namespace Ui {
|
||||
class LoginDialog;
|
||||
}
|
||||
|
||||
class LoginDialog : public FramelessDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
LoginDialog(QWidget* parent);
|
||||
~LoginDialog();
|
||||
|
||||
public slots:
|
||||
void handleLoginClicked();
|
||||
void handleLoginCompleted(const QUrl& authURL);
|
||||
void handleLoginFailed();
|
||||
|
||||
protected:
|
||||
void moveEvent(QMoveEvent* event);
|
||||
|
||||
private:
|
||||
Ui::LoginDialog* _ui;
|
||||
|
||||
};
|
||||
|
||||
#endif // hifi_LoginDialog_h
|
491
interface/ui/loginDialog.ui
Normal file
491
interface/ui/loginDialog.ui
Normal file
|
@ -0,0 +1,491 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>LoginDialog</class>
|
||||
<widget class="QDialog" name="LoginDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1003</width>
|
||||
<height>130</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>130</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">font-family: Helvetica, Arial, sans-serif;</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QWidget" name="statusArea" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="spacing">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="errorMessages" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>825</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="infoLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Helvetica,Arial,sans-serif</family>
|
||||
<pointsize>17</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Authenticating...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="errorLabel">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Helvetica,Arial,sans-serif</family>
|
||||
<pointsize>17</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">color: #992800;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><style type="text/css">
|
||||
a { text-decoration: none; color: #267077;}
|
||||
</style>
|
||||
Invalid username or password. <a href="https://data-web.highfidelity.io/password/new">Recover?</a></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="closeButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>SplitHCursor</cursorShape>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>../resources/images/close.svg</normaloff>../resources/images/close.svg</iconset>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="loginAreaContainer" native="true">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>102</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>30</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="spacerLeft">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="logoArea" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="logoLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap>../resources/images/hifi-logo.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="loginArea" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>931</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QLineEdit {
|
||||
padding: 10px;
|
||||
border-width: 1px; border-style: solid; border-radius: 3px; border-color: #aaa;
|
||||
}</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<property name="spacing">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="emailLineEdit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>54</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Helvetica,Arial,sans-serif</family>
|
||||
<pointsize>20</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">padding-top: 14px;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>Username or Email</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="passwordLineEdit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>54</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Helvetica,Arial,sans-serif</family>
|
||||
<pointsize>20</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">padding-top: 14px;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>Password</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="loginButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>141</width>
|
||||
<height>54</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Helvetica,Arial,sans-serif</family>
|
||||
<pointsize>20</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>PointingHandCursor</cursorShape>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">
|
||||
background: #0e7077;
|
||||
color: #e7eeee;
|
||||
border-radius: 4px; padding-top: 1px;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string> Login</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>../resources/images/login.svg</normaloff>../resources/images/login.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="default">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Helvetica,Arial,sans-serif</family>
|
||||
<pointsize>17</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><style type="text/css">
|
||||
a { text-decoration: none; color: #267077;}
|
||||
</style>
|
||||
<a href="https://data-web.highfidelity.io/password/new">Recover password?</a></string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="spacerRight">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -50,6 +50,10 @@ typedef unsigned long long quint64;
|
|||
#include "HeadData.h"
|
||||
#include "HandData.h"
|
||||
|
||||
// avatar motion behaviors
|
||||
const quint32 AVATAR_MOTION_OBEY_ENVIRONMENTAL_GRAVITY = 1U << 0;
|
||||
const quint32 AVATAR_MOTION_OBEY_LOCAL_GRAVITY = 1U << 1;
|
||||
|
||||
// First bitset
|
||||
const int KEY_STATE_START_BIT = 0; // 1st and 2nd bits
|
||||
const int HAND_STATE_START_BIT = 2; // 3rd and 4th bits
|
||||
|
|
|
@ -337,6 +337,7 @@ void AccountManager::requestFinished() {
|
|||
} else {
|
||||
// TODO: error handling
|
||||
qDebug() << "Error in response for password grant -" << rootObject["error_description"].toString();
|
||||
emit loginFailed();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -71,6 +71,7 @@ signals:
|
|||
void usernameChanged(const QString& username);
|
||||
void accessTokenChanged();
|
||||
void loginComplete(const QUrl& authURL);
|
||||
void loginFailed();
|
||||
void logoutComplete();
|
||||
private slots:
|
||||
void processReply();
|
||||
|
|
|
@ -239,6 +239,9 @@ void ScriptEngine::init() {
|
|||
globalObject.setProperty("COLLISION_GROUP_VOXELS", _engine.newVariant(QVariant(COLLISION_GROUP_VOXELS)));
|
||||
globalObject.setProperty("COLLISION_GROUP_PARTICLES", _engine.newVariant(QVariant(COLLISION_GROUP_PARTICLES)));
|
||||
|
||||
globalObject.setProperty("AVATAR_MOTION_OBEY_LOCAL_GRAVITY", _engine.newVariant(QVariant(AVATAR_MOTION_OBEY_LOCAL_GRAVITY)));
|
||||
globalObject.setProperty("AVATAR_MOTION_OBEY_ENVIRONMENTAL_GRAVITY", _engine.newVariant(QVariant(AVATAR_MOTION_OBEY_ENVIRONMENTAL_GRAVITY)));
|
||||
|
||||
// let the VoxelPacketSender know how frequently we plan to call it
|
||||
_voxelsScriptingInterface.getVoxelPacketSender()->setProcessCallIntervalHint(SCRIPT_DATA_CALLBACK_USECS);
|
||||
_particlesScriptingInterface.getParticlePacketSender()->setProcessCallIntervalHint(SCRIPT_DATA_CALLBACK_USECS);
|
||||
|
|
|
@ -36,6 +36,10 @@ float Vec3::length(const glm::vec3& v) {
|
|||
return glm::length(v);
|
||||
}
|
||||
|
||||
float Vec3::distance(const glm::vec3& v1, const glm::vec3& v2) {
|
||||
return glm::distance(v1, v2);
|
||||
}
|
||||
|
||||
glm::vec3 Vec3::normalize(const glm::vec3& v) {
|
||||
return glm::normalize(v);
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ public slots:
|
|||
glm::vec3 sum(const glm::vec3& v1, const glm::vec3& v2);
|
||||
glm::vec3 subtract(const glm::vec3& v1, const glm::vec3& v2);
|
||||
float length(const glm::vec3& v);
|
||||
float distance(const glm::vec3& v1, const glm::vec3& v2);
|
||||
glm::vec3 normalize(const glm::vec3& v);
|
||||
void print(const QString& lable, const glm::vec3& v);
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue