From 886772eb39331ebd21a1f86944f1273be9f9280e Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Wed, 22 May 2019 11:27:14 -0700 Subject: [PATCH 01/31] only worry about Ubuntu major versions when selecting Qt package --- hifi_vcpkg.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hifi_vcpkg.py b/hifi_vcpkg.py index 3df714e6f9..ee42eef14f 100644 --- a/hifi_vcpkg.py +++ b/hifi_vcpkg.py @@ -265,10 +265,10 @@ endif() #url = 'https://hifi-public.s3.amazonaws.com/dependencies/vcpkg/qt5-install-5.12.3-macos.tar.gz?versionId=QrGxwssB.WwU_z3QCyG7ghP1_VjTkQeK' url = 'https://hifi-public.s3.amazonaws.com/dependencies/vcpkg/qt5-install-5.12.3-macos.tar.gz' elif platform.system() == 'Linux': - if platform.linux_distribution()[1] == '16.04': + if platform.linux_distribution()[1][:3] == '16.': #url = 'https://hifi-public.s3.amazonaws.com/dependencies/vcpkg/qt5-install-5.12.3-ubuntu-16.04.tar.gz?versionId=c9j7PW4uBDPLif7DKmgIhorh9WBMjZRB' url = 'https://hifi-public.s3.amazonaws.com/dependencies/vcpkg/qt5-install-5.12.3-ubuntu-16.04.tar.gz' - elif platform.linux_distribution()[1] == '18.04': + elif platform.linux_distribution()[1][:3] == '18.': #url = 'https://hifi-public.s3.amazonaws.com/dependencies/vcpkg/qt5-install-5.12.3-ubuntu-18.04.tar.gz?versionId=Z3TojPFdb5pXdahF3oi85jjKocpL0xqw' url = 'https://hifi-public.s3.amazonaws.com/dependencies/vcpkg/qt5-install-5.12.3-ubuntu-18.04.tar.gz' else: From 3849450c6669771cd05d90e6be05d21f512caefa Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Wed, 22 May 2019 11:57:08 -0700 Subject: [PATCH 02/31] Fix crash calculating tangents without texcoords --- .../src/model-baker/CalculateBlendshapeTangentsTask.cpp | 4 ++-- .../model-baker/src/model-baker/CalculateMeshTangentsTask.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/model-baker/src/model-baker/CalculateBlendshapeTangentsTask.cpp b/libraries/model-baker/src/model-baker/CalculateBlendshapeTangentsTask.cpp index b807aea38f..905de9b5a7 100644 --- a/libraries/model-baker/src/model-baker/CalculateBlendshapeTangentsTask.cpp +++ b/libraries/model-baker/src/model-baker/CalculateBlendshapeTangentsTask.cpp @@ -42,8 +42,8 @@ void CalculateBlendshapeTangentsTask::run(const baker::BakeContextPointer& conte continue; } - // Check if we can and should calculate tangents (we need normals to calculate the tangents) - if (normals.empty()) { + // Check if we can calculate tangents (we need normals and texcoords to calculate the tangents) + if (normals.empty() || normals.size() != (size_t)mesh.texCoords.size()) { continue; } tangentsOut.resize(normals.size()); diff --git a/libraries/model-baker/src/model-baker/CalculateMeshTangentsTask.cpp b/libraries/model-baker/src/model-baker/CalculateMeshTangentsTask.cpp index 58c54c9189..297d8cbde7 100644 --- a/libraries/model-baker/src/model-baker/CalculateMeshTangentsTask.cpp +++ b/libraries/model-baker/src/model-baker/CalculateMeshTangentsTask.cpp @@ -27,10 +27,10 @@ void CalculateMeshTangentsTask::run(const baker::BakeContextPointer& context, co auto& tangentsOut = tangentsPerMeshOut[tangentsPerMeshOut.size()-1]; // Check if we already have tangents and therefore do not need to do any calculation - // Otherwise confirm if we have the normals needed, and need to calculate the tangents + // Otherwise confirm if we have the normals and texcoords needed if (!tangentsIn.empty()) { tangentsOut = tangentsIn.toStdVector(); - } else if (!normals.empty()) { + } else if (!normals.empty() && mesh.vertices.size() == mesh.texCoords.size()) { tangentsOut.resize(normals.size()); baker::calculateTangents(mesh, [&mesh, &normals, &tangentsOut](int firstIndex, int secondIndex, glm::vec3* outVertices, glm::vec2* outTexCoords, glm::vec3& outNormal) { From 30c13fd9882a2453c88474370b566fd346ae40a5 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Wed, 22 May 2019 12:01:38 -0700 Subject: [PATCH 03/31] Fix environment volume slider (BUGZ-213); optimize sliders --- .../simplifiedUI/settingsApp/audio/Audio.qml | 55 +++++++++++++++---- .../simplifiedControls/Slider.qml | 1 + 2 files changed, 44 insertions(+), 12 deletions(-) diff --git a/interface/resources/qml/hifi/simplifiedUI/settingsApp/audio/Audio.qml b/interface/resources/qml/hifi/simplifiedUI/settingsApp/audio/Audio.qml index da924615e3..3e2e4bf752 100644 --- a/interface/resources/qml/hifi/simplifiedUI/settingsApp/audio/Audio.qml +++ b/interface/resources/qml/hifi/simplifiedUI/settingsApp/audio/Audio.qml @@ -68,57 +68,88 @@ Flickable { SimplifiedControls.Slider { id: peopleVolume + property real lastValueSent anchors.left: parent.left anchors.right: parent.right Layout.topMargin: simplifiedUI.margins.settings.settingsGroupTopMargin height: 30 labelText: "People Volume" - from: -60 - to: 10 + from: -60.0 + to: 20.0 defaultValue: 0.0 + stepSize: 5.0 value: AudioScriptingInterface.getAvatarGain() live: true + function updatePeopleGain(sliderValue) { + if (AudioScriptingInterface.getAvatarGain() !== sliderValue) { + AudioScriptingInterface.setAvatarGain(sliderValue); + } + } onValueChanged: { - if (AudioScriptingInterface.getAvatarGain() != peopleVolume.value) { - AudioScriptingInterface.setAvatarGain(peopleVolume.value); + updatePeopleGain(value); + } + onPressedChanged: { + if (!pressed) { + updatePeopleGain(value); } } } SimplifiedControls.Slider { id: environmentVolume + property real lastValueSent anchors.left: parent.left anchors.right: parent.right Layout.topMargin: 2 height: 30 labelText: "Environment Volume" - from: -60 - to: 10 + from: -60.0 + to: 20.0 defaultValue: 0.0 + stepSize: 5.0 value: AudioScriptingInterface.getInjectorGain() live: true + function updateEnvironmentGain(sliderValue) { + if (AudioScriptingInterface.getInjectorGain() !== sliderValue) { + AudioScriptingInterface.setInjectorGain(sliderValue); + AudioScriptingInterface.setLocalInjectorGain(sliderValue); + } + } onValueChanged: { - if (AudioScriptingInterface.getInjectorGain() != environmentVolume.value) { - AudioScriptingInterface.setInjectorGain(environmentVolume.value); + updateEnvironmentGain(value); + } + onPressedChanged: { + if (!pressed) { + updateEnvironmentGain(value); } } } SimplifiedControls.Slider { id: systemSoundVolume + property real lastValueSent anchors.left: parent.left anchors.right: parent.right Layout.topMargin: 2 height: 30 labelText: "System Sound Volume" - from: -60 - to: 10 + from: -60.0 + to: 20.0 defaultValue: 0.0 + stepSize: 5.0 value: AudioScriptingInterface.getSystemInjectorGain() live: true + function updateSystemGain(sliderValue) { + if (AudioScriptingInterface.getSystemInjectorGain() !== sliderValue) { + AudioScriptingInterface.setSystemInjectorGain(sliderValue); + } + } onValueChanged: { - if (AudioScriptingInterface.getSystemInjectorGain() != systemSoundVolume.value) { - AudioScriptingInterface.setSystemInjectorGain(systemSoundVolume.value); + updateSystemGain(value); + } + onPressedChanged: { + if (!pressed) { + updateSystemGain(value); } } } diff --git a/interface/resources/qml/hifi/simplifiedUI/simplifiedControls/Slider.qml b/interface/resources/qml/hifi/simplifiedUI/simplifiedControls/Slider.qml index 2b1dc68261..38b114e9d2 100644 --- a/interface/resources/qml/hifi/simplifiedUI/simplifiedControls/Slider.qml +++ b/interface/resources/qml/hifi/simplifiedUI/simplifiedControls/Slider.qml @@ -30,6 +30,7 @@ Item { property alias live: sliderControl.live property alias stepSize: sliderControl.stepSize property alias snapMode: sliderControl.snapMode + property alias pressed: sliderControl.pressed property real defaultValue: 0.0 HifiStylesUit.GraphikRegular { From 4ca77ba3ac8801b93266e619e3566b65dace8779 Mon Sep 17 00:00:00 2001 From: Roxanne Skelly Date: Wed, 22 May 2019 13:51:43 -0700 Subject: [PATCH 04/31] BUGZ-322 - add domain checkin lag logging --- domain-server/src/DomainGatekeeper.cpp | 5 +- domain-server/src/DomainServer.cpp | 6 ++ domain-server/src/DomainServerNodeData.h | 5 +- domain-server/src/NodeConnectionData.cpp | 2 + domain-server/src/NodeConnectionData.h | 1 + libraries/networking/src/NodeList.cpp | 82 ++++++++++++------- .../networking/src/udt/PacketHeaders.cpp | 4 +- libraries/networking/src/udt/PacketHeaders.h | 6 +- 8 files changed, 77 insertions(+), 34 deletions(-) diff --git a/domain-server/src/DomainGatekeeper.cpp b/domain-server/src/DomainGatekeeper.cpp index 29656f4465..75399d1a9b 100644 --- a/domain-server/src/DomainGatekeeper.cpp +++ b/domain-server/src/DomainGatekeeper.cpp @@ -358,7 +358,7 @@ SharedNodePointer DomainGatekeeper::processAssignmentConnectRequest(const NodeCo nodeData->setNodeVersion(it->second.getNodeVersion()); nodeData->setHardwareAddress(nodeConnection.hardwareAddress); nodeData->setMachineFingerprint(nodeConnection.machineFingerprint); - + nodeData->setLastDomainCheckinTimestamp(nodeConnection.lastPingTimestamp); nodeData->setWasAssigned(true); // cleanup the PendingAssignedNodeData for this assignment now that it's connecting @@ -499,6 +499,9 @@ SharedNodePointer DomainGatekeeper::processAgentConnectRequest(const NodeConnect // set the machine fingerprint passed in the connect request nodeData->setMachineFingerprint(nodeConnection.machineFingerprint); + // set the last ping timestamp passed in the connect request + nodeData->setLastDomainCheckinTimestamp(nodeConnection.lastPingTimestamp); + // also add an interpolation to DomainServerNodeData so that servers can get username in stats nodeData->addOverrideForKey(USERNAME_UUID_REPLACEMENT_STATS_KEY, uuidStringWithoutCurlyBraces(newNode->getUUID()), username); diff --git a/domain-server/src/DomainServer.cpp b/domain-server/src/DomainServer.cpp index 051dd989f5..37643cc372 100644 --- a/domain-server/src/DomainServer.cpp +++ b/domain-server/src/DomainServer.cpp @@ -1068,6 +1068,8 @@ void DomainServer::processListRequestPacket(QSharedPointer mess // update the connecting hostname in case it has changed nodeData->setPlaceName(nodeRequestData.placeName); + nodeData->setLastDomainCheckinTimestamp(nodeRequestData.lastPingTimestamp); + sendDomainListToNode(sendingNode, message->getSenderSockAddr()); } @@ -1174,6 +1176,10 @@ void DomainServer::sendDomainListToNode(const SharedNodePointer& node, const Hif DomainServerNodeData* nodeData = static_cast(node->getLinkedData()); + domainListStream << nodeData->getLastDomainCheckinTimestamp(); + + domainListStream << usecTimestampNow(); + // store the nodeInterestSet on this DomainServerNodeData, in case it has changed auto& nodeInterestSet = nodeData->getNodeInterestSet(); diff --git a/domain-server/src/DomainServerNodeData.h b/domain-server/src/DomainServerNodeData.h index f465cceb96..370886cbce 100644 --- a/domain-server/src/DomainServerNodeData.h +++ b/domain-server/src/DomainServerNodeData.h @@ -61,6 +61,9 @@ public: void setMachineFingerprint(const QUuid& machineFingerprint) { _machineFingerprint = machineFingerprint; } const QUuid& getMachineFingerprint() { return _machineFingerprint; } + void setLastDomainCheckinTimestamp(quint64 lastDomainCheckinTimestamp) { _lastDomainCheckinTimestamp = lastDomainCheckinTimestamp; } + quint64 getLastDomainCheckinTimestamp() { return _lastDomainCheckinTimestamp; } + void addOverrideForKey(const QString& key, const QString& value, const QString& overrideValue); void removeOverrideForKey(const QString& key, const QString& value); @@ -93,7 +96,7 @@ private: QString _nodeVersion; QString _hardwareAddress; QUuid _machineFingerprint; - + quint64 _lastDomainCheckinTimestamp; QString _placeName; bool _wasAssigned { false }; diff --git a/domain-server/src/NodeConnectionData.cpp b/domain-server/src/NodeConnectionData.cpp index 0a3782d79b..b3ea005bd1 100644 --- a/domain-server/src/NodeConnectionData.cpp +++ b/domain-server/src/NodeConnectionData.cpp @@ -36,6 +36,8 @@ NodeConnectionData NodeConnectionData::fromDataStream(QDataStream& dataStream, c // now the machine fingerprint dataStream >> newHeader.machineFingerprint; } + + dataStream >> newHeader.lastPingTimestamp; dataStream >> newHeader.nodeType >> newHeader.publicSockAddr >> newHeader.localSockAddr diff --git a/domain-server/src/NodeConnectionData.h b/domain-server/src/NodeConnectionData.h index dd9ca6b650..96e81839c6 100644 --- a/domain-server/src/NodeConnectionData.h +++ b/domain-server/src/NodeConnectionData.h @@ -22,6 +22,7 @@ public: bool isConnectRequest = true); QUuid connectUUID; + quint64 lastPingTimestamp; NodeType_t nodeType; HifiSockAddr publicSockAddr; HifiSockAddr localSockAddr; diff --git a/libraries/networking/src/NodeList.cpp b/libraries/networking/src/NodeList.cpp index b3862e4252..11c7ca53b7 100644 --- a/libraries/networking/src/NodeList.cpp +++ b/libraries/networking/src/NodeList.cpp @@ -412,6 +412,8 @@ void NodeList::sendDomainServerCheckIn() { packetStream << FingerprintUtils::getMachineFingerprint(); } + packetStream << usecTimestampNow(); + // pack our data to send to the domain-server including // the hostname information (so the domain-server can see which place name we came in on) packetStream << _ownerType.load() << publicSockAddr << localSockAddr << _nodeTypesOfInterest.toList(); @@ -618,32 +620,14 @@ void NodeList::processDomainServerConnectionTokenPacket(QSharedPointer message) { - if (_domainHandler.getSockAddr().isNull()) { - qWarning() << "IGNORING DomainList packet while not connected to a Domain Server"; - // refuse to process this packet if we aren't currently connected to the DS - return; - } - - // this is a packet from the domain server, reset the count of un-replied check-ins - _domainHandler.clearPendingCheckins(); - - // emit our signal so listeners know we just heard from the DS - emit receivedDomainServerList(); - - DependencyManager::get()->flagTimeForConnectionStep(LimitedNodeList::ConnectionStep::ReceiveDSList); + // parse header information QDataStream packetStream(message->getMessage()); // grab the domain's ID from the beginning of the packet QUuid domainUUID; packetStream >> domainUUID; - if (_domainHandler.isConnected() && _domainHandler.getUUID() != domainUUID) { - // Recieved packet from different domain. - qWarning() << "IGNORING DomainList packet from" << domainUUID << "while connected to" << _domainHandler.getUUID(); - return; - } - Node::LocalID domainLocalID; packetStream >> domainLocalID; @@ -654,6 +638,57 @@ void NodeList::processDomainServerList(QSharedPointer message) packetStream >> newUUID; packetStream >> newLocalID; + // pull the permissions/right/privileges for this node out of the stream + NodePermissions newPermissions; + packetStream >> newPermissions; + setPermissions(newPermissions); + // Is packet authentication enabled? + bool isAuthenticated; + packetStream >> isAuthenticated; + setAuthenticatePackets(isAuthenticated); + + quint64 connectRequestTimestamp; + quint64 now = usecTimestampNow(); + packetStream >> connectRequestTimestamp; + quint64 pingLagTime = (now - connectRequestTimestamp) / USECS_PER_MSEC; + quint64 domainServerPingReceiveTime; + + packetStream >> domainServerPingReceiveTime; + quint64 domainServerRequestLag = (domainServerPingReceiveTime - connectRequestTimestamp) / USECS_PER_MSEC; + quint64 domainServerResponseLag = (now - domainServerPingReceiveTime) / USECS_PER_MSEC; + + if (_domainHandler.getSockAddr().isNull()) { + qWarning(networking) << "IGNORING DomainList packet while not connected to a Domain Server: sent " << pingLagTime << " msec ago."; + qWarning(networking) << "DomainList request lag (with skew): " << domainServerRequestLag << "msec"; + qWarning(networking) << "DomainList response lag (with skew): " << domainServerResponseLag << "msec"; + // refuse to process this packet if we aren't currently connected to the DS + return; + } + + // warn if ping lag is getting long + if (pingLagTime > MSECS_PER_SECOND) { + qCDebug(networking) << "DomainList ping is lagging: " << pingLagTime << "msec"; + qCDebug(networking) << "DomainList request lag (with skew): " << domainServerRequestLag << "msec"; + qCDebug(networking) << "DomainList response lag (with skew): " << domainServerResponseLag << "msec"; + } + + // this is a packet from the domain server, reset the count of un-replied check-ins + _domainHandler.clearPendingCheckins(); + + // emit our signal so listeners know we just heard from the DS + emit receivedDomainServerList(); + + DependencyManager::get()->flagTimeForConnectionStep(LimitedNodeList::ConnectionStep::ReceiveDSList); + + if (_domainHandler.isConnected() && _domainHandler.getUUID() != domainUUID) { + // Recieved packet from different domain. + qWarning() << "IGNORING DomainList packet from" << domainUUID << "while connected to" + << _domainHandler.getUUID() << ": sent " << pingLagTime << " msec ago."; + qWarning(networking) << "DomainList request lag (with skew): " << domainServerRequestLag << "msec"; + qWarning(networking) << "DomainList response lag (with skew): " << domainServerResponseLag << "msec"; + return; + } + // when connected, if the session ID or local ID were not null and changed, we should reset auto currentLocalID = getSessionLocalID(); auto currentSessionID = getSessionUUID(); @@ -684,15 +719,6 @@ void NodeList::processDomainServerList(QSharedPointer message) DependencyManager::get()->lookupShareableNameForDomainID(domainUUID); } - // pull the permissions/right/privileges for this node out of the stream - NodePermissions newPermissions; - packetStream >> newPermissions; - setPermissions(newPermissions); - // Is packet authentication enabled? - bool isAuthenticated; - packetStream >> isAuthenticated; - setAuthenticatePackets(isAuthenticated); - // pull each node in the packet while (packetStream.device()->pos() < message->getSize()) { parseNodeFromPacketStream(packetStream); diff --git a/libraries/networking/src/udt/PacketHeaders.cpp b/libraries/networking/src/udt/PacketHeaders.cpp index f8574b3b94..566e1e4946 100644 --- a/libraries/networking/src/udt/PacketHeaders.cpp +++ b/libraries/networking/src/udt/PacketHeaders.cpp @@ -27,7 +27,7 @@ PacketVersion versionForPacketType(PacketType packetType) { case PacketType::StunResponse: return 17; case PacketType::DomainList: - return static_cast(DomainListVersion::AuthenticationOptional); + return static_cast(DomainListVersion::HasTimestamp); case PacketType::EntityAdd: case PacketType::EntityClone: case PacketType::EntityEdit: @@ -72,7 +72,7 @@ PacketVersion versionForPacketType(PacketType packetType) { return static_cast(DomainConnectionDeniedVersion::IncludesExtraInfo); case PacketType::DomainConnectRequest: - return static_cast(DomainConnectRequestVersion::AlwaysHasMachineFingerprint); + return static_cast(DomainConnectRequestVersion::HasTimestamp); case PacketType::DomainServerAddedNode: return static_cast(DomainServerAddedNodeVersion::PermissionsGrid); diff --git a/libraries/networking/src/udt/PacketHeaders.h b/libraries/networking/src/udt/PacketHeaders.h index 5deadd8c43..903c1f4c93 100644 --- a/libraries/networking/src/udt/PacketHeaders.h +++ b/libraries/networking/src/udt/PacketHeaders.h @@ -344,7 +344,8 @@ enum class DomainConnectRequestVersion : PacketVersion { HasProtocolVersions, HasMACAddress, HasMachineFingerprint, - AlwaysHasMachineFingerprint + AlwaysHasMachineFingerprint, + HasTimestamp }; enum class DomainConnectionDeniedVersion : PacketVersion { @@ -363,7 +364,8 @@ enum class DomainListVersion : PacketVersion { PermissionsGrid, GetUsernameFromUUIDSupport, GetMachineFingerprintFromUUIDSupport, - AuthenticationOptional + AuthenticationOptional, + HasTimestamp }; enum class AudioVersion : PacketVersion { From 3a4bf2e8f7291f914facdcdeda5f3bb01f531950 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Wed, 22 May 2019 13:57:09 -0700 Subject: [PATCH 05/31] Fix the janky audio output settings UI --- .../simplifiedUI/settingsApp/audio/Audio.qml | 23 +++++----- .../simplifiedUI/topBar/SimplifiedTopBar.qml | 10 ++--- interface/src/scripting/Audio.cpp | 37 ++++++++++++++++ interface/src/scripting/Audio.h | 36 +++++++++++++++ scripts/system/simplifiedUI/simplifiedUI.js | 44 ++++++++----------- 5 files changed, 104 insertions(+), 46 deletions(-) diff --git a/interface/resources/qml/hifi/simplifiedUI/settingsApp/audio/Audio.qml b/interface/resources/qml/hifi/simplifiedUI/settingsApp/audio/Audio.qml index 3e2e4bf752..bb64e835d5 100644 --- a/interface/resources/qml/hifi/simplifiedUI/settingsApp/audio/Audio.qml +++ b/interface/resources/qml/hifi/simplifiedUI/settingsApp/audio/Audio.qml @@ -68,7 +68,6 @@ Flickable { SimplifiedControls.Slider { id: peopleVolume - property real lastValueSent anchors.left: parent.left anchors.right: parent.right Layout.topMargin: simplifiedUI.margins.settings.settingsGroupTopMargin @@ -78,11 +77,11 @@ Flickable { to: 20.0 defaultValue: 0.0 stepSize: 5.0 - value: AudioScriptingInterface.getAvatarGain() + value: AudioScriptingInterface.avatarGain live: true function updatePeopleGain(sliderValue) { - if (AudioScriptingInterface.getAvatarGain() !== sliderValue) { - AudioScriptingInterface.setAvatarGain(sliderValue); + if (AudioScriptingInterface.avatarGain !== sliderValue) { + AudioScriptingInterface.avatarGain = sliderValue; } } onValueChanged: { @@ -97,7 +96,6 @@ Flickable { SimplifiedControls.Slider { id: environmentVolume - property real lastValueSent anchors.left: parent.left anchors.right: parent.right Layout.topMargin: 2 @@ -107,12 +105,12 @@ Flickable { to: 20.0 defaultValue: 0.0 stepSize: 5.0 - value: AudioScriptingInterface.getInjectorGain() + value: AudioScriptingInterface.serverInjectorGain live: true function updateEnvironmentGain(sliderValue) { - if (AudioScriptingInterface.getInjectorGain() !== sliderValue) { - AudioScriptingInterface.setInjectorGain(sliderValue); - AudioScriptingInterface.setLocalInjectorGain(sliderValue); + if (AudioScriptingInterface.serverInjectorGain !== sliderValue) { + AudioScriptingInterface.serverInjectorGain = sliderValue; + AudioScriptingInterface.localInjectorGain = sliderValue; } } onValueChanged: { @@ -127,7 +125,6 @@ Flickable { SimplifiedControls.Slider { id: systemSoundVolume - property real lastValueSent anchors.left: parent.left anchors.right: parent.right Layout.topMargin: 2 @@ -137,11 +134,11 @@ Flickable { to: 20.0 defaultValue: 0.0 stepSize: 5.0 - value: AudioScriptingInterface.getSystemInjectorGain() + value: AudioScriptingInterface.systemInjectorGain live: true function updateSystemGain(sliderValue) { - if (AudioScriptingInterface.getSystemInjectorGain() !== sliderValue) { - AudioScriptingInterface.setSystemInjectorGain(sliderValue); + if (AudioScriptingInterface.systemInjectorGain !== sliderValue) { + AudioScriptingInterface.systemInjectorGain = sliderValue; } } onValueChanged: { diff --git a/interface/resources/qml/hifi/simplifiedUI/topBar/SimplifiedTopBar.qml b/interface/resources/qml/hifi/simplifiedUI/topBar/SimplifiedTopBar.qml index 66270cc325..1a85e6fbae 100644 --- a/interface/resources/qml/hifi/simplifiedUI/topBar/SimplifiedTopBar.qml +++ b/interface/resources/qml/hifi/simplifiedUI/topBar/SimplifiedTopBar.qml @@ -203,7 +203,8 @@ Rectangle { Image { id: outputDeviceButton - property bool outputMuted: false + property bool outputMuted: AudioScriptingInterface.avatarGain === -60 && + AudioScriptingInterface.serverInjectorGain === -60 && AudioScriptingInterface.localInjectorGain === -60 && AudioScriptingInterface.systemInjectorGain === -60 source: outputDeviceButton.outputMuted ? "./images/outputDeviceMuted.svg" : "./images/outputDeviceLoud.svg" anchors.centerIn: parent width: 20 @@ -228,7 +229,6 @@ Rectangle { } onClicked: { Tablet.playSound(TabletEnums.ButtonClick); - outputDeviceButton.outputMuted = !outputDeviceButton.outputMuted; if (outputDeviceButton.outputMuted && !AudioScriptingInterface.muted) { AudioScriptingInterface.muted = true; @@ -238,7 +238,7 @@ Rectangle { "source": "SimplifiedTopBar.qml", "method": "setOutputMuted", "data": { - "outputMuted": outputDeviceButton.outputMuted + "outputMuted": !outputDeviceButton.outputMuted } }); } @@ -454,10 +454,6 @@ Rectangle { } break; - case "updateOutputMuted": - outputDeviceButton.outputMuted = message.data.outputMuted; - break; - case "updateStatusButton": statusButton.currentStatus = message.data.currentStatus; break; diff --git a/interface/src/scripting/Audio.cpp b/interface/src/scripting/Audio.cpp index cb8b211352..6df4729ee0 100644 --- a/interface/src/scripting/Audio.cpp +++ b/interface/src/scripting/Audio.cpp @@ -400,10 +400,19 @@ void Audio::setReverbOptions(const AudioEffectOptions* options) { } void Audio::setAvatarGain(float gain) { + bool changed = false; + if (getAvatarGain() != gain) { + changed = true; + } + withWriteLock([&] { // ask the NodeList to set the master avatar gain DependencyManager::get()->setAvatarGain(QUuid(), gain); }); + + if (changed) { + emit avatarGainChanged(gain); + } } float Audio::getAvatarGain() { @@ -413,10 +422,19 @@ float Audio::getAvatarGain() { } void Audio::setInjectorGain(float gain) { + bool changed = false; + if (getInjectorGain() != gain) { + changed = true; + } + withWriteLock([&] { // ask the NodeList to set the audio injector gain DependencyManager::get()->setInjectorGain(gain); }); + + if (changed) { + emit serverInjectorGainChanged(gain); + } } float Audio::getInjectorGain() { @@ -426,6 +444,11 @@ float Audio::getInjectorGain() { } void Audio::setLocalInjectorGain(float gain) { + bool changed = false; + if (getLocalInjectorGain() != gain) { + changed = true; + } + withWriteLock([&] { if (_localInjectorGain != gain) { _localInjectorGain = gain; @@ -436,6 +459,11 @@ void Audio::setLocalInjectorGain(float gain) { DependencyManager::get()->setLocalInjectorGain(gain); } }); + + + if (changed) { + emit localInjectorGainChanged(gain); + } } float Audio::getLocalInjectorGain() { @@ -445,6 +473,11 @@ float Audio::getLocalInjectorGain() { } void Audio::setSystemInjectorGain(float gain) { + bool changed = false; + if (getSystemInjectorGain() != gain) { + changed = true; + } + withWriteLock([&] { if (_systemInjectorGain != gain) { _systemInjectorGain = gain; @@ -455,6 +488,10 @@ void Audio::setSystemInjectorGain(float gain) { DependencyManager::get()->setSystemInjectorGain(gain); } }); + + if (changed) { + emit systemInjectorGainChanged(gain); + } } float Audio::getSystemInjectorGain() { diff --git a/interface/src/scripting/Audio.h b/interface/src/scripting/Audio.h index ed54dca5c6..688009645f 100644 --- a/interface/src/scripting/Audio.h +++ b/interface/src/scripting/Audio.h @@ -90,6 +90,10 @@ class Audio : public AudioScriptingInterface, protected ReadWriteLockable { Q_PROPERTY(bool pushToTalkDesktop READ getPTTDesktop WRITE setPTTDesktop NOTIFY pushToTalkDesktopChanged) Q_PROPERTY(bool pushToTalkHMD READ getPTTHMD WRITE setPTTHMD NOTIFY pushToTalkHMDChanged) Q_PROPERTY(bool pushingToTalk READ getPushingToTalk WRITE setPushingToTalk NOTIFY pushingToTalkChanged) + Q_PROPERTY(float avatarGain READ getAvatarGain WRITE setAvatarGain NOTIFY avatarGainChanged) + Q_PROPERTY(float localInjectorGain READ getLocalInjectorGain WRITE setLocalInjectorGain NOTIFY localInjectorGainChanged) + Q_PROPERTY(float serverInjectorGain READ getInjectorGain WRITE setInjectorGain NOTIFY serverInjectorGainChanged) + Q_PROPERTY(float systemInjectorGain READ getSystemInjectorGain WRITE setSystemInjectorGain NOTIFY systemInjectorGainChanged) public: static QString AUDIO; @@ -412,6 +416,38 @@ signals: */ void pushingToTalkChanged(bool talking); + /**jsdoc + * Triggered when the avatar gain changes. + * @function Audio.avatarGainChanged + * @param {float} gain - The new avatar gain value. + * @returns {Signal} + */ + void avatarGainChanged(float gain); + + /**jsdoc + * Triggered when the local injector gain changes. + * @function Audio.localInjectorGainChanged + * @param {float} gain - The new local injector gain value. + * @returns {Signal} + */ + void localInjectorGainChanged(float gain); + + /**jsdoc + * Triggered when the server injector gain changes. + * @function Audio.serverInjectorGainChanged + * @param {float} gain - The new server injector gain value. + * @returns {Signal} + */ + void serverInjectorGainChanged(float gain); + + /**jsdoc + * Triggered when the system injector gain changes. + * @function Audio.systemInjectorGainChanged + * @param {float} gain - The new system injector gain value. + * @returns {Signal} + */ + void systemInjectorGainChanged(float gain); + public slots: /**jsdoc diff --git a/scripts/system/simplifiedUI/simplifiedUI.js b/scripts/system/simplifiedUI/simplifiedUI.js index 94eb9f84fd..624522730e 100644 --- a/scripts/system/simplifiedUI/simplifiedUI.js +++ b/scripts/system/simplifiedUI/simplifiedUI.js @@ -238,40 +238,40 @@ function updateOutputDeviceMutedOverlay(isMuted) { } -var savedAvatarGain = Audio.getAvatarGain(); -var savedInjectorGain = Audio.getInjectorGain(); -var savedLocalInjectorGain = Audio.getLocalInjectorGain(); -var savedSystemInjectorGain = Audio.getSystemInjectorGain(); +var savedAvatarGain = Audio.avatarGain; +var savedInjectorGain = Audio.serverInjectorGain; +var savedLocalInjectorGain = Audio.localInjectorGain; +var savedSystemInjectorGain = Audio.systemInjectorGain; function setOutputMuted(outputMuted) { updateOutputDeviceMutedOverlay(outputMuted); if (outputMuted) { - savedAvatarGain = Audio.getAvatarGain(); - savedInjectorGain = Audio.getInjectorGain(); - savedLocalInjectorGain = Audio.getLocalInjectorGain(); - savedSystemInjectorGain = Audio.getSystemInjectorGain(); + savedAvatarGain = Audio.avatarGain; + savedInjectorGain = Audio.serverInjectorGain; + savedLocalInjectorGain = Audio.localInjectorGain; + savedSystemInjectorGain = Audio.systemInjectorGain; - Audio.setAvatarGain(-60); - Audio.setInjectorGain(-60); - Audio.setLocalInjectorGain(-60); - Audio.setSystemInjectorGain(-60); + Audio.avatarGain = -60; + Audio.serverInjectorGain = -60; + Audio.localInjectorGain = -60; + Audio.systemInjectorGain = -60; } else { if (savedAvatarGain === -60) { savedAvatarGain = 0; } - Audio.setAvatarGain(savedAvatarGain); + Audio.avatarGain = savedAvatarGain; if (savedInjectorGain === -60) { savedInjectorGain = 0; } - Audio.setInjectorGain(savedInjectorGain); + Audio.serverInjectorGain = savedInjectorGain; if (savedLocalInjectorGain === -60) { savedLocalInjectorGain = 0; } - Audio.setLocalInjectorGain(savedLocalInjectorGain); + Audio.localInjectorGain = savedLocalInjectorGain; if (savedSystemInjectorGain === -60) { savedSystemInjectorGain = 0; } - Audio.setSystemInjectorGain(savedSystemInjectorGain); + Audio.systemInjectorGain = savedSystemInjectorGain; } } @@ -334,7 +334,7 @@ function onTopBarClosed() { function isOutputMuted() { - return Audio.getAvatarGain() === -60 && Audio.getInjectorGain() === -60 && Audio.getLocalInjectorGain() === -60 && Audio.getSystemInjectorGain() === -60; + return Audio.avatarGain === -60 && Audio.serverInjectorGain === -60 && Audio.localInjectorGain === -60 && Audio.systemInjectorGain === -60; } @@ -370,15 +370,7 @@ function loadSimplifiedTopBar() { // The eventbridge takes a nonzero time to initialize, so we have to wait a bit // for the QML to load and for that to happen before updating the UI. - Script.setTimeout(function() { - topBarWindow.sendToQml({ - "source": "simplifiedUI.js", - "method": "updateOutputMuted", - "data": { - "outputMuted": isOutputMuted() - } - }); - + Script.setTimeout(function() { sendLocalStatusToQml(); }, WAIT_FOR_TOP_BAR_MS); } From 0c90b7c4c214123836e623a5451a469ac63aca06 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Wed, 22 May 2019 14:51:11 -0700 Subject: [PATCH 06/31] JSdocs --- interface/src/scripting/Audio.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/interface/src/scripting/Audio.h b/interface/src/scripting/Audio.h index 688009645f..c7ac98402c 100644 --- a/interface/src/scripting/Audio.h +++ b/interface/src/scripting/Audio.h @@ -66,6 +66,10 @@ class Audio : public AudioScriptingInterface, protected ReadWriteLockable { * @property {boolean} pushToTalkHMD - true if HMD push-to-talk is enabled, otherwise false. * @property {boolean} pushingToTalk - true if the user is currently pushing-to-talk, otherwise * false. + * @property {float} avatarGain - The gain (relative volume) that avatars' voices are played at. This gain is used at the server. + * @property {float} localInjectorGain - The gain (relative volume) that local injectors (local environment sounds) are played at. + * @property {float} serverInjectorGain - The gain (relative volume) that server injectors (server environment sounds) are played at. This gain is used at the server. + * @property {float} systemInjectorGain - The gain (relative volume) that system sounds are played at. * * @comment The following properties are from AudioScriptingInterface.h. * @property {boolean} isStereoInput - true if the input audio is being used in stereo, otherwise From 04573da96b6b53d331136155f7f6ecde7605f476 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Thu, 23 May 2019 09:49:32 +1200 Subject: [PATCH 07/31] Selection JSDoc revision --- .../scripting/SelectionScriptingInterface.cpp | 33 +-- .../scripting/SelectionScriptingInterface.h | 225 +++++++++--------- 2 files changed, 128 insertions(+), 130 deletions(-) diff --git a/interface/src/scripting/SelectionScriptingInterface.cpp b/interface/src/scripting/SelectionScriptingInterface.cpp index c15b5cde11..556b17650d 100644 --- a/interface/src/scripting/SelectionScriptingInterface.cpp +++ b/interface/src/scripting/SelectionScriptingInterface.cpp @@ -44,13 +44,14 @@ SelectionScriptingInterface::SelectionScriptingInterface() { } /**jsdoc + * The type of an item in a selection list. * * * * * - * - * + * + * * *
ValueDescription
"avatar"
"entity"
"avatar"The item is an avatar.
"entity"The item is an entity.
* @typedef {string} Selection.ItemType @@ -245,9 +246,10 @@ void SelectionScriptingInterface::printList(const QString& listName) { } /**jsdoc + * A selection list. * @typedef {object} Selection.SelectedItemsList - * @property {Uuid[]} avatars - The IDs of the avatars in the selection. - * @property {Uuid[]} entities - The IDs of the entities in the selection. + * @property {Uuid[]} avatars - The IDs of the avatars in the selection list. + * @property {Uuid[]} entities - The IDs of the entities in the selection list. */ QVariantMap SelectionScriptingInterface::getSelectedItemsList(const QString& listName) const { QReadLocker lock(&_selectionListsLock); @@ -438,18 +440,19 @@ bool SelectionHighlightStyle::fromVariantMap(const QVariantMap& properties) { } /**jsdoc + * The highlighting style of a selection list. * @typedef {object} Selection.HighlightStyle - * @property {Color} outlineUnoccludedColor - Color of the specified highlight region. - * @property {Color} outlineOccludedColor - "" - * @property {Color} fillUnoccludedColor- "" - * @property {Color} fillOccludedColor- "" - * @property {number} outlineUnoccludedAlpha - Alpha value ranging from 0.0 (not visible) to 1.0 - * (fully opaque) for the specified highlight region. - * @property {number} outlineOccludedAlpha - "" - * @property {number} fillUnoccludedAlpha - "" - * @property {number} fillOccludedAlpha - "" - * @property {number} outlineWidth - Width of the outline, in pixels. - * @property {boolean} isOutlineSmooth - true to enable outline smooth fall-off. + * @property {Color} outlineUnoccludedColor=255,178,51 - Unoccluded outline color. + * @property {Color} outlineOccludedColor=255,178,51 - Occluded outline color. + * @property {Color} fillUnoccludedColor=51,178,255 - Unoccluded fill color. + * @property {Color} fillOccludedColor=51,178,255 - Occluded fill color. + * @property {number} outlineUnoccludedAlpha=0.9 - Unoccluded outline alpha, range 0.01.0. + * @property {number} outlineOccludedAlpha=0.9 - Occluded outline alpha, range 0.01.0. + * @property {number} fillUnoccludedAlpha=0.0 - Unoccluded fill alpha, range 0.01.0. + * @property {number} fillOccludedAlpha=0.0 - Occluded fill alpha, range 0.01.0. + * @property {number} outlineWidth=2 - Width of the outline, in pixels. + * @property {boolean} isOutlineSmooth=false - true to fade the outside edge of the outline, false + * to have a sharp edge. */ QVariantMap SelectionHighlightStyle::toVariantMap() const { QVariantMap properties; diff --git a/interface/src/scripting/SelectionScriptingInterface.h b/interface/src/scripting/SelectionScriptingInterface.h index fcb4090184..921db0e70b 100644 --- a/interface/src/scripting/SelectionScriptingInterface.h +++ b/interface/src/scripting/SelectionScriptingInterface.h @@ -77,47 +77,45 @@ protected: }; /**jsdoc - * The Selection API provides a means of grouping together avatars and entities in named lists. + * The Selection API provides a means of grouping together and highlighting avatars and entities in named lists. + * * @namespace Selection * * @hifi-interface * @hifi-client-entity * @hifi-avatar * - * @example Outline an entity when it is grabbed by a controller. - * // Create a box and copy the following text into the entity's "Script URL" field. + * @example Outline an entity when it is grabbed by the mouse or a controller. + * // Create an entity and copy the following script into the entity's "Script URL" field. + * // Move the entity behind another entity to see the occluded outline. * (function () { - * print("Starting highlight script..............."); - * var _this = this; - * var prevID = 0; - * var listName = "contextOverlayHighlightList"; - * var listType = "entity"; - * - * _this.startNearGrab = function(entityID){ - * if (prevID !== entityID) { - * Selection.addToSelectedItemsList(listName, listType, entityID); - * prevID = entityID; - * } + * var LIST_NAME = "SelectionExample", + * ITEM_TYPE = "entity", + * HIGHLIGHT_STYLE = { + * outlineUnoccludedColor: { red: 0, green: 180, blue: 239 }, + * outlineUnoccludedAlpha: 0.5, + * outlineOccludedColor: { red: 239, green: 180, blue: 0 }, + * outlineOccludedAlpha: 0.5, + * outlineWidth: 4 + * }; + * + * Selection.enableListHighlight(LIST_NAME, HIGHLIGHT_STYLE); + * + * this.startNearGrab = function (entityID) { + * Selection.addToSelectedItemsList(LIST_NAME, ITEM_TYPE, entityID); * }; - * - * _this.releaseGrab = function(entityID){ - * if (prevID !== 0) { - * Selection.removeFromSelectedItemsList("contextOverlayHighlightList", listType, prevID); - * prevID = 0; - * } + * + * this.startDistanceGrab = function (entityID) { + * Selection.addToSelectedItemsList(LIST_NAME, ITEM_TYPE, entityID); * }; - * - * var cleanup = function(){ - * Entities.findEntities(MyAvatar.position, 1000).forEach(function(entity) { - * try { - * Selection.removeListFromMap(listName); - * } catch (e) { - * print("Error cleaning up."); - * } - * }); + * + * this.releaseGrab = function (entityID) { + * Selection.removeFromSelectedItemsList(LIST_NAME, ITEM_TYPE, entityID); * }; - * - * Script.scriptEnding.connect(cleanup); + * + * Script.scriptEnding.connect(function () { + * Selection.removeListFromMap(LIST_NAME); + * }); * }); */ class SelectionScriptingInterface : public QObject, public Dependency { @@ -127,121 +125,119 @@ public: SelectionScriptingInterface(); /**jsdoc - * Get the names of all the selection lists. - * @function Selection.getListNames - * @returns {list[]} An array of names of all the selection lists. - */ + * Gets the names of all current selection lists. + * @function Selection.getListNames + * @returns {string[]} The names of all current selection lists. + * @example List all the current selection lists. + * print("Selection lists: " + Selection.getListNames()); + */ Q_INVOKABLE QStringList getListNames() const; /**jsdoc - * Delete a named selection list. - * @function Selection.removeListFromMap - * @param {string} listName - The name of the selection list. - * @returns {boolean} true if the selection existed and was successfully removed, otherwise false. - */ + * Deletes a selection list. + * @function Selection.removeListFromMap + * @param {string} listName - The name of the selection list to delete. + * @returns {boolean} true if the selection existed and was successfully removed, otherwise false. + */ Q_INVOKABLE bool removeListFromMap(const QString& listName); /**jsdoc - * Add an item to a selection list. - * @function Selection.addToSelectedItemsList - * @param {string} listName - The name of the selection list to add the item to. - * @param {Selection.ItemType} itemType - The type of the item being added. - * @param {Uuid} id - The ID of the item to add to the selection. - * @returns {boolean} true if the item was successfully added, otherwise false. - */ + * Adds an item to a selection list. The list is created if it doesn't exist. + * @function Selection.addToSelectedItemsList + * @param {string} listName - The name of the selection list to add the item to. + * @param {Selection.ItemType} itemType - The type of item being added. + * @param {Uuid} itemID - The ID of the item to add. + * @returns {boolean} true if the item was successfully added or already existed in the list, otherwise + * false. + */ Q_INVOKABLE bool addToSelectedItemsList(const QString& listName, const QString& itemType, const QUuid& id); + /**jsdoc - * Remove an item from a selection list. - * @function Selection.removeFromSelectedItemsList - * @param {string} listName - The name of the selection list to remove the item from. - * @param {Selection.ItemType} itemType - The type of the item being removed. - * @param {Uuid} id - The ID of the item to remove. - * @returns {boolean} true if the item was successfully removed, otherwise false. - * is returned if the list doesn't contain any data. - */ + * Removes an item from a selection list. + * @function Selection.removeFromSelectedItemsList + * @param {string} listName - The name of the selection list to remove the item from. + * @param {Selection.ItemType} itemType - The type of item being removed. + * @param {Uuid} itemID - The ID of the item to remove. + * @returns {boolean} true if the item was successfully removed or was not in the list, otherwise + * false. + */ Q_INVOKABLE bool removeFromSelectedItemsList(const QString& listName, const QString& itemType, const QUuid& id); + /**jsdoc - * Remove all items from a selection. - * @function Selection.clearSelectedItemsList - * @param {string} listName - The name of the selection list. - * @returns {boolean} true if the item was successfully cleared, otherwise false. - */ + * Removes all items from a selection list. + * @function Selection.clearSelectedItemsList + * @param {string} listName - The name of the selection list. + * @returns {boolean} true zlways. + */ Q_INVOKABLE bool clearSelectedItemsList(const QString& listName); /**jsdoc - * Print out the list of avatars and entities in a selection to the debug log (not the script log). - * @function Selection.printList - * @param {string} listName - The name of the selection list. - */ + * Prints the list of avatars and entities in a selection to the program log (but not the Script Log window). + * @function Selection.printList + * @param {string} listName - The name of the selection list. + */ Q_INVOKABLE void printList(const QString& listName); /**jsdoc - * Get the list of avatars and entities stored in a selection list. - * @function Selection.getSelectedItemsList - * @param {string} listName - The name of the selection list. - * @returns {Selection.SelectedItemsList} The content of a selection list. If the list name doesn't exist, the function - * returns an empty object with no properties. - */ + * Gets the list of avatars and entities in a selection list. + * @function Selection.getSelectedItemsList + * @param {string} listName - The name of the selection list. + * @returns {Selection.SelectedItemsList} The content of the selection list if the list exists, otherwise an empty object. + */ Q_INVOKABLE QVariantMap getSelectedItemsList(const QString& listName) const; /**jsdoc - * Get the names of the highlighted selection lists. - * @function Selection.getHighlightedListNames - * @returns {string[]} An array of names of the selection list currently highlight enabled. - */ + * Gets the names of all current selection lists that have highlighting enabled. + * @function Selection.getHighlightedListNames + * @returns {string[]} The names of the selection lists that currently have highlighting enabled. + */ Q_INVOKABLE QStringList getHighlightedListNames() const; /**jsdoc - * Enable highlighting for a selection list. - * If the selection list doesn't exist, it will be created. - * All objects in the list will be displayed with the highlight effect specified. - * The function can be called several times with different values in the style to modify it.
- * Note: This function implicitly calls {@link Selection.enableListToScene}. - * @function Selection.enableListHighlight - * @param {string} listName - The name of the selection list. - * @param {Selection.HighlightStyle} highlightStyle - The highlight style. - * @returns {boolean} true if the selection was successfully enabled for highlight. - */ + * Enables highlighting for a selection list. All items in or subsequently added to the list are displayed with the + * highlight effect specified. The method can be called multiple times with different values in the style to modify the + * highlighting. + *

Note: This function implicitly calls {@link Selection.enableListToScene|enableListToScene}.

+ * @function Selection.enableListHighlight + * @param {string} listName - The name of the selection list. + * @param {Selection.HighlightStyle} highlightStyle - The highlight style. + * @returns {boolean} true always. + */ Q_INVOKABLE bool enableListHighlight(const QString& listName, const QVariantMap& highlightStyle); /**jsdoc - * Disable highlighting for the selection list. - * If the selection list doesn't exist or wasn't enabled for highlighting then nothing happens and false is - * returned.
- * Note: This function implicitly calls {@link Selection.disableListToScene}. - * @function Selection.disableListHighlight - * @param {string} listName - The name of the selection list. - * @returns {boolean} true if the selection was successfully disabled for highlight, otherwise - * false. - */ + * Disables highlighting for a selection list. + *

Note: This function implicitly calls {@link Selection.disableListToScene|disableListToScene}.

+ * @function Selection.disableListHighlight + * @param {string} listName - The name of the selection list. + * @returns {boolean} true always. + */ Q_INVOKABLE bool disableListHighlight(const QString& listName); + /**jsdoc - * Enable scene selection for the selection list. - * If the Selection doesn't exist, it will be created. - * All objects in the list will be sent to a scene selection. - * @function Selection.enableListToScene - * @param {string} listName - The name of the selection list. - * @returns {boolean} true if the selection was successfully enabled on the scene, otherwise false. - */ + * Enables scene selection for a selection list. All items in or subsequently added to the list are sent to a scene + * selection in the rendering engine for debugging purposes. + * @function Selection.enableListToScene + * @param {string} listName - The name of the selection list. + * @returns {boolean} true always. + */ Q_INVOKABLE bool enableListToScene(const QString& listName); /**jsdoc - * Disable scene selection for the named selection. - * If the selection list doesn't exist or wasn't enabled on the scene then nothing happens and false is - * returned. - * @function Selection.disableListToScene - * @param {string} listName - The name of the selection list. - * @returns {boolean} true if the selection was successfully disabled on the scene, false otherwise. - */ + * Disables scene selection for a selection list. + * @function Selection.disableListToScene + * @param {string} listName - The name of the selection list. + * @returns {boolean} true always. + */ Q_INVOKABLE bool disableListToScene(const QString& listName); /**jsdoc - * Get the highlight style values for the a selection list. - * If the selection doesn't exist or hasn't been highlight enabled yet, an empty object is returned. - * @function Selection.getListHighlightStyle - * @param {string} listName - The name of the selection list. - * @returns {Selection.HighlightStyle} highlight style - */ + * Gets the current highlighting style for a selection list. + * @function Selection.getListHighlightStyle + * @param {string} listName - The name of the selection list. + * @returns {Selection.HighlightStyle} The highlight style of the selection list if the list exists and highlighting is + * enabled, otherwise an empty object. + */ Q_INVOKABLE QVariantMap getListHighlightStyle(const QString& listName) const; @@ -253,7 +249,7 @@ public: signals: /**jsdoc - * Triggered when a list's content changes. + * Triggered when a selection list's content changes or the list is deleted. * @function Selection.selectedItemsListChanged * @param {string} listName - The name of the selection list that changed. * @returns {Signal} @@ -276,7 +272,6 @@ private: void setupHandler(const QString& selectionName); void removeHandler(const QString& selectionName); - }; #endif // hifi_SelectionScriptingInterface_h From 7a88c8362b08502d172f3984e0ca90e0606852a8 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Wed, 22 May 2019 15:01:22 -0700 Subject: [PATCH 08/31] naming CR feedback --- scripts/system/simplifiedUI/simplifiedUI.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/system/simplifiedUI/simplifiedUI.js b/scripts/system/simplifiedUI/simplifiedUI.js index 624522730e..d55663edab 100644 --- a/scripts/system/simplifiedUI/simplifiedUI.js +++ b/scripts/system/simplifiedUI/simplifiedUI.js @@ -239,7 +239,7 @@ function updateOutputDeviceMutedOverlay(isMuted) { var savedAvatarGain = Audio.avatarGain; -var savedInjectorGain = Audio.serverInjectorGain; +var savedServerInjectorGain = Audio.serverInjectorGain; var savedLocalInjectorGain = Audio.localInjectorGain; var savedSystemInjectorGain = Audio.systemInjectorGain; function setOutputMuted(outputMuted) { @@ -247,7 +247,7 @@ function setOutputMuted(outputMuted) { if (outputMuted) { savedAvatarGain = Audio.avatarGain; - savedInjectorGain = Audio.serverInjectorGain; + savedServerInjectorGain = Audio.serverInjectorGain; savedLocalInjectorGain = Audio.localInjectorGain; savedSystemInjectorGain = Audio.systemInjectorGain; @@ -260,10 +260,10 @@ function setOutputMuted(outputMuted) { savedAvatarGain = 0; } Audio.avatarGain = savedAvatarGain; - if (savedInjectorGain === -60) { - savedInjectorGain = 0; + if (savedServerInjectorGain === -60) { + savedServerInjectorGain = 0; } - Audio.serverInjectorGain = savedInjectorGain; + Audio.serverInjectorGain = savedServerInjectorGain; if (savedLocalInjectorGain === -60) { savedLocalInjectorGain = 0; } From b331bb06836975567530d87963ca12ab1be78e4a Mon Sep 17 00:00:00 2001 From: Roxanne Skelly Date: Wed, 22 May 2019 15:03:39 -0700 Subject: [PATCH 09/31] Initialize structure member as per code review suggestion. --- domain-server/src/NodeConnectionData.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/domain-server/src/NodeConnectionData.h b/domain-server/src/NodeConnectionData.h index 96e81839c6..779411d11e 100644 --- a/domain-server/src/NodeConnectionData.h +++ b/domain-server/src/NodeConnectionData.h @@ -22,7 +22,7 @@ public: bool isConnectRequest = true); QUuid connectUUID; - quint64 lastPingTimestamp; + quint64 lastPingTimestamp{ 0 }; NodeType_t nodeType; HifiSockAddr publicSockAddr; HifiSockAddr localSockAddr; From 2c591ba19673b157f2f40d4d611741d9087e853a Mon Sep 17 00:00:00 2001 From: David Rowe Date: Thu, 23 May 2019 10:18:03 +1200 Subject: [PATCH 10/31] Doc review --- interface/src/scripting/SelectionScriptingInterface.cpp | 2 +- interface/src/scripting/SelectionScriptingInterface.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/interface/src/scripting/SelectionScriptingInterface.cpp b/interface/src/scripting/SelectionScriptingInterface.cpp index 556b17650d..5856188868 100644 --- a/interface/src/scripting/SelectionScriptingInterface.cpp +++ b/interface/src/scripting/SelectionScriptingInterface.cpp @@ -44,7 +44,7 @@ SelectionScriptingInterface::SelectionScriptingInterface() { } /**jsdoc - * The type of an item in a selection list. + * The type of a specific item in a selection list. * * * diff --git a/interface/src/scripting/SelectionScriptingInterface.h b/interface/src/scripting/SelectionScriptingInterface.h index 921db0e70b..4386ee5ee6 100644 --- a/interface/src/scripting/SelectionScriptingInterface.h +++ b/interface/src/scripting/SelectionScriptingInterface.h @@ -167,7 +167,7 @@ public: * Removes all items from a selection list. * @function Selection.clearSelectedItemsList * @param {string} listName - The name of the selection list. - * @returns {boolean} true zlways. + * @returns {boolean} true always. */ Q_INVOKABLE bool clearSelectedItemsList(const QString& listName); From 46ee148a69d345326f167bbb15665f5b277fcf12 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Wed, 22 May 2019 15:24:33 -0700 Subject: [PATCH 11/31] Fix a bug and remove magic numbers --- .../simplifiedUI/settingsApp/audio/Audio.qml | 6 +-- .../SimplifiedConstants.qml | 4 ++ .../simplifiedUI/topBar/SimplifiedTopBar.qml | 8 ++-- scripts/system/simplifiedUI/simplifiedUI.js | 37 +++++++++++++------ 4 files changed, 38 insertions(+), 17 deletions(-) diff --git a/interface/resources/qml/hifi/simplifiedUI/settingsApp/audio/Audio.qml b/interface/resources/qml/hifi/simplifiedUI/settingsApp/audio/Audio.qml index bb64e835d5..9ac72fa3cd 100644 --- a/interface/resources/qml/hifi/simplifiedUI/settingsApp/audio/Audio.qml +++ b/interface/resources/qml/hifi/simplifiedUI/settingsApp/audio/Audio.qml @@ -73,7 +73,7 @@ Flickable { Layout.topMargin: simplifiedUI.margins.settings.settingsGroupTopMargin height: 30 labelText: "People Volume" - from: -60.0 + from: simplifiedUI.numericConstants.mutedValue to: 20.0 defaultValue: 0.0 stepSize: 5.0 @@ -101,7 +101,7 @@ Flickable { Layout.topMargin: 2 height: 30 labelText: "Environment Volume" - from: -60.0 + from: simplifiedUI.numericConstants.mutedValue to: 20.0 defaultValue: 0.0 stepSize: 5.0 @@ -130,7 +130,7 @@ Flickable { Layout.topMargin: 2 height: 30 labelText: "System Sound Volume" - from: -60.0 + from: simplifiedUI.numericConstants.mutedValue to: 20.0 defaultValue: 0.0 stepSize: 5.0 diff --git a/interface/resources/qml/hifi/simplifiedUI/simplifiedConstants/SimplifiedConstants.qml b/interface/resources/qml/hifi/simplifiedUI/simplifiedConstants/SimplifiedConstants.qml index 752c989500..1f628b041d 100644 --- a/interface/resources/qml/hifi/simplifiedUI/simplifiedConstants/SimplifiedConstants.qml +++ b/interface/resources/qml/hifi/simplifiedUI/simplifiedConstants/SimplifiedConstants.qml @@ -221,4 +221,8 @@ QtObject { } } } + + readonly property QtObject numericConstants: QtObject { + readonly property real mutedValue: -60.0 + } } diff --git a/interface/resources/qml/hifi/simplifiedUI/topBar/SimplifiedTopBar.qml b/interface/resources/qml/hifi/simplifiedUI/topBar/SimplifiedTopBar.qml index 1a85e6fbae..27a786ece2 100644 --- a/interface/resources/qml/hifi/simplifiedUI/topBar/SimplifiedTopBar.qml +++ b/interface/resources/qml/hifi/simplifiedUI/topBar/SimplifiedTopBar.qml @@ -203,8 +203,10 @@ Rectangle { Image { id: outputDeviceButton - property bool outputMuted: AudioScriptingInterface.avatarGain === -60 && - AudioScriptingInterface.serverInjectorGain === -60 && AudioScriptingInterface.localInjectorGain === -60 && AudioScriptingInterface.systemInjectorGain === -60 + property bool outputMuted: AudioScriptingInterface.avatarGain === simplifiedUI.numericConstants.mutedValue && + AudioScriptingInterface.serverInjectorGain === simplifiedUI.numericConstants.mutedValue && + AudioScriptingInterface.localInjectorGain === simplifiedUI.numericConstants.mutedValue && + AudioScriptingInterface.systemInjectorGain === simplifiedUI.numericConstants.mutedValue source: outputDeviceButton.outputMuted ? "./images/outputDeviceMuted.svg" : "./images/outputDeviceLoud.svg" anchors.centerIn: parent width: 20 @@ -230,7 +232,7 @@ Rectangle { onClicked: { Tablet.playSound(TabletEnums.ButtonClick); - if (outputDeviceButton.outputMuted && !AudioScriptingInterface.muted) { + if (!outputDeviceButton.outputMuted && !AudioScriptingInterface.muted) { AudioScriptingInterface.muted = true; } diff --git a/scripts/system/simplifiedUI/simplifiedUI.js b/scripts/system/simplifiedUI/simplifiedUI.js index d55663edab..351372613b 100644 --- a/scripts/system/simplifiedUI/simplifiedUI.js +++ b/scripts/system/simplifiedUI/simplifiedUI.js @@ -242,33 +242,32 @@ var savedAvatarGain = Audio.avatarGain; var savedServerInjectorGain = Audio.serverInjectorGain; var savedLocalInjectorGain = Audio.localInjectorGain; var savedSystemInjectorGain = Audio.systemInjectorGain; +var MUTED_VALUE_DB = -60; // This should always match `SimplifiedConstants.qml` -> numericConstants -> mutedValue! function setOutputMuted(outputMuted) { - updateOutputDeviceMutedOverlay(outputMuted); - if (outputMuted) { savedAvatarGain = Audio.avatarGain; savedServerInjectorGain = Audio.serverInjectorGain; savedLocalInjectorGain = Audio.localInjectorGain; savedSystemInjectorGain = Audio.systemInjectorGain; - Audio.avatarGain = -60; - Audio.serverInjectorGain = -60; - Audio.localInjectorGain = -60; - Audio.systemInjectorGain = -60; + Audio.avatarGain = MUTED_VALUE_DB; + Audio.serverInjectorGain = MUTED_VALUE_DB; + Audio.localInjectorGain = MUTED_VALUE_DB; + Audio.systemInjectorGain = MUTED_VALUE_DB; } else { - if (savedAvatarGain === -60) { + if (savedAvatarGain === MUTED_VALUE_DB) { savedAvatarGain = 0; } Audio.avatarGain = savedAvatarGain; - if (savedServerInjectorGain === -60) { + if (savedServerInjectorGain === MUTED_VALUE_DB) { savedServerInjectorGain = 0; } Audio.serverInjectorGain = savedServerInjectorGain; - if (savedLocalInjectorGain === -60) { + if (savedLocalInjectorGain === MUTED_VALUE_DB) { savedLocalInjectorGain = 0; } Audio.localInjectorGain = savedLocalInjectorGain; - if (savedSystemInjectorGain === -60) { + if (savedSystemInjectorGain === MUTED_VALUE_DB) { savedSystemInjectorGain = 0; } Audio.systemInjectorGain = savedSystemInjectorGain; @@ -334,7 +333,10 @@ function onTopBarClosed() { function isOutputMuted() { - return Audio.avatarGain === -60 && Audio.serverInjectorGain === -60 && Audio.localInjectorGain === -60 && Audio.systemInjectorGain === -60; + return Audio.avatarGain === MUTED_VALUE_DB && + Audio.serverInjectorGain === MUTED_VALUE_DB && + Audio.localInjectorGain === MUTED_VALUE_DB && + Audio.systemInjectorGain === MUTED_VALUE_DB; } @@ -461,6 +463,11 @@ function onStatusChanged() { } +function maybeUpdateOutputDeviceMutedOverlay() { + updateOutputDeviceMutedOverlay(isOutputMuted()); +} + + var simplifiedNametag = Script.require("./simplifiedNametag/simplifiedNametag.js?" + Date.now()); var SimplifiedStatusIndicator = Script.require("./simplifiedStatusIndicator/simplifiedStatusIndicator.js?" + Date.now()); var si; @@ -493,6 +500,10 @@ function startup() { Audio.mutedDesktopChanged.connect(onDesktopInputDeviceMutedChanged); Window.geometryChanged.connect(onGeometryChanged); HMD.displayModeChanged.connect(ensureFirstPersonCameraInHMD); + Audio.avatarGainChanged.connect(maybeUpdateOutputDeviceMutedOverlay); + Audio.localInjectorGainChanged.connect(maybeUpdateOutputDeviceMutedOverlay); + Audio.serverInjectorGainChanged.connect(maybeUpdateOutputDeviceMutedOverlay); + Audio.systemInjectorGainChanged.connect(maybeUpdateOutputDeviceMutedOverlay); oldShowAudioTools = AvatarInputs.showAudioTools; AvatarInputs.showAudioTools = false; @@ -543,6 +554,10 @@ function shutdown() { Audio.mutedDesktopChanged.disconnect(onDesktopInputDeviceMutedChanged); Window.geometryChanged.disconnect(onGeometryChanged); HMD.displayModeChanged.disconnect(ensureFirstPersonCameraInHMD); + Audio.avatarGainChanged.disconnect(maybeUpdateOutputDeviceMutedOverlay); + Audio.localInjectorGainChanged.disconnect(maybeUpdateOutputDeviceMutedOverlay); + Audio.serverInjectorGainChanged.disconnect(maybeUpdateOutputDeviceMutedOverlay); + Audio.systemInjectorGainChanged.disconnect(maybeUpdateOutputDeviceMutedOverlay); AvatarInputs.showAudioTools = oldShowAudioTools; AvatarInputs.showBubbleTools = oldShowBubbleTools; From 3ed47b4f2345d91602aa98ec4fde1a05f961defd Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Wed, 22 May 2019 15:45:18 -0700 Subject: [PATCH 12/31] Show error states in Avatar app (BUGZ-310) --- .../hifi/simplifiedUI/avatarApp/AvatarApp.qml | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/interface/resources/qml/hifi/simplifiedUI/avatarApp/AvatarApp.qml b/interface/resources/qml/hifi/simplifiedUI/avatarApp/AvatarApp.qml index 57bec2250f..cb0da7c0df 100644 --- a/interface/resources/qml/hifi/simplifiedUI/avatarApp/AvatarApp.qml +++ b/interface/resources/qml/hifi/simplifiedUI/avatarApp/AvatarApp.qml @@ -58,7 +58,8 @@ Rectangle { if (isLoggedIn) { Commerce.getWalletStatus(); } else { - // Show some error to the user + errorText.text = "There was a problem while retrieving your inventory. " + + "Please try closing and re-opening the Avatar app.\n\nLogin status result: " + isLoggedIn; } } @@ -66,11 +67,17 @@ Rectangle { if (walletStatus === 5) { getInventory(); } else { - // Show some error to the user + errorText.text = "There was a problem while retrieving your inventory. " + + "Please try closing and re-opening the Avatar app.\n\nWallet status result: " + walletStatus; } } onInventoryResult: { + if (result.status !== "success") { + errorText.text = "There was a problem while retrieving your inventory. " + + "Please try closing and re-opening the Avatar app.\n\nInventory status: " + result.status + "\nMessage: " + result.message; + } + avatarAppInventoryModel.handlePage(result.status !== "success" && result.message, result); root.updatePreviewUrl(); } @@ -172,7 +179,7 @@ Rectangle { anchors.bottom: parent.bottom AnimatedImage { - visible: !inventoryContentsList.visible + visible: !inventoryContentsList.visible && !errorText.visible anchors.centerIn: parent width: 72 height: width @@ -181,7 +188,7 @@ Rectangle { ListView { id: inventoryContentsList - visible: avatarAppInventoryModel.count !== 0 + visible: avatarAppInventoryModel.count !== 0 && !errorText.visible interactive: contentItem.height > height clip: true model: avatarAppInventoryModel @@ -196,6 +203,18 @@ Rectangle { standaloneIncompatible: model.standalone_incompatible } } + + HifiStylesUit.GraphikRegular { + id: errorText + text: "" + visible: text !== "" + anchors.fill: parent + size: 22 + color: simplifiedUI.colors.text.white + wrapMode: Text.Wrap + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + } } From 8df706abcb33fa6067b8370c7eb619ca4d18fd38 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Wed, 22 May 2019 15:51:46 -0700 Subject: [PATCH 13/31] Handle the case when the user doesn't have any avatars yet --- .../resources/qml/hifi/simplifiedUI/avatarApp/AvatarApp.qml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/interface/resources/qml/hifi/simplifiedUI/avatarApp/AvatarApp.qml b/interface/resources/qml/hifi/simplifiedUI/avatarApp/AvatarApp.qml index cb0da7c0df..b426f2d986 100644 --- a/interface/resources/qml/hifi/simplifiedUI/avatarApp/AvatarApp.qml +++ b/interface/resources/qml/hifi/simplifiedUI/avatarApp/AvatarApp.qml @@ -76,6 +76,8 @@ Rectangle { if (result.status !== "success") { errorText.text = "There was a problem while retrieving your inventory. " + "Please try closing and re-opening the Avatar app.\n\nInventory status: " + result.status + "\nMessage: " + result.message; + } else if (result.data && result.data.assets && result.data.assets.length === 0) { + errorText.text = "You have not created any avatars yet! Create an avatar with the Avatar Creator, then close and re-open the Avatar App." } avatarAppInventoryModel.handlePage(result.status !== "success" && result.message, result); From 55f1929de22ee94e03a2e24ac741d723d7ae488b Mon Sep 17 00:00:00 2001 From: Clement Date: Wed, 22 May 2019 16:08:26 -0700 Subject: [PATCH 14/31] Fix nodelist reset on logout/username change --- libraries/networking/src/NodeList.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/networking/src/NodeList.cpp b/libraries/networking/src/NodeList.cpp index 11c7ca53b7..31576ff8d9 100644 --- a/libraries/networking/src/NodeList.cpp +++ b/libraries/networking/src/NodeList.cpp @@ -91,10 +91,10 @@ NodeList::NodeList(char newOwnerType, int socketListenPort, int dtlsListenPort) connect(accountManager.data(), &AccountManager::newKeypair, this, &NodeList::sendDomainServerCheckIn); // clear out NodeList when login is finished and we know our new username - connect(accountManager.data(), SIGNAL(usernameChanged(QString)) , this, SLOT(reset())); + connect(accountManager.data(), &AccountManager::usernameChanged , this, [this]{ reset("Username changed"); }); // clear our NodeList when logout is requested - connect(accountManager.data(), SIGNAL(logoutComplete()) , this, SLOT(reset())); + connect(accountManager.data(), &AccountManager::logoutComplete , this, [this]{ reset("Logged out"); }); // anytime we get a new node we will want to attempt to punch to it connect(this, &LimitedNodeList::nodeAdded, this, &NodeList::startNodeHolePunch); From 206e35326462de92f9e47daded61b6f0c9f24829 Mon Sep 17 00:00:00 2001 From: luiscuenca Date: Wed, 22 May 2019 16:18:30 -0700 Subject: [PATCH 15/31] Pass tokens as params for automatic login --- interface/src/main.cpp | 18 +++++- libraries/networking/src/AccountManager.cpp | 63 +++++++++++++++++++++ libraries/networking/src/AccountManager.h | 5 ++ 3 files changed, 85 insertions(+), 1 deletion(-) diff --git a/interface/src/main.cpp b/interface/src/main.cpp index 9d8b733ba7..303d7f210b 100644 --- a/interface/src/main.cpp +++ b/interface/src/main.cpp @@ -83,6 +83,7 @@ int main(int argc, const char* argv[]) { QCommandLineOption allowMultipleInstancesOption("allowMultipleInstances", "Allow multiple instances to run"); QCommandLineOption overrideAppLocalDataPathOption("cache", "set test cache ", "dir"); QCommandLineOption overrideScriptsPathOption(SCRIPTS_SWITCH, "set scripts ", "path"); + QCommandLineOption responseTokensOption("tokens", "set response tokens ", "json"); parser.addOption(urlOption); parser.addOption(noLauncherOption); @@ -93,6 +94,7 @@ int main(int argc, const char* argv[]) { parser.addOption(overrideAppLocalDataPathOption); parser.addOption(overrideScriptsPathOption); parser.addOption(allowMultipleInstancesOption); + parser.addOption(responseTokensOption); if (!parser.parse(arguments)) { std::cout << parser.errorText().toStdString() << std::endl; // Avoid Qt log spam @@ -121,7 +123,7 @@ int main(int argc, const char* argv[]) { static const QString APPLICATION_CONFIG_FILENAME = "config.json"; QDir applicationDir(applicationPath); QFile configFile(applicationDir.filePath(APPLICATION_CONFIG_FILENAME)); - + bool isConfigFileValid = false; if (configFile.exists()) { if (!configFile.open(QIODevice::ReadOnly)) { qWarning() << "Found application config, but could not open it"; @@ -136,6 +138,7 @@ int main(int argc, const char* argv[]) { static const QString LAUNCHER_PATH_KEY = "launcherPath"; QString launcherPath = doc.object()[LAUNCHER_PATH_KEY].toString(); if (!launcherPath.isEmpty()) { + isConfigFileValid = true; if (!parser.isSet(noLauncherOption)) { qDebug() << "Found a launcherPath in application config. Starting launcher."; QProcess launcher; @@ -146,6 +149,7 @@ int main(int argc, const char* argv[]) { qDebug() << "Found a launcherPath in application config, but the launcher" " has been suppressed. Continuing normal execution."; } + configFile.close(); } } } @@ -398,6 +402,18 @@ int main(int argc, const char* argv[]) { printSystemInformation(); + if (isConfigFileValid || parser.isSet(responseTokensOption)) { + auto accountManager = DependencyManager::get(); + if (!accountManager.isNull()) { + if (parser.isSet(responseTokensOption)) { + QString tokens = QString(parser.value(responseTokensOption)); + accountManager->setAccessTokens(tokens); + } else if (isConfigFileValid) { + accountManager->setConfigFileURL(configFile.fileName()); + } + } + } + QTranslator translator; translator.load("i18n/interface_en"); app.installTranslator(&translator); diff --git a/libraries/networking/src/AccountManager.cpp b/libraries/networking/src/AccountManager.cpp index 226433e388..014ae62aff 100644 --- a/libraries/networking/src/AccountManager.cpp +++ b/libraries/networking/src/AccountManager.cpp @@ -97,6 +97,7 @@ void AccountManager::logout() { // remove this account from the account settings file removeAccountFromFile(); + saveLoginStatus(false); emit logoutComplete(); // the username has changed to blank @@ -650,6 +651,39 @@ void AccountManager::refreshAccessToken() { } } +void AccountManager::setAccessTokens(const QString& response) { + QJsonDocument jsonResponse = QJsonDocument::fromJson(response.toUtf8()); + const QJsonObject& rootObject = jsonResponse.object(); + + if (!rootObject.contains("error")) { + // construct an OAuthAccessToken from the json object + + if (!rootObject.contains("access_token") || !rootObject.contains("expires_in") + || !rootObject.contains("token_type")) { + // TODO: error handling - malformed token response + qCDebug(networking) << "Received a response for password grant that is missing one or more expected values."; + } else { + // clear the path from the response URL so we have the right root URL for this access token + QUrl rootURL = rootObject.contains("url") ? rootObject["url"].toString() : _authURL; + rootURL.setPath(""); + + qCDebug(networking) << "Storing an account with access-token for" << qPrintable(rootURL.toString()); + + _accountInfo = DataServerAccountInfo(); + _accountInfo.setAccessTokenFromJSON(rootObject); + emit loginComplete(rootURL); + + persistAccountToFile(); + + requestProfile(); + } + } else { + // TODO: error handling + qCDebug(networking) << "Error in response for password grant -" << rootObject["error_description"].toString(); + emit loginFailed(); + } +} + void AccountManager::requestAccessTokenFinished() { QNetworkReply* requestReply = reinterpret_cast(sender()); @@ -895,3 +929,32 @@ void AccountManager::handleKeypairGenerationError() { void AccountManager::setLimitedCommerce(bool isLimited) { _limitedCommerce = isLimited; } + +void AccountManager::saveLoginStatus(bool isLoggedIn) { + if (_configFileURL.isValid()) { + QFile configFile(_configFileURL.toString()); + configFile.open(QIODevice::ReadOnly | QIODevice::Text); + QJsonParseError error; + QJsonDocument jsonDocument = QJsonDocument::fromJson(configFile.readAll(), &error); + configFile.close(); + QString launcherPath; + if (error.error == QJsonParseError::NoError) { + QJsonObject rootObject = jsonDocument.object(); + if (rootObject.contains("loggedIn")) { + rootObject["loggedIn"] = isLoggedIn; + } + if (rootObject.contains("laucherPath")) { + launcherPath = rootObject["launcherPath"].isString(); + } + } + configFile.open(QFile::WriteOnly | QFile::Text | QFile::Truncate); + configFile.write(jsonDocument.toJson()); + configFile.close(); + if (!isLoggedIn && !launcherPath.isEmpty()) { + QProcess launcher; + launcher.setProgram(launcherPath); + launcher.startDetached(); + qApp->quit(); + } + } +} \ No newline at end of file diff --git a/libraries/networking/src/AccountManager.h b/libraries/networking/src/AccountManager.h index 8732042e93..3fcbff4f99 100644 --- a/libraries/networking/src/AccountManager.h +++ b/libraries/networking/src/AccountManager.h @@ -102,6 +102,10 @@ public: bool getLimitedCommerce() { return _limitedCommerce; } void setLimitedCommerce(bool isLimited); + void setAccessTokens(const QString& response); + void setConfigFileURL(const QUrl& fileURL) { _configFileURL = fileURL; } + void saveLoginStatus(bool isLoggedIn); + public slots: void requestAccessToken(const QString& login, const QString& password); void requestAccessTokenWithSteam(QByteArray authSessionTicket); @@ -162,6 +166,7 @@ private: QUuid _sessionID { QUuid::createUuid() }; bool _limitedCommerce { false }; + QUrl _configFileURL; }; #endif // hifi_AccountManager_h From d75fe040385b5e42dc103260cc41b83e1ec9b237 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Wed, 22 May 2019 16:24:40 -0700 Subject: [PATCH 16/31] Fix BUGZ-311 --- interface/resources/qml/hifi/simplifiedUI/settingsApp/vr/VR.qml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/interface/resources/qml/hifi/simplifiedUI/settingsApp/vr/VR.qml b/interface/resources/qml/hifi/simplifiedUI/settingsApp/vr/VR.qml index 96dbc5e180..fc11451b5b 100644 --- a/interface/resources/qml/hifi/simplifiedUI/settingsApp/vr/VR.qml +++ b/interface/resources/qml/hifi/simplifiedUI/settingsApp/vr/VR.qml @@ -216,6 +216,7 @@ Flickable { width: parent.width - inputLevel.width checked: selectedHMD text: model.devicename + wrapLabel: false ButtonGroup.group: inputDeviceButtonGroup onClicked: { AudioScriptingInterface.setStereoInput(false); // the next selected audio device might not support stereo @@ -315,6 +316,7 @@ Flickable { width: parent.width checked: selectedDesktop text: model.devicename + wrapLabel: false ButtonGroup.group: outputDeviceButtonGroup onClicked: { AudioScriptingInterface.setOutputDevice(model.info, true); // `false` argument for Desktop mode setting From 6d824ff22d1931342a53e55b9ea0fdc22575a98a Mon Sep 17 00:00:00 2001 From: luiscuenca Date: Wed, 22 May 2019 20:27:42 -0700 Subject: [PATCH 17/31] Fix logout --- interface/src/main.cpp | 18 ++++++++++-------- libraries/networking/src/AccountManager.cpp | 14 ++++++++------ libraries/networking/src/AccountManager.h | 4 ++-- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/interface/src/main.cpp b/interface/src/main.cpp index 303d7f210b..80d88c9303 100644 --- a/interface/src/main.cpp +++ b/interface/src/main.cpp @@ -122,8 +122,10 @@ int main(int argc, const char* argv[]) { static const QString APPLICATION_CONFIG_FILENAME = "config.json"; QDir applicationDir(applicationPath); - QFile configFile(applicationDir.filePath(APPLICATION_CONFIG_FILENAME)); - bool isConfigFileValid = false; + QString configFileName = applicationDir.filePath(APPLICATION_CONFIG_FILENAME); + QFile configFile(configFileName); + QString launcherPath; + if (configFile.exists()) { if (!configFile.open(QIODevice::ReadOnly)) { qWarning() << "Found application config, but could not open it"; @@ -136,9 +138,8 @@ int main(int argc, const char* argv[]) { qWarning() << "Found application config, but could not parse it: " << error.errorString(); } else { static const QString LAUNCHER_PATH_KEY = "launcherPath"; - QString launcherPath = doc.object()[LAUNCHER_PATH_KEY].toString(); + launcherPath = doc.object()[LAUNCHER_PATH_KEY].toString(); if (!launcherPath.isEmpty()) { - isConfigFileValid = true; if (!parser.isSet(noLauncherOption)) { qDebug() << "Found a launcherPath in application config. Starting launcher."; QProcess launcher; @@ -402,15 +403,16 @@ int main(int argc, const char* argv[]) { printSystemInformation(); - if (isConfigFileValid || parser.isSet(responseTokensOption)) { + if (!launcherPath.isEmpty() || parser.isSet(responseTokensOption)) { auto accountManager = DependencyManager::get(); if (!accountManager.isNull()) { + if (!launcherPath.isEmpty()) { + accountManager->setConfigFileURL(configFileName); + } if (parser.isSet(responseTokensOption)) { QString tokens = QString(parser.value(responseTokensOption)); accountManager->setAccessTokens(tokens); - } else if (isConfigFileValid) { - accountManager->setConfigFileURL(configFile.fileName()); - } + } } } diff --git a/libraries/networking/src/AccountManager.cpp b/libraries/networking/src/AccountManager.cpp index 014ae62aff..3a7d3e0a67 100644 --- a/libraries/networking/src/AccountManager.cpp +++ b/libraries/networking/src/AccountManager.cpp @@ -674,7 +674,7 @@ void AccountManager::setAccessTokens(const QString& response) { emit loginComplete(rootURL); persistAccountToFile(); - + saveLoginStatus(true); requestProfile(); } } else { @@ -931,8 +931,8 @@ void AccountManager::setLimitedCommerce(bool isLimited) { } void AccountManager::saveLoginStatus(bool isLoggedIn) { - if (_configFileURL.isValid()) { - QFile configFile(_configFileURL.toString()); + if (!_configFileURL.isEmpty()) { + QFile configFile(_configFileURL); configFile.open(QIODevice::ReadOnly | QIODevice::Text); QJsonParseError error; QJsonDocument jsonDocument = QJsonDocument::fromJson(configFile.readAll(), &error); @@ -940,12 +940,14 @@ void AccountManager::saveLoginStatus(bool isLoggedIn) { QString launcherPath; if (error.error == QJsonParseError::NoError) { QJsonObject rootObject = jsonDocument.object(); + if (rootObject.contains("launcherPath")) { + launcherPath = rootObject["launcherPath"].toString(); + } if (rootObject.contains("loggedIn")) { rootObject["loggedIn"] = isLoggedIn; } - if (rootObject.contains("laucherPath")) { - launcherPath = rootObject["launcherPath"].isString(); - } + jsonDocument = QJsonDocument(rootObject); + } configFile.open(QFile::WriteOnly | QFile::Text | QFile::Truncate); configFile.write(jsonDocument.toJson()); diff --git a/libraries/networking/src/AccountManager.h b/libraries/networking/src/AccountManager.h index 3fcbff4f99..c2187f79cb 100644 --- a/libraries/networking/src/AccountManager.h +++ b/libraries/networking/src/AccountManager.h @@ -103,7 +103,7 @@ public: void setLimitedCommerce(bool isLimited); void setAccessTokens(const QString& response); - void setConfigFileURL(const QUrl& fileURL) { _configFileURL = fileURL; } + void setConfigFileURL(const QString& fileURL) { _configFileURL = fileURL; } void saveLoginStatus(bool isLoggedIn); public slots: @@ -166,7 +166,7 @@ private: QUuid _sessionID { QUuid::createUuid() }; bool _limitedCommerce { false }; - QUrl _configFileURL; + QString _configFileURL; }; #endif // hifi_AccountManager_h From 0d0a9fbd09881a02ceb6a28a40a0999df408dcb3 Mon Sep 17 00:00:00 2001 From: Ken Cooke Date: Thu, 23 May 2019 07:54:08 -0700 Subject: [PATCH 18/31] Never return more than maxSamples from the audio ringbuffer --- libraries/audio/src/InboundAudioStream.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libraries/audio/src/InboundAudioStream.cpp b/libraries/audio/src/InboundAudioStream.cpp index 5ac3996029..3964c9a6ed 100644 --- a/libraries/audio/src/InboundAudioStream.cpp +++ b/libraries/audio/src/InboundAudioStream.cpp @@ -366,8 +366,9 @@ int InboundAudioStream::popSamples(int maxSamples, bool allOrNothing) { _consecutiveNotMixedCount++; //Kick PLC to generate a filler frame, reducing 'click' lostAudioData(allOrNothing ? (maxSamples - samplesAvailable) / _ringBuffer.getNumFrameSamples() : 1); - samplesPopped = _ringBuffer.samplesAvailable(); - if (samplesPopped) { + samplesAvailable = _ringBuffer.samplesAvailable(); + if (samplesAvailable > 0) { + samplesPopped = std::min(samplesAvailable, maxSamples); popSamplesNoCheck(samplesPopped); } else { // No samples available means a packet is currently being From ba3282e12b034e2b2ec48a6b579b763b7a7dbc58 Mon Sep 17 00:00:00 2001 From: Ken Cooke Date: Thu, 23 May 2019 08:03:59 -0700 Subject: [PATCH 19/31] Fix rounding error in allOrNothing mode --- libraries/audio/src/InboundAudioStream.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/libraries/audio/src/InboundAudioStream.cpp b/libraries/audio/src/InboundAudioStream.cpp index 3964c9a6ed..7a81b8a67a 100644 --- a/libraries/audio/src/InboundAudioStream.cpp +++ b/libraries/audio/src/InboundAudioStream.cpp @@ -364,9 +364,17 @@ int InboundAudioStream::popSamples(int maxSamples, bool allOrNothing) { // buffer calculations. setToStarved(); _consecutiveNotMixedCount++; - //Kick PLC to generate a filler frame, reducing 'click' - lostAudioData(allOrNothing ? (maxSamples - samplesAvailable) / _ringBuffer.getNumFrameSamples() : 1); + + // use PLC to generate extrapolated audio data, to reduce clicking + if (allOrNothing) { + int samplesNeeded = maxSamples - samplesAvailable; + int packetsNeeded = (samplesNeeded + _ringBuffer.getNumFrameSamples() - 1) / _ringBuffer.getNumFrameSamples(); + lostAudioData(packetsNeeded); + } else { + lostAudioData(1); + } samplesAvailable = _ringBuffer.samplesAvailable(); + if (samplesAvailable > 0) { samplesPopped = std::min(samplesAvailable, maxSamples); popSamplesNoCheck(samplesPopped); From 135dc7f2b18dbbd34c8d01ac07631c5f58224c17 Mon Sep 17 00:00:00 2001 From: Ken Cooke Date: Thu, 23 May 2019 08:54:47 -0700 Subject: [PATCH 20/31] assert() on over-filling the audio callback buffer --- libraries/audio-client/src/AudioClient.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libraries/audio-client/src/AudioClient.cpp b/libraries/audio-client/src/AudioClient.cpp index cef6adcab0..da948f9917 100644 --- a/libraries/audio-client/src/AudioClient.cpp +++ b/libraries/audio-client/src/AudioClient.cpp @@ -2162,6 +2162,8 @@ qint64 AudioClient::AudioOutputIODevice::readData(char * data, qint64 maxSize) { } bytesWritten = framesPopped * AudioConstants::SAMPLE_SIZE * deviceChannelCount; + assert(bytesWritten <= maxSize); + } else { // nothing on network, don't grab anything from injectors, and just return 0s memset(data, 0, maxSize); @@ -2174,7 +2176,6 @@ qint64 AudioClient::AudioOutputIODevice::readData(char * data, qint64 maxSize) { _audio->_audioFileWav.addRawAudioChunk(reinterpret_cast(scratchBuffer), bytesWritten); } - int bytesAudioOutputUnplayed = _audio->_audioOutput->bufferSize() - _audio->_audioOutput->bytesFree(); float msecsAudioOutputUnplayed = bytesAudioOutputUnplayed / (float)_audio->_outputFormat.bytesForDuration(USECS_PER_MSEC); _audio->_stats.updateOutputMsUnplayed(msecsAudioOutputUnplayed); From 8db3d03772fad935013f3ba8cda22e91fd807a5c Mon Sep 17 00:00:00 2001 From: luiscuenca Date: Thu, 23 May 2019 10:21:47 -0700 Subject: [PATCH 21/31] add display name as param --- interface/src/Application.cpp | 10 ++++++++++ interface/src/Application.h | 4 ++++ interface/src/main.cpp | 24 ++++++++++++++---------- 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 0dba4498d5..ca171aa8b9 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -9355,6 +9355,16 @@ void Application::showUrlHandler(const QUrl& url) { }); } +void Application::forceDisplayName(const QString& displayName) { + getMyAvatar()->setDisplayName(displayName); +} +void Application::forceLogginWithTokens(const QString& tokens) { + DependencyManager::get()->setAccessTokens(tokens); +} +void Application::setConfigFileURL(const QString& fileUrl) { + DependencyManager::get()->setConfigFileURL(fileUrl); +} + #if defined(Q_OS_ANDROID) void Application::beforeEnterBackground() { auto nodeList = DependencyManager::get(); diff --git a/interface/src/Application.h b/interface/src/Application.h index 210039beba..2eac2bc885 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -356,6 +356,10 @@ public: void openDirectory(const QString& path); + void forceDisplayName(const QString& displayName); + void forceLogginWithTokens(const QString& tokens); + void setConfigFileURL(const QString& fileUrl); + signals: void svoImportRequested(const QString& url); diff --git a/interface/src/main.cpp b/interface/src/main.cpp index 80d88c9303..140b79584c 100644 --- a/interface/src/main.cpp +++ b/interface/src/main.cpp @@ -84,6 +84,7 @@ int main(int argc, const char* argv[]) { QCommandLineOption overrideAppLocalDataPathOption("cache", "set test cache ", "dir"); QCommandLineOption overrideScriptsPathOption(SCRIPTS_SWITCH, "set scripts ", "path"); QCommandLineOption responseTokensOption("tokens", "set response tokens ", "json"); + QCommandLineOption displayNameOption("displayName", "set user display name ", "string"); parser.addOption(urlOption); parser.addOption(noLauncherOption); @@ -95,6 +96,7 @@ int main(int argc, const char* argv[]) { parser.addOption(overrideScriptsPathOption); parser.addOption(allowMultipleInstancesOption); parser.addOption(responseTokensOption); + parser.addOption(displayNameOption); if (!parser.parse(arguments)) { std::cout << parser.errorText().toStdString() << std::endl; // Avoid Qt log spam @@ -403,16 +405,18 @@ int main(int argc, const char* argv[]) { printSystemInformation(); - if (!launcherPath.isEmpty() || parser.isSet(responseTokensOption)) { - auto accountManager = DependencyManager::get(); - if (!accountManager.isNull()) { - if (!launcherPath.isEmpty()) { - accountManager->setConfigFileURL(configFileName); - } - if (parser.isSet(responseTokensOption)) { - QString tokens = QString(parser.value(responseTokensOption)); - accountManager->setAccessTokens(tokens); - } + auto appPointer = dynamic_cast(&app); + if (appPointer) { + if (parser.isSet(displayNameOption)) { + QString displayName = QString(parser.value(displayNameOption)); + appPointer->forceDisplayName(displayName); + } + if (!launcherPath.isEmpty()) { + appPointer->setConfigFileURL(configFileName); + } + if (parser.isSet(responseTokensOption)) { + QString tokens = QString(parser.value(responseTokensOption)); + appPointer->forceLogginWithTokens(tokens); } } From a71e902a499e8f5eb6c45f7736a8bde96fd9e358 Mon Sep 17 00:00:00 2001 From: Howard Stearns Date: Thu, 23 May 2019 10:27:05 -0700 Subject: [PATCH 22/31] Revert "BUGZ-322 - add domain checkin lag logging" --- domain-server/src/DomainGatekeeper.cpp | 5 +- domain-server/src/DomainServer.cpp | 6 -- domain-server/src/DomainServerNodeData.h | 5 +- domain-server/src/NodeConnectionData.cpp | 2 - domain-server/src/NodeConnectionData.h | 1 - libraries/networking/src/NodeList.cpp | 80 +++++++------------ .../networking/src/udt/PacketHeaders.cpp | 4 +- libraries/networking/src/udt/PacketHeaders.h | 6 +- 8 files changed, 33 insertions(+), 76 deletions(-) diff --git a/domain-server/src/DomainGatekeeper.cpp b/domain-server/src/DomainGatekeeper.cpp index 75399d1a9b..29656f4465 100644 --- a/domain-server/src/DomainGatekeeper.cpp +++ b/domain-server/src/DomainGatekeeper.cpp @@ -358,7 +358,7 @@ SharedNodePointer DomainGatekeeper::processAssignmentConnectRequest(const NodeCo nodeData->setNodeVersion(it->second.getNodeVersion()); nodeData->setHardwareAddress(nodeConnection.hardwareAddress); nodeData->setMachineFingerprint(nodeConnection.machineFingerprint); - nodeData->setLastDomainCheckinTimestamp(nodeConnection.lastPingTimestamp); + nodeData->setWasAssigned(true); // cleanup the PendingAssignedNodeData for this assignment now that it's connecting @@ -499,9 +499,6 @@ SharedNodePointer DomainGatekeeper::processAgentConnectRequest(const NodeConnect // set the machine fingerprint passed in the connect request nodeData->setMachineFingerprint(nodeConnection.machineFingerprint); - // set the last ping timestamp passed in the connect request - nodeData->setLastDomainCheckinTimestamp(nodeConnection.lastPingTimestamp); - // also add an interpolation to DomainServerNodeData so that servers can get username in stats nodeData->addOverrideForKey(USERNAME_UUID_REPLACEMENT_STATS_KEY, uuidStringWithoutCurlyBraces(newNode->getUUID()), username); diff --git a/domain-server/src/DomainServer.cpp b/domain-server/src/DomainServer.cpp index 37643cc372..051dd989f5 100644 --- a/domain-server/src/DomainServer.cpp +++ b/domain-server/src/DomainServer.cpp @@ -1068,8 +1068,6 @@ void DomainServer::processListRequestPacket(QSharedPointer mess // update the connecting hostname in case it has changed nodeData->setPlaceName(nodeRequestData.placeName); - nodeData->setLastDomainCheckinTimestamp(nodeRequestData.lastPingTimestamp); - sendDomainListToNode(sendingNode, message->getSenderSockAddr()); } @@ -1176,10 +1174,6 @@ void DomainServer::sendDomainListToNode(const SharedNodePointer& node, const Hif DomainServerNodeData* nodeData = static_cast(node->getLinkedData()); - domainListStream << nodeData->getLastDomainCheckinTimestamp(); - - domainListStream << usecTimestampNow(); - // store the nodeInterestSet on this DomainServerNodeData, in case it has changed auto& nodeInterestSet = nodeData->getNodeInterestSet(); diff --git a/domain-server/src/DomainServerNodeData.h b/domain-server/src/DomainServerNodeData.h index 370886cbce..f465cceb96 100644 --- a/domain-server/src/DomainServerNodeData.h +++ b/domain-server/src/DomainServerNodeData.h @@ -61,9 +61,6 @@ public: void setMachineFingerprint(const QUuid& machineFingerprint) { _machineFingerprint = machineFingerprint; } const QUuid& getMachineFingerprint() { return _machineFingerprint; } - void setLastDomainCheckinTimestamp(quint64 lastDomainCheckinTimestamp) { _lastDomainCheckinTimestamp = lastDomainCheckinTimestamp; } - quint64 getLastDomainCheckinTimestamp() { return _lastDomainCheckinTimestamp; } - void addOverrideForKey(const QString& key, const QString& value, const QString& overrideValue); void removeOverrideForKey(const QString& key, const QString& value); @@ -96,7 +93,7 @@ private: QString _nodeVersion; QString _hardwareAddress; QUuid _machineFingerprint; - quint64 _lastDomainCheckinTimestamp; + QString _placeName; bool _wasAssigned { false }; diff --git a/domain-server/src/NodeConnectionData.cpp b/domain-server/src/NodeConnectionData.cpp index b3ea005bd1..0a3782d79b 100644 --- a/domain-server/src/NodeConnectionData.cpp +++ b/domain-server/src/NodeConnectionData.cpp @@ -36,8 +36,6 @@ NodeConnectionData NodeConnectionData::fromDataStream(QDataStream& dataStream, c // now the machine fingerprint dataStream >> newHeader.machineFingerprint; } - - dataStream >> newHeader.lastPingTimestamp; dataStream >> newHeader.nodeType >> newHeader.publicSockAddr >> newHeader.localSockAddr diff --git a/domain-server/src/NodeConnectionData.h b/domain-server/src/NodeConnectionData.h index 779411d11e..dd9ca6b650 100644 --- a/domain-server/src/NodeConnectionData.h +++ b/domain-server/src/NodeConnectionData.h @@ -22,7 +22,6 @@ public: bool isConnectRequest = true); QUuid connectUUID; - quint64 lastPingTimestamp{ 0 }; NodeType_t nodeType; HifiSockAddr publicSockAddr; HifiSockAddr localSockAddr; diff --git a/libraries/networking/src/NodeList.cpp b/libraries/networking/src/NodeList.cpp index 31576ff8d9..4f0e3ca9bd 100644 --- a/libraries/networking/src/NodeList.cpp +++ b/libraries/networking/src/NodeList.cpp @@ -412,8 +412,6 @@ void NodeList::sendDomainServerCheckIn() { packetStream << FingerprintUtils::getMachineFingerprint(); } - packetStream << usecTimestampNow(); - // pack our data to send to the domain-server including // the hostname information (so the domain-server can see which place name we came in on) packetStream << _ownerType.load() << publicSockAddr << localSockAddr << _nodeTypesOfInterest.toList(); @@ -620,58 +618,12 @@ void NodeList::processDomainServerConnectionTokenPacket(QSharedPointer message) { - - // parse header information - QDataStream packetStream(message->getMessage()); - - // grab the domain's ID from the beginning of the packet - QUuid domainUUID; - packetStream >> domainUUID; - - Node::LocalID domainLocalID; - packetStream >> domainLocalID; - - // pull our owner (ie. session) UUID from the packet, it's always the first thing - // The short (16 bit) ID comes next. - QUuid newUUID; - Node::LocalID newLocalID; - packetStream >> newUUID; - packetStream >> newLocalID; - - // pull the permissions/right/privileges for this node out of the stream - NodePermissions newPermissions; - packetStream >> newPermissions; - setPermissions(newPermissions); - // Is packet authentication enabled? - bool isAuthenticated; - packetStream >> isAuthenticated; - setAuthenticatePackets(isAuthenticated); - - quint64 connectRequestTimestamp; - quint64 now = usecTimestampNow(); - packetStream >> connectRequestTimestamp; - quint64 pingLagTime = (now - connectRequestTimestamp) / USECS_PER_MSEC; - quint64 domainServerPingReceiveTime; - - packetStream >> domainServerPingReceiveTime; - quint64 domainServerRequestLag = (domainServerPingReceiveTime - connectRequestTimestamp) / USECS_PER_MSEC; - quint64 domainServerResponseLag = (now - domainServerPingReceiveTime) / USECS_PER_MSEC; - if (_domainHandler.getSockAddr().isNull()) { - qWarning(networking) << "IGNORING DomainList packet while not connected to a Domain Server: sent " << pingLagTime << " msec ago."; - qWarning(networking) << "DomainList request lag (with skew): " << domainServerRequestLag << "msec"; - qWarning(networking) << "DomainList response lag (with skew): " << domainServerResponseLag << "msec"; + qWarning() << "IGNORING DomainList packet while not connected to a Domain Server"; // refuse to process this packet if we aren't currently connected to the DS return; } - // warn if ping lag is getting long - if (pingLagTime > MSECS_PER_SECOND) { - qCDebug(networking) << "DomainList ping is lagging: " << pingLagTime << "msec"; - qCDebug(networking) << "DomainList request lag (with skew): " << domainServerRequestLag << "msec"; - qCDebug(networking) << "DomainList response lag (with skew): " << domainServerResponseLag << "msec"; - } - // this is a packet from the domain server, reset the count of un-replied check-ins _domainHandler.clearPendingCheckins(); @@ -680,15 +632,28 @@ void NodeList::processDomainServerList(QSharedPointer message) DependencyManager::get()->flagTimeForConnectionStep(LimitedNodeList::ConnectionStep::ReceiveDSList); + QDataStream packetStream(message->getMessage()); + + // grab the domain's ID from the beginning of the packet + QUuid domainUUID; + packetStream >> domainUUID; + if (_domainHandler.isConnected() && _domainHandler.getUUID() != domainUUID) { // Recieved packet from different domain. - qWarning() << "IGNORING DomainList packet from" << domainUUID << "while connected to" - << _domainHandler.getUUID() << ": sent " << pingLagTime << " msec ago."; - qWarning(networking) << "DomainList request lag (with skew): " << domainServerRequestLag << "msec"; - qWarning(networking) << "DomainList response lag (with skew): " << domainServerResponseLag << "msec"; + qWarning() << "IGNORING DomainList packet from" << domainUUID << "while connected to" << _domainHandler.getUUID(); return; } + Node::LocalID domainLocalID; + packetStream >> domainLocalID; + + // pull our owner (ie. session) UUID from the packet, it's always the first thing + // The short (16 bit) ID comes next. + QUuid newUUID; + Node::LocalID newLocalID; + packetStream >> newUUID; + packetStream >> newLocalID; + // when connected, if the session ID or local ID were not null and changed, we should reset auto currentLocalID = getSessionLocalID(); auto currentSessionID = getSessionUUID(); @@ -719,6 +684,15 @@ void NodeList::processDomainServerList(QSharedPointer message) DependencyManager::get()->lookupShareableNameForDomainID(domainUUID); } + // pull the permissions/right/privileges for this node out of the stream + NodePermissions newPermissions; + packetStream >> newPermissions; + setPermissions(newPermissions); + // Is packet authentication enabled? + bool isAuthenticated; + packetStream >> isAuthenticated; + setAuthenticatePackets(isAuthenticated); + // pull each node in the packet while (packetStream.device()->pos() < message->getSize()) { parseNodeFromPacketStream(packetStream); diff --git a/libraries/networking/src/udt/PacketHeaders.cpp b/libraries/networking/src/udt/PacketHeaders.cpp index 566e1e4946..f8574b3b94 100644 --- a/libraries/networking/src/udt/PacketHeaders.cpp +++ b/libraries/networking/src/udt/PacketHeaders.cpp @@ -27,7 +27,7 @@ PacketVersion versionForPacketType(PacketType packetType) { case PacketType::StunResponse: return 17; case PacketType::DomainList: - return static_cast(DomainListVersion::HasTimestamp); + return static_cast(DomainListVersion::AuthenticationOptional); case PacketType::EntityAdd: case PacketType::EntityClone: case PacketType::EntityEdit: @@ -72,7 +72,7 @@ PacketVersion versionForPacketType(PacketType packetType) { return static_cast(DomainConnectionDeniedVersion::IncludesExtraInfo); case PacketType::DomainConnectRequest: - return static_cast(DomainConnectRequestVersion::HasTimestamp); + return static_cast(DomainConnectRequestVersion::AlwaysHasMachineFingerprint); case PacketType::DomainServerAddedNode: return static_cast(DomainServerAddedNodeVersion::PermissionsGrid); diff --git a/libraries/networking/src/udt/PacketHeaders.h b/libraries/networking/src/udt/PacketHeaders.h index 903c1f4c93..5deadd8c43 100644 --- a/libraries/networking/src/udt/PacketHeaders.h +++ b/libraries/networking/src/udt/PacketHeaders.h @@ -344,8 +344,7 @@ enum class DomainConnectRequestVersion : PacketVersion { HasProtocolVersions, HasMACAddress, HasMachineFingerprint, - AlwaysHasMachineFingerprint, - HasTimestamp + AlwaysHasMachineFingerprint }; enum class DomainConnectionDeniedVersion : PacketVersion { @@ -364,8 +363,7 @@ enum class DomainListVersion : PacketVersion { PermissionsGrid, GetUsernameFromUUIDSupport, GetMachineFingerprintFromUUIDSupport, - AuthenticationOptional, - HasTimestamp + AuthenticationOptional }; enum class AudioVersion : PacketVersion { From cdf71f40d5643c211cad6c247192f44bb6c976a3 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Wed, 22 May 2019 15:05:27 -0700 Subject: [PATCH 23/31] Add postbuild script for CI server --- tools/ci-scripts/postbuild.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tools/ci-scripts/postbuild.py diff --git a/tools/ci-scripts/postbuild.py b/tools/ci-scripts/postbuild.py new file mode 100644 index 0000000000..a1561f6203 --- /dev/null +++ b/tools/ci-scripts/postbuild.py @@ -0,0 +1,20 @@ +# Post build script +import os +import sys + +SOURCE_PATH = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), '..', '..')) +BUILD_PATH = os.path.join(SOURCE_PATH, 'build') + +# FIXME move the helper python modules somewher other than the root of the repo +sys.path.append(SOURCE_PATH) + +import hifi_utils + +#for var in sys.argv: +# print("{}".format(var)) + +#for var in os.environ: +# print("{} = {}".format(var, os.environ[var])) + +print("Create ZIP version of installer archive") +hifi_utils.executeSubprocess(['cpack', '-G', 'ZIP'], folder=BUILD_PATH) From 053576e29fd09f275b87c7a6ce689b845af2fc72 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Thu, 23 May 2019 11:31:42 -0700 Subject: [PATCH 24/31] Move SimplifiedUI folder and create new defaultScripts.js --- scripts/simplifiedUI/defaultScripts.js | 41 +++++++++++++++++++ .../simplifiedUI/images/inputDeviceMuted.svg | 0 .../simplifiedUI/images/outputDeviceMuted.svg | 0 .../modules/defaultLocalEntityProps.js | 0 .../resources/modules/entityMaker.js | 0 .../resources/modules/nameTagListManager.js | 0 .../resources/modules/objectAssign.js | 0 .../resources/modules/pickRayController.js | 0 .../resources/modules/textHelper.js | 0 .../simplifiedNametag/simplifiedNametag.js | 0 .../simplifiedStatusIndicator.js | 0 .../{system => }/simplifiedUI/simplifiedUI.js | 2 +- 12 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 scripts/simplifiedUI/defaultScripts.js rename scripts/{system => }/simplifiedUI/images/inputDeviceMuted.svg (100%) rename scripts/{system => }/simplifiedUI/images/outputDeviceMuted.svg (100%) rename scripts/{system => }/simplifiedUI/simplifiedNametag/resources/modules/defaultLocalEntityProps.js (100%) rename scripts/{system => }/simplifiedUI/simplifiedNametag/resources/modules/entityMaker.js (100%) rename scripts/{system => }/simplifiedUI/simplifiedNametag/resources/modules/nameTagListManager.js (100%) rename scripts/{system => }/simplifiedUI/simplifiedNametag/resources/modules/objectAssign.js (100%) rename scripts/{system => }/simplifiedUI/simplifiedNametag/resources/modules/pickRayController.js (100%) rename scripts/{system => }/simplifiedUI/simplifiedNametag/resources/modules/textHelper.js (100%) rename scripts/{system => }/simplifiedUI/simplifiedNametag/simplifiedNametag.js (100%) rename scripts/{system => }/simplifiedUI/simplifiedStatusIndicator/simplifiedStatusIndicator.js (100%) rename scripts/{system => }/simplifiedUI/simplifiedUI.js (99%) diff --git a/scripts/simplifiedUI/defaultScripts.js b/scripts/simplifiedUI/defaultScripts.js new file mode 100644 index 0000000000..0911c6518a --- /dev/null +++ b/scripts/simplifiedUI/defaultScripts.js @@ -0,0 +1,41 @@ +"use strict"; +/* jslint vars: true, plusplus: true */ + +// +// defaultScripts.js +// +// Authors: Zach Fox +// Created: 2019-05-23 +// Copyright 2019 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 +// +var DEFAULT_SCRIPTS_PATH_PREFIX = ScriptDiscoveryService.defaultScriptsPath + "/"; + + +var DEFAULT_SCRIPTS_SEPARATE = [ + DEFAULT_SCRIPTS_PATH_PREFIX + "system/controllers/controllerScripts.js", + Script.resolvePath("simplifiedUI.js") +]; +function loadSeparateDefaults() { + for (var i in DEFAULT_SCRIPTS_SEPARATE) { + Script.load(DEFAULT_SCRIPTS_SEPARATE[i]); + } +} + + +var DEFAULT_SCRIPTS_COMBINED = [ + DEFAULT_SCRIPTS_PATH_PREFIX + "system/request-service.js", + DEFAULT_SCRIPTS_PATH_PREFIX + "system/progress.js", + DEFAULT_SCRIPTS_PATH_PREFIX + "system/away.js" +]; +function runDefaultsTogether() { + for (var i in DEFAULT_SCRIPTS_COMBINED) { + Script.include(DEFAULT_SCRIPTS_COMBINED[i]); + } + loadSeparateDefaults(); +} + + +runDefaultsTogether(); diff --git a/scripts/system/simplifiedUI/images/inputDeviceMuted.svg b/scripts/simplifiedUI/images/inputDeviceMuted.svg similarity index 100% rename from scripts/system/simplifiedUI/images/inputDeviceMuted.svg rename to scripts/simplifiedUI/images/inputDeviceMuted.svg diff --git a/scripts/system/simplifiedUI/images/outputDeviceMuted.svg b/scripts/simplifiedUI/images/outputDeviceMuted.svg similarity index 100% rename from scripts/system/simplifiedUI/images/outputDeviceMuted.svg rename to scripts/simplifiedUI/images/outputDeviceMuted.svg diff --git a/scripts/system/simplifiedUI/simplifiedNametag/resources/modules/defaultLocalEntityProps.js b/scripts/simplifiedUI/simplifiedNametag/resources/modules/defaultLocalEntityProps.js similarity index 100% rename from scripts/system/simplifiedUI/simplifiedNametag/resources/modules/defaultLocalEntityProps.js rename to scripts/simplifiedUI/simplifiedNametag/resources/modules/defaultLocalEntityProps.js diff --git a/scripts/system/simplifiedUI/simplifiedNametag/resources/modules/entityMaker.js b/scripts/simplifiedUI/simplifiedNametag/resources/modules/entityMaker.js similarity index 100% rename from scripts/system/simplifiedUI/simplifiedNametag/resources/modules/entityMaker.js rename to scripts/simplifiedUI/simplifiedNametag/resources/modules/entityMaker.js diff --git a/scripts/system/simplifiedUI/simplifiedNametag/resources/modules/nameTagListManager.js b/scripts/simplifiedUI/simplifiedNametag/resources/modules/nameTagListManager.js similarity index 100% rename from scripts/system/simplifiedUI/simplifiedNametag/resources/modules/nameTagListManager.js rename to scripts/simplifiedUI/simplifiedNametag/resources/modules/nameTagListManager.js diff --git a/scripts/system/simplifiedUI/simplifiedNametag/resources/modules/objectAssign.js b/scripts/simplifiedUI/simplifiedNametag/resources/modules/objectAssign.js similarity index 100% rename from scripts/system/simplifiedUI/simplifiedNametag/resources/modules/objectAssign.js rename to scripts/simplifiedUI/simplifiedNametag/resources/modules/objectAssign.js diff --git a/scripts/system/simplifiedUI/simplifiedNametag/resources/modules/pickRayController.js b/scripts/simplifiedUI/simplifiedNametag/resources/modules/pickRayController.js similarity index 100% rename from scripts/system/simplifiedUI/simplifiedNametag/resources/modules/pickRayController.js rename to scripts/simplifiedUI/simplifiedNametag/resources/modules/pickRayController.js diff --git a/scripts/system/simplifiedUI/simplifiedNametag/resources/modules/textHelper.js b/scripts/simplifiedUI/simplifiedNametag/resources/modules/textHelper.js similarity index 100% rename from scripts/system/simplifiedUI/simplifiedNametag/resources/modules/textHelper.js rename to scripts/simplifiedUI/simplifiedNametag/resources/modules/textHelper.js diff --git a/scripts/system/simplifiedUI/simplifiedNametag/simplifiedNametag.js b/scripts/simplifiedUI/simplifiedNametag/simplifiedNametag.js similarity index 100% rename from scripts/system/simplifiedUI/simplifiedNametag/simplifiedNametag.js rename to scripts/simplifiedUI/simplifiedNametag/simplifiedNametag.js diff --git a/scripts/system/simplifiedUI/simplifiedStatusIndicator/simplifiedStatusIndicator.js b/scripts/simplifiedUI/simplifiedStatusIndicator/simplifiedStatusIndicator.js similarity index 100% rename from scripts/system/simplifiedUI/simplifiedStatusIndicator/simplifiedStatusIndicator.js rename to scripts/simplifiedUI/simplifiedStatusIndicator/simplifiedStatusIndicator.js diff --git a/scripts/system/simplifiedUI/simplifiedUI.js b/scripts/simplifiedUI/simplifiedUI.js similarity index 99% rename from scripts/system/simplifiedUI/simplifiedUI.js rename to scripts/simplifiedUI/simplifiedUI.js index 351372613b..d3bc2830cd 100644 --- a/scripts/system/simplifiedUI/simplifiedUI.js +++ b/scripts/simplifiedUI/simplifiedUI.js @@ -5,7 +5,7 @@ // simplifiedUI.js // // Authors: Wayne Chen & Zach Fox -// Created on: 5/1/2019 +// Created: 2019-05-01 // Copyright 2019 High Fidelity, Inc. // // Distributed under the Apache License, Version 2.0. From dc370d676acc520aea8b4b50a2dcba1e58ccaa35 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Thu, 23 May 2019 13:07:47 -0700 Subject: [PATCH 25/31] Fix BUGZ-203 --- scripts/simplifiedUI/simplifiedUI.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripts/simplifiedUI/simplifiedUI.js b/scripts/simplifiedUI/simplifiedUI.js index d3bc2830cd..a6183c5ab9 100644 --- a/scripts/simplifiedUI/simplifiedUI.js +++ b/scripts/simplifiedUI/simplifiedUI.js @@ -103,6 +103,8 @@ var AVATAR_APP_PRESENTATION_MODE = Desktop.PresentationMode.NATIVE; var AVATAR_APP_WIDTH_PX = 480; var AVATAR_APP_HEIGHT_PX = 615; var avatarAppWindow = false; +var POPOUT_SAFE_MARGIN_X = 30; +var POPOUT_SAFE_MARGIN_Y = 30; function toggleAvatarApp() { if (avatarAppWindow) { avatarAppWindow.close(); @@ -119,6 +121,10 @@ function toggleAvatarApp() { size: { x: AVATAR_APP_WIDTH_PX, y: AVATAR_APP_HEIGHT_PX + }, + position: { + x: Math.max(Window.x + POPOUT_SAFE_MARGIN_X, Window.x + Window.innerWidth / 2 - AVATAR_APP_WIDTH_PX / 2), + y: Math.max(Window.y + POPOUT_SAFE_MARGIN_Y, Window.y + Window.innerHeight / 2 - AVATAR_APP_HEIGHT_PX / 2) } }); @@ -181,6 +187,10 @@ function toggleSettingsApp() { size: { x: SETTINGS_APP_WIDTH_PX, y: SETTINGS_APP_HEIGHT_PX + }, + position: { + x: Math.max(Window.x + POPOUT_SAFE_MARGIN_X, Window.x + Window.innerWidth / 2 - SETTINGS_APP_WIDTH_PX / 2), + y: Math.max(Window.y + POPOUT_SAFE_MARGIN_Y, Window.y + Window.innerHeight / 2 - SETTINGS_APP_HEIGHT_PX / 2) } }); From da011fd042a63df1719f7c27301a39f1d3c83015 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Thu, 23 May 2019 13:37:25 -0700 Subject: [PATCH 26/31] Fix BUGZ-312; fix BUGZ-311 --- .../simplifiedUI/settingsApp/audio/Audio.qml | 23 +++++++------------ .../hifi/simplifiedUI/settingsApp/vr/VR.qml | 14 +++++------ 2 files changed, 14 insertions(+), 23 deletions(-) diff --git a/interface/resources/qml/hifi/simplifiedUI/settingsApp/audio/Audio.qml b/interface/resources/qml/hifi/simplifiedUI/settingsApp/audio/Audio.qml index 9ac72fa3cd..1b5f571d96 100644 --- a/interface/resources/qml/hifi/simplifiedUI/settingsApp/audio/Audio.qml +++ b/interface/resources/qml/hifi/simplifiedUI/settingsApp/audio/Audio.qml @@ -60,7 +60,7 @@ Flickable { HifiStylesUit.GraphikRegular { id: volumeControlsTitle text: "Volume Controls" - Layout.maximumWidth: parent.width + Layout.preferredWidth: parent.width height: paintedHeight size: 22 color: simplifiedUI.colors.text.white @@ -68,8 +68,7 @@ Flickable { SimplifiedControls.Slider { id: peopleVolume - anchors.left: parent.left - anchors.right: parent.right + Layout.preferredWidth: parent.width Layout.topMargin: simplifiedUI.margins.settings.settingsGroupTopMargin height: 30 labelText: "People Volume" @@ -96,8 +95,7 @@ Flickable { SimplifiedControls.Slider { id: environmentVolume - anchors.left: parent.left - anchors.right: parent.right + Layout.preferredWidth: parent.width Layout.topMargin: 2 height: 30 labelText: "Environment Volume" @@ -125,8 +123,7 @@ Flickable { SimplifiedControls.Slider { id: systemSoundVolume - anchors.left: parent.left - anchors.right: parent.right + Layout.preferredWidth: parent.width Layout.topMargin: 2 height: 30 labelText: "System Sound Volume" @@ -212,8 +209,7 @@ Flickable { ListView { id: inputDeviceListView - anchors.left: parent.left - anchors.right: parent.right + Layout.preferredWidth: parent.width Layout.topMargin: simplifiedUI.margins.settings.settingsGroupTopMargin interactive: false height: contentItem.height @@ -228,7 +224,7 @@ Flickable { id: inputDeviceCheckbox anchors.left: parent.left width: parent.width - inputLevel.width - height: paintedHeight + height: 16 wrapLabel: false checked: selectedDesktop text: model.devicename @@ -278,7 +274,6 @@ Flickable { id: testYourMicButton enabled: !HMD.active - anchors.left: parent.left Layout.topMargin: simplifiedUI.margins.settings.settingsGroupTopMargin width: 160 height: 32 @@ -313,8 +308,7 @@ Flickable { ListView { id: outputDeviceListView - anchors.left: parent.left - anchors.right: parent.right + Layout.preferredWidth: parent.width Layout.topMargin: simplifiedUI.margins.settings.settingsGroupTopMargin interactive: false height: contentItem.height @@ -329,7 +323,7 @@ Flickable { id: outputDeviceCheckbox anchors.left: parent.left width: parent.width - height: paintedHeight + height: 16 checked: selectedDesktop text: model.devicename wrapLabel: false @@ -381,7 +375,6 @@ Flickable { id: testYourSoundButton enabled: !HMD.active - anchors.left: parent.left Layout.topMargin: simplifiedUI.margins.settings.settingsGroupTopMargin width: 160 height: 32 diff --git a/interface/resources/qml/hifi/simplifiedUI/settingsApp/vr/VR.qml b/interface/resources/qml/hifi/simplifiedUI/settingsApp/vr/VR.qml index fc11451b5b..d869f82e12 100644 --- a/interface/resources/qml/hifi/simplifiedUI/settingsApp/vr/VR.qml +++ b/interface/resources/qml/hifi/simplifiedUI/settingsApp/vr/VR.qml @@ -198,8 +198,7 @@ Flickable { ListView { id: inputDeviceListView - anchors.left: parent.left - anchors.right: parent.right + Layout.preferredWidth: parent.width Layout.topMargin: simplifiedUI.margins.settings.settingsGroupTopMargin interactive: false height: contentItem.height @@ -214,6 +213,7 @@ Flickable { id: inputDeviceCheckbox anchors.left: parent.left width: parent.width - inputLevel.width + height: 16 checked: selectedHMD text: model.devicename wrapLabel: false @@ -263,7 +263,6 @@ Flickable { id: testYourMicButton enabled: HMD.active - anchors.left: parent.left Layout.topMargin: simplifiedUI.margins.settings.settingsGroupTopMargin width: 160 height: 32 @@ -298,8 +297,7 @@ Flickable { ListView { id: outputDeviceListView - anchors.left: parent.left - anchors.right: parent.right + Layout.preferredWidth: parent.width Layout.topMargin: simplifiedUI.margins.settings.settingsGroupTopMargin interactive: false height: contentItem.height @@ -314,12 +312,13 @@ Flickable { id: outputDeviceCheckbox anchors.left: parent.left width: parent.width - checked: selectedDesktop + height: 16 + checked: selectedHMD text: model.devicename wrapLabel: false ButtonGroup.group: outputDeviceButtonGroup onClicked: { - AudioScriptingInterface.setOutputDevice(model.info, true); // `false` argument for Desktop mode setting + AudioScriptingInterface.setOutputDevice(model.info, true); // `true` argument for VR mode setting } } } @@ -365,7 +364,6 @@ Flickable { id: testYourSoundButton enabled: HMD.active - anchors.left: parent.left Layout.topMargin: simplifiedUI.margins.settings.settingsGroupTopMargin width: 160 height: 32 From 940c122f461f4b363c10503d772b312962a2346f Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Thu, 23 May 2019 13:38:54 -0700 Subject: [PATCH 27/31] clear _otherAvatarsToChangeInPhysics after processing it --- interface/src/avatar/AvatarManager.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/interface/src/avatar/AvatarManager.cpp b/interface/src/avatar/AvatarManager.cpp index 80b9762213..f153f66799 100755 --- a/interface/src/avatar/AvatarManager.cpp +++ b/interface/src/avatar/AvatarManager.cpp @@ -521,6 +521,7 @@ void AvatarManager::buildPhysicsTransaction(PhysicsEngine::Transaction& transact } } } + _otherAvatarsToChangeInPhysics.clear(); } void AvatarManager::handleProcessedPhysicsTransaction(PhysicsEngine::Transaction& transaction) { @@ -645,7 +646,7 @@ void AvatarManager::clearOtherAvatars() { } void AvatarManager::deleteAllAvatars() { - assert(_otherAvatarsToChangeInPhysics.empty()); + _otherAvatarsToChangeInPhysics.clear(); QReadLocker locker(&_hashLock); AvatarHash::iterator avatarIterator = _avatarHash.begin(); while (avatarIterator != _avatarHash.end()) { From a7874fa55605b844836ef4915c6ac117ef836187 Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Thu, 23 May 2019 14:10:06 -0700 Subject: [PATCH 28/31] Update windows build with symbols for release qt-5.12.3 hifi_vcpkg.py will now download a new version of qt that contains release symbols. made minor changes to bullet3/portfile.cmake to trigger a new vkpkg hash. --- cmake/ports/bullet3/portfile.cmake | 5 +- hifi_vcpkg.py | 7 +- tools/qt-builder/README.md | 408 ++++++++++++++--------------- tools/qt-builder/qt5vars.bat | 2 +- 4 files changed, 208 insertions(+), 214 deletions(-) diff --git a/cmake/ports/bullet3/portfile.cmake b/cmake/ports/bullet3/portfile.cmake index d4e7aaf787..9318385de0 100644 --- a/cmake/ports/bullet3/portfile.cmake +++ b/cmake/ports/bullet3/portfile.cmake @@ -25,14 +25,13 @@ vcpkg_from_github( HEAD_REF master ) - vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} OPTIONS -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON -DUSE_MSVC_RUNTIME_LIBRARY_DLL=ON - -DUSE_GLUT=0 - -DUSE_DX11=0 + -DUSE_GLUT=0 + -DUSE_DX11=0 -DBUILD_DEMOS=OFF -DBUILD_OPENGL3_DEMOS=OFF -DBUILD_BULLET3=OFF diff --git a/hifi_vcpkg.py b/hifi_vcpkg.py index 3df714e6f9..9bc1878f94 100644 --- a/hifi_vcpkg.py +++ b/hifi_vcpkg.py @@ -258,18 +258,13 @@ endif() url = 'NOT DEFINED' if platform.system() == 'Windows': - # TODO: figure out how to download with versionId - #url = 'https://hifi-public.s3.amazonaws.com/dependencies/vcpkg/qt5-install-5.12.3-windows.tar.gz?versionId=Etx8novAe0.IxQ7AosLFtop7fZur.cx9' - url = 'https://hifi-public.s3.amazonaws.com/dependencies/vcpkg/qt5-install-5.12.3-windows.tar.gz' + url = 'https://hifi-public.s3.amazonaws.com/dependencies/vcpkg/qt5-install-5.12.3-windows2.tar.gz' elif platform.system() == 'Darwin': - #url = 'https://hifi-public.s3.amazonaws.com/dependencies/vcpkg/qt5-install-5.12.3-macos.tar.gz?versionId=QrGxwssB.WwU_z3QCyG7ghP1_VjTkQeK' url = 'https://hifi-public.s3.amazonaws.com/dependencies/vcpkg/qt5-install-5.12.3-macos.tar.gz' elif platform.system() == 'Linux': if platform.linux_distribution()[1] == '16.04': - #url = 'https://hifi-public.s3.amazonaws.com/dependencies/vcpkg/qt5-install-5.12.3-ubuntu-16.04.tar.gz?versionId=c9j7PW4uBDPLif7DKmgIhorh9WBMjZRB' url = 'https://hifi-public.s3.amazonaws.com/dependencies/vcpkg/qt5-install-5.12.3-ubuntu-16.04.tar.gz' elif platform.linux_distribution()[1] == '18.04': - #url = 'https://hifi-public.s3.amazonaws.com/dependencies/vcpkg/qt5-install-5.12.3-ubuntu-18.04.tar.gz?versionId=Z3TojPFdb5pXdahF3oi85jjKocpL0xqw' url = 'https://hifi-public.s3.amazonaws.com/dependencies/vcpkg/qt5-install-5.12.3-ubuntu-18.04.tar.gz' else: print('UNKNOWN LINUX VERSION!!!') diff --git a/tools/qt-builder/README.md b/tools/qt-builder/README.md index 4cd49ce865..b7861a5e53 100644 --- a/tools/qt-builder/README.md +++ b/tools/qt-builder/README.md @@ -1,235 +1,235 @@ # General This document describes the process to build Qt 5.12.3. -Note that there are two patches. The first (to qfloat16.h) is needed to compile QT 5.12.3 on Visual Studio 2017 due to a bug in Visual Studio (*bitset* will not compile. Note that there is a change in CMakeLists.txt to support this. +Note that there are two patches. The first (to qfloat16.h) is needed to compile QT 5.12.3 on Visual Studio 2017 due to a bug in Visual Studio (*bitset* will not compile. Note that there is a change in CMakeLists.txt to support this. The second patch is to OpenSL ES audio. ## Requirements ### Windows -1. Visual Studio 2017 - If you don’t have Community or Professional edition of Visual Studio 2017, download [Visual Studio Community 2017](https://www.visualstudio.com/downloads/). +1. Visual Studio 2017 + If you don’t have Community or Professional edition of Visual Studio 2017, download [Visual Studio Community 2017](https://www.visualstudio.com/downloads/). Install with defaults 1. python 2.7.16 -Check if needed running `python --version` - should return python 2.7.x -Install from https://www.python.org/ftp/python/2.7.16/python-2.7.16.amd64.msi +Check if needed running `python --version` - should return python 2.7.x +Install from https://www.python.org/ftp/python/2.7.16/python-2.7.16.amd64.msi Add path to python executable to PATH. NOTE: REMOVE python 3 from PATH. Our regular build uses python 3. This will still work, because HIFI_PYTHON_EXEC points to the python 3 executable. -Verify that python runs python 2.7 (run “python --version”) -1. git >= 1.6 -Check if needed `git --version` -Download from https://git-scm.com/download/win -Verify by entering `git --version` -1. perl >= 5.14 -Install from Strawberry Perl - http://strawberryperl.com/ - 5.28.1.1 64 bit to C:\Strawberry\ -Verify by running `perl --version` -1. flex and bison -Download from https://sourceforge.net/projects/winflexbison/files/latest/download -Uncompress in C:\flex_bison -Rename win-bison.exe to bison.exe and win-flex.exe to flex.exe -Add C:\flex_bison to PATH -Verify by running `flex --version` -Verify by running `bison --version` -1. gperf -Install from http://gnuwin32.sourceforge.net/downlinks/gperf.php -Add C:\Program Files (x86)\GnuWin32\bin to PATH -Verify by running `gperf --version` -1. 7-zip -Download from https://www.7-zip.org/download.html -1. Bash shell -From *Settings* select *Update & Security* -Select *For Developers* -Enable *Developer mode* -Restart PC -Open Control Panel and select *Programs and Features* -Select *Turn Windows features on or off* -Check *Windows Subsystem for Linux* -Click *Restart now* -Download from the Microsoft Store - Search for *bash* and choose the latest Ubuntu version -[First run will take a few minutes] -Enter a user name - all small letters (this is used for *sudo* commands) -Choose a password +Verify that python runs python 2.7 (run “python --version”) +1. git >= 1.6 +Check if needed `git --version` +Download from https://git-scm.com/download/win +Verify by entering `git --version` +1. perl >= 5.14 +Install from Strawberry Perl - http://strawberryperl.com/ - 5.28.1.1 64 bit to C:\Strawberry\ +Verify by running `perl --version` +1. flex and bison +Download from https://sourceforge.net/projects/winflexbison/files/latest/download +Uncompress in C:\flex_bison +Rename win-bison.exe to bison.exe and win-flex.exe to flex.exe +Add C:\flex_bison to PATH +Verify by running `flex --version` +Verify by running `bison --version` +1. gperf +Install from http://gnuwin32.sourceforge.net/downlinks/gperf.php +Add C:\Program Files (x86)\GnuWin32\bin to PATH +Verify by running `gperf --version` +1. 7-zip +Download from https://www.7-zip.org/download.html +1. Bash shell +From *Settings* select *Update & Security* +Select *For Developers* +Enable *Developer mode* +Restart PC +Open Control Panel and select *Programs and Features* +Select *Turn Windows features on or off* +Check *Windows Subsystem for Linux* +Click *Restart now* +Download from the Microsoft Store - Search for *bash* and choose the latest Ubuntu version +[First run will take a few minutes] +Enter a user name - all small letters (this is used for *sudo* commands) +Choose a password ### Linux -Tested on Ubuntu 16.04 and 18.04. +Tested on Ubuntu 16.04 and 18.04. **16.04 NEEDED FOR JENKINS~~ ** -1. qt5 requirements -edit /etc/apt/sources.list (edit as root) -replace all *# deb-src* with *deb-src* (in vi `1,$s/# deb-src/deb-src/`) -`sudo apt-get update -y` -`sudo apt-get upgrade -y` -`sudo apt-get build-dep qt5-default -y` -1. git >= 1.6 -Check if needed `git --version` -`sudo apt-get install git -y` -Verify again -1. python -Check if needed `python --version` - should return python 2.7.x -`sudo apt-get install python -y` (not python 3!) -Verify again -1. gperf -Check if needed `gperf --version` -`sudo apt-get install gperf -y` -Verify again -1. bison and flex -Check if needed `flex --version` and `bison --version` -`sudo apt-get install flex bison -y` -Verify again -1. pkg-config (needed for qtwebengine) -Check if needed `pkg-config --version` -`sudo apt-get install pkg-config -y` -Verify again -1. OpenGL -Verify (first install mesa-utils - `sudo apt install mesa-utils -y`) by `glxinfo | grep "OpenGL version"` -`sudo apt-get install libgl1-mesa-dev -y` -`sudo ln -s /usr/lib/x86_64-linux-gnu/libGL.so.346.35 /usr/lib/x86_64-linux-gnu/libGL.so.1.2.0` -Verify again -1. make -Check if needed `make --version` -`sudo apt-get install make -y` -Verify again -1. g++ -Check if needed - `g++ --version` -`sudo apt-get install g++ -y` -Verify again -1. dbus-1 (needed for qtwebengine) -`sudo apt-get install libdbus-glib-1-dev -y` -1. nss (needed for qtwebengine) -`sudo apt-get install libnss3-dev -y` +1. qt5 requirements +edit /etc/apt/sources.list (edit as root) +replace all *# deb-src* with *deb-src* (in vi `1,$s/# deb-src/deb-src/`) +`sudo apt-get update -y` +`sudo apt-get upgrade -y` +`sudo apt-get build-dep qt5-default -y` +1. git >= 1.6 +Check if needed `git --version` +`sudo apt-get install git -y` +Verify again +1. python +Check if needed `python --version` - should return python 2.7.x +`sudo apt-get install python -y` (not python 3!) +Verify again +1. gperf +Check if needed `gperf --version` +`sudo apt-get install gperf -y` +Verify again +1. bison and flex +Check if needed `flex --version` and `bison --version` +`sudo apt-get install flex bison -y` +Verify again +1. pkg-config (needed for qtwebengine) +Check if needed `pkg-config --version` +`sudo apt-get install pkg-config -y` +Verify again +1. OpenGL +Verify (first install mesa-utils - `sudo apt install mesa-utils -y`) by `glxinfo | grep "OpenGL version"` +`sudo apt-get install libgl1-mesa-dev -y` +`sudo ln -s /usr/lib/x86_64-linux-gnu/libGL.so.346.35 /usr/lib/x86_64-linux-gnu/libGL.so.1.2.0` +Verify again +1. make +Check if needed `make --version` +`sudo apt-get install make -y` +Verify again +1. g++ +Check if needed + `g++ --version` +`sudo apt-get install g++ -y` +Verify again +1. dbus-1 (needed for qtwebengine) +`sudo apt-get install libdbus-glib-1-dev -y` +1. nss (needed for qtwebengine) +`sudo apt-get install libnss3-dev -y` ### Mac -1. git >= 1.6 -Check if needed `git --version` -Install from https://git-scm.com/download/mac -Verify again -1. pkg-config -brew fontconfig dbus-glib stall pkg-config -1. dbus-1 -brew install dbus-glib +1. git >= 1.6 +Check if needed `git --version` +Install from https://git-scm.com/download/mac +Verify again +1. pkg-config +brew fontconfig dbus-glib stall pkg-config +1. dbus-1 +brew install dbus-glib ## Build Process ### General -qt is cloned to the qt5 folder. -The build is performed in the qt5-build folder. -Build products are installed to the qt5-install folder. -Before running configure, make sure that the qt5-build folder is empty. +qt is cloned to the qt5 folder. +The build is performed in the qt5-build folder. +Build products are installed to the qt5-install folder. +Before running configure, make sure that the qt5-build folder is empty. -**Only run the git patches once!!!** +**Only run the git patches once!!!** ### Windows -Before building, verify that **HIFI_VCPKG_BASE_VERSION** points to a *vcpkg* folder containing *packages\openssl-windows_x64-windows*. -If not, follow https://github.com/highfidelity/vcpkg to install *vcpkg* and then *openssl*. +Before building, verify that **HIFI_VCPKG_BASE_VERSION** points to a *vcpkg* folder containing *packages\openssl-windows_x64-windows*. +If not, follow https://github.com/highfidelity/vcpkg to install *vcpkg* and then *openssl*. #### Preparing source files -`git clone --recursive https://code.qt.io/qt/qt5.git -b 5.12.3 --single-branch` - -* Copy the **patches** folder to qt5 -* Copy the **qt5vars.bat** file to qt5 -* Apply the two patches to Qt +`git clone --recursive https://code.qt.io/qt/qt5.git -b 5.12.3 --single-branch` -`cd qt5` -`git apply --ignore-space-change --ignore-whitespace patches/qfloat16.patch` -`git apply --ignore-space-change --ignore-whitespace patches/aec.patch` -`cd ..` -#### Configuring -`mkdir qt5-install` -`mkdir qt5-build` -`cd qt5-build` +* Copy the **patches** folder to qt5 +* Copy the **qt5vars.bat** file to qt5 +* Apply the two patches to Qt -run `..\qt5\qt5vars.bat` -`cd ..\..\qt5-build` - -`..\qt5\configure -force-debug-info -opensource -confirm-license -opengl desktop -platform win32-msvc -openssl-linked OPENSSL_LIBS="-lssleay32 -llibeay32" -I %HIFI_VCPKG_BASE_VERSION%\packages\openssl-windows_x64-windows\include -L %HIFI_VCPKG_BASE_VERSION%\packages\openssl-windows_x64-windows\lib -nomake examples -nomake tests -skip qttranslations -skip qtserialport -skip qt3d -skip qtlocation -skip qtwayland -skip qtsensors -skip qtgamepad -skip qtspeech -skip qtcharts -skip qtx11extras -skip qtmacextras -skip qtvirtualkeyboard -skip qtpurchasing -skip qtdatavis3d -no-warnings-are-errors -no-pch -prefix ..\qt5-install` -#### Make -`nmake` -`nmake install` -#### Fixing -The *.prl* files have an absolute path that needs to be removed (see http://www.linuxfromscratch.org/blfs/view/stable-systemd/x/qtwebengine.html) -1. Open a bash terminal -1. `cd` to the *qt5-install* folder (e.g. `cd /mnt/d/qt5-install/`) -1. Run the following command -`find . -name \*.prl -exec sed -i -e '/^QMAKE_PRL_BUILD_DIR/d' {} \;` -1. Copy *qt.conf* to *qt5-install\bin* -#### Uploading -Create a tar file called qt5-install.tar from the qt5-install folder (e.g. using 7-zip) -Create a gzip file called qt5-install.tar.gz from the qt5-install.tar file just created (e.g. using 7-zip) -Upload qt5-install.tar.gz to https://hifi-qa.s3.amazonaws.com/qt5/Windows/ -### Linux -#### Preparing source files -`git clone --recursive git://code.qt.io/qt/qt5.git -b 5.12.3 --single-branch` - -* Copy the **patches** folder to qt5 -* Apply one patch to Qt -`cd qt5` -`git apply --ignore-space-change --ignore-whitespace patches/aec.patch` +`cd qt5` +`git apply --ignore-space-change --ignore-whitespace patches/qfloat16.patch` +`git apply --ignore-space-change --ignore-whitespace patches/aec.patch` `cd ..` #### Configuring -`mkdir qt5-install` -`mkdir qt5-build` -`cd qt5-build` +`mkdir qt5-install` +`mkdir qt5-build` +`cd qt5-build` -*Ubuntu 16.04* -`../qt5/configure -opensource -confirm-license -platform linux-g++-64 -qt-zlib -qt-libjpeg -qt-libpng -qt-xcb -qt-freetype -qt-pcre -qt-harfbuzz -nomake examples -nomake tests -skip qttranslations -skip qtserialport -skip qt3d -skip qtlocation -skip qtwayland -skip qtsensors -skip qtgamepad -skip qtspeech -skip qtcharts -skip qtmacextras -skip qtvirtualkeyboard -skip qtpurchasing -skip qtdatavis3d -no-warnings-are-errors -no-pch -no-egl -no-icu -prefix ../qt5-install` +run `..\qt5\qt5vars.bat` +`cd ..\..\qt5-build` -*Ubuntu 18.04* -`../qt5/configure -force-debug-info -release -opensource -confirm-license -gdb-index -recheck-all -nomake tests -nomake examples -skip qttranslations -skip qtserialport -skip qt3d -skip qtlocation -skip qtwayland -skip qtsensors -skip qtgamepad -skip qtspeech -skip qtcharts -skip qtx11extras -skip qtmacextras -skip qtvirtualkeyboard -skip qtpurchasing -skip qtdatavis3d -no-warnings-are-errors -no-pch -c++std c++14 -prefix ../qt5-install` - - -???`../qt5/configure -opensource -confirm-license -gdb-index -nomake examples -nomake tests -skip qttranslations -skip qtserialport -skip qt3d -skip qtlocation -skip qtwayland -skip qtsensors -skip qtgamepad -skip qtspeech -skip qtcharts -skip qtmacextras -skip qtvirtualkeyboard -skip qtpurchasing -skip qtdatavis3d -no-warnings-are-errors -no-pch -prefix ../qt5-install` -#### Make -`make` - -????*Ubuntu 18.04 only* -????`make module-qtwebengine` -????`make module-qtscript` - -*Both* -`make install` -#### Fixing -1. The *.prl* files have an absolute path that needs to be removed (see http://www.linuxfromscratch.org/blfs/view/stable-systemd/x/qtwebengine.html) -`cd ../qt5-install` -`find . -name \*.prl -exec sed -i -e '/^QMAKE_PRL_BUILD_DIR/d' {} \;` -1. Copy *qt.conf* to *qt5-install\bin* -#### Uploading -*Ubuntu 16.04* -1. Return to the home folder -`cd ..` -1. Open a python 3 shell -`python3` -1. Run the following snippet: -`import os` -`import tarfile` -`filename=tarfile.open("qt5-install.tar.gz", "w:gz")` -`filename.add("qt5-install", os.path.basename("qt5-install"))` -`exit()` -1. Upload qt5-install.tar.gz to https://hifi-qa.s3.amazonaws.com/qt5/Ubuntu/16.04 - -*Ubuntu 18.04* -``tar -zcvf qt5-install.tar.gz qt5-install` -1. Upload qt5-install.tar.gz to https://hifi-qa.s3.amazonaws.com/qt5/Ubuntu/18.04 - -1. ### Mac -#### Preparing source files -git clone --recursive git://code.qt.io/qt/qt5.git -b 5.12.3 --single-branch - -* Copy the **patches** folder to qt5 -* Apply one patch to Qt -`cd qt5` -`git apply --ignore-space-change --ignore-whitespace patches/aec.patch` -`cd ..` -#### Configuring -`mkdir qt5-install` -`mkdir qt5-build` -`cd ../qt5-build` - -`../qt5/configure -force-debug-info -opensource -confirm-license -qt-zlib -qt-libjpeg -qt-libpng -qt-freetype -qt-pcre -qt-harfbuzz -nomake examples -nomake tests -skip qttranslations -skip qtserialport -skip qt3d -skip qtlocation -skip qtwayland -skip qtsensors -skip qtgamepad -skip qtspeech -skip qtcharts -skip qtx11extras -skip qtmacextras -skip qtvirtualkeyboard -skip qtpurchasing -skip qtdatavis3d -no-warnings-are-errors -no-pch -prefix ../qt5-install` +`..\qt5\configure -force-debug-info -opensource -confirm-license -opengl desktop -platform win32-msvc -openssl-linked OPENSSL_LIBS="-lssleay32 -llibeay32" -I %HIFI_VCPKG_BASE_VERSION%\packages\openssl-windows_x64-windows\include -L %HIFI_VCPKG_BASE_VERSION%\packages\openssl-windows_x64-windows\lib -nomake examples -nomake tests -skip qttranslations -skip qtserialport -skip qt3d -skip qtlocation -skip qtwayland -skip qtsensors -skip qtgamepad -skip qtspeech -skip qtcharts -skip qtx11extras -skip qtmacextras -skip qtvirtualkeyboard -skip qtpurchasing -skip qtdatavis3d -no-warnings-are-errors -no-pch -prefix ..\qt5-install` #### Make -`make` -`make install` +`nmake` +`nmake install` #### Fixing -1. The *.prl* files have an absolute path that needs to be removed (see http://www.linuxfromscratch.org/blfs/view/stable-systemd/x/qtwebengine.html) -`cd ../qt5-install` -`find . -name \*.prl -exec sed -i -e '/^QMAKE_PRL_BUILD_DIR/d' {} \;` -`cd ..` -1. Copy *qt.conf* to *qt5-install\bin* +The *.prl* files have an absolute path that needs to be removed (see http://www.linuxfromscratch.org/blfs/view/stable-systemd/x/qtwebengine.html) +1. Open a bash terminal +1. `cd` to the *qt5-install* folder (e.g. `cd /mnt/d/qt5-install/`) +1. Run the following command +`find . -name \*.prl -exec sed -i -e '/^QMAKE_PRL_BUILD_DIR/d' {} \;` +1. Copy *qt.conf* to *qt5-install\bin* #### Uploading -`tar -zcvf qt5-install.tar.gz qt5-install` -Upload qt5-install.tar.gz to https://hifi-qa.s3.amazonaws.com/qt5/Mac/ +Create a tar file called qt5-install.tar from the qt5-install folder (e.g. using 7-zip) +Create a gzip file called qt5-install.tar.gz from the qt5-install.tar file just created (e.g. using 7-zip) +Upload qt5-install.tar.gz to https://hifi-qa.s3.amazonaws.com/qt5/Windows/ +### Linux +#### Preparing source files +`git clone --recursive git://code.qt.io/qt/qt5.git -b 5.12.3 --single-branch` + +* Copy the **patches** folder to qt5 +* Apply one patch to Qt +`cd qt5` +`git apply --ignore-space-change --ignore-whitespace patches/aec.patch` +`cd ..` +#### Configuring +`mkdir qt5-install` +`mkdir qt5-build` +`cd qt5-build` + +*Ubuntu 16.04* +`../qt5/configure -opensource -confirm-license -platform linux-g++-64 -qt-zlib -qt-libjpeg -qt-libpng -qt-xcb -qt-freetype -qt-pcre -qt-harfbuzz -nomake examples -nomake tests -skip qttranslations -skip qtserialport -skip qt3d -skip qtlocation -skip qtwayland -skip qtsensors -skip qtgamepad -skip qtspeech -skip qtcharts -skip qtmacextras -skip qtvirtualkeyboard -skip qtpurchasing -skip qtdatavis3d -no-warnings-are-errors -no-pch -no-egl -no-icu -prefix ../qt5-install` + +*Ubuntu 18.04* +`../qt5/configure -force-debug-info -release -opensource -confirm-license -gdb-index -recheck-all -nomake tests -nomake examples -skip qttranslations -skip qtserialport -skip qt3d -skip qtlocation -skip qtwayland -skip qtsensors -skip qtgamepad -skip qtspeech -skip qtcharts -skip qtx11extras -skip qtmacextras -skip qtvirtualkeyboard -skip qtpurchasing -skip qtdatavis3d -no-warnings-are-errors -no-pch -c++std c++14 -prefix ../qt5-install` + + +???`../qt5/configure -opensource -confirm-license -gdb-index -nomake examples -nomake tests -skip qttranslations -skip qtserialport -skip qt3d -skip qtlocation -skip qtwayland -skip qtsensors -skip qtgamepad -skip qtspeech -skip qtcharts -skip qtmacextras -skip qtvirtualkeyboard -skip qtpurchasing -skip qtdatavis3d -no-warnings-are-errors -no-pch -prefix ../qt5-install` +#### Make +`make` + +????*Ubuntu 18.04 only* +????`make module-qtwebengine` +????`make module-qtscript` + +*Both* +`make install` +#### Fixing +1. The *.prl* files have an absolute path that needs to be removed (see http://www.linuxfromscratch.org/blfs/view/stable-systemd/x/qtwebengine.html) +`cd ../qt5-install` +`find . -name \*.prl -exec sed -i -e '/^QMAKE_PRL_BUILD_DIR/d' {} \;` +1. Copy *qt.conf* to *qt5-install\bin* +#### Uploading +*Ubuntu 16.04* +1. Return to the home folder +`cd ..` +1. Open a python 3 shell +`python3` +1. Run the following snippet: +`import os` +`import tarfile` +`filename=tarfile.open("qt5-install.tar.gz", "w:gz")` +`filename.add("qt5-install", os.path.basename("qt5-install"))` +`exit()` +1. Upload qt5-install.tar.gz to https://hifi-qa.s3.amazonaws.com/qt5/Ubuntu/16.04 + +*Ubuntu 18.04* +``tar -zcvf qt5-install.tar.gz qt5-install` +1. Upload qt5-install.tar.gz to https://hifi-qa.s3.amazonaws.com/qt5/Ubuntu/18.04 + +1. ### Mac +#### Preparing source files +git clone --recursive git://code.qt.io/qt/qt5.git -b 5.12.3 --single-branch + +* Copy the **patches** folder to qt5 +* Apply one patch to Qt +`cd qt5` +`git apply --ignore-space-change --ignore-whitespace patches/aec.patch` +`cd ..` +#### Configuring +`mkdir qt5-install` +`mkdir qt5-build` +`cd ../qt5-build` + +`../qt5/configure -force-debug-info -opensource -confirm-license -qt-zlib -qt-libjpeg -qt-libpng -qt-freetype -qt-pcre -qt-harfbuzz -nomake examples -nomake tests -skip qttranslations -skip qtserialport -skip qt3d -skip qtlocation -skip qtwayland -skip qtsensors -skip qtgamepad -skip qtspeech -skip qtcharts -skip qtx11extras -skip qtmacextras -skip qtvirtualkeyboard -skip qtpurchasing -skip qtdatavis3d -no-warnings-are-errors -no-pch -prefix ../qt5-install` +#### Make +`make` +`make install` +#### Fixing +1. The *.prl* files have an absolute path that needs to be removed (see http://www.linuxfromscratch.org/blfs/view/stable-systemd/x/qtwebengine.html) +`cd ../qt5-install` +`find . -name \*.prl -exec sed -i -e '/^QMAKE_PRL_BUILD_DIR/d' {} \;` +`cd ..` +1. Copy *qt.conf* to *qt5-install\bin* +#### Uploading +`tar -zcvf qt5-install.tar.gz qt5-install` +Upload qt5-install.tar.gz to https://hifi-qa.s3.amazonaws.com/qt5/Mac/ ## Problems *configure* errors, if any, may be viewed in **config.log** and **config.summary** diff --git a/tools/qt-builder/qt5vars.bat b/tools/qt-builder/qt5vars.bat index 10ad5be4ae..22a976827b 100644 --- a/tools/qt-builder/qt5vars.bat +++ b/tools/qt-builder/qt5vars.bat @@ -1,6 +1,6 @@ @echo off -REM Set up \Microsoft Visual Studio 2015, where is \c amd64, \c x86, etc. +REM Set up \Microsoft Visual Studio 2017, where is \c amd64, \c x86, etc. CALL "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x64 REM Edit this location to point to the source code of Qt From 78fdd2d6738d18449e5a799244859b63e0905104 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Thu, 23 May 2019 14:25:06 -0700 Subject: [PATCH 29/31] Fix BUGZ-336 --- .../hifi/simplifiedUI/settingsApp/audio/Audio.qml | 14 +++++--------- .../qml/hifi/simplifiedUI/settingsApp/vr/VR.qml | 14 +++++--------- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/interface/resources/qml/hifi/simplifiedUI/settingsApp/audio/Audio.qml b/interface/resources/qml/hifi/simplifiedUI/settingsApp/audio/Audio.qml index 9ac72fa3cd..c43f432582 100644 --- a/interface/resources/qml/hifi/simplifiedUI/settingsApp/audio/Audio.qml +++ b/interface/resources/qml/hifi/simplifiedUI/settingsApp/audio/Audio.qml @@ -251,6 +251,7 @@ Flickable { } SimplifiedControls.Button { + id: audioLoopbackButton property bool audioLoopedBack: AudioScriptingInterface.getLocalEcho() function startAudioLoopback() { @@ -266,17 +267,14 @@ Flickable { } } - Timer { - id: loopbackTimer - interval: 8000 - running: false - repeat: false - onTriggered: { + Component.onDestruction: stopAudioLoopback(); + + onVisibleChanged: { + if (!visible) { stopAudioLoopback(); } } - id: testYourMicButton enabled: !HMD.active anchors.left: parent.left Layout.topMargin: simplifiedUI.margins.settings.settingsGroupTopMargin @@ -285,10 +283,8 @@ Flickable { text: audioLoopedBack ? "STOP TESTING" : "TEST YOUR MIC" onClicked: { if (audioLoopedBack) { - loopbackTimer.stop(); stopAudioLoopback(); } else { - loopbackTimer.restart(); startAudioLoopback(); } } diff --git a/interface/resources/qml/hifi/simplifiedUI/settingsApp/vr/VR.qml b/interface/resources/qml/hifi/simplifiedUI/settingsApp/vr/VR.qml index 96dbc5e180..549c4aced5 100644 --- a/interface/resources/qml/hifi/simplifiedUI/settingsApp/vr/VR.qml +++ b/interface/resources/qml/hifi/simplifiedUI/settingsApp/vr/VR.qml @@ -235,6 +235,7 @@ Flickable { } SimplifiedControls.Button { + id: audioLoopbackButton property bool audioLoopedBack: AudioScriptingInterface.getLocalEcho() function startAudioLoopback() { @@ -250,17 +251,14 @@ Flickable { } } - Timer { - id: loopbackTimer - interval: 8000 - running: false - repeat: false - onTriggered: { + Component.onDestruction: stopAudioLoopback(); + + onVisibleChanged: { + if (!visible) { stopAudioLoopback(); } } - id: testYourMicButton enabled: HMD.active anchors.left: parent.left Layout.topMargin: simplifiedUI.margins.settings.settingsGroupTopMargin @@ -269,10 +267,8 @@ Flickable { text: audioLoopedBack ? "STOP TESTING" : "TEST YOUR MIC" onClicked: { if (audioLoopedBack) { - loopbackTimer.stop(); stopAudioLoopback(); } else { - loopbackTimer.restart(); startAudioLoopback(); } } From 42c1f4be33dd215d34c57d2b13b99f67d21e4f3b Mon Sep 17 00:00:00 2001 From: luiscuenca Date: Thu, 23 May 2019 17:07:06 -0700 Subject: [PATCH 30/31] fix typo and entry on first run when --url is set --- interface/src/Application.cpp | 20 +++++++++++++------- interface/src/Application.h | 4 +++- interface/src/main.cpp | 5 ++++- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index ca171aa8b9..5432577223 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -3800,10 +3800,14 @@ void Application::handleSandboxStatus(QNetworkReply* reply) { // If this is a first run we short-circuit the address passed in if (_firstRun.get()) { - DependencyManager::get()->goToEntry(); - sentTo = SENT_TO_ENTRY; - _firstRun.set(false); - + if (!_overrideEntry) { + DependencyManager::get()->goToEntry(); + sentTo = SENT_TO_ENTRY; + } else { + DependencyManager::get()->loadSettings(addressLookupString); + sentTo = SENT_TO_PREVIOUS_LOCATION; + } + _firstRun.set(false); } else { QString goingTo = ""; if (addressLookupString.isEmpty()) { @@ -3819,7 +3823,7 @@ void Application::handleSandboxStatus(QNetworkReply* reply) { DependencyManager::get()->loadSettings(addressLookupString); sentTo = SENT_TO_PREVIOUS_LOCATION; } - + UserActivityLogger::getInstance().logAction("startup_sent_to", { { "sent_to", sentTo }, { "sandbox_is_running", sandboxIsRunning }, @@ -9354,11 +9358,13 @@ void Application::showUrlHandler(const QUrl& url) { } }); } - +void Application::overrideEntry(){ + _overrideEntry = true; +} void Application::forceDisplayName(const QString& displayName) { getMyAvatar()->setDisplayName(displayName); } -void Application::forceLogginWithTokens(const QString& tokens) { +void Application::forceLoginWithTokens(const QString& tokens) { DependencyManager::get()->setAccessTokens(tokens); } void Application::setConfigFileURL(const QString& fileUrl) { diff --git a/interface/src/Application.h b/interface/src/Application.h index 2eac2bc885..837fb8eae6 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -356,8 +356,9 @@ public: void openDirectory(const QString& path); + void overrideEntry(); void forceDisplayName(const QString& displayName); - void forceLogginWithTokens(const QString& tokens); + void forceLoginWithTokens(const QString& tokens); void setConfigFileURL(const QString& fileUrl); signals: @@ -832,5 +833,6 @@ private: bool _resumeAfterLoginDialogActionTaken_WasPostponed { false }; bool _resumeAfterLoginDialogActionTaken_SafeToRun { false }; bool _startUpFinished { false }; + bool _overrideEntry { false }; }; #endif // hifi_Application_h diff --git a/interface/src/main.cpp b/interface/src/main.cpp index 140b79584c..7fc4a5b651 100644 --- a/interface/src/main.cpp +++ b/interface/src/main.cpp @@ -407,6 +407,9 @@ int main(int argc, const char* argv[]) { auto appPointer = dynamic_cast(&app); if (appPointer) { + if (parser.isSet(urlOption)) { + appPointer->overrideEntry(); + } if (parser.isSet(displayNameOption)) { QString displayName = QString(parser.value(displayNameOption)); appPointer->forceDisplayName(displayName); @@ -416,7 +419,7 @@ int main(int argc, const char* argv[]) { } if (parser.isSet(responseTokensOption)) { QString tokens = QString(parser.value(responseTokensOption)); - appPointer->forceLogginWithTokens(tokens); + appPointer->forceLoginWithTokens(tokens); } } From 050682c84cc90f1c9cc573d25574374b5bdd63a8 Mon Sep 17 00:00:00 2001 From: luiscuenca Date: Thu, 23 May 2019 19:53:37 -0700 Subject: [PATCH 31/31] Keep logged in after first run --- interface/src/Application.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 5432577223..a0cb790958 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -9366,6 +9366,7 @@ void Application::forceDisplayName(const QString& displayName) { } void Application::forceLoginWithTokens(const QString& tokens) { DependencyManager::get()->setAccessTokens(tokens); + Setting::Handle(KEEP_ME_LOGGED_IN_SETTING_NAME, true).set(true); } void Application::setConfigFileURL(const QString& fileUrl) { DependencyManager::get()->setConfigFileURL(fileUrl);
ValueDescription