Exemplo n.º 1
0
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());
    }
}
Exemplo n.º 2
0
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.");
    }
}