GUI: Use integer list instead of variant list for line numbers.

This commit is contained in:
Kimmo Varis 2010-07-10 20:54:33 +03:00
parent 2f0202d105
commit faa483b8d0
8 changed files with 12 additions and 16 deletions

View File

@ -33,7 +33,7 @@ class ErrorItem
public: public:
QString file; QString file;
QStringList files; QStringList files;
QStringList lines; QList<unsigned int> lines;
QString id; QString id;
QString severity; QString severity;
QString msg; QString msg;

View File

@ -617,7 +617,7 @@ void ResultsTree::SaveErrors(Report *report, QStandardItem *item)
item.msg = data["message"].toString(); item.msg = data["message"].toString();
item.id = data["id"].toString(); item.id = data["id"].toString();
QString file = StripPath(data["file"].toString(), true); QString file = StripPath(data["file"].toString(), true);
QString line = data["line"].toString(); unsigned int line = data["line"].toUInt();
item.files << file; item.files << file;
item.lines << line; item.lines << line;
@ -631,7 +631,7 @@ void ResultsTree::SaveErrors(Report *report, QStandardItem *item)
QVariantMap child_data = child_userdata.toMap(); QVariantMap child_data = child_userdata.toMap();
file = StripPath(child_data["file"].toString(), true); file = StripPath(child_data["file"].toString(), true);
line = child_data["line"].toString(); line = child_data["line"].toUInt();
item.files << file; item.files << file;
item.lines << line; item.lines << line;

View File

@ -70,7 +70,7 @@ void ResultsView::Error(const QString &file,
const QString &severity, const QString &severity,
const QString &message, const QString &message,
const QStringList &files, const QStringList &files,
const QVariantList &lines, const QList<unsigned int> &lines,
const QString &id) const QString &id)
{ {
mErrorsFound = true; mErrorsFound = true;
@ -78,15 +78,10 @@ void ResultsView::Error(const QString &file,
item.file = file; item.file = file;
item.files = files; item.files = files;
item.id = id; item.id = id;
item.lines = lines;
item.msg = message; item.msg = message;
item.severity = severity; item.severity = severity;
QVariant line;
foreach(line, lines)
{
item.lines.append(line.toString());
}
mUI.mTree->AddErrorItem(item); mUI.mTree->AddErrorItem(item);
emit GotResults(); emit GotResults();
} }

View File

@ -169,7 +169,7 @@ public slots:
const QString &severity, const QString &severity,
const QString &message, const QString &message,
const QStringList &files, const QStringList &files,
const QVariantList &lines, const QList<unsigned int> &lines,
const QString &id); const QString &id);
/** /**

View File

@ -145,13 +145,13 @@ void ThreadHandler::Initialize(ResultsView *view)
const QString &, const QString &,
const QString &, const QString &,
const QStringList &, const QStringList &,
const QVariantList &, const QList<unsigned int> &,
const QString &)), const QString &)),
view, SLOT(Error(const QString &, view, SLOT(Error(const QString &,
const QString &, const QString &,
const QString &, const QString &,
const QStringList &, const QStringList &,
const QVariantList &, const QList<unsigned int> &,
const QString &))); const QString &)));
} }

View File

@ -47,7 +47,7 @@ void ThreadResult::reportErr(const ErrorLogger::ErrorMessage &msg)
{ {
QMutexLocker locker(&mutex); QMutexLocker locker(&mutex);
QVariantList lines; QList<unsigned int> lines;
QStringList files; QStringList files;
for (std::list<ErrorLogger::ErrorMessage::FileLocation>::const_iterator tok = msg._callStack.begin(); for (std::list<ErrorLogger::ErrorMessage::FileLocation>::const_iterator tok = msg._callStack.begin();

View File

@ -98,7 +98,7 @@ signals:
const QString &severity, const QString &severity,
const QString &message, const QString &message,
const QStringList &files, const QStringList &files,
const QVariantList &lines, const QList<unsigned int> &lines,
const QString &id); const QString &id);
protected: protected:

View File

@ -88,7 +88,8 @@ void XmlReport::WriteError(const ErrorItem &error)
mXmlWriter->writeStartElement(ErrorElementName); mXmlWriter->writeStartElement(ErrorElementName);
mXmlWriter->writeAttribute(FilenameAttribute, error.files[error.files.size() - 1]); mXmlWriter->writeAttribute(FilenameAttribute, error.files[error.files.size() - 1]);
mXmlWriter->writeAttribute(LineAttribute, error.lines[error.lines.size() - 1]); const QString line = QString::number(error.lines[error.lines.size() - 1]);
mXmlWriter->writeAttribute(LineAttribute, line);
mXmlWriter->writeAttribute(IdAttribute, error.id); mXmlWriter->writeAttribute(IdAttribute, error.id);
mXmlWriter->writeAttribute(SeverityAttribute, error.severity); mXmlWriter->writeAttribute(SeverityAttribute, error.severity);
mXmlWriter->writeAttribute(MsgAttribute, error.msg); mXmlWriter->writeAttribute(MsgAttribute, error.msg);