forked from qt-creator/qt-creator
FileSearch: Add some logging for search progress
Change-Id: I453b04eb3701035138900d699d4e69d5fd9b99df Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -32,12 +32,15 @@
|
|||||||
#include "stringutils.h"
|
#include "stringutils.h"
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
#include <QLoggingCategory>
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
#include <QTextCodec>
|
#include <QTextCodec>
|
||||||
|
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
|
|
||||||
|
Q_LOGGING_CATEGORY(log, "qtc.utils.filesearch", QtWarningMsg)
|
||||||
|
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|
||||||
static inline QString msgCanceled(const QString &searchTerm, int numMatches, int numFilesSearched)
|
static inline QString msgCanceled(const QString &searchTerm, int numMatches, int numFilesSearched)
|
||||||
@@ -140,11 +143,13 @@ void FileSearch::operator()(QFutureInterface<FileSearchResultList> &futureInterf
|
|||||||
{
|
{
|
||||||
if (futureInterface.isCanceled())
|
if (futureInterface.isCanceled())
|
||||||
return;
|
return;
|
||||||
|
qCDebug(log) << "Searching in" << item.filePath;
|
||||||
futureInterface.setProgressRange(0, 1);
|
futureInterface.setProgressRange(0, 1);
|
||||||
futureInterface.setProgressValue(0);
|
futureInterface.setProgressValue(0);
|
||||||
FileSearchResultList results;
|
FileSearchResultList results;
|
||||||
QString tempString;
|
QString tempString;
|
||||||
if (!getFileContent(item.filePath, item.encoding, &tempString, fileToContentsMap)) {
|
if (!getFileContent(item.filePath, item.encoding, &tempString, fileToContentsMap)) {
|
||||||
|
qCDebug(log) << "- failed to get content for" << item.filePath;
|
||||||
futureInterface.cancel(); // failure
|
futureInterface.cancel(); // failure
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -222,6 +227,7 @@ void FileSearch::operator()(QFutureInterface<FileSearchResultList> &futureInterf
|
|||||||
futureInterface.reportResult(results);
|
futureInterface.reportResult(results);
|
||||||
futureInterface.setProgressValue(1);
|
futureInterface.setProgressValue(1);
|
||||||
}
|
}
|
||||||
|
qCDebug(log) << "- finished searching in" << item.filePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileSearchRegExp::FileSearchRegExp(const QString &searchTerm, QTextDocument::FindFlags flags,
|
FileSearchRegExp::FileSearchRegExp(const QString &searchTerm, QTextDocument::FindFlags flags,
|
||||||
@@ -257,11 +263,13 @@ void FileSearchRegExp::operator()(QFutureInterface<FileSearchResultList> &future
|
|||||||
}
|
}
|
||||||
if (futureInterface.isCanceled())
|
if (futureInterface.isCanceled())
|
||||||
return;
|
return;
|
||||||
|
qCDebug(log) << "Searching in" << item.filePath;
|
||||||
futureInterface.setProgressRange(0, 1);
|
futureInterface.setProgressRange(0, 1);
|
||||||
futureInterface.setProgressValue(0);
|
futureInterface.setProgressValue(0);
|
||||||
FileSearchResultList results;
|
FileSearchResultList results;
|
||||||
QString tempString;
|
QString tempString;
|
||||||
if (!getFileContent(item.filePath, item.encoding, &tempString, fileToContentsMap)) {
|
if (!getFileContent(item.filePath, item.encoding, &tempString, fileToContentsMap)) {
|
||||||
|
qCDebug(log) << "- failed to get content for" << item.filePath;
|
||||||
futureInterface.cancel(); // failure
|
futureInterface.cancel(); // failure
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -296,6 +304,7 @@ void FileSearchRegExp::operator()(QFutureInterface<FileSearchResultList> &future
|
|||||||
futureInterface.reportResult(results);
|
futureInterface.reportResult(results);
|
||||||
futureInterface.setProgressValue(1);
|
futureInterface.setProgressValue(1);
|
||||||
}
|
}
|
||||||
|
qCDebug(log) << "- finished searching in" << item.filePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct SearchState
|
struct SearchState
|
||||||
|
|||||||
Reference in New Issue
Block a user