mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-05 09:45:44 +08:00
Added callsign to user object:
* Changed user class * Updated ATC station / aircraft to keep callsigns in sync * Updated user list model for GUI
This commit is contained in:
@@ -14,10 +14,12 @@ namespace BlackGui
|
|||||||
CListModelBase<BlackMisc::Network::CUser, BlackMisc::Network::CUserList>("ViewUserList", parent)
|
CListModelBase<BlackMisc::Network::CUser, BlackMisc::Network::CUserList>("ViewUserList", parent)
|
||||||
{
|
{
|
||||||
this->m_columns.addColumn(CUser::IndexRealName, "realname");
|
this->m_columns.addColumn(CUser::IndexRealName, "realname");
|
||||||
|
this->m_columns.addColumn(CUser::IndexCallsign, "callsign");
|
||||||
this->m_columns.addColumn(CUser::IndexId, "userid");
|
this->m_columns.addColumn(CUser::IndexId, "userid");
|
||||||
this->m_columns.addColumn(CUser::IndexEmail, "email");
|
this->m_columns.addColumn(CUser::IndexEmail, "email");
|
||||||
|
|
||||||
// force strings for translation in resource files
|
// force strings for translation in resource files
|
||||||
|
(void)QT_TRANSLATE_NOOP("ViewUserList", "callsign");
|
||||||
(void)QT_TRANSLATE_NOOP("ViewUserList", "realname");
|
(void)QT_TRANSLATE_NOOP("ViewUserList", "realname");
|
||||||
(void)QT_TRANSLATE_NOOP("ViewUserList", "userid");
|
(void)QT_TRANSLATE_NOOP("ViewUserList", "userid");
|
||||||
(void)QT_TRANSLATE_NOOP("ViewUserList", "email");
|
(void)QT_TRANSLATE_NOOP("ViewUserList", "email");
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ namespace BlackMisc
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief QVariant, required for DBus QVariant lists
|
* \brief QVariant, required for DBus QVariant lists
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
virtual QVariant toQVariant() const
|
virtual QVariant toQVariant() const
|
||||||
{
|
{
|
||||||
@@ -49,80 +48,67 @@ namespace BlackMisc
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Get callsign.
|
* Get callsign.
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
const CCallsign &getCallsign() const { return m_callsign; }
|
const CCallsign &getCallsign() const { return m_callsign; }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Get callsign.
|
* Get callsign.
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
QString getCallsignAsString() const { return m_callsign.asString(); }
|
QString getCallsignAsString() const { return m_callsign.asString(); }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Set callsign
|
* Set callsign
|
||||||
* \param callsign
|
|
||||||
*/
|
*/
|
||||||
void setCallsign(const CCallsign &callsign) { this->m_callsign = callsign; }
|
void setCallsign(const CCallsign &callsign) { this->m_callsign = callsign; this->m_pilot.setCallsign(callsign); }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Get situation.
|
* Get situation.
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
const CAircraftSituation &getSituation() const { return m_situation; }
|
const CAircraftSituation &getSituation() const { return m_situation; }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Set situation.
|
* Set situation.
|
||||||
* \param
|
|
||||||
*/
|
*/
|
||||||
void setSituation(const CAircraftSituation &situation) { m_situation = situation; }
|
void setSituation(const CAircraftSituation &situation) { m_situation = situation; }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Get user
|
* Get user
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
const BlackMisc::Network::CUser &getPilot() const { return m_pilot; }
|
const BlackMisc::Network::CUser &getPilot() const { return m_pilot; }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Set user
|
* \brief Set user
|
||||||
* \param password
|
|
||||||
*/
|
*/
|
||||||
void setPilot(const BlackMisc::Network::CUser &user) { m_pilot = user; }
|
void setPilot(const BlackMisc::Network::CUser &user) { m_pilot = user; this->m_pilot.setCallsign(this->m_callsign);}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Get ICAO info
|
* Get ICAO info
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
const CAircraftIcao &getIcaoInfo() const { return m_icao; }
|
const CAircraftIcao &getIcaoInfo() const { return m_icao; }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Set ICAO info
|
* \brief Set ICAO info
|
||||||
* \param icao
|
|
||||||
*/
|
*/
|
||||||
void setIcaoInfo(const CAircraftIcao &icao) { m_icao = icao; }
|
void setIcaoInfo(const CAircraftIcao &icao) { m_icao = icao; }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Get the distance to own plane
|
* Get the distance to own plane
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
const BlackMisc::PhysicalQuantities::CLength &getDistanceToPlane() const { return m_distanceToPlane; }
|
const BlackMisc::PhysicalQuantities::CLength &getDistanceToPlane() const { return m_distanceToPlane; }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Set distance to own plane
|
* Set distance to own plane
|
||||||
* \param range
|
|
||||||
*/
|
*/
|
||||||
void setDistanceToPlane(const BlackMisc::PhysicalQuantities::CLength &distance) { this->m_distanceToPlane = distance; }
|
void setDistanceToPlane(const BlackMisc::PhysicalQuantities::CLength &distance) { this->m_distanceToPlane = distance; }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Valid distance?
|
* \brief Valid distance?
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
bool hasValidDistance() const { return !this->m_distanceToPlane.isNegativeWithEpsilonConsidered();}
|
bool hasValidDistance() const { return !this->m_distanceToPlane.isNegativeWithEpsilonConsidered();}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Calculcate distance to plane, set it, and also return it
|
* \brief Calculcate distance to plane, set it, and also return it
|
||||||
* \param position
|
* \param position calculated from this postion to my own aircraft
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
const BlackMisc::PhysicalQuantities::CLength &calculcateDistanceToPlane(const BlackMisc::Geo::CCoordinateGeodetic &position);
|
const BlackMisc::PhysicalQuantities::CLength &calculcateDistanceToPlane(const BlackMisc::Geo::CCoordinateGeodetic &position);
|
||||||
|
|
||||||
@@ -134,73 +120,61 @@ namespace BlackMisc
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Set position
|
* \brief Set position
|
||||||
* \param position
|
|
||||||
*/
|
*/
|
||||||
void setPosition(const BlackMisc::Geo::CCoordinateGeodetic &position) { this->m_situation.setPosition(position); }
|
void setPosition(const BlackMisc::Geo::CCoordinateGeodetic &position) { this->m_situation.setPosition(position); }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Get altitude
|
* \brief Get altitude
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
const BlackMisc::Aviation::CAltitude &getAltitude() const { return this->m_situation.getAltitude(); }
|
const BlackMisc::Aviation::CAltitude &getAltitude() const { return this->m_situation.getAltitude(); }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Set altitude
|
* \brief Set altitude
|
||||||
* \param altitude
|
|
||||||
*/
|
*/
|
||||||
void setAltitude(const BlackMisc::Aviation::CAltitude &altitude) { this->m_situation.setAltitude(altitude); }
|
void setAltitude(const BlackMisc::Aviation::CAltitude &altitude) { this->m_situation.setAltitude(altitude); }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Get groundspeed
|
* \brief Get groundspeed
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
const BlackMisc::PhysicalQuantities::CSpeed &getGroundSpeed() const { return this->m_situation.getGroundSpeed(); }
|
const BlackMisc::PhysicalQuantities::CSpeed &getGroundSpeed() const { return this->m_situation.getGroundSpeed(); }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Get latitude
|
* \brief Get latitude
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
virtual const BlackMisc::Geo::CLatitude &latitude() const { return this->m_situation.latitude(); }
|
virtual const BlackMisc::Geo::CLatitude &latitude() const { return this->m_situation.latitude(); }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Get longitude
|
* \brief Get longitude
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
virtual const BlackMisc::Geo::CLongitude &longitude() const { return this->m_situation.longitude(); }
|
virtual const BlackMisc::Geo::CLongitude &longitude() const { return this->m_situation.longitude(); }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Get height
|
* \brief Get height (height of current position)
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
const BlackMisc::PhysicalQuantities::CLength &getHeight() const { return this->m_situation.getHeight(); }
|
const BlackMisc::PhysicalQuantities::CLength &getHeight() const { return this->m_situation.getHeight(); }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Get heading
|
* \brief Get heading
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
const BlackMisc::Aviation::CHeading &getHeading() const { return this->m_situation.getHeading(); }
|
const BlackMisc::Aviation::CHeading &getHeading() const { return this->m_situation.getHeading(); }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Get pitch
|
* \brief Get pitch
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
const BlackMisc::PhysicalQuantities::CAngle &getPitch() const { return this->m_situation.getPitch(); }
|
const BlackMisc::PhysicalQuantities::CAngle &getPitch() const { return this->m_situation.getPitch(); }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Get bank
|
* \brief Get bank
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
const BlackMisc::PhysicalQuantities::CAngle &getBank() const { return this->m_situation.getBank(); }
|
const BlackMisc::PhysicalQuantities::CAngle &getBank() const { return this->m_situation.getBank(); }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Get COM1 system
|
* \brief Get COM1 system
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
const BlackMisc::Aviation::CComSystem &getCom1System() const { return this->m_com1system; }
|
const BlackMisc::Aviation::CComSystem &getCom1System() const { return this->m_com1system; }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Get COM2 system
|
* \brief Get COM2 system
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
const BlackMisc::Aviation::CComSystem &getCom2System() const { return this->m_com2system; }
|
const BlackMisc::Aviation::CComSystem &getCom2System() const { return this->m_com2system; }
|
||||||
|
|
||||||
@@ -216,7 +190,6 @@ namespace BlackMisc
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Get transponder
|
* \brief Get transponder
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
const BlackMisc::Aviation::CTransponder &getTransponder() const { return this->m_transponder; }
|
const BlackMisc::Aviation::CTransponder &getTransponder() const { return this->m_transponder; }
|
||||||
|
|
||||||
@@ -227,25 +200,21 @@ namespace BlackMisc
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Get transponder code
|
* \brief Get transponder code
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
QString getTransponderCodeFormatted() const { return this->m_transponder.getTransponderCodeFormatted(); }
|
QString getTransponderCodeFormatted() const { return this->m_transponder.getTransponderCodeFormatted(); }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Get transponder code
|
* \brief Get transponder code
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
qint32 getTransponderCode() const { return this->m_transponder.getTransponderCode(); }
|
qint32 getTransponderCode() const { return this->m_transponder.getTransponderCode(); }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Get transponder mode
|
* \brief Get transponder mode
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
BlackMisc::Aviation::CTransponder::TransponderMode getTransponderMode() const { return this->m_transponder.getTransponderMode(); }
|
BlackMisc::Aviation::CTransponder::TransponderMode getTransponderMode() const { return this->m_transponder.getTransponderMode(); }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Is valid for login
|
* \brief Is valid for login?
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
bool isValidForLogin() const;
|
bool isValidForLogin() const;
|
||||||
|
|
||||||
@@ -261,8 +230,6 @@ namespace BlackMisc
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Equal operator ==
|
* \brief Equal operator ==
|
||||||
* \param other
|
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
bool operator ==(const CAircraft &other) const;
|
bool operator ==(const CAircraft &other) const;
|
||||||
|
|
||||||
@@ -303,32 +270,23 @@ namespace BlackMisc
|
|||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Property by index
|
* \copydoc CValueObject::propertyByIndex()
|
||||||
* \param index
|
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
virtual QVariant propertyByIndex(int index) const;
|
virtual QVariant propertyByIndex(int index) const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Property by index as string
|
* \copydoc CValueObject::propertyByIndexAsString()
|
||||||
* \param index
|
|
||||||
* \param i18n
|
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
virtual QString propertyByIndexAsString(int index, bool i18n) const;
|
virtual QString propertyByIndexAsString(int index, bool i18n) const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Property by index (setter)
|
* \copydoc CValueObject::setPropertyByIndex()
|
||||||
* \param variant
|
|
||||||
* \param index
|
|
||||||
*/
|
*/
|
||||||
virtual void setPropertyByIndex(const QVariant &variant, int index);
|
virtual void setPropertyByIndex(const QVariant &variant, int index);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/*!
|
/*!
|
||||||
* \brief Rounded value as string
|
* \copydoc CValueObject::convertToQString()
|
||||||
* \param i18n
|
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
virtual QString convertToQString(bool i18n = false) const;
|
virtual QString convertToQString(bool i18n = false) const;
|
||||||
|
|
||||||
@@ -348,14 +306,12 @@ namespace BlackMisc
|
|||||||
virtual int compareImpl(const CValueObject &other) const;
|
virtual int compareImpl(const CValueObject &other) const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Stream to DBus <<
|
* \copydoc CValueObject::marshallToDbus()
|
||||||
* \param argument
|
|
||||||
*/
|
*/
|
||||||
virtual void marshallToDbus(QDBusArgument &argument) const;
|
virtual void marshallToDbus(QDBusArgument &argument) const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Stream from DBus >>
|
* \copydoc CValueObject::marshallFromDbus()
|
||||||
* \param argument
|
|
||||||
*/
|
*/
|
||||||
virtual void unmarshallFromDbus(const QDBusArgument &argument);
|
virtual void unmarshallFromDbus(const QDBusArgument &argument);
|
||||||
|
|
||||||
|
|||||||
@@ -63,27 +63,17 @@ namespace BlackMisc
|
|||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Default constructor.
|
* \brief Default constructor.
|
||||||
*/
|
*/
|
||||||
CAtcStation();
|
CAtcStation();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Simplified constructor
|
* \brief Simplified constructor
|
||||||
* \param callsign
|
|
||||||
*/
|
*/
|
||||||
CAtcStation(const QString &callsign);
|
CAtcStation(const QString &callsign);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief ATC station
|
* \brief ATC station constructor
|
||||||
* \param callsign
|
|
||||||
* \param controllerName
|
|
||||||
* \param freq
|
|
||||||
* \param pos
|
|
||||||
* \param range
|
|
||||||
* \param isOnline
|
|
||||||
* \param bookedFromUtc
|
|
||||||
* \param bookedUntilUtc
|
|
||||||
* \param atis
|
|
||||||
*/
|
*/
|
||||||
CAtcStation(const CCallsign &callsign, const BlackMisc::Network::CUser &controller,
|
CAtcStation(const CCallsign &callsign, const BlackMisc::Network::CUser &controller,
|
||||||
const BlackMisc::PhysicalQuantities::CFrequency &frequency,
|
const BlackMisc::PhysicalQuantities::CFrequency &frequency,
|
||||||
@@ -92,8 +82,7 @@ namespace BlackMisc
|
|||||||
const CInformationMessage &atis = CInformationMessage(CInformationMessage::ATIS), const CInformationMessage &metar = CInformationMessage(CInformationMessage::METAR));
|
const CInformationMessage &atis = CInformationMessage(CInformationMessage::ATIS), const CInformationMessage &metar = CInformationMessage(CInformationMessage::METAR));
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Virtual method to return QVariant, used with DBUS QVariant lists
|
* \copydoc CValueObject::toQVariant()
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
virtual QVariant toQVariant() const
|
virtual QVariant toQVariant() const
|
||||||
{
|
{
|
||||||
@@ -102,21 +91,16 @@ namespace BlackMisc
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Equal operator ==
|
* \brief Equal operator ==
|
||||||
* \param other
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
bool operator ==(const CAtcStation &other) const;
|
bool operator ==(const CAtcStation &other) const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Unequal operator ==
|
* \brief Unequal operator ==
|
||||||
* \param other
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
bool operator !=(const CAtcStation &other) const;
|
bool operator !=(const CAtcStation &other) const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Has booking times?
|
* \brief Has booking times?
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
bool hasBookingTimes() const
|
bool hasBookingTimes() const
|
||||||
{
|
{
|
||||||
@@ -125,7 +109,6 @@ namespace BlackMisc
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Has ATIS?
|
* \brief Has ATIS?
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
bool hasAtis() const
|
bool hasAtis() const
|
||||||
{
|
{
|
||||||
@@ -134,7 +117,6 @@ namespace BlackMisc
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Has Metar?
|
* \brief Has Metar?
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
bool hasMetar() const
|
bool hasMetar() const
|
||||||
{
|
{
|
||||||
@@ -148,16 +130,14 @@ namespace BlackMisc
|
|||||||
const CCallsign &getCallsign() const { return m_callsign; }
|
const CCallsign &getCallsign() const { return m_callsign; }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Get callsign.
|
* Get callsign as string.
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
QString getCallsignAsString() const { return m_callsign.asString(); }
|
QString getCallsignAsString() const { return m_callsign.asString(); }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Set callsign
|
* Set callsign
|
||||||
* \param callsign
|
|
||||||
*/
|
*/
|
||||||
void setCallsign(const CCallsign &callsign) { this->m_callsign = callsign; }
|
void setCallsign(const CCallsign &callsign) { this->m_callsign = callsign; this->m_controller.setCallsign(callsign);}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Get controller
|
* Get controller
|
||||||
@@ -181,7 +161,7 @@ namespace BlackMisc
|
|||||||
* Set controller
|
* Set controller
|
||||||
* \param controller
|
* \param controller
|
||||||
*/
|
*/
|
||||||
void setController(const BlackMisc::Network::CUser &controller) { this->m_controller = controller; }
|
void setController(const BlackMisc::Network::CUser &controller) { this->m_controller = controller; this->m_controller.setCallsign(this->m_callsign); }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Set controller's name
|
* Set controller's name
|
||||||
@@ -191,37 +171,31 @@ namespace BlackMisc
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Set controller's id
|
* Set controller's id
|
||||||
* \param controllerId
|
|
||||||
*/
|
*/
|
||||||
void setControllerId(const QString &controllerId) { this->m_controller.setId(controllerId); }
|
void setControllerId(const QString &controllerId) { this->m_controller.setId(controllerId); }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Has valid realname?
|
* \brief Has valid realname?
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
bool hasValidRealName() const { return this->m_controller.hasValidRealName(); }
|
bool hasValidRealName() const { return this->m_controller.hasValidRealName(); }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Has valid id?
|
* \brief Has valid id?
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
bool hasValidId() const { return this->m_controller.hasValidId(); }
|
bool hasValidId() const { return this->m_controller.hasValidId(); }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Get frequency.
|
* Get frequency.
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
const BlackMisc::PhysicalQuantities::CFrequency &getFrequency() const { return m_frequency; }
|
const BlackMisc::PhysicalQuantities::CFrequency &getFrequency() const { return m_frequency; }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Set frequency
|
* Set frequency
|
||||||
* \param frequency
|
|
||||||
*/
|
*/
|
||||||
void setFrequency(const BlackMisc::PhysicalQuantities::CFrequency &frequency) { this->m_frequency = frequency; }
|
void setFrequency(const BlackMisc::PhysicalQuantities::CFrequency &frequency) { this->m_frequency = frequency; }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Get the position of the center of the controller's area of visibility.
|
* Get the position of the center of the controller's area of visibility.
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
const BlackMisc::Geo::CCoordinateGeodetic &getPosition() const { return m_position; }
|
const BlackMisc::Geo::CCoordinateGeodetic &getPosition() const { return m_position; }
|
||||||
|
|
||||||
@@ -252,19 +226,16 @@ namespace BlackMisc
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Get the distance to own plane
|
* Get the distance to own plane
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
const BlackMisc::PhysicalQuantities::CLength &getDistanceToPlane() const { return m_distanceToPlane; }
|
const BlackMisc::PhysicalQuantities::CLength &getDistanceToPlane() const { return m_distanceToPlane; }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Set distance to own plane
|
* Set distance to own plane
|
||||||
* \param range
|
|
||||||
*/
|
*/
|
||||||
void setDistanceToPlane(const BlackMisc::PhysicalQuantities::CLength &distance) { this->m_distanceToPlane = distance; }
|
void setDistanceToPlane(const BlackMisc::PhysicalQuantities::CLength &distance) { this->m_distanceToPlane = distance; }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Valid distance?
|
* \brief Valid distance?
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
bool hasValidDistance() const { return !this->m_distanceToPlane.isNegativeWithEpsilonConsidered();}
|
bool hasValidDistance() const { return !this->m_distanceToPlane.isNegativeWithEpsilonConsidered();}
|
||||||
|
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ namespace BlackMisc
|
|||||||
argument << this->m_realname;
|
argument << this->m_realname;
|
||||||
argument << this->m_email;
|
argument << this->m_email;
|
||||||
argument << this->m_password;
|
argument << this->m_password;
|
||||||
|
argument << this->m_callsign;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -73,6 +74,7 @@ namespace BlackMisc
|
|||||||
argument >> this->m_realname;
|
argument >> this->m_realname;
|
||||||
argument >> this->m_email;
|
argument >> this->m_email;
|
||||||
argument >> this->m_password;
|
argument >> this->m_password;
|
||||||
|
argument >> this->m_callsign;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -83,7 +85,8 @@ namespace BlackMisc
|
|||||||
if (this == &other) return true;
|
if (this == &other) return true;
|
||||||
return (this->m_id == other.m_id &&
|
return (this->m_id == other.m_id &&
|
||||||
this->m_realname == other.m_realname &&
|
this->m_realname == other.m_realname &&
|
||||||
this->m_email == other.m_email);
|
this->m_email == other.m_email &&
|
||||||
|
this->m_callsign == other.m_callsign);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -107,6 +110,11 @@ namespace BlackMisc
|
|||||||
otherUser.setEmail(this->getEmail());
|
otherUser.setEmail(this->getEmail());
|
||||||
else if (otherUser.hasValidEmail())
|
else if (otherUser.hasValidEmail())
|
||||||
this->setEmail(otherUser.getEmail());
|
this->setEmail(otherUser.getEmail());
|
||||||
|
|
||||||
|
if (this->hasValidCallsign())
|
||||||
|
otherUser.setCallsign(this->getCallsign());
|
||||||
|
else if (otherUser.hasValidCallsign())
|
||||||
|
this->setCallsign(otherUser.getCallsign());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -126,6 +134,7 @@ namespace BlackMisc
|
|||||||
hashs << qHash(this->m_id);
|
hashs << qHash(this->m_id);
|
||||||
hashs << qHash(this->m_realname);
|
hashs << qHash(this->m_realname);
|
||||||
hashs << qHash(this->m_email);
|
hashs << qHash(this->m_email);
|
||||||
|
hashs << qHash(this->m_callsign.getValueHash());
|
||||||
return BlackMisc::calculateHash(hashs, "CUser");
|
return BlackMisc::calculateHash(hashs, "CUser");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,6 +162,8 @@ namespace BlackMisc
|
|||||||
return QVariant(this->m_password);
|
return QVariant(this->m_password);
|
||||||
case IndexRealName:
|
case IndexRealName:
|
||||||
return QVariant(this->m_realname);
|
return QVariant(this->m_realname);
|
||||||
|
case IndexCallsign:
|
||||||
|
return this->m_callsign.toQVariant();
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -181,6 +192,9 @@ namespace BlackMisc
|
|||||||
case IndexRealName:
|
case IndexRealName:
|
||||||
this->setRealName(variant.value<QString>());
|
this->setRealName(variant.value<QString>());
|
||||||
break;
|
break;
|
||||||
|
case IndexCallsign:
|
||||||
|
this->setCallsign(variant.value<BlackMisc::Aviation::CCallsign>());
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
Q_ASSERT_X(false, "CUser", "index unknown (setter)");
|
Q_ASSERT_X(false, "CUser", "index unknown (setter)");
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -9,7 +9,8 @@
|
|||||||
|
|
||||||
#ifndef BLACKMISC_USER_H
|
#ifndef BLACKMISC_USER_H
|
||||||
#define BLACKMISC_USER_H
|
#define BLACKMISC_USER_H
|
||||||
#include "valueobject.h"
|
|
||||||
|
#include "avcallsign.h"
|
||||||
|
|
||||||
namespace BlackMisc
|
namespace BlackMisc
|
||||||
{
|
{
|
||||||
@@ -30,7 +31,8 @@ namespace BlackMisc
|
|||||||
IndexEmail,
|
IndexEmail,
|
||||||
IndexId,
|
IndexId,
|
||||||
IndexPassword,
|
IndexPassword,
|
||||||
IndexRealName
|
IndexRealName,
|
||||||
|
IndexCallsign
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -94,6 +96,11 @@ namespace BlackMisc
|
|||||||
*/
|
*/
|
||||||
bool hasValidId() const { return !this->m_id.isEmpty(); }
|
bool hasValidId() const { return !this->m_id.isEmpty(); }
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Has associated callsign?
|
||||||
|
*/
|
||||||
|
bool hasValidCallsign() const { return !m_callsign.isEmpty(); }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Get email.
|
* Get email.
|
||||||
*/
|
*/
|
||||||
@@ -104,21 +111,32 @@ namespace BlackMisc
|
|||||||
*/
|
*/
|
||||||
void setEmail(const QString &email) { m_email = email.trimmed(); }
|
void setEmail(const QString &email) { m_email = email.trimmed(); }
|
||||||
|
|
||||||
/*!
|
|
||||||
* Get id.
|
|
||||||
*/
|
|
||||||
QString getId() const { return m_id; }
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Valid email?
|
* \brief Valid email?
|
||||||
*/
|
*/
|
||||||
bool hasValidEmail() const { return !this->m_email.isEmpty(); }
|
bool hasValidEmail() const { return !this->m_email.isEmpty(); }
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Get id.
|
||||||
|
*/
|
||||||
|
QString getId() const { return m_id; }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Set id
|
* \brief Set id
|
||||||
*/
|
*/
|
||||||
void setId(const QString &id) { m_id = id.trimmed(); }
|
void setId(const QString &id) { m_id = id.trimmed(); }
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Get associated callsign.
|
||||||
|
*/
|
||||||
|
BlackMisc::Aviation::CCallsign getCallsign() const { return m_callsign; }
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Set associated callsign
|
||||||
|
* \param callsign
|
||||||
|
*/
|
||||||
|
void setCallsign(const BlackMisc::Aviation::CCallsign &callsign) { m_callsign = callsign; }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Equal operator ==
|
* \brief Equal operator ==
|
||||||
*/
|
*/
|
||||||
@@ -196,6 +214,7 @@ namespace BlackMisc
|
|||||||
QString m_realname;
|
QString m_realname;
|
||||||
QString m_email;
|
QString m_email;
|
||||||
QString m_password;
|
QString m_password;
|
||||||
|
BlackMisc::Aviation::CCallsign m_callsign;
|
||||||
};
|
};
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
Reference in New Issue
Block a user