Save Fault Info to Database
This commit is contained in:
@@ -57,7 +57,7 @@ void FaultManager::StartGPS()
|
||||
gps->startUpdates();
|
||||
}
|
||||
|
||||
void FaultManager::SaveImage()
|
||||
void FaultManager::SaveImage(QByteArray *imageBuffer)
|
||||
{
|
||||
QSqlQuery query;
|
||||
|
||||
@@ -65,14 +65,17 @@ void FaultManager::SaveImage()
|
||||
QGeoPositionInfo position = gps->lastKnownPosition(true);
|
||||
QGeoCoordinate coorinate = position.coordinate();
|
||||
|
||||
qInfo() << coorinate.isValid();
|
||||
qInfo() << coorinate.longitude();
|
||||
qInfo() << coorinate.latitude();
|
||||
qInfo() << coorinate.altitude();
|
||||
|
||||
// Save Image to Filesystem
|
||||
//QSaveFile
|
||||
query.prepare("INSERT INTO Faults (latitude, longitude, altitude, image) "
|
||||
"VALUES (:latitude, :longitude, :altitude, :image)");
|
||||
if (coorinate.isValid())
|
||||
{
|
||||
// This probably wont work without proper converstions
|
||||
query.bindValue(":latitude", coorinate.latitude());
|
||||
query.bindValue(":longitude", coorinate.longitude());
|
||||
query.bindValue(":altitude", coorinate.altitude());
|
||||
}
|
||||
query.bindValue(":image", *imageBuffer);
|
||||
|
||||
// Save to Database
|
||||
//query.exec("INSERT");
|
||||
query.exec();
|
||||
}
|
||||
Reference in New Issue
Block a user