#ifndef DEVICEMODEL_H #define DEVICEMODEL_H #include #include #include #include #include class DeviceModel : public QAbstractItemModel { Q_OBJECT public: enum DeviceType { Attached, Detatched }; enum { UdiRole = Qt::UserRole, TypeRole }; DeviceModel(QObject* parent = 0); ~DeviceModel(); Qt::ItemFlags flags(const QModelIndex &index) const; QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; int rowCount(const QModelIndex &parent = QModelIndex()) const; int columnCount(const QModelIndex &parent = QModelIndex()) const; QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; QModelIndex parent(const QModelIndex &index) const; bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); public slots: void forgetDevice(const QString &udi); void reload(); private slots: void deviceAttached(const QString &udi); void deviceRemoved(const QString &udi); private: void addNewDevice(const QString &udi); QList m_attached; QList m_disconnected; QHash m_loginForced; QHash m_attachedForced; }; #endif