Commit db7b86fb authored by Don Gagne's avatar Don Gagne

Use new QGCMessageBox apis

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. This
prevents message boxes which can go behind MainWindow
parent e833fe46
......@@ -487,7 +487,8 @@ HEADERS += \
src/uas/QGCUASWorker.h \
src/CmdLineOptParser.h \
src/uas/QGXPX4UAS.h \
src/QGCFileDialog.h
src/QGCFileDialog.h \
src/QGCMessageBox.h
SOURCES += \
src/main.cc \
......
......@@ -47,6 +47,7 @@
#include "MainWindow.h"
#include "GAudioOutput.h"
#include "CmdLineOptParser.h"
#include "QGCMessageBox.h"
#ifdef QGC_RTLAB_ENABLED
#include "OpalLink.h"
......@@ -245,19 +246,12 @@ bool QGCApplication::init(void)
// Check if link could be connected
if (udpLink && !LinkManager::instance()->connectLink(udpLink))
{
QMessageBox msgBox;
msgBox.setIcon(QMessageBox::Critical);
msgBox.setText("Could not connect UDP port. Is an instance of " + qAppName() + "already running?");
msgBox.setInformativeText("It is recommended to close the application and stop all instances. Click Yes to close.");
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()));
QMessageBox::StandardButton button = QGCMessageBox::critical(tr("Could not connect UDP port. Is an instance of %1 already running?").arg(qAppName()),
tr("It is recommended to close the application and stop all instances. Click Yes to close."),
QMessageBox::Yes | QMessageBox::No,
QMessageBox::No);
// Exit application
if (ret == QMessageBox::Yes)
if (button == QMessageBox::Yes)
{
//mainWindow->close();
QTimer::singleShot(200, _mainWindow, SLOT(close()));
......
/*=====================================================================
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
......@@ -31,11 +31,11 @@ This file is part of the QGROUNDCONTROL project
#include <QList>
#include <QApplication>
#include <QMessageBox>
#include <QDebug>
#include "LinkManager.h"
#include "MainWindow.h"
#include "QGCMessageBox.h"
LinkManager* LinkManager::instance()
{
......@@ -284,9 +284,8 @@ const QList<SerialLink*> LinkManager::getSerialLinks()
bool LinkManager::_connectionsSuspendedMsg(void)
{
if (_connectionsSuspended) {
QMessageBox::information(MainWindow::instance(),
tr("Connect not allowed"),
tr("Connect not allowed: %1").arg(_connectionsSuspendedReason));
QGCMessageBox::information(tr("Connect not allowed"),
tr("Connect not allowed: %1").arg(_connectionsSuspendedReason));
return true;
} else {
return false;
......
......@@ -13,7 +13,6 @@
#include <QDebug>
#include <QTime>
#include <QApplication>
#include <QMessageBox>
#include <QSettings>
#include <QStandardPaths>
#include <QtEndian>
......
#include "OpalRT.h"
#include "QGCMessageBox.h"
namespace OpalRT
{
......@@ -7,10 +8,7 @@ void OpalErrorMsg::displayLastErrorMsg()
{
static QString lastErrorMsg;
setLastErrorMsg();
QMessageBox msgBox;
msgBox.setIcon(QMessageBox::Critical);
msgBox.setText(lastErrorMsg);
msgBox.exec();
QGCMessageBox::critical(QString(), lastErrorMsg);
}
void OpalErrorMsg::setLastErrorMsg()
......
......@@ -31,7 +31,6 @@ This file is part of the QGROUNDCONTROL project
#define OPALRT_H
#include <QString>
#include <QMessageBox>
#include "OpalApi.h"
......
......@@ -35,6 +35,7 @@ This file is part of the QGROUNDCONTROL project
#include <QDebug>
#include <QMutexLocker>
#include <QHostInfo>
#include <QMessageBox>
#include <iostream>
......
......@@ -9,9 +9,9 @@
#include "Mouse6dofInput.h"
#include "UAS.h"
#include "UASManager.h"
#include "QMessageBox"
#include "QGCMessageBox.h"
#ifdef QGC_MOUSE_ENABLED_LINUX
#ifdef QGC_MOUSE_ENABLED_LINUX
#include <QX11Info>
#include <X11/Xlib.h>
#ifdef Success
......@@ -21,9 +21,9 @@ extern "C"
{
#include "xdrvlib.h"
}
#endif // QGC_MOUSE_ENABLED_LINUX
#endif // QGC_MOUSE_ENABLED_LINUX
#ifdef QGC_MOUSE_ENABLED_WIN
#ifdef QGC_MOUSE_ENABLED_WIN
Mouse6dofInput::Mouse6dofInput(Mouse3DInput* mouseInput) :
mouse3DMax(0.075), // TODO: check maximum value fot plugged device
uas(NULL),
......@@ -45,9 +45,9 @@ Mouse6dofInput::Mouse6dofInput(Mouse3DInput* mouseInput) :
//connect(mouseInput, SIGNAL(On3dmouseKeyUp(int)), this, SLOT(FUNCTION(int)));
}
#endif //QGC_MOUSE_ENABLED_WIN
#endif //QGC_MOUSE_ENABLED_WIN
#ifdef QGC_MOUSE_ENABLED_LINUX
#ifdef QGC_MOUSE_ENABLED_LINUX
Mouse6dofInput::Mouse6dofInput(QWidget* parent) :
mouse3DMax(350.0), // TODO: check maximum value fot plugged device
uas(NULL),
......@@ -86,14 +86,8 @@ Mouse6dofInput::Mouse6dofInput(QWidget* parent) :
}
if ( !MagellanInit( display, parent->winId() ) )
{
QMessageBox msgBox;
msgBox.setIcon(QMessageBox::Information);
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();
QGCMessageBox::critical(tr("No 3DxWare driver is running."),
tr("Enter in Terminal 'sudo /etc/3DxWare/daemon/3dxsrv -d usb' and then restart QGroundControl."));
qDebug() << "No 3DxWare driver is running!";
return;
}
......@@ -109,7 +103,7 @@ Mouse6dofInput::Mouse6dofInput(QWidget* parent) :
}
}
#endif //QGC_MOUSE_ENABLED_LINUX
#endif //QGC_MOUSE_ENABLED_LINUX
Mouse6dofInput::~Mouse6dofInput()
......@@ -191,7 +185,7 @@ void Mouse6dofInput::run()
}
}
#ifdef QGC_MOUSE_ENABLED_WIN
#ifdef QGC_MOUSE_ENABLED_WIN
void Mouse6dofInput::motion3DMouse(std::vector<float> &motionData)
{
if (motionData.size() < 6) return;
......@@ -220,9 +214,9 @@ void Mouse6dofInput::motion3DMouse(std::vector<float> &motionData)
//qDebug() << "NEW 3D MOUSE VALUES -- X" << xValue << " -- Y" << yValue << " -- Z" << zValue << " -- A" << aValue << " -- B" << bValue << " -- C" << cValue;
}
#endif //QGC_MOUSE_ENABLED_WIN
#endif //QGC_MOUSE_ENABLED_WIN
#ifdef QGC_MOUSE_ENABLED_WIN
#ifdef QGC_MOUSE_ENABLED_WIN
void Mouse6dofInput::button3DMouseDown(int button)
{
switch(button)
......@@ -245,9 +239,9 @@ void Mouse6dofInput::button3DMouseDown(int button)
break;
}
}
#endif //QGC_MOUSE_ENABLED_WIN
#endif //QGC_MOUSE_ENABLED_WIN
#ifdef QGC_MOUSE_ENABLED_LINUX
#ifdef QGC_MOUSE_ENABLED_LINUX
void Mouse6dofInput::handleX11Event(XEvent *event)
{
//qDebug("XEvent occured...");
......@@ -327,4 +321,4 @@ void Mouse6dofInput::handleX11Event(XEvent *event)
}
}
}
#endif //QGC_MOUSE_ENABLED_LINUX
#endif //QGC_MOUSE_ENABLED_LINUX
......@@ -2,9 +2,9 @@
#include <QApplication>
#include <QDir>
#include <QMessageBox>
#include "UASInterface.h"
#include "QGCMessageBox.h"
QGCUASParamManager::QGCUASParamManager(QObject *parent) :
QGCUASParamManagerInterface(parent),
......@@ -193,9 +193,8 @@ void QGCUASParamManager::copyVolatileParamsToPersistent()
int changedParamCount = paramDataModel.countPendingParams();
if (changedParamCount > 0) {
QMessageBox msgBox;
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."));
msgBox.exec();
QGCMessageBox::warning(tr("Warning"),
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."));
}
else {
paramCommsMgr.writeParamsToPersistentStorage();
......
......@@ -10,13 +10,14 @@
*/
#include <QList>
#include <QMessageBox>
#include <QTimer>
#include <QSettings>
#include <iostream>
#include <QDebug>
#include <cmath>
#include <qmath.h>
#include "UAS.h"
#include "LinkInterface.h"
#include "UASManager.h"
......@@ -29,6 +30,7 @@
#include "UASParameterCommsMgr.h"
#include <Eigen/Geometry>
#include "AutoPilotPlugin.h"
#include "QGCMessageBox.h"
/**
* 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())
: getUASName();
QMessageBox msgBox;
msgBox.setIcon(QMessageBox::Warning);
msgBox.setText(tr("Set a new home position for vehicle %1").arg(uasName));
msgBox.setInformativeText("Do you want to set a new origin? Waypoints defined in the local frame will be shifted in their physical location");
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)
QMessageBox::StandardButton button = QGCMessageBox::question(tr("Set a new home position for vehicle %1").arg(uasName),
tr("Do you want to set a new origin? Waypoints defined in the local frame will be shifted in their physical location"),
QMessageBox::Yes | QMessageBox::Cancel,
QMessageBox::Cancel);
if (button == QMessageBox::Yes)
{
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);
......@@ -1442,19 +1436,11 @@ void UAS::setHomePosition(double lat, double lon, double alt)
**/
void UAS::setLocalOriginAtCurrentGPSPosition()
{
QMessageBox msgBox;
msgBox.setIcon(QMessageBox::Warning);
msgBox.setText("Set the home position at the current GPS position?");
msgBox.setInformativeText("Do you want to set a new origin? Waypoints defined in the local frame will be shifted in their physical location");
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)
QMessageBox::StandardButton button = QGCMessageBox::question(tr("Set the home position at the current GPS position?"),
tr("Do you want to set a new origin? Waypoints defined in the local frame will be shifted in their physical location"),
QMessageBox::Yes | QMessageBox::Cancel,
QMessageBox::Cancel);
if (button == QMessageBox::Yes)
{
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);
......@@ -3204,19 +3190,11 @@ void UAS::stopHil()
void UAS::shutdown()
{
QMessageBox msgBox;
msgBox.setIcon(QMessageBox::Critical);
msgBox.setText("Shutting down the UAS");
msgBox.setInformativeText("Do you want to shut down the onboard computer?");
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)
QMessageBox::StandardButton button = QGCMessageBox::question(tr("Shutting down the UAS"),
tr("Do you want to shut down the onboard computer?"),
QMessageBox::Yes | QMessageBox::Cancel,
QMessageBox::Cancel);
if (button == QMessageBox::Yes)
{
// If the active UAS is set, execute command
mavlink_message_t msg;
......
......@@ -10,13 +10,14 @@
#include <QList>
#include <QApplication>
#include <QMessageBox>
#include <QTimer>
#include <QSettings>
#include "UAS.h"
#include "UASInterface.h"
#include "UASManager.h"
#include "QGC.h"
#include "QGCMessageBox.h"
#define PI 3.1415926535897932384626433832795
#define MEAN_EARTH_DIAMETER 12756274.0
......@@ -308,7 +309,7 @@ void UASManager::addUAS(UASInterface* uas)
setActiveUAS(uas);
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.
for (int i=0;i<offlineUASWaypointManager->getWaypointEditableList().size();i++)
......
......@@ -28,7 +28,6 @@ This file is part of the QGROUNDCONTROL project
*/
#include <QFileInfo>
#include <QMessageBox>
#include <QStandardPaths>
#include "MAVLinkSettingsWidget.h"
......
......@@ -30,7 +30,6 @@ This file is part of the QGROUNDCONTROL project
#include <QSettings>
#include <QDockWidget>
#include <QNetworkInterface>
#include <QMessageBox>
#include <QDebug>
#include <QTimer>
#include <QHostInfo>
......@@ -73,6 +72,7 @@ This file is part of the QGROUNDCONTROL project
#include "QGCUASFileViewMulti.h"
#include "QGCCore.h"
#include "QGCFileDialog.h"
#include "QGCMessageBox.h"
#ifdef QGC_OSG_ENABLED
#include "Q3DWidgetFactory.h"
......@@ -1131,14 +1131,14 @@ void MainWindow::showCriticalMessage(const QString& title, const QString& messag
{
_hideSplashScreen();
qDebug() << "Critical" << title << message;
QMessageBox::critical(this, title, message);
QGCMessageBox::critical(title, message);
}
void MainWindow::showInfoMessage(const QString& title, const QString& message)
{
_hideSplashScreen();
qDebug() << "Information" << title << message;
QMessageBox::information(this, title, message);
QGCMessageBox::information(title, message);
}
/**
......@@ -1676,15 +1676,11 @@ void MainWindow::handleMisconfiguration(UASInterface* uas)
_hideSplashScreen();
// Ask user if he wants to handle this now
QMessageBox msgBox(this);
msgBox.setIcon(QMessageBox::Information);
msgBox.setText(tr("Missing or Invalid Onboard Configuration"));
msgBox.setInformativeText(tr("The onboard system configuration is missing or incomplete. Do you want to resolve this now?"));
msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
msgBox.setDefaultButton(QMessageBox::Ok);
int val = msgBox.exec();
if (val == QMessageBox::Ok) {
QMessageBox::StandardButton button = QGCMessageBox::question(tr("Missing or Invalid Onboard Configuration"),
tr("The onboard system configuration is missing or incomplete. Do you want to resolve this now?"),
QMessageBox::Ok | QMessageBox::Cancel,
QMessageBox::Ok);
if (button == QMessageBox::Ok) {
// He wants to handle it, make sure this system is selected
UASManager::instance()->setActiveUAS(uas);
......
......@@ -29,7 +29,6 @@ This file is part of the QGROUNDCONTROL project
*/
#include <QTemporaryFile>
#include <QMessageBox>
#include <QPrintDialog>
#include <QProgressDialog>
#include <QHBoxLayout>
......@@ -45,6 +44,7 @@ This file is part of the QGROUNDCONTROL project
#include "MG.h"
#include "MainWindow.h"
#include "QGCFileDialog.h"
#include "QGCMessageBox.h"
QGCDataPlot2D::QGCDataPlot2D(QWidget *parent) :
QWidget(parent),
......@@ -130,14 +130,14 @@ void QGCDataPlot2D::savePlot()
}
while(!(fileName.endsWith(".svg") || fileName.endsWith(".pdf"))) {
QMessageBox msgBox;
msgBox.setIcon(QMessageBox::Critical);
msgBox.setText("Unsuitable file extension for PDF or SVG");
msgBox.setInformativeText("Please choose .pdf or .svg as file extension. Click OK to change the file extension, cancel to not save the file.");
msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
msgBox.setDefaultButton(QMessageBox::Ok);
QMessageBox::StandardButton button = QGCMessageBox::critical(tr("Unsuitable file extension for PDF or SVG"),
tr("Please choose .pdf or .svg as file extension. Click OK to change the file extension, cancel to not save the file."),
QMessageBox::Ok | QMessageBox::Cancel,
QMessageBox::Ok);
// Abort if cancelled
if(msgBox.exec() == QMessageBox::Cancel) return;
if (button == QMessageBox::Cancel) {
return;
}
fileName = QGCFileDialog::getSaveFileName(
this, "Export File Name", QStandardPaths::writableLocation(QStandardPaths::DesktopLocation),
"PDF Documents (*.pdf);;SVG Images (*.svg)");
......@@ -279,13 +279,8 @@ void QGCDataPlot2D::selectFile()
QFileInfo fileInfo(fileName);
if (!fileInfo.isReadable())
{
QMessageBox msgBox;
msgBox.setIcon(QMessageBox::Critical);
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();
QGCMessageBox::critical(tr("Could not open file"),
tr("The file is owned by user %1. Is the file currently used by another program?").arg(fileInfo.owner()));
ui->filenameLabel->setText(tr("Could not open %1").arg(fileInfo.baseName()+"."+fileInfo.completeSuffix()));
}
else
......@@ -705,26 +700,6 @@ void QGCDataPlot2D::saveCsvLog()
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);
qDebug() << "Saved CSV log. Success: " << success;
......
......@@ -10,7 +10,6 @@
#include <QTimer>
#include <QDir>
#include <QXmlStreamReader>
#include <QMessageBox>
#include <QLabel>
#include "QGCPX4VehicleConfig.h"
......@@ -152,37 +151,6 @@ void QGCPX4VehicleConfig::firmwareMenuButtonClicked()
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()
{
QPushButton *button = qobject_cast<QPushButton*>(sender());
......
......@@ -7,7 +7,6 @@
#include <QGroupBox>
#include <QPushButton>
#include <QStringList>
#include <QMessageBox>
#include <QGraphicsScene>
#include "QGCToolWidget.h"
......@@ -78,7 +77,6 @@ protected:
QPixmap planeSide;
QGCPX4SensorCalibration* px4SensorCalibration;
PX4RCCalibration* px4RCCalibration;
QMessageBox msgBox;
QGraphicsScene scene;
QPushButton* skipActionButton;
......
......@@ -33,7 +33,6 @@ This file is part of the QGROUNDCONTROL project
#include <QGridLayout>
#include <QList>
#include <QMessageBox>
#include <QPushButton>
#include <QSettings>
#include <QTime>
......
......@@ -35,6 +35,7 @@
#include "GAudioOutput.h"
#include "QGCCore.h"
#include "QGCFileDialog.h"
#include "QGCMessageBox.h"
SettingsDialog::SettingsDialog(JoystickInput *joystick, QWidget *parent, Qt::WindowFlags flags) :
QDialog(parent, flags),
......@@ -122,11 +123,10 @@ void SettingsDialog::selectCustomMode(int mode)
void SettingsDialog::_deleteSettingsToggled(bool checked)
{
if (checked){
QMessageBox::StandardButton answer = QMessageBox::question(this,
tr("Delete Settings"),
tr("All saved settings will be deleted the next time you start QGroundControl. Is this really what you want?"),
QMessageBox::Yes | QMessageBox::No,
QMessageBox::No);
QGCMessageBox::StandardButton answer = QGCMessageBox::question(tr("Delete Settings"),
tr("All saved settings will be deleted the next time you start QGroundControl. Is this really what you want?"),
QMessageBox::Yes | QMessageBox::No,
QMessageBox::No);
if (answer == QMessageBox::Yes) {
qgcApp()->deleteAllSettingsNextBoot();
} else {
......@@ -146,9 +146,8 @@ void SettingsDialog::_validateBeforeClose(void)
QString saveLocation = _ui->savedFilesLocation->text();
if (!app->validatePossibleSavedFilesLocation(saveLocation)) {
QMessageBox::warning(_mainWindow,
tr("Bad save location"),
tr("The location to save files to is invalid, or cannot be written to. Please provide a valid directory."));
QGCMessageBox::warning(tr("Bad save location"),
tr("The location to save files to is invalid, or cannot be written to. Please provide a valid directory."));
return;
}
......
......@@ -27,7 +27,6 @@
#include <QFileDialog>
#include <QDir>
#include <QMessageBox>
QGCUASFileView::QGCUASFileView(QWidget *parent, QGCUASFileManager *manager) :
QWidget(parent),
......
......@@ -39,7 +39,6 @@ This file is part of the PIXHAWK project
#include <UAS.h>
#include <UASManager.h>
#include <QDebug>
#include <QMessageBox>
#include <QMouseEvent>
#include <QTextEdit>
......
......@@ -38,11 +38,11 @@ This file is part of the APM_PLANNER project
#include "ui_terminalconsole.h"
#include "console.h"
#include "QGCConfig.h"
#include "QGCMessageBox.h"
#include <QDebug>
#include <QSettings>
#include <QStatusBar>
#include <QMessageBox>
#include <QVBoxLayout>
#include <QComboBox>
#include <QSerialPort>
......@@ -159,12 +159,12 @@ void TerminalConsole::openSerialPort(const SerialSettings &settings)
} else {
m_serial->close();
QMessageBox::critical(this, tr("Error"), m_serial->errorString());
QGCMessageBox::critical(tr("Error"), m_serial->errorString());
m_statusBar->showMessage(tr("Open error"));
}
} else {
QMessageBox::critical(this, tr("Error"), m_serial->errorString());
QGCMessageBox::critical(tr("Error"), m_serial->errorString());
m_statusBar->showMessage(tr("Configure error"));
}
......@@ -222,7 +222,7 @@ void TerminalConsole::readData()
void TerminalConsole::handleError(QSerialPort::SerialPortError error)
{
if (error == QSerialPort::ResourceError) {
QMessageBox::critical(this, tr("Critical Error"), m_serial->errorString());