mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-03 07:35:48 +08:00
Formatting, comments, typos, or minor tweaks
* Aircraft ICAO class: hasXX methods (hasAircraftCombinedType(), ..) * Index Variant map, contains(index) * Deleted context_network_textmessages.cpp and moved it into impl.cpp (this was only 1 method) * Fixed bug refs#228
This commit is contained in:
@@ -22,7 +22,7 @@ namespace BlackMisc
|
||||
class CAircraftIcao : public BlackMisc::CValueObject
|
||||
{
|
||||
public:
|
||||
//! \brief Default constructor.
|
||||
//! Default constructor.
|
||||
CAircraftIcao() {}
|
||||
|
||||
/*!
|
||||
@@ -49,40 +49,49 @@ namespace BlackMisc
|
||||
//! Set ICAO designator, e.g. "B737"
|
||||
void setAircraftDesignator(const QString &icaoDesignator) { this->m_aircraftDesignator = icaoDesignator.trimmed().toUpper(); }
|
||||
|
||||
//! \brief Get airline, e.g. "DLH"
|
||||
//! Aircraft designator?
|
||||
bool hasAircraftDesignator() const { return !this->m_aircraftDesignator.isEmpty(); }
|
||||
|
||||
//! Get airline, e.g. "DLH"
|
||||
const QString &getAirlineDesignator() const { return this->m_airlineDesignator; }
|
||||
|
||||
//! \brief Set airline, e.g. "DLH"
|
||||
//! Set airline, e.g. "DLH"
|
||||
void setAirlineDesignator(const QString &icaoDesignator) { this->m_airlineDesignator = icaoDesignator.trimmed().toUpper(); }
|
||||
|
||||
//! \brief Airline available?
|
||||
//! Airline available?
|
||||
bool hasAirlineDesignator() const { return !this->m_airlineDesignator.isEmpty(); }
|
||||
|
||||
//! \brief Get livery
|
||||
//! Airline and Aircraft designator?
|
||||
bool hasAircraftAndAirlineDsignator() const { return this->hasAirlineDesignator() && this->hasAircraftDesignator(); }
|
||||
|
||||
//! Get livery
|
||||
const QString &getLivery() const { return this->m_livery; }
|
||||
|
||||
//! \brief Set livery
|
||||
//! Set livery
|
||||
void setLivery(const QString &livery) { this->m_livery = livery.trimmed().toUpper(); }
|
||||
|
||||
//! \brief has livery?
|
||||
//! has livery?
|
||||
bool hasLivery() const { return !this->m_livery.isEmpty(); }
|
||||
|
||||
//! \brief Get livery or color
|
||||
//! Get livery or color
|
||||
const QString &getLiveryOrColor() const { return this->hasLivery() ? this->m_livery : this->m_aircraftColor; }
|
||||
|
||||
//! \brief Get color (RGB hex)
|
||||
//! Get color (RGB hex)
|
||||
const QString &getAircraftColor() const { return this->m_aircraftColor; }
|
||||
|
||||
//! \brief Set color (RGB hex)
|
||||
//! Set color (RGB hex)
|
||||
void setAircraftColor(const QString &color) { this->m_aircraftColor = color.trimmed().toUpper(); }
|
||||
|
||||
//! \brief Color available?
|
||||
//! Color available?
|
||||
bool hasAircraftColor() const { return !this->m_aircraftColor.isEmpty(); }
|
||||
|
||||
//! \brief Get type, e.g. "L2J"
|
||||
//! Get type, e.g. "L2J"
|
||||
const QString &getAircraftCombinedType() const { return this->m_aircraftCombinedType; }
|
||||
|
||||
//! \brief Get engine type, e.g. "J"
|
||||
//! Combined type available?
|
||||
bool hasAircraftCombinedType() const { return this->getAircraftCombinedType().length() == 3; }
|
||||
|
||||
//! Get engine type, e.g. "J"
|
||||
QString getEngineType() const
|
||||
{
|
||||
if (this->m_aircraftCombinedType.length() != 3) return "";
|
||||
@@ -95,16 +104,16 @@ namespace BlackMisc
|
||||
*/
|
||||
QString asString() const;
|
||||
|
||||
//! \brief Set type
|
||||
//! Set type
|
||||
void setAircraftCombinedType(const QString &type) { this->m_aircraftCombinedType = type.trimmed().toUpper(); }
|
||||
|
||||
//! \brief Equal operator ==
|
||||
//! Equal operator ==
|
||||
bool operator ==(const CAircraftIcao &other) const;
|
||||
|
||||
//! \brief Unequal operator !=
|
||||
//! Unequal operator !=
|
||||
bool operator !=(const CAircraftIcao &other) const;
|
||||
|
||||
//! \brief Value hash
|
||||
//! Value hash
|
||||
virtual uint getValueHash() const override;
|
||||
|
||||
//! \copydoc CValueObject::toJson
|
||||
@@ -113,10 +122,10 @@ namespace BlackMisc
|
||||
//! \copydoc CValueObject::fromJson
|
||||
virtual void fromJson(const QJsonObject &json) override;
|
||||
|
||||
//! \brief Register metadata
|
||||
//! Register metadata
|
||||
static void registerMetadata();
|
||||
|
||||
//! \brief Members
|
||||
//! Members
|
||||
static const QStringList &jsonMembers();
|
||||
|
||||
/*!
|
||||
|
||||
@@ -3,10 +3,6 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/*!
|
||||
\file
|
||||
*/
|
||||
|
||||
#ifndef BLACKMISC_SELCAL_H
|
||||
#define BLACKMISC_SELCAL_H
|
||||
#include "blackmisc/pqfrequency.h"
|
||||
|
||||
@@ -55,6 +55,9 @@ namespace BlackMisc
|
||||
//! Indexes
|
||||
QList<int> indexes() const { return this->m_values.keys(); }
|
||||
|
||||
//! Contains index?
|
||||
bool contains(int index) const { return this->m_values.contains(index); }
|
||||
|
||||
//! values
|
||||
QList<QVariant> values() const { return this->m_values.values(); }
|
||||
|
||||
|
||||
@@ -3,10 +3,6 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/*!
|
||||
\file
|
||||
*/
|
||||
|
||||
#ifndef BLACKMISC_SERVER_H
|
||||
#define BLACKMISC_SERVER_H
|
||||
#include "nwuser.h"
|
||||
|
||||
@@ -3,10 +3,6 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/*!
|
||||
\file
|
||||
*/
|
||||
|
||||
#ifndef BLACKMISC_USER_H
|
||||
#define BLACKMISC_USER_H
|
||||
|
||||
@@ -38,15 +34,18 @@ namespace BlackMisc
|
||||
IndexCallsignIcon
|
||||
};
|
||||
|
||||
//! \brief Default constructor.
|
||||
//! Default constructor.
|
||||
CUser() {}
|
||||
|
||||
//! \brief Constructor.
|
||||
//! Constructor by callsign
|
||||
CUser(const BlackMisc::Aviation::CCallsign &callsign) : m_callsign(callsign) {}
|
||||
|
||||
//! Constructor.
|
||||
CUser(const QString &id, const QString &realname, const BlackMisc::Aviation::CCallsign &callsign)
|
||||
: m_id(id), m_realname(realname), m_callsign(callsign)
|
||||
{}
|
||||
|
||||
//! \brief Constructor.
|
||||
//! Constructor.
|
||||
CUser(const QString &id, const QString &realname, const QString &email = "", const QString &password = "", const BlackMisc::Aviation::CCallsign &callsign = BlackMisc::Aviation::CCallsign())
|
||||
: m_id(id), m_realname(realname), m_email(email), m_password(password), m_callsign(callsign)
|
||||
{}
|
||||
@@ -100,16 +99,13 @@ namespace BlackMisc
|
||||
void setId(const QString &id) { m_id = id.trimmed(); }
|
||||
|
||||
//! \brief Get associated callsign.
|
||||
BlackMisc::Aviation::CCallsign getCallsign() const { return m_callsign; }
|
||||
const BlackMisc::Aviation::CCallsign &getCallsign() const { return m_callsign; }
|
||||
|
||||
//! \brief Set associated callsign
|
||||
void setCallsign(const BlackMisc::Aviation::CCallsign &callsign) { m_callsign = callsign; }
|
||||
|
||||
//! \copydoc CValueObject::toIcon()
|
||||
virtual const QPixmap &toIcon() const override
|
||||
{
|
||||
return this->getCallsign().toIcon();
|
||||
}
|
||||
virtual const QPixmap &toIcon() const override { return this->getCallsign().toIcon(); }
|
||||
|
||||
//! \brief Equal operator ==
|
||||
bool operator ==(const CUser &other) const;
|
||||
|
||||
@@ -3,10 +3,6 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/*!
|
||||
\file
|
||||
*/
|
||||
|
||||
#ifndef BLACKMISC_USERLIST_H
|
||||
#define BLACKMISC_USERLIST_H
|
||||
|
||||
@@ -21,35 +17,20 @@ namespace BlackMisc
|
||||
{
|
||||
namespace Network
|
||||
{
|
||||
/*!
|
||||
* Value object encapsulating a list of voice rooms.
|
||||
*/
|
||||
//! Value object encapsulating a list of voice rooms.
|
||||
class CUserList : public CSequence<CUser>
|
||||
{
|
||||
public:
|
||||
/*!
|
||||
* \brief Default constructor.
|
||||
*/
|
||||
//! \brief Default constructor.
|
||||
CUserList();
|
||||
|
||||
/*!
|
||||
* \brief Construct from a base class object.
|
||||
* \param other
|
||||
*/
|
||||
//! Construct from a base class object.
|
||||
CUserList(const CSequence &other);
|
||||
|
||||
/*!
|
||||
* \brief QVariant, required for DBus QVariant lists
|
||||
* \return
|
||||
*/
|
||||
virtual QVariant asQVariant() const
|
||||
{
|
||||
return QVariant::fromValue(*this);
|
||||
}
|
||||
//! QVariant, required for DBus QVariant lists
|
||||
virtual QVariant asQVariant() const { return QVariant::fromValue(*this); }
|
||||
|
||||
/*!
|
||||
* \brief Register metadata
|
||||
*/
|
||||
//! Register metadata
|
||||
static void registerMetadata();
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user