mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-06 02:16:04 +08:00
Ref T286, multi caches/setting utility functions to check other versions
This commit is contained in:
@@ -7,9 +7,10 @@
|
|||||||
* contained in the LICENSE file.
|
* contained in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "blackmisc/simulation/data/modelcaches.h"
|
||||||
|
#include "blackmisc/cachesettingsutils.h"
|
||||||
#include "blackmisc/logmessage.h"
|
#include "blackmisc/logmessage.h"
|
||||||
#include "blackmisc/verify.h"
|
#include "blackmisc/verify.h"
|
||||||
#include "blackmisc/simulation/data/modelcaches.h"
|
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
|
||||||
using namespace BlackMisc;
|
using namespace BlackMisc;
|
||||||
@@ -53,6 +54,22 @@ namespace BlackMisc
|
|||||||
return this->getCachedModels(simulator).size();
|
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
|
QStringList IMultiSimulatorModelCaches::getAllFilenames() const
|
||||||
{
|
{
|
||||||
return QStringList(
|
return QStringList(
|
||||||
|
|||||||
@@ -12,12 +12,13 @@
|
|||||||
#ifndef BLACKMISC_SIMULATION_DATA_MODELCACHES
|
#ifndef BLACKMISC_SIMULATION_DATA_MODELCACHES
|
||||||
#define BLACKMISC_SIMULATION_DATA_MODELCACHES
|
#define BLACKMISC_SIMULATION_DATA_MODELCACHES
|
||||||
|
|
||||||
#include "blackmisc/blackmiscexport.h"
|
|
||||||
#include "blackmisc/datacache.h"
|
|
||||||
#include "blackmisc/simulation/aircraftmodelinterfaces.h"
|
#include "blackmisc/simulation/aircraftmodelinterfaces.h"
|
||||||
#include "blackmisc/simulation/aircraftmodellist.h"
|
#include "blackmisc/simulation/aircraftmodellist.h"
|
||||||
#include "blackmisc/simulation/simulatorinfo.h"
|
#include "blackmisc/simulation/simulatorinfo.h"
|
||||||
|
#include "blackmisc/applicationinfo.h"
|
||||||
#include "blackmisc/statusmessage.h"
|
#include "blackmisc/statusmessage.h"
|
||||||
|
#include "blackmisc/datacache.h"
|
||||||
|
#include "blackmisc/blackmiscexport.h"
|
||||||
|
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
@@ -170,6 +171,12 @@ namespace BlackMisc
|
|||||||
//! Get filename for simulator cache file
|
//! Get filename for simulator cache file
|
||||||
virtual QString getFilename(const BlackMisc::Simulation::CSimulatorInfo &simulator) const = 0;
|
virtual QString getFilename(const BlackMisc::Simulation::CSimulatorInfo &simulator) const = 0;
|
||||||
|
|
||||||
|
//! Has the other version the file?
|
||||||
|
bool hasOtherVersionFile(const BlackMisc::CApplicationInfo &info, const BlackMisc::Simulation::CSimulatorInfo &simulator) const;
|
||||||
|
|
||||||
|
//! Simulators of given other versionwhich have a cache file
|
||||||
|
BlackMisc::Simulation::CSimulatorInfo otherVersionSimulatorsWithFile(const BlackMisc::CApplicationInfo &info) const;
|
||||||
|
|
||||||
//! All file names
|
//! All file names
|
||||||
virtual QStringList getAllFilenames() const;
|
virtual QStringList getAllFilenames() const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user