dtkio
dtk library for dtkio.
载入中...
搜索中...
未找到
dprotocoldevicemonitor.h
浏览该文件的文档.
1// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
5#ifndef DPROTOCOLDEVICEMONITOR_H
6#define DPROTOCOLDEVICEMONITOR_H
7
8#include <DtkMountGlobal>
9
10#include <QObject>
11
12DMOUNT_BEGIN_NAMESPACE
13
14class DProtocolDeviceMonitor;
15namespace DDeviceManager {
16DProtocolDeviceMonitor *globalProtocolDeviceMonitor();
17} // namespace DDeviceManager
18
19class DProtocolDeviceMonitorPrivate;
20class DProtocolDeviceMonitor : public QObject
21{
22 Q_OBJECT
23 Q_DECLARE_PRIVATE(DProtocolDeviceMonitor)
24 friend DProtocolDeviceMonitor *DDeviceManager::globalProtocolDeviceMonitor();
25
26public:
28
29 void setWatchChanges(bool watchChanges);
30 bool watchChanges() const;
31 QStringList devices() const;
32
33Q_SIGNALS:
34 void deviceAdded(const QString &devUrl);
35 void deviceRemoved(const QString &devUrl);
36 void mountAdded(const QString &devUrl, const QString &mountPoint);
37 void mountRemoved(const QString &devUrl);
38
39private:
40 explicit DProtocolDeviceMonitor(QObject *parent = nullptr);
41
42 QScopedPointer<DProtocolDeviceMonitorPrivate> d_ptr;
43};
44
45DMOUNT_END_NAMESPACE
46
47#endif // DPROTOCOLDEVICEMONITOR_H
提供对协议类设备的监听操作
Definition dprotocoldevicemonitor.h:21
bool watchChanges() const
获取当前监视器工作状态
void setWatchChanges(bool watchChanges)
开启或关闭设备监听
void mountRemoved(const QString &devUrl)
信号,告知设备卸载
void deviceAdded(const QString &devUrl)
信号,告知协议设备添加
QStringList devices() const
获取当前所有协议设备列表
void deviceRemoved(const QString &devUrl)
信号,告知协议设备移除
void mountAdded(const QString &devUrl, const QString &mountPoint)
信号,告知设备挂载
~DProtocolDeviceMonitor() override
析构函数
DProtocolDeviceMonitor * globalProtocolDeviceMonitor()
获取全局唯一协议设备监视器,你可以使用该监视器监听协议设备的变化