-
Notifications
You must be signed in to change notification settings - Fork 0
/
UDisks2Watcher.h
60 lines (47 loc) · 1.34 KB
/
UDisks2Watcher.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
#ifndef UDISKS2WATCHER_H
#define UDISKS2WATCHER_H
#include <QObject>
#include <QMap>
#include <QVariant>
#include <map>
#include <memory>
class UDisks2PropertyChangeWatcher;
class UDisks2Watcher : public QObject
{
Q_OBJECT
public:
explicit UDisks2Watcher(QObject *parent = nullptr);
~UDisks2Watcher();
signals:
void partitionChanged(QString driveName);
void driveMounted(QString driveName, QString mountDir);
protected:
#ifdef __unix__
QList<QString> mBlockdevObjects;
std::map<QString, std::unique_ptr<UDisks2PropertyChangeWatcher>> mPathWatcherMap;
std::map<QString, QList<QString>> mDeviceMounts;
void updateInterfaceList();
#endif
protected slots:
#ifdef __unix__
void on_blockDevicePropertiesChanged(QString objPath, QVariantMap changedProps);
void on_interfaceAdded(QString objPath);
void on_interfaceRemoved(QString objPath);
#endif
};
#ifdef __unix__
class UDisks2PropertyChangeWatcher : public QObject
{
Q_OBJECT
public:
explicit UDisks2PropertyChangeWatcher(QString objPath, QObject *parent = nullptr);
~UDisks2PropertyChangeWatcher();
signals:
void objectPropertiesChanged(QString devName, QVariantMap changedProps);
protected:
QString mObjPath;
protected slots:
void on_propertiesChanged(QString interface, QVariantMap changedProps);
};
#endif
#endif // UDISKS2WATCHER_H