import QtQuick 2.0 import Qt.labs.settings 1.0 import QtQuick.Layouts 1.11 import QtQuick.Controls 1.4 import QGroundControl.Controls 1.0 import QGroundControl.FactControls 1.0 import QGroundControl.ScreenTools 1.0 import QGroundControl.Palette 1.0 import MeasurementComplexItem 1.0 as MCI Rectangle { id: _root width: mainGrid.width height: mainGrid.height color: qgcPal.windowShadeDark property bool checked: true property var missionItem: undefined property int availableWidth: 300 readonly property bool running: _nemoInterface.running property string warningString: _nemoInterface.warningString property string infoString: _nemoInterface.infoString signal abort property var _areaData: missionItem.areaData property real _margin: ScreenTools.defaultFontPixelWidth / 2 property var _nemoInterface: MCI.NemoInterface Component.onCompleted: { console.assert(missionItem !== undefined, "please set the missionItem property") } GridLayout { id: mainGrid width: availableWidth columnSpacing: _margin rowSpacing: _margin columns: 2 QGCButton { text: running ? qsTr("Stop") : qsTr("Start") Layout.columnSpan: parent.columns Layout.fillWidth: true onPressed: { if (running) { _nemoInterface.stop() } else { _nemoInterface.start() } } } QGCLabel { text: qsTr("Status: ") + _nemoInterface.statusString wrapMode: Text.WordWrap horizontalAlignment: Text.AlignVCenter Layout.columnSpan: parent.columns Layout.fillWidth: true } QGCLabel { text: _root.warningString visible: text.length > 0 wrapMode: Text.WordWrap horizontalAlignment: Text.AlignLeft color: "orange" Layout.columnSpan: parent.columns Layout.fillWidth: true } QGCLabel { text: _root.infoString visible: text.length > 0 wrapMode: Text.WordWrap horizontalAlignment: Text.AlignLeft Layout.columnSpan: parent.columns Layout.fillWidth: true } SectionHeader { id: progressHeader Layout.fillWidth: true Layout.columnSpan: parent.columns text: qsTr("Progress") } GridLayout { columnSpacing: _margin rowSpacing: _margin columns: 2 Layout.columnSpan: parent.columns Layout.fillWidth: true visible: progressHeader.checked QGCButton { text: !missionItem.holdProgress ? qsTr("Hold") : qsTr("Stop Holding") Layout.fillWidth: true Layout.columnSpan: parent.columns onPressed: { if (missionItem.holdProgress) { missionItem.holdProgress = false } else { missionItem.holdProgress = true } } } QGCButton { text: qsTr("Random") Layout.columnSpan: parent.columns Layout.fillWidth: true onPressed: { _randomProgress() } } QGCButton { text: qsTr("Reset") Layout.columnSpan: parent.columns Layout.fillWidth: true onPressed: { _resetProgress() } } } // bussy indicator ColumnLayout { Layout.fillWidth: true spacing: _margin Layout.maximumWidth: parent.width BusyIndicator { id: indicator property bool calculating: missionItem.calculating running: calculating visible: calculating || timer.running onCalculatingChanged: { if (!calculating) { // defer hiding timer.restart() } } Timer { id: timer interval: 1000 repeat: false running: false } } } // indicator column SectionHeader { id: hintHeader Layout.fillWidth: true Layout.columnSpan: parent.columns text: qsTr("Hints") } GridLayout { columnSpacing: _margin rowSpacing: _margin columns: 2 Layout.columnSpan: 2 Layout.fillWidth: true visible: hintHeader.checked QGCLabel { id: hintLabel wrapMode: Text.WordWrap horizontalAlignment: Text.AlignLeft text: qsTr("Use this tab to connect to a device implementing the Nemointerface. Use the Random button to simulate measurement progress.") Layout.fillWidth: true Layout.columnSpan: parent.columns } } Settings { property alias showHint: hintHeader.checked } } // GridLayout function _randomProgress() { var areaArray = _areaData.measurementAreaList for (var i = 0; i < areaArray.count; ++i) { var area = areaArray.get(i) if (area) { area.randomProgress() } else { console.log("empty area!") } } } function _resetProgress() { var areaArray = _areaData.measurementAreaList for (var i = 0; i < areaArray.count; ++i) { var area = areaArray.get(i) if (area) { area.resetProgress() } else { console.log("empty area!") } } } } // Rectangle