tr("Flight Gear protocol file '%1' is out of date. Quit %2. Delete the file and restart %2 to fix.").arg(_fgProtocolFileFullyQualified).arg(qgcApp()->applicationName()));
xmag_body,ymag_body,zmag_body,abs_pressure*1e-2f,diff_pressure*1e-2f,pressure_alt,temperature,fields_changed);//Pressure in hPa for _vehicle->uas()link
// 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")){
QGCMessageBox::critical(tr("FlightGear HIL"),tr("Incorrect FlightGear setup. 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
// Verify that the file is current by comparing it against the one in QGC
QFilefgFile(_fgProtocolFileFullyQualified);
QFileqgcFile(qgcProtocolFileFullyQualified);
if(!fgFile.open(QIODevice::ReadOnly)||
!qgcFile.open(QIODevice::ReadOnly)){
QGCMessageBox::warning(tr("FlightGear HIL"),tr("Unable to verify that protocol file %1 is current. "
"If file is out of date, you may experience problems. "
"Safest approach is to delete the file manually and allow %2 install the latest file.").arg(qgcApp()->applicationName()).arg(_fgProtocolFileFullyQualified));
}
QByteArrayfgBytes=fgFile.readAll();
QByteArrayqgcBytes=qgcFile.readAll();
fgFile.close();
qgcFile.close();
if(fgBytes!=qgcBytes){
QGCMessageBox::warning(tr("FlightGear HIL"),tr("FlightGear protocol file %1 is out of date. It will be deleted, which will cause %2 to install the latest version of the file.").arg(_fgProtocolFileFullyQualified).arg(qgcApp()->applicationName()));
tr("FlightGear Failed to Start. %1 protocol (%2) not installed to FlightGear Protocol directory (%3)").arg(qgcApp()->applicationName()).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;
}
// Now that we made it this far, we should be able to try to copy the protocol file 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);
//@TODO Update the rest of the plot and update drawing
windowLock.unlock();
}
/**
* @brief Get the time window position
* The position marks the right edge of the plot window
*
* @return The position of the plot window, in milliseconds
**/
quint64LinechartPlot::getWindowPosition()
{
returnplotPosition;
}
/**
* @brief Set the scaling of the (vertical) y axis
* The mapping of the variable values on the drawing pane can be
* adjusted with this method. The default is that the y axis will the chosen
* to fit all curves in their normal base units. This can however hide all
* details if large differences in the data values exist.
*
* The scaling can be changed to best fit, which fits all curves in a +100 to -100 interval.
* The logarithmic scaling does not fit the variables, but instead applies a log10
* scaling to all variables.
*
* @param scaling LinechartPlot::SCALE_ABSOLUTE for linear scaling, LinechartPlot::SCALE_BEST_FIT for the best fit scaling and LinechartPlot::SCALE_LOGARITHMIC for the logarithmic scaling.
**/
voidLinechartPlot::setScaling(intscaling)
{
this->scaling=scaling;
switch(scaling){
caseLinechartPlot::SCALE_ABSOLUTE:
setLinearScaling();
break;
caseLinechartPlot::SCALE_LOGARITHMIC:
setLogarithmicScaling();
break;
}
}
/**
* @brief Change the visibility of a curve
*
* @param id The string id of the curve
* @param visible The visibility: True to make it visible
timeButton->setToolTip(tr("Overwrite timestamp of data from vehicle with ground receive time. Helps if the plots are not visible because of missing or invalid onboard time."));
timeButton->setWhatsThis(tr("Overwrite timestamp of data from vehicle with ground receive time. Helps if the plots are not visible because of missing or invalid onboard time."));