mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-15 01:05:35 +08:00
Ref T308, using QStringBuilder in simulator info
This commit is contained in:
@@ -122,9 +122,9 @@ namespace BlackMisc
|
|||||||
int CSimulatorInfo::numberSimulators() const
|
int CSimulatorInfo::numberSimulators() const
|
||||||
{
|
{
|
||||||
int c = isFS9() ? 1 : 0;
|
int c = isFS9() ? 1 : 0;
|
||||||
if (isFSX()) { c++; }
|
if (isFSX()) { c++; }
|
||||||
if (isXPlane()) { c++; }
|
if (isXPlane()) { c++; }
|
||||||
if (isP3D()) { c++; }
|
if (isP3D()) { c++; }
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,11 +148,11 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
Q_UNUSED(i18n);
|
Q_UNUSED(i18n);
|
||||||
const Simulator s = getSimulator();
|
const Simulator s = getSimulator();
|
||||||
QString str;
|
const QString str =
|
||||||
if (s.testFlag(FSX)) { str.append("FSX "); }
|
(s.testFlag(FSX) ? QStringLiteral("FS9 ") : QStringLiteral("")) %
|
||||||
if (s.testFlag(FS9)) { str.append("FS9 "); }
|
(s.testFlag(FS9) ? QStringLiteral("FSX ") : QStringLiteral("")) %
|
||||||
if (s.testFlag(P3D)) { str.append("P3D "); }
|
(s.testFlag(P3D) ? QStringLiteral("P3D ") : QStringLiteral("")) %
|
||||||
if (s.testFlag(XPLANE)) { str.append("XPlane"); }
|
(s.testFlag(XPLANE) ? QStringLiteral("XPlane ") : QStringLiteral(""));
|
||||||
return str.trimmed();
|
return str.trimmed();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -299,10 +299,10 @@ namespace BlackMisc
|
|||||||
|
|
||||||
CSimulatorInfo CSimulatorInfo::fromDatabaseJson(const QJsonObject &json, const QString &prefix)
|
CSimulatorInfo CSimulatorInfo::fromDatabaseJson(const QJsonObject &json, const QString &prefix)
|
||||||
{
|
{
|
||||||
const QJsonValue jfsx = json.value(prefix + "simfsx");
|
const QJsonValue jfsx = json.value(prefix % QStringLiteral("simfsx"));
|
||||||
const QJsonValue jfs9 = json.value(prefix + "simfs9");
|
const QJsonValue jfs9 = json.value(prefix % QStringLiteral("simfs9"));
|
||||||
const QJsonValue jxp = json.value(prefix + "simxplane");
|
const QJsonValue jxp = json.value(prefix % QStringLiteral("simxplane"));
|
||||||
const QJsonValue jp3d = json.value(prefix + "simp3d");
|
const QJsonValue jp3d = json.value(prefix % QStringLiteral("simp3d"));
|
||||||
|
|
||||||
// we handle bool JSON values and bool as string
|
// we handle bool JSON values and bool as string
|
||||||
const bool fsx = jfsx.isBool() ? jfsx.toBool() : CDatastoreUtility::dbBoolStringToBool(jfsx.toString());
|
const bool fsx = jfsx.isBool() ? jfsx.toBool() : CDatastoreUtility::dbBoolStringToBool(jfsx.toString());
|
||||||
@@ -365,10 +365,10 @@ namespace BlackMisc
|
|||||||
|
|
||||||
QString CCountPerSimulator::toQString() const
|
QString CCountPerSimulator::toQString() const
|
||||||
{
|
{
|
||||||
return "FSX: " % QString::number(m_counts[0]) %
|
return QStringLiteral("FSX: ") % QString::number(m_counts[0]) %
|
||||||
" P3D: " % QString::number(m_counts[1]) %
|
QStringLiteral(" P3D: ") % QString::number(m_counts[1]) %
|
||||||
" FS9: " % QString::number(m_counts[2]) %
|
QStringLiteral(" FS9: ") % QString::number(m_counts[2]) %
|
||||||
" XPlane: " % QString::number(m_counts[3]);
|
QStringLiteral(" XPlane: ") % QString::number(m_counts[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCountPerSimulator::setCount(int count, const CSimulatorInfo &simulator)
|
void CCountPerSimulator::setCount(int count, const CSimulatorInfo &simulator)
|
||||||
|
|||||||
Reference in New Issue
Block a user