-
-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a1da3cb
commit 765d449
Showing
1 changed file
with
61 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,173 +1,147 @@ | ||
import QtQuick 2.12 | ||
import QtQuick.Controls 2.12 | ||
import QtQuick.Layouts 1.12 | ||
|
||
|
||
import Qt.labs.settings 1.0 | ||
|
||
import OpenHD 1.0 | ||
|
||
import "../../../ui" as Ui | ||
import "../../elements" | ||
|
||
// Dirty here i place stuff that can be usefully during development | ||
// Main container | ||
Rectangle { | ||
id: elementAppDeveloperStats | ||
width: parent.width | ||
height: parent.height | ||
|
||
property int rowHeight: 64 | ||
property int text_minHeight: 20 | ||
|
||
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 { | ||
// This screen doesn't tab, but we use the tab bar element for a consistent style | ||
id: selectItemInStackLayoutBar | ||
width: parent.width | ||
TabButton { | ||
text: qsTr("Developer Menu") | ||
} | ||
} | ||
ScrollView{ | ||
|
||
// Main layout with scrollable content | ||
ScrollView { | ||
anchors.left: parent.left | ||
anchors.right: parent.right | ||
anchors.top: selectItemInStackLayoutBar.bottom | ||
anchors.bottom: parent.bottom | ||
anchors.margins: 5 | ||
contentHeight: main_column_layout.height | ||
contentWidth: main_column_layout.width | ||
//ScrollBar.vertical.policy: ScrollBar.AlwaysOn | ||
ScrollBar.vertical.interactive: true | ||
anchors.margins: 10 | ||
|
||
Column { | ||
id: main_column_layout | ||
width: parent.width | ||
spacing: 6 | ||
Text{ | ||
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) | ||
} | ||
|
||
// Example information text | ||
Text { | ||
height: 23 | ||
text: qsTr("Art Horizon mavlink update rate:" + _fcMavlinkSystem.curr_update_rate_mavlink_message_attitude + " Hz") | ||
text: qsTr("QOpenHD version: 1.0.0 for Linux") | ||
font.pixelSize: 14 | ||
} | ||
Text { | ||
height: 23 | ||
text: qsTr("Tele in" + _mavlinkTelemetry.telemetry_pps_in + " pps") | ||
text: qsTr("Features: AVCODEC (Enabled), MMAL (Enabled), GStreamer QMLGLSink (Disabled)") | ||
font.pixelSize: 14 | ||
} | ||
|
||
// Buttons for actions | ||
GridLayout { | ||
columns: 4 | ||
id: buttonGrid | ||
columns: 3 | ||
rowSpacing: 10 | ||
columnSpacing: 10 | ||
|
||
Button { | ||
width: 400 | ||
text: "Restart local OHD service" | ||
onClicked: { | ||
_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 | ||
console.log("Local IP: 192.168.1.1") | ||
} | ||
} | ||
Button { | ||
id: write_local_log | ||
text: "Write GND log to SD" | ||
onClicked: { | ||
var text = _qopenhd.write_local_log() | ||
write_local_log.text = text | ||
console.log("GND log written") | ||
} | ||
} | ||
Button { | ||
id: write_air_log | ||
text: "Write AIR log to SD" | ||
onClicked: { | ||
var text = "Not implemented yet" | ||
write_air_log.text = text | ||
console.log("AIR log written") | ||
} | ||
} | ||
Button { | ||
text: "Set Tele rates" | ||
onClicked: { | ||
_mavlinkTelemetry.re_apply_rates() | ||
console.log("Telemetry rates updated") | ||
} | ||
} | ||
Button { | ||
visible: _qopenhd.is_linux() | ||
text: "Start openhd" | ||
onClicked: { | ||
_qopenhd.sysctl_openhd(0); | ||
} | ||
} | ||
Button { | ||
visible: _qopenhd.is_linux() | ||
text: "Stop openhd" | ||
onClicked: { | ||
_qopenhd.sysctl_openhd(1); | ||
console.log("OpenHD started") | ||
} | ||
} | ||
Button { | ||
text: "Stop openhd" | ||
visible: _qopenhd.is_linux() | ||
text: "Enable openhd" | ||
onClicked: { | ||
_qopenhd.sysctl_openhd(2); | ||
console.log("OpenHD stopped") | ||
} | ||
} | ||
Button { | ||
text: "Enable openhd" | ||
visible: _qopenhd.is_linux() | ||
text: "Disable openhd" | ||
onClicked: { | ||
_qopenhd.sysctl_openhd(3); | ||
console.log("OpenHD enabled") | ||
} | ||
} | ||
Button { | ||
id:sdbut | ||
text: "Self Distruct" | ||
text: "Disable openhd" | ||
visible: _qopenhd.is_linux() | ||
onClicked: { | ||
sdbut.text="just kidding"; | ||
console.log("OpenHD disabled") | ||
} | ||
} | ||
Button { | ||
font.capitalization: Font.MixedCase | ||
text: qsTr("Restart QOpenHD") | ||
onPressed: { | ||
qopenhdservicedialoque.open_dialoque(0) | ||
} | ||
} | ||
Button { | ||
font.capitalization: Font.MixedCase | ||
text: qsTr("Cancel QOpenHD") | ||
onPressed: { | ||
qopenhdservicedialoque.open_dialoque(1) | ||
} | ||
|
||
// Terminal-like Scrollable Text Display | ||
Rectangle { | ||
id: terminalContainer | ||
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 | ||
|
||
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" | ||
font.pixelSize: 14 | ||
color: "white" // Text color | ||
background: Rectangle { color: "black" } // Ensures full black background | ||
} | ||
} | ||
} | ||
} | ||
} | ||
QOpenHDServiceDialoque{ | ||
id: qopenhdservicedialoque | ||
} | ||
} |