mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-13 07:35:41 +08:00
Encapsulated last network server used in network setup. Will allow to retrieve ecosystem for T272
This commit is contained in:
85
src/blackcore/data/networksetup.h
Normal file
85
src/blackcore/data/networksetup.h
Normal file
@@ -0,0 +1,85 @@
|
||||
/* Copyright (C) 2018
|
||||
* 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 BLACKCORE_DATA_NETWORKSETUP_H
|
||||
#define BLACKCORE_DATA_NETWORKSETUP_H
|
||||
|
||||
#include "blackcore/vatsim/vatsimsettings.h"
|
||||
#include "blackcore/data/vatsimsetup.h"
|
||||
#include "blackcore/blackcoreexport.h"
|
||||
#include "blackmisc/network/data/lastserver.h"
|
||||
#include "blackmisc/network/serverlist.h"
|
||||
#include "blackmisc/settingscache.h"
|
||||
#include "blackmisc/metaclass.h"
|
||||
|
||||
#include <QMetaType>
|
||||
#include <QString>
|
||||
#include <QObject>
|
||||
|
||||
namespace BlackCore
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
//! Remembering the last servers and ecosystem.
|
||||
class BLACKCORE_EXPORT CNetworkSetup : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Default constructor
|
||||
CNetworkSetup();
|
||||
|
||||
//! Destructor.
|
||||
virtual ~CNetworkSetup() {}
|
||||
|
||||
//! Last VATSIM server (VATSIM only)
|
||||
BlackMisc::Network::CServer getLastVatsimServer() const;
|
||||
|
||||
//! Set value of last VATSIM server
|
||||
BlackMisc::CStatusMessage setLastVatsimServer(const BlackMisc::Network::CServer &server);
|
||||
|
||||
//! Last server (all networks)
|
||||
BlackMisc::Network::CServer getLastServer() const;
|
||||
|
||||
//! Set value of last server
|
||||
BlackMisc::CStatusMessage setLastServer(const BlackMisc::Network::CServer &server);
|
||||
|
||||
//! Last used eco system
|
||||
BlackMisc::Network::CEcosystem getLastEcosystem() const;
|
||||
|
||||
//! The other servers
|
||||
BlackMisc::Network::CServerList getOtherServers() const;
|
||||
|
||||
//! The other servers plus test servers
|
||||
BlackMisc::Network::CServerList getOtherServersPlusTestServers() const;
|
||||
|
||||
//! Last used with VATSIM?
|
||||
bool wasLastUsedWithVatsim() const;
|
||||
|
||||
//! Used with an other server (i.e. non VATSIM)
|
||||
bool wasLastUsedWithOtherServer() const;
|
||||
|
||||
signals:
|
||||
//! Setup changed
|
||||
void setupChanged();
|
||||
|
||||
private:
|
||||
//! Settings have been changed
|
||||
void onSettingsChanged();
|
||||
|
||||
BlackMisc::CSettingReadOnly<BlackCore::Vatsim::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
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
#endif // guard
|
||||
Reference in New Issue
Block a user