/**************************************************************************** * * (c) 2009-2016 QGROUNDCONTROL PROJECT * * QGroundControl is licensed according to the terms in the file * COPYING.md in the root of the source code directory. * ****************************************************************************/ #ifndef PlanElementController_H #define PlanElementController_H #include #include "Vehicle.h" #include "MultiVehicleManager.h" /// This is the abstract base clas for Plan Element controllers. /// Examples of plan elements are: missions (MissionController), geofence (GeoFenceController) class PlanElementController : public QObject { Q_OBJECT public: PlanElementController(QObject* parent = NULL); ~PlanElementController(); /// true: information is currently being saved/sent, false: no active save/send in progress Q_PROPERTY(bool syncInProgress READ syncInProgress NOTIFY syncInProgressChanged) /// true: unsaved/sent changes are present, false: no changes since last save/send Q_PROPERTY(bool dirty READ dirty WRITE setDirty NOTIFY dirtyChanged) /// Should be called immediately upon Component.onCompleted. /// @param editMode true: controller being used in Plan view, false: controller being used in Fly view Q_INVOKABLE virtual void start(bool editMode); Q_INVOKABLE virtual void loadFromVehicle(void) = 0; Q_INVOKABLE virtual void sendToVehicle(void) = 0; Q_INVOKABLE virtual void loadFromFilePicker(void) = 0; Q_INVOKABLE virtual void loadFromFile(const QString& filename) = 0; Q_INVOKABLE virtual void saveToFilePicker(void) = 0; Q_INVOKABLE virtual void saveToFile(const QString& filename) = 0; Q_INVOKABLE virtual void removeAll(void) = 0; virtual bool syncInProgress (void) const = 0; virtual bool dirty (void) const = 0; virtual void setDirty (bool dirty) = 0; signals: void syncInProgressChanged (bool syncInProgress); void dirtyChanged (bool dirty); protected: Vehicle* _activeVehicle; MultiVehicleManager* _multiVehicleMgr; bool _editMode; /// Called when the current active vehicle has been removed. Derived classes should override /// to implement custom behavior. When this is called _activeVehicle has already been cleared. virtual void _activeVehicleBeingRemoved(Vehicle* removedVehicle) = 0; /// Called when a new active vehicle has been set. Derived classes should override /// to implement custom behavior. virtual void _activeVehicleSet(void) = 0; private slots: void _activeVehicleChanged(Vehicle* activeVehicle); }; #endif