mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 06:35:52 +08:00
Some fixes for interpolation setups
* added missing signal * refresh list on reload button press * display pitch value * list ctor for single object
This commit is contained in:
committed by
Mat Sutcliffe
parent
9b031bb582
commit
148368ca0c
@@ -100,15 +100,15 @@ namespace BlackMisc
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexLogInterpolation: return CVariant::fromValue(m_logInterpolation);
|
||||
case IndexLogInterpolation: return CVariant::fromValue(m_logInterpolation);
|
||||
case IndexSimulatorDebugMessages: return CVariant::fromValue(m_simulatorDebugMessages);
|
||||
case IndexForceFullInterpolation: return CVariant::fromValue(m_forceFullInterpolation);
|
||||
case IndexEnabledAircraftParts: return CVariant::fromValue(m_enabledAircraftParts);
|
||||
case IndexEnabledAircraftParts: return CVariant::fromValue(m_enabledAircraftParts);
|
||||
case IndexSendGndFlagToSimulator: return CVariant::fromValue(m_sendGndToSim);
|
||||
case IndexInterpolatorMode: return CVariant::fromValue(m_interpolatorMode);
|
||||
case IndexInterpolatorMode: return CVariant::fromValue(m_interpolatorMode);
|
||||
case IndexInterpolatorModeAsString: return CVariant::fromValue(this->getInterpolatorModeAsString());
|
||||
case IndexFixSceneryOffset: return CVariant::fromValue(m_fixSceneryOffset);
|
||||
case IndexPitchOnGround: return CVariant::fromValue(m_pitchOnGround);
|
||||
case IndexPitchOnGround: return CVariant::fromValue(m_pitchOnGround);
|
||||
default: break;
|
||||
}
|
||||
BLACK_VERIFY_X(false, Q_FUNC_INFO, "Cannot handle index");
|
||||
@@ -120,15 +120,15 @@ namespace BlackMisc
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexLogInterpolation: m_logInterpolation = variant.toBool(); return;
|
||||
case IndexLogInterpolation: m_logInterpolation = variant.toBool(); return;
|
||||
case IndexSimulatorDebugMessages: m_simulatorDebugMessages = variant.toBool(); return;
|
||||
case IndexForceFullInterpolation: m_forceFullInterpolation = variant.toBool(); return;
|
||||
case IndexEnabledAircraftParts: m_enabledAircraftParts = variant.toBool(); return;
|
||||
case IndexEnabledAircraftParts: m_enabledAircraftParts = variant.toBool(); return;
|
||||
case IndexSendGndFlagToSimulator: m_sendGndToSim = variant.toBool(); return;
|
||||
case IndexInterpolatorMode: m_interpolatorMode = variant.toInt(); return;
|
||||
case IndexInterpolatorMode: m_interpolatorMode = variant.toInt(); return;
|
||||
case IndexInterpolatorModeAsString: this->setInterpolatorMode(variant.toQString()); return;
|
||||
case IndexFixSceneryOffset: m_fixSceneryOffset = variant.toBool(); return;
|
||||
case IndexPitchOnGround: m_pitchOnGround.setPropertyByIndex(index.copyFrontRemoved(), variant); return;
|
||||
case IndexPitchOnGround: m_pitchOnGround.setPropertyByIndex(index.copyFrontRemoved(), variant); return;
|
||||
default: break;
|
||||
}
|
||||
BLACK_VERIFY_X(false, Q_FUNC_INFO, "Cannot handle index");
|
||||
@@ -136,7 +136,7 @@ namespace BlackMisc
|
||||
|
||||
QString CInterpolationAndRenderingSetupBase::convertToQString(bool i18n) const
|
||||
{
|
||||
Q_UNUSED(i18n);
|
||||
Q_UNUSED(i18n)
|
||||
return
|
||||
QStringLiteral("Interpolator: ") % this->getInterpolatorModeAsString() %
|
||||
QStringLiteral(" | Dbg.sim.msgs: ") % boolToYesNo(m_simulatorDebugMessages) %
|
||||
@@ -276,7 +276,7 @@ namespace BlackMisc
|
||||
|
||||
QString CInterpolationAndRenderingSetupGlobal::convertToQString(bool i18n) const
|
||||
{
|
||||
Q_UNUSED(i18n);
|
||||
Q_UNUSED(i18n)
|
||||
return
|
||||
CInterpolationAndRenderingSetupBase::convertToQString(i18n) %
|
||||
QStringLiteral(" max.aircraft:") % QString::number(m_maxRenderedAircraft) %
|
||||
@@ -329,12 +329,13 @@ namespace BlackMisc
|
||||
CPropertyIndexList CInterpolationAndRenderingSetupPerCallsign::unequalToGlobal(const CInterpolationAndRenderingSetupGlobal &globalSetup) const
|
||||
{
|
||||
CPropertyIndexList diff;
|
||||
if (this->logInterpolation() != globalSetup.logInterpolation()) { diff.push_back(IndexLogInterpolation); }
|
||||
if (this->showSimulatorDebugMessages() != globalSetup.showSimulatorDebugMessages()) { diff.push_back(IndexSimulatorDebugMessages); }
|
||||
if (this->isForcingFullInterpolation() != globalSetup.isForcingFullInterpolation()) { diff.push_back(IndexForceFullInterpolation); }
|
||||
if (this->isAircraftPartsEnabled() != globalSetup.isAircraftPartsEnabled()) { diff.push_back(IndexEnabledAircraftParts); }
|
||||
if (this->logInterpolation() != globalSetup.logInterpolation()) { diff.push_back(IndexLogInterpolation); }
|
||||
if (this->showSimulatorDebugMessages() != globalSetup.showSimulatorDebugMessages()) { diff.push_back(IndexSimulatorDebugMessages); }
|
||||
if (this->isForcingFullInterpolation() != globalSetup.isForcingFullInterpolation()) { diff.push_back(IndexForceFullInterpolation); }
|
||||
if (this->isAircraftPartsEnabled() != globalSetup.isAircraftPartsEnabled()) { diff.push_back(IndexEnabledAircraftParts); }
|
||||
if (this->isSendingGndFlagToSimulator() != globalSetup.isSendingGndFlagToSimulator()) { diff.push_back(IndexSendGndFlagToSimulator); }
|
||||
if (this->isFixingSceneryOffset() != globalSetup.isFixingSceneryOffset()) { diff.push_back(IndexFixSceneryOffset); }
|
||||
if (this->isFixingSceneryOffset() != globalSetup.isFixingSceneryOffset()) { diff.push_back(IndexFixSceneryOffset); }
|
||||
if (this->getPitchOnGround() != globalSetup.getPitchOnGround()) { diff.push_back(IndexPitchOnGround); }
|
||||
return diff;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,8 +14,14 @@ namespace BlackMisc
|
||||
{
|
||||
CInterpolationSetupList::CInterpolationSetupList() { }
|
||||
|
||||
CInterpolationSetupList::CInterpolationSetupList(const CInterpolationAndRenderingSetupPerCallsign &setup)
|
||||
{
|
||||
this->push_back(setup);
|
||||
}
|
||||
|
||||
CInterpolationSetupList::CInterpolationSetupList(const CSequence<CInterpolationAndRenderingSetupPerCallsign> &other) :
|
||||
CSequence<CInterpolationAndRenderingSetupPerCallsign>(other)
|
||||
{ }
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -35,6 +35,9 @@ namespace BlackMisc
|
||||
//! Default constructor.
|
||||
CInterpolationSetupList();
|
||||
|
||||
//! Single object
|
||||
CInterpolationSetupList(const CInterpolationAndRenderingSetupPerCallsign &setup);
|
||||
|
||||
//! Construct from a base class object.
|
||||
CInterpolationSetupList(const CSequence<CInterpolationAndRenderingSetupPerCallsign> &other);
|
||||
};
|
||||
|
||||
@@ -17,8 +17,8 @@ namespace BlackMisc
|
||||
CInterpolationAndRenderingSetupPerCallsign IInterpolationSetupProvider::getInterpolationSetupPerCallsignOrDefault(const CCallsign &callsign) const
|
||||
{
|
||||
QReadLocker l(&m_lockSetup);
|
||||
if (!m_setups.contains(callsign)) { return CInterpolationAndRenderingSetupPerCallsign(callsign, m_globalSetup); }
|
||||
return m_setups.value(callsign);
|
||||
if (!m_setupsPerCallsign.contains(callsign)) { return CInterpolationAndRenderingSetupPerCallsign(callsign, m_globalSetup); }
|
||||
return m_setupsPerCallsign.value(callsign);
|
||||
}
|
||||
|
||||
CInterpolationSetupList IInterpolationSetupProvider::getInterpolationSetupsPerCallsign() const
|
||||
@@ -30,7 +30,7 @@ namespace BlackMisc
|
||||
bool IInterpolationSetupProvider::hasSetupsPerCallsign() const
|
||||
{
|
||||
QReadLocker l(&m_lockSetup);
|
||||
return !m_setups.isEmpty();
|
||||
return !m_setupsPerCallsign.isEmpty();
|
||||
}
|
||||
|
||||
bool IInterpolationSetupProvider::setInterpolationSetupsPerCallsign(const CInterpolationSetupList &setups, bool ignoreSameAsGlobal)
|
||||
@@ -42,12 +42,12 @@ namespace BlackMisc
|
||||
if (ignoreSameAsGlobal && setup.isEqualToGlobal(gs)) { continue; }
|
||||
setupsPerCs.insert(setup.getCallsign(), setup);
|
||||
}
|
||||
|
||||
{
|
||||
QWriteLocker l(&m_lockSetup);
|
||||
if (m_setups.isEmpty() && setupsPerCs.isEmpty()) { return false; }
|
||||
m_setups = setupsPerCs;
|
||||
if (m_setupsPerCallsign.isEmpty() && setupsPerCs.isEmpty()) { return false; }
|
||||
m_setupsPerCallsign = setupsPerCs;
|
||||
}
|
||||
this->emitInterpolationSetupChanged();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace BlackMisc
|
||||
{
|
||||
const SetupsPerCallsign setups = this->getSetupsPerCallsign();
|
||||
CCallsignSet callsigns;
|
||||
for (const auto &pair : makePairsRange(setups))
|
||||
for (const auto pair : makePairsRange(setups))
|
||||
{
|
||||
if (pair.second.logInterpolation()) { callsigns.insert(pair.first); }
|
||||
}
|
||||
@@ -71,8 +71,8 @@ namespace BlackMisc
|
||||
bool IInterpolationSetupProvider::isLogCallsign(const CCallsign &callsign) const
|
||||
{
|
||||
QReadLocker l(&m_lockSetup);
|
||||
if (!m_setups.contains(callsign)) { return false; }
|
||||
return m_setups[callsign].logInterpolation();
|
||||
if (!m_setupsPerCallsign.contains(callsign)) { return false; }
|
||||
return m_setupsPerCallsign[callsign].logInterpolation();
|
||||
}
|
||||
|
||||
bool IInterpolationSetupProvider::setInterpolationMode(const QString &modeAsString, const CCallsign &callsign)
|
||||
@@ -112,13 +112,13 @@ namespace BlackMisc
|
||||
if (setup.isEqualToGlobal(gs))
|
||||
{
|
||||
QWriteLocker l(&m_lockSetup);
|
||||
m_setups.remove(callsign);
|
||||
m_setupsPerCallsign.remove(callsign);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
{
|
||||
QWriteLocker l(&m_lockSetup);
|
||||
m_setups[callsign] = setup;
|
||||
m_setupsPerCallsign[callsign] = setup;
|
||||
}
|
||||
this->emitInterpolationSetupChanged();
|
||||
return true;
|
||||
@@ -129,7 +129,7 @@ namespace BlackMisc
|
||||
bool removed = false;
|
||||
{
|
||||
QWriteLocker l(&m_lockSetup);
|
||||
removed = m_setups.remove(callsign) > 0;
|
||||
removed = m_setupsPerCallsign.remove(callsign) > 0;
|
||||
}
|
||||
if (removed) { this->emitInterpolationSetupChanged(); }
|
||||
return removed;
|
||||
@@ -152,7 +152,7 @@ namespace BlackMisc
|
||||
// on the other side, we keep locks for a minimal time frame
|
||||
SetupsPerCallsign setupsToKeep;
|
||||
CInterpolationAndRenderingSetupGlobal global = this->getInterpolationSetupGlobal();
|
||||
for (const auto &pair : makePairsRange(setupsCopy))
|
||||
for (const auto pair : makePairsRange(setupsCopy))
|
||||
{
|
||||
CInterpolationAndRenderingSetupPerCallsign setup = pair.second;
|
||||
setup.setLogInterpolation(false);
|
||||
@@ -161,7 +161,7 @@ namespace BlackMisc
|
||||
}
|
||||
{
|
||||
QWriteLocker l(&m_lockSetup);
|
||||
m_setups = setupsToKeep;
|
||||
m_setupsPerCallsign = setupsToKeep;
|
||||
}
|
||||
this->emitInterpolationSetupChanged();
|
||||
}
|
||||
@@ -171,8 +171,8 @@ namespace BlackMisc
|
||||
int r = 0;
|
||||
{
|
||||
QWriteLocker l(&m_lockSetup);
|
||||
r = m_setups.size();
|
||||
m_setups.clear();
|
||||
r = m_setupsPerCallsign.size();
|
||||
m_setupsPerCallsign.clear();
|
||||
}
|
||||
|
||||
if (r > 0) { this->emitInterpolationSetupChanged(); }
|
||||
@@ -193,7 +193,7 @@ namespace BlackMisc
|
||||
IInterpolationSetupProvider::SetupsPerCallsign IInterpolationSetupProvider::getSetupsPerCallsign() const
|
||||
{
|
||||
QReadLocker l(&m_lockSetup);
|
||||
return m_setups;
|
||||
return m_setupsPerCallsign;
|
||||
}
|
||||
|
||||
// pin vtables to this file
|
||||
|
||||
@@ -102,7 +102,7 @@ namespace BlackMisc
|
||||
|
||||
private:
|
||||
CInterpolationAndRenderingSetupGlobal m_globalSetup;
|
||||
SetupsPerCallsign m_setups;
|
||||
SetupsPerCallsign m_setupsPerCallsign;
|
||||
mutable QReadWriteLock m_lockSetup; //!< lock clients
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user