Commit 0de02e58 authored by Gus Grubba's avatar Gus Grubba Committed by Lorenz Meier

WIP - MAVLink chart as a control. Add any number of charts with any number of...

WIP - MAVLink chart as a control. Add any number of charts with any number of series. All individually controlled.
parent 6c4f6de7
...@@ -302,12 +302,12 @@ AnalyzePage { ...@@ -302,12 +302,12 @@ AnalyzePage {
delegate: QGCCheckBox { delegate: QGCCheckBox {
Layout.row: index Layout.row: index
Layout.column: 3 Layout.column: 3
enabled: (object.series !== null && object.left) || (object.selectable && controller.seriesCount < 12) enabled: (object.series !== null) || (object.selectable)
checked: enabled ? (object.series !== null && object.left) : false checked: enabled ? (object.series !== null) : false
onClicked: { onClicked: {
if(enabled) { if(enabled) {
if(checked) { if(checked) {
chart1.addDimension(object, true) chart1.addDimension(object)
} else { } else {
chart1.delDimension(object) chart1.delDimension(object)
} }
...@@ -320,12 +320,12 @@ AnalyzePage { ...@@ -320,12 +320,12 @@ AnalyzePage {
delegate: QGCCheckBox { delegate: QGCCheckBox {
Layout.row: index Layout.row: index
Layout.column: 4 Layout.column: 4
enabled: (object.series !== null && !object.left) || (object.selectable && controller.seriesCount < 12 && (object.series === null && !object.left)) enabled: (object.series !== null) || (object.selectable)
checked: enabled ? (object.series !== null && !object.left) : false checked: enabled ? (object.series !== null) : false
onClicked: { onClicked: {
if(enabled) { if(enabled) {
if(checked) { if(checked) {
chart2.addDimension(object, false) chart2.addDimension(object)
} else { } else {
chart2.delDimension(object) chart2.delDimension(object)
} }
...@@ -338,17 +338,11 @@ AnalyzePage { ...@@ -338,17 +338,11 @@ AnalyzePage {
MAVLinkChart { MAVLinkChart {
id: chart1 id: chart1
height: ScreenTools.defaultFontPixelHeight * 20 height: ScreenTools.defaultFontPixelHeight * 20
visible: controller.leftChartFields.length > 0
min: controller.leftRangeMin
max: controller.leftRangeMax
Layout.fillWidth: true Layout.fillWidth: true
} }
MAVLinkChart { MAVLinkChart {
id: chart2 id: chart2
height: ScreenTools.defaultFontPixelHeight * 20 height: ScreenTools.defaultFontPixelHeight * 20
visible: controller.rightChartFields.length > 0
min: controller.rightRangeMin
max: controller.rightRangeMax
Layout.fillWidth: true Layout.fillWidth: true
} }
} }
......
...@@ -92,7 +92,6 @@ ...@@ -92,7 +92,6 @@
#include "QGCFileDownload.h" #include "QGCFileDownload.h"
#include "FirmwareImage.h" #include "FirmwareImage.h"
#include "MavlinkConsoleController.h" #include "MavlinkConsoleController.h"
#include "MAVLinkInspectorController.h"
#include "GeoTagController.h" #include "GeoTagController.h"
#include "LogReplayLink.h" #include "LogReplayLink.h"
#include "VehicleObjectAvoidance.h" #include "VehicleObjectAvoidance.h"
...@@ -502,6 +501,7 @@ void QGCApplication::_initCommon() ...@@ -502,6 +501,7 @@ void QGCApplication::_initCommon()
qmlRegisterUncreatableType<CameraCalc> (kQGroundControl, 1, 0, "CameraCalc", kRefOnly); qmlRegisterUncreatableType<CameraCalc> (kQGroundControl, 1, 0, "CameraCalc", kRefOnly);
qmlRegisterUncreatableType<LogReplayLink> (kQGroundControl, 1, 0, "LogReplayLink", kRefOnly); qmlRegisterUncreatableType<LogReplayLink> (kQGroundControl, 1, 0, "LogReplayLink", kRefOnly);
qmlRegisterType<LogReplayLinkController> (kQGroundControl, 1, 0, "LogReplayLinkController"); qmlRegisterType<LogReplayLinkController> (kQGroundControl, 1, 0, "LogReplayLinkController");
qmlRegisterUncreatableType<MAVLinkChartController> (kQGroundControl, 1, 0, "MAVLinkChart", kRefOnly);
#if defined(QGC_ENABLE_PAIRING) #if defined(QGC_ENABLE_PAIRING)
qmlRegisterUncreatableType<PairingManager> (kQGroundControl, 1, 0, "PairingManager", kRefOnly); qmlRegisterUncreatableType<PairingManager> (kQGroundControl, 1, 0, "PairingManager", kRefOnly);
#endif #endif
...@@ -528,7 +528,6 @@ void QGCApplication::_initCommon() ...@@ -528,7 +528,6 @@ void QGCApplication::_initCommon()
qmlRegisterType<RCChannelMonitorController> (kQGCControllers, 1, 0, "RCChannelMonitorController"); qmlRegisterType<RCChannelMonitorController> (kQGCControllers, 1, 0, "RCChannelMonitorController");
qmlRegisterType<JoystickConfigController> (kQGCControllers, 1, 0, "JoystickConfigController"); qmlRegisterType<JoystickConfigController> (kQGCControllers, 1, 0, "JoystickConfigController");
qmlRegisterType<LogDownloadController> (kQGCControllers, 1, 0, "LogDownloadController"); qmlRegisterType<LogDownloadController> (kQGCControllers, 1, 0, "LogDownloadController");
qmlRegisterType<MAVLinkInspectorController> (kQGCControllers, 1, 0, "MAVLinkInspectorController");
qmlRegisterType<SyslinkComponentController> (kQGCControllers, 1, 0, "SyslinkComponentController"); qmlRegisterType<SyslinkComponentController> (kQGCControllers, 1, 0, "SyslinkComponentController");
qmlRegisterType<EditPositionDialogController> (kQGCControllers, 1, 0, "EditPositionDialogController"); qmlRegisterType<EditPositionDialogController> (kQGCControllers, 1, 0, "EditPositionDialogController");
...@@ -617,21 +616,18 @@ QGCApplication* qgcApp(void) ...@@ -617,21 +616,18 @@ QGCApplication* qgcApp(void)
return QGCApplication::_app; return QGCApplication::_app;
} }
void QGCApplication::informationMessageBoxOnMainThread(const QString& title, const QString& msg) void QGCApplication::informationMessageBoxOnMainThread(const QString& /*title*/, const QString& msg)
{ {
Q_UNUSED(title);
showMessage(msg); showMessage(msg);
} }
void QGCApplication::warningMessageBoxOnMainThread(const QString& title, const QString& msg) void QGCApplication::warningMessageBoxOnMainThread(const QString& /*title*/, const QString& msg)
{ {
Q_UNUSED(title)
showMessage(msg); showMessage(msg);
} }
void QGCApplication::criticalMessageBoxOnMainThread(const QString& title, const QString& msg) void QGCApplication::criticalMessageBoxOnMainThread(const QString& /*title*/, const QString& msg)
{ {
Q_UNUSED(title)
showMessage(msg); showMessage(msg);
} }
...@@ -670,12 +666,11 @@ void QGCApplication::checkTelemetrySavePathOnMainThread() ...@@ -670,12 +666,11 @@ void QGCApplication::checkTelemetrySavePathOnMainThread()
_checkTelemetrySavePath(false /* useMessageBox */); _checkTelemetrySavePath(false /* useMessageBox */);
} }
bool QGCApplication::_checkTelemetrySavePath(bool useMessageBox) bool QGCApplication::_checkTelemetrySavePath(bool /*useMessageBox*/)
{ {
QString saveDirPath = _toolbox->settingsManager()->appSettings()->telemetrySavePath(); QString saveDirPath = _toolbox->settingsManager()->appSettings()->telemetrySavePath();
if (saveDirPath.isEmpty()) { if (saveDirPath.isEmpty()) {
QString error = tr("Unable to save telemetry log. Application save directory is not set."); QString error = tr("Unable to save telemetry log. Application save directory is not set.");
Q_UNUSED(useMessageBox);
showMessage(error); showMessage(error);
return false; return false;
} }
...@@ -793,10 +788,8 @@ void QGCApplication::_checkForNewVersion() ...@@ -793,10 +788,8 @@ void QGCApplication::_checkForNewVersion()
#endif #endif
} }
void QGCApplication::_currentVersionDownloadFinished(QString remoteFile, QString localFile) void QGCApplication::_currentVersionDownloadFinished(QString /*remoteFile*/, QString localFile)
{ {
Q_UNUSED(remoteFile);
#ifdef __mobile__ #ifdef __mobile__
Q_UNUSED(localFile); Q_UNUSED(localFile);
#else #else
...@@ -822,9 +815,8 @@ void QGCApplication::_currentVersionDownloadFinished(QString remoteFile, QString ...@@ -822,9 +815,8 @@ void QGCApplication::_currentVersionDownloadFinished(QString remoteFile, QString
#endif #endif
} }
void QGCApplication::_currentVersionDownloadError(QString errorMsg) void QGCApplication::_currentVersionDownloadError(QString /*errorMsg*/)
{ {
Q_UNUSED(errorMsg);
_currentVersionDownload->deleteLater(); _currentVersionDownload->deleteLater();
} }
......
...@@ -20,12 +20,14 @@ ChartView { ...@@ -20,12 +20,14 @@ ChartView {
margins.bottom: ScreenTools.defaultFontPixelHeight * 1.5 margins.bottom: ScreenTools.defaultFontPixelHeight * 1.5
margins.top: chartHeader.height + (ScreenTools.defaultFontPixelHeight * 2) margins.top: chartHeader.height + (ScreenTools.defaultFontPixelHeight * 2)
property var chartController: null
property int maxSeriesCount: seriesColors.length property int maxSeriesCount: seriesColors.length
property var seriesColors: ["chartreuse", "chocolate", "yellowgreen", "thistle", "silver", "darkturquoise", "blue", "green"] property var seriesColors: ["chartreuse", "chocolate", "yellowgreen", "thistle", "silver", "darkturquoise", "blue", "green"]
property alias max: axisY.max
property alias min: axisY.min
function addDimension(field, left) { function addDimension(field) {
if(!chartController) {
chartController = controller.createChart()
}
console.log(field.name + ' AxisY: ' + axisY) console.log(field.name + ' AxisY: ' + axisY)
console.log(chartView.count + ' ' + chartView.seriesColors[chartView.count]) console.log(chartView.count + ' ' + chartView.seriesColors[chartView.count])
var serie = createSeries(ChartView.SeriesTypeLine, field.label) var serie = createSeries(ChartView.SeriesTypeLine, field.label)
...@@ -34,19 +36,25 @@ ChartView { ...@@ -34,19 +36,25 @@ ChartView {
serie.useOpenGL = true serie.useOpenGL = true
serie.color = chartView.seriesColors[chartView.count] serie.color = chartView.seriesColors[chartView.count]
serie.width = 1 serie.width = 1
controller.addSeries(field, serie, left) chartController.addSeries(field, serie)
} }
function delDimension(field) { function delDimension(field) {
if(chartController) {
chartView.removeSeries(field.series) chartView.removeSeries(field.series)
controller.delSeries(field) chartController.delSeries(field)
console.log('Remove: ' + chartView.count + ' ' + field.name) console.log('Remove: ' + chartView.count + ' ' + field.name)
if(chartView.count === 0) {
controller.deleteChart(chartController)
chartController = null
}
}
} }
DateTimeAxis { DateTimeAxis {
id: axisX id: axisX
min: controller.rangeXMin min: chartController ? chartController.rangeXMin : 0
max: controller.rangeXMax max: chartController ? chartController.rangeXMax : 0
format: "mm:ss.zzz" format: "mm:ss.zzz"
tickCount: 5 tickCount: 5
gridVisible: true gridVisible: true
...@@ -56,6 +64,8 @@ ChartView { ...@@ -56,6 +64,8 @@ ChartView {
ValueAxis { ValueAxis {
id: axisY id: axisY
min: chartController ? chartController.rangeYMin : 0
max: chartController ? chartController.rangeYMax : 0
lineVisible: false lineVisible: false
labelsFont.family: "Fixed" labelsFont.family: "Fixed"
labelsFont.pixelSize: ScreenTools.smallFontPointSize labelsFont.pixelSize: ScreenTools.smallFontPointSize
...@@ -69,53 +79,36 @@ ChartView { ...@@ -69,53 +79,36 @@ ChartView {
anchors.rightMargin: ScreenTools.defaultFontPixelWidth * 4 anchors.rightMargin: ScreenTools.defaultFontPixelWidth * 4
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: ScreenTools.defaultFontPixelHeight * 1.5 anchors.topMargin: ScreenTools.defaultFontPixelHeight * 1.5
spacing: 0
QGCLabel {
text: qsTr("Scale:");
font.pixelSize: ScreenTools.smallFontPointSize
Layout.alignment: Qt.AlignVCenter
}
QGCComboBox {
id: timeScaleSelector
width: ScreenTools.defaultFontPixelWidth * 10
height: ScreenTools.defaultFontPixelHeight
model: controller.timeScales
currentIndex: controller.timeScale
onActivated: controller.timeScale = index
font.pixelSize: ScreenTools.smallFontPointSize
Layout.alignment: Qt.AlignVCenter
}
GridLayout { GridLayout {
columns: 2 columns: 2
columnSpacing: ScreenTools.defaultFontPixelWidth columnSpacing: ScreenTools.defaultFontPixelWidth
rowSpacing: ScreenTools.defaultFontPixelHeight * 0.25 rowSpacing: ScreenTools.defaultFontPixelHeight * 0.25
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
Layout.fillWidth: true
QGCLabel { QGCLabel {
text: qsTr("Range Left:"); text: qsTr("Scale:");
font.pixelSize: ScreenTools.smallFontPointSize font.pixelSize: ScreenTools.smallFontPointSize
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
} }
QGCComboBox { QGCComboBox {
Layout.minimumWidth: ScreenTools.defaultFontPixelWidth * 8 Layout.minimumWidth: ScreenTools.defaultFontPixelWidth * 10
height: ScreenTools.defaultFontPixelHeight * 1.5 height: ScreenTools.defaultFontPixelHeight
model: controller.rangeList model: controller.timeScales
currentIndex: controller.leftRangeIdx currentIndex: chartController ? chartController.rangeXIndex : 0
onActivated: controller.leftRangeIdx = index onActivated: { if(chartController) chartController.rangeXIndex = index; }
font.pixelSize: ScreenTools.smallFontPointSize font.pixelSize: ScreenTools.smallFontPointSize
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
} }
QGCLabel { QGCLabel {
text: qsTr("Range Right:"); text: qsTr("Range:");
font.pixelSize: ScreenTools.smallFontPointSize font.pixelSize: ScreenTools.smallFontPointSize
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
} }
QGCComboBox { QGCComboBox {
Layout.minimumWidth: ScreenTools.defaultFontPixelWidth * 8 Layout.minimumWidth: ScreenTools.defaultFontPixelWidth * 10
height: ScreenTools.defaultFontPixelHeight * 1.5 height: ScreenTools.defaultFontPixelHeight
model: controller.rangeList model: controller.rangeList
currentIndex: controller.rightRangeIdx currentIndex: chartController ? chartController.rangeYIndex : 0
onActivated: controller.rightRangeIdx = index onActivated: { if(chartController) chartController.rangeYIndex = index; }
font.pixelSize: ScreenTools.smallFontPointSize font.pixelSize: ScreenTools.smallFontPointSize
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
} }
......
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