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

Method post

app/src/DataModel/NotificationCenter.cpp:138–165  ·  view source on GitHub ↗

* @brief Primary posting entry point; normalizes inputs and fans out to the bus. */

Source from the content-addressed store, hash-verified

136 * @brief Primary posting entry point; normalizes inputs and fans out to the bus.
137 */
138void DataModel::NotificationCenter::post(int level,
139 const QString& channel,
140 const QString& title,
141 const QString& subtitle)
142{
143 Q_ASSERT(thread() == QThread::currentThread());
144
145 const int clamped = qBound(static_cast<int>(Info), level, static_cast<int>(Critical));
146
147 const QString chan = channel.trimmed();
148 const QString ttl = title.trimmed();
149
150 if (chan.isEmpty() && ttl.isEmpty())
151 return;
152
153 const auto now = QDateTime::currentMSecsSinceEpoch();
154 const DedupKey key{clamped, chan, ttl, subtitle};
155 if (shouldDropDuplicate(key, now))
156 return;
157
158 Event e;
159 e.timestampMs = now;
160 e.level = clamped;
161 e.channel = chan;
162 e.title = ttl;
163 e.subtitle = subtitle;
164 appendEvent(std::move(e));
165}
166
167/**
168 * @brief Convenience wrapper that posts an Info-level event.

Callers 9

prelude.jsFile · 0.45
SerialStudio.jsFile · 0.45
fetchTrialStateMethod · 0.45
activateMethod · 0.45
validateMethod · 0.45
deactivateMethod · 0.45
processValueMethod · 0.45
MessageHandlerFunction · 0.45
luaNotifyFunction · 0.45

Calls 1

isEmptyMethod · 0.80

Tested by

no test coverage detected