mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-23 08:52:10 +01:00
44176370de
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@503 ebee16cc-31ac-478f-84a7-5cbb03baadba
97 lines
3.2 KiB
C++
97 lines
3.2 KiB
C++
/**
|
|
******************************************************************************
|
|
*
|
|
* @file uavobjecttreemodel.h
|
|
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
|
* @brief
|
|
* @see The GNU Public License (GPL) Version 3
|
|
* @defgroup uavobjectbrowser
|
|
* @{
|
|
*
|
|
*****************************************************************************/
|
|
/*
|
|
* This program 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.
|
|
*
|
|
* This program 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 this program; if not, write to the Free Software Foundation, Inc.,
|
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
*/
|
|
|
|
#ifndef UAVOBJECTTREEMODEL_H
|
|
#define UAVOBJECTTREEMODEL_H
|
|
|
|
#include <QAbstractItemModel>
|
|
#include <QtCore/QMap>
|
|
#include <QtGui/QColor>
|
|
|
|
class TreeItem;
|
|
class TopTreeItem;
|
|
class ObjectTreeItem;
|
|
class DataObjectTreeItem;
|
|
class UAVObject;
|
|
class UAVDataObject;
|
|
class UAVMetaObject;
|
|
class UAVObjectField;
|
|
class UAVObjectManager;
|
|
class QSignalMapper;
|
|
class QTimer;
|
|
|
|
class UAVObjectTreeModel : public QAbstractItemModel
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit UAVObjectTreeModel(QObject *parent = 0);
|
|
~UAVObjectTreeModel();
|
|
|
|
QVariant data(const QModelIndex &index, int role) const;
|
|
bool setData(const QModelIndex &index, const QVariant & value, int role);
|
|
Qt::ItemFlags flags(const QModelIndex &index) const;
|
|
QVariant headerData(int section, Qt::Orientation orientation,
|
|
int role = Qt::DisplayRole) const;
|
|
QModelIndex index(int row, int column,
|
|
const QModelIndex &parent = QModelIndex()) const;
|
|
QModelIndex parent(const QModelIndex &index) const;
|
|
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
|
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
|
|
|
|
|
signals:
|
|
|
|
public slots:
|
|
void newObject(UAVObject *obj);
|
|
|
|
private slots:
|
|
void highlightUpdatedObject(UAVObject *obj);
|
|
void removeHighlight(TreeItem*);
|
|
|
|
private:
|
|
QModelIndex index(TreeItem *item);
|
|
void addDataObject(UAVDataObject *obj);
|
|
void addMetaObject(UAVMetaObject *obj, TreeItem *parent);
|
|
void addArrayField(UAVObjectField *field, TreeItem *parent);
|
|
|
|
void addSingleField(int index, UAVObjectField *field, TreeItem *parent);
|
|
void addInstance(UAVObject *obj, TreeItem *parent);
|
|
QString updateMode(quint8 updateMode);
|
|
void setupModelData(UAVObjectManager *objManager);
|
|
ObjectTreeItem *findObjectTreeItem(UAVObject *obj);
|
|
DataObjectTreeItem *findDataObjectTreeItem(UAVDataObject *obj);
|
|
|
|
TreeItem *m_rootItem;
|
|
TopTreeItem *m_settingsTree;
|
|
TopTreeItem *m_nonSettingsTree;
|
|
int m_recentlyUpdatedTimeout;
|
|
QColor m_recentlyUpdatedColor;
|
|
QColor m_manuallyChangedColor;
|
|
};
|
|
|
|
#endif // UAVOBJECTTREEMODEL_H
|