Commit 284a2c08 authored by DoinLakeFlyer's avatar DoinLakeFlyer

App messages now use simple modal message dialogs. Vehicle messages continue to use non-modal popup.
parent 9e8a5dcb
...@@ -66,7 +66,7 @@ void ADSBVehicleManager::adsbVehicleUpdate(const ADSBVehicle::VehicleInfo_t vehi ...@@ -66,7 +66,7 @@ void ADSBVehicleManager::adsbVehicleUpdate(const ADSBVehicle::VehicleInfo_t vehi
void ADSBVehicleManager::_tcpError(const QString errorMsg) void ADSBVehicleManager::_tcpError(const QString errorMsg)
{ {
qgcApp()->showMessage(tr("ADSB Server Error: %1").arg(errorMsg)); qgcApp()->showAppMessage(tr("ADSB Server Error: %1").arg(errorMsg));
} }
......
...@@ -89,7 +89,7 @@ void ...@@ -89,7 +89,7 @@ void
AirMapManager::_error(const QString& what, const QString& airmapdMessage, const QString& airmapdDetails) AirMapManager::_error(const QString& what, const QString& airmapdMessage, const QString& airmapdDetails)
{ {
qCDebug(AirMapManagerLog) << "Error: "<<what<<", msg: "<<airmapdMessage<<", details: "<<airmapdDetails; qCDebug(AirMapManagerLog) << "Error: "<<what<<", msg: "<<airmapdMessage<<", details: "<<airmapdDetails;
qgcApp()->showMessage(QString("Error: %1. %2").arg(what).arg(airmapdMessage)); qgcApp()->showAppMessage(QString("Error: %1. %2").arg(what).arg(airmapdMessage));
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
......
...@@ -254,7 +254,7 @@ void APMAirframeComponentController::_githubJsonDownloadFinished(QString remoteF ...@@ -254,7 +254,7 @@ void APMAirframeComponentController::_githubJsonDownloadFinished(QString remoteF
void APMAirframeComponentController::_githubJsonDownloadError(QString errorMsg) void APMAirframeComponentController::_githubJsonDownloadError(QString errorMsg)
{ {
qgcApp()->showMessage(tr("Param file github json download failed: %1").arg(errorMsg)); qgcApp()->showAppMessage(tr("Param file github json download failed: %1").arg(errorMsg));
qgcApp()->restoreOverrideCursor(); qgcApp()->restoreOverrideCursor();
} }
...@@ -267,7 +267,7 @@ void APMAirframeComponentController::_paramFileDownloadFinished(QString remoteFi ...@@ -267,7 +267,7 @@ void APMAirframeComponentController::_paramFileDownloadFinished(QString remoteFi
void APMAirframeComponentController::_paramFileDownloadError(QString errorMsg) void APMAirframeComponentController::_paramFileDownloadError(QString errorMsg)
{ {
qgcApp()->showMessage(tr("Param file download failed: %1").arg(errorMsg)); qgcApp()->showAppMessage(tr("Param file download failed: %1").arg(errorMsg));
qgcApp()->restoreOverrideCursor(); qgcApp()->restoreOverrideCursor();
} }
......
...@@ -218,7 +218,7 @@ void APMAutoPilotPlugin::_checkForBadCubeBlack(void) ...@@ -218,7 +218,7 @@ void APMAutoPilotPlugin::_checkForBadCubeBlack(void)
if (paramMgr->parameterExists(-1, paramAcc3) && paramMgr->getParameter(-1, paramAcc3)->rawValue().toInt() == 0 && if (paramMgr->parameterExists(-1, paramAcc3) && paramMgr->getParameter(-1, paramAcc3)->rawValue().toInt() == 0 &&
paramMgr->parameterExists(-1, paramGyr3) && paramMgr->getParameter(-1, paramGyr3)->rawValue().toInt() == 0 && paramMgr->parameterExists(-1, paramGyr3) && paramMgr->getParameter(-1, paramGyr3)->rawValue().toInt() == 0 &&
paramMgr->parameterExists(-1, paramEnableMask) && paramMgr->getParameter(-1, paramEnableMask)->rawValue().toInt() >= 7) { paramMgr->parameterExists(-1, paramEnableMask) && paramMgr->getParameter(-1, paramEnableMask)->rawValue().toInt() >= 7) {
qgcApp()->showMessage(tr("WARNING: The flight board you are using has a critical service bulletin against it which advises against flying. For details see: https://discuss.cubepilot.org/t/sb-0000002-critical-service-bulletin-for-cubes-purchased-between-january-2019-to-present-do-not-fly/406")); qgcApp()->showAppMessage(tr("WARNING: The flight board you are using has a critical service bulletin against it which advises against flying. For details see: https://discuss.cubepilot.org/t/sb-0000002-critical-service-bulletin-for-cubes-purchased-between-january-2019-to-present-do-not-fly/406"));
} }
} }
......
...@@ -196,7 +196,7 @@ void APMSensorsComponentController::_stopCalibration(APMSensorsComponentControll ...@@ -196,7 +196,7 @@ void APMSensorsComponentController::_stopCalibration(APMSensorsComponentControll
default: default:
// Assume failed // Assume failed
_hideAllCalAreas(); _hideAllCalAreas();
qgcApp()->showMessage(tr("Calibration failed. Calibration log will be displayed.")); qgcApp()->showAppMessage(tr("Calibration failed. Calibration log will be displayed."));
break; break;
} }
......
...@@ -71,7 +71,7 @@ void AutoPilotPlugin::parametersReadyPreChecks(void) ...@@ -71,7 +71,7 @@ void AutoPilotPlugin::parametersReadyPreChecks(void)
} }
if (!_setupComplete) { if (!_setupComplete) {
qgcApp()->showMessage(tr("One or more vehicle components require setup prior to flight.")); qgcApp()->showAppMessage(tr("One or more vehicle components require setup prior to flight."));
// Take the user to Vehicle Summary // Take the user to Vehicle Summary
qgcApp()->showSetupView(); qgcApp()->showSetupView();
......
...@@ -288,7 +288,7 @@ void RadioComponentController::nextButtonClicked(void) ...@@ -288,7 +288,7 @@ void RadioComponentController::nextButtonClicked(void)
if (_unitTestMode) { if (_unitTestMode) {
emit nextButtonMessageBoxDisplayed(); emit nextButtonMessageBoxDisplayed();
} else { } else {
qgcApp()->showMessage(QString("Detected %1 radio channels. To operate PX4, you need at least %2 channels.").arg(_chanCount).arg(_chanMinimum)); qgcApp()->showAppMessage(QString("Detected %1 radio channels. To operate PX4, you need at least %2 channels.").arg(_chanCount).arg(_chanMinimum));
} }
return; return;
} }
......
...@@ -85,7 +85,7 @@ AirframeComponentController::~AirframeComponentController() ...@@ -85,7 +85,7 @@ AirframeComponentController::~AirframeComponentController()
void AirframeComponentController::changeAutostart(void) void AirframeComponentController::changeAutostart(void)
{ {
if (qgcApp()->toolbox()->multiVehicleManager()->vehicles()->count() > 1) { if (qgcApp()->toolbox()->multiVehicleManager()->vehicles()->count() > 1) {
qgcApp()->showMessage(tr("You cannot change airframe configuration while connected to multiple vehicles.")); qgcApp()->showAppMessage(tr("You cannot change airframe configuration while connected to multiple vehicles."));
return; return;
} }
......
...@@ -132,7 +132,7 @@ void PX4AutoPilotPlugin::parametersReadyPreChecks(void) ...@@ -132,7 +132,7 @@ void PX4AutoPilotPlugin::parametersReadyPreChecks(void)
QString hitlParam("SYS_HITL"); QString hitlParam("SYS_HITL");
if (_vehicle->parameterManager()->parameterExists(FactSystem::defaultComponentId, hitlParam) && if (_vehicle->parameterManager()->parameterExists(FactSystem::defaultComponentId, hitlParam) &&
_vehicle->parameterManager()->getParameter(FactSystem::defaultComponentId, hitlParam)->rawValue().toBool()) { _vehicle->parameterManager()->getParameter(FactSystem::defaultComponentId, hitlParam)->rawValue().toBool()) {
qgcApp()->showMessage(tr("Warning: Hardware In The Loop (HITL) simulation is enabled for this vehicle.")); qgcApp()->showAppMessage(tr("Warning: Hardware In The Loop (HITL) simulation is enabled for this vehicle."));
} }
} }
......
...@@ -179,7 +179,7 @@ void SensorsComponentController::_stopCalibration(SensorsComponentController::St ...@@ -179,7 +179,7 @@ void SensorsComponentController::_stopCalibration(SensorsComponentController::St
default: default:
// Assume failed // Assume failed
_hideAllCalAreas(); _hideAllCalAreas();
qgcApp()->showMessage(tr("Calibration failed. Calibration log will be displayed.")); qgcApp()->showAppMessage(tr("Calibration failed. Calibration log will be displayed."));
break; break;
} }
......
...@@ -742,9 +742,9 @@ void Fact::_checkForRebootMessaging(void) ...@@ -742,9 +742,9 @@ void Fact::_checkForRebootMessaging(void)
if(qgcApp()) { if(qgcApp()) {
if (!qgcApp()->runningUnitTests()) { if (!qgcApp()->runningUnitTests()) {
if (vehicleRebootRequired()) { if (vehicleRebootRequired()) {
qgcApp()->showMessage(tr("Change of parameter %1 requires a Vehicle reboot to take effect.").arg(name())); qgcApp()->showAppMessage(tr("Change of parameter %1 requires a Vehicle reboot to take effect.").arg(name()));
} else if (qgcRebootRequired()) { } else if (qgcRebootRequired()) {
qgcApp()->showMessage(tr("Change of '%1' value requires restart of %2 to take effect.").arg(shortDescription()).arg(qgcApp()->applicationName())); qgcApp()->showAppMessage(tr("Change of '%1' value requires restart of %2 to take effect.").arg(shortDescription()).arg(qgcApp()->applicationName()));
} }
} }
} }
......
...@@ -120,7 +120,7 @@ void FactPanelController::_showInternalError(const QString& errorMsg) ...@@ -120,7 +120,7 @@ void FactPanelController::_showInternalError(const QString& errorMsg)
{ {
_notifyPanelErrorMsg(tr("Internal Error: %1").arg(errorMsg)); _notifyPanelErrorMsg(tr("Internal Error: %1").arg(errorMsg));
qCWarning(FactPanelControllerLog) << "Internal Error" << errorMsg; qCWarning(FactPanelControllerLog) << "Internal Error" << errorMsg;
qgcApp()->showMessage(errorMsg); qgcApp()->showAppMessage(errorMsg);
} }
void FactPanelController::getMissingParameters(QStringList rgNames) void FactPanelController::getMissingParameters(QStringList rgNames)
......
...@@ -782,7 +782,7 @@ void ParameterManager::_waitingParamTimeout(void) ...@@ -782,7 +782,7 @@ void ParameterManager::_waitingParamTimeout(void)
_waitingWriteParamNameMap[componentId].remove(paramName); _waitingWriteParamNameMap[componentId].remove(paramName);
QString errorMsg = tr("Parameter write failed: veh:%1 comp:%2 param:%3").arg(_vehicle->id()).arg(componentId).arg(paramName); QString errorMsg = tr("Parameter write failed: veh:%1 comp:%2 param:%3").arg(_vehicle->id()).arg(componentId).arg(paramName);
qCDebug(ParameterManagerLog) << errorMsg; qCDebug(ParameterManagerLog) << errorMsg;
qgcApp()->showMessage(errorMsg); qgcApp()->showAppMessage(errorMsg);
} }
} }
} }
...@@ -804,7 +804,7 @@ void ParameterManager::_waitingParamTimeout(void) ...@@ -804,7 +804,7 @@ void ParameterManager::_waitingParamTimeout(void)
_waitingReadParamNameMap[componentId].remove(paramName); _waitingReadParamNameMap[componentId].remove(paramName);
QString errorMsg = tr("Parameter read failed: veh:%1 comp:%2 param:%3").arg(_vehicle->id()).arg(componentId).arg(paramName); QString errorMsg = tr("Parameter read failed: veh:%1 comp:%2 param:%3").arg(_vehicle->id()).arg(componentId).arg(paramName);
qCDebug(ParameterManagerLog) << errorMsg; qCDebug(ParameterManagerLog) << errorMsg;
qgcApp()->showMessage(errorMsg); qgcApp()->showAppMessage(errorMsg);
} }
} }
} }
...@@ -1029,7 +1029,7 @@ void ParameterManager::_tryCacheHashLoad(int vehicleId, int componentId, QVarian ...@@ -1029,7 +1029,7 @@ void ParameterManager::_tryCacheHashLoad(int vehicleId, int componentId, QVarian
for (const QString& name: cacheMap.keys()) { for (const QString& name: cacheMap.keys()) {
_debugCacheParamSeen[componentId][name] = false; _debugCacheParamSeen[componentId][name] = false;
} }
qgcApp()->showMessage(tr("Parameter cache CRC match failed")); qgcApp()->showAppMessage(tr("Parameter cache CRC match failed"));
} }
} }
} }
...@@ -1296,7 +1296,7 @@ void ParameterManager::_checkInitialLoadComplete(void) ...@@ -1296,7 +1296,7 @@ void ParameterManager::_checkInitialLoadComplete(void)
"If you are using modified firmware, you may need to resolve any vehicle startup errors to resolve the issue. " "If you are using modified firmware, you may need to resolve any vehicle startup errors to resolve the issue. "
"If you are using standard firmware, you may need to upgrade to a newer version to resolve the issue.").arg(qgcApp()->applicationName()).arg(_vehicle->id()); "If you are using standard firmware, you may need to upgrade to a newer version to resolve the issue.").arg(qgcApp()->applicationName()).arg(_vehicle->id());
qCDebug(ParameterManagerLog) << errorMsg; qCDebug(ParameterManagerLog) << errorMsg;
qgcApp()->showMessage(errorMsg); qgcApp()->showAppMessage(errorMsg);
if (!qgcApp()->runningUnitTests()) { if (!qgcApp()->runningUnitTests()) {
qCWarning(ParameterManagerLog) << _logVehiclePrefix(-1) << "The following parameter indices could not be loaded after the maximum number of retries: " << indexList; qCWarning(ParameterManagerLog) << _logVehiclePrefix(-1) << "The following parameter indices could not be loaded after the maximum number of retries: " << indexList;
} }
...@@ -1320,7 +1320,7 @@ void ParameterManager::_initialRequestTimeout(void) ...@@ -1320,7 +1320,7 @@ void ParameterManager::_initialRequestTimeout(void)
QString errorMsg = tr("Vehicle %1 did not respond to request for parameters. " QString errorMsg = tr("Vehicle %1 did not respond to request for parameters. "
"This will cause %2 to be unable to display its full user interface.").arg(_vehicle->id()).arg(qgcApp()->applicationName()); "This will cause %2 to be unable to display its full user interface.").arg(_vehicle->id()).arg(qgcApp()->applicationName());
qCDebug(ParameterManagerLog) << errorMsg; qCDebug(ParameterManagerLog) << errorMsg;
qgcApp()->showMessage(errorMsg); qgcApp()->showAppMessage(errorMsg);
} }
} }
} }
......
...@@ -397,7 +397,7 @@ bool APMFirmwarePlugin::_handleIncomingStatusText(Vehicle* vehicle, mavlink_mess ...@@ -397,7 +397,7 @@ bool APMFirmwarePlugin::_handleIncomingStatusText(Vehicle* vehicle, mavlink_mess
if (supportedMajorNumber != -1) { if (supportedMajorNumber != -1) {
if (firmwareVersion.majorNumber() < supportedMajorNumber || if (firmwareVersion.majorNumber() < supportedMajorNumber ||
(firmwareVersion.majorNumber() == supportedMajorNumber && firmwareVersion.minorNumber() < supportedMinorNumber)) { (firmwareVersion.majorNumber() == supportedMajorNumber && firmwareVersion.minorNumber() < supportedMinorNumber)) {
qgcApp()->showMessage(tr("QGroundControl fully supports Version %1.%2 and above. You are using a version prior to that. This combination is untested, you may run into unpredictable results.").arg(supportedMajorNumber).arg(supportedMinorNumber)); qgcApp()->showAppMessage(tr("QGroundControl fully supports Version %1.%2 and above. You are using a version prior to that. This combination is untested, you may run into unpredictable results.").arg(supportedMajorNumber).arg(supportedMinorNumber));
} }
} }
} }
...@@ -798,7 +798,7 @@ void APMFirmwarePlugin::_soloVideoHandshake(Vehicle* vehicle, bool originalSoloF ...@@ -798,7 +798,7 @@ void APMFirmwarePlugin::_soloVideoHandshake(Vehicle* vehicle, bool originalSoloF
void APMFirmwarePlugin::_artooSocketError(QAbstractSocket::SocketError socketError) void APMFirmwarePlugin::_artooSocketError(QAbstractSocket::SocketError socketError)
{ {
qgcApp()->showMessage(tr("Error during Solo video link setup: %1").arg(socketError)); qgcApp()->showAppMessage(tr("Error during Solo video link setup: %1").arg(socketError));
} }
QString APMFirmwarePlugin::internalParameterMetaDataFile(Vehicle* vehicle) QString APMFirmwarePlugin::internalParameterMetaDataFile(Vehicle* vehicle)
...@@ -888,7 +888,7 @@ void APMFirmwarePlugin::pauseVehicle(Vehicle* vehicle) ...@@ -888,7 +888,7 @@ void APMFirmwarePlugin::pauseVehicle(Vehicle* vehicle)
void APMFirmwarePlugin::guidedModeGotoLocation(Vehicle* vehicle, const QGeoCoordinate& gotoCoord) void APMFirmwarePlugin::guidedModeGotoLocation(Vehicle* vehicle, const QGeoCoordinate& gotoCoord)
{ {
if (qIsNaN(vehicle->altitudeRelative()->rawValue().toDouble())) { if (qIsNaN(vehicle->altitudeRelative()->rawValue().toDouble())) {
qgcApp()->showMessage(QStringLiteral("Unable to go to location, vehicle position not known.")); qgcApp()->showAppMessage(QStringLiteral("Unable to go to location, vehicle position not known."));
return; return;
} }
...@@ -908,7 +908,7 @@ void APMFirmwarePlugin::guidedModeRTL(Vehicle* vehicle, bool smartRTL) ...@@ -908,7 +908,7 @@ void APMFirmwarePlugin::guidedModeRTL(Vehicle* vehicle, bool smartRTL)
void APMFirmwarePlugin::guidedModeChangeAltitude(Vehicle* vehicle, double altitudeChange) void APMFirmwarePlugin::guidedModeChangeAltitude(Vehicle* vehicle, double altitudeChange)
{ {
if (qIsNaN(vehicle->altitudeRelative()->rawValue().toDouble())) { if (qIsNaN(vehicle->altitudeRelative()->rawValue().toDouble())) {
qgcApp()->showMessage(tr("Unable to change altitude, vehicle altitude not known.")); qgcApp()->showAppMessage(tr("Unable to change altitude, vehicle altitude not known."));
return; return;
} }
...@@ -968,13 +968,13 @@ double APMFirmwarePlugin::minimumTakeoffAltitude(Vehicle* vehicle) ...@@ -968,13 +968,13 @@ double APMFirmwarePlugin::minimumTakeoffAltitude(Vehicle* vehicle)
bool APMFirmwarePlugin::_guidedModeTakeoff(Vehicle* vehicle, double altitudeRel) bool APMFirmwarePlugin::_guidedModeTakeoff(Vehicle* vehicle, double altitudeRel)
{ {
if (!vehicle->multiRotor() && !vehicle->vtol()) { if (!vehicle->multiRotor() && !vehicle->vtol()) {
qgcApp()->showMessage(tr("Vehicle does not support guided takeoff")); qgcApp()->showAppMessage(tr("Vehicle does not support guided takeoff"));
return false; return false;
} }
double vehicleAltitudeAMSL = vehicle->altitudeAMSL()->rawValue().toDouble(); double vehicleAltitudeAMSL = vehicle->altitudeAMSL()->rawValue().toDouble();
if (qIsNaN(vehicleAltitudeAMSL)) { if (qIsNaN(vehicleAltitudeAMSL)) {
qgcApp()->showMessage(tr("Unable to takeoff, vehicle position not known.")); qgcApp()->showAppMessage(tr("Unable to takeoff, vehicle position not known."));
return false; return false;
} }
...@@ -984,12 +984,12 @@ bool APMFirmwarePlugin::_guidedModeTakeoff(Vehicle* vehicle, double altitudeRel) ...@@ -984,12 +984,12 @@ bool APMFirmwarePlugin::_guidedModeTakeoff(Vehicle* vehicle, double altitudeRel)
} }
if (!_setFlightModeAndValidate(vehicle, "Guided")) { if (!_setFlightModeAndValidate(vehicle, "Guided")) {
qgcApp()->showMessage(tr("Unable to takeoff: Vehicle failed to change to Guided mode.")); qgcApp()->showAppMessage(tr("Unable to takeoff: Vehicle failed to change to Guided mode."));
return false; return false;
} }
if (!_armVehicleAndValidate(vehicle)) { if (!_armVehicleAndValidate(vehicle)) {
qgcApp()->showMessage(tr("Unable to takeoff: Vehicle failed to arm.")); qgcApp()->showAppMessage(tr("Unable to takeoff: Vehicle failed to arm."));
return false; return false;
} }
...@@ -1007,7 +1007,7 @@ void APMFirmwarePlugin::startMission(Vehicle* vehicle) ...@@ -1007,7 +1007,7 @@ void APMFirmwarePlugin::startMission(Vehicle* vehicle)
if (vehicle->flying()) { if (vehicle->flying()) {
// Vehicle already in the air, we just need to switch to auto // Vehicle already in the air, we just need to switch to auto
if (!_setFlightModeAndValidate(vehicle, "Auto")) { if (!_setFlightModeAndValidate(vehicle, "Auto")) {
qgcApp()->showMessage(tr("Unable to start mission: Vehicle failed to change to Auto mode.")); qgcApp()->showAppMessage(tr("Unable to start mission: Vehicle failed to change to Auto mode."));
} }
return; return;
} }
...@@ -1015,19 +1015,19 @@ void APMFirmwarePlugin::startMission(Vehicle* vehicle) ...@@ -1015,19 +1015,19 @@ void APMFirmwarePlugin::startMission(Vehicle* vehicle)
if (!vehicle->armed()) { if (!vehicle->armed()) {
// First switch to flight mode we can arm from // First switch to flight mode we can arm from
if (!_setFlightModeAndValidate(vehicle, "Guided")) { if (!_setFlightModeAndValidate(vehicle, "Guided")) {
qgcApp()->showMessage(tr("Unable to start mission: Vehicle failed to change to Guided mode.")); qgcApp()->showAppMessage(tr("Unable to start mission: Vehicle failed to change to Guided mode."));
return; return;
} }
if (!_armVehicleAndValidate(vehicle)) { if (!_armVehicleAndValidate(vehicle)) {
qgcApp()->showMessage(tr("Unable to start mission: Vehicle failed to arm.")); qgcApp()->showAppMessage(tr("Unable to start mission: Vehicle failed to arm."));
return; return;
} }
} }
if (vehicle->fixedWing()) { if (vehicle->fixedWing()) {
if (!_setFlightModeAndValidate(vehicle, "Auto")) { if (!_setFlightModeAndValidate(vehicle, "Auto")) {
qgcApp()->showMessage(tr("Unable to start mission: Vehicle failed to change to Auto mode.")); qgcApp()->showAppMessage(tr("Unable to start mission: Vehicle failed to change to Auto mode."));
return; return;
} }
} else { } else {
...@@ -1097,7 +1097,7 @@ void APMFirmwarePlugin::_sendGCSMotionReport(Vehicle* vehicle, FollowMe::GCSMoti ...@@ -1097,7 +1097,7 @@ void APMFirmwarePlugin::_sendGCSMotionReport(Vehicle* vehicle, FollowMe::GCSMoti
static bool sentOnce = false; static bool sentOnce = false;
if (!sentOnce) { if (!sentOnce) {
sentOnce = true; sentOnce = true;
qgcApp()->showMessage(tr("Follow failed: Home position not set.")); qgcApp()->showAppMessage(tr("Follow failed: Home position not set."));
} }
return; return;
} }
...@@ -1107,7 +1107,7 @@ void APMFirmwarePlugin::_sendGCSMotionReport(Vehicle* vehicle, FollowMe::GCSMoti ...@@ -1107,7 +1107,7 @@ void APMFirmwarePlugin::_sendGCSMotionReport(Vehicle* vehicle, FollowMe::GCSMoti
if (!sentOnce) { if (!sentOnce) {
sentOnce = true; sentOnce = true;
qWarning() << "APMFirmwarePlugin::_sendGCSMotionReport estimateCapabilities" << estimationCapabilities; qWarning() << "APMFirmwarePlugin::_sendGCSMotionReport estimateCapabilities" << estimationCapabilities;
qgcApp()->showMessage(tr("Follow failed: Ground station cannot provide required position information.")); qgcApp()->showAppMessage(tr("Follow failed: Ground station cannot provide required position information."));
} }
return; return;
} }
......
...@@ -76,7 +76,7 @@ void ArduRoverFirmwarePlugin::guidedModeChangeAltitude(Vehicle* vehicle, double ...@@ -76,7 +76,7 @@ void ArduRoverFirmwarePlugin::guidedModeChangeAltitude(Vehicle* vehicle, double
Q_UNUSED(vehicle); Q_UNUSED(vehicle);
Q_UNUSED(altitudeChange); Q_UNUSED(altitudeChange);
qgcApp()->showMessage(QStringLiteral("Change altitude not supported.")); qgcApp()->showAppMessage(QStringLiteral("Change altitude not supported."));
} }
bool ArduRoverFirmwarePlugin::supportsNegativeThrust(Vehicle* /*vehicle*/) bool ArduRoverFirmwarePlugin::supportsNegativeThrust(Vehicle* /*vehicle*/)
......
...@@ -224,14 +224,14 @@ void FirmwarePlugin::setGuidedMode(Vehicle* vehicle, bool guidedMode) ...@@ -224,14 +224,14 @@ void FirmwarePlugin::setGuidedMode(Vehicle* vehicle, bool guidedMode)
{ {
Q_UNUSED(vehicle); Q_UNUSED(vehicle);
Q_UNUSED(guidedMode); Q_UNUSED(guidedMode);
qgcApp()->showMessage(guided_mode_not_supported_by_vehicle); qgcApp()->showAppMessage(guided_mode_not_supported_by_vehicle);
} }
void FirmwarePlugin::pauseVehicle(Vehicle* vehicle) void FirmwarePlugin::pauseVehicle(Vehicle* vehicle)
{ {
// Not supported by generic vehicle // Not supported by generic vehicle
Q_UNUSED(vehicle); Q_UNUSED(vehicle);
qgcApp()->showMessage(guided_mode_not_supported_by_vehicle); qgcApp()->showAppMessage(guided_mode_not_supported_by_vehicle);
} }
void FirmwarePlugin::guidedModeRTL(Vehicle* vehicle, bool smartRTL) void FirmwarePlugin::guidedModeRTL(Vehicle* vehicle, bool smartRTL)
...@@ -239,14 +239,14 @@ void FirmwarePlugin::guidedModeRTL(Vehicle* vehicle, bool smartRTL) ...@@ -239,14 +239,14 @@ void FirmwarePlugin::guidedModeRTL(Vehicle* vehicle, bool smartRTL)
// Not supported by generic vehicle // Not supported by generic vehicle
Q_UNUSED(vehicle); Q_UNUSED(vehicle);
Q_UNUSED(smartRTL); Q_UNUSED(smartRTL);
qgcApp()->showMessage(guided_mode_not_supported_by_vehicle); qgcApp()->showAppMessage(guided_mode_not_supported_by_vehicle);
} }
void FirmwarePlugin::guidedModeLand(Vehicle* vehicle) void FirmwarePlugin::guidedModeLand(Vehicle* vehicle)
{ {
// Not supported by generic vehicle // Not supported by generic vehicle
Q_UNUSED(vehicle); Q_UNUSED(vehicle);
qgcApp()->showMessage(guided_mode_not_supported_by_vehicle); qgcApp()->showAppMessage(guided_mode_not_supported_by_vehicle);
} }
void FirmwarePlugin::guidedModeTakeoff(Vehicle* vehicle, double takeoffAltRel) void FirmwarePlugin::guidedModeTakeoff(Vehicle* vehicle, double takeoffAltRel)
...@@ -254,7 +254,7 @@ void FirmwarePlugin::guidedModeTakeoff(Vehicle* vehicle, double takeoffAltRel) ...@@ -254,7 +254,7 @@ void FirmwarePlugin::guidedModeTakeoff(Vehicle* vehicle, double takeoffAltRel)
// Not supported by generic vehicle // Not supported by generic vehicle
Q_UNUSED(vehicle); Q_UNUSED(vehicle);
Q_UNUSED(takeoffAltRel); Q_UNUSED(takeoffAltRel);
qgcApp()->showMessage(guided_mode_not_supported_by_vehicle); qgcApp()->showAppMessage(guided_mode_not_supported_by_vehicle);
} }
void FirmwarePlugin::guidedModeGotoLocation(Vehicle* vehicle, const QGeoCoordinate& gotoCoord) void FirmwarePlugin::guidedModeGotoLocation(Vehicle* vehicle, const QGeoCoordinate& gotoCoord)
...@@ -262,19 +262,19 @@ void FirmwarePlugin::guidedModeGotoLocation(Vehicle* vehicle, const QGeoCoordina ...@@ -262,19 +262,19 @@ void FirmwarePlugin::guidedModeGotoLocation(Vehicle* vehicle, const QGeoCoordina
// Not supported by generic vehicle // Not supported by generic vehicle
Q_UNUSED(vehicle); Q_UNUSED(vehicle);
Q_UNUSED(gotoCoord); Q_UNUSED(gotoCoord);
qgcApp()->showMessage(guided_mode_not_supported_by_vehicle); qgcApp()->showAppMessage(guided_mode_not_supported_by_vehicle);
} }
void FirmwarePlugin::guidedModeChangeAltitude(Vehicle*, double) void FirmwarePlugin::guidedModeChangeAltitude(Vehicle*, double)
{ {
// Not supported by generic vehicle // Not supported by generic vehicle
qgcApp()->showMessage(guided_mode_not_supported_by_vehicle); qgcApp()->showAppMessage(guided_mode_not_supported_by_vehicle);
} }
void FirmwarePlugin::startMission(Vehicle*) void FirmwarePlugin::startMission(Vehicle*)
{ {
// Not supported by generic vehicle // Not supported by generic vehicle
qgcApp()->showMessage(guided_mode_not_supported_by_vehicle); qgcApp()->showAppMessage(guided_mode_not_supported_by_vehicle);
} }
const FirmwarePlugin::remapParamNameMajorVersionMap_t& FirmwarePlugin::paramNameRemapMajorVersionMap(void) const const FirmwarePlugin::remapParamNameMajorVersionMap_t& FirmwarePlugin::paramNameRemapMajorVersionMap(void) const
...@@ -862,7 +862,7 @@ void FirmwarePlugin::_versionFileDownloadFinished(QString& remoteFile, QString& ...@@ -862,7 +862,7 @@ void FirmwarePlugin::_versionFileDownloadFinished(QString& remoteFile, QString&
QString currentVersionNumber = QString("%1.%2.%3").arg(vehicle->firmwareMajorVersion()) QString currentVersionNumber = QString("%1.%2.%3").arg(vehicle->firmwareMajorVersion())
.arg(vehicle->firmwareMinorVersion()) .arg(vehicle->firmwareMinorVersion())
.arg(vehicle->firmwarePatchVersion()); .arg(vehicle->firmwarePatchVersion());
qgcApp()->showMessage(tr("Vehicle is not running latest stable firmware! Running %1, latest stable is %2.").arg(currentVersionNumber, version)); qgcApp()->showAppMessage(tr("Vehicle is not running latest stable firmware! Running %1, latest stable is %2.").arg(currentVersionNumber, version));
} }
} }
......
...@@ -401,7 +401,7 @@ void PX4FirmwarePlugin::guidedModeTakeoff(Vehicle* vehicle, double takeoffAltRel ...@@ -401,7 +401,7 @@ void PX4FirmwarePlugin::guidedModeTakeoff(Vehicle* vehicle, double takeoffAltRel
{ {
double vehicleAltitudeAMSL = vehicle->altitudeAMSL()->rawValue().toDouble(); double vehicleAltitudeAMSL = vehicle->altitudeAMSL()->rawValue().toDouble();
if (qIsNaN(vehicleAltitudeAMSL)) { if (qIsNaN(vehicleAltitudeAMSL)) {
qgcApp()->showMessage(tr("Unable to takeoff, vehicle position not known.")); qgcApp()->showAppMessage(tr("Unable to takeoff, vehicle position not known."));
return; return;
} }
...@@ -424,7 +424,7 @@ void PX4FirmwarePlugin::guidedModeTakeoff(Vehicle* vehicle, double takeoffAltRel ...@@ -424,7 +424,7 @@ void PX4FirmwarePlugin::guidedModeTakeoff(Vehicle* vehicle, double takeoffAltRel
void PX4FirmwarePlugin::guidedModeGotoLocation(Vehicle* vehicle, const QGeoCoordinate& gotoCoord) void PX4FirmwarePlugin::guidedModeGotoLocation(Vehicle* vehicle, const QGeoCoordinate& gotoCoord)
{ {
if (qIsNaN(vehicle->altitudeAMSL()->rawValue().toDouble())) { if (qIsNaN(vehicle->altitudeAMSL()->rawValue().toDouble())) {
qgcApp()->showMessage(tr("Unable to go to location, vehicle position not known.")); qgcApp()->showAppMessage(tr("Unable to go to location, vehicle position not known."));
return; return;
} }
...@@ -457,11 +457,11 @@ void PX4FirmwarePlugin::guidedModeGotoLocation(Vehicle* vehicle, const QGeoCoord ...@@ -457,11 +457,11 @@ void PX4FirmwarePlugin::guidedModeGotoLocation(Vehicle* vehicle, const QGeoCoord
void PX4FirmwarePlugin::guidedModeChangeAltitude(Vehicle* vehicle, double altitudeChange) void PX4FirmwarePlugin::guidedModeChangeAltitude(Vehicle* vehicle, double altitudeChange)
{ {
if (!vehicle->homePosition().isValid()) { if (!vehicle->homePosition().isValid()) {
qgcApp()->showMessage(tr("Unable to change altitude, home position unknown.")); qgcApp()->showAppMessage(tr("Unable to change altitude, home position unknown."));
return; return;
} }
if (qIsNaN(vehicle->homePosition().altitude())) { if (qIsNaN(vehicle->homePosition().altitude())) {
qgcApp()->showMessage(tr("Unable to change altitude, home position altitude unknown.")); qgcApp()->showAppMessage(tr("Unable to change altitude, home position altitude unknown."));
return; return;
} }
...@@ -484,11 +484,11 @@ void PX4FirmwarePlugin::startMission(Vehicle* vehicle) ...@@ -484,11 +484,11 @@ void PX4FirmwarePlugin::startMission(Vehicle* vehicle)
{ {
if (_setFlightModeAndValidate(vehicle, missionFlightMode())) { if (_setFlightModeAndValidate(vehicle, missionFlightMode())) {
if (!_armVehicleAndValidate(vehicle)) { if (!_armVehicleAndValidate(vehicle)) {
qgcApp()->showMessage(tr("Unable to start mission: Vehicle rejected arming.")); qgcApp()->showAppMessage(tr("Unable to start mission: Vehicle rejected arming."));
return; return;
} }
} else { } else {
qgcApp()->showMessage(tr("Unable to start mission: Vehicle not changing to %1 flight mode.").arg(missionFlightMode())); qgcApp()->showAppMessage(tr("Unable to start mission: Vehicle not changing to %1 flight mode.").arg(missionFlightMode()));
} }
} }
...@@ -560,7 +560,7 @@ void PX4FirmwarePlugin::_handleAutopilotVersion(Vehicle* vehicle, mavlink_messag ...@@ -560,7 +560,7 @@ void PX4FirmwarePlugin::_handleAutopilotVersion(Vehicle* vehicle, mavlink_messag
if (notifyUser) { if (notifyUser) {
instanceData->versionNotified = true; instanceData->versionNotified = true;
qgcApp()->showMessage(tr("QGroundControl supports PX4 Pro firmware Version %1.%2.%3 and above. You are using a version prior to that which will lead to unpredictable results. Please upgrade your firmware.").arg(supportedMajorVersion).arg(supportedMinorVersion).arg(supportedPatchVersion)); qgcApp()->showAppMessage(tr("QGroundControl supports PX4 Pro firmware Version %1.%2.%3 and above. You are using a version prior to that which will lead to unpredictable results. Please upgrade your firmware.").arg(supportedMajorVersion).arg(supportedMinorVersion).arg(supportedPatchVersion));
} }
} }
} }
......
...@@ -48,19 +48,19 @@ QStringList ComplexMissionItem::presetNames(void) ...@@ -48,19 +48,19 @@ QStringList ComplexMissionItem::presetNames(void)
void ComplexMissionItem::loadPreset(const QString& name) void ComplexMissionItem::loadPreset(const QString& name)
{ {
Q_UNUSED(name); Q_UNUSED(name);
qgcApp()->showMessage(tr("This Pattern does not support Presets.")); qgcApp()->showAppMessage(tr("This Pattern does not support Presets."));
} }
void ComplexMissionItem::savePreset(const QString& name) void ComplexMissionItem::savePreset(const QString& name)
{ {
Q_UNUSED(name); Q_UNUSED(name);
qgcApp()->showMessage(tr("This Pattern does not support Presets.")); qgcApp()->showAppMessage(tr("This Pattern does not support Presets."));
} }
void ComplexMissionItem::deletePreset(const QString& name) void ComplexMissionItem::deletePreset(const QString& name)
{ {
if (qgcApp()->toolbox()->corePlugin()->options()->surveyBuiltInPresetNames().contains(name)) { if (qgcApp()->toolbox()->corePlugin()->options()->surveyBuiltInPresetNames().contains(name)) {
qgcApp()->showMessage(tr("'%1' is a built-in preset which cannot be deleted.").arg(name)); qgcApp()->showAppMessage(tr("'%1' is a built-in preset which cannot be deleted.").arg(name));
return; return;
} }
......
...@@ -216,7 +216,7 @@ bool FixedWingLandingComplexItem::load(const QJsonObject& complexObject, int seq ...@@ -216,7 +216,7 @@ bool FixedWingLandingComplexItem::load(const QJsonObject& complexObject, int seq
bool loiterAltitudeRelative = complexObject[_jsonLoiterAltitudeRelativeKey].toBool(); bool loiterAltitudeRelative = complexObject[_jsonLoiterAltitudeRelativeKey].toBool();
bool landingAltitudeRelative = complexObject[_jsonLandingAltitudeRelativeKey].toBool(); bool landingAltitudeRelative = complexObject[_jsonLandingAltitudeRelativeKey].toBool();
if (loiterAltitudeRelative != landingAltitudeRelative) { if (loiterAltitudeRelative != landingAltitudeRelative) {
qgcApp()->showMessage(tr("Fixed Wing Landing Pattern: " qgcApp()->showAppMessage(tr("Fixed Wing Landing Pattern: "
"Setting the loiter and landing altitudes with different settings for altitude relative is no longer supported. " "Setting the loiter and landing altitudes with different settings for altitude relative is no longer supported. "
"Both have been set to altitude relative. Be sure to adjust/check your plan prior to flight.")); "Both have been set to altitude relative. Be sure to adjust/check your plan prior to flight."));
_altitudesAreRelative = true; _altitudesAreRelative = true;
......
...@@ -88,7 +88,7 @@ void MissionManager::generateResumeMission(int resumeIndex) ...@@ -88,7 +88,7 @@ void MissionManager::generateResumeMission(int resumeIndex)
for (int i=0; i<_missionItems.count(); i++) { for (int i=0; i<_missionItems.count(); i++) {
MissionItem* item = _missionItems[i]; MissionItem* item = _missionItems[i];
if (item->command() == MAV_CMD_DO_JUMP) { if (item->command() == MAV_CMD_DO_JUMP) {
qgcApp()->showMessage(tr("Unable to generate resume mission due to MAV_CMD_DO_JUMP command.")); qgcApp()->showAppMessage(tr("Unable to generate resume mission due to MAV_CMD_DO_JUMP command."));
return; return;
} }
} }
......
...@@ -206,7 +206,7 @@ void PlanMasterController::_activeVehicleChanged(Vehicle* activeVehicle) ...@@ -206,7 +206,7 @@ void PlanMasterController::_activeVehicleChanged(Vehicle* activeVehicle)
void PlanMasterController::loadFromVehicle(void) void PlanMasterController::loadFromVehicle(void)
{ {
if (_managerVehicle->highLatencyLink()) { if (_managerVehicle->highLatencyLink()) {
qgcApp()->showMessage(tr("Download not supported on high latency links.")); qgcApp()->showAppMessage(tr("Download not supported on high latency links."));
return; return;
} }
...@@ -313,7 +313,7 @@ void PlanMasterController::_startFlightPlanning(void) { ...@@ -313,7 +313,7 @@ void PlanMasterController::_startFlightPlanning(void) {
void PlanMasterController::sendToVehicle(void) void PlanMasterController::sendToVehicle(void)
{ {
if (_managerVehicle->highLatencyLink()) { if (_managerVehicle->highLatencyLink()) {
qgcApp()->showMessage(tr("Upload not supported on high latency links.")); qgcApp()->showAppMessage(tr("Upload not supported on high latency links."));
return; return;
} }
...@@ -343,7 +343,7 @@ void PlanMasterController::loadFromFile(const QString& filename) ...@@ -343,7 +343,7 @@ void PlanMasterController::loadFromFile(const QString& filename)
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
errorString = file.errorString() + QStringLiteral(" ") + filename; errorString = file.errorString() + QStringLiteral(" ") + filename;
qgcApp()->showMessage(errorMessage.arg(errorString)); qgcApp()->showAppMessage(errorMessage.arg(errorString));
return; return;
} }
...@@ -353,7 +353,7 @@ void PlanMasterController::loadFromFile(const QString& filename) ...@@ -353,7 +353,7 @@ void PlanMasterController::loadFromFile(const QString& filename)
QByteArray bytes = file.readAll(); QByteArray bytes = file.readAll();
if (!JsonHelper::isJsonFile(bytes, jsonDoc, errorString)) { if (!JsonHelper::isJsonFile(bytes, jsonDoc, errorString)) {
qgcApp()->showMessage(errorMessage.arg(errorString)); qgcApp()->showAppMessage(errorMessage.arg(errorString));
return; return;
} }
...@@ -363,7 +363,7 @@ void PlanMasterController::loadFromFile(const QString& filename) ...@@ -363,7 +363,7 @@ void PlanMasterController::loadFromFile(const QString& filename)
int version; int version;
if (!JsonHelper::validateQGCJsonFile(json, kPlanFileType, kPlanFileVersion, kPlanFileVersion, version, errorString)) { if (!JsonHelper::validateQGCJsonFile(json, kPlanFileType, kPlanFileVersion, kPlanFileVersion, version, errorString)) {
qgcApp()->showMessage(errorMessage.arg(errorString)); qgcApp()->showAppMessage(errorMessage.arg(errorString));
return; return;
} }
...@@ -373,14 +373,14 @@ void PlanMasterController::loadFromFile(const QString& filename) ...@@ -373,14 +373,14 @@ void PlanMasterController::loadFromFile(const QString& filename)
{ kJsonRallyPointsObjectKey, QJsonValue::Object, true }, { kJsonRallyPointsObjectKey, QJsonValue::Object, true },
}; };
if (!JsonHelper::validateKeys(json, rgKeyInfo, errorString)) { if (!JsonHelper::validateKeys(json, rgKeyInfo, errorString)) {
qgcApp()->showMessage(errorMessage.arg(errorString)); qgcApp()->showAppMessage(errorMessage.arg(errorString));
return; return;
} }
if (!_missionController.load(json[kJsonMissionObjectKey].toObject(), errorString) || if (!_missionController.load(json[kJsonMissionObjectKey].toObject(), errorString) ||
!_geoFenceController.load(json[kJsonGeoFenceObjectKey].toObject(), errorString) || !_geoFenceController.load(json[kJsonGeoFenceObjectKey].toObject(), errorString) ||
!_rallyPointController.load(json[kJsonRallyPointsObjectKey].toObject(), errorString)) { !_rallyPointController.load(json[kJsonRallyPointsObjectKey].toObject(), errorString)) {
qgcApp()->showMessage(errorMessage.arg(errorString)); qgcApp()->showAppMessage(errorMessage.arg(errorString));
} else { } else {
//-- Allow plugins to post process the load //-- Allow plugins to post process the load
qgcApp()->toolbox()->corePlugin()->postLoadFromJson(this, json); qgcApp()->toolbox()->corePlugin()->postLoadFromJson(this, json);
...@@ -388,13 +388,13 @@ void PlanMasterController::loadFromFile(const QString& filename) ...@@ -388,13 +388,13 @@ void PlanMasterController::loadFromFile(const QString& filename)
} }
} else if (fileInfo.suffix() == AppSettings::missionFileExtension) { } else if (fileInfo.suffix() == AppSettings::missionFileExtension) {
if (!_missionController.loadJsonFile(file, errorString)) { if (!_missionController.loadJsonFile(file, errorString)) {
qgcApp()->showMessage(errorMessage.arg(errorString)); qgcApp()->showAppMessage(errorMessage.arg(errorString));
} else { } else {
success = true; success = true;
} }
} else if (fileInfo.suffix() == AppSettings::waypointsFileExtension || fileInfo.suffix() == QStringLiteral("txt")) { } else if (fileInfo.suffix() == AppSettings::waypointsFileExtension || fileInfo.suffix() == QStringLiteral("txt")) {
if (!_missionController.loadTextFile(file, errorString)) { if (!_missionController.loadTextFile(file, errorString)) {
qgcApp()->showMessage(errorMessage.arg(errorString)); qgcApp()->showAppMessage(errorMessage.arg(errorString));
} else { } else {
success = true; success = true;
} }
...@@ -458,7 +458,7 @@ void PlanMasterController::saveToFile(const QString& filename) ...@@ -458,7 +458,7 @@ void PlanMasterController::saveToFile(const QString& filename)
QFile file(planFilename); QFile file(planFilename);
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
qgcApp()->showMessage(tr("Plan save error %1 : %2").arg(filename).arg(file.errorString())); qgcApp()->showAppMessage(tr("Plan save error %1 : %2").arg(filename).arg(file.errorString()));
_currentPlanFile.clear(); _currentPlanFile.clear();
emit currentPlanFileChanged(); emit currentPlanFileChanged();
} else { } else {
...@@ -490,7 +490,7 @@ void PlanMasterController::saveToKml(const QString& filename) ...@@ -490,7 +490,7 @@ void PlanMasterController::saveToKml(const QString& filename)
QFile file(kmlFilename); QFile file(kmlFilename);
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
qgcApp()->showMessage(tr("KML save error %1 : %2").arg(filename).arg(file.errorString())); qgcApp()->showAppMessage(tr("KML save error %1 : %2").arg(filename).arg(file.errorString()));
} else { } else {
KMLPlanDomDocument planKML; KMLPlanDomDocument planKML;
_missionController.addMissionToKML(planKML); _missionController.addMissionToKML(planKML);
......
...@@ -467,7 +467,7 @@ bool QGCMapPolygon::loadKMLOrSHPFile(const QString& file) ...@@ -467,7 +467,7 @@ bool QGCMapPolygon::loadKMLOrSHPFile(const QString& file)
QString errorString; QString errorString;
QList<QGeoCoordinate> rgCoords; QList<QGeoCoordinate> rgCoords;
if (!ShapeFileHelper::loadPolygonFromFile(file, rgCoords, errorString)) { if (!ShapeFileHelper::loadPolygonFromFile(file, rgCoords, errorString)) {
qgcApp()->showMessage(errorString); qgcApp()->showAppMessage(errorString);
return false; return false;
} }
......
...@@ -353,7 +353,7 @@ bool QGCMapPolyline::loadKMLFile(const QString& kmlFile) ...@@ -353,7 +353,7 @@ bool QGCMapPolyline::loadKMLFile(const QString& kmlFile)
QString errorString; QString errorString;
QList<QGeoCoordinate> rgCoords; QList<QGeoCoordinate> rgCoords;
if (!KMLHelper::loadPolylineFromFile(kmlFile, rgCoords, errorString)) { if (!KMLHelper::loadPolylineFromFile(kmlFile, rgCoords, errorString)) {
qgcApp()->showMessage(errorString); qgcApp()->showAppMessage(errorString);
return false; return false;
} }
......
...@@ -151,7 +151,7 @@ void SurveyComplexItem::loadPreset(const QString& name) ...@@ -151,7 +151,7 @@ void SurveyComplexItem::loadPreset(const QString& name)
QJsonObject presetObject = _loadPresetJson(name); QJsonObject presetObject = _loadPresetJson(name);
if (!_loadV4V5(presetObject, 0, errorString, 5, true /* forPresets */)) { if (!_loadV4V5(presetObject, 0, errorString, 5, true /* forPresets */)) {
qgcApp()->showMessage(QStringLiteral("Internal Error: Preset load failed. Name: %1 Error: %2").arg(name).arg(errorString)); qgcApp()->showAppMessage(QStringLiteral("Internal Error: Preset load failed. Name: %1 Error: %2").arg(name).arg(errorString));
} }
_rebuildTransects(); _rebuildTransects();
} }
......
...@@ -520,7 +520,7 @@ void TransectStyleComplexItem::_adjustTransectsForTerrain(void) ...@@ -520,7 +520,7 @@ void TransectStyleComplexItem::_adjustTransectsForTerrain(void)
if (_followTerrain) { if (_followTerrain) {
if (readyForSaveState() != ReadyForSave) { if (readyForSaveState() != ReadyForSave) {
qCWarning(TransectStyleComplexItemLog) << "_adjustTransectPointsForTerrain called when terrain data not ready"; qCWarning(TransectStyleComplexItemLog) << "_adjustTransectPointsForTerrain called when terrain data not ready";
qgcApp()->showMessage(tr("INTERNAL ERROR: TransectStyleComplexItem::_adjustTransectPointsForTerrain called when terrain data not ready. Plan will be incorrect.")); qgcApp()->showAppMessage(tr("INTERNAL ERROR: TransectStyleComplexItem::_adjustTransectPointsForTerrain called when terrain data not ready. Plan will be incorrect."));
return; return;
} }
......
...@@ -603,7 +603,7 @@ bool QGCApplication::_initForNormalAppBoot() ...@@ -603,7 +603,7 @@ bool QGCApplication::_initForNormalAppBoot()
toolbox()->joystickManager()->init(); toolbox()->joystickManager()->init();
if (_settingsUpgraded) { if (_settingsUpgraded) {
showMessage(QString(tr("The format for %1 saved settings has been modified. " showAppMessage(QString(tr("The format for %1 saved settings has been modified. "
"Your saved settings have been reset to defaults.")).arg(applicationName())); "Your saved settings have been reset to defaults.")).arg(applicationName()));
} }
...@@ -611,10 +611,13 @@ bool QGCApplication::_initForNormalAppBoot() ...@@ -611,10 +611,13 @@ bool QGCApplication::_initForNormalAppBoot()
toolbox()->linkManager()->startAutoConnectedLinks(); toolbox()->linkManager()->startAutoConnectedLinks();
if (getQGCMapEngine()->wasCacheReset()) { if (getQGCMapEngine()->wasCacheReset()) {
showMessage(tr("The Offline Map Cache database has been upgraded. " showAppMessage(tr("The Offline Map Cache database has been upgraded. "
"Your old map cache sets have been reset.")); "Your old map cache sets have been reset."));
} }
showAppMessage("Foo");
showAppMessage("Bar");
settings.sync(); settings.sync();
return true; return true;
} }
...@@ -644,17 +647,17 @@ QGCApplication* qgcApp(void) ...@@ -644,17 +647,17 @@ QGCApplication* qgcApp(void)
void QGCApplication::informationMessageBoxOnMainThread(const QString& /*title*/, const QString& msg) void QGCApplication::informationMessageBoxOnMainThread(const QString& /*title*/, const QString& msg)
{ {
showMessage(msg); showAppMessage(msg);
} }
void QGCApplication::warningMessageBoxOnMainThread(const QString& /*title*/, const QString& msg) void QGCApplication::warningMessageBoxOnMainThread(const QString& /*title*/, const QString& msg)
{ {
showMessage(msg); showAppMessage(msg);
} }
void QGCApplication::criticalMessageBoxOnMainThread(const QString& /*title*/, const QString& msg) void QGCApplication::criticalMessageBoxOnMainThread(const QString& /*title*/, const QString& msg)
{ {
showMessage(msg); showAppMessage(msg);
} }
void QGCApplication::saveTelemetryLogOnMainThread(QString tempLogfile) void QGCApplication::saveTelemetryLogOnMainThread(QString tempLogfile)
...@@ -680,7 +683,7 @@ void QGCApplication::saveTelemetryLogOnMainThread(QString tempLogfile) ...@@ -680,7 +683,7 @@ void QGCApplication::saveTelemetryLogOnMainThread(QString tempLogfile)
QFile tempFile(tempLogfile); QFile tempFile(tempLogfile);
if (!tempFile.copy(saveFilePath)) { if (!tempFile.copy(saveFilePath)) {
QString error = tr("Unable to save telemetry log. Error copying telemetry to '%1': '%2'.").arg(saveFilePath).arg(tempFile.errorString()); QString error = tr("Unable to save telemetry log. Error copying telemetry to '%1': '%2'.").arg(saveFilePath).arg(tempFile.errorString());
showMessage(error); showAppMessage(error);
} }
} }
QFile::remove(tempLogfile); QFile::remove(tempLogfile);
...@@ -697,14 +700,14 @@ bool QGCApplication::_checkTelemetrySavePath(bool /*useMessageBox*/) ...@@ -697,14 +700,14 @@ bool QGCApplication::_checkTelemetrySavePath(bool /*useMessageBox*/)
QString saveDirPath = _toolbox->settingsManager()->appSettings()->telemetrySavePath(); QString saveDirPath = _toolbox->settingsManager()->appSettings()->telemetrySavePath();
if (saveDirPath.isEmpty()) { if (saveDirPath.isEmpty()) {
QString error = tr("Unable to save telemetry log. Application save directory is not set."); QString error = tr("Unable to save telemetry log. Application save directory is not set.");
showMessage(error); showAppMessage(error);
return false; return false;
} }
QDir saveDir(saveDirPath); QDir saveDir(saveDirPath);
if (!saveDir.exists()) { if (!saveDir.exists()) {
QString error = tr("Unable to save telemetry log. Telemetry save directory \"%1\" does not exist.").arg(saveDirPath); QString error = tr("Unable to save telemetry log. Telemetry save directory \"%1\" does not exist.").arg(saveDirPath);
showMessage(error); showAppMessage(error);
return false; return false;
} }
...@@ -737,7 +740,7 @@ void QGCApplication::_missingParamsDisplay(void) ...@@ -737,7 +740,7 @@ void QGCApplication::_missingParamsDisplay(void)
} }
_missingParams.clear(); _missingParams.clear();
showMessage(tr("Parameters are missing from firmware. You may be running a version of firmware QGC does not work correctly with or your firmware has a bug in it. Missing params: %1").arg(params)); showAppMessage(tr("Parameters are missing from firmware. You may be running a version of firmware QGC does not work correctly with or your firmware has a bug in it. Missing params: %1").arg(params));
} }
} }
...@@ -748,8 +751,7 @@ QObject* QGCApplication::_rootQmlObject() ...@@ -748,8 +751,7 @@ QObject* QGCApplication::_rootQmlObject()
return nullptr; return nullptr;
} }
void QGCApplication::showVehicleMessage(const QString& message)
void QGCApplication::showMessage(const QString& message)
{ {
// PreArm messages are handled by Vehicle and shown in Map // PreArm messages are handled by Vehicle and shown in Map
if (message.startsWith(QStringLiteral("PreArm")) || message.startsWith(QStringLiteral("preflight"), Qt::CaseInsensitive)) { if (message.startsWith(QStringLiteral("PreArm")) || message.startsWith(QStringLiteral("preflight"), Qt::CaseInsensitive)) {
...@@ -759,10 +761,27 @@ void QGCApplication::showMessage(const QString& message) ...@@ -759,10 +761,27 @@ void QGCApplication::showMessage(const QString& message)
if (rootQmlObject) { if (rootQmlObject) {
QVariant varReturn; QVariant varReturn;
QVariant varMessage = QVariant::fromValue(message); QVariant varMessage = QVariant::fromValue(message);
QMetaObject::invokeMethod(_rootQmlObject(), "showMessage", Q_RETURN_ARG(QVariant, varReturn), Q_ARG(QVariant, varMessage)); QMetaObject::invokeMethod(_rootQmlObject(), "showVehicleMessage", Q_RETURN_ARG(QVariant, varReturn), Q_ARG(QVariant, varMessage));
} else if (runningUnitTests()) {
// Unit tests can run without UI
qDebug() << "QGCApplication::showVehicleMessage unittest" << message;
} else {
qWarning() << "Internal error";
}
}
void QGCApplication::showAppMessage(const QString& message, const QString& title)
{
QString dialogTitle = title.isEmpty() ? applicationName() : title;
QObject* rootQmlObject = _rootQmlObject();
if (rootQmlObject) {
QVariant varReturn;
QVariant varMessage = QVariant::fromValue(message);
QMetaObject::invokeMethod(_rootQmlObject(), "showMessageDialog", Q_RETURN_ARG(QVariant, varReturn), Q_ARG(QVariant, dialogTitle) /* No title */, Q_ARG(QVariant, varMessage));
} else if (runningUnitTests()) { } else if (runningUnitTests()) {
// Unit tests can run without UI // Unit tests can run without UI
qDebug() << "QGCApplication::showMessage unittest" << message; qDebug() << "QGCApplication::showAppMessage unittest" << message << dialogTitle;
} else { } else {
qWarning() << "Internal error"; qWarning() << "Internal error";
} }
......
...@@ -70,8 +70,11 @@ public: ...@@ -70,8 +70,11 @@ public:
/// multiple times. /// multiple times.
void reportMissingParameter(int componentId, const QString& name); void reportMissingParameter(int componentId, const QString& name);
/// Show a non-modal message to the user /// Show non-modal vehicle message to the user
Q_SLOT void showMessage(const QString& message); Q_SLOT void showVehicleMessage(const QString& message);
/// Show modal application message to the user
Q_SLOT void showAppMessage(const QString& message, const QString& title = QString());
/// @return true: Fake ui into showing mobile interface /// @return true: Fake ui into showing mobile interface
bool fakeMobile(void) const { return _fakeMobile; } bool fakeMobile(void) const { return _fakeMobile; }
......
...@@ -105,7 +105,7 @@ void AppLogModel::threadsafeLog(const QString message) ...@@ -105,7 +105,7 @@ void AppLogModel::threadsafeLog(const QString message)
_logFile.setFileName(saveFilePath); _logFile.setFileName(saveFilePath);
if (!_logFile.open(QIODevice::WriteOnly | QIODevice::Text)) { if (!_logFile.open(QIODevice::WriteOnly | QIODevice::Text)) {
qgcApp()->showMessage(tr("Open console log output file failed %1 : %2").arg(_logFile.fileName()).arg(_logFile.errorString())); qgcApp()->showAppMessage(tr("Open console log output file failed %1 : %2").arg(_logFile.fileName()).arg(_logFile.errorString()));
} }
} }
} }
......
...@@ -97,7 +97,7 @@ void ParameterEditorController::saveToFile(const QString& filename) ...@@ -97,7 +97,7 @@ void ParameterEditorController::saveToFile(const QString& filename)
QFile file(parameterFilename); QFile file(parameterFilename);
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
qgcApp()->showMessage(tr("Unable to create file: %1").arg(parameterFilename)); qgcApp()->showAppMessage(tr("Unable to create file: %1").arg(parameterFilename));
return; return;
} }
...@@ -115,7 +115,7 @@ void ParameterEditorController::loadFromFile(const QString& filename) ...@@ -115,7 +115,7 @@ void ParameterEditorController::loadFromFile(const QString& filename)
QFile file(filename); QFile file(filename);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
qgcApp()->showMessage(tr("Unable to open file: %1").arg(filename)); qgcApp()->showAppMessage(tr("Unable to open file: %1").arg(filename));
return; return;
} }
......
...@@ -122,7 +122,7 @@ void MultiVehicleManager::_vehicleHeartbeatInfo(LinkInterface* link, int vehicle ...@@ -122,7 +122,7 @@ void MultiVehicleManager::_vehicleHeartbeatInfo(LinkInterface* link, int vehicle
<< vehicleType; << vehicleType;
if (vehicleId == _mavlinkProtocol->getSystemId()) { if (vehicleId == _mavlinkProtocol->getSystemId()) {
_app->showMessage(tr("Warning: A vehicle is using the same system id as %1: %2").arg(qgcApp()->applicationName()).arg(vehicleId)); _app->showAppMessage(tr("Warning: A vehicle is using the same system id as %1: %2").arg(qgcApp()->applicationName()).arg(vehicleId));
} }
Vehicle* vehicle = new Vehicle(link, vehicleId, componentId, (MAV_AUTOPILOT)vehicleFirmwareType, (MAV_TYPE)vehicleType, _firmwarePluginManager, _joystickManager); Vehicle* vehicle = new Vehicle(link, vehicleId, componentId, (MAV_AUTOPILOT)vehicleFirmwareType, (MAV_TYPE)vehicleType, _firmwarePluginManager, _joystickManager);
...@@ -140,7 +140,7 @@ void MultiVehicleManager::_vehicleHeartbeatInfo(LinkInterface* link, int vehicle ...@@ -140,7 +140,7 @@ void MultiVehicleManager::_vehicleHeartbeatInfo(LinkInterface* link, int vehicle
emit vehicleAdded(vehicle); emit vehicleAdded(vehicle);
if (_vehicles.count() > 1) { if (_vehicles.count() > 1) {
qgcApp()->showMessage(tr("Connected to Vehicle %1").arg(vehicleId)); qgcApp()->showAppMessage(tr("Connected to Vehicle %1").arg(vehicleId));
} else { } else {
setActiveVehicle(vehicle); setActiveVehicle(vehicle);
} }
......
This diff is collapsed.
...@@ -253,7 +253,7 @@ void JoystickConfigController::nextButtonClicked() ...@@ -253,7 +253,7 @@ void JoystickConfigController::nextButtonClicked()
if (_currentStep == -1) { if (_currentStep == -1) {
// Need to have enough channels // Need to have enough channels
if (_axisCount < _axisMinimum) { if (_axisCount < _axisMinimum) {
qgcApp()->showMessage(tr("Detected %1 joystick axes. To operate PX4, you need at least %2 axes.").arg(_axisCount).arg(_axisMinimum)); qgcApp()->showAppMessage(tr("Detected %1 joystick axes. To operate PX4, you need at least %2 axes.").arg(_axisCount).arg(_axisMinimum));
return; return;
} }
_startCalibration(); _startCalibration();
......
...@@ -220,14 +220,14 @@ VideoManager::startRecording(const QString& videoFile) ...@@ -220,14 +220,14 @@ VideoManager::startRecording(const QString& videoFile)
} }
#if defined(QGC_GST_STREAMING) #if defined(QGC_GST_STREAMING)
if (!_videoReceiver) { if (!_videoReceiver) {
qgcApp()->showMessage(tr("Video receiver is not ready.")); qgcApp()->showAppMessage(tr("Video receiver is not ready."));
return; return;
} }
const VideoReceiver::FILE_FORMAT fileFormat = static_cast<VideoReceiver::FILE_FORMAT>(_videoSettings->recordingFormat()->rawValue().toInt()); const VideoReceiver::FILE_FORMAT fileFormat = static_cast<VideoReceiver::FILE_FORMAT>(_videoSettings->recordingFormat()->rawValue().toInt());
if(fileFormat < VideoReceiver::FILE_FORMAT_MIN || fileFormat >= VideoReceiver::FILE_FORMAT_MAX) { if(fileFormat < VideoReceiver::FILE_FORMAT_MIN || fileFormat >= VideoReceiver::FILE_FORMAT_MAX) {
qgcApp()->showMessage(tr("Invalid video format defined.")); qgcApp()->showAppMessage(tr("Invalid video format defined."));
return; return;
} }
...@@ -237,7 +237,7 @@ VideoManager::startRecording(const QString& videoFile) ...@@ -237,7 +237,7 @@ VideoManager::startRecording(const QString& videoFile)
QString savePath = qgcApp()->toolbox()->settingsManager()->appSettings()->videoSavePath(); QString savePath = qgcApp()->toolbox()->settingsManager()->appSettings()->videoSavePath();
if(savePath.isEmpty()) { if(savePath.isEmpty()) {
qgcApp()->showMessage(tr("Unabled to record video. Video save path must be specified in Settings.")); qgcApp()->showAppMessage(tr("Unabled to record video. Video save path must be specified in Settings."));
return; return;
} }
......
...@@ -295,7 +295,7 @@ SharedLinkInterfacePointer LinkManager::sharedLinkInterfacePointerForLink(LinkIn ...@@ -295,7 +295,7 @@ SharedLinkInterfacePointer LinkManager::sharedLinkInterfacePointerForLink(LinkIn
bool LinkManager::_connectionsSuspendedMsg(void) bool LinkManager::_connectionsSuspendedMsg(void)
{ {
if (_connectionsSuspended) { if (_connectionsSuspended) {
qgcApp()->showMessage(tr("Connect not allowed: %1").arg(_connectionsSuspendedReason)); qgcApp()->showAppMessage(tr("Connect not allowed: %1").arg(_connectionsSuspendedReason));
return true; return true;
} else { } else {
return false; return false;
...@@ -932,7 +932,7 @@ void LinkManager::_activeLinkCheck(void) ...@@ -932,7 +932,7 @@ void LinkManager::_activeLinkCheck(void)
foundNSHPrompt = true; foundNSHPrompt = true;
} }
} }
qgcApp()->showMessage( qgcApp()->showAppMessage(
foundNSHPrompt ? foundNSHPrompt ?
tr("Please check to make sure you have an SD Card inserted in your Vehicle and try again.") : tr("Please check to make sure you have an SD Card inserted in your Vehicle and try again.") :
tr("Your Vehicle is not responding. If this continues, shutdown %1, restart the Vehicle letting it boot completely, then start %1.").arg(qgcApp()->applicationName())); tr("Your Vehicle is not responding. If this continues, shutdown %1, restart the Vehicle letting it boot completely, then start %1.").arg(qgcApp()->applicationName()));
......
...@@ -202,7 +202,7 @@ void UASMessageHandler::handleTextMessage(int, int compId, int severity, QString ...@@ -202,7 +202,7 @@ void UASMessageHandler::handleTextMessage(int, int compId, int severity, QString
emit textMessageCountChanged(count); emit textMessageCountChanged(count);
if (_showErrorsInToolbar && message->severityIsError()) { if (_showErrorsInToolbar && message->severityIsError()) {
_app->showMessage(message->getText()); _app->showVehicleMessage(message->getText());
} }
} }
......
...@@ -151,25 +151,24 @@ ApplicationWindow { ...@@ -151,25 +151,24 @@ ApplicationWindow {
//-- Global simple message dialog //-- Global simple message dialog
function showMessageDialog(title, text) { function showMessageDialog(title, text) {
if(simpleMessageDialog.visible) { var dialog = simpleMessageDialog.createObject(mainWindow, { title: title, text: text })
simpleMessageDialog.close() dialog.open()
}
simpleMessageDialog.title = title
simpleMessageDialog.text = text
simpleMessageDialog.open()
} }
/// Saves main window position and size Component {
MainWindowSavedState { id: simpleMessageDialog
window: mainWindow
}
MessageDialog { MessageDialog {
id: simpleMessageDialog
standardButtons: StandardButton.Ok standardButtons: StandardButton.Ok
modality: Qt.ApplicationModal modality: Qt.ApplicationModal
visible: false visible: false
} }
}
/// Saves main window position and size
MainWindowSavedState {
window: mainWindow
}
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
//-- Global complex dialog //-- Global complex dialog
...@@ -524,7 +523,7 @@ ApplicationWindow { ...@@ -524,7 +523,7 @@ ApplicationWindow {
property var _messageQueue: [] property var _messageQueue: []
property string _systemMessage: "" property string _systemMessage: ""
function showMessage(message) { function showVehicleMessage(message) {
vehicleMessageArea.close() vehicleMessageArea.close()
if(systemMessageArea.visible || QGroundControl.videoManager.fullScreen) { if(systemMessageArea.visible || QGroundControl.videoManager.fullScreen) {
_messageQueue.push(message) _messageQueue.push(message)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment