| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
#pragma once |
| 6 |
|
| 7 |
#include <QObject> |
| 8 |
#include <QString> |
| 9 |
#include <QMap> |
| 10 |
|
| 11 |
class DeviceInfo |
| 12 |
{ |
| 13 |
public: |
| 14 |
DeviceInfo() {} |
| 15 |
DeviceInfo(const QString &path, quint32 used, quint32 total, const QString &label) |
| 16 |
: path(path), used(used), total(total), label(label) |
| 17 |
{ |
| 18 |
} |
| 19 |
|
| 20 |
QString path = ""; |
| 21 |
quint32 used = 0; |
| 22 |
quint32 total = 0; |
| 23 |
QString label = QObject::tr("Removable Disk"); |
| 24 |
QString uuid = ""; |
| 25 |
QString fstype = ""; |
| 26 |
QString target = ""; |
| 27 |
QString strDev = ""; |
| 28 |
bool isDisk = false; |
| 29 |
bool needFormat = false; |
| 30 |
QMap<QString, DeviceInfo> children; |
| 31 |
|
| 32 |
bool operator==(const DeviceInfo& otherInfo) |
| 33 |
{ |
| 34 |
return (this->path == otherInfo.path); |
| 35 |
} |
| 36 |
}; |
| 37 |
|
| 38 |
Q_DECLARE_METATYPE(QList<DeviceInfo>); |
| 39 |
|
| 40 |
QDataStream &operator<<(QDataStream &out, const DeviceInfo &msg); |
| 41 |
QDataStream &operator>>(QDataStream &in, DeviceInfo &msg); |
| 42 |
|
| 43 |
QString deviceListToJson(QList<DeviceInfo> deviceList); |
| 44 |
QList<DeviceInfo> deviceListFromJson(QString json); |