Skip to content
5 changes: 4 additions & 1 deletion resources/AdvancedTab.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Item {
contentHeight: Constants.tabBarHeight

Repeater {
model: ["System Monitor", "IMU", "Magnetometer", "Networking", "Spectrum Analyzer"]
model: ["System Monitor", "IMU", "Magnetometer", "Networking", "Spectrum Analyzer", "INS"]

TabButton {
text: modelData
Expand Down Expand Up @@ -62,6 +62,9 @@ Item {
AdvancedTabComponents.AdvancedSpectrumAnalyzerTab {
}

AdvancedTabComponents.AdvancedInsTab {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm but this is in a StackLayout... nothing else should be showing but one of the items in this list...

}

}

}
Expand Down
6 changes: 0 additions & 6 deletions resources/AdvancedTabComponents/AdvancedImuTab.qml
Original file line number Diff line number Diff line change
Expand Up @@ -304,12 +304,6 @@ Item {

}

FusionStatusFlags {
Layout.fillWidth: true
Layout.preferredHeight: Constants.advancedImu.urlBarHeight
Layout.alignment: Qt.AlignBottom
}

}

}
22 changes: 22 additions & 0 deletions resources/AdvancedTabComponents/AdvancedInsTab.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import "../Constants"
import QtCharts 2.3
import QtQuick 2.6
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.15
import SwiftConsole 1.0

Item {
id: advancedInsTab

width: parent.width
height: parent.height

ColumnLayout {
anchors.centerIn: parent

FusionStatusFlags {
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really don't like that across the app, you guys don't specify the anchors or sizing of components where you use them.
You should leave out the width, height, x, y, and any anchors from the base of the component you are defining, and leave it to the place where you use it to define that... And for FusionStatusFlags, that place where you use it is here ^^

I'll put another comment in FusionStatusFlags talking about it.

Ok - so for sizing here, this is in a ColumnLayout, so use the Layout.xxx attached properties for sizing and placement. The ColumnLayout will decide where to vertically place it, but you can tell it to fill any available height, which you should do in this case, since there's just this one component, and you want it to fill. Same with the width - you want it to fill the ColumnLayout

so, add the following:

Layout.fillWidth: true```

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really don't like that across the app, you guys don't specify the anchors or sizing of components where you use them. You should leave out the width, height, x, y, and any anchors from the base of the component you are defining, and leave it to the place where you use it to define that... And for FusionStatusFlags, that place where you use it is here ^^

What is the impact of doing things this way? Perhaps we should capture this as a clean-up task through-out the QML code.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you make a .qml component, typically it is to be used as a reusable component to be used in more than one place (or at least, with the potential to use in more than one place).

You don't know what the parent is going to be - it could be a Layout, where setting explicit widths and heights doesn't make sense. If it happened to be paired with another component in a ColumnLayout, for instance, then setting the width and height to parent.width and parent.height makes no sense, and would make the second item in the ColumnLayout not show properly. It would also not be clear when you used it that that was the problem - since you wouldn't be looking at the component that set those (in this case FusionStatusFlags).


}

}
67 changes: 35 additions & 32 deletions resources/AdvancedTabComponents/FusionStatusFlags.qml
Original file line number Diff line number Diff line change
Expand Up @@ -16,171 +16,169 @@ Item {
property string last_nhc: "UNKNOWN"
property string last_zerovel: "UNKNOWN"

width: parent.width
height: parent.height
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see you removed the sizing of the Item* here, but didn't add any sizing to it where it's used in AdvancedInsTab.qml.
I think this might be where the weird placement you're seeing is happening. I'll comment in there to mention what you should add there.

  • Which should be removed, see next comment.

Component.onCompleted: {
}

FusionStatusFlagsData {
id: fusionStatusFlagsData
}

ColumnLayout {
id: fusionStatusFlagsArea
GroupBox {
anchors.centerIn: parent

width: parent.width
height: parent.height
GridLayout {
id: fusionStatusFlagsArea

RowLayout {
id: insStatusRow

visible: false
Layout.fillWidth: true
Layout.preferredHeight: Constants.advancedImu.urlBarHeight
Layout.alignment: Qt.AlignBottom
columns: 2

Label {
text: Constants.advancedImu.insStatusLabels[0]
font.pointSize: Constants.fusionStatusFlags.labelFontSize
}

UnknownStatus {
id: gnssposUnknown

Layout.preferredWidth: Constants.advancedImu.insStatusImageWidth
Layout.preferredWidth: Constants.fusionStatusFlags.fusionStatusWidth
}

WarningStatus {
id: gnssposWarning

visible: false
Layout.preferredWidth: Constants.advancedImu.insStatusImageWidth
Layout.preferredWidth: Constants.fusionStatusFlags.fusionStatusWidth
}

OkStatus {
id: gnssposOk

visible: false
Layout.preferredWidth: Constants.advancedImu.insStatusImageWidth
Layout.preferredWidth: Constants.fusionStatusFlags.fusionStatusWidth
}

Label {
text: Constants.advancedImu.insStatusLabels[1]
font.pointSize: Constants.fusionStatusFlags.labelFontSize
}

UnknownStatus {
id: gnssvelUnknown

Layout.preferredWidth: Constants.advancedImu.insStatusImageWidth
Layout.preferredWidth: Constants.fusionStatusFlags.fusionStatusWidth
}

WarningStatus {
id: gnssvelWarning

visible: false
Layout.preferredWidth: Constants.advancedImu.insStatusImageWidth
Layout.preferredWidth: Constants.fusionStatusFlags.fusionStatusWidth
}

OkStatus {
id: gnssvelOk

visible: false
Layout.preferredWidth: Constants.advancedImu.insStatusImageWidth
Layout.preferredWidth: Constants.fusionStatusFlags.fusionStatusWidth
}

Label {
text: Constants.advancedImu.insStatusLabels[2]
font.pointSize: Constants.fusionStatusFlags.labelFontSize
}

UnknownStatus {
id: wheelticksUnknown

Layout.preferredWidth: Constants.advancedImu.insStatusImageWidth
Layout.preferredWidth: Constants.fusionStatusFlags.fusionStatusWidth
}

WarningStatus {
id: wheelticksWarning

visible: false
Layout.preferredWidth: Constants.advancedImu.insStatusImageWidth
Layout.preferredWidth: Constants.fusionStatusFlags.fusionStatusWidth
}

OkStatus {
id: wheelticksOk

visible: false
Layout.preferredWidth: Constants.advancedImu.insStatusImageWidth
Layout.preferredWidth: Constants.fusionStatusFlags.fusionStatusWidth
}

Label {
text: Constants.advancedImu.insStatusLabels[3]
font.pointSize: Constants.fusionStatusFlags.labelFontSize
}

UnknownStatus {
id: speedUnknown

Layout.preferredWidth: Constants.advancedImu.insStatusImageWidth
Layout.preferredWidth: Constants.fusionStatusFlags.fusionStatusWidth
}

WarningStatus {
id: speedWarning

visible: false
Layout.preferredWidth: Constants.advancedImu.insStatusImageWidth
Layout.preferredWidth: Constants.fusionStatusFlags.fusionStatusWidth
}

OkStatus {
id: speedOk

visible: false
Layout.preferredWidth: Constants.advancedImu.insStatusImageWidth
Layout.preferredWidth: Constants.fusionStatusFlags.fusionStatusWidth
}

Label {
text: Constants.advancedImu.insStatusLabels[4]
font.pointSize: Constants.fusionStatusFlags.labelFontSize
}

UnknownStatus {
id: nhcUnknown

Layout.preferredWidth: Constants.advancedImu.insStatusImageWidth
Layout.preferredWidth: Constants.fusionStatusFlags.fusionStatusWidth
}

WarningStatus {
id: nhcWarning

visible: false
Layout.preferredWidth: Constants.advancedImu.insStatusImageWidth
Layout.preferredWidth: Constants.fusionStatusFlags.fusionStatusWidth
}

OkStatus {
id: nhcOk

visible: false
Layout.preferredWidth: Constants.advancedImu.insStatusImageWidth
Layout.preferredWidth: Constants.fusionStatusFlags.fusionStatusWidth
}

Label {
text: Constants.advancedImu.insStatusLabels[5]
font.pointSize: Constants.fusionStatusFlags.labelFontSize
}

UnknownStatus {
id: zerovelUnknown

Layout.preferredWidth: Constants.advancedImu.insStatusImageWidth
Layout.preferredWidth: Constants.fusionStatusFlags.fusionStatusWidth
}

WarningStatus {
id: zerovelWarning

visible: false
Layout.preferredWidth: Constants.advancedImu.insStatusImageWidth
Layout.preferredWidth: Constants.fusionStatusFlags.fusionStatusWidth
}

OkStatus {
id: zerovelOk

visible: false
Layout.preferredWidth: Constants.advancedImu.insStatusImageWidth
Layout.preferredWidth: Constants.fusionStatusFlags.fusionStatusWidth
}

Item {
Expand All @@ -199,7 +197,7 @@ Item {
if (!fusionStatusFlagsData.gnsspos)
return ;

insStatusRow.visible = true;
fusionStatusFlagsArea.visible = true;
var gnsspos = fusionStatusFlagsData.gnsspos;
if (gnsspos != last_gnsspos) {
if (gnsspos == "UNKNOWN") {
Expand Down Expand Up @@ -307,6 +305,11 @@ Item {

}

label: Label {
text: Constants.fusionStatusFlags.title
font.pointSize: Constants.fusionStatusFlags.titleFontSize
}

}

}
15 changes: 14 additions & 1 deletion resources/AdvancedTabComponents/OkStatus.qml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import "../Constants"
import QtGraphicalEffects 1.15
import QtQuick 2.5
import QtQuick.Layouts 1.15

Item {
Image {
anchors.centerIn: parent
id: okStatusImage

anchors.verticalCenter: parent.verticalCenter
width: Constants.advancedImu.insStatusImageWidth
height: Constants.advancedImu.insStatusImageWidth
smooth: true
Expand All @@ -20,4 +23,14 @@ Item {

}

Text {
id: label

text: "OK"
anchors.left: okStatusImage.right
anchors.leftMargin: Constants.fusionStatusFlags.labelMargin
anchors.verticalCenter: okStatusImage.verticalCenter
font.pointSize: Constants.mediumPointSize
}

}
15 changes: 14 additions & 1 deletion resources/AdvancedTabComponents/UnknownStatus.qml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import "../Constants"
import QtGraphicalEffects 1.15
import QtQuick 2.5
import QtQuick.Layouts 1.15

Item {
Image {
anchors.centerIn: parent
id: unknownStatusImage

anchors.verticalCenter: parent.verticalCenter
width: Constants.advancedImu.insStatusImageWidth
height: Constants.advancedImu.insStatusImageWidth
smooth: true
Expand All @@ -20,4 +23,14 @@ Item {

}

Text {
id: label

text: "UNKNOWN"
anchors.left: unknownStatusImage.right
anchors.leftMargin: Constants.fusionStatusFlags.labelMargin
anchors.verticalCenter: unknownStatusImage.verticalCenter
font.pointSize: Constants.mediumPointSize
}

}
15 changes: 14 additions & 1 deletion resources/AdvancedTabComponents/WarningStatus.qml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import "../Constants"
import QtGraphicalEffects 1.15
import QtQuick 2.5
import QtQuick.Layouts 1.15

Item {
Image {
anchors.centerIn: parent
id: warningStatusImage

anchors.verticalCenter: parent.verticalCenter
width: Constants.advancedImu.insStatusImageWidth
height: Constants.advancedImu.insStatusImageWidth
smooth: true
Expand All @@ -20,4 +23,14 @@ Item {

}

Text {
id: label

text: "WARNING"
anchors.left: warningStatusImage.right
anchors.leftMargin: Constants.fusionStatusFlags.labelMargin
anchors.verticalCenter: warningStatusImage.verticalCenter
font.pointSize: Constants.mediumPointSize
}

}
10 changes: 10 additions & 0 deletions resources/Constants/Constants.qml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ QtObject {
property QtObject icons
property QtObject trackingSkyPlot
property QtObject networking
property QtObject fusionStatusFlags
readonly property int staticTimerIntervalRate: 5 // 5 Hz
readonly property int staticTableTimerIntervalRate: 10 // 10 Hz
readonly property int staticTimerSlowIntervalRate: 2 // 2 Hz
Expand Down Expand Up @@ -179,6 +180,15 @@ QtObject {
readonly property int messageBroadcasterIntValidatorUInt16Max: 65535
}

fusionStatusFlags: QtObject {
readonly property int spacing: 20
readonly property int fusionStatusWidth: 80
readonly property int labelMargin: 5
readonly property int labelFontSize: 14
readonly property int titleFontSize: 16
readonly property string title: "Fusion Status"
}

genericTable: QtObject {
readonly property int headerZOffset: 100
readonly property int padding: 2
Expand Down
1 change: 1 addition & 0 deletions resources/console_resources.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<file>AdvancedTabComponents/AdvancedMagnetometerTab.qml</file>
<file>AdvancedTabComponents/AdvancedSpectrumAnalyzerTab.qml</file>
<file>AdvancedTabComponents/AdvancedSpectrumAnalyzerTabChannelBar.qml</file>
<file>AdvancedTabComponents/AdvancedInsTab.qml</file>
<file>AdvancedTabComponents/UnknownStatus.qml</file>
<file>AdvancedTabComponents/WarningStatus.qml</file>
<file>AdvancedTabComponents/OkStatus.qml</file>
Expand Down