mirror of
https://github.com/cmclark00/retro-imager.git
synced 2025-05-18 07:55:21 +01:00
Same legal entity, just a company name change. https://find-and-update.company-information.service.gov.uk/company/08207441/filing-history
39 lines
1,017 B
C++
39 lines
1,017 B
C++
#ifndef DRIVELISTMODEL_H
|
|
#define DRIVELISTMODEL_H
|
|
|
|
/*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
* Copyright (C) 2020 Raspberry Pi Ltd
|
|
*/
|
|
|
|
#include <QAbstractItemModel>
|
|
#include <QMap>
|
|
#include <QHash>
|
|
#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<int, QByteArray> 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<Drivelist::DeviceDescriptor> l);
|
|
|
|
protected:
|
|
QMap<QString,DriveListItem *> _drivelist;
|
|
QHash<int, QByteArray> _rolenames;
|
|
DriveListModelPollThread _thread;
|
|
};
|
|
|
|
#endif // DRIVELISTMODEL_H
|