Commit 89cacd32 authored by Don Gagne's avatar Don Gagne

Convert QGCMessageBox to QGCApplication::showMessage

parent 745fff0c
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include "APMAutoPilotPlugin.h" #include "APMAutoPilotPlugin.h"
#include "AutoPilotPluginManager.h" #include "AutoPilotPluginManager.h"
#include "QGCMessageBox.h"
#include "UAS.h" #include "UAS.h"
#include "FirmwarePlugin/APM/APMParameterMetaData.h" // FIXME: Hack #include "FirmwarePlugin/APM/APMParameterMetaData.h" // FIXME: Hack
#include "FirmwarePlugin/APM/APMFirmwarePlugin.h" // FIXME: Hack #include "FirmwarePlugin/APM/APMFirmwarePlugin.h" // FIXME: Hack
...@@ -76,8 +75,8 @@ void APMAutoPilotPlugin::_parametersReadyPreChecks(bool missingParameters) ...@@ -76,8 +75,8 @@ void APMAutoPilotPlugin::_parametersReadyPreChecks(bool missingParameters)
// should be used instead. // should be used instead.
if (parameterExists(FactSystem::defaultComponentId, "SENS_GYRO_XOFF")) { if (parameterExists(FactSystem::defaultComponentId, "SENS_GYRO_XOFF")) {
_incorrectParameterVersion = true; _incorrectParameterVersion = true;
QGCMessageBox::warning("Setup", "This version of GroundControl can only perform vehicle setup on a newer version of firmware. " qgcApp()->showMessage("This version of GroundControl can only perform vehicle setup on a newer version of firmware. "
"Please perform a Firmware Upgrade if you wish to use Vehicle Setup."); "Please perform a Firmware Upgrade if you wish to use Vehicle Setup.");
} }
#endif #endif
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include "AutoPilotPlugin.h" #include "AutoPilotPlugin.h"
#include "QGCApplication.h" #include "QGCApplication.h"
#include "QGCMessageBox.h"
#include "MainWindow.h" #include "MainWindow.h"
#include "ParameterLoader.h" #include "ParameterLoader.h"
#include "UAS.h" #include "UAS.h"
...@@ -63,7 +62,7 @@ void AutoPilotPlugin::_parametersReadyChanged(bool parametersReady) ...@@ -63,7 +62,7 @@ void AutoPilotPlugin::_parametersReadyChanged(bool parametersReady)
if (parametersReady) { if (parametersReady) {
_recalcSetupComplete(); _recalcSetupComplete();
if (!_setupComplete) { if (!_setupComplete) {
qgcApp()->showToolBarMessage("One or more vehicle components require setup prior to flight."); qgcApp()->showMessage("One or more vehicle components require setup prior to flight.");
// Take the user to Vehicle Summary // Take the user to Vehicle Summary
MainWindow::instance()->showSetupView(); MainWindow::instance()->showSetupView();
......
...@@ -308,7 +308,7 @@ void RadioComponentController::nextButtonClicked(void) ...@@ -308,7 +308,7 @@ void RadioComponentController::nextButtonClicked(void)
if (_unitTestMode) { if (_unitTestMode) {
emit nextButtonMessageBoxDisplayed(); emit nextButtonMessageBoxDisplayed();
} else { } else {
QGCMessageBox::warning(tr("Receiver"), tr("Detected %1 radio channels. To operate PX4, you need at least %2 channels.").arg(_chanCount).arg(_chanMinimum)); qgcApp()->showMessage(QString("Detected %1 radio channels. To operate PX4, you need at least %2 channels.").arg(_chanCount).arg(_chanMinimum));
} }
return; return;
} }
...@@ -567,7 +567,7 @@ void RadioComponentController::_saveFlapsDown(void) ...@@ -567,7 +567,7 @@ void RadioComponentController::_saveFlapsDown(void)
if (_unitTestMode) { if (_unitTestMode) {
emit nextButtonMessageBoxDisplayed(); emit nextButtonMessageBoxDisplayed();
} else { } else {
QGCMessageBox::warning(tr("Flaps switch"), tr("Flaps switch has not yet been detected.")); qgcApp()->showMessage("Flaps switch has not yet been detected.");
} }
return; return;
} }
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include "MultiVehicleManager.h" #include "MultiVehicleManager.h"
#include "AutoPilotPluginManager.h" #include "AutoPilotPluginManager.h"
#include "QGCApplication.h" #include "QGCApplication.h"
#include "QGCMessageBox.h"
#include <QVariant> #include <QVariant>
#include <QQmlProperty> #include <QQmlProperty>
...@@ -98,7 +97,7 @@ AirframeComponentController::~AirframeComponentController() ...@@ -98,7 +97,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) {
QGCMessageBox::warning("Airframe Config", "You cannot change airframe configuration while connected to multiple vehicles."); qgcApp()->showMessage("You cannot change airframe configuration while connected to multiple vehicles.");
return; return;
} }
......
...@@ -26,10 +26,10 @@ ...@@ -26,10 +26,10 @@
#include "PX4AirframeLoader.h" #include "PX4AirframeLoader.h"
#include "FlightModesComponentController.h" #include "FlightModesComponentController.h"
#include "AirframeComponentController.h" #include "AirframeComponentController.h"
#include "QGCMessageBox.h"
#include "UAS.h" #include "UAS.h"
#include "FirmwarePlugin/PX4/PX4ParameterMetaData.h" // FIXME: Hack #include "FirmwarePlugin/PX4/PX4ParameterMetaData.h" // FIXME: Hack
#include "FirmwarePlugin/PX4/PX4FirmwarePlugin.h" // FIXME: Hack #include "FirmwarePlugin/PX4/PX4FirmwarePlugin.h" // FIXME: Hack
#include "QGCApplication.h"
/// @file /// @file
/// @brief This is the AutoPilotPlugin implementatin for the MAV_AUTOPILOT_PX4 type. /// @brief This is the AutoPilotPlugin implementatin for the MAV_AUTOPILOT_PX4 type.
...@@ -139,8 +139,8 @@ void PX4AutoPilotPlugin::_parametersReadyPreChecks(bool missingParameters) ...@@ -139,8 +139,8 @@ void PX4AutoPilotPlugin::_parametersReadyPreChecks(bool missingParameters)
// should be used instead. // should be used instead.
if (parameterExists(FactSystem::defaultComponentId, "SENS_GYRO_XOFF")) { if (parameterExists(FactSystem::defaultComponentId, "SENS_GYRO_XOFF")) {
_incorrectParameterVersion = true; _incorrectParameterVersion = true;
QGCMessageBox::warning("Setup", "This version of GroundControl can only perform vehicle setup on a newer version of firmware. " qgcApp()->showMessage("This version of GroundControl can only perform vehicle setup on a newer version of firmware. "
"Please perform a Firmware Upgrade if you wish to use Vehicle Setup."); "Please perform a Firmware Upgrade if you wish to use Vehicle Setup.");
} }
_parametersReady = true; _parametersReady = true;
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include "PowerComponentController.h" #include "PowerComponentController.h"
#include "QGCMAVLink.h" #include "QGCMAVLink.h"
#include "QGCMessageBox.h"
#include "UAS.h" #include "UAS.h"
#include <QVariant> #include <QVariant>
......
...@@ -26,8 +26,8 @@ ...@@ -26,8 +26,8 @@
#include "SensorsComponentController.h" #include "SensorsComponentController.h"
#include "QGCMAVLink.h" #include "QGCMAVLink.h"
#include "QGCMessageBox.h"
#include "UAS.h" #include "UAS.h"
#include "QGCApplication.h"
#include <QVariant> #include <QVariant>
#include <QQmlProperty> #include <QQmlProperty>
...@@ -181,7 +181,7 @@ void SensorsComponentController::_stopCalibration(SensorsComponentController::St ...@@ -181,7 +181,7 @@ void SensorsComponentController::_stopCalibration(SensorsComponentController::St
default: default:
// Assume failed // Assume failed
_hideAllCalAreas(); _hideAllCalAreas();
QGCMessageBox::warning("Calibration", "Calibration failed. Calibration log will be displayed."); qgcApp()->showMessage("Calibration failed. Calibration log will be displayed.");
break; break;
} }
......
...@@ -23,8 +23,8 @@ ...@@ -23,8 +23,8 @@
#include "FactPanelController.h" #include "FactPanelController.h"
#include "MultiVehicleManager.h" #include "MultiVehicleManager.h"
#include "QGCMessageBox.h"
#include "UAS.h" #include "UAS.h"
#include "QGCApplication.h"
#include <QQmlEngine> #include <QQmlEngine>
...@@ -150,5 +150,5 @@ void FactPanelController::_showInternalError(const QString& errorMsg) ...@@ -150,5 +150,5 @@ void FactPanelController::_showInternalError(const QString& errorMsg)
{ {
_notifyPanelErrorMsg(QString("Internal Error: %1").arg(errorMsg)); _notifyPanelErrorMsg(QString("Internal Error: %1").arg(errorMsg));
qCWarning(FactPanelControllerLog) << "Internal Error" << errorMsg; qCWarning(FactPanelControllerLog) << "Internal Error" << errorMsg;
QGCMessageBox::critical("Internal Error", errorMsg); qgcApp()->showMessage(errorMsg);
} }
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#endif #endif
#include "MultiVehicleManager.h" #include "MultiVehicleManager.h"
#include "QGCApplication.h" #include "QGCApplication.h"
#include "QGCMessageBox.h"
#include "QGCQuickWidget.h" #include "QGCQuickWidget.h"
#include <QQuickItem> #include <QQuickItem>
......
...@@ -848,18 +848,17 @@ void ParameterLoader::_checkInitialLoadComplete(void) ...@@ -848,18 +848,17 @@ void ParameterLoader::_checkInitialLoadComplete(void)
if (errorsFound) { if (errorsFound) {
QString errorMsg = QString("<b>Critical safety issue detected:</b><br>%1").arg(errors); QString errorMsg = QString("<b>Critical safety issue detected:</b><br>%1").arg(errors);
qgcApp()->showToolBarMessage(errorMsg); qgcApp()->showMessage(errorMsg);
} }
} }
// Warn of parameter load failure // Warn of parameter load failure
if (initialLoadFailures) { if (initialLoadFailures) {
QGCMessageBox::critical("Parameter Load Failure", qgcApp()->showMessage("QGroundControl was unable to retrieve the full set of parameters from the vehicle. "
"QGroundControl was unable to retrieve the full set of parameters from the vehicle. " "This will cause QGroundControl to be unable to display it's full user interface. "
"This will cause QGroundControl to be unable to display it's full user interface. " "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.");
"If you are using standard firmware, you may need to upgrade to a newer version to resolve the issue.");
qCWarning(ParameterLoaderLog) << "The following parameter indices could not be loaded after the maximum number of retries: " << indexList; qCWarning(ParameterLoaderLog) << "The following parameter indices could not be loaded after the maximum number of retries: " << indexList;
emit parametersReady(true); emit parametersReady(true);
} else { } else {
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#include "UASInterface.h" #include "UASInterface.h"
#include "HomePositionManager.h" #include "HomePositionManager.h"
#include "QGC.h" #include "QGC.h"
#include "QGCMessageBox.h"
#include "QGCApplication.h" #include "QGCApplication.h"
#include "MultiVehicleManager.h" #include "MultiVehicleManager.h"
......
...@@ -26,8 +26,8 @@ This file is part of the QGROUNDCONTROL project ...@@ -26,8 +26,8 @@ This file is part of the QGROUNDCONTROL project
#include "MissionManager.h" #include "MissionManager.h"
#include "QGCFileDialog.h" #include "QGCFileDialog.h"
#include "CoordinateVector.h" #include "CoordinateVector.h"
#include "QGCMessageBox.h"
#include "FirmwarePlugin.h" #include "FirmwarePlugin.h"
#include "QGCApplication.h"
QGC_LOGGING_CATEGORY(MissionControllerLog, "MissionControllerLog") QGC_LOGGING_CATEGORY(MissionControllerLog, "MissionControllerLog")
......
...@@ -393,9 +393,8 @@ void QGCApplication::_initCommon(void) ...@@ -393,9 +393,8 @@ void QGCApplication::_initCommon(void)
if (settingsUpgraded) { if (settingsUpgraded) {
settings.clear(); settings.clear();
settings.setValue(_settingsVersionKey, QGC_SETTINGS_VERSION); settings.setValue(_settingsVersionKey, QGC_SETTINGS_VERSION);
QGCMessageBox::information(tr("Settings Cleared"), showMessage("The format for QGroundControl saved settings has been modified. "
tr("The format for QGroundControl saved settings has been modified. " "Your saved settings have been reset to defaults.");
"Your saved settings have been reset to defaults."));
} }
// Load saved files location and validate // Load saved files location and validate
...@@ -588,7 +587,8 @@ QGCApplication* qgcApp(void) ...@@ -588,7 +587,8 @@ QGCApplication* qgcApp(void)
void QGCApplication::informationMessageBoxOnMainThread(const QString& title, const QString& msg) void QGCApplication::informationMessageBoxOnMainThread(const QString& title, const QString& msg)
{ {
QGCMessageBox::information(title, msg); Q_UNUSED(title);
showMessage(msg);
} }
void QGCApplication::warningMessageBoxOnMainThread(const QString& title, const QString& msg) void QGCApplication::warningMessageBoxOnMainThread(const QString& title, const QString& msg)
...@@ -709,7 +709,7 @@ void QGCApplication::_missingParamsDisplay(void) ...@@ -709,7 +709,7 @@ void QGCApplication::_missingParamsDisplay(void)
"You should quit QGroundControl immediately and update your firmware.").arg(params)); "You should quit QGroundControl immediately and update your firmware.").arg(params));
} }
void QGCApplication::showToolBarMessage(const QString& message) void QGCApplication::showMessage(const QString& message)
{ {
MainWindow* mainWindow = MainWindow::instance(); MainWindow* mainWindow = MainWindow::instance();
if (mainWindow) { if (mainWindow) {
......
...@@ -116,7 +116,7 @@ public: ...@@ -116,7 +116,7 @@ public:
void reportMissingParameter(int componentId, const QString& name); void reportMissingParameter(int componentId, const QString& name);
/// Show a non-modal message to the user /// Show a non-modal message to the user
void showToolBarMessage(const QString& message); void showMessage(const QString& message);
/// @return true: Fake ui into showing mobile interface /// @return true: Fake ui into showing mobile interface
bool fakeMobile(void) { return _fakeMobile; } bool fakeMobile(void) { return _fakeMobile; }
......
...@@ -27,9 +27,9 @@ ...@@ -27,9 +27,9 @@
#include "ParameterEditorController.h" #include "ParameterEditorController.h"
#include "AutoPilotPluginManager.h" #include "AutoPilotPluginManager.h"
#include "QGCFileDialog.h" #include "QGCFileDialog.h"
#include "QGCMessageBox.h"
#include "QGCMapRCToParamDialog.h" #include "QGCMapRCToParamDialog.h"
#include "MainWindow.h" #include "MainWindow.h"
#include "QGCApplication.h"
/// @Brief Constructs a new ParameterEditorController Widget. This widget is used within the PX4VehicleConfig set of screens. /// @Brief Constructs a new ParameterEditorController Widget. This widget is used within the PX4VehicleConfig set of screens.
ParameterEditorController::ParameterEditorController(void) ParameterEditorController::ParameterEditorController(void)
...@@ -106,7 +106,7 @@ void ParameterEditorController::saveToFile(void) ...@@ -106,7 +106,7 @@ void ParameterEditorController::saveToFile(void)
QFile file(fileName); QFile file(fileName);
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
QGCMessageBox::critical(msgTitle, "Unable to create file"); qgcApp()->showMessage("Unable to create file");
return; return;
} }
...@@ -132,7 +132,7 @@ void ParameterEditorController::loadFromFile(void) ...@@ -132,7 +132,7 @@ void ParameterEditorController::loadFromFile(void)
QFile file(fileName); QFile file(fileName);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
QGCMessageBox::critical(msgTitle, "Unable to open file"); qgcApp()->showMessage("Unable to open file");
return; return;
} }
......
...@@ -1080,7 +1080,7 @@ void Vehicle::sendMessageMultiple(mavlink_message_t message) ...@@ -1080,7 +1080,7 @@ void Vehicle::sendMessageMultiple(mavlink_message_t message)
void Vehicle::_missionManagerError(int errorCode, const QString& errorMsg) void Vehicle::_missionManagerError(int errorCode, const QString& errorMsg)
{ {
Q_UNUSED(errorCode); Q_UNUSED(errorCode);
qgcApp()->showToolBarMessage(QString("Error during Mission communication with Vehicle: %1").arg(errorMsg)); qgcApp()->showMessage(QString("Error during Mission communication with Vehicle: %1").arg(errorMsg));
} }
void Vehicle::_addNewMapTrajectoryPoint(void) void Vehicle::_addNewMapTrajectoryPoint(void)
......
...@@ -28,8 +28,7 @@ ...@@ -28,8 +28,7 @@
#include "FirmwareUpgradeController.h" #include "FirmwareUpgradeController.h"
#include "Bootloader.h" #include "Bootloader.h"
#include "QGCFileDialog.h" #include "QGCFileDialog.h"
#include "QGCMessageBox.h" #include "QGCApplication.h"
struct FirmwareToUrlElement_t { struct FirmwareToUrlElement_t {
FirmwareUpgradeController::AutoPilotStackType_t stackType; FirmwareUpgradeController::AutoPilotStackType_t stackType;
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include "JoystickConfigController.h" #include "JoystickConfigController.h"
#include "JoystickManager.h" #include "JoystickManager.h"
#include "QGCMessageBox.h"
#include "QGCApplication.h" #include "QGCApplication.h"
#include <QSettings> #include <QSettings>
...@@ -197,7 +196,7 @@ void JoystickConfigController::nextButtonClicked(void) ...@@ -197,7 +196,7 @@ void JoystickConfigController::nextButtonClicked(void)
if (_currentStep == -1) { if (_currentStep == -1) {
// Need to have enough channels // Need to have enough channels
if (_axisCount < _axisMinimum) { if (_axisCount < _axisMinimum) {
QGCMessageBox::warning(tr("Joystick"), tr("Detected %1 joystick axes. To operate PX4, you need at least %2 axes.").arg(_axisCount).arg(_axisMinimum)); qgcApp()->showMessage(QString("Detected %1 joystick axes. To operate PX4, you need at least %2 axes.").arg(_axisCount).arg(_axisMinimum));
return; return;
} }
_startCalibration(); _startCalibration();
......
...@@ -26,8 +26,8 @@ ...@@ -26,8 +26,8 @@
#include "SetupViewTest.h" #include "SetupViewTest.h"
#include "MockLink.h" #include "MockLink.h"
#include "QGCMessageBox.h"
#include "MultiVehicleManager.h" #include "MultiVehicleManager.h"
#include "QGCApplication.h"
void SetupViewTest::_clickThrough_test(void) void SetupViewTest::_clickThrough_test(void)
{ {
......
...@@ -39,7 +39,6 @@ This file is part of the QGROUNDCONTROL project ...@@ -39,7 +39,6 @@ This file is part of the QGROUNDCONTROL project
#include "LinkManager.h" #include "LinkManager.h"
#include "MainWindow.h" #include "MainWindow.h"
#include "QGCMessageBox.h"
#include "QGCApplication.h" #include "QGCApplication.h"
#include "QGCApplication.h" #include "QGCApplication.h"
#include "UDPLink.h" #include "UDPLink.h"
...@@ -276,8 +275,7 @@ void LinkManager::_deleteLink(LinkInterface* link) ...@@ -276,8 +275,7 @@ void LinkManager::_deleteLink(LinkInterface* link)
bool LinkManager::_connectionsSuspendedMsg(void) bool LinkManager::_connectionsSuspendedMsg(void)
{ {
if (_connectionsSuspended) { if (_connectionsSuspended) {
QGCMessageBox::information(tr("Connect not allowed"), qgcApp()->showMessage(QString("Connect not allowed: %1").arg(_connectionsSuspendedReason));
tr("Connect not allowed: %1").arg(_connectionsSuspendedReason));
return true; return true;
} else { } else {
return false; return false;
...@@ -618,14 +616,14 @@ void LinkManager::_vehicleHeartbeatInfo(LinkInterface* link, int vehicleId, int ...@@ -618,14 +616,14 @@ void LinkManager::_vehicleHeartbeatInfo(LinkInterface* link, int vehicleId, int
<< vehicleType; << vehicleType;
if (vehicleId == _mavlinkProtocol->getSystemId()) { if (vehicleId == _mavlinkProtocol->getSystemId()) {
_app->showToolBarMessage(QString("Warning: A vehicle is using the same system id as QGroundControl: %1").arg(vehicleId)); _app->showMessage(QString("Warning: A vehicle is using the same system id as QGroundControl: %1").arg(vehicleId));
} }
QSettings settings; QSettings settings;
bool mavlinkVersionCheck = settings.value("VERSION_CHECK_ENABLED", true).toBool(); bool mavlinkVersionCheck = settings.value("VERSION_CHECK_ENABLED", true).toBool();
if (mavlinkVersionCheck && vehicleMavlinkVersion != MAVLINK_VERSION) { if (mavlinkVersionCheck && vehicleMavlinkVersion != MAVLINK_VERSION) {
_ignoreVehicleIds += vehicleId; _ignoreVehicleIds += vehicleId;
_app->showToolBarMessage(QString("The MAVLink protocol version on vehicle #%1 and QGroundControl differ! " _app->showMessage(QString("The MAVLink protocol version on vehicle #%1 and QGroundControl differ! "
"It is unsafe to use different MAVLink versions. " "It is unsafe to use different MAVLink versions. "
"QGroundControl therefore refuses to connect to vehicle #%1, which sends MAVLink version %2 (QGroundControl uses version %3).").arg(vehicleId).arg(vehicleMavlinkVersion).arg(MAVLINK_VERSION)); "QGroundControl therefore refuses to connect to vehicle #%1, which sends MAVLink version %2 (QGroundControl uses version %3).").arg(vehicleId).arg(vehicleMavlinkVersion).arg(MAVLINK_VERSION));
return; return;
......
...@@ -34,10 +34,10 @@ ...@@ -34,10 +34,10 @@
#endif #endif
#include <Eigen/Geometry> #include <Eigen/Geometry>
#include "FirmwarePluginManager.h" #include "FirmwarePluginManager.h"
#include "QGCMessageBox.h"
#include "QGCLoggingCategory.h" #include "QGCLoggingCategory.h"
#include "Vehicle.h" #include "Vehicle.h"
#include "Joystick.h" #include "Joystick.h"
#include "QGCApplication.h"
QGC_LOGGING_CATEGORY(UASLog, "UASLog") QGC_LOGGING_CATEGORY(UASLog, "UASLog")
......
...@@ -198,7 +198,7 @@ void UASMessageHandler::handleTextMessage(int, int compId, int severity, QString ...@@ -198,7 +198,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->showToolBarMessage(message->getText()); _app->showMessage(message->getText());
} }
} }
......
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