From 394147dcb9d47861b137be73a6b8819f7c6dd8a8 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Thu, 29 Nov 2018 00:02:04 +0100 Subject: [PATCH] Server handling * added tower view as hardcoded * renamed to predefined servers * utility functions to add/remove FSD setup flags --- src/blackcore/data/globalsetup.cpp | 80 ++++++++++--------- src/blackcore/data/globalsetup.h | 17 ++-- src/blackcore/data/networksetup.cpp | 13 ++- src/blackcore/data/networksetup.h | 2 +- src/blackcore/data/vatsimsetup.h | 2 +- src/blackgui/components/logincomponent.cpp | 2 +- .../settingsnetworkserverscomponent.cpp | 2 +- src/blackmisc/network/fsdsetup.h | 7 ++ src/blackmisc/network/server.cpp | 69 +++++++++------- src/blackmisc/network/server.h | 9 +++ src/blackmisc/network/serverlist.cpp | 8 ++ src/blackmisc/network/serverlist.h | 3 + 12 files changed, 132 insertions(+), 82 deletions(-) diff --git a/src/blackcore/data/globalsetup.cpp b/src/blackcore/data/globalsetup.cpp index 37f62b9fd..6e04604ed 100644 --- a/src/blackcore/data/globalsetup.cpp +++ b/src/blackcore/data/globalsetup.cpp @@ -250,10 +250,10 @@ namespace BlackCore return m_mapUrls; } - CServerList CGlobalSetup::getFsdTestServersPlusHardcodedServers() const + CServerList CGlobalSetup::getPredefinedServersPlusHardcodedServers() const { - static const CServerList hardcoded({ CServer::swiftFsdTestServer(), CServer::fscServer() }); - CServerList testServers(m_fsdTestServers); + static const CServerList hardcoded({ CServer::swiftFsdTestServer(), CServer::fscServer(), CServer::esTowerView() }); + CServerList testServers(m_predefinedServers); testServers.addIfAddressNotExists(hardcoded); return testServers; } @@ -338,8 +338,8 @@ namespace BlackCore % getVatsimDataFileUrls().toQString(i18n) % separator - % QStringLiteral("FSD test servers: ") - % getFsdTestServers().toQString(i18n) + % QStringLiteral("Predefined servers: ") + % getPredefinedServers().toQString(i18n) % separator % QStringLiteral("Crash report server: ") @@ -356,26 +356,27 @@ namespace BlackCore const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexDbRootDirectory: return CVariant::fromValue(m_dbRootDirectoryUrl); - case IndexDbHttpPort: return CVariant::fromValue(m_dbHttpPort); - case IndexDbHttpsPort: return CVariant::fromValue(m_dbHttpsPort); - case IndexDbLoginService: return CVariant::fromValue(this->getDbLoginServiceUrl()); - case IndexDbClientPingService: return CVariant::fromValue(this->getDbClientPingServiceUrl()); - case IndexVatsimStatus: return CVariant::fromValue(m_vatsimStatusFileUrls); - case IndexVatsimData: return CVariant::fromValue(m_vatsimDataFileUrls); - case IndexVatsimBookings: return CVariant::fromValue(m_vatsimDataFileUrls); - case IndexVatsimMetars: return CVariant::fromValue(m_vatsimMetarsUrls); - case IndexBootstrapFileUrls: return CVariant::fromValue(this->getSwiftBootstrapFileUrls()); - case IndexUpdateInfoFileUrls: return CVariant::fromValue(this->getSwiftUpdateInfoFileUrls()); - case IndexSharedUrls: return CVariant::fromValue(m_sharedUrls); - case IndexNewsUrls: return CVariant::fromValue(m_newsUrls); - case IndexSwiftMapUrls: return CVariant::fromValue(m_mapUrls); - case IndexOnlineHelpUrls: return CVariant::fromValue(m_onlineHelpUrls); - case IndexCrashReportServerUrl: return CVariant::fromValue(m_crashReportServerUrl); - case IndexWasLoadedFromWeb: return CVariant::fromValue(m_wasLoadedFromWeb); - case IndexWasLoadedFromFile: return CVariant::fromValue(m_wasLoadedFromFile); + case IndexDbRootDirectory: return CVariant::fromValue(m_dbRootDirectoryUrl); + case IndexDbHttpPort: return CVariant::fromValue(m_dbHttpPort); + case IndexDbHttpsPort: return CVariant::fromValue(m_dbHttpsPort); + case IndexDbLoginService: return CVariant::fromValue(this->getDbLoginServiceUrl()); + case IndexDbClientPingService: return CVariant::fromValue(this->getDbClientPingServiceUrl()); + case IndexVatsimStatus: return CVariant::fromValue(m_vatsimStatusFileUrls); + case IndexVatsimData: return CVariant::fromValue(m_vatsimDataFileUrls); + case IndexVatsimBookings: return CVariant::fromValue(m_vatsimDataFileUrls); + case IndexVatsimMetars: return CVariant::fromValue(m_vatsimMetarsUrls); + case IndexBootstrapFileUrls: return CVariant::fromValue(this->getSwiftBootstrapFileUrls()); + case IndexUpdateInfoFileUrls: return CVariant::fromValue(this->getSwiftUpdateInfoFileUrls()); + case IndexSharedUrls: return CVariant::fromValue(m_sharedUrls); + case IndexNewsUrls: return CVariant::fromValue(m_newsUrls); + case IndexSwiftMapUrls: return CVariant::fromValue(m_mapUrls); + case IndexOnlineHelpUrls: return CVariant::fromValue(m_onlineHelpUrls); + case IndexCrashReportServerUrl: return CVariant::fromValue(m_crashReportServerUrl); + case IndexWasLoadedFromWeb: return CVariant::fromValue(m_wasLoadedFromWeb); + case IndexWasLoadedFromFile: return CVariant::fromValue(m_wasLoadedFromFile); case IndexMappingMinimumVersion: return CVariant::fromValue(m_mappingMinimumVersion); - default: return CValueObject::propertyByIndex(index); + case IndexPredefinedServers: return CVariant::fromValue(m_predefinedServers); + default: return CValueObject::propertyByIndex(index); } } @@ -391,22 +392,23 @@ namespace BlackCore const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexDbRootDirectory: m_dbRootDirectoryUrl.setPropertyByIndex(index.copyFrontRemoved(), variant); break; - case IndexDbHttpPort: m_dbHttpPort = variant.toInt(); break; - case IndexDbHttpsPort: m_dbHttpsPort = variant.toInt(); break; - case IndexDbLoginService: break; // cannot be changed - case IndexDbClientPingService: break; // cannot be changed - case IndexVatsimData: m_vatsimDataFileUrls = variant.value(); break; - case IndexVatsimBookings: m_vatsimBookingsUrl.setPropertyByIndex(index.copyFrontRemoved(), variant); break; - case IndexVatsimMetars: m_vatsimMetarsUrls = variant.value(); break; - case IndexSharedUrls: m_sharedUrls = variant.value(); break; - case IndexNewsUrls: m_newsUrls = variant.value(); break; - case IndexOnlineHelpUrls: m_onlineHelpUrls = variant.value(); break; - case IndexSwiftMapUrls: m_mapUrls = variant.value(); break; - case IndexCrashReportServerUrl: m_crashReportServerUrl = variant.value(); break; - case IndexWasLoadedFromWeb: m_wasLoadedFromWeb = variant.toBool(); break; - case IndexWasLoadedFromFile: m_wasLoadedFromFile = variant.toBool(); break; + case IndexDbRootDirectory: m_dbRootDirectoryUrl.setPropertyByIndex(index.copyFrontRemoved(), variant); break; + case IndexDbHttpPort: m_dbHttpPort = variant.toInt(); break; + case IndexDbHttpsPort: m_dbHttpsPort = variant.toInt(); break; + case IndexDbLoginService: break; // cannot be changed + case IndexDbClientPingService: break; // cannot be changed + case IndexVatsimData: m_vatsimDataFileUrls = variant.value(); break; + case IndexVatsimBookings: m_vatsimBookingsUrl.setPropertyByIndex(index.copyFrontRemoved(), variant); break; + case IndexVatsimMetars: m_vatsimMetarsUrls = variant.value(); break; + case IndexSharedUrls: m_sharedUrls = variant.value(); break; + case IndexNewsUrls: m_newsUrls = variant.value(); break; + case IndexOnlineHelpUrls: m_onlineHelpUrls = variant.value(); break; + case IndexSwiftMapUrls: m_mapUrls = variant.value(); break; + case IndexCrashReportServerUrl: m_crashReportServerUrl = variant.value(); break; + case IndexWasLoadedFromWeb: m_wasLoadedFromWeb = variant.toBool(); break; + case IndexWasLoadedFromFile: m_wasLoadedFromFile = variant.toBool(); break; case IndexMappingMinimumVersion: m_mappingMinimumVersion = variant.toQString(); break; + case IndexPredefinedServers: m_predefinedServers = variant.value(); break; default: CValueObject::setPropertyByIndex(index, variant); break; } } diff --git a/src/blackcore/data/globalsetup.h b/src/blackcore/data/globalsetup.h index c0812f964..f7dd090b2 100644 --- a/src/blackcore/data/globalsetup.h +++ b/src/blackcore/data/globalsetup.h @@ -61,7 +61,8 @@ namespace BlackCore IndexWasLoadedFromWeb, IndexWasLoadedFromFile, IndexSharedUrls, - IndexMappingMinimumVersion + IndexMappingMinimumVersion, + IndexPredefinedServers }; //! Add info when pinging @@ -189,11 +190,11 @@ namespace BlackCore //! swift map URLs const BlackMisc::Network::CUrlList &getSwiftMapUrls() const; - //! FSD test servers - const BlackMisc::Network::CServerList &getFsdTestServers() const { return m_fsdTestServers; } + //! Predefined servers + const BlackMisc::Network::CServerList &getPredefinedServers() const { return m_predefinedServers; } - //! FSD test servers plus hardcoded - BlackMisc::Network::CServerList getFsdTestServersPlusHardcodedServers() const; + //! Predefined plus hardcoded + BlackMisc::Network::CServerList getPredefinedServersPlusHardcodedServers() const; //! Is server a development server? bool isDevelopment() const { return m_development; } @@ -239,7 +240,7 @@ namespace BlackCore private: bool m_wasLoadedFromWeb = false; //!< Loaded from web bool m_wasLoadedFromFile = false; //!< Loaded from local file - int m_dbHttpPort = 80; //!< port + int m_dbHttpPort = 80; //!< port int m_dbHttpsPort = 443; //!< SSL port bool m_development = false; //!< dev. version? QString m_mappingMinimumVersion; //!< minimum version @@ -253,7 +254,7 @@ namespace BlackCore BlackMisc::Network::CUrlList m_newsUrls; //!< where we can obtain latest news BlackMisc::Network::CUrlList m_onlineHelpUrls; //!< online help URLs BlackMisc::Network::CUrlList m_mapUrls; //!< swift map URLs - BlackMisc::Network::CServerList m_fsdTestServers; //!< FSD test servers loaded from setup file + BlackMisc::Network::CServerList m_predefinedServers; //!< Predefined servers loaded from setup file BlackMisc::Network::CUrl m_ncepGlobalForecastSystemUrl; //!< NCEP GFS url // transient members, to be switched on/off via GUI or set from reader @@ -279,7 +280,7 @@ namespace BlackCore BLACK_METAMEMBER(newsUrls), BLACK_METAMEMBER(onlineHelpUrls), BLACK_METAMEMBER(mapUrls), - BLACK_METAMEMBER(fsdTestServers), + BLACK_METAMEMBER(predefinedServers), BLACK_METAMEMBER(development), BLACK_METAMEMBER(mappingMinimumVersion), BLACK_METAMEMBER(ncepGlobalForecastSystemUrl), diff --git a/src/blackcore/data/networksetup.cpp b/src/blackcore/data/networksetup.cpp index 556089476..75356e3cd 100644 --- a/src/blackcore/data/networksetup.cpp +++ b/src/blackcore/data/networksetup.cpp @@ -52,13 +52,20 @@ namespace BlackCore return m_otherTrafficNetworkServers.get(); } - CServerList CNetworkSetup::getOtherServersPlusTestServers() const + CServerList CNetworkSetup::getOtherServersPlusPredefinedServers() const { // add a testserver when no servers can be loaded CServerList otherServers(this->getOtherServers()); - if (otherServers.isEmpty() && CBuildConfig::isLocalDeveloperDebugBuild()) + if (sApp) { - otherServers.push_back(sApp->getGlobalSetup().getFsdTestServersPlusHardcodedServers()); + if (otherServers.isEmpty() && CBuildConfig::isLocalDeveloperDebugBuild()) + { + otherServers.addIfAddressNotExists(sApp->getGlobalSetup().getPredefinedServersPlusHardcodedServers()); + } + else + { + otherServers.addIfAddressNotExists(sApp->getGlobalSetup().getPredefinedServers()); + } } return otherServers; } diff --git a/src/blackcore/data/networksetup.h b/src/blackcore/data/networksetup.h index 517f0792f..0fbe10a1e 100644 --- a/src/blackcore/data/networksetup.h +++ b/src/blackcore/data/networksetup.h @@ -64,7 +64,7 @@ namespace BlackCore BlackMisc::Network::CServerList getOtherServers() const; //! The other servers plus test servers - BlackMisc::Network::CServerList getOtherServersPlusTestServers() const; + BlackMisc::Network::CServerList getOtherServersPlusPredefinedServers() const; //! Last used with VATSIM? bool wasLastUsedWithVatsim() const; diff --git a/src/blackcore/data/vatsimsetup.h b/src/blackcore/data/vatsimsetup.h index 3edaa460a..1c2f06965 100644 --- a/src/blackcore/data/vatsimsetup.h +++ b/src/blackcore/data/vatsimsetup.h @@ -73,7 +73,7 @@ namespace BlackCore //! Set all URLs and indicate if something has changed bool setUrls(const BlackMisc::Network::CUrlList &dataFileUrls, const BlackMisc::Network::CUrlList &serverFileUrls, const BlackMisc::Network::CUrlList &metarFileUrls); - //! FSD test servers + //! FSD servers const BlackMisc::Network::CServerList &getFsdServers() const { return m_fsdServers; } //! Set FSD servers diff --git a/src/blackgui/components/logincomponent.cpp b/src/blackgui/components/logincomponent.cpp index 716a801dd..d1d09f7e3 100644 --- a/src/blackgui/components/logincomponent.cpp +++ b/src/blackgui/components/logincomponent.cpp @@ -154,7 +154,7 @@ namespace BlackGui this->validateAircraftValues(); ui->form_Pilot->validate(); this->onWebServiceDataRead(CEntityFlags::VatsimDataFile, CEntityFlags::ReadFinished, -1); - const CServerList otherServers(m_networkSetup.getOtherServersPlusTestServers()); + const CServerList otherServers(m_networkSetup.getOtherServersPlusPredefinedServers()); ui->comp_OtherServers->setServers(otherServers); ui->cb_AutoLogoff->setChecked(m_networkSetup.useAutoLogoff()); diff --git a/src/blackgui/components/settingsnetworkserverscomponent.cpp b/src/blackgui/components/settingsnetworkserverscomponent.cpp index 127fb5952..a520b2a00 100644 --- a/src/blackgui/components/settingsnetworkserverscomponent.cpp +++ b/src/blackgui/components/settingsnetworkserverscomponent.cpp @@ -62,7 +62,7 @@ namespace BlackGui // this is debug/bootstrap feature we can continue to test when something goes wrong if (serverList.isEmpty() && CBuildConfig::isLocalDeveloperDebugBuild()) { - serverList.push_back(sGui->getGlobalSetup().getFsdTestServersPlusHardcodedServers()); + serverList.push_back(sGui->getGlobalSetup().getPredefinedServersPlusHardcodedServers()); } ui->tvp_Servers->updateContainer(serverList); } diff --git a/src/blackmisc/network/fsdsetup.h b/src/blackmisc/network/fsdsetup.h index 36f400a98..80b7d3057 100644 --- a/src/blackmisc/network/fsdsetup.h +++ b/src/blackmisc/network/fsdsetup.h @@ -53,6 +53,7 @@ namespace BlackMisc AllParts = SendAircraftParts | ReceiveAircraftParts, //!< send/receive parts AllSendingWithoutGnd = SendAircraftParts | SendInterimPositions, //!< all out, but no gnd.flag AllReceiveWithoutGnd = ReceiveAircraftParts | ReceiveInterimPositions, //!< all in, but no gnd.flag + AllInterimPositions = SendInterimPositions | ReceiveInterimPositions, //!< all interim positions AllWithoutGnd = AllReceiveWithoutGnd | AllSendingWithoutGnd, //!< all, but no gnd.flag VATSIMDefault = AllParts | Force3LetterAirlineICAO }; @@ -86,6 +87,12 @@ namespace BlackMisc //! Set send / receive details void setSendReceiveDetails(SendReceiveDetails sendReceive) { m_sendReceive = sendReceive; } + //! Add send / receive details + void addSendReceiveDetails(SendReceiveDetails sendReceive) { m_sendReceive |= sendReceive; } + + //! Remove send / receive details + void removeSendReceiveDetails(SendReceiveDetails sendReceive) { m_sendReceive &= ~sendReceive; } + //! Set send / receive details void setSendReceiveDetails(bool partsSend, bool partsReceive, bool gndSend, bool gndReceive, bool interimSend, bool interimReceive); diff --git a/src/blackmisc/network/server.cpp b/src/blackmisc/network/server.cpp index f13ccca9a..d024eefe7 100644 --- a/src/blackmisc/network/server.cpp +++ b/src/blackmisc/network/server.cpp @@ -79,12 +79,25 @@ namespace BlackMisc const CServer &CServer::fscServer() { - static const CServer fsc("FSC", "FSC e.V.", "OBF:AwJIKfgkQDJEIRnno29DJlB+UK0=", 6809, - CUser(), - CFsdSetup(), CVoiceSetup(), CEcosystem(CEcosystem::privateFsd()), CServer::FSDServer); + static const CServer fsc = [] + { + CServer s = CServer("FSC", "FSC e.V.", "OBF:AwJIKfgkQDJEIRnno29DJlB+UK0=", 6809, + CUser(), + CFsdSetup(), CVoiceSetup(), CEcosystem(CEcosystem::privateFsd()), CServer::FSDServer); + s.removeSendReceiveDetails(CFsdSetup::AllInterimPositions); + return s; + }(); return fsc; } + const CServer &CServer::esTowerView() + { + static const CServer s = CServer("ES Tower", "Euroscope Tower view", "localhost", 6809, + CUser(), + CFsdSetup::vatsimStandard(), CVoiceSetup::vatsimStandard(), CEcosystem(CEcosystem::vatsim()), CServer::VoiceServerVatsim); + return s; + } + bool CServer::matchesName(const QString &name) const { return m_name.length() == name.length() && @@ -189,17 +202,17 @@ namespace BlackMisc const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexAddress: return CVariant::fromValue(m_address); - case IndexDescription: return CVariant::fromValue(m_description); - case IndexName: return CVariant::fromValue(m_name); - case IndexPort: return CVariant::fromValue(m_port); - case IndexUser: return m_user.propertyByIndex(index.copyFrontRemoved()); - case IndexFsdSetup: return m_fsdSetup.propertyByIndex(index.copyFrontRemoved()); - case IndexVoiceSetup: return m_voiceSetup.propertyByIndex(index.copyFrontRemoved()); - case IndexEcosystem: return m_ecosystem.propertyByIndex(index.copyFrontRemoved()); + case IndexAddress: return CVariant::fromValue(m_address); + case IndexDescription: return CVariant::fromValue(m_description); + case IndexName: return CVariant::fromValue(m_name); + case IndexPort: return CVariant::fromValue(m_port); + case IndexUser: return m_user.propertyByIndex(index.copyFrontRemoved()); + case IndexFsdSetup: return m_fsdSetup.propertyByIndex(index.copyFrontRemoved()); + case IndexVoiceSetup: return m_voiceSetup.propertyByIndex(index.copyFrontRemoved()); + case IndexEcosystem: return m_ecosystem.propertyByIndex(index.copyFrontRemoved()); case IndexIsAcceptingConnections: return CVariant::fromValue(m_isAcceptingConnections); - case IndexServerType: return CVariant::fromValue(m_serverType); - case IndexServerTypeAsString: return CVariant::fromValue(getServerTypeAsString()); + case IndexServerType: return CVariant::fromValue(m_serverType); + case IndexServerTypeAsString: return CVariant::fromValue(getServerTypeAsString()); default: return CValueObject::propertyByIndex(index); } } @@ -212,16 +225,16 @@ namespace BlackMisc const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexAddress: this->setAddress(variant.value()); break; - case IndexPort: this->setPort(variant.value()); break; + case IndexAddress: this->setAddress(variant.value()); break; + case IndexPort: this->setPort(variant.value()); break; case IndexDescription: this->setDescription(variant.value()); break; - case IndexName: this->setName(variant.value()); break; - case IndexUser: m_user.setPropertyByIndex(index.copyFrontRemoved(), variant); break; - case IndexFsdSetup: m_fsdSetup.setPropertyByIndex(index.copyFrontRemoved(), variant); break; - case IndexVoiceSetup: m_voiceSetup.setPropertyByIndex(index.copyFrontRemoved(), variant); break; - case IndexEcosystem: m_ecosystem.setPropertyByIndex(index.copyFrontRemoved(), variant); break; + case IndexName: this->setName(variant.value()); break; + case IndexUser: m_user.setPropertyByIndex(index.copyFrontRemoved(), variant); break; + case IndexFsdSetup: m_fsdSetup.setPropertyByIndex(index.copyFrontRemoved(), variant); break; + case IndexVoiceSetup: m_voiceSetup.setPropertyByIndex(index.copyFrontRemoved(), variant); break; + case IndexEcosystem: m_ecosystem.setPropertyByIndex(index.copyFrontRemoved(), variant); break; + case IndexServerType: this->setServerType(static_cast(variant.toInt())); break; case IndexIsAcceptingConnections: this->setIsAcceptingConnections(variant.value()); break; - case IndexServerType: this->setServerType(static_cast(variant.toInt())); break; default: CValueObject::setPropertyByIndex(index, variant); break; } } @@ -233,15 +246,15 @@ namespace BlackMisc const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexAddress: return this->getAddress().compare(compareValue.getAddress(), Qt::CaseInsensitive); + case IndexAddress: return this->getAddress().compare(compareValue.getAddress(), Qt::CaseInsensitive); case IndexDescription: return this->getDescription().compare(compareValue.getDescription(), Qt::CaseInsensitive); - case IndexFsdSetup: return m_fsdSetup.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getFsdSetup()); - case IndexVoiceSetup: return m_voiceSetup.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getVoiceSetup()); - case IndexName: return this->getName().compare(compareValue.getName(), Qt::CaseInsensitive); + case IndexFsdSetup: return m_fsdSetup.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getFsdSetup()); + case IndexVoiceSetup: return m_voiceSetup.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getVoiceSetup()); + case IndexName: return this->getName().compare(compareValue.getName(), Qt::CaseInsensitive); + case IndexPort: return Compare::compare(this->getPort(), compareValue.getPort()); + case IndexUser: return this->getUser().comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getUser()); + 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 IndexEcosystem: return this->getEcosystem().comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getEcosystem()); case IndexServerType: case IndexServerTypeAsString: return this->getServerTypeAsString().compare(compareValue.getServerTypeAsString(), Qt::CaseInsensitive); diff --git a/src/blackmisc/network/server.h b/src/blackmisc/network/server.h index 7b72f38d2..5b9d7e7f7 100644 --- a/src/blackmisc/network/server.h +++ b/src/blackmisc/network/server.h @@ -157,6 +157,12 @@ namespace BlackMisc //! Set FSD setup void setFsdSetup(const CFsdSetup &setup) { m_fsdSetup = setup; } + //! Add send / receive details + void addSendReceiveDetails(CFsdSetup::SendReceiveDetails sendReceive) { m_fsdSetup.addSendReceiveDetails(sendReceive); } + + //! Remove send / receive details + void removeSendReceiveDetails(CFsdSetup::SendReceiveDetails sendReceive) { m_fsdSetup.removeSendReceiveDetails(sendReceive); } + //! A FSD server? bool isFsdServer() const; @@ -217,6 +223,9 @@ namespace BlackMisc //! FSC server static const CServer &fscServer(); + //! ES tower server + static const CServer &esTowerView(); + private: QString m_name; QString m_description; diff --git a/src/blackmisc/network/serverlist.cpp b/src/blackmisc/network/serverlist.cpp index 341b20ffc..9efa5cd63 100644 --- a/src/blackmisc/network/serverlist.cpp +++ b/src/blackmisc/network/serverlist.cpp @@ -43,6 +43,14 @@ namespace BlackMisc return removed; } + void CServerList::removeUsers() + { + for (CServer &s : *this) + { + s.setUser(CUser()); + } + } + bool CServerList::containsAddressPort(const CServer &server) { for (const CServer &s : *this) diff --git a/src/blackmisc/network/serverlist.h b/src/blackmisc/network/serverlist.h index 1a747e1ae..daedb190d 100644 --- a/src/blackmisc/network/serverlist.h +++ b/src/blackmisc/network/serverlist.h @@ -45,6 +45,9 @@ namespace BlackMisc //! Remove by name bool removeByName(const QString &name); + //! Remove passwords + void removeUsers(); + //! Contains server with same address/port bool containsAddressPort(const CServer &server);