dtkio
dtk library for dtkio.
载入中...
搜索中...
未找到
dblockdevicemonitor.h
浏览该文件的文档.
1// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
5#ifndef DBLOCKDEVICEMONITOR_H
6#define DBLOCKDEVICEMONITOR_H
7
8#include <DtkMountGlobal>
9
10#include <QObject>
11
12DMOUNT_BEGIN_NAMESPACE
13
14class DBlockDeviceMonitor;
15namespace DDeviceManager {
17}
18
19enum class BlockDeviceProperty;
20class DBlockDeviceMonitorPrivate;
21class DBlockDeviceMonitor : public QObject
22{
23 Q_OBJECT
24 Q_DECLARE_PRIVATE(DBlockDeviceMonitor)
25 friend DBlockDeviceMonitor *DDeviceManager::globalBlockDeviceMonitor();
26
27public:
29
30 void setWatchChanges(bool watchChanges);
31 bool watchChanges() const;
32
33Q_SIGNALS:
34 void deviceAdded(const QString &devPath);
35 void deviceRemoved(const QString &devPath);
36 void mountAdded(const QString &devPath, const QString &mountPoint);
37 void mountRemoved(const QString &devPath);
38 void fileSystemAdded(const QString &devPath);
39 void fileSystemRemoved(const QString &devPath);
40 void driveAdded(const QString &drvPath);
41 void driveRemoved(const QString &drvPath);
42 void propertiesChanged(const QString &devPath, const QMap<Dtk::Mount::BlockDeviceProperty, QVariant> &changes);
43
44private:
45 explicit DBlockDeviceMonitor(QObject *parent = nullptr);
46 QScopedPointer<DBlockDeviceMonitorPrivate> d_ptr;
47};
48
49DMOUNT_END_NAMESPACE
50
51#endif // DBLOCKDEVICEMONITOR_H
提供块设备的监听操作
Definition dblockdevicemonitor.h:22
void propertiesChanged(const QString &devPath, const QMap< Dtk::Mount::BlockDeviceProperty, QVariant > &changes)
信号,告知块设备/驱动设备属性变化
void driveRemoved(const QString &drvPath)
信号,告知驱动设备移除
void fileSystemAdded(const QString &devPath)
信号,告知块设备文件系统识别
void deviceRemoved(const QString &devPath)
信号,告知块设备移除
void driveAdded(const QString &drvPath)
信号,告知驱动(硬盘)设备添加
bool watchChanges() const
获取当前监视器工作状态
void deviceAdded(const QString &devPath)
信号,告知块设备添加
~DBlockDeviceMonitor() override
析构函数
void mountAdded(const QString &devPath, const QString &mountPoint)
信号,告知块设备挂载
void mountRemoved(const QString &devPath)
信号,告知块设备卸载
void fileSystemRemoved(const QString &devPath)
信号,告知块设备文件系统移除
void setWatchChanges(bool watchChanges)
开启或关闭设备监听
DBlockDeviceMonitor * globalBlockDeviceMonitor()
获取全局唯一块设备监视器,你可以使用该监视器监听块设备的变化