triage: better handling of error messages with notes
This commit is contained in:
parent
1fe59faecb
commit
7b5e994f29
|
@ -32,17 +32,24 @@ void MainWindow::loadFile()
|
||||||
file.open(QIODevice::ReadOnly | QIODevice::Text);
|
file.open(QIODevice::ReadOnly | QIODevice::Text);
|
||||||
QTextStream textStream(&file);
|
QTextStream textStream(&file);
|
||||||
QString url;
|
QString url;
|
||||||
|
QString errorMessage;
|
||||||
while (true) {
|
while (true) {
|
||||||
const QString line = textStream.readLine();
|
const QString line = textStream.readLine();
|
||||||
if (line.isNull())
|
if (line.isNull())
|
||||||
break;
|
break;
|
||||||
if (line.startsWith("ftp://"))
|
if (line.startsWith("ftp://")) {
|
||||||
|
if (!url.isEmpty() && !errorMessage.isEmpty())
|
||||||
|
ui->results->addItem(url + "\n" + errorMessage);
|
||||||
url = line;
|
url = line;
|
||||||
else if (!url.isEmpty()) {
|
errorMessage.clear();
|
||||||
ui->results->addItem(url + "\n" + line);
|
} else if (!url.isEmpty() && QRegExp(".*: (error|warning|note):.*").exactMatch(line)) {
|
||||||
url.clear();
|
if (!errorMessage.isEmpty())
|
||||||
|
errorMessage += '\n';
|
||||||
|
errorMessage += line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!url.isEmpty() && !errorMessage.isEmpty())
|
||||||
|
ui->results->addItem(url + "\n" + errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::showResult(QListWidgetItem *item)
|
void MainWindow::showResult(QListWidgetItem *item)
|
||||||
|
@ -50,7 +57,7 @@ void MainWindow::showResult(QListWidgetItem *item)
|
||||||
if (!item->text().startsWith("ftp://"))
|
if (!item->text().startsWith("ftp://"))
|
||||||
return;
|
return;
|
||||||
const QStringList lines = item->text().split("\n");
|
const QStringList lines = item->text().split("\n");
|
||||||
if (lines.size() != 2)
|
if (lines.size() < 2)
|
||||||
return;
|
return;
|
||||||
const QString url = lines[0];
|
const QString url = lines[0];
|
||||||
const QString msg = lines[1];
|
const QString msg = lines[1];
|
||||||
|
|
Loading…
Reference in New Issue