mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 04:25:35 +08:00
refs #483, call in background via QTimer::singleShot
As proposed https://dev.vatsim-germany.org/issues/483
This commit is contained in:
committed by
Mathew Sutcliffe
parent
a9a6fbc4c0
commit
805ebb109b
@@ -13,6 +13,7 @@
|
||||
#include "blackmisc/fileutilities.h"
|
||||
#include "modeldatareader.h"
|
||||
|
||||
#include <QTimer>
|
||||
#include <QRegularExpression>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
@@ -323,14 +324,15 @@ namespace BlackCore
|
||||
return (reallyRead & CEntityFlags::DistributorLiveryModel) == whatToRead;
|
||||
}
|
||||
|
||||
CWorker *CModelDataReader::readFromJsonFilesInBackground(const QString &dir, CEntityFlags::Entity whatToRead)
|
||||
bool CModelDataReader::readFromJsonFilesInBackground(const QString &dir, CEntityFlags::Entity whatToRead)
|
||||
{
|
||||
CWorker *worker = BlackMisc::CWorker::fromTask(this, "CModelDataReader::readFromJsonFilesInBackground", [this, dir, whatToRead]()
|
||||
if (dir.isEmpty() || whatToRead == CEntityFlags::NoEntity) { return false; }
|
||||
QTimer::singleShot(0, this, [this, dir, whatToRead]()
|
||||
{
|
||||
bool s = this->readFromJsonFiles(dir, whatToRead);
|
||||
Q_UNUSED(s);
|
||||
});
|
||||
return worker;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CModelDataReader::writeToJsonFiles(const QString &dir) const
|
||||
|
||||
Reference in New Issue
Block a user