diff --git a/qml/qml.qrc b/qml/qml.qrc index 17d85bfb0..3563af141 100644 --- a/qml/qml.qrc +++ b/qml/qml.qrc @@ -254,7 +254,7 @@ ui/elements/CardToast.qml ui/elements/ButtonYellow.qml ui/configpopup/connect/PaneLocalhost.qml - ui/configpopup/connect/PaneInfo.qml + ui/configpopup/connect/PaneTethering.qml ui/configpopup/connect/GenericInfoPane.qml ui/elements/ButtonSimple.qml diff --git a/qml/ui/configpopup/connect/ConnectPanel.qml b/qml/ui/configpopup/connect/ConnectPanel.qml index c828c2f13..2b85eeb76 100644 --- a/qml/ui/configpopup/connect/ConnectPanel.qml +++ b/qml/ui/configpopup/connect/ConnectPanel.qml @@ -27,26 +27,26 @@ Item { id: selectItemInStackLayoutBar width: parent.width TabButton { - text: qsTr("INFO") + text: qsTr("TCP") } TabButton{ - text: "LOCAL" - } - TabButton { - text: qsTr("USB Tether") - } - TabButton { - text: qsTr("(USB) Ethernet passive") - } - TabButton { - text: qsTr("(USB) Ethernet active") - } - TabButton { - text: qsTr("WiFi") - } - TabButton { - text: qsTr("Custom (TCP)") + text: "Tethering" } + // TabButton { + // text: qsTr("USB Tether") + // } + // TabButton { + // text: qsTr("(USB) Ethernet passive") + // } + // TabButton { + // text: qsTr("(USB) Ethernet active") + // } + // TabButton { + // text: qsTr("WiFi") + // } + // TabButton { + // text: qsTr("Custom (TCP)") + // } } // placed right below the top bar @@ -59,41 +59,41 @@ Item { currentIndex: selectItemInStackLayoutBar.currentIndex - PaneInfo{ + PaneCustom{ } - PaneLocalhost{ - } + PaneTethering{ + } - PaneUSBTether{ - id: pane_usb_tether - } + // PaneUSBTether{ + // id: pane_usb_tether + // } - GenericInfoPane{ - m_info_text: { - return"1) Make sure ETH_HOTSPOT_E is disabled (Ground param)\n\n"+ - "2) Enable ETH_PASSIVE_F on your openhd ground unit (Ground param)\n\n"+ - "3) Connect your external device running QOpenHD to your ground station via ethernet\n(e.g. ethernet port on rpi 4).\n\n"+ - "4) Make sure to select 'share my internet with ...' when the android connection setup pops up\n\n"+ - "Video and telemetry forwarding should start automatically, and your GCS can get internet from your phone." - } - } - GenericInfoPane{ - m_info_text: { - return "1) Make sure ETH_PASSIVE_F is disabled (Ground param)\n\n"+ - "2) Enable ETH_HOTSPOT_E on your openhd ground unit (Ground param)\n\n"+ - "3) Connect your external device running QOpenHD to your ground station via ethernet\n(e.g. ethernet port on rpi 4).\n\n"+ - "You might have to disable wifi and cellular on your phone !.\n\n"+ - "Video and telemetry forwarding should start automatically." - } - } + // GenericInfoPane{ + // m_info_text: { + // return"1) Make sure ETH_HOTSPOT_E is disabled (Ground param)\n\n"+ + // "2) Enable ETH_PASSIVE_F on your openhd ground unit (Ground param)\n\n"+ + // "3) Connect your external device running QOpenHD to your ground station via ethernet\n(e.g. ethernet port on rpi 4).\n\n"+ + // "4) Make sure to select 'share my internet with ...' when the android connection setup pops up\n\n"+ + // "Video and telemetry forwarding should start automatically, and your GCS can get internet from your phone." + // } + // } + // GenericInfoPane{ + // m_info_text: { + // return "1) Make sure ETH_PASSIVE_F is disabled (Ground param)\n\n"+ + // "2) Enable ETH_HOTSPOT_E on your openhd ground unit (Ground param)\n\n"+ + // "3) Connect your external device running QOpenHD to your ground station via ethernet\n(e.g. ethernet port on rpi 4).\n\n"+ + // "You might have to disable wifi and cellular on your phone !.\n\n"+ + // "Video and telemetry forwarding should start automatically." + // } + // } - PaneWIFI{ - id: wifi - } + // PaneWIFI{ + // id: wifi + // } - PaneCustom{ - id: pane_custom - } + // PaneCustom{ + // id: pane_custom + // } } } diff --git a/qml/ui/configpopup/connect/GenericInfoPane.qml b/qml/ui/configpopup/connect/GenericInfoPane.qml index 6157444f8..e96d2055b 100644 --- a/qml/ui/configpopup/connect/GenericInfoPane.qml +++ b/qml/ui/configpopup/connect/GenericInfoPane.qml @@ -20,8 +20,9 @@ Pane { ScrollView { id:mavlinkExtraWBParamPanel - width: parent.width - height: parent.height + width: parent.width-24 + height: parent.height-24 + anchors.centerIn: parent contentHeight: mainItem.height contentWidth: mainItem.width clip: true diff --git a/qml/ui/configpopup/connect/PaneCustom.qml b/qml/ui/configpopup/connect/PaneCustom.qml index 9ff313c1b..855fa3ea2 100644 --- a/qml/ui/configpopup/connect/PaneCustom.qml +++ b/qml/ui/configpopup/connect/PaneCustom.qml @@ -10,63 +10,58 @@ import OpenHD 1.0 import "../../../ui" as Ui import "../../elements" - Rectangle { width: parent.width height: parent.height - //color: "green" - - property string m_info_text: "ADVANCED - Connect to a ground station (running OpenHD core) located anywhere in your network using TCP.\n"+ - "After connecting (mavlink) via TCP, video will also be streamed to this device (using UDP)." - - ColumnLayout{ - anchors.fill: parent - spacing: 6 + Rectangle { + id: innerRect + width: 300 + height: 300 + anchors.centerIn: parent + anchors.horizontalCenterOffset: 70 + ColumnLayout { + spacing: 6 - Text{ - Layout.alignment: Qt.AlignTop - width:parent.width - wrapMode: Text.WordWrap - text: m_info_text - } - RowLayout{ - TextField { - id: textFieldip - validator: RegExpValidator { - regExp: /^((?:[0-1]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.){0,3}(?:[0-1]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])$/ + RowLayout { + TextField { + id: textFieldip + validator: RegExpValidator { + regExp: /^((?:[0-1]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.){0,3}(?:[0-1]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])$/ + } + inputMethodHints: Qt.ImhFormattedNumbersOnly + text: "192.168.178.36" //settings.dev_mavlink_tcp_ip + } + ButtonIconInfoText { + m_info_text: "Connect with a OpenHD Ground Station, via TCP, this will still stream video va UDP for lower latency, after a successful conneciton." } - inputMethodHints: Qt.ImhFormattedNumbersOnly - text: "192.168.178.36" //settings.dev_mavlink_tcp_ip } - ButtonIconInfoText{ - m_info_text: "Enter your grund station IP, then click 'CONNECT TCP'" + + Button { + Layout.alignment: Qt.AlignTop + text: "CONNECT TCP" + onClicked: { + var ip_address = textFieldip.text + if (_qopenhd.is_valid_ip(ip_address)) { + _mavlinkTelemetry.add_tcp_connection_handler(ip_address) + } else { + _qopenhd.show_toast("Please enter a valid ip") + } + } } - } - Button{ - Layout.alignment: Qt.AlignTop - text: "CONNECT TCP" - onClicked: { - var ip_address=textFieldip.text - if(_qopenhd.is_valid_ip(ip_address)){ - _mavlinkTelemetry.add_tcp_connection_handler(ip_address) - }else{ - _qopenhd.show_toast("Please enter a valid ip") + Button { + text: "RE-ENABLE UDP" + onClicked: { + _mavlinkTelemetry.enable_udp() } } - } - Button{ - text: "RE-ENABLE UDP" - onClicked: { - _mavlinkTelemetry.enable_udp() + + // padding to bottom + Item { + Layout.fillHeight: true + Layout.fillWidth: true } } - // padding to bottom - Item{ - Layout.fillHeight: true - Layout.fillWidth: true - } - } } diff --git a/qml/ui/configpopup/connect/PaneInfo.qml b/qml/ui/configpopup/connect/PaneInfo.qml deleted file mode 100644 index af44a16f9..000000000 --- a/qml/ui/configpopup/connect/PaneInfo.qml +++ /dev/null @@ -1,47 +0,0 @@ -import QtQuick 2.12 -import QtQuick.Controls 2.12 -import QtQuick.Layouts 1.12 -import QtQuick.Dialogs 1.0 -import QtQuick.Controls.Material 2.12 - -import Qt.labs.settings 1.0 - -import OpenHD 1.0 - -import "../../../ui" as Ui -import "../../elements" - -Rectangle{ - width: parent.width - height: parent.height - ColumnLayout{ - anchors.fill: parent - spacing: 6 - Text{ - Layout.fillWidth: true - Layout.alignment: Qt.AlignTop - Layout.preferredHeight: 50 - //width:parent.width - wrapMode: Text.WordWrap - verticalAlignment: Text.AlignTop - text: "When running QOpenHD on an external device (e.g. android phone)\n"+ - "you have to use one of the given choices to connect the device to the OpenHD ground station" - } - Text{ - Layout.preferredHeight: 50 - text: "You are already connected to your ground station - nothing to do." - color: "#706F1D" // dark green - visible: m_is_connected_gnd - } - Text{ - Layout.preferredHeight: 50 - text: "Looks like you are not connected to your ground station - please use one of the given choices to connect." - color: "red" - visible: !m_is_connected_gnd - } - Item{ - Layout.fillHeight: true - // filler - } - } -} diff --git a/qml/ui/configpopup/connect/PaneTethering.qml b/qml/ui/configpopup/connect/PaneTethering.qml new file mode 100644 index 000000000..a19cbef3b --- /dev/null +++ b/qml/ui/configpopup/connect/PaneTethering.qml @@ -0,0 +1,102 @@ +import QtQuick 2.12 +import QtQuick.Controls 2.12 +import QtQuick.Layouts 1.12 +import QtQuick.Dialogs 1.0 +import QtQuick.Controls.Material 2.12 + +import Qt.labs.settings 1.0 + +import OpenHD 1.0 + +import "../../../ui" as Ui +import "../../elements" +Rectangle { + width: parent.width + height: parent.height + property bool m_local_mode_enabled: _mavlinkTelemetry.udp_localhost_mode_enabled + + + Rectangle { + id: innerRect + width: 300 + height: 300 + anchors.centerIn: parent + anchors.horizontalCenterOffset: 40 + ColumnLayout { + spacing: 6 + + RowLayout { + Button{ + text: m_local_mode_enabled ? "LOCAL MODE ACTIVE" : "ENABLE LOCAL MODE" + Layout.preferredWidth: 180 + onClicked: { + _mavlinkTelemetry.enable_udp() + } + enabled: !m_local_mode_enabled + } + ButtonIconInfoText { + m_info_text: "Use this if you are running QOpenHD on your ground station itself and don't use it as a secondary device."+ + "\n\nIt uses UDP localhost to communicate with OpenHD core via mavlink (best performance and latency)." + } + } + RowLayout { + Button{ + text: "Android Tethering" + Layout.preferredWidth: 180 + onClicked: _qopenhd.android_open_tethering_settings() + } + ButtonIconInfoText { + m_info_text: "1) Connect your phone via high quality USB cable to your ground station.\n\n"+ + "2) enable USB Tethering on your phone.\n\n"+ + "3) Telemetry and video forwarding is started automatically \n\n"+ + " ! Requires a phone and cellular contract that allows USB tethering. !" + } + } + RowLayout { + Button{ + text: "Passive Eth tethering" + Layout.preferredWidth: 180 + //TODO disable active tethering and enable passive when clicking the button + } + ButtonIconInfoText { + m_info_text: "1) Disable ETH_HOTSPOT_E and Enable ETH_PASSIVE_F\n\n"+ + "2) Connect your external device to your ground station via ethernet.\n\n"+ + "3) Select 'share my internet with ...' when the android connection setup pops up\n\n"+ + "Video and telemetry forwarding should start automatically, internet will be forwarded from your phone." + } + } + RowLayout { + Button{ + text: "Active Eth tethering" + Layout.preferredWidth: 180 + //TODO disable passive tethering and enable active when clicking the button + } + ButtonIconInfoText { + m_info_text: "1) Disable ETH_PASSIVE_F and Enable ETH_HOTSPOT_E\n\n"+ + "2) Connect your external device to your ground station via ethernet.\n\n"+ + "You might need to disable wifi and cellular on your phone\n\n"+ + "Video and telemetry forwarding should start automatically, internet will not be available." + } + } + RowLayout { + Button{ + text: "Wifi tethering" + Layout.preferredWidth: 180 + //TODO enable hotspot + } + ButtonIconInfoText { + m_info_text: "1) Enable WIFI_HOTSPOT_E\n\n"+ + "2) Connect to WiFi: openhd pw openhdopenhd\n\n"+ + "3) Press 'Connect' button.\n\n"+ + "NOTE: You cannot use WIFI hotspot during flight (while armed)" + } + } + + // padding to bottom + Item { + Layout.fillHeight: true + Layout.fillWidth: true + } + } + } +}