DtkDevice
DTK library for device.
dinputdevicemanager.h
浏览该文件的文档.
1// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
5#ifndef DINPUTDEVICEMANAGER_H
6#define DINPUTDEVICEMANAGER_H
7
8#include "dtkdevice_global.h"
9#include <DExpected>
10#include <DObject>
11#include <QObject>
12
14
15DDEVICE_BEGIN_NAMESPACE
16class DInputDeviceGeneric;
17class DInputDeviceSetting;
18DDEVICE_END_NAMESPACE
19using DInputDevicePtr = QSharedPointer<DTK_DEVICE_NAMESPACE::DInputDeviceGeneric>;
20using DInputSettingPtr = QSharedPointer<DTK_DEVICE_NAMESPACE::DInputDeviceSetting>;
21using DInputDeviceInfoList = QList<DTK_DEVICE_NAMESPACE::DeviceInfo>;
22DDEVICE_BEGIN_NAMESPACE
23using DCORE_NAMESPACE::DExpected;
24using DCORE_NAMESPACE::DObject;
25class DInputDeviceManagerPrivate;
26class LIBDTKDEVICESHARED_EXPORT DInputDeviceManager : public QObject, public DObject
27{
28 Q_OBJECT
29 Q_PROPERTY(DInputDeviceInfoList deviceInfos READ deviceInfos)
30
31public:
32 explicit DInputDeviceManager(QObject *parent = nullptr);
34 DInputDeviceInfoList deviceInfos() const;
35
36Q_SIGNALS:
37 void deviceAdded(const DeviceInfo &device);
38 void deviceRemoved(const DeviceInfo &device);
39
40public Q_SLOTS:
41 DExpected<DInputDevicePtr> createDevice(const DeviceInfo &info);
42 DExpected<DInputSettingPtr> setting();
43
44private:
45 template <DeviceType deviceType> void handleDeviceChanged(const QString &deviceList);
46 D_DECLARE_PRIVATE(DInputDeviceManager)
47};
48
49DDEVICE_END_NAMESPACE
50#endif
Manager类
Definition: dinputdevicemanager.h:27
DInputDeviceInfoList deviceInfos() const
获取所有设备信息
DInputDeviceManager(QObject *parent=nullptr)
构造函数
void deviceAdded(const DeviceInfo &device)
设备新增信号
void deviceRemoved(const DeviceInfo &device)
设备移除信号
DExpected< DInputDevicePtr > createDevice(const DeviceInfo &info)
创建设备
DExpected< DInputSettingPtr > setting()
获取全局设置
~DInputDeviceManager() override
析构函数
设备信息类
Definition: dtkinputdevices_types.h:16