Skip to content

Commit

Permalink
Update AppDeveloperStatsPanel.qml
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelscholle committed Dec 30, 2024
1 parent f77c880 commit 05fe9aa
Showing 1 changed file with 96 additions and 28 deletions.
124 changes: 96 additions & 28 deletions qml/ui/configpopup/dev/AppDeveloperStatsPanel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,19 @@ Rectangle {
height: parent.height
color: "#eaeaea"

function yes_or_no_as_string(yes) {
if (yes) return "Y";
return "N";
}

function get_features_string() {
var ret = "";
ret += "AVCODEC:" + yes_or_no_as_string(QOPENHD_ENABLE_VIDEO_VIA_AVCODEC) + ", ";
ret += "MMAL:" + yes_or_no_as_string(QOPENHD_HAVE_MMAL) + ", ";
ret += "GSTREAMER_QMLGLSINK:" + yes_or_no_as_string(QOPENHD_ENABLE_GSTREAMER_QMLGLSINK) + ", ";
return ret;
}

// TabBar for consistent style
TabBar {
id: selectItemInStackLayoutBar
Expand All @@ -34,14 +47,25 @@ Rectangle {
id: main_column_layout
width: parent.width

// Example information text
Text {
text: qsTr("QOpenHD version: 1.0.0 for Linux")
font.pixelSize: 14
height: 23
text: qsTr("QOpenHD version: " + _qopenhd.version_string + " for " + Qt.platform.os)
}
Text {
height: 23
text: qsTr("FEATURES: " + get_features_string())
}
Text {
height: 23
text: qsTr("Resolution: " + " Screen " + _qrenderstats.screen_width_height_str + " ADJ:" + _qrenderstats.display_width_height_str + " Window: " + _qrenderstats.window_width + "x" + _qrenderstats.window_height)
}
Text {
height: 23
text: qsTr("Art Horizon mavlink update rate:" + _fcMavlinkSystem.curr_update_rate_mavlink_message_attitude + " Hz")
}
Text {
text: qsTr("Features: AVCODEC (Enabled), MMAL (Enabled), GStreamer QMLGLSink (Disabled)")
font.pixelSize: 14
height: 23
text: qsTr("Tele in " + _mavlinkTelemetry.telemetry_pps_in + " pps")
}

// Buttons for actions
Expand All @@ -55,37 +79,37 @@ Rectangle {
width: 400
text: "Restart local OHD service"
onClicked: {
_qopenhd.restart_local_oenhd_service()
_qopenhd.restart_local_oenhd_service();
}
}
Button {
id: local_ip_button
text: "Show local IP"
onClicked: {
var text = _qopenhd.show_local_ip()
local_ip_button.text = text
var text = _qopenhd.show_local_ip();
local_ip_button.text = text;
}
}
Button {
id: write_local_log
text: "Write GND log to SD"
onClicked: {
var text = _qopenhd.write_local_log()
write_local_log.text = text
var text = _qopenhd.write_local_log();
write_local_log.text = text;
}
}
Button {
id: write_air_log
text: "Write AIR log to SD"
onClicked: {
var text = "Not implemented yet"
write_air_log.text = text
var text = "Not implemented yet";
write_air_log.text = text;
}
}
Button {
text: "Set Tele rates"
onClicked: {
_mavlinkTelemetry.re_apply_rates()
_mavlinkTelemetry.re_apply_rates();
}
}
Button {
Expand Down Expand Up @@ -117,59 +141,103 @@ Rectangle {
}
}
Button {
id:sdbut
text: "Self Distruct"
id: sdbut
text: "Self Destruct"
onClicked: {
sdbut.text="just kidding";
sdbut.text = "just kidding";
}
}
Button {
font.capitalization: Font.MixedCase
text: qsTr("Restart QOpenHD")
onPressed: {
qopenhdservicedialoque.open_dialoque(0)
qopenhdservicedialoque.open_dialoque(0);
}
}
Button {
font.capitalization: Font.MixedCase
text: qsTr("Cancel QOpenHD")
onPressed: {
qopenhdservicedialoque.open_dialoque(1)
qopenhdservicedialoque.open_dialoque(1);
}
}
}

// Terminal-like Scrollable Text Display
Rectangle {
id: terminalContainer
visible: false
width: parent.width
height: 200
color: "black" // Background color
border.color: "gray"
border.width: 1

ScrollView {
id: terminalScrollView
anchors.fill: parent
ScrollBar.vertical.interactive: true
ScrollBar.vertical.policy: ScrollBar.AlwaysOn

TextArea {
id: terminalTextArea
readOnly: true
wrapMode: TextArea.WrapAtWordBoundaryOrAnywhere
text: "Initializing...\n" +
"Feature AVCODEC: Enabled\n" +
"Feature MMAL: Enabled\n" +
"GStreamer QMLGLSink: Disabled\n" +
"Mavlink update rate: 50Hz\n" +
"Local IP: 192.168.1.1\n" +
"Logs updating...\n"
text: ""
font.pixelSize: 14
color: "white" // Text color
background: Rectangle { color: "black" } // Ensures full black background
background: Rectangle { color: "black" }
}
}
}

Row {
spacing: 10

Button {
text: "Show Air Info"
onClicked: {
showSystemInfo(_ohdSystemAir, "Air");
terminalContainer.visible = true;
}
}
Button {
text: "Show Ground Info"
onClicked: {
showSystemInfo(_ohdSystemGround, "Ground");
terminalContainer.visible = true;
}
}
Button {
text: "Show Mavlink Info"
onClicked: {
showSystemInfo(_fcMavlinkSystem, "Mavlink");
terminalContainer.visible = true;
}
}
Button {
text: "\uf2ed"
onClicked: {
terminalTextArea.text = " \n";
}
}
}
}
}

function showSystemInfo(systemObject, title) {
if (systemObject) {
terminalTextArea.text += title + " System Information:\n\n";
for (var key in systemObject) {
if (systemObject.hasOwnProperty(key) && typeof systemObject[key] !== "function") {
terminalTextArea.text += key + ": " + systemObject[key] + "\n";
}
}
} else {
terminalTextArea.text += title + " System Information unavailable.\n";
}
}


QOpenHDServiceDialoque {
id: qopenhdservicedialoque
}
}

0 comments on commit 05fe9aa

Please sign in to comment.