79 const QString &description,
80 const QString &messageCode =
"",
83 const QString canonicalPath = QString()) :
84 m_description(description),
89 m_lineNumber(lineNumber),
90 m_filePath(canonicalPath)
92 if (m_color.isValid() ==
false)
94 m_color = statusToColor(m_type);
100 m_description(other.m_description),
101 m_code(other.m_code),
102 m_type(other.m_type),
105 m_lineNumber(other.m_lineNumber),
106 m_filePath(other.m_filePath),
107 m_color(other.m_color)
113 CheckerType type()
const
119 QString description()
const
121 return m_description;
125 int lineNumber()
const
138 static QString statusToString(CheckerType status)
143 return QObject::tr(
"Info");
145 return QObject::tr(
"Warning");
147 return QObject::tr(
"Error");
159 static QColor statusToColor(CheckerType status)
164 return QColor(
"#4040DD");
166 return QColor(
"#DDDD40");
169 return QColor(
"#DD4040");
179 QString statusString()
const
181 return statusToString(m_type);
186 QString checkerItemText(
bool addShortType =
false,
int wordWrapLength = -1)
const
196 prefix = QObject::tr(
"[I] ");
199 prefix = QObject::tr(
"[W] ");
202 prefix = QObject::tr(
"[E] ");
208 if (m_code.isEmpty())
212 text = QObject::tr(
"%1 (Column %2)").arg(prefix + m_description).arg(m_col + 1);
216 text = m_description;
223 text = QObject::tr(
"%1: %2 (Column %3)")
224 .arg(prefix + m_code)
230 text = QString(
"%1: %2").arg(prefix + m_code).arg(m_description);
234 if (wordWrapLength > 0 && text.size() > wordWrapLength)
238 QStringList words = text.split(
" ");
240 QStringList finalParts;
243 foreach (
const QString& word, text.split(
" "))
246 len += (word.size() + 1);
248 if (len >= wordWrapLength)
250 finalParts.append(parts.join(
" "));
258 finalParts.append(parts.join(
" "));
261 text = finalParts.join(
"\n ");
270 QString m_description;