@@ -39,14 +39,14 @@ void ThreadResult::finishCheck(const CheckThread::Details& details)
3939{
4040 std::lock_guard<std::mutex> locker (mutex);
4141
42- mProgress += QFile (details.file ).size ();
42+ mCheckedFileSize += QFile (details.file ).size ();
4343 mFilesChecked ++;
4444
45- if (mMaxProgress > 0 ) {
46- const int value = static_cast <int >(PROGRESS_MAX * mProgress / mMaxProgress );
45+ if (mTotalFileSize > 0 ) {
46+ const int value = static_cast <int >(PROGRESS_MAX * mCheckedFileSize / mTotalFileSize );
4747 const QString description = tr (" %1 of %2 files checked" ).arg (mFilesChecked ).arg (mTotalFiles );
4848
49- emit progress (value, description);
49+ emit filesCheckedProgress (value, description);
5050 }
5151}
5252
@@ -60,6 +60,10 @@ void ThreadResult::reportErr(const ErrorMessage &msg)
6060 emit debugError (item);
6161}
6262
63+ void ThreadResult::reportProgress (const std::string &filename, const char stage[], const std::size_t value) {
64+ emit progress (QString::fromStdString (filename), stage, value);
65+ }
66+
6367void ThreadResult::getNextFile (const FileWithDetails*& file)
6468{
6569 std::lock_guard<std::mutex> locker (mutex);
@@ -88,15 +92,15 @@ void ThreadResult::setFiles(std::list<FileWithDetails> files)
8892 mTotalFiles = files.size ();
8993 mFiles = std::move (files);
9094 mItNextFile = mFiles .cbegin ();
91- mProgress = 0 ;
95+ mCheckedFileSize = 0 ;
9296 mFilesChecked = 0 ;
9397
9498 // Determine the total size of all of the files to check, so that we can
9599 // show an accurate progress estimate
96100 quint64 sizeOfFiles = std::accumulate (mFiles .cbegin (), mFiles .cend (), 0 , [](quint64 total, const FileWithDetails& file) {
97101 return total + file.size ();
98102 });
99- mMaxProgress = sizeOfFiles;
103+ mTotalFileSize = sizeOfFiles;
100104}
101105
102106void ThreadResult::setProject (const ImportProject &prj)
@@ -106,13 +110,13 @@ void ThreadResult::setProject(const ImportProject &prj)
106110 mItNextFile = mFiles .cbegin ();
107111 mFileSettings = prj.fileSettings ;
108112 mItNextFileSettings = mFileSettings .cbegin ();
109- mProgress = 0 ;
113+ mCheckedFileSize = 0 ;
110114 mFilesChecked = 0 ;
111115 mTotalFiles = prj.fileSettings .size ();
112116
113117 // Determine the total size of all of the files to check, so that we can
114118 // show an accurate progress estimate
115- mMaxProgress = std::accumulate (prj.fileSettings .begin (), prj.fileSettings .end (), quint64{ 0 }, [](quint64 v, const FileSettings& fs) {
119+ mTotalFileSize = std::accumulate (prj.fileSettings .begin (), prj.fileSettings .end (), quint64{ 0 }, [](quint64 v, const FileSettings& fs) {
116120 return v + QFile (QString::fromStdString (fs.filename ())).size ();
117121 });
118122}
0 commit comments