| 21009 | } |
| 21010 | |
| 21011 | SendInputTask::SendInputTask(int rowindex, const QStringList &inputKeys, int keyupdown, const QString &original_key, int sendmode, int sendvirtualkey_state, QList<MAP_KEYDATA> *keyMappingDataList) : |
| 21012 | m_rowindex(rowindex), |
| 21013 | m_inputKeys(inputKeys), |
| 21014 | m_keyupdown(keyupdown), |
| 21015 | m_original_key(original_key), |
| 21016 | m_real_originalkey(original_key), |
| 21017 | m_sendmode(sendmode), |
| 21018 | m_sendvirtualkey_state(sendvirtualkey_state) |
| 21019 | { |
| 21020 | // Set the real original key |
| 21021 | m_real_originalkey = getRealOriginalKey(original_key); |
| 21022 | |
| 21023 | // Save current mapping table pointer to avoid array bounds issues during tab switching |
| 21024 | if (keyMappingDataList != Q_NULLPTR) { |
| 21025 | m_keyMappingDataList = keyMappingDataList; |
| 21026 | } |
| 21027 | |
| 21028 | { |
| 21029 | // Lock the map access mutex |
| 21030 | QMutexLocker mapLocker(&s_SendInputTaskControllerMapMutex); |
| 21031 | |
| 21032 | // Check if the Controller for this original key already exists |
| 21033 | if (!s_SendInputTaskControllerMap.contains(m_real_originalkey)) { |
| 21034 | // Create a new Controller struct and insert it into the map |
| 21035 | SendInputTaskController controller; |
| 21036 | controller.task_threadpool = new QThreadPool(); |
| 21037 | controller.task_threadpool->setMaxThreadCount(1); |
| 21038 | controller.task_stop_mutex = new QMutex(); |
| 21039 | controller.task_stop_condition = new QWaitCondition(); |
| 21040 | controller.task_stop_flag = new QAtomicInt(INPUTSTOP_NONE); |
| 21041 | controller.task_pause_state = new QAtomicInt(KEYSEQUENCE_PAUSE_STATE_NONE); |
| 21042 | controller.sendvirtualkey_state = SENDVIRTUALKEY_STATE_NORMAL; |
| 21043 | controller.task_rowindex = INITIAL_ROW_INDEX; |
| 21044 | controller.task_keyup_sent = false; |
| 21045 | s_SendInputTaskControllerMap.insert(m_real_originalkey, controller); |
| 21046 | } |
| 21047 | else { |
| 21048 | SendInputTaskController *controller = Q_NULLPTR; |
| 21049 | controller = &s_SendInputTaskControllerMap[m_real_originalkey]; |
| 21050 | if (keyupdown == KEY_UP) { |
| 21051 | controller->task_keyup_sent = true; |
| 21052 | } |
| 21053 | else { |
| 21054 | controller->task_keyup_sent = false; |
| 21055 | } |
| 21056 | } |
| 21057 | } |
| 21058 | } |
| 21059 | |
| 21060 | void SendInputTask::run() |
| 21061 | { |
nothing calls this directly
no test coverage detected