qevdevkeyboardmanager.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6extern const QLoggingCategory &qLcEvdevKey();-
7-
8QEvdevKeyboardManager::QEvdevKeyboardManager(const QString &key, const QString &specification, QObject *parent)-
9 : QObject(parent)-
10{-
11 (void)key;;-
12-
13-
14 QString spec = QString::fromLocal8Bit(qgetenv("QT_QPA_EVDEV_KEYBOARD_PARAMETERS"));-
15-
16 if (spec.isEmpty()
spec.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
17 spec = specification;
never executed: spec = specification;
0
18-
19 QStringList args = spec.split(QLatin1Char(':'));-
20 QStringList devices;-
21-
22 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) {-
23 if (arg.startsWith(QLatin1String("/dev/"))
arg.startsWith...ring("/dev/"))Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
24-
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-
34 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)-
35 addKeyboard(device);
never executed: addKeyboard(device);
0
36-
37 if (devices.isEmpty()
devices.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
38 for (bool qt_category_enabled = qLcEvdevKey().isDebugEnabled(); qt_category_enabled
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
; qt_category_enabled = false) QMessageLogger(__FILE__, 83, __PRETTY_FUNCTION__, qLcEvdevKey().categoryName()).debug() << "evdevkeyboard: Using device discovery";
never executed: QMessageLogger(__FILE__, 83, __PRETTY_FUNCTION__, qLcEvdevKey().categoryName()).debug() << "evdevkeyboard: Using device discovery";
0
39 m_deviceDiscovery = QDeviceDiscovery::create(QDeviceDiscovery::Device_Keyboard, this);-
40 if (m_deviceDiscovery
m_deviceDiscoveryDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
41-
42 QStringList devices = m_deviceDiscovery->scanConnectedDevices();-
43 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) {-
44 addKeyboard(device);-
45 }
never executed: end of block
0
46-
47 connect(m_deviceDiscovery, qFlagLocation("2""deviceDetected(QString)" "\0" __FILE__ ":" "92"), this, qFlagLocation("1""addKeyboard(QString)" "\0" __FILE__ ":" "92"));-
48 connect(m_deviceDiscovery, qFlagLocation("2""deviceRemoved(QString)" "\0" __FILE__ ":" "93"), this, qFlagLocation("1""removeKeyboard(QString)" "\0" __FILE__ ":" "93"));-
49 }
never executed: end of block
0
50 }
never executed: end of block
0
51}
never executed: end of block
0
52-
53QEvdevKeyboardManager::~QEvdevKeyboardManager()-
54{-
55 qDeleteAll(m_keyboards);-
56 m_keyboards.clear();-
57}
never executed: end of block
0
58-
59void QEvdevKeyboardManager::addKeyboard(const QString &deviceNode)-
60{-
61 for (bool qt_category_enabled = qLcEvdevKey().isDebugEnabled(); qt_category_enabled
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
; qt_category_enabled = false) QMessageLogger(__FILE__, 106, __PRETTY_FUNCTION__, qLcEvdevKey().categoryName()).debug() << "Adding keyboard at" << deviceNode;
never executed: QMessageLogger(__FILE__, 106, __PRETTY_FUNCTION__, qLcEvdevKey().categoryName()).debug() << "Adding keyboard at" << deviceNode;
0
62 QEvdevKeyboardHandler *keyboard;-
63 keyboard = QEvdevKeyboardHandler::create(deviceNode, m_spec, m_defaultKeymapFile);-
64 if (keyboard
keyboardDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
65 m_keyboards.insert(deviceNode, keyboard);-
66 QInputDeviceManagerPrivate::get(QGuiApplicationPrivate::inputDeviceManager())->setDeviceCount(-
67 QInputDeviceManager::DeviceTypeKeyboard, m_keyboards.count());-
68 }
never executed: end of block
else {
0
69 QMessageLogger(__FILE__, 114, __PRETTY_FUNCTION__).warning("Failed to open keyboard device %s", QString(deviceNode).toLocal8Bit().constData());-
70 }
never executed: end of block
0
71}-
72-
73void QEvdevKeyboardManager::removeKeyboard(const QString &deviceNode)-
74{-
75 if (m_keyboards.contains(deviceNode)
m_keyboards.co...ns(deviceNode)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
76 for (bool qt_category_enabled = qLcEvdevKey().isDebugEnabled(); qt_category_enabled
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
; qt_category_enabled = false) QMessageLogger(__FILE__, 121, __PRETTY_FUNCTION__, qLcEvdevKey().categoryName()).debug() << "Removing keyboard at" << deviceNode;
never executed: QMessageLogger(__FILE__, 121, __PRETTY_FUNCTION__, qLcEvdevKey().categoryName()).debug() << "Removing keyboard at" << deviceNode;
0
77 QEvdevKeyboardHandler *keyboard = m_keyboards.value(deviceNode);-
78 m_keyboards.remove(deviceNode);-
79 QInputDeviceManagerPrivate::get(QGuiApplicationPrivate::inputDeviceManager())->setDeviceCount(-
80 QInputDeviceManager::DeviceTypeKeyboard, m_keyboards.count());-
81 delete keyboard;-
82 }
never executed: end of block
0
83}
never executed: end of block
0
84-
85void QEvdevKeyboardManager::loadKeymap(const QString &file)-
86{-
87 m_defaultKeymapFile = file;-
88-
89 if (file.isEmpty()
file.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
90-
91-
92 QString keymapFromSpec;-
93 const auto specs = m_spec.splitRef(QLatin1Char(':'));-
94 for (const QStringRef &arg : specs) {-
95 if (arg.startsWith(QLatin1String("keymap="))
arg.startsWith...ng("keymap="))Description
TRUEnever evaluated
FALSEnever evaluated
)
0
96 keymapFromSpec = arg.mid(7).toString();
never executed: keymapFromSpec = arg.mid(7).toString();
0
97 }
never executed: end of block
0
98 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(m_keyboards)>::type> _container_((m_keyboards)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QEvdevKeyboardHandler *handler = *_container_.i; _container_.control; _container_.control = 0) {-
99 if (keymapFromSpec.isEmpty()
keymapFromSpec.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
100 handler->unloadKeymap();
never executed: handler->unloadKeymap();
0
101 else-
102 handler->loadKeymap(keymapFromSpec);
never executed: handler->loadKeymap(keymapFromSpec);
0
103 }-
104 }
never executed: end of block
else {
0
105 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(m_keyboards)>::type> _container_((m_keyboards)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QEvdevKeyboardHandler *handler = *_container_.i; _container_.control; _container_.control = 0)-
106 handler->loadKeymap(file);
never executed: handler->loadKeymap(file);
0
107 }
never executed: end of block
0
108}-
109-
110-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9