mirror of
https://github.com/epasveer/seer.git
synced 2026-08-30 17:10:44 +08:00
Remove duplicate source files returned by gdb.
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include <QtWidgets/QApplication>
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QtCore/Qt>
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
SeerSourceBrowserWidget::SeerSourceBrowserWidget (QWidget* parent) : QWidget(parent) {
|
||||
@@ -63,12 +64,12 @@ void SeerSourceBrowserWidget::handleText (const QString& text) {
|
||||
// {file=\"helloworld.cpp\",fullname=\"/home/erniep/Development/Peak/src/Seer/helloworld/helloworld.cpp\"}
|
||||
// ]
|
||||
|
||||
QString files_text = Seer::parseFirst(text, "files=", '[', ']', false);
|
||||
|
||||
//qDebug() << files_text;
|
||||
|
||||
QString files_text = Seer::parseFirst(text, "files=", '[', ']', false);
|
||||
QStringList files_list = Seer::parse(files_text, "", '{', '}', false);
|
||||
|
||||
// Set up a map to look for duplicate entries. QMap<fullname,file>
|
||||
QMap<QString,QString> files;
|
||||
|
||||
for ( const auto& entry_text : files_list ) {
|
||||
|
||||
QString file_text = Seer::parseFirst(entry_text, "file=", '"', '"', false);
|
||||
@@ -76,6 +77,13 @@ void SeerSourceBrowserWidget::handleText (const QString& text) {
|
||||
|
||||
//qDebug() << file_text << fullname_text;
|
||||
|
||||
// Skip duplicates
|
||||
if (files.contains(fullname_text)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
files.insert(fullname_text, file_text);
|
||||
|
||||
// Get information about the file.
|
||||
QFileInfo fileInfo(fullname_text);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user