Commit f2526355 authored by Don Gagne's avatar Don Gagne

Move LogDownload to Analyze View

parent 11a86919
......@@ -54,9 +54,10 @@
<file alias="DatalinkLossLight.svg">src/AutoPilotPlugins/PX4/Images/DatalinkLossLight.svg</file>
<file alias="GeoFence.svg">src/AutoPilotPlugins/PX4/Images/GeoFence.svg</file>
<file alias="GeoFenceLight.svg">src/AutoPilotPlugins/PX4/Images/GeoFenceLight.svg</file>
<file alias="GeoTagIcon.png">src/AnalyzeView/GeoTagIcon.png</file>
<file alias="GeoTagIcon">src/AnalyzeView/GeoTagIcon.png</file>
<file alias="LandMode.svg">src/AutoPilotPlugins/PX4/Images/LandMode.svg</file>
<file alias="LandModeCopter.svg">src/AutoPilotPlugins/PX4/Images/LandModeCopter.svg</file>
<file alias="LogDownloadIcon">src/AnalyzeView/LogDownloadIcon.png</file>
<file alias="LowBattery.svg">src/AutoPilotPlugins/PX4/Images/LowBattery.svg</file>
<file alias="LowBatteryLight.svg">src/AutoPilotPlugins/PX4/Images/LowBatteryLight.svg</file>
<file alias="MotorComponentIcon.svg">src/AutoPilotPlugins/Common/Images/MotorComponentIcon.svg</file>
......
......@@ -373,6 +373,7 @@ HEADERS += \
!MobileBuild {
HEADERS += \
src/AnalyzeView/GeoTagController.h \
src/AnalyzeView/LogDownloadController.h \
src/comm/LogReplayLink.h \
src/comm/QGCFlightGearLink.h \
src/comm/QGCHilLink.h \
......@@ -422,8 +423,6 @@ HEADERS += \
src/GPS/GPSProvider.h \
src/ViewWidgets/CustomCommandWidget.h \
src/ViewWidgets/CustomCommandWidgetController.h \
src/ViewWidgets/LogDownload.h \
src/ViewWidgets/LogDownloadController.h \
src/ViewWidgets/ViewWidgetController.h \
}
......@@ -528,6 +527,7 @@ contains(DEFINES, QGC_ENABLE_BLUETOOTH) {
!MobileBuild {
SOURCES += \
src/AnalyzeView/GeoTagController.cc \
src/AnalyzeView/LogDownloadController.cc \
src/ui/uas/UASMessageView.cc \
src/uas/FileManager.cc \
src/ui/uas/QGCUnconnectedInfoWidget.cc \
......@@ -571,8 +571,6 @@ SOURCES += \
src/GPS/GPSProvider.cc \
src/ViewWidgets/CustomCommandWidget.cc \
src/ViewWidgets/CustomCommandWidgetController.cc \
src/ViewWidgets/LogDownload.cc \
src/ViewWidgets/LogDownloadController.cc \
src/ViewWidgets/ViewWidgetController.cc
}
......@@ -591,6 +589,7 @@ INCLUDEPATH += \
src/qgcunittest
HEADERS += \
src/AnalyzeView/LogDownloadTest.h \
src/FactSystem/FactSystemTestBase.h \
src/FactSystem/FactSystemTestGeneric.h \
src/FactSystem/FactSystemTestPX4.h \
......@@ -615,9 +614,9 @@ HEADERS += \
src/qgcunittest/TCPLinkTest.h \
src/qgcunittest/TCPLoopBackServer.h \
src/qgcunittest/UnitTest.h \
src/ViewWidgets/LogDownloadTest.h \
SOURCES += \
src/AnalyzeView/LogDownloadTest.cc \
src/FactSystem/FactSystemTestBase.cc \
src/FactSystem/FactSystemTestGeneric.cc \
src/FactSystem/FactSystemTestPX4.cc \
......@@ -643,7 +642,6 @@ SOURCES += \
src/qgcunittest/TCPLoopBackServer.cc \
src/qgcunittest/UnitTest.cc \
src/qgcunittest/UnitTestList.cc \
src/ViewWidgets/LogDownloadTest.cc \
} # !MobileBuild
} # DebugBuild
......
......@@ -12,7 +12,6 @@
<file alias="APMAirframeComponent.qml">src/AutoPilotPlugins/APM/APMAirframeComponent.qml</file>
<file alias="APMAirframeComponentSummary.qml">src/AutoPilotPlugins/APM/APMAirframeComponentSummary.qml</file>
<file alias="CustomCommandWidget.qml">src/ViewWidgets/CustomCommandWidget.qml</file>
<file alias="LogDownload.qml">src/ViewWidgets/LogDownload.qml</file>
<file alias="FirmwareUpgrade.qml">src/VehicleSetup/FirmwareUpgrade.qml</file>
<file alias="FlightDisplayView.qml">src/FlightDisplay/FlightDisplayView.qml</file>
<file alias="FlightDisplayViewUVC.qml">src/FlightDisplay/FlightDisplayViewUVC.qml</file>
......@@ -169,8 +168,9 @@
<file alias="VehicleSummary.qml">src/VehicleSetup/VehicleSummary.qml</file>
<file alias="QGroundControl/Controls/OfflineMapButton.qml">src/QmlControls/OfflineMapButton.qml</file>
<file alias="PX4TuningComponentVTOL.qml">src/AutoPilotPlugins/PX4/PX4TuningComponentVTOL.qml</file>
<file alias="GeoTagPage.qml">src/AnalyzeView/GeoTagPage.qml</file>
<file alias="AnalyzeView.qml">src/AnalyzeView/AnalyzeView.qml</file>
<file alias="GeoTagPage.qml">src/AnalyzeView/GeoTagPage.qml</file>
<file alias="LogDownloadPage.qml">src/AnalyzeView/LogDownloadPage.qml</file>
</qresource>
<qresource prefix="/json">
<file alias="MavCmdInfoCommon.json">src/MissionManager/MavCmdInfoCommon.json</file>
......
......@@ -29,17 +29,11 @@ Rectangle {
ExclusiveGroup { id: setupButtonGroup }
readonly property real _defaultTextHeight: ScreenTools.defaultFontPixelHeight
readonly property real _defaultTextWidth: ScreenTools.defaultFontPixelWidth
readonly property real _horizontalMargin: _defaultTextWidth / 2
readonly property real _verticalMargin: _defaultTextHeight / 2
readonly property real _buttonWidth: _defaultTextWidth * 18
function showGeoTagPanel() {
panelLoader.source = "GeoTagPage.qml"
}
Component.onCompleted: showGeoTagPanel()
readonly property real _defaultTextHeight: ScreenTools.defaultFontPixelHeight
readonly property real _defaultTextWidth: ScreenTools.defaultFontPixelWidth
readonly property real _horizontalMargin: _defaultTextWidth / 2
readonly property real _verticalMargin: _defaultTextHeight / 2
readonly property real _buttonWidth: _defaultTextWidth * 18
QGCFlickable {
id: buttonScroll
......@@ -87,15 +81,31 @@ Rectangle {
visible: !ScreenTools.isShortScreen
}
SubMenuButton {
id: summaryButton
imageResource: "/qmlimages/GeoTagIcon.png"
setupIndicator: false
checked: true
exclusiveGroup: setupButtonGroup
text: "GeoTag Images"
Repeater {
id: buttonRepeater
model: ListModel {
ListElement {
buttonImage: "/qmlimages/LogDownloadIcon"
buttonText: qsTr("Log Download")
pageSource: "LogDownloadPage.qml"
}
ListElement {
buttonImage: "/qmlimages/GeoTagIcon"
buttonText: qsTr("GeoTag Images")
pageSource: "GeoTagPage.qml"
}
}
onClicked: showGeoTagPanel()
Component.onCompleted: itemAt(0).checked = true
SubMenuButton {
imageResource: buttonImage
setupIndicator: false
exclusiveGroup: setupButtonGroup
text: buttonText
onClicked: panelLoader.source = pageSource
}
}
}
}
......@@ -122,5 +132,6 @@ Rectangle {
anchors.right: parent.right
anchors.top: parent.top
anchors.bottom: parent.bottom
source: "LogDownloadPage.qml"
}
}
......@@ -103,9 +103,8 @@ QGCLogEntry::sizeStr() const
}
//----------------------------------------------------------------------------------------
LogDownloadController::LogDownloadController(bool standaloneUnitTesting)
: FactPanelController(standaloneUnitTesting)
, _uas(NULL)
LogDownloadController::LogDownloadController(void)
: _uas(NULL)
, _downloadData(NULL)
, _vehicle(NULL)
, _requestingLogEntries(false)
......
......@@ -21,7 +21,6 @@
#include "UASInterface.h"
#include "AutoPilotPlugin.h"
#include "FactPanelController.h"
class MultiVehicleManager;
class UASInterface;
......@@ -110,13 +109,12 @@ private:
};
//-----------------------------------------------------------------------------
class LogDownloadController : public FactPanelController
class LogDownloadController : public QObject
{
Q_OBJECT
public:
/// @param standaloneUnitTesting true: being run without factPanel, false: normal operation, factPanel is required
LogDownloadController(bool standaloneUnitTesting = false);
public:
LogDownloadController(void);
Q_PROPERTY(QGCLogModel* model READ model NOTIFY modelChanged)
Q_PROPERTY(bool requestingList READ requestingList NOTIFY requestingListChanged)
......
/****************************************************************************
*
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
import QtQuick 2.5
import QtQuick.Controls 1.2
import QtQuick.Dialogs 1.2
import QtQuick.Layouts 1.2
import QGroundControl 1.0
import QGroundControl.Palette 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Controllers 1.0
import QGroundControl.ScreenTools 1.0
AnalyzePage {
id: logDownloadPage
pageComponent: pageComponent
pageName: qsTr("Log Download")
pageDescription: qsTr("Log Download allows you to download binary log files from your vehicle. Click Refresh to get list of available logs.")
property real _margin: ScreenTools.defaultFontPixelWidth
property real _butttonWidth: ScreenTools.defaultFontPixelWidth * 10
LogDownloadController {
id: controller
onSelectionChanged: {
tableView.selection.clear()
for(var i = 0; i < controller.model.count; i++) {
var o = controller.model.get(i)
if (o && o.selected) {
tableView.selection.select(i, i)
}
}
}
}
QGCPalette { id: palette; colorGroupEnabled: enabled }
Component {
id: pageComponent
RowLayout {
width: availableWidth
height: availableHeight
TableView {
id: tableView
anchors.top: parent.top
anchors.bottom: parent.bottom
model: controller.model
selectionMode: SelectionMode.MultiSelection
Layout.fillWidth: true
TableViewColumn {
title: qsTr("Id")
width: ScreenTools.defaultFontPixelWidth * 6
horizontalAlignment: Text.AlignHCenter
delegate : Text {
horizontalAlignment: Text.AlignHCenter
text: {
var o = controller.model.get(styleData.row)
return o ? o.id : ""
}
}
}
TableViewColumn {
title: qsTr("Date")
width: ScreenTools.defaultFontPixelWidth * 34
horizontalAlignment: Text.AlignHCenter
delegate : Text {
text: {
var o = controller.model.get(styleData.row)
if (o) {
//-- Have we received this entry already?
if(controller.model.get(styleData.row).received) {
var d = controller.model.get(styleData.row).time
if(d.getUTCFullYear() < 2010)
return qsTr("Date Unknown")
else
return d.toLocaleString()
}
}
return ""
}
}
}
TableViewColumn {
title: qsTr("Size")
width: ScreenTools.defaultFontPixelWidth * 18
horizontalAlignment: Text.AlignHCenter
delegate : Text {
horizontalAlignment: Text.AlignRight
text: {
var o = controller.model.get(styleData.row)
return o ? o.sizeStr : ""
}
}
}
TableViewColumn {
title: qsTr("Status")
width: ScreenTools.defaultFontPixelWidth * 22
horizontalAlignment: Text.AlignHCenter
delegate : Text {
horizontalAlignment: Text.AlignHCenter
text: {
var o = controller.model.get(styleData.row)
return o ? o.status : ""
}
}
}
}
Column {
spacing: _margin
Layout.alignment: Qt.AlignTop | Qt.AlignLeft
QGCButton {
enabled: !controller.requestingList && !controller.downloadingLogs
text: qsTr("Refresh")
width: _butttonWidth
onClicked: {
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)
} else {
controller.refresh()
}
}
}
QGCButton {
enabled: !controller.requestingList && !controller.downloadingLogs && tableView.selection.count > 0
text: qsTr("Download")
width: _butttonWidth
onClicked: {
//-- Clear selection
for(var i = 0; i < controller.model.count; i++) {
var o = controller.model.get(i)
if (o) o.selected = false
}
//-- Flag selected log files
tableView.selection.forEach(function(rowIndex){
var o = controller.model.get(rowIndex)
if (o) o.selected = true
})
//-- Download them
controller.download()
}
}
QGCButton {
enabled: !controller.requestingList && !controller.downloadingLogs && controller.model.count > 0
text: qsTr("Erase All")
width: _butttonWidth
onClicked: logDownloadPage.showDialog(eraseAllMessage,
qsTr("Delete All Log Files"),
logDownloadPage.showDialogDefaultWidth,
StandardButton.Yes | StandardButton.No)
Component {
id: eraseAllMessage
QGCViewMessage {
message: qsTr("All log files will be erased permanently. Is this really what you want?")
function accept() {
logDownloadPage.hideDialog()
controller.eraseAll()
}
}
}
}
QGCButton {
text: qsTr("Cancel")
width: _butttonWidth
enabled: controller.requestingList || controller.downloadingLogs
onClicked: controller.cancel()
}
} // Column - Buttons
} // RowLayout
} // Component
} // AnalyzePage
......@@ -23,7 +23,7 @@ void LogDownloadTest::downloadTest(void)
_connectMockLink(MAV_AUTOPILOT_PX4);
LogDownloadController* controller = new LogDownloadController(true);
LogDownloadController* controller = new LogDownloadController();
_rgLogDownloadControllerSignals[requestingListChangedSignalIndex] = SIGNAL(requestingListChanged());
_rgLogDownloadControllerSignals[downloadingLogsChangedSignalIndex] = SIGNAL(downloadingLogsChanged());
......
/****************************************************************************
*
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
#include "LogDownload.h"
LogDownload::LogDownload(const QString& title, QAction* action, QWidget *parent) :
QGCQmlWidgetHolder(title, action, parent)
{
Q_UNUSED(title);
Q_UNUSED(action);
resize(800, 600);
setSource(QUrl::fromUserInput("qrc:/qml/LogDownload.qml"));
loadSettings();
}
/****************************************************************************
*
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
#ifndef LogDownload_H
#define LogDownload_H
#include "QGCQmlWidgetHolder.h"
class LogDownload : public QGCQmlWidgetHolder
{
Q_OBJECT
public:
LogDownload(const QString& title, QAction* action, QWidget *parent = 0);
};
#endif
/****************************************************************************
*
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
import QtQuick 2.5
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2
import QtQuick.Dialogs 1.2
import QGroundControl.Palette 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Controllers 1.0
import QGroundControl.ScreenTools 1.0
QGCView {
viewPanel: panel
property real _margins: ScreenTools.defaultFontPixelHeight
property real _butttonWidth: ScreenTools.defaultFontPixelWidth * 10
LogDownloadController {
id: controller
factPanel: panel
onSelectionChanged: {
tableView.selection.clear()
for(var i = 0; i < controller.model.count; i++) {
var o = controller.model.get(i)
if (o && o.selected) {
tableView.selection.select(i, i)
}
}
}
}
QGCPalette { id: palette; colorGroupEnabled: enabled }
QGCViewPanel {
id: panel
anchors.fill: parent
TableView {
id: tableView
anchors.margins: _margins
anchors.left: parent.left
anchors.right: refreshButton.left
anchors.top: parent.top
anchors.bottom: parent.bottom
model: controller.model
selectionMode: SelectionMode.MultiSelection
TableViewColumn {
title: qsTr("Id")
width: ScreenTools.defaultFontPixelWidth * 6
horizontalAlignment: Text.AlignHCenter
delegate : Text {
horizontalAlignment: Text.AlignHCenter
text: {
var o = controller.model.get(styleData.row)
return o ? o.id : ""
}
}
}
TableViewColumn {
title: qsTr("Date")
width: ScreenTools.defaultFontPixelWidth * 34
horizontalAlignment: Text.AlignHCenter
delegate : Text {
text: {
var o = controller.model.get(styleData.row)
if (o) {
//-- Have we received this entry already?
if(controller.model.get(styleData.row).received) {
var d = controller.model.get(styleData.row).time
if(d.getUTCFullYear() < 2010)
return qsTr("Date Unknown")
else
return d.toLocaleString()
}
}
return ""
}
}
}
TableViewColumn {
title: qsTr("Size")
width: ScreenTools.defaultFontPixelWidth * 18
horizontalAlignment: Text.AlignHCenter
delegate : Text {
horizontalAlignment: Text.AlignRight
text: {
var o = controller.model.get(styleData.row)
return o ? o.sizeStr : ""
}
}
}
TableViewColumn {
title: qsTr("Status")
width: ScreenTools.defaultFontPixelWidth * 22
horizontalAlignment: Text.AlignHCenter
delegate : Text {
horizontalAlignment: Text.AlignHCenter
text: {
var o = controller.model.get(styleData.row)
return o ? o.status : ""
}
}
}
}
QGCButton {
id: refreshButton
anchors.margins: _margins
anchors.top: parent.top
anchors.right: parent.right
enabled: !controller.requestingList && !controller.downloadingLogs
text: qsTr("Refresh")
width: _butttonWidth
onClicked: {
controller.refresh()
}
}
QGCButton {
id: downloadButton
anchors.margins: _margins
anchors.top: refreshButton.bottom
anchors.right: parent.right
enabled: !controller.requestingList && !controller.downloadingLogs && tableView.selection.count > 0
text: qsTr("Download")
width: _butttonWidth
onClicked: {
//-- Clear selection
for(var i = 0; i < controller.model.count; i++) {
var o = controller.model.get(i)
if (o) o.selected = false
}
//-- Flag selected log files
tableView.selection.forEach(function(rowIndex){
var o = controller.model.get(rowIndex)
if (o) o.selected = true
})
//-- Download them
controller.download()
}
}
QGCButton {
id: eraseAllButton
anchors.margins: _margins
anchors.top: downloadButton.bottom
anchors.right: parent.right
enabled: !controller.requestingList && !controller.downloadingLogs && controller.model.count > 0
text: qsTr("Erase All")
width: _butttonWidth
onClicked: {
eraseAllDialog.visible = true
}
MessageDialog {
id: eraseAllDialog
visible: false
icon: StandardIcon.Warning
standardButtons: StandardButton.Yes | StandardButton.No
title: qsTr("Delete All Log Files")
text: qsTr("All log files will be erased permanently. Is this really what you want?")
onYes: {
controller.eraseAll()
eraseAllDialog.visible = false
}
onNo: {
eraseAllDialog.visible = false
}
}
}
QGCButton {
id: cancelButton
anchors.margins: _margins
anchors.top: eraseAllButton.bottom
anchors.right: parent.right
text: qsTr("Cancel")
width: _butttonWidth
enabled: controller.requestingList || controller.downloadingLogs
onClicked: {
controller.cancel()
}
}
}
}
......@@ -51,7 +51,6 @@
#include "CustomCommandWidget.h"
#include "QGCDockWidget.h"
#include "HILDockWidget.h"
#include "LogDownload.h"
#include "AppMessages.h"
#endif
......@@ -73,8 +72,7 @@ enum DockWidgetTypes {
ONBOARD_FILES,
INFO_VIEW,
HIL_CONFIG,
ANALYZE,
LOG_DOWNLOAD
ANALYZE
};
static const char *rgDockWidgetNames[] = {
......@@ -83,8 +81,7 @@ static const char *rgDockWidgetNames[] = {
"Onboard Files",
"Info View",
"HIL Config",
"Analyze",
"Log Download"
"Analyze"
};
#define ARRAY_SIZE(ARRAY) (sizeof(ARRAY) / sizeof(ARRAY[0]))
......@@ -352,9 +349,6 @@ bool MainWindow::_createInnerDockWidget(const QString& widgetName)
case ONBOARD_FILES:
widget = new QGCUASFileViewMulti(widgetName, action, this);
break;
case LOG_DOWNLOAD:
widget = new LogDownload(widgetName, action, this);
break;
case HIL_CONFIG:
widget = new HILDockWidget(widgetName, action, this);
break;
......
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