File indexing completed on 2024-05-12 05:48:41

0001 /*
0002     SPDX-FileCopyrightText: 2007 Nicolas Ternisien <nicolas.ternisien@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "xorgItemBuilder.h"
0008 
0009 void XorgItemBuilder::prepareItem(LogViewWidgetItem *item) const
0010 {
0011     LogLine *line = item->logLine();
0012 
0013     item->setText(0, QLatin1String(""));
0014 
0015     int i = 1;
0016     const auto logItems = line->logItems();
0017     for (const QString &label : logItems) {
0018         item->setText(i, label);
0019         i++;
0020     }
0021 
0022     item->setIcon(0, line->logLevel()->icon());
0023 }
0024 
0025 QString XorgItemBuilder::createToolTipText(LogLine *line) const
0026 {
0027     QString result;
0028 
0029     QListIterator<QString> it(line->logItems());
0030 
0031     result.append(QLatin1String("<table>"));
0032 
0033     const QString type = it.next();
0034     if (type.isEmpty()) {
0035         result.append(labelMessageFormat(i18n("Type:"), i18n("none")));
0036     } else {
0037         result.append(labelMessageFormat(i18n("Type:"), type));
0038     }
0039 
0040     result.append(labelMessageFormat(i18n("Original file:"), line->sourceFileName()));
0041 
0042     result.append(QLatin1String("</table>"));
0043 
0044     return result;
0045 }
0046 
0047 QString XorgItemBuilder::createFormattedText(LogLine *line) const
0048 {
0049     // It uses the same formating than the tool tip
0050     return createToolTipText(line);
0051 }