// MainWindow::instance()->showCriticalMessage(tr("FlightGear Failed to Start"), tr("FlightGear was not found at %1").arg(processFgfs));
// sane = false;
// }
// QFileInfo root(fgRoot);
// if (!root.isDir())
// {
// MainWindow::instance()->showCriticalMessage(tr("FlightGear Failed to Start"), tr("FlightGear data directory was not found at %1").arg(fgRoot));
// sane = false;
// }
// QFileInfo scenery(fgScenery);
// if (!scenery.isDir())
// {
// MainWindow::instance()->showCriticalMessage(tr("FlightGear Failed to Start"), tr("FlightGear scenery directory was not found at %1").arg(fgScenery));
flightGearArguments<<QString("--fg-scenery=%1:%2").arg(fgScenery).arg(terraSyncScenery);//according to http://wiki.flightgear.org/TerraSync a separate directory is used
MainWindow::instance()->showCriticalMessage(tr("FlightGear/TerraSync Failed to Start"),tr("Please check if the path and command is correct"));
emitshowCriticalMessageFromThread(tr("FlightGear Failed to Start"),_fgProcess->errorString());
break;
caseQProcess::Crashed:
MainWindow::instance()->showCriticalMessage(tr("FlightGear/TerraSync Crashed"),tr("This is a FlightGear-related problem. Please upgrade FlightGear"));
emitshowCriticalMessageFromThread(tr("FlightGear Crashed"),tr("This is a FlightGear-related problem. Please upgrade FlightGear"));
break;
caseQProcess::Timedout:
MainWindow::instance()->showCriticalMessage(tr("FlightGear/TerraSync Start Timed Out"),tr("Please check if the path and command is correct"));
emitshowCriticalMessageFromThread(tr("FlightGear Start Timed Out"),tr("Please check if the path and command is correct"));
break;
caseQProcess::WriteError:
MainWindow::instance()->showCriticalMessage(tr("Could not Communicate with FlightGear/TerraSync"),tr("Please check if the path and command is correct"));
emitshowCriticalMessageFromThread(tr("Could not Communicate with FlightGear"),tr("Please check if the path and command is correct"));
break;
caseQProcess::ReadError:
MainWindow::instance()->showCriticalMessage(tr("Could not Communicate with FlightGear/TerraSync"),tr("Please check if the path and command is correct"));
emitshowCriticalMessageFromThread(tr("Could not Communicate with FlightGear"),tr("Please check if the path and command is correct"));
break;
caseQProcess::UnknownError:
default:
MainWindow::instance()->showCriticalMessage(tr("FlightGear/TerraSync Error"),tr("Please check if the path and command is correct."));
emitshowCriticalMessageFromThread(tr("FlightGear Error"),tr("Please check if the path and command is correct."));
break;
}
}
...
...
@@ -393,13 +237,13 @@ void QGCFlightGearLink::updateControls(quint64 time, float rollAilerons, float p
// See if we can find an --fg-root directory from the proposed list.
Q_ASSERT(fgRootPath.isEmpty());
for(inti=0;i<fgRootPathProposedList.count();i++){
fgRootPath=fgRootPathProposedList[i];
if(QFileInfo(fgRootPath).isDir()){
// We found it
break;
}else{
fgRootPath.clear();
}
}
// Alert the user if we couldn't find an --fg-root
if(fgRootPath.isEmpty()){
QStringerrMsg;
if(fgRootDirOverride){
errMsg=tr("--fg-root directory specified from ui option not found: %1").arg(fgRootPath);
}elseif(fgRootPath.isEmpty()){
errMsg=tr("Unable to automatically determine --fg-root directory location. You will need to specify --fg-root=<directory> as an additional command line parameter from ui.");
// Windows won't start without an --fg-scenery set. We don't validate the directory in the path since
// it can be multiple paths.
if(fgSceneryPath.isEmpty()){
QStringerrMsg;
if(fgSceneryDirOverride){
errMsg=tr("--fg-scenery directory specified from ui option not found: %1").arg(fgSceneryPath);
}else{
errMsg=tr("Unable to automatically determine --fg-scenery directory location. You will need to specify --fg-scenery=directory as an additional command line parameter from ui.");
// Verify directory where FlightGear stores communicaton protocols.
QDirfgProtocolDir(fgRootPath);
if(!fgProtocolDir.cd("Protocol")){
MainWindow::instance()->showCriticalMessage(tr("Incorrect FlightGear setup"),tr("Protocol directory is missing: '%1'. Command line parameter for --fg-root may be set incorrectly.").arg(fgProtocolDir.path()));
returnfalse;
}
// Verify directory which contains QGC provided FlightGear communication protocol files
tr("FlightGear Failed to Start. QGroundControl protocol (%1) not installed to FlightGear Protocol directory (%2)").arg(fgProtocolXmlFile).arg(fgProtocolDir.path()),
QMessageBox::Cancel,
MainWindow::instance());
msgBox.setWindowModality(Qt::ApplicationModal);
msgBox.addButton(tr("Fix it for me"),QMessageBox::ActionRole);
if(msgBox.exec()==QMessageBox::Cancel){
returnfalse;
}
// Make sure we can find the communication protocol file in QGC install before we attempt to copy to FlightGear
tr("Copy from (%1) to (%2) failed, possibly due to permissions issue. You will need to perform manually. Try pasting the following command into a Command Prompt which was started with Run as Administrator:\n\n").arg(qgcProtocolFileFullyQualified).arg(fgProtocolFileFullyQualified)+copyCmd,
#else
tr("Copy from (%1) to (%2) failed, possibly due to permissions issue. You will need to perform manually. Try pasting the following command into a shell:\n\n").arg(qgcProtocolFileFullyQualified).arg(fgProtocolFileFullyQualified)+copyCmd,
#endif
QMessageBox::Cancel,
MainWindow::instance());
msgBox.setWindowModality(Qt::ApplicationModal);
msgBox.addButton(tr("Copy to Clipboard"),QMessageBox::ActionRole);