Пример #1
0
void LocationEditor::setGeography(qint32 lid, double longitude, double latitude, double altitude, QString placeName) {
    this->startLongitude = longitude;
    this->startLatitude = latitude;
    this->startAltitude = altitude;
    currentLid = lid;

    Note n;
    NoteTable ntable(global.db);
    ntable.get(n, lid, false, false);
    NoteAttributes attributes;
    if (n.attributes.isSet())
        attributes = n.attributes;
    if (!attributes.latitude.isSet() || !attributes.longitude.isSet())
        return;

    if (placeName == "") {
        LocationDialog dialog;
        dialog.setLongitude(this->startLongitude);
        dialog.setLatitude(this->startLatitude);
        dialog.setAltitude(this->startAltitude);
        this->setText(dialog.locationText());
    } else
        this->setText(placeName);
}
Пример #2
0
void LocationEditor::buttonClicked() {
    LocationDialog dialog;
    dialog.setLongitude(this->startLongitude);
    dialog.setLatitude(this->startLatitude);
    dialog.setAltitude(this->startAltitude);
    dialog.exec();

    double lon = dialog.getLongitude();
    double lat = dialog.getLatitude();
    double alt = dialog.getAltitude();
    startAltitude = alt;
    startLongitude = lon;
    startLatitude = lat;
    if (dialog.okPressed()) {
        NoteTable ntable(global.db);
        if (lon == 0.0 && lat == 0.0) {
            setText(defaultText);
            ntable.resetGeography(currentLid, true);
            return;
        }
        this->setText(dialog.locationText());
        ntable.setGeography(currentLid, lon,lat,alt, true);
    }
}