diff --git a/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.cc b/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.cc index 91413929d2dcc1be6e2612f5f159c6159f7b2331..f29cd98c221544661ec4d544d9e76c09a12a69b8 100644 --- a/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.cc +++ b/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.cc @@ -23,7 +23,6 @@ #include "APMAutoPilotPlugin.h" #include "AutoPilotPluginManager.h" -#include "QGCMessageBox.h" #include "UAS.h" #include "FirmwarePlugin/APM/APMParameterMetaData.h" // FIXME: Hack #include "FirmwarePlugin/APM/APMFirmwarePlugin.h" // FIXME: Hack @@ -83,8 +82,8 @@ void APMAutoPilotPlugin::_parametersReadyPreChecks(bool missingParameters) // should be used instead. if (parameterExists(FactSystem::defaultComponentId, "SENS_GYRO_XOFF")) { _incorrectParameterVersion = true; - QGCMessageBox::warning("Setup", "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."); + 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."); } #endif diff --git a/src/AutoPilotPlugins/AutoPilotPlugin.cc b/src/AutoPilotPlugins/AutoPilotPlugin.cc index 044dd6e356383b7c2486ef0671b1b522f9ce845c..d44f95dd62662a25489393f3282822da02ca9ae5 100644 --- a/src/AutoPilotPlugins/AutoPilotPlugin.cc +++ b/src/AutoPilotPlugins/AutoPilotPlugin.cc @@ -26,7 +26,6 @@ #include "AutoPilotPlugin.h" #include "QGCApplication.h" -#include "QGCMessageBox.h" #include "MainWindow.h" #include "ParameterLoader.h" #include "UAS.h" @@ -63,7 +62,7 @@ void AutoPilotPlugin::_parametersReadyChanged(bool parametersReady) if (parametersReady) { _recalcSetupComplete(); 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 MainWindow::instance()->showSetupView(); diff --git a/src/AutoPilotPlugins/Common/RadioComponentController.cc b/src/AutoPilotPlugins/Common/RadioComponentController.cc index 8516a8f3f4bca6e38a0004d4a5429c875441ce11..2f88a4840046345d90f47ca25e0166f4d950ae27 100644 --- a/src/AutoPilotPlugins/Common/RadioComponentController.cc +++ b/src/AutoPilotPlugins/Common/RadioComponentController.cc @@ -308,7 +308,7 @@ void RadioComponentController::nextButtonClicked(void) if (_unitTestMode) { emit nextButtonMessageBoxDisplayed(); } 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; } @@ -567,7 +567,7 @@ void RadioComponentController::_saveFlapsDown(void) if (_unitTestMode) { emit nextButtonMessageBoxDisplayed(); } else { - QGCMessageBox::warning(tr("Flaps switch"), tr("Flaps switch has not yet been detected.")); + qgcApp()->showMessage("Flaps switch has not yet been detected."); } return; } diff --git a/src/AutoPilotPlugins/PX4/AirframeComponentController.cc b/src/AutoPilotPlugins/PX4/AirframeComponentController.cc index ab8371e4ced656ab8fc766ebe71a092c80c613dc..91d8b00613798f8c149de562d4fc2845d85eaf32 100644 --- a/src/AutoPilotPlugins/PX4/AirframeComponentController.cc +++ b/src/AutoPilotPlugins/PX4/AirframeComponentController.cc @@ -30,7 +30,6 @@ #include "MultiVehicleManager.h" #include "AutoPilotPluginManager.h" #include "QGCApplication.h" -#include "QGCMessageBox.h" #include #include @@ -98,7 +97,7 @@ AirframeComponentController::~AirframeComponentController() void AirframeComponentController::changeAutostart(void) { 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; } diff --git a/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc b/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc index 930cda13e866bd0b5bf910fc4009da6d231de62b..24bd16d6f7418ef2e8c1665dda16ca3ed71e75ab 100644 --- a/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc +++ b/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc @@ -26,10 +26,10 @@ #include "PX4AirframeLoader.h" #include "FlightModesComponentController.h" #include "AirframeComponentController.h" -#include "QGCMessageBox.h" #include "UAS.h" #include "FirmwarePlugin/PX4/PX4ParameterMetaData.h" // FIXME: Hack #include "FirmwarePlugin/PX4/PX4FirmwarePlugin.h" // FIXME: Hack +#include "QGCApplication.h" /// @file /// @brief This is the AutoPilotPlugin implementatin for the MAV_AUTOPILOT_PX4 type. @@ -139,8 +139,8 @@ void PX4AutoPilotPlugin::_parametersReadyPreChecks(bool missingParameters) // should be used instead. if (parameterExists(FactSystem::defaultComponentId, "SENS_GYRO_XOFF")) { _incorrectParameterVersion = true; - QGCMessageBox::warning("Setup", "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."); + 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."); } _parametersReady = true; diff --git a/src/AutoPilotPlugins/PX4/PowerComponentController.cc b/src/AutoPilotPlugins/PX4/PowerComponentController.cc index 416caf928c2f18d8f2186ae518201c8849382038..604fee7c2e6be558e08cc5b8ae6fc60de6081b26 100644 --- a/src/AutoPilotPlugins/PX4/PowerComponentController.cc +++ b/src/AutoPilotPlugins/PX4/PowerComponentController.cc @@ -26,7 +26,6 @@ #include "PowerComponentController.h" #include "QGCMAVLink.h" -#include "QGCMessageBox.h" #include "UAS.h" #include diff --git a/src/AutoPilotPlugins/PX4/SensorsComponentController.cc b/src/AutoPilotPlugins/PX4/SensorsComponentController.cc index 86732c01e2f999ba051aae1f59404de531b06a51..4eb5fdbd10430422a6f936c2631df37aa59b9353 100644 --- a/src/AutoPilotPlugins/PX4/SensorsComponentController.cc +++ b/src/AutoPilotPlugins/PX4/SensorsComponentController.cc @@ -26,8 +26,8 @@ #include "SensorsComponentController.h" #include "QGCMAVLink.h" -#include "QGCMessageBox.h" #include "UAS.h" +#include "QGCApplication.h" #include #include @@ -181,7 +181,7 @@ void SensorsComponentController::_stopCalibration(SensorsComponentController::St default: // Assume failed _hideAllCalAreas(); - QGCMessageBox::warning("Calibration", "Calibration failed. Calibration log will be displayed."); + qgcApp()->showMessage("Calibration failed. Calibration log will be displayed."); break; } diff --git a/src/FactSystem/FactControls/FactPanelController.cc b/src/FactSystem/FactControls/FactPanelController.cc index 850116b0aa3805ba5e8e1fc77f3677fb4f3acaca..be1dbd070fcd91cfa9f6bd2ae6d775abc384a5c2 100644 --- a/src/FactSystem/FactControls/FactPanelController.cc +++ b/src/FactSystem/FactControls/FactPanelController.cc @@ -23,8 +23,8 @@ #include "FactPanelController.h" #include "MultiVehicleManager.h" -#include "QGCMessageBox.h" #include "UAS.h" +#include "QGCApplication.h" #include @@ -150,5 +150,5 @@ void FactPanelController::_showInternalError(const QString& errorMsg) { _notifyPanelErrorMsg(QString("Internal Error: %1").arg(errorMsg)); qCWarning(FactPanelControllerLog) << "Internal Error" << errorMsg; - QGCMessageBox::critical("Internal Error", errorMsg); + qgcApp()->showMessage(errorMsg); } diff --git a/src/FactSystem/FactSystemTestBase.cc b/src/FactSystem/FactSystemTestBase.cc index ca5063f176109df8d139c6a026f1a40c292c90d6..d23c3ac551926fe90a6fdbaa21c8414eccfa6092 100644 --- a/src/FactSystem/FactSystemTestBase.cc +++ b/src/FactSystem/FactSystemTestBase.cc @@ -31,7 +31,6 @@ #endif #include "MultiVehicleManager.h" #include "QGCApplication.h" -#include "QGCMessageBox.h" #include "QGCQuickWidget.h" #include diff --git a/src/FactSystem/ParameterLoader.cc b/src/FactSystem/ParameterLoader.cc index db2d15f793514d7eab820e66dfe7db84d332004b..0fbd59e6727d51bf31fd3af544b858edb6b015b7 100644 --- a/src/FactSystem/ParameterLoader.cc +++ b/src/FactSystem/ParameterLoader.cc @@ -848,18 +848,17 @@ void ParameterLoader::_checkInitialLoadComplete(void) if (errorsFound) { QString errorMsg = QString("Critical safety issue detected:
%1").arg(errors); - qgcApp()->showToolBarMessage(errorMsg); + qgcApp()->showMessage(errorMsg); } } // Warn of parameter load failure if (initialLoadFailures) { - QGCMessageBox::critical("Parameter Load Failure", - "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. " - "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."); + qgcApp()->showMessage("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. " + "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."); qCWarning(ParameterLoaderLog) << "The following parameter indices could not be loaded after the maximum number of retries: " << indexList; emit parametersReady(true); } else { diff --git a/src/HomePositionManager.cc b/src/HomePositionManager.cc index f478c670b3173fa6d63dc1990cd9e9ee4d694b3e..a235c3117c3390b2f776578952f420d8f4c486d2 100644 --- a/src/HomePositionManager.cc +++ b/src/HomePositionManager.cc @@ -31,7 +31,6 @@ #include "UASInterface.h" #include "HomePositionManager.h" #include "QGC.h" -#include "QGCMessageBox.h" #include "QGCApplication.h" #include "MultiVehicleManager.h" diff --git a/src/MissionManager/MissionController.cc b/src/MissionManager/MissionController.cc index 02d1ba2b867b01fba2be14c6f4fee777e0840dd4..15b004f1e43d9b8e171e20d6b2811b41ad1f6046 100644 --- a/src/MissionManager/MissionController.cc +++ b/src/MissionManager/MissionController.cc @@ -26,8 +26,8 @@ This file is part of the QGROUNDCONTROL project #include "MissionManager.h" #include "QGCFileDialog.h" #include "CoordinateVector.h" -#include "QGCMessageBox.h" #include "FirmwarePlugin.h" +#include "QGCApplication.h" QGC_LOGGING_CATEGORY(MissionControllerLog, "MissionControllerLog") diff --git a/src/QGCApplication.cc b/src/QGCApplication.cc index b3e795af32cac8103de34942c9257d4afe060f7a..beddbde4b37afb0fc8f37d6b2d0943d5d5113272 100644 --- a/src/QGCApplication.cc +++ b/src/QGCApplication.cc @@ -395,9 +395,8 @@ void QGCApplication::_initCommon(void) if (settingsUpgraded) { settings.clear(); settings.setValue(_settingsVersionKey, QGC_SETTINGS_VERSION); - QGCMessageBox::information(tr("Settings Cleared"), - tr("The format for QGroundControl saved settings has been modified. " - "Your saved settings have been reset to defaults.")); + showMessage("The format for QGroundControl saved settings has been modified. " + "Your saved settings have been reset to defaults."); } // Load saved files location and validate @@ -590,7 +589,8 @@ QGCApplication* qgcApp(void) 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) @@ -711,7 +711,7 @@ void QGCApplication::_missingParamsDisplay(void) "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(); if (mainWindow) { diff --git a/src/QGCApplication.h b/src/QGCApplication.h index ec19b0302ea8933e3c5badc1a282090fa60e29dc..51118427ede45ef94e92414730ddb3c8d0d31f9d 100644 --- a/src/QGCApplication.h +++ b/src/QGCApplication.h @@ -116,7 +116,7 @@ public: void reportMissingParameter(int componentId, const QString& name); /// 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 bool fakeMobile(void) { return _fakeMobile; } diff --git a/src/QmlControls/ParameterEditorController.cc b/src/QmlControls/ParameterEditorController.cc index 8cab46d3c583b58b5dcf7e7026eee5e04fc8f282..8d53863350cc5d57fef0cb2f6b2b0ca8070b60ae 100644 --- a/src/QmlControls/ParameterEditorController.cc +++ b/src/QmlControls/ParameterEditorController.cc @@ -27,9 +27,9 @@ #include "ParameterEditorController.h" #include "AutoPilotPluginManager.h" #include "QGCFileDialog.h" -#include "QGCMessageBox.h" #include "QGCMapRCToParamDialog.h" #include "MainWindow.h" +#include "QGCApplication.h" /// @Brief Constructs a new ParameterEditorController Widget. This widget is used within the PX4VehicleConfig set of screens. ParameterEditorController::ParameterEditorController(void) @@ -106,7 +106,7 @@ void ParameterEditorController::saveToFile(void) QFile file(fileName); if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { - QGCMessageBox::critical(msgTitle, "Unable to create file"); + qgcApp()->showMessage("Unable to create file"); return; } @@ -132,7 +132,7 @@ void ParameterEditorController::loadFromFile(void) QFile file(fileName); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { - QGCMessageBox::critical(msgTitle, "Unable to open file"); + qgcApp()->showMessage("Unable to open file"); return; } diff --git a/src/Vehicle/Vehicle.cc b/src/Vehicle/Vehicle.cc index 8df158ccb75a1f042121a824dd0357095f133d6a..1d0d1475bebefc5fa7c63dbc635eb85372485996 100644 --- a/src/Vehicle/Vehicle.cc +++ b/src/Vehicle/Vehicle.cc @@ -1080,7 +1080,7 @@ void Vehicle::sendMessageMultiple(mavlink_message_t message) void Vehicle::_missionManagerError(int errorCode, const QString& errorMsg) { 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) diff --git a/src/VehicleSetup/FirmwareUpgradeController.cc b/src/VehicleSetup/FirmwareUpgradeController.cc index e25da2e6f9b68d017e04b68a69fbe5d708b51b70..d5a2585fec25d9930c6322752ffaf71f82494f1e 100644 --- a/src/VehicleSetup/FirmwareUpgradeController.cc +++ b/src/VehicleSetup/FirmwareUpgradeController.cc @@ -28,8 +28,7 @@ #include "FirmwareUpgradeController.h" #include "Bootloader.h" #include "QGCFileDialog.h" -#include "QGCMessageBox.h" - +#include "QGCApplication.h" struct FirmwareToUrlElement_t { FirmwareUpgradeController::AutoPilotStackType_t stackType; diff --git a/src/VehicleSetup/JoystickConfigController.cc b/src/VehicleSetup/JoystickConfigController.cc index 96beec80620e0799b7702de679c7c68e56c4044f..102603090d60905819881d9394d0b45bb162236f 100644 --- a/src/VehicleSetup/JoystickConfigController.cc +++ b/src/VehicleSetup/JoystickConfigController.cc @@ -23,7 +23,6 @@ #include "JoystickConfigController.h" #include "JoystickManager.h" -#include "QGCMessageBox.h" #include "QGCApplication.h" #include @@ -197,7 +196,7 @@ void JoystickConfigController::nextButtonClicked(void) if (_currentStep == -1) { // Need to have enough channels 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; } _startCalibration(); diff --git a/src/VehicleSetup/SetupViewTest.cc b/src/VehicleSetup/SetupViewTest.cc index d7fa322a8c3d36180bd96a206844b604360e1a8c..649d9a30d9b5373d2617047c32d4b39e1b909395 100644 --- a/src/VehicleSetup/SetupViewTest.cc +++ b/src/VehicleSetup/SetupViewTest.cc @@ -26,8 +26,8 @@ #include "SetupViewTest.h" #include "MockLink.h" -#include "QGCMessageBox.h" #include "MultiVehicleManager.h" +#include "QGCApplication.h" void SetupViewTest::_clickThrough_test(void) { diff --git a/src/comm/LinkManager.cc b/src/comm/LinkManager.cc index 3a01b6bab530e6e16b77b8a991dcb0c8e291cd9a..0e12c749f747e33c5f6e25806d449caf0adfb7f3 100644 --- a/src/comm/LinkManager.cc +++ b/src/comm/LinkManager.cc @@ -39,7 +39,6 @@ This file is part of the QGROUNDCONTROL project #include "LinkManager.h" #include "MainWindow.h" -#include "QGCMessageBox.h" #include "QGCApplication.h" #include "QGCApplication.h" #include "UDPLink.h" @@ -276,8 +275,7 @@ void LinkManager::_deleteLink(LinkInterface* link) bool LinkManager::_connectionsSuspendedMsg(void) { if (_connectionsSuspended) { - QGCMessageBox::information(tr("Connect not allowed"), - tr("Connect not allowed: %1").arg(_connectionsSuspendedReason)); + qgcApp()->showMessage(QString("Connect not allowed: %1").arg(_connectionsSuspendedReason)); return true; } else { return false; @@ -618,14 +616,14 @@ void LinkManager::_vehicleHeartbeatInfo(LinkInterface* link, int vehicleId, int << vehicleType; 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; bool mavlinkVersionCheck = settings.value("VERSION_CHECK_ENABLED", true).toBool(); if (mavlinkVersionCheck && vehicleMavlinkVersion != MAVLINK_VERSION) { _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. " "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; diff --git a/src/uas/UAS.cc b/src/uas/UAS.cc index 574d28caa869dc3976216b044d2484d7f751800d..4bab6568ea43695e7d766c4323c54c03b93ddbde 100644 --- a/src/uas/UAS.cc +++ b/src/uas/UAS.cc @@ -34,10 +34,10 @@ #endif #include #include "FirmwarePluginManager.h" -#include "QGCMessageBox.h" #include "QGCLoggingCategory.h" #include "Vehicle.h" #include "Joystick.h" +#include "QGCApplication.h" QGC_LOGGING_CATEGORY(UASLog, "UASLog") diff --git a/src/uas/UASMessageHandler.cc b/src/uas/UASMessageHandler.cc index 7582bd2e2749e944abe918cb0768683328988c74..5d1b58710f10275d4441cd666c302aeef58bed69 100644 --- a/src/uas/UASMessageHandler.cc +++ b/src/uas/UASMessageHandler.cc @@ -198,7 +198,7 @@ void UASMessageHandler::handleTextMessage(int, int compId, int severity, QString emit textMessageCountChanged(count); if (_showErrorsInToolbar && message->severityIsError()) { - _app->showToolBarMessage(message->getText()); + _app->showMessage(message->getText()); } }