mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-25 18:25:42 +08:00
Ref T730, style
This commit is contained in:
committed by
Mat Sutcliffe
parent
fee8852762
commit
6e9fa0b2ad
@@ -8,8 +8,8 @@
|
|||||||
|
|
||||||
//! \file
|
//! \file
|
||||||
|
|
||||||
#ifndef BLACKCORE_AFV_CLIENT_AFVCLIENT_H
|
#ifndef BLACKCORE_AFV_CLIENTS_AFVCLIENT_H
|
||||||
#define BLACKCORE_AFV_CLIENT_AFVCLIENT_H
|
#define BLACKCORE_AFV_CLIENTS_AFVCLIENT_H
|
||||||
|
|
||||||
#include "blackcore/context/contextownaircraft.h"
|
#include "blackcore/context/contextownaircraft.h"
|
||||||
#include "blackcore/afv/connection/clientconnection.h"
|
#include "blackcore/afv/connection/clientconnection.h"
|
||||||
@@ -68,10 +68,16 @@ namespace BlackCore
|
|||||||
//! Corresponding callsign
|
//! Corresponding callsign
|
||||||
QString callsign() const { return m_callsign; }
|
QString callsign() const { return m_callsign; }
|
||||||
|
|
||||||
|
//! Is connected to network?
|
||||||
bool isConnected() const { return m_connection->isConnected(); }
|
bool isConnected() const { return m_connection->isConnected(); }
|
||||||
|
|
||||||
|
//! Connection status
|
||||||
ConnectionStatus getConnectionStatus() const;
|
ConnectionStatus getConnectionStatus() const;
|
||||||
|
|
||||||
|
//! Connect to network
|
||||||
Q_INVOKABLE void connectTo(const QString &cid, const QString &password, const QString &callsign);
|
Q_INVOKABLE void connectTo(const QString &cid, const QString &password, const QString &callsign);
|
||||||
|
|
||||||
|
//! Disconnect from network
|
||||||
Q_INVOKABLE void disconnectFrom();
|
Q_INVOKABLE void disconnectFrom();
|
||||||
|
|
||||||
//! Audio devices @{
|
//! Audio devices @{
|
||||||
@@ -82,8 +88,11 @@ namespace BlackCore
|
|||||||
//! Enable/disable VHF simulation, true means effects are NOT used
|
//! Enable/disable VHF simulation, true means effects are NOT used
|
||||||
Q_INVOKABLE void setBypassEffects(bool value);
|
Q_INVOKABLE void setBypassEffects(bool value);
|
||||||
|
|
||||||
|
//! Client started?
|
||||||
bool isStarted() const { return m_isStarted; }
|
bool isStarted() const { return m_isStarted; }
|
||||||
QDateTime getStartDateTimeUt() const { return m_startDateTimeUtc; }
|
|
||||||
|
//! When started
|
||||||
|
const QDateTime &getStartDateTimeUtc() const { return m_startDateTimeUtc; }
|
||||||
|
|
||||||
//! Muted @{
|
//! Muted @{
|
||||||
bool isMuted() const;
|
bool isMuted() const;
|
||||||
@@ -159,8 +168,10 @@ namespace BlackCore
|
|||||||
const BlackMisc::Audio::CAudioDeviceInfo &getOutputDevice() const;
|
const BlackMisc::Audio::CAudioDeviceInfo &getOutputDevice() const;
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
|
//! Callsigns currently received @{
|
||||||
QString getReceivingCallsignsCom1();
|
QString getReceivingCallsignsCom1();
|
||||||
QString getReceivingCallsignsCom2();
|
QString getReceivingCallsignsCom2();
|
||||||
|
//! @}
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
//! Receiving callsigns have been changed
|
//! Receiving callsigns have been changed
|
||||||
|
|||||||
@@ -46,23 +46,32 @@ namespace BlackCore
|
|||||||
//! Constructor
|
//! Constructor
|
||||||
ApiServerConnection(const QString &address, QObject *parent = nullptr);
|
ApiServerConnection(const QString &address, QObject *parent = nullptr);
|
||||||
|
|
||||||
|
//! User authenticated?
|
||||||
bool isAuthenticated() const { return m_isAuthenticated; }
|
bool isAuthenticated() const { return m_isAuthenticated; }
|
||||||
|
|
||||||
|
//! Connect to network
|
||||||
bool connectTo(const QString &username, const QString &password, const QUuid &networkVersion);
|
bool connectTo(const QString &username, const QString &password, const QUuid &networkVersion);
|
||||||
|
|
||||||
|
//! Add callsign to network
|
||||||
PostCallsignResponseDto addCallsign(const QString &callsign);
|
PostCallsignResponseDto addCallsign(const QString &callsign);
|
||||||
|
|
||||||
|
//! Remove callsign from network
|
||||||
void removeCallsign(const QString &callsign);
|
void removeCallsign(const QString &callsign);
|
||||||
|
|
||||||
|
//! Update transceivers
|
||||||
void updateTransceivers(const QString &callsign, const QVector<TransceiverDto> &transceivers);
|
void updateTransceivers(const QString &callsign, const QVector<TransceiverDto> &transceivers);
|
||||||
|
|
||||||
|
//! Force disconnect from network
|
||||||
void forceDisconnect();
|
void forceDisconnect();
|
||||||
|
|
||||||
|
//! All aliased stations
|
||||||
QVector<StationDto> getAllAliasedStations();
|
QVector<StationDto> getAllAliasedStations();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template<typename TResponse>
|
template<typename TResponse>
|
||||||
TResponse postNoRequest(const QString &resource)
|
TResponse postNoRequest(const QString &resource)
|
||||||
{
|
{
|
||||||
if (! m_isAuthenticated)
|
if (!m_isAuthenticated)
|
||||||
{
|
{
|
||||||
qDebug() << "Not authenticated";
|
qDebug() << "Not authenticated";
|
||||||
return {};
|
return {};
|
||||||
@@ -147,15 +156,13 @@ namespace BlackCore
|
|||||||
static bool isShuttingDown();
|
static bool isShuttingDown();
|
||||||
|
|
||||||
const QString m_address;
|
const QString m_address;
|
||||||
QByteArray m_jwt;
|
QByteArray m_jwt;
|
||||||
QString m_username;
|
QString m_username;
|
||||||
QString m_password;
|
QString m_password;
|
||||||
QUuid m_networkVersion;
|
QUuid m_networkVersion;
|
||||||
QDateTime m_expiryLocalUtc;
|
QDateTime m_expiryLocalUtc;
|
||||||
qint64 m_serverToUserOffsetMs;
|
qint64 m_serverToUserOffsetMs;
|
||||||
|
bool m_isAuthenticated = false;
|
||||||
bool m_isAuthenticated = false;
|
|
||||||
|
|
||||||
QElapsedTimer *m_watch = nullptr;
|
QElapsedTimer *m_watch = nullptr;
|
||||||
};
|
};
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ namespace BlackMisc
|
|||||||
|
|
||||||
QString CUser::convertToQString(bool i18n) const
|
QString CUser::convertToQString(bool i18n) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(i18n);
|
Q_UNUSED(i18n)
|
||||||
if (m_realname.isEmpty()) return QStringLiteral("<no realname>");
|
if (m_realname.isEmpty()) return QStringLiteral("<no realname>");
|
||||||
QString s = m_realname;
|
QString s = m_realname;
|
||||||
if (this->hasId())
|
if (this->hasId())
|
||||||
|
|||||||
Reference in New Issue
Block a user