mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 21:56:43 +08:00
Ref T246, unified signal handling in model caches and loader
* setSimulator as checked, simulatorChanged as unchecked version * some renamings * made some functions private, turned public slots -> public
This commit is contained in:
@@ -20,7 +20,7 @@ namespace BlackMisc
|
||||
{
|
||||
CAircraftModelSetLoader::CAircraftModelSetLoader(QObject *parent) : QObject(parent)
|
||||
{
|
||||
connect(&m_caches, &CModelSetCaches::cacheChanged, this, &CAircraftModelSetLoader::cacheChanged);
|
||||
connect(&m_caches, &CModelSetCaches::cacheChanged, this, &CAircraftModelSetLoader::onModelsCacheChanged);
|
||||
}
|
||||
|
||||
CAircraftModelSetLoader::~CAircraftModelSetLoader()
|
||||
@@ -56,11 +56,9 @@ namespace BlackMisc
|
||||
|
||||
void CAircraftModelSetLoader::changeSimulator(const CSimulatorInfo &simulator)
|
||||
{
|
||||
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "Only one simulator per loader");
|
||||
if (this->getSimulator() == simulator) { return; }
|
||||
m_caches.setCurrentSimulator(simulator);
|
||||
m_caches.synchronizeCurrentCache();
|
||||
emit simulatorChanged(simulator);
|
||||
emit this->simulatorChanged(simulator);
|
||||
}
|
||||
|
||||
CAircraftModelList CAircraftModelSetLoader::getAircraftModels() const
|
||||
@@ -115,6 +113,12 @@ namespace BlackMisc
|
||||
return this->setCachedModels(CAircraftModelList());
|
||||
}
|
||||
|
||||
void CAircraftModelSetLoader::onModelsCacheChanged(const CSimulatorInfo &simulator)
|
||||
{
|
||||
this->changeSimulator(simulator);
|
||||
emit this->cacheChanged(simulator);
|
||||
}
|
||||
|
||||
CSimulatorInfo CAircraftModelSetLoader::getSimulator() const
|
||||
{
|
||||
return m_caches.getCurrentSimulator();
|
||||
@@ -125,6 +129,13 @@ namespace BlackMisc
|
||||
return this->getSimulator().toQString();
|
||||
}
|
||||
|
||||
void CAircraftModelSetLoader::setSimulator(const CSimulatorInfo &simulator)
|
||||
{
|
||||
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "Only one simulator per loader");
|
||||
if (this->getSimulator() == simulator) { return; }
|
||||
this->changeSimulator(simulator);
|
||||
}
|
||||
|
||||
bool CAircraftModelSetLoader::supportsSimulator(const CSimulatorInfo &info)
|
||||
{
|
||||
return this->getSimulator().matchesAny(info);
|
||||
|
||||
Reference in New Issue
Block a user