Commit 1edf5b83 authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #4912 from NaterGator/analyzectl

Make AnalyzeView controllers persistent
parents 2e7364da b71cf9ba
...@@ -36,6 +36,14 @@ Rectangle { ...@@ -36,6 +36,14 @@ Rectangle {
readonly property real _verticalMargin: _defaultTextHeight / 2 readonly property real _verticalMargin: _defaultTextHeight / 2
readonly property real _buttonWidth: _defaultTextWidth * 18 readonly property real _buttonWidth: _defaultTextWidth * 18
GeoTagController {
id: geoController
}
LogDownloadController {
id: logController
}
MavlinkConsoleController { MavlinkConsoleController {
id: conController id: conController
} }
......
...@@ -27,10 +27,6 @@ AnalyzePage { ...@@ -27,10 +27,6 @@ AnalyzePage {
property real _margin: ScreenTools.defaultFontPixelWidth * 2 property real _margin: ScreenTools.defaultFontPixelWidth * 2
GeoTagController {
id: controller
}
Component { Component {
id: pageComponent id: pageComponent
...@@ -46,18 +42,18 @@ AnalyzePage { ...@@ -46,18 +42,18 @@ AnalyzePage {
id: progressBar id: progressBar
width: qgcView.width -_margin * 5 width: qgcView.width -_margin * 5
maximumValue: 100 maximumValue: 100
value: controller.progress value: geoController.progress
} }
BusyIndicator { BusyIndicator {
running: controller.progress > 0 && controller.progress < 100 && controller.errorMessage === "" running: geoController.progress > 0 && geoController.progress < 100 && geoController.errorMessage === ""
width: progressBar.height width: progressBar.height
height: progressBar.height height: progressBar.height
} }
} }
QGCLabel { QGCLabel {
text: controller.errorMessage text: geoController.errorMessage
font.bold: true font.bold: true
font.pointSize: ScreenTools.largeFontPointSize font.pointSize: ScreenTools.largeFontPointSize
color: "red" color: "red"
...@@ -77,12 +73,12 @@ AnalyzePage { ...@@ -77,12 +73,12 @@ AnalyzePage {
QGCButton { QGCButton {
text: qsTr("Select log file") text: qsTr("Select log file")
width: ScreenTools.defaultFontPixelWidth * 30 width: ScreenTools.defaultFontPixelWidth * 30
onClicked: controller.pickLogFile() onClicked: geoController.pickLogFile()
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
QGCLabel { QGCLabel {
text: controller.logFile text: geoController.logFile
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
...@@ -93,12 +89,12 @@ AnalyzePage { ...@@ -93,12 +89,12 @@ AnalyzePage {
QGCButton { QGCButton {
text: qsTr("Select image directory") text: qsTr("Select image directory")
width: ScreenTools.defaultFontPixelWidth * 30 width: ScreenTools.defaultFontPixelWidth * 30
onClicked: controller.pickImageDirectory() onClicked: geoController.pickImageDirectory()
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
QGCLabel { QGCLabel {
text: controller.imageDirectory text: geoController.imageDirectory
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
...@@ -109,12 +105,12 @@ AnalyzePage { ...@@ -109,12 +105,12 @@ AnalyzePage {
QGCButton { QGCButton {
text: qsTr("(Optionally) Select save directory") text: qsTr("(Optionally) Select save directory")
width: ScreenTools.defaultFontPixelWidth * 30 width: ScreenTools.defaultFontPixelWidth * 30
onClicked: controller.pickSaveDirectory() onClicked: geoController.pickSaveDirectory()
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
QGCLabel { QGCLabel {
text: controller.saveDirectory != "" ? controller.saveDirectory : "/TAGGED folder in your image folder" text: geoController.saveDirectory != "" ? geoController.saveDirectory : "/TAGGED folder in your image folder"
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
...@@ -128,13 +124,13 @@ AnalyzePage { ...@@ -128,13 +124,13 @@ AnalyzePage {
} }
QGCButton { QGCButton {
text: controller.inProgress ? qsTr("Cancel Tagging") : qsTr("Start Tagging") text: geoController.inProgress ? qsTr("Cancel Tagging") : qsTr("Start Tagging")
width: ScreenTools.defaultFontPixelWidth * 30 width: ScreenTools.defaultFontPixelWidth * 30
onClicked: { onClicked: {
if (controller.inProgress) { if (geoController.inProgress) {
controller.cancelTagging() geoController.cancelTagging()
} else { } else {
controller.startTagging() geoController.startTagging()
} }
} }
} }
......
...@@ -27,13 +27,21 @@ AnalyzePage { ...@@ -27,13 +27,21 @@ AnalyzePage {
property real _margin: ScreenTools.defaultFontPixelWidth property real _margin: ScreenTools.defaultFontPixelWidth
property real _butttonWidth: ScreenTools.defaultFontPixelWidth * 10 property real _butttonWidth: ScreenTools.defaultFontPixelWidth * 10
LogDownloadController { QGCPalette { id: palette; colorGroupEnabled: enabled }
id: controller
Component {
id: pageComponent
RowLayout {
width: availableWidth
height: availableHeight
Connections {
target: logController
onSelectionChanged: { onSelectionChanged: {
tableView.selection.clear() tableView.selection.clear()
for(var i = 0; i < controller.model.count; i++) { for(var i = 0; i < logController.model.count; i++) {
var o = controller.model.get(i) var o = logController.model.get(i)
if (o && o.selected) { if (o && o.selected) {
tableView.selection.select(i, i) tableView.selection.select(i, i)
} }
...@@ -41,20 +49,11 @@ AnalyzePage { ...@@ -41,20 +49,11 @@ AnalyzePage {
} }
} }
QGCPalette { id: palette; colorGroupEnabled: enabled }
Component {
id: pageComponent
RowLayout {
width: availableWidth
height: availableHeight
TableView { TableView {
id: tableView id: tableView
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
model: controller.model model: logController.model
selectionMode: SelectionMode.MultiSelection selectionMode: SelectionMode.MultiSelection
Layout.fillWidth: true Layout.fillWidth: true
...@@ -65,7 +64,7 @@ AnalyzePage { ...@@ -65,7 +64,7 @@ AnalyzePage {
delegate : Text { delegate : Text {
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
text: { text: {
var o = controller.model.get(styleData.row) var o = logController.model.get(styleData.row)
return o ? o.id : "" return o ? o.id : ""
} }
} }
...@@ -77,11 +76,11 @@ AnalyzePage { ...@@ -77,11 +76,11 @@ AnalyzePage {
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
delegate : Text { delegate : Text {
text: { text: {
var o = controller.model.get(styleData.row) var o = logController.model.get(styleData.row)
if (o) { if (o) {
//-- Have we received this entry already? //-- Have we received this entry already?
if(controller.model.get(styleData.row).received) { if(logController.model.get(styleData.row).received) {
var d = controller.model.get(styleData.row).time var d = logController.model.get(styleData.row).time
if(d.getUTCFullYear() < 2010) if(d.getUTCFullYear() < 2010)
return qsTr("Date Unknown") return qsTr("Date Unknown")
else else
...@@ -100,7 +99,7 @@ AnalyzePage { ...@@ -100,7 +99,7 @@ AnalyzePage {
delegate : Text { delegate : Text {
horizontalAlignment: Text.AlignRight horizontalAlignment: Text.AlignRight
text: { text: {
var o = controller.model.get(styleData.row) var o = logController.model.get(styleData.row)
return o ? o.sizeStr : "" return o ? o.sizeStr : ""
} }
} }
...@@ -113,7 +112,7 @@ AnalyzePage { ...@@ -113,7 +112,7 @@ AnalyzePage {
delegate : Text { delegate : Text {
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
text: { text: {
var o = controller.model.get(styleData.row) var o = logController.model.get(styleData.row)
return o ? o.status : "" return o ? o.status : ""
} }
} }
...@@ -125,7 +124,7 @@ AnalyzePage { ...@@ -125,7 +124,7 @@ AnalyzePage {
Layout.alignment: Qt.AlignTop | Qt.AlignLeft Layout.alignment: Qt.AlignTop | Qt.AlignLeft
QGCButton { QGCButton {
enabled: !controller.requestingList && !controller.downloadingLogs enabled: !logController.requestingList && !logController.downloadingLogs
text: qsTr("Refresh") text: qsTr("Refresh")
width: _butttonWidth width: _butttonWidth
...@@ -133,33 +132,33 @@ AnalyzePage { ...@@ -133,33 +132,33 @@ AnalyzePage {
if (!QGroundControl.multiVehicleManager.activeVehicle || QGroundControl.multiVehicleManager.activeVehicle.isOfflineEditingVehicle) { if (!QGroundControl.multiVehicleManager.activeVehicle || QGroundControl.multiVehicleManager.activeVehicle.isOfflineEditingVehicle) {
logDownloadPage.showMessage(qsTr("Log Refresh"), qsTr("You must be connected to a vehicle in order to download logs."), StandardButton.Ok) logDownloadPage.showMessage(qsTr("Log Refresh"), qsTr("You must be connected to a vehicle in order to download logs."), StandardButton.Ok)
} else { } else {
controller.refresh() logController.refresh()
} }
} }
} }
QGCButton { QGCButton {
enabled: !controller.requestingList && !controller.downloadingLogs && tableView.selection.count > 0 enabled: !logController.requestingList && !logController.downloadingLogs && tableView.selection.count > 0
text: qsTr("Download") text: qsTr("Download")
width: _butttonWidth width: _butttonWidth
onClicked: { onClicked: {
//-- Clear selection //-- Clear selection
for(var i = 0; i < controller.model.count; i++) { for(var i = 0; i < logController.model.count; i++) {
var o = controller.model.get(i) var o = logController.model.get(i)
if (o) o.selected = false if (o) o.selected = false
} }
//-- Flag selected log files //-- Flag selected log files
tableView.selection.forEach(function(rowIndex){ tableView.selection.forEach(function(rowIndex){
var o = controller.model.get(rowIndex) var o = logController.model.get(rowIndex)
if (o) o.selected = true if (o) o.selected = true
}) })
//-- Download them //-- Download them
controller.download() logController.download()
} }
} }
QGCButton { QGCButton {
enabled: !controller.requestingList && !controller.downloadingLogs && controller.model.count > 0 enabled: !logController.requestingList && !logController.downloadingLogs && logController.model.count > 0
text: qsTr("Erase All") text: qsTr("Erase All")
width: _butttonWidth width: _butttonWidth
onClicked: logDownloadPage.showDialog(eraseAllMessage, onClicked: logDownloadPage.showDialog(eraseAllMessage,
...@@ -175,7 +174,7 @@ AnalyzePage { ...@@ -175,7 +174,7 @@ AnalyzePage {
function accept() { function accept() {
logDownloadPage.hideDialog() logDownloadPage.hideDialog()
controller.eraseAll() logController.eraseAll()
} }
} }
} }
...@@ -184,8 +183,8 @@ AnalyzePage { ...@@ -184,8 +183,8 @@ AnalyzePage {
QGCButton { QGCButton {
text: qsTr("Cancel") text: qsTr("Cancel")
width: _butttonWidth width: _butttonWidth
enabled: controller.requestingList || controller.downloadingLogs enabled: logController.requestingList || logController.downloadingLogs
onClicked: controller.cancel() onClicked: logController.cancel()
} }
} // Column - Buttons } // Column - Buttons
} // RowLayout } // RowLayout
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment