#ifndef DRIVELISTMODEL_H #define DRIVELISTMODEL_H /* * SPDX-License-Identifier: Apache-2.0 * Copyright (C) 2020 Raspberry Pi Ltd */ #include #include #include #include "drivelistitem.h" #include "drivelistmodelpollthread.h" class DriveListModel : public QAbstractListModel { Q_OBJECT public: DriveListModel(QObject *parent = nullptr); virtual int rowCount(const QModelIndex &) const; virtual QHash roleNames() const; virtual QVariant data(const QModelIndex &index, int role) const; void startPolling(); void stopPolling(); enum driveListRoles { deviceRole = Qt::UserRole + 1, descriptionRole, sizeRole, isUsbRole, isScsiRole, isReadOnlyRole, mountpointsRole }; public slots: void processDriveList(std::vector l); protected: QMap _drivelist; QHash _rolenames; DriveListModelPollThread _thread; }; #endif // DRIVELISTMODEL_H