From fe59583defcd2d683ae4bb130141f720e1582dae Mon Sep 17 00:00:00 2001 From: Gus Grubba <gus@auterion.com> Date: Tue, 27 Aug 2019 20:16:55 -0400 Subject: [PATCH] UI/UX Rework --- .../CustomMainToolBarIndicators.qml | 24 ++ qgcimages.qrc | 12 +- src/PairingManager/Images/PairingButton.svg | 23 ++ .../Images/PairingConnected.svg | 44 +++ src/PairingManager/Images/PairingError.svg | 11 + src/PairingManager/Images/PairingIcon.svg | 40 +- src/PairingManager/PairingManager.cc | 13 +- src/PairingManager/PairingManager.h | 60 +-- src/ui/preferences/GeneralSettings.qml | 4 +- src/ui/toolbar/PairingIndicator.qml | 364 ++++++++++-------- 10 files changed, 396 insertions(+), 199 deletions(-) create mode 100644 src/PairingManager/Images/PairingButton.svg create mode 100644 src/PairingManager/Images/PairingConnected.svg create mode 100644 src/PairingManager/Images/PairingError.svg diff --git a/custom-example/res/MainToolbar/CustomMainToolBarIndicators.qml b/custom-example/res/MainToolbar/CustomMainToolBarIndicators.qml index 8b956355d1..858bb85bb8 100644 --- a/custom-example/res/MainToolbar/CustomMainToolBarIndicators.qml +++ b/custom-example/res/MainToolbar/CustomMainToolBarIndicators.qml @@ -23,6 +23,29 @@ import QGroundControl.Palette 1.0 Item { anchors.fill: parent readonly property real _indicatorMargins: ScreenTools.defaultFontPixelHeight * 0.75 + Component.onCompleted: { + if(QGroundControl.pairingManager) { + if(!activeVehicle) { + pairingTimer.start() + } + } + } + //------------------------------------------------------------------------- + //-- Launch pairing manager if nothing connected + Timer { + id: pairingTimer + interval: 5000 + running: false; + repeat: false; + onTriggered: { + if(!activeVehicle) { + if(QGroundControl.pairingManager.firstBoot && pairingLoader.item) { + QGroundControl.pairingManager.firstBoot = false + pairingLoader.item.runPairing() + } + } + } + } //------------------------------------------------------------------------- //-- Waiting for a vehicle Row { @@ -60,6 +83,7 @@ Item { spacing: ScreenTools.defaultFontPixelWidth * 2 visible: !indicatorRow.visible Loader { + id: pairingLoader anchors.top: parent.top anchors.bottom: parent.bottom anchors.margins: _indicatorMargins diff --git a/qgcimages.qrc b/qgcimages.qrc index 031ea95f2c..8d12d67fad 100644 --- a/qgcimages.qrc +++ b/qgcimages.qrc @@ -66,11 +66,11 @@ <file alias="CameraTrigger.svg">src/AutoPilotPlugins/PX4/Images/CameraTrigger.svg</file> <file alias="check.svg">resources/check.svg</file> <file alias="checkbox-check.svg">src/QmlControls/checkbox-check.svg</file> + <file alias="cOGPointer.svg">src/FlightMap/Images/cOGPointer.svg</file> <file alias="CogWheel.svg">src/MissionManager/CogWheel.svg</file> + <file alias="compassDottedLine.svg">src/FlightMap/Images/compassDottedLine.svg</file> <file alias="compassInstrumentArrow.svg">src/FlightMap/Images/compassInstrumentArrow.svg</file> <file alias="compassInstrumentDial.svg">src/FlightMap/Images/compassInstrumentDial.svg</file> - <file alias="compassDottedLine.svg">src/FlightMap/Images/compassDottedLine.svg</file> - <file alias="cOGPointer.svg">src/FlightMap/Images/cOGPointer.svg</file> <file alias="Connect.svg">src/ui/toolbar/Images/Connect.svg</file> <file alias="crossHair.svg">src/FlightMap/Images/crossHair.svg</file> <file alias="DatalinkLoss.svg">src/AutoPilotPlugins/PX4/Images/DatalinkLoss.svg</file> @@ -121,6 +121,10 @@ <file alias="no-logging-light.svg">src/AutoPilotPlugins/PX4/Images/no-logging-light.svg</file> <file alias="no-logging.svg">src/AutoPilotPlugins/PX4/Images/no-logging.svg</file> <file alias="ObjectAvoidance.svg">src/AutoPilotPlugins/PX4/Images/ObjectAvoidance.svg</file> + <file alias="PairingButton.svg">src/PairingManager/Images/PairingButton.svg</file> + <file alias="PairingConnected.svg">src/PairingManager/Images/PairingConnected.svg</file> + <file alias="PairingError.svg">src/PairingManager/Images/PairingError.svg</file> + <file alias="PairingIcon.svg">src/PairingManager/Images/PairingIcon.svg</file> <file alias="PaperPlane.svg">src/ui/toolbar/Images/PaperPlane.svg</file> <file alias="PiP.svg">src/FlightMap/Images/PiP.svg</file> <file alias="pipHide.svg">src/FlightMap/Images/pipHide.svg</file> @@ -181,9 +185,5 @@ <file alias="Yield.svg">src/ui/toolbar/Images/Yield.svg</file> <file alias="ZoomMinus.svg">src/FlightMap/Images/ZoomMinus.svg</file> <file alias="ZoomPlus.svg">src/FlightMap/Images/ZoomPlus.svg</file> - - <file alias="PairingIcon.svg">src/PairingManager/Images/PairingIcon.svg</file> - <file alias="PairingIconLight.svg">src/PairingManager/Images/PairingIconLight.svg</file> - </qresource> </RCC> diff --git a/src/PairingManager/Images/PairingButton.svg b/src/PairingManager/Images/PairingButton.svg new file mode 100644 index 0000000000..1166e20885 --- /dev/null +++ b/src/PairingManager/Images/PairingButton.svg @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generator: Adobe Illustrator 23.0.6, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> +<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" + viewBox="0 0 288 288" style="enable-background:new 0 0 288 288;" xml:space="preserve"> +<style type="text/css"> + .st0{fill:#FFFFFF;} +</style> +<path class="st0" d="M106.783,143.429c-1.327-5.063-2.711-10.125-4.095-15.256c-29.464-2.025-52.834-26.495-52.834-56.465 + c0-31.299,25.438-56.736,56.736-56.736s56.647,25.438,56.647,56.736c0,17.247-7.752,32.684-19.902,43.067 + c0.675,1.744,1.373,3.499,2.048,5.209c1.496,3.792,2.576,6.345,3.814,9.394c17.641-13.062,29.116-34.032,29.116-57.669 + c-0.011-39.614-32.108-71.71-71.722-71.71s-71.71,32.099-71.71,71.71c0,39.614,32.108,71.71,71.71,71.71 + c0.068,0.011,0.124,0.011,0.191,0.011L106.783,143.429z"/> +<path class="st0" d="M231.879,162.801c-13.321-4.534-33.3-7.223-50.043-8.562c-16.932-1.35-30.42-1.485-30.42-1.485h-1.395 + l-0.461-1.215c0,0-5.659-13.467-11.633-28.644c-5.974-15.177-12.274-31.86-13.669-39.536c-1.294-7.054-2.588-12.736-4.748-16.28 + c-2.16-3.533-4.759-5.265-10.508-4.927c-2.599,0.157-4.039,1.181-5.209,2.88c-1.17,1.699-1.924,4.264-2.228,7.256 + c-0.607,5.985,0.45,13.478,1.204,18.699c3.454,23.874,11.937,46.632,16.561,70.687c2.756,14.322,3.893,28.925,6.514,42.888 + l0.743,4.185l-3.724-1.958c-1.766-0.923-3.015-2.531-4.275-4.467c-1.271-1.935-2.464-4.286-3.724-6.694 + c-2.509-4.815-5.186-10.036-7.628-12.927c-3.78-4.478-8.449-9.473-13.388-12.466c-4.883-2.959-9.676-3.915-14.885-1.305 + c-2.306,2.093-3.139,3.983-3.162,6.143c-0.022,2.25,0.889,4.86,2.329,7.628c2.869,5.535,7.752,11.397,9.203,17.483 + c3.611,15.154,12.781,26.978,20.926,39.904c6.368,10.105,11.093,21.23,20.926,26.227c12.972,6.592,24.256,17.01,37.116,19.16 + c15.616,2.61,33.076,3.397,48.084,1.394c14.873-1.981,27.103-6.851,32.828-14.604c12.297-49.862,4.534-82.32-15.335-109.468V162.801 + z"/> +</svg> diff --git a/src/PairingManager/Images/PairingConnected.svg b/src/PairingManager/Images/PairingConnected.svg new file mode 100644 index 0000000000..02ac3be801 --- /dev/null +++ b/src/PairingManager/Images/PairingConnected.svg @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generator: Adobe Illustrator 23.0.6, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> +<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" + viewBox="0 0 360 72" style="enable-background:new 0 0 360 72;" xml:space="preserve"> +<style type="text/css"> + .st0{fill:#FFFFFF;} + .st1{fill-rule:evenodd;clip-rule:evenodd;fill:#FFFFFF;} + + .st2{fill:none;stroke:#FFFFFF;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4.2573;stroke-dasharray:2,6,2,6;} + .st3{fill:#0CA678;} +</style> +<path class="st0" d="M349.779,17.419h-30.656c-5.646,0-10.221,4.605-10.221,10.288v20.571c0,2.827,2.299,5.141,5.107,5.141h5.107 + l2.825-5.684c1.258-2.531,4.587-4.599,7.395-4.599h10.226c2.808,0,6.137,2.067,7.395,4.599l2.825,5.684h5.107 + c2.808,0,5.107-2.314,5.107-5.141V27.708C360,22.03,355.426,17.419,349.779,17.419L349.779,17.419z M321.681,35.422 + c-2.821,0-5.107-2.302-5.107-5.147c0-2.839,2.287-5.141,5.107-5.141c2.82,0,5.107,2.302,5.107,5.141 + C326.788,33.12,324.506,35.422,321.681,35.422z M347.229,35.422c-2.821,0-5.107-2.302-5.107-5.147c0-2.839,2.287-5.141,5.107-5.141 + c2.82,0,5.107,2.302,5.107,5.141C352.337,33.12,350.049,35.422,347.229,35.422z"/> +<path class="st1" d="M39.568,25.298l5.557-4.015c-1.334-2.006-2-4.237-2-6.913c0-6.691,5.336-12.042,12.003-12.042 + c6.891,0,12.227,5.353,12.227,12.042c0,6.913-5.336,12.266-12.227,12.266c-2.223,0-4.447-0.668-6.225-1.784l-4.223,5.799v11.596 + l3.778,5.129c1.779-1.338,4.223-2.006,6.67-2.006c6.67,0,12.003,5.575,12.003,12.266s-5.336,12.042-12.003,12.042 + c-6.67,0-12.226-5.353-12.226-12.042c0-2.452,0.889-4.683,2-6.691l-5.781-4.015H27.784l-5.112,3.791 + c1.334,2.006,2.223,4.237,2.223,6.913c0,6.691-5.557,12.042-12.227,12.042c-6.67,0-12.003-5.353-12.003-12.042 + c0-6.691,5.336-12.266,12.003-12.266c2.444,0,4.668,0.668,6.446,2.006l4.002-5.575v-11.82l-4.223-5.353 + c-2,1.114-4.223,2.006-6.891,2.006C5.333,26.631,0,21.277,0,14.364C0,7.673,5.336,2.323,12.003,2.323 + c6.891,0,12.227,5.353,12.227,12.042c0,2.452-0.666,4.907-2,6.691l6.002,4.237h11.337L39.568,25.298z M49.793,49.16l3.778,5.353 + l2.889,2.898c0.221,0.668-1.11,2.006-1.555,1.784l-3.113-3.344l-5.112-3.569c-0.889,1.56-1.555,3.344-1.555,5.353 + c0,5.353,4.447,9.812,10.004,9.812c5.336,0,9.78-4.461,9.78-9.812c0-5.575-4.447-10.036-9.78-10.036 + C53.129,47.599,51.351,48.267,49.793,49.16L49.793,49.16z M46.904,19.944l4.891-3.569l2.889-2.898c0.666-0.668,2,1.114,1.779,1.56 + l-2.889,3.123l-3.334,4.907c1.334,0.892,3.113,1.338,4.891,1.338c5.557,0,10.004-4.461,10.004-10.036 + c0-5.353-4.447-9.812-10.004-9.812c-5.336,0-9.78,4.461-9.78,9.812c0,2.006,0.666,4.015,1.555,5.575L46.904,19.944z M17.562,22.843 + l-3.778-5.129l-2.889-2.677c-0.221-0.446,1.11-1.784,1.779-1.56l2.889,2.898l4.891,3.569c0.889-1.56,1.555-3.569,1.555-5.575 + c0-5.353-4.447-9.812-10.004-9.812c-5.336,0-9.78,4.461-9.78,9.812c0,5.575,4.447,10.036,9.78,10.036 + c2.223,0,4.002-0.668,5.557-1.56L17.562,22.843z M20.896,52.058l-5.336,3.79l-2.889,3.345c-0.666,0.222-2-1.114-1.779-1.784 + l2.889-2.898l4.002-5.353c-1.555-0.892-3.113-1.56-5.112-1.56c-5.336,0-9.78,4.461-9.78,10.036c0,5.575,4.447,9.812,9.78,9.812 + c5.557,0,10.004-4.237,10.004-9.812C22.675,55.627,22.009,53.618,20.896,52.058L20.896,52.058z"/> +<line class="st2" x1="81.29" y1="34.839" x2="297.29" y2="34.839"/> +<rect x="184.065" y="26.323" class="st0" width="19.355" height="18.387"/> +<path class="st3" d="M206.948,24.149l-13.7-7.298c-0.426-0.238-0.948-0.238-1.375,0l-13.271,7.298 + c-0.474,0.238-0.758,0.711-0.758,1.232v10.334c0,8.105,4.833,15.5,12.277,18.769l1.849,0.806c0.188,0.094,0.379,0.094,0.568,0.094 + c0.188,0,0.379-0.047,0.568-0.094l2.085-0.9c7.587-3.223,12.516-10.617,12.516-18.864V25.383 + C207.706,24.861,207.422,24.387,206.948,24.149L206.948,24.149z M199.931,34.198l-8.389,6.826c-0.285,0.238-0.568,0.332-0.9,0.332 + c-0.379,0-0.806-0.189-1.09-0.521l-3.601-4.219c-0.521-0.617-0.427-1.517,0.141-1.991c0.618-0.521,1.518-0.426,1.992,0.142 + l2.701,3.175l7.3-5.971c0.617-0.474,1.517-0.426,1.99,0.189C200.642,32.825,200.548,33.725,199.931,34.198L199.931,34.198z"/> +</svg> diff --git a/src/PairingManager/Images/PairingError.svg b/src/PairingManager/Images/PairingError.svg new file mode 100644 index 0000000000..db18451421 --- /dev/null +++ b/src/PairingManager/Images/PairingError.svg @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generator: Adobe Illustrator 23.0.6, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> +<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" + viewBox="0 0 288 288" style="enable-background:new 0 0 288 288;" xml:space="preserve"> +<style type="text/css"> + .st0{fill:#C92A30;} +</style> +<path class="st0" d="M279.208,90.739c-35.477-36.963-83.184-57.313-134.318-57.313c-51.541,0-101.247,21.676-136.384,59.487 + l-8.503,9.142l142.983,152.52l145.017-154.67L279.208,90.739z M158.864,196.782h-29.737v-29.737h29.737V196.782z M158.864,150.006 + h-29.737v-83.38h29.737V150.006z"/> +</svg> diff --git a/src/PairingManager/Images/PairingIcon.svg b/src/PairingManager/Images/PairingIcon.svg index 23579e8cc8..aff3e41e0c 100644 --- a/src/PairingManager/Images/PairingIcon.svg +++ b/src/PairingManager/Images/PairingIcon.svg @@ -3,21 +3,29 @@ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 288 288" style="enable-background:new 0 0 288 288;" xml:space="preserve"> <style type="text/css"> - .st0{fill:#07916D;} - .st1{fill:#FFFFFF;} + .st0{fill:#FFFFFF;} + .st1{fill-rule:evenodd;clip-rule:evenodd;fill:#FFFFFF;} </style> -<rect x="45" y="94.5" class="st0" width="128.1" height="136.1"/> -<path class="st1" d="M251.5,247H4.5c-1.3,0-2.3,0.5-3.2,1.3C0.5,249.3,0,250.7,0,252c1.3,20.2,18.4,36,38.7,36h178.7 - c20.2,0,37.3-15.8,38.7-36c0-1.3-0.5-2.7-1.3-3.6C253.8,247.5,252.9,247,251.5,247L251.5,247z M137.7,272.3h-19.8 - c-2.7,0-4.5-2.3-4.5-4.5c0-2.2,1.8-4.5,4.5-4.5h19.8c2.3,0,4.5,2.3,4.5,4.5C142.2,270,140.4,272.3,137.7,272.3z"/> -<path class="st1" d="M274.5,0h-74.7c-7.6,0-13.5,6.3-13.5,13.5v106.2l101.7,0V13.5C288,6.3,281.7,0,274.5,0L274.5,0z"/> -<path class="st1" d="M186.3,147.2c0,7.6,5.8,13.5,13.5,13.5l74.7,0c7.6,0,13.5-6.3,13.5-13.5v-18.4H186.3V147.2z M230.4,140h13.5 - c2.7,0,4.5,1.8,4.5,4.5c0,2.7-1.8,4.5-4.5,4.5h-13.5c-2.7,0-4.5-1.8-4.5-4.5C225.9,141.7,227.7,140,230.4,140z"/> -<path class="st1" d="M18.9,238.1h218.2c2.7,0,4.5-2.3,4.5-4.5v-63.9h-41.8c-12.6,0-22.5-10.3-22.5-22.5V77.4l-149.9,0 - c-7.2,0-13.1,5.8-13.1,13.1v143.1C14.4,236.3,16.2,238.1,18.9,238.1L18.9,238.1z M102.6,135.4l27-12.1l-8.6-3.2 - c-2.3-0.9-3.6-3.6-2.7-5.8c0.9-2.3,3.6-3.6,5.8-2.7l18.4,6.8c0.9,0.5,2.3,1.3,2.7,2.3c0.5,0.9,0.5,2.3,0,3.6l-6.8,18.4 - c-0.9,2.3-3.6,3.6-5.8,2.7c-2.2-0.9-3.6-3.6-2.7-5.8l3.2-8.6l-27,12.1c-2.3,0.9-5,0-5.8-2.3C99,139,100.4,136.4,102.6,135.4 - L102.6,135.4z M81,190.8l6.8-18.4c0.9-2.3,3.6-3.6,5.8-2.7c2.3,0.9,3.6,3.6,2.7,5.8l-3.2,8.6l27-12.1c2.3-0.9,5,0,5.8,2.3 - c0.9,2.3,0,5-2.2,5.8l-27,12.1l8.6,3.2c2.3,0.9,3.6,3.6,2.7,5.8c-0.9,2.3-3.6,3.6-5.8,2.7l-18.4-6.8c-0.9-0.5-2.3-1.3-2.7-2.3 - C81.4,193.9,80.6,193.1,81,190.8L81,190.8z"/> +<path class="st0" d="M95.992,203.994h-71.99c-13.259,0-24.001,10.743-24.001,24.001v47.988c0,6.594,5.399,11.993,11.993,11.993 + h11.993l6.636-13.258c2.953-5.906,10.771-10.729,17.365-10.729h24.016c6.594,0,14.411,4.823,17.364,10.729l6.636,13.258H108 + c6.594,0,11.993-5.399,11.993-11.993v-47.988C119.993,214.751,109.25,203.994,95.992,203.994L95.992,203.994z M30.006,245.993 + c-6.623,0-11.993-5.37-11.993-12.007c0-6.623,5.37-11.993,11.993-11.993c6.622,0,11.994,5.37,11.994,11.993 + C41.999,240.623,36.642,245.993,30.006,245.993z M90.002,245.993c-6.623,0-11.993-5.37-11.993-12.007 + c0-6.623,5.37-11.993,11.993-11.993c6.622,0,11.993,5.37,11.993,11.993C101.996,240.623,96.624,245.993,90.002,245.993z"/> +<path class="st1" d="M287.974,0.034v24.001l-0.002-0.014h-29.991v24.001h5.99c13.274,0,24.001,10.743,24.001,24.001L288,96.025 + c0,13.259-10.742,24.001-24.001,24.001h-19.586c12.443,25.38,19.586,53.81,19.586,83.983c0,19.868-16.128,35.995-35.995,35.995 + h-35.995v-23.987h35.995c6.622,0,12.008-5.385,12.008-12.008c-0.029-30.426-8.296-58.884-22.526-83.49 + c-5.722,1.013-11.853,3.712-15.114,6.96c-4.093,4.106-7.452,7.467-7.452,7.467c-5.849,5.864-12.767,10.658-20.36,14.214 + c3.403,5.499,5.456,11.924,5.456,18.87c0,19.881-16.128,35.995-35.995,35.995c-19.896,0-36.009-16.114-36.009-35.995 + c0-6.946,2.053-13.372,5.456-18.87c-7.594-3.571-14.511-8.352-20.374-14.229c0,0-3.361-3.346-7.452-7.452 + c-3.234-3.234-9.323-5.933-15.003-6.96c-10.376,18.037-17.59,38.09-20.697,59.503H25.644c2.672-21.316,9.013-41.451,18.081-59.996 + H24.014c-13.274,0-24.001-10.742-24.001-24.001V72.024C0.012,58.779,10.74,48.037,24,48.037h6.004V24.036H0.012V0.034L83.996,0.02 + v24.001H54.005v24.001l0.182,0.014h11.994c6.594,0,15.34-3.346,19.446-7.452l7.452-7.452c13.037-13.034,31.032-21.091,50.915-21.091 + s37.88,8.057,50.9,21.077c0,0,3.346,3.36,7.452,7.465c4.091,4.106,12.866,7.452,19.446,7.452h12.19V24.036h-29.991V0.034H287.974z + M132.001,168.015c0,6.623,5.357,11.993,11.993,11.993c6.622,0,12.008-5.37,11.993-11.993c0-6.636-5.372-12.008-11.993-12.008 + S132.001,161.379,132.001,168.015z M195.332,70.369l-26.937-19.418c-2.131-1.46-4.936,0.338-4.49,2.806l2.245,13.022h-28.953 + c-1.569,0-2.92,1.346-2.92,2.919v5.836c0,1.569,1.346,2.92,2.92,2.92h28.844l-2.245,13.021c-0.448,2.583,2.468,4.376,4.49,2.806 + l27.05-19.418c1.68-1.013,1.68-3.372-0.004-4.493V70.369z M149.315,90.91h-28.953l2.245-13.022c0.446-2.582-2.468-4.376-4.49-2.806 + L91.18,94.391c-1.571,1.122-1.571,3.59,0,4.713l27.05,19.418c2.131,1.46,4.937-0.338,4.49-2.806l-2.245-13.022h28.844 + c1.569,0,2.92-1.346,2.92-2.919v-5.836c-0.119-1.683-1.351-3.03-2.925-3.03V90.91z"/> </svg> diff --git a/src/PairingManager/PairingManager.cc b/src/PairingManager/PairingManager.cc index 84f8208d8c..96c02a5961 100644 --- a/src/PairingManager/PairingManager.cc +++ b/src/PairingManager/PairingManager.cc @@ -70,7 +70,9 @@ PairingManager::_pairingCompleted(QString name) { _writeJson(_jsonDoc, _pairingCacheFile(name)); _remotePairingMap["NM"] = name; + _lastPaired = name; emit pairedListChanged(); + emit pairedVehicleChanged(); _app->informationMessageBoxOnMainThread("", tr("Paired with %1").arg(name)); setPairingStatus(PairingSuccess, tr("Pairing Successfull")); } @@ -154,7 +156,7 @@ PairingManager::_uploadFinished(void) } else { if(++_pairRetryCount > 3) { qCDebug(PairingManagerLog) << "Giving up"; - setPairingStatus(PairingError, tr("Too Many Errors")); + setPairingStatus(PairingError, tr("No Response From Vehicle")); _uploadManager->deleteLater(); _uploadManager = nullptr; } else { @@ -190,6 +192,15 @@ PairingManager::connectToPairedDevice(QString name) jsonReceived(json); } +//----------------------------------------------------------------------------- +void +PairingManager::removePairedDevice(QString name) +{ + QFile file(_pairingCacheFile(name)); + file.remove(); + emit pairedListChanged(); +} + //----------------------------------------------------------------------------- QStringList PairingManager::pairedDeviceNameList(void) diff --git a/src/PairingManager/PairingManager.h b/src/PairingManager/PairingManager.h index 71c79ae1af..ada48de739 100644 --- a/src/PairingManager/PairingManager.h +++ b/src/PairingManager/PairingManager.h @@ -61,18 +61,23 @@ public: Q_ENUM(PairingStatus) - QStringList pairingLinkTypeStrings(void); - QString pairingStatusStr(void) const; - QStringList pairedDeviceNameList(void); - PairingStatus pairingStatus() { return _status; } - int nfcIndex(void) { return _nfcIndex; } - int microhardIndex(void) { return _microhardIndex; } - void setStatusMessage(PairingStatus status, QString statusStr) { emit setPairingStatus(status, statusStr); } - void jsonReceived(QString json) { emit parsePairingJson(json); } + QStringList pairingLinkTypeStrings (void); + QString pairingStatusStr (void) const; + QStringList pairedDeviceNameList (void); + PairingStatus pairingStatus () { return _status; } + QString pairedVehicle () { return _lastPaired; } + int nfcIndex (void) { return _nfcIndex; } + int microhardIndex (void) { return _microhardIndex; } + bool firstBoot () { return _firstBoot; } + bool errorState () { return _status == PairingRejected || _status == PairingConnectionRejected || _status == PairingError; } + void setStatusMessage (PairingStatus status, QString statusStr) { emit setPairingStatus(status, statusStr); } + void jsonReceived (QString json) { emit parsePairingJson(json); } + void setFirstBoot (bool set) { _firstBoot = set; emit firstBootChanged(); } #ifdef __android__ - static void setNativeMethods(void); + static void setNativeMethods (void); #endif - Q_INVOKABLE void connectToPairedDevice(QString name); + Q_INVOKABLE void connectToPairedDevice (QString name); + Q_INVOKABLE void removePairedDevice (QString name); #if defined QGC_ENABLE_NFC || defined QGC_ENABLE_QTNFC Q_INVOKABLE void startNFCScan(); @@ -86,8 +91,11 @@ public: Q_PROPERTY(PairingStatus pairingStatus READ pairingStatus NOTIFY pairingStatusChanged) Q_PROPERTY(QStringList pairedDeviceNameList READ pairedDeviceNameList NOTIFY pairedListChanged) Q_PROPERTY(QStringList pairingLinkTypeStrings READ pairingLinkTypeStrings CONSTANT) + Q_PROPERTY(QString pairedVehicle READ pairedVehicle NOTIFY pairedVehicleChanged) + Q_PROPERTY(bool errorState READ errorState NOTIFY pairingStatusChanged) Q_PROPERTY(int nfcIndex READ nfcIndex CONSTANT) Q_PROPERTY(int microhardIndex READ microhardIndex CONSTANT) + Q_PROPERTY(bool firstBoot READ firstBoot WRITE setFirstBoot NOTIFY firstBootChanged) signals: void startUpload(QString pairURL, QJsonDocument); @@ -98,6 +106,8 @@ signals: void parsePairingJson(QString json); void setPairingStatus(PairingStatus status, QString pairingStatus); void pairedListChanged(); + void pairedVehicleChanged(); + void firstBootChanged(); private slots: void _startUpload(QString pairURL, QJsonDocument); @@ -109,6 +119,7 @@ private slots: private: QString _statusString; QString _jsonFileName; + QString _lastPaired; QVariantMap _remotePairingMap; int _nfcIndex = -1; int _microhardIndex = -1; @@ -121,20 +132,21 @@ private: QString _uploadURL{}; QString _uploadData{}; - void _parsePairingJsonFile(); - QJsonDocument _createZeroTierConnectJson(QString cert2); - QJsonDocument _createMicrohardConnectJson(QString cert2); - QJsonDocument _createZeroTierPairingJson(QString cert1); - QJsonDocument _createMicrohardPairingJson(QString pwd, QString cert1); - QString _assumeMicrohardPairingJson(); - void _writeJson(QJsonDocument &jsonDoc, QString fileName); - QString _getLocalIPInNetwork(QString remoteIP, int num); - void _uploadFinished(void); - void _uploadError(QNetworkReply::NetworkError code); - void _pairingCompleted(QString name); - void _connectionCompleted(QString name); - QDir _pairingCacheDir(); - QString _pairingCacheFile(QString uavName); + void _parsePairingJsonFile(); + QJsonDocument _createZeroTierConnectJson(QString cert2); + QJsonDocument _createMicrohardConnectJson(QString cert2); + QJsonDocument _createZeroTierPairingJson(QString cert1); + QJsonDocument _createMicrohardPairingJson(QString pwd, QString cert1); + QString _assumeMicrohardPairingJson(); + void _writeJson(QJsonDocument &jsonDoc, QString fileName); + QString _getLocalIPInNetwork(QString remoteIP, int num); + void _uploadFinished(void); + void _uploadError(QNetworkReply::NetworkError code); + void _pairingCompleted(QString name); + void _connectionCompleted(QString name); + QDir _pairingCacheDir(); + QString _pairingCacheFile(QString uavName); + bool _firstBoot = true; #if defined QGC_ENABLE_NFC || defined QGC_ENABLE_QTNFC PairingNFC pairingNFC; diff --git a/src/ui/preferences/GeneralSettings.qml b/src/ui/preferences/GeneralSettings.qml index d0dc218075..2809c201da 100644 --- a/src/ui/preferences/GeneralSettings.qml +++ b/src/ui/preferences/GeneralSettings.qml @@ -484,14 +484,14 @@ Rectangle { } FactCheckBox { text: qsTr("Show additional heading indicators on Compass") - visible: _showAdditionalIndicatorsCompass.visible + visible: _showAdditionalIndicatorsCompass ? _showAdditionalIndicatorsCompass.visible : false fact: _showAdditionalIndicatorsCompass property Fact _showAdditionalIndicatorsCompass: QGroundControl.settingsManager.flyViewSettings.showAdditionalIndicatorsCompass } FactCheckBox { text: qsTr("Lock Compass Nose-Up") - visible: _lockNoseUpCompass.visible + visible: _lockNoseUpCompass ? _lockNoseUpCompass.visible : false fact: _lockNoseUpCompass property Fact _lockNoseUpCompass: QGroundControl.settingsManager.flyViewSettings.lockNoseUpCompass diff --git a/src/ui/toolbar/PairingIndicator.qml b/src/ui/toolbar/PairingIndicator.qml index 3d60bb0bf5..90f6bca04e 100644 --- a/src/ui/toolbar/PairingIndicator.qml +++ b/src/ui/toolbar/PairingIndicator.qml @@ -10,6 +10,7 @@ import QtQuick 2.11 import QtQuick.Controls 2.4 import QtQuick.Layouts 1.11 +import QtQuick.Dialogs 1.3 import QGroundControl 1.0 import QGroundControl.Controls 1.0 @@ -26,24 +27,46 @@ Item { anchors.bottom: parent.bottom property bool _light: qgcPal.globalTheme === QGCPalette.Light && !activeVehicle - property real _contentWidth: ScreenTools.defaultFontPixelWidth * 40 + property real _contentWidth: ScreenTools.defaultFontPixelWidth * 34 property real _contentSpacing: ScreenTools.defaultFontPixelHeight * 0.5 property real _rectWidth: _contentWidth property real _rectHeight: _contentWidth * 0.75 property string kPairingManager: qsTr("Pairing Manager") + function runPairing() { + QGroundControl.pairingManager.firstBoot = false + if(QGroundControl.pairingManager.pairedDeviceNameList.length > 0) { + connectionPopup.open() + } else { + mhPopup.open() + } + } + + Connections { + target: QGroundControl.pairingManager + //-- Connect automatically once paired + onPairingStatusChanged: { + if(QGroundControl.pairingManager.pairingStatus === PairingManager.PairingSuccess) { + if(QGroundControl.pairingManager.pairedVehicle !== "") { + QGroundControl.pairingManager.connectToPairedDevice(QGroundControl.pairingManager.pairedVehicle) + } + } + } + } + Row { id: pairingRow spacing: ScreenTools.defaultFontPixelWidth anchors.top: parent.top anchors.bottom: parent.bottom anchors.horizontalCenter: parent.horizontalCenter - Image { + QGCColoredImage { id: pairingIcon height: parent.height width: height - source: _light ? "/qmlimages/PairingIconLight.svg" : "/qmlimages/PairingIcon.svg" + color: qgcPal.text + source: "/qmlimages/PairingIcon.svg" sourceSize.width: width fillMode: Image.PreserveAspectFit smooth: true @@ -62,89 +85,7 @@ Item { MouseArea { anchors.fill: parent onClicked: { - if(QGroundControl.pairingManager.pairedDeviceNameList.length > 1) { - connectionPopup.open() - } else { - if(QGroundControl.pairingManager.pairingLinkTypeStrings.length > 1) - pairingPopup.open() - else { - mhPopup.open() - } - } - } - } - //------------------------------------------------------------------------- - //-- Pairing - Popup { - id: pairingPopup - width: pairingBody.width - height: pairingBody.height - modal: true - focus: true - parent: Overlay.overlay - x: Math.round((mainWindow.width - width) * 0.5) - y: Math.round((mainWindow.height - height) * 0.5) - closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside - background: Rectangle { - anchors.fill: parent - color: qgcPal.globalTheme === QGCPalette.Light ? Qt.rgba(1,1,1,0.95) : Qt.rgba(0,0,0,0.75) - radius: ScreenTools.defaultFontPixelWidth * 0.25 - } - Item { - id: pairingBody - width: comboListCol.width + (ScreenTools.defaultFontPixelWidth * 8) - height: comboListCol.height + (ScreenTools.defaultFontPixelHeight * 2) - anchors.centerIn: parent - Column { - id: comboListCol - spacing: _contentSpacing - anchors.centerIn: parent - Item { width: 1; height: 1; } - QGCLabel { - text: kPairingManager - font.family: ScreenTools.demiboldFontFamily - anchors.horizontalCenter: parent.horizontalCenter - } - Item { width: 1; height: 1; } - Rectangle { - width: _rectWidth - height: _rectHeight - color: Qt.rgba(0,0,0,0) - border.color: qgcPal.text - border.width: 1 - anchors.horizontalCenter: parent.horizontalCenter - QGCLabel { - text: "Pair Graphic" - anchors.centerIn: parent - } - } - Item { width: 1; height: 1; } - QGCLabel { - text: qsTr("Please choose a pairing method in order to connect to a nearby device") - width: _contentWidth - wrapMode: Text.WordWrap - horizontalAlignment: Text.AlignHCenter - anchors.horizontalCenter: parent.horizontalCenter - } - Item { width: 1; height: 1; } - Repeater { - model: QGroundControl.pairingManager ? QGroundControl.pairingManager.pairingLinkTypeStrings : [] - delegate: QGCButton { - text: modelData - width: _contentWidth - anchors.horizontalCenter: parent.horizontalCenter - onClicked: { - pairingPopup.close() - if (index === QGroundControl.pairingManager.nfcIndex) { - nfcPopup.open() - } else if (index === QGroundControl.pairingManager.microhardIndex) { - mhPopup.open() - } - } - } - } - Item { width: 1; height: 1; } - } + runPairing() } } //------------------------------------------------------------------------- @@ -177,37 +118,42 @@ Item { QGCLabel { text: kPairingManager font.family: ScreenTools.demiboldFontFamily + font.pointSize: ScreenTools.mediumFontPointSize anchors.horizontalCenter: parent.horizontalCenter } + Rectangle { + width: _contentWidth + height: 1 + color: qgcPal.globalTheme !== QGCPalette.Light ? Qt.rgba(1,1,1,0.25) : Qt.rgba(0,0,0,0.25) + } Item { width: 1; height: 1; } QGCLabel { - text: qsTr("To connect to your vehicle, please click 3 times on the button in order to put the vehicle in a discovery mode") + text: qsTr("To connect to your vehicle, please click on the pairing button in order to put the vehicle in discovery mode") width: _contentWidth wrapMode: Text.WordWrap horizontalAlignment: Text.AlignHCenter anchors.horizontalCenter: parent.horizontalCenter } - Item { width: 1; height: 1; } - Rectangle { - width: _rectWidth - height: _rectHeight - color: Qt.rgba(0,0,0,0) - border.color: qgcPal.text - border.width: 1 + Item { width: 1; height: ScreenTools.defaultFontPixelHeight * 2; } + QGCColoredImage { + height: ScreenTools.defaultFontPixelHeight * 6 + width: height + source: "/qmlimages/PairingButton.svg" + sourceSize.height: height + fillMode: Image.PreserveAspectFit + mipmap: true + smooth: true + color: qgcPal.text anchors.horizontalCenter: parent.horizontalCenter - QGCLabel { - text: "Button Positioning Graphic" - anchors.centerIn: parent - } } - Item { width: 1; height: 1; } + Item { width: 1; height: ScreenTools.defaultFontPixelHeight * 2; } QGCButton { - text: qsTr("Pair Via Microhard") + text: qsTr("Pair a Vehicle") width: _contentWidth anchors.horizontalCenter: parent.horizontalCenter onClicked: { mhPopup.close() - connectionPopup.open() + progressPopup.open() QGroundControl.pairingManager.startMicrohardPairing(); } } @@ -245,8 +191,14 @@ Item { QGCLabel { text: kPairingManager font.family: ScreenTools.demiboldFontFamily + font.pointSize: ScreenTools.mediumFontPointSize anchors.horizontalCenter: parent.horizontalCenter } + Rectangle { + width: _contentWidth + height: 1 + color: qgcPal.globalTheme !== QGCPalette.Light ? Qt.rgba(1,1,1,0.25) : Qt.rgba(0,0,0,0.25) + } Item { width: 1; height: 1; } Rectangle { width: _rectWidth @@ -275,7 +227,7 @@ Item { anchors.horizontalCenter: parent.horizontalCenter onClicked: { nfcPopup.close() - connectionPopup.open() + progressPopup.open() QGroundControl.pairingManager.startNFCScan(); } } @@ -284,11 +236,11 @@ Item { } } //------------------------------------------------------------------------- - //-- Connection Manager + //-- Pairing/Connection Progress Popup { - id: connectionPopup - width: connectionBody.width - height: connectionBody.height + id: progressPopup + width: progressBody.width + height: progressBody.height modal: true focus: true parent: Overlay.overlay @@ -301,22 +253,24 @@ Item { radius: ScreenTools.defaultFontPixelWidth * 0.25 } Item { - id: connectionBody - width: connectionCol.width + (ScreenTools.defaultFontPixelWidth * 8) - height: connectionCol.height + (ScreenTools.defaultFontPixelHeight * 2) + id: progressBody + width: progressCol.width + (ScreenTools.defaultFontPixelWidth * 8) + height: progressCol.height + (ScreenTools.defaultFontPixelHeight * 2) anchors.centerIn: parent Column { - id: connectionCol + id: progressCol spacing: _contentSpacing anchors.centerIn: parent Item { width: 1; height: 1; } QGCLabel { text: kPairingManager font.family: ScreenTools.demiboldFontFamily + font.pointSize: ScreenTools.mediumFontPointSize anchors.horizontalCenter: parent.horizontalCenter } QGCLabel { text: QGroundControl.pairingManager ? QGroundControl.pairingManager.pairingStatusStr : "" + visible: !connectedIndicator.visible anchors.horizontalCenter: parent.horizontalCenter } Rectangle { @@ -325,9 +279,11 @@ Item { color: qgcPal.globalTheme !== QGCPalette.Light ? Qt.rgba(1,1,1,0.25) : Qt.rgba(0,0,0,0.25) } Item { width: 1; height: 1; } + //-- Pairing/Connecting + Item { width: 1; height: ScreenTools.defaultFontPixelHeight * 3; visible: busyIndicator.visible; } QGCColoredImage { id: busyIndicator - height: ScreenTools.defaultFontPixelHeight * 2 + height: ScreenTools.defaultFontPixelHeight * 4 width: height source: "/qmlimages/MapSync.svg" sourceSize.height: height @@ -335,7 +291,7 @@ Item { mipmap: true smooth: true color: qgcPal.text - visible: cancelButton.visible + visible: QGroundControl.pairingManager.pairingStatus === PairingManager.PairingActive || QGroundControl.pairingManager.pairingStatus === PairingManager.PairingConnecting anchors.horizontalCenter: parent.horizontalCenter RotationAnimation on rotation { loops: Animation.Infinite @@ -345,6 +301,132 @@ Item { running: busyIndicator.visible } } + Item { width: 1; height: ScreenTools.defaultFontPixelHeight * 3; visible: busyIndicator.visible; } + //-- Error State + Image { + height: ScreenTools.defaultFontPixelHeight * 4 + width: height + source: "/qmlimages/PairingError.svg" + sourceSize.height: height + fillMode: Image.PreserveAspectFit + mipmap: true + smooth: true + visible: QGroundControl.pairingManager.errorState + anchors.horizontalCenter: parent.horizontalCenter + } + //-- Connection Successful + Image { + id: connectedIndicator + height: width * 0.2 + width: _contentWidth + source: "/qmlimages/PairingConnected.svg" + sourceSize.height: height + fillMode: Image.PreserveAspectFit + mipmap: true + smooth: true + visible: QGroundControl.pairingManager.pairingStatus === PairingManager.PairingConnected + anchors.horizontalCenter: parent.horizontalCenter + } + Item { width: 1; height: _contentSpacing; visible: connectedIndicator.visible; } + QGCLabel { + text: QGroundControl.pairingManager.pairedVehicle + visible: connectedIndicator.visible + anchors.horizontalCenter: parent.horizontalCenter + } + QGCLabel { + text: qsTr("Connection Successful") + visible: connectedIndicator.visible + anchors.horizontalCenter: parent.horizontalCenter + } + Item { width: 1; height: _contentSpacing; } + //-- Buttons + QGCButton { + width: _contentWidth + visible: QGroundControl.pairingManager ? (QGroundControl.pairingManager.pairingStatus === PairingManager.PairingConnected) : false + text: qsTr("Done") + anchors.horizontalCenter: parent.horizontalCenter + onClicked: { + progressPopup.close() + } + } + QGCButton { + text: qsTr("Pair Another") + width: _contentWidth + visible: QGroundControl.pairingManager ? (QGroundControl.pairingManager.pairingStatus === PairingManager.PairingConnected) : false + anchors.horizontalCenter: parent.horizontalCenter + onClicked: { + progressPopup.close() + mhPopup.open() + } + } + QGCButton { + text: qsTr("Try Again") + width: _contentWidth + visible: QGroundControl.pairingManager ? QGroundControl.pairingManager.errorState : false + anchors.horizontalCenter: parent.horizontalCenter + onClicked: { + progressPopup.close() + runPairing() + } + } + QGCButton { + id: cancelButton + width: _contentWidth + visible: QGroundControl.pairingManager ? (QGroundControl.pairingManager.pairingStatus === PairingManager.PairingActive || QGroundControl.pairingManager.pairingStatus === PairingManager.PairingConnecting || QGroundControl.pairingManager.errorState) : false + text: qsTr("Cancel") + anchors.horizontalCenter: parent.horizontalCenter + onClicked: { + if(QGroundControl.pairingManager.pairingStatus === PairingManager.PairingActive) + QGroundControl.pairingManager.stopPairing() + else { + //-- TODO: Cancel connection to paired device + } + progressPopup.close() + } + } + Item { width: 1; height: 1; } + } + } + } + //------------------------------------------------------------------------- + //-- Connection Manager + Popup { + id: connectionPopup + width: connectionBody.width + height: connectionBody.height + modal: true + focus: true + parent: Overlay.overlay + x: Math.round((mainWindow.width - width) * 0.5) + y: Math.round((mainWindow.height - height) * 0.5) + closePolicy: cancelButton.visible ? Popup.NoAutoClose : (Popup.CloseOnEscape | Popup.CloseOnPressOutside) + background: Rectangle { + anchors.fill: parent + color: qgcPal.globalTheme === QGCPalette.Light ? Qt.rgba(1,1,1,0.95) : Qt.rgba(0,0,0,0.75) + radius: ScreenTools.defaultFontPixelWidth * 0.25 + } + Item { + id: connectionBody + width: connectionCol.width + (ScreenTools.defaultFontPixelWidth * 8) + height: connectionCol.height + (ScreenTools.defaultFontPixelHeight * 2) + anchors.centerIn: parent + Column { + id: connectionCol + spacing: _contentSpacing + anchors.centerIn: parent + Item { width: 1; height: 1; } + QGCLabel { + text: kPairingManager + font.family: ScreenTools.demiboldFontFamily + font.pointSize: ScreenTools.mediumFontPointSize + anchors.horizontalCenter: parent.horizontalCenter + } + Rectangle { + width: _contentWidth + height: 1 + color: qgcPal.globalTheme !== QGCPalette.Light ? Qt.rgba(1,1,1,0.25) : Qt.rgba(0,0,0,0.25) + } + Item { width: 1; height: 1; } QGCLabel { text: qsTr("List Of Available Devices") visible: QGroundControl.pairingManager ? (QGroundControl.pairingManager.pairedDeviceNameList.length > 0 && !cancelButton.visible) : false @@ -358,9 +440,9 @@ Item { rowSpacing: ScreenTools.defaultFontPixelHeight * 0.25 anchors.horizontalCenter: parent.horizontalCenter Repeater { - model: QGroundControl.pairingManager ? QGroundControl.pairingManager.pairedDeviceNameList : [] + model: QGroundControl.pairingManager ? QGroundControl.pairingManager.pairedDeviceNameList : [] QGCLabel { - text: modelData + text: modelData Layout.row: index Layout.column: 0 Layout.minimumWidth:ScreenTools.defaultFontPixelWidth * 14 @@ -368,18 +450,20 @@ Item { } } Repeater { - model: QGroundControl.pairingManager ? QGroundControl.pairingManager.pairedDeviceNameList : [] + model: QGroundControl.pairingManager ? QGroundControl.pairingManager.pairedDeviceNameList : [] QGCButton { text: qsTr("Connect") Layout.row: index Layout.column: 1 onClicked: { QGroundControl.pairingManager.connectToPairedDevice(modelData) + connectionPopup.close() + progressPopup.open() } } } Repeater { - model: QGroundControl.pairingManager ? QGroundControl.pairingManager.pairedDeviceNameList : [] + model: QGroundControl.pairingManager ? QGroundControl.pairingManager.pairedDeviceNameList : [] QGCColoredImage { height: ScreenTools.defaultFontPixelHeight * 1.5 width: height @@ -391,7 +475,18 @@ Item { MouseArea { anchors.fill: parent onClicked: { - //-- TODO: + removePrompt.open() + } + } + MessageDialog { + id: removePrompt + title: qsTr("Remove Paired Vehicle") + text: qsTr("Confirm removing %1?").arg(modelData) + standardButtons: StandardButton.Yes | StandardButton.No + onNo: removePrompt.close() + onYes: { + QGroundControl.pairingManager.removePairedDevice(modelData) + removePrompt.close() } } } @@ -399,10 +494,8 @@ Item { } Item { width: 1; height: _contentSpacing; } QGCButton { - id: connectedButton width: _contentWidth - visible: QGroundControl.pairingManager ? (QGroundControl.pairingManager.pairingStatus === PairingManager.PairingConnected || QGroundControl.pairingManager.pairingStatus === PairingManager.PairingIdle) : false - text: QGroundControl.pairingManager ? (QGroundControl.pairingManager.pairingStatus === PairingManager.PairingConnected ? qsTr("Done ") : qsTr("Close")) : "" + text: qsTr("Close") anchors.horizontalCenter: parent.horizontalCenter onClicked: { connectionPopup.close() @@ -411,39 +504,10 @@ Item { QGCButton { text: qsTr("Pair Another") width: _contentWidth - visible: connectedButton.visible - anchors.horizontalCenter: parent.horizontalCenter - onClicked: { - connectionPopup.close() - if(QGroundControl.pairingManager.pairingLinkTypeStrings.length > 1) - pairingPopup.open() - else { - mhPopup.open() - } - } - } - QGCButton { - id: cancelButton - width: _contentWidth - visible: QGroundControl.pairingManager ? (QGroundControl.pairingManager.pairingStatus === PairingManager.PairingActive || QGroundControl.pairingManager.pairingStatus === PairingManager.PairingConnecting) : false - text: qsTr("Cancel") - anchors.horizontalCenter: parent.horizontalCenter - onClicked: { - if(QGroundControl.pairingManager.pairingStatus === PairingManager.PairingActive) - QGroundControl.pairingManager.stopPairing() - else { - //-- TODO: Cancel connection to paired device - } - connectionPopup.close() - } - } - QGCButton { - visible: !cancelButton.visible && !connectedButton.visible - text: qsTr("Close") - width: _contentWidth anchors.horizontalCenter: parent.horizontalCenter onClicked: { connectionPopup.close() + mhPopup.open() } } Item { width: 1; height: 1; } -- GitLab