GCC Code Coverage Report


Directory: ./
File: src/MessageModel.cpp
Date: 2024-11-19 17:00:39
Exec Total Coverage
Lines: 131 208 63.0%
Branches: 140 364 38.5%

Line Branch Exec Source
1 /*****************************************************************************
2 *
3 * Copyright (C) 2009 - 2022 Florian Pose <fp@igh.de>
4 *
5 * This file is part of the QtPdCom library.
6 *
7 * The QtPdCom library is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
11 *
12 * The QtPdCom library is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15 * License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with the QtPdCom Library. If not, see <http://www.gnu.org/licenses/>.
19 *
20 ****************************************************************************/
21
22 #include "MessageModel.h"
23 using QtPdCom::MessageModel;
24
25 #include "MessageImpl.h"
26 #include "MessageItem.h"
27 #include "MessageManager.h"
28 #include "MessageModelImpl.h"
29 #include "Process.h"
30
31 #include <QEvent>
32 #include <QFile>
33 #include <QDomDocument>
34 #include <QtGlobal>
35
36 /****************************************************************************/
37
38 /** Constructor.
39 */
40 10 MessageModel::MessageModel(QObject *parent):
41 QAbstractTableModel(parent),
42
2/4
✓ Branch 2 taken 10 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 10 times.
✗ Branch 6 not taken.
10 impl(std::unique_ptr<Impl>(new MessageModel::Impl(this)))
43 10 {}
44
45 /****************************************************************************/
46
47 /** Destructor.
48 */
49 23 MessageModel::~MessageModel()
50 {
51 10 clear();
52 13 }
53
54 /****************************************************************************/
55
56 /** Loads messages from an Xml file.
57 */
58 3 void MessageModel::load(
59 const QString &path, /**< Path to Xml file. */
60 const QString &lang, /**< Language identifier. */
61 const QString &pathPrefix /**< Prefix to path (with leading /). */
62 )
63 {
64
1/2
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
6 QFile file(path);
65
1/2
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
6 QDomDocument doc;
66
1/2
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
6 QDomElement docElem;
67
68
2/4
✓ Branch 3 taken 3 times.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 3 times.
3 if (!file.open(QIODevice::ReadOnly)) {
69 throw Exception(QtPdCom::MessageModel::tr("Failed to open %1.")
70 .arg(file.fileName()));
71 }
72
73 #if QT_VERSION < 0x060500
74 {
75 6 QString errorMessage;
76 3 int errorRow, errorColumn;
77
2/4
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 times.
3 if (!doc.setContent(&file, &errorMessage, &errorRow, &errorColumn)) {
78 throw Exception(
79 QtPdCom::MessageModel::tr("Failed to parse %1, line %2,"
80 " column %3: %4")
81 .arg(file.fileName())
82 .arg(errorRow)
83 .arg(errorColumn)
84 .arg(errorMessage));
85 }
86 }
87 #else
88 {
89 QDomDocument::ParseResult res = doc.setContent(&file);
90 if (not res) {
91 throw Exception(
92 QtPdCom::MessageModel::tr("Failed to parse %1, line %2,"
93 " column %3: %4")
94 .arg(file.fileName())
95 .arg(res.errorLine)
96 .arg(res.errorColumn)
97 .arg(res.errorMessage));
98 }
99 }
100 #endif
101
1/2
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
3 file.close();
102
103
2/4
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 3 times.
✗ Branch 6 not taken.
3 docElem = doc.documentElement();
104
105
3/6
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 3 times.
✗ Branch 6 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 3 times.
3 if (docElem.tagName() != "EtherLabPlainMessages") {
106 throw Exception(
107 QtPdCom::MessageModel::tr("Failed to process %1:"
108 " No plain message file (%2)!"));
109 }
110
111
1/2
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
6 QDomNodeList children = docElem.childNodes();
112
1/2
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
6 QDomNode node;
113
1/2
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
6 QDomElement child;
114
115
3/4
✓ Branch 1 taken 9 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
✓ Branch 4 taken 3 times.
9 for (int i = 0; i < children.size(); i++) {
116
2/4
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 6 times.
✗ Branch 6 not taken.
6 node = children.item(i);
117
2/4
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
✗ Branch 4 not taken.
6 if (node.isElement()) {
118
2/4
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 6 times.
✗ Branch 6 not taken.
6 child = node.toElement();
119
3/6
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 6 times.
✗ Branch 6 not taken.
✓ Branch 9 taken 6 times.
✗ Branch 10 not taken.
6 if (child.tagName() == "Message") {
120 try {
121 6 QString path = Message::Impl::pathFromPlainXmlElement(
122 child,
123
2/6
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 6 times.
✗ Branch 6 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
12 pathPrefix);
124 6 int index =
125
2/4
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 6 times.
✗ Branch 6 not taken.
6 Message::Impl::indexFromPlainXmlElement(child);
126
127
2/4
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 6 times.
✗ Branch 6 not taken.
6 Message *&msg = impl->messageMap[path][index];
128
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 if (!msg) {
129
2/4
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
6 msg = new Message();
130 }
131
2/4
✓ Branch 3 taken 6 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 6 times.
✗ Branch 7 not taken.
6 msg->impl->fromPlainXmlElement(child, pathPrefix);
132
3/6
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 6 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 6 times.
✗ Branch 9 not taken.
12 QObject::connect(
133 msg,
134 SIGNAL(stateChanged()),
135 6 impl.get(),
136 SLOT(stateChanged()));
137 }
138 catch (Message::Exception &e) {
139 qWarning() << e.msg;
140 }
141 }
142 }
143 }
144
145 3 impl->lang = lang;
146 3 }
147
148 /****************************************************************************/
149
150 /** Clears the messages.
151 */
152 13 void MessageModel::clear()
153 {
154
2/2
✓ Branch 1 taken 5 times.
✓ Branch 2 taken 8 times.
13 if (impl->announcedMessageItem) {
155 5 impl->announcedMessageItem = nullptr;
156 #if PD_DEBUG_MESSAGE_MODEL
157
3/6
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 5 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 5 times.
✗ Branch 11 not taken.
5 qDebug() << __func__ << "currentMessage null";
158 #endif
159 5 emit currentMessage(nullptr);
160 }
161
162
2/2
✓ Branch 2 taken 10 times.
✓ Branch 3 taken 3 times.
13 if (impl->messageItemList.count()) {
163
1/2
✓ Branch 5 taken 10 times.
✗ Branch 6 not taken.
10 beginRemoveRows(QModelIndex(), 0, impl->messageItemList.count() - 1);
164 10 qDeleteAll(impl->messageItemList);
165 10 impl->messageItemList.clear();
166 10 endRemoveRows();
167 }
168
169
5/8
✓ Branch 3 taken 13 times.
✗ Branch 4 not taken.
✓ Branch 7 taken 13 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 18 times.
✓ Branch 11 taken 13 times.
✓ Branch 14 taken 18 times.
✗ Branch 15 not taken.
31 for (auto &h : impl->messageMap) {
170
1/2
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
18 qDeleteAll(h);
171 }
172
173 13 impl->messageMap.clear();
174 13 }
175
176 /****************************************************************************/
177
178 /** Sets the maximum number of rows to fetch.
179 */
180 void MessageModel::setRowLimit(int limit /**< Maximum number of rows. */)
181 {
182 impl->rowLimit = limit;
183 }
184
185 /****************************************************************************/
186
187 /** Gets the maxium number of rows to fetch.
188 */
189 int MessageModel::getRowLimit() const
190 {
191 return impl->rowLimit;
192 }
193
194 /****************************************************************************/
195
196 /** Connects messages to the given process.
197 */
198 10 void MessageModel::connect(QtPdCom::Process *process /**< PdCom process. */
199 )
200 {
201 10 impl->canFetchMore = false;
202 10 impl->historicSeqNo = 0;
203 10 impl->process = process;
204
205 10 impl->messageManager =
206
1/2
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
10 dynamic_cast<MessageManager *>(process->getMessageManager());
207
1/2
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
10 if (impl->messageManager) {
208 30 QObject::connect(
209 10 impl->messageManager,
210 &MessageManager::processMessageSignal,
211 10 impl.get(),
212 &Impl::processMessage);
213 20 QObject::connect(
214 process,
215 &Process::processConnected,
216 10 impl.get(),
217 &Impl::reloadActiveMessages);
218 30 QObject::connect(
219 10 impl->messageManager,
220 &MessageManager::processResetSignal,
221 10 impl.get(),
222 &Impl::processReset);
223 }
224 else {
225 qWarning() << QtPdCom::MessageModel::tr(
226 "Failed to connect to message manager.");
227 }
228
229
6/10
✓ Branch 3 taken 10 times.
✗ Branch 4 not taken.
✓ Branch 7 taken 10 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 6 times.
✓ Branch 11 taken 10 times.
✓ Branch 15 taken 6 times.
✗ Branch 16 not taken.
✓ Branch 20 taken 6 times.
✗ Branch 21 not taken.
16 for (auto h : impl->messageMap) {
230 6 Impl::MessageHash::iterator i;
231
5/8
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 12 times.
✗ Branch 6 not taken.
✓ Branch 9 taken 6 times.
✓ Branch 10 taken 6 times.
✓ Branch 12 taken 6 times.
✗ Branch 13 not taken.
12 for (i = h.begin(); i != h.end(); ++i) {
232
2/4
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 times.
6 if (i.key() != -1) { /* FIXME vector messages */
233 continue;
234 }
235
1/2
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
6 Message *msg = i.value();
236
2/4
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
✓ Branch 6 taken 6 times.
✗ Branch 7 not taken.
12 PdCom::Selector selector;
237
238
2/4
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 times.
6 if (msg->getIndex() > -1) {
239 selector = PdCom::ScalarSelector({msg->getIndex()});
240 }
241 #if PD_DEBUG_MESSAGE_MODEL
242
6/12
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 6 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 6 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 6 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 6 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 6 times.
✗ Branch 20 not taken.
6 qDebug() << "Subscribing to" << msg->getPath() << msg->getIndex();
243 #endif
244 try {
245
3/8
✓ Branch 3 taken 6 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 6 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 6 times.
✗ Branch 9 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
12 msg->impl->variable.setVariable(
246 process,
247 msg->getPath(),
248 6 selector);
249 }
250 catch (AbstractScalarVariable::Exception &e) {
251 qWarning() << QtPdCom::MessageModel::tr(
252 "Failed to subscribe to %1: %2")
253 .arg(msg->getPath())
254 .arg(e.msg);
255 }
256 }
257 }
258 10 }
259
260 /****************************************************************************/
261
262 QtPdCom::Process *MessageModel::getProcess() const
263 {
264 return impl->process;
265 }
266
267 /****************************************************************************/
268
269 /** Sets a new language and notifies views.
270 */
271 void MessageModel::translate(const QString &lang)
272 {
273 impl->lang = lang;
274
275 for (int i = 0; i < impl->messageItemList.count(); i++) {
276 QModelIndex idx = index(i, 0); // only text column
277 emit dataChanged(idx, idx);
278 }
279
280 if (impl->announcedMessageItem) {
281 #if PD_DEBUG_MESSAGE_MODEL
282 qDebug() << __func__ << "currentMessage" << impl->announcedMessageItem
283 << impl->announcedMessageItem->message;
284 #endif
285 emit currentMessage(impl->announcedMessageItem->message);
286 }
287 }
288
289 /****************************************************************************/
290
291 /** Sets an icon for a specific message type.
292 */
293 void MessageModel::setIcon(Message::Type type, const QIcon &icon)
294 {
295 impl->iconHash[type] = icon;
296 }
297
298 /****************************************************************************/
299
300 /** \return Icon for given message type.
301 */
302 const QIcon &MessageModel::getIcon(Message::Type type) const
303 {
304 return impl->iconHash[type];
305 }
306
307 /****************************************************************************/
308
309 /** Sets the path (url) to an icon for a specific message type.
310 If the model is used with QML views this is the only way
311 to store the icon information.
312 */
313 void MessageModel::setIconPath(Message::Type type, const QString &iconPath)
314 {
315 impl->iconPathHash[type] = iconPath;
316 // and also add it to the iconHash
317 setIcon(type, QIcon(iconPath));
318 /* vice versa would be nice, but does not work because
319 to a QIcon the Path is not known */
320 }
321
322 /****************************************************************************/
323
324 /** Implements the model interface.
325 *
326 * \returns Number of active messages.
327 */
328 3447 int MessageModel::rowCount(const QModelIndex &index) const
329 {
330
2/2
✓ Branch 1 taken 3168 times.
✓ Branch 2 taken 279 times.
3447 if (!index.isValid()) {
331 3168 return impl->messageItemList.count();
332 }
333 else {
334 279 return 0;
335 }
336 }
337
338 /****************************************************************************/
339
340 /** Implements the model interface.
341 *
342 * \returns Number of columns.
343 */
344 2659 int MessageModel::columnCount(const QModelIndex &index) const
345 {
346 Q_UNUSED(index);
347 2659 return 3;
348 }
349
350 /****************************************************************************/
351
352 /** Implements the Model interface.
353 */
354 384 QVariant MessageModel::data(const QModelIndex &index, int role) const
355 {
356
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 384 times.
384 if (!index.isValid()) {
357 return QVariant();
358 }
359
360 384 auto msgItem = impl->messageItemList[index.row()];
361
362
3/4
✓ Branch 1 taken 342 times.
✓ Branch 2 taken 30 times.
✓ Branch 3 taken 12 times.
✗ Branch 4 not taken.
384 switch (index.column()) {
363 342 case 0: // text
364
3/8
✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 37 times.
✓ Branch 7 taken 222 times.
342 switch (role) {
365 83 case Qt::DisplayRole:
366
1/2
✓ Branch 4 taken 83 times.
✗ Branch 5 not taken.
83 return msgItem->getText(impl->lang);
367 case Qt::DecorationRole:
368 return impl->iconHash[msgItem->getType()];
369 case DecorationPathRole:
370 return impl->iconPathHash[msgItem->getType()];
371 case TimeStringRole:
372 // it is necessary to return other columns under
373 // column 0 because in QML a View can't address
374 // from column but only from roles
375 return msgItem->getTimeString();
376 case ResetTimeStringRole:
377 return msgItem->getResetTimeString();
378 case MessageTypeRole:
379 return msgItem->getType();
380 37 case Qt::ToolTipRole:
381 37 return impl->wrapText(
382
2/4
✓ Branch 5 taken 37 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 37 times.
✗ Branch 9 not taken.
37 msgItem->getDescription(impl->lang));
383 222 default:
384 222 return QVariant();
385 }
386 break;
387
388 30 case 1: // set time
389
1/3
✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
30 switch (role) {
390 30 case Qt::DisplayRole:
391
1/2
✓ Branch 3 taken 30 times.
✗ Branch 4 not taken.
30 return msgItem->getTimeString();
392 case Qt::UserRole + 1:
393 return "";
394 default:
395 return QVariant();
396 }
397 break;
398
399 12 case 2: // reset time
400
1/3
✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
12 switch (role) {
401 12 case Qt::DisplayRole:
402
1/2
✓ Branch 3 taken 12 times.
✗ Branch 4 not taken.
12 return msgItem->getResetTimeString();
403 case Qt::UserRole + 1:
404 return "";
405 default:
406 return QVariant();
407 }
408 break;
409
410 default:
411 return QVariant();
412 }
413 }
414
415 /****************************************************************************/
416
417 /** Implements the Model interface.
418 */
419 QVariant
420 MessageModel::headerData(int section, Qt::Orientation o, int role) const
421 {
422 if (role == Qt::DisplayRole && o == Qt::Horizontal) {
423 switch (section) {
424 case 0:
425 return QtPdCom::MessageModel::tr("Message");
426
427 case 1:
428 return QtPdCom::MessageModel::tr("Time");
429
430 case 2:
431 return QtPdCom::MessageModel::tr("Reset");
432
433 default:
434 return QVariant();
435 }
436 }
437 else {
438 return QVariant();
439 }
440 }
441
442 /****************************************************************************/
443
444 /** Implements the Model interface.
445 */
446 98 Qt::ItemFlags MessageModel::flags(const QModelIndex &index) const
447 {
448
2/2
✓ Branch 1 taken 68 times.
✓ Branch 2 taken 30 times.
98 if (!index.isValid()) {
449 68 return Qt::ItemFlags();
450 }
451
452 30 auto msgItem {impl->messageItemList[index.row()]};
453
2/2
✓ Branch 1 taken 16 times.
✓ Branch 2 taken 14 times.
30 return msgItem->isActive() ? Qt::ItemIsEnabled : Qt::ItemFlags();
454 }
455
456 /****************************************************************************/
457
458 /** Additional Rolename for decoration for use in QML views
459 */
460
461 68 QHash<int, QByteArray> MessageModel::roleNames() const
462 {
463 // default role names
464 68 QHash<int, QByteArray> roles = QAbstractTableModel::roleNames();
465
466 // extended role names
467
2/4
✓ Branch 2 taken 68 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 68 times.
✗ Branch 6 not taken.
68 roles[DecorationPathRole] = "decorationPath";
468
2/4
✓ Branch 2 taken 68 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 68 times.
✗ Branch 6 not taken.
68 roles[TimeStringRole] = "timeString";
469
2/4
✓ Branch 2 taken 68 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 68 times.
✗ Branch 6 not taken.
68 roles[ResetTimeStringRole] = "resetTimeString";
470
2/4
✓ Branch 2 taken 68 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 68 times.
✗ Branch 6 not taken.
68 roles[MessageTypeRole] = "messageTyp";
471 68 return roles;
472 }
473
474 /****************************************************************************/
475
476 70 void MessageModel::fetchMore(const QModelIndex &parent)
477 {
478 #if PD_DEBUG_MESSAGE_MODEL
479
3/6
✓ Branch 6 taken 70 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 70 times.
✗ Branch 10 not taken.
✓ Branch 13 taken 70 times.
✗ Branch 14 not taken.
70 qDebug() << __func__ << parent;
480 #endif
481
2/2
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 66 times.
70 if (canFetchMore(parent)) {
482 #if PD_DEBUG_MESSAGE_MODEL
483
4/8
✓ Branch 6 taken 4 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 4 times.
✗ Branch 10 not taken.
✓ Branch 13 taken 4 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 4 times.
✗ Branch 17 not taken.
4 qDebug() << __func__ << parent << "fetching";
484 #endif
485 4 impl->getHistoryMessage();
486 }
487 70 }
488
489 /****************************************************************************/
490
491 177 bool MessageModel::canFetchMore(const QModelIndex &parent) const
492 {
493
2/2
✓ Branch 2 taken 8 times.
✓ Branch 3 taken 169 times.
354 bool ret = !parent.isValid() and impl->canFetchMore
494
1/2
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
8 and impl->historicSeqNo
495
2/4
✓ Branch 0 taken 177 times.
✗ Branch 1 not taken.
✓ Branch 5 taken 8 times.
✗ Branch 6 not taken.
185 and impl->messageItemList.count() < impl->rowLimit;
496 #if PD_DEBUG_MESSAGE_MODEL
497
6/12
✓ Branch 5 taken 177 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 177 times.
✗ Branch 9 not taken.
✓ Branch 12 taken 177 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 177 times.
✗ Branch 16 not taken.
✓ Branch 19 taken 177 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 177 times.
✗ Branch 23 not taken.
354 qDebug() << __func__ << parent << "can" << impl->canFetchMore << "hist"
498
2/4
✓ Branch 2 taken 177 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 177 times.
✗ Branch 6 not taken.
177 << impl->historicSeqNo << "space"
499
2/4
✓ Branch 4 taken 177 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 177 times.
✗ Branch 8 not taken.
177 << (impl->messageItemList.count() < impl->rowLimit) << "ret"
500
1/2
✓ Branch 2 taken 177 times.
✗ Branch 3 not taken.
354 << ret;
501 #endif
502 177 return ret;
503 }
504
505 /****************************************************************************/
506
507 /** Event handler.
508 */
509 bool MessageModel::event(QEvent *event /**< Paint event flags. */
510 )
511 {
512 if (event->type() == QEvent::LanguageChange) {
513 emit headerDataChanged(Qt::Horizontal, 0, 1);
514 }
515
516 return QAbstractTableModel::event(event);
517 }
518
519 /****************************************************************************/
520