Skip to content
Snippets Groups Projects
QGCToolBar.h 4.35 KiB
Newer Older
  • Learn to ignore specific revisions
  • /*=====================================================================
    
    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 <QPushButton>
    
    LM's avatar
    LM committed
    #include <QProgressBar>
    
    #include "UASInterface.h"
    
    lm's avatar
    lm committed
    #include "QGCMAVLinkLogPlayer.h"
    
    
    class QGCToolBar : public QToolBar
    {
        Q_OBJECT
    
    public:
    
    lm's avatar
    lm committed
        explicit QGCToolBar(QWidget* parent = 0);
    
    Lorenz Meier's avatar
    Lorenz Meier committed
        void setPerspectiveChangeActions(const QList<QAction*> &action);
    
        void setPerspectiveChangeAdvancedActions(const QList<QAction*> &action);
    
        ~QGCToolBar();
    
    public slots:
        /** @brief Set the system that is currently displayed by this widget */
        void setActiveUAS(UASInterface* active);
    
        /** @brief Set the link which is currently handled with connecting / disconnecting */
        void addLink(LinkInterface* link);
        /** @brief Remove link which is currently handled */
        void removeLink(LinkInterface* link);
        /** @brief Update the link state */
        void updateLinkState(bool connected);
    
        /** @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
        /** @brief Received system text message */
        void receiveTextMessage(int uasid, int componentid, int severity, QString text);
    
    LM's avatar
    LM committed
        /** @brief Update battery charge state */
    
    dongfang's avatar
    dongfang committed
        void updateBatteryRemaining(UASInterface* uas, double voltage, double current, double percent, int seconds);
    
        /** @brief Update current waypoint */
        void updateCurrentWaypoint(quint16 id);
        /** @brief Update distance to current waypoint */
        void updateWaypointDistance(double distance);
    
        /** @brief Update arming state */
        void updateArmingState(bool armed);
    
    lm's avatar
    lm committed
        /** @brief Repaint widgets */
        void updateView();
    
        /** @brief Update connection timeout time */
        void heartbeatTimeout(bool timeout, unsigned int ms);
    
        /** @brief Update global position */
        void globalPositionChanged(UASInterface* uas, double lat, double lon, double alt, quint64 usec);
    
        /** @brief Create or connect link */
        void connectLink(bool connect);
    
        /** @brief Clear status string */
        void clearStatusString();
    
        /** @brief Set an activity action as checked in menu */
        void advancedActivityTriggered(QAction* action);
    
        void storeSettings();
        void loadSettings();
    
    LM's avatar
    LM committed
        QLabel* toolBarNameLabel;
    
        QLabel* toolBarSafetyLabel;
    
    LM's avatar
    LM committed
        QLabel* toolBarModeLabel;
        QLabel* toolBarStateLabel;
        QLabel* toolBarWpLabel;
        QLabel* toolBarDistLabel;
        QLabel* toolBarMessageLabel;
    
        QPushButton* connectButton;
    
    LM's avatar
    LM committed
        QProgressBar* toolBarBatteryBar;
    
        QLabel* toolBarBatteryVoltageLabel;
    
    lm's avatar
    lm committed
        bool changed;
        float batteryPercent;
        float batteryVoltage;
        int wpId;
        double wpDistance;
    
        float altitudeMSL;
        float altitudeRel;
    
    lm's avatar
    lm committed
        QString state;
        QString mode;
        QString systemName;
        QString lastSystemMessage;
    
        quint64 lastSystemMessageTimeMs;
    
    lm's avatar
    lm committed
        QTimer updateViewTimer;
    
        LinkInterface* currentLink;
    
        QButtonGroup *group;