Ref T286, moved server settings into "network" namespace (not VATSIM specific)

This commit is contained in:
Klaus Basan
2018-07-03 19:40:47 +02:00
parent 2da0186dd2
commit a2bca21715
6 changed files with 72 additions and 43 deletions

View File

@@ -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<Vatsim::TCurrentTrafficServer> m_currentNetworkServer { this };
BlackMisc::CSetting<BlackMisc::Network::Settings::TCurrentTrafficServer> m_currentNetworkServer { this };
//! Station has been changed, needed to tune in/out voice room
//! \ingroup crosscontextfunction

View File

@@ -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<BlackCore::Vatsim::TTrafficServers> m_otherTrafficNetworkServers { this, &CNetworkSetup::onSettingsChanged };
BlackMisc::CSettingReadOnly<BlackMisc::Network::Settings::TTrafficServers> m_otherTrafficNetworkServers { this, &CNetworkSetup::onSettingsChanged };
BlackMisc::CData<BlackMisc::Network::Data::TLastServer> m_lastServer { this, &CNetworkSetup::onSettingsChanged }; //!< recently used server (VATSIM, other)
BlackMisc::CData<BlackCore::Data::TVatsimLastServer> m_lastVatsimServer { this, &CNetworkSetup::onSettingsChanged }; //!< recently used VATSIM server
};

View File

@@ -24,38 +24,6 @@ namespace BlackCore
{
namespace Vatsim
{
/*!
* Virtual air traffic servers
*/
struct TTrafficServers : public BlackMisc::TSettingTrait<BlackMisc::Network::CServerList>
{
//! \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<BlackMisc::Network::CServer>
{
//! \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;

View File

@@ -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 <QFrame>
#include <QObject>
#include <QScopedPointer>
@@ -52,7 +51,7 @@ namespace BlackGui
void alterTrafficServer();
QScopedPointer<Ui::CSettingsNetworkServersComponent> ui;
BlackMisc::CSetting<BlackCore::Vatsim::TTrafficServers> m_trafficNetworkServers { this, &CSettingsNetworkServersComponent::reloadSettings };
BlackMisc::CSetting<BlackMisc::Network::Settings::TTrafficServers> m_trafficNetworkServers { this, &CSettingsNetworkServersComponent::reloadSettings };
};
} // ns
} // ns

View File

@@ -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 \

View File

@@ -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<CServerList>
{
//! \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<CServer>
{
//! \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