-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathudisks2.h
136 lines (108 loc) · 3.16 KB
/
udisks2.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#ifndef UDISKS2_H
#define UDISKS2_H
#include <QObject>
#include <QtDBus>
class UDisks2Block;
class UDisks2Drive;
class UDisks2Filesystem;
class UDisks2 : public QObject {
Q_OBJECT
public:
explicit UDisks2(QObject *parent = NULL);
~UDisks2();
QStringList blockDevices();
UDisks2Block *blockDevice(const QString &node);
QStringList drives();
UDisks2Drive *drive(const QString &node);
signals:
void deviceInformationChanged(QString node, QVariantMap info);
void driveAdded(const QString& node);
void driveRemoved(const QString& node);
void driveChanged(const QString& node);
void blockDeviceAdded(const QString& node);
void blockDeviceRemoved(const QString &node);
void blockDeviceChanged(const QString &node);
void filesystemAdded(const QString& node);
void filesystemRemoved(const QString &node);
void filesystemChanged(const QString &node);
private:
void addDrive(const QString &node);
void addBlock(const QString &node);
void removeDrive(const QString &node);
void removeBlock(const QString &node);
private slots:
void dbus_interfaceAdded(const QDBusObjectPath &path, const QMap<QString, QVariant> &interfaces);
void dbus_interfaceRemoved(const QDBusObjectPath &path, const QStringList &interfaces);
private:
QMap<QString,UDisks2Drive*> drives_;
QMap<QString,UDisks2Block*> blocks_;
};
class UDisks2Block : public QObject {
Q_OBJECT
public:
explicit UDisks2Block(const QString &node, QObject *parent = NULL);
public:
QString name;
QString dev;
QString id;
QString drive;
qulonglong size;
bool readonly;
QString usage;
QString type;
QString toString();
void update();
void updateFilesystem();
void addFilesystem();
void removeFilesystem();
UDisks2Filesystem *fileSystem();
signals:
void filesystemAdded(const QString& node);
void filesystemRemoved(const QString &node);
void filesystemChanged(const QString &node);
void changed(const QString &node);
private slots:
void self_propertiesChanged(const QString &interface, const QVariantMap &changedProp, const QStringList &invalidatedProp);
private:
QDBusInterface *dbus;
UDisks2Filesystem* fs;
};
class UDisks2Filesystem : public QObject {
Q_OBJECT
public:
UDisks2Filesystem(const QString &node, QObject *parent = NULL);
QStringList mountPoints() const;
QString mount();
void unmount();
void update();
bool isValid();
QString name;
private:
QDBusInterface *dbus;
QDBusInterface *dbusProp;
QStringList mountPoints_;
};
class UDisks2Drive : public QObject {
Q_OBJECT
public:
explicit UDisks2Drive(const QString &node, QObject *parent = NULL);
QString name;
qulonglong size;
QString vendor;
QString model;
QString serial;
QString id;
QString media;
bool optical;
bool removable;
bool available;
QString toString();
void update();
signals:
void changed(const QString &node);
private slots:
void self_propertiesChanged(const QString &interface, const QVariantMap &changed, const QStringList &invalidated);
private:
QDBusInterface *dbus;
};
#endif // UDISKS2_H