Browse Source

Merge pull request #1002 from DonLakeFlyer/QGCMessageBox

QGCMessageBox implementation
QGC4.4
Don Gagne 11 years ago
parent
commit
7fe044d132
  1. 3
      qgroundcontrol.pro
  2. 18
      src/QGCCore.cc
  3. 79
      src/QGCMessageBox.h
  4. 7
      src/comm/LinkManager.cc
  5. 1
      src/comm/MAVLinkProtocol.cc
  6. 6
      src/comm/OpalRT.cc
  7. 1
      src/comm/OpalRT.h
  8. 1
      src/comm/QGCFlightGearLink.cc
  9. 12
      src/input/Mouse6dofInput.cpp
  10. 7
      src/uas/QGCUASParamManager.cc
  11. 58
      src/uas/UAS.cc
  12. 5
      src/uas/UASManager.cc
  13. 1
      src/ui/MAVLinkSettingsWidget.cc
  14. 20
      src/ui/MainWindow.cc
  15. 45
      src/ui/QGCDataPlot2D.cc
  16. 5
      src/ui/QGCMAVLinkLogPlayer.cc
  17. 32
      src/ui/QGCPX4VehicleConfig.cc
  18. 2
      src/ui/QGCPX4VehicleConfig.h
  19. 1
      src/ui/QGCParamWidget.cc
  20. 15
      src/ui/QGCSettingsWidget.cc
  21. 1
      src/ui/QGCUASFileView.cc
  22. 1
      src/ui/WaypointList.cc
  23. 8
      src/ui/configuration/terminalconsole.cpp
  24. 36
      src/ui/linechart/LinechartWidget.cc
  25. 16
      src/ui/map/QGCMapWidget.cc
  26. 7
      src/ui/map3D/Pixhawk3DWidget.cc
  27. 4
      src/ui/px4_configuration/PX4FirmwareUpgrade.cc
  28. 8
      src/ui/px4_configuration/PX4RCCalibration.cc
  29. 29
      src/ui/px4_configuration/QGCPX4AirframeConfig.cc

3
qgroundcontrol.pro

@ -487,7 +487,8 @@ HEADERS += \
src/uas/QGCUASWorker.h \ src/uas/QGCUASWorker.h \
src/CmdLineOptParser.h \ src/CmdLineOptParser.h \
src/uas/QGXPX4UAS.h \ src/uas/QGXPX4UAS.h \
src/QGCFileDialog.h src/QGCFileDialog.h \
src/QGCMessageBox.h
SOURCES += \ SOURCES += \
src/main.cc \ src/main.cc \

18
src/QGCCore.cc

@ -47,6 +47,7 @@
#include "MainWindow.h" #include "MainWindow.h"
#include "GAudioOutput.h" #include "GAudioOutput.h"
#include "CmdLineOptParser.h" #include "CmdLineOptParser.h"
#include "QGCMessageBox.h"
#ifdef QGC_RTLAB_ENABLED #ifdef QGC_RTLAB_ENABLED
#include "OpalLink.h" #include "OpalLink.h"
@ -247,19 +248,12 @@ bool QGCApplication::init(void)
// Check if link could be connected // Check if link could be connected
if (udpLink && !LinkManager::instance()->connectLink(udpLink)) if (udpLink && !LinkManager::instance()->connectLink(udpLink))
{ {
QMessageBox msgBox; QMessageBox::StandardButton button = QGCMessageBox::critical(tr("Could not connect UDP port. Is an instance of %1 already running?").arg(qAppName()),
msgBox.setIcon(QMessageBox::Critical); tr("It is recommended to close the application and stop all instances. Click Yes to close."),
msgBox.setText("Could not connect UDP port. Is an instance of " + qAppName() + "already running?"); QMessageBox::Yes | QMessageBox::No,
msgBox.setInformativeText("It is recommended to close the application and stop all instances. Click Yes to close."); QMessageBox::No);
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
msgBox.setDefaultButton(QMessageBox::No);
int ret = msgBox.exec();
// Close the message box shortly after the click to prevent accidental clicks
QTimer::singleShot(15000, &msgBox, SLOT(reject()));
// Exit application // Exit application
if (ret == QMessageBox::Yes) if (button == QMessageBox::Yes)
{ {
//mainWindow->close(); //mainWindow->close();
QTimer::singleShot(200, _mainWindow, SLOT(close())); QTimer::singleShot(200, _mainWindow, SLOT(close()));

79
src/QGCMessageBox.h

@ -0,0 +1,79 @@
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
#ifndef QGCMESSAGEBOX_H
#define QGCMESSAGEBOX_H
#include <QMessageBox>
#include "MainWindow.h"
/// @file
/// @brief Subclass of QMessageBox which re-implements the static public functions. There are two reasons for this:
/// 1) The QMessageBox implementation on OSX does now show the title string. This leads to message
/// boxes which don't make much sense. So on OSX we set title to text and text to informative text.
/// 2) If parent is NULL, we set parent to MainWindow::instance
/// @author Don Gagne <don@thegagnes.com>
class QGCMessageBox : public QMessageBox {
public:
static StandardButton critical(const QString& title, const QString& text, StandardButtons buttons = Ok, StandardButton defaultButton = NoButton, QWidget* parent = NULL)
{ return _messageBox(QMessageBox::Critical, title, text, buttons, defaultButton, parent); }
static StandardButton information(const QString & title, const QString& text, StandardButtons buttons = Ok, StandardButton defaultButton = NoButton, QWidget* parent = NULL)
{ return _messageBox(QMessageBox::Information, title, text, buttons, defaultButton, parent); }
static StandardButton question(const QString& title, const QString& text, StandardButtons buttons = Ok, StandardButton defaultButton = NoButton, QWidget* parent = NULL)
{ return _messageBox(QMessageBox::Question, title, text, buttons, defaultButton, parent); }
static StandardButton warning(const QString& title, const QString& text, StandardButtons buttons = Ok, StandardButton defaultButton = NoButton, QWidget* parent = NULL)
{ return _messageBox(QMessageBox::Warning, title, text, buttons, defaultButton, parent); }
private:
#ifdef Q_OS_MAC
static StandardButton _messageBox(Icon icon, const QString& title, const QString& text, StandardButtons buttons, StandardButton defaultButton, QWidget* parent)
{
if (parent == NULL) {
parent = MainWindow::instance();
}
QString emptyTitle;
QMessageBox box(icon, emptyTitle, title, buttons, parent);
box.setDefaultButton(defaultButton);
box.setInformativeText(text);
return static_cast<QMessageBox::StandardButton>(box.exec());
}
#else
static StandardButton _messageBox(Icon icon, const QString& title, const QString& text, StandardButtons buttons, StandardButton defaultButton, QWidget* parent)
{
if (parent == NULL) {
parent = MainWindow::instance();
}
QMessageBox box(icon, title, text, buttons, parent);
box.setDefaultButton(defaultButton);
return static_cast<QMessageBox::StandardButton>(box.exec());
}
#endif
};
#endif

7
src/comm/LinkManager.cc

@ -31,11 +31,11 @@ This file is part of the QGROUNDCONTROL project
#include <QList> #include <QList>
#include <QApplication> #include <QApplication>
#include <QMessageBox>
#include <QDebug> #include <QDebug>
#include "LinkManager.h" #include "LinkManager.h"
#include "MainWindow.h" #include "MainWindow.h"
#include "QGCMessageBox.h"
LinkManager* LinkManager::instance() LinkManager* LinkManager::instance()
{ {
@ -284,9 +284,8 @@ const QList<SerialLink*> LinkManager::getSerialLinks()
bool LinkManager::_connectionsSuspendedMsg(void) bool LinkManager::_connectionsSuspendedMsg(void)
{ {
if (_connectionsSuspended) { if (_connectionsSuspended) {
QMessageBox::information(MainWindow::instance(), QGCMessageBox::information(tr("Connect not allowed"),
tr("Connect not allowed"), tr("Connect not allowed: %1").arg(_connectionsSuspendedReason));
tr("Connect not allowed: %1").arg(_connectionsSuspendedReason));
return true; return true;
} else { } else {
return false; return false;

1
src/comm/MAVLinkProtocol.cc

@ -13,7 +13,6 @@
#include <QDebug> #include <QDebug>
#include <QTime> #include <QTime>
#include <QApplication> #include <QApplication>
#include <QMessageBox>
#include <QSettings> #include <QSettings>
#include <QStandardPaths> #include <QStandardPaths>
#include <QtEndian> #include <QtEndian>

6
src/comm/OpalRT.cc

@ -1,4 +1,5 @@
#include "OpalRT.h" #include "OpalRT.h"
#include "QGCMessageBox.h"
namespace OpalRT namespace OpalRT
{ {
@ -7,10 +8,7 @@ void OpalErrorMsg::displayLastErrorMsg()
{ {
static QString lastErrorMsg; static QString lastErrorMsg;
setLastErrorMsg(); setLastErrorMsg();
QMessageBox msgBox; QGCMessageBox::critical(QString(), lastErrorMsg);
msgBox.setIcon(QMessageBox::Critical);
msgBox.setText(lastErrorMsg);
msgBox.exec();
} }
void OpalErrorMsg::setLastErrorMsg() void OpalErrorMsg::setLastErrorMsg()

1
src/comm/OpalRT.h

@ -31,7 +31,6 @@ This file is part of the QGROUNDCONTROL project
#define OPALRT_H #define OPALRT_H
#include <QString> #include <QString>
#include <QMessageBox>
#include "OpalApi.h" #include "OpalApi.h"

1
src/comm/QGCFlightGearLink.cc

@ -35,6 +35,7 @@ This file is part of the QGROUNDCONTROL project
#include <QDebug> #include <QDebug>
#include <QMutexLocker> #include <QMutexLocker>
#include <QHostInfo> #include <QHostInfo>
#include <QMessageBox>
#include <iostream> #include <iostream>

12
src/input/Mouse6dofInput.cpp

@ -9,7 +9,7 @@
#include "Mouse6dofInput.h" #include "Mouse6dofInput.h"
#include "UAS.h" #include "UAS.h"
#include "UASManager.h" #include "UASManager.h"
#include "QMessageBox" #include "QGCMessageBox.h"
#ifdef QGC_MOUSE_ENABLED_LINUX #ifdef QGC_MOUSE_ENABLED_LINUX
#include <QX11Info> #include <QX11Info>
@ -86,14 +86,8 @@ Mouse6dofInput::Mouse6dofInput(QWidget* parent) :
} }
if ( !MagellanInit( display, parent->winId() ) ) if ( !MagellanInit( display, parent->winId() ) )
{ {
QMessageBox msgBox; QGCMessageBox::critical(tr("No 3DxWare driver is running."),
msgBox.setIcon(QMessageBox::Information); tr("Enter in Terminal 'sudo /etc/3DxWare/daemon/3dxsrv -d usb' and then restart QGroundControl."));
msgBox.setText(tr("No 3DxWare driver is running."));
msgBox.setInformativeText(tr("Enter in Terminal 'sudo /etc/3DxWare/daemon/3dxsrv -d usb' and then restart QGroundControl."));
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok);
msgBox.exec();
qDebug() << "No 3DxWare driver is running!"; qDebug() << "No 3DxWare driver is running!";
return; return;
} }

7
src/uas/QGCUASParamManager.cc

@ -2,9 +2,9 @@
#include <QApplication> #include <QApplication>
#include <QDir> #include <QDir>
#include <QMessageBox>
#include "UASInterface.h" #include "UASInterface.h"
#include "QGCMessageBox.h"
QGCUASParamManager::QGCUASParamManager(QObject *parent) : QGCUASParamManager::QGCUASParamManager(QObject *parent) :
QGCUASParamManagerInterface(parent), QGCUASParamManagerInterface(parent),
@ -193,9 +193,8 @@ void QGCUASParamManager::copyVolatileParamsToPersistent()
int changedParamCount = paramDataModel.countPendingParams(); int changedParamCount = paramDataModel.countPendingParams();
if (changedParamCount > 0) { if (changedParamCount > 0) {
QMessageBox msgBox; QGCMessageBox::warning(tr("Warning"),
msgBox.setText(tr("There are locally changed parameters. Please transmit them first (<TRANSMIT>) or update them with the onboard values (<REFRESH>) before storing onboard from RAM to ROM.")); tr("There are locally changed parameters. Please transmit them first (<TRANSMIT>) or update them with the onboard values (<REFRESH>) before storing onboard from RAM to ROM."));
msgBox.exec();
} }
else { else {
paramCommsMgr.writeParamsToPersistentStorage(); paramCommsMgr.writeParamsToPersistentStorage();

58
src/uas/UAS.cc

@ -10,13 +10,14 @@
*/ */
#include <QList> #include <QList>
#include <QMessageBox>
#include <QTimer> #include <QTimer>
#include <QSettings> #include <QSettings>
#include <iostream> #include <iostream>
#include <QDebug> #include <QDebug>
#include <cmath> #include <cmath>
#include <qmath.h> #include <qmath.h>
#include "UAS.h" #include "UAS.h"
#include "LinkInterface.h" #include "LinkInterface.h"
#include "UASManager.h" #include "UASManager.h"
@ -29,6 +30,7 @@
#include "UASParameterCommsMgr.h" #include "UASParameterCommsMgr.h"
#include <Eigen/Geometry> #include <Eigen/Geometry>
#include "AutoPilotPlugin.h" #include "AutoPilotPlugin.h"
#include "QGCMessageBox.h"
/** /**
* Gets the settings from the previous UAS (name, airframe, autopilot, battery specs) * Gets the settings from the previous UAS (name, airframe, autopilot, battery specs)
@ -1404,19 +1406,11 @@ void UAS::setHomePosition(double lat, double lon, double alt)
tr("UAS") + QString::number(getUASID()) tr("UAS") + QString::number(getUASID())
: getUASName(); : getUASName();
QMessageBox msgBox; QMessageBox::StandardButton button = QGCMessageBox::question(tr("Set a new home position for vehicle %1").arg(uasName),
msgBox.setIcon(QMessageBox::Warning); tr("Do you want to set a new origin? Waypoints defined in the local frame will be shifted in their physical location"),
msgBox.setText(tr("Set a new home position for vehicle %1").arg(uasName)); QMessageBox::Yes | QMessageBox::Cancel,
msgBox.setInformativeText("Do you want to set a new origin? Waypoints defined in the local frame will be shifted in their physical location"); QMessageBox::Cancel);
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::Cancel); if (button == QMessageBox::Yes)
msgBox.setDefaultButton(QMessageBox::Cancel);
int ret = msgBox.exec();
// Close the message box shortly after the click to prevent accidental clicks
QTimer::singleShot(5000, &msgBox, SLOT(reject()));
if (ret == QMessageBox::Yes)
{ {
mavlink_message_t msg; mavlink_message_t msg;
mavlink_msg_command_long_pack(mavlink->getSystemId(), mavlink->getComponentId(), &msg, this->getUASID(), 0, MAV_CMD_DO_SET_HOME, 1, 0, 0, 0, 0, lat, lon, alt); mavlink_msg_command_long_pack(mavlink->getSystemId(), mavlink->getComponentId(), &msg, this->getUASID(), 0, MAV_CMD_DO_SET_HOME, 1, 0, 0, 0, 0, lat, lon, alt);
@ -1442,19 +1436,11 @@ void UAS::setHomePosition(double lat, double lon, double alt)
**/ **/
void UAS::setLocalOriginAtCurrentGPSPosition() void UAS::setLocalOriginAtCurrentGPSPosition()
{ {
QMessageBox msgBox; QMessageBox::StandardButton button = QGCMessageBox::question(tr("Set the home position at the current GPS position?"),
msgBox.setIcon(QMessageBox::Warning); tr("Do you want to set a new origin? Waypoints defined in the local frame will be shifted in their physical location"),
msgBox.setText("Set the home position at the current GPS position?"); QMessageBox::Yes | QMessageBox::Cancel,
msgBox.setInformativeText("Do you want to set a new origin? Waypoints defined in the local frame will be shifted in their physical location"); QMessageBox::Cancel);
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::Cancel); if (button == QMessageBox::Yes)
msgBox.setDefaultButton(QMessageBox::Cancel);
int ret = msgBox.exec();
// Close the message box shortly after the click to prevent accidental clicks
QTimer::singleShot(5000, &msgBox, SLOT(reject()));
if (ret == QMessageBox::Yes)
{ {
mavlink_message_t msg; mavlink_message_t msg;
mavlink_msg_command_long_pack(mavlink->getSystemId(), mavlink->getComponentId(), &msg, this->getUASID(), 0, MAV_CMD_DO_SET_HOME, 1, 1, 0, 0, 0, 0, 0, 0); mavlink_msg_command_long_pack(mavlink->getSystemId(), mavlink->getComponentId(), &msg, this->getUASID(), 0, MAV_CMD_DO_SET_HOME, 1, 1, 0, 0, 0, 0, 0, 0);
@ -3204,19 +3190,11 @@ void UAS::stopHil()
void UAS::shutdown() void UAS::shutdown()
{ {
QMessageBox msgBox; QMessageBox::StandardButton button = QGCMessageBox::question(tr("Shutting down the UAS"),
msgBox.setIcon(QMessageBox::Critical); tr("Do you want to shut down the onboard computer?"),
msgBox.setText("Shutting down the UAS"); QMessageBox::Yes | QMessageBox::Cancel,
msgBox.setInformativeText("Do you want to shut down the onboard computer?"); QMessageBox::Cancel);
if (button == QMessageBox::Yes)
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::Cancel);
msgBox.setDefaultButton(QMessageBox::Cancel);
int ret = msgBox.exec();
// Close the message box shortly after the click to prevent accidental clicks
QTimer::singleShot(5000, &msgBox, SLOT(reject()));
if (ret == QMessageBox::Yes)
{ {
// If the active UAS is set, execute command // If the active UAS is set, execute command
mavlink_message_t msg; mavlink_message_t msg;

5
src/uas/UASManager.cc

@ -10,13 +10,14 @@
#include <QList> #include <QList>
#include <QApplication> #include <QApplication>
#include <QMessageBox>
#include <QTimer> #include <QTimer>
#include <QSettings> #include <QSettings>
#include "UAS.h" #include "UAS.h"
#include "UASInterface.h" #include "UASInterface.h"
#include "UASManager.h" #include "UASManager.h"
#include "QGC.h" #include "QGC.h"
#include "QGCMessageBox.h"
#define PI 3.1415926535897932384626433832795 #define PI 3.1415926535897932384626433832795
#define MEAN_EARTH_DIAMETER 12756274.0 #define MEAN_EARTH_DIAMETER 12756274.0
@ -308,7 +309,7 @@ void UASManager::addUAS(UASInterface* uas)
setActiveUAS(uas); setActiveUAS(uas);
if (offlineUASWaypointManager->getWaypointEditableList().size() > 0) if (offlineUASWaypointManager->getWaypointEditableList().size() > 0)
{ {
if (QMessageBox::question(0,"Question","Do you want to append the offline waypoints to the ones currently on the UAV?",QMessageBox::Yes,QMessageBox::No) == QMessageBox::Yes) if (QGCMessageBox::question(tr("Question"), tr("Do you want to append the offline waypoints to the ones currently on the UAV?"), QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes)
{ {
//Need to transfer all waypoints from the offline mode WPManager to the online mode. //Need to transfer all waypoints from the offline mode WPManager to the online mode.
for (int i=0;i<offlineUASWaypointManager->getWaypointEditableList().size();i++) for (int i=0;i<offlineUASWaypointManager->getWaypointEditableList().size();i++)

1
src/ui/MAVLinkSettingsWidget.cc

@ -28,7 +28,6 @@ This file is part of the QGROUNDCONTROL project
*/ */
#include <QFileInfo> #include <QFileInfo>
#include <QMessageBox>
#include <QStandardPaths> #include <QStandardPaths>
#include "MAVLinkSettingsWidget.h" #include "MAVLinkSettingsWidget.h"

20
src/ui/MainWindow.cc

@ -30,7 +30,6 @@ This file is part of the QGROUNDCONTROL project
#include <QSettings> #include <QSettings>
#include <QDockWidget> #include <QDockWidget>
#include <QNetworkInterface> #include <QNetworkInterface>
#include <QMessageBox>
#include <QDebug> #include <QDebug>
#include <QTimer> #include <QTimer>
#include <QHostInfo> #include <QHostInfo>
@ -73,6 +72,7 @@ This file is part of the QGROUNDCONTROL project
#include "QGCUASFileViewMulti.h" #include "QGCUASFileViewMulti.h"
#include "QGCCore.h" #include "QGCCore.h"
#include "QGCFileDialog.h" #include "QGCFileDialog.h"
#include "QGCMessageBox.h"
#ifdef QGC_OSG_ENABLED #ifdef QGC_OSG_ENABLED
#include "Q3DWidgetFactory.h" #include "Q3DWidgetFactory.h"
@ -1131,14 +1131,14 @@ void MainWindow::showCriticalMessage(const QString& title, const QString& messag
{ {
_hideSplashScreen(); _hideSplashScreen();
qDebug() << "Critical" << title << message; qDebug() << "Critical" << title << message;
QMessageBox::critical(this, title, message); QGCMessageBox::critical(title, message);
} }
void MainWindow::showInfoMessage(const QString& title, const QString& message) void MainWindow::showInfoMessage(const QString& title, const QString& message)
{ {
_hideSplashScreen(); _hideSplashScreen();
qDebug() << "Information" << title << message; qDebug() << "Information" << title << message;
QMessageBox::information(this, title, message); QGCMessageBox::information(title, message);
} }
/** /**
@ -1676,15 +1676,11 @@ void MainWindow::handleMisconfiguration(UASInterface* uas)
_hideSplashScreen(); _hideSplashScreen();
// Ask user if he wants to handle this now // Ask user if he wants to handle this now
QMessageBox msgBox(this); QMessageBox::StandardButton button = QGCMessageBox::question(tr("Missing or Invalid Onboard Configuration"),
msgBox.setIcon(QMessageBox::Information); tr("The onboard system configuration is missing or incomplete. Do you want to resolve this now?"),
msgBox.setText(tr("Missing or Invalid Onboard Configuration")); QMessageBox::Ok | QMessageBox::Cancel,
msgBox.setInformativeText(tr("The onboard system configuration is missing or incomplete. Do you want to resolve this now?")); QMessageBox::Ok);
msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); if (button == QMessageBox::Ok) {
msgBox.setDefaultButton(QMessageBox::Ok);
int val = msgBox.exec();
if (val == QMessageBox::Ok) {
// He wants to handle it, make sure this system is selected // He wants to handle it, make sure this system is selected
UASManager::instance()->setActiveUAS(uas); UASManager::instance()->setActiveUAS(uas);

45
src/ui/QGCDataPlot2D.cc

@ -29,7 +29,6 @@ This file is part of the QGROUNDCONTROL project
*/ */
#include <QTemporaryFile> #include <QTemporaryFile>
#include <QMessageBox>
#include <QPrintDialog> #include <QPrintDialog>
#include <QProgressDialog> #include <QProgressDialog>
#include <QHBoxLayout> #include <QHBoxLayout>
@ -45,6 +44,7 @@ This file is part of the QGROUNDCONTROL project
#include "MG.h" #include "MG.h"
#include "MainWindow.h" #include "MainWindow.h"
#include "QGCFileDialog.h" #include "QGCFileDialog.h"
#include "QGCMessageBox.h"
QGCDataPlot2D::QGCDataPlot2D(QWidget *parent) : QGCDataPlot2D::QGCDataPlot2D(QWidget *parent) :
QWidget(parent), QWidget(parent),
@ -130,14 +130,14 @@ void QGCDataPlot2D::savePlot()
} }
while(!(fileName.endsWith(".svg") || fileName.endsWith(".pdf"))) { while(!(fileName.endsWith(".svg") || fileName.endsWith(".pdf"))) {
QMessageBox msgBox; QMessageBox::StandardButton button = QGCMessageBox::critical(tr("Unsuitable file extension for PDF or SVG"),
msgBox.setIcon(QMessageBox::Critical); tr("Please choose .pdf or .svg as file extension. Click OK to change the file extension, cancel to not save the file."),
msgBox.setText("Unsuitable file extension for PDF or SVG"); QMessageBox::Ok | QMessageBox::Cancel,
msgBox.setInformativeText("Please choose .pdf or .svg as file extension. Click OK to change the file extension, cancel to not save the file."); QMessageBox::Ok);
msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
msgBox.setDefaultButton(QMessageBox::Ok);
// Abort if cancelled // Abort if cancelled
if(msgBox.exec() == QMessageBox::Cancel) return; if (button == QMessageBox::Cancel) {
return;
}
fileName = QGCFileDialog::getSaveFileName( fileName = QGCFileDialog::getSaveFileName(
this, "Export File Name", QStandardPaths::writableLocation(QStandardPaths::DesktopLocation), this, "Export File Name", QStandardPaths::writableLocation(QStandardPaths::DesktopLocation),
"PDF Documents (*.pdf);;SVG Images (*.svg)"); "PDF Documents (*.pdf);;SVG Images (*.svg)");
@ -279,13 +279,8 @@ void QGCDataPlot2D::selectFile()
QFileInfo fileInfo(fileName); QFileInfo fileInfo(fileName);
if (!fileInfo.isReadable()) if (!fileInfo.isReadable())
{ {
QMessageBox msgBox; QGCMessageBox::critical(tr("Could not open file"),
msgBox.setIcon(QMessageBox::Critical); tr("The file is owned by user %1. Is the file currently used by another program?").arg(fileInfo.owner()));
msgBox.setText("Could not open file");
msgBox.setInformativeText(tr("The file is owned by user %1. Is the file currently used by another program?").arg(fileInfo.owner()));
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok);
msgBox.exec();
ui->filenameLabel->setText(tr("Could not open %1").arg(fileInfo.baseName()+"."+fileInfo.completeSuffix())); ui->filenameLabel->setText(tr("Could not open %1").arg(fileInfo.baseName()+"."+fileInfo.completeSuffix()));
} }
else else
@ -705,26 +700,6 @@ void QGCDataPlot2D::saveCsvLog()
fileName.append(".csv"); fileName.append(".csv");
} }
// QFileInfo fileInfo(fileName);
//
// // Check if we could create a new file in this directory
// QDir dir(fileInfo.absoluteDir());
// QFileInfo dirInfo(dir);
//
// while(!(dirInfo.isWritable()))
// {
// QMessageBox msgBox;
// msgBox.setIcon(QMessageBox::Critical);
// msgBox.setText("File cannot be written, Operating System denies permission");
// msgBox.setInformativeText("Please choose a different file name or directory. Click OK to change the file, cancel to not save the file.");
// msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
// msgBox.setDefaultButton(QMessageBox::Ok);
// if(msgBox.exec() == QMessageBox::Cancel) break;
// fileName = QGCFileDialog::getSaveFileName(
// this, "Export CSV File Name", QStandardPaths::writableLocation(QStandardPaths::DesktopLocation),
// "CSV file (*.csv);;Text file (*.txt)");
// }
bool success = logFile->copy(fileName); bool success = logFile->copy(fileName);
qDebug() << "Saved CSV log. Success: " << success; qDebug() << "Saved CSV log. Success: " << success;

5
src/ui/QGCMAVLinkLogPlayer.cc

@ -1,4 +1,3 @@
#include <QMessageBox>
#include <QStandardPaths> #include <QStandardPaths>
#include <QtEndian> #include <QtEndian>
@ -136,7 +135,9 @@ void QGCMAVLinkLogPlayer::reset()
{ {
pause(); pause();
loopCounter = 0; loopCounter = 0;
logFile.reset(); if (logFile.isOpen()) {
logFile.reset();
}
// Now update the position slider to its default location // Now update the position slider to its default location
updatePositionSliderUi(0.0); updatePositionSliderUi(0.0);

32
src/ui/QGCPX4VehicleConfig.cc

@ -10,7 +10,6 @@
#include <QTimer> #include <QTimer>
#include <QDir> #include <QDir>
#include <QXmlStreamReader> #include <QXmlStreamReader>
#include <QMessageBox>
#include <QLabel> #include <QLabel>
#include "QGCPX4VehicleConfig.h" #include "QGCPX4VehicleConfig.h"
@ -152,37 +151,6 @@ void QGCPX4VehicleConfig::firmwareMenuButtonClicked()
ui->tabTitleLabel->setText(tr("Firmware Upgrade")); ui->tabTitleLabel->setText(tr("Firmware Upgrade"));
} }
#if 0
void QGCPX4VehicleConfig::toggleSpektrumPairing(bool enabled)
{
Q_UNUSED(enabled);
if (!ui->dsm2RadioButton->isChecked() && !ui->dsmxRadioButton->isChecked()
&& !ui->dsmx8RadioButton->isChecked()) {
// Reject
QMessageBox warnMsgBox;
warnMsgBox.setText(tr("Please select a Spektrum Protocol Version"));
warnMsgBox.setInformativeText(tr("Please select either DSM2 or DSM-X\ndirectly below the pair button,\nbased on the receiver type."));
warnMsgBox.setStandardButtons(QMessageBox::Ok);
warnMsgBox.setDefaultButton(QMessageBox::Ok);
(void)warnMsgBox.exec();
return;
}
UASInterface* mav = UASManager::instance()->getActiveUAS();
if (mav) {
int rxSubType;
if (ui->dsm2RadioButton->isChecked())
rxSubType = 0;
else if (ui->dsmxRadioButton->isChecked())
rxSubType = 1;
else // if (ui->dsmx8RadioButton->isChecked())
rxSubType = 2;
mav->pairRX(0, rxSubType);
}
}
#endif
void QGCPX4VehicleConfig::menuButtonClicked() void QGCPX4VehicleConfig::menuButtonClicked()
{ {
QPushButton *button = qobject_cast<QPushButton*>(sender()); QPushButton *button = qobject_cast<QPushButton*>(sender());

2
src/ui/QGCPX4VehicleConfig.h

@ -7,7 +7,6 @@
#include <QGroupBox> #include <QGroupBox>
#include <QPushButton> #include <QPushButton>
#include <QStringList> #include <QStringList>
#include <QMessageBox>
#include <QGraphicsScene> #include <QGraphicsScene>
#include "QGCToolWidget.h" #include "QGCToolWidget.h"
@ -78,7 +77,6 @@ protected:
QPixmap planeSide; QPixmap planeSide;
QGCPX4SensorCalibration* px4SensorCalibration; QGCPX4SensorCalibration* px4SensorCalibration;
PX4RCCalibration* px4RCCalibration; PX4RCCalibration* px4RCCalibration;
QMessageBox msgBox;
QGraphicsScene scene; QGraphicsScene scene;
QPushButton* skipActionButton; QPushButton* skipActionButton;

1
src/ui/QGCParamWidget.cc

@ -33,7 +33,6 @@ This file is part of the QGROUNDCONTROL project
#include <QGridLayout> #include <QGridLayout>
#include <QList> #include <QList>
#include <QMessageBox>
#include <QPushButton> #include <QPushButton>
#include <QSettings> #include <QSettings>
#include <QTime> #include <QTime>

15
src/ui/QGCSettingsWidget.cc

@ -35,6 +35,7 @@
#include "GAudioOutput.h" #include "GAudioOutput.h"
#include "QGCCore.h" #include "QGCCore.h"
#include "QGCFileDialog.h" #include "QGCFileDialog.h"
#include "QGCMessageBox.h"
SettingsDialog::SettingsDialog(JoystickInput *joystick, QWidget *parent, Qt::WindowFlags flags) : SettingsDialog::SettingsDialog(JoystickInput *joystick, QWidget *parent, Qt::WindowFlags flags) :
QDialog(parent, flags), QDialog(parent, flags),
@ -122,11 +123,10 @@ void SettingsDialog::selectCustomMode(int mode)
void SettingsDialog::_deleteSettingsToggled(bool checked) void SettingsDialog::_deleteSettingsToggled(bool checked)
{ {
if (checked){ if (checked){
QMessageBox::StandardButton answer = QMessageBox::question(this, QGCMessageBox::StandardButton answer = QGCMessageBox::question(tr("Delete Settings"),
tr("Delete Settings"), tr("All saved settings will be deleted the next time you start QGroundControl. Is this really what you want?"),
tr("All saved settings will be deleted the next time you start QGroundControl. Is this really what you want?"), QMessageBox::Yes | QMessageBox::No,
QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
QMessageBox::No);
if (answer == QMessageBox::Yes) { if (answer == QMessageBox::Yes) {
qgcApp()->deleteAllSettingsNextBoot(); qgcApp()->deleteAllSettingsNextBoot();
} else { } else {
@ -146,9 +146,8 @@ void SettingsDialog::_validateBeforeClose(void)
QString saveLocation = _ui->savedFilesLocation->text(); QString saveLocation = _ui->savedFilesLocation->text();
if (!app->validatePossibleSavedFilesLocation(saveLocation)) { if (!app->validatePossibleSavedFilesLocation(saveLocation)) {
QMessageBox::warning(_mainWindow, QGCMessageBox::warning(tr("Bad save location"),
tr("Bad save location"), tr("The location to save files to is invalid, or cannot be written to. Please provide a valid directory."));
tr("The location to save files to is invalid, or cannot be written to. Please provide a valid directory."));
return; return;
} }

1
src/ui/QGCUASFileView.cc

@ -27,7 +27,6 @@
#include <QFileDialog> #include <QFileDialog>
#include <QDir> #include <QDir>
#include <QMessageBox>
QGCUASFileView::QGCUASFileView(QWidget *parent, QGCUASFileManager *manager) : QGCUASFileView::QGCUASFileView(QWidget *parent, QGCUASFileManager *manager) :
QWidget(parent), QWidget(parent),

1
src/ui/WaypointList.cc

@ -39,7 +39,6 @@ This file is part of the PIXHAWK project
#include <UAS.h> #include <UAS.h>
#include <UASManager.h> #include <UASManager.h>
#include <QDebug> #include <QDebug>
#include <QMessageBox>
#include <QMouseEvent> #include <QMouseEvent>
#include <QTextEdit> #include <QTextEdit>

8
src/ui/configuration/terminalconsole.cpp

@ -38,11 +38,11 @@ This file is part of the APM_PLANNER project
#include "ui_terminalconsole.h" #include "ui_terminalconsole.h"
#include "console.h" #include "console.h"
#include "QGCConfig.h" #include "QGCConfig.h"
#include "QGCMessageBox.h"
#include <QDebug> #include <QDebug>
#include <QSettings> #include <QSettings>
#include <QStatusBar> #include <QStatusBar>
#include <QMessageBox>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QComboBox> #include <QComboBox>
#include <QSerialPort> #include <QSerialPort>
@ -159,12 +159,12 @@ void TerminalConsole::openSerialPort(const SerialSettings &settings)
} else { } else {
m_serial->close(); m_serial->close();
QMessageBox::critical(this, tr("Error"), m_serial->errorString()); QGCMessageBox::critical(tr("Error"), m_serial->errorString());
m_statusBar->showMessage(tr("Open error")); m_statusBar->showMessage(tr("Open error"));
} }
} else { } else {
QMessageBox::critical(this, tr("Error"), m_serial->errorString()); QGCMessageBox::critical(tr("Error"), m_serial->errorString());
m_statusBar->showMessage(tr("Configure error")); m_statusBar->showMessage(tr("Configure error"));
} }
@ -222,7 +222,7 @@ void TerminalConsole::readData()
void TerminalConsole::handleError(QSerialPort::SerialPortError error) void TerminalConsole::handleError(QSerialPort::SerialPortError error)
{ {
if (error == QSerialPort::ResourceError) { if (error == QSerialPort::ResourceError) {
QMessageBox::critical(this, tr("Critical Error"), m_serial->errorString()); QGCMessageBox::critical(tr("Critical Error"), m_serial->errorString());
closeSerialPort(); closeSerialPort();
} }
} }

36
src/ui/linechart/LinechartWidget.cc

@ -43,7 +43,6 @@ This file is part of the PIXHAWK project
#include <QColor> #include <QColor>
#include <QPalette> #include <QPalette>
#include <QStandardPaths> #include <QStandardPaths>
#include <QMessageBox>
#include <QShortcut> #include <QShortcut>
#include "LinechartWidget.h" #include "LinechartWidget.h"
@ -53,6 +52,7 @@ This file is part of the PIXHAWK project
#include "QGC.h" #include "QGC.h"
#include "MG.h" #include "MG.h"
#include "QGCFileDialog.h" #include "QGCFileDialog.h"
#include "QGCMessageBox.h"
LinechartWidget::LinechartWidget(int systemid, QWidget *parent) : QWidget(parent), LinechartWidget::LinechartWidget(int systemid, QWidget *parent) : QWidget(parent),
sysid(systemid), sysid(systemid),
@ -442,13 +442,7 @@ void LinechartWidget::startLogging()
// Check if any curve is enabled // Check if any curve is enabled
if (!activePlot->anyCurveVisible()) { if (!activePlot->anyCurveVisible()) {
QMessageBox msgBox; QGCMessageBox::critical(tr("No curves selected for logging."), tr("Please check all curves you want to log. Currently no data would be logged, aborting the logging."));
msgBox.setIcon(QMessageBox::Critical);
msgBox.setText("No curves selected for logging.");
msgBox.setInformativeText("Please check all curves you want to log. Currently no data would be logged, aborting the logging.");
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok);
msgBox.exec();
return; return;
} }
@ -458,14 +452,11 @@ void LinechartWidget::startLogging()
QString fileName = QGCFileDialog::getSaveFileName(this, tr("Specify log file name"), QStandardPaths::writableLocation(QStandardPaths::DesktopLocation), tr("Logfile (*.log);;")); QString fileName = QGCFileDialog::getSaveFileName(this, tr("Specify log file name"), QStandardPaths::writableLocation(QStandardPaths::DesktopLocation), tr("Logfile (*.log);;"));
while (!(fileName.endsWith(".log")) && !abort && fileName != "") { while (!(fileName.endsWith(".log")) && !abort && fileName != "") {
QMessageBox msgBox; QMessageBox::StandardButton button = QGCMessageBox::critical(tr("Unsuitable file extension for logfile"),
msgBox.setIcon(QMessageBox::Critical); tr("Please choose .log as file extension. Click OK to change the file extension, cancel to not start logging."),
msgBox.setText("Unsuitable file extension for logfile"); QMessageBox::Ok | QMessageBox::Cancel,
msgBox.setInformativeText("Please choose .log as file extension. Click OK to change the file extension, cancel to not start logging."); QMessageBox::Ok);
msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); if (button != QMessageBox::Ok) {
msgBox.setDefaultButton(QMessageBox::Ok);
if(msgBox.exec() != QMessageBox::Ok)
{
abort = true; abort = true;
break; break;
} }
@ -501,15 +492,12 @@ void LinechartWidget::stopLogging()
connect(compressor, SIGNAL(finishedFile(QString)), this, SIGNAL(logfileWritten(QString))); connect(compressor, SIGNAL(finishedFile(QString)), this, SIGNAL(logfileWritten(QString)));
connect(compressor, SIGNAL(logProcessingStatusChanged(QString)), MainWindow::instance(), SLOT(showStatusMessage(QString))); connect(compressor, SIGNAL(logProcessingStatusChanged(QString)), MainWindow::instance(), SLOT(showStatusMessage(QString)));
QMessageBox msgBox; QMessageBox::StandardButton button = QGCMessageBox::question(tr("Starting Log Compression"),
msgBox.setIcon(QMessageBox::Question); tr("Should empty fields (e.g. due to packet drops) be filled with the previous value of the same variable (zero order hold)?"),
msgBox.setText(tr("Starting Log Compression")); QMessageBox::Yes | QMessageBox::No,
msgBox.setInformativeText(tr("Should empty fields (e.g. due to packet drops) be filled with the previous value of the same variable (zero order hold)?")); QMessageBox::No);
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
msgBox.setDefaultButton(QMessageBox::No);
int ret = msgBox.exec();
bool fill; bool fill;
if (ret == QMessageBox::Yes) if (button == QMessageBox::Yes)
{ {
fill = true; fill = true;
} }

16
src/ui/map/QGCMapWidget.cc

@ -6,6 +6,7 @@
#include "MAV2DIcon.h" #include "MAV2DIcon.h"
#include "Waypoint2DIcon.h" #include "Waypoint2DIcon.h"
#include "UASWaypointManager.h" #include "UASWaypointManager.h"
#include "QGCMessageBox.h"
QGCMapWidget::QGCMapWidget(QWidget *parent) : QGCMapWidget::QGCMapWidget(QWidget *parent) :
mapcontrol::OPMapWidget(parent), mapcontrol::OPMapWidget(parent),
@ -65,7 +66,7 @@ void QGCMapWidget::guidedActionTriggered()
{ {
if (!uas) if (!uas)
{ {
QMessageBox::information(0,"Error","Please connect first"); QGCMessageBox::information(tr("Error"), tr("Please connect first"));
return; return;
} }
if (currWPManager) if (currWPManager)
@ -91,7 +92,7 @@ bool QGCMapWidget::guidedAltActionTriggered()
{ {
if (!uas) if (!uas)
{ {
QMessageBox::information(0,"Error","Please connect first"); QGCMessageBox::information(tr("Error"), tr("Please connect first"));
return false; return false;
} }
bool ok = false; bool ok = false;
@ -113,7 +114,7 @@ bool QGCMapWidget::setHomeActionTriggered()
{ {
if (!uas) if (!uas)
{ {
QMessageBox::information(0,"Error","Please connect first"); QGCMessageBox::information(tr("Error"), tr("Please connect first"));
return false; return false;
} }
UASManagerInterface *uasManager = UASManager::instance(); UASManagerInterface *uasManager = UASManager::instance();
@ -597,13 +598,8 @@ void QGCMapWidget::cacheVisibleRegion()
if (rect.IsEmpty()) if (rect.IsEmpty())
{ {
QMessageBox msgBox(this); QGCMessageBox::information(tr("Cannot cache tiles for offline use"),
msgBox.setIcon(QMessageBox::Information); tr("Please select an area first by holding down SHIFT or ALT and selecting the area with the left mouse button."));
msgBox.setText("Cannot cache tiles for offline use");
msgBox.setInformativeText("Please select an area first by holding down SHIFT or ALT and selecting the area with the left mouse button.");
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok);
msgBox.exec();
} }
else else
{ {

7
src/ui/map3D/Pixhawk3DWidget.cc

@ -45,6 +45,7 @@
#include "TerrainParamDialog.h" #include "TerrainParamDialog.h"
#include "UASManager.h" #include "UASManager.h"
#include "QGCFileDialog.h" #include "QGCFileDialog.h"
#include "QGCMessageBox.h"
#include "QGC.h" #include "QGC.h"
#include "gpl.h" #include "gpl.h"
@ -618,10 +619,8 @@ Pixhawk3DWidget::loadTerrainModel(void)
} }
else else
{ {
QMessageBox msgBox(QMessageBox::Warning, QGCMessageBox::warning(tr("Error loading model"),
"Error loading model", tr("Error: Unable to load terrain model (%1).").arg(filename));
QString("Error: Unable to load terrain model (%1).").arg(filename));
msgBox.exec();
} }
} }

4
src/ui/px4_configuration/PX4FirmwareUpgrade.cc

@ -34,9 +34,9 @@
#include <QJsonObject> #include <QJsonObject>
#include <QDir> #include <QDir>
#include <QDebug> #include <QDebug>
#include <QMessageBox>
#include "QGCFileDialog.h" #include "QGCFileDialog.h"
#include "QGCMessageBox.h"
/// @Brief Constructs a new PX4FirmwareUpgrade Widget. This widget is used within the PX4VehicleConfig set of screens. /// @Brief Constructs a new PX4FirmwareUpgrade Widget. This widget is used within the PX4VehicleConfig set of screens.
PX4FirmwareUpgrade::PX4FirmwareUpgrade(QWidget *parent) : PX4FirmwareUpgrade::PX4FirmwareUpgrade(QWidget *parent) :
@ -294,7 +294,7 @@ void PX4FirmwareUpgrade::_foundBoard(bool firstTry, const QString portName, QStr
{ {
if (firstTry) { if (firstTry) {
// Board is still plugged // Board is still plugged
QMessageBox::critical(this, tr("Firmware Upgrade"), tr("You must unplug you board before beginning the Firmware Upgrade process.")); QGCMessageBox::critical(tr("Firmware Upgrade"), tr("You must unplug you board before beginning the Firmware Upgrade process."));
_cancel(); _cancel();
} else { } else {
_portName = portName; _portName = portName;

8
src/ui/px4_configuration/PX4RCCalibration.cc

@ -25,11 +25,11 @@
/// @brief PX4 RC Calibration Widget /// @brief PX4 RC Calibration Widget
/// @author Don Gagne <don@thegagnes.com /// @author Don Gagne <don@thegagnes.com
#include <QMessageBox>
#include <QSettings> #include <QSettings>
#include "PX4RCCalibration.h" #include "PX4RCCalibration.h"
#include "UASManager.h" #include "UASManager.h"
#include "QGCMessageBox.h"
const int PX4RCCalibration::_updateInterval = 150; ///< Interval for timer which updates radio channel widgets const int PX4RCCalibration::_updateInterval = 150; ///< Interval for timer which updates radio channel widgets
const int PX4RCCalibration::_rcCalPWMCenterPoint = ((PX4RCCalibration::_rcCalPWMValidMaxValue - PX4RCCalibration::_rcCalPWMValidMinValue) / 2.0f) + PX4RCCalibration::_rcCalPWMValidMinValue; const int PX4RCCalibration::_rcCalPWMCenterPoint = ((PX4RCCalibration::_rcCalPWMValidMaxValue - PX4RCCalibration::_rcCalPWMValidMinValue) / 2.0f) + PX4RCCalibration::_rcCalPWMValidMinValue;
@ -297,7 +297,7 @@ void PX4RCCalibration::_nextButton(void)
if (_unitTestMode) { if (_unitTestMode) {
emit nextButtonMessageBoxDisplayed(); emit nextButtonMessageBoxDisplayed();
} else { } else {
QMessageBox::warning(this, tr("Receiver"), tr("Detected %1 radio channels. To operate PX4, you need at least %2 channels.").arg(_chanCount).arg(_chanMinimum)); QGCMessageBox::warning(tr("Receiver"), tr("Detected %1 radio channels. To operate PX4, you need at least %2 channels.").arg(_chanCount).arg(_chanMinimum));
} }
return; return;
} }
@ -322,7 +322,7 @@ void PX4RCCalibration::_skipButton(void)
void PX4RCCalibration::_trimNYI(void) void PX4RCCalibration::_trimNYI(void)
{ {
QMessageBox::warning(this, tr("Set Trim"), tr("Setting individual trims is not yet implemented. You will need to go through full calibration to set trims.")); QGCMessageBox::warning(tr("Set Trim"), tr("Setting individual trims is not yet implemented. You will need to go through full calibration to set trims."));
} }
void PX4RCCalibration::_saveAllTrims(void) void PX4RCCalibration::_saveAllTrims(void)
@ -559,7 +559,7 @@ void PX4RCCalibration::_saveFlapsDown(void)
if (_unitTestMode) { if (_unitTestMode) {
emit nextButtonMessageBoxDisplayed(); emit nextButtonMessageBoxDisplayed();
} else { } else {
QMessageBox::warning(this, tr("Flaps switch"), tr("Flaps switch has not yet been detected.")); QGCMessageBox::warning(tr("Flaps switch"), tr("Flaps switch has not yet been detected."));
} }
return; return;
} }

29
src/ui/px4_configuration/QGCPX4AirframeConfig.cc

@ -1,4 +1,3 @@
#include <QMessageBox>
#include <QProgressDialog> #include <QProgressDialog>
#include <QDebug> #include <QDebug>
#include <QTimer> #include <QTimer>
@ -10,6 +9,7 @@
#include "LinkManager.h" #include "LinkManager.h"
#include "UAS.h" #include "UAS.h"
#include "QGC.h" #include "QGC.h"
#include "QGCMessageBox.h"
QGCPX4AirframeConfig::QGCPX4AirframeConfig(QWidget *parent) : QGCPX4AirframeConfig::QGCPX4AirframeConfig(QWidget *parent) :
QWidget(parent), QWidget(parent),
@ -251,13 +251,8 @@ void QGCPX4AirframeConfig::applyAndReboot()
// Guard against the case of an edit where we didn't receive all params yet // Guard against the case of an edit where we didn't receive all params yet
if (selectedId <= 0) if (selectedId <= 0)
{ {
QMessageBox msgBox; QGCMessageBox::warning(tr("No airframe selected"),
msgBox.setText(tr("No airframe selected")); tr("Please select an airframe first."));
msgBox.setInformativeText(tr("Please select an airframe first."));
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok);
(void)msgBox.exec();
return; return;
} }
@ -276,25 +271,15 @@ void QGCPX4AirframeConfig::applyAndReboot()
// Guard against the case of an edit where we didn't receive all params yet // Guard against the case of an edit where we didn't receive all params yet
if (paramMgr->countPendingParams() > 0 || components.count() == 0) if (paramMgr->countPendingParams() > 0 || components.count() == 0)
{ {
QMessageBox msgBox; QGCMessageBox::information(tr("Parameter sync with UAS not yet complete"),
msgBox.setText(tr("Parameter sync with UAS not yet complete")); tr("Please wait a few moments and retry"));
msgBox.setInformativeText(tr("Please wait a few moments and retry"));
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok);
(void)msgBox.exec();
return; return;
} }
// Guard against multiple components responding - this will never show in practice // Guard against multiple components responding - this will never show in practice
if (components.count() != 1) { if (components.count() != 1) {
QMessageBox msgBox; QGCMessageBox::warning(tr("Invalid system setup detected"),
msgBox.setText(tr("Invalid system setup detected")); tr("None or more than one component advertised to provide the main system configuration option. This is an invalid system setup - please check your autopilot."));
msgBox.setInformativeText(tr("None or more than one component advertised to provide the main system configuration option. This is an invalid system setup - please check your autopilot."));
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok);
(void)msgBox.exec();
return; return;
} }

Loading…
Cancel
Save