mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 11:55:35 +08:00
Caches: rename "get" to "getThreadLocal" and rename "getCopy" to get.
This commit is contained in:
committed by
Klaus Basan
parent
332d8e5fc8
commit
9bef6854ca
@@ -419,7 +419,7 @@ namespace BlackCore
|
||||
Q_ASSERT(this->m_voice);
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << notification; }
|
||||
|
||||
bool play = !considerSettings || m_audioSettings.get().getNotificationFlag(notification);
|
||||
bool play = !considerSettings || m_audioSettings.getThreadLocal().getNotificationFlag(notification);
|
||||
if (play)
|
||||
{
|
||||
CSoundGenerator::playNotificationSound(90, notification);
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace BlackCore
|
||||
CAltitude(312, CAltitude::MeanSeaLevel, CLengthUnit::ft())
|
||||
);
|
||||
this->m_ownAircraft.setSituation(situation);
|
||||
this->m_ownAircraft.setPilot(this->m_currentNetworkServer.get().getUser());
|
||||
this->m_ownAircraft.setPilot(this->m_currentNetworkServer.getThreadLocal().getUser());
|
||||
|
||||
// from simulator, if available
|
||||
this->m_ownAircraft.setCallsign(CCallsign("SWIFT")); // would come from settings
|
||||
|
||||
@@ -576,7 +576,7 @@ namespace BlackCore
|
||||
{
|
||||
stopSimulatorListeners();
|
||||
|
||||
auto enabledSimulators = m_enabledSimulators.get();
|
||||
auto enabledSimulators = m_enabledSimulators.getThreadLocal();
|
||||
auto allSimulators = m_plugins->getAvailableSimulatorPlugins();
|
||||
for (const CSimulatorPluginInfo& s: allSimulators)
|
||||
{
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace BlackCore
|
||||
}
|
||||
else
|
||||
{
|
||||
dbusAddress = m_dbusServerAddress.get();
|
||||
dbusAddress = m_dbusServerAddress.getThreadLocal();
|
||||
}
|
||||
|
||||
// DBus
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace BlackCore
|
||||
|
||||
CAircraftIcaoCodeList CIcaoDataReader::getAircraftIcaoCodes() const
|
||||
{
|
||||
return m_aircraftIcaoCache.getCopy();
|
||||
return m_aircraftIcaoCache.get();
|
||||
}
|
||||
|
||||
CAircraftIcaoCode CIcaoDataReader::getAircraftIcaoCodeForDesignator(const QString &designator) const
|
||||
@@ -62,7 +62,7 @@ namespace BlackCore
|
||||
|
||||
CAirlineIcaoCodeList CIcaoDataReader::getAirlineIcaoCodes() const
|
||||
{
|
||||
return m_airlineIcaoCache.getCopy();
|
||||
return m_airlineIcaoCache.get();
|
||||
}
|
||||
|
||||
CAircraftIcaoCode CIcaoDataReader::smartAircraftIcaoSelector(const CAircraftIcaoCode &icaoPattern) const
|
||||
@@ -73,7 +73,7 @@ namespace BlackCore
|
||||
|
||||
CCountryList CIcaoDataReader::getCountries() const
|
||||
{
|
||||
return m_countryCache.getCopy();
|
||||
return m_countryCache.get();
|
||||
}
|
||||
|
||||
CCountry CIcaoDataReader::getCountryForIsoCode(const QString &isoCode) const
|
||||
@@ -201,7 +201,7 @@ namespace BlackCore
|
||||
|
||||
void CIcaoDataReader::updateReaderUrl(const CUrl &url)
|
||||
{
|
||||
const CUrl current = this->m_readerUrlCache.getCopy();
|
||||
const CUrl current = this->m_readerUrlCache.get();
|
||||
if (current == url) { return; }
|
||||
const CStatusMessage m = this->m_readerUrlCache.set(url);
|
||||
if (m.isFailure())
|
||||
@@ -420,9 +420,9 @@ namespace BlackCore
|
||||
{
|
||||
switch (entity)
|
||||
{
|
||||
case CEntityFlags::AircraftIcaoEntity: return this->m_aircraftIcaoCache.getCopy().size();
|
||||
case CEntityFlags::AirlineIcaoEntity: return this->m_airlineIcaoCache.getCopy().size();
|
||||
case CEntityFlags::CountryEntity: return this->m_countryCache.getCopy().size();
|
||||
case CEntityFlags::AircraftIcaoEntity: return this->m_aircraftIcaoCache.get().size();
|
||||
case CEntityFlags::AirlineIcaoEntity: return this->m_airlineIcaoCache.get().size();
|
||||
case CEntityFlags::CountryEntity: return this->m_countryCache.get().size();
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
@@ -430,7 +430,7 @@ namespace BlackCore
|
||||
bool CIcaoDataReader::hasChangedUrl(CEntityFlags::Entity entity) const
|
||||
{
|
||||
Q_UNUSED(entity);
|
||||
return CDatabaseReader::isChangedUrl(this->m_readerUrlCache.getCopy(), this->getBaseUrl());
|
||||
return CDatabaseReader::isChangedUrl(this->m_readerUrlCache.get(), this->getBaseUrl());
|
||||
}
|
||||
|
||||
CUrl CIcaoDataReader::getAircraftIcaoUrl(bool shared) const
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace BlackCore
|
||||
|
||||
CLiveryList CModelDataReader::getLiveries() const
|
||||
{
|
||||
return this->m_liveryCache.getCopy();
|
||||
return this->m_liveryCache.get();
|
||||
}
|
||||
|
||||
CLivery CModelDataReader::getLiveryForCombinedCode(const QString &combinedCode) const
|
||||
@@ -79,12 +79,12 @@ namespace BlackCore
|
||||
|
||||
CDistributorList CModelDataReader::getDistributors() const
|
||||
{
|
||||
return m_distributorCache.getCopy();
|
||||
return m_distributorCache.get();
|
||||
}
|
||||
|
||||
CAircraftModelList CModelDataReader::getModels() const
|
||||
{
|
||||
return m_modelCache.getCopy();
|
||||
return m_modelCache.get();
|
||||
}
|
||||
|
||||
CAircraftModel CModelDataReader::getModelForModelString(const QString &modelString) const
|
||||
@@ -231,7 +231,7 @@ namespace BlackCore
|
||||
|
||||
void CModelDataReader::updateReaderUrl(const CUrl &url)
|
||||
{
|
||||
const CUrl current = this->m_readerUrlCache.getCopy();
|
||||
const CUrl current = this->m_readerUrlCache.get();
|
||||
if (current == url) { return; }
|
||||
const CStatusMessage m = this->m_readerUrlCache.set(url);
|
||||
if (m.isFailure())
|
||||
@@ -489,9 +489,9 @@ namespace BlackCore
|
||||
{
|
||||
switch (entity)
|
||||
{
|
||||
case CEntityFlags::LiveryEntity: return this->m_liveryCache.getCopy().size();
|
||||
case CEntityFlags::ModelEntity: return this->m_modelCache.getCopy().size();
|
||||
case CEntityFlags::DistributorEntity: return this->m_distributorCache.getCopy().size();
|
||||
case CEntityFlags::LiveryEntity: return this->m_liveryCache.get().size();
|
||||
case CEntityFlags::ModelEntity: return this->m_modelCache.get().size();
|
||||
case CEntityFlags::DistributorEntity: return this->m_distributorCache.get().size();
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
@@ -499,7 +499,7 @@ namespace BlackCore
|
||||
bool CModelDataReader::hasChangedUrl(CEntityFlags::Entity entity) const
|
||||
{
|
||||
Q_UNUSED(entity);
|
||||
return CDatabaseReader::isChangedUrl(this->m_readerUrlCache.getCopy(), this->getBaseUrl());
|
||||
return CDatabaseReader::isChangedUrl(this->m_readerUrlCache.get(), this->getBaseUrl());
|
||||
}
|
||||
|
||||
const CUrl &CModelDataReader::getBaseUrl()
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace BlackCore
|
||||
void CInputManager::ps_changeHotkeySettings()
|
||||
{
|
||||
m_configuredActions.clear();
|
||||
for (CActionHotkey actionHotkey : m_actionHotkeys.get())
|
||||
for (CActionHotkey actionHotkey : m_actionHotkeys.getThreadLocal())
|
||||
{
|
||||
CHotkeyCombination combination = actionHotkey.getCombination();
|
||||
if (combination.isEmpty()) continue;
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace BlackCore
|
||||
: INetwork(parent), COwnAircraftAware(ownAircraft),
|
||||
m_loginMode(LoginNormal),
|
||||
m_status(vatStatusIdle),
|
||||
m_fsdTextCodec(QTextCodec::codecForName(m_fsdTextCodecSetting.get().toLocal8Bit())),
|
||||
m_fsdTextCodec(QTextCodec::codecForName(m_fsdTextCodecSetting.getThreadLocal().toLocal8Bit())),
|
||||
m_tokenBucket(10, CTime(5, CTimeUnit::s()), 1)
|
||||
{
|
||||
connect(this, &CNetworkVatlib::terminate, this, &INetwork::terminateConnection, Qt::QueuedConnection);
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace BlackCore
|
||||
}
|
||||
|
||||
m_setup.synchronize(); // make sure it is loaded
|
||||
CGlobalSetup cachedSetup = m_setup.getCopy();
|
||||
CGlobalSetup cachedSetup = m_setup.get();
|
||||
const bool cacheAvailable = cachedSetup.wasLoaded();
|
||||
msgs.push_back(cacheAvailable ?
|
||||
CStatusMessage(this, CStatusMessage::SeverityInfo , "Cached setup syncronized and contains data") :
|
||||
@@ -281,7 +281,7 @@ namespace BlackCore
|
||||
}
|
||||
else
|
||||
{
|
||||
const CGlobalSetup currentSetup = m_setup.getCopy();
|
||||
const CGlobalSetup currentSetup = m_setup.get();
|
||||
CGlobalSetup loadedSetup;
|
||||
loadedSetup.convertFromJson(Json::jsonObjectFromString(setupJson));
|
||||
loadedSetup.markAsLoaded(true);
|
||||
@@ -410,12 +410,12 @@ namespace BlackCore
|
||||
|
||||
CGlobalSetup CSetupReader::getSetup() const
|
||||
{
|
||||
return m_setup.getCopy();
|
||||
return m_setup.get();
|
||||
}
|
||||
|
||||
CUpdateInfo CSetupReader::getUpdateInfo() const
|
||||
{
|
||||
return m_updateInfo.getCopy();
|
||||
return m_updateInfo.get();
|
||||
}
|
||||
|
||||
CStatusMessageList CSetupReader::manageSetupAvailability(bool webRead, bool localRead)
|
||||
@@ -440,7 +440,7 @@ namespace BlackCore
|
||||
}
|
||||
else
|
||||
{
|
||||
bool cacheAvailable = this->m_setup.get().wasLoaded();
|
||||
bool cacheAvailable = this->m_setup.getThreadLocal().wasLoaded();
|
||||
available = cacheAvailable && this->m_bootstrapMode != Explicit;
|
||||
}
|
||||
|
||||
|
||||
@@ -86,12 +86,12 @@ namespace BlackCore
|
||||
|
||||
CServerList CVatsimDataFileReader::getVoiceServers() const
|
||||
{
|
||||
return this->m_lastGoodSetup.getCopy().getVoiceServers();
|
||||
return this->m_lastGoodSetup.get().getVoiceServers();
|
||||
}
|
||||
|
||||
CServerList CVatsimDataFileReader::getFsdServers() const
|
||||
{
|
||||
return this->m_lastGoodSetup.getCopy().getFsdServers();
|
||||
return this->m_lastGoodSetup.get().getFsdServers();
|
||||
}
|
||||
|
||||
CUserList CVatsimDataFileReader::getPilotsForCallsigns(const CCallsignSet &callsigns)
|
||||
@@ -379,7 +379,7 @@ namespace BlackCore
|
||||
this->m_aircraft = aircraft;
|
||||
this->m_atcStations = atcStations;
|
||||
this->m_voiceCapabilities = voiceCapabilities;
|
||||
CVatsimSetup vs(this->m_lastGoodSetup.get());
|
||||
CVatsimSetup vs(this->m_lastGoodSetup.getThreadLocal());
|
||||
vs.setVoiceServers(voiceServers);
|
||||
vs.setFsdServers(fsdServers);
|
||||
vs.setUtcTimestamp(updateTimestampFromFile);
|
||||
|
||||
@@ -53,12 +53,12 @@ namespace BlackCore
|
||||
|
||||
CUrlList CVatsimStatusFileReader::getMetarFileUrls() const
|
||||
{
|
||||
return this->m_lastGoodSetup.getCopy().getMetarFileUrls();
|
||||
return this->m_lastGoodSetup.get().getMetarFileUrls();
|
||||
}
|
||||
|
||||
CUrlList CVatsimStatusFileReader::getDataFileUrls() const
|
||||
{
|
||||
return this->m_lastGoodSetup.getCopy().getDataFileUrls();
|
||||
return this->m_lastGoodSetup.get().getDataFileUrls();
|
||||
}
|
||||
|
||||
void CVatsimStatusFileReader::cleanup()
|
||||
@@ -148,7 +148,7 @@ namespace BlackCore
|
||||
// this part needs to be synchronized
|
||||
{
|
||||
// cache itself is thread safe
|
||||
CVatsimSetup vs(this->m_lastGoodSetup.getCopy());
|
||||
CVatsimSetup vs(this->m_lastGoodSetup.get());
|
||||
vs.setDataFileUrls(dataFiles);
|
||||
vs.setMetarFileUrls(metarFiles);
|
||||
vs.setServerFileUrls(serverFiles);
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace BlackGui
|
||||
|
||||
void CAudioSetupComponent::ps_reloadSettings()
|
||||
{
|
||||
CSettingsAudio as(m_audioSettings.get());
|
||||
CSettingsAudio as(m_audioSettings.getThreadLocal());
|
||||
this->ui->cb_SetupAudioPlayNotificationSounds->setChecked(true);
|
||||
this->ui->cb_SetupAudioNotificationTextMessage->setChecked(as.getNotificationFlag(CNotificationSounds::NotificationTextMessagePrivate));
|
||||
this->ui->cb_SetupAudioNotificationVoiceRoom->setChecked(as.getNotificationFlag(CNotificationSounds::NotificationVoiceRoomJoined));
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace BlackGui
|
||||
|
||||
void CDbDebugDatabaseSetup::ps_debugChanged(bool set)
|
||||
{
|
||||
CGlobalSetup gs(m_setup.get());
|
||||
CGlobalSetup gs(m_setup.getThreadLocal());
|
||||
gs.setServerDebugFlag(set);
|
||||
m_setup.set(gs);
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace BlackGui
|
||||
|
||||
// should be single simulator or no simulator (default)
|
||||
this->m_simulatorSelection.synchronize();
|
||||
const CSimulatorInfo simulator(this->m_simulatorSelection.getCopy());
|
||||
const CSimulatorInfo simulator(this->m_simulatorSelection.get());
|
||||
const bool s = this->initModelLoader(!simulator.isSingleSimulator() ? CSimulatorInfo(CSimulatorInfo::FSX) : simulator);
|
||||
if (s)
|
||||
{
|
||||
|
||||
@@ -278,7 +278,7 @@ namespace BlackGui
|
||||
|
||||
void CDbOwnModelSetComponent::ps_distributorPreferencesChanged()
|
||||
{
|
||||
const CDistributorListPreferences preferences = this->m_distributorPreferences.get();
|
||||
const CDistributorListPreferences preferences = this->m_distributorPreferences.getThreadLocal();
|
||||
const CSimulatorInfo simuulator = preferences.getLastUpdatedSimulator();
|
||||
if (simuulator.isSingleSimulator())
|
||||
{
|
||||
@@ -316,7 +316,7 @@ namespace BlackGui
|
||||
{
|
||||
CAircraftModelList modelSet = this->m_modelSetLoader.getAircraftModels(simulator);
|
||||
if (modelSet.isEmpty()) { return; }
|
||||
const CDistributorListPreferences preferences = this->m_distributorPreferences.get();
|
||||
const CDistributorListPreferences preferences = this->m_distributorPreferences.getThreadLocal();
|
||||
const CDistributorList distributors = preferences.getDistributors(simulator);
|
||||
if (distributors.isEmpty()) { return; }
|
||||
modelSet.updateDistributorOrder(distributors);
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace BlackGui
|
||||
{
|
||||
// changed somewhere else
|
||||
const CSimulatorInfo sim(ui->comp_SimulatorSelector->getValue());
|
||||
const CDistributorList distributors = this->m_distributorPreferences.get().getDistributors(sim);
|
||||
const CDistributorList distributors = this->m_distributorPreferences.getThreadLocal().getDistributors(sim);
|
||||
this->updateContainerMaybeAsync(distributors);
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ namespace BlackGui
|
||||
{
|
||||
const CDistributorList distributors(ui->tvp_Distributors->container());
|
||||
const CSimulatorInfo simulator = ui->comp_SimulatorSelector->getValue();
|
||||
CDistributorListPreferences preferences = this->m_distributorPreferences.get();
|
||||
CDistributorListPreferences preferences = this->m_distributorPreferences.getThreadLocal();
|
||||
preferences.setDistributors(distributors, simulator);
|
||||
const CStatusMessage m = this->m_distributorPreferences.setAndSave(preferences);
|
||||
CLogMessage::preformatted(m);
|
||||
@@ -137,7 +137,7 @@ namespace BlackGui
|
||||
void CDistributorPreferencesComponent::ps_simulatorChanged(const CSimulatorInfo &simulator)
|
||||
{
|
||||
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "Expect single simulator");
|
||||
const CDistributorList distributors(this->m_distributorPreferences.get().getDistributors(simulator));
|
||||
const CDistributorList distributors(this->m_distributorPreferences.getThreadLocal().getDistributors(simulator));
|
||||
ui->tvp_Distributors->updateContainerMaybeAsync(distributors);
|
||||
}
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ namespace BlackGui
|
||||
ps_validateAircraftValues();
|
||||
ps_validateVatsimValues();
|
||||
ps_onWebServiceDataRead(CEntityFlags::VatsimDataFile, CEntityFlags::ReadFinished, -1);
|
||||
CServerList otherServers(this->m_otherTrafficNetworkServers.get());
|
||||
CServerList otherServers(this->m_otherTrafficNetworkServers.getThreadLocal());
|
||||
|
||||
// add a testserver when no servers can be loaded
|
||||
if (otherServers.isEmpty() && (sGui->isRunningInDeveloperEnvironment() || CBuildConfig::isBetaTest()))
|
||||
@@ -470,7 +470,7 @@ namespace BlackGui
|
||||
|
||||
void CLoginComponent::ps_reloadSettings()
|
||||
{
|
||||
CServerList otherServers(this->m_otherTrafficNetworkServers.get());
|
||||
CServerList otherServers(this->m_otherTrafficNetworkServers.getThreadLocal());
|
||||
this->ui->cbp_OtherServers->setServers(otherServers);
|
||||
}
|
||||
|
||||
|
||||
@@ -106,28 +106,28 @@ namespace BlackGui
|
||||
|
||||
void CSettingsHotkeyComponent::addHotkeytoSettings(const CActionHotkey &actionHotkey)
|
||||
{
|
||||
CActionHotkeyList actionHotkeyList(m_actionHotkeys.get());
|
||||
CActionHotkeyList actionHotkeyList(m_actionHotkeys.getThreadLocal());
|
||||
actionHotkeyList.push_back(actionHotkey);
|
||||
m_actionHotkeys.set(actionHotkeyList);
|
||||
}
|
||||
|
||||
void CSettingsHotkeyComponent::updateHotkeyInSettings(const CActionHotkey &oldValue, const CActionHotkey &newValue)
|
||||
{
|
||||
CActionHotkeyList actionHotkeyList(m_actionHotkeys.get());
|
||||
CActionHotkeyList actionHotkeyList(m_actionHotkeys.getThreadLocal());
|
||||
actionHotkeyList.replace(oldValue, newValue);
|
||||
m_actionHotkeys.set(actionHotkeyList);
|
||||
}
|
||||
|
||||
void CSettingsHotkeyComponent::removeHotkeyFromSettings(const CActionHotkey &actionHotkey)
|
||||
{
|
||||
CActionHotkeyList actionHotkeyList(m_actionHotkeys.get());
|
||||
CActionHotkeyList actionHotkeyList(m_actionHotkeys.getThreadLocal());
|
||||
actionHotkeyList.remove(actionHotkey);
|
||||
m_actionHotkeys.set(actionHotkeyList);
|
||||
}
|
||||
|
||||
bool CSettingsHotkeyComponent::checkAndConfirmConflicts(const CActionHotkey &actionHotkey, const CActionHotkeyList &ignore)
|
||||
{
|
||||
auto configuredHotkeys = m_actionHotkeys.get();
|
||||
auto configuredHotkeys = m_actionHotkeys.getThreadLocal();
|
||||
CActionHotkeyList conflicts = configuredHotkeys.findSupersetsOf(actionHotkey);
|
||||
conflicts.push_back(configuredHotkeys.findSubsetsOf(actionHotkey));
|
||||
conflicts.removeIfIn(ignore);
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace BlackGui
|
||||
|
||||
void CSettingsNetworkServersComponent::ps_reloadSettings()
|
||||
{
|
||||
CServerList serverList(m_trafficNetworkServers.getCopy());
|
||||
CServerList serverList(m_trafficNetworkServers.get());
|
||||
|
||||
// add swift test servers in case we have no servers:
|
||||
// this is debug/bootstrap feature we can continue to test when something goes wrong
|
||||
@@ -81,7 +81,7 @@ namespace BlackGui
|
||||
CStatusMessageList msgs = server.validate();
|
||||
if (!msgs.isEmpty()) { msgs.addCategories(this); }
|
||||
|
||||
CServerList serverList(m_trafficNetworkServers.get());
|
||||
CServerList serverList(m_trafficNetworkServers.getThreadLocal());
|
||||
QObject *sender = QObject::sender();
|
||||
CStatusMessage msg;
|
||||
bool changed = false;
|
||||
|
||||
@@ -150,7 +150,7 @@ namespace BlackGui
|
||||
return;
|
||||
}
|
||||
|
||||
auto e = m_enabledSimulators.get();
|
||||
auto e = m_enabledSimulators.getThreadLocal();
|
||||
if (enabled && !e.contains(selected->getIdentifier()))
|
||||
{
|
||||
e << selected->getIdentifier();
|
||||
@@ -301,7 +301,7 @@ namespace BlackGui
|
||||
void CSettingsSimulatorComponent::ps_reloadPluginConfig()
|
||||
{
|
||||
// list all available simulators
|
||||
auto enabledSimulators = m_enabledSimulators.get();
|
||||
auto enabledSimulators = m_enabledSimulators.getThreadLocal();
|
||||
for (const auto &p : getAvailablePlugins())
|
||||
{
|
||||
ui->ps_EnabledSimulators->setEnabled(p.getIdentifier(), enabledSimulators.contains(p.getIdentifier()));
|
||||
|
||||
@@ -536,7 +536,7 @@ namespace BlackGui
|
||||
void CDockWidget::initSettings()
|
||||
{
|
||||
const QString name(this->getNameForSettings());
|
||||
CSettingsDockWidgets all = this->m_settings.getCopy();
|
||||
CSettingsDockWidgets all = this->m_settings.get();
|
||||
if (all.contains(name)) { return; }
|
||||
all.getByNameOrInitToDefault(name);
|
||||
this->m_settings.set(all);
|
||||
@@ -551,7 +551,7 @@ namespace BlackGui
|
||||
|
||||
CSettingsDockWidget CDockWidget::getSettings() const
|
||||
{
|
||||
const CSettingsDockWidgets all = this->m_settings.getCopy();
|
||||
const CSettingsDockWidgets all = this->m_settings.get();
|
||||
const QString name(this->getNameForSettings());
|
||||
const CSettingsDockWidget s = all.value(name);
|
||||
return s;
|
||||
@@ -561,7 +561,7 @@ namespace BlackGui
|
||||
{
|
||||
const CSettingsDockWidget current = getSettings();
|
||||
if (current == settings) { return; }
|
||||
CSettingsDockWidgets all = this->m_settings.getCopy();
|
||||
CSettingsDockWidgets all = this->m_settings.get();
|
||||
const QString name(this->getNameForSettings());
|
||||
all.insert(name, settings);
|
||||
const CStatusMessage m = this->m_settings.set(all); // saved when shutdown
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace BlackGui
|
||||
|
||||
const BlackMisc::Network::CAuthenticatedUser &CForm::getSwiftDbUser() const
|
||||
{
|
||||
return this->m_swiftDbUser.get();
|
||||
return this->m_swiftDbUser.getThreadLocal();
|
||||
}
|
||||
|
||||
void CForm::ps_userChanged()
|
||||
|
||||
@@ -89,7 +89,7 @@ namespace BlackGui
|
||||
{
|
||||
Q_ASSERT_X(sGui && sGui->hasWebDataServices(), Q_FUNC_INFO, "Missing web data services");
|
||||
Q_ASSERT_X(this->m_simulator.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
|
||||
const CDistributorListPreferences prefs(this->m_distributorPreferences.getCopy());
|
||||
const CDistributorListPreferences prefs(this->m_distributorPreferences.get());
|
||||
const CDistributorList distributors(prefs.getDistributors(this->m_simulator));
|
||||
if (!distributors.isEmpty()) { return distributors; }
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace BlackGui
|
||||
|
||||
bool COwnModelSetForm::hasDIstributorPreferences() const
|
||||
{
|
||||
const CDistributorListPreferences prefs(this->m_distributorPreferences.getCopy());
|
||||
const CDistributorListPreferences prefs(this->m_distributorPreferences.get());
|
||||
return !prefs.getDistributors(this->m_simulator).isEmpty();
|
||||
}
|
||||
} // ns
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace BlackMisc
|
||||
CModelCaches::CModelCaches(QObject *parent) : IMultiSimulatorModelCaches(parent)
|
||||
{
|
||||
this->m_currentSimulator.synchronize();
|
||||
const CSimulatorInfo sim(this->m_currentSimulator.getCopy());
|
||||
const CSimulatorInfo sim(this->m_currentSimulator.get());
|
||||
this->syncronizeCacheImpl(sim);
|
||||
const QString simStr(sim.toQString(true));
|
||||
CLogMessage(this).info("Initialized model caches to %1") << simStr;
|
||||
@@ -76,10 +76,10 @@ namespace BlackMisc
|
||||
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "No single simulator");
|
||||
switch (simulator.getSimulator())
|
||||
{
|
||||
case CSimulatorInfo::FS9: return this->m_modelCacheFs9.getCopy();
|
||||
case CSimulatorInfo::FSX: return this->m_modelCacheFsx.getCopy();
|
||||
case CSimulatorInfo::P3D: return this->m_modelCacheP3D.getCopy();
|
||||
case CSimulatorInfo::XPLANE: return this->m_modelCacheXP.getCopy();
|
||||
case CSimulatorInfo::FS9: return this->m_modelCacheFs9.get();
|
||||
case CSimulatorInfo::FSX: return this->m_modelCacheFsx.get();
|
||||
case CSimulatorInfo::P3D: return this->m_modelCacheP3D.get();
|
||||
case CSimulatorInfo::XPLANE: return this->m_modelCacheXP.get();
|
||||
default:
|
||||
Q_ASSERT_X(false, Q_FUNC_INFO, "wrong simulator");
|
||||
return CAircraftModelList();
|
||||
@@ -132,7 +132,7 @@ namespace BlackMisc
|
||||
CStatusMessage CModelCaches::setCurrentSimulator(const CSimulatorInfo &simulator)
|
||||
{
|
||||
static const CStatusMessage sameSimMsg = CStatusMessage(this).info("Same simulator");
|
||||
const CSimulatorInfo s = this->m_currentSimulator.getCopy();
|
||||
const CSimulatorInfo s = this->m_currentSimulator.get();
|
||||
if (s == simulator) { return sameSimMsg; }
|
||||
const BlackMisc::CStatusMessage m = this->m_currentSimulator.set(simulator);
|
||||
this->syncronizeCache(simulator);
|
||||
@@ -157,7 +157,7 @@ namespace BlackMisc
|
||||
CModelSetCaches::CModelSetCaches(QObject *parent) : IMultiSimulatorModelCaches(parent)
|
||||
{
|
||||
this->m_currentSimulator.synchronize();
|
||||
const CSimulatorInfo sim(this->m_currentSimulator.getCopy());
|
||||
const CSimulatorInfo sim(this->m_currentSimulator.get());
|
||||
this->syncronizeCacheImpl(sim);
|
||||
const QString simStr(sim.toQString(true));
|
||||
CLogMessage(this).info("Initialized model set caches to %1") << simStr;
|
||||
@@ -168,10 +168,10 @@ namespace BlackMisc
|
||||
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "No single simulator");
|
||||
switch (simulator.getSimulator())
|
||||
{
|
||||
case CSimulatorInfo::FS9: return this->m_modelCacheFs9.getCopy();
|
||||
case CSimulatorInfo::FSX: return this->m_modelCacheFsx.getCopy();
|
||||
case CSimulatorInfo::P3D: return this->m_modelCacheP3D.getCopy();
|
||||
case CSimulatorInfo::XPLANE: return this->m_modelCacheXP.getCopy();
|
||||
case CSimulatorInfo::FS9: return this->m_modelCacheFs9.get();
|
||||
case CSimulatorInfo::FSX: return this->m_modelCacheFsx.get();
|
||||
case CSimulatorInfo::P3D: return this->m_modelCacheP3D.get();
|
||||
case CSimulatorInfo::XPLANE: return this->m_modelCacheXP.get();
|
||||
default:
|
||||
Q_ASSERT_X(false, Q_FUNC_INFO, "wrong simulator");
|
||||
return CAircraftModelList();
|
||||
@@ -226,7 +226,7 @@ namespace BlackMisc
|
||||
CStatusMessage CModelSetCaches::setCurrentSimulator(const CSimulatorInfo &simulator)
|
||||
{
|
||||
static const CStatusMessage sameSimMsg = CStatusMessage(this).info("Same simulator");
|
||||
const CSimulatorInfo s = this->m_currentSimulator.getCopy();
|
||||
const CSimulatorInfo s = this->m_currentSimulator.get();
|
||||
if (s == simulator) { return sameSimMsg; }
|
||||
const BlackMisc::CStatusMessage m = this->m_currentSimulator.set(simulator);
|
||||
this->syncronizeCache(simulator);
|
||||
|
||||
@@ -236,7 +236,7 @@ namespace BlackMisc
|
||||
virtual BlackMisc::CStatusMessage setCachedModels(const BlackMisc::Simulation::CAircraftModelList &models, const BlackMisc::Simulation::CSimulatorInfo &simulator) override;
|
||||
virtual QDateTime getCacheTimestamp(const BlackMisc::Simulation::CSimulatorInfo &simulator) const override;
|
||||
virtual void syncronizeCache(const BlackMisc::Simulation::CSimulatorInfo &simulator) override;
|
||||
virtual BlackMisc::Simulation::CSimulatorInfo getCurrentSimulator() const override { return this->m_currentSimulator.getCopy(); }
|
||||
virtual BlackMisc::Simulation::CSimulatorInfo getCurrentSimulator() const override { return this->m_currentSimulator.get(); }
|
||||
virtual BlackMisc::CStatusMessage setCurrentSimulator(const BlackMisc::Simulation::CSimulatorInfo &simulator) override;
|
||||
//! @}
|
||||
|
||||
@@ -267,7 +267,7 @@ namespace BlackMisc
|
||||
virtual BlackMisc::CStatusMessage setCachedModels(const BlackMisc::Simulation::CAircraftModelList &models, const BlackMisc::Simulation::CSimulatorInfo &simulator) override;
|
||||
virtual QDateTime getCacheTimestamp(const BlackMisc::Simulation::CSimulatorInfo &simulator) const override;
|
||||
virtual void syncronizeCache(const BlackMisc::Simulation::CSimulatorInfo &simulator) override;
|
||||
virtual BlackMisc::Simulation::CSimulatorInfo getCurrentSimulator() const override { return this->m_currentSimulator.getCopy(); }
|
||||
virtual BlackMisc::Simulation::CSimulatorInfo getCurrentSimulator() const override { return this->m_currentSimulator.get(); }
|
||||
virtual BlackMisc::CStatusMessage setCurrentSimulator(const BlackMisc::Simulation::CSimulatorInfo &simulator) override;
|
||||
//! @}
|
||||
|
||||
|
||||
@@ -90,13 +90,13 @@ namespace BlackMisc
|
||||
|
||||
int CVPilotRulesReader::getModelsCount() const
|
||||
{
|
||||
return this->m_cachedVPilotModels.get().size();
|
||||
return this->m_cachedVPilotModels.getThreadLocal().size();
|
||||
}
|
||||
|
||||
CAircraftModelList CVPilotRulesReader::getAsModels()
|
||||
{
|
||||
// already cached?
|
||||
CAircraftModelList vPilotModels(this->m_cachedVPilotModels.getCopy());
|
||||
CAircraftModelList vPilotModels(this->m_cachedVPilotModels.get());
|
||||
if (!vPilotModels.isEmpty() || m_rules.isEmpty()) { return vPilotModels; }
|
||||
|
||||
// important: that can take a while and should normally
|
||||
@@ -109,7 +109,7 @@ namespace BlackMisc
|
||||
|
||||
CAircraftModelList CVPilotRulesReader::getAsModelsFromCache() const
|
||||
{
|
||||
return this->m_cachedVPilotModels.getCopy();
|
||||
return this->m_cachedVPilotModels.get();
|
||||
}
|
||||
|
||||
int CVPilotRulesReader::countRulesLoaded() const
|
||||
|
||||
@@ -333,11 +333,11 @@ namespace BlackMisc
|
||||
{}
|
||||
|
||||
//! Read the current value.
|
||||
const T &get() const { static const T empty {}; return *(isValid() ? static_cast<const T *>(getVariant().data()) : &empty); }
|
||||
const T &getThreadLocal() const { static const T empty {}; return *(isValid() ? static_cast<const T *>(getVariant().data()) : &empty); }
|
||||
|
||||
//! Get a copy of the current value.
|
||||
//! \threadsafe
|
||||
T getCopy() const { return isValid() ? getVariantCopy().template value<T>() : T{}; }
|
||||
T get() const { return isValid() ? getVariantCopy().template value<T>() : T{}; }
|
||||
|
||||
//! Write a new value. Must be called from the thread in which the owner lives.
|
||||
CStatusMessage set(const T &value, qint64 timestamp = 0) { return m_page.setValue(m_element, CVariant::from(value), timestamp); }
|
||||
|
||||
@@ -656,8 +656,8 @@ namespace BlackSimPlugin
|
||||
}
|
||||
else
|
||||
{
|
||||
CLogMessage(this).debug() << "Starting XBus on" << m_xbusServerSetting.get();
|
||||
m_conn = CSimulatorXPlane::connectionFromString(m_xbusServerSetting.get());
|
||||
CLogMessage(this).debug() << "Starting XBus on" << m_xbusServerSetting.getThreadLocal();
|
||||
m_conn = CSimulatorXPlane::connectionFromString(m_xbusServerSetting.getThreadLocal());
|
||||
m_watcher = new QDBusServiceWatcher(xbusServiceName(), m_conn, QDBusServiceWatcher::WatchForRegistration, this);
|
||||
connect(m_watcher, &QDBusServiceWatcher::serviceRegistered, this, &CSimulatorXPlaneListener::ps_serviceRegistered);
|
||||
}
|
||||
@@ -674,7 +674,7 @@ namespace BlackSimPlugin
|
||||
|
||||
bool CSimulatorXPlaneListener::isXBusRunning() const
|
||||
{
|
||||
QDBusConnection conn = CSimulatorXPlane::connectionFromString(m_xbusServerSetting.get());
|
||||
QDBusConnection conn = CSimulatorXPlane::connectionFromString(m_xbusServerSetting.getThreadLocal());
|
||||
CXBusServiceProxy *service = new CXBusServiceProxy(conn);
|
||||
CXBusTrafficProxy *traffic = new CXBusTrafficProxy(conn);
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace BlackSimPlugin
|
||||
connect(ui->bb_OkCancel, &QDialogButtonBox::accepted, this, &CSimulatorXPlaneConfigWindow::close);
|
||||
connect(ui->bb_OkCancel, &QDialogButtonBox::rejected, this, &CSimulatorXPlaneConfigWindow::close);
|
||||
|
||||
ui->cp_XBusServer->setCurrentText(m_xbusServerSetting.get());
|
||||
ui->cp_XBusServer->setCurrentText(m_xbusServerSetting.getThreadLocal());
|
||||
|
||||
if (xBusAvailable())
|
||||
connect(ui->pb_InstallXBus, &QPushButton::clicked, this, &CSimulatorXPlaneConfigWindow::ps_installXBus);
|
||||
@@ -74,7 +74,7 @@ namespace BlackSimPlugin
|
||||
|
||||
void CSimulatorXPlaneConfigWindow::ps_storeSettings()
|
||||
{
|
||||
if (ui->cp_XBusServer->currentText() != m_xbusServerSetting.get())
|
||||
if (ui->cp_XBusServer->currentText() != m_xbusServerSetting.getThreadLocal())
|
||||
{
|
||||
m_xbusServerSetting.set(ui->cp_XBusServer->currentText());
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ CSwiftLauncher::CSwiftLauncher(QWidget *parent) :
|
||||
this->ui->le_DBusServerPort->setValidator(new QIntValidator(0, 65535, this));
|
||||
|
||||
// default from settings
|
||||
const QString dbus(this->m_dbusServerAddress.get());
|
||||
const QString dbus(this->m_dbusServerAddress.getThreadLocal());
|
||||
this->setDefault(dbus);
|
||||
}
|
||||
|
||||
@@ -307,7 +307,7 @@ void CSwiftLauncher::ps_loadedUpdateInfo(bool success)
|
||||
return;
|
||||
}
|
||||
|
||||
const CUpdateInfo updateInfo(this->m_updateInfo.get());
|
||||
const CUpdateInfo updateInfo(this->m_updateInfo.getThreadLocal());
|
||||
const QString latestVersion(updateInfo.getLatestVersion()) ; // need to get this from somewhere
|
||||
CFailoverUrlList downloadUrls(updateInfo.getDownloadUrls());
|
||||
bool newVersionAvailable = CVersion::isNewerVersion(latestVersion) && !downloadUrls.isEmpty();
|
||||
|
||||
Reference in New Issue
Block a user