refs #536 Moved CDataCache serialization into a worker thread.

This commit is contained in:
Mathew Sutcliffe
2015-12-06 19:25:12 +00:00
parent e266ccefad
commit 366030f2a9
4 changed files with 93 additions and 27 deletions

View File

@@ -249,19 +249,17 @@ namespace BlackMisc
{
QMutexLocker lock(&m_mutex);
CValueCachePacket values;
auto status = loadFromFiles(dir, values);
auto status = loadFromFiles(dir, getAllValues(), values);
insertValues(values);
return status;
}
CStatusMessage CValueCache::loadFromFiles(const QString &dir, CValueCachePacket &o_values) const
CStatusMessage CValueCache::loadFromFiles(const QString &dir, const CVariantMap &currentValues, CValueCachePacket &o_values) const
{
QMutexLocker lock(&m_mutex);
if (! QDir(dir).isReadable())
{
return CLogMessage(this).error("Failed to read directory %1") << dir;
}
auto currentValues = getAllValues();
for (const auto &filename : QDir(dir).entryList({ "*.json" }, QDir::Files))
{
QFile file(dir + "/" + filename);