refs #559, adjustments cache/settings moved

This commit is contained in:
Klaus Basan
2015-12-18 03:25:03 +01:00
parent 070ba8f158
commit 3ac32fa58e
42 changed files with 87 additions and 98 deletions

View File

@@ -12,7 +12,7 @@
#include "blackcore/contextapplicationproxy.h"
#include "blackcore/contextapplicationempty.h"
#include "blackcore/inputmanager.h"
#include "blackcore/settingscache.h"
#include "blackmisc/settingscache.h"
#include "blackmisc/statusmessage.h"
#include "blackmisc/loghandler.h"
#include "blackmisc/logmessage.h"

View File

@@ -10,7 +10,7 @@
#include "contextapplicationimpl.h"
#include "contextruntime.h"
#include "inputmanager.h"
#include "settingscache.h"
#include "blackmisc/settingscache.h"
#include "blackmisc/logmessage.h"
#include "blackmisc/loghandler.h"
#include <QtMsgHandler>

View File

@@ -9,7 +9,7 @@
#include "blackcore/contextapplicationproxy.h"
#include "blackcore/inputmanager.h"
#include "blackcore/settingscache.h"
#include "blackmisc/settingscache.h"
#include "blackmisc/blackmiscfreefunctions.h"
#include "blackmisc/loghandler.h"
#include "blackmisc/identifierlist.h"

View File

@@ -169,7 +169,7 @@ namespace BlackCore
QHash<BlackMisc::Aviation::CComSystem::ComUnit, QSharedPointer<IVoiceChannel>> m_voiceChannelMapping;
// settings
CSetting<BlackCore::Settings::Audio::AudioSettings> m_audioSettings { this };
BlackMisc::CSetting<BlackCore::Settings::Audio::AudioSettings> m_audioSettings { this };
};
} // namespace

View File

@@ -145,7 +145,7 @@ namespace BlackCore
QString m_voiceRoom2UrlOverride; //!< overridden voice room url
mutable QReadWriteLock m_lockAircraft; //!< lock aircraft
CSetting<Settings::Network::CurrentTrafficServer> m_currentNetworkServer { this };
BlackMisc::CSetting<Settings::Network::CurrentTrafficServer> m_currentNetworkServer { this };
//! Init my very own aircraft with some defaults, before overridden by simulator
void initOwnAircraft();

View File

@@ -151,7 +151,7 @@ namespace BlackCore
private:
bool m_init = false; //!< flag
CSetting<Settings::Network::DBusServerAddress> m_dbusServerAddress { this };
BlackMisc::CSetting<Settings::Network::DBusServerAddress> m_dbusServerAddress { this };
// DBus
BlackMisc::CDBusServer *m_dbusServer = nullptr;

View File

@@ -13,7 +13,7 @@
#define BLACKCORE_DATA_AIRCRAFTMODELS_H
#include "blackcore/blackcoreexport.h"
#include "blackcore/datacache.h"
#include "blackmisc/datacache.h"
#include "blackmisc/simulation/aircraftmodellist.h"
#include "blackmisc/variant.h"
@@ -22,7 +22,7 @@ namespace BlackCore
namespace Data
{
//! Trait for own simulator models
struct OwnSimulatorAircraftModels : public BlackCore::CDataTrait<BlackMisc::Simulation::CAircraftModelList>
struct OwnSimulatorAircraftModels : public BlackMisc::CDataTrait<BlackMisc::Simulation::CAircraftModelList>
{
//! Key in data cache
static const char *key() { return "simulator/models"; }
@@ -36,7 +36,7 @@ namespace BlackCore
};
//! Trait for vPilot derived models
struct VPilotAircraftModels : public BlackCore::CDataTrait<BlackMisc::Simulation::CAircraftModelList>
struct VPilotAircraftModels : public BlackMisc::CDataTrait<BlackMisc::Simulation::CAircraftModelList>
{
//! Key in data cache
static const char *key() { return "vpilot/models"; }

View File

@@ -13,7 +13,7 @@
#define BLACKCORE_DATA_AUTHENTICATEDUSER_H
#include "blackcore/blackcoreexport.h"
#include "blackcore/datacache.h"
#include "blackmisc/datacache.h"
#include "blackmisc/network/authenticateduser.h"
namespace BlackCore
@@ -21,7 +21,7 @@ namespace BlackCore
namespace Data
{
//! Trait for for global setup data
struct AuthenticatedUser : public BlackCore::CDataTrait<BlackMisc::Network::CAuthenticatedUser>
struct AuthenticatedUser : public BlackMisc::CDataTrait<BlackMisc::Network::CAuthenticatedUser>
{
//! Key in data cache
static const char *key() { return "readers/global/user"; }

View File

@@ -13,7 +13,7 @@
#define BLACKCORE_DATA_GLOBALSETUP_H
#include "blackcore/blackcoreexport.h"
#include "blackcore/datacache.h"
#include "blackmisc/datacache.h"
#include "blackmisc/network/serverlist.h"
#include "blackmisc/network/urllist.h"
#include "blackmisc/valueobject.h"
@@ -149,7 +149,7 @@ namespace BlackCore
};
//! Trait for global setup data
struct GlobalSetup : public BlackCore::CDataTrait<CGlobalSetup>
struct GlobalSetup : public BlackMisc::CDataTrait<CGlobalSetup>
{
//! Key in data cache
static const char *key() { return "readers/setup"; }

View File

@@ -13,7 +13,7 @@
#define BLACKCORE_DATA_UPDATEINFO_H
#include "blackcore/blackcoreexport.h"
#include "blackcore/datacache.h"
#include "blackmisc/datacache.h"
#include "blackmisc/network/urllist.h"
#include "blackmisc/valueobject.h"
#include "blackmisc/variant.h"
@@ -103,7 +103,7 @@ namespace BlackCore
};
//! Trait for global setup data
struct UpdateInfo : public BlackCore::CDataTrait<CUpdateInfo>
struct UpdateInfo : public BlackMisc::CDataTrait<CUpdateInfo>
{
//! Key in data cache
static const char *key() { return "readers/updateinfo"; }

View File

@@ -59,8 +59,8 @@ namespace BlackCore
void ps_userChanged();
private:
CData<BlackCore::Data::GlobalSetup> m_setup {this}; //!< data cache
BlackCore::CData<BlackCore::Data::AuthenticatedUser> m_user {this, &CDatabaseAuthenticationService::ps_userChanged};
BlackMisc::CData<BlackCore::Data::GlobalSetup> m_setup {this}; //!< data cache
BlackMisc::CData<BlackCore::Data::AuthenticatedUser> m_user {this, &CDatabaseAuthenticationService::ps_userChanged};
QNetworkAccessManager *m_networkManager = nullptr;
bool m_shutdown = false;

View File

@@ -43,11 +43,11 @@ namespace BlackCore
void ps_postResponse(QNetworkReply *nwReplyPtr);
private:
CData<BlackCore::Data::GlobalSetup> m_setup {this}; //!< data cache
BlackMisc::Network::CUrl m_modelUrl;
QNetworkAccessManager *m_networkManager = nullptr;
QNetworkReply *m_pendingReply = nullptr;
bool m_shutdown = false;
BlackMisc::CData<BlackCore::Data::GlobalSetup> m_setup {this}; //!< data cache
BlackMisc::Network::CUrl m_modelUrl;
QNetworkAccessManager *m_networkManager = nullptr;
QNetworkReply *m_pendingReply = nullptr;
bool m_shutdown = false;
//! URL model web service
static BlackMisc::Network::CUrl getModelWriteUrl(const BlackMisc::Network::CUrl &baseUrl);

View File

@@ -134,7 +134,7 @@ namespace BlackCore
mutable QReadWriteLock m_lockAircraft;
mutable QReadWriteLock m_lockCountry;
BlackCore::CData<BlackCore::Data::GlobalSetup> m_setup {this}; //!< setup cache
BlackMisc::CData<BlackCore::Data::GlobalSetup> m_setup {this}; //!< setup cache
//! Base URL
BlackMisc::Network::CUrl getBaseUrl() const;

View File

@@ -132,7 +132,7 @@ namespace BlackCore
BlackMisc::Input::CHotkeyCombination m_lastCombination;
BlackMisc::Input::CHotkeyCombination m_capturedCombination;
BlackCore::CSetting<BlackCore::Settings::Application::ActionHotkeys> m_actionHotkeys { this, &CInputManager::ps_changeHotkeySettings };
BlackMisc::CSetting<BlackCore::Settings::Application::ActionHotkeys> m_actionHotkeys { this, &CInputManager::ps_changeHotkeySettings };
};
}

View File

@@ -133,7 +133,7 @@ namespace BlackCore
mutable QReadWriteLock m_lockLivery;
mutable QReadWriteLock m_lockModels;
BlackCore::CData<BlackCore::Data::GlobalSetup> m_setup {this}; //!< setup cache
BlackMisc::CData<BlackCore::Data::GlobalSetup> m_setup {this}; //!< setup cache
//! Base URL
BlackMisc::Network::CUrl getBaseUrl() const;

View File

@@ -181,7 +181,7 @@ namespace BlackCore
static int const c_updateIntervalMsec = 5000;
static int const c_logoffTimeoutSec = 5;
CSetting<Settings::Network::WireTextCodec> m_fsdTextCodecSetting { this };
BlackMisc::CSetting<Settings::Network::WireTextCodec> m_fsdTextCodecSetting { this };
QTextCodec *m_fsdTextCodec = nullptr;
BlackMisc::Aviation::CAircraftParts m_sentAircraftConfig;

View File

@@ -12,7 +12,7 @@
#ifndef BLACKCORE_SETTINGS_APPLICATION_H
#define BLACKCORE_SETTINGS_APPLICATION_H
#include "blackcore/settingscache.h"
#include "blackmisc/settingscache.h"
#include "blackmisc/input/actionhotkeylist.h"
namespace BlackCore
@@ -22,12 +22,12 @@ namespace BlackCore
namespace Application
{
//! User configured hotkeys
struct ActionHotkeys : public CSettingTrait<BlackMisc::Input::CActionHotkeyList>
struct ActionHotkeys : public BlackMisc::CSettingTrait<BlackMisc::Input::CActionHotkeyList>
{
//! \copydoc BlackCore::CSettingTrait::key
//! \copydoc BlackMisc::CSettingTrait::key
static const char *key() { return "application/actionhotkeys"; }
//! \copydoc BlackCore::CSettingTrait::isValid
//! \copydoc BlackMisc::CSettingTrait::isValid
static bool isValid(const BlackMisc::Input::CActionHotkeyList &value)
{
for (const auto &actionHotkey : value)
@@ -39,8 +39,8 @@ namespace BlackCore
return true;
}
};
}
}
}
} // ns
} // ns
} // ns
#endif

View File

@@ -12,7 +12,7 @@
#ifndef BLACKCORE_SETTINGS_AUDIO_H
#define BLACKCORE_SETTINGS_AUDIO_H
#include "blackcore/settingscache.h"
#include "blackmisc/settingscache.h"
#include "blackmisc/audio/settings/settingsaudio.h"
namespace BlackCore
@@ -22,15 +22,15 @@ namespace BlackCore
namespace Audio
{
//! Name of text codec to use with text in FSD protocol
struct AudioSettings : public CSettingTrait<BlackMisc::Audio::Settings::CSettingsAudio>
struct AudioSettings : public BlackMisc::CSettingTrait<BlackMisc::Audio::Settings::CSettingsAudio>
{
//! \copydoc BlackCore::CSettingTrait::key
//! \copydoc BlackMisc::CSettingTrait::key
static const char *key() { return "audio/setup"; }
//! \copydoc BlackCore::CSettingTrait::defaultValue
//! \copydoc BlackMisc::CSettingTrait::defaultValue
static const BlackMisc::Audio::Settings::CSettingsAudio &defaultValue() { static const BlackMisc::Audio::Settings::CSettingsAudio a; return a; }
//! \copydoc BlackCore::CSettingTrait::isValid
//! \copydoc BlackMisc::CSettingTrait::isValid
static bool isValid(const BlackMisc::Audio::Settings::CSettingsAudio &value) { Q_UNUSED(value); return true; }
};

View File

@@ -12,7 +12,7 @@
#ifndef BLACKCORE_SETTINGS_NETWORK_H
#define BLACKCORE_SETTINGS_NETWORK_H
#include "blackcore/settingscache.h"
#include "blackmisc/settingscache.h"
#include "blackmisc/network/serverlist.h"
#include <QTextCodec>
@@ -23,32 +23,32 @@ namespace BlackCore
namespace Network
{
//! Name of text codec to use with text in FSD protocol
struct WireTextCodec : public CSettingTrait<QString>
struct WireTextCodec : public BlackMisc::CSettingTrait<QString>
{
//! \copydoc BlackCore::CSettingTrait::key
//! \copydoc BlackMisc::CSettingTrait::key
static const char *key() { return "network/wiretextcodec"; }
//! \copydoc BlackCore::CSettingTrait::defaultValue
//! \copydoc BlackMisc::CSettingTrait::defaultValue
static const QString &defaultValue() { static const QString dv("latin1"); return dv; }
//! \copydoc BlackCore::CSettingTrait::isValid
//! \copydoc BlackMisc::CSettingTrait::isValid
static bool isValid(const QString &value) { return QTextCodec::codecForName(qPrintable(value)); }
};
//! Virtual air traffic servers
struct TrafficServers : public CSettingTrait<BlackMisc::Network::CServerList>
struct TrafficServers : public BlackMisc::CSettingTrait<BlackMisc::Network::CServerList>
{
//! \copydoc BlackCore::CSettingTrait::key
//! \copydoc BlackMisc::CSettingTrait::key
static const char *key() { return "network/trafficservers"; }
};
//! Currently selected virtual air traffic server
struct CurrentTrafficServer : public CSettingTrait<BlackMisc::Network::CServer>
struct CurrentTrafficServer : public BlackMisc::CSettingTrait<BlackMisc::Network::CServer>
{
//! \copydoc BlackCore::CSettingTrait::key
//! \copydoc BlackMisc::CSettingTrait::key
static const char *key() { return "network/currenttrafficserver"; }
//! \copydoc BlackCore::CSettingTrait::defaultValue
//! \copydoc BlackMisc::CSettingTrait::defaultValue
static const BlackMisc::Network::CServer &defaultValue()
{
using namespace BlackMisc::Network;
@@ -58,12 +58,12 @@ namespace BlackCore
};
//! DBus server address
struct DBusServerAddress : public CSettingTrait<QString>
struct DBusServerAddress : public BlackMisc::CSettingTrait<QString>
{
//! \copydoc BlackCore::CSettingTrait::key
//! \copydoc BlackMisc::CSettingTrait::key
static const char *key() { return "network/dbusserver"; }
//! \copydoc BlackCore::CSettingTrait::defaultValue
//! \copydoc BlackMisc::CSettingTrait::defaultValue
static const QString &defaultValue() { static const QString dv("session"); return dv; }
};
} // ns

View File

@@ -1,11 +0,0 @@
/* Copyright (C) 2013 VATSIM Community / contributors
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef BLACKCORE_SETTINGSALLCLASSES_H
#define BLACKCORE_SETTINGSALLCLASSES_H
#include "blackmisc/settingsblackmiscclasses.h"
#endif // guard

View File

@@ -70,8 +70,8 @@ namespace BlackCore
QNetworkAccessManager *m_networkManagerUpdateInfo = nullptr;
BlackMisc::LockFree<BlackMisc::Network::CFailoverUrlList> m_bootstrapUrls;
BlackMisc::LockFree<BlackMisc::Network::CFailoverUrlList> m_updateInfoUrls;
CData<BlackCore::Data::GlobalSetup> m_setup {this}; //!< data cache setup
CData<BlackCore::Data::UpdateInfo> m_updateInfo {this}; //!< data cache update info
BlackMisc::CData<BlackCore::Data::GlobalSetup> m_setup {this}; //!< data cache setup
BlackMisc::CData<BlackCore::Data::UpdateInfo> m_updateInfo {this}; //!< data cache update info
//! Constructor
explicit CSetupReader(QObject *owner);

View File

@@ -56,7 +56,7 @@ namespace BlackCore
void ps_read();
private:
BlackCore::CData<BlackCore::Data::GlobalSetup> m_setup {this}; //!< setup cache
BlackMisc::CData<BlackCore::Data::GlobalSetup> m_setup {this}; //!< setup cache
QNetworkAccessManager *m_networkManager = nullptr;
};
}

View File

@@ -130,7 +130,7 @@ namespace BlackCore
BlackMisc::Aviation::CAtcStationList m_atcStations;
BlackMisc::Simulation::CSimulatedAircraftList m_aircraft;
QMap<BlackMisc::Aviation::CCallsign, BlackMisc::Network::CVoiceCapabilities> m_voiceCapabilities;
BlackCore::CData<BlackCore::Data::GlobalSetup> m_setup {this}; //!< setup cache
BlackMisc::CData<BlackCore::Data::GlobalSetup> m_setup {this}; //!< setup cache
//! Split line and assign values to their corresponding attribute names
static const QMap<QString, QString> clientPartsToMap(const QString &currentLine, const QStringList &clientSectionAttributes);

View File

@@ -72,7 +72,7 @@ namespace BlackCore
QNetworkAccessManager *m_networkManager = nullptr;
BlackMisc::Weather::CMetarDecoder m_metarDecoder;
BlackMisc::Weather::CMetarSet m_metars;
BlackCore::CData<BlackCore::Data::GlobalSetup> m_setup {this}; //!< setup cache
BlackMisc::CData<BlackCore::Data::GlobalSetup> m_setup {this}; //!< setup cache
};
}
#endif // guard

View File

@@ -285,7 +285,7 @@ namespace BlackCore
CWebReaderFlags::WebReader m_readerFlags = CWebReaderFlags::WebReaderFlag::None; //!< which readers are available
int m_autoReadAfterSetupMs = -1; //!< directly read all known readers after setup was syncronized
bool m_initialRead = false; //!< Initial read conducted
BlackCore::CData<BlackCore::Data::GlobalSetup> m_setup {this, &CWebDataServices::ps_setupChanged}; //!< setup cache
BlackMisc::CData<BlackCore::Data::GlobalSetup> m_setup {this, &CWebDataServices::ps_setupChanged}; //!< setup cache
// for reading XML and VATSIM data files
CVatsimBookingReader *m_vatsimBookingReader = nullptr;