forked from raspberrypi/rpi-imager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
drivelistmodel.h
39 lines (32 loc) · 1.01 KB
/
drivelistmodel.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef DRIVELISTMODEL_H
#define DRIVELISTMODEL_H
/*
* SPDX-License-Identifier: Apache-2.0
* Copyright (C) 2020 Raspberry Pi (Trading) Limited
*/
#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