Skip to content

Commit

Permalink
Vehicle Messages indicator is now part of Main Status Indicator
Browse files Browse the repository at this point in the history
Also main flight status text ("Flying") is no longer displayed in a marquee control, just regular text now
  • Loading branch information
DonLakeFlyer committed Mar 4, 2025
1 parent 716e9cc commit ac9de96
Show file tree
Hide file tree
Showing 16 changed files with 231 additions and 322 deletions.
1 change: 0 additions & 1 deletion custom-example/qgroundcontrol.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
<file alias="VehicleGPSIndicator.qml">../src/UI/toolbar/VehicleGPSIndicator.qml</file>
<file alias="JoystickIndicator.qml">../src/UI/toolbar/JoystickIndicator.qml</file>
<file alias="LinkIndicator.qml">../src/UI/toolbar/LinkIndicator.qml</file>
<file alias="MessageIndicator.qml">../src/UI/toolbar/MessageIndicator.qml</file>
<file alias="ModeIndicator.qml">../src/UI/toolbar/ModeIndicator.qml</file>
<file alias="MultiVehicleSelector.qml">../src/UI/toolbar/MultiVehicleSelector.qml</file>
<file alias="RCRSSIIndicator.qml">../src/UI/toolbar/RCRSSIIndicator.qml</file>
Expand Down
1 change: 1 addition & 0 deletions qgcresources.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
<file alias="takeoff.svg">resources/takeoff.svg</file>
<file alias="terrain.svg">resources/terrain.svg</file>
<file alias="TrashDelete.svg">resources/TrashDelete.svg</file>
<file alias="VehicleMessages.png">resources/VehicleMessages.png</file>
<file alias="waves.svg">resources/waves.svg</file>
<file alias="wind-guru.svg">resources/wind-guru.svg</file>
<file alias="wind-rose.svg">resources/wind-rose.svg</file>
Expand Down
2 changes: 1 addition & 1 deletion qgroundcontrol.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
<file alias="VehicleGPSIndicator.qml">src/UI/toolbar/VehicleGPSIndicator.qml</file>
<file alias="JoystickIndicator.qml">src/UI/toolbar/JoystickIndicator.qml</file>
<file alias="LinkIndicator.qml">src/UI/toolbar/LinkIndicator.qml</file>
<file alias="MessageIndicator.qml">src/UI/toolbar/MessageIndicator.qml</file>
<file alias="ModeIndicator.qml">src/UI/toolbar/ModeIndicator.qml</file>
<file alias="MultiVehicleSelector.qml">src/UI/toolbar/MultiVehicleSelector.qml</file>
<file alias="RCRSSIIndicator.qml">src/UI/toolbar/RCRSSIIndicator.qml</file>
Expand Down Expand Up @@ -205,6 +204,7 @@
<file alias="QGroundControl/Controls/TransectStyleComplexItemTabBar.qml">src/PlanView/TransectStyleComplexItemTabBar.qml</file>
<file alias="QGroundControl/Controls/TransectStyleComplexItemTerrainFollow.qml">src/PlanView/TransectStyleComplexItemTerrainFollow.qml</file>
<file alias="QGroundControl/Controls/ValueSlider.qml">src/QmlControls/ValueSlider.qml</file>
<file alias="QGroundControl/Controls/VehicleMessageList.qml">src/UI/toolbar/VehicleMessageList.qml</file>
<file alias="QGroundControl/Controls/VehicleRotationCal.qml">src/QmlControls/VehicleRotationCal.qml</file>
<file alias="QGroundControl/Controls/VehicleSummaryRow.qml">src/QmlControls/VehicleSummaryRow.qml</file>
<file alias="QGroundControl/Controls/VTOLLandingPatternMapVisual.qml">src/PlanView/VTOLLandingPatternMapVisual.qml</file>
Expand Down
Binary file added resources/VehicleMessages.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion src/FirmwarePlugin/APM/ArduSubFirmwarePlugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ const QVariantList& ArduSubFirmwarePlugin::toolIndicators(const Vehicle* vehicle
//-- Sub specific list of indicators (Enter your modified list here)
if(_toolIndicators.size() == 0) {
_toolIndicators = QVariantList({
QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/MessageIndicator.qml")),
QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/BatteryIndicator.qml")),
QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/JoystickIndicator.qml")),
});
Expand Down
1 change: 0 additions & 1 deletion src/FirmwarePlugin/FirmwarePlugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,6 @@ const QVariantList& FirmwarePlugin::toolIndicators(const Vehicle*)
if(_toolIndicatorList.size() == 0) {
_toolIndicatorList = QVariantList({
QVariant::fromValue(QUrl::fromUserInput("qrc:/qml/QGroundControl/Controls/FlightModeIndicator.qml")),
QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/MessageIndicator.qml")),
QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/VehicleGPSIndicator.qml")),
QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/TelemetryRSSIIndicator.qml")),
QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/RCRSSIIndicator.qml")),
Expand Down
4 changes: 2 additions & 2 deletions src/FlightDisplay/FlyView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ Item {
toolstrip.adjustToolInset(newToolInset)
}

function dropMessageIndicatorTool() {
toolbar.dropMessageIndicatorTool();
function dropMainStatusIndicatorTool() {
toolbar.dropMainStatusIndicatorTool();
}

QGCToolInsets {
Expand Down
14 changes: 12 additions & 2 deletions src/MAVLink/StatusTextHandler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,18 @@ void StatusTextHandler::_handleTextMessage(uint32_t newCount, MessageType messag
emit messageCountChanged(messageCount());
}

if (messageType != m_messageType) {
m_messageType = messageType;
// messageType represents the worst message which hasn't been viewed yet
MessageType newMessageType = MessageType::MessageNone;
if (getErrorCount() > 0) {
newMessageType = MessageType::MessageError;
} else if (getWarningCount() > 0) {
newMessageType = MessageType::MessageWarning;
} else if (getNormalCount() > 0) {
newMessageType = MessageType::MessageNormal;
}

if (newMessageType != m_messageType) {
m_messageType = newMessageType;
emit messageTypeChanged();
}
}
2 changes: 1 addition & 1 deletion src/MissionManager/PlanManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void PlanManager::writeMissionItems(const QList<MissionItem*>& missionItems)

bool skipFirstItem = _planType == MAV_MISSION_TYPE_MISSION && !_vehicle->firmwarePlugin()->sendHomePositionToVehicle();

if (skipFirstItem) {
if (skipFirstItem && missionItems.count() > 0) {
// First item is not going to be moved to _writeMissionItems, free it now.
delete missionItems[0];
}
Expand Down
1 change: 1 addition & 0 deletions src/QmlControls/QGroundControl/Controls/qmldir
Original file line number Diff line number Diff line change
Expand Up @@ -127,5 +127,6 @@ TransectStyleComplexItemTabBar 1.0 TransectStyleComplexItemTabBar.qml
TransectStyleComplexItemTerrainFollow 1.0 TransectStyleComplexItemTerrainFollow.qml
TransectStyleMapVisuals 1.0 TransectStyleMapVisuals.qml
ValueSlider 1.0 ValueSlider.qml
VehicleMessageList 1.0 VehicleMessageList.qml
VehicleRotationCal 1.0 VehicleRotationCal.qml
VehicleSummaryRow 1.0 VehicleSummaryRow.qml
22 changes: 11 additions & 11 deletions src/UI/MainRootWindow.qml
Original file line number Diff line number Diff line change
Expand Up @@ -561,28 +561,27 @@ ApplicationWindow {
function showCriticalVehicleMessage(message) {
closeIndicatorDrawer()
if (criticalVehicleMessagePopup.visible || QGroundControl.videoManager.fullScreen) {
// We received additional wanring message while an older warning message was still displayed.
// We received additional warning message while an older warning message was still displayed.
// When the user close the older one drop the message indicator tool so they can see the rest of them.
criticalVehicleMessagePopup.dropMessageIndicatorOnClose = true
criticalVehicleMessagePopup.additionalCriticalMessagesReceived = true
} else {
criticalVehicleMessagePopup.criticalVehicleMessage = message
criticalVehicleMessagePopup.dropMessageIndicatorOnClose = false
criticalVehicleMessagePopup.additionalCriticalMessagesReceived = false
criticalVehicleMessagePopup.open()
}
}

Popup {
id: criticalVehicleMessagePopup
y: ScreenTools.defaultFontPixelHeight
y: ScreenTools.toolbarHeight + ScreenTools.defaultFontPixelHeight
x: Math.round((mainWindow.width - width) * 0.5)
width: mainWindow.width * 0.55
height: criticalVehicleMessageText.contentHeight + ScreenTools.defaultFontPixelHeight * 2
modal: false
focus: true
closePolicy: Popup.CloseOnEscape

property alias criticalVehicleMessage: criticalVehicleMessageText.text
property bool dropMessageIndicatorOnClose: false
property alias criticalVehicleMessage: criticalVehicleMessageText.text
property bool additionalCriticalMessagesReceived: false

background: Rectangle {
anchors.fill: parent
Expand Down Expand Up @@ -624,7 +623,7 @@ ApplicationWindow {
border.width: 1
width: additionalErrorsLabel.contentWidth + _margins
height: additionalErrorsLabel.contentHeight + _margins
visible: criticalVehicleMessagePopup.dropMessageIndicatorOnClose
visible: criticalVehicleMessagePopup.additionalCriticalMessagesReceived

property real _margins: ScreenTools.defaultFontPixelHeight * 0.25

Expand All @@ -651,10 +650,11 @@ ApplicationWindow {
anchors.fill: parent
onClicked: {
criticalVehicleMessagePopup.close()
if (criticalVehicleMessagePopup.dropMessageIndicatorOnClose) {
criticalVehicleMessagePopup.dropMessageIndicatorOnClose = false;
if (criticalVehicleMessagePopup.additionalCriticalMessagesReceived) {
criticalVehicleMessagePopup.additionalCriticalMessagesReceived = false;
flyView.dropMainStatusIndicatorTool();
} else {
QGroundControl.multiVehicleManager.activeVehicle.resetErrorLevelMessages();
flyView.dropMessageIndicatorTool();
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/UI/toolbar/FlyViewToolBar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ Rectangle {
property bool _communicationLost: _activeVehicle ? _activeVehicle.vehicleLinkManager.communicationLost : false
property color _mainStatusBGColor: qgcPal.brandingPurple

function dropMessageIndicatorTool() {
toolIndicators.dropMessageIndicatorTool();
function dropMainStatusIndicatorTool() {
mainStatusIndicator.dropMainStatusIndicator();
}

QGCPalette { id: qgcPal }
Expand Down Expand Up @@ -72,6 +72,7 @@ Rectangle {
}

MainStatusIndicator {
id: mainStatusIndicator
Layout.preferredHeight: viewButtonRow.height
}

Expand Down
13 changes: 0 additions & 13 deletions src/UI/toolbar/FlyViewToolBarIndicators.qml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ Row {
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property real _toolIndicatorMargins: ScreenTools.defaultFontPixelHeight * 0.66

function dropMessageIndicatorTool() {
toolIndicatorsRepeater.dropMessageIndicatorTool();
}

Repeater {
id: appRepeater
model: QGroundControl.corePlugin.toolBarIndicators
Expand All @@ -43,15 +39,6 @@ Row {
id: toolIndicatorsRepeater
model: _activeVehicle ? _activeVehicle.toolIndicators : []

function dropMessageIndicatorTool() {
for (var i=0; i<count; i++) {
var thisTool = itemAt(i);
if (thisTool.item.dropMessageIndicator) {
thisTool.item.dropMessageIndicator();
}
}
}

Loader {
anchors.top: parent.top
anchors.bottom: parent.bottom
Expand Down
Loading

0 comments on commit ac9de96

Please sign in to comment.