mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-08-11 04:05:38 +08:00
Formatting, help text beautifyHelpMessage, improved convertToQString
This commit is contained in:
committed by
Mathew Sutcliffe
parent
a34be02e07
commit
c1482dca36
@@ -37,19 +37,21 @@ namespace BlackSample
|
||||
int CSamplesChangeObject::samples()
|
||||
{
|
||||
// ATC station
|
||||
QDateTime dtFrom = QDateTime::currentDateTimeUtc();
|
||||
QDateTime dtUntil = dtFrom.addSecs(60 * 60); // 1 hour
|
||||
QDateTime dtFrom2 = dtUntil;
|
||||
QDateTime dtUntil2 = dtUntil.addSecs(60 * 60);
|
||||
CCoordinateGeodetic geoPos = CCoordinateGeodetic::fromWgs84("48° 21′ 13″ N", "11° 47′ 09″ E", { 1487, CLengthUnit::ft() });
|
||||
CAtcStation station1(CCallsign("eddm_twr"), CUser("123456", "Joe Doe"),
|
||||
CFrequency(118.7, CFrequencyUnit::MHz()),
|
||||
geoPos, CLength(50, CLengthUnit::km()), false, dtFrom, dtUntil);
|
||||
CAtcStation station2(station1);
|
||||
CAtcStation station3(CCallsign("eddm_app"), CUser("654321", "Jen Doe"),
|
||||
const QDateTime dtFrom = QDateTime::currentDateTimeUtc();
|
||||
const QDateTime dtUntil = dtFrom.addSecs(60 * 60); // 1 hour
|
||||
const QDateTime dtFrom2 = dtUntil;
|
||||
const QDateTime dtUntil2 = dtUntil.addSecs(60 * 60);
|
||||
const CCoordinateGeodetic geoPos = CCoordinateGeodetic::fromWgs84("48° 21′ 13″ N", "11° 47′ 09″ E", { 1487, CLengthUnit::ft() });
|
||||
const CAtcStation station1(CCallsign("eddm_twr"), CUser("123456", "Joe Doe"),
|
||||
CFrequency(118.7, CFrequencyUnit::MHz()),
|
||||
geoPos, CLength(50, CLengthUnit::km()), false, dtFrom, dtUntil);
|
||||
const CAtcStation station2(station1);
|
||||
const CAtcStation station3(CCallsign("eddm_app"), CUser("654321", "Jen Doe"),
|
||||
CFrequency(120.7, CFrequencyUnit::MHz()),
|
||||
geoPos, CLength(100, CLengthUnit::km()), false, dtFrom2, dtUntil2);
|
||||
|
||||
Q_ASSERT_X(station1 == station2, Q_FUNC_INFO, "Unequal stations");
|
||||
|
||||
// ATC List
|
||||
CAtcStationList atcList;
|
||||
atcList.push_back(station1);
|
||||
@@ -81,5 +83,4 @@ namespace BlackSample
|
||||
qDebug() << "-----------------------------------------------";
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
|
||||
#include "blackmisc/aviation/aircraftsituationlist.h"
|
||||
#include "blackmisc/simulation/aircraftmodellist.h"
|
||||
|
||||
#include <QTextStream>
|
||||
#include <QtGlobal>
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ class QObject;
|
||||
class QProcess;
|
||||
|
||||
namespace BlackMisc { class CDBusServer; }
|
||||
|
||||
namespace BlackSample
|
||||
{
|
||||
class Testservice; // forward declaration
|
||||
|
||||
@@ -163,7 +163,7 @@ namespace BlackSample
|
||||
void Testservice::receiveLengthsQvl(const QVariantList &lengthsVariantList) const
|
||||
{
|
||||
qDebug() << "Pid:" << ServiceTool::getPid() << lengthsVariantList;
|
||||
foreach(QVariant lv, lengthsVariantList)
|
||||
foreach (QVariant lv, lengthsVariantList)
|
||||
{
|
||||
BlackMisc::PhysicalQuantities::CLength l;
|
||||
lv.value<QDBusArgument>() >> l;
|
||||
@@ -177,7 +177,7 @@ namespace BlackSample
|
||||
void Testservice::receiveLengthsQl(const QList<QVariant> &lengthsList) const
|
||||
{
|
||||
qDebug() << "Pid:" << ServiceTool::getPid() << "Received " << lengthsList;
|
||||
foreach(QVariant lv, lengthsList)
|
||||
foreach (QVariant lv, lengthsList)
|
||||
{
|
||||
BlackMisc::PhysicalQuantities::CLength l;
|
||||
lv.value<QDBusArgument>() >> l;
|
||||
|
||||
@@ -64,7 +64,6 @@ namespace BlackMisc
|
||||
|
||||
namespace BlackSample
|
||||
{
|
||||
|
||||
//! Testservice for PQ / CValueObject DBus tests
|
||||
class Testservice : public QObject
|
||||
{
|
||||
@@ -79,7 +78,6 @@ namespace BlackSample
|
||||
void sendStringMessage(const QString &message);
|
||||
|
||||
public slots:
|
||||
|
||||
//! Receive string message
|
||||
void receiveStringMessage(const QString &message);
|
||||
|
||||
@@ -107,7 +105,7 @@ namespace BlackSample
|
||||
//! Receive track
|
||||
void receiveTrack(const BlackMisc::Aviation::CTrack &track) const;
|
||||
|
||||
//! Receive a length (not working)
|
||||
//! Receive a length
|
||||
void receiveLength(const BlackMisc::PhysicalQuantities::CLength &length) const;
|
||||
|
||||
//! Receive lengths
|
||||
@@ -200,6 +198,7 @@ namespace BlackSample
|
||||
public:
|
||||
//! DBus interface name
|
||||
static const QString InterfaceName;
|
||||
|
||||
//! DBus object path
|
||||
static const QString ObjectPath;
|
||||
|
||||
@@ -208,11 +207,8 @@ namespace BlackSample
|
||||
|
||||
private:
|
||||
BlackMisc::Aviation::CAtcStationList m_someAtcStations;
|
||||
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
#pragma pop_macro("interface")
|
||||
|
||||
#endif // guard
|
||||
|
||||
@@ -834,7 +834,7 @@ namespace BlackCore
|
||||
void CApplication::addDBusAddressOption()
|
||||
{
|
||||
this->m_cmdDBusAddress = QCommandLineOption({ "dbus", "dbusaddress" },
|
||||
QCoreApplication::translate("application", "DBus address."),
|
||||
QCoreApplication::translate("application", "DBus address (session, system, P2P IP e.g. 192.168.23.5)"),
|
||||
"dbusaddress");
|
||||
this->addParserOption(this->m_cmdDBusAddress);
|
||||
}
|
||||
@@ -849,7 +849,7 @@ namespace BlackCore
|
||||
if (this->isParserOptionSet(this->m_cmdDBusAddress))
|
||||
{
|
||||
const QString v(this->getParserValue(m_cmdDBusAddress));
|
||||
const QString dBusAddress(CDBusServer:: normalizeAddress(v));
|
||||
const QString dBusAddress(CDBusServer::normalizeAddress(v));
|
||||
return dBusAddress;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -54,6 +54,33 @@ namespace BlackCore
|
||||
//! Destructor
|
||||
virtual ~CContextAudioProxy() {}
|
||||
|
||||
|
||||
public slots:
|
||||
// interface overrides
|
||||
//! \publicsection
|
||||
//! @{
|
||||
virtual BlackMisc::Audio::CVoiceRoomList getComVoiceRooms() const override;
|
||||
virtual BlackMisc::Audio::CVoiceRoomList getComVoiceRoomsWithAudioStatus() const override;
|
||||
virtual BlackMisc::Audio::CVoiceRoom getVoiceRoom(BlackMisc::Aviation::CComSystem::ComUnit comUnitValue, bool withAudioStatus) const override;
|
||||
virtual void setComVoiceRooms(const BlackMisc::Audio::CVoiceRoomList &voiceRooms) override;
|
||||
virtual void setOwnCallsignForRooms(const BlackMisc::Aviation::CCallsign &callsign) override;
|
||||
virtual BlackMisc::Aviation::CCallsignSet getRoomCallsigns(BlackMisc::Aviation::CComSystem::ComUnit comUnitValue) const override;
|
||||
virtual BlackMisc::Network::CUserList getRoomUsers(BlackMisc::Aviation::CComSystem::ComUnit comUnitValue) const override;
|
||||
virtual void leaveAllVoiceRooms() override;
|
||||
virtual BlackMisc::Audio::CAudioDeviceInfoList getAudioDevices() const override;
|
||||
virtual BlackMisc::Audio::CAudioDeviceInfoList getCurrentAudioDevices() const override;
|
||||
virtual void setCurrentAudioDevice(const BlackMisc::Audio::CAudioDeviceInfo &audioDevice) override;
|
||||
virtual void setVoiceOutputVolume(int volume) override;
|
||||
virtual int getVoiceOutputVolume() const override;
|
||||
virtual void setMute(bool muted) override;
|
||||
virtual bool isMuted() const override;
|
||||
virtual void playSelcalTone(const BlackMisc::Aviation::CSelcal &selcal) const override;
|
||||
virtual void playNotification(BlackMisc::Audio::CNotificationSounds::Notification notification, bool considerSettings) const override;
|
||||
virtual void enableAudioLoopback(bool enable = true) override;
|
||||
virtual bool isAudioLoopbackEnabled() const override;
|
||||
virtual bool parseCommandLine(const QString &commandLine, const BlackMisc::CIdentifier &originator) override;
|
||||
//! @}
|
||||
|
||||
private:
|
||||
BlackMisc::CGenericDBusInterface *m_dBusInterface;
|
||||
|
||||
@@ -67,67 +94,6 @@ namespace BlackCore
|
||||
|
||||
//! DBus version constructor
|
||||
CContextAudioProxy(const QString &serviceName, QDBusConnection &connection, CCoreFacadeConfig::ContextMode mode, CCoreFacade *runtime);
|
||||
|
||||
public slots:
|
||||
//! \copydoc IContextAudio::getComVoiceRooms()
|
||||
virtual BlackMisc::Audio::CVoiceRoomList getComVoiceRooms() const override;
|
||||
|
||||
//! \copydoc IContextAudio::getComVoiceRoomsWithAudioStatus()
|
||||
virtual BlackMisc::Audio::CVoiceRoomList getComVoiceRoomsWithAudioStatus() const override;
|
||||
|
||||
//! \copydoc IContextAudio::getVoiceRoom
|
||||
virtual BlackMisc::Audio::CVoiceRoom getVoiceRoom(BlackMisc::Aviation::CComSystem::ComUnit comUnitValue, bool withAudioStatus) const override;
|
||||
|
||||
//! \copydoc IContextAudio::setComVoiceRooms()
|
||||
virtual void setComVoiceRooms(const BlackMisc::Audio::CVoiceRoomList &voiceRooms) override;
|
||||
|
||||
//! \copydoc IContextAudio::setOwnCallsignForRooms
|
||||
virtual void setOwnCallsignForRooms(const BlackMisc::Aviation::CCallsign &callsign) override;
|
||||
|
||||
//! \copydoc IContextAudio::getRoomCallsigns()
|
||||
virtual BlackMisc::Aviation::CCallsignSet getRoomCallsigns(BlackMisc::Aviation::CComSystem::ComUnit comUnitValue) const override;
|
||||
|
||||
//! \copydoc IContextAudio::getRoomUsers()
|
||||
virtual BlackMisc::Network::CUserList getRoomUsers(BlackMisc::Aviation::CComSystem::ComUnit comUnitValue) const override;
|
||||
|
||||
//! \copydoc IContextAudio::leaveAllVoiceRooms
|
||||
virtual void leaveAllVoiceRooms() override;
|
||||
|
||||
//! \copydoc IContextAudio::getAudioDevices()
|
||||
virtual BlackMisc::Audio::CAudioDeviceInfoList getAudioDevices() const override;
|
||||
|
||||
//! \copydoc IContextAudio::getCurrentAudioDevices()
|
||||
virtual BlackMisc::Audio::CAudioDeviceInfoList getCurrentAudioDevices() const override;
|
||||
|
||||
//! \copydoc IContextAudio::setCurrentAudioDevice()
|
||||
virtual void setCurrentAudioDevice(const BlackMisc::Audio::CAudioDeviceInfo &audioDevice) override;
|
||||
|
||||
//!\copydoc IContextAudio::setVoiceOutputVolume
|
||||
virtual void setVoiceOutputVolume(int volume) override;
|
||||
|
||||
//! \copydoc IContextAudio::getVoiceOutputVolume
|
||||
virtual int getVoiceOutputVolume() const override;
|
||||
|
||||
//! \copydoc IContextAudio::setMute
|
||||
virtual void setMute(bool muted) override;
|
||||
|
||||
//! \copydoc IContextAudio::isMuted()
|
||||
virtual bool isMuted() const override;
|
||||
|
||||
//! \copydoc IContextAudio::playSelcalTone
|
||||
virtual void playSelcalTone(const BlackMisc::Aviation::CSelcal &selcal) const override;
|
||||
|
||||
//! \copydoc IContextAudio::playNotification
|
||||
virtual void playNotification(BlackMisc::Audio::CNotificationSounds::Notification notification, bool considerSettings) const override;
|
||||
|
||||
//! \copydoc IContextAudio::enableAudioLoopback()
|
||||
virtual void enableAudioLoopback(bool enable = true) override;
|
||||
|
||||
//! \copydoc IContextAudio::isAudioLoopbackEnabled()
|
||||
virtual bool isAudioLoopbackEnabled() const override;
|
||||
|
||||
//! \copydoc IContextOwnAircraft::parseCommandLine
|
||||
virtual bool parseCommandLine(const QString &commandLine, const BlackMisc::CIdentifier &originator) override;
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "blackcore/blackcoreexport.h"
|
||||
#include "blackcore/context/contextnetwork.h"
|
||||
#include "blackcore/corefacadeconfig.h"
|
||||
#include "blackcoreexport.h"
|
||||
#include "blackcore/blackcoreexport.h"
|
||||
#include "blackmisc/audio/voiceroomlist.h"
|
||||
#include "blackmisc/aviation/airporticaocode.h"
|
||||
#include "blackmisc/aviation/atcstation.h"
|
||||
@@ -65,7 +65,6 @@ namespace BlackCore
|
||||
friend class IContextNetwork;
|
||||
|
||||
public:
|
||||
|
||||
//! Destructor
|
||||
virtual ~CContextNetworkProxy() {}
|
||||
|
||||
|
||||
@@ -57,41 +57,21 @@ namespace BlackCore
|
||||
virtual ~CContextOwnAircraftProxy() {}
|
||||
|
||||
public slots:
|
||||
//! \copydoc IContextOwnAircraft::getOwnAircraft()
|
||||
//! \publicsection
|
||||
//! @{
|
||||
virtual BlackMisc::Simulation::CSimulatedAircraft getOwnAircraft() const override;
|
||||
|
||||
//! \copydoc IContextOwnAircraft::updateOwnPosition
|
||||
virtual bool updateOwnPosition(const BlackMisc::Geo::CCoordinateGeodetic &position, const BlackMisc::Aviation::CAltitude &altitude) override;
|
||||
|
||||
//! \copydoc IContextOwnAircraft::updateCockpit
|
||||
virtual bool updateCockpit(const BlackMisc::Aviation::CComSystem &com1, const BlackMisc::Aviation::CComSystem &com2, const BlackMisc::Aviation::CTransponder &transponder, const BlackMisc::CIdentifier &originator) override;
|
||||
|
||||
//! \copydoc IContextOwnAircraft::updateActiveComFrequency
|
||||
virtual bool updateActiveComFrequency(const BlackMisc::PhysicalQuantities::CFrequency &frequency, BlackMisc::Aviation::CComSystem::ComUnit comUnit, const BlackMisc::CIdentifier &originator) override;
|
||||
|
||||
//! \copydoc IContextOwnAircraft::updateOwnAircraftPilot
|
||||
virtual bool updateOwnAircraftPilot(const BlackMisc::Network::CUser &pilot) override;
|
||||
|
||||
//! \copydoc IContextOwnAircraft::updateSelcal
|
||||
virtual bool updateSelcal(const BlackMisc::Aviation::CSelcal &selcal, const BlackMisc::CIdentifier &originator) override;
|
||||
|
||||
//! \copydoc IContextOwnAircraft::updateOwnCallsign
|
||||
virtual bool updateOwnCallsign(const BlackMisc::Aviation::CCallsign &callsign) override;
|
||||
|
||||
//! \copydoc IContextOwnAircraft::updateOwnIcaoCodes
|
||||
virtual bool updateOwnIcaoCodes(const BlackMisc::Aviation::CAircraftIcaoCode &aircraftIcaoCode, const BlackMisc::Aviation::CAirlineIcaoCode &airlineIcaoCode) override;
|
||||
|
||||
//! \copydoc IContextOwnAircraft::setAudioOutputVolume
|
||||
virtual void setAudioOutputVolume(int outputVolume) override;
|
||||
|
||||
//! \copydoc IContextOwnAircraft::setAudioVoiceRoomOverrideUrls
|
||||
virtual void setAudioVoiceRoomOverrideUrls(const QString &voiceRoom1Url, const QString &voiceRoom2Url) override;
|
||||
|
||||
//! \copydoc IContextOwnAircraft::enableAutomaticVoiceRoomResolution
|
||||
virtual void enableAutomaticVoiceRoomResolution(bool enable) override;
|
||||
|
||||
//! \copydoc IContextOwnAircraft::parseCommandLine
|
||||
virtual bool parseCommandLine(const QString &commandLine, const BlackMisc::CIdentifier &originator) override;
|
||||
//! @}
|
||||
|
||||
protected:
|
||||
//! \brief Constructor
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace BlackCore
|
||||
|
||||
public:
|
||||
//! Destructor
|
||||
~CContextSimulatorProxy() {}
|
||||
virtual ~CContextSimulatorProxy() {}
|
||||
|
||||
public slots:
|
||||
//! \name Interface overrides
|
||||
|
||||
@@ -82,7 +82,7 @@ namespace BlackGui
|
||||
// list all available simulators
|
||||
for (const auto &p : getAvailablePlugins())
|
||||
{
|
||||
QString config = m_plugins->getPluginConfigId(p.getIdentifier());
|
||||
const QString config = m_plugins->getPluginConfigId(p.getIdentifier());
|
||||
ui->ps_EnabledSimulators->addPlugin(p.getIdentifier(), p.getName(), !config.isEmpty(), false);
|
||||
}
|
||||
|
||||
|
||||
@@ -278,7 +278,7 @@ namespace BlackGui
|
||||
{
|
||||
static const CPropertyIndexList propertiesSingle({ CStatusMessage::IndexMessage });
|
||||
static const CPropertyIndexList propertiesMulti({ CStatusMessage::IndexSeverityAsString, CStatusMessage::IndexMessage });
|
||||
const QString helpText(beautifyHelpMessage(this->m_parser.helpText()));
|
||||
const QString helpText(CGuiApplication::beautifyHelpMessage(this->m_parser.helpText()));
|
||||
const QString msgsHtml = msgs.toHtml(msgs.size() > 1 ? propertiesMulti : propertiesSingle);
|
||||
QMessageBox::critical(nullptr,
|
||||
QGuiApplication::applicationDisplayName(),
|
||||
@@ -565,8 +565,9 @@ namespace BlackGui
|
||||
{
|
||||
if (CBuildConfig::isRunningOnWindowsNtPlatform())
|
||||
{
|
||||
const QString helpText(CGuiApplication::beautifyHelpMessage(this->m_parser.helpText()));
|
||||
QMessageBox::information(nullptr, QGuiApplication::applicationDisplayName(),
|
||||
"<html><head/><body><pre>" + this->m_parser.helpText() + "</pre></body></html>");
|
||||
"<html><head/><body>" + helpText + "</body></html>");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
|
||||
CPluginSelector::CPluginSelector(QWidget *parent) : QWidget(parent),
|
||||
m_detailsButtonMapper(new QSignalMapper(this)),
|
||||
m_configButtonMapper(new QSignalMapper(this))
|
||||
@@ -35,7 +34,7 @@ namespace BlackGui
|
||||
connect(m_configButtonMapper, static_cast<void (QSignalMapper::*)(const QString &)>(&QSignalMapper::mapped), this, &CPluginSelector::pluginConfigRequested);
|
||||
}
|
||||
|
||||
void CPluginSelector::addPlugin(const QString& identifier, const QString &name, bool hasConfig, bool enabled)
|
||||
void CPluginSelector::addPlugin(const QString &identifier, const QString &name, bool hasConfig, bool enabled)
|
||||
{
|
||||
QWidget *pw = new QWidget;
|
||||
QHBoxLayout *layout = new QHBoxLayout;
|
||||
@@ -57,7 +56,8 @@ namespace BlackGui
|
||||
|
||||
pw->layout()->addWidget(cb);
|
||||
|
||||
if (hasConfig) {
|
||||
if (hasConfig)
|
||||
{
|
||||
QPushButton *config = new QPushButton("...");
|
||||
m_configButtonMapper->setMapping(config, identifier);
|
||||
connect(config, &QPushButton::clicked, m_configButtonMapper, static_cast<void (QSignalMapper::*)()>(&QSignalMapper::map));
|
||||
@@ -78,14 +78,14 @@ namespace BlackGui
|
||||
|
||||
void CPluginSelector::setEnabled(const QString &identifier, bool enabled)
|
||||
{
|
||||
QCheckBox* cb = findChild<QCheckBox *>(identifier);
|
||||
QCheckBox *cb = findChild<QCheckBox *>(identifier);
|
||||
Q_ASSERT(cb);
|
||||
cb->setChecked(enabled);
|
||||
}
|
||||
|
||||
void CPluginSelector::ps_handlePluginStateChange()
|
||||
{
|
||||
QCheckBox *cb = qobject_cast<QCheckBox*>(sender());
|
||||
QCheckBox *cb = qobject_cast<QCheckBox *>(sender());
|
||||
Q_ASSERT(cb);
|
||||
|
||||
bool enabled = cb->checkState() != Qt::Unchecked;
|
||||
@@ -95,6 +95,4 @@ namespace BlackGui
|
||||
|
||||
emit pluginStateChanged(identifier, enabled);
|
||||
}
|
||||
|
||||
|
||||
} // namespace
|
||||
} // ns
|
||||
|
||||
@@ -22,7 +22,6 @@ class QSignalMapper;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
|
||||
/*!
|
||||
* Shows all available plugins in nice list and lets user enable, disable and configure
|
||||
* each of them.
|
||||
@@ -43,7 +42,7 @@ namespace BlackGui
|
||||
|
||||
public:
|
||||
//! Constructor
|
||||
explicit CPluginSelector(QWidget *parent = 0);
|
||||
explicit CPluginSelector(QWidget *parent = nullptr);
|
||||
|
||||
//! Adds the new plugin to the list.
|
||||
//! \param identifier Identifier of the plugin
|
||||
@@ -61,9 +60,7 @@ namespace BlackGui
|
||||
private:
|
||||
QSignalMapper *m_detailsButtonMapper;
|
||||
QSignalMapper *m_configButtonMapper;
|
||||
|
||||
};
|
||||
} // ns
|
||||
|
||||
} // namespace BlackGui
|
||||
|
||||
#endif // BLACKGUI_PLUGINSELECTOR_H
|
||||
#endif // guard
|
||||
|
||||
@@ -29,7 +29,6 @@ namespace BlackMisc
|
||||
{
|
||||
namespace Aviation
|
||||
{
|
||||
|
||||
//! Value object for ICAO classification
|
||||
class BLACKMISC_EXPORT CAircraftIcaoCode :
|
||||
public CValueObject<CAircraftIcaoCode>,
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace BlackMisc
|
||||
QLatin1Literal(" gs: ") % (this->m_groundSpeed.toQString(i18n)) %
|
||||
QLatin1Literal(" elevation: ") % (this->m_groundElevation.toQString(i18n)) %
|
||||
QLatin1Literal(" heading: ") % (this->m_heading.toQString(i18n)) %
|
||||
QLatin1Literal(" timestamp: ") % (this->getFormattedUtcTimestampDhms());
|
||||
QLatin1Literal(" timestamp: ") % (this->hasValidTimestamp() ? this->getFormattedUtcTimestampDhms() : QStringLiteral("-"));
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace BlackMisc
|
||||
{ }
|
||||
|
||||
CAirport::CAirport(const CAirportIcaoCode &icao, const BlackMisc::Geo::CCoordinateGeodetic &position, const QString &descriptiveName) :
|
||||
m_icao(icao), m_descriptiveName(descriptiveName), m_position(position)
|
||||
m_descriptiveName(descriptiveName), m_icao(icao), m_position(position)
|
||||
{ }
|
||||
|
||||
void CAirport::updateMissingParts(const CAirport &airport)
|
||||
|
||||
@@ -37,8 +37,8 @@ namespace BlackMisc
|
||||
//! Value object encapsulating information about an airpot.
|
||||
class BLACKMISC_EXPORT CAirport :
|
||||
public CValueObject<CAirport>,
|
||||
public BlackMisc::Db::IDatastoreObjectWithIntegerKey,
|
||||
public Geo::ICoordinateWithRelativePosition
|
||||
public Geo::ICoordinateWithRelativePosition,
|
||||
public BlackMisc::Db::IDatastoreObjectWithIntegerKey
|
||||
{
|
||||
public:
|
||||
//! Properties by index
|
||||
@@ -148,23 +148,25 @@ namespace BlackMisc
|
||||
static CAirport fromDatabaseJson(const QJsonObject &json, const QString &prefix = QString());
|
||||
|
||||
private:
|
||||
CAirportIcaoCode m_icao;
|
||||
QString m_descriptiveName;
|
||||
BlackMisc::Geo::CCoordinateGeodetic m_position;
|
||||
CCountry m_country;
|
||||
bool m_operating;
|
||||
CAirportIcaoCode m_icao;
|
||||
BlackMisc::CCountry m_country;
|
||||
BlackMisc::Geo::CCoordinateGeodetic m_position;
|
||||
|
||||
BLACK_METACLASS(
|
||||
CAirport,
|
||||
BLACK_METAMEMBER(dbKey),
|
||||
BLACK_METAMEMBER(timestampMSecsSinceEpoch),
|
||||
BLACK_METAMEMBER(icao),
|
||||
BLACK_METAMEMBER(descriptiveName),
|
||||
BLACK_METAMEMBER(position),
|
||||
BLACK_METAMEMBER(country),
|
||||
BLACK_METAMEMBER(operating),
|
||||
// ICoordinateWithRelativePosition
|
||||
BLACK_METAMEMBER(relativeDistance),
|
||||
BLACK_METAMEMBER(relativeBearing)
|
||||
BLACK_METAMEMBER(relativeBearing),
|
||||
// IDatastoreObjectWithIntegerKey
|
||||
BLACK_METAMEMBER(dbKey),
|
||||
BLACK_METAMEMBER(timestampMSecsSinceEpoch)
|
||||
);
|
||||
};
|
||||
} // namespace
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QtGlobal>
|
||||
#include <QStringBuilder>
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::PhysicalQuantities;
|
||||
@@ -84,93 +85,49 @@ namespace BlackMisc
|
||||
|
||||
QString CAtcStation::convertToQString(bool i18n) const
|
||||
{
|
||||
QString s = i18n ?
|
||||
QCoreApplication::translate("Aviation", "ATC station") :
|
||||
"ATC station";
|
||||
s.append(' ').append(this->m_callsign.toQString(i18n));
|
||||
static const QString atcI18n(QCoreApplication::translate("Aviation", "ATC station"));
|
||||
static const QString rangeI18n(QCoreApplication::translate("Aviation", "range"));
|
||||
static const QString fromUtcI18n(QCoreApplication::translate("Aviation", "from(UTC)"));
|
||||
static const QString untilUtcI18n(QCoreApplication::translate("Aviation", "until(UTC)"));
|
||||
|
||||
// position
|
||||
s.append(' ').append(this->m_position.toQString(i18n));
|
||||
const QString s = (i18n ? atcI18n : QLatin1Literal("ATC station")) %
|
||||
QLatin1Char(' ') % this->m_callsign.toQString(i18n) %
|
||||
QLatin1Char(' ') % this->m_position.toQString(i18n) %
|
||||
QLatin1String(" online: ") % boolToYesNo(m_isOnline) %
|
||||
|
||||
// Online?
|
||||
s.append(' ');
|
||||
if (this->m_isOnline)
|
||||
{
|
||||
i18n ? s.append(QCoreApplication::translate("Aviation", "online")) : s.append("online");
|
||||
}
|
||||
else
|
||||
{
|
||||
i18n ? s.append(QCoreApplication::translate("Aviation", "offline")) : s.append("offline");
|
||||
}
|
||||
// controller
|
||||
(!this->m_controller.isValid() ? QStringLiteral("") :
|
||||
QStringLiteral(" ") % this->m_controller.toQString(i18n)) %
|
||||
|
||||
// controller name
|
||||
if (this->m_controller.isValid())
|
||||
{
|
||||
s.append(' ');
|
||||
s.append(this->m_controller.toQString(i18n));
|
||||
}
|
||||
// frequency
|
||||
QLatin1Char(' ') % this->m_frequency.valueRoundedWithUnit(3, i18n) %
|
||||
|
||||
// frequency
|
||||
s.append(' ');
|
||||
s.append(this->m_frequency.valueRoundedWithUnit(3, i18n));
|
||||
// ATIS
|
||||
(!this->hasAtis() ? QStringLiteral("") :
|
||||
QStringLiteral(" ") % this->m_atis.toQString(i18n)) %
|
||||
|
||||
// ATIS
|
||||
if (this->hasAtis())
|
||||
{
|
||||
s.append(' ');
|
||||
s.append(this->m_atis.toQString(i18n));
|
||||
}
|
||||
// METAR
|
||||
(!this->hasMetar() ? QStringLiteral("") :
|
||||
QStringLiteral(" ") % this->m_metar.toQString(i18n)) %
|
||||
|
||||
// METAR
|
||||
if (this->hasMetar())
|
||||
{
|
||||
s.append(' ');
|
||||
s.append(this->m_metar.toQString(i18n));
|
||||
}
|
||||
// range
|
||||
QLatin1Char(' ') % (i18n ? rangeI18n : QLatin1Literal("range")) %
|
||||
QLatin1Char(' ') % this->m_range.toQString(i18n) %
|
||||
|
||||
// range
|
||||
s.append(' ');
|
||||
i18n ? s.append(s.append(QCoreApplication::translate("Aviation", "range"))) : s.append("range");
|
||||
s.append(": ");
|
||||
s.append(this->m_range.toQString(i18n));
|
||||
// distance / bearing
|
||||
QLatin1Char(' ') % ICoordinateWithRelativePosition::convertToQString(i18n) %
|
||||
|
||||
// distance to plane
|
||||
if (this->m_relativeDistance.isPositiveWithEpsilonConsidered())
|
||||
{
|
||||
s.append(' ');
|
||||
i18n ? s.append(QCoreApplication::translate("Aviation", "distance")) : s.append("distance");
|
||||
s.append(' ');
|
||||
s.append(this->m_relativeDistance.toQString(i18n));
|
||||
}
|
||||
// booking from/until
|
||||
QLatin1Char(' ') %
|
||||
(i18n ? fromUtcI18n : QLatin1Literal("from(UTC)")) %
|
||||
QLatin1Char(' ') %
|
||||
(this->m_bookedFromUtc.isNull() ? QLatin1String("-") : this->m_bookedFromUtc.toString("yy-MM-dd HH:mm")) %
|
||||
|
||||
// from / to
|
||||
if (!this->hasBookingTimes()) return s;
|
||||
QLatin1Char(' ') %
|
||||
(i18n ? untilUtcI18n : QLatin1Literal("until(UTC)")) %
|
||||
QLatin1Char(' ') %
|
||||
(this->m_bookedUntilUtc.isNull() ? QLatin1String("-") : this->m_bookedUntilUtc.toString("yy-MM-dd HH:mm"));
|
||||
|
||||
// append from
|
||||
s.append(' ');
|
||||
i18n ? s.append(s.append(QCoreApplication::translate("Aviation", "from(UTC)"))) : s.append("from(UTC)");
|
||||
s.append(": ");
|
||||
if (this->m_bookedFromUtc.isNull())
|
||||
{
|
||||
s.append('-');
|
||||
}
|
||||
else
|
||||
{
|
||||
s.append(this->m_bookedFromUtc.toString("yy-MM-dd HH:mm"));
|
||||
}
|
||||
|
||||
// append to
|
||||
s.append(' ');
|
||||
i18n ? s.append(s.append(QCoreApplication::translate("Aviation", "until(UTC)"))) : s.append("to(UTC)");
|
||||
s.append(": ");
|
||||
if (this->m_bookedFromUtc.isNull())
|
||||
{
|
||||
s.append('-');
|
||||
}
|
||||
else
|
||||
{
|
||||
s.append(this->m_bookedUntilUtc.toString("yy-MM-dd HH:mm"));
|
||||
}
|
||||
return s;
|
||||
|
||||
// force strings for translation in resource files
|
||||
|
||||
@@ -77,17 +77,11 @@ namespace BlackMisc
|
||||
bool isOnline = false, const QDateTime &bookedFromUtc = QDateTime(), const QDateTime &bookedUntilUtc = QDateTime(),
|
||||
const CInformationMessage &atis = CInformationMessage(CInformationMessage::ATIS), const CInformationMessage &metar = CInformationMessage(CInformationMessage::METAR));
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Icon::toIcon()
|
||||
BlackMisc::CIcon toIcon() const { return this->m_callsign.toIcon(); }
|
||||
|
||||
//! Has booking times?
|
||||
bool hasBookingTimes() const;
|
||||
|
||||
//! Has ATIS?
|
||||
bool hasAtis() const
|
||||
{
|
||||
return this->m_atis.hasMessage();
|
||||
}
|
||||
bool hasAtis() const { return this->m_atis.hasMessage(); }
|
||||
|
||||
//! Has METAR?
|
||||
bool hasMetar() const;
|
||||
@@ -256,6 +250,9 @@ namespace BlackMisc
|
||||
//! \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:
|
||||
CCallsign m_callsign;
|
||||
BlackMisc::Network::CUser m_controller;
|
||||
@@ -277,9 +274,9 @@ namespace BlackMisc
|
||||
BLACK_METAMEMBER(position),
|
||||
BLACK_METAMEMBER(range),
|
||||
BLACK_METAMEMBER(isOnline),
|
||||
BLACK_METAMEMBER(atis),
|
||||
BLACK_METAMEMBER(bookedFromUtc),
|
||||
BLACK_METAMEMBER(bookedUntilUtc),
|
||||
BLACK_METAMEMBER(atis),
|
||||
BLACK_METAMEMBER(metar),
|
||||
BLACK_METAMEMBER(voiceRoom),
|
||||
BLACK_METAMEMBER(relativeDistance),
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace BlackMisc
|
||||
|
||||
QString CCallsign::unifyCallsign(const QString &callsign)
|
||||
{
|
||||
return removeChars(callsign.toUpper(), [](QChar c) { return !c.isLetterOrNumber() && c != '_'; });
|
||||
return removeChars(callsign.toUpper().trimmed(), [](QChar c) { return !c.isLetterOrNumber() && c != '_'; });
|
||||
}
|
||||
|
||||
const CIcon &CCallsign::convertToIcon(const CCallsign &callsign)
|
||||
|
||||
@@ -56,12 +56,12 @@ namespace BlackMisc
|
||||
|
||||
//! Constructor
|
||||
CCallsign(const QString &callsign, TypeHint hint = NoHint)
|
||||
: m_callsignAsSet(callsign.trimmed()), m_callsign(CCallsign::unifyCallsign(callsign.trimmed())), m_typeHint(hint)
|
||||
: m_callsignAsSet(callsign.trimmed()), m_callsign(CCallsign::unifyCallsign(callsign)), m_typeHint(hint)
|
||||
{}
|
||||
|
||||
//! Constructor
|
||||
CCallsign(const QString &callsign, const QString &telephonyDesignator, TypeHint hint = NoHint)
|
||||
: m_callsignAsSet(callsign.trimmed()), m_callsign(CCallsign::unifyCallsign(callsign.trimmed())), m_telephonyDesignator(telephonyDesignator.trimmed()), m_typeHint(hint)
|
||||
: m_callsignAsSet(callsign.trimmed()), m_callsign(CCallsign::unifyCallsign(callsign)), m_telephonyDesignator(telephonyDesignator.trimmed()), m_typeHint(hint)
|
||||
{}
|
||||
|
||||
//! Constructor, needed to disambiguate implicit conversion from string literal.
|
||||
|
||||
@@ -13,9 +13,9 @@ namespace BlackMisc
|
||||
{
|
||||
namespace Aviation
|
||||
{
|
||||
|
||||
QString CInformationMessage::convertToQString(bool /** i18n **/) const
|
||||
QString CInformationMessage::convertToQString(bool i18n) const
|
||||
{
|
||||
Q_UNUSED(i18n);
|
||||
return this->m_message;
|
||||
}
|
||||
|
||||
@@ -45,6 +45,5 @@ namespace BlackMisc
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -29,9 +29,7 @@ namespace BlackMisc
|
||||
class BLACKMISC_EXPORT CInformationMessage : public CValueObject<CInformationMessage>
|
||||
{
|
||||
public:
|
||||
/*!
|
||||
* Type
|
||||
*/
|
||||
//! Type
|
||||
enum InformationType
|
||||
{
|
||||
Unspecified,
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <Qt>
|
||||
#include <QtGlobal>
|
||||
#include <tuple>
|
||||
#include <QStringBuilder>
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Db;
|
||||
@@ -69,9 +70,7 @@ namespace BlackMisc
|
||||
QString s(getCombinedCode());
|
||||
if (!this->getDescription().isEmpty())
|
||||
{
|
||||
s += " (";
|
||||
s += this->getDescription();
|
||||
s += ")";
|
||||
s += QLatin1Literal(" (") % this->getDescription() % QLatin1Literal(")");
|
||||
}
|
||||
return s;
|
||||
}
|
||||
@@ -117,20 +116,16 @@ namespace BlackMisc
|
||||
|
||||
QString CLivery::convertToQString(bool i18n) const
|
||||
{
|
||||
QString s(i18n ? QCoreApplication::translate("Aviation", "Livery") : "Livery");
|
||||
if (this->hasCombinedCode())
|
||||
{
|
||||
s.append(' ');
|
||||
s.append(m_combinedCode);
|
||||
}
|
||||
s.append(' ');
|
||||
s.append(this->m_airline.toQString(i18n));
|
||||
s.append(' ');
|
||||
if (!this->m_description.isEmpty()) { s.append(' ').append(this->m_description); }
|
||||
if (this->m_colorFuselage.isValid()) { s.append(" F: ").append(this->m_colorFuselage.hex()); }
|
||||
if (this->m_colorTail.isValid()) { s.append(" T: ").append(this->m_colorTail.hex()); }
|
||||
s.append(" Mil: ").append(boolToYesNo(this->isMilitary()));
|
||||
return s;
|
||||
static const QString livery("Livery");
|
||||
static const QString liveryI18n(QCoreApplication::translate("Aviation", "Livery"));
|
||||
|
||||
return (i18n ? liveryI18n : livery) %
|
||||
QLatin1Literal(" cc: '") % m_combinedCode %
|
||||
QLatin1Literal("' airline: '") % m_airline.toQString(i18n) %
|
||||
QLatin1Literal("' desc.: '") % m_description %
|
||||
QLatin1Literal("' F: '") % m_colorFuselage.hex() %
|
||||
QLatin1Literal("' T: '") % m_colorTail.hex() %
|
||||
QLatin1Literal("' Mil: ") % boolToYesNo(this->isMilitary());
|
||||
|
||||
// force strings for translation in resource files
|
||||
(void)QT_TRANSLATE_NOOP("Aviation", "Livery");
|
||||
|
||||
@@ -30,8 +30,8 @@ namespace BlackMisc
|
||||
CAircraftSituationList::registerMetadata();
|
||||
CAirlineIcaoCode::registerMetadata();
|
||||
CAirlineIcaoCodeList::registerMetadata();
|
||||
CAirport::registerMetadata();
|
||||
CAirportIcaoCode::registerMetadata();
|
||||
CAirport::registerMetadata();
|
||||
CAirportList::registerMetadata();
|
||||
CAltitude::registerMetadata();
|
||||
CAtcStation::registerMetadata();
|
||||
|
||||
@@ -25,6 +25,33 @@ namespace BlackMisc
|
||||
qRegisterMetaType<TransponderMode>();
|
||||
}
|
||||
|
||||
CTransponder::CTransponder(int transponderCode, CTransponder::TransponderMode transponderMode) :
|
||||
m_transponderCode(transponderCode), m_transponderMode(transponderMode)
|
||||
{ }
|
||||
|
||||
CTransponder::CTransponder(int transponderCode, QString transponderMode) :
|
||||
m_transponderCode(transponderCode), m_transponderMode(StateStandby)
|
||||
{
|
||||
this->setModeAsString(transponderMode);
|
||||
}
|
||||
|
||||
CTransponder::CTransponder(QString transponderCode, CTransponder::TransponderMode transponderMode) :
|
||||
m_transponderCode(0), m_transponderMode(transponderMode)
|
||||
{
|
||||
bool ok = false;
|
||||
this->m_transponderCode = transponderCode.toInt(&ok);
|
||||
if (!ok) this->m_transponderCode = -1; // will cause assert / exception
|
||||
}
|
||||
|
||||
CTransponder::CTransponder(QString transponderCode, QString transponderMode) :
|
||||
m_transponderCode(0), m_transponderMode(StateStandby)
|
||||
{
|
||||
bool ok = false;
|
||||
this->m_transponderCode = transponderCode.toInt(&ok);
|
||||
if (!ok) this->m_transponderCode = -1; // will cause assert / exception
|
||||
this->setModeAsString(transponderMode);
|
||||
}
|
||||
|
||||
bool CTransponder::validValues() const
|
||||
{
|
||||
if (this->isDefaultValue()) return true; // special case
|
||||
@@ -62,11 +89,11 @@ namespace BlackMisc
|
||||
if (modeString.startsWith("Mode C", Qt::CaseInsensitive)) return ModeC;
|
||||
if (modeString.startsWith("C", Qt::CaseInsensitive)) return ModeC;
|
||||
if (modeString.startsWith("Mode S", Qt::CaseInsensitive)) return ModeS;
|
||||
if (modeString.contains("Mode 1", Qt::CaseInsensitive)) return ModeMil1;
|
||||
if (modeString.contains("Mode 2", Qt::CaseInsensitive)) return ModeMil2;
|
||||
if (modeString.contains("Mode 3", Qt::CaseInsensitive)) return ModeMil3;
|
||||
if (modeString.contains("Mode 4", Qt::CaseInsensitive)) return ModeMil4;
|
||||
if (modeString.contains("Mode 5", Qt::CaseInsensitive)) return ModeMil5;
|
||||
if (modeString.contains("1", Qt::CaseInsensitive)) return ModeMil1;
|
||||
if (modeString.contains("2", Qt::CaseInsensitive)) return ModeMil2;
|
||||
if (modeString.contains("3", Qt::CaseInsensitive)) return ModeMil3;
|
||||
if (modeString.contains("4", Qt::CaseInsensitive)) return ModeMil4;
|
||||
if (modeString.contains("5", Qt::CaseInsensitive)) return ModeMil5;
|
||||
return StateStandby;
|
||||
}
|
||||
|
||||
@@ -114,6 +141,11 @@ namespace BlackMisc
|
||||
return CTransponder::isValidTransponderCode(QString::number(transponderCode));
|
||||
}
|
||||
|
||||
CTransponder CTransponder::getStandardTransponder(qint32 transponderCode, CTransponder::TransponderMode mode)
|
||||
{
|
||||
return CTransponder(transponderCode, mode);
|
||||
}
|
||||
|
||||
const QString &CTransponder::modeAsString(CTransponder::TransponderMode mode)
|
||||
{
|
||||
static QString m;
|
||||
@@ -206,6 +238,5 @@ namespace BlackMisc
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
|
||||
namespace Aviation
|
||||
{
|
||||
//! Transponder
|
||||
@@ -37,9 +36,9 @@ namespace BlackMisc
|
||||
//! Transponder codes
|
||||
enum TransponderMode
|
||||
{
|
||||
StateStandby = 0, // not a real mode, more a state
|
||||
StateStandby = 0, //!< not a real mode, more a state
|
||||
ModeMil1 = 1, ModeMil2 = 2, ModeMil3 = 3, ModeMil4 = 4, ModeMil5 = 5,
|
||||
StateIdent = 10, // not a real mode, more a state
|
||||
StateIdent = 10, //!< not a real mode, more a state
|
||||
ModeA = 11,
|
||||
ModeC = 12,
|
||||
ModeS = 20
|
||||
@@ -62,44 +61,22 @@ namespace BlackMisc
|
||||
CTransponder() : m_transponderCode(0), m_transponderMode(StateStandby) {}
|
||||
|
||||
//! Constructor
|
||||
CTransponder(int transponderCode, TransponderMode transponderMode) :
|
||||
m_transponderCode(transponderCode), m_transponderMode(transponderMode)
|
||||
{ }
|
||||
CTransponder(int transponderCode, TransponderMode transponderMode);
|
||||
|
||||
//! Constructor with transponder mode as string
|
||||
CTransponder(int transponderCode, QString transponderMode) :
|
||||
m_transponderCode(transponderCode), m_transponderMode(StateStandby)
|
||||
{
|
||||
this->setModeAsString(transponderMode);
|
||||
}
|
||||
CTransponder(int transponderCode, QString transponderMode);
|
||||
|
||||
//! Constructor, code as string
|
||||
CTransponder(QString transponderCode, TransponderMode transponderMode) :
|
||||
m_transponderCode(0), m_transponderMode(transponderMode)
|
||||
{
|
||||
bool ok = false;
|
||||
this->m_transponderCode = transponderCode.toInt(&ok);
|
||||
if (!ok) this->m_transponderCode = -1; // will cause assert / exception
|
||||
}
|
||||
CTransponder(QString transponderCode, TransponderMode transponderMode);
|
||||
|
||||
//! Constructor
|
||||
CTransponder(QString transponderCode, QString transponderMode) :
|
||||
m_transponderCode(0), m_transponderMode(StateStandby)
|
||||
{
|
||||
bool ok = false;
|
||||
this->m_transponderCode = transponderCode.toInt(&ok);
|
||||
if (!ok) this->m_transponderCode = -1; // will cause assert / exception
|
||||
this->setModeAsString(transponderMode);
|
||||
}
|
||||
CTransponder(QString transponderCode, QString transponderMode);
|
||||
|
||||
//! Are set values valid?
|
||||
bool validValues() const;
|
||||
|
||||
//! Transponder mode as string
|
||||
QString getModeAsString() const
|
||||
{
|
||||
return modeAsString(this->getTransponderMode());
|
||||
}
|
||||
QString getModeAsString() const { return modeAsString(this->getTransponderMode()); }
|
||||
|
||||
//! In any sending mode such as MIL1 oder ModeS
|
||||
bool isInNormalSendingMode() const;
|
||||
@@ -111,25 +88,16 @@ namespace BlackMisc
|
||||
bool isIdentifying() const { return StateIdent == m_transponderMode; }
|
||||
|
||||
//! Transponder mode as string
|
||||
void setModeAsString(const QString &mode)
|
||||
{
|
||||
this->setTransponderMode(CTransponder::modeFromString(mode));
|
||||
}
|
||||
void setModeAsString(const QString &mode) { this->setTransponderMode(CTransponder::modeFromString(mode)); }
|
||||
|
||||
//! Transponder mode
|
||||
TransponderMode getTransponderMode() const
|
||||
{
|
||||
return this->m_transponderMode;
|
||||
}
|
||||
TransponderMode getTransponderMode() const { return this->m_transponderMode; }
|
||||
|
||||
//! Transponder mode as string
|
||||
static const QString &modeAsString(TransponderMode mode);
|
||||
|
||||
//! Transponder code
|
||||
int getTransponderCode() const
|
||||
{
|
||||
return this->m_transponderCode;
|
||||
}
|
||||
int getTransponderCode() const { return this->m_transponderCode; }
|
||||
|
||||
//! Transponder code
|
||||
QString getTransponderCodeFormatted() const;
|
||||
@@ -158,26 +126,23 @@ namespace BlackMisc
|
||||
//! Set IFR
|
||||
void setIFR() { this->m_transponderCode = 2000; }
|
||||
|
||||
//! Transponder unit
|
||||
static CTransponder getStandardTransponder(qint32 transponderCode, TransponderMode mode)
|
||||
{
|
||||
return CTransponder(transponderCode, mode);
|
||||
}
|
||||
|
||||
//! \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;
|
||||
|
||||
//! Is valid transponder code?
|
||||
static bool isValidTransponderCode(const QString &transponderCode);
|
||||
|
||||
//! Is valid transponder code?
|
||||
static bool isValidTransponderCode(qint32 transponderMode);
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::String::toQString
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
//! Transponder unit
|
||||
static CTransponder getStandardTransponder(qint32 transponderCode, TransponderMode mode);
|
||||
|
||||
private:
|
||||
//! Default value?
|
||||
@@ -192,7 +157,6 @@ namespace BlackMisc
|
||||
BLACK_METAMEMBER(transponderMode)
|
||||
);
|
||||
};
|
||||
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ using namespace BlackMisc::Network;
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
|
||||
CDBusServer::CDBusServer(const QString &service, const QString &address, QObject *parent) : QObject(parent)
|
||||
{
|
||||
m_serverMode = modeOfAddress(address);
|
||||
@@ -347,7 +346,7 @@ namespace BlackMisc
|
||||
|
||||
QString CDBusServer::normalizeAddress(const QString &address)
|
||||
{
|
||||
QString lc(address.toLower().trimmed());
|
||||
const QString lc(address.toLower().trimmed());
|
||||
|
||||
if (lc.isEmpty()) { return sessionBusAddress(); }
|
||||
if (lc == sessionBusAddress() || lc == systemBusAddress()) { return lc; }
|
||||
@@ -400,8 +399,8 @@ namespace BlackMisc
|
||||
{
|
||||
QString name = coreServiceName();
|
||||
QDBusConnection connection = dbusAddress == systemBusAddress() ?
|
||||
QDBusConnection::connectToBus(QDBusConnection::SystemBus, name) :
|
||||
QDBusConnection::connectToBus(QDBusConnection::SessionBus, name);
|
||||
QDBusConnection::connectToBus(QDBusConnection::SystemBus, name) :
|
||||
QDBusConnection::connectToBus(QDBusConnection::SessionBus, name);
|
||||
|
||||
// todo: further checks would need to go here
|
||||
// failing session bus not detected yet
|
||||
@@ -419,5 +418,4 @@ namespace BlackMisc
|
||||
QString unused;
|
||||
return isDBusAvailable(dbusAddress, unused, timeoutMs);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QtGlobal>
|
||||
#include <QStringBuilder>
|
||||
#include <cmath>
|
||||
|
||||
using namespace BlackMisc::Aviation;
|
||||
@@ -144,6 +145,14 @@ namespace BlackMisc
|
||||
return 0;
|
||||
}
|
||||
|
||||
QString ICoordinateGeodetic::convertToQString(bool i18n) const
|
||||
{
|
||||
Q_UNUSED(i18n);
|
||||
return this->latitudeAsString() % QLatin1Char(' ') %
|
||||
this->longitudeAsString() % QLatin1Char(' ') %
|
||||
this->geodeticHeightAsString();
|
||||
}
|
||||
|
||||
CVariant CCoordinateGeodetic::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
@@ -328,6 +337,13 @@ namespace BlackMisc
|
||||
return 0;
|
||||
}
|
||||
|
||||
QString ICoordinateWithRelativePosition::convertToQString(bool i18n) const
|
||||
{
|
||||
return m_relativeBearing.toQString(i18n) % QLatin1Char(' ') %
|
||||
m_relativeDistance.toQString(i18n) % QLatin1Char(' ') %
|
||||
ICoordinateGeodetic::convertToQString(i18n);
|
||||
}
|
||||
|
||||
ICoordinateWithRelativePosition::ICoordinateWithRelativePosition()
|
||||
{ }
|
||||
|
||||
|
||||
@@ -104,6 +104,9 @@ namespace BlackMisc
|
||||
//! Compare by index
|
||||
int comparePropertyByIndex(const CPropertyIndex &index, const ICoordinateGeodetic &compareValue) const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::String::toQString
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
|
||||
protected:
|
||||
//! Can given index be handled?
|
||||
static bool canHandleIndex(const BlackMisc::CPropertyIndex &index);
|
||||
@@ -165,6 +168,9 @@ namespace BlackMisc
|
||||
//! Compare by index
|
||||
int comparePropertyByIndex(const CPropertyIndex &index, const ICoordinateWithRelativePosition &compareValue) const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::String::toQString
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
|
||||
protected:
|
||||
//! Constructor
|
||||
ICoordinateWithRelativePosition();
|
||||
|
||||
@@ -18,8 +18,6 @@
|
||||
#include <QtGlobal>
|
||||
#include <tuple>
|
||||
|
||||
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
CPixmap::CPixmap(const QPixmap &pixmap) : m_pixmap(pixmap), m_hasCachedPixmap(true)
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#define BLACKMISC_SAMPLEUTILS_H
|
||||
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
@@ -24,7 +23,6 @@ namespace BlackMisc
|
||||
//! Utils for sample programms
|
||||
class BLACKMISC_EXPORT CSampleUtils
|
||||
{
|
||||
|
||||
public:
|
||||
//! Select directory among given ones
|
||||
static QString selectDirectory(const QStringList &directoryOptions, QTextStream &streamOut, QTextStream &streamIn);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
|
||||
private slots:
|
||||
//! \name PushButton slots
|
||||
//! @[
|
||||
//! @{
|
||||
void ps_startCorePressed();
|
||||
void ps_stopCorePressed();
|
||||
void ps_appendLogMessage(const BlackMisc::CStatusMessage &message);
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
#include "testblackcoremain.h"
|
||||
#include "blackcore/application.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QtGlobal>
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
namespace BlackCoreTest
|
||||
{
|
||||
|
||||
/*!
|
||||
* Class firing all unit tests in this namespace.
|
||||
* Avoids clashes with other main(..) functions and allows to fire the test cases
|
||||
|
||||
@@ -43,7 +43,6 @@ using namespace BlackMisc::PhysicalQuantities;
|
||||
|
||||
namespace BlackCoreTest
|
||||
{
|
||||
|
||||
void CTestNetwork::networkTest(BlackCore::INetwork *net)
|
||||
{
|
||||
CServer fsdServer("", "", "vatsim-germany.org", 6809, CUser("1234567", "", "", "123456"));
|
||||
@@ -111,7 +110,6 @@ namespace BlackCoreTest
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//! \endcond
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
|
||||
namespace BlackCore { class INetwork; }
|
||||
namespace BlackMisc { namespace Network { class CServer; } }
|
||||
|
||||
namespace BlackCoreTest
|
||||
{
|
||||
/*!
|
||||
@@ -52,7 +51,6 @@ namespace BlackCoreTest
|
||||
//! Test if server is available
|
||||
static bool pingServer(const BlackMisc::Network::CServer &server);
|
||||
};
|
||||
|
||||
} //namespace
|
||||
|
||||
//! \endcond
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace BlackCoreTest
|
||||
explicit CTestReaders(QObject *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
~CTestReaders();
|
||||
virtual ~CTestReaders();
|
||||
|
||||
private slots:
|
||||
//! Read ICAO data
|
||||
@@ -62,7 +62,6 @@ namespace BlackCoreTest
|
||||
//! Test if server is available
|
||||
static bool pingServer(const BlackMisc::Network::CUrl &url);
|
||||
};
|
||||
|
||||
} //namespace
|
||||
|
||||
//! \endcond
|
||||
|
||||
@@ -11,11 +11,8 @@
|
||||
#define BLACKMISCTEST_TESTMAIN_H
|
||||
|
||||
//! \cond PRIVATE_TESTS
|
||||
|
||||
/*!
|
||||
* \file
|
||||
* \ingroup testblackmisc
|
||||
*/
|
||||
//! \file
|
||||
//! \ingroup testblackmisc
|
||||
|
||||
namespace BlackMiscTest
|
||||
{
|
||||
|
||||
@@ -11,17 +11,13 @@
|
||||
#define BLACKMISCTEST_TESTMATH_H
|
||||
|
||||
//! \cond PRIVATE_TESTS
|
||||
|
||||
/*!
|
||||
* \file
|
||||
* \ingroup testblackmisc
|
||||
*/
|
||||
//! \file
|
||||
//! \ingroup testblackmisc
|
||||
|
||||
#include <QObject>
|
||||
|
||||
namespace BlackMiscTest
|
||||
{
|
||||
|
||||
/*!
|
||||
* Math classes tests
|
||||
*/
|
||||
@@ -37,7 +33,6 @@ namespace BlackMiscTest
|
||||
//! Unit test for round to multiple of
|
||||
void testRoundToMultipleOf();
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
//! \endcond
|
||||
|
||||
@@ -11,11 +11,8 @@
|
||||
#define BLACKMISCTEST_TESTPROCESS_H
|
||||
|
||||
//! \cond PRIVATE_TESTS
|
||||
|
||||
/*!
|
||||
* \file
|
||||
* \ingroup testblackmisc
|
||||
*/
|
||||
//! \file
|
||||
//! \ingroup testblackmisc
|
||||
|
||||
#include <QObject>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user