QStringfileName=QFileDialog::getOpenFileName(this,tr("Specify MAVLink log file name"),QDesktopServices::storageLocation(QDesktopServices::DesktopLocation),tr("MAVLink or Binary Logfile (*.mavlink *.bin)"));
QStringfileName=QFileDialog::getOpenFileName(this,tr("Specify MAVLink log file name to replay"),QDesktopServices::storageLocation(QDesktopServices::DesktopLocation),tr("MAVLink or Binary Logfile (*.mavlink *.bin *.log)"));
MainWindow::instance()->showInfoMessage(tr("MAVLink Logging Stopped during Replay"),tr("MAVLink logging has been stopped during the log replay. To re-enable logging, use the link properties in the communication menu."));
}
// Ensure that the playback process is stopped
if(logFile.isOpen()){
if(logFile.isOpen())
{
pause();
logFile.close();
}
logFile.setFileName(file);
if(!logFile.open(QFile::ReadOnly)){
if(!logFile.open(QFile::ReadOnly))
{
MainWindow::instance()->showCriticalMessage(tr("The selected logfile is unreadable"),tr("Please make sure that the file %1 is readable or select a different file").arg(file));
// Check if the correct number of bytes could be read
if(startBytes.length()!=timeLen){
if(startBytes.length()!=timeLen)
{
ui->logStatsLabel->setText(tr("Error reading first %1 bytes").arg(timeLen));
MainWindow::instance()->showCriticalMessage(tr("Failed loading MAVLink Logfile"),tr("Error reading first %1 bytes from logfile. Got %2 instead of %1 bytes. Is the logfile readable?").arg(timeLen).arg(startBytes.length()));
// Check if these bytes could be correctly decoded
if(!ok){
if(!ok)
{
ui->logStatsLabel->setText(tr("Error decoding first timestamp, aborting."));
MainWindow::instance()->showCriticalMessage(tr("Failed loading MAVLink Logfile"),tr("Could not load initial timestamp from file %1. Is the file corrupted?").arg(logFile.fileName()));