message handler: make the log output less verbose

Skip truly identical / repetitive messages.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2020-03-29 14:38:09 -07:00
parent cbf1f35d63
commit 4cd7767bec

View file

@ -39,6 +39,13 @@ int MessageHandlerModel::rowCount(const QModelIndex&) const
void MessageHandlerModel::addLog(QtMsgType type, const QString& message)
{
if (!m_data.isEmpty()) {
struct MessageData *lm = &m_data.last();
QString lastMessage = lm->message.mid(lm->message.indexOf(':'));
QString newMessage = message.mid(message.indexOf(':'));
if (lastMessage == newMessage)
return;
}
beginInsertRows(QModelIndex(), rowCount(), rowCount());
m_data.append({message, type});
endInsertRows();