MainWindow::instance()->showCriticalMessage(tr("Error loading waypoint file"),tr("The waypoint file is not compatible with the current version of QGroundControl."));
}
else
{
while(!in.atEnd())
{
t->setId(waypoints.size());
waypoints.insert(waypoints.size(),t);
Waypoint*t=newWaypoint();
if(t->load(in))
{
t->setId(waypoints.size());
waypoints.insert(waypoints.size(),t);
}
else
{
MainWindow::instance()->showCriticalMessage(tr("Error loading waypoint file"),tr("The waypoint file is corrupted. Load operation only partly succesful."));
//TODO: Why not replace with waypoint_buffer.clear() ?
//TODO: Why not replace with waypoint_buffer.clear() ? - because this will lead to memory leaks, the waypoint-structs have to be deleted, clear() would only delete the pointers.