From a1c7f6c05c484542f4b109545c338c2e587a0292 Mon Sep 17 00:00:00 2001 From: Raphael Date: Mon, 2 Oct 2023 03:10:45 +0200 Subject: [PATCH] layout changes --- lib/mavsdk_prebuilts | 1 + qml/main.qml | 4 +- qml/qml.qrc | 1 + .../status/StatusCardBodyOpenHD.qml | 64 ++++++++++++------- .../configpopup/status/StatusCardsColumn.qml | 1 - qml/ui/elements/ButtonSimple.qml | 21 ++++++ qml/ui/elements/ButtonYellow.qml | 12 +++- qml/ui/elements/Card.qml | 2 +- 8 files changed, 75 insertions(+), 31 deletions(-) create mode 160000 lib/mavsdk_prebuilts create mode 100644 qml/ui/elements/ButtonSimple.qml diff --git a/lib/mavsdk_prebuilts b/lib/mavsdk_prebuilts new file mode 160000 index 000000000..c8a01a1d7 --- /dev/null +++ b/lib/mavsdk_prebuilts @@ -0,0 +1 @@ +Subproject commit c8a01a1d789099cbf66f542f5e7fb9438332064b diff --git a/qml/main.qml b/qml/main.qml index bd4f05901..e22f57635 100755 --- a/qml/main.qml +++ b/qml/main.qml @@ -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). diff --git a/qml/qml.qrc b/qml/qml.qrc index 66e93bbe6..17d85bfb0 100644 --- a/qml/qml.qrc +++ b/qml/qml.qrc @@ -256,5 +256,6 @@ ui/configpopup/connect/PaneLocalhost.qml ui/configpopup/connect/PaneInfo.qml ui/configpopup/connect/GenericInfoPane.qml + ui/elements/ButtonSimple.qml diff --git a/qml/ui/configpopup/status/StatusCardBodyOpenHD.qml b/qml/ui/configpopup/status/StatusCardBodyOpenHD.qml index 4cd868b01..f23211a50 100644 --- a/qml/ui/configpopup/status/StatusCardBodyOpenHD.qml +++ b/qml/ui/configpopup/status/StatusCardBodyOpenHD.qml @@ -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 !" @@ -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(){ @@ -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: { @@ -137,6 +150,7 @@ ColumnLayout { } Text { text: m_last_ping + color: m_last_ping === "N/A" ? "#DC143C" : "green" } } RowLayout{ @@ -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: { @@ -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"+ diff --git a/qml/ui/configpopup/status/StatusCardsColumn.qml b/qml/ui/configpopup/status/StatusCardsColumn.qml index e3a35e144..8d75b1cef 100644 --- a/qml/ui/configpopup/status/StatusCardsColumn.qml +++ b/qml/ui/configpopup/status/StatusCardsColumn.qml @@ -24,7 +24,6 @@ Item { RowLayout { width: parent.width - 24 - height: parent.height Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter Card { diff --git a/qml/ui/elements/ButtonSimple.qml b/qml/ui/elements/ButtonSimple.qml new file mode 100644 index 000000000..9ecda885d --- /dev/null +++ b/qml/ui/elements/ButtonSimple.qml @@ -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 + } + +} diff --git a/qml/ui/elements/ButtonYellow.qml b/qml/ui/elements/ButtonYellow.qml index 8564799dd..561ad3ebe 100644 --- a/qml/ui/elements/ButtonYellow.qml +++ b/qml/ui/elements/ButtonYellow.qml @@ -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 } diff --git a/qml/ui/elements/Card.qml b/qml/ui/elements/Card.qml index 7fffa4477..0905f90b3 100644 --- a/qml/ui/elements/Card.qml +++ b/qml/ui/elements/Card.qml @@ -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