3
0
Fork 0
mirror of https://github.com/lubosz/overte.git synced 2025-04-27 12:35:31 +02:00

Merging with master

This commit is contained in:
samcake 2016-01-18 16:40:34 -08:00
commit df496b065c
203 changed files with 4541 additions and 3568 deletions
examples
interface/resources/qml

View file

@ -272,7 +272,7 @@ function loadBirds(howMany) {
gravity: { x: 0, y: BIRD_GRAVITY, z: 0 },
velocity: { x: 0, y: -0.1, z: 0 },
damping: LINEAR_DAMPING,
collisionsWillMove: true,
dynamic: true,
lifetime: STARTING_LIFETIME,
color: colors[whichBird]
}),
@ -289,4 +289,4 @@ function loadBirds(howMany) {
color: {red: 100, green: 100, blue: 100}
});
}
}
}

View file

@ -53,7 +53,7 @@ for (var i = 0; i < NUM_MOONS; i++) {
dimensions: { x: radius, y: radius, z: radius },
color: color,
ignoreCollisions: true,
collisionsWillMove: false
dynamic: false
}));
}

View file

@ -65,7 +65,7 @@
modelURL: BAT_MODEL,
position: dropPosition,
compoundShapeURL: BAT_COLLISION_HULL,
collisionsWillMove: true,
dynamic: true,
velocity: { x: 0, y: 0.05, z: 0}, // workaround for gravity not taking effect on add
gravity: { x: 0, y: -9.81, z: 0},
rotation: Quat.fromPitchYawRollDegrees(0.0, 0.0, -90.0),

View file

@ -107,7 +107,7 @@ var PITCHING_MACHINE_PROPERTIES = {
y: 0.61,
z: 0.39
},
collisionsWillMove: false,
dynamic: false,
shapeType: "Box"
};
PITCHING_MACHINE_PROPERTIES.dimensions = Vec3.multiply(2.5, PITCHING_MACHINE_PROPERTIES.dimensions);
@ -217,7 +217,7 @@ var BASEBALL_PROPERTIES = {
y: BASEBALL_RADIUS,
z: BASEBALL_RADIUS
},
collisionsWillMove: true,
dynamic: true,
angularVelocity: {
x: 17.0,
y: 0,

View file

@ -104,7 +104,7 @@ function generateFloor() {
green: randFloat(70, 71),
blue: randFloat(70, 80)
},
// collisionsWillMove: true
// dynamic: true
}));
}
@ -132,7 +132,7 @@ function dropBlock() {
shapeType: 'box',
position: dropPos,
dimensions: BLOCK_SIZE,
collisionsWillMove: true,
dynamic: true,
gravity: {
x: 0,
y: -9,
@ -198,4 +198,4 @@ function map(value, min1, max1, min2, max2) {
}
Script.scriptEnding.connect(cleanup);
Controller.mousePressEvent.connect(mousePressEvent);
Controller.mousePressEvent.connect(mousePressEvent);

View file

@ -101,7 +101,7 @@ for (var i = 0; i < NUM_BLOCKS; i++) {
ignoreCollisions: false,
damping: DAMPING,
lifetime: LIFETIME,
collisionsWillMove: true }));
dynamic: true }));
}
function scriptEnding() {
@ -121,4 +121,4 @@ function scriptEnding() {
}
}
Script.scriptEnding.connect(scriptEnding);
Script.scriptEnding.connect(scriptEnding);

View file

@ -234,7 +234,7 @@ function shootBullet(position, velocity, grenade) {
damping: 0.01,
density: 8000,
ignoreCollisions: false,
collisionsWillMove: true
dynamic: true
});
Script.addEventHandler(bulletID, "collisionWithEntity", entityCollisionWithEntity);
@ -294,7 +294,7 @@ function shootTarget() {
rotation: Camera.getOrientation(),
damping: 0.1,
density: 100.0,
collisionsWillMove: true
dynamic: true
});
// Record start time
@ -349,7 +349,7 @@ function makeGrid(type, scale, size) {
rotation: Camera.getOrientation(),
damping: 0.1,
density: 100.0,
collisionsWillMove: true
dynamic: true
});
}
}
@ -401,7 +401,7 @@ function makePlatform(gravity, scale, size) {
lifetime: TARGET_LIFE,
damping: 0.1,
density: 100.0,
collisionsWillMove: true
dynamic: true
});
}
}

View file

@ -59,7 +59,7 @@ function createEntities() {
gravity: { x: 0, y: GRAVITY, z: 0 },
ignoreCollisions: false,
damping: 0.50,
collisionsWillMove: true });
dynamic: true });
paddle = Entities.addEntity(
{ type: "Box",
@ -71,7 +71,7 @@ function createEntities() {
damping: 0.10,
visible: false,
rotation : leftHanded ? MyAvatar.leftHandPose.rotation : MyAvatar.rightHandPose.rotation,
collisionsWillMove: false });
dynamic: false });
modelURL = "http://public.highfidelity.io/models/attachments/pong_paddle.fbx";
paddleModel = Entities.addEntity(
@ -84,7 +84,7 @@ function createEntities() {
modelURL: modelURL,
damping: 0.10,
rotation : leftHanded ? MyAvatar.leftHandPose.rotation : MyAvatar.rightHandPose.rotation,
collisionsWillMove: false });
dynamic: false });
line = Overlays.addOverlay("line3d", {
start: { x: 0, y: 0, z: 0 },

View file

@ -154,7 +154,7 @@ function checkControllerSide(whichSide) {
dimensions: { x: BALL_RADIUS * 2, y: BALL_RADIUS * 2, z: BALL_RADIUS * 2 },
damping: 0.00001,
shapeType: "sphere",
collisionsWillMove: false,
dynamic: false,
color: HELD_COLOR,
lifetime: LIFETIME_SECONDS
};
@ -200,7 +200,7 @@ function checkControllerSide(whichSide) {
velocity: linearVelocity,
rotation: palmRotation,
angularVelocity: angularVelocity,
collisionsWillMove: true,
dynamic: true,
color: THROWN_COLOR,
gravity: { x: 0, y: -GRAVITY_STRENGTH, z: 0},
};

View file

@ -175,7 +175,7 @@ function createTable() {
damping: 0.1,
restitution: 0.01,
density: 0.5,
collisionsWillMove: true,
dynamic: true,
color: { red: randInt(0, 255), green: randInt(0, 255), blue: randInt(0, 255) },
});
if (type == "Model") {
@ -196,4 +196,4 @@ function removeTable() {
}
Script.scriptEnding.connect(cleanUp);
Controller.mousePressEvent.connect(onClick);
Controller.mousePressEvent.connect(onClick);

View file

@ -42,7 +42,7 @@ for (var x = 0; x < SIDE_SIZE; x++) {
dimensions: { x: radius, y: radius, z: radius },
color: color,
ignoreCollisions: true,
collisionsWillMove: false,
dynamic: false,
lifetime: LIFETIME
}));
}

View file

@ -51,7 +51,7 @@ function createEarth() {
z: EARTH_SPHERE_RADIUS
},
rotation: Quat.fromPitchYawRollDegrees(0, 90, 0),
// collisionsWillMove: true,
// dynamic: true,
//if you have a shapetype it blocks the smaller markers
// shapeType:'sphere'
// userData: JSON.stringify({

View file

@ -108,7 +108,7 @@ Script.setInterval(function() {
var grabData = userData["grabKey"]
// {"grabbableKey":{"invertSolidWhileHeld":true},
// "grabKey":{"activated":true,"avatarId":"{6ea8b092-10e0-4058-888b-6facc40d0fe9}","refCount":1,"gravity":{"x":0,"y":0,"z":0},"ignoreForCollisions":0,"collisionsWillMove":1}
// "grabKey":{"activated":true,"avatarId":"{6ea8b092-10e0-4058-888b-6facc40d0fe9}","refCount":1,"gravity":{"x":0,"y":0,"z":0},"ignoreForCollisions":0,"dynamic":1}
// }
if (typeof grabData != 'undefined') {

View file

@ -110,7 +110,7 @@ function shootDice(position, velocity) {
},
lifetime: LIFETIME,
shapeType: "box",
collisionsWillMove: true,
dynamic: true,
collisionSoundURL: "http://s3.amazonaws.com/hifi-public/sounds/dice/diceCollide.wav"
}));
position = Vec3.sum(position, Vec3.multiply(DIE_SIZE, Vec3.normalize(Quat.getRight(Camera.getOrientation()))));
@ -151,4 +151,4 @@ function scriptEnding() {
}
Controller.mousePressEvent.connect(mousePressEvent);
Script.scriptEnding.connect(scriptEnding);
Script.scriptEnding.connect(scriptEnding);

View file

@ -77,7 +77,7 @@ Script.setInterval(function () {
damping: DAMPING,
angularDamping: ANGULAR_DAMPING,
gravity: (gravity ? GRAVITY : { x: 0, y: 0, z: 0}),
collisionsWillMove: collidable,
dynamic: collidable,
lifetime: LIFETIME
});

View file

@ -24,7 +24,7 @@ function createAvatarDetector() {
y: 2,
z: 1
},
collisionsWillMove: false,
dynamic: false,
ignoreForCollisions: true,
visible: false,
color: {
@ -52,4 +52,4 @@ var cleanup = function() {
createAvatarDetector();
Script.scriptEnding.connect(cleanup);
Script.update.connect(updateAvatarDetector);
Script.update.connect(updateAvatarDetector);

View file

@ -56,7 +56,7 @@ function explodeHelicopter(explodePosition) {
dimensions: partsURLS[i].dimensions,
position: position,
shapeType: "box",
collisionsWillMove: true,
dynamic: true,
damping: 0,
gravity: {
x: 0,
@ -141,4 +141,4 @@ function cleanup() {
})
}
Script.scriptEnding.connect(cleanup);
Script.scriptEnding.connect(cleanup);

View file

@ -90,7 +90,7 @@ var modelRatProperties = {
damping: 0.8,
angularDamping: 0.99,
friction: 0.75,
collisionsWillMove: true,
dynamic: true,
ignoreForCollisions: false,
gravity: {
x: 0,
@ -194,7 +194,7 @@ function addAvoiderBlock(position) {
z: 1
},
position: position,
collisionsWillMove: false,
dynamic: false,
ignoreForCollisions: true,
visible: false
};
@ -468,4 +468,4 @@ if (USE_CONSTANT_SPAWNER === true) {
}
}, RAT_SPAWN_RATE);
}
}

View file

@ -165,7 +165,7 @@ function spawnBalls() {
blue: randFloat(10, 180)
},
ignoreCollisions: false,
collisionsWillMove: true,
dynamic: true,
gravity: {
x: 0,
y: -9.9,
@ -244,4 +244,4 @@ Script.scriptEnding.connect(cleanup);
Script.scriptEnding.connect(cleanup);
Controller.mousePressEvent.connect(mousePressEvent);
Controller.mousePressEvent.connect(mousePressEvent);

View file

@ -43,7 +43,7 @@ function draw(deltaTime) {
var properties = {
type: "Sphere",
collisionsWillMove: true,
dynamic: true,
position: startPosition,
dimensions: {x: largeRadius, y: largeRadius, z: largeRadius},
registrationPoint: { x: 0.5, y: 0.5, z: 0.5 },
@ -84,7 +84,7 @@ function draw(deltaTime) {
if (numberEntitiesAdded <= MAX_ENTITIES) {
var properties = {
type: "Sphere",
collisionsWillMove: true,
dynamic: true,
position: center,
dimensions: {x: entitySize, y: entitySize, z: entitySize},
registrationPoint: { x: 0.5, y: 0.5, z: 0.5 },

View file

@ -19,7 +19,7 @@ var position = Vec3.sum(MyAvatar.position, Quat.getFront(MyAvatar.orientation));
var properties = {
type: "Box",
position: position,
collisionsWillMove: true,
dynamic: true,
color: { red: 200, green: 0, blue: 0 }
};
var collider = Entities.addEntity(properties);

View file

@ -177,7 +177,7 @@ function makeNewProp(which, position) {
damping: PUCK_DAMPING,
angularDamping: ANGULAR_DAMPING,
lifetime: LIFETIME,
collisionsWillMove: true
dynamic: true
});
} else if (which == "paddle1") {
paddle1Pos = Vec3.sum(center, {
@ -211,7 +211,7 @@ function makeNewProp(which, position) {
damping: PADDLE_DAMPING,
angularDamping: PADDLE_ANGULAR_DAMPING,
lifetime: LIFETIME,
collisionsWillMove: true
dynamic: true
});
} else if (which == "paddle2") {
paddle2Pos = Vec3.sum(center, {
@ -245,7 +245,7 @@ function makeNewProp(which, position) {
damping: PADDLE_DAMPING,
angularDamping: PADDLE_ANGULAR_DAMPING,
lifetime: LIFETIME,
collisionsWillMove: true
dynamic: true
});
}
}

View file

@ -128,7 +128,7 @@ function makeBalls(pos) {
damping: 0.50,
shapeType: "sphere",
collisionSoundURL: hitSound,
collisionsWillMove: true }));
dynamic: true }));
ballPosition.z += (BALL_SIZE + BALL_GAP) * SCALE;
ballNumber++;
}
@ -149,7 +149,7 @@ function makeBalls(pos) {
ignoreCollisions: false,
damping: 0.50,
shapeType: "sphere",
collisionsWillMove: true });
dynamic: true });
}
@ -184,7 +184,7 @@ function shootCue(velocity) {
damping: 0.10,
density: 8000,
ignoreCollisions: false,
collisionsWillMove: true
dynamic: true
});
print("Shot, velocity = " + velocity);
}

View file

@ -219,7 +219,7 @@
type: 'Box',
dimensions: COLOR_INDICATOR_DIMENSIONS,
position: this.currentProperties.position,
collisionsWillMove: false,
dynamic: false,
ignoreForCollisions: true
}
@ -262,4 +262,4 @@
};
return new ColorBusterWand();
});
});

View file

@ -81,7 +81,7 @@ function createColorBusterCube(row, column, vertical) {
name: 'Hifi-ColorBusterCube',
type: 'Box',
dimensions: CUBE_DIMENSIONS,
collisionsWillMove: false,
dynamic: false,
ignoreForCollisions: false,
color: startingColor[1],
position: position,
@ -127,4 +127,4 @@ if (DELETE_AT_ENDING === true) {
}
createBoard();
createBoard();

View file

@ -71,7 +71,7 @@ function createColorBusterWand() {
dimensions: COLOR_WAND_DIMENSIONS,
position: center,
script: COLOR_WAND_SCRIPT_URL,
collisionsWillMove: true,
dynamic: true,
userData: JSON.stringify({
hifiColorBusterWandKey: {
owner: MyAvatar.sessionUUID,
@ -96,4 +96,4 @@ if (DELETE_AT_ENDING === true) {
Script.scriptEnding.connect(deleteWand);
}
createColorBusterWand();
createColorBusterWand();

View file

@ -169,8 +169,8 @@ function fire(side, value) {
if (intersection.intersects) {
Script.setTimeout(function() {
createEntityHitEffect(intersection.intersection);
if (shootAnything && intersection.properties.collisionsWillMove === 1) {
// Any entity with collisions will move can be shot
if (shootAnything && intersection.properties.dynamic === 1) {
// Any dynamic entity can be shot
Entities.editEntity(intersection.entityID, {
velocity: Vec3.multiply(shotDirection, GUN_FORCE)
});

View file

@ -142,7 +142,7 @@ function mousePressEvent(event) {
if (!pickResults.intersects) {
return;
}
if (pickResults.properties.collisionsWillMove) {
if (pickResults.properties.dynamic) {
grabbedEntity = pickResults.entityID;
var props = Entities.getEntityProperties(grabbedEntity)
originalGravity = props.gravity;

View file

@ -190,7 +190,7 @@ function controller(side) {
direction: Vec3.normalize(Vec3.subtract(this.tipPosition, this.palmPosition))
};
var intersection = getRayIntersection(pickRay, true);
if (intersection.intersects && intersection.properties.collisionsWillMove) {
if (intersection.intersects && intersection.properties.dynamic) {
this.laserWasHovered = true;
if (this.triggerHeld && !this.grabbing) {
this.grab(intersection.entityID);
@ -298,4 +298,4 @@ var leftController = new controller(LEFT);
Script.update.connect(update);
Script.scriptEnding.connect(scriptEnding);
Script.scriptEnding.connect(scriptEnding);

View file

@ -49,7 +49,7 @@ function mousePressEvent(event) {
dimensions: {x: 0.3, y: 0.7, z: 0.3},
gravity: {x: 0.0, y: -3.0, z: 0.0},
damping: 0.2,
collisionsWillMove: true
dynamic: true
});
var pointToOffsetFrom = Vec3.sum(position, {x: 0.0, y: 2.0, z: 0.0});

View file

@ -289,7 +289,7 @@ PlankyStack = function() {
}
if (!editMode) {
_this.planks.forEach(function(plank, index, object) {
Entities.editEntity(plank.entity, {ignoreForCollisions: false, collisionsWillMove: true});
Entities.editEntity(plank.entity, {ignoreForCollisions: false, dynamic: true});
});
}
};

View file

@ -67,7 +67,7 @@ SatelliteCreator = function() {
damping: 0.0,
ignoreCollisions: false,
lifetime: 6000,
collisionsWillMove: false,
dynamic: false,
visible: true
});
@ -90,7 +90,7 @@ SatelliteCreator = function() {
damping: 0.0,
ignoreCollisions: false,
lifetime: LIFETIME,
collisionsWillMove: false,
dynamic: false,
visible: true
});
@ -174,7 +174,7 @@ SatelliteCreator = function() {
damping: 0.0,
ignoreCollisions: false,
lifetime: LIFETIME,
collisionsWillMove: false,
dynamic: false,
});
this.getProperties = function() {

View file

@ -191,7 +191,7 @@ function initializeInvaders() {
dimensions: { x: invaderSize * 2, y: invaderSize * 2, z: invaderSize * 2 },
color: { red: 255, green: 0, blue: 0 },
modelURL: invaderModels[row].modelURL,
collisionsWillMove: true,
dynamic: true,
lifetime: itemLifetimes
});
}
@ -341,7 +341,7 @@ function fireMissile() {
velocity: { x: 0, y: 5, z: 0},
gravity: { x: 0, y: 0, z: 0 },
damping: 0,
collisionsWillMove: true,
dynamic: true,
dimensions: { x: missileSize, y: missileSize, z: missileSize },
color: { red: 0, green: 0, blue: 255 },
lifetime: 5

View file

@ -286,7 +286,7 @@ function makeSword() {
damping: 0.1,
collisionSoundURL: swordCollisionSoundURL,
restitution: 0.01,
collisionsWillMove: true,
dynamic: true,
});
if (originalAvatarCollisionSound === undefined) {

View file

@ -30,7 +30,7 @@ ColorCube.prototype.create = function() {
name: that.NAME,
color: that.COLOR,
ignoreCollisions: true,
collisionsWillMove: false,
dynamic: false,
dimensions: { x: size, y: size, z: size },
lifetime: 3600,
userData: JSON.stringify(that.USER_DATA)

View file

@ -55,7 +55,7 @@ CreateSimulation = function() {
damping: DAMPING,
ignoreCollisions: false,
lifetime: LIFETIME,
collisionsWillMove: false
dynamic: false
});
@ -187,7 +187,7 @@ CreateSimulation = function() {
damping: DAMPING,
ignoreCollisions: false,
lifetime: LIFETIME,
collisionsWillMove: false,
dynamic: false,
});
this.computeAcceleration = function() {

View file

@ -37,7 +37,7 @@ function makeAll() {
type: "Model",
modelURL: HIFI_PUBLIC_BUCKET + model,
collisionSoundURL: sound,
collisionsWillMove: true,
dynamic: true,
shapeType: "box",
restitution: 0.8,
dimensions: currentDimensions,

View file

@ -46,7 +46,7 @@ ArcBall = function(spawnPosition) {
},
ignoreForCollisions: true,
damping: 0.8,
collisionsWillMove: true,
dynamic: true,
userData: JSON.stringify({
grabbableKey: {
spatialKey: {
@ -142,4 +142,4 @@ ArcBall = function(spawnPosition) {
}
this.cleanup = cleanup;
}
}

View file

@ -41,7 +41,7 @@ LightBall = function(spawnPosition) {
green: 10,
blue: 150
},
collisionsWillMove: true,
dynamic: true,
// gravity: {
// x: 0,
// y: -0.5,

View file

@ -23,7 +23,7 @@ LightSaber = function(spawnPosition) {
modelURL: modelURL,
position: spawnPosition,
shapeType: 'box',
collisionsWillMove: true,
dynamic: true,
script: scriptURL,
dimensions: {
x: 0.06,

View file

@ -33,7 +33,7 @@ RaveStick = function(spawnPosition) {
modelURL: modelURL,
position: spawnPosition,
shapeType: 'box',
collisionsWillMove: true,
dynamic: true,
script: scriptURL,
dimensions: {
x: 0.06,

View file

@ -320,7 +320,7 @@ Grabber.prototype.pressEvent = function(event) {
return;
}
if (!pickResults.properties.collisionsWillMove) {
if (!pickResults.properties.dynamic) {
// only grab dynamic objects
return;
}
@ -510,7 +510,7 @@ Grabber.prototype.activateEntity = function(entityID, grabbedProperties) {
if (data["refCount"] == 1) {
data["gravity"] = grabbedProperties.gravity;
data["ignoreForCollisions"] = grabbedProperties.ignoreForCollisions;
data["collisionsWillMove"] = grabbedProperties.collisionsWillMove;
data["dynamic"] = grabbedProperties.dynamic;
var whileHeldProperties = {gravity: {x:0, y:0, z:0}};
if (invertSolidWhileHeld) {
whileHeldProperties["ignoreForCollisions"] = ! grabbedProperties.ignoreForCollisions;
@ -528,7 +528,7 @@ Grabber.prototype.deactivateEntity = function(entityID) {
Entities.editEntity(entityID, {
gravity: data["gravity"],
ignoreForCollisions: data["ignoreForCollisions"],
collisionsWillMove: data["collisionsWillMove"]
dynamic: data["dynamic"]
});
data = null;
}

View file

@ -52,7 +52,7 @@ function makeGrenade() {
dimensions: { x: 0.09,
y: 0.20,
z: 0.09 },
collisionsWillMove: true,
dynamic: true,
modelURL: grenadeURL,
shapeType: "box"
});
@ -160,7 +160,7 @@ function blowShitUp(position, radius) {
var SPIN_RATE = 20.0;
for (var i = 0; i < stuff.length; i++) {
var properties = Entities.getEntityProperties(stuff[i]);
if (properties.collisionsWillMove) {
if (properties.dynamic) {
var diff = Vec3.subtract(properties.position, position);
var distance = Vec3.length(diff);
var velocity = Vec3.sum(properties.velocity, Vec3.multiply(STRENGTH * 1.0 / distance, Vec3.normalize(diff)));

View file

@ -46,7 +46,7 @@ Script.setInterval(function () {
position: position,
dimensions: MODEL_DIMENSION,
ignoreCollisions: true,
collisionsWillMove: false,
dynamic: false,
lifetime: LIFETIME
});
} else {
@ -57,7 +57,7 @@ Script.setInterval(function () {
dimensions: { x: SIZE, y: SIZE, z: SIZE },
color: { red: x / ROWS_X * 255, green: 50, blue: z / ROWS_Z * 255 },
ignoreCollisions: true,
collisionsWillMove: false,
dynamic: false,
lifetime: LIFETIME
});
}

View file

@ -25,7 +25,7 @@ ball = Entities.addEntity(
position: basePosition,
dimensions: { x: 0.1, y: 0.1, z: 0.1 },
color: { red: 255, green: 0, blue: 255 },
collisionsWillMove: false,
dynamic: false,
ignoreForCollisions: true
});

View file

@ -262,7 +262,7 @@
var elDensity = document.getElementById("property-density");
var elIgnoreForCollisions = document.getElementById("property-ignore-for-collisions");
var elCollisionsWillMove = document.getElementById("property-collisions-will-move");
var elDynamic = document.getElementById("property-dynamic" );
var elCollisionSoundURL = document.getElementById("property-collision-sound-url");
var elLifetime = document.getElementById("property-lifetime");
var elScriptURL = document.getElementById("property-script-url");
@ -492,7 +492,7 @@
elDensity.value = properties.density.toFixed(2);
elIgnoreForCollisions.checked = properties.ignoreForCollisions;
elCollisionsWillMove.checked = properties.collisionsWillMove;
elDynamic.checked = properties.dynamic;
elCollisionSoundURL.value = properties.collisionSoundURL;
elLifetime.value = properties.lifetime;
elScriptURL.value = properties.script;
@ -719,7 +719,7 @@
elDensity.addEventListener('change', createEmitNumberPropertyUpdateFunction('density'));
elIgnoreForCollisions.addEventListener('change', createEmitCheckedPropertyUpdateFunction('ignoreForCollisions'));
elCollisionsWillMove.addEventListener('change', createEmitCheckedPropertyUpdateFunction('collisionsWillMove'));
elDynamic.addEventListener('change', createEmitCheckedPropertyUpdateFunction('dynamic'));
elCollisionSoundURL.addEventListener('change', createEmitTextPropertyUpdateFunction('collisionSoundURL'));
elLifetime.addEventListener('change', createEmitNumberPropertyUpdateFunction('lifetime'));
@ -1242,9 +1242,9 @@
</div>
<div class="property">
<span class="label">Collisions Will Move</span>
<span class="label">Dynamic</span>
<span class="value">
<input type='checkbox' id="property-collisions-will-move">
<input type='checkbox' id="property-dynamic">
</span>
</div>

View file

@ -75,7 +75,7 @@ var playerSphere = Entities.addEntity({
y: -9.8,
z: 0
},
collisionsWillMove: true,
dynamic: true,
damping: 0.2
});
@ -267,4 +267,4 @@ function cleanup() {
}
Script.scriptEnding.connect(cleanup);
Script.scriptEnding.connect(cleanup);

View file

@ -201,7 +201,7 @@ EntityPropertyDialogBox = (function () {
index++;
array.push({ label: "Ignore for Collisions:", type: "checkbox", value: properties.ignoreForCollisions });
index++;
array.push({ label: "Collisions Will Move:", type: "checkbox", value: properties.collisionsWillMove });
array.push({ label: "Dynamic:", type: "checkbox", value: properties.dynamic });
index++;
array.push({ label: "Collision Sound URL:", value: properties.collisionSoundURL });
index++;
@ -413,7 +413,7 @@ EntityPropertyDialogBox = (function () {
index++; // skip header
properties.density = array[index++].value;
properties.ignoreForCollisions = array[index++].value;
properties.collisionsWillMove = array[index++].value;
properties.dynamic = array[index++].value;
properties.lifetime = array[index++].value;
properties.visible = array[index++].value;

View file

@ -227,7 +227,7 @@ entitySlider.prototype = {
type: 'Line',
name: 'Hifi-Slider-Axis::' + this.sliderType,
color: this.color,
collisionsWillMove: false,
dynamic: false,
ignoreForCollisions: true,
dimensions: {
x: 3,
@ -250,7 +250,7 @@ entitySlider.prototype = {
var properties = {
name: 'Hifi-End-Of-Axis',
type: 'Box',
collisionsWillMove: false,
dynamic: false,
ignoreForCollisions: true,
dimensions: {
x: 0.01,
@ -360,7 +360,7 @@ entitySlider.prototype = {
type: 'Sphere',
name: 'Hifi-Slider-' + this.sliderType,
dimensions: SLIDER_DIMENSIONS,
collisionsWillMove: true,
dynamic: true,
color: this.color,
position: sliderPosition,
script: SLIDER_SCRIPT_URL,
@ -558,7 +558,7 @@ function createPanelEntity(position) {
z: 0.1
},
visible: false,
collisionsWillMove: false,
dynamic: false,
ignoreForCollisions: true
}
@ -582,7 +582,7 @@ function createVisiblePanel() {
z: SLIDER_DIMENSIONS.z / 4
},
visible: true,
collisionsWillMove: false,
dynamic: false,
ignoreForCollisions: true,
position: moveDown,
rotation: avatarRot,
@ -602,7 +602,7 @@ function createLightModel(position, rotation) {
shapeType: 'box',
modelURL: LIGHT_MODEL_URL,
dimensions: LIGHT_MODEL_DIMENSIONS,
collisionsWillMove: true,
dynamic: true,
position: position,
rotation: rotation,
script: PARENT_SCRIPT_URL,
@ -639,7 +639,7 @@ function createCloseButton(axisStart) {
position: Vec3.sum(position, VERTICAL_OFFFSET),
rotation: Quat.multiply(avatarRot, Quat.fromPitchYawRollDegrees(90, 0, 45)),
//rotation: Quat.fromPitchYawRollDegrees(0, 0, 90),
collisionsWillMove: false,
dynamic: false,
ignoreForCollisions: true,
script: CLOSE_BUTTON_SCRIPT_URL,
userData: JSON.stringify({
@ -873,4 +873,4 @@ subscribeToCleanupMessages();
// linearAttenuation: 0,
// quadraticAttenuation: 0,
// exponent: 0,
// cutoff: 180, // in degrees
// cutoff: 180, // in degrees

View file

@ -42,7 +42,7 @@ for (var i = 0; i < NUM_BLOCKS; i++) {
z: basePosition.z + randFloat(-SPAWN_RANGE, SPAWN_RANGE)
},
color: {red: Math.random() * 255, green: Math.random() * 255, blue: Math.random() * 255},
collisionsWillMove: true,
dynamic: true,
gravity: {x: 0, y: 0, z: 0}
}));
}
@ -60,4 +60,4 @@ Script.scriptEnding.connect(cleanup);
function randFloat(low, high) {
return low + Math.random() * ( high - low );
}
}

View file

@ -39,7 +39,7 @@ BALL_PROTOTYPE = {
dimensions: BALL_DIMENSIONS,
color: BALL_COLOR,
ignoreCollisions: true,
collisionsWillMove: false
dynamic: false
};
// 2 millimeters
@ -62,7 +62,7 @@ LINE_PROTOTYPE = {
lineWidth: 5,
visible: true,
ignoreCollisions: true,
collisionsWillMove: false,
dynamic: false,
}
EDGE_PROTOTYPE = LINE_PROTOTYPE;
@ -76,7 +76,7 @@ EDGE_PROTOTYPE = LINE_PROTOTYPE;
// rotation: rotation,
// visible: true,
// ignoreCollisions: true,
// collisionsWillMove: false
// dynamic: false
// }

View file

@ -9,7 +9,7 @@
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
/*global window, alert, EventBridge, dat, convertBinaryToBoolean, listenForSettingsUpdates,createVec3Folder,createQuatFolder,writeVec3ToInterface,writeDataToInterface*/
/*global window, alert, EventBridge, dat, listenForSettingsUpdates,createVec3Folder,createQuatFolder,writeVec3ToInterface,writeDataToInterface*/
var Settings = function() {
this.exportSettings = function() {
@ -66,7 +66,7 @@ var keysToIgnore = [
'angularVelocity',
'angularDamping',
'ignoreForCollisions',
'collisionsWillMove',
'dynamic',
'href',
'actionData',
'marketplaceID',
@ -502,11 +502,3 @@ function registerDOMElementsForListenerBlocking() {
});
}
///utility method for converting weird collisionWillMove type propertyies from binary to new Boolean()
//
// function convertBinaryToBoolean(value) {
// if (value === 0) {
// return false;
// }
// return true;
// }

View file

@ -58,7 +58,7 @@ for (var i = 0; i < planetTypes.length; i++) {
angularDamping: 0.0,
ignoreCollisions: false,
lifetime: LIFETIME,
collisionsWillMove: false }));
dynamic: false }));
}
Script.setTimeout(createParticles, 1000);
@ -82,7 +82,7 @@ function createParticles() {
ignoreCollisions: false,
damping: DAMPING,
lifetime: LIFETIME,
collisionsWillMove: true }));
dynamic: true }));
}
Script.update.connect(update);
}

View file

@ -113,7 +113,7 @@ function spawnBoxes() {
collisionSoundURL: collisionSoundURL,
shapeType: "box",
position: position,
collisionsWillMove: true,
dynamic: true,
dimensions: {x: 1, y: 2, z: 3},
velocity: {x: 0, y: -.01, z: 0},
gravity: {x: 0, y: -2.5 - Math.random() * 6, z: 0}

View file

@ -148,7 +148,7 @@ for (var i = 0; i < NUM_BALLS; i++) {
ignoreCollisions: false,
damping: DAMPING,
lifetime: LIFETIME,
collisionsWillMove: true }));
dynamic: true }));
}
var VEL_MAG = 2.0;

View file

@ -37,7 +37,7 @@ function makeNewStick() {
damping: .1,
collisionSoundURL: "http://public.highfidelity.io/sounds/Collisions-hitsandslaps/67LCollision07.wav",
restitution: 0.01,
collisionsWillMove: true
dynamic: true
});
actionID = Entities.addAction("hold", stickID,
{relativePosition: {x: 0.0, y: 0.0, z: -0.5},

View file

@ -37,7 +37,7 @@ function makeNewStick() {
damping: .1,
collisionSoundURL: "http://public.highfidelity.io/sounds/Collisions-hitsandslaps/67LCollision07.wav",
restitution: 0.01,
collisionsWillMove: true
dynamic: true
});
actionID = Entities.addAction("hold", stickID, {relativePosition: {x: 0.0, y: 0.0, z: -0.9},
hand: hand,

View file

@ -47,7 +47,7 @@ var rack = Entities.addEntity({
y: 1.37,
z: 1.73
},
collisionsWillMove: true,
dynamic: true,
ignoreForCollisions: false,
collisionSoundURL: collisionSoundURL,
compoundShapeURL: rackCollisionHullURL,
@ -89,7 +89,7 @@ function createBalls() {
y: -9.8,
z: 0
},
collisionsWillMove: true,
dynamic: true,
ignoreForCollisions: false,
modelURL: basketballURL,
userData: JSON.stringify({
@ -150,4 +150,4 @@ function atEnd() {
Script.clearInterval(distanceCheckInterval);
}
Script.scriptEnding.connect(atEnd);
Script.scriptEnding.connect(atEnd);

View file

@ -42,7 +42,7 @@ function makeBasketball() {
y: DIAMETER,
z: DIAMETER
},
collisionsWillMove: true,
dynamic: true,
collisionSoundURL: collisionSoundURL,
modelURL: basketballURL,
restitution: 1.0,
@ -94,4 +94,4 @@ function deleteStuff() {
}
Script.update.connect(update);
Script.scriptEnding.connect(scriptEnding);
Script.scriptEnding.connect(scriptEnding);

View file

@ -90,7 +90,7 @@ var topBlock = Entities.addEntity({
rotation: topBlock_rotation,
damping: LINEAR_DAMPING,
gravity: BLOCK_GRAVITY,
collisionsWillMove: true,
dynamic: true,
velocity: {
x: 0,
y: -0.01,
@ -108,7 +108,7 @@ var sideBlock1 = Entities.addEntity({
rotation: sideBlock1_rotation,
damping: LINEAR_DAMPING,
gravity: BLOCK_GRAVITY,
collisionsWillMove: true
dynamic: true
});
var sideBlock2 = Entities.addEntity({
@ -119,10 +119,10 @@ var sideBlock2 = Entities.addEntity({
dimensions: blockDimensions,
position: sideBlock2_position,
rotation: sideBlock2_rotation,
collsionsWillMove: true,
dynamic: true,
damping: LINEAR_DAMPING,
gravity: BLOCK_GRAVITY,
collisionsWillMove: true
dynamic: true
});
var ground = Entities.addEntity({

View file

@ -234,7 +234,7 @@
compoundShapeURL: ARROW_COLLISION_HULL_URL,
dimensions: ARROW_DIMENSIONS,
position: this.bowProperties.position,
collisionsWillMove: false,
dynamic: false,
ignoreForCollisions: true,
collisionSoundURL: ARROW_HIT_SOUND_URL,
damping: 0.01,
@ -264,7 +264,7 @@
z: 0
},
position: collision.contactPoint,
collisionsWillMove: false
dynamic: false
})
// print('ARROW COLLIDED WITH::' + entityB);
Script.removeEventHandler(arrow, "collisionWithEntity", makeArrowStick)
@ -286,7 +286,7 @@
type: 'Line',
position: Vec3.sum(this.bowProperties.position, TOP_NOTCH_OFFSET),
dimensions: LINE_DIMENSIONS,
collisionsWillMove: false,
dynamic: false,
ignoreForCollisions: true,
userData: JSON.stringify({
grabbableKey: {
@ -304,7 +304,7 @@
type: 'Line',
position: Vec3.sum(this.bowProperties.position, BOTTOM_NOTCH_OFFSET),
dimensions: LINE_DIMENSIONS,
collisionsWillMove: false,
dynamic: false,
ignoreForCollisions: true,
userData: JSON.stringify({
grabbableKey: {
@ -389,7 +389,7 @@
position: Vec3.sum(this.bowProperties.position, TOP_NOTCH_OFFSET),
dimensions: LINE_DIMENSIONS,
visible: true,
collisionsWillMove: false,
dynamic: false,
ignoreForCollisions: true,
userData: JSON.stringify({
grabbableKey: {
@ -538,7 +538,7 @@
//make the arrow physical, give it gravity, a lifetime, and set our velocity
var arrowProperties = {
collisionsWillMove: true,
dynamic: true,
ignoreForCollisions: false,
collisionMask: "static,dynamic,otherAvatar", // workaround: not with kinematic --> no collision with bow
velocity: releaseVelocity,

View file

@ -39,7 +39,7 @@ var bow = Entities.addEntity({
modelURL: MODEL_URL,
position: center,
dimensions: BOW_DIMENSIONS,
collisionsWillMove: true,
dynamic: true,
gravity: BOW_GRAVITY,
shapeType: 'compound',
compoundShapeURL: COLLISION_HULL_URL,
@ -68,4 +68,4 @@ function cleanup() {
Entities.deleteEntity(bow);
}
Script.scriptEnding.connect(cleanup);
Script.scriptEnding.connect(cleanup);

View file

@ -41,7 +41,7 @@ var wand = Entities.addEntity({
z: 0.05
},
//must be enabled to be grabbable in the physics engine
collisionsWillMove: true,
dynamic: true,
compoundShapeURL: WAND_COLLISION_SHAPE,
script: WAND_SCRIPT_URL,
userData: JSON.stringify({

View file

@ -71,7 +71,7 @@
addCollisionsToBubbleAfterCreation: function(bubble) {
//if the bubble collide immediately, we get weird effects. so we add collisions after release
Entities.editEntity(bubble, {
collisionsWillMove: true
dynamic: true
});
},
randomizeBubbleGravity: function() {
@ -161,7 +161,7 @@
modelURL: BUBBLE_MODEL,
position: this.getWandTipPosition(properties),
dimensions: BUBBLE_INITIAL_DIMENSIONS,
collisionsWillMove: false,
dynamic: false,
ignoreForCollisions: true,
damping: BUBBLE_LINEAR_DAMPING,
shapeType: "sphere"
@ -198,4 +198,4 @@
return new BubbleWand();
});
});

View file

@ -47,7 +47,7 @@ function createDoll() {
y: 0,
z: 0
},
collisionsWillMove: true,
dynamic: true,
userData: JSON.stringify({
grabbableKey: {
invertSolidWhileHeld: true
@ -57,4 +57,4 @@ function createDoll() {
return doll;
}
createDoll();
createDoll();

View file

@ -33,7 +33,7 @@ var flashlight = Entities.addEntity({
y: 0.30,
z: 0.08
},
collisionsWillMove: true,
dynamic: true,
shapeType: 'box',
script: scriptURL,
userData: JSON.stringify({
@ -41,4 +41,4 @@ var flashlight = Entities.addEntity({
invertSolidWhileHeld: true
}
})
});
});

View file

@ -34,7 +34,7 @@ var pingPongGun = Entities.addEntity({
y: 0.21,
z: 0.47
},
collisionsWillMove: true,
dynamic: true,
collisionSoundURL: COLLISION_SOUND_URL,
userData: JSON.stringify({
grabbableKey: {
@ -54,4 +54,4 @@ var pingPongGun = Entities.addEntity({
function cleanUp() {
Entities.deleteEntity(pingPongGun);
}
Script.scriptEnding.connect(cleanUp);
Script.scriptEnding.connect(cleanUp);

View file

@ -55,7 +55,7 @@ var targetIntervalClearer = Entities.addEntity({
},
rotation: rotation,
visible: false,
collisionsWillMove: false,
dynamic: false,
ignoreForCollisions: true,
});
@ -89,7 +89,7 @@ function addTargets() {
type: 'Model',
modelURL: MODEL_URL,
shapeType: 'compound',
collisionsWillMove: true,
dynamic: true,
dimensions: TARGET_DIMENSIONS,
compoundShapeURL: COLLISION_HULL_URL,
position: position,
@ -122,7 +122,7 @@ function testTargetDistanceFromStart() {
type: 'Model',
modelURL: MODEL_URL,
shapeType: 'compound',
collisionsWillMove: true,
dynamic: true,
dimensions: TARGET_DIMENSIONS,
compoundShapeURL: COLLISION_HULL_URL,
position: originalPositions[index],
@ -167,4 +167,4 @@ function atEnd() {
deleteTargets();
}
Script.scriptEnding.connect(atEnd);
Script.scriptEnding.connect(atEnd);

View file

@ -126,7 +126,7 @@
damping: BALL_LINEAR_DAMPING,
gravity: BALL_GRAVITY,
restitution: BALL_RESTITUTION,
collisionsWillMove: true,
dynamic: true,
rotation: gunProperties.rotation,
position: this.getGunTipPosition(gunProperties),
velocity: forwardVec,

View file

@ -19,7 +19,7 @@ var pistol = Entities.addEntity({
blue: 20
},
shapeType: 'box',
collisionsWillMove: true,
dynamic: true,
gravity: {x: 0, y: -5.0, z: 0},
restitution: 0,
collisionSoundURL: "https://s3.amazonaws.com/hifi-public/sounds/Guns/Gun_Drop_and_Metalli_1.wav",
@ -43,4 +43,4 @@ function cleanup() {
Entities.deleteEntity(pistol);
}
Script.scriptEnding.connect(cleanup);
Script.scriptEnding.connect(cleanup);

View file

@ -153,8 +153,8 @@
});
}, randFloat(10, 200));
}
if (intersection.properties.collisionsWillMove === 1) {
// Any entity with collisions will move can be shot
if (intersection.properties.dynamic === 1) {
// Any dynaic entity can be shot
Entities.editEntity(intersection.entityID, {
velocity: Vec3.multiply(this.firingDirection, this.bulletForce)
});
@ -359,4 +359,4 @@
// entity scripts always need to return a newly constructed object of our type
return new Pistol();
});
});

View file

@ -12,7 +12,7 @@
Script.include("cookies.js");
var MENU = "Developer>Render>Debug Deferred Buffer";
var ACTIONS = ["Off", "Diffuse", "AmbientOcclusion", "Specular", "Roughness", "Normal", "Depth", "Lighting", "PyramidDepth", "OcclusionRaw", "OcclusionBlurred", "Custom"];
var ACTIONS = ["Off", "Diffuse", "Metallic", "Roughness", "Normal", "Depth", "Lighting", "PyramidDepth", "AmbientOcclusion", "OcclusionRaw", "OcclusionBlurred", "Custom"];
var SETTINGS_KEY = "EngineDebugScript.DebugMode";
Number.prototype.clamp = function(min, max) {

View file

@ -62,7 +62,7 @@ function initMonsters() {
y: 1.6,
z: 0.07
},
collisionsWillMove: true,
dynamic: true,
shapeType: 'box',
velocity: {
x: randFloat(1, 3),
@ -114,4 +114,4 @@ function cleanup() {
});
}
Script.scriptEnding.connect(cleanup);
Script.scriptEnding.connect(cleanup);

View file

@ -37,7 +37,7 @@
modelURL: MODEL_URL,
position: MyAvatar.position,
dimensions: {x: 0.04, y: 1.3, z: 0.21},
collisionsWillMove: true,
dynamic: true,
gravity: {x: 0, y: 0, z: 0},
shapeType: 'compound',
compoundShapeURL: COLLISION_HULL_URL,

View file

@ -157,7 +157,7 @@ var onTargetHit = function(targetEntity, projectileEntity, collision) {
parentID: targetEntity
});
Entities.editEntity(targetEntity, {
collisionsWillMove: true,
dynamic: true,
gravity: {x: 0, y: GRAVITY, z: 0},
velocity: {x: 0, y: -0.01, z: 0}
});

View file

@ -12,37 +12,37 @@ import Hifi 1.0
import QtQuick 2.4
import "controls"
import "styles"
import "windows"
DialogContainer {
Window {
id: root
HifiConstants { id: hifi }
z: 1000
anchors.centerIn: parent
objectName: "AddressBarDialog"
property bool destroyOnInvisible: false
property real scale: 1.25 // Make this dialog a little larger than normal
destroyOnInvisible: false
resizable: false
scale: 1.25 // Make this dialog a little larger than normal
implicitWidth: addressBarDialog.implicitWidth
implicitHeight: addressBarDialog.implicitHeight
x: parent ? parent.width / 2 - width / 2 : 0
y: parent ? parent.height / 2 - height / 2 : 0
property int maximumX: parent ? parent.width - width : 0
property int maximumY: parent ? parent.height - height : 0
Rectangle {
id: dragRegion
visible: dragMouseArea.containsMouse
}
width: addressBarDialog.implicitWidth
height: addressBarDialog.implicitHeight
AddressBarDialog {
id: addressBarDialog
z: dragRegion.z + 1
implicitWidth: backgroundImage.width
implicitHeight: backgroundImage.height
Timer {
running: root.visible
interval: 500
repeat: true
onTriggered: {
if (root.enabled && !addressLine.activeFocus) {
addressLine.forceActiveFocus()
}
}
}
Image {
id: backgroundImage
@ -52,45 +52,9 @@ DialogContainer {
property int inputAreaHeight: 56.0 * root.scale // Height of the background's input area
property int inputAreaStep: (height - inputAreaHeight) / 2
MouseArea {
id: dragMouseArea
// Drag the icon
width: parent.height
height: parent.height
x: 0
y: 0
hoverEnabled: true
drag {
target: root
minimumX: -parent.inputAreaStep
minimumY: -parent.inputAreaStep
maximumX: root.parent ? root.maximumX : 0
maximumY: root.parent ? root.maximumY + parent.inputAreaStep : 0
}
}
MouseArea {
// Drag the input rectangle
width: parent.width - parent.height
height: parent.inputAreaHeight
x: parent.height
y: parent.inputAreaStep
drag {
target: root
minimumX: -parent.inputAreaStep
minimumY: -parent.inputAreaStep
maximumX: root.parent ? root.maximumX : 0
maximumY: root.parent ? root.maximumY + parent.inputAreaStep : 0
}
}
Image {
id: backArrow
source: addressBarDialog.backEnabled ? "../images/left-arrow.svg" : "../images/left-arrow-disabled.svg"
anchors {
fill: parent
leftMargin: parent.height + hifi.layout.spacing + 6
@ -110,9 +74,7 @@ DialogContainer {
Image {
id: forwardArrow
source: addressBarDialog.forwardEnabled ? "../images/right-arrow.svg" : "../images/right-arrow-disabled.svg"
anchors {
fill: parent
leftMargin: parent.height + hifi.layout.spacing * 9
@ -130,6 +92,7 @@ DialogContainer {
}
}
// FIXME replace with TextField
TextInput {
id: addressLine
@ -139,61 +102,35 @@ DialogContainer {
rightMargin: hifi.layout.spacing * 2
topMargin: parent.inputAreaStep + hifi.layout.spacing
bottomMargin: parent.inputAreaStep + hifi.layout.spacing
}
font.pixelSize: hifi.fonts.pixelSize * root.scale * 0.75
helperText: "Go to: place, @user, /path, network address"
onAccepted: {
event.accepted = true // Generates erroneous error in program log, "ReferenceError: event is not defined".
addressBarDialog.loadAddress(addressLine.text)
}
}
}
}
onEnabledChanged: {
if (enabled) {
addressLine.forceActiveFocus()
}
}
Timer {
running: root.enabled
interval: 500
repeat: true
onTriggered: {
if (root.enabled && !addressLine.activeFocus) {
addressLine.forceActiveFocus()
}
}
}
onVisibleChanged: {
if (!visible) {
if (visible) {
addressLine.forceActiveFocus()
} else {
addressLine.text = ""
}
}
function toggleOrGo() {
if (addressLine.text == "") {
enabled = false
} else {
if (addressLine.text != "") {
addressBarDialog.loadAddress(addressLine.text)
}
root.close();
}
Keys.onPressed: {
switch (event.key) {
case Qt.Key_Escape:
case Qt.Key_Back:
if (enabled) {
enabled = false
event.accepted = true
}
root.close()
event.accepted = true
break
case Qt.Key_Enter:
case Qt.Key_Return:

View file

@ -12,23 +12,23 @@ Window {
title: "Browser"
resizable: true
destroyOnInvisible: true
width: 800
height: 600
Component.onCompleted: {
enabled = true
visible = true
addressBar.text = webview.url
}
onParentChanged: {
if (visible && enabled) {
if (visible) {
addressBar.forceActiveFocus();
addressBar.selectAll()
}
}
Item {
width: 800
height: 600
anchors.fill: parent
Rectangle {
anchors.left: parent.left
anchors.right: parent.right

View file

@ -1,112 +0,0 @@
//
// ErrorDialog.qml
//
// Created by David Rowe on 30 May 2015
// Copyright 2015 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
//
import Hifi 1.0
import QtQuick 2.4
import "controls"
import "styles"
DialogContainer {
id: root
HifiConstants { id: hifi }
Component.onCompleted: {
enabled = true
}
onParentChanged: {
if (visible && enabled) {
forceActiveFocus()
}
}
implicitWidth: content.implicitWidth
implicitHeight: content.implicitHeight
x: parent ? parent.width / 2 - width / 2 : 0
y: parent ? parent.height / 2 - height / 2 : 0
ErrorDialog {
id: content
implicitWidth: box.width
implicitHeight: icon.height + hifi.layout.spacing * 2
Border {
id: box
width: 512
color: "#ebebeb"
radius: 2
border.width: 1
border.color: "#000000"
Image {
id: icon
source: "../images/address-bar-error-icon.svg"
width: 40
height: 40
anchors {
left: parent.left
leftMargin: hifi.layout.spacing
verticalCenter: parent.verticalCenter
}
}
Text {
id: messageText
font.pixelSize: hifi.fonts.pixelSize * 0.6
font.weight: Font.Bold
anchors {
horizontalCenter: parent.horizontalCenter
verticalCenter: parent.verticalCenter
}
text: content.text
}
Image {
source: "../images/address-bar-error-close.svg"
width: 20
height: 20
anchors {
right: parent.right
rightMargin: hifi.layout.spacing * 2
verticalCenter: parent.verticalCenter
}
MouseArea {
anchors.fill: parent
cursorShape: "PointingHandCursor"
onClicked: {
content.accept()
}
}
}
}
}
Keys.onPressed: {
if (!enabled) {
return
}
switch (event.key) {
case Qt.Key_Escape:
case Qt.Key_Back:
case Qt.Key_Enter:
case Qt.Key_Return:
event.accepted = true
content.accept()
break
}
}
}

View file

@ -1,179 +0,0 @@
var OFFSCREEN_ROOT_OBJECT_NAME = "desktopRoot"
var OFFSCREEN_WINDOW_OBJECT_NAME = "topLevelWindow"
function findChild(item, name) {
for (var i = 0; i < item.children.length; ++i) {
if (item.children[i].objectName === name) {
return item.children[i];
}
}
return null;
}
function findParentMatching(item, predicate) {
while (item) {
if (predicate(item)) {
break;
}
item = item.parent;
}
return item;
}
function findParentByName(item, name) {
return findParentMatching(item, function(item) {
var testName = name;
var result = (item.name === testName);
return result;
});
}
function findRootMenu(item) {
item = getDesktop(item);
return item ? item.rootMenu : null;
}
function isDesktop(item) {
return item.desktopRoot;
}
function isTopLevelWindow(item) {
return item.topLevelWindow;
}
function getTopLevelWindows(item) {
var desktop = getDesktop(item);
var currentWindows = [];
if (!desktop) {
console.log("Could not find desktop for " + item)
return currentWindows;
}
for (var i = 0; i < desktop.children.length; ++i) {
var child = desktop.children[i];
if (isTopLevelWindow(child)) {
var windowId = child.toString();
currentWindows.push(child)
}
}
return currentWindows;
}
function getDesktop(item) {
return findParentMatching(item, isDesktop);
}
function getDesktopWindow(item) {
return findParentMatching(item, isTopLevelWindow)
}
function closeWindow(item) {
item = findDialog(item);
if (item) {
item.enabled = false
} else {
console.warn("Could not find top level dialog")
}
}
function findMenuChild(menu, childName) {
if (!menu) {
return null;
}
if (menu.type !== 2) {
console.warn("Tried to find child of a non-menu");
return null;
}
var items = menu.items;
var count = items.length;
for (var i = 0; i < count; ++i) {
var child = items[i];
var name;
switch (child.type) {
case 2:
name = child.title;
break;
case 1:
name = child.text;
break;
default:
break;
}
if (name && name === childName) {
return child;
}
}
}
function findMenu(rootMenu, path) {
if ('string' === typeof(path)) {
path = [ path ]
}
var currentMenu = rootMenu;
for (var i = 0; currentMenu && i < path.length; ++i) {
currentMenu = findMenuChild(currentMenu, path[i]);
}
return currentMenu;
}
function findInRootMenu(item, path) {
return findMenu(findRootMenu(item), path);
}
function menuItemsToListModel(parent, items) {
var newListModel = Qt.createQmlObject('import QtQuick 2.5; ListModel {}', parent);
for (var i = 0; i < items.length; ++i) {
var item = items[i];
switch (item.type) {
case 2:
newListModel.append({"type":item.type, "name": item.title, "item": item})
break;
case 1:
newListModel.append({"type":item.type, "name": item.text, "item": item})
break;
case 0:
newListModel.append({"type":item.type, "name": "-----", "item": item})
break;
}
}
return newListModel;
}
function raiseWindow(item) {
var targetWindow = getDesktopWindow(item);
if (!targetWindow) {
console.warn("Could not find top level window for " + item);
return;
}
var desktop = getDesktop(targetWindow);
if (!desktop) {
console.warn("Could not find desktop for window " + targetWindow);
return;
}
var maxZ = 0;
var minZ = 100000;
var windows = desktop.windows;
windows.sort(function(a, b){
return a.z - b.z;
});
var lastZ = -1;
var lastTargetZ = -1;
for (var i = 0; i < windows.length; ++i) {
var window = windows[i];
if (window.z > lastZ) {
lastZ = window.z;
++lastTargetZ;
}
window.z = lastTargetZ;
}
targetWindow.z = lastTargetZ + 1;
}

View file

@ -1,11 +1,10 @@
import QtQuick 2.5
import Hifi 1.0 as Hifi
import QtQuick 2.3
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.3
import QtWebEngine 1.1
import "controls"
VrDialog {
import "controls"
import "windows" as Windows
Windows.Window {
id: root
width: 800
height: 800
@ -13,12 +12,10 @@ VrDialog {
Hifi.InfoView {
id: infoView
// Fille the client area
// Fill the client area
anchors.fill: parent
anchors.margins: parent.margins
anchors.topMargin: parent.topMargin
WebEngineView {
WebView {
id: webview
objectName: "WebView"
anchors.fill: parent

View file

@ -12,29 +12,23 @@ import Hifi 1.0
import QtQuick 2.4
import "controls"
import "styles"
import "windows"
DialogContainer {
Window {
id: root
HifiConstants { id: hifi }
objectName: "LoginDialog"
property bool destroyOnInvisible: false
implicitWidth: loginDialog.implicitWidth
implicitHeight: loginDialog.implicitHeight
x: parent ? parent.width / 2 - width / 2 : 0
y: parent ? parent.height / 2 - height / 2 : 0
property int maximumX: parent ? parent.width - width : 0
property int maximumY: parent ? parent.height - height : 0
height: loginDialog.implicitHeight
width: loginDialog.implicitWidth
// FIXME make movable
anchors.centerIn: parent
destroyOnInvisible: false
visible: false
LoginDialog {
id: loginDialog
implicitWidth: backgroundRectangle.width
implicitHeight: backgroundRectangle.height
readonly property int inputWidth: 500
readonly property int inputHeight: 60
readonly property int borderWidth: 30
@ -47,46 +41,8 @@ DialogContainer {
width: loginDialog.inputWidth + loginDialog.borderWidth * 2
height: loginDialog.inputHeight * 6 + loginDialog.closeMargin * 2
radius: loginDialog.closeMargin * 2
color: "#2c86b1"
opacity: 0.85
MouseArea {
width: parent.width
height: parent.height
anchors {
horizontalCenter: parent.horizontalCenter
verticalCenter: parent.verticalCenter
}
drag {
target: root
minimumX: 0
minimumY: 0
maximumX: root.parent ? root.maximumX : 0
maximumY: root.parent ? root.maximumY : 0
}
}
}
Image {
id: closeIcon
source: "../images/login-close.svg"
width: 20
height: 20
anchors {
top: backgroundRectangle.top
right: backgroundRectangle.right
topMargin: loginDialog.closeMargin
rightMargin: loginDialog.closeMargin
}
MouseArea {
anchors.fill: parent
cursorShape: "PointingHandCursor"
onClicked: {
root.enabled = false
}
}
}
Column {
@ -324,18 +280,13 @@ DialogContainer {
}
}
onOpacityChanged: {
// Set focus once animation is completed so that focus is set at start-up when not logged in
if (opacity == 1.0) {
username.forceActiveFocus()
}
}
onVisibleChanged: {
if (!visible) {
username.text = ""
password.text = ""
loginDialog.statusText = ""
} else {
username.forceActiveFocus()
}
}
@ -343,11 +294,10 @@ DialogContainer {
switch (event.key) {
case Qt.Key_Escape:
case Qt.Key_Back:
if (enabled) {
enabled = false
event.accepted = true
}
break
root.close();
event.accepted = true;
break;
case Qt.Key_Enter:
case Qt.Key_Return:
if (username.activeFocus) {

View file

@ -1,45 +0,0 @@
import Hifi 1.0
import QtQuick 2.3
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.3
import QtWebEngine 1.1
import "controls"
VrDialog {
title: "Test Dlg"
id: testDialog
objectName: "Browser"
width: 720
height: 720
resizable: true
MarketplaceDialog {
id: marketplaceDialog
}
Item {
id: clientArea
// The client area
anchors.fill: parent
anchors.margins: parent.margins
anchors.topMargin: parent.topMargin
WebEngineView {
objectName: "WebView"
id: webview
url: "https://metaverse.highfidelity.com/marketplace"
anchors.fill: parent
onNavigationRequested: {
console.log(request.url)
if (!marketplaceDialog.navigationRequested(request.url)) {
console.log("Application absorbed the request")
request.action = WebView.IgnoreRequest;
return;
}
console.log("Application passed on the request")
request.action = WebView.AcceptRequest;
return;
}
}
}
}

View file

@ -1,337 +0,0 @@
import Hifi 1.0 as Hifi
import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Dialogs 1.2
import "controls"
import "styles"
VrDialog {
id: root
HifiConstants { id: hifi }
property real spacing: hifi.layout.spacing
property real outerSpacing: hifi.layout.spacing * 2
destroyOnCloseButton: true
destroyOnInvisible: true
contentImplicitWidth: content.implicitWidth
contentImplicitHeight: content.implicitHeight
Component.onCompleted: {
enabled = true
}
onParentChanged: {
if (visible && enabled) {
forceActiveFocus();
}
}
Hifi.MessageDialog {
id: content
clip: true
x: root.clientX
y: root.clientY
implicitHeight: contentColumn.implicitHeight + outerSpacing * 2
implicitWidth: mainText.implicitWidth + outerSpacing * 2
Component.onCompleted: {
root.title = title
}
onTitleChanged: {
root.title = title
}
Column {
anchors.fill: parent
anchors.margins: 8
id: contentColumn
spacing: root.outerSpacing
Item {
width: parent.width
height: Math.max(icon.height, mainText.height + informativeText.height + root.spacing)
FontAwesome {
id: icon
width: content.icon ? 48 : 0
height: content.icon ? 48 : 0
visible: content.icon ? true : false
font.pixelSize: 48
verticalAlignment: Text.AlignTop
horizontalAlignment: Text.AlignLeft
color: iconColor()
text: iconSymbol()
function iconSymbol() {
switch (content.icon) {
case Hifi.MessageDialog.Information:
return "\uF05A"
case Hifi.MessageDialog.Question:
return "\uF059"
case Hifi.MessageDialog.Warning:
return "\uF071"
case Hifi.MessageDialog.Critical:
return "\uF057"
default:
break;
}
return content.icon;
}
function iconColor() {
switch (content.icon) {
case Hifi.MessageDialog.Information:
case Hifi.MessageDialog.Question:
return "blue"
case Hifi.MessageDialog.Warning:
case Hifi.MessageDialog.Critical:
return "red"
default:
break
}
return "black"
}
}
Text {
id: mainText
anchors {
left: icon.right
leftMargin: root.spacing
right: parent.right
}
text: content.text
font.pointSize: 14
font.weight: Font.Bold
wrapMode: Text.WordWrap
}
Text {
id: informativeText
anchors {
left: icon.right
right: parent.right
top: mainText.bottom
leftMargin: root.spacing
topMargin: root.spacing
}
text: content.informativeText
font.pointSize: 14
wrapMode: Text.WordWrap
}
}
Flow {
id: buttons
spacing: root.spacing
layoutDirection: Qt.RightToLeft
width: parent.width
Button {
id: okButton
text: qsTr("OK")
onClicked: content.click(StandardButton.Ok)
visible: content.standardButtons & StandardButton.Ok
}
Button {
id: openButton
text: qsTr("Open")
onClicked: content.click(StandardButton.Open)
visible: content.standardButtons & StandardButton.Open
}
Button {
id: saveButton
text: qsTr("Save")
onClicked: content.click(StandardButton.Save)
visible: content.standardButtons & StandardButton.Save
}
Button {
id: saveAllButton
text: qsTr("Save All")
onClicked: content.click(StandardButton.SaveAll)
visible: content.standardButtons & StandardButton.SaveAll
}
Button {
id: retryButton
text: qsTr("Retry")
onClicked: content.click(StandardButton.Retry)
visible: content.standardButtons & StandardButton.Retry
}
Button {
id: ignoreButton
text: qsTr("Ignore")
onClicked: content.click(StandardButton.Ignore)
visible: content.standardButtons & StandardButton.Ignore
}
Button {
id: applyButton
text: qsTr("Apply")
onClicked: content.click(StandardButton.Apply)
visible: content.standardButtons & StandardButton.Apply
}
Button {
id: yesButton
text: qsTr("Yes")
onClicked: content.click(StandardButton.Yes)
visible: content.standardButtons & StandardButton.Yes
}
Button {
id: yesAllButton
text: qsTr("Yes to All")
onClicked: content.click(StandardButton.YesToAll)
visible: content.standardButtons & StandardButton.YesToAll
}
Button {
id: noButton
text: qsTr("No")
onClicked: content.click(StandardButton.No)
visible: content.standardButtons & StandardButton.No
}
Button {
id: noAllButton
text: qsTr("No to All")
onClicked: content.click(StandardButton.NoToAll)
visible: content.standardButtons & StandardButton.NoToAll
}
Button {
id: discardButton
text: qsTr("Discard")
onClicked: content.click(StandardButton.Discard)
visible: content.standardButtons & StandardButton.Discard
}
Button {
id: resetButton
text: qsTr("Reset")
onClicked: content.click(StandardButton.Reset)
visible: content.standardButtons & StandardButton.Reset
}
Button {
id: restoreDefaultsButton
text: qsTr("Restore Defaults")
onClicked: content.click(StandardButton.RestoreDefaults)
visible: content.standardButtons & StandardButton.RestoreDefaults
}
Button {
id: cancelButton
text: qsTr("Cancel")
onClicked: content.click(StandardButton.Cancel)
visible: content.standardButtons & StandardButton.Cancel
}
Button {
id: abortButton
text: qsTr("Abort")
onClicked: content.click(StandardButton.Abort)
visible: content.standardButtons & StandardButton.Abort
}
Button {
id: closeButton
text: qsTr("Close")
onClicked: content.click(StandardButton.Close)
visible: content.standardButtons & StandardButton.Close
}
Button {
id: moreButton
text: qsTr("Show Details...")
onClicked: content.state = (content.state === "" ? "expanded" : "")
visible: content.detailedText.length > 0
}
Button {
id: helpButton
text: qsTr("Help")
onClicked: content.click(StandardButton.Help)
visible: content.standardButtons & StandardButton.Help
}
}
}
Item {
id: details
width: parent.width
implicitHeight: detailedText.implicitHeight + root.spacing
height: 0
clip: true
anchors {
left: parent.left
right: parent.right
top: contentColumn.bottom
topMargin: root.spacing
leftMargin: root.outerSpacing
rightMargin: root.outerSpacing
}
Flickable {
id: flickable
contentHeight: detailedText.height
anchors.fill: parent
anchors.topMargin: root.spacing
anchors.bottomMargin: root.outerSpacing
TextEdit {
id: detailedText
text: content.detailedText
width: details.width
wrapMode: Text.WordWrap
readOnly: true
selectByMouse: true
}
}
}
states: [
State {
name: "expanded"
PropertyChanges {
target: details
height: root.height - contentColumn.height - root.spacing - root.outerSpacing
}
PropertyChanges {
target: content
implicitHeight: contentColumn.implicitHeight + root.spacing * 2 +
detailedText.implicitHeight + root.outerSpacing * 2
}
PropertyChanges {
target: moreButton
text: qsTr("Hide Details")
}
}
]
}
Keys.onPressed: {
if (!enabled) {
return
}
if (event.modifiers === Qt.ControlModifier)
switch (event.key) {
case Qt.Key_A:
event.accepted = true
detailedText.selectAll()
break
case Qt.Key_C:
event.accepted = true
detailedText.copy()
break
case Qt.Key_Period:
if (Qt.platform.os === "osx") {
event.accepted = true
content.reject()
}
break
} else switch (event.key) {
case Qt.Key_Escape:
case Qt.Key_Back:
event.accepted = true
content.reject()
break
case Qt.Key_Enter:
case Qt.Key_Return:
event.accepted = true
content.accept()
break
}
}
}

View file

@ -1,105 +0,0 @@
//
// Created by Bradley Austin Davis on 2015/11/14
// Copyright 2015 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
//
import Hifi 1.0
import QtQuick 2.4
import "controls"
import "styles"
VrDialog {
id: root
HifiConstants { id: hifi }
property real spacing: hifi.layout.spacing
property real outerSpacing: hifi.layout.spacing * 2
objectName: "RecorderDialog"
destroyOnInvisible: false
destroyOnCloseButton: false
contentImplicitWidth: recorderDialog.width
contentImplicitHeight: recorderDialog.height
RecorderDialog {
id: recorderDialog
x: root.clientX; y: root.clientY
width: 800
height: 128
signal play()
signal rewind()
onPlay: {
console.log("Pressed play")
player.isPlaying = !player.isPlaying
}
onRewind: {
console.log("Pressed rewind")
player.position = 0
}
Row {
height: 32
ButtonAwesome {
id: cmdRecord
visible: root.showRecordButton
width: 32; height: 32
text: "\uf111"
iconColor: "red"
onClicked: {
console.log("Pressed record")
status.text = "Recording";
}
}
}
Text {
id: status
anchors.top: parent.top
anchors.right: parent.right
width: 128
text: "Idle"
}
Player {
id: player
y: root.clientY + 64
height: 64
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
// onClicked: {
// if (recordTimer.running) {
// recordTimer.stop();
// }
// recordTimer.start();
// }
Timer {
id: recordTimer;
interval: 1000; running: false; repeat: false
onTriggered: {
console.log("Recording: " + MyAvatar.isRecording())
MyAvatar.startRecording();
console.log("Recording: " + MyAvatar.isRecording())
}
}
}
Component.onCompleted: {
player.play.connect(play)
player.rewind.connect(rewind)
}
}
}

View file

@ -1,14 +1,36 @@
import QtQuick 2.5
import QtQuick.Controls 1.4
import QtQuick.Dialogs 1.2 as OriginalDialogs;
import "Global.js" as Global
import "dialogs"
// This is our primary 'desktop' object to which all VR dialogs and
// windows will be childed.
Item {
// This is our primary 'desktop' object to which all VR dialogs and
// windows will be childed.
FocusScope {
id: desktop
anchors.fill: parent;
onParentChanged: forceActiveFocus();
// Debugging help for figuring out focus issues
property var offscreenWindow;
onOffscreenWindowChanged: offscreenWindow.activeFocusItemChanged.connect(onWindowFocusChanged);
function onWindowFocusChanged() {
console.log("Focus item is " + offscreenWindow.activeFocusItem);
var focusedItem = offscreenWindow.activeFocusItem ;
if (DebugQML && focusedItem) {
var rect = desktop.mapToItem(desktop, focusedItem.x, focusedItem.y, focusedItem.width, focusedItem.height);
focusDebugger.visible = true
focusDebugger.x = rect.x;
focusDebugger.y = rect.y;
focusDebugger.width = rect.width
focusDebugger.height = rect.height
}
}
Rectangle {
id: focusDebugger;
z: 9999; visible: false; color: "red"
ColorAnimation on color { from: "#7fffff00"; to: "#7f0000ff"; duration: 1000; loops: 9999 }
}
// Allows QML/JS to find the desktop through the parent chain
property bool desktopRoot: true
@ -16,16 +38,179 @@ Item {
// The VR version of the primary menu
property var rootMenu: Menu { objectName: "rootMenu" }
// List of all top level windows
property var windows: [];
onChildrenChanged: windows = Global.getTopLevelWindows(desktop);
// The tool window, one instance
property alias toolWindow: toolWindow
ToolWindow { id: toolWindow }
// FIXME support always on top flags
function raise(item) {
Global.raiseWindow(item);
d.raiseWindow(item);
}
Component {
id: messageDialogBuilder
MessageDialog { }
}
Component {
id: nativeMessageDialogBuilder
OriginalDialogs.MessageDialog { }
}
function messageBox(properties) {
// Debugging: native message dialog for comparison
// nativeMessageDialogBuilder.createObject(desktop, properties);
return messageDialogBuilder.createObject(desktop, properties);
}
QtObject {
id: d
readonly property int zBasisNormal: 0
readonly property int zBasisAlwaysOnTop: 4096
readonly property int zBasisModal: 8192
function findChild(item, name) {
for (var i = 0; i < item.children.length; ++i) {
if (item.children[i].objectName === name) {
return item.children[i];
}
}
return null;
}
function findParentMatching(item, predicate) {
while (item) {
if (predicate(item)) {
break;
}
item = item.parent;
}
return item;
}
function isDesktop(item) {
return item.desktopRoot;
}
function isTopLevelWindow(item) {
return item.topLevelWindow;
}
function isAlwaysOnTopWindow(window) {
return window.alwaysOnTop;
}
function isModalWindow(window) {
return window.modality !== Qt.NonModal;
}
function getTopLevelWindows(predicate) {
var currentWindows = [];
if (!desktop) {
console.log("Could not find desktop for " + item)
return currentWindows;
}
for (var i = 0; i < desktop.children.length; ++i) {
var child = desktop.children[i];
if (isTopLevelWindow(child) && (!predicate || predicate(child))) {
currentWindows.push(child)
}
}
return currentWindows;
}
function getDesktopWindow(item) {
return findParentMatching(item, isTopLevelWindow)
}
function fixupZOrder(windows, basis, topWindow) {
windows.sort(function(a, b){
return a.z - b.z;
});
if ((topWindow.z >= basis) && (windows[windows.length - 1] === topWindow)) {
return;
}
var lastZ = -1;
var lastTargetZ = basis - 1;
for (var i = 0; i < windows.length; ++i) {
var window = windows[i];
if (!window.visible) {
continue
}
if (topWindow && (topWindow === window)) {
continue
}
if (window.z > lastZ) {
lastZ = window.z;
++lastTargetZ;
}
if (DebugQML) {
console.log("Assigning z order " + lastTargetZ + " to " + window)
}
window.z = lastTargetZ;
}
if (topWindow) {
++lastTargetZ;
if (DebugQML) {
console.log("Assigning z order " + lastTargetZ + " to " + topWindow)
}
topWindow.z = lastTargetZ;
}
return lastTargetZ;
}
function raiseWindow(item) {
var targetWindow = getDesktopWindow(item);
if (!targetWindow) {
console.warn("Could not find top level window for " + item);
return;
}
if (!desktop) {
console.warn("Could not find desktop for window " + targetWindow);
return;
}
var predicate;
var zBasis;
if (isModalWindow(targetWindow)) {
predicate = isModalWindow;
zBasis = zBasisModal
} else if (isAlwaysOnTopWindow(targetWindow)) {
predicate = function(window) {
return (isAlwaysOnTopWindow(window) && !isModalWindow(window));
}
zBasis = zBasisAlwaysOnTop
} else {
predicate = function(window) {
return (!isAlwaysOnTopWindow(window) && !isModalWindow(window));
}
zBasis = zBasisNormal
}
var windows = getTopLevelWindows(predicate);
fixupZOrder(windows, zBasis, targetWindow);
}
}
function unfocusWindows() {
var windows = d.getTopLevelWindows();
for (var i = 0; i < windows.length; ++i) {
windows[i].focus = false;
}
desktop.focus = true;
}
}

View file

@ -188,6 +188,7 @@ Item {
visible: root.expanded;
text: "\tItems Rendered Opaque: " + root.opaqueRendered +
" / Translucent: " + root.translucentRendered +
" / Shadow: " + root.shadowRendered +
" / Other: " + root.otherRendered;
}
Text {
@ -198,6 +199,14 @@ Item {
" / Out of view: " + root.opaqueOutOfView +
" / Too small: " + root.opaqueTooSmall;
}
Text {
color: root.fontColor;
font.pixelSize: root.fontSize
visible: root.expanded;
text: "\tShadow considered: " + root.shadowConsidered +
" / Out of view: " + root.shadowOutOfView +
" / Too small: " + root.shadowTooSmall;
}
Text {
color: root.fontColor;
font.pixelSize: root.fontSize

View file

@ -15,6 +15,7 @@ Windows.Window {
destroyOnInvisible: false
closable: false
visible: false
width: 384; height: 640;
property string newTabSource
property alias tabView: tabView
onParentChanged: {
@ -43,7 +44,8 @@ Windows.Window {
}
TabView {
id: tabView; width: 384; height: 640;
anchors.fill: parent
id: tabView;
onCountChanged: {
if (0 == count) {
toolWindow.visible = false
@ -73,13 +75,37 @@ Windows.Window {
return i;
}
}
console.warn("Could not find tab for " + source);
return -1;
}
function findTabForUrl(source) {
var index = findIndexForUrl(source);
if (index < 0) {
return;
}
return tabView.getTab(index);
}
function showTabForUrl(source, newVisible) {
var index = findIndexForUrl(source);
if (index < 0) {
return;
}
var tab = tabView.getTab(index);
if (newVisible) {
toolWindow.visible = true
tab.enabled = true
} else {
tab.enabled = false;
updateVisiblity();
}
}
function removeTabForUrl(source) {
var index = findIndexForUrl(source);
if (index < 0) {
console.warn("Could not find tab for " + source);
return;
}
tabView.removeTab(index);

View file

@ -5,21 +5,16 @@ import QtQuick.Controls.Styles 1.3
import QtGraphicalEffects 1.0
import "controls"
import "styles"
import "windows"
DialogContainer {
Window {
id: root
HifiConstants { id: hifi }
objectName: "UpdateDialog"
implicitWidth: updateDialog.implicitWidth
implicitHeight: updateDialog.implicitHeight
x: parent ? parent.width / 2 - width / 2 : 0
y: parent ? parent.height / 2 - height / 2 : 0
property int maximumX: parent ? parent.width - width : 0
property int maximumY: parent ? parent.height - height : 0
width: updateDialog.implicitWidth
height: updateDialog.implicitHeight
resizable: false
anchors.centerIn: parent
UpdateDialog {
id: updateDialog

View file

@ -1,9 +1,27 @@
import QtQuick 2.3
import QtQuick.Controls 1.3 as Original
import QtQuick.Controls.Styles 1.3
import "."
import "../styles"
Original.Button {
style: ButtonStyle { }
style: ButtonStyle {
HifiConstants { id: hifi }
padding {
top: 8
left: 12
right: 12
bottom: 8
}
background: Border {
anchors.fill: parent
}
label: Text {
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
text: control.text
color: control.enabled ? hifi.colors.text : hifi.colors.disabledText
}
}
}

View file

@ -1,99 +0,0 @@
import QtQuick 2.3
import QtQuick.Controls 1.2
import "."
import "../styles"
Item {
id: root
objectName: "topLevelWindow"
HifiConstants { id: hifi }
implicitHeight: contentImplicitHeight + titleBorder.height + hifi.styles.borderWidth
implicitWidth: contentImplicitWidth + hifi.styles.borderWidth * 2
property string title
property int titleSize: titleBorder.height + 12
property string frameColor: hifi.colors.hifiBlue
property string backgroundColor: hifi.colors.dialogBackground
property bool active: false
property real contentImplicitWidth: 800
property real contentImplicitHeight: 800
property alias titleBorder: titleBorder
readonly property alias titleX: titleBorder.x
readonly property alias titleY: titleBorder.y
readonly property alias titleWidth: titleBorder.width
readonly property alias titleHeight: titleBorder.height
// readonly property real borderWidth: hifi.styles.borderWidth
readonly property real borderWidth: 0
property alias clientBorder: clientBorder
readonly property real clientX: clientBorder.x + borderWidth
readonly property real clientY: clientBorder.y + borderWidth
readonly property real clientWidth: clientBorder.width - borderWidth * 2
readonly property real clientHeight: clientBorder.height - borderWidth * 2
/*
* Window decorations, with a title bar and frames
*/
Border {
id: windowBorder
anchors.fill: parent
border.color: root.frameColor
border.width: 0
color: "#00000000"
Border {
id: titleBorder
height: hifi.layout.windowTitleHeight
anchors.right: parent.right
anchors.left: parent.left
border.color: root.frameColor
border.width: 0
clip: true
color: root.active ?
hifi.colors.activeWindow.headerBackground :
hifi.colors.inactiveWindow.headerBackground
Text {
id: titleText
color: root.active ?
hifi.colors.activeWindow.headerText :
hifi.colors.inactiveWindow.headerText
text: root.title
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
anchors.fill: parent
}
} // header border
// These two rectangles hide the curves between the title area
// and the client area
Rectangle {
y: titleBorder.height - titleBorder.radius
height: titleBorder.radius
width: titleBorder.width
color: titleBorder.color
visible: borderWidth == 0
}
Rectangle {
y: titleBorder.height
width: clientBorder.width
height: clientBorder.radius
color: clientBorder.color
}
Border {
id: clientBorder
border.width: 0
border.color: root.frameColor
color: root.backgroundColor
anchors.bottom: parent.bottom
anchors.top: titleBorder.bottom
anchors.topMargin: -titleBorder.border.width
anchors.right: parent.right
anchors.left: parent.left
} // client border
} // window border
}

View file

@ -1,65 +0,0 @@
//
// DialogCommon.qml
//
// Created by David Rowe on 3 Jun 2015
// Copyright 2015 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
//
import Hifi 1.0
import QtQuick 2.4
import "../styles"
Item {
id: root
property bool destroyOnInvisible: true
// The UI enables an object, rather than manipulating its visibility, so that we can do animations in both directions.
// Because visibility and enabled are booleans, they cannot be animated. So when enabled is changed, we modify a property
// that can be animated, like scale or opacity, and then when the target animation value is reached, we can modify the
// visibility.
enabled: false
opacity: 0.0
onEnabledChanged: {
opacity = enabled ? 1.0 : 0.0
}
Behavior on opacity {
// Animate opacity.
NumberAnimation {
duration: hifi.effects.fadeInDuration
easing.type: Easing.OutCubic
}
}
onOpacityChanged: {
// Once we're transparent, disable the dialog's visibility.
visible = (opacity != 0.0)
}
onVisibleChanged: {
if (!visible) {
// Some dialogs should be destroyed when they become invisible.
if (destroyOnInvisible) {
destroy()
}
}
}
Keys.onPressed: {
switch(event.key) {
case Qt.Key_W:
if (event.modifiers == Qt.ControlModifier) {
enabled = false
event.accepted = true
}
break
}
}
}

View file

@ -1,179 +0,0 @@
import QtQuick 2.3
import QtQuick.Controls 1.2
import "."
import "../styles"
/*
* FIXME Need to create a client property here so that objects can be
* placed in it without having to think about positioning within the outer
* window.
*
* Examine the QML ApplicationWindow.qml source for how it does this
*
*/
DialogBase {
id: root
HifiConstants { id: hifi }
// FIXME better placement via a window manager
x: parent ? parent.width / 2 - width / 2 : 0
y: parent ? parent.height / 2 - height / 2 : 0
property bool destroyOnInvisible: false
property bool destroyOnCloseButton: true
property bool resizable: false
property int animationDuration: hifi.effects.fadeInDuration
property int minX: 256
property int minY: 256
readonly property int topMargin: root.height - clientBorder.height + hifi.layout.spacing
/*
* Support for animating the dialog in and out.
*/
enabled: false
opacity: 1.0
// The offscreen UI will enable an object, rather than manipulating it's
// visibility, so that we can do animations in both directions. Because
// visibility and enabled are boolean flags, they cannot be animated. So when
// enabled is change, we modify a property that can be animated, like scale or
// opacity, and then when the target animation value is reached, we can
// modify the visibility
onEnabledChanged: {
opacity = enabled ? 1.0 : 0.0
// If the dialog is initially invisible, setting opacity doesn't
// trigger making it visible.
if (enabled) {
visible = true;
if (root.parent) {
Desktop.raise(root);
}
}
}
onParentChanged: {
if (enabled && parent) {
Global.raiseWindow(root);
}
}
// The actual animator
Behavior on opacity {
NumberAnimation {
duration: animationDuration
easing.type: Easing.OutCubic
}
}
// Once we're transparent, disable the dialog's visibility
onOpacityChanged: {
visible = (opacity != 0.0);
}
Component.onCompleted: {
if (visible) {
Global.raiseWindow(root);
}
}
// Some dialogs should be destroyed when they become invisible,
// so handle that
onVisibleChanged: {
if (!visible && destroyOnInvisible) {
destroy();
}
}
// our close function performs the same way as the OffscreenUI class:
// don't do anything but manipulate the enabled flag and let the other
// mechanisms decide if the window should be destroyed after the close
// animation completes
function close() {
if (destroyOnCloseButton) {
destroyOnInvisible = true
}
enabled = false;
}
/*
* Resize support
*/
function deltaSize(dx, dy) {
width = Math.max(width + dx, minX)
height = Math.max(height + dy, minY)
}
MouseArea {
id: sizeDrag
enabled: root.resizable
property int startX
property int startY
anchors.right: parent.right
anchors.bottom: parent.bottom
width: 16
height: 16
z: 1000
hoverEnabled: true
onPressed: {
startX = mouseX
startY = mouseY
}
onPositionChanged: {
if (pressed) {
root.deltaSize((mouseX - startX), (mouseY - startY))
startX = mouseX
startY = mouseY
}
}
}
MouseArea {
id: titleDrag
x: root.titleX
y: root.titleY
width: root.titleWidth
height: root.titleHeight
onClicked: Global.raiseWindow(root)
drag {
target: root
minimumX: 0
minimumY: 0
maximumX: root.parent ? root.parent.width - root.width : 0
maximumY: root.parent ? root.parent.height - root.height : 0
}
Row {
id: windowControls
anchors.bottom: parent.bottom
anchors.top: parent.top
anchors.right: parent.right
anchors.rightMargin: hifi.layout.spacing
FontAwesome {
id: icon
anchors.verticalCenter: parent.verticalCenter
size: root.titleHeight - hifi.layout.spacing * 2
color: "red"
text: "\uf00d"
MouseArea {
anchors.margins: hifi.layout.spacing / 2
anchors.fill: parent
onClicked: {
root.close();
}
}
}
}
}
Keys.onPressed: {
switch(event.key) {
case Qt.Key_W:
if (event.modifiers == Qt.ControlModifier) {
event.accepted = true
enabled = false
}
break;
}
}
}

View file

@ -4,17 +4,200 @@ import Qt.labs.folderlistmodel 2.1
import Qt.labs.settings 1.0
import ".."
import "."
import "../windows"
import "../styles"
// Work in progress....
DialogBase {
Window {
id: root
Constants { id: vr }
property string settingsName: ""
HifiConstants { id: hifi }
signal selectedFile(var file);
signal canceled();
anchors.centerIn: parent
resizable: true
width: 640
height: 480
modality: Qt.ApplicationModal
property string settingsName: ""
property alias folder: folderModel.folder
property alias filterModel: selectionType.model
Rectangle {
anchors.fill: parent
color: "white"
Settings {
// fixme, combine with a property to allow different saved locations
category: "FileOpenLastFolder." + settingsName
property alias folder: folderModel.folder
}
TextField {
id: currentDirectory
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
anchors.margins: 8
readOnly: true
text: folderModel.folder
}
Component {
id: fileItemDelegate
Item {
clip: true
Text {
x: 3
id: columnText
anchors.verticalCenter: parent.verticalCenter
// font.pointSize: 12
color: tableView.activeFocus && styleData.row === tableView.currentRow ? "yellow" : styleData.textColor
elide: styleData.elideMode
text: getText();
font.italic: folderModel.get(styleData.row, "fileIsDir") ? true : false
Connections {
target: tableView
//onCurrentRowChanged: columnText.color = (tableView.activeFocus && styleData.row === tableView.currentRow ? "yellow" : styleData.textColor)
}
function getText() {
switch (styleData.column) {
//case 1: return Date.fromLocaleString(locale, styleData.value, "yyyy-MM-dd hh:mm:ss");
case 2: return folderModel.get(styleData.row, "fileIsDir") ? "" : formatSize(styleData.value);
default: return styleData.value;
}
}
function formatSize(size) {
var suffixes = [ "bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB" ];
var suffixIndex = 0
while ((size / 1024.0) > 1.1) {
size /= 1024.0;
++suffixIndex;
}
size = Math.round(size*1000)/1000;
size = size.toLocaleString()
return size + " " + suffixes[suffixIndex];
}
}
}
}
TableView {
id: tableView
focus: true
model: FolderListModel {
id: folderModel
showDotAndDotDot: true
showDirsFirst: true
onFolderChanged: {
tableView.currentRow = -1;
tableView.positionViewAtRow(0, ListView.Beginning)
}
}
anchors.top: currentDirectory.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: selectionType.top
anchors.margins: 8
itemDelegate: fileItemDelegate
// rowDelegate: Rectangle {
// id: rowDelegate
// color: styleData.selected ? "#7f0000ff" : "#00000000"
// Connections { target: folderModel; onFolderChanged: rowDelegate.visible = false }
// Connections { target: tableView; onCurrentRowChanged: rowDelegate.visible = true; }
// }
TableViewColumn {
role: "fileName"
title: "Name"
width: 400
}
TableViewColumn {
role: "fileModified"
title: "Date Modified"
width: 200
}
TableViewColumn {
role: "fileSize"
title: "Size"
width: 200
}
Keys.onReturnPressed: selectCurrentFile();
onDoubleClicked: { currentRow = row; selectCurrentFile(); }
onCurrentRowChanged: currentSelection.text = model.get(currentRow, "fileName");
KeyNavigation.left: cancelButton
KeyNavigation.right: selectionType
}
TextField {
id: currentSelection
anchors.right: selectionType.left
anchors.rightMargin: 8
anchors.left: parent.left
anchors.leftMargin: 8
anchors.top: selectionType.top
}
ComboBox {
id: selectionType
anchors.bottom: buttonRow.top
anchors.bottomMargin: 8
anchors.right: parent.right
anchors.rightMargin: 8
anchors.left: buttonRow.left
model: ListModel {
ListElement { text: "All Files (*.*)"; filter: "*.*" }
}
onCurrentIndexChanged: {
folderModel.nameFilters = [ filterModel.get(currentIndex).filter ]
}
KeyNavigation.left: tableView
KeyNavigation.right: openButton
}
Row {
id: buttonRow
anchors.right: parent.right
anchors.rightMargin: 8
anchors.bottom: parent.bottom
anchors.bottomMargin: 8
layoutDirection: Qt.RightToLeft
spacing: 8
Button {
id: cancelButton
text: "Cancel"
KeyNavigation.up: selectionType
KeyNavigation.left: openButton
KeyNavigation.right: tableView.contentItem
Keys.onReturnPressed: { canceled(); root.enabled = false }
onClicked: { canceled(); close() }
}
Button {
id: openButton
text: "Open"
enabled: tableView.currentRow != -1 && !folderModel.get(tableView.currentRow, "fileIsDir")
onClicked: selectCurrentFile();
Keys.onReturnPressed: selectCurrentFile();
KeyNavigation.up: selectionType
KeyNavigation.left: selectionType
KeyNavigation.right: cancelButton
}
}
}
function selectCurrentFile() {
var row = tableView.currentRow
console.log("Selecting row " + row)
@ -25,200 +208,11 @@ DialogBase {
folderModel.folder = folderModel.get(row, "fileURL");
} else {
selectedFile(folderModel.get(row, "fileURL"));
enabled = false
close();
}
}
property var folderModel: FolderListModel {
id: folderModel
showDotAndDotDot: true
showDirsFirst: true
folder: "file:///C:/";
onFolderChanged: tableView.currentRow = 0
}
property var filterModel: ListModel {
ListElement {
text: "All Files (*.*)"
filter: "*"
}
ListElement {
text: "Javascript Files (*.js)"
filter: "*.js"
}
ListElement {
text: "QML Files (*.qml)"
filter: "*.qml"
}
}
Settings {
// fixme, combine with a property to allow different saved locations
category: "FileOpenLastFolder." + settingsName
property alias folder: folderModel.folder
}
Rectangle {
id: currentDirectoryWrapper
anchors.left: parent.left
anchors.leftMargin: 8
anchors.right: parent.right
anchors.rightMargin: 8
anchors.top: parent.top
anchors.topMargin: 8
height: currentDirectory.implicitHeight + 8
radius: vr.styles.radius
color: vr.controls.colors.inputBackground
TextEdit {
enabled: false
id: currentDirectory
text: folderModel.folder
anchors {
fill: parent
leftMargin: 8
rightMargin: 8
topMargin: 4
bottomMargin: 4
}
}
}
TableView {
id: tableView
focus: true
model: folderModel
anchors.top: currentDirectoryWrapper.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: selectionType.top
anchors.margins: 8
itemDelegate: Item {
Text {
anchors.verticalCenter: parent.verticalCenter
font.family: vr.fonts.lightFontName
font.pointSize: 12
color: tableView.activeFocus && styleData.row === tableView.currentRow ? "yellow" : styleData.textColor
elide: styleData.elideMode
text: getText();
function getText() {
switch (styleData.column) {
//case 1: return Date.fromLocaleString(locale, styleData.value, "yyyy-MM-dd hh:mm:ss");
case 2: return folderModel.get(styleData.row, "fileIsDir") ? "" : formatSize(styleData.value);
default: return styleData.value;
}
}
function formatSize(size) {
var suffixes = [ "bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB" ];
var suffixIndex = 0
while ((size / 1024.0) > 1.1) {
size /= 1024.0;
++suffixIndex;
}
size = Math.round(size*1000)/1000;
size = size.toLocaleString()
return size + " " + suffixes[suffixIndex];
}
}
}
TableViewColumn {
role: "fileName"
title: "Name"
width: 400
}
TableViewColumn {
role: "fileModified"
title: "Date Modified"
width: 200
}
TableViewColumn {
role: "fileSize"
title: "Size"
width: 200
}
function selectItem(row) {
selectCurrentFile()
}
Keys.onReturnPressed: selectCurrentFile();
onDoubleClicked: { currentRow = row; selectCurrentFile(); }
onCurrentRowChanged: currentSelection.text = model.get(currentRow, "fileName");
KeyNavigation.left: cancelButton
KeyNavigation.right: selectionType
}
Rectangle {
anchors.right: selectionType.left
anchors.rightMargin: 8
anchors.top: selectionType.top
anchors.bottom: selectionType.bottom
anchors.left: parent.left
anchors.leftMargin: 8
radius: 8
color: "#eee"
Text {
id: currentSelection
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: 8
anchors.verticalCenter: parent.verticalCenter
font.family: vr.fonts.mainFontName
font.pointSize: 18
}
}
ComboBox {
id: selectionType
anchors.bottom: buttonRow.top
anchors.bottomMargin: 8
anchors.right: parent.right
anchors.rightMargin: 8
anchors.left: buttonRow.left
model: filterModel
onCurrentIndexChanged: folderModel.nameFilters = [
filterModel.get(currentIndex).filter
]
KeyNavigation.left: tableView
KeyNavigation.right: openButton
}
Row {
id: buttonRow
anchors.right: parent.right
anchors.rightMargin: 8
anchors.bottom: parent.bottom
anchors.bottomMargin: 8
layoutDirection: Qt.RightToLeft
spacing: 8
Button {
id: cancelButton
text: "Cancel"
KeyNavigation.up: selectionType
KeyNavigation.left: openButton
KeyNavigation.right: tableView.contentItem
Keys.onReturnPressed: { canceled(); root.enabled = false }
onClicked: { canceled(); root.enabled = false }
}
Button {
id: openButton
text: "Open"
enabled: tableView.currentRow != -1 && !folderModel.get(tableView.currentRow, "fileIsDir")
KeyNavigation.up: selectionType
KeyNavigation.left: selectionType
KeyNavigation.right: cancelButton
onClicked: selectCurrentFile();
Keys.onReturnPressed: selectedFile(folderModel.get(tableView.currentRow, "fileURL"))
}
}
Keys.onPressed: {
if (event.key === Qt.Key_Backspace && folderModel.parentFolder && folderModel.parentFolder != "") {

View file

@ -0,0 +1,341 @@
import QtQuick 2.5
import QtQuick.Controls 1.2
import QtQuick.Dialogs 1.2 as OriginalDialogs
import "../controls"
import "../styles"
import "../windows"
// FIXME respect default button functionality
// FIXME force active focus at all times (modal dialog)
Window {
id: root
HifiConstants { id: hifi }
implicitWidth: 640
implicitHeight: 320
destroyOnCloseButton: true
destroyOnInvisible: true
visible: true
modality: Qt.ApplicationModal
anchors.centerIn: parent
frame: ModalFrame {}
signal selected(int button);
function click(button) {
console.log("User clicked " + button)
clickedButton = button;
selected(button);
destroy();
}
property alias detailedText: detailedText.text
property alias text: mainTextContainer.text
property alias informativeText: informativeTextContainer.text
onIconChanged: iconHolder.updateIcon();
property int buttons: OriginalDialogs.StandardButton.Ok
property int icon: OriginalDialogs.StandardIcon.NoIcon
property int defaultButton: OriginalDialogs.StandardButton.NoButton;
property int clickedButton: OriginalDialogs.StandardButton.NoButton;
focus: defaultButton === OriginalDialogs.StandardButton.NoButton
Rectangle {
id: messageBox
clip: true
anchors.fill: parent
radius: 4
color: "white"
QtObject {
id: d
readonly property real spacing: hifi.layout.spacing
readonly property real outerSpacing: hifi.layout.spacing * 2
readonly property int minWidth: 480
readonly property int maxWdith: 1280
readonly property int minHeight: 160
readonly property int maxHeight: 720
function resize() {
var targetWidth = iconHolder.width + mainTextContainer.width + d.spacing * 6
var targetHeight = mainTextContainer.implicitHeight + informativeTextContainer.implicitHeight + d.spacing * 8 + buttons.height + details.height
root.width = (targetWidth < d.minWidth) ? d.minWidth : ((targetWidth > d.maxWdith) ? d.maxWidth : targetWidth)
root.height = (targetHeight < d.minHeight) ? d.minHeight: ((targetHeight > d.maxHeight) ? d.maxHeight : targetHeight)
}
}
FontAwesome {
id: iconHolder
size: 48
anchors {
left: parent.left
top: parent.top
margins: d.spacing * 2
}
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
style: Text.Outline; styleColor: "black"
Component.onCompleted: updateIcon();
function updateIcon() {
if (!root) {
return;
}
switch (root.icon) {
case OriginalDialogs.StandardIcon.Information:
text = "\uF05A";
color = "blue";
break;
case OriginalDialogs.StandardIcon.Question:
text = "\uF059"
color = "blue";
break;
case OriginalDialogs.StandardIcon.Warning:
text = "\uF071"
color = "yellow";
break;
case OriginalDialogs.StandardIcon.Critical:
text = "\uF057"
color = "red"
break;
default:
text = ""
}
visible = (text != "");
}
}
Text {
id: mainTextContainer
onHeightChanged: d.resize(); onWidthChanged: d.resize();
wrapMode: Text.WordWrap
font { pointSize: 14; weight: Font.Bold }
anchors { left: iconHolder.right; top: parent.top; margins: d.spacing * 2 }
}
Text {
id: informativeTextContainer
onHeightChanged: d.resize(); onWidthChanged: d.resize();
wrapMode: Text.WordWrap
font.pointSize: 11
anchors { top: mainTextContainer.bottom; right: parent.right; left: iconHolder.right; margins: d.spacing * 2 }
}
Flow {
id: buttons
focus: true
spacing: d.spacing
onHeightChanged: d.resize(); onWidthChanged: d.resize();
layoutDirection: Qt.RightToLeft
anchors { bottom: details.top; right: parent.right; margins: d.spacing * 2; bottomMargin: 0 }
Button {
id: okButton
text: qsTr("OK")
focus: root.defaultButton === OriginalDialogs.StandardButton.Ok
onClicked: root.click(OriginalDialogs.StandardButton.Ok)
visible: root.buttons & OriginalDialogs.StandardButton.Ok
}
Button {
id: openButton
text: qsTr("Open")
focus: root.defaultButton === OriginalDialogs.StandardButton.Open
onClicked: root.click(OriginalDialogs.StandardButton.Open)
visible: root.buttons & OriginalDialogs.StandardButton.Open
}
Button {
id: saveButton
text: qsTr("Save")
focus: root.defaultButton === OriginalDialogs.StandardButton.Save
onClicked: root.click(OriginalDialogs.StandardButton.Save)
visible: root.buttons & OriginalDialogs.StandardButton.Save
}
Button {
id: saveAllButton
text: qsTr("Save All")
focus: root.defaultButton === OriginalDialogs.StandardButton.SaveAll
onClicked: root.click(OriginalDialogs.StandardButton.SaveAll)
visible: root.buttons & OriginalDialogs.StandardButton.SaveAll
}
Button {
id: retryButton
text: qsTr("Retry")
focus: root.defaultButton === OriginalDialogs.StandardButton.Retry
onClicked: root.click(OriginalDialogs.StandardButton.Retry)
visible: root.buttons & OriginalDialogs.StandardButton.Retry
}
Button {
id: ignoreButton
text: qsTr("Ignore")
focus: root.defaultButton === OriginalDialogs.StandardButton.Ignore
onClicked: root.click(OriginalDialogs.StandardButton.Ignore)
visible: root.buttons & OriginalDialogs.StandardButton.Ignore
}
Button {
id: applyButton
text: qsTr("Apply")
focus: root.defaultButton === OriginalDialogs.StandardButton.Apply
onClicked: root.click(OriginalDialogs.StandardButton.Apply)
visible: root.buttons & OriginalDialogs.StandardButton.Apply
}
Button {
id: yesButton
text: qsTr("Yes")
focus: root.defaultButton === OriginalDialogs.StandardButton.Yes
onClicked: root.click(OriginalDialogs.StandardButton.Yes)
visible: root.buttons & OriginalDialogs.StandardButton.Yes
}
Button {
id: yesAllButton
text: qsTr("Yes to All")
focus: root.defaultButton === OriginalDialogs.StandardButton.YesToAll
onClicked: root.click(OriginalDialogs.StandardButton.YesToAll)
visible: root.buttons & OriginalDialogs.StandardButton.YesToAll
}
Button {
id: noButton
text: qsTr("No")
focus: root.defaultButton === OriginalDialogs.StandardButton.No
onClicked: root.click(OriginalDialogs.StandardButton.No)
visible: root.buttons & OriginalDialogs.StandardButton.No
}
Button {
id: noAllButton
text: qsTr("No to All")
focus: root.defaultButton === OriginalDialogs.StandardButton.NoToAll
onClicked: root.click(OriginalDialogs.StandardButton.NoToAll)
visible: root.buttons & OriginalDialogs.StandardButton.NoToAll
}
Button {
id: discardButton
text: qsTr("Discard")
focus: root.defaultButton === OriginalDialogs.StandardButton.Discard
onClicked: root.click(OriginalDialogs.StandardButton.Discard)
visible: root.buttons & OriginalDialogs.StandardButton.Discard
}
Button {
id: resetButton
text: qsTr("Reset")
focus: root.defaultButton === OriginalDialogs.StandardButton.Reset
onClicked: root.click(OriginalDialogs.StandardButton.Reset)
visible: root.buttons & OriginalDialogs.StandardButton.Reset
}
Button {
id: restoreDefaultsButton
text: qsTr("Restore Defaults")
focus: root.defaultButton === OriginalDialogs.StandardButton.RestoreDefaults
onClicked: root.click(OriginalDialogs.StandardButton.RestoreDefaults)
visible: root.buttons & OriginalDialogs.StandardButton.RestoreDefaults
}
Button {
id: cancelButton
text: qsTr("Cancel")
focus: root.defaultButton === OriginalDialogs.StandardButton.Cancel
onClicked: root.click(OriginalDialogs.StandardButton.Cancel)
visible: root.buttons & OriginalDialogs.StandardButton.Cancel
}
Button {
id: abortButton
text: qsTr("Abort")
focus: root.defaultButton === OriginalDialogs.StandardButton.Abort
onClicked: root.click(OriginalDialogs.StandardButton.Abort)
visible: root.buttons & OriginalDialogs.StandardButton.Abort
}
Button {
id: closeButton
text: qsTr("Close")
focus: root.defaultButton === OriginalDialogs.StandardButton.Close
onClicked: root.click(OriginalDialogs.StandardButton.Close)
visible: root.buttons & OriginalDialogs.StandardButton.Close
}
Button {
id: moreButton
text: qsTr("Show Details...")
onClicked: { content.state = (content.state === "" ? "expanded" : "")
}
visible: detailedText && detailedText.length > 0
}
Button {
id: helpButton
text: qsTr("Help")
focus: root.defaultButton === OriginalDialogs.StandardButton.Help
onClicked: root.click(OriginalDialogs.StandardButton.Help)
visible: root.buttons & OriginalDialogs.StandardButton.Help
}
}
Item {
id: details
width: parent.width
implicitHeight: detailedText.implicitHeight + root.spacing
height: 0
clip: true
anchors { bottom: parent.bottom; left: parent.left; right: parent.right; margins: d.spacing * 2 }
Flickable {
id: flickable
contentHeight: detailedText.height
anchors.fill: parent
anchors.topMargin: root.spacing
anchors.bottomMargin: root.outerSpacing
TextEdit {
id: detailedText
width: details.width
wrapMode: Text.WordWrap
readOnly: true
selectByMouse: true
}
}
}
states: [
State {
name: "expanded"
PropertyChanges { target: root; anchors.fill: undefined }
PropertyChanges { target: details; height: 120 }
PropertyChanges { target: moreButton; text: qsTr("Hide Details") }
}
]
onStateChanged: d.resize()
}
Keys.onPressed: {
if (!visible) {
return
}
if (event.modifiers === Qt.ControlModifier)
switch (event.key) {
case Qt.Key_A:
event.accepted = true
detailedText.selectAll()
break
case Qt.Key_C:
event.accepted = true
detailedText.copy()
break
case Qt.Key_Period:
if (Qt.platform.os === "osx") {
event.accepted = true
content.reject()
}
break
} else switch (event.key) {
case Qt.Key_Escape:
case Qt.Key_Back:
event.accepted = true
root.click(OriginalDialogs.StandardButton.Cancel)
break
case Qt.Key_Enter:
case Qt.Key_Return:
event.accepted = true
root.click(OriginalDialogs.StandardButton.Ok)
break
}
}
}

View file

@ -13,12 +13,17 @@ Window {
title: "Running Scripts"
resizable: true
destroyOnInvisible: true
enabled: false
x: 40; y: 40
property var scripts: ScriptDiscoveryService;
property var scriptsModel: scripts.scriptsModelFilter
property var runningScriptsModel: ListModel { }
property var fileFilters: ListModel {
id: jsFilters
ListElement { text: "Javascript Files (*.js)"; filter: "*.js" }
ListElement { text: "All Files (*.*)"; filter: "*.*" }
}
Settings {
category: "Overlay.RunningScripts"
@ -66,6 +71,23 @@ Window {
scripts.stopAllScripts();
}
Component {
id: fileDialogBuilder
FileDialog { }
}
function loadFromFile() {
var fileDialog = fileDialogBuilder.createObject(Desktop, { filterModel: fileFilters });
fileDialog.canceled.connect(function(){
console.debug("Cancelled file open")
})
fileDialog.selectedFile.connect(function(file){
console.debug("Selected " + file)
scripts.loadOneScript(file);
})
}
Rectangle {
color: "white"
implicitWidth: 384; implicitHeight: 640
@ -164,7 +186,7 @@ Window {
}
Button {
text: "from Disk"
onClicked: ApplicationInterface.loadDialog();
onClicked: loadFromFile();
}
}
@ -202,7 +224,6 @@ Window {
TextField {
id: selectedScript
enabled: true
readOnly: true
anchors.left: parent.left
anchors.right: loadButton.left

View file

@ -0,0 +1,167 @@
import QtQuick 2.5
QtObject {
readonly property string aboutApp: "About Interface";
readonly property string addRemoveFriends: "Add/Remove Friends...";
readonly property string addressBar: "Show Address Bar";
readonly property string animations: "Animations...";
readonly property string animDebugDrawAnimPose: "Debug Draw Animation";
readonly property string animDebugDrawDefaultPose: "Debug Draw Default Pose";
readonly property string animDebugDrawPosition: "Debug Draw Position";
readonly property string antialiasing: "Antialiasing";
readonly property string assetMigration: "ATP Asset Migration";
readonly property string atmosphere: "Atmosphere";
readonly property string attachments: "Attachments...";
readonly property string audioNetworkStats: "Audio Network Stats";
readonly property string audioNoiseReduction: "Audio Noise Reduction";
readonly property string audioScope: "Show Scope";
readonly property string audioScopeFiftyFrames: "Fifty";
readonly property string audioScopeFiveFrames: "Five";
readonly property string audioScopeFrames: "Display Frames";
readonly property string audioScopePause: "Pause Scope";
readonly property string audioScopeTwentyFrames: "Twenty";
readonly property string audioStatsShowInjectedStreams: "Audio Stats Show Injected Streams";
readonly property string audioTools: "Show Level Meter";
readonly property string autoMuteAudio: "Auto Mute Microphone";
readonly property string avatarReceiveStats: "Show Receive Stats";
readonly property string back: "Back";
readonly property string bandwidthDetails: "Bandwidth Details";
readonly property string binaryEyelidControl: "Binary Eyelid Control";
readonly property string bookmarkLocation: "Bookmark Location";
readonly property string bookmarks: "Bookmarks";
readonly property string cachesSize: "RAM Caches Size";
readonly property string calibrateCamera: "Calibrate Camera";
readonly property string cameraEntityMode: "Entity Mode";
readonly property string centerPlayerInView: "Center Player In View";
readonly property string chat: "Chat...";
readonly property string collisions: "Collisions";
readonly property string comfortMode: "Comfort Mode";
readonly property string connexion: "Activate 3D Connexion Devices";
readonly property string console_: "Console...";
readonly property string controlWithSpeech: "Control With Speech";
readonly property string copyAddress: "Copy Address to Clipboard";
readonly property string copyPath: "Copy Path to Clipboard";
readonly property string coupleEyelids: "Couple Eyelids";
readonly property string crashInterface: "Crash Interface";
readonly property string debugAmbientOcclusion: "Debug Ambient Occlusion";
readonly property string decreaseAvatarSize: "Decrease Avatar Size";
readonly property string deleteBookmark: "Delete Bookmark...";
readonly property string disableActivityLogger: "Disable Activity Logger";
readonly property string disableEyelidAdjustment: "Disable Eyelid Adjustment";
readonly property string disableLightEntities: "Disable Light Entities";
readonly property string disableNackPackets: "Disable Entity NACK Packets";
readonly property string diskCacheEditor: "Disk Cache Editor";
readonly property string displayCrashOptions: "Display Crash Options";
readonly property string displayHandTargets: "Show Hand Targets";
readonly property string displayModelBounds: "Display Model Bounds";
readonly property string displayModelTriangles: "Display Model Triangles";
readonly property string displayModelElementChildProxies: "Display Model Element Children";
readonly property string displayModelElementProxy: "Display Model Element Bounds";
readonly property string displayDebugTimingDetails: "Display Timing Details";
readonly property string dontDoPrecisionPicking: "Don't Do Precision Picking";
readonly property string dontRenderEntitiesAsScene: "Don't Render Entities as Scene";
readonly property string echoLocalAudio: "Echo Local Audio";
readonly property string echoServerAudio: "Echo Server Audio";
readonly property string enable3DTVMode: "Enable 3DTV Mode";
readonly property string enableCharacterController: "Enable avatar collisions";
readonly property string expandMyAvatarSimulateTiming: "Expand /myAvatar/simulation";
readonly property string expandMyAvatarTiming: "Expand /myAvatar";
readonly property string expandOtherAvatarTiming: "Expand /otherAvatar";
readonly property string expandPaintGLTiming: "Expand /paintGL";
readonly property string expandUpdateTiming: "Expand /update";
readonly property string faceshift: "Faceshift";
readonly property string firstPerson: "First Person";
readonly property string fivePointCalibration: "5 Point Calibration";
readonly property string fixGaze: "Fix Gaze (no saccade)";
readonly property string forward: "Forward";
readonly property string frameTimer: "Show Timer";
readonly property string fullscreenMirror: "Mirror";
readonly property string glowWhenSpeaking: "Glow When Speaking";
readonly property string help: "Help...";
readonly property string increaseAvatarSize: "Increase Avatar Size";
readonly property string independentMode: "Independent Mode";
readonly property string inputMenu: "Avatar>Input Devices";
readonly property string keyboardMotorControl: "Enable Keyboard Motor Control";
readonly property string leapMotionOnHMD: "Leap Motion on HMD";
readonly property string loadScript: "Open and Run Script File...";
readonly property string loadScriptURL: "Open and Run Script from URL...";
readonly property string lodTools: "LOD Tools";
readonly property string login: "Login";
readonly property string log: "Log";
readonly property string logExtraTimings: "Log Extra Timing Details";
readonly property string lowVelocityFilter: "Low Velocity Filter";
readonly property string meshVisible: "Draw Mesh";
readonly property string miniMirror: "Mini Mirror";
readonly property string muteAudio: "Mute Microphone";
readonly property string muteEnvironment: "Mute Environment";
readonly property string muteFaceTracking: "Mute Face Tracking";
readonly property string namesAboveHeads: "Names Above Heads";
readonly property string noFaceTracking: "None";
readonly property string octreeStats: "Entity Statistics";
readonly property string onePointCalibration: "1 Point Calibration";
readonly property string onlyDisplayTopTen: "Only Display Top Ten";
readonly property string outputMenu: "Display";
readonly property string packageModel: "Package Model...";
readonly property string pair: "Pair";
readonly property string physicsShowOwned: "Highlight Simulation Ownership";
readonly property string physicsShowHulls: "Draw Collision Hulls";
readonly property string pipelineWarnings: "Log Render Pipeline Warnings";
readonly property string preferences: "General...";
readonly property string quit: "Quit";
readonly property string reloadAllScripts: "Reload All Scripts";
readonly property string reloadContent: "Reload Content (Clears all caches)";
readonly property string renderBoundingCollisionShapes: "Show Bounding Collision Shapes";
readonly property string renderFocusIndicator: "Show Eye Focus";
readonly property string renderLookAtTargets: "Show Look-at Targets";
readonly property string renderLookAtVectors: "Show Look-at Vectors";
readonly property string renderResolution: "Scale Resolution";
readonly property string renderResolutionOne: "1";
readonly property string renderResolutionTwoThird: "2/3";
readonly property string renderResolutionHalf: "1/2";
readonly property string renderResolutionThird: "1/3";
readonly property string renderResolutionQuarter: "1/4";
readonly property string renderAmbientLight: "Ambient Light";
readonly property string renderAmbientLightGlobal: "Global";
readonly property string renderAmbientLight0: "OLD_TOWN_SQUARE";
readonly property string renderAmbientLight1: "GRACE_CATHEDRAL";
readonly property string renderAmbientLight2: "EUCALYPTUS_GROVE";
readonly property string renderAmbientLight3: "ST_PETERS_BASILICA";
readonly property string renderAmbientLight4: "UFFIZI_GALLERY";
readonly property string renderAmbientLight5: "GALILEOS_TOMB";
readonly property string renderAmbientLight6: "VINE_STREET_KITCHEN";
readonly property string renderAmbientLight7: "BREEZEWAY";
readonly property string renderAmbientLight8: "CAMPUS_SUNSET";
readonly property string renderAmbientLight9: "FUNSTON_BEACH_SUNSET";
readonly property string resetAvatarSize: "Reset Avatar Size";
readonly property string resetSensors: "Reset Sensors";
readonly property string runningScripts: "Running Scripts...";
readonly property string runTimingTests: "Run Timing Tests";
readonly property string scriptEditor: "Script Editor...";
readonly property string scriptedMotorControl: "Enable Scripted Motor Control";
readonly property string showDSConnectTable: "Show Domain Connection Timing";
readonly property string showBordersEntityNodes: "Show Entity Nodes";
readonly property string showRealtimeEntityStats: "Show Realtime Entity Stats";
readonly property string showWhosLookingAtMe: "Show Who's Looking at Me";
readonly property string standingHMDSensorMode: "Standing HMD Sensor Mode";
readonly property string simulateEyeTracking: "Simulate";
readonly property string sMIEyeTracking: "SMI Eye Tracking";
readonly property string stars: "Stars";
readonly property string stats: "Stats";
readonly property string stopAllScripts: "Stop All Scripts";
readonly property string suppressShortTimings: "Suppress Timings Less than 10ms";
readonly property string thirdPerson: "Third Person";
readonly property string threePointCalibration: "3 Point Calibration";
readonly property string throttleFPSIfNotFocus: "Throttle FPS If Not Focus"; // FIXME - this value duplicated in Basic2DWindowOpenGLDisplayPlugin.cpp
readonly property string toolWindow: "Tool Window";
readonly property string transmitterDrive: "Transmitter Drive";
readonly property string turnWithHead: "Turn using Head";
readonly property string uploadAsset: "Upload File to Asset Server";
readonly property string useAudioForMouth: "Use Audio for Mouth";
readonly property string useCamera: "Use Camera";
readonly property string velocityFilter: "Velocity Filter";
readonly property string visibleToEveryone: "Everyone";
readonly property string visibleToFriends: "Friends";
readonly property string visibleToNoOne: "No one";
readonly property string worldAxes: "World Axes";
}

View file

@ -1,23 +0,0 @@
import QtQuick 2.4 as Original
import QtQuick.Controls.Styles 1.3 as OriginalStyles
import "."
import "../controls"
OriginalStyles.ButtonStyle {
HifiConstants { id: hifi }
padding {
top: 8
left: 12
right: 12
bottom: 8
}
background: Border {
anchors.fill: parent
}
label: Text {
verticalAlignment: Original.Text.AlignVCenter
horizontalAlignment: Original.Text.AlignHCenter
text: control.text
color: control.enabled ? hifi.colors.text : hifi.colors.disabledText
}
}

View file

@ -1,11 +0,0 @@
import QtQuick 2.4
Item {
property string hifiBlue: "#0e7077"
property alias colors: colorsObj
Item {
id: colorsObj
property string hifiRed: "red"
}
}

View file

@ -1,10 +0,0 @@
ButtonStyle {
background: Item { anchors.fill: parent }
label: FontAwesome {
id: icon
font.pointSize: 18
property alias unicode: text
text: control.text
color: control.enabled ? hifi.colors.text : hifi.colors.disabledText
}
}

View file

@ -8,27 +8,10 @@ Frame {
// The frame fills the parent, which should be the size of the content.
// The frame decorations use negative anchor margins to extend beyond
anchors.fill: parent
// Size of the controls
readonly property real iconSize: 24;
// Convenience accessor for the window
property alias window: frame.parent
// FIXME needed?
property alias decoration: decoration
Rectangle {
anchors { margins: -4 }
visible: !decoration.visible
anchors.fill: parent;
color: "#7f7f7f7f";
radius: 3;
}
Rectangle {
id: decoration
anchors { margins: -iconSize; topMargin: -iconSize * (window.closable ? 2 : 1); }
// FIXME doesn't work
// visible: window.activator.containsMouse
anchors.fill: parent;
color: "#7f7f7f7f";
radius: 3;
@ -36,14 +19,9 @@ Frame {
// Allow dragging of the window
MouseArea {
id: dragMouseArea
hoverEnabled: true
anchors.fill: parent
drag {
target: window
// minimumX: (decoration.width - window.width) * -1
// minimumY: 0
// maximumX: (window.parent.width - window.width) - 2 * (decoration.width - window.width)
// maximumY: (window.parent.height - window.height) - 2 * (decoration.height - window.height)
}
drag.target: window
}
Row {
@ -53,6 +31,7 @@ Frame {
anchors.rightMargin: iconSize
anchors.topMargin: iconSize / 2
spacing: iconSize / 4
FontAwesome {
visible: false
text: "\uf08d"
@ -66,7 +45,6 @@ Frame {
onClicked: { frame.pin(); mouse.accepted = false; }
}
}
FontAwesome {
visible: window.closable
text: closeClickArea.containsMouse ? "\uf057" : "\uf05c"
@ -82,56 +60,6 @@ Frame {
}
}
}
// Allow sizing of the window
// FIXME works in native QML, doesn't work in Interface
MouseArea {
id: sizeDrag
width: iconSize
height: iconSize
anchors {
right: decoration.right;
bottom: decoration.bottom
bottomMargin: iconSize * 2
}
property vector2d pressOrigin
property vector2d sizeOrigin
property bool hid: false
onPressed: {
console.log("Pressed on size")
pressOrigin = Qt.vector2d(mouseX, mouseY)
sizeOrigin = Qt.vector2d(window.content.width, window.content.height)
hid = false;
}
onReleased: {
if (hid) {
window.content.visible = true
hid = false;
}
}
onPositionChanged: {
if (pressed) {
if (window.content.visible) {
window.content.visible = false;
hid = true;
}
var delta = Qt.vector2d(mouseX, mouseY).minus(pressOrigin);
frame.deltaSize(delta.x, delta.y)
}
}
}
FontAwesome {
visible: window.resizable
rotation: -45
anchors { centerIn: sizeDrag }
horizontalAlignment: Text.AlignHCenter
text: "\uf07d"
size: iconSize / 3 * 2
style: Text.Outline; styleColor: "white"
}
}
}

Some files were not shown because too many files have changed in this diff Show more