MissionEditor.h 2.67 KB
Newer Older
Don Gagne's avatar
Don Gagne committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
/*=====================================================================

QGroundControl Open Source Ground Control Station

(c) 2009, 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>

This file is part of the QGROUNDCONTROL project

    QGROUNDCONTROL is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    QGROUNDCONTROL is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.

======================================================================*/

#ifndef MissionEditor_H
#define MissionEditor_H

#include "QGCQmlWidgetHolder.h"
#include "QmlObjectListModel.h"

class MissionEditor : public QGCQmlWidgetHolder
{
    Q_OBJECT
    
public:
    MissionEditor(QWidget* parent = NULL);
    ~MissionEditor();

38 39
    Q_PROPERTY(QmlObjectListModel*  missionItems    READ missionItems       NOTIFY missionItemsChanged)
    Q_PROPERTY(QmlObjectListModel*  waypointLines   READ waypointLines      NOTIFY waypointLinesChanged)
Don Gagne's avatar
Don Gagne committed
40
    Q_PROPERTY(bool                 canEdit         READ canEdit            NOTIFY canEditChanged)
Don Gagne's avatar
Don Gagne committed
41
    
42
    Q_INVOKABLE int addMissionItem(QGeoCoordinate coordinate);
Don Gagne's avatar
Don Gagne committed
43 44
    Q_INVOKABLE void getMissionItems(void);
    Q_INVOKABLE void setMissionItems(void);
Don Gagne's avatar
Don Gagne committed
45 46
    Q_INVOKABLE void loadMissionFromFile(void);
    Q_INVOKABLE void saveMissionToFile(void);
47 48 49
    Q_INVOKABLE void removeMissionItem(int index);
    Q_INVOKABLE void moveUp(int index);
    Q_INVOKABLE void moveDown(int index);
Don Gagne's avatar
Don Gagne committed
50 51 52

    // Property accessors
    
53 54
    QmlObjectListModel* missionItems(void) { return _missionItems; }
    QmlObjectListModel* waypointLines(void) { return &_waypointLines; }
Don Gagne's avatar
Don Gagne committed
55
    bool canEdit(void) { return _canEdit; }
Don Gagne's avatar
Don Gagne committed
56 57 58
    
signals:
    void missionItemsChanged(void);
Don Gagne's avatar
Don Gagne committed
59
    void canEditChanged(bool canEdit);
60
    void waypointLinesChanged(void);
Don Gagne's avatar
Don Gagne committed
61 62 63
    
private slots:
    void _newMissionItemsAvailable();
64
    void _missionListDirtyChanged(bool dirty);
Don Gagne's avatar
Don Gagne committed
65
    
66 67
private:
    void _reSequence(void);
68 69
    void _rebuildWaypointLines(void);
   
Don Gagne's avatar
Don Gagne committed
70
private:
Don Gagne's avatar
Don Gagne committed
71
    QmlObjectListModel* _missionItems;
72
    QmlObjectListModel  _waypointLines;
Don Gagne's avatar
Don Gagne committed
73
    bool                _canEdit;           ///< true: UI can edit these items, false: can't edit, can only send to vehicle or save
Don Gagne's avatar
Don Gagne committed
74 75 76 77 78
    
    static const char* _settingsGroup;
};

#endif