* @brief Switches the console view to the given @p deviceId. */
| 880 | * @brief Switches the console view to the given @p deviceId. |
| 881 | */ |
| 882 | void Console::Handler::setCurrentDeviceId(int deviceId) |
| 883 | { |
| 884 | if (m_currentDeviceId == deviceId) |
| 885 | return; |
| 886 | |
| 887 | m_currentDeviceId = deviceId; |
| 888 | |
| 889 | m_textBuffer.clear(); |
| 890 | m_isStartingLine = true; |
| 891 | m_lastCharWasCR = false; |
| 892 | Q_EMIT cleared(); |
| 893 | |
| 894 | auto it = m_deviceState.find(m_currentDeviceId); |
| 895 | if (it != m_deviceState.end() && !it->second.buffer.isEmpty()) { |
| 896 | m_textBuffer.append(it->second.buffer.toUtf8()); |
| 897 | Q_EMIT displayString(it->second.buffer); |
| 898 | } |
| 899 | |
| 900 | Q_EMIT currentDeviceIdChanged(); |
| 901 | } |
| 902 | |
| 903 | /** |
| 904 | * @brief Maps a QML combobox index to a device source ID. |