Merge branch 'master' of https://github.com/highfidelity/hifi into particleExplorerOptionalPropFix

This commit is contained in:
David Back 2018-06-27 16:32:21 -07:00
commit dd09ec1656
42 changed files with 353 additions and 342 deletions

View file

@ -504,6 +504,11 @@ void EntityServer::startDynamicDomainVerification() {
QString thisDomainID = DependencyManager::get<AddressManager>()->getDomainID().remove(QRegExp("\\{|\\}")); QString thisDomainID = DependencyManager::get<AddressManager>()->getDomainID().remove(QRegExp("\\{|\\}"));
if (jsonObject["domain_id"].toString() != thisDomainID) { if (jsonObject["domain_id"].toString() != thisDomainID) {
EntityItemPointer entity = tree->findEntityByEntityItemID(entityID); EntityItemPointer entity = tree->findEntityByEntityItemID(entityID);
if (!entity) {
qCDebug(entities) << "Entity undergoing dynamic domain verification is no longer available:" << entityID;
networkReply->deleteLater();
return;
}
if (entity->getAge() > (_MAXIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS/MSECS_PER_SECOND)) { if (entity->getAge() > (_MAXIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS/MSECS_PER_SECOND)) {
qCDebug(entities) << "Entity's cert's domain ID" << jsonObject["domain_id"].toString() qCDebug(entities) << "Entity's cert's domain ID" << jsonObject["domain_id"].toString()
<< "doesn't match the current Domain ID" << thisDomainID << "; deleting entity" << entityID; << "doesn't match the current Domain ID" << thisDomainID << "; deleting entity" << entityID;

View file

@ -660,9 +660,8 @@ void DomainGatekeeper::requestUserPublicKey(const QString& username, bool isOpti
// even if we have a public key for them right now, request a new one in case it has just changed // even if we have a public key for them right now, request a new one in case it has just changed
JSONCallbackParameters callbackParams; JSONCallbackParameters callbackParams;
callbackParams.jsonCallbackReceiver = this; callbackParams.callbackReceiver = this;
callbackParams.jsonCallbackMethod = "publicKeyJSONCallback"; callbackParams.jsonCallbackMethod = "publicKeyJSONCallback";
callbackParams.errorCallbackReceiver = this;
callbackParams.errorCallbackMethod = "publicKeyJSONErrorCallback"; callbackParams.errorCallbackMethod = "publicKeyJSONErrorCallback";
@ -675,19 +674,19 @@ void DomainGatekeeper::requestUserPublicKey(const QString& username, bool isOpti
QNetworkAccessManager::GetOperation, callbackParams); QNetworkAccessManager::GetOperation, callbackParams);
} }
QString extractUsernameFromPublicKeyRequest(QNetworkReply& requestReply) { QString extractUsernameFromPublicKeyRequest(QNetworkReply* requestReply) {
// extract the username from the request url // extract the username from the request url
QString username; QString username;
const QString PUBLIC_KEY_URL_REGEX_STRING = "api\\/v1\\/users\\/([A-Za-z0-9_\\.]+)\\/public_key"; const QString PUBLIC_KEY_URL_REGEX_STRING = "api\\/v1\\/users\\/([A-Za-z0-9_\\.]+)\\/public_key";
QRegExp usernameRegex(PUBLIC_KEY_URL_REGEX_STRING); QRegExp usernameRegex(PUBLIC_KEY_URL_REGEX_STRING);
if (usernameRegex.indexIn(requestReply.url().toString()) != -1) { if (usernameRegex.indexIn(requestReply->url().toString()) != -1) {
username = usernameRegex.cap(1); username = usernameRegex.cap(1);
} }
return username.toLower(); return username.toLower();
} }
void DomainGatekeeper::publicKeyJSONCallback(QNetworkReply& requestReply) { void DomainGatekeeper::publicKeyJSONCallback(QNetworkReply* requestReply) {
QJsonObject jsonObject = QJsonDocument::fromJson(requestReply.readAll()).object(); QJsonObject jsonObject = QJsonDocument::fromJson(requestReply->readAll()).object();
QString username = extractUsernameFromPublicKeyRequest(requestReply); QString username = extractUsernameFromPublicKeyRequest(requestReply);
bool isOptimisticKey = _inFlightPublicKeyRequests.take(username); bool isOptimisticKey = _inFlightPublicKeyRequests.take(username);
@ -707,8 +706,8 @@ void DomainGatekeeper::publicKeyJSONCallback(QNetworkReply& requestReply) {
} }
} }
void DomainGatekeeper::publicKeyJSONErrorCallback(QNetworkReply& requestReply) { void DomainGatekeeper::publicKeyJSONErrorCallback(QNetworkReply* requestReply) {
qDebug() << "publicKey api call failed:" << requestReply.error(); qDebug() << "publicKey api call failed:" << requestReply->error();
QString username = extractUsernameFromPublicKeyRequest(requestReply); QString username = extractUsernameFromPublicKeyRequest(requestReply);
_inFlightPublicKeyRequests.remove(username); _inFlightPublicKeyRequests.remove(username);
} }
@ -893,9 +892,8 @@ void DomainGatekeeper::getGroupMemberships(const QString& username) {
JSONCallbackParameters callbackParams; JSONCallbackParameters callbackParams;
callbackParams.jsonCallbackReceiver = this; callbackParams.callbackReceiver = this;
callbackParams.jsonCallbackMethod = "getIsGroupMemberJSONCallback"; callbackParams.jsonCallbackMethod = "getIsGroupMemberJSONCallback";
callbackParams.errorCallbackReceiver = this;
callbackParams.errorCallbackMethod = "getIsGroupMemberErrorCallback"; callbackParams.errorCallbackMethod = "getIsGroupMemberErrorCallback";
const QString GET_IS_GROUP_MEMBER_PATH = "api/v1/groups/members/%2"; const QString GET_IS_GROUP_MEMBER_PATH = "api/v1/groups/members/%2";
@ -906,18 +904,18 @@ void DomainGatekeeper::getGroupMemberships(const QString& username) {
} }
QString extractUsernameFromGroupMembershipsReply(QNetworkReply& requestReply) { QString extractUsernameFromGroupMembershipsReply(QNetworkReply* requestReply) {
// extract the username from the request url // extract the username from the request url
QString username; QString username;
const QString GROUP_MEMBERSHIPS_URL_REGEX_STRING = "api\\/v1\\/groups\\/members\\/([A-Za-z0-9_\\.]+)"; const QString GROUP_MEMBERSHIPS_URL_REGEX_STRING = "api\\/v1\\/groups\\/members\\/([A-Za-z0-9_\\.]+)";
QRegExp usernameRegex(GROUP_MEMBERSHIPS_URL_REGEX_STRING); QRegExp usernameRegex(GROUP_MEMBERSHIPS_URL_REGEX_STRING);
if (usernameRegex.indexIn(requestReply.url().toString()) != -1) { if (usernameRegex.indexIn(requestReply->url().toString()) != -1) {
username = usernameRegex.cap(1); username = usernameRegex.cap(1);
} }
return username.toLower(); return username.toLower();
} }
void DomainGatekeeper::getIsGroupMemberJSONCallback(QNetworkReply& requestReply) { void DomainGatekeeper::getIsGroupMemberJSONCallback(QNetworkReply* requestReply) {
// { // {
// "data":{ // "data":{
// "username":"sethalves", // "username":"sethalves",
@ -934,7 +932,7 @@ void DomainGatekeeper::getIsGroupMemberJSONCallback(QNetworkReply& requestReply)
// "status":"success" // "status":"success"
// } // }
QJsonObject jsonObject = QJsonDocument::fromJson(requestReply.readAll()).object(); QJsonObject jsonObject = QJsonDocument::fromJson(requestReply->readAll()).object();
if (jsonObject["status"].toString() == "success") { if (jsonObject["status"].toString() == "success") {
QJsonObject data = jsonObject["data"].toObject(); QJsonObject data = jsonObject["data"].toObject();
QJsonObject groups = data["groups"].toObject(); QJsonObject groups = data["groups"].toObject();
@ -953,16 +951,15 @@ void DomainGatekeeper::getIsGroupMemberJSONCallback(QNetworkReply& requestReply)
_inFlightGroupMembershipsRequests.remove(extractUsernameFromGroupMembershipsReply(requestReply)); _inFlightGroupMembershipsRequests.remove(extractUsernameFromGroupMembershipsReply(requestReply));
} }
void DomainGatekeeper::getIsGroupMemberErrorCallback(QNetworkReply& requestReply) { void DomainGatekeeper::getIsGroupMemberErrorCallback(QNetworkReply* requestReply) {
qDebug() << "getIsGroupMember api call failed:" << requestReply.error(); qDebug() << "getIsGroupMember api call failed:" << requestReply->error();
_inFlightGroupMembershipsRequests.remove(extractUsernameFromGroupMembershipsReply(requestReply)); _inFlightGroupMembershipsRequests.remove(extractUsernameFromGroupMembershipsReply(requestReply));
} }
void DomainGatekeeper::getDomainOwnerFriendsList() { void DomainGatekeeper::getDomainOwnerFriendsList() {
JSONCallbackParameters callbackParams; JSONCallbackParameters callbackParams;
callbackParams.jsonCallbackReceiver = this; callbackParams.callbackReceiver = this;
callbackParams.jsonCallbackMethod = "getDomainOwnerFriendsListJSONCallback"; callbackParams.jsonCallbackMethod = "getDomainOwnerFriendsListJSONCallback";
callbackParams.errorCallbackReceiver = this;
callbackParams.errorCallbackMethod = "getDomainOwnerFriendsListErrorCallback"; callbackParams.errorCallbackMethod = "getDomainOwnerFriendsListErrorCallback";
const QString GET_FRIENDS_LIST_PATH = "api/v1/user/friends"; const QString GET_FRIENDS_LIST_PATH = "api/v1/user/friends";
@ -974,7 +971,7 @@ void DomainGatekeeper::getDomainOwnerFriendsList() {
} }
void DomainGatekeeper::getDomainOwnerFriendsListJSONCallback(QNetworkReply& requestReply) { void DomainGatekeeper::getDomainOwnerFriendsListJSONCallback(QNetworkReply* requestReply) {
// { // {
// status: "success", // status: "success",
// data: { // data: {
@ -991,7 +988,7 @@ void DomainGatekeeper::getDomainOwnerFriendsListJSONCallback(QNetworkReply& requ
// ] // ]
// } // }
// } // }
QJsonObject jsonObject = QJsonDocument::fromJson(requestReply.readAll()).object(); QJsonObject jsonObject = QJsonDocument::fromJson(requestReply->readAll()).object();
if (jsonObject["status"].toString() == "success") { if (jsonObject["status"].toString() == "success") {
_domainOwnerFriends.clear(); _domainOwnerFriends.clear();
QJsonArray friends = jsonObject["data"].toObject()["friends"].toArray(); QJsonArray friends = jsonObject["data"].toObject()["friends"].toArray();
@ -1003,8 +1000,8 @@ void DomainGatekeeper::getDomainOwnerFriendsListJSONCallback(QNetworkReply& requ
} }
} }
void DomainGatekeeper::getDomainOwnerFriendsListErrorCallback(QNetworkReply& requestReply) { void DomainGatekeeper::getDomainOwnerFriendsListErrorCallback(QNetworkReply* requestReply) {
qDebug() << "getDomainOwnerFriendsList api call failed:" << requestReply.error(); qDebug() << "getDomainOwnerFriendsList api call failed:" << requestReply->error();
} }
void DomainGatekeeper::refreshGroupsCache() { void DomainGatekeeper::refreshGroupsCache() {

View file

@ -51,14 +51,14 @@ public slots:
void processICEPingReplyPacket(QSharedPointer<ReceivedMessage> message); void processICEPingReplyPacket(QSharedPointer<ReceivedMessage> message);
void processICEPeerInformationPacket(QSharedPointer<ReceivedMessage> message); void processICEPeerInformationPacket(QSharedPointer<ReceivedMessage> message);
void publicKeyJSONCallback(QNetworkReply& requestReply); void publicKeyJSONCallback(QNetworkReply* requestReply);
void publicKeyJSONErrorCallback(QNetworkReply& requestReply); void publicKeyJSONErrorCallback(QNetworkReply* requestReply);
void getIsGroupMemberJSONCallback(QNetworkReply& requestReply); void getIsGroupMemberJSONCallback(QNetworkReply* requestReply);
void getIsGroupMemberErrorCallback(QNetworkReply& requestReply); void getIsGroupMemberErrorCallback(QNetworkReply* requestReply);
void getDomainOwnerFriendsListJSONCallback(QNetworkReply& requestReply); void getDomainOwnerFriendsListJSONCallback(QNetworkReply* requestReply);
void getDomainOwnerFriendsListErrorCallback(QNetworkReply& requestReply); void getDomainOwnerFriendsListErrorCallback(QNetworkReply* requestReply);
void refreshGroupsCache(); void refreshGroupsCache();

View file

@ -514,13 +514,13 @@ void DomainServer::getTemporaryName(bool force) {
// request a temporary name from the metaverse // request a temporary name from the metaverse
auto accountManager = DependencyManager::get<AccountManager>(); auto accountManager = DependencyManager::get<AccountManager>();
JSONCallbackParameters callbackParameters { this, "handleTempDomainSuccess", this, "handleTempDomainError" }; JSONCallbackParameters callbackParameters { this, "handleTempDomainSuccess", "handleTempDomainError" };
accountManager->sendRequest("/api/v1/domains/temporary", AccountManagerAuth::None, accountManager->sendRequest("/api/v1/domains/temporary", AccountManagerAuth::None,
QNetworkAccessManager::PostOperation, callbackParameters); QNetworkAccessManager::PostOperation, callbackParameters);
} }
void DomainServer::handleTempDomainSuccess(QNetworkReply& requestReply) { void DomainServer::handleTempDomainSuccess(QNetworkReply* requestReply) {
QJsonObject jsonObject = QJsonDocument::fromJson(requestReply.readAll()).object(); QJsonObject jsonObject = QJsonDocument::fromJson(requestReply->readAll()).object();
// grab the information for the new domain // grab the information for the new domain
static const QString DATA_KEY = "data"; static const QString DATA_KEY = "data";
@ -565,7 +565,7 @@ void DomainServer::handleTempDomainSuccess(QNetworkReply& requestReply) {
} }
} }
void DomainServer::handleTempDomainError(QNetworkReply& requestReply) { void DomainServer::handleTempDomainError(QNetworkReply* requestReply) {
qWarning() << "A temporary name was requested but there was an error creating one. Please try again via domain-server relaunch" qWarning() << "A temporary name was requested but there was an error creating one. Please try again via domain-server relaunch"
<< "or from the domain-server settings."; << "or from the domain-server settings.";
} }
@ -1345,7 +1345,7 @@ void DomainServer::sendPendingTransactionsToServer() {
JSONCallbackParameters transactionCallbackParams; JSONCallbackParameters transactionCallbackParams;
transactionCallbackParams.jsonCallbackReceiver = this; transactionCallbackParams.callbackReceiver = this;
transactionCallbackParams.jsonCallbackMethod = "transactionJSONCallback"; transactionCallbackParams.jsonCallbackMethod = "transactionJSONCallback";
while (i != _pendingAssignmentCredits.end()) { while (i != _pendingAssignmentCredits.end()) {
@ -1449,11 +1449,11 @@ void DomainServer::sendHeartbeatToMetaverse(const QString& networkAddress) {
DependencyManager::get<AccountManager>()->sendRequest(DOMAIN_UPDATE.arg(uuidStringWithoutCurlyBraces(getID())), DependencyManager::get<AccountManager>()->sendRequest(DOMAIN_UPDATE.arg(uuidStringWithoutCurlyBraces(getID())),
AccountManagerAuth::Optional, AccountManagerAuth::Optional,
QNetworkAccessManager::PutOperation, QNetworkAccessManager::PutOperation,
JSONCallbackParameters(nullptr, QString(), this, "handleMetaverseHeartbeatError"), JSONCallbackParameters(this, QString(), "handleMetaverseHeartbeatError"),
domainUpdateJSON.toUtf8()); domainUpdateJSON.toUtf8());
} }
void DomainServer::handleMetaverseHeartbeatError(QNetworkReply& requestReply) { void DomainServer::handleMetaverseHeartbeatError(QNetworkReply* requestReply) {
if (!_metaverseHeartbeatTimer) { if (!_metaverseHeartbeatTimer) {
// avoid rehandling errors from the same issue // avoid rehandling errors from the same issue
return; return;
@ -1462,13 +1462,13 @@ void DomainServer::handleMetaverseHeartbeatError(QNetworkReply& requestReply) {
// only attempt to grab a new temporary name if we're already a temporary domain server // only attempt to grab a new temporary name if we're already a temporary domain server
if (_type == MetaverseTemporaryDomain) { if (_type == MetaverseTemporaryDomain) {
// check if we need to force a new temporary domain name // check if we need to force a new temporary domain name
switch (requestReply.error()) { switch (requestReply->error()) {
// if we have a temporary domain with a bad token, we get a 401 // if we have a temporary domain with a bad token, we get a 401
case QNetworkReply::NetworkError::AuthenticationRequiredError: { case QNetworkReply::NetworkError::AuthenticationRequiredError: {
static const QString DATA_KEY = "data"; static const QString DATA_KEY = "data";
static const QString TOKEN_KEY = "api_key"; static const QString TOKEN_KEY = "api_key";
QJsonObject jsonObject = QJsonDocument::fromJson(requestReply.readAll()).object(); QJsonObject jsonObject = QJsonDocument::fromJson(requestReply->readAll()).object();
auto tokenFailure = jsonObject[DATA_KEY].toObject()[TOKEN_KEY]; auto tokenFailure = jsonObject[DATA_KEY].toObject()[TOKEN_KEY];
if (!tokenFailure.isNull()) { if (!tokenFailure.isNull()) {
@ -1531,9 +1531,8 @@ void DomainServer::sendICEServerAddressToMetaverseAPI() {
// make sure we hear about failure so we can retry // make sure we hear about failure so we can retry
JSONCallbackParameters callbackParameters; JSONCallbackParameters callbackParameters;
callbackParameters.errorCallbackReceiver = this; callbackParameters.callbackReceiver = this;
callbackParameters.errorCallbackMethod = "handleFailedICEServerAddressUpdate"; callbackParameters.errorCallbackMethod = "handleFailedICEServerAddressUpdate";
callbackParameters.jsonCallbackReceiver = this;
callbackParameters.jsonCallbackMethod = "handleSuccessfulICEServerAddressUpdate"; callbackParameters.jsonCallbackMethod = "handleSuccessfulICEServerAddressUpdate";
static bool printedIceServerMessage = false; static bool printedIceServerMessage = false;
@ -1552,7 +1551,7 @@ void DomainServer::sendICEServerAddressToMetaverseAPI() {
domainUpdateJSON.toUtf8()); domainUpdateJSON.toUtf8());
} }
void DomainServer::handleSuccessfulICEServerAddressUpdate(QNetworkReply& requestReply) { void DomainServer::handleSuccessfulICEServerAddressUpdate(QNetworkReply* requestReply) {
_sendICEServerAddressToMetaverseAPIInProgress = false; _sendICEServerAddressToMetaverseAPIInProgress = false;
if (_sendICEServerAddressToMetaverseAPIRedo) { if (_sendICEServerAddressToMetaverseAPIRedo) {
qDebug() << "ice-server address updated with metaverse, but has since changed. redoing update..."; qDebug() << "ice-server address updated with metaverse, but has since changed. redoing update...";
@ -1563,7 +1562,7 @@ void DomainServer::handleSuccessfulICEServerAddressUpdate(QNetworkReply& request
} }
} }
void DomainServer::handleFailedICEServerAddressUpdate(QNetworkReply& requestReply) { void DomainServer::handleFailedICEServerAddressUpdate(QNetworkReply* requestReply) {
_sendICEServerAddressToMetaverseAPIInProgress = false; _sendICEServerAddressToMetaverseAPIInProgress = false;
if (_sendICEServerAddressToMetaverseAPIRedo) { if (_sendICEServerAddressToMetaverseAPIRedo) {
// if we have new data, retry right away, even though the previous attempt didn't go well. // if we have new data, retry right away, even though the previous attempt didn't go well.
@ -1573,7 +1572,7 @@ void DomainServer::handleFailedICEServerAddressUpdate(QNetworkReply& requestRepl
const int ICE_SERVER_UPDATE_RETRY_MS = 2 * 1000; const int ICE_SERVER_UPDATE_RETRY_MS = 2 * 1000;
qWarning() << "Failed to update ice-server address with High Fidelity Metaverse - error was" qWarning() << "Failed to update ice-server address with High Fidelity Metaverse - error was"
<< requestReply.errorString(); << requestReply->errorString();
qWarning() << "\tRe-attempting in" << ICE_SERVER_UPDATE_RETRY_MS / 1000 << "seconds"; qWarning() << "\tRe-attempting in" << ICE_SERVER_UPDATE_RETRY_MS / 1000 << "seconds";
QTimer::singleShot(ICE_SERVER_UPDATE_RETRY_MS, this, SLOT(sendICEServerAddressToMetaverseAPI())); QTimer::singleShot(ICE_SERVER_UPDATE_RETRY_MS, this, SLOT(sendICEServerAddressToMetaverseAPI()));

View file

@ -108,10 +108,10 @@ private slots:
void sendHeartbeatToIceServer(); void sendHeartbeatToIceServer();
void handleConnectedNode(SharedNodePointer newNode); void handleConnectedNode(SharedNodePointer newNode);
void handleTempDomainSuccess(QNetworkReply& requestReply); void handleTempDomainSuccess(QNetworkReply* requestReply);
void handleTempDomainError(QNetworkReply& requestReply); void handleTempDomainError(QNetworkReply* requestReply);
void handleMetaverseHeartbeatError(QNetworkReply& requestReply); void handleMetaverseHeartbeatError(QNetworkReply* requestReply);
void queuedQuit(QString quitMessage, int exitCode); void queuedQuit(QString quitMessage, int exitCode);
@ -121,8 +121,8 @@ private slots:
void handleICEHostInfo(const QHostInfo& hostInfo); void handleICEHostInfo(const QHostInfo& hostInfo);
void sendICEServerAddressToMetaverseAPI(); void sendICEServerAddressToMetaverseAPI();
void handleSuccessfulICEServerAddressUpdate(QNetworkReply& requestReply); void handleSuccessfulICEServerAddressUpdate(QNetworkReply* requestReply);
void handleFailedICEServerAddressUpdate(QNetworkReply& requestReply); void handleFailedICEServerAddressUpdate(QNetworkReply* requestReply);
void updateReplicatedNodes(); void updateReplicatedNodes();
void updateDownstreamNodes(); void updateDownstreamNodes();

View file

@ -1815,9 +1815,8 @@ void DomainServerSettingsManager::apiRefreshGroupInformation() {
void DomainServerSettingsManager::apiGetGroupID(const QString& groupName) { void DomainServerSettingsManager::apiGetGroupID(const QString& groupName) {
JSONCallbackParameters callbackParams; JSONCallbackParameters callbackParams;
callbackParams.jsonCallbackReceiver = this; callbackParams.callbackReceiver = this;
callbackParams.jsonCallbackMethod = "apiGetGroupIDJSONCallback"; callbackParams.jsonCallbackMethod = "apiGetGroupIDJSONCallback";
callbackParams.errorCallbackReceiver = this;
callbackParams.errorCallbackMethod = "apiGetGroupIDErrorCallback"; callbackParams.errorCallbackMethod = "apiGetGroupIDErrorCallback";
const QString GET_GROUP_ID_PATH = "api/v1/groups/names/%1"; const QString GET_GROUP_ID_PATH = "api/v1/groups/names/%1";
@ -1826,7 +1825,7 @@ void DomainServerSettingsManager::apiGetGroupID(const QString& groupName) {
QNetworkAccessManager::GetOperation, callbackParams); QNetworkAccessManager::GetOperation, callbackParams);
} }
void DomainServerSettingsManager::apiGetGroupIDJSONCallback(QNetworkReply& requestReply) { void DomainServerSettingsManager::apiGetGroupIDJSONCallback(QNetworkReply* requestReply) {
// { // {
// "data":{ // "data":{
// "groups":[{ // "groups":[{
@ -1857,7 +1856,7 @@ void DomainServerSettingsManager::apiGetGroupIDJSONCallback(QNetworkReply& reque
// }, // },
// "status":"success" // "status":"success"
// } // }
QJsonObject jsonObject = QJsonDocument::fromJson(requestReply.readAll()).object(); QJsonObject jsonObject = QJsonDocument::fromJson(requestReply->readAll()).object();
if (jsonObject["status"].toString() == "success") { if (jsonObject["status"].toString() == "success") {
QJsonArray groups = jsonObject["data"].toObject()["groups"].toArray(); QJsonArray groups = jsonObject["data"].toObject()["groups"].toArray();
for (int i = 0; i < groups.size(); i++) { for (int i = 0; i < groups.size(); i++) {
@ -1876,15 +1875,14 @@ void DomainServerSettingsManager::apiGetGroupIDJSONCallback(QNetworkReply& reque
} }
} }
void DomainServerSettingsManager::apiGetGroupIDErrorCallback(QNetworkReply& requestReply) { void DomainServerSettingsManager::apiGetGroupIDErrorCallback(QNetworkReply* requestReply) {
qDebug() << "******************** getGroupID api call failed:" << requestReply.error(); qDebug() << "******************** getGroupID api call failed:" << requestReply->error();
} }
void DomainServerSettingsManager::apiGetGroupRanks(const QUuid& groupID) { void DomainServerSettingsManager::apiGetGroupRanks(const QUuid& groupID) {
JSONCallbackParameters callbackParams; JSONCallbackParameters callbackParams;
callbackParams.jsonCallbackReceiver = this; callbackParams.callbackReceiver = this;
callbackParams.jsonCallbackMethod = "apiGetGroupRanksJSONCallback"; callbackParams.jsonCallbackMethod = "apiGetGroupRanksJSONCallback";
callbackParams.errorCallbackReceiver = this;
callbackParams.errorCallbackMethod = "apiGetGroupRanksErrorCallback"; callbackParams.errorCallbackMethod = "apiGetGroupRanksErrorCallback";
const QString GET_GROUP_RANKS_PATH = "api/v1/groups/%1/ranks"; const QString GET_GROUP_RANKS_PATH = "api/v1/groups/%1/ranks";
@ -1893,7 +1891,7 @@ void DomainServerSettingsManager::apiGetGroupRanks(const QUuid& groupID) {
QNetworkAccessManager::GetOperation, callbackParams); QNetworkAccessManager::GetOperation, callbackParams);
} }
void DomainServerSettingsManager::apiGetGroupRanksJSONCallback(QNetworkReply& requestReply) { void DomainServerSettingsManager::apiGetGroupRanksJSONCallback(QNetworkReply* requestReply) {
// { // {
// "data":{ // "data":{
// "groups":{ // "groups":{
@ -1926,7 +1924,7 @@ void DomainServerSettingsManager::apiGetGroupRanksJSONCallback(QNetworkReply& re
// } // }
bool changed = false; bool changed = false;
QJsonObject jsonObject = QJsonDocument::fromJson(requestReply.readAll()).object(); QJsonObject jsonObject = QJsonDocument::fromJson(requestReply->readAll()).object();
if (jsonObject["status"].toString() == "success") { if (jsonObject["status"].toString() == "success") {
QJsonObject groups = jsonObject["data"].toObject()["groups"].toObject(); QJsonObject groups = jsonObject["data"].toObject()["groups"].toObject();
@ -1972,8 +1970,8 @@ void DomainServerSettingsManager::apiGetGroupRanksJSONCallback(QNetworkReply& re
} }
} }
void DomainServerSettingsManager::apiGetGroupRanksErrorCallback(QNetworkReply& requestReply) { void DomainServerSettingsManager::apiGetGroupRanksErrorCallback(QNetworkReply* requestReply) {
qDebug() << "******************** getGroupRanks api call failed:" << requestReply.error(); qDebug() << "******************** getGroupRanks api call failed:" << requestReply->error();
} }
void DomainServerSettingsManager::recordGroupMembership(const QString& name, const QUuid groupID, QUuid rankID) { void DomainServerSettingsManager::recordGroupMembership(const QString& name, const QUuid groupID, QUuid rankID) {

View file

@ -133,10 +133,10 @@ signals:
void settingsUpdated(); void settingsUpdated();
public slots: public slots:
void apiGetGroupIDJSONCallback(QNetworkReply& requestReply); void apiGetGroupIDJSONCallback(QNetworkReply* requestReply);
void apiGetGroupIDErrorCallback(QNetworkReply& requestReply); void apiGetGroupIDErrorCallback(QNetworkReply* requestReply);
void apiGetGroupRanksJSONCallback(QNetworkReply& requestReply); void apiGetGroupRanksJSONCallback(QNetworkReply* requestReply);
void apiGetGroupRanksErrorCallback(QNetworkReply& requestReply); void apiGetGroupRanksErrorCallback(QNetworkReply* requestReply);
private slots: private slots:
void processSettingsRequestPacket(QSharedPointer<ReceivedMessage> message); void processSettingsRequestPacket(QSharedPointer<ReceivedMessage> message);

View file

@ -1081,6 +1081,11 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
auto nodeList = DependencyManager::get<NodeList>(); auto nodeList = DependencyManager::get<NodeList>();
nodeList->startThread(); nodeList->startThread();
// move the AddressManager to the NodeList thread so that domain resets due to domain changes always occur
// before we tell MyAvatar to go to a new location in the new domain
auto addressManager = DependencyManager::get<AddressManager>();
addressManager->moveToThread(nodeList->thread());
const char** constArgv = const_cast<const char**>(argv); const char** constArgv = const_cast<const char**>(argv);
if (cmdOptionExists(argc, constArgv, "--disableWatchdog")) { if (cmdOptionExists(argc, constArgv, "--disableWatchdog")) {
DISABLE_WATCHDOG = true; DISABLE_WATCHDOG = true;
@ -1231,8 +1236,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
accountManager->setIsAgent(true); accountManager->setIsAgent(true);
accountManager->setAuthURL(NetworkingConstants::METAVERSE_SERVER_URL()); accountManager->setAuthURL(NetworkingConstants::METAVERSE_SERVER_URL());
auto addressManager = DependencyManager::get<AddressManager>();
// use our MyAvatar position and quat for address manager path // use our MyAvatar position and quat for address manager path
addressManager->setPositionGetter([this]{ return getMyAvatar()->getWorldPosition(); }); addressManager->setPositionGetter([this]{ return getMyAvatar()->getWorldPosition(); });
addressManager->setOrientationGetter([this]{ return getMyAvatar()->getWorldOrientation(); }); addressManager->setOrientationGetter([this]{ return getMyAvatar()->getWorldOrientation(); });

View file

@ -97,7 +97,7 @@ void DiscoverabilityManager::updateLocation() {
locationObject.insert(AVAILABILITY_KEY_IN_LOCATION, findableByString(static_cast<Discoverability::Mode>(_mode.get()))); locationObject.insert(AVAILABILITY_KEY_IN_LOCATION, findableByString(static_cast<Discoverability::Mode>(_mode.get())));
JSONCallbackParameters callbackParameters; JSONCallbackParameters callbackParameters;
callbackParameters.jsonCallbackReceiver = this; callbackParameters.callbackReceiver = this;
callbackParameters.jsonCallbackMethod = "handleHeartbeatResponse"; callbackParameters.jsonCallbackMethod = "handleHeartbeatResponse";
// figure out if we'll send a fresh location or just a simple heartbeat // figure out if we'll send a fresh location or just a simple heartbeat
@ -121,7 +121,7 @@ void DiscoverabilityManager::updateLocation() {
// we still send a heartbeat to the metaverse server for stats collection // we still send a heartbeat to the metaverse server for stats collection
JSONCallbackParameters callbackParameters; JSONCallbackParameters callbackParameters;
callbackParameters.jsonCallbackReceiver = this; callbackParameters.callbackReceiver = this;
callbackParameters.jsonCallbackMethod = "handleHeartbeatResponse"; callbackParameters.jsonCallbackMethod = "handleHeartbeatResponse";
accountManager->sendRequest(API_USER_HEARTBEAT_PATH, AccountManagerAuth::Optional, accountManager->sendRequest(API_USER_HEARTBEAT_PATH, AccountManagerAuth::Optional,
@ -136,7 +136,7 @@ void DiscoverabilityManager::updateLocation() {
setCrashAnnotation("address", currentAddress.toString().toStdString()); setCrashAnnotation("address", currentAddress.toString().toStdString());
} }
void DiscoverabilityManager::handleHeartbeatResponse(QNetworkReply& requestReply) { void DiscoverabilityManager::handleHeartbeatResponse(QNetworkReply* requestReply) {
auto dataObject = AccountManager::dataObjectFromResponse(requestReply); auto dataObject = AccountManager::dataObjectFromResponse(requestReply);
if (!dataObject.isEmpty()) { if (!dataObject.isEmpty()) {

View file

@ -51,7 +51,7 @@ public:
static QString findableByString(Discoverability::Mode discoverabilityMode); static QString findableByString(Discoverability::Mode discoverabilityMode);
private slots: private slots:
void handleHeartbeatResponse(QNetworkReply& requestReply); void handleHeartbeatResponse(QNetworkReply* requestReply);
private: private:
DiscoverabilityManager(); DiscoverabilityManager();

View file

@ -283,7 +283,7 @@ Menu::Menu() {
MenuWrapper* settingsMenu = addMenu("Settings"); MenuWrapper* settingsMenu = addMenu("Settings");
// Settings > General... // Settings > General...
action = addActionToQMenuAndActionHash(settingsMenu, MenuOption::Preferences, Qt::CTRL | Qt::Key_G, nullptr, nullptr, QAction::PreferencesRole); action = addActionToQMenuAndActionHash(settingsMenu, MenuOption::Preferences, Qt::CTRL | Qt::Key_G, nullptr, nullptr);
connect(action, &QAction::triggered, [] { connect(action, &QAction::triggered, [] {
qApp->showDialog(QString("hifi/dialogs/GeneralPreferencesDialog.qml"), qApp->showDialog(QString("hifi/dialogs/GeneralPreferencesDialog.qml"),
QString("hifi/tablet/TabletGeneralPreferences.qml"), "GeneralPreferencesDialog"); QString("hifi/tablet/TabletGeneralPreferences.qml"), "GeneralPreferencesDialog");

View file

@ -714,7 +714,8 @@ void MyAvatar::simulate(float deltaTime) {
entityTree->recurseTreeWithOperator(&moveOperator); entityTree->recurseTreeWithOperator(&moveOperator);
} }
}); });
_characterController.setFlyingAllowed(zoneAllowsFlying && _enableFlying); bool isPhysicsEnabled = qApp->isPhysicsEnabled();
_characterController.setFlyingAllowed(zoneAllowsFlying && (_enableFlying || !isPhysicsEnabled));
_characterController.setCollisionlessAllowed(collisionlessAllowed); _characterController.setCollisionlessAllowed(collisionlessAllowed);
} }
@ -1099,6 +1100,7 @@ void MyAvatar::saveData() {
settings.setValue("useSnapTurn", _useSnapTurn); settings.setValue("useSnapTurn", _useSnapTurn);
settings.setValue("clearOverlayWhenMoving", _clearOverlayWhenMoving); settings.setValue("clearOverlayWhenMoving", _clearOverlayWhenMoving);
settings.setValue("userHeight", getUserHeight()); settings.setValue("userHeight", getUserHeight());
settings.setValue("enabledFlying", getFlyingEnabled());
settings.endGroup(); settings.endGroup();
} }
@ -1248,7 +1250,7 @@ void MyAvatar::loadData() {
settings.remove("avatarEntityData"); settings.remove("avatarEntityData");
} }
setAvatarEntityDataChanged(true); setAvatarEntityDataChanged(true);
setFlyingEnabled(settings.value("enabledFlying").toBool());
setDisplayName(settings.value("displayName").toString()); setDisplayName(settings.value("displayName").toString());
setCollisionSoundURL(settings.value("collisionSoundURL", DEFAULT_AVATAR_COLLISION_SOUND_URL).toString()); setCollisionSoundURL(settings.value("collisionSoundURL", DEFAULT_AVATAR_COLLISION_SOUND_URL).toString());
setSnapTurn(settings.value("useSnapTurn", _useSnapTurn).toBool()); setSnapTurn(settings.value("useSnapTurn", _useSnapTurn).toBool());

View file

@ -1434,7 +1434,7 @@ private:
std::array<float, MAX_DRIVE_KEYS> _driveKeys; std::array<float, MAX_DRIVE_KEYS> _driveKeys;
std::bitset<MAX_DRIVE_KEYS> _disabledDriveKeys; std::bitset<MAX_DRIVE_KEYS> _disabledDriveKeys;
bool _enableFlying { true }; bool _enableFlying { false };
bool _wasPushing { false }; bool _wasPushing { false };
bool _isPushing { false }; bool _isPushing { false };
bool _isBeingPushed { false }; bool _isBeingPushed { false };

View file

@ -28,15 +28,15 @@
// account synthesizes a result {status: 'success', data: {keyStatus: "preexisting"|"conflicting"|"ok"}} // account synthesizes a result {status: 'success', data: {keyStatus: "preexisting"|"conflicting"|"ok"}}
QJsonObject Ledger::apiResponse(const QString& label, QNetworkReply& reply) { QJsonObject Ledger::apiResponse(const QString& label, QNetworkReply* reply) {
QByteArray response = reply.readAll(); QByteArray response = reply->readAll();
QJsonObject data = QJsonDocument::fromJson(response).object(); QJsonObject data = QJsonDocument::fromJson(response).object();
qInfo(commerce) << label << "response" << QJsonDocument(data).toJson(QJsonDocument::Compact); qInfo(commerce) << label << "response" << QJsonDocument(data).toJson(QJsonDocument::Compact);
return data; return data;
} }
// Non-200 responses are not json: // Non-200 responses are not json:
QJsonObject Ledger::failResponse(const QString& label, QNetworkReply& reply) { QJsonObject Ledger::failResponse(const QString& label, QNetworkReply* reply) {
QString response = reply.readAll(); QString response = reply->readAll();
qWarning(commerce) << "FAILED" << label << response; qWarning(commerce) << "FAILED" << label << response;
// tempResult will be NULL if the response isn't valid JSON. // tempResult will be NULL if the response isn't valid JSON.
@ -52,8 +52,8 @@ QJsonObject Ledger::failResponse(const QString& label, QNetworkReply& reply) {
return tempResult.object(); return tempResult.object();
} }
} }
#define ApiHandler(NAME) void Ledger::NAME##Success(QNetworkReply& reply) { emit NAME##Result(apiResponse(#NAME, reply)); } #define ApiHandler(NAME) void Ledger::NAME##Success(QNetworkReply* reply) { emit NAME##Result(apiResponse(#NAME, reply)); }
#define FailHandler(NAME) void Ledger::NAME##Failure(QNetworkReply& reply) { emit NAME##Result(failResponse(#NAME, reply)); } #define FailHandler(NAME) void Ledger::NAME##Failure(QNetworkReply* reply) { emit NAME##Result(failResponse(#NAME, reply)); }
#define Handler(NAME) ApiHandler(NAME) FailHandler(NAME) #define Handler(NAME) ApiHandler(NAME) FailHandler(NAME)
Handler(buy) Handler(buy)
Handler(receiveAt) Handler(receiveAt)
@ -68,7 +68,7 @@ Handler(updateItem)
void Ledger::send(const QString& endpoint, const QString& success, const QString& fail, QNetworkAccessManager::Operation method, AccountManagerAuth::Type authType, QJsonObject request) { void Ledger::send(const QString& endpoint, const QString& success, const QString& fail, QNetworkAccessManager::Operation method, AccountManagerAuth::Type authType, QJsonObject request) {
auto accountManager = DependencyManager::get<AccountManager>(); auto accountManager = DependencyManager::get<AccountManager>();
const QString URL = "/api/v1/commerce/"; const QString URL = "/api/v1/commerce/";
JSONCallbackParameters callbackParams(this, success, this, fail); JSONCallbackParameters callbackParams(this, success, fail);
qCInfo(commerce) << "Sending" << endpoint << QJsonDocument(request).toJson(QJsonDocument::Compact); qCInfo(commerce) << "Sending" << endpoint << QJsonDocument(request).toJson(QJsonDocument::Compact);
accountManager->sendRequest(URL + endpoint, accountManager->sendRequest(URL + endpoint,
authType, authType,
@ -223,12 +223,12 @@ QString transactionString(const QJsonObject& valueObject) {
} }
static const QString MARKETPLACE_ITEMS_BASE_URL = NetworkingConstants::METAVERSE_SERVER_URL().toString() + "/marketplace/items/"; static const QString MARKETPLACE_ITEMS_BASE_URL = NetworkingConstants::METAVERSE_SERVER_URL().toString() + "/marketplace/items/";
void Ledger::historySuccess(QNetworkReply& reply) { void Ledger::historySuccess(QNetworkReply* reply) {
// here we send a historyResult with some extra stuff in it // here we send a historyResult with some extra stuff in it
// Namely, the styled text we'd like to show. The issue is the // Namely, the styled text we'd like to show. The issue is the
// QML cannot do that easily since it doesn't know what the wallet // QML cannot do that easily since it doesn't know what the wallet
// public key(s) are. Let's keep it that way // public key(s) are. Let's keep it that way
QByteArray response = reply.readAll(); QByteArray response = reply->readAll();
QJsonObject data = QJsonDocument::fromJson(response).object(); QJsonObject data = QJsonDocument::fromJson(response).object();
qInfo(commerce) << "history" << "response" << QJsonDocument(data).toJson(QJsonDocument::Compact); qInfo(commerce) << "history" << "response" << QJsonDocument(data).toJson(QJsonDocument::Compact);
@ -262,7 +262,7 @@ void Ledger::historySuccess(QNetworkReply& reply) {
emit historyResult(newData); emit historyResult(newData);
} }
void Ledger::historyFailure(QNetworkReply& reply) { void Ledger::historyFailure(QNetworkReply* reply) {
failResponse("history", reply); failResponse("history", reply);
} }
@ -273,10 +273,10 @@ void Ledger::history(const QStringList& keys, const int& pageNumber, const int&
keysQuery("history", "historySuccess", "historyFailure", params); keysQuery("history", "historySuccess", "historyFailure", params);
} }
void Ledger::accountSuccess(QNetworkReply& reply) { void Ledger::accountSuccess(QNetworkReply* reply) {
// lets set the appropriate stuff in the wallet now // lets set the appropriate stuff in the wallet now
auto wallet = DependencyManager::get<Wallet>(); auto wallet = DependencyManager::get<Wallet>();
QByteArray response = reply.readAll(); QByteArray response = reply->readAll();
QJsonObject data = QJsonDocument::fromJson(response).object()["data"].toObject(); QJsonObject data = QJsonDocument::fromJson(response).object()["data"].toObject();
auto salt = QByteArray::fromBase64(data["salt"].toString().toUtf8()); auto salt = QByteArray::fromBase64(data["salt"].toString().toUtf8());
@ -312,7 +312,7 @@ void Ledger::accountSuccess(QNetworkReply& reply) {
emit accountResult(responseData); emit accountResult(responseData);
} }
void Ledger::accountFailure(QNetworkReply& reply) { void Ledger::accountFailure(QNetworkReply* reply) {
failResponse("account", reply); failResponse("account", reply);
} }
void Ledger::account() { void Ledger::account() {
@ -320,8 +320,8 @@ void Ledger::account() {
} }
// The api/failResponse is called just for the side effect of logging. // The api/failResponse is called just for the side effect of logging.
void Ledger::updateLocationSuccess(QNetworkReply& reply) { apiResponse("updateLocation", reply); } void Ledger::updateLocationSuccess(QNetworkReply* reply) { apiResponse("updateLocation", reply); }
void Ledger::updateLocationFailure(QNetworkReply& reply) { failResponse("updateLocation", reply); } void Ledger::updateLocationFailure(QNetworkReply* reply) { failResponse("updateLocation", reply); }
void Ledger::updateLocation(const QString& asset_id, const QString& location, const bool& alsoUpdateSiblings, const bool controlledFailure) { void Ledger::updateLocation(const QString& asset_id, const QString& location, const bool& alsoUpdateSiblings, const bool controlledFailure) {
auto wallet = DependencyManager::get<Wallet>(); auto wallet = DependencyManager::get<Wallet>();
auto walletScriptingInterface = DependencyManager::get<WalletScriptingInterface>(); auto walletScriptingInterface = DependencyManager::get<WalletScriptingInterface>();
@ -349,11 +349,11 @@ void Ledger::updateLocation(const QString& asset_id, const QString& location, co
} }
} }
void Ledger::certificateInfoSuccess(QNetworkReply& reply) { void Ledger::certificateInfoSuccess(QNetworkReply* reply) {
auto wallet = DependencyManager::get<Wallet>(); auto wallet = DependencyManager::get<Wallet>();
auto accountManager = DependencyManager::get<AccountManager>(); auto accountManager = DependencyManager::get<AccountManager>();
QByteArray response = reply.readAll(); QByteArray response = reply->readAll();
QJsonObject replyObject = QJsonDocument::fromJson(response).object(); QJsonObject replyObject = QJsonDocument::fromJson(response).object();
QStringList keys = wallet->listPublicKeys(); QStringList keys = wallet->listPublicKeys();
@ -366,7 +366,7 @@ void Ledger::certificateInfoSuccess(QNetworkReply& reply) {
qInfo(commerce) << "certificateInfo" << "response" << QJsonDocument(replyObject).toJson(QJsonDocument::Compact); qInfo(commerce) << "certificateInfo" << "response" << QJsonDocument(replyObject).toJson(QJsonDocument::Compact);
emit certificateInfoResult(replyObject); emit certificateInfoResult(replyObject);
} }
void Ledger::certificateInfoFailure(QNetworkReply& reply) { void Ledger::certificateInfoFailure(QNetworkReply* reply) {
emit certificateInfoResult(failResponse("certificateInfo", reply)); emit certificateInfoResult(failResponse("certificateInfo", reply));
} }
void Ledger::certificateInfo(const QString& certificateId) { void Ledger::certificateInfo(const QString& certificateId) {

View file

@ -65,36 +65,36 @@ signals:
void updateCertificateStatus(const QString& certID, uint certStatus); void updateCertificateStatus(const QString& certID, uint certStatus);
public slots: public slots:
void buySuccess(QNetworkReply& reply); void buySuccess(QNetworkReply* reply);
void buyFailure(QNetworkReply& reply); void buyFailure(QNetworkReply* reply);
void receiveAtSuccess(QNetworkReply& reply); void receiveAtSuccess(QNetworkReply* reply);
void receiveAtFailure(QNetworkReply& reply); void receiveAtFailure(QNetworkReply* reply);
void balanceSuccess(QNetworkReply& reply); void balanceSuccess(QNetworkReply* reply);
void balanceFailure(QNetworkReply& reply); void balanceFailure(QNetworkReply* reply);
void inventorySuccess(QNetworkReply& reply); void inventorySuccess(QNetworkReply* reply);
void inventoryFailure(QNetworkReply& reply); void inventoryFailure(QNetworkReply* reply);
void historySuccess(QNetworkReply& reply); void historySuccess(QNetworkReply* reply);
void historyFailure(QNetworkReply& reply); void historyFailure(QNetworkReply* reply);
void accountSuccess(QNetworkReply& reply); void accountSuccess(QNetworkReply* reply);
void accountFailure(QNetworkReply& reply); void accountFailure(QNetworkReply* reply);
void updateLocationSuccess(QNetworkReply& reply); void updateLocationSuccess(QNetworkReply* reply);
void updateLocationFailure(QNetworkReply& reply); void updateLocationFailure(QNetworkReply* reply);
void certificateInfoSuccess(QNetworkReply& reply); void certificateInfoSuccess(QNetworkReply* reply);
void certificateInfoFailure(QNetworkReply& reply); void certificateInfoFailure(QNetworkReply* reply);
void transferAssetToNodeSuccess(QNetworkReply& reply); void transferAssetToNodeSuccess(QNetworkReply* reply);
void transferAssetToNodeFailure(QNetworkReply& reply); void transferAssetToNodeFailure(QNetworkReply* reply);
void transferAssetToUsernameSuccess(QNetworkReply& reply); void transferAssetToUsernameSuccess(QNetworkReply* reply);
void transferAssetToUsernameFailure(QNetworkReply& reply); void transferAssetToUsernameFailure(QNetworkReply* reply);
void alreadyOwnedSuccess(QNetworkReply& reply); void alreadyOwnedSuccess(QNetworkReply* reply);
void alreadyOwnedFailure(QNetworkReply& reply); void alreadyOwnedFailure(QNetworkReply* reply);
void availableUpdatesSuccess(QNetworkReply& reply); void availableUpdatesSuccess(QNetworkReply* reply);
void availableUpdatesFailure(QNetworkReply& reply); void availableUpdatesFailure(QNetworkReply* reply);
void updateItemSuccess(QNetworkReply& reply); void updateItemSuccess(QNetworkReply* reply);
void updateItemFailure(QNetworkReply& reply); void updateItemFailure(QNetworkReply* reply);
private: private:
QJsonObject apiResponse(const QString& label, QNetworkReply& reply); QJsonObject apiResponse(const QString& label, QNetworkReply* reply);
QJsonObject failResponse(const QString& label, QNetworkReply& reply); QJsonObject failResponse(const QString& label, QNetworkReply* reply);
void send(const QString& endpoint, const QString& success, const QString& fail, QNetworkAccessManager::Operation method, AccountManagerAuth::Type authType, QJsonObject request); void send(const QString& endpoint, const QString& success, const QString& fail, QNetworkAccessManager::Operation method, AccountManagerAuth::Type authType, QJsonObject request);
void keysQuery(const QString& endpoint, const QString& success, const QString& fail, QJsonObject& extraRequestParams); void keysQuery(const QString& endpoint, const QString& success, const QString& fail, QJsonObject& extraRequestParams);
void keysQuery(const QString& endpoint, const QString& success, const QString& fail); void keysQuery(const QString& endpoint, const QString& success, const QString& fail);

View file

@ -113,9 +113,8 @@ void LoginDialog::linkSteam() {
} }
JSONCallbackParameters callbackParams; JSONCallbackParameters callbackParams;
callbackParams.jsonCallbackReceiver = this; callbackParams.callbackReceiver = this;
callbackParams.jsonCallbackMethod = "linkCompleted"; callbackParams.jsonCallbackMethod = "linkCompleted";
callbackParams.errorCallbackReceiver = this;
callbackParams.errorCallbackMethod = "linkFailed"; callbackParams.errorCallbackMethod = "linkFailed";
const QString LINK_STEAM_PATH = "api/v1/user/steam/link"; const QString LINK_STEAM_PATH = "api/v1/user/steam/link";
@ -141,9 +140,8 @@ void LoginDialog::createAccountFromStream(QString username) {
} }
JSONCallbackParameters callbackParams; JSONCallbackParameters callbackParams;
callbackParams.jsonCallbackReceiver = this; callbackParams.callbackReceiver = this;
callbackParams.jsonCallbackMethod = "createCompleted"; callbackParams.jsonCallbackMethod = "createCompleted";
callbackParams.errorCallbackReceiver = this;
callbackParams.errorCallbackMethod = "createFailed"; callbackParams.errorCallbackMethod = "createFailed";
const QString CREATE_ACCOUNT_FROM_STEAM_PATH = "api/v1/user/steam/create"; const QString CREATE_ACCOUNT_FROM_STEAM_PATH = "api/v1/user/steam/create";
@ -185,28 +183,27 @@ void LoginDialog::openUrl(const QString& url) const {
} }
} }
void LoginDialog::linkCompleted(QNetworkReply& reply) { void LoginDialog::linkCompleted(QNetworkReply* reply) {
emit handleLinkCompleted(); emit handleLinkCompleted();
} }
void LoginDialog::linkFailed(QNetworkReply& reply) { void LoginDialog::linkFailed(QNetworkReply* reply) {
emit handleLinkFailed(reply.errorString()); emit handleLinkFailed(reply->errorString());
} }
void LoginDialog::createCompleted(QNetworkReply& reply) { void LoginDialog::createCompleted(QNetworkReply* reply) {
emit handleCreateCompleted(); emit handleCreateCompleted();
} }
void LoginDialog::createFailed(QNetworkReply& reply) { void LoginDialog::createFailed(QNetworkReply* reply) {
emit handleCreateFailed(reply.errorString()); emit handleCreateFailed(reply->errorString());
} }
void LoginDialog::signup(const QString& email, const QString& username, const QString& password) { void LoginDialog::signup(const QString& email, const QString& username, const QString& password) {
JSONCallbackParameters callbackParams; JSONCallbackParameters callbackParams;
callbackParams.jsonCallbackReceiver = this; callbackParams.callbackReceiver = this;
callbackParams.jsonCallbackMethod = "signupCompleted"; callbackParams.jsonCallbackMethod = "signupCompleted";
callbackParams.errorCallbackReceiver = this;
callbackParams.errorCallbackMethod = "signupFailed"; callbackParams.errorCallbackMethod = "signupFailed";
QJsonObject payload; QJsonObject payload;
@ -228,7 +225,7 @@ void LoginDialog::signup(const QString& email, const QString& username, const QS
QJsonDocument(payload).toJson()); QJsonDocument(payload).toJson());
} }
void LoginDialog::signupCompleted(QNetworkReply& reply) { void LoginDialog::signupCompleted(QNetworkReply* reply) {
emit handleSignupCompleted(); emit handleSignupCompleted();
} }
@ -242,10 +239,10 @@ QString errorStringFromAPIObject(const QJsonValue& apiObject) {
} }
} }
void LoginDialog::signupFailed(QNetworkReply& reply) { void LoginDialog::signupFailed(QNetworkReply* reply) {
// parse the returned JSON to see what the problem was // parse the returned JSON to see what the problem was
auto jsonResponse = QJsonDocument::fromJson(reply.readAll()); auto jsonResponse = QJsonDocument::fromJson(reply->readAll());
static const QString RESPONSE_DATA_KEY = "data"; static const QString RESPONSE_DATA_KEY = "data";

View file

@ -42,14 +42,14 @@ signals:
void handleSignupFailed(QString errorString); void handleSignupFailed(QString errorString);
public slots: public slots:
void linkCompleted(QNetworkReply& reply); void linkCompleted(QNetworkReply* reply);
void linkFailed(QNetworkReply& reply); void linkFailed(QNetworkReply* reply);
void createCompleted(QNetworkReply& reply); void createCompleted(QNetworkReply* reply);
void createFailed(QNetworkReply& reply); void createFailed(QNetworkReply* reply);
void signupCompleted(QNetworkReply& reply); void signupCompleted(QNetworkReply* reply);
void signupFailed(QNetworkReply& reply); void signupFailed(QNetworkReply* reply);
protected slots: protected slots:
Q_INVOKABLE bool isSteamRunning() const; Q_INVOKABLE bool isSteamRunning() const;

View file

@ -493,7 +493,7 @@ void Snapshot::uploadSnapshot(const QString& filename, const QUrl& href) {
multiPart->append(imagePart); multiPart->append(imagePart);
auto accountManager = DependencyManager::get<AccountManager>(); auto accountManager = DependencyManager::get<AccountManager>();
JSONCallbackParameters callbackParams(uploader, "uploadSuccess", uploader, "uploadFailure"); JSONCallbackParameters callbackParams(uploader, "uploadSuccess", "uploadFailure");
accountManager->sendRequest(SNAPSHOT_UPLOAD_URL, AccountManagerAuth::Required, QNetworkAccessManager::PostOperation, accountManager->sendRequest(SNAPSHOT_UPLOAD_URL, AccountManagerAuth::Required, QNetworkAccessManager::PostOperation,
callbackParams, nullptr, multiPart); callbackParams, nullptr, multiPart);

View file

@ -23,11 +23,11 @@ SnapshotUploader::SnapshotUploader(QUrl inWorldLocation, QString pathname) :
_pathname(pathname) { _pathname(pathname) {
} }
void SnapshotUploader::uploadSuccess(QNetworkReply& reply) { void SnapshotUploader::uploadSuccess(QNetworkReply* reply) {
const QString STORY_UPLOAD_URL = "/api/v1/user_stories"; const QString STORY_UPLOAD_URL = "/api/v1/user_stories";
// parse the reply for the thumbnail_url // parse the reply for the thumbnail_url
QByteArray contents = reply.readAll(); QByteArray contents = reply->readAll();
QJsonParseError jsonError; QJsonParseError jsonError;
auto doc = QJsonDocument::fromJson(contents, &jsonError); auto doc = QJsonDocument::fromJson(contents, &jsonError);
if (jsonError.error == QJsonParseError::NoError) { if (jsonError.error == QJsonParseError::NoError) {
@ -60,7 +60,7 @@ void SnapshotUploader::uploadSuccess(QNetworkReply& reply) {
rootObject.insert("user_story", userStoryObject); rootObject.insert("user_story", userStoryObject);
auto accountManager = DependencyManager::get<AccountManager>(); auto accountManager = DependencyManager::get<AccountManager>();
JSONCallbackParameters callbackParams(this, "createStorySuccess", this, "createStoryFailure"); JSONCallbackParameters callbackParams(this, "createStorySuccess", "createStoryFailure");
accountManager->sendRequest(STORY_UPLOAD_URL, accountManager->sendRequest(STORY_UPLOAD_URL,
AccountManagerAuth::Required, AccountManagerAuth::Required,
@ -74,11 +74,11 @@ void SnapshotUploader::uploadSuccess(QNetworkReply& reply) {
} }
} }
void SnapshotUploader::uploadFailure(QNetworkReply& reply) { void SnapshotUploader::uploadFailure(QNetworkReply* reply) {
QString replyString = reply.readAll(); QString replyString = reply->readAll();
qDebug() << "Error " << reply.errorString() << " uploading snapshot " << _pathname << " from " << _inWorldLocation; qDebug() << "Error " << reply->errorString() << " uploading snapshot " << _pathname << " from " << _inWorldLocation;
if (replyString.size() == 0) { if (replyString.size() == 0) {
replyString = reply.errorString(); replyString = reply->errorString();
} }
replyString = replyString.left(1000); // Only print first 1000 characters of error replyString = replyString.left(1000); // Only print first 1000 characters of error
qDebug() << "Snapshot upload reply error (truncated):" << replyString; qDebug() << "Snapshot upload reply error (truncated):" << replyString;
@ -86,17 +86,17 @@ void SnapshotUploader::uploadFailure(QNetworkReply& reply) {
this->deleteLater(); this->deleteLater();
} }
void SnapshotUploader::createStorySuccess(QNetworkReply& reply) { void SnapshotUploader::createStorySuccess(QNetworkReply* reply) {
QString replyString = reply.readAll(); QString replyString = reply->readAll();
emit DependencyManager::get<WindowScriptingInterface>()->snapshotShared(false, replyString); emit DependencyManager::get<WindowScriptingInterface>()->snapshotShared(false, replyString);
this->deleteLater(); this->deleteLater();
} }
void SnapshotUploader::createStoryFailure(QNetworkReply& reply) { void SnapshotUploader::createStoryFailure(QNetworkReply* reply) {
QString replyString = reply.readAll(); QString replyString = reply->readAll();
qDebug() << "Error " << reply.errorString() << " uploading snapshot story " << _pathname << " from " << _inWorldLocation; qDebug() << "Error " << reply->errorString() << " uploading snapshot story " << _pathname << " from " << _inWorldLocation;
if (replyString.size() == 0) { if (replyString.size() == 0) {
replyString = reply.errorString(); replyString = reply->errorString();
} }
replyString = replyString.left(1000); // Only print first 1000 characters of error replyString = replyString.left(1000); // Only print first 1000 characters of error
qDebug() << "Snapshot story upload reply error (truncated):" << replyString; qDebug() << "Snapshot story upload reply error (truncated):" << replyString;

View file

@ -21,12 +21,12 @@ class SnapshotUploader : public QObject {
public: public:
SnapshotUploader(QUrl inWorldLocation, QString pathname); SnapshotUploader(QUrl inWorldLocation, QString pathname);
public slots: public slots:
void uploadSuccess(QNetworkReply& reply); void uploadSuccess(QNetworkReply* reply);
void uploadFailure(QNetworkReply& reply); void uploadFailure(QNetworkReply* reply);
void createStorySuccess(QNetworkReply& reply); void createStorySuccess(QNetworkReply* reply);
void createStoryFailure(QNetworkReply& reply); void createStoryFailure(QNetworkReply* reply);
private: private:
QUrl _inWorldLocation; QUrl _inWorldLocation;
QString _pathname; QString _pathname;
}; };
#endif // hifi_SnapshotUploader_h #endif // hifi_SnapshotUploader_h

View file

@ -1816,7 +1816,6 @@ FBXGeometry* FBXReader::extractFBXGeometry(const QVariantHash& mapping, const QS
} }
} }
float clusterScale = extractUniformScale(fbxCluster.inverseBindMatrix);
glm::mat4 meshToJoint = glm::inverse(joint.bindTransform) * modelTransform; glm::mat4 meshToJoint = glm::inverse(joint.bindTransform) * modelTransform;
ShapeVertices& points = shapeVertices.at(jointIndex); ShapeVertices& points = shapeVertices.at(jointIndex);
@ -1832,7 +1831,7 @@ FBXGeometry* FBXReader::extractFBXGeometry(const QVariantHash& mapping, const QS
if (weight >= EXPANSION_WEIGHT_THRESHOLD) { if (weight >= EXPANSION_WEIGHT_THRESHOLD) {
// transform to joint-frame and save for later // transform to joint-frame and save for later
const glm::mat4 vertexTransform = meshToJoint * glm::translate(extracted.mesh.vertices.at(newIndex)); const glm::mat4 vertexTransform = meshToJoint * glm::translate(extracted.mesh.vertices.at(newIndex));
points.push_back(extractTranslation(vertexTransform) * clusterScale); points.push_back(extractTranslation(vertexTransform));
} }
// look for an unused slot in the weights vector // look for an unused slot in the weights vector
@ -1886,12 +1885,11 @@ FBXGeometry* FBXReader::extractFBXGeometry(const QVariantHash& mapping, const QS
FBXJoint& joint = geometry.joints[jointIndex]; FBXJoint& joint = geometry.joints[jointIndex];
// transform cluster vertices to joint-frame and save for later // transform cluster vertices to joint-frame and save for later
float clusterScale = extractUniformScale(firstFBXCluster.inverseBindMatrix);
glm::mat4 meshToJoint = glm::inverse(joint.bindTransform) * modelTransform; glm::mat4 meshToJoint = glm::inverse(joint.bindTransform) * modelTransform;
ShapeVertices& points = shapeVertices.at(jointIndex); ShapeVertices& points = shapeVertices.at(jointIndex);
foreach (const glm::vec3& vertex, extracted.mesh.vertices) { foreach (const glm::vec3& vertex, extracted.mesh.vertices) {
const glm::mat4 vertexTransform = meshToJoint * glm::translate(vertex); const glm::mat4 vertexTransform = meshToJoint * glm::translate(vertex);
points.push_back(extractTranslation(vertexTransform) * clusterScale); points.push_back(extractTranslation(vertexTransform));
} }
// Apply geometric offset, if present, by transforming the vertices directly // Apply geometric offset, if present, by transforming the vertices directly

View file

@ -25,6 +25,7 @@
#include <QtCore/QThreadPool> #include <QtCore/QThreadPool>
#include <QtNetwork/QHttpMultiPart> #include <QtNetwork/QHttpMultiPart>
#include <QtNetwork/QNetworkRequest> #include <QtNetwork/QNetworkRequest>
#include <QtNetwork/QNetworkReply>
#include <qthread.h> #include <qthread.h>
#include <SettingHandle.h> #include <SettingHandle.h>
@ -46,21 +47,18 @@ Q_DECLARE_METATYPE(JSONCallbackParameters)
const QString ACCOUNTS_GROUP = "accounts"; const QString ACCOUNTS_GROUP = "accounts";
JSONCallbackParameters::JSONCallbackParameters(QObject* jsonCallbackReceiver, const QString& jsonCallbackMethod, JSONCallbackParameters::JSONCallbackParameters(QObject* callbackReceiver,
QObject* errorCallbackReceiver, const QString& errorCallbackMethod, const QString& jsonCallbackMethod,
QObject* updateReceiver, const QString& updateSlot) : const QString& errorCallbackMethod) :
jsonCallbackReceiver(jsonCallbackReceiver), callbackReceiver(callbackReceiver),
jsonCallbackMethod(jsonCallbackMethod), jsonCallbackMethod(jsonCallbackMethod),
errorCallbackReceiver(errorCallbackReceiver), errorCallbackMethod(errorCallbackMethod)
errorCallbackMethod(errorCallbackMethod),
updateReciever(updateReceiver),
updateSlot(updateSlot)
{ {
} }
QJsonObject AccountManager::dataObjectFromResponse(QNetworkReply &requestReply) { QJsonObject AccountManager::dataObjectFromResponse(QNetworkReply* requestReply) {
QJsonObject jsonObject = QJsonDocument::fromJson(requestReply.readAll()).object(); QJsonObject jsonObject = QJsonDocument::fromJson(requestReply->readAll()).object();
static const QString STATUS_KEY = "status"; static const QString STATUS_KEY = "status";
static const QString DATA_KEY = "data"; static const QString DATA_KEY = "data";
@ -74,8 +72,7 @@ QJsonObject AccountManager::dataObjectFromResponse(QNetworkReply &requestReply)
AccountManager::AccountManager(UserAgentGetter userAgentGetter) : AccountManager::AccountManager(UserAgentGetter userAgentGetter) :
_userAgentGetter(userAgentGetter), _userAgentGetter(userAgentGetter),
_authURL(), _authURL()
_pendingCallbackMap()
{ {
qRegisterMetaType<OAuthAccessToken>("OAuthAccessToken"); qRegisterMetaType<OAuthAccessToken>("OAuthAccessToken");
qRegisterMetaTypeStreamOperators<OAuthAccessToken>("OAuthAccessToken"); qRegisterMetaTypeStreamOperators<OAuthAccessToken>("OAuthAccessToken");
@ -323,75 +320,66 @@ void AccountManager::sendRequest(const QString& path,
} }
} }
connect(networkReply, &QNetworkReply::finished, this, [this, networkReply] {
if (!callbackParams.isEmpty()) { // double check if the finished network reply had a session ID in the header and make
// if we have information for a callback, insert the callbackParams into our local map // sure that our session ID matches that value if so
_pendingCallbackMap.insert(networkReply, callbackParams); if (networkReply->hasRawHeader(METAVERSE_SESSION_ID_HEADER)) {
_sessionID = networkReply->rawHeader(METAVERSE_SESSION_ID_HEADER);
if (callbackParams.updateReciever && !callbackParams.updateSlot.isEmpty()) {
callbackParams.updateReciever->connect(networkReply, SIGNAL(uploadProgress(qint64, qint64)),
callbackParams.updateSlot.toStdString().c_str());
} }
});
if (callbackParams.isEmpty()) {
connect(networkReply, &QNetworkReply::finished, networkReply, &QNetworkReply::deleteLater);
} else {
// There's a cleaner way to fire the JSON/error callbacks below and ensure that deleteLater is called for the
// request reply - unfortunately it requires Qt 5.10 which the Android build does not support as of 06/26/18
connect(networkReply, &QNetworkReply::finished, callbackParams.callbackReceiver,
[callbackParams, networkReply] {
if (networkReply->error() == QNetworkReply::NoError) {
if (!callbackParams.jsonCallbackMethod.isEmpty()) {
bool invoked = QMetaObject::invokeMethod(callbackParams.callbackReceiver,
qPrintable(callbackParams.jsonCallbackMethod),
Q_ARG(QNetworkReply*, networkReply));
if (!invoked) {
QString error = "Could not invoke " + callbackParams.jsonCallbackMethod + " with QNetworkReply* "
+ "on callbackReceiver.";
qCWarning(networking) << error;
Q_ASSERT_X(invoked, "AccountManager::passErrorToCallback", qPrintable(error));
}
} else {
if (VERBOSE_HTTP_REQUEST_DEBUGGING) {
qCDebug(networking) << "Received JSON response from metaverse API that has no matching callback.";
qCDebug(networking) << QJsonDocument::fromJson(networkReply->readAll());
}
}
} else {
if (!callbackParams.errorCallbackMethod.isEmpty()) {
bool invoked = QMetaObject::invokeMethod(callbackParams.callbackReceiver,
qPrintable(callbackParams.errorCallbackMethod),
Q_ARG(QNetworkReply*, networkReply));
if (!invoked) {
QString error = "Could not invoke " + callbackParams.errorCallbackMethod + " with QNetworkReply* "
+ "on callbackReceiver.";
qCWarning(networking) << error;
Q_ASSERT_X(invoked, "AccountManager::passErrorToCallback", qPrintable(error));
}
} else {
if (VERBOSE_HTTP_REQUEST_DEBUGGING) {
qCDebug(networking) << "Received error response from metaverse API that has no matching callback.";
qCDebug(networking) << "Error" << networkReply->error() << "-" << networkReply->errorString();
qCDebug(networking) << networkReply->readAll();
}
}
}
networkReply->deleteLater();
});
} }
// if we ended up firing of a request, hook up to it now
connect(networkReply, SIGNAL(finished()), SLOT(processReply()));
}
}
void AccountManager::processReply() {
QNetworkReply* requestReply = reinterpret_cast<QNetworkReply*>(sender());
if (requestReply->error() == QNetworkReply::NoError) {
if (requestReply->hasRawHeader(METAVERSE_SESSION_ID_HEADER)) {
_sessionID = requestReply->rawHeader(METAVERSE_SESSION_ID_HEADER);
}
passSuccessToCallback(requestReply);
} else {
passErrorToCallback(requestReply);
}
requestReply->deleteLater();
}
void AccountManager::passSuccessToCallback(QNetworkReply* requestReply) {
JSONCallbackParameters callbackParams = _pendingCallbackMap.value(requestReply);
if (callbackParams.jsonCallbackReceiver) {
// invoke the right method on the callback receiver
QMetaObject::invokeMethod(callbackParams.jsonCallbackReceiver, qPrintable(callbackParams.jsonCallbackMethod),
Q_ARG(QNetworkReply&, *requestReply));
// remove the related reply-callback group from the map
_pendingCallbackMap.remove(requestReply);
} else {
if (VERBOSE_HTTP_REQUEST_DEBUGGING) {
qCDebug(networking) << "Received JSON response from metaverse API that has no matching callback.";
qCDebug(networking) << QJsonDocument::fromJson(requestReply->readAll());
}
requestReply->deleteLater();
}
}
void AccountManager::passErrorToCallback(QNetworkReply* requestReply) {
JSONCallbackParameters callbackParams = _pendingCallbackMap.value(requestReply);
if (callbackParams.errorCallbackReceiver) {
// invoke the right method on the callback receiver
QMetaObject::invokeMethod(callbackParams.errorCallbackReceiver, qPrintable(callbackParams.errorCallbackMethod),
Q_ARG(QNetworkReply&, *requestReply));
// remove the related reply-callback group from the map
_pendingCallbackMap.remove(requestReply);
} else {
if (VERBOSE_HTTP_REQUEST_DEBUGGING) {
qCDebug(networking) << "Received error response from metaverse API that has no matching callback.";
qCDebug(networking) << "Error" << requestReply->error() << "-" << requestReply->errorString();
qCDebug(networking) << requestReply->readAll();
}
requestReply->deleteLater();
} }
} }
@ -817,16 +805,15 @@ void AccountManager::processGeneratedKeypair(QByteArray publicKey, QByteArray pr
// setup callback parameters so we know once the keypair upload has succeeded or failed // setup callback parameters so we know once the keypair upload has succeeded or failed
JSONCallbackParameters callbackParameters; JSONCallbackParameters callbackParameters;
callbackParameters.jsonCallbackReceiver = this; callbackParameters.callbackReceiver = this;
callbackParameters.jsonCallbackMethod = "publicKeyUploadSucceeded"; callbackParameters.jsonCallbackMethod = "publicKeyUploadSucceeded";
callbackParameters.errorCallbackReceiver = this;
callbackParameters.errorCallbackMethod = "publicKeyUploadFailed"; callbackParameters.errorCallbackMethod = "publicKeyUploadFailed";
sendRequest(uploadPath, AccountManagerAuth::Optional, QNetworkAccessManager::PutOperation, sendRequest(uploadPath, AccountManagerAuth::Optional, QNetworkAccessManager::PutOperation,
callbackParameters, QByteArray(), requestMultiPart); callbackParameters, QByteArray(), requestMultiPart);
} }
void AccountManager::publicKeyUploadSucceeded(QNetworkReply& reply) { void AccountManager::publicKeyUploadSucceeded(QNetworkReply* reply) {
qCDebug(networking) << "Uploaded public key to Metaverse API. RSA keypair generation is completed."; qCDebug(networking) << "Uploaded public key to Metaverse API. RSA keypair generation is completed.";
// public key upload complete - store the matching private key and persist the account to settings // public key upload complete - store the matching private key and persist the account to settings
@ -838,23 +825,17 @@ void AccountManager::publicKeyUploadSucceeded(QNetworkReply& reply) {
_isWaitingForKeypairResponse = false; _isWaitingForKeypairResponse = false;
emit newKeypair(); emit newKeypair();
// delete the reply object now that we are done with it
reply.deleteLater();
} }
void AccountManager::publicKeyUploadFailed(QNetworkReply& reply) { void AccountManager::publicKeyUploadFailed(QNetworkReply* reply) {
// the public key upload has failed // the public key upload has failed
qWarning() << "Public key upload failed from AccountManager" << reply.errorString(); qWarning() << "Public key upload failed from AccountManager" << reply->errorString();
// we aren't waiting for a response any longer // we aren't waiting for a response any longer
_isWaitingForKeypairResponse = false; _isWaitingForKeypairResponse = false;
// clear our pending private key // clear our pending private key
_pendingPrivateKey.clear(); _pendingPrivateKey.clear();
// delete the reply object now that we are done with it
reply.deleteLater();
} }
void AccountManager::handleKeypairGenerationError() { void AccountManager::handleKeypairGenerationError() {

View file

@ -28,18 +28,14 @@
class JSONCallbackParameters { class JSONCallbackParameters {
public: public:
JSONCallbackParameters(QObject* jsonCallbackReceiver = nullptr, const QString& jsonCallbackMethod = QString(), JSONCallbackParameters(QObject* callbackReceiver = nullptr, const QString& jsonCallbackMethod = QString(),
QObject* errorCallbackReceiver = nullptr, const QString& errorCallbackMethod = QString(), const QString& errorCallbackMethod = QString());
QObject* updateReceiver = nullptr, const QString& updateSlot = QString());
bool isEmpty() const { return !jsonCallbackReceiver && !errorCallbackReceiver; } bool isEmpty() const { return !callbackReceiver; }
QObject* jsonCallbackReceiver; QObject* callbackReceiver;
QString jsonCallbackMethod; QString jsonCallbackMethod;
QObject* errorCallbackReceiver;
QString errorCallbackMethod; QString errorCallbackMethod;
QObject* updateReciever;
QString updateSlot;
}; };
namespace AccountManagerAuth { namespace AccountManagerAuth {
@ -90,7 +86,7 @@ public:
DataServerAccountInfo& getAccountInfo() { return _accountInfo; } DataServerAccountInfo& getAccountInfo() { return _accountInfo; }
void setAccountInfo(const DataServerAccountInfo &newAccountInfo); void setAccountInfo(const DataServerAccountInfo &newAccountInfo);
static QJsonObject dataObjectFromResponse(QNetworkReply& requestReply); static QJsonObject dataObjectFromResponse(QNetworkReply* requestReply);
QUuid getSessionID() const { return _sessionID; } QUuid getSessionID() const { return _sessionID; }
void setSessionID(const QUuid& sessionID); void setSessionID(const QUuid& sessionID);
@ -126,11 +122,10 @@ signals:
void newKeypair(); void newKeypair();
private slots: private slots:
void processReply();
void handleKeypairGenerationError(); void handleKeypairGenerationError();
void processGeneratedKeypair(QByteArray publicKey, QByteArray privateKey); void processGeneratedKeypair(QByteArray publicKey, QByteArray privateKey);
void publicKeyUploadSucceeded(QNetworkReply& reply); void publicKeyUploadSucceeded(QNetworkReply* reply);
void publicKeyUploadFailed(QNetworkReply& reply); void publicKeyUploadFailed(QNetworkReply* reply);
void generateNewKeypair(bool isUserKeypair = true, const QUuid& domainID = QUuid()); void generateNewKeypair(bool isUserKeypair = true, const QUuid& domainID = QUuid());
private: private:
@ -146,8 +141,6 @@ private:
UserAgentGetter _userAgentGetter; UserAgentGetter _userAgentGetter;
QUrl _authURL; QUrl _authURL;
QMap<QNetworkReply*, JSONCallbackParameters> _pendingCallbackMap;
DataServerAccountInfo _accountInfo; DataServerAccountInfo _accountInfo;
bool _isWaitingForTokenRefresh { false }; bool _isWaitingForTokenRefresh { false };

View file

@ -215,9 +215,8 @@ const JSONCallbackParameters& AddressManager::apiCallbackParameters() {
static JSONCallbackParameters callbackParams; static JSONCallbackParameters callbackParams;
if (!hasSetupParameters) { if (!hasSetupParameters) {
callbackParams.jsonCallbackReceiver = this; callbackParams.callbackReceiver = this;
callbackParams.jsonCallbackMethod = "handleAPIResponse"; callbackParams.jsonCallbackMethod = "handleAPIResponse";
callbackParams.errorCallbackReceiver = this;
callbackParams.errorCallbackMethod = "handleAPIError"; callbackParams.errorCallbackMethod = "handleAPIError";
} }
@ -377,8 +376,8 @@ void AddressManager::handleLookupString(const QString& lookupString, bool fromSu
const QString DATA_OBJECT_DOMAIN_KEY = "domain"; const QString DATA_OBJECT_DOMAIN_KEY = "domain";
void AddressManager::handleAPIResponse(QNetworkReply& requestReply) { void AddressManager::handleAPIResponse(QNetworkReply* requestReply) {
QJsonObject responseObject = QJsonDocument::fromJson(requestReply.readAll()).object(); QJsonObject responseObject = QJsonDocument::fromJson(requestReply->readAll()).object();
QJsonObject dataObject = responseObject["data"].toObject(); QJsonObject dataObject = responseObject["data"].toObject();
// Lookup succeeded, don't keep re-trying it (especially on server restarts) // Lookup succeeded, don't keep re-trying it (especially on server restarts)
@ -396,7 +395,7 @@ void AddressManager::handleAPIResponse(QNetworkReply& requestReply) {
const char OVERRIDE_PATH_KEY[] = "override_path"; const char OVERRIDE_PATH_KEY[] = "override_path";
const char LOOKUP_TRIGGER_KEY[] = "lookup_trigger"; const char LOOKUP_TRIGGER_KEY[] = "lookup_trigger";
void AddressManager::goToAddressFromObject(const QVariantMap& dataObject, const QNetworkReply& reply) { void AddressManager::goToAddressFromObject(const QVariantMap& dataObject, const QNetworkReply* reply) {
const QString DATA_OBJECT_PLACE_KEY = "place"; const QString DATA_OBJECT_PLACE_KEY = "place";
const QString DATA_OBJECT_USER_LOCATION_KEY = "location"; const QString DATA_OBJECT_USER_LOCATION_KEY = "location";
@ -461,7 +460,7 @@ void AddressManager::goToAddressFromObject(const QVariantMap& dataObject, const
emit possibleDomainChangeRequiredViaICEForID(iceServerAddress, domainID); emit possibleDomainChangeRequiredViaICEForID(iceServerAddress, domainID);
} }
LookupTrigger trigger = (LookupTrigger) reply.property(LOOKUP_TRIGGER_KEY).toInt(); LookupTrigger trigger = (LookupTrigger) reply->property(LOOKUP_TRIGGER_KEY).toInt();
// set our current root place id to the ID that came back // set our current root place id to the ID that came back
@ -495,7 +494,7 @@ void AddressManager::goToAddressFromObject(const QVariantMap& dataObject, const
} }
// check if we had a path to override the path returned // check if we had a path to override the path returned
QString overridePath = reply.property(OVERRIDE_PATH_KEY).toString(); QString overridePath = reply->property(OVERRIDE_PATH_KEY).toString();
if (!overridePath.isEmpty() && overridePath != "/") { if (!overridePath.isEmpty() && overridePath != "/") {
// make sure we don't re-handle an overriden path if this was a refresh of info from API // make sure we don't re-handle an overriden path if this was a refresh of info from API
@ -543,10 +542,10 @@ void AddressManager::goToAddressFromObject(const QVariantMap& dataObject, const
} }
} }
void AddressManager::handleAPIError(QNetworkReply& errorReply) { void AddressManager::handleAPIError(QNetworkReply* errorReply) {
qCDebug(networking) << "AddressManager API error -" << errorReply.error() << "-" << errorReply.errorString(); qCDebug(networking) << "AddressManager API error -" << errorReply->error() << "-" << errorReply->errorString();
if (errorReply.error() == QNetworkReply::ContentNotFoundError) { if (errorReply->error() == QNetworkReply::ContentNotFoundError) {
// if this is a lookup that has no result, don't keep re-trying it // if this is a lookup that has no result, don't keep re-trying it
_previousLookup.clear(); _previousLookup.clear();
@ -874,14 +873,14 @@ QString AddressManager::getDomainID() const {
return DependencyManager::get<NodeList>()->getDomainHandler().getUUID().toString(); return DependencyManager::get<NodeList>()->getDomainHandler().getUUID().toString();
} }
void AddressManager::handleShareableNameAPIResponse(QNetworkReply& requestReply) { void AddressManager::handleShareableNameAPIResponse(QNetworkReply* requestReply) {
// make sure that this response is for the domain we're currently connected to // make sure that this response is for the domain we're currently connected to
auto domainID = DependencyManager::get<NodeList>()->getDomainHandler().getUUID(); auto domainID = DependencyManager::get<NodeList>()->getDomainHandler().getUUID();
if (requestReply.url().toString().contains(uuidStringWithoutCurlyBraces(domainID))) { if (requestReply->url().toString().contains(uuidStringWithoutCurlyBraces(domainID))) {
// check for a name or default name in the API response // check for a name or default name in the API response
QJsonObject responseObject = QJsonDocument::fromJson(requestReply.readAll()).object(); QJsonObject responseObject = QJsonDocument::fromJson(requestReply->readAll()).object();
QJsonObject domainObject = responseObject["domain"].toObject(); QJsonObject domainObject = responseObject["domain"].toObject();
const QString DOMAIN_NAME_KEY = "name"; const QString DOMAIN_NAME_KEY = "name";
@ -917,7 +916,7 @@ void AddressManager::lookupShareableNameForDomainID(const QUuid& domainID) {
// no error callback handling // no error callback handling
// in the case of an error we simply assume there is no default place name // in the case of an error we simply assume there is no default place name
callbackParams.jsonCallbackReceiver = this; callbackParams.callbackReceiver = this;
callbackParams.jsonCallbackMethod = "handleShareableNameAPIResponse"; callbackParams.jsonCallbackMethod = "handleShareableNameAPIResponse";
DependencyManager::get<AccountManager>()->sendRequest(GET_DOMAIN_ID.arg(uuidStringWithoutCurlyBraces(domainID)), DependencyManager::get<AccountManager>()->sendRequest(GET_DOMAIN_ID.arg(uuidStringWithoutCurlyBraces(domainID)),

View file

@ -417,13 +417,13 @@ signals:
void goForwardPossible(bool isPossible); void goForwardPossible(bool isPossible);
private slots: private slots:
void handleAPIResponse(QNetworkReply& requestReply); void handleAPIResponse(QNetworkReply* requestReply);
void handleAPIError(QNetworkReply& errorReply); void handleAPIError(QNetworkReply* errorReply);
void handleShareableNameAPIResponse(QNetworkReply& requestReply); void handleShareableNameAPIResponse(QNetworkReply* requestReply);
private: private:
void goToAddressFromObject(const QVariantMap& addressMap, const QNetworkReply& reply); void goToAddressFromObject(const QVariantMap& addressMap, const QNetworkReply* reply);
// Set host and port, and return `true` if it was changed. // Set host and port, and return `true` if it was changed.
bool setHost(const QString& host, LookupTrigger trigger, quint16 port = 0); bool setHost(const QString& host, LookupTrigger trigger, quint16 port = 0);

View file

@ -549,7 +549,7 @@ void NodeList::handleICEConnectionToDomainServer() {
_domainHandler.getICEClientID(), _domainHandler.getICEClientID(),
_domainHandler.getPendingDomainID()); _domainHandler.getPendingDomainID());
} }
} }
void NodeList::pingPunchForDomainServer() { void NodeList::pingPunchForDomainServer() {
// make sure if we're here that we actually still need to ping the domain-server // make sure if we're here that we actually still need to ping the domain-server

View file

@ -65,7 +65,7 @@ void UserActivityLogger::logAction(QString action, QJsonObject details, JSONCall
// if no callbacks specified, call our owns // if no callbacks specified, call our owns
if (params.isEmpty()) { if (params.isEmpty()) {
params.errorCallbackReceiver = this; params.callbackReceiver = this;
params.errorCallbackMethod = "requestError"; params.errorCallbackMethod = "requestError";
} }
@ -75,8 +75,8 @@ void UserActivityLogger::logAction(QString action, QJsonObject details, JSONCall
params, NULL, multipart); params, NULL, multipart);
} }
void UserActivityLogger::requestError(QNetworkReply& errorReply) { void UserActivityLogger::requestError(QNetworkReply* errorReply) {
qCDebug(networking) << errorReply.error() << "-" << errorReply.errorString(); qCDebug(networking) << errorReply->error() << "-" << errorReply->errorString();
} }
void UserActivityLogger::launch(QString applicationVersion, bool previousSessionCrashed, int previousSessionRuntime) { void UserActivityLogger::launch(QString applicationVersion, bool previousSessionCrashed, int previousSessionRuntime) {

View file

@ -50,7 +50,7 @@ public slots:
void wentTo(AddressManager::LookupTrigger trigger, QString destinationType, QString destinationName); void wentTo(AddressManager::LookupTrigger trigger, QString destinationType, QString destinationName);
private slots: private slots:
void requestError(QNetworkReply& errorReply); void requestError(QNetworkReply* errorReply);
private: private:
UserActivityLogger(); UserActivityLogger();

View file

@ -286,6 +286,13 @@ void OffscreenSurface::loadInternal(const QUrl& qmlSource,
if (QThread::currentThread() != thread()) { if (QThread::currentThread() != thread()) {
qFatal("Called load on a non-surface thread"); qFatal("Called load on a non-surface thread");
} }
// For desktop toolbar mode window: stop script when window is closed.
if (qmlSource.isEmpty()) {
getSurfaceContext()->engine()->quit();
return;
}
// Synchronous loading may take a while; restart the deadlock timer // Synchronous loading may take a while; restart the deadlock timer
QMetaObject::invokeMethod(qApp, "updateHeartbeat", Qt::DirectConnection); QMetaObject::invokeMethod(qApp, "updateHeartbeat", Qt::DirectConnection);

View file

@ -83,7 +83,7 @@ void Tooltip::requestHyperlinkImage() {
auto accountManager = DependencyManager::get<AccountManager>(); auto accountManager = DependencyManager::get<AccountManager>();
JSONCallbackParameters callbackParams; JSONCallbackParameters callbackParams;
callbackParams.jsonCallbackReceiver = this; callbackParams.callbackReceiver = this;
callbackParams.jsonCallbackMethod = "handleAPIResponse"; callbackParams.jsonCallbackMethod = "handleAPIResponse";
accountManager->sendRequest(GET_PLACE.arg(_title), accountManager->sendRequest(GET_PLACE.arg(_title),
@ -94,9 +94,9 @@ void Tooltip::requestHyperlinkImage() {
} }
} }
void Tooltip::handleAPIResponse(QNetworkReply& requestReply) { void Tooltip::handleAPIResponse(QNetworkReply* requestReply) {
// did a preview image come back? // did a preview image come back?
QJsonObject responseObject = QJsonDocument::fromJson(requestReply.readAll()).object(); QJsonObject responseObject = QJsonDocument::fromJson(requestReply->readAll()).object();
QJsonObject dataObject = responseObject["data"].toObject(); QJsonObject dataObject = responseObject["data"].toObject();
const QString PLACE_KEY = "place"; const QString PLACE_KEY = "place";

View file

@ -49,7 +49,7 @@ signals:
void imageURLChanged(); void imageURLChanged();
private slots: private slots:
void handleAPIResponse(QNetworkReply& requestReply); void handleAPIResponse(QNetworkReply* requestReply);
private: private:
void requestHyperlinkImage(); void requestHyperlinkImage();

View file

@ -648,6 +648,26 @@ void TabletProxy::loadQMLSource(const QVariant& path, bool resizable) {
} }
} }
void TabletProxy::stopQMLSource() {
// For desktop toolbar mode dialogs.
if (!_toolbarMode || !_desktopWindow) {
qCDebug(uiLogging) << "tablet cannot clear QML because not desktop toolbar mode";
return;
}
auto root = _desktopWindow->asQuickItem();
if (root) {
QMetaObject::invokeMethod(root, "loadSource", Q_ARG(const QVariant&, ""));
if (!_currentPathLoaded.toString().isEmpty()) {
emit screenChanged(QVariant("QML"), "");
}
_currentPathLoaded = "";
_state = State::Home;
} else {
qCDebug(uiLogging) << "tablet cannot clear QML because _desktopWindow is null";
}
}
bool TabletProxy::pushOntoStack(const QVariant& path) { bool TabletProxy::pushOntoStack(const QVariant& path) {
if (QThread::currentThread() != thread()) { if (QThread::currentThread() != thread()) {
bool result = false; bool result = false;
@ -719,6 +739,7 @@ void TabletProxy::loadHomeScreen(bool forceOntoHomeScreen) {
// close desktop window // close desktop window
if (_desktopWindow->asQuickItem()) { if (_desktopWindow->asQuickItem()) {
QMetaObject::invokeMethod(_desktopWindow->asQuickItem(), "setShown", Q_ARG(const QVariant&, QVariant(false))); QMetaObject::invokeMethod(_desktopWindow->asQuickItem(), "setShown", Q_ARG(const QVariant&, QVariant(false)));
stopQMLSource(); // Stop the currently loaded QML running.
} }
} }
_state = State::Home; _state = State::Home;

View file

@ -443,6 +443,9 @@ protected:
bool _showRunningScripts { false }; bool _showRunningScripts { false };
TabletButtonListModel _buttons; TabletButtonListModel _buttons;
private:
void stopQMLSource();
}; };
Q_DECLARE_METATYPE(TabletProxy*); Q_DECLARE_METATYPE(TabletProxy*);

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

View file

@ -16,7 +16,8 @@
(function() { // BEGIN LOCAL_SCOPE (function() { // BEGIN LOCAL_SCOPE
var EMOTE_ANIMATIONS = ['Cry', 'Surprised', 'Dance', 'Cheer', 'Wave', 'Fall', 'Point', 'Clap', 'Sit1', 'Sit2', 'Sit3', 'Love']; var EMOTE_ANIMATIONS =
['Crying', 'Surprised', 'Dancing', 'Cheering', 'Waving', 'Fall', 'Pointing', 'Clapping', 'Sit1', 'Sit2', 'Sit3', 'Love'];
var ANIMATIONS = Array(); var ANIMATIONS = Array();
var eventMappingName = "io.highfidelity.away"; // restoreAnimation on hand controller button events, too var eventMappingName = "io.highfidelity.away"; // restoreAnimation on hand controller button events, too
@ -36,6 +37,7 @@ var EMOTE_LABEL = "EMOTE";
var EMOTE_APP_SORT_ORDER = 12; var EMOTE_APP_SORT_ORDER = 12;
var FPS = 60; var FPS = 60;
var MSEC_PER_SEC = 1000; var MSEC_PER_SEC = 1000;
var FINISHED = 3; // see ScriptableResource::State
var onEmoteScreen = false; var onEmoteScreen = false;
var button; var button;
@ -73,63 +75,65 @@ function onWebEventReceived(event) {
if (event.type === "click") { if (event.type === "click") {
// Allow for a random sitting animation when a user selects sit
var randSit = Math.floor(Math.random() * 3) + 1;
var emoteName = event.data; var emoteName = event.data;
if (activeTimer !== false) { if (emoteName === "Sit"){
Script.clearTimeout(activeTimer); emoteName = event.data + randSit; // Sit1, Sit2, Sit3
} }
// If the activeEmote is different from the chosen emote, then play the new emote. Other wise, if (ANIMATIONS[emoteName].resource.state === FINISHED) {
// This is a second click on the same emote as the activeEmote, and we will just stop it.
if (activeEmote !== emoteName) {
activeEmote = emoteName;
// Allow for a random sitting animation when a user selects sit if (activeTimer !== false) {
var randSit = Math.floor(Math.random() * 3) + 1; Script.clearTimeout(activeTimer);
if (emoteName === "Sit"){
emoteName = event.data + randSit; // "Sit1, Sit2, Sit3"
} }
var frameCount = ANIMATIONS[emoteName].animation.frames.length; // If the activeEmote is different from the chosen emote, then play the new emote
// This is a second click on the same emote as the activeEmote, and we will just stop it
// Three types of emotes (non-looping end, non-looping return, looping) if (activeEmote !== emoteName) {
if (emoteName.match(/^Sit.*$/) || emoteName === "Fall") { // non-looping end activeEmote = emoteName;
MyAvatar.overrideAnimation(ANIMATIONS[emoteName].url, FPS, false, 0, frameCount);
// Non-looping return
} else if (emoteName === "Love" || emoteName === "Surprised" || emoteName === "Cry" || emoteName === "Point"){
MyAvatar.overrideAnimation(ANIMATIONS[emoteName].url, FPS, false, 0, frameCount);
var timeOut = MSEC_PER_SEC * frameCount / FPS;
activeTimer = Script.setTimeout(function () {
MyAvatar.restoreAnimation();
activeTimer = false;
activeEmote = false;
}, timeOut);
} else { // Looping
// Sit is the only animation currently that plays and then ends at the last frame
MyAvatar.overrideAnimation(ANIMATIONS[emoteName].url, FPS, true, 0, frameCount); if (emoteName.match(/^Sit.*$/)) {
} // If user provides input during a sit, the avatar animation state should be restored
Controller.keyPressEvent.connect(restoreAnimation);
} else { MyAvatar.overrideAnimation(ANIMATIONS[emoteName].url, FPS, false, 0, frameCount);
activeEmote = false;
MyAvatar.restoreAnimation(); } else {
}
activeEmote = emoteName;
var frameCount = ANIMATIONS[emoteName].animation.frames.length;
MyAvatar.overrideAnimation(ANIMATIONS[emoteName].url, FPS, false, 0, frameCount);
var timeOut = MSEC_PER_SEC * frameCount / FPS;
activeTimer = Script.setTimeout(function () {
MyAvatar.restoreAnimation();
activeTimer = false;
activeEmote = false;
}, timeOut);
}
} else {
activeEmote = false;
MyAvatar.restoreAnimation();
}
}
} }
} }
// If a user provides input, end the emote animation and restore the navigation animation states (idle, walk, run) // Restore the navigation animation states (idle, walk, run)
function restoreAnimation() { function restoreAnimation() {
MyAvatar.restoreAnimation(); MyAvatar.restoreAnimation();
// Make sure the input is disconnected after animations are restored so it doesn't affect any emotes other than sit
Controller.keyPressEvent.disconnect(restoreAnimation);
} }
Controller.keyPressEvent.connect(restoreAnimation);
// Note peek() so as to not interfere with other mappings. // Note peek() so as to not interfere with other mappings.
eventMapping.from(Controller.Standard.LeftPrimaryThumb).peek().to(restoreAnimation); eventMapping.from(Controller.Standard.LeftPrimaryThumb).peek().to(restoreAnimation);
eventMapping.from(Controller.Standard.RightPrimaryThumb).peek().to(restoreAnimation); eventMapping.from(Controller.Standard.RightPrimaryThumb).peek().to(restoreAnimation);
@ -137,6 +141,10 @@ eventMapping.from(Controller.Standard.LeftSecondaryThumb).peek().to(restoreAnima
eventMapping.from(Controller.Standard.RightSecondaryThumb).peek().to(restoreAnimation); eventMapping.from(Controller.Standard.RightSecondaryThumb).peek().to(restoreAnimation);
eventMapping.from(Controller.Standard.LB).peek().to(restoreAnimation); eventMapping.from(Controller.Standard.LB).peek().to(restoreAnimation);
eventMapping.from(Controller.Standard.LS).peek().to(restoreAnimation); eventMapping.from(Controller.Standard.LS).peek().to(restoreAnimation);
eventMapping.from(Controller.Standard.RY).peek().to(restoreAnimation);
eventMapping.from(Controller.Standard.RX).peek().to(restoreAnimation);
eventMapping.from(Controller.Standard.LY).peek().to(restoreAnimation);
eventMapping.from(Controller.Standard.LX).peek().to(restoreAnimation);
eventMapping.from(Controller.Standard.LeftGrip).peek().to(restoreAnimation); eventMapping.from(Controller.Standard.LeftGrip).peek().to(restoreAnimation);
eventMapping.from(Controller.Standard.RB).peek().to(restoreAnimation); eventMapping.from(Controller.Standard.RB).peek().to(restoreAnimation);
eventMapping.from(Controller.Standard.RS).peek().to(restoreAnimation); eventMapping.from(Controller.Standard.RS).peek().to(restoreAnimation);

View file

@ -98,14 +98,14 @@
</div> </div>
<div class="content"> <div class="content">
<p>Choose an emote:<p> <p>Choose an emote:<p>
<p><input type="button" class="emote-button white" value="Cry"> <p><input type="button" class="emote-button white" value="Crying">
<input type="button" class="emote-button white" value="Surprised"></p> <input type="button" class="emote-button white" value="Surprised"></p>
<p><input type="button" class="emote-button white" value="Dance"> <p><input type="button" class="emote-button white" value="Dancing">
<input type="button" class="emote-button white" value="Cheer"></p> <input type="button" class="emote-button white" value="Cheering"></p>
<p><input type="button" class="emote-button white" value="Wave"> <p><input type="button" class="emote-button white" value="Waving">
<input type="button" class="emote-button white" value="Fall"></p> <input type="button" class="emote-button white" value="Fall"></p>
<p><input type="button" class="emote-button white" value="Point"> <p><input type="button" class="emote-button white" value="Pointing">
<input type="button" class="emote-button white" value="Clap"></p> <input type="button" class="emote-button white" value="Clapping"></p>
<p><input type="button" class="emote-button white" value="Sit"> <p><input type="button" class="emote-button white" value="Sit">
<input type="button" class="emote-button white" value="Love"></p> <input type="button" class="emote-button white" value="Love"></p>
</div> </div>