import QtQuick 2.3 import QtQuick.Controls.Styles 1.4 import QtQuick.Dialogs 1.2 import QtLocation 5.3 import QtPositioning 5.3 import QtQuick.Controls 2.4 import QtQuick.Layouts 1.2 import QGroundControl 1.0 import QGroundControl.ScreenTools 1.0 import QGroundControl.Controls 1.0 import QGroundControl.Palette 1.0 import QGroundControl.Vehicle 1.0 import QGroundControl.FlightMap 1.0 import QGroundControl.FlightDisplay 1.0 import QGroundControl.Airspace 1.0 import QGroundControl.Airmap 1.0 import QGroundControl.FactSystem 1.0 import QGroundControl.FactControls 1.0 import Qt.labs.settings 1.0 Item { id: _root height: mainFrame.height width: mainFrame.width clip: true property int maxHeight: 500 property int maxWidth: 300 property var wimaController // must be provided by the user property var planMasterController // must be provided by the user property var missionController // must be provided by the user property bool _controllerValid: planMasterController !== undefined property real _controllerProgressPct: _controllerValid ? planMasterController.missionController.progressPct : 0 property real _margins: ScreenTools.defaultFontPixelWidth / 2 // Disabels map scrolling when cursor on this menu. DeadMouseArea { anchors.fill: parent } // Use Settings to store menu appearance through different sessions. Settings { property alias snakeHeaderChecker: snakeHeader.checked property alias missionHeaderChecker: missionHeader.checked property alias navigateHeaderChecker: navigateHeader.checked property alias vehicleHeaderChecker: vehicleHeader.checked property alias statsHeaderChecker: statsHeader.checked } // Progress bar visibility on_ControllerProgressPctChanged: { if (_controllerProgressPct === 1) { uploadCompleteText.visible = true progressBar.visible = false } else if (_controllerProgressPct > 0) { progressBar.visible = true uploadCompleteText.visible = false } } function getTime(time) { // time is a double if(isNaN(time)) { return "00:00:00" } var t = new Date(0, 0, 0, 0, 0, Number(time)) return Qt.formatTime(t, 'hh:mm:ss') } QGCPalette { id: qgcPal } // box containing all items Rectangle { // maybe replace with column and remove anchors => dynamic height: id: mainFrame height: enableWima.height + flickable.height + _margins*2 width: Math.max(enableWima.width, flickable.width) color: enableWima.enableWimaBoolean ? qgcPal.window : "transparent" radius: Math.min(height, width)/50 clip: true property real _margins: _root._margins // checkbox to enable/ disable wima SliderSwitch { id: enableWima anchors.horizontalCenter: flickable.horizontalCenter anchors.bottom: flickable.top anchors.bottomMargin: _margins confirmText: enableWimaBoolean ? qsTr("disable WiMA") : qsTr("enable WiMA") property var enableWimaFact: wimaController.enableWimaController property bool enableWimaBoolean: enableWimaFact.value onAccept: { if (enableWimaBoolean) { enableWimaFact.value = false enableWimaMouseArea.enabled = true timer.start() } else { enableWimaFact.value = true enableWimaMouseArea.enabled = false timer.stop() } } } MouseArea { id: enableWimaMouseArea anchors.fill: enableWima hoverEnabled: true property var enableWimaFact: wimaController.enableWimaController property bool enableWimaBoolean: enableWimaFact.value onEntered: { enableWima.visible = true enabled = false timer.start() } } Timer { id: timer interval: 3000 running: false repeat: false onTriggered: triggerHandler() function triggerHandler() { if (enableWima.enableWimaBoolean === false) { enableWima.visible = false enableWimaMouseArea.enabled = true } } Component.onCompleted: { start() } } QGCFlickable { id: flickable clip: true visible: enableWima.enableWimaBoolean anchors.left: parent.left anchors.bottom: parent.bottom width: enableWima.enableWimaBoolean ? Math.min(contentWidth, maxWidth) : enableWima.width height: enableWima.enableWimaBoolean ? Math.min(contentHeight, maxHeight) : 0 contentHeight: columnWrapper.height contentWidth: columnWrapper.width Row { id: columnWrapper Item{ // spacer width: 6 height: 1 } Column { id: mainColumn spacing: ScreenTools.defaultFontPixelHeight * 0.3 SectionHeader{ id: snakeHeader text: qsTr("Snake Settings") } Column { visible: snakeHeader.checked spacing: ScreenTools.defaultFontPixelHeight * 0.5 FactCheckBox { text: wimaController.enableSnake.value ? qsTr("Disable Snake") : qsTr("Enable Snake") fact: wimaController.enableSnake } // Spacer Item { height: 1 } // Snake status and settings column. GridLayout { columns: 2 rowSpacing: ScreenTools.defaultFontPixelHeight * 0.5 columnSpacing: ScreenTools.defaultFontPixelHeight * 0.5 visible: wimaController.enableSnake.value // Snake connection status. QGCLabel { property int _connectionStatus: wimaController.snakeConnectionStatus text: _connectionStatus === 1 ? qsTr("Status: Connected") : qsTr("Status: Not Connected") Layout.fillWidth: true } // Snake calculation status. QGCLabel { property bool _calcInProgress: wimaController.snakeCalcInProgress text: _calcInProgress === true ? qsTr("Calculation: In Progress") : qsTr("Calculation: Idle") Layout.fillWidth: true } } } SectionHeader{ id: missionHeader text: qsTr("Phase Settings") } GridLayout { columns: 2 rowSpacing: ScreenTools.defaultFontPixelHeight * 0.5 columnSpacing: ScreenTools.defaultFontPixelHeight * 0.5 visible: missionHeader.checked QGCLabel { text: qsTr("Next Waypoint") Layout.fillWidth: true } FactTextField { fact: wimaController.startWaypointIndex Layout.fillWidth: true } QGCLabel { text: qsTr("Max Waypoints") Layout.fillWidth: true } FactTextField { fact: wimaController.maxWaypointsPerPhase Layout.fillWidth: true } QGCLabel { text: qsTr("Overlap") Layout.fillWidth: true } FactTextField { fact: wimaController.overlapWaypoints Layout.fillWidth: true } QGCLabel { text: qsTr("Measurement Speed") Layout.fillWidth: true } FactTextField { fact: wimaController.flightSpeed Layout.fillWidth: true } QGCLabel { text: qsTr("AaR Speed") Layout.fillWidth: true } FactTextField { fact: wimaController.arrivalReturnSpeed Layout.fillWidth: true } QGCLabel { text: qsTr("Altitude") Layout.fillWidth: true } FactTextField { fact: wimaController.altitude Layout.fillWidth: true } FactCheckBox { text: qsTr("Show Mission") fact: wimaController.showAllMissionItems Layout.fillWidth: true } FactCheckBox { text: qsTr("Show Phase") fact: wimaController.showCurrentMissionItems Layout.fillWidth: true } FactCheckBox { text: qsTr("Invert Phase") fact: wimaController.reverse Layout.fillWidth: true } } SectionHeader{ id: navigateHeader text: qsTr("Navigate") } GridLayout {// Buttons columns: 2 rowSpacing: ScreenTools.defaultFontPixelHeight * 0.5 columnSpacing: ScreenTools.defaultFontPixelHeight * 0.5 visible: navigateHeader.checked width: missionHeader.width QGCButton { id: buttonPreviousMissionPhase text: qsTr("Go Reverse") onClicked: wimaController.previousPhase() Layout.fillWidth: true } QGCButton { id: buttonNextMissionPhase text: qsTr("Go Forward") onClicked: wimaController.nextPhase() Layout.fillWidth: true } QGCButton { id: buttonResetPhase text: qsTr("Reset Phase") onClicked: wimaController.resetPhase(); Layout.columnSpan: 2 Layout.fillWidth: true } } // Grid Buttons SectionHeader{ id: vehicleHeader text: qsTr("Vehicle") } GridLayout { columns: 2 rowSpacing: ScreenTools.defaultFontPixelHeight * 0.5 columnSpacing: ScreenTools.defaultFontPixelHeight * 0.5 visible: vehicleHeader.checked width: parent.width QGCButton { id: buttonUpload text: qsTr("Upload") onClicked: { if (!planMasterController.offline) { wimaController.uploadToVehicle() } } Layout.fillWidth: true } QGCButton { id: buttonRemoveFromVehicle text: qsTr("Remove") onClicked: wimaController.removeFromVehicle() Layout.fillWidth: true } QGCButton { id: buttonSmartRTL text: qsTr("Smart RTL") onClicked: wimaController.initSmartRTL(); Layout.columnSpan: 2 Layout.fillWidth: true } QGCButton { id: buttonRemoveTrajectoryHistory text: qsTr("Clear Trajectory") onClicked: wimaController.removeVehicleTrajectoryHistory() Layout.columnSpan: 2 Layout.fillWidth: true } // progess bar Rectangle { id: progressBar height: 4 width: _controllerProgressPct * parent.width color: qgcPal.colorGreen visible: false Layout.columnSpan: 2 Layout.fillWidth: true } QGCLabel { id: uploadCompleteText font.pointSize: ScreenTools.largeFontPointSize Layout.columnSpan: 2 horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter text: "Done" visible: false Layout.fillWidth: true } } SectionHeader { id: statsHeader text: qsTr("Statistics") } GridLayout { columns: 3 rowSpacing: ScreenTools.defaultFontPixelHeight * 0.5 anchors.topMargin: ScreenTools.defaultFontPixelHeight * 0.5 visible: statsHeader.checked Item { id: widthItem Layout.fillWidth: true Layout.columnSpan: parent.columns height: 0 } SmallValue { property var phaseDistance: wimaController.phaseDistance shortDescription: qsTr("Phase Length") value: phaseDistance >= 0 ? phaseDistance.toFixed(2): "-.-" unit: "m" //width: widthItem.width*0.49 } SmallValue { property var phaseDuration: wimaController.phaseDuration shortDescription: qsTr("Phase Duration") value: phaseDuration >= 0 ? getTime(phaseDuration) : "-.-" //unit: "m" //width: widthItem.width*0.49 } SmallValue { property var currentMissionIndex: missionController.currentMissionIndex shortDescription: qsTr("Current Waypoint") value: currentMissionIndex > 0 ? currentMissionIndex : "-.-" //unit: "m" //width: widthItem.width*0.49 } SmallValue { property var remainingDistance: missionController.remainingDistance shortDescription: qsTr("Remaining Distance") value: remainingDistance >= 0 ? remainingDistance.toFixed(2) : "-.-" unit: "m" //width: widthItem.width*0.49 } SmallValue { property var remainingTime: missionController.remainingTime shortDescription: qsTr("Remaining Time") value: remainingTime >= 0 ? getTime(remainingTime) : "-.-" //unit: "m" //width: widthItem.width*0.49 } Item { // spacer height: 5 Layout.columnSpan: parent.columns } } // GridLayout } // settingsColumn Item { // spacer width: 6 height: 5 } } // Row } // QGCFlickable } }