mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 12:55:33 +08:00
refs #445, settings for global network/readers values
This commit is contained in:
committed by
Mathew Sutcliffe
parent
4120608532
commit
938c0f3dc8
27
src/blackcore/global_network_settings.cpp
Normal file
27
src/blackcore/global_network_settings.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
/* Copyright (C) 2015
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "global_network_settings.h"
|
||||
#include "blackmisc/network/user.h"
|
||||
|
||||
using namespace BlackMisc::Network;
|
||||
|
||||
namespace BlackCore
|
||||
{
|
||||
CGlobalNetworkSettings::CGlobalNetworkSettings() :
|
||||
m_fsdSwiftServer("swift", "swift Testserver", "vatsim-germany.org", 6809,
|
||||
CUser("1234567", "swift Test User", "", "123456"), true)
|
||||
{ }
|
||||
|
||||
const CGlobalNetworkSettings &CGlobalNetworkSettings::instance()
|
||||
{
|
||||
static const CGlobalNetworkSettings rs;
|
||||
return rs;
|
||||
}
|
||||
}
|
||||
42
src/blackcore/global_network_settings.h
Normal file
42
src/blackcore/global_network_settings.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/* Copyright (C) 2015
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef BLACKCORE_GLOBAL_NETWORKSETTINGS_H
|
||||
#define BLACKCORE_GLOBAL_NETWORKSETTINGS_H
|
||||
|
||||
#include "blackmisc/network/server.h"
|
||||
#include "blackcoreexport.h"
|
||||
#include <QStringList>
|
||||
#include <QObject>
|
||||
|
||||
namespace BlackCore
|
||||
{
|
||||
//! Settings for readers
|
||||
class BLACKCORE_EXPORT CGlobalNetworkSettings : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! FSD Server
|
||||
const BlackMisc::Network::CServer &swiftFSDTestServer() const { return m_fsdSwiftServer; }
|
||||
|
||||
//! Singleton
|
||||
static const CGlobalNetworkSettings &instance();
|
||||
|
||||
private:
|
||||
//! Default constructor
|
||||
CGlobalNetworkSettings();
|
||||
|
||||
//! Destructor.
|
||||
~CGlobalNetworkSettings() {}
|
||||
|
||||
BlackMisc::Network::CServer m_fsdSwiftServer;
|
||||
};
|
||||
}
|
||||
#endif // guard
|
||||
@@ -7,22 +7,20 @@
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "reader_settings.h"
|
||||
#include "global_reader_settings.h"
|
||||
|
||||
namespace BlackCore
|
||||
{
|
||||
CReaderSettings::CReaderSettings() :
|
||||
// m_protocolIcaoReader("http"), m_serverIcaoReader("vatrep.vatsim-germany.org"),
|
||||
// m_protocolModelReader("http"), m_serverModelReader("vatrep.vatsim-germany.org"),
|
||||
CGlobalReaderSettings::CGlobalReaderSettings() :
|
||||
m_protocolIcaoReader("http"), m_serverIcaoReader("ubuntu12"), m_baseUrlIcaoReader("vatrep/public"),
|
||||
m_protocolModelReader("http"), m_serverModelReader("ubuntu12"), m_baseUrlModelReader("vatrep/public"),
|
||||
m_bookingsUrl("http://vatbook.euroutepro.com/xml2.php"),
|
||||
m_vatsimDataFileUrls({ "http://info.vroute.net/vatsim-data.txt" })
|
||||
{ }
|
||||
|
||||
const CReaderSettings &CReaderSettings::instance()
|
||||
const CGlobalReaderSettings &CGlobalReaderSettings::instance()
|
||||
{
|
||||
static const CReaderSettings rs;
|
||||
static const CGlobalReaderSettings rs;
|
||||
return rs;
|
||||
}
|
||||
}
|
||||
@@ -7,8 +7,8 @@
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#ifndef BLACKCORE_READERSETTINGS_H
|
||||
#define BLACKCORE_READERSETTINGS_H
|
||||
#ifndef BLACKCORE_GLOBAL_READERSETTINGS_H
|
||||
#define BLACKCORE_GLOBAL_READERSETTINGS_H
|
||||
|
||||
#include "blackcoreexport.h"
|
||||
#include <QStringList>
|
||||
@@ -17,7 +17,7 @@
|
||||
namespace BlackCore
|
||||
{
|
||||
//! Settings for readers
|
||||
class BLACKCORE_EXPORT CReaderSettings : public QObject
|
||||
class BLACKCORE_EXPORT CGlobalReaderSettings : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -47,14 +47,14 @@ namespace BlackCore
|
||||
const QStringList &vatsimDataFileUrls() const { return m_vatsimDataFileUrls; }
|
||||
|
||||
//! Singleton
|
||||
static const CReaderSettings &instance();
|
||||
static const CGlobalReaderSettings &instance();
|
||||
|
||||
private:
|
||||
//! Default constructor
|
||||
CReaderSettings();
|
||||
CGlobalReaderSettings();
|
||||
|
||||
//! Destructor.
|
||||
~CReaderSettings() {}
|
||||
~CGlobalReaderSettings() {}
|
||||
|
||||
QString m_protocolIcaoReader;
|
||||
QString m_serverIcaoReader;
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "vatsimdatafilereader.h"
|
||||
#include "icaodatareader.h"
|
||||
#include "modeldatareader.h"
|
||||
#include "reader_settings.h"
|
||||
#include "global_reader_settings.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackmisc/worker.h"
|
||||
|
||||
@@ -151,7 +151,7 @@ namespace BlackCore
|
||||
// 1. VATSIM bookings
|
||||
if (flags.testFlag(VatsimBookingReader))
|
||||
{
|
||||
this->m_vatsimBookingReader = new CVatsimBookingReader(this, CReaderSettings::instance().bookingsUrl());
|
||||
this->m_vatsimBookingReader = new CVatsimBookingReader(this, CGlobalReaderSettings::instance().bookingsUrl());
|
||||
connect(this->m_vatsimBookingReader, &CVatsimBookingReader::dataRead, this, &CWebDataReader::ps_receivedBookings);
|
||||
this->m_vatsimBookingReader->start();
|
||||
this->m_vatsimBookingReader->setInterval(3 * 60 * 1000);
|
||||
@@ -160,7 +160,7 @@ namespace BlackCore
|
||||
// 2. VATSIM data file
|
||||
if (flags.testFlag(VatsimDataReader))
|
||||
{
|
||||
this->m_vatsimDataFileReader = new CVatsimDataFileReader(this, CReaderSettings::instance().vatsimDataFileUrls());
|
||||
this->m_vatsimDataFileReader = new CVatsimDataFileReader(this, CGlobalReaderSettings::instance().vatsimDataFileUrls());
|
||||
connect(this->m_vatsimDataFileReader, &CVatsimDataFileReader::dataRead, this, &CWebDataReader::ps_dataFileRead);
|
||||
this->m_vatsimDataFileReader->start();
|
||||
this->m_vatsimDataFileReader->setInterval(90 * 1000);
|
||||
@@ -169,7 +169,7 @@ namespace BlackCore
|
||||
// 3. ICAO data reader
|
||||
if (flags.testFlag(IcaoDataReader))
|
||||
{
|
||||
this->m_icaoDataReader = new CIcaoDataReader(this, CReaderSettings::instance().protocolIcaoReader(), CReaderSettings::instance().serverIcaoReader(), CReaderSettings::instance().baseUrlIcaoReader());
|
||||
this->m_icaoDataReader = new CIcaoDataReader(this, CGlobalReaderSettings::instance().protocolIcaoReader(), CGlobalReaderSettings::instance().serverIcaoReader(), CGlobalReaderSettings::instance().baseUrlIcaoReader());
|
||||
connect(this->m_icaoDataReader, &CIcaoDataReader::readAircraftIcaoCodes, this, &CWebDataReader::ps_readAircraftIcaoCodes);
|
||||
connect(this->m_icaoDataReader, &CIcaoDataReader::readAirlinesIcaoCodes, this, &CWebDataReader::ps_readAirlinesIcaoCodes);
|
||||
this->m_icaoDataReader->start();
|
||||
@@ -178,7 +178,7 @@ namespace BlackCore
|
||||
// 4. Model reader
|
||||
if (flags.testFlag(ModelReader))
|
||||
{
|
||||
this->m_modelDataReader = new CModelDataReader(this, CReaderSettings::instance().protocolModelReader(), CReaderSettings::instance().serverModelReader(), CReaderSettings::instance().baseUrlModelReader());
|
||||
this->m_modelDataReader = new CModelDataReader(this, CGlobalReaderSettings::instance().protocolModelReader(), CGlobalReaderSettings::instance().serverModelReader(), CGlobalReaderSettings::instance().baseUrlModelReader());
|
||||
connect(this->m_modelDataReader, &CModelDataReader::readLiveries, this, &CWebDataReader::ps_readLiveries);
|
||||
connect(this->m_modelDataReader, &CModelDataReader::readDistributors, this, &CWebDataReader::ps_readDistributors);
|
||||
connect(this->m_modelDataReader, &CModelDataReader::readModels, this, &CWebDataReader::ps_readModels);
|
||||
|
||||
Reference in New Issue
Block a user