QGCToolBar.h 3.58 KB
Newer Older
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
/*=====================================================================

QGroundControl Open Source Ground Control Station

(c) 2009 - 2011 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 QGCTOOLBAR_H
#define QGCTOOLBAR_H

#include <QToolBar>
#include <QAction>
#include <QToolButton>
#include <QLabel>
LM's avatar
LM committed
31
#include <QProgressBar>
32
#include "UASInterface.h"
lm's avatar
lm committed
33
#include "QGCMAVLinkLogPlayer.h"
34 35 36 37 38 39

class QGCToolBar : public QToolBar
{
    Q_OBJECT

public:
lm's avatar
lm committed
40
    explicit QGCToolBar(QWidget* parent = 0);
41 42 43 44 45 46 47 48 49 50 51 52 53 54
    void addPerspectiveChangeAction(QAction* action);
    ~QGCToolBar();

public slots:
    /** @brief Set the system that is currently displayed by this widget */
    void setActiveUAS(UASInterface* active);
    /** @brief Set the system state */
    void updateState(UASInterface* system, QString name, QString description);
    /** @brief Set the system mode */
    void updateMode(int system, QString name, QString description);
    /** @brief Update the system name */
    void updateName(const QString& name);
    /** @brief Set the MAV system type */
    void setSystemType(UASInterface* uas, unsigned int systemType);
LM's avatar
LM committed
55 56
    /** @brief Received system text message */
    void receiveTextMessage(int uasid, int componentid, int severity, QString text);
lm's avatar
lm committed
57
    /** @brief Start / stop logging */
58
    void logging(bool checked);
59
    /** @brief Start playing logfile */
60
    void playLogFile(bool checked);
lm's avatar
lm committed
61 62
    /** @brief Set log playing component */
    void setLogPlayer(QGCMAVLinkLogPlayer* player);
LM's avatar
LM committed
63 64
    /** @brief Update battery charge state */
    void updateBatteryRemaining(UASInterface* uas, double voltage, double percent, int seconds);
65 66 67 68
    /** @brief Update current waypoint */
    void updateCurrentWaypoint(quint16 id);
    /** @brief Update distance to current waypoint */
    void updateWaypointDistance(double distance);
69 70
    /** @brief Update arming state */
    void updateArmingState(bool armed);
lm's avatar
lm committed
71 72
    /** @brief Repaint widgets */
    void updateView();
73 74
    /** @brief Update connection timeout time */
    void heartbeatTimeout(bool timeout, unsigned int ms);
75 76 77 78 79 80 81 82

protected:
    void createCustomWidgets();

    QAction* toggleLoggingAction;
    QAction* logReplayAction;
    UASInterface* mav;
    QToolButton* symbolButton;
LM's avatar
LM committed
83
    QLabel* toolBarNameLabel;
84
    QLabel* toolBarTimeoutLabel;
85
    QLabel* toolBarSafetyLabel;
LM's avatar
LM committed
86 87 88 89 90 91
    QLabel* toolBarModeLabel;
    QLabel* toolBarStateLabel;
    QLabel* toolBarWpLabel;
    QLabel* toolBarDistLabel;
    QLabel* toolBarMessageLabel;
    QProgressBar* toolBarBatteryBar;
92
    QLabel* toolBarBatteryVoltageLabel;
93
    QGCMAVLinkLogPlayer* player;
lm's avatar
lm committed
94 95 96 97 98 99 100 101 102 103
    bool changed;
    float batteryPercent;
    float batteryVoltage;
    int wpId;
    double wpDistance;
    QString state;
    QString mode;
    QString systemName;
    QString lastSystemMessage;
    QTimer updateViewTimer;
104
    bool systemArmed;
105 106 107
};

#endif // QGCTOOLBAR_H