mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-14 00:25:35 +08:00
Ref T172, added ecosystem in CServer class
This commit is contained in:
@@ -15,6 +15,7 @@
|
|||||||
#include "blackmisc/statusmessage.h"
|
#include "blackmisc/statusmessage.h"
|
||||||
#include "blackmisc/comparefunctions.h"
|
#include "blackmisc/comparefunctions.h"
|
||||||
#include "blackmisc/variant.h"
|
#include "blackmisc/variant.h"
|
||||||
|
#include "blackmisc/verify.h"
|
||||||
|
|
||||||
#include <Qt>
|
#include <Qt>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
@@ -25,19 +26,52 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
const QList<int> &CServer::allServerTypes()
|
const QList<int> &CServer::allServerTypes()
|
||||||
{
|
{
|
||||||
static const QList<int> all({ FSDServerVatsim, FSDServerFSC, FSDServerLegacy, WebService, Unspecified });
|
static const QList<int> all({ FSDServerVatsim, VoiceServerVatsim, FSDServer, VoiceServer, WebService, Unspecified });
|
||||||
return all;
|
return all;
|
||||||
}
|
}
|
||||||
|
|
||||||
CServer::CServer(const QString &name, const QString &description, const QString &address, int port, const CUser &user, ServerType serverType, bool isAcceptingConnections)
|
CServer::CServer(
|
||||||
: m_name(name), m_description(description), m_address(address), m_port(port), m_user(user), m_serverType(serverType), m_isAcceptingConnections(isAcceptingConnections) {}
|
const QString &name, const QString &description, const QString &address, int port, const CUser &user,
|
||||||
|
const CFsdSetup &setup, const CEcosystem &ecosytem, ServerType serverType, bool isAcceptingConnections)
|
||||||
|
: m_name(name), m_description(description), m_address(address), m_port(port), m_user(user),
|
||||||
|
m_fsdSetup(setup), m_ecosystem(ecosytem),
|
||||||
|
m_serverType(serverType), m_isAcceptingConnections(isAcceptingConnections)
|
||||||
|
{}
|
||||||
|
|
||||||
|
CServer::CServer(
|
||||||
|
const QString &address, int port, const CUser &user)
|
||||||
|
: m_name("no name"), m_description("min.configuration"), m_address(address), m_port(port), m_user(user)
|
||||||
|
{}
|
||||||
|
|
||||||
|
CServer::CServer(const CEcosystem &ecosystem)
|
||||||
|
{
|
||||||
|
this->setEcosystem(ecosystem);
|
||||||
|
}
|
||||||
|
|
||||||
|
CServer::CServer(CServer::ServerType serverType)
|
||||||
|
{
|
||||||
|
this->setServerType(serverType);
|
||||||
|
}
|
||||||
|
|
||||||
QString CServer::convertToQString(bool i18n) const
|
QString CServer::convertToQString(bool i18n) const
|
||||||
{
|
{
|
||||||
static const QString str("%1 %2 %3:%4 %5 accepting: %6 FSD: %7 con.since: %8");
|
static const QString str("%1 %2 %3:%4 %5 %6 accepting: %7 FSD: %8 con.since: %9");
|
||||||
return str.
|
return str.
|
||||||
arg(this->m_name, this->m_description, this->m_address).arg(this->m_port).
|
arg(m_name, m_description, m_address).arg(m_port).
|
||||||
arg(this->m_user.toQString(i18n), boolToYesNo(this->m_isAcceptingConnections), this->m_fsdSetup.toQString(i18n), this->isConnected() ? this->getFormattedUtcTimestampHms() : "not con.");
|
arg(m_user.toQString(i18n), m_ecosystem.getSystemString(),
|
||||||
|
boolToYesNo(m_isAcceptingConnections), m_fsdSetup.toQString(i18n), this->isConnected() ? this->getFormattedUtcTimestampHms() : "not con.");
|
||||||
|
}
|
||||||
|
|
||||||
|
const CServer &CServer::swiftFsdTestServer(bool withPw)
|
||||||
|
{
|
||||||
|
// CUser("guest", "Guest Client project", "", "guest")
|
||||||
|
static const CServer dvp("Testserver", "Client project testserver", "fsd.swift-project.org", 6809,
|
||||||
|
CUser("1234567", "Test User", "", "123456"),
|
||||||
|
CFsdSetup(), CEcosystem(CEcosystem::swiftTest()), CServer::FSDServerVatsim);
|
||||||
|
static const CServer dvnp("Testserver", "Client project testserver", "fsd.swift-project.org", 6809,
|
||||||
|
CUser("1234567", "Test User", "", ""),
|
||||||
|
CFsdSetup(), CEcosystem(CEcosystem::swiftTest()), CServer::FSDServerVatsim);
|
||||||
|
return withPw ? dvp : dvnp;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CServer::matchesName(const QString &name) const
|
bool CServer::matchesName(const QString &name) const
|
||||||
@@ -58,9 +92,21 @@ namespace BlackMisc
|
|||||||
m_address.startsWith(address, Qt::CaseInsensitive);
|
m_address.startsWith(address, Qt::CaseInsensitive);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CServer::setEcosystem(const CEcosystem &ecosystem)
|
||||||
|
{
|
||||||
|
if (m_ecosystem == ecosystem) { return false; } // avoid cross dependency
|
||||||
|
m_ecosystem = ecosystem;
|
||||||
|
|
||||||
|
// cross dependency
|
||||||
|
if (ecosystem.isSystem(CEcosystem::VATSIM)) { m_serverType = FSDServerVatsim; }
|
||||||
|
if (ecosystem.isSystem(CEcosystem::PrivateFSD)) { m_serverType = FSDServer; }
|
||||||
|
if (ecosystem.isSystem(CEcosystem::SwiftTest)) { m_serverType = FSDServerVatsim; }
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool CServer::isValidForLogin() const
|
bool CServer::isValidForLogin() const
|
||||||
{
|
{
|
||||||
return this->m_user.hasValidCredentials() && this->hasAddressAndPort() && this->isAcceptingConnections();
|
return m_user.hasValidCredentials() && this->hasAddressAndPort() && this->isAcceptingConnections();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CServer::hasAddressAndPort() const
|
bool CServer::hasAddressAndPort() const
|
||||||
@@ -71,18 +117,39 @@ namespace BlackMisc
|
|||||||
bool CServer::isFsdServer() const
|
bool CServer::isFsdServer() const
|
||||||
{
|
{
|
||||||
return (this->getServerType() == FSDServerVatsim ||
|
return (this->getServerType() == FSDServerVatsim ||
|
||||||
this->getServerType() == FSDServerLegacy ||
|
this->getServerType() == FSDServer);
|
||||||
this->getServerType() == FSDServerFSC);
|
}
|
||||||
|
|
||||||
|
bool CServer::setServerType(CServer::ServerType serverType)
|
||||||
|
{
|
||||||
|
if (m_serverType == serverType) { return false; } // avoid x-dependency
|
||||||
|
m_serverType = static_cast<int>(serverType);
|
||||||
|
switch (m_serverType)
|
||||||
|
{
|
||||||
|
case FSDServerVatsim : m_ecosystem = CEcosystem(CEcosystem::VATSIM); break;
|
||||||
|
case FSDServer: m_ecosystem = CEcosystem(CEcosystem::PrivateFSD); break;
|
||||||
|
case VoiceServerVatsim: m_ecosystem = CEcosystem(CEcosystem::VATSIM); break;
|
||||||
|
case VoiceServer: m_ecosystem = CEcosystem(CEcosystem::PrivateFSD); break;
|
||||||
|
case WebService: m_ecosystem = CEcosystem(CEcosystem::NoSystem); break;
|
||||||
|
case Unspecified: m_ecosystem = CEcosystem(CEcosystem::Unspecified); break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CServer::hasUnspecifiedServerType() const
|
||||||
|
{
|
||||||
|
return this->getServerType() == Unspecified;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString &CServer::getServerTypeAsString() const
|
const QString &CServer::getServerTypeAsString() const
|
||||||
{
|
{
|
||||||
return serverTypeToString(getServerType());
|
return CServer::serverTypeToString(getServerType());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CServer::isConnected() const
|
bool CServer::isConnected() const
|
||||||
{
|
{
|
||||||
return this->m_timestampMSecsSinceEpoch >= 0;
|
return m_timestampMSecsSinceEpoch >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
CStatusMessageList CServer::validate() const
|
CStatusMessageList CServer::validate() const
|
||||||
@@ -107,7 +174,7 @@ namespace BlackMisc
|
|||||||
return session.arg(this->getName(), this->getAddress()).arg(this->getPort()).arg(this->getUser().getRealName(), this->getFormattedUtcTimestampHms());
|
return session.arg(this->getName(), this->getAddress()).arg(this->getPort()).arg(this->getUser().getRealName(), this->getFormattedUtcTimestampHms());
|
||||||
}
|
}
|
||||||
|
|
||||||
CVariant CServer::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
CVariant CServer::propertyByIndex(const CPropertyIndex &index) const
|
||||||
{
|
{
|
||||||
if (index.isMyself()) { return CVariant::from(*this); }
|
if (index.isMyself()) { return CVariant::from(*this); }
|
||||||
if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::propertyByIndex(index); }
|
if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::propertyByIndex(index); }
|
||||||
@@ -115,26 +182,17 @@ namespace BlackMisc
|
|||||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
case IndexAddress:
|
case IndexAddress: return CVariant::fromValue(m_address);
|
||||||
return CVariant::fromValue(this->m_address);
|
case IndexDescription: return CVariant::fromValue(m_description);
|
||||||
case IndexDescription:
|
case IndexName: return CVariant::fromValue(m_name);
|
||||||
return CVariant::fromValue(this->m_description);
|
case IndexPort: return CVariant::fromValue(m_port);
|
||||||
case IndexName:
|
case IndexUser: return m_user.propertyByIndex(index.copyFrontRemoved());
|
||||||
return CVariant::fromValue(this->m_name);
|
case IndexFsdSetup: return m_fsdSetup.propertyByIndex(index.copyFrontRemoved());
|
||||||
case IndexPort:
|
case IndexEcosystem: return m_ecosystem.propertyByIndex(index.copyFrontRemoved());
|
||||||
return CVariant::fromValue(this->m_port);
|
case IndexIsAcceptingConnections: return CVariant::fromValue(m_isAcceptingConnections);
|
||||||
case IndexUser:
|
case IndexServerType: return CVariant::fromValue(m_serverType);
|
||||||
return this->m_user.propertyByIndex(index.copyFrontRemoved());
|
case IndexServerTypeAsString: return CVariant::fromValue(getServerTypeAsString());
|
||||||
case IndexFsdSetup:
|
default: return CValueObject::propertyByIndex(index);
|
||||||
return this->m_fsdSetup.propertyByIndex(index.copyFrontRemoved());
|
|
||||||
case IndexIsAcceptingConnections:
|
|
||||||
return CVariant::fromValue(this->m_isAcceptingConnections);
|
|
||||||
case IndexServerType:
|
|
||||||
return CVariant::fromValue(this->m_serverType);
|
|
||||||
case IndexServerTypeAsString:
|
|
||||||
return CVariant::fromValue(getServerTypeAsString());
|
|
||||||
default:
|
|
||||||
return CValueObject::propertyByIndex(index);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,33 +204,16 @@ namespace BlackMisc
|
|||||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
case IndexAddress:
|
case IndexAddress: this->setAddress(variant.value<QString>()); break;
|
||||||
this->setAddress(variant.value<QString>());
|
case IndexPort: this->setPort(variant.value<qint32>()); break;
|
||||||
break;
|
case IndexDescription: this->setDescription(variant.value<QString>()); break;
|
||||||
case IndexPort:
|
case IndexName: this->setName(variant.value<QString>()); break;
|
||||||
this->setPort(variant.value<qint32>());
|
case IndexUser: m_user.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
|
||||||
break;
|
case IndexFsdSetup: m_fsdSetup.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
|
||||||
case IndexDescription:
|
case IndexEcosystem: m_ecosystem.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
|
||||||
this->setDescription(variant.value<QString>());
|
case IndexIsAcceptingConnections: this->setIsAcceptingConnections(variant.value<bool>()); break;
|
||||||
break;
|
case IndexServerType: this->setServerType(static_cast<ServerType>(variant.toInt())); break;
|
||||||
case IndexName:
|
default: CValueObject::setPropertyByIndex(index, variant); break;
|
||||||
this->setName(variant.value<QString>());
|
|
||||||
break;
|
|
||||||
case IndexUser:
|
|
||||||
this->m_user.setPropertyByIndex(index.copyFrontRemoved(), variant);
|
|
||||||
break;
|
|
||||||
case IndexFsdSetup:
|
|
||||||
this->m_fsdSetup.setPropertyByIndex(index.copyFrontRemoved(), variant);
|
|
||||||
break;
|
|
||||||
case IndexIsAcceptingConnections:
|
|
||||||
this->setIsAcceptingConnections(variant.value<bool>());
|
|
||||||
break;
|
|
||||||
case IndexServerType:
|
|
||||||
this->setServerType(static_cast<ServerType>(variant.toInt()));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
CValueObject::setPropertyByIndex(index, variant);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,45 +224,40 @@ namespace BlackMisc
|
|||||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
case IndexAddress:
|
case IndexAddress: return this->getAddress().compare(compareValue.getAddress(), Qt::CaseInsensitive);
|
||||||
return this->getAddress().compare(compareValue.getAddress(), Qt::CaseInsensitive);
|
case IndexDescription: return this->getDescription().compare(compareValue.getDescription(), Qt::CaseInsensitive);
|
||||||
case IndexDescription:
|
case IndexFsdSetup: return this->getFsdSetup().toQString().compare(compareValue.getFsdSetup().toQString());
|
||||||
return this->getDescription().compare(compareValue.getDescription(), Qt::CaseInsensitive);
|
case IndexName: return this->getName().compare(compareValue.getName(), Qt::CaseInsensitive);
|
||||||
case IndexFsdSetup:
|
case IndexIsAcceptingConnections: return Compare::compare(this->isAcceptingConnections(), compareValue.isAcceptingConnections());
|
||||||
return this->getFsdSetup().toQString().compare(compareValue.getFsdSetup().toQString());
|
case IndexPort: return Compare::compare(this->getPort(), compareValue.getPort());
|
||||||
case IndexName:
|
case IndexUser: return this->getUser().comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getUser());
|
||||||
return this->getName().compare(compareValue.getName(), Qt::CaseInsensitive);
|
case IndexEcosystem: return this->getEcosystem().comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getEcosystem());
|
||||||
case IndexIsAcceptingConnections:
|
|
||||||
return Compare::compare(this->isAcceptingConnections(), compareValue.isAcceptingConnections());
|
|
||||||
case IndexPort:
|
|
||||||
return Compare::compare(this->getPort(), compareValue.getPort());
|
|
||||||
case IndexUser:
|
|
||||||
return this->getUser().comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getUser());
|
|
||||||
case IndexServerType:
|
case IndexServerType:
|
||||||
case IndexServerTypeAsString:
|
case IndexServerTypeAsString:
|
||||||
return this->getServerTypeAsString().compare(compareValue.getServerTypeAsString(), Qt::CaseInsensitive);
|
return this->getServerTypeAsString().compare(compareValue.getServerTypeAsString(), Qt::CaseInsensitive);
|
||||||
default:
|
default: break;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
Q_ASSERT_X(false, Q_FUNC_INFO, "No compare function");
|
BLACK_VERIFY_X(false, Q_FUNC_INFO, qUtf8Printable("No comparison for index " + index.toQString()));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString &CServer::serverTypeToString(CServer::ServerType server)
|
const QString &CServer::serverTypeToString(CServer::ServerType server)
|
||||||
{
|
{
|
||||||
static const QString fsdVatsim("FSD [VATSIM]");
|
static const QString fsdVatsim("FSD [VATSIM]");
|
||||||
static const QString fsdFsc("FSD [FSC]");
|
static const QString voiceVatsim("voice [VATSIM]");
|
||||||
static const QString fsdLegacy("FSD (legacy)");
|
static const QString fsdLegacy("FSD (legacy)");
|
||||||
|
static const QString voice("voice");
|
||||||
static const QString webService("web service");
|
static const QString webService("web service");
|
||||||
static const QString unspecified("unspecified");
|
static const QString unspecified("unspecified");
|
||||||
|
|
||||||
switch (server)
|
switch (server)
|
||||||
{
|
{
|
||||||
case FSDServerVatsim: return fsdVatsim;
|
case FSDServerVatsim: return fsdVatsim;
|
||||||
case FSDServerFSC: return fsdFsc;
|
case VoiceServerVatsim: return voiceVatsim;
|
||||||
case FSDServerLegacy: return fsdLegacy;
|
case FSDServer: return fsdLegacy;
|
||||||
|
case VoiceServer: return voice;
|
||||||
case WebService: return webService;
|
case WebService: return webService;
|
||||||
case Unspecified: return unspecified;
|
case Unspecified:
|
||||||
default: return unspecified;
|
default: return unspecified;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
#include "blackmisc/metaclass.h"
|
#include "blackmisc/metaclass.h"
|
||||||
#include "blackmisc/network/user.h"
|
#include "blackmisc/network/user.h"
|
||||||
#include "blackmisc/network/fsdsetup.h"
|
#include "blackmisc/network/fsdsetup.h"
|
||||||
|
#include "blackmisc/network/ecosystem.h"
|
||||||
#include "blackmisc/propertyindex.h"
|
#include "blackmisc/propertyindex.h"
|
||||||
#include "blackmisc/statusmessagelist.h"
|
#include "blackmisc/statusmessagelist.h"
|
||||||
#include "blackmisc/timestampbased.h"
|
#include "blackmisc/timestampbased.h"
|
||||||
@@ -32,18 +33,19 @@ namespace BlackMisc
|
|||||||
//! Value object encapsulating information of a server
|
//! Value object encapsulating information of a server
|
||||||
class BLACKMISC_EXPORT CServer :
|
class BLACKMISC_EXPORT CServer :
|
||||||
public CValueObject<CServer>,
|
public CValueObject<CServer>,
|
||||||
public BlackMisc::ITimestampBased
|
public ITimestampBased
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//! Properties by index
|
//! Properties by index
|
||||||
enum ColumnIndex
|
enum ColumnIndex
|
||||||
{
|
{
|
||||||
IndexName = BlackMisc::CPropertyIndex::GlobalIndexCServer,
|
IndexName = CPropertyIndex::GlobalIndexCServer,
|
||||||
IndexDescription,
|
IndexDescription,
|
||||||
IndexAddress,
|
IndexAddress,
|
||||||
IndexPort,
|
IndexPort,
|
||||||
IndexUser,
|
IndexUser,
|
||||||
IndexFsdSetup,
|
IndexFsdSetup,
|
||||||
|
IndexEcosystem,
|
||||||
IndexIsAcceptingConnections,
|
IndexIsAcceptingConnections,
|
||||||
IndexServerType,
|
IndexServerType,
|
||||||
IndexServerTypeAsString
|
IndexServerTypeAsString
|
||||||
@@ -52,11 +54,12 @@ namespace BlackMisc
|
|||||||
//! Server Type
|
//! Server Type
|
||||||
enum ServerType
|
enum ServerType
|
||||||
{
|
{
|
||||||
|
Unspecified,
|
||||||
FSDServerVatsim,
|
FSDServerVatsim,
|
||||||
FSDServerFSC,
|
FSDServer,
|
||||||
FSDServerLegacy,
|
VoiceServerVatsim,
|
||||||
|
VoiceServer,
|
||||||
WebService,
|
WebService,
|
||||||
Unspecified
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Allows to iterate over all ServerType
|
//! Allows to iterate over all ServerType
|
||||||
@@ -70,7 +73,18 @@ namespace BlackMisc
|
|||||||
|
|
||||||
//! Constructor.
|
//! Constructor.
|
||||||
CServer(const QString &name, const QString &description, const QString &address, int port,
|
CServer(const QString &name, const QString &description, const QString &address, int port,
|
||||||
const CUser &user, ServerType serverType = FSDServerVatsim, bool isAcceptingConnections = true);
|
const CUser &user,
|
||||||
|
const CFsdSetup &setup, const CEcosystem &ecosytem, ServerType serverType,
|
||||||
|
bool isAcceptingConnections = true);
|
||||||
|
|
||||||
|
//! Constructor (minimal for testing)
|
||||||
|
CServer(const QString &address, int port, const CUser &user);
|
||||||
|
|
||||||
|
//! Constructor by ecosystem
|
||||||
|
CServer(const CEcosystem &ecosystem);
|
||||||
|
|
||||||
|
//! Constructor by server type
|
||||||
|
CServer(ServerType serverType);
|
||||||
|
|
||||||
//! Get address.
|
//! Get address.
|
||||||
const QString &getAddress() const { return m_address; }
|
const QString &getAddress() const { return m_address; }
|
||||||
@@ -111,6 +125,12 @@ namespace BlackMisc
|
|||||||
//! Set port
|
//! Set port
|
||||||
void setPort(int port) { m_port = port; }
|
void setPort(int port) { m_port = port; }
|
||||||
|
|
||||||
|
//! Get the ecosystem
|
||||||
|
const CEcosystem &getEcosystem() const { return m_ecosystem; }
|
||||||
|
|
||||||
|
//! Set the ecosystem
|
||||||
|
bool setEcosystem(const CEcosystem &ecosystem);
|
||||||
|
|
||||||
//! Server is accepting connections (allows to disable server temporarily or generally)
|
//! Server is accepting connections (allows to disable server temporarily or generally)
|
||||||
bool isAcceptingConnections() const { return m_isAcceptingConnections; }
|
bool isAcceptingConnections() const { return m_isAcceptingConnections; }
|
||||||
|
|
||||||
@@ -124,20 +144,23 @@ namespace BlackMisc
|
|||||||
bool hasAddressAndPort() const;
|
bool hasAddressAndPort() const;
|
||||||
|
|
||||||
//! Get setup
|
//! Get setup
|
||||||
const CFsdSetup &getFsdSetup() const { return this->m_fsdSetup; }
|
const CFsdSetup &getFsdSetup() const { return m_fsdSetup; }
|
||||||
|
|
||||||
//! A FSD server?
|
//! A FSD server?
|
||||||
bool isFsdServer() const;
|
bool isFsdServer() const;
|
||||||
|
|
||||||
//! Set setup
|
//! Set setup
|
||||||
void setFsdSetup(const CFsdSetup &setup) { this->m_fsdSetup = setup; }
|
void setFsdSetup(const CFsdSetup &setup) { m_fsdSetup = setup; }
|
||||||
|
|
||||||
//! Set server type
|
//! Set server type
|
||||||
void setServerType(ServerType serverType) { m_serverType = static_cast<int>(serverType); }
|
bool setServerType(ServerType serverType);
|
||||||
|
|
||||||
//! Get server type
|
//! Get server type
|
||||||
ServerType getServerType() const { return static_cast<ServerType>(m_serverType); }
|
ServerType getServerType() const { return static_cast<ServerType>(m_serverType); }
|
||||||
|
|
||||||
|
//! Unspecified?
|
||||||
|
bool hasUnspecifiedServerType() const;
|
||||||
|
|
||||||
//! Get server type as string
|
//! Get server type as string
|
||||||
const QString &getServerTypeAsString() const;
|
const QString &getServerTypeAsString() const;
|
||||||
|
|
||||||
@@ -154,16 +177,16 @@ namespace BlackMisc
|
|||||||
bool isConnected() const;
|
bool isConnected() const;
|
||||||
|
|
||||||
//! Validate, provide details about issues
|
//! Validate, provide details about issues
|
||||||
BlackMisc::CStatusMessageList validate() const;
|
CStatusMessageList validate() const;
|
||||||
|
|
||||||
//! Identifying a session, if not connected empty
|
//! Identifying a session, if not connected empty
|
||||||
QString getServerSessionId() const;
|
QString getServerSessionId() const;
|
||||||
|
|
||||||
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
|
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
|
||||||
CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
|
CVariant propertyByIndex(const CPropertyIndex &index) const;
|
||||||
|
|
||||||
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
|
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
|
||||||
void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant);
|
void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant);
|
||||||
|
|
||||||
//! Compare by index
|
//! Compare by index
|
||||||
int comparePropertyByIndex(const CPropertyIndex &index, const CServer &compareValue) const;
|
int comparePropertyByIndex(const CPropertyIndex &index, const CServer &compareValue) const;
|
||||||
@@ -171,15 +194,19 @@ namespace BlackMisc
|
|||||||
//! \copydoc BlackMisc::Mixin::String::toQString()
|
//! \copydoc BlackMisc::Mixin::String::toQString()
|
||||||
QString convertToQString(bool i18n = false) const;
|
QString convertToQString(bool i18n = false) const;
|
||||||
|
|
||||||
|
//! swift FSD test server
|
||||||
|
static const CServer &swiftFsdTestServer(bool withPw = false);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_name;
|
QString m_name;
|
||||||
QString m_description;
|
QString m_description;
|
||||||
QString m_address;
|
QString m_address;
|
||||||
int m_port = -1;
|
int m_port = -1;
|
||||||
CUser m_user;
|
CUser m_user;
|
||||||
CFsdSetup m_fsdSetup;
|
CFsdSetup m_fsdSetup;
|
||||||
int m_serverType = FSDServerVatsim;
|
CEcosystem m_ecosystem;
|
||||||
bool m_isAcceptingConnections = true; //!< disable server for connections
|
int m_serverType = static_cast<int>(Unspecified);
|
||||||
|
bool m_isAcceptingConnections = true; //!< disable server for connections
|
||||||
|
|
||||||
BLACK_METACLASS(
|
BLACK_METACLASS(
|
||||||
CServer,
|
CServer,
|
||||||
@@ -189,6 +216,7 @@ namespace BlackMisc
|
|||||||
BLACK_METAMEMBER(port),
|
BLACK_METAMEMBER(port),
|
||||||
BLACK_METAMEMBER(user),
|
BLACK_METAMEMBER(user),
|
||||||
BLACK_METAMEMBER(fsdSetup),
|
BLACK_METAMEMBER(fsdSetup),
|
||||||
|
BLACK_METAMEMBER(ecosystem),
|
||||||
BLACK_METAMEMBER(serverType),
|
BLACK_METAMEMBER(serverType),
|
||||||
BLACK_METAMEMBER(isAcceptingConnections),
|
BLACK_METAMEMBER(isAcceptingConnections),
|
||||||
BLACK_METAMEMBER(timestampMSecsSinceEpoch, 0, DisabledForJson | DisabledForComparison)
|
BLACK_METAMEMBER(timestampMSecsSinceEpoch, 0, DisabledForJson | DisabledForComparison)
|
||||||
|
|||||||
Reference in New Issue
Block a user