MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / setCurrentDeviceId

Method setCurrentDeviceId

app/src/Console/Handler.cpp:882–901  ·  view source on GitHub ↗

* @brief Switches the console view to the given @p deviceId. */

Source from the content-addressed store, hash-verified

880 * @brief Switches the console view to the given @p deviceId.
881 */
882void 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.

Callers

nothing calls this directly

Calls 4

findMethod · 0.80
isEmptyMethod · 0.80
clearMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected