diff --git a/tools/triage/mainwindow.cpp b/tools/triage/mainwindow.cpp index 80e1c17ea..753e87606 100644 --- a/tools/triage/mainwindow.cpp +++ b/tools/triage/mainwindow.cpp @@ -35,13 +35,26 @@ void MainWindow::loadFile() const QString fileName = QFileDialog::getOpenFileName(this, tr("daca results file"), WORK_FOLDER, tr("Text files (*.txt);;All (*.*)")); if (fileName.isEmpty()) return; - ui->results->clear(); QFile file(fileName); file.open(QIODevice::ReadOnly | QIODevice::Text); QTextStream textStream(&file); + load(textStream); +} + +void MainWindow::loadFromClipboard() +{ + ui->statusBar->clearMessage(); + QString clipboardContent = QApplication::clipboard()->text(); + QTextStream textStream(&clipboardContent); + load(textStream); +} + +void MainWindow::load(QTextStream &textStream) +{ QString url; QString errorMessage; QStringList allErrors; + ui->results->clear(); while (true) { QString line = textStream.readLine(); if (line.isNull()) diff --git a/tools/triage/mainwindow.h b/tools/triage/mainwindow.h index 5abc8e9a0..acd6e1ff1 100644 --- a/tools/triage/mainwindow.h +++ b/tools/triage/mainwindow.h @@ -3,6 +3,8 @@ #include #include +#include +#include namespace Ui { class MainWindow; @@ -19,11 +21,13 @@ public: public slots: void loadFile(); + void loadFromClipboard(); void showResult(QListWidgetItem *item); private: Ui::MainWindow *ui; + void load(QTextStream &textStream); bool runProcess(const QString &programName, const QStringList & arguments); bool wget(const QString url); bool unpackArchive(const QString archiveName); diff --git a/tools/triage/mainwindow.ui b/tools/triage/mainwindow.ui index b1e740534..e7544c955 100644 --- a/tools/triage/mainwindow.ui +++ b/tools/triage/mainwindow.ui @@ -22,7 +22,14 @@ - Load + Load from file + + + + + + + Load from clipboard @@ -89,7 +96,7 @@ 0 0 1057 - 25 + 21 @@ -113,22 +120,6 @@ - - loadFile - clicked() - MainWindow - pasteResults() - - - 86 - 68 - - - 135 - 68 - - - results itemDoubleClicked(QListWidgetItem*) @@ -161,9 +152,26 @@ + + loadFromClipboard + clicked() + MainWindow + loadFromClipboard() + + + 142 + 55 + + + 528 + 268 + + + loadFile() showResult(QListWidgetItem*) + loadFromClipboard() diff --git a/tools/triage/readme.txt b/tools/triage/readme.txt index 61c2e6fc6..c3c9fedc9 100644 --- a/tools/triage/readme.txt +++ b/tools/triage/readme.txt @@ -9,10 +9,12 @@ On Windows something like Cygwin is necessary and the directory containing the e in the PATH environment variable (for example "C:\cygwin\bin"). Usage: -After triage has been started you have to load a daca results file via the "Load" button. -The file must contain the package URL line beginning with "ftp://" and the Cppcheck messages. -When the results file has been parsed successfully you can see a list of Cppcheck messages directly -beneath the "Load" button. Double-click any entry to let the tool show the source code and jump to -and mark the corresponding line. If the package is not found it is downloaded and extracted +After triage has been started you have to load daca results from a file via the "Load from file" +button or from the clipboard via the "Load from clipboard" button. +The file or clipboard text must contain the package URL line beginning with "ftp://" and the +Cppcheck messages. +When the results data has been parsed successfully you can see a list of Cppcheck messages directly +beneath the "Load ..." buttons. Double-click any entry to let the tool show the source code and jump +to and mark the corresponding line. If the package is not found it is downloaded and extracted automatically. So after the first double-click it is normal that it takes some time until the source code is shown.