QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
VehicleComponent.h
Go to the documentation of this file.
1#pragma once
2
3#include <QtCore/QLoggingCategory>
4#include <QtCore/QObject>
5#include <QtCore/QStringList>
6#include <QtCore/QUrl>
7#include <QtCore/QVariant>
8#include <QtQmlIntegration/QtQmlIntegration>
9
10#include "AutoPilotPlugin.h"
11
12class Vehicle;
13class QQuickItem;
14class QQmlContext;
15
16Q_DECLARE_LOGGING_CATEGORY(VehicleComponentLog)
17
18
20class VehicleComponent : public QObject
21{
22 Q_OBJECT
23 QML_ELEMENT
24 QML_UNCREATABLE("")
25 Q_PROPERTY(QString name READ name CONSTANT)
26 Q_PROPERTY(QString description READ description CONSTANT)
27 Q_PROPERTY(bool requiresSetup READ requiresSetup CONSTANT)
28 Q_PROPERTY(bool setupComplete READ setupComplete STORED false NOTIFY setupCompleteChanged)
29 Q_PROPERTY(QString iconResource READ iconResource CONSTANT)
30 Q_PROPERTY(QUrl setupSource READ setupSource NOTIFY setupSourceChanged)
31 Q_PROPERTY(QUrl summaryQmlSource READ summaryQmlSource CONSTANT)
32 Q_PROPERTY(bool allowSetupWhileArmed READ allowSetupWhileArmed CONSTANT)
33 Q_PROPERTY(bool allowSetupWhileFlying READ allowSetupWhileFlying CONSTANT)
34 Q_PROPERTY(AutoPilotPlugin::KnownVehicleComponent KnownVehicleComponent READ KnownVehicleComponent CONSTANT)
35
36public:
37 explicit VehicleComponent(Vehicle *vehicle, AutoPilotPlugin *autopilot, AutoPilotPlugin::KnownVehicleComponent KnownVehicleComponent, QObject *parent = nullptr);
38 virtual ~VehicleComponent();
39
40 virtual QString name() const = 0;
41 virtual QString description() const { return QString(); }
42 virtual QString iconResource() const = 0;
43 virtual bool requiresSetup() const = 0;
44 virtual bool setupComplete() const = 0;
45 virtual QUrl setupSource() const = 0;
46 virtual QUrl summaryQmlSource() const = 0;
47
48 // @return true: Setup panel can be shown while vehicle is armed
49 virtual bool allowSetupWhileArmed() const { return false; }
50
51 // @return true: Setup panel can be shown while vehicle is flying (and armed)
52 virtual bool allowSetupWhileFlying() const { return false; }
53
54 virtual void addSummaryQmlComponent(QQmlContext* context, QQuickItem* parent);
55
58 virtual QStringList setupCompleteChangedTriggerList() const = 0;
59
62 virtual void setupTriggerSignals();
63
64 AutoPilotPlugin::KnownVehicleComponent KnownVehicleComponent() const { return _KnownVehicleComponent; }
65
66signals:
69
70protected slots:
71 void _triggerUpdated(QVariant /*value*/) { emit setupCompleteChanged(); }
72
73protected:
74 Vehicle *_vehicle = nullptr;
75 AutoPilotPlugin *_autopilot = nullptr;
76 AutoPilotPlugin::KnownVehicleComponent _KnownVehicleComponent;
77};
Q_DECLARE_LOGGING_CATEGORY(AndroidSerialLog)
void setupCompleteChanged()
void _triggerUpdated(QVariant)
void setupSourceChanged()
AutoPilotPlugin::KnownVehicleComponent _KnownVehicleComponent