Skip to content

Commit

Permalink
layout changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphael committed Oct 2, 2023
1 parent 9a47290 commit a1c7f6c
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 31 deletions.
1 change: 1 addition & 0 deletions lib/mavsdk_prebuilts
Submodule mavsdk_prebuilts added at c8a01a
4 changes: 2 additions & 2 deletions qml/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ ApplicationWindow {
contentOrientation: settings.general_screen_rotation===0 ? Qt.PortraitOrientation : Qt.LandscapeOrientation
contentItem.rotation: settings.general_screen_rotation

minimumWidth: 480
minimumHeight: 320
minimumWidth: 850
minimumHeight: 480
title: qsTr("QOpenHD EVO")
// Transparent background is needed when the video is not rendered via (OpenGL) inside QT,
// but rather done independently by using a pipeline that directly goes to the HW composer (e.g. mmal on pi).
Expand Down
1 change: 1 addition & 0 deletions qml/qml.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -256,5 +256,6 @@
<file>ui/configpopup/connect/PaneLocalhost.qml</file>
<file>ui/configpopup/connect/PaneInfo.qml</file>
<file>ui/configpopup/connect/GenericInfoPane.qml</file>
<file>ui/elements/ButtonSimple.qml</file>
</qresource>
</RCC>
64 changes: 40 additions & 24 deletions qml/ui/configpopup/status/StatusCardBodyOpenHD.qml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ColumnLayout {
property string m_version: m_model.openhd_version
property string m_last_ping: m_model.last_ping_result_openhd
property bool m_is_alive: m_model.is_alive
property string m_qopenhd_version: "2.5.1-alpha"
property string m_qopenhd_version: "2.5.1-evo-alpha"

function get_alive_text(){
return m_is_alive ? "Yes" : "NOT ALIVE !"
Expand All @@ -33,26 +33,38 @@ ColumnLayout {
return m_is_alive ? "green" : "black"
}

function get_cards_text(){
if(!m_is_ground){
return _wifi_card_air.card_type_as_string;
}
// Ground
var ret="";
if(_wifi_card_gnd0.alive){
ret+="[1]"+_wifi_card_gnd0.card_type_as_string;
}
if(_wifi_card_gnd1.alive){
ret+="\n"+"[2]"+_wifi_card_gnd1.card_type_as_string;
}
if(_wifi_card_gnd2.alive){
ret+="\n"+"[3]"+_wifi_card_gnd2.card_type_as_string;
}
if(_wifi_card_gnd3.alive){
ret+="\n"+"[4]"+_wifi_card_gnd3.card_type_as_string;
}
if(ret.length==0)return "N/A";
return ret;
function get_cards_text() {
if (!m_is_ground) {
var airCardType = _wifi_card_air.card_type_as_string;
airCardType = airCardType.substring(3);
return airCardType;
}


// Ground
var ret = "";

if (_wifi_card_gnd0.alive) {
ret += _wifi_card_gnd0.card_type_as_string;
}
if (_wifi_card_gnd1.alive) {
ret += "\n" + _wifi_card_gnd1.card_type_as_string;
}
if (_wifi_card_gnd2.alive) {
ret += "\n" + _wifi_card_gnd2.card_type_as_string;
}
if (_wifi_card_gnd3.alive) {
ret += "\n" + _wifi_card_gnd3.card_type_as_string;
}

if (ret.length == 0) return "N/A";

// Remove the first 3 characters if ret is not "N/A"
if (ret !== "N/A") {
ret = ret.substring(3);
}

return ret;
}

function gnd_uplink_state(){
Expand Down Expand Up @@ -96,9 +108,10 @@ ColumnLayout {
}
Text {
text: m_version
color: "green"
visible: !b_version_warning.visible
}
ButtonYellow{
ButtonSimple{
text: m_version
id: b_version_warning
onClicked: {
Expand Down Expand Up @@ -137,6 +150,7 @@ ColumnLayout {
}
Text {
text: m_last_ping
color: m_last_ping === "N/A" ? "#DC143C" : "green"
}
}
RowLayout{
Expand Down Expand Up @@ -166,9 +180,10 @@ ColumnLayout {
}
Text {
text: get_cards_text()
color: get_cards_text().endsWith("OHD") ? "green" : "DC143C"
visible: !b_unsupported_cards_warning.visible
}
ButtonYellow{
ButtonSimple{
id: b_unsupported_cards_warning
text: get_cards_text()
onClicked: {
Expand Down Expand Up @@ -206,13 +221,14 @@ ColumnLayout {
}
Text{
text: gnd_uplink_state_text()
color: "green"
visible: {
var gnd_up_state=gnd_uplink_state()
if(gnd_up_state===0 || gnd_up_state===1)return true;
return false;
}
}
ButtonYellow{
ButtonSimple{
text: gnd_uplink_state_text()
onClicked: {
var message="Looks like your uplink (GND to AIR) is not functional - please use a supported card on your GND station"+
Expand Down
1 change: 0 additions & 1 deletion qml/ui/configpopup/status/StatusCardsColumn.qml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ Item {

RowLayout {
width: parent.width - 24
height: parent.height
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter

Card {
Expand Down
21 changes: 21 additions & 0 deletions qml/ui/elements/ButtonSimple.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Dialogs 1.0
import QtQuick.Controls.Material 2.12

Button {
id: control
background: Rectangle {
opacity:0
}
contentItem: Text {
text: control.text
font: control.font
opacity: enabled ? 1.0 : 0.3
color: control.down ? "#8B0000" : "#DC143C"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
}

}
12 changes: 9 additions & 3 deletions qml/ui/elements/ButtonYellow.qml
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Dialogs 1.0
import QtQuick.Controls.Styles 1.4
import QtQuick.Controls.Material 2.12
import QtQuick.Layouts 1.0
import QtGraphicalEffects 1.12
import Qt.labs.settings 1.0

// Yellow (Lime) background
import OpenHD 1.0

// Lime button
Button {
Material.background:Material.Lime
Material.accent: Material.Lime
highlighted: true
}
2 changes: 1 addition & 1 deletion qml/ui/elements/Card.qml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Item {
property bool hasHeaderImage: false

property int cardRadius: 6
property color cardNameColor: "#33aaff"
property color cardNameColor: "black"
property color borderColor: "#3a000000"

property bool m_style_error: false
Expand Down

0 comments on commit a1c7f6c

Please sign in to comment.