mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-07 11:05:33 +08:00
Formatting, help text beautifyHelpMessage, improved convertToQString
This commit is contained in:
committed by
Mathew Sutcliffe
parent
a34be02e07
commit
c1482dca36
@@ -23,6 +23,7 @@
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
#include <QtGlobal>
|
||||
#include <QStringBuilder>
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Aviation;
|
||||
@@ -56,18 +57,12 @@ namespace BlackMisc
|
||||
|
||||
QString CAircraftModel::convertToQString(bool i18n) const
|
||||
{
|
||||
QString s = this->m_modelString;
|
||||
if (!s.isEmpty()) { s += " type: "; }
|
||||
s += this->getModelTypeAsString();
|
||||
s += ' ';
|
||||
s += this->getAircraftIcaoCode().toQString(i18n);
|
||||
s += ' ';
|
||||
s += this->m_livery.toQString(i18n);
|
||||
if (!this->m_fileName.isEmpty())
|
||||
{
|
||||
s += ' ';
|
||||
s += m_fileName;
|
||||
}
|
||||
const QString s =
|
||||
this->m_modelString %
|
||||
QLatin1Literal(" type: '") % this->getModelTypeAsString() %
|
||||
QLatin1Literal("' ICAO: '") % this->getAircraftIcaoCode().toQString(i18n) %
|
||||
QLatin1Literal("' {") % this->m_livery.toQString(i18n) %
|
||||
QLatin1Literal("} file: '") % this->m_fileName % QLatin1Literal("'");
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -149,14 +144,9 @@ namespace BlackMisc
|
||||
{
|
||||
if (this->hasValidDbKey())
|
||||
{
|
||||
if (this->hasModelString())
|
||||
{
|
||||
return QString(this->getModelString()).append(" ").append(this->getDbKeyAsStringInParentheses());
|
||||
}
|
||||
else
|
||||
{
|
||||
return this->getDbKeyAsString();
|
||||
}
|
||||
return this->hasModelString() ?
|
||||
QString(this->getModelString()).append(" ").append(this->getDbKeyAsStringInParentheses()) :
|
||||
this->getDbKeyAsString();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -175,7 +165,7 @@ namespace BlackMisc
|
||||
if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { return IDatastoreObjectWithIntegerKey::propertyByIndex(index); }
|
||||
if (IOrderable::canHandleIndex(index)) { return IOrderable::propertyByIndex(index);}
|
||||
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexModelString:
|
||||
@@ -229,7 +219,7 @@ namespace BlackMisc
|
||||
if (IOrderable::canHandleIndex(index)) { IOrderable::setPropertyByIndex(index, variant); return; }
|
||||
if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { IDatastoreObjectWithIntegerKey::setPropertyByIndex(index, variant); return; }
|
||||
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexModelString:
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "blackmisc/propertyindex.h"
|
||||
#include "blackmisc/simulation/simulatedaircraft.h"
|
||||
#include "blackmisc/stringutils.h"
|
||||
|
||||
#include <QStringBuilder>
|
||||
#include <tuple>
|
||||
|
||||
using namespace BlackMisc;
|
||||
@@ -530,24 +530,15 @@ namespace BlackMisc
|
||||
|
||||
QString CSimulatedAircraft::convertToQString(bool i18n) const
|
||||
{
|
||||
QString s(this->m_callsign.toQString(i18n));
|
||||
s += " ";
|
||||
s += this->m_pilot.toQString(i18n);
|
||||
s += " ";
|
||||
s += this->m_situation.toQString(i18n);
|
||||
s += " ";
|
||||
s += this->m_com1system.toQString(i18n);
|
||||
s += " ";
|
||||
s += this->m_com2system.toQString(i18n);
|
||||
s += " ";
|
||||
s += this->m_transponder.toQString(i18n);
|
||||
s += " enabled: ";
|
||||
s += BlackMisc::boolToYesNo(this->isEnabled());
|
||||
s += " ";
|
||||
s += " rendered: ";
|
||||
s += BlackMisc::boolToYesNo(this->isRendered());
|
||||
s += " ";
|
||||
s += this->m_model.toQString(i18n);
|
||||
const QString s = this->m_callsign.toQString(i18n) %
|
||||
QLatin1Char(' ') % this->m_pilot.toQString(i18n) %
|
||||
QLatin1Char(' ') % this->m_situation.toQString(i18n) %
|
||||
QLatin1Char(' ') % this->m_com1system.toQString(i18n) %
|
||||
QLatin1Char(' ') % this->m_com2system.toQString(i18n) %
|
||||
QLatin1Char(' ') % this->m_transponder.toQString(i18n) %
|
||||
QLatin1Literal(" enabled: ") % BlackMisc::boolToYesNo(this->isEnabled()) %
|
||||
QLatin1Literal(" rendered: ") % BlackMisc::boolToYesNo(this->isRendered()) %
|
||||
QLatin1Char(' ') % this->getModel().toQString(i18n);
|
||||
return s;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#ifndef BLACKMISC_SIMULATION_SIMULATEDAIRCRAFT_H
|
||||
#define BLACKMISC_SIMULATION_SIMULATEDAIRCRAFT_H
|
||||
|
||||
#include "blackmisc/simulation/aircraftmodellist.h"
|
||||
#include "blackmisc/aviation/aircraftlights.h"
|
||||
#include "blackmisc/aviation/aircraftparts.h"
|
||||
#include "blackmisc/aviation/aircraftsituation.h"
|
||||
@@ -21,18 +22,17 @@
|
||||
#include "blackmisc/aviation/livery.h"
|
||||
#include "blackmisc/aviation/selcal.h"
|
||||
#include "blackmisc/aviation/transponder.h"
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
#include "blackmisc/compare.h"
|
||||
#include "blackmisc/network/user.h"
|
||||
#include "blackmisc/geo/coordinategeodetic.h"
|
||||
#include "blackmisc/geo/latitude.h"
|
||||
#include "blackmisc/geo/longitude.h"
|
||||
#include "blackmisc/icon.h"
|
||||
#include "blackmisc/metaclass.h"
|
||||
#include "blackmisc/network/user.h"
|
||||
#include "blackmisc/pq/frequency.h"
|
||||
#include "blackmisc/pq/length.h"
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
#include "blackmisc/compare.h"
|
||||
#include "blackmisc/icon.h"
|
||||
#include "blackmisc/metaclass.h"
|
||||
#include "blackmisc/propertyindex.h"
|
||||
#include "blackmisc/simulation/aircraftmodel.h"
|
||||
#include "blackmisc/valueobject.h"
|
||||
#include "blackmisc/variant.h"
|
||||
|
||||
@@ -100,9 +100,6 @@ namespace BlackMisc
|
||||
//! Constructor.
|
||||
CSimulatedAircraft(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Network::CUser &user, const BlackMisc::Aviation::CAircraftSituation &situation);
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Icon::toIcon()
|
||||
BlackMisc::CIcon toIcon() const { return this->m_callsign.toIcon(); }
|
||||
|
||||
//! Get callsign.
|
||||
const BlackMisc::Aviation::CCallsign &getCallsign() const { return m_callsign; }
|
||||
|
||||
@@ -137,7 +134,6 @@ namespace BlackMisc
|
||||
bool setAircraftIcaoCode(const BlackMisc::Aviation::CAircraftIcaoCode &aircraftIcaoCode) { return m_model.setAircraftIcaoCode(aircraftIcaoCode);}
|
||||
|
||||
//! Set ICAO info
|
||||
//! \deprecated
|
||||
bool setIcaoCodes(const BlackMisc::Aviation::CAircraftIcaoCode &aircraftIcaoCode, const BlackMisc::Aviation::CAirlineIcaoCode &airlineIcaoCode);
|
||||
|
||||
//! Get livery
|
||||
@@ -329,12 +325,6 @@ namespace BlackMisc
|
||||
//! Combined ICAO / color string
|
||||
QString getCombinedIcaoLiveryString(bool networkModel = false) const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
|
||||
CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
|
||||
void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant);
|
||||
|
||||
//! Compare for index
|
||||
int comparePropertyByIndex(const CPropertyIndex &index, const CSimulatedAircraft &compareValue) const;
|
||||
|
||||
@@ -407,9 +397,18 @@ namespace BlackMisc
|
||||
//! Set the synchronisation flag
|
||||
void setPartsSynchronized(bool synchronized) { m_partsSynchronized = synchronized; }
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
|
||||
CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
|
||||
void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant);
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::String::toQString()
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Icon::toIcon()
|
||||
BlackMisc::CIcon toIcon() const { return this->m_callsign.toIcon(); }
|
||||
|
||||
private:
|
||||
BlackMisc::Aviation::CCallsign m_callsign;
|
||||
BlackMisc::Network::CUser m_pilot;
|
||||
|
||||
Reference in New Issue
Block a user