mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
refs #619, change model loader to use caches (one per simulator)
* removed caching from GUI component * added caches in model loader * adjusted samples
This commit is contained in:
@@ -15,6 +15,8 @@
|
||||
#include "blackmisc/simulation/fscommon/aircraftcfgentrieslist.h"
|
||||
#include "blackmisc/simulation/fscommon/aircraftcfgparser.h"
|
||||
#include "blackmisc/simulation/aircraftmatcher.h"
|
||||
#include "blackmisc/simulation/simulatorinfo.h"
|
||||
|
||||
|
||||
#include <QDebug>
|
||||
#include <QFuture>
|
||||
@@ -24,16 +26,17 @@
|
||||
#include <QJsonDocument>
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Simulation;
|
||||
using namespace BlackMisc::Simulation::FsCommon;
|
||||
|
||||
namespace BlackSample
|
||||
{
|
||||
void CSamplesFsCommon::samples(QTextStream &streamOut, QTextStream &streamIn)
|
||||
{
|
||||
QString fsxDir = CSampleUtils::selectDirectory({"C:/Program Files (x86)/Microsoft Games/Microsoft Flight Simulator X/SimObjects",
|
||||
const QString fsxDir = CSampleUtils::selectDirectory({"C:/Program Files (x86)/Microsoft Games/Microsoft Flight Simulator X/SimObjects",
|
||||
"C:/Flight Simulator 9/Aircraft"}, streamOut, streamIn);
|
||||
|
||||
CAircraftCfgParser parser;
|
||||
CAircraftCfgParser parser(CSimulatorInfo(CSimulatorInfo::FSX), fsxDir);
|
||||
parser.changeRootDirectory(fsxDir);
|
||||
|
||||
streamOut << "start reading, press RETURN" << endl;
|
||||
|
||||
@@ -43,12 +43,12 @@ namespace BlackSample
|
||||
streamOut << "loaded: " << BlackMisc::boolToYesNo(s) << " size: " << cvm->getDatastoreModels().size() << endl;
|
||||
|
||||
// mapper with rule set, handing over ownership
|
||||
CAircraftCfgParser cfgParser;
|
||||
QString fsxDir = CSampleUtils::selectDirectory({QStringLiteral("P:/FlightSimulatorX (MSI)/SimObjects"),
|
||||
QStringLiteral("P:/Temp/SimObjects"),
|
||||
QStringLiteral("C:/Flight Simulator 9/Aircraft")
|
||||
}, streamOut, streamIn);
|
||||
|
||||
CAircraftCfgParser cfgParser(CSimulatorInfo(CSimulatorInfo::FSX), fsxDir);
|
||||
if (!cfgParser.changeRootDirectory(fsxDir))
|
||||
{
|
||||
streamOut << "Wrong or empty directoy " << fsxDir << endl;
|
||||
@@ -56,7 +56,7 @@ namespace BlackSample
|
||||
}
|
||||
|
||||
streamOut << "Start reading models" << endl;
|
||||
cfgParser.startLoading(CAircraftCfgParser::ModeBlocking);
|
||||
cfgParser.startLoading(CAircraftCfgParser::CacheSkipped | CAircraftCfgParser::LoadDirectly);
|
||||
streamOut << "Read models: " << cfgParser.getAircraftCfgEntriesList().size() << endl;
|
||||
streamOut << "Ambigious models: " << cfgParser.getAircraftCfgEntriesList().detectAmbiguousTitles().join(", ") << endl;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user