Commit 93cbdea2 authored by Don Gagne's avatar Don Gagne

Merge pull request #1778 from DonLakeFlyer/VehicleErrors

Show vehicle errors after parameters load
parents a617e2d2 f1196e14
...@@ -758,20 +758,25 @@ void ParameterLoader::_checkInitialLoadComplete(void) ...@@ -758,20 +758,25 @@ void ParameterLoader::_checkInitialLoadComplete(void)
UASMessageHandler* msgHandler = UASMessageHandler::instance(); UASMessageHandler* msgHandler = UASMessageHandler::instance();
if (msgHandler->getErrorCountTotal()) { if (msgHandler->getErrorCountTotal()) {
QString errors; QString errors;
bool firstError = true;
msgHandler->lockAccess(); msgHandler->lockAccess();
foreach (UASMessage* msg, msgHandler->messages()) { foreach (UASMessage* msg, msgHandler->messages()) {
if (msg->severityIsError()) { if (msg->severityIsError()) {
errors += msg->getText(); if (!firstError) {
errors += "\n"; errors += "\n";
} }
errors += " - ";
errors += msg->getText();
firstError = false;
}
} }
msgHandler->unlockAccess(); msgHandler->unlockAccess();
QGCMessageBox::critical("Vehicle startup errors", if (!firstError) {
QString("Errors were detected during vehicle startup:\n" QString errorMsg = QString("Errors were detected during vehicle startup. You should resolve these prior to flight.\n%1").arg(errors);
"%1" qgcApp()->showToolBarMessage(errorMsg);
"You should resolve these prior to flight.").arg(errors)); }
} }
// Warn of parameter load failure // Warn of parameter load failure
......
...@@ -772,3 +772,13 @@ MavManager* QGCApplication::getMavManager() ...@@ -772,3 +772,13 @@ MavManager* QGCApplication::getMavManager()
{ {
return _pMavManager; return _pMavManager;
} }
void QGCApplication::showToolBarMessage(const QString& message)
{
MainWindow* mainWindow = MainWindow::instance();
if (mainWindow) {
mainWindow->getMainToolBar()->showToolBarMessage(message);
} else {
QGCMessageBox::information("", message);
}
}
...@@ -107,6 +107,9 @@ public: ...@@ -107,6 +107,9 @@ public:
/// MavManager accessor /// MavManager accessor
MavManager* getMavManager(); MavManager* getMavManager();
/// Show a non-modal message to the user
void showToolBarMessage(const QString& message);
public slots: public slots:
/// You can connect to this slot to show an information message box from a different thread. /// You can connect to this slot to show an information message box from a different thread.
void informationMessageBoxOnMainThread(const QString& title, const QString& msg); void informationMessageBoxOnMainThread(const QString& title, const QString& msg);
......
...@@ -30,7 +30,7 @@ QGCQmlWidgetHolder::QGCQmlWidgetHolder(QWidget *parent) : ...@@ -30,7 +30,7 @@ QGCQmlWidgetHolder::QGCQmlWidgetHolder(QWidget *parent) :
QWidget(parent) QWidget(parent)
{ {
_ui.setupUi(this); _ui.setupUi(this);
_ui.qmlWidget->setResizeMode(QQuickWidget::SizeRootObjectToView); setResizeMode(QQuickWidget::SizeRootObjectToView);
} }
QGCQmlWidgetHolder::~QGCQmlWidgetHolder() QGCQmlWidgetHolder::~QGCQmlWidgetHolder()
...@@ -62,3 +62,8 @@ QQuickItem* QGCQmlWidgetHolder::getRootObject(void) ...@@ -62,3 +62,8 @@ QQuickItem* QGCQmlWidgetHolder::getRootObject(void)
{ {
return _ui.qmlWidget->rootObject(); return _ui.qmlWidget->rootObject();
} }
void QGCQmlWidgetHolder::setResizeMode(QQuickWidget::ResizeMode resizeMode)
{
_ui.qmlWidget->setResizeMode(resizeMode);
}
\ No newline at end of file
...@@ -61,6 +61,9 @@ public: ...@@ -61,6 +61,9 @@ public:
void setContextPropertyObject(const QString& name, QObject* object); void setContextPropertyObject(const QString& name, QObject* object);
/// Sets the resize mode for the QQuickWidget container
void setResizeMode(QQuickWidget::ResizeMode resizeMode);
private: private:
Ui::QGCQmlWidgetHolder _ui; Ui::QGCQmlWidgetHolder _ui;
}; };
......
...@@ -92,6 +92,8 @@ MainToolBar::MainToolBar(QWidget* parent) ...@@ -92,6 +92,8 @@ MainToolBar::MainToolBar(QWidget* parent)
SLOT(_telemetryChanged(LinkInterface*, unsigned, unsigned, unsigned, unsigned, unsigned, unsigned, unsigned))); SLOT(_telemetryChanged(LinkInterface*, unsigned, unsigned, unsigned, unsigned, unsigned, unsigned, unsigned)));
connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(_setActiveUAS(UASInterface*))); connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(_setActiveUAS(UASInterface*)));
connect(UASManager::instance(), SIGNAL(UASDeleted(UASInterface*)), this, SLOT(_forgetUAS(UASInterface*))); connect(UASManager::instance(), SIGNAL(UASDeleted(UASInterface*)), this, SLOT(_forgetUAS(UASInterface*)));
connect(this, &MainToolBar::heightChanged, this, &MainToolBar::_heightChanged);
} }
MainToolBar::~MainToolBar() MainToolBar::~MainToolBar()
...@@ -396,3 +398,9 @@ void MainToolBar::_setProgressBarValue(float value) ...@@ -396,3 +398,9 @@ void MainToolBar::_setProgressBarValue(float value)
_progressBarValue = value; _progressBarValue = value;
emit progressBarValueChanged(value); emit progressBarValueChanged(value);
} }
void MainToolBar::_heightChanged(double height)
{
setMinimumHeight(height);
setMaximumHeight(height);
}
...@@ -69,6 +69,7 @@ public: ...@@ -69,6 +69,7 @@ public:
Q_INVOKABLE void onDisconnect(QString conf); Q_INVOKABLE void onDisconnect(QString conf);
Q_INVOKABLE void onEnterMessageArea(int x, int y); Q_INVOKABLE void onEnterMessageArea(int x, int y);
Q_PROPERTY(double height MEMBER _toolbarHeight NOTIFY heightChanged)
Q_PROPERTY(ViewType_t currentView MEMBER _currentView NOTIFY currentViewChanged) Q_PROPERTY(ViewType_t currentView MEMBER _currentView NOTIFY currentViewChanged)
Q_PROPERTY(QStringList configList MEMBER _linkConfigurations NOTIFY configListChanged) Q_PROPERTY(QStringList configList MEMBER _linkConfigurations NOTIFY configListChanged)
Q_PROPERTY(int connectionCount READ connectionCount NOTIFY connectionCountChanged) Q_PROPERTY(int connectionCount READ connectionCount NOTIFY connectionCountChanged)
...@@ -90,6 +91,8 @@ public: ...@@ -90,6 +91,8 @@ public:
int telemetryLRSSI () { return _telemetryLRSSI; } int telemetryLRSSI () { return _telemetryLRSSI; }
int connectionCount () { return _connectionCount; } int connectionCount () { return _connectionCount; }
void showToolBarMessage(const QString& message) { emit showMessage(message); }
signals: signals:
void connectionCountChanged (int count); void connectionCountChanged (int count);
void currentViewChanged (); void currentViewChanged ();
...@@ -104,6 +107,10 @@ signals: ...@@ -104,6 +107,10 @@ signals:
void remoteRSSIChanged (int value); void remoteRSSIChanged (int value);
void telemetryRRSSIChanged (int value); void telemetryRRSSIChanged (int value);
void telemetryLRSSIChanged (int value); void telemetryLRSSIChanged (int value);
void heightChanged (double height);
/// Shows a non-modal message below the toolbar
void showMessage(const QString& message);
private slots: private slots:
void _forgetUAS (UASInterface* uas); void _forgetUAS (UASInterface* uas);
...@@ -115,6 +122,7 @@ private slots: ...@@ -115,6 +122,7 @@ private slots:
void _setProgressBarValue (float value); void _setProgressBarValue (float value);
void _remoteControlRSSIChanged (uint8_t rssi); void _remoteControlRSSIChanged (uint8_t rssi);
void _telemetryChanged (LinkInterface* link, unsigned rxerrors, unsigned fixed, unsigned rssi, unsigned remrssi, unsigned txbuf, unsigned noise, unsigned remnoise); void _telemetryChanged (LinkInterface* link, unsigned rxerrors, unsigned fixed, unsigned rssi, unsigned remrssi, unsigned txbuf, unsigned noise, unsigned remnoise);
void _heightChanged (double height);
private: private:
void _updateConnection (LinkInterface *disconnectedLink = NULL); void _updateConnection (LinkInterface *disconnectedLink = NULL);
...@@ -137,6 +145,7 @@ private: ...@@ -137,6 +145,7 @@ private:
double _remoteRSSIstore; double _remoteRSSIstore;
int _telemetryRRSSI; int _telemetryRRSSI;
int _telemetryLRSSI; int _telemetryLRSSI;
double _toolbarHeight;
UASMessageViewRollDown* _rollDownMessages; UASMessageViewRollDown* _rollDownMessages;
}; };
......
...@@ -43,14 +43,18 @@ Rectangle { ...@@ -43,14 +43,18 @@ Rectangle {
property var qgcPal: QGCPalette { id: palette; colorGroupEnabled: true } property var qgcPal: QGCPalette { id: palette; colorGroupEnabled: true }
readonly property real toolBarHeight: ScreenTools.defaultFontPixelHeight * 3
property int cellSpacerSize: ScreenTools.isMobile ? getProportionalDimmension(6) : getProportionalDimmension(4) property int cellSpacerSize: ScreenTools.isMobile ? getProportionalDimmension(6) : getProportionalDimmension(4)
property int cellHeight: getProportionalDimmension(30) readonly property int cellHeight: toolBarHeight * 0.75
property var colorBlue: "#1a6eaa" readonly property real horizontalMargins: ScreenTools.defaultFontPixelWidth / 2
property var colorGreen: "#329147" readonly property real verticalMargins: ScreenTools.defaultFontPixelHeight / 4
property var colorRed: "#942324"
property var colorOrange: "#a76f26" readonly property var colorBlue: "#1a6eaa"
property var colorWhite: "#f0f0f0" readonly property var colorGreen: "#329147"
readonly property var colorRed: "#942324"
readonly property var colorOrange: "#a76f26"
readonly property var colorWhite: "#f0f0f0"
property var colorOrangeText: (qgcPal.globalTheme === QGCPalette.Light) ? "#b75711" : "#ea8225" property var colorOrangeText: (qgcPal.globalTheme === QGCPalette.Light) ? "#b75711" : "#ea8225"
property var colorRedText: (qgcPal.globalTheme === QGCPalette.Light) ? "#ee1112" : "#ef2526" property var colorRedText: (qgcPal.globalTheme === QGCPalette.Light) ? "#ee1112" : "#ef2526"
...@@ -59,8 +63,18 @@ Rectangle { ...@@ -59,8 +63,18 @@ Rectangle {
color: qgcPal.windowShade color: qgcPal.windowShade
Connections {
target: mainToolBar
onShowMessage: {
toolBarMessage.text = message
mainToolBar.height = toolBarHeight + toolBarMessage.contentHeight + verticalMargins
toolBarMessageArea.visible = true
}
}
function getProportionalDimmension(val) { function getProportionalDimmension(val) {
return toolBarHolder.height * val / 40 return toolBarHeight * val / 40
} }
function getMessageColor() { function getMessageColor() {
...@@ -177,15 +191,14 @@ Rectangle { ...@@ -177,15 +191,14 @@ Rectangle {
mainToolBar.onFlyViewMenu(); mainToolBar.onFlyViewMenu();
} }
} }
} } // Menu
Row { Row {
id: row1 id: toolRow
x: horizontalMargins
y: (toolBarHeight - cellHeight) / 2
height: cellHeight height: cellHeight
anchors.left: parent.left
spacing: getProportionalDimmension(4) spacing: getProportionalDimmension(4)
anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: getProportionalDimmension(10)
//--------------------------------------------------------------------- //---------------------------------------------------------------------
//-- Main menu for Non Mobile Devices (Chevron Buttons) //-- Main menu for Non Mobile Devices (Chevron Buttons)
...@@ -193,8 +206,9 @@ Rectangle { ...@@ -193,8 +206,9 @@ Rectangle {
id: row11 id: row11
height: cellHeight height: cellHeight
spacing: -getProportionalDimmension(12) spacing: -getProportionalDimmension(12)
anchors.verticalCenter: parent.verticalCenter anchors.top: parent.top
visible: !ScreenTools.isMobile visible: !ScreenTools.isMobile
Connections { Connections {
target: ScreenTools target: ScreenTools
onRepaintRequested: { onRepaintRequested: {
...@@ -213,7 +227,6 @@ Rectangle { ...@@ -213,7 +227,6 @@ Rectangle {
height: cellHeight height: cellHeight
exclusiveGroup: mainActionGroup exclusiveGroup: mainActionGroup
text: qsTr("Setup") text: qsTr("Setup")
anchors.verticalCenter: parent.verticalCenter
checked: (mainToolBar.currentView === MainToolBar.ViewSetup) checked: (mainToolBar.currentView === MainToolBar.ViewSetup)
onClicked: { onClicked: {
mainToolBar.onSetupView(); mainToolBar.onSetupView();
...@@ -227,7 +240,6 @@ Rectangle { ...@@ -227,7 +240,6 @@ Rectangle {
height: cellHeight height: cellHeight
exclusiveGroup: mainActionGroup exclusiveGroup: mainActionGroup
text: qsTr("Plan") text: qsTr("Plan")
anchors.verticalCenter: parent.verticalCenter
checked: (mainToolBar.currentView === MainToolBar.ViewPlan) checked: (mainToolBar.currentView === MainToolBar.ViewPlan)
onClicked: { onClicked: {
mainToolBar.onPlanView(); mainToolBar.onPlanView();
...@@ -241,7 +253,6 @@ Rectangle { ...@@ -241,7 +253,6 @@ Rectangle {
height: cellHeight height: cellHeight
exclusiveGroup: mainActionGroup exclusiveGroup: mainActionGroup
text: qsTr("Fly") text: qsTr("Fly")
anchors.verticalCenter: parent.verticalCenter
checked: (mainToolBar.currentView === MainToolBar.ViewFly) checked: (mainToolBar.currentView === MainToolBar.ViewFly)
onClicked: { onClicked: {
mainToolBar.onFlyView(); mainToolBar.onFlyView();
...@@ -255,15 +266,13 @@ Rectangle { ...@@ -255,15 +266,13 @@ Rectangle {
height: cellHeight height: cellHeight
exclusiveGroup: mainActionGroup exclusiveGroup: mainActionGroup
text: qsTr("Analyze") text: qsTr("Analyze")
anchors.verticalCenter: parent.verticalCenter
checked: (mainToolBar.currentView === MainToolBar.ViewAnalyze) checked: (mainToolBar.currentView === MainToolBar.ViewAnalyze)
onClicked: { onClicked: {
mainToolBar.onAnalyzeView(); mainToolBar.onAnalyzeView();
} }
z: 700 z: 700
} }
} // Row
}
//--------------------------------------------------------------------- //---------------------------------------------------------------------
//-- Indicators //-- Indicators
...@@ -667,17 +676,17 @@ Rectangle { ...@@ -667,17 +676,17 @@ Rectangle {
color: colorRedText color: colorRedText
} }
} }
} } // Row
} } // Row
Row { Row {
id: row2 id: connectRow
height: cellHeight anchors.rightMargin: verticalMargins
spacing: cellSpacerSize
anchors.right: parent.right anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter anchors.top: toolRow.top
anchors.leftMargin: getProportionalDimmension(10) anchors.verticalCenter: toolRow.verticalCenter
anchors.rightMargin: getProportionalDimmension(10) height: toolRow.height
spacing: cellSpacerSize
Menu { Menu {
id: connectMenu id: connectMenu
...@@ -712,7 +721,6 @@ Rectangle { ...@@ -712,7 +721,6 @@ Rectangle {
visible: mainToolBar.connectionCount === 0 visible: mainToolBar.connectionCount === 0
text: qsTr("Connect") text: qsTr("Connect")
menu: connectMenu menu: connectMenu
anchors.verticalCenter: parent.verticalCenter
} }
QGCButton { QGCButton {
...@@ -720,7 +728,6 @@ Rectangle { ...@@ -720,7 +728,6 @@ Rectangle {
width: getProportionalDimmension(100) width: getProportionalDimmension(100)
visible: mainToolBar.connectionCount === 1 visible: mainToolBar.connectionCount === 1
text: qsTr("Disconnect") text: qsTr("Disconnect")
anchors.verticalCenter: parent.verticalCenter
onClicked: { onClicked: {
mainToolBar.onDisconnect(""); mainToolBar.onDisconnect("");
} }
...@@ -750,18 +757,47 @@ Rectangle { ...@@ -750,18 +757,47 @@ Rectangle {
text: "Disconnect" text: "Disconnect"
visible: mainToolBar.connectionCount > 1 visible: mainToolBar.connectionCount > 1
menu: disconnectMenu menu: disconnectMenu
anchors.verticalCenter: parent.verticalCenter
}
} }
} // Row
// Progress bar // Progress bar
Rectangle { Rectangle {
readonly property int progressBarHeight: getProportionalDimmension(3) id: progressBar
y: parent.height - progressBarHeight anchors.top: toolRow.bottom
height: progressBarHeight height: getProportionalDimmension(3)
width: parent.width * mainToolBar.progressBarValue width: parent.width * mainToolBar.progressBarValue
color: qgcPal.text color: qgcPal.text
} }
}
// Toolbar message area
Rectangle {
id: toolBarMessageArea
anchors.margins: horizontalMargins
anchors.top: progressBar.bottom
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
color: qgcPal.windowShadeDark
visible: false
QGCLabel {
id: toolBarMessage
anchors.fill: parent
wrapMode: Text.WordWrap
}
QGCButton {
id: toolBarMessageCloseButton
anchors.rightMargin: horizontalMargins
anchors.topMargin: verticalMargins
anchors.top: parent.top
anchors.right: parent.right
text: "Close Message"
onClicked: {
parent.visible = false
mainToolBar.height = toolBarHeight
}
}
}
} // Rectangle
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