void LocationManager::goToAddressFromResponse(const QJsonObject& responseData) { QJsonValue status = responseData["status"]; const QJsonObject& data = responseData["data"].toObject(); const QJsonValue& userObject = data["user"]; const QJsonValue& placeObject = data["place"]; if (!placeObject.isUndefined() && !userObject.isUndefined()) { emit multipleDestinationsFound(userObject.toObject(), placeObject.toObject()); } else if (placeObject.isUndefined()) { Application::getInstance()->getAvatar()->goToLocationFromAddress(userObject.toObject()["address"].toObject()); } else { Application::getInstance()->getAvatar()->goToLocationFromAddress(placeObject.toObject()["address"].toObject()); } }
void LocationManager::goToAddressFromResponse(const QJsonObject& responseData) { QJsonValue status = responseData["status"]; qDebug() << responseData; if (!status.isUndefined() && status.toString() == "success") { const QJsonObject& data = responseData["data"].toObject(); const QJsonValue& userObject = data["user"]; const QJsonValue& placeObject = data["place"]; if (!placeObject.isUndefined() && !userObject.isUndefined()) { emit multipleDestinationsFound(userObject.toObject(), placeObject.toObject()); } else if (placeObject.isUndefined()) { Application::getInstance()->getAvatar()->goToLocationFromAddress(userObject.toObject()["address"].toObject()); } else { Application::getInstance()->getAvatar()->goToLocationFromAddress(placeObject.toObject()["address"].toObject()); } } else { QMessageBox::warning(Application::getInstance()->getWindow(), "", "That user or location could not be found."); } }