MCPcopy Create free account
hub / github.com/IENT/YUView / openStatisticsFile

Method openStatisticsFile

YUViewLib/src/playlistitem/playlistItemStatisticsFile.cpp:266–306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

264}
265
266void playlistItemStatisticsFile::openStatisticsFile()
267{
268 // Is the background parser still running? If yes, abort it.
269 if (this->backgroundParserFuture.isRunning())
270 {
271 // signal to background thread that we want to cancel the processing
272 this->breakBackgroundAtomic.store(true);
273 this->backgroundParserFuture.waitForFinished();
274 }
275
276 auto suffix = QFileInfo(this->prop.name).suffix();
277 if (this->openMode == OpenMode::CSVFile ||
278 (this->openMode == OpenMode::Extension && suffix == "csv"))
279 this->file.reset(new stats::StatisticsFileCSV(this->prop.name, this->statisticsData));
280 else if (this->openMode == OpenMode::VTMBMSFile ||
281 (this->openMode == OpenMode::Extension && suffix == "vtmbmsstats"))
282 this->file.reset(new stats::StatisticsFileVTMBMS(this->prop.name, this->statisticsData));
283 else
284 assert(false);
285
286 connect(this->file.get(),
287 &stats::StatisticsFileBase::readPOC,
288 this,
289 &playlistItemStatisticsFile::onPOCParsed);
290 connect(this->file.get(),
291 &stats::StatisticsFileBase::readPOCType,
292 this,
293 &playlistItemStatisticsFile::onPOCTypeParsed);
294
295 // Run the parsing of the file in the background
296 this->timer.start(1000, this);
297 this->breakBackgroundAtomic.store(false);
298 this->backgroundParserFuture = QtConcurrent::run(
299 [=](stats::StatisticsFileBase *file) {
300 file->readFrameAndTypePositionsFromFile(std::ref(this->breakBackgroundAtomic));
301 },
302 this->file.get());
303
304 DEBUG_STAT(
305 "playlistItemStatisticsFile::openStatisticsFile File opened. Background parsing started.");
306}
307
308// This timer event is called regularly when the background loading process is running.
309void playlistItemStatisticsFile::timerEvent(QTimerEvent *event)

Callers 2

reloadItemSourceMethod · 0.95

Calls 2

isRunningMethod · 0.80

Tested by

no test coverage detected