From a2bca2171509ba7fadbacb35fb446cd0c920ecbd Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Tue, 3 Jul 2018 19:40:47 +0200 Subject: [PATCH] Ref T286, moved server settings into "network" namespace (not VATSIM specific) --- .../context/contextownaircraftimpl.h | 11 ++-- src/blackcore/data/networksetup.h | 3 +- src/blackcore/vatsim/vatsimsettings.h | 34 +---------- .../settingsnetworkserverscomponent.h | 7 +-- src/blackmisc/blackmisc.pro | 1 + src/blackmisc/network/settings/servers.h | 59 +++++++++++++++++++ 6 files changed, 72 insertions(+), 43 deletions(-) create mode 100644 src/blackmisc/network/settings/servers.h diff --git a/src/blackcore/context/contextownaircraftimpl.h b/src/blackcore/context/contextownaircraftimpl.h index 1be8b2864..8aef81416 100644 --- a/src/blackcore/context/contextownaircraftimpl.h +++ b/src/blackcore/context/contextownaircraftimpl.h @@ -16,18 +16,19 @@ #include "blackcore/context/contextownaircraft.h" #include "blackcore/corefacadeconfig.h" #include "blackcore/vatsim/vatsimsettings.h" +#include "blackmisc/network/settings/servers.h" +#include "blackmisc/network/user.h" +#include "blackmisc/simulation/aircraftmodel.h" +#include "blackmisc/simulation/ownaircraftprovider.h" +#include "blackmisc/simulation/simulatedaircraft.h" #include "blackmisc/aviation/aircraftparts.h" #include "blackmisc/aviation/airlineicaocode.h" #include "blackmisc/aviation/atcstation.h" #include "blackmisc/aviation/comsystem.h" #include "blackmisc/aviation/selcal.h" #include "blackmisc/geo/coordinategeodetic.h" -#include "blackmisc/network/user.h" #include "blackmisc/pq/frequency.h" #include "blackmisc/pq/length.h" -#include "blackmisc/simulation/aircraftmodel.h" -#include "blackmisc/simulation/ownaircraftprovider.h" -#include "blackmisc/simulation/simulatedaircraft.h" #include "blackmisc/settingscache.h" #include "blackmisc/identifiable.h" #include "blackmisc/identifier.h" @@ -185,7 +186,7 @@ namespace BlackCore QString m_voiceRoom2UrlOverride; //!< overridden voice room url mutable QReadWriteLock m_lockAircraft; //!< lock aircraft - BlackMisc::CSetting m_currentNetworkServer { this }; + BlackMisc::CSetting m_currentNetworkServer { this }; //! Station has been changed, needed to tune in/out voice room //! \ingroup crosscontextfunction diff --git a/src/blackcore/data/networksetup.h b/src/blackcore/data/networksetup.h index b4419b80f..d2059f8dd 100644 --- a/src/blackcore/data/networksetup.h +++ b/src/blackcore/data/networksetup.h @@ -16,6 +16,7 @@ #include "blackcore/data/vatsimsetup.h" #include "blackcore/blackcoreexport.h" #include "blackmisc/network/data/lastserver.h" +#include "blackmisc/network/settings/servers.h" #include "blackmisc/network/serverlist.h" #include "blackmisc/settingscache.h" #include "blackmisc/metaclass.h" @@ -75,7 +76,7 @@ namespace BlackCore //! Settings have been changed void onSettingsChanged(); - BlackMisc::CSettingReadOnly m_otherTrafficNetworkServers { this, &CNetworkSetup::onSettingsChanged }; + BlackMisc::CSettingReadOnly m_otherTrafficNetworkServers { this, &CNetworkSetup::onSettingsChanged }; BlackMisc::CData m_lastServer { this, &CNetworkSetup::onSettingsChanged }; //!< recently used server (VATSIM, other) BlackMisc::CData m_lastVatsimServer { this, &CNetworkSetup::onSettingsChanged }; //!< recently used VATSIM server }; diff --git a/src/blackcore/vatsim/vatsimsettings.h b/src/blackcore/vatsim/vatsimsettings.h index 420071851..888eed98e 100644 --- a/src/blackcore/vatsim/vatsimsettings.h +++ b/src/blackcore/vatsim/vatsimsettings.h @@ -24,38 +24,6 @@ namespace BlackCore { namespace Vatsim { - /*! - * Virtual air traffic servers - */ - struct TTrafficServers : public BlackMisc::TSettingTrait - { - //! \copydoc BlackMisc::TSettingTrait::key - static const char *key() { return "network/trafficservers"; } - - //! \copydoc BlackCore::TSettingTrait::humanReadable - static const QString &humanReadable() { static const QString name("Traffic servers"); return name; } - }; - - /*! - * Currently selected virtual air traffic server - */ - struct TCurrentTrafficServer : public BlackMisc::TSettingTrait - { - //! \copydoc BlackMisc::TSettingTrait::key - static const char *key() { return "network/currenttrafficserver"; } - - //! \copydoc BlackCore::TSettingTrait::humanReadable - static const QString &humanReadable() { static const QString name("Current traffic servers"); return name; } - - //! \copydoc BlackMisc::TSettingTrait::defaultValue - static const BlackMisc::Network::CServer &defaultValue() - { - using namespace BlackMisc::Network; - static const CServer dv = CServer::swiftFsdTestServer(); - return dv; - } - }; - /*! * Settings used with readers */ @@ -104,7 +72,7 @@ namespace BlackCore static const CReaderSettings &neverUpdateSettings(); private: - BlackMisc::PhysicalQuantities::CTime m_initialTime { 30.0, BlackMisc::PhysicalQuantities::CTimeUnit::s()}; + BlackMisc::PhysicalQuantities::CTime m_initialTime { 30.0, BlackMisc::PhysicalQuantities::CTimeUnit::s()}; BlackMisc::PhysicalQuantities::CTime m_periodicTime { 30.0, BlackMisc::PhysicalQuantities::CTimeUnit::s()}; bool m_neverUpdate = false; diff --git a/src/blackgui/components/settingsnetworkserverscomponent.h b/src/blackgui/components/settingsnetworkserverscomponent.h index bfe53e563..bceca5c26 100644 --- a/src/blackgui/components/settingsnetworkserverscomponent.h +++ b/src/blackgui/components/settingsnetworkserverscomponent.h @@ -12,10 +12,9 @@ #ifndef BLACKGUI_COMPONENTS_SETTINGSNETWORKSERVERSCOMPONENT_H #define BLACKGUI_COMPONENTS_SETTINGSNETWORKSERVERSCOMPONENT_H -#include "blackcore/vatsim/vatsimsettings.h" #include "blackgui/blackguiexport.h" -#include "blackmisc/settingscache.h" - +#include "blackgui/blackguiexport.h" +#include "blackmisc/network/settings/servers.h" #include #include #include @@ -52,7 +51,7 @@ namespace BlackGui void alterTrafficServer(); QScopedPointer ui; - BlackMisc::CSetting m_trafficNetworkServers { this, &CSettingsNetworkServersComponent::reloadSettings }; + BlackMisc::CSetting m_trafficNetworkServers { this, &CSettingsNetworkServersComponent::reloadSettings }; }; } // ns } // ns diff --git a/src/blackmisc/blackmisc.pro b/src/blackmisc/blackmisc.pro index 9c4050681..cffd68ea6 100644 --- a/src/blackmisc/blackmisc.pro +++ b/src/blackmisc/blackmisc.pro @@ -33,6 +33,7 @@ HEADERS += *.h \ $$PWD/math/*.h \ $$PWD/network/*.h \ $$PWD/network/data/*.h \ + $$PWD/network/settings/*.h \ $$PWD/pq/*.h \ $$PWD/simulation/*.h \ $$PWD/simulation/data/*.h \ diff --git a/src/blackmisc/network/settings/servers.h b/src/blackmisc/network/settings/servers.h new file mode 100644 index 000000000..b3048dae6 --- /dev/null +++ b/src/blackmisc/network/settings/servers.h @@ -0,0 +1,59 @@ +/* Copyright (C) 2016 + * swift project Community / Contributors + * + * This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level + * directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project, + * including this file, may be copied, modified, propagated, or distributed except according to the terms + * contained in the LICENSE file. + */ + +//! \file + +#ifndef BLACKMISC_NETWORK_SETTINGS_SERVERS_H +#define BLACKMISC_NETWORK_SETTINGS_SERVERS_H + +#include "blackmisc/settingscache.h" +#include "blackmisc/valueobject.h" +#include "blackmisc/network/serverlist.h" + +namespace BlackMisc +{ + namespace Network + { + namespace Settings + { + /*! + * Virtual air traffic servers + */ + struct TTrafficServers : public TSettingTrait + { + //! \copydoc BlackMisc::TSettingTrait::key + static const char *key() { return "network/trafficservers"; } + + //! \copydoc BlackCore::TSettingTrait::humanReadable + static const QString &humanReadable() { static const QString name("Traffic servers"); return name; } + }; + + /*! + * Currently selected virtual air traffic server + */ + struct TCurrentTrafficServer : public TSettingTrait + { + //! \copydoc BlackMisc::TSettingTrait::key + static const char *key() { return "network/currenttrafficserver"; } + + //! \copydoc BlackCore::TSettingTrait::humanReadable + static const QString &humanReadable() { static const QString name("Current traffic servers"); return name; } + + //! \copydoc BlackMisc::TSettingTrait::defaultValue + static const BlackMisc::Network::CServer &defaultValue() + { + static const CServer dv = CServer::swiftFsdTestServer(); + return dv; + } + }; + } // ns + } // ns +} // ns + +#endif