Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/platformsupport/input/evdevtablet/qevdevtabletmanager.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||
---|---|---|---|---|---|---|---|---|
1 | - | |||||||
2 | - | |||||||
3 | - | |||||||
4 | - | |||||||
5 | extern const QLoggingCategory &qLcEvdevTablet(); | - | ||||||
6 | - | |||||||
7 | QEvdevTabletManager::QEvdevTabletManager(const QString &key, const QString &specification, QObject *parent) | - | ||||||
8 | : QObject(parent) | - | ||||||
9 | { | - | ||||||
10 | (void)key;; | - | ||||||
11 | - | |||||||
12 | if (qEnvironmentVariableIsSet("QT_QPA_EVDEV_DEBUG")
| 0 | ||||||
13 | const_cast< never executed: QLoggingCategory &>(qLcEvdevTablet()).setEnabled(QtDebugMsg, true);const_cast<QLoggingCategory &>(qLcEvdevTablet()).setEnabled(QtDebugMsg, true); never executed: const_cast<QLoggingCategory &>(qLcEvdevTablet()).setEnabled(QtDebugMsg, true); | 0 | ||||||
14 | - | |||||||
15 | QString spec = QString::fromLocal8Bit(qgetenv("QT_QPA_EVDEV_TABLET_PARAMETERS")); | - | ||||||
16 | - | |||||||
17 | if (spec.isEmpty()
| 0 | ||||||
18 | spec = specification; never executed: spec = specification; | 0 | ||||||
19 | - | |||||||
20 | QStringList args = spec.split(QLatin1Char(':')); | - | ||||||
21 | QStringList devices; | - | ||||||
22 | - | |||||||
23 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(args)>::type> _container_((args)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (const QString &arg = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||
24 | if (arg.startsWith(QLatin1String("/dev/"))
| 0 | ||||||
25 | devices.append(arg); | - | ||||||
26 | args.removeAll(arg); | - | ||||||
27 | } never executed: end of block | 0 | ||||||
28 | } never executed: end of block | 0 | ||||||
29 | - | |||||||
30 | - | |||||||
31 | m_spec = args.join(QLatin1Char(':')); | - | ||||||
32 | - | |||||||
33 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(devices)>::type> _container_((devices)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (const QString &device = *_container_.i; _container_.control; _container_.control = 0) | - | ||||||
34 | addDevice(device); never executed: addDevice(device); | 0 | ||||||
35 | - | |||||||
36 | - | |||||||
37 | if (devices.isEmpty()
| 0 | ||||||
38 | for (bool qt_category_enabled = qLcEvdevTablet().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 85, __PRETTY_FUNCTION__, qLcEvdevTablet().categoryName()).debug() << "evdevtablet: Using device discovery"; | 0 | ||||||
39 | m_deviceDiscovery = QDeviceDiscovery::create(QDeviceDiscovery::Device_Tablet, this); | - | ||||||
40 | if (m_deviceDiscovery
| 0 | ||||||
41 | QStringList devices = m_deviceDiscovery->scanConnectedDevices(); | - | ||||||
42 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(devices)>::type> _container_((devices)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (const QString &device = *_container_.i; _container_.control; _container_.control = 0) | - | ||||||
43 | addDevice(device); never executed: addDevice(device); | 0 | ||||||
44 | connect(m_deviceDiscovery, qFlagLocation("2""deviceDetected(QString)" "\0" __FILE__ ":" "91"), this, qFlagLocation("1""addDevice(QString)" "\0" __FILE__ ":" "91")); | - | ||||||
45 | connect(m_deviceDiscovery, qFlagLocation("2""deviceRemoved(QString)" "\0" __FILE__ ":" "92"), this, qFlagLocation("1""removeDevice(QString)" "\0" __FILE__ ":" "92")); | - | ||||||
46 | } never executed: end of block | 0 | ||||||
47 | } never executed: end of block | 0 | ||||||
48 | } never executed: end of block | 0 | ||||||
49 | - | |||||||
50 | QEvdevTabletManager::~QEvdevTabletManager() | - | ||||||
51 | { | - | ||||||
52 | qDeleteAll(m_activeDevices); | - | ||||||
53 | } never executed: end of block | 0 | ||||||
54 | - | |||||||
55 | void QEvdevTabletManager::addDevice(const QString &deviceNode) | - | ||||||
56 | { | - | ||||||
57 | for (bool qt_category_enabled = qLcEvdevTablet().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 104, __PRETTY_FUNCTION__, qLcEvdevTablet().categoryName()).debug() << "Adding device at" << deviceNode; | 0 | ||||||
58 | QEvdevTabletHandlerThread *handler; | - | ||||||
59 | handler = new QEvdevTabletHandlerThread(deviceNode, m_spec); | - | ||||||
60 | if (handler
| 0 | ||||||
61 | m_activeDevices.insert(deviceNode, handler); | - | ||||||
62 | QInputDeviceManagerPrivate::get(QGuiApplicationPrivate::inputDeviceManager())->setDeviceCount( | - | ||||||
63 | QInputDeviceManager::DeviceTypeTablet, m_activeDevices.count()); | - | ||||||
64 | } never executed: else {end of block | 0 | ||||||
65 | QMessageLogger(__FILE__, 112, __PRETTY_FUNCTION__).warning("evdevtablet: Failed to open tablet device %s", QString(deviceNode).toLocal8Bit().constData()); | - | ||||||
66 | } never executed: end of block | 0 | ||||||
67 | } | - | ||||||
68 | - | |||||||
69 | void QEvdevTabletManager::removeDevice(const QString &deviceNode) | - | ||||||
70 | { | - | ||||||
71 | if (m_activeDevices.contains(deviceNode)
| 0 | ||||||
72 | for (bool qt_category_enabled = qLcEvdevTablet().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 119, __PRETTY_FUNCTION__, qLcEvdevTablet().categoryName()).debug() << "Removing device at" << deviceNode; | 0 | ||||||
73 | QEvdevTabletHandlerThread *handler = m_activeDevices.value(deviceNode); | - | ||||||
74 | m_activeDevices.remove(deviceNode); | - | ||||||
75 | QInputDeviceManagerPrivate::get(QGuiApplicationPrivate::inputDeviceManager())->setDeviceCount( | - | ||||||
76 | QInputDeviceManager::DeviceTypeTablet, m_activeDevices.count()); | - | ||||||
77 | delete handler; | - | ||||||
78 | } never executed: end of block | 0 | ||||||
79 | } never executed: end of block | 0 | ||||||
80 | - | |||||||
81 | - | |||||||
Switch to Source code | Preprocessed file |