hook to request user's location from data-server

This commit is contained in:
Stephen Birarda 2014-02-21 16:55:20 -08:00
parent 625299e6e6
commit 52a21d4dfd
4 changed files with 13 additions and 3 deletions

View file

@ -1049,8 +1049,14 @@ void Menu::goTo() {
// go to coordinate destination or to Username
if (!goToDestination(destination)) {
// there's a username entered by the user, make a request to the data-server
JSONCallbackParameters callbackParams;
callbackParams.jsonCallbackReceiver = Application::getInstance()->getAvatar();
callbackParams.jsonCallbackMethod = "goToLocationFromResponse";
// there's a username entered by the user, make a request to the data-server for the associated location
AccountManager::getInstance().authenticatedRequest("/api/v1/users/" + gotoDialog.textValue() + "/location",
QNetworkAccessManager::GetOperation,
callbackParams);
}
}

View file

@ -1200,3 +1200,6 @@ void MyAvatar::updateLocationInDataServer() {
}
}
void MyAvatar::goToLocationFromResponse(const QJsonObject& jsonObject) {
qDebug() << jsonObject;
}

View file

@ -90,6 +90,7 @@ public slots:
void resetSize();
void updateLocationInDataServer();
void goToLocationFromResponse(const QJsonObject& jsonObject);
// Set/Get update the thrust that will move the avatar around
void addThrust(glm::vec3 newThrust) { _thrust += newThrust; };

View file

@ -38,7 +38,7 @@ public:
static AccountManager& getInstance();
void authenticatedRequest(const QString& path,
QNetworkAccessManager::Operation operation,
QNetworkAccessManager::Operation operation = QNetworkAccessManager::GetOperation,
const JSONCallbackParameters& callbackParams = JSONCallbackParameters(),
const QByteArray& dataByteArray = QByteArray());