Ref T286, multi caches/setting utility functions to check other versions

This commit is contained in:
Klaus Basan
2018-07-03 19:43:06 +02:00
parent a2bca21715
commit f2820d81a4
2 changed files with 27 additions and 3 deletions

View File

@@ -7,9 +7,10 @@
* contained in the LICENSE file.
*/
#include "blackmisc/simulation/data/modelcaches.h"
#include "blackmisc/cachesettingsutils.h"
#include "blackmisc/logmessage.h"
#include "blackmisc/verify.h"
#include "blackmisc/simulation/data/modelcaches.h"
#include <QtGlobal>
using namespace BlackMisc;
@@ -53,6 +54,22 @@ namespace BlackMisc
return this->getCachedModels(simulator).size();
}
bool IMultiSimulatorModelCaches::hasOtherVersionFile(const CApplicationInfo &info, const CSimulatorInfo &simulator) const
{
const QString fn = this->getFilename(simulator);
return CCacheSettingsUtils::hasOtherVersionCacheFile(info, fn);
}
CSimulatorInfo IMultiSimulatorModelCaches::otherVersionSimulatorsWithFile(const CApplicationInfo &info) const
{
CSimulatorInfo sim = CSimulatorInfo(CSimulatorInfo::None);
if (this->hasOtherVersionFile(info, CSimulatorInfo::fsx())) { sim.addSimulator(CSimulatorInfo::fsx()); }
if (this->hasOtherVersionFile(info, CSimulatorInfo::p3d())) { sim.addSimulator(CSimulatorInfo::p3d()); }
if (this->hasOtherVersionFile(info, CSimulatorInfo::fs9())) { sim.addSimulator(CSimulatorInfo::fs9()); }
if (this->hasOtherVersionFile(info, CSimulatorInfo::xplane())) { sim.addSimulator(CSimulatorInfo::xplane()); }
return sim;
}
QStringList IMultiSimulatorModelCaches::getAllFilenames() const
{
return QStringList(