Qt/QML edition

This commit is contained in:
Floris Bos 2020-03-04 16:55:40 +01:00
commit d7b361ba44
2168 changed files with 721948 additions and 0 deletions

34
drivelistmodel.h Normal file
View file

@ -0,0 +1,34 @@
#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"
class DriveListModel : public QAbstractListModel
{
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;
enum driveListRoles {
deviceRole = Qt::UserRole + 1, descriptionRole, sizeRole, isUsbRole, isScsiRole, mountpointsRole
};
public slots:
void refreshDriveList();
protected:
QMap<QString,DriveListItem *> _drivelist;
QHash<int, QByteArray> _rolenames;
};
#endif // DRIVELISTMODEL_H