mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-09 05:28:09 +08:00
refs #297 Removed old simulator settings, which were not even used.
This commit is contained in:
@@ -94,13 +94,6 @@ namespace BlackCore
|
||||
return s;
|
||||
}
|
||||
|
||||
//! Path for simulator settings
|
||||
static const QString &PathSimulatorSettings()
|
||||
{
|
||||
static QString s("simulator");
|
||||
return s;
|
||||
}
|
||||
|
||||
//! Root path
|
||||
static const QString &PathRoot()
|
||||
{
|
||||
@@ -136,9 +129,6 @@ namespace BlackCore
|
||||
//! Audio settings
|
||||
virtual BlackMisc::Settings::CSettingsAudio getAudioSettings() const = 0;
|
||||
|
||||
//! Audio settings
|
||||
virtual BlackMisc::Simulation::Settings::CSettingsSimulator getSimulatorSettings() const = 0;
|
||||
|
||||
//! Hotkeys
|
||||
virtual BlackMisc::Settings::CSettingKeyboardHotkeyList getHotkeys() const = 0;
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ using namespace BlackMisc;
|
||||
using namespace BlackMisc::Settings;
|
||||
using namespace BlackMisc::Network;
|
||||
using namespace BlackMisc::Hardware;
|
||||
using namespace BlackMisc::Simulation::Settings;
|
||||
|
||||
namespace BlackCore
|
||||
{
|
||||
@@ -71,18 +70,6 @@ namespace BlackCore
|
||||
this->m_settingsAudio.initDefaultValues();
|
||||
}
|
||||
|
||||
// init simulator
|
||||
if (jsonObject.contains(IContextSettings::PathSimulatorSettings()))
|
||||
{
|
||||
this->m_settingsSimulator.convertFromJson(
|
||||
jsonObject.value(IContextSettings::PathSimulatorSettings()).toObject()
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->m_settingsSimulator.initDefaultValues();
|
||||
}
|
||||
|
||||
// init own members
|
||||
if (jsonObject.contains(IContextSettings::PathHotkeys()))
|
||||
{
|
||||
@@ -137,7 +124,6 @@ namespace BlackCore
|
||||
this->m_hotkeys.initAsHotkeyList(true);
|
||||
this->m_settingsNetwork.initDefaultValues();
|
||||
this->m_settingsAudio.initDefaultValues();
|
||||
this->m_settingsSimulator.initDefaultValues();
|
||||
this->emitCompletelyChanged();
|
||||
if (write)
|
||||
{
|
||||
@@ -163,7 +149,6 @@ namespace BlackCore
|
||||
QJsonObject jsonObject;
|
||||
jsonObject.insert(IContextSettings::PathNetworkSettings(), this->m_settingsNetwork.toJson());
|
||||
jsonObject.insert(IContextSettings::PathAudioSettings(), this->m_settingsAudio.toJson());
|
||||
jsonObject.insert(IContextSettings::PathSimulatorSettings(), this->m_settingsSimulator.toJson());
|
||||
jsonObject.insert(IContextSettings::PathHotkeys(), this->m_hotkeys.toJson());
|
||||
QJsonDocument doc(jsonObject);
|
||||
return doc;
|
||||
@@ -204,14 +189,6 @@ namespace BlackCore
|
||||
return this->m_settingsAudio;
|
||||
}
|
||||
|
||||
/*
|
||||
* Simulator settings
|
||||
*/
|
||||
CSettingsSimulator CContextSettings::getSimulatorSettings() const
|
||||
{
|
||||
return this->m_settingsSimulator;
|
||||
}
|
||||
|
||||
/*
|
||||
* Pass value
|
||||
*/
|
||||
@@ -257,15 +234,6 @@ namespace BlackCore
|
||||
emit this->changedSettings(static_cast<uint>(SettingsAudio));
|
||||
}
|
||||
}
|
||||
else if (path.startsWith(IContextSettings::PathSimulatorSettings()))
|
||||
{
|
||||
msgs.push_back(this->m_settingsSimulator.value(nextLevelPath, command, value, changed));
|
||||
if (changed)
|
||||
{
|
||||
msgs.push_back(this->write());
|
||||
emit this->changedSettings(static_cast<uint>(SettingsSimulator));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
msgs.push_back(
|
||||
|
||||
@@ -60,9 +60,6 @@ namespace BlackCore
|
||||
//! \copydoc IContextSettings::getAudioSettings()
|
||||
virtual BlackMisc::Settings::CSettingsAudio getAudioSettings() const override;
|
||||
|
||||
//! \copydoc IContextSettings::getSimulatorSettings()
|
||||
virtual BlackMisc::Simulation::Settings::CSettingsSimulator getSimulatorSettings() const override;
|
||||
|
||||
//! \copydoc IContextSettings::getHotkeys()
|
||||
virtual BlackMisc::Settings::CSettingKeyboardHotkeyList getHotkeys() const override;
|
||||
|
||||
@@ -87,7 +84,6 @@ namespace BlackCore
|
||||
|
||||
BlackMisc::Settings::CSettingsNetwork m_settingsNetwork;
|
||||
BlackMisc::Settings::CSettingsAudio m_settingsAudio;
|
||||
BlackMisc::Simulation::Settings::CSettingsSimulator m_settingsSimulator;
|
||||
BlackMisc::Settings::CSettingKeyboardHotkeyList m_hotkeys;
|
||||
QJsonDocument toJsonDocument() const;
|
||||
void emitCompletelyChanged();
|
||||
|
||||
@@ -15,7 +15,6 @@ using namespace BlackMisc;
|
||||
using namespace BlackMisc::Settings;
|
||||
using namespace BlackMisc::Network;
|
||||
using namespace BlackMisc::Hardware;
|
||||
using namespace BlackMisc::Simulation::Settings;
|
||||
|
||||
namespace BlackCore
|
||||
{
|
||||
@@ -58,14 +57,6 @@ namespace BlackCore
|
||||
return this->m_dBusInterface->callDBusRet<CSettingsAudio>(QLatin1Literal("getAudioSettings"));
|
||||
}
|
||||
|
||||
/*
|
||||
* Relay to DBus
|
||||
*/
|
||||
CSettingsSimulator CContextSettingsProxy::getSimulatorSettings() const
|
||||
{
|
||||
return this->m_dBusInterface->callDBusRet<CSettingsSimulator>(QLatin1Literal("getSimulatorSettings"));
|
||||
}
|
||||
|
||||
/*
|
||||
* Relay to DBus
|
||||
*/
|
||||
|
||||
@@ -50,9 +50,6 @@ namespace BlackCore
|
||||
//! \copydoc IContextSettings::getAudioSettings()
|
||||
virtual BlackMisc::Settings::CSettingsAudio getAudioSettings() const override;
|
||||
|
||||
//! \copydoc IContextSettings::getSimulatorSettings()
|
||||
virtual BlackMisc::Simulation::Settings::CSettingsSimulator getSimulatorSettings() const override;
|
||||
|
||||
//! \copydoc IContextSettings::getHotkeys()
|
||||
virtual BlackMisc::Settings::CSettingKeyboardHotkeyList getHotkeys() const override;
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@ using namespace BlackMisc::Network;
|
||||
using namespace BlackMisc::Simulation;
|
||||
using namespace BlackMisc::Geo;
|
||||
using namespace BlackMisc::Simulation;
|
||||
using namespace BlackMisc::Simulation::Settings;
|
||||
|
||||
namespace BlackCore
|
||||
{
|
||||
|
||||
@@ -7,6 +7,5 @@
|
||||
#define BLACKCORE_SETTINGSALLCLASSES_H
|
||||
|
||||
#include "blackmisc/settingsblackmiscclasses.h"
|
||||
#include "blackmisc/simulation/setsimulator.h"
|
||||
|
||||
#endif // guard
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
#include "settingssimulatorcomponent.h"
|
||||
#include "ui_settingssimulatorcomponent.h"
|
||||
|
||||
#include "blackcore/context_settings.h"
|
||||
#include "blackcore/context_simulator.h"
|
||||
#include "blackcore/context_network.h"
|
||||
#include "blackmisc/simulation/simulatorplugininfolist.h"
|
||||
#include "blackmisc/simulation/setsimulator.h"
|
||||
#include "blackmisc/simulation/simulatedaircraftlist.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackmisc/variant.h"
|
||||
@@ -41,7 +39,6 @@ namespace BlackGui
|
||||
void CSettingsSimulatorComponent::runtimeHasBeenSet()
|
||||
{
|
||||
Q_ASSERT_X(this->getIContextSimulator(), Q_FUNC_INFO, "missing simulator");
|
||||
Q_ASSERT_X(this->getIContextSettings(), Q_FUNC_INFO, "missing settings");
|
||||
|
||||
// set values
|
||||
for (const auto &p : getAvailablePlugins(true))
|
||||
@@ -51,8 +48,6 @@ namespace BlackGui
|
||||
|
||||
// connects
|
||||
connect(this->ui->cb_Plugins, static_cast<void (QComboBox::*)(int)> (&QComboBox::currentIndexChanged), this, &CSettingsSimulatorComponent::ps_pluginHasBeenSelectedInComboBox);
|
||||
connect(this->getIContextSettings(), &IContextSettings::changedSettings, this, &CSettingsSimulatorComponent::ps_settingsHaveChanged);
|
||||
connect(this->getIContextSimulator(), &IContextSimulator::simulatorPluginChanged, this, &CSettingsSimulatorComponent::ps_simulatorPluginChanged);
|
||||
connect(this->ui->pb_ApplyMaxAircraft, &QCheckBox::pressed, this, &CSettingsSimulatorComponent::ps_onApplyMaxRenderedAircraft);
|
||||
connect(this->ui->pb_ApplyTimeSync, &QCheckBox::pressed, this, &CSettingsSimulatorComponent::ps_onApplyTimeSync);
|
||||
connect(this->ui->pb_ApplyMaxDistance, &QCheckBox::pressed, this, &CSettingsSimulatorComponent::ps_onApplyMaxRenderedDistance);
|
||||
@@ -142,8 +137,7 @@ namespace BlackGui
|
||||
void CSettingsSimulatorComponent::ps_pluginHasBeenSelectedInComboBox(int index)
|
||||
{
|
||||
Q_ASSERT(this->getIContextSimulator());
|
||||
Q_ASSERT(this->getIContextSettings());
|
||||
if (!this->getIContextSimulator() || !this->getIContextSettings()) { return; }
|
||||
if (!this->getIContextSimulator()) { return; }
|
||||
|
||||
CSimulatorPluginInfoList simDrivers(getAvailablePlugins(true));
|
||||
if (simDrivers.isEmpty())
|
||||
@@ -164,12 +158,6 @@ namespace BlackGui
|
||||
// changing of GUI state will be done via received signal
|
||||
}
|
||||
|
||||
void CSettingsSimulatorComponent::ps_settingsHaveChanged(uint settingsType)
|
||||
{
|
||||
Q_ASSERT(this->getIContextSettings());
|
||||
Q_UNUSED(settingsType);
|
||||
}
|
||||
|
||||
void CSettingsSimulatorComponent::ps_onApplyMaxRenderedAircraft()
|
||||
{
|
||||
Q_ASSERT(getIContextSimulator());
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#define BLACKGUI_SETTINGSSIMULATORCOMPONENT_H
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackmisc/simulation/setsimulator.h"
|
||||
#include "blackmisc/simulation/simulatorplugininfolist.h"
|
||||
#include "enableforruntime.h"
|
||||
#include "enableforruntime.h"
|
||||
@@ -43,9 +42,6 @@ namespace BlackGui
|
||||
//! Driver changed
|
||||
void ps_pluginHasBeenSelectedInComboBox(int index);
|
||||
|
||||
//! Settings have been changed
|
||||
void ps_settingsHaveChanged(uint settingsType);
|
||||
|
||||
//! Apply max.aircraft
|
||||
void ps_onApplyMaxRenderedAircraft();
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include "blackmisc/simulation/aircraftmodellist.h"
|
||||
#include "blackmisc/simulation/simulatedaircraftlist.h"
|
||||
#include "blackmisc/simulation/simulatorplugininfolist.h"
|
||||
#include "blackmisc/simulation/setsimulator.h"
|
||||
#include "blackmisc/simulation/airspaceaircraftsnapshot.h"
|
||||
#include "blackmisc/simulation/simulatorsetup.h"
|
||||
#include "blackmisc/simulation/fsx/simconnectutilities.h"
|
||||
@@ -19,7 +18,6 @@
|
||||
using namespace BlackMisc::Simulation;
|
||||
using namespace BlackMisc::Simulation::Fsx;
|
||||
using namespace BlackMisc::Simulation::FsCommon;
|
||||
using namespace BlackMisc::Simulation::Settings;
|
||||
|
||||
/*
|
||||
* Metadata for simulation
|
||||
@@ -31,7 +29,6 @@ void BlackMisc::Simulation::registerMetadata()
|
||||
{
|
||||
CSimulatorPluginInfo::registerMetadata();
|
||||
CSimulatorPluginInfoList::registerMetadata();
|
||||
CSettingsSimulator::registerMetadata();
|
||||
CAircraftCfgEntries::registerMetadata();
|
||||
CAircraftCfgEntriesList::registerMetadata();
|
||||
CSimConnectUtilities::registerMetadata();
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
/* Copyright (C) 2013
|
||||
* 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 "setsimulator.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Settings;
|
||||
using namespace BlackMisc::PhysicalQuantities;
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
namespace Simulation
|
||||
{
|
||||
namespace Settings
|
||||
{
|
||||
|
||||
CSettingsSimulator::CSettingsSimulator()
|
||||
{
|
||||
this->initDefaultValues();
|
||||
}
|
||||
|
||||
QString CSettingsSimulator::convertToQString(bool i18n) const
|
||||
{
|
||||
Q_UNUSED(i18n);
|
||||
QString s("Sel.driver:");
|
||||
s.append(" ").append(m_selectedPlugin.toQString(i18n));
|
||||
return s;
|
||||
}
|
||||
|
||||
void CSettingsSimulator::initDefaultValues()
|
||||
{
|
||||
this->m_timeSyncOffset = CTime(0, CTimeUnit::hrmin());
|
||||
this->m_timeSync = false;
|
||||
}
|
||||
|
||||
BlackMisc::CStatusMessage CSettingsSimulator::value(const QString &path, const QString &command, const CVariant &value, bool &changedFlag)
|
||||
{
|
||||
// TODO: This needs to be refactored to a smarter way to delegate commands
|
||||
changedFlag = false;
|
||||
if (path == CSettingsSimulator::ValueSelectedDriver())
|
||||
{
|
||||
if (command == CSettingUtilities::CmdAdd() || command == CSettingUtilities::CmdUpdate())
|
||||
{
|
||||
CSimulatorPluginInfo v = value.value<CSimulatorPluginInfo>();
|
||||
changedFlag = (v != this->m_selectedPlugin);
|
||||
this->m_selectedPlugin = v;
|
||||
return CLogMessage(CLogCategory::settingsUpdate()).info("selected driver%1 changed") << (changedFlag ? "" : " not");
|
||||
}
|
||||
return CLogMessage(CLogCategory::validation()).error("wrong command: %1") << command;
|
||||
}
|
||||
else if (path == CSettingsSimulator::ValueSyncTime())
|
||||
{
|
||||
if (command == CSettingUtilities::CmdAdd() || command == CSettingUtilities::CmdUpdate())
|
||||
{
|
||||
bool v = value.value<bool>();
|
||||
changedFlag = (v != this->m_timeSync);
|
||||
this->m_timeSync = v;
|
||||
return CLogMessage(CLogCategory::settingsUpdate()).info("time synchronization%1 changed") << (changedFlag ? "" : " not");
|
||||
}
|
||||
return CLogMessage(CLogCategory::validation()).error("wrong command: %1") << command;
|
||||
}
|
||||
else if (path == CSettingsSimulator::ValueSyncTimeOffset())
|
||||
{
|
||||
if (command == CSettingUtilities::CmdAdd() || command == CSettingUtilities::CmdUpdate())
|
||||
{
|
||||
CTime v = value.value<CTime>();
|
||||
changedFlag = (v != this->m_timeSyncOffset);
|
||||
this->m_timeSyncOffset = v;
|
||||
return CLogMessage(CLogCategory::settingsUpdate()).info("time synchronization offset%1 changed") << (changedFlag ? "" : " not");
|
||||
}
|
||||
return CLogMessage(CLogCategory::validation()).error("wrong command: %1") << command;
|
||||
}
|
||||
else
|
||||
{
|
||||
return CLogMessage(CLogCategory::validation()).error("wrong path: %1") << path;
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
} // namespace
|
||||
} // namespace
|
||||
@@ -1,98 +0,0 @@
|
||||
/* Copyright (C) 2013
|
||||
* 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_SETTINGS_SIMULATOR_H
|
||||
#define BLACKMISC_SETTINGS_SIMULATOR_H
|
||||
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
#include "blackmisc/valueobject.h"
|
||||
#include "blackmisc/statusmessagelist.h"
|
||||
#include "blackmisc/settingutilities.h"
|
||||
#include "blackmisc/pq/time.h"
|
||||
#include "simulatorplugininfo.h"
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
namespace Simulation
|
||||
{
|
||||
namespace Settings
|
||||
{
|
||||
//! Value object encapsulating information of simulator related settings.
|
||||
//! \deprecated will be removed with new MS settings
|
||||
class BLACKMISC_EXPORT CSettingsSimulator : public BlackMisc::CValueObject<CSettingsSimulator>
|
||||
{
|
||||
public:
|
||||
//! Default constructor.
|
||||
CSettingsSimulator();
|
||||
|
||||
//! Path
|
||||
static const QString &ValueSelectedDriver()
|
||||
{
|
||||
static const QString value("selecteddriver");
|
||||
return value;
|
||||
}
|
||||
|
||||
//! Path
|
||||
static const QString &ValueSyncTimeOffset()
|
||||
{
|
||||
static const QString value("synctimeoffset");
|
||||
return value;
|
||||
}
|
||||
|
||||
//! Path
|
||||
static const QString &ValueSyncTime()
|
||||
{
|
||||
static const QString value("synctime");
|
||||
return value;
|
||||
}
|
||||
|
||||
//! Selected driver
|
||||
const BlackMisc::Simulation::CSimulatorPluginInfo &getSelectedPlugin() const { return this->m_selectedPlugin; }
|
||||
|
||||
//! Selected driver
|
||||
void setSelectedPlugin(const BlackMisc::Simulation::CSimulatorPluginInfo &plugin) { this->m_selectedPlugin = plugin; }
|
||||
|
||||
//! Time synchronization offset time
|
||||
const BlackMisc::PhysicalQuantities::CTime &getSyncTimeOffset() const { return this->m_timeSyncOffset;}
|
||||
|
||||
//! Set time synchronization offset time
|
||||
void setSyncTimeOffset(const BlackMisc::PhysicalQuantities::CTime &offset) { this->m_timeSyncOffset = offset; this->m_timeSyncOffset.switchUnit(BlackMisc::PhysicalQuantities::CTimeUnit::hrmin());}
|
||||
|
||||
//! Time syncronization enabled?
|
||||
bool isTimeSyncEnabled() const { return this->m_timeSync;}
|
||||
|
||||
//! Set time synchronization
|
||||
void setTimeSyncEnabled(bool enabled) { this->m_timeSync = enabled; }
|
||||
|
||||
//! Init with meaningful default values
|
||||
void initDefaultValues();
|
||||
|
||||
//! \copydoc BlackCore::IContextSettings::value
|
||||
BlackMisc::CStatusMessage value(const QString &path, const QString &command, const BlackMisc::CVariant &value, bool &changedFlag);
|
||||
|
||||
//! \copydoc CValueObject::convertToQString
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
|
||||
private:
|
||||
BLACK_ENABLE_TUPLE_CONVERSION(CSettingsSimulator)
|
||||
BlackMisc::Simulation::CSimulatorPluginInfo m_selectedPlugin;
|
||||
bool m_timeSync = false;
|
||||
BlackMisc::PhysicalQuantities::CTime m_timeSyncOffset;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
Q_DECLARE_METATYPE(BlackMisc::Simulation::Settings::CSettingsSimulator)
|
||||
BLACK_DECLARE_TUPLE_CONVERSION(BlackMisc::Simulation::Settings::CSettingsSimulator, (o.m_selectedPlugin, o.m_timeSync, o.m_timeSyncOffset))
|
||||
|
||||
#endif // guard
|
||||
Reference in New Issue
Block a user