mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
refs #829, consolidated settings for simulator/messages
* move traits from blackcore to blackmisc * renamed CSimulatorSettings/Messages
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
#include "blackmisc/sampleutils.h"
|
||||
#include "blackmisc/simulation/fscommon/aircraftcfgentrieslist.h"
|
||||
#include "blackmisc/simulation/fscommon/aircraftcfgparser.h"
|
||||
#include "blackmisc/simulation/simulationsettings.h"
|
||||
#include "blackmisc/simulation/simulatorsettings.h"
|
||||
#include "blackmisc/simulation/simulatorinfo.h"
|
||||
|
||||
#include <QByteArray>
|
||||
@@ -41,8 +41,8 @@ namespace BlackSample
|
||||
|
||||
const CSimulatorInfo sim = fsDir.toLower().contains("simobjects") ? CSimulatorInfo::FSX : CSimulatorInfo::FS9;
|
||||
CMultiSimulatorSettings multiSettings;
|
||||
const CSettings originalSettings = multiSettings.getSettings(sim);
|
||||
CSettings newSettings(originalSettings);
|
||||
const CSimulatorSettings originalSettings = multiSettings.getSettings(sim);
|
||||
CSimulatorSettings newSettings(originalSettings);
|
||||
newSettings.setModelDirectory(fsDir);
|
||||
multiSettings.setSettings(newSettings, sim); // set, but do NOT(!) save
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "blackmisc/aviation/aircrafticaocode.h"
|
||||
#include "blackmisc/aviation/airlineicaocode.h"
|
||||
#include "blackmisc/sampleutils.h"
|
||||
#include "blackmisc/simulation/simulationsettings.h"
|
||||
#include "blackmisc/simulation/simulatorsettings.h"
|
||||
#include "blackmisc/simulation/aircraftmodellist.h"
|
||||
#include "blackmisc/simulation/aircraftmodelloader.h"
|
||||
#include "blackmisc/simulation/fscommon/aircraftcfgentrieslist.h"
|
||||
@@ -54,8 +54,8 @@ namespace BlackSample
|
||||
|
||||
const CSimulatorInfo sim = fsDir.toLower().contains("simobjects") ? CSimulatorInfo::FSX : CSimulatorInfo::FS9;
|
||||
CMultiSimulatorSettings multiSettings;
|
||||
const CSettings originalSettings = multiSettings.getSettings(sim);
|
||||
CSettings newSettings(originalSettings);
|
||||
const CSimulatorSettings originalSettings = multiSettings.getSettings(sim);
|
||||
CSimulatorSettings newSettings(originalSettings);
|
||||
newSettings.setModelDirectory(fsDir);
|
||||
multiSettings.setSettings(newSettings, sim); // set, but do NOT(!) save
|
||||
|
||||
|
||||
@@ -479,7 +479,7 @@ namespace BlackCore
|
||||
{
|
||||
if (!isSimulatorSimulating()) { return; }
|
||||
if (!this->getIContextOwnAircraft()) { return; }
|
||||
const CSettingsSimulatorMessages settings = m_messageSettings.getThreadLocal();
|
||||
const CSimulatorMessagesSettings settings = m_messageSettings.getThreadLocal();
|
||||
const CSimulatedAircraft ownAircraft = this->getIContextOwnAircraft()->getOwnAircraft();
|
||||
for (const auto &tm : textMessages)
|
||||
{
|
||||
@@ -526,7 +526,7 @@ namespace BlackCore
|
||||
void CContextSimulator::ps_relayStatusMessageToSimulator(const BlackMisc::CStatusMessage &message)
|
||||
{
|
||||
if (!isSimulatorSimulating()) { return; }
|
||||
const CSettingsSimulatorMessages simMsg = m_messageSettings.getThreadLocal();
|
||||
const CSimulatorMessagesSettings simMsg = m_messageSettings.getThreadLocal();
|
||||
if (simMsg.relayThisStatusMessage(message))
|
||||
{
|
||||
m_simulatorPlugin.second->displayStatusMessage(message);
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include "blackmisc/simulation/simulatorplugininfo.h"
|
||||
#include "blackmisc/simulation/simulatorplugininfolist.h"
|
||||
#include "blackmisc/simulation/simulatorinternals.h"
|
||||
#include "blackmisc/simulation/simulationsettings.h"
|
||||
#include "blackmisc/simulation/simulatorsettings.h"
|
||||
#include "blackmisc/worker.h"
|
||||
|
||||
#include <QObject>
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
/* 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 BLACKCORE_SIMULATOR_SETTINGS_H
|
||||
#define BLACKCORE_SIMULATOR_SETTINGS_H
|
||||
|
||||
#include "blackmisc/settingscache.h"
|
||||
#include "blackmisc/weather/weatherscenario.h"
|
||||
#include "blackmisc/simulation/distributorlistpreferences.h"
|
||||
|
||||
namespace BlackCore
|
||||
{
|
||||
namespace Simulator
|
||||
{
|
||||
//! Selected weather scenario
|
||||
struct TSelectedWeatherScenario : public BlackMisc::TSettingTrait<BlackMisc::Weather::CWeatherScenario>
|
||||
{
|
||||
//! \copydoc BlackCore::TSettingTrait::key
|
||||
static const char *key() { return "simulator/selectedweatherscenario"; }
|
||||
|
||||
//! \copydoc BlackCore::TSettingTrait::defaultValue
|
||||
static const BlackMisc::Weather::CWeatherScenario &defaultValue()
|
||||
{
|
||||
static const BlackMisc::Weather::CWeatherScenario scenario {};
|
||||
return scenario;
|
||||
}
|
||||
};
|
||||
|
||||
//! Mapping preferences for model distributor list
|
||||
struct TDistributorListPreferences : public BlackMisc::TSettingTrait<BlackMisc::Simulation::CDistributorListPreferences>
|
||||
{
|
||||
//! \copydoc BlackMisc::TSettingTrait::key
|
||||
static const char *key() { return "mapping/distributorpreferences"; }
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
#endif
|
||||
@@ -12,21 +12,20 @@
|
||||
#ifndef BLACKGUI_COMPONENTS_DBMAPPINGCOMPONENT_H
|
||||
#define BLACKGUI_COMPONENTS_DBMAPPINGCOMPONENT_H
|
||||
|
||||
#include "blackcore/data/authenticateduser.h"
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackgui/components/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/enableforviewbasedindicator.h"
|
||||
#include "blackgui/menus/menudelegate.h"
|
||||
#include "blackgui/overlaymessagesframe.h"
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackcore/data/authenticateduser.h"
|
||||
#include "blackmisc/aviation/airlineicaocode.h"
|
||||
#include "blackmisc/datacache.h"
|
||||
#include "blackmisc/digestsignal.h"
|
||||
#include "blackmisc/network/entityflags.h"
|
||||
#include "blackmisc/simulation/aircraftmodel.h"
|
||||
#include "blackmisc/simulation/aircraftmodellist.h"
|
||||
#include "blackmisc/simulation/distributor.h"
|
||||
#include "blackmisc/simulation/fscommon/vpilotrulesreader.h"
|
||||
#include "blackmisc/simulation/simulatorinfo.h"
|
||||
#include "blackmisc/datacache.h"
|
||||
#include "blackmisc/digestsignal.h"
|
||||
#include "blackmisc/statusmessage.h"
|
||||
#include "blackmisc/statusmessagelist.h"
|
||||
|
||||
@@ -307,8 +306,8 @@ namespace BlackGui
|
||||
QScopedPointer<CDbAutoSimulatorStashingComponent> m_autoSimulatorDialog; //!< dialog auto simulator update
|
||||
QScopedPointer<CDbModelMappingModifyComponent> m_modelModifyDialog; //!< dialog when modifying models
|
||||
BlackMisc::Simulation::FsCommon::CVPilotRulesReader m_vPilotReader; //!< read vPilot rules
|
||||
BlackMisc::CData<BlackCore::Data::TAuthenticatedDbUser> m_swiftDbUser { this };
|
||||
BlackMisc::CDigestSignal m_dsStashedModelsChanged { this, &CDbMappingComponent::ps_digestStashedModelsChanged, &CDbMappingComponent::ps_onStashedModelsChangedDigest, 750, 25 };
|
||||
BlackMisc::CData<BlackCore::Data::TAuthenticatedDbUser> m_swiftDbUser { this };
|
||||
const bool vPilotSupport = true; //!< vPilot support
|
||||
bool m_vPilot1stInit = true; //!< vPilot extensions initaliazed?
|
||||
bool m_vPilotEnabled = false; //!< use vPilot extensions
|
||||
|
||||
@@ -12,10 +12,9 @@
|
||||
#ifndef BLACKGUI_COMPONENTS_DBOWNMODELSETCOMPONENT_H
|
||||
#define BLACKGUI_COMPONENTS_DBOWNMODELSETCOMPONENT_H
|
||||
|
||||
#include "blackcore/simulator/simulatorsettings.h"
|
||||
#include "blackgui/components/dbmappingcomponentaware.h"
|
||||
#include "blackgui/menus/menudelegate.h"
|
||||
#include "blackmisc/settingscache.h"
|
||||
#include "blackmisc/simulation/modelsettings.h"
|
||||
#include "blackmisc/simulation/aircraftmodelinterfaces.h"
|
||||
#include "blackmisc/simulation/aircraftmodellist.h"
|
||||
#include "blackmisc/simulation/aircraftmodelsetloader.h"
|
||||
@@ -145,7 +144,7 @@ namespace BlackGui
|
||||
QScopedPointer<Ui::CDbOwnModelSetComponent> ui;
|
||||
QScopedPointer<CDbOwnModelSetDialog> m_modelSetDialog;
|
||||
BlackMisc::Simulation::CAircraftModelSetLoader m_modelSetLoader { this };
|
||||
BlackMisc::CSetting<BlackCore::Simulator::TDistributorListPreferences> m_distributorPreferences { this, &CDbOwnModelSetComponent::ps_distributorPreferencesChanged };
|
||||
BlackMisc::CSetting<BlackMisc::Simulation::TDistributorListPreferences> m_distributorPreferences { this, &CDbOwnModelSetComponent::ps_distributorPreferencesChanged };
|
||||
|
||||
// -------------------------- custom menus -----------------------------------
|
||||
|
||||
|
||||
@@ -12,10 +12,9 @@
|
||||
#ifndef BLACKGUI_COMPONENTS_DISTRIBUTORPREFERENCESCOMPONENT_H
|
||||
#define BLACKGUI_COMPONENTS_DISTRIBUTORPREFERENCESCOMPONENT_H
|
||||
|
||||
#include "blackcore/simulator/simulatorsettings.h"
|
||||
#include "blackmisc/settingscache.h"
|
||||
#include "blackmisc/simulation/aircraftmodelsetloader.h"
|
||||
#include "blackmisc/simulation/distributorlist.h"
|
||||
#include "blackmisc/simulation/modelsettings.h"
|
||||
#include "blackmisc/simulation/simulatorinfo.h"
|
||||
|
||||
#include <QFrame>
|
||||
@@ -25,7 +24,6 @@
|
||||
class QWidget;
|
||||
|
||||
namespace Ui { class CDistributorPreferencesComponent; }
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
class COverlayMessagesFrame;
|
||||
@@ -72,7 +70,7 @@ namespace BlackGui
|
||||
QScopedPointer<Ui::CDistributorPreferencesComponent> ui;
|
||||
BlackGui::COverlayMessagesFrame *m_overlayMessageFrame = nullptr;
|
||||
BlackMisc::Simulation::CAircraftModelSetLoader m_modelSetLoader { this };
|
||||
BlackMisc::CSetting<BlackCore::Simulator::TDistributorListPreferences> m_distributorPreferences { this, &CDistributorPreferencesComponent::ps_preferencesChanged };
|
||||
BlackMisc::CSetting<BlackMisc::Simulation::TDistributorListPreferences> m_distributorPreferences { this, &CDistributorPreferencesComponent::ps_preferencesChanged };
|
||||
|
||||
//! Update
|
||||
void updateContainerMaybeAsync(const BlackMisc::Simulation::CDistributorList &models, bool sortByOrder = true);
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace BlackGui
|
||||
explicit CSettingsGuiComponent(QWidget *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
~CSettingsGuiComponent();
|
||||
virtual ~CSettingsGuiComponent();
|
||||
|
||||
//! Hide opacity elements
|
||||
void hideOpacity(bool hide);
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace BlackGui
|
||||
void CSettingsSimulatorBasicsComponent::ps_save()
|
||||
{
|
||||
const CSimulatorInfo simulator(ui->comp_SimulatorSelector->getValue());
|
||||
CSettings s = this->getSettings(simulator);
|
||||
CSimulatorSettings s = this->getSettings(simulator);
|
||||
const QString sd(ui->le_SimulatorDirectory->text().trimmed());
|
||||
const QStringList md(this->parseDirectories(ui->pte_ModelDirectories->toPlainText()));
|
||||
const QStringList ed(this->parseDirectories(ui->pte_ExcludeDirectories->toPlainText()));
|
||||
@@ -193,15 +193,15 @@ namespace BlackGui
|
||||
ui->pte_ModelDirectories->setPlainText(d);
|
||||
}
|
||||
|
||||
CSettings CSettingsSimulatorBasicsComponent::getSettings(const CSimulatorInfo &simulator) const
|
||||
CSimulatorSettings CSettingsSimulatorBasicsComponent::getSettings(const CSimulatorInfo &simulator) const
|
||||
{
|
||||
const CSettings s = this->m_settings.getSettings(simulator);
|
||||
const CSimulatorSettings s = this->m_settings.getSettings(simulator);
|
||||
return s;
|
||||
}
|
||||
|
||||
void CSettingsSimulatorBasicsComponent::displaySettings(const CSimulatorInfo &simulator)
|
||||
{
|
||||
const CSettings s = this->getSettings(simulator);
|
||||
const CSimulatorSettings s = this->getSettings(simulator);
|
||||
this->displayExcludeDirectoryPatterns(s.getModelExcludeDirectoryPatterns());
|
||||
this->displayModelDirectories(s.getModelDirectories());
|
||||
ui->le_SimulatorDirectory->setText(s.getSimulatorDirectory());
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#ifndef BLACKGUI_COMPONENTS_SETTINGSSIMULATORBASICSCOMPONENT_H
|
||||
#define BLACKGUI_COMPONENTS_SETTINGSSIMULATORBASICSCOMPONENT_H
|
||||
|
||||
#include "blackmisc/simulation/simulationsettings.h"
|
||||
#include "blackmisc/simulation/simulatorsettings.h"
|
||||
#include <QFrame>
|
||||
#include <QFileDialog>
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace BlackGui
|
||||
void displayModelDirectories(const QStringList &dirs);
|
||||
|
||||
//! Current settings
|
||||
BlackMisc::Simulation::CSettings getSettings(const BlackMisc::Simulation::CSimulatorInfo &simulator) const;
|
||||
BlackMisc::Simulation::CSimulatorSettings getSettings(const BlackMisc::Simulation::CSimulatorInfo &simulator) const;
|
||||
|
||||
//! Display simulator`s settings
|
||||
void displaySettings(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "settingssimulatormessagescomponent.h"
|
||||
#include "ui_settingssimulatormessagescomponent.h"
|
||||
#include "blackmisc/simulation/simulationsettings.h"
|
||||
#include "blackmisc/simulation/simulatorsettings.h"
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Simulation;
|
||||
@@ -34,7 +34,7 @@ namespace BlackGui
|
||||
|
||||
void CSettingsSimulatorMessagesComponent::ps_save()
|
||||
{
|
||||
CSettingsSimulatorMessages settings;
|
||||
CSimulatorMessagesSettings settings;
|
||||
settings.setGloballyEnabled(ui->cb_Messages->isChecked());
|
||||
if (ui->rb_NoTechnicalMessages->isChecked())
|
||||
{
|
||||
@@ -53,11 +53,11 @@ namespace BlackGui
|
||||
settings.setTechnicalLogSeverity(CStatusMessage::SeverityInfo);
|
||||
}
|
||||
|
||||
CSettingsSimulatorMessages::TextMessageType mt = CSettingsSimulatorMessages::NoTextMessages;
|
||||
if (ui->cb_PrivateMessages->isChecked()) { mt |= CSettingsSimulatorMessages::TextMessagePrivate; }
|
||||
if (ui->cb_SupervisorMessages->isChecked()) { mt |= CSettingsSimulatorMessages::TextMessageSupervisor; }
|
||||
if (ui->cb_Com1->isChecked()) { mt |= CSettingsSimulatorMessages::TextMessagesCom1; }
|
||||
if (ui->cb_Com2->isChecked()) { mt |= CSettingsSimulatorMessages::TextMessagesCom2; };
|
||||
CSimulatorMessagesSettings::TextMessageType mt = CSimulatorMessagesSettings::NoTextMessages;
|
||||
if (ui->cb_PrivateMessages->isChecked()) { mt |= CSimulatorMessagesSettings::TextMessagePrivate; }
|
||||
if (ui->cb_SupervisorMessages->isChecked()) { mt |= CSimulatorMessagesSettings::TextMessageSupervisor; }
|
||||
if (ui->cb_Com1->isChecked()) { mt |= CSimulatorMessagesSettings::TextMessagesCom1; }
|
||||
if (ui->cb_Com2->isChecked()) { mt |= CSimulatorMessagesSettings::TextMessagesCom2; };
|
||||
settings.setRelayedTextMessages(mt);
|
||||
|
||||
// save
|
||||
@@ -66,7 +66,7 @@ namespace BlackGui
|
||||
|
||||
void CSettingsSimulatorMessagesComponent::ps_load()
|
||||
{
|
||||
const CSettingsSimulatorMessages settings(this->m_settings.get());
|
||||
const CSimulatorMessagesSettings settings(this->m_settings.get());
|
||||
ui->cb_Messages->setChecked(settings.isGloballyEnabled());
|
||||
if (settings.isRelayedInfoMessages())
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#ifndef BLACKGUI_COMPONENTS_SETTINGSSIMULATORMESSAGESCOMPONENT_H
|
||||
#define BLACKGUI_COMPONENTS_SETTINGSSIMULATORMESSAGESCOMPONENT_H
|
||||
|
||||
#include "blackmisc/simulation/simulationsettings.h"
|
||||
#include "blackmisc/simulation/simulatorsettings.h"
|
||||
#include <QFrame>
|
||||
#include <QScopedPointer>
|
||||
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackgui/components/enablefordockwidgetinfoarea.h"
|
||||
#include "blackcore/simulator/simulatorsettings.h"
|
||||
#include "blackmisc/geo/coordinategeodetic.h"
|
||||
#include "blackmisc/identifiable.h"
|
||||
#include "blackmisc/simulation/simulatorsettings.h"
|
||||
#include "blackmisc/weather/weatherscenario.h"
|
||||
#include "blackmisc/identifiable.h"
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QModelIndex>
|
||||
@@ -34,7 +34,6 @@ namespace Ui { class CWeatherComponent; }
|
||||
namespace BlackGui
|
||||
{
|
||||
class CDockWidgetInfoArea;
|
||||
|
||||
namespace Components
|
||||
{
|
||||
//! Weather component
|
||||
@@ -76,7 +75,7 @@ namespace BlackGui
|
||||
QVector<BlackMisc::Weather::CWeatherScenario> m_weatherScenarios;
|
||||
QTimer m_weatherUpdateTimer { this };
|
||||
BlackMisc::Geo::CCoordinateGeodetic m_lastOwnAircraftPosition;
|
||||
BlackMisc::CSetting<BlackCore::Simulator::TSelectedWeatherScenario> m_weatherScenarioSetting { this };
|
||||
BlackMisc::CSetting<BlackMisc::Simulation::TSelectedWeatherScenario> m_weatherScenarioSetting { this };
|
||||
};
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -13,9 +13,7 @@
|
||||
#define BLACKGUI_EDITORS_OWNMODELSETFORM_H
|
||||
|
||||
#include "form.h"
|
||||
#include "blackcore/simulator/simulatorsettings.h"
|
||||
#include "blackmisc/simulation/distributorlist.h"
|
||||
|
||||
#include "blackmisc/simulation/modelsettings.h"
|
||||
#include <QObject>
|
||||
#include <QScopedPointer>
|
||||
|
||||
@@ -111,7 +109,7 @@ namespace BlackGui
|
||||
|
||||
QScopedPointer<Ui::COwnModelSetForm> ui;
|
||||
BlackMisc::Simulation::CSimulatorInfo m_simulator;
|
||||
BlackMisc::CSetting<BlackCore::Simulator::TDistributorListPreferences> m_distributorPreferences { this, &COwnModelSetForm::ps_preferencesChanged };
|
||||
BlackMisc::CSetting<BlackMisc::Simulation::TDistributorListPreferences> m_distributorPreferences { this, &COwnModelSetForm::ps_preferencesChanged };
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include "blackmisc/simulation/aircraftmodelinterfaces.h"
|
||||
#include "blackmisc/simulation/aircraftmodellist.h"
|
||||
#include "blackmisc/simulation/data/modelcaches.h"
|
||||
#include "blackmisc/simulation/simulationsettings.h"
|
||||
#include "blackmisc/simulation/simulatorsettings.h"
|
||||
#include "blackmisc/simulation/simulatorinfo.h"
|
||||
#include "blackmisc/statusmessage.h"
|
||||
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
|
||||
#include "registermetadatasimulation.h"
|
||||
#include "simulation.h"
|
||||
#include "blackmisc/simulation/simulationsettings.h"
|
||||
#include "blackmisc/simulation/simulatorsettings.h"
|
||||
#include "blackmisc/simulation/modelsettings.h"
|
||||
#include "blackmisc/valueobject.h"
|
||||
#include "blackmisc/variant.h"
|
||||
|
||||
@@ -41,8 +42,8 @@ namespace BlackMisc
|
||||
CSimulatorInternals::registerMetadata();
|
||||
CVPilotModelRule::registerMetadata();
|
||||
CVPilotModelRuleSet::registerMetadata();
|
||||
CSettings::registerMetadata();
|
||||
CSettingsSimulatorMessages::registerMetadata();
|
||||
CSimulatorSettings::registerMetadata();
|
||||
CSimulatorMessagesSettings::registerMetadata();
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "simulationsettings.h"
|
||||
#include "simulatorsettings.h"
|
||||
#include "blackmisc/simulation/simulatedaircraft.h"
|
||||
#include "blackmisc/simulation/fscommon/fscommonutil.h"
|
||||
#include "blackmisc/simulation/xplane/xplaneutil.h"
|
||||
@@ -22,57 +22,57 @@ namespace BlackMisc
|
||||
{
|
||||
namespace Simulation
|
||||
{
|
||||
CSettings::CSettings()
|
||||
CSimulatorSettings::CSimulatorSettings()
|
||||
{ }
|
||||
|
||||
void CSettings::setSimulatorDirectory(const QString &simulatorDirectory)
|
||||
void CSimulatorSettings::setSimulatorDirectory(const QString &simulatorDirectory)
|
||||
{
|
||||
this->m_simulatorDirectory = simulatorDirectory.trimmed();
|
||||
}
|
||||
|
||||
const QString &CSettings::getSimulatorDirectory() const
|
||||
const QString &CSimulatorSettings::getSimulatorDirectory() const
|
||||
{
|
||||
return this->m_simulatorDirectory;
|
||||
}
|
||||
|
||||
void CSettings::setModelDirectories(const QStringList &modelDirectories)
|
||||
void CSimulatorSettings::setModelDirectories(const QStringList &modelDirectories)
|
||||
{
|
||||
this->m_modelDirectories = modelDirectories;
|
||||
}
|
||||
|
||||
void CSettings::setModelDirectory(const QString &modelDirectory)
|
||||
void CSimulatorSettings::setModelDirectory(const QString &modelDirectory)
|
||||
{
|
||||
this->m_modelDirectories = QStringList({ modelDirectory });
|
||||
}
|
||||
|
||||
const QStringList &CSettings::getModelDirectories() const
|
||||
const QStringList &CSimulatorSettings::getModelDirectories() const
|
||||
{
|
||||
return this->m_modelDirectories;
|
||||
}
|
||||
|
||||
void CSettings::setModelExcludeDirectories(const QStringList &excludeDirectories)
|
||||
void CSimulatorSettings::setModelExcludeDirectories(const QStringList &excludeDirectories)
|
||||
{
|
||||
this->m_excludeDirectoryPatterns = excludeDirectories;
|
||||
}
|
||||
|
||||
const QStringList &CSettings::getModelExcludeDirectoryPatterns() const
|
||||
const QStringList &CSimulatorSettings::getModelExcludeDirectoryPatterns() const
|
||||
{
|
||||
return m_excludeDirectoryPatterns;
|
||||
}
|
||||
|
||||
void CSettings::resetPaths()
|
||||
void CSimulatorSettings::resetPaths()
|
||||
{
|
||||
this->m_excludeDirectoryPatterns.clear();
|
||||
this->m_modelDirectories.clear();
|
||||
this->m_simulatorDirectory.clear();
|
||||
}
|
||||
|
||||
QString CSettings::convertToQString(bool i18n) const
|
||||
QString CSimulatorSettings::convertToQString(bool i18n) const
|
||||
{
|
||||
return convertToQString(", ", i18n);
|
||||
}
|
||||
|
||||
QString CSettings::convertToQString(const QString &separator, bool i18n) const
|
||||
QString CSimulatorSettings::convertToQString(const QString &separator, bool i18n) const
|
||||
{
|
||||
Q_UNUSED(i18n);
|
||||
QString s("model directories: ");
|
||||
@@ -83,10 +83,10 @@ namespace BlackMisc
|
||||
return s;
|
||||
}
|
||||
|
||||
CVariant CSettings::propertyByIndex(const CPropertyIndex &index) const
|
||||
CVariant CSimulatorSettings::propertyByIndex(const CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexSimulatorDirectory:
|
||||
@@ -100,11 +100,10 @@ namespace BlackMisc
|
||||
}
|
||||
}
|
||||
|
||||
void CSettings::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
|
||||
void CSimulatorSettings::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
|
||||
{
|
||||
if (index.isMyself()) { (*this) = variant.to<CSettings>(); return; }
|
||||
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
if (index.isMyself()) { (*this) = variant.to<CSimulatorSettings>(); return; }
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexSimulatorDirectory:
|
||||
@@ -127,7 +126,7 @@ namespace BlackMisc
|
||||
// void
|
||||
}
|
||||
|
||||
CSettings CMultiSimulatorSettings::getSettings(const CSimulatorInfo &simulator) const
|
||||
CSimulatorSettings CMultiSimulatorSettings::getSettings(const CSimulatorInfo &simulator) const
|
||||
{
|
||||
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "No single simulator");
|
||||
switch (simulator.getSimulator())
|
||||
@@ -140,10 +139,10 @@ namespace BlackMisc
|
||||
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "No single simulator");
|
||||
break;
|
||||
}
|
||||
return CSettings();
|
||||
return CSimulatorSettings();
|
||||
}
|
||||
|
||||
CStatusMessage CMultiSimulatorSettings::setSettings(const CSettings &settings, const CSimulatorInfo &simulator)
|
||||
CStatusMessage CMultiSimulatorSettings::setSettings(const CSimulatorSettings &settings, const CSimulatorInfo &simulator)
|
||||
{
|
||||
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "No single simulator");
|
||||
switch (simulator.getSimulator())
|
||||
@@ -159,7 +158,7 @@ namespace BlackMisc
|
||||
return CStatusMessage({ CLogCategory::settings() }, CStatusMessage::SeverityError, "wrong simulator");
|
||||
}
|
||||
|
||||
CStatusMessage CMultiSimulatorSettings::setAndSaveSettings(const CSettings &settings, const CSimulatorInfo &simulator)
|
||||
CStatusMessage CMultiSimulatorSettings::setAndSaveSettings(const CSimulatorSettings &settings, const CSimulatorInfo &simulator)
|
||||
{
|
||||
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "No single simulator");
|
||||
switch (simulator.getSimulator())
|
||||
@@ -193,7 +192,7 @@ namespace BlackMisc
|
||||
|
||||
QString CMultiSimulatorSettings::getSimulatorDirectoryOrDefault(const CSimulatorInfo &simulator) const
|
||||
{
|
||||
const CSettings s = this->getSettings(simulator);
|
||||
const CSimulatorSettings s = this->getSettings(simulator);
|
||||
if (s.getSimulatorDirectory().isEmpty())
|
||||
{
|
||||
return this->getDefaultSimulatorDirectory(simulator);
|
||||
@@ -219,7 +218,7 @@ namespace BlackMisc
|
||||
|
||||
QStringList CMultiSimulatorSettings::getModelDirectoriesOrDefault(const CSimulatorInfo &simulator) const
|
||||
{
|
||||
const CSettings s = this->getSettings(simulator);
|
||||
const CSimulatorSettings s = this->getSettings(simulator);
|
||||
if (s.getModelDirectories().isEmpty())
|
||||
{
|
||||
return this->getDefaultModelDirectories(simulator);
|
||||
@@ -253,7 +252,7 @@ namespace BlackMisc
|
||||
|
||||
QStringList CMultiSimulatorSettings::getModelExcludeDirectoryPatternsOrDefault(const CSimulatorInfo &simulator) const
|
||||
{
|
||||
const CSettings s = this->getSettings(simulator);
|
||||
const CSimulatorSettings s = this->getSettings(simulator);
|
||||
QStringList exclude(s.getModelExcludeDirectoryPatterns());
|
||||
if (!exclude.isEmpty()) { return exclude; }
|
||||
exclude = this->getDefaultModelExcludeDirectoryPatterns(simulator);
|
||||
@@ -278,80 +277,80 @@ namespace BlackMisc
|
||||
|
||||
void CMultiSimulatorSettings::resetToDefaults(const CSimulatorInfo &simulator)
|
||||
{
|
||||
CSettings s = this->getSettings(simulator);
|
||||
CSimulatorSettings s = this->getSettings(simulator);
|
||||
s.resetPaths();
|
||||
this->setAndSaveSettings(s, simulator);
|
||||
}
|
||||
|
||||
CSettingsSimulatorMessages::CSettingsSimulatorMessages()
|
||||
CSimulatorMessagesSettings::CSimulatorMessagesSettings()
|
||||
{
|
||||
// void
|
||||
}
|
||||
|
||||
void CSettingsSimulatorMessages::setTechnicalLogSeverity(CStatusMessage::StatusSeverity severity)
|
||||
void CSimulatorMessagesSettings::setTechnicalLogSeverity(CStatusMessage::StatusSeverity severity)
|
||||
{
|
||||
this->m_technicalLogLevel = static_cast<int>(severity);
|
||||
}
|
||||
|
||||
void CSettingsSimulatorMessages::disableTechnicalMessages()
|
||||
void CSimulatorMessagesSettings::disableTechnicalMessages()
|
||||
{
|
||||
this->m_technicalLogLevel = -1;
|
||||
}
|
||||
|
||||
bool CSettingsSimulatorMessages::isRelayedErrorsMessages() const
|
||||
bool CSimulatorMessagesSettings::isRelayedErrorsMessages() const
|
||||
{
|
||||
if (this->m_technicalLogLevel < 0) { return false; }
|
||||
return (this->m_technicalLogLevel <= CStatusMessage::SeverityError);
|
||||
}
|
||||
|
||||
bool CSettingsSimulatorMessages::isRelayedWarningMessages() const
|
||||
bool CSimulatorMessagesSettings::isRelayedWarningMessages() const
|
||||
{
|
||||
if (this->m_technicalLogLevel < 0) { return false; }
|
||||
return (this->m_technicalLogLevel <= CStatusMessage::SeverityWarning);
|
||||
}
|
||||
|
||||
bool CSettingsSimulatorMessages::isRelayedInfoMessages() const
|
||||
bool CSimulatorMessagesSettings::isRelayedInfoMessages() const
|
||||
{
|
||||
if (this->m_technicalLogLevel < 0) { return false; }
|
||||
return (this->m_technicalLogLevel <= CStatusMessage::SeverityInfo);
|
||||
}
|
||||
|
||||
bool CSettingsSimulatorMessages::isRelayedTechnicalMessages() const
|
||||
bool CSimulatorMessagesSettings::isRelayedTechnicalMessages() const
|
||||
{
|
||||
return (this->m_technicalLogLevel >= 0);
|
||||
}
|
||||
|
||||
void CSettingsSimulatorMessages::setRelayedTextMessages(CSettingsSimulatorMessages::TextMessageType messageType)
|
||||
void CSimulatorMessagesSettings::setRelayedTextMessages(CSimulatorMessagesSettings::TextMessageType messageType)
|
||||
{
|
||||
this->m_messageType = static_cast<int>(messageType);
|
||||
}
|
||||
|
||||
bool CSettingsSimulatorMessages::isRelayedSupervisorTextMessages() const
|
||||
bool CSimulatorMessagesSettings::isRelayedSupervisorTextMessages() const
|
||||
{
|
||||
return this->getRelayedTextMessageTypes().testFlag(TextMessageSupervisor);
|
||||
}
|
||||
|
||||
bool CSettingsSimulatorMessages::isRelayedPrivateTextMessages() const
|
||||
bool CSimulatorMessagesSettings::isRelayedPrivateTextMessages() const
|
||||
{
|
||||
return this->getRelayedTextMessageTypes().testFlag(TextMessagePrivate);
|
||||
}
|
||||
|
||||
bool CSettingsSimulatorMessages::isRelayedUnicomTextMessages() const
|
||||
bool CSimulatorMessagesSettings::isRelayedUnicomTextMessages() const
|
||||
{
|
||||
return this->getRelayedTextMessageTypes().testFlag(TextMessagesUnicom);
|
||||
}
|
||||
|
||||
bool CSettingsSimulatorMessages::isRelayedCom1TextMessages() const
|
||||
bool CSimulatorMessagesSettings::isRelayedCom1TextMessages() const
|
||||
{
|
||||
return this->getRelayedTextMessageTypes().testFlag(TextMessagesCom1);
|
||||
}
|
||||
|
||||
bool CSettingsSimulatorMessages::isRelayedCom2TextMessages() const
|
||||
bool CSimulatorMessagesSettings::isRelayedCom2TextMessages() const
|
||||
{
|
||||
return this->getRelayedTextMessageTypes().testFlag(TextMessagesCom2);
|
||||
}
|
||||
|
||||
bool CSettingsSimulatorMessages::relayThisStatusMessage(const CStatusMessage &message) const
|
||||
bool CSimulatorMessagesSettings::relayThisStatusMessage(const CStatusMessage &message) const
|
||||
{
|
||||
if (message.isEmpty()) { return false; }
|
||||
if (!this->isGloballyEnabled()) { return false; }
|
||||
@@ -360,7 +359,7 @@ namespace BlackMisc
|
||||
return (s >= this->m_technicalLogLevel);
|
||||
}
|
||||
|
||||
bool CSettingsSimulatorMessages::relayThisTextMessage(const Network::CTextMessage &msg, const BlackMisc::Simulation::CSimulatedAircraft &aircraft) const
|
||||
bool CSimulatorMessagesSettings::relayThisTextMessage(const Network::CTextMessage &msg, const BlackMisc::Simulation::CSimulatedAircraft &aircraft) const
|
||||
{
|
||||
if (msg.isEmpty()) { return false; }
|
||||
if (!this->isGloballyEnabled()) { return false; }
|
||||
@@ -386,12 +385,12 @@ namespace BlackMisc
|
||||
return false;
|
||||
}
|
||||
|
||||
CSettingsSimulatorMessages::TextMessageType CSettingsSimulatorMessages::getRelayedTextMessageTypes() const
|
||||
CSimulatorMessagesSettings::TextMessageType CSimulatorMessagesSettings::getRelayedTextMessageTypes() const
|
||||
{
|
||||
return static_cast<CSettingsSimulatorMessages::TextMessageType>(this->m_messageType);
|
||||
return static_cast<CSimulatorMessagesSettings::TextMessageType>(this->m_messageType);
|
||||
}
|
||||
|
||||
QString CSettingsSimulatorMessages::convertToQString(bool i18n) const
|
||||
QString CSimulatorMessagesSettings::convertToQString(bool i18n) const
|
||||
{
|
||||
Q_UNUSED(i18n);
|
||||
QString s("Enabled %1, text messages: %2, severity: %3");
|
||||
@@ -407,7 +406,7 @@ namespace BlackMisc
|
||||
return s.arg(boolToOnOff(this->m_globallyEnabled)).arg(this->m_messageType).arg(severity);
|
||||
}
|
||||
|
||||
CVariant CSettingsSimulatorMessages::propertyByIndex(const CPropertyIndex &index) const
|
||||
CVariant CSimulatorMessagesSettings::propertyByIndex(const CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
@@ -424,9 +423,9 @@ namespace BlackMisc
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingsSimulatorMessages::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
|
||||
void CSimulatorMessagesSettings::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
|
||||
{
|
||||
if (index.isMyself()) { (*this) = variant.to<CSettingsSimulatorMessages>(); return; }
|
||||
if (index.isMyself()) { (*this) = variant.to<CSimulatorMessagesSettings>(); return; }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
@@ -434,7 +433,7 @@ namespace BlackMisc
|
||||
this->setTechnicalLogSeverity(static_cast<CStatusMessage::StatusSeverity>(variant.toInt()));
|
||||
break;
|
||||
case IndexTextMessageRelay:
|
||||
this->setRelayedTextMessages(static_cast<CSettingsSimulatorMessages::TextMessageType>(variant.toInt()));
|
||||
this->setRelayedTextMessages(static_cast<CSimulatorMessagesSettings::TextMessageType>(variant.toInt()));
|
||||
break;
|
||||
case IndexGloballyEnabled:
|
||||
this->setGloballyEnabled(variant.toBool());
|
||||
@@ -9,11 +9,12 @@
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKMISC_SIMULATION_SETTINGS_H
|
||||
#define BLACKMISC_SIMULATION_SETTINGS_H
|
||||
#ifndef BLACKMISC_SIMULATION_SIMULATORSETTINGS_H
|
||||
#define BLACKMISC_SIMULATION_SIMULATORSETTINGS_H
|
||||
|
||||
#include "blackmisc/simulation/simulatorinfo.h"
|
||||
#include "blackmisc/network/textmessage.h"
|
||||
#include "blackmisc/weather/weatherscenario.h"
|
||||
#include "blackmisc/settingscache.h"
|
||||
#include "blackmisc/statusmessage.h"
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
@@ -30,8 +31,8 @@ namespace BlackMisc
|
||||
|
||||
//! Settings for simulator
|
||||
//! Driver independent part also used in loaders (such as directories)
|
||||
class BLACKMISC_EXPORT CSettings :
|
||||
public BlackMisc::CValueObject<CSettings>
|
||||
class BLACKMISC_EXPORT CSimulatorSettings :
|
||||
public BlackMisc::CValueObject<CSimulatorSettings>
|
||||
{
|
||||
public:
|
||||
//! Properties by index
|
||||
@@ -43,7 +44,7 @@ namespace BlackMisc
|
||||
};
|
||||
|
||||
//! Default constructor
|
||||
CSettings();
|
||||
CSimulatorSettings();
|
||||
|
||||
//! Set simulator directory
|
||||
void setSimulatorDirectory(const QString &simulatorDirectory);
|
||||
@@ -82,12 +83,12 @@ namespace BlackMisc
|
||||
void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const BlackMisc::CVariant &variant);
|
||||
|
||||
private:
|
||||
QString m_simulatorDirectory; //! Simulator directory
|
||||
QStringList m_modelDirectories; //!< Model directory
|
||||
QStringList m_excludeDirectoryPatterns; //!< Exclude model directory
|
||||
QString m_simulatorDirectory; //! Simulator directory
|
||||
QStringList m_modelDirectories; //!< Model directory
|
||||
QStringList m_excludeDirectoryPatterns; //!< Exclude model directory
|
||||
|
||||
BLACK_METACLASS(
|
||||
CSettings,
|
||||
CSimulatorSettings,
|
||||
BLACK_METAMEMBER(simulatorDirectory),
|
||||
BLACK_METAMEMBER(modelDirectories),
|
||||
BLACK_METAMEMBER(excludeDirectoryPatterns)
|
||||
@@ -95,28 +96,28 @@ namespace BlackMisc
|
||||
};
|
||||
|
||||
//! Trait for simulator settings
|
||||
struct TSimulatorFsx : public BlackMisc::TSettingTrait<CSettings>
|
||||
struct TSimulatorFsx : public BlackMisc::TSettingTrait<CSimulatorSettings>
|
||||
{
|
||||
//! Key in data cache
|
||||
static const char *key() { return "settingssimulatorfsx"; }
|
||||
};
|
||||
|
||||
//! Trait for simulator settings
|
||||
struct TSimulatorFs9 : public BlackMisc::TSettingTrait<CSettings>
|
||||
struct TSimulatorFs9 : public BlackMisc::TSettingTrait<CSimulatorSettings>
|
||||
{
|
||||
//! Key in data cache
|
||||
static const char *key() { return "settingssimulatorfs9"; }
|
||||
};
|
||||
|
||||
//! Trait for simulator settings
|
||||
struct TSimulatorP3D : public BlackMisc::TSettingTrait<CSettings>
|
||||
struct TSimulatorP3D : public BlackMisc::TSettingTrait<CSimulatorSettings>
|
||||
{
|
||||
//! Key in data cache
|
||||
static const char *key() { return "settingssimulatorp3d"; }
|
||||
};
|
||||
|
||||
//! Trait for simulator settings
|
||||
struct TSimulatorXP : public BlackMisc::TSettingTrait<CSettings>
|
||||
struct TSimulatorXP : public BlackMisc::TSettingTrait<CSimulatorSettings>
|
||||
{
|
||||
//! Key in data cache
|
||||
static const char *key() { return "settingssimulatorxplane"; }
|
||||
@@ -132,13 +133,13 @@ namespace BlackMisc
|
||||
CMultiSimulatorSettings(QObject *parent = nullptr);
|
||||
|
||||
//! Settings per simulator
|
||||
CSettings getSettings(const BlackMisc::Simulation::CSimulatorInfo &simulator) const;
|
||||
CSimulatorSettings getSettings(const BlackMisc::Simulation::CSimulatorInfo &simulator) const;
|
||||
|
||||
//! Set settings per simulator
|
||||
BlackMisc::CStatusMessage setSettings(const BlackMisc::Simulation::CSettings &settings, const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||
BlackMisc::CStatusMessage setSettings(const BlackMisc::Simulation::CSimulatorSettings &settings, const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||
|
||||
//! Set settings per simulator
|
||||
BlackMisc::CStatusMessage setAndSaveSettings(const BlackMisc::Simulation::CSettings &settings, const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||
BlackMisc::CStatusMessage setAndSaveSettings(const BlackMisc::Simulation::CSimulatorSettings &settings, const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||
|
||||
//! Set settings per simulator
|
||||
BlackMisc::CStatusMessage saveSettings(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||
@@ -176,8 +177,8 @@ namespace BlackMisc
|
||||
|
||||
//! Settings regarding message handling.
|
||||
//! Driver independent part, related to network
|
||||
class BLACKMISC_EXPORT CSettingsSimulatorMessages :
|
||||
public BlackMisc::CValueObject<CSettingsSimulatorMessages>
|
||||
class BLACKMISC_EXPORT CSimulatorMessagesSettings :
|
||||
public BlackMisc::CValueObject<CSimulatorMessagesSettings>
|
||||
{
|
||||
public:
|
||||
//! Properties by index
|
||||
@@ -197,12 +198,12 @@ namespace BlackMisc
|
||||
TextMessagesCom2 = 1 << 2,
|
||||
TextMessagePrivate = 1 << 3,
|
||||
TextMessageSupervisor = 1 << 4,
|
||||
TextMessagesAll = TextMessagesUnicom | TextMessagesCom1 | TextMessagesCom2 | TextMessagePrivate
|
||||
TextMessagesAll = TextMessagesUnicom | TextMessagesCom1 | TextMessagesCom2 | TextMessagePrivate
|
||||
};
|
||||
Q_DECLARE_FLAGS(TextMessageType, TextMessageTypeFlag)
|
||||
|
||||
//! Default constructor
|
||||
CSettingsSimulatorMessages();
|
||||
CSimulatorMessagesSettings();
|
||||
|
||||
//! Log severity
|
||||
void setTechnicalLogSeverity(BlackMisc::CStatusMessage::StatusSeverity severity);
|
||||
@@ -229,7 +230,7 @@ namespace BlackMisc
|
||||
bool isRelayedTechnicalMessages() const;
|
||||
|
||||
//! Relay the following message types
|
||||
void setRelayedTextMessages(BlackMisc::Simulation::CSettingsSimulatorMessages::TextMessageType messageType);
|
||||
void setRelayedTextMessages(BlackMisc::Simulation::CSimulatorMessagesSettings::TextMessageType messageType);
|
||||
|
||||
//! Relay supervisor messages
|
||||
bool isRelayedSupervisorTextMessages() const;
|
||||
@@ -253,7 +254,7 @@ namespace BlackMisc
|
||||
bool relayThisStatusMessage(const BlackMisc::CStatusMessage &message) const;
|
||||
|
||||
//! Relayed text messages
|
||||
CSettingsSimulatorMessages::TextMessageType getRelayedTextMessageTypes() const;
|
||||
CSimulatorMessagesSettings::TextMessageType getRelayedTextMessageTypes() const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::String::toQString
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
@@ -270,29 +271,43 @@ namespace BlackMisc
|
||||
bool m_globallyEnabled = true; //!< messsage relay enabled to simulator
|
||||
|
||||
BLACK_METACLASS(
|
||||
CSettingsSimulatorMessages,
|
||||
CSimulatorMessagesSettings,
|
||||
BLACK_METAMEMBER(technicalLogLevel),
|
||||
BLACK_METAMEMBER(messageType)
|
||||
);
|
||||
};
|
||||
|
||||
//! Trait for simulator message settings
|
||||
struct TSimulatorMessages : public BlackMisc::TSettingTrait<CSettingsSimulatorMessages>
|
||||
struct TSimulatorMessages : public BlackMisc::TSettingTrait<CSimulatorMessagesSettings>
|
||||
{
|
||||
//! Key in data cache
|
||||
static const char *key() { return "settingssimulatormessages"; }
|
||||
};
|
||||
|
||||
//! Selected weather scenario
|
||||
struct TSelectedWeatherScenario : public BlackMisc::TSettingTrait<BlackMisc::Weather::CWeatherScenario>
|
||||
{
|
||||
//! \copydoc BlackMisc::TSettingTrait::key
|
||||
static const char *key() { return "simulator/selectedweatherscenario"; }
|
||||
|
||||
//! \copydoc BlackMisc::TSettingTrait::defaultValue
|
||||
static const BlackMisc::Weather::CWeatherScenario &defaultValue()
|
||||
{
|
||||
static const BlackMisc::Weather::CWeatherScenario scenario {};
|
||||
return scenario;
|
||||
}
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
Q_DECLARE_METATYPE(BlackMisc::Simulation::CSettings)
|
||||
Q_DECLARE_METATYPE(BlackMisc::CCollection<BlackMisc::Simulation::CSettings>)
|
||||
Q_DECLARE_METATYPE(BlackMisc::CSequence<BlackMisc::Simulation::CSettings>)
|
||||
Q_DECLARE_METATYPE(BlackMisc::Simulation::CSettingsSimulatorMessages)
|
||||
Q_DECLARE_METATYPE(BlackMisc::CCollection<BlackMisc::Simulation::CSettingsSimulatorMessages>)
|
||||
Q_DECLARE_METATYPE(BlackMisc::CSequence<BlackMisc::Simulation::CSettingsSimulatorMessages>)
|
||||
Q_DECLARE_METATYPE(BlackMisc::Simulation::CSettingsSimulatorMessages::TextMessageTypeFlag)
|
||||
Q_DECLARE_METATYPE(BlackMisc::Simulation::CSettingsSimulatorMessages::TextMessageType)
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(BlackMisc::Simulation::CSettingsSimulatorMessages::TextMessageType)
|
||||
Q_DECLARE_METATYPE(BlackMisc::Simulation::CSimulatorSettings)
|
||||
Q_DECLARE_METATYPE(BlackMisc::CCollection<BlackMisc::Simulation::CSimulatorSettings>)
|
||||
Q_DECLARE_METATYPE(BlackMisc::CSequence<BlackMisc::Simulation::CSimulatorSettings>)
|
||||
Q_DECLARE_METATYPE(BlackMisc::Simulation::CSimulatorMessagesSettings)
|
||||
Q_DECLARE_METATYPE(BlackMisc::CCollection<BlackMisc::Simulation::CSimulatorMessagesSettings>)
|
||||
Q_DECLARE_METATYPE(BlackMisc::CSequence<BlackMisc::Simulation::CSimulatorMessagesSettings>)
|
||||
Q_DECLARE_METATYPE(BlackMisc::Simulation::CSimulatorMessagesSettings::TextMessageTypeFlag)
|
||||
Q_DECLARE_METATYPE(BlackMisc::Simulation::CSimulatorMessagesSettings::TextMessageType)
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(BlackMisc::Simulation::CSimulatorMessagesSettings::TextMessageType)
|
||||
|
||||
#endif // guard
|
||||
@@ -16,7 +16,7 @@
|
||||
#include "fs9client.h"
|
||||
#include "lobbyclient.h"
|
||||
#include "../fscommon/simulatorfscommon.h"
|
||||
#include "blackcore/simulator/simulatorsettings.h"
|
||||
#include "blackmisc/simulation/simulatorsettings.h"
|
||||
#include "blackcore/simulator.h"
|
||||
#include "blackmisc/interpolator.h"
|
||||
#include "blackmisc/simulation/simulatedaircraft.h"
|
||||
@@ -101,7 +101,7 @@ namespace BlackSimPlugin
|
||||
QSharedPointer<CLobbyClient> m_lobbyClient;
|
||||
|
||||
BlackMisc::Geo::CCoordinateGeodetic m_lastWeatherPosition; //!< Own aircraft position at which weather was fetched and injected last
|
||||
BlackMisc::CSetting<BlackCore::Simulator::TSelectedWeatherScenario> m_weatherScenarioSettings { this, &CSimulatorFs9::reloadWeatherSettings };
|
||||
BlackMisc::CSetting<BlackMisc::Simulation::TSelectedWeatherScenario> m_weatherScenarioSettings { this, &CSimulatorFs9::reloadWeatherSettings };
|
||||
};
|
||||
|
||||
//! Listener for FS9
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
#include "simconnectdatadefinition.h"
|
||||
#include "simconnectobject.h"
|
||||
#include "../fscommon/simulatorfscommon.h"
|
||||
#include "blackcore/simulator/simulatorsettings.h"
|
||||
#include "blackcore/simulator.h"
|
||||
#include "blackmisc/interpolatorlinear.h"
|
||||
#include "blackmisc/simulation/simulatorplugininfo.h"
|
||||
#include "blackmisc/simulation/simulatorsettings.h"
|
||||
#include "blackmisc/simulation/aircraftmodel.h"
|
||||
#include "blackmisc/simulation/simulatedaircraft.h"
|
||||
#include "blackmisc/aviation/airportlist.h"
|
||||
@@ -222,7 +222,7 @@ namespace BlackSimPlugin
|
||||
CSimConnectObjects m_simConnectObjects; //!< AI objects and their object / request ids
|
||||
BlackMisc::Simulation::CSimulatedAircraftList m_outOfRealityBubble; //!< aircraft removed by FSX because they are out of reality bubble
|
||||
BlackMisc::Geo::CCoordinateGeodetic m_lastWeatherPosition; //!< Own aircraft position at which weather was fetched and injected last
|
||||
BlackMisc::CSetting<BlackCore::Simulator::TSelectedWeatherScenario> m_weatherScenarioSettings { this, &CSimulatorFsx::reloadWeatherSettings };
|
||||
BlackMisc::CSetting<BlackMisc::Simulation::TSelectedWeatherScenario> m_weatherScenarioSettings { this, &CSimulatorFsx::reloadWeatherSettings };
|
||||
QTimer m_realityBubbleTimer { this }; //!< updating of aircraft out of reality bubble
|
||||
};
|
||||
|
||||
|
||||
@@ -14,20 +14,20 @@
|
||||
|
||||
#include "blackcore/simulator.h"
|
||||
#include "blackcore/simulatorcommon.h"
|
||||
#include "blackcore/simulator/simulatorsettings.h"
|
||||
#include "plugins/simulator/xplaneconfig/simulatorxplaneconfig.h"
|
||||
#include "blackmisc/aviation/airportlist.h"
|
||||
#include "blackmisc/aviation/callsignset.h"
|
||||
#include "blackmisc/geo/coordinategeodetic.h"
|
||||
#include "blackmisc/identifier.h"
|
||||
#include "blackmisc/pixmap.h"
|
||||
#include "blackmisc/pq/time.h"
|
||||
#include "blackmisc/pq/units.h"
|
||||
#include "blackmisc/sequence.h"
|
||||
#include "blackmisc/settingscache.h"
|
||||
#include "blackmisc/simulation/aircraftmodellist.h"
|
||||
#include "blackmisc/statusmessage.h"
|
||||
#include "blackmisc/simulation/simulatorsettings.h"
|
||||
#include "blackmisc/weather/weathergrid.h"
|
||||
#include "plugins/simulator/xplaneconfig/simulatorxplaneconfig.h"
|
||||
#include "blackmisc/settingscache.h"
|
||||
#include "blackmisc/statusmessage.h"
|
||||
#include "blackmisc/identifier.h"
|
||||
#include "blackmisc/pixmap.h"
|
||||
#include "blackmisc/sequence.h"
|
||||
|
||||
#include <QDBusConnection>
|
||||
#include <QList>
|
||||
@@ -149,7 +149,7 @@ namespace BlackSimPlugin
|
||||
BlackMisc::Simulation::CAircraftModelList m_installedModels; //!< \todo Do we still need this, as we now focus on model set
|
||||
|
||||
BlackMisc::Geo::CCoordinateGeodetic m_lastWeatherPosition; //!< Own aircraft position at which weather was fetched and injected last
|
||||
BlackMisc::CSetting<BlackCore::Simulator::TSelectedWeatherScenario> m_weatherScenarioSettings { this, &CSimulatorXPlane::reloadWeatherSettings };
|
||||
BlackMisc::CSetting<BlackMisc::Simulation::TSelectedWeatherScenario> m_weatherScenarioSettings { this, &CSimulatorXPlane::reloadWeatherSettings };
|
||||
|
||||
//! \todo Add units to members? pitchDeg?, altitudeFt?
|
||||
struct // data is written by DBus async method callbacks
|
||||
|
||||
Reference in New Issue
Block a user