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