mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-14 00:25:35 +08:00
refs #247 Using CVariant in blacksim.
This commit is contained in:
@@ -26,7 +26,7 @@ namespace BlackSim
|
|||||||
QSettings fsxRegistry("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Microsoft Games\\Flight Simulator\\10.0", QSettings::NativeFormat);
|
QSettings fsxRegistry("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Microsoft Games\\Flight Simulator\\10.0", QSettings::NativeFormat);
|
||||||
fsxPath = fsxRegistry.value("SetupPath").toString();
|
fsxPath = fsxRegistry.value("SetupPath").toString();
|
||||||
}
|
}
|
||||||
if (!fsxPath.isEmpty()) this->m_setup.value(CSimulatorSetup::SetupSimPath, QVariant(fsxPath));
|
if (!fsxPath.isEmpty()) this->m_setup.value(CSimulatorSetup::SetupSimPath, CVariant(fsxPath));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -22,16 +22,16 @@ namespace BlackSim
|
|||||||
CSimulatorInfo::CSimulatorInfo() : m_fullName("Unknown"), m_shortName("Unknown")
|
CSimulatorInfo::CSimulatorInfo() : m_fullName("Unknown"), m_shortName("Unknown")
|
||||||
{}
|
{}
|
||||||
|
|
||||||
QVariant CSimulatorInfo::getSimulatorSetupValue(int index) const
|
CVariant CSimulatorInfo::getSimulatorSetupValue(int index) const
|
||||||
{
|
{
|
||||||
return this->m_simsetup.value(index);
|
return this->m_simsetup.value(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CSimulatorInfo::getSimulatorSetupValueAsString(int index) const
|
QString CSimulatorInfo::getSimulatorSetupValueAsString(int index) const
|
||||||
{
|
{
|
||||||
QVariant qv = getSimulatorSetupValue(index);
|
CVariant qv = getSimulatorSetupValue(index);
|
||||||
Q_ASSERT(qv.canConvert<QString>());
|
Q_ASSERT(qv.canConvert<QString>());
|
||||||
return qv.toString();
|
return qv.toQString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSimulatorInfo::setSimulatorSetup(const BlackMisc::CPropertyIndexVariantMap &setup)
|
void CSimulatorInfo::setSimulatorSetup(const BlackMisc::CPropertyIndexVariantMap &setup)
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ namespace BlackSim
|
|||||||
bool isUnspecified() const { return this->m_shortName.isEmpty() || this->m_shortName.startsWith("Unspecified", Qt::CaseInsensitive); }
|
bool isUnspecified() const { return this->m_shortName.isEmpty() || this->m_shortName.startsWith("Unspecified", Qt::CaseInsensitive); }
|
||||||
|
|
||||||
//! Single setting value
|
//! Single setting value
|
||||||
QVariant getSimulatorSetupValue(int index) const;
|
BlackMisc::CVariant getSimulatorSetupValue(int index) const;
|
||||||
|
|
||||||
//! Single setting value
|
//! Single setting value
|
||||||
QString getSimulatorSetupValueAsString(int index) const;
|
QString getSimulatorSetupValueAsString(int index) const;
|
||||||
@@ -86,7 +86,11 @@ namespace BlackSim
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
BLACK_DECLARE_TUPLE_CONVERSION(BlackSim::CSimulatorInfo, (o.m_fullName, o.m_shortName, o.m_simsetup))
|
BLACK_DECLARE_TUPLE_CONVERSION(BlackSim::CSimulatorInfo, (
|
||||||
|
o.m_fullName,
|
||||||
|
o.m_shortName,
|
||||||
|
attr(o.m_simsetup, flags<DisabledForComparison>())
|
||||||
|
))
|
||||||
Q_DECLARE_METATYPE(BlackSim::CSimulatorInfo)
|
Q_DECLARE_METATYPE(BlackSim::CSimulatorInfo)
|
||||||
|
|
||||||
#endif // guard
|
#endif // guard
|
||||||
|
|||||||
Reference in New Issue
Block a user