mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 06:45:37 +08:00
refactor: Fix remaining modernize- warnings
This commit is contained in:
41
.clang-tidy
41
.clang-tidy
@@ -3,10 +3,45 @@
|
||||
|
||||
Checks: >
|
||||
-*,
|
||||
modernize-use-auto,
|
||||
modernize-use-override,
|
||||
modernize-return-braced-init-list,
|
||||
modernize-avoid-bind,
|
||||
modernize-concat-nested-namespaces,
|
||||
modernize-deprecated-headers,
|
||||
modernize-deprecated-ios-base-aliases,
|
||||
modernize-loop-convert,
|
||||
modernize-macro-to-enum,
|
||||
modernize-make-shared,
|
||||
modernize-make-unique,
|
||||
modernize-min-max-use-initializer-list,
|
||||
modernize-raw-string-literal,
|
||||
modernize-redundant-void-arg,
|
||||
modernize-replace-auto-ptr,
|
||||
modernize-replace-disallow-copy-and-assign-macro,
|
||||
modernize-replace-random-shuffle,
|
||||
modernize-return-braced-init-list,
|
||||
modernize-shrink-to-fit,
|
||||
modernize-type-traits,
|
||||
modernize-unary-static-assert,
|
||||
modernize-use-auto,
|
||||
modernize-use-bool-literals,
|
||||
modernize-use-constraints,
|
||||
modernize-use-default-member-init,
|
||||
modernize-use-designated-initializers,
|
||||
modernize-use-emplace,
|
||||
modernize-use-equals-default,
|
||||
modernize-use-equals-delete,
|
||||
modernize-use-integer-sign-comparison,
|
||||
modernize-use-noexcept,
|
||||
modernize-use-nullptr,
|
||||
modernize-use-override,
|
||||
modernize-use-ranges,
|
||||
modernize-use-scoped-lock,
|
||||
modernize-use-starts-ends-with,
|
||||
modernize-use-std-format,
|
||||
modernize-use-std-numbers,
|
||||
modernize-use-std-print,
|
||||
modernize-use-transparent-functors,
|
||||
modernize-use-uncaught-exceptions,
|
||||
modernize-use-using,
|
||||
|
||||
|
||||
CheckOptions:
|
||||
|
||||
@@ -113,7 +113,7 @@ def run_clazy(build_path: str, changed_source_files: set[str]):
|
||||
'-p', build_path,
|
||||
"-extra-arg", "-Werror",
|
||||
"-extra-arg", "-Wno-unnecessary-virtual-specifier",
|
||||
'--header-filter', '(config|core|gui|input|misc|plugins|sound|swiftcore|swiftdata|swiftguistandard|swiftlauncher|xswiftbus)/',
|
||||
'--header-filter', f'{utils.get_swift_source_path()}/src/',
|
||||
*changed_source_files
|
||||
], text=True, check=True)
|
||||
except CalledProcessError:
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
|
||||
#include "core/context/contextnetworkimpl.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <QStringBuilder>
|
||||
#include <QTimer>
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace swift::core::context
|
||||
{
|
||||
CContextSimulatorProxy::CContextSimulatorProxy(const QString &serviceName, QDBusConnection &connection,
|
||||
CCoreFacadeConfig::ContextMode mode, CCoreFacade *runtime)
|
||||
: IContextSimulator(mode, runtime), m_dBusInterface(nullptr)
|
||||
: IContextSimulator(mode, runtime)
|
||||
{
|
||||
this->m_dBusInterface = new swift::misc::CGenericDBusInterface(
|
||||
serviceName, IContextSimulator::ObjectPath(), IContextSimulator::InterfaceName(), connection, this);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "core/inputmanager.h"
|
||||
|
||||
#include <limits.h>
|
||||
#include <climits>
|
||||
|
||||
#include <QtGlobal>
|
||||
|
||||
|
||||
@@ -48,9 +48,11 @@ namespace swift::core
|
||||
template <typename RecvObj>
|
||||
int bind(const QString &action, RecvObj *receiver, void (RecvObj::*slotPointer)(bool))
|
||||
{
|
||||
// NOLINTBEGIN(modernize-avoid-bind)
|
||||
using namespace std::placeholders;
|
||||
auto function = std::bind(slotPointer, receiver, _1);
|
||||
return bindImpl(action, receiver, function);
|
||||
// NOLINTEND(modernize-avoid-bind)
|
||||
}
|
||||
|
||||
//! Register a new hotkey function
|
||||
|
||||
@@ -715,7 +715,7 @@ namespace swift::core
|
||||
|
||||
protected:
|
||||
//! Default ctor
|
||||
ISimulatorFactory() {}
|
||||
ISimulatorFactory() {} // NOLINT(modernize-use-equals-default)
|
||||
};
|
||||
} // namespace swift::core
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "atcbuttoncomponent.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
|
||||
#include <QGridLayout>
|
||||
#include <QPushButton>
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace swift::gui::components
|
||||
|
||||
using namespace std::placeholders;
|
||||
QMetaObject::Connection c = sGui->getIContextNetwork()->connectRawFsdMessageSignal(
|
||||
this, std::bind(&CRawFsdMessagesComponent::addFsdMessage, this, _1));
|
||||
this, [this](auto &&msg) { addFsdMessage(std::forward<decltype(msg)>(msg)); });
|
||||
if (!c)
|
||||
{
|
||||
ui->pte_RawFsdMessages->appendPlainText(QStringLiteral("Could not connect to raw FSD message."));
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace swift::gui::components
|
||||
void CSettingsTextMessageStyle::replaceTableStyle(const QString &newTableStyle)
|
||||
{
|
||||
QString style = m_style;
|
||||
thread_local const QRegularExpression re("table\\s*\\{.*\\}");
|
||||
thread_local const QRegularExpression re(R"(table\s*\{.*\})");
|
||||
style.replace(re, newTableStyle);
|
||||
m_style = style;
|
||||
}
|
||||
@@ -112,7 +112,7 @@ namespace swift::gui::components
|
||||
bool CSettingsTextMessageStyle::changeFontSize(bool increase)
|
||||
{
|
||||
QString style = m_style;
|
||||
thread_local const QRegularExpression re("table\\s*\\{.*:\\s*(\\d{1,2}).*\\}");
|
||||
thread_local const QRegularExpression re(R"(table\s*\{.*:\s*(\d{1,2}).*\})");
|
||||
const QRegularExpressionMatch match = re.match(style);
|
||||
const QStringList matches = match.capturedTexts();
|
||||
if (matches.size() != 2) { return false; }
|
||||
|
||||
@@ -318,7 +318,7 @@ namespace swift::gui
|
||||
|
||||
private:
|
||||
//! No constructor, use static functions only
|
||||
CGuiUtility() {}
|
||||
CGuiUtility() {} // NOLINT(modernize-use-equals-default)
|
||||
|
||||
static QWidget *s_mainApplicationWidget;
|
||||
};
|
||||
|
||||
@@ -21,7 +21,7 @@ using namespace swift::misc::aviation;
|
||||
namespace swift::gui::models
|
||||
{
|
||||
CTextMessageListModel::CTextMessageListModel(TextMessageMode mode, QObject *parent)
|
||||
: CListModelTimestampObjects("ModelTextMessageList", parent), m_textMessageMode(NotSet)
|
||||
: CListModelTimestampObjects("ModelTextMessageList", parent)
|
||||
{
|
||||
this->setTextMessageMode(mode);
|
||||
|
||||
|
||||
@@ -17,8 +17,7 @@ using namespace swift::misc::aviation;
|
||||
|
||||
namespace swift::gui::models
|
||||
{
|
||||
CUserListModel::CUserListModel(UserMode userMode, QObject *parent)
|
||||
: CListModelBase("ModelUserList", parent), m_userMode(NotSet)
|
||||
CUserListModel::CUserListModel(UserMode userMode, QObject *parent) : CListModelBase("ModelUserList", parent)
|
||||
{
|
||||
this->setUserMode(userMode);
|
||||
|
||||
|
||||
@@ -374,7 +374,7 @@ namespace swift::misc::aviation
|
||||
const QRegularExpression &CAltitude::fpAltitudeRegExp()
|
||||
{
|
||||
thread_local const QRegularExpression re(
|
||||
"([Ff][Ll]?\\d{2,3})|([Ss]\\d{2,4})|([Aa]\\d{2,3})|([Mm]\\d{2,4})|(\\d{3,5}(ft|m))");
|
||||
R"(([Ff][Ll]?\d{2,3})|([Ss]\d{2,4})|([Aa]\d{2,3})|([Mm]\d{2,4})|(\d{3,5}(ft|m)))");
|
||||
return re;
|
||||
}
|
||||
|
||||
|
||||
@@ -258,7 +258,7 @@ namespace swift::misc::aviation
|
||||
|
||||
protected:
|
||||
//! Constructor
|
||||
ICallsignObjectList() {}
|
||||
ICallsignObjectList() {} // NOLINT(modernize-use-equals-default)
|
||||
|
||||
//! Container
|
||||
const CONTAINER &container() const { return static_cast<const CONTAINER &>(*this); }
|
||||
|
||||
@@ -41,54 +41,50 @@
|
||||
#include "misc/aviation/track.h"
|
||||
#include "misc/aviation/transponder.h"
|
||||
|
||||
namespace swift::misc
|
||||
namespace swift::misc::aviation
|
||||
{
|
||||
namespace aviation
|
||||
void registerMetadata()
|
||||
{
|
||||
void registerMetadata()
|
||||
{
|
||||
CAircraftEngine::registerMetadata();
|
||||
CAircraftEngineList::registerMetadata();
|
||||
CAircraftIcaoCode::registerMetadata();
|
||||
CAircraftIcaoCodeList::registerMetadata();
|
||||
CAircraftCategory::registerMetadata();
|
||||
CAircraftCategoryList::registerMetadata();
|
||||
CAircraftLights::registerMetadata();
|
||||
CAircraftParts::registerMetadata();
|
||||
CAircraftPartsList::registerMetadata();
|
||||
CAircraftSituation::registerMetadata();
|
||||
CAircraftSituationChange::registerMetadata();
|
||||
CAircraftSituationList::registerMetadata();
|
||||
CAircraftVelocity::registerMetadata();
|
||||
CAirlineIcaoCode::registerMetadata();
|
||||
CAirlineIcaoCodeList::registerMetadata();
|
||||
CAirportIcaoCode::registerMetadata();
|
||||
CAirport::registerMetadata();
|
||||
CAirportList::registerMetadata();
|
||||
CAltitude::registerMetadata();
|
||||
CAtcStation::registerMetadata();
|
||||
CAtcStationList::registerMetadata();
|
||||
CCallsign::registerMetadata();
|
||||
CCallsignSet::registerMetadata();
|
||||
CComSystem::registerMetadata();
|
||||
CSsrEquipment::registerMetadata();
|
||||
CComNavEquipment::registerMetadata();
|
||||
CWakeTurbulenceCategory::registerMetadata();
|
||||
CFlightPlan::registerMetadata();
|
||||
CFlightPlanAircraftInfo::registerMetadata();
|
||||
CFlightPlanList::registerMetadata();
|
||||
CSimBriefData::registerMetadata();
|
||||
CFlightPlanRemarks::registerMetadata();
|
||||
CHeading::registerMetadata();
|
||||
CInformationMessage::registerMetadata();
|
||||
CLivery::registerMetadata();
|
||||
CLiveryList::registerMetadata();
|
||||
CNavSystem::registerMetadata();
|
||||
CSelcal::registerMetadata();
|
||||
CTrack::registerMetadata();
|
||||
CTransponder::registerMetadata();
|
||||
COnGroundInfo::registerMetadata();
|
||||
}
|
||||
} // namespace aviation
|
||||
|
||||
} // namespace swift::misc
|
||||
CAircraftEngine::registerMetadata();
|
||||
CAircraftEngineList::registerMetadata();
|
||||
CAircraftIcaoCode::registerMetadata();
|
||||
CAircraftIcaoCodeList::registerMetadata();
|
||||
CAircraftCategory::registerMetadata();
|
||||
CAircraftCategoryList::registerMetadata();
|
||||
CAircraftLights::registerMetadata();
|
||||
CAircraftParts::registerMetadata();
|
||||
CAircraftPartsList::registerMetadata();
|
||||
CAircraftSituation::registerMetadata();
|
||||
CAircraftSituationChange::registerMetadata();
|
||||
CAircraftSituationList::registerMetadata();
|
||||
CAircraftVelocity::registerMetadata();
|
||||
CAirlineIcaoCode::registerMetadata();
|
||||
CAirlineIcaoCodeList::registerMetadata();
|
||||
CAirportIcaoCode::registerMetadata();
|
||||
CAirport::registerMetadata();
|
||||
CAirportList::registerMetadata();
|
||||
CAltitude::registerMetadata();
|
||||
CAtcStation::registerMetadata();
|
||||
CAtcStationList::registerMetadata();
|
||||
CCallsign::registerMetadata();
|
||||
CCallsignSet::registerMetadata();
|
||||
CComSystem::registerMetadata();
|
||||
CSsrEquipment::registerMetadata();
|
||||
CComNavEquipment::registerMetadata();
|
||||
CWakeTurbulenceCategory::registerMetadata();
|
||||
CFlightPlan::registerMetadata();
|
||||
CFlightPlanAircraftInfo::registerMetadata();
|
||||
CFlightPlanList::registerMetadata();
|
||||
CSimBriefData::registerMetadata();
|
||||
CFlightPlanRemarks::registerMetadata();
|
||||
CHeading::registerMetadata();
|
||||
CInformationMessage::registerMetadata();
|
||||
CLivery::registerMetadata();
|
||||
CLiveryList::registerMetadata();
|
||||
CNavSystem::registerMetadata();
|
||||
CSelcal::registerMetadata();
|
||||
CTrack::registerMetadata();
|
||||
CTransponder::registerMetadata();
|
||||
COnGroundInfo::registerMetadata();
|
||||
}
|
||||
} // namespace swift::misc::aviation
|
||||
@@ -8,7 +8,7 @@
|
||||
#if defined(Q_OS_WIN32)
|
||||
# include <windows.h>
|
||||
#elif defined(Q_OS_UNIX)
|
||||
# include <time.h>
|
||||
# include <ctime>
|
||||
#endif
|
||||
|
||||
namespace swift::misc
|
||||
|
||||
@@ -132,7 +132,7 @@ namespace swift::misc
|
||||
|
||||
protected:
|
||||
//! Constructor
|
||||
IDatastoreObjectWithIntegerKey() {}
|
||||
IDatastoreObjectWithIntegerKey() {} // NOLINT(modernize-use-equals-default)
|
||||
|
||||
//! Constructor
|
||||
IDatastoreObjectWithIntegerKey(int key) : m_dbKey(key) {}
|
||||
@@ -224,7 +224,7 @@ namespace swift::misc
|
||||
|
||||
protected:
|
||||
//! Constructor
|
||||
IDatastoreObjectWithStringKey() {}
|
||||
IDatastoreObjectWithStringKey() {} // NOLINT(modernize-use-equals-default)
|
||||
|
||||
//! Constructor
|
||||
IDatastoreObjectWithStringKey(const QString &key) : m_dbKey(key) {}
|
||||
|
||||
@@ -92,25 +92,25 @@ namespace swift::misc
|
||||
using impl_type = Impl<Key, Value>;
|
||||
|
||||
//! STL compatibility
|
||||
typedef Key key_type;
|
||||
using key_type = Key;
|
||||
|
||||
//! STL compatibility
|
||||
typedef Value value_type;
|
||||
using value_type = Value;
|
||||
|
||||
//! STL compatibility
|
||||
typedef Value &reference;
|
||||
using reference = Value &;
|
||||
|
||||
//! STL compatibility
|
||||
typedef const Value &const_reference;
|
||||
using const_reference = Value &;
|
||||
|
||||
//! STL compatibility
|
||||
typedef typename Impl<Key, Value>::size_type size_type;
|
||||
using size_type = typename Impl<Key, Value>::size_type;
|
||||
|
||||
//! STL compatibility
|
||||
typedef typename Impl<Key, Value>::iterator iterator;
|
||||
using iterator = typename Impl<Key, Value>::iterator;
|
||||
|
||||
//! STL compatibility
|
||||
typedef typename Impl<Key, Value>::const_iterator const_iterator;
|
||||
using const_iterator = typename Impl<Key, Value>::const_iterator;
|
||||
|
||||
//! Return a copy containing only those elements for which the dictionary keys return true for a given
|
||||
//! predicate.
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
SWIFT_DECLARE_VALUEOBJECT_MIXINS(swift::misc::geo, CCoordinateGeodetic)
|
||||
|
||||
namespace swift::misc
|
||||
namespace swift::misc // NOLINT(modernize-concat-nested-namespaces)
|
||||
{
|
||||
namespace geo
|
||||
{
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace swift::misc::geo
|
||||
}
|
||||
|
||||
// http://www.regular-expressions.info/floatingpoint.html
|
||||
thread_local const QRegularExpression rx("[+-]?\\d+(?:\\.\\d+)?");
|
||||
thread_local const QRegularExpression rx(R"([+-]?\d+(?:\.\d+)?)");
|
||||
int deg = 0;
|
||||
int min = 0;
|
||||
double sec = 0.0;
|
||||
|
||||
@@ -230,7 +230,7 @@ namespace swift::misc::geo
|
||||
|
||||
protected:
|
||||
//! Constructor
|
||||
IGeoObjectList() {}
|
||||
IGeoObjectList() {} // NOLINT(modernize-use-equals-default)
|
||||
|
||||
//! Container
|
||||
const CONTAINER &container() const { return static_cast<const CONTAINER &>(*this); }
|
||||
@@ -296,7 +296,7 @@ namespace swift::misc::geo
|
||||
|
||||
protected:
|
||||
//! Constructor
|
||||
IGeoObjectWithRelativePositionList() {}
|
||||
IGeoObjectWithRelativePositionList() {} // NOLINT(modernize-use-equals-default)
|
||||
};
|
||||
} // namespace swift::misc::geo
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace swift::misc
|
||||
CIdentifiable(QObject *nameProvider);
|
||||
|
||||
//! Construct without a name
|
||||
CIdentifiable() {}
|
||||
CIdentifiable() {} // NOLINT(modernize-use-equals-default)
|
||||
|
||||
//! Destructor
|
||||
~CIdentifiable();
|
||||
|
||||
@@ -48,7 +48,9 @@ namespace swift::misc::private_ns
|
||||
auto invokeMethod(T *object, F &&func, Ts &&...args)
|
||||
{
|
||||
const auto invoker = [](auto &&...x) { return private_ns::invokeSlot(std::forward<decltype(x)>(x)...); };
|
||||
// NOLINTBEGIN(modernize-avoid-bind)
|
||||
auto method = std::bind(invoker, std::forward<F>(func), object, std::forward<Ts>(args)...);
|
||||
// NOLINTEND(modernize-avoid-bind)
|
||||
CPromise<decltype(std::move(method)())> promise;
|
||||
QMetaObject::invokeMethod(
|
||||
object, [promise, method = std::move(method)]() mutable { promise.setResultFrom(std::move(method)); });
|
||||
|
||||
@@ -134,8 +134,8 @@ namespace swift::misc::Iterators
|
||||
};
|
||||
|
||||
//! The type returned by this iterator's arrow operator, which may be a pointer or a pointer-like wrapper object
|
||||
using pointer = typename std::conditional<std::is_reference_v<undecayed_type>,
|
||||
std::remove_reference_t<undecayed_type> *, PointerWrapper>::type;
|
||||
using pointer = std::conditional_t<std::is_reference_v<undecayed_type>,
|
||||
std::remove_reference_t<undecayed_type> *, PointerWrapper>;
|
||||
|
||||
//! Constructor.
|
||||
TransformIterator(I iterator, F function) : m_iterator(iterator), m_function(function) {}
|
||||
|
||||
@@ -14,106 +14,103 @@
|
||||
#include "misc/propertyindexref.h"
|
||||
#include "misc/variant.h"
|
||||
|
||||
namespace swift::misc
|
||||
namespace swift::misc::mixin
|
||||
{
|
||||
namespace mixin
|
||||
/*!
|
||||
* CRTP class template from which a derived class can inherit common methods dealing with the metatype of the
|
||||
* class.
|
||||
*
|
||||
* \see SWIFT_MISC_DECLARE_USING_MIXIN_METATYPE
|
||||
*/
|
||||
template <class Derived>
|
||||
class MetaType
|
||||
{
|
||||
/*!
|
||||
* CRTP class template from which a derived class can inherit common methods dealing with the metatype of the
|
||||
* class.
|
||||
*
|
||||
* \see SWIFT_MISC_DECLARE_USING_MIXIN_METATYPE
|
||||
*/
|
||||
template <class Derived>
|
||||
class MetaType
|
||||
{
|
||||
public:
|
||||
//! Register metadata
|
||||
static void registerMetadata();
|
||||
public:
|
||||
//! Register metadata
|
||||
static void registerMetadata();
|
||||
|
||||
//! Returns the Qt meta type ID of this object
|
||||
//! \remark for CVariant this returns the id of CVariant, not of the encapsulated object.
|
||||
//! valueVariant.userType()` returns metatype of the contained object
|
||||
int getMetaTypeId() const;
|
||||
//! Returns the Qt meta type ID of this object
|
||||
//! \remark for CVariant this returns the id of CVariant, not of the encapsulated object.
|
||||
//! valueVariant.userType()` returns metatype of the contained object
|
||||
int getMetaTypeId() const;
|
||||
|
||||
//! Class name
|
||||
QString getClassName() const;
|
||||
//! Class name
|
||||
QString getClassName() const;
|
||||
|
||||
//! Returns true if this object is an instance of the class with the given meta type ID, or one of its
|
||||
//! subclasses.
|
||||
bool isA(int metaTypeId) const;
|
||||
//! Returns true if this object is an instance of the class with the given meta type ID, or one of its
|
||||
//! subclasses.
|
||||
bool isA(int metaTypeId) const;
|
||||
|
||||
private:
|
||||
const Derived *derived() const;
|
||||
Derived *derived();
|
||||
private:
|
||||
const Derived *derived() const;
|
||||
Derived *derived();
|
||||
|
||||
template <typename Base2>
|
||||
static bool baseIsA(const Base2 *base, int metaTypeId);
|
||||
static bool baseIsA(const void *, int);
|
||||
};
|
||||
|
||||
template <class Derived>
|
||||
void MetaType<Derived>::registerMetadata()
|
||||
{
|
||||
private_ns::MetaTypeHelper<Derived>::maybeRegisterMetaType();
|
||||
}
|
||||
|
||||
template <class Derived>
|
||||
int MetaType<Derived>::getMetaTypeId() const
|
||||
{
|
||||
return private_ns::MetaTypeHelper<Derived>::maybeGetMetaTypeId();
|
||||
}
|
||||
|
||||
template <class Derived>
|
||||
QString MetaType<Derived>::getClassName() const
|
||||
{
|
||||
return QMetaType(getMetaTypeId()).name();
|
||||
}
|
||||
|
||||
template <class Derived>
|
||||
bool MetaType<Derived>::isA(int metaTypeId) const
|
||||
{
|
||||
if (metaTypeId == QMetaType::UnknownType) { return false; }
|
||||
if (metaTypeId == getMetaTypeId()) { return true; }
|
||||
return baseIsA(static_cast<const TMetaBaseOfT<Derived> *>(derived()), metaTypeId);
|
||||
}
|
||||
|
||||
template <class Derived>
|
||||
const Derived *MetaType<Derived>::derived() const
|
||||
{
|
||||
return static_cast<const Derived *>(this);
|
||||
}
|
||||
|
||||
template <class Derived>
|
||||
Derived *MetaType<Derived>::derived()
|
||||
{
|
||||
return static_cast<Derived *>(this);
|
||||
}
|
||||
|
||||
template <class Derived>
|
||||
template <typename Base2>
|
||||
bool MetaType<Derived>::baseIsA(const Base2 *base, int metaTypeId)
|
||||
{
|
||||
return base->isA(metaTypeId);
|
||||
}
|
||||
static bool baseIsA(const Base2 *base, int metaTypeId);
|
||||
static bool baseIsA(const void *, int);
|
||||
};
|
||||
|
||||
template <class Derived>
|
||||
bool MetaType<Derived>::baseIsA(const void *, int)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
template <class Derived>
|
||||
void MetaType<Derived>::registerMetadata()
|
||||
{
|
||||
private_ns::MetaTypeHelper<Derived>::maybeRegisterMetaType();
|
||||
}
|
||||
|
||||
/*!
|
||||
* When a derived class and a base class both inherit from mixin::MetaType,
|
||||
* the derived class uses this macro to disambiguate the inherited members.
|
||||
*/
|
||||
template <class Derived>
|
||||
int MetaType<Derived>::getMetaTypeId() const
|
||||
{
|
||||
return private_ns::MetaTypeHelper<Derived>::maybeGetMetaTypeId();
|
||||
}
|
||||
|
||||
template <class Derived>
|
||||
QString MetaType<Derived>::getClassName() const
|
||||
{
|
||||
return QMetaType(getMetaTypeId()).name();
|
||||
}
|
||||
|
||||
template <class Derived>
|
||||
bool MetaType<Derived>::isA(int metaTypeId) const
|
||||
{
|
||||
if (metaTypeId == QMetaType::UnknownType) { return false; }
|
||||
if (metaTypeId == getMetaTypeId()) { return true; }
|
||||
return baseIsA(static_cast<const TMetaBaseOfT<Derived> *>(derived()), metaTypeId);
|
||||
}
|
||||
|
||||
template <class Derived>
|
||||
const Derived *MetaType<Derived>::derived() const
|
||||
{
|
||||
return static_cast<const Derived *>(this);
|
||||
}
|
||||
|
||||
template <class Derived>
|
||||
Derived *MetaType<Derived>::derived()
|
||||
{
|
||||
return static_cast<Derived *>(this);
|
||||
}
|
||||
|
||||
template <class Derived>
|
||||
template <typename Base2>
|
||||
bool MetaType<Derived>::baseIsA(const Base2 *base, int metaTypeId)
|
||||
{
|
||||
return base->isA(metaTypeId);
|
||||
}
|
||||
|
||||
template <class Derived>
|
||||
bool MetaType<Derived>::baseIsA(const void *, int)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/*!
|
||||
* When a derived class and a base class both inherit from mixin::MetaType,
|
||||
* the derived class uses this macro to disambiguate the inherited members.
|
||||
*/
|
||||
#define SWIFT_MISC_DECLARE_USING_MIXIN_METATYPE(DERIVED) \
|
||||
using ::swift::misc::mixin::MetaType<DERIVED>::registerMetadata; \
|
||||
using ::swift::misc::mixin::MetaType<DERIVED>::getMetaTypeId; \
|
||||
using ::swift::misc::mixin::MetaType<DERIVED>::getClassName; \
|
||||
using ::swift::misc::mixin::MetaType<DERIVED>::isA;
|
||||
|
||||
} // namespace mixin
|
||||
} // namespace swift::misc
|
||||
} // namespace swift::misc::mixin
|
||||
|
||||
#endif // SWIFT_MISC_MIXIN_MIXINMETATYPE_H
|
||||
|
||||
@@ -124,7 +124,7 @@ namespace swift::misc::network
|
||||
bool CClientProvider::setClientGndCapability(const CCallsign &callsign, bool supportGndFlag)
|
||||
{
|
||||
SWIFT_VERIFY_X(!callsign.isEmpty(), Q_FUNC_INFO, "Missing client callsign");
|
||||
if (callsign.isEmpty()) { return 0; }
|
||||
if (callsign.isEmpty()) { return false; }
|
||||
|
||||
CClient client = this->getClientOrDefaultForCallsign(callsign);
|
||||
|
||||
|
||||
@@ -157,7 +157,7 @@ namespace swift::misc
|
||||
|
||||
protected:
|
||||
//! Default constructor
|
||||
CClientAware() {}
|
||||
CClientAware() {} // NOLINT(modernize-use-equals-default)
|
||||
|
||||
//! Constructor
|
||||
CClientAware(IClientProvider *clientProvider) : IProviderAware(clientProvider) {}
|
||||
|
||||
@@ -138,7 +138,7 @@ namespace swift::misc::network
|
||||
|
||||
private:
|
||||
//! Hidden constructor
|
||||
CNetworkUtils() {}
|
||||
CNetworkUtils() {} // NOLINT(modernize-use-equals-default)
|
||||
};
|
||||
} // namespace swift::misc::network
|
||||
|
||||
|
||||
@@ -31,41 +31,37 @@
|
||||
#include "misc/network/userlist.h"
|
||||
#include "misc/network/voicecapabilities.h"
|
||||
|
||||
namespace swift::misc
|
||||
namespace swift::misc::network
|
||||
{
|
||||
namespace network
|
||||
void registerMetadata()
|
||||
{
|
||||
void registerMetadata()
|
||||
{
|
||||
CAuthenticatedUser::registerMetadata();
|
||||
CConnectionStatus::registerMetadata();
|
||||
CClient::registerMetadata();
|
||||
qDBusRegisterMetaType<swift::misc::network::CClient::Capability>();
|
||||
qDBusRegisterMetaType<swift::misc::network::CClient::Capabilities>();
|
||||
CClientList::registerMetadata();
|
||||
CEcosystem::registerMetadata();
|
||||
CEcosystemList::registerMetadata();
|
||||
CEntityFlags::registerMetadata();
|
||||
CFacilityType::registerMetadata();
|
||||
CFsdSetup::registerMetadata();
|
||||
CLoginMode::registerMetadata();
|
||||
CRawFsdMessage::registerMetadata();
|
||||
CRawFsdMessageList::registerMetadata();
|
||||
CRemoteFile::registerMetadata();
|
||||
CRemoteFileList::registerMetadata();
|
||||
CRole::registerMetadata();
|
||||
CRoleList::registerMetadata();
|
||||
CServer::registerMetadata();
|
||||
CServerList::registerMetadata();
|
||||
CTextMessage::registerMetadata();
|
||||
CTextMessageList::registerMetadata();
|
||||
CUrl::registerMetadata();
|
||||
CUrlLog::registerMetadata();
|
||||
CUrlLogList::registerMetadata();
|
||||
CUser::registerMetadata();
|
||||
CUserList::registerMetadata();
|
||||
CVoiceCapabilities::registerMetadata();
|
||||
}
|
||||
} // namespace network
|
||||
|
||||
} // namespace swift::misc
|
||||
CAuthenticatedUser::registerMetadata();
|
||||
CConnectionStatus::registerMetadata();
|
||||
CClient::registerMetadata();
|
||||
qDBusRegisterMetaType<swift::misc::network::CClient::Capability>();
|
||||
qDBusRegisterMetaType<swift::misc::network::CClient::Capabilities>();
|
||||
CClientList::registerMetadata();
|
||||
CEcosystem::registerMetadata();
|
||||
CEcosystemList::registerMetadata();
|
||||
CEntityFlags::registerMetadata();
|
||||
CFacilityType::registerMetadata();
|
||||
CFsdSetup::registerMetadata();
|
||||
CLoginMode::registerMetadata();
|
||||
CRawFsdMessage::registerMetadata();
|
||||
CRawFsdMessageList::registerMetadata();
|
||||
CRemoteFile::registerMetadata();
|
||||
CRemoteFileList::registerMetadata();
|
||||
CRole::registerMetadata();
|
||||
CRoleList::registerMetadata();
|
||||
CServer::registerMetadata();
|
||||
CServerList::registerMetadata();
|
||||
CTextMessage::registerMetadata();
|
||||
CTextMessageList::registerMetadata();
|
||||
CUrl::registerMetadata();
|
||||
CUrlLog::registerMetadata();
|
||||
CUrlLogList::registerMetadata();
|
||||
CUser::registerMetadata();
|
||||
CUserList::registerMetadata();
|
||||
CVoiceCapabilities::registerMetadata();
|
||||
}
|
||||
} // namespace swift::misc::network
|
||||
@@ -117,8 +117,8 @@ namespace swift::misc
|
||||
}
|
||||
union Data
|
||||
{
|
||||
Data() {}
|
||||
~Data() {}
|
||||
Data() {} // NOLINT(modernize-use-equals-default)
|
||||
~Data() {} // NOLINT(modernize-use-equals-default)
|
||||
char bytes[sizeof(T)];
|
||||
T object;
|
||||
};
|
||||
|
||||
@@ -242,9 +242,6 @@ namespace swift::misc::physical_quantities
|
||||
//! Constructor
|
||||
CMeasurementUnit(const Data &data) : m_data(&data) {}
|
||||
|
||||
//! Constructor saves the address of its argument, so forbid rvalues
|
||||
CMeasurementUnit(const Data &&) = delete;
|
||||
|
||||
//! Destructor
|
||||
~CMeasurementUnit() = default;
|
||||
|
||||
@@ -258,6 +255,9 @@ namespace swift::misc::physical_quantities
|
||||
const Data *m_data = (static_cast<void>(throw std::logic_error("Uninitialized pimpl")), nullptr);
|
||||
|
||||
public:
|
||||
//! Constructor saves the address of its argument, so forbid rvalues
|
||||
CMeasurementUnit(const Data &&) = delete;
|
||||
|
||||
//! \copydoc swift::misc::mixin::String::toQString
|
||||
QString convertToQString(bool i18n = false) const { return this->getSymbol(i18n); }
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace swift::misc::physical_quantities
|
||||
// check
|
||||
if (vs.isEmpty()) { return v; }
|
||||
|
||||
thread_local const QRegularExpression regex("([-+]?[0-9]*[\\.,]?[0-9]+)\\s*(\\D*)$");
|
||||
thread_local const QRegularExpression regex(R"(([-+]?[0-9]*[\.,]?[0-9]+)\s*(\D*)$)");
|
||||
const auto match = regex.match(value);
|
||||
if (!match.hasMatch()) { return v; } // not a valid number
|
||||
QString unit = match.captured(2).trimmed();
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
namespace swift::misc
|
||||
{
|
||||
CPropertyIndexRef::CPropertyIndexRef(int index) : m_begin(nullptr), m_sizeOrIndex(index) {}
|
||||
CPropertyIndexRef::CPropertyIndexRef(int index) : m_sizeOrIndex(index) {}
|
||||
|
||||
CPropertyIndexRef::CPropertyIndexRef(const QVector<int> &indexes)
|
||||
: m_begin(indexes.data()), m_sizeOrIndex(indexes.size())
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace swift::misc
|
||||
|
||||
protected:
|
||||
//! Constructor
|
||||
IProvider() {}
|
||||
IProvider() {} // NOLINT(modernize-use-equals-default)
|
||||
};
|
||||
|
||||
//! Base class of provider aware classes
|
||||
|
||||
@@ -191,16 +191,16 @@ namespace swift::misc
|
||||
public:
|
||||
//! @{
|
||||
//! STL compatibility
|
||||
typedef typename std::iterator_traits<I>::value_type value_type;
|
||||
typedef typename std::iterator_traits<I>::reference reference;
|
||||
typedef typename std::iterator_traits<I>::difference_type difference_type;
|
||||
typedef const value_type &const_reference;
|
||||
typedef value_type key_type;
|
||||
typedef difference_type size_type;
|
||||
typedef I iterator;
|
||||
typedef I const_iterator;
|
||||
typedef std::reverse_iterator<I> reverse_iterator;
|
||||
typedef std::reverse_iterator<I> const_reverse_iterator;
|
||||
using value_type = typename std::iterator_traits<I>::value_type;
|
||||
using reference = typename std::iterator_traits<I>::reference;
|
||||
using difference_type = typename std::iterator_traits<I>::difference_type;
|
||||
using const_reference = const value_type &;
|
||||
using key_type = value_type;
|
||||
using size_type = difference_type;
|
||||
using iterator = I;
|
||||
using const_iterator = I;
|
||||
using reverse_iterator = std::reverse_iterator<I>;
|
||||
using const_reverse_iterator = std::reverse_iterator<I>;
|
||||
//! @}
|
||||
|
||||
//! Constructor.
|
||||
@@ -225,7 +225,7 @@ namespace swift::misc
|
||||
//! Create a range from reverse iterators.
|
||||
CRange<const_reverse_iterator> reverse() const
|
||||
{
|
||||
static_assert(std::is_same_v<decltype(*rbegin()), decltype(*begin())>, "");
|
||||
static_assert(std::is_same_v<decltype(*rbegin()), decltype(*begin())>);
|
||||
return { rbegin(), rend() };
|
||||
}
|
||||
|
||||
|
||||
@@ -86,40 +86,40 @@ namespace swift::misc
|
||||
{
|
||||
public:
|
||||
//! STL compatibility
|
||||
typedef T key_type;
|
||||
using key_type = T;
|
||||
|
||||
//! STL compatilibty
|
||||
typedef T value_type;
|
||||
using value_type = T;
|
||||
|
||||
//! STL compatibility
|
||||
typedef T &reference;
|
||||
using reference = T &;
|
||||
|
||||
//! STL compatibility
|
||||
typedef const T &const_reference;
|
||||
using const_reference = const T &;
|
||||
|
||||
//! STL compatibility
|
||||
typedef T *pointer;
|
||||
using pointer = T *;
|
||||
|
||||
//! STL compatibility
|
||||
typedef const T *const_pointer;
|
||||
using const_pointer = const T *;
|
||||
|
||||
//! STL compatibility
|
||||
typedef typename QVector<T>::const_iterator const_iterator;
|
||||
using const_iterator = typename QVector<T>::const_iterator;
|
||||
|
||||
//! STL compatibility
|
||||
typedef typename QVector<T>::iterator iterator;
|
||||
using iterator = typename QVector<T>::iterator;
|
||||
|
||||
//! STL compatibility
|
||||
typedef typename QVector<T>::const_reverse_iterator const_reverse_iterator;
|
||||
using const_reverse_iterator = typename QVector<T>::const_reverse_iterator;
|
||||
|
||||
//! STL compatibility
|
||||
typedef typename QVector<T>::reverse_iterator reverse_iterator;
|
||||
using reverse_iterator = typename QVector<T>::reverse_iterator;
|
||||
|
||||
//! STL compatibility
|
||||
typedef ptrdiff_t difference_type;
|
||||
using difference_type = ptrdiff_t;
|
||||
|
||||
//! STL compatibility
|
||||
typedef int size_type;
|
||||
using size_type = int;
|
||||
|
||||
//! Default constructor.
|
||||
CSequence() = default;
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace swift::misc::simulation::flightgear
|
||||
if (CBuildConfig::isRunningOnWindowsNtPlatform())
|
||||
{
|
||||
QSettings flightgearRegistry(
|
||||
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\FlightGear_is1",
|
||||
R"(HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\FlightGear_is1)",
|
||||
QSettings::NativeFormat);
|
||||
flightgearRootDir = flightgearRegistry.value("InstallLocation").toString().trimmed();
|
||||
}
|
||||
|
||||
@@ -689,7 +689,7 @@ namespace swift::misc::simulation
|
||||
|
||||
protected:
|
||||
//! Default constructor
|
||||
CRemoteAircraftAware() {}
|
||||
CRemoteAircraftAware() {} // NOLINT(modernize-use-equals-default)
|
||||
|
||||
//! Constructor
|
||||
CRemoteAircraftAware(IRemoteAircraftProvider *remoteAircraftProvider) : IProviderAware(remoteAircraftProvider)
|
||||
|
||||
@@ -31,218 +31,209 @@ constexpr char swift::misc::simulation::settings::CXSwiftBusSettingsQtFree::Json
|
||||
constexpr char swift::misc::simulation::settings::CXSwiftBusSettingsQtFree::JsonLogRenderPhases[];
|
||||
//! @endcond
|
||||
|
||||
namespace swift::misc
|
||||
namespace swift::misc::simulation::settings
|
||||
{
|
||||
namespace simulation
|
||||
bool CXSwiftBusSettingsQtFree::parseXSwiftBusString(const std::string &json)
|
||||
{
|
||||
namespace settings
|
||||
if (json.empty()) { return false; }
|
||||
|
||||
const nlohmann::basic_json parsed = nlohmann::json::parse(json, nullptr, false);
|
||||
|
||||
if (parsed.is_discarded()) { return false; }
|
||||
|
||||
int c = 0;
|
||||
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonDBusServerAddress) &&
|
||||
parsed[CXSwiftBusSettingsQtFree::JsonDBusServerAddress].is_string())
|
||||
{
|
||||
bool CXSwiftBusSettingsQtFree::parseXSwiftBusString(const std::string &json)
|
||||
{
|
||||
if (json.empty()) { return false; }
|
||||
m_dBusServerAddress = parsed[CXSwiftBusSettingsQtFree::JsonDBusServerAddress].get<std::string>();
|
||||
c++;
|
||||
}
|
||||
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonMessageBox) &&
|
||||
parsed[CXSwiftBusSettingsQtFree::JsonMessageBox].is_string())
|
||||
{
|
||||
m_msgBox = parsed[CXSwiftBusSettingsQtFree::JsonMessageBox].get<std::string>();
|
||||
c++;
|
||||
}
|
||||
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonNightTextureMode) &&
|
||||
parsed[CXSwiftBusSettingsQtFree::JsonNightTextureMode].is_string())
|
||||
{
|
||||
m_nightTextureMode = parsed[CXSwiftBusSettingsQtFree::JsonNightTextureMode].get<std::string>();
|
||||
c++;
|
||||
}
|
||||
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonDrawingLabels) &&
|
||||
parsed[CXSwiftBusSettingsQtFree::JsonDrawingLabels].is_boolean())
|
||||
{
|
||||
m_drawingLabels = parsed[CXSwiftBusSettingsQtFree::JsonDrawingLabels].get<bool>();
|
||||
c++;
|
||||
}
|
||||
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonLabelColor) &&
|
||||
parsed[CXSwiftBusSettingsQtFree::JsonLabelColor].is_number_integer())
|
||||
{
|
||||
m_labelColor = parsed[CXSwiftBusSettingsQtFree::JsonLabelColor].get<int>();
|
||||
c++;
|
||||
}
|
||||
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonBundleTaxiLandingLights) &&
|
||||
parsed[CXSwiftBusSettingsQtFree::JsonBundleTaxiLandingLights].is_boolean())
|
||||
{
|
||||
m_bundleTaxiLandingLights = parsed[CXSwiftBusSettingsQtFree::JsonBundleTaxiLandingLights].get<bool>();
|
||||
c++;
|
||||
}
|
||||
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonTcas) &&
|
||||
parsed[CXSwiftBusSettingsQtFree::JsonTcas].is_boolean())
|
||||
{
|
||||
m_tcasEnabled = parsed[CXSwiftBusSettingsQtFree::JsonTcas].get<bool>();
|
||||
c++;
|
||||
}
|
||||
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonTerrainProbe) &&
|
||||
parsed[CXSwiftBusSettingsQtFree::JsonTerrainProbe].is_boolean())
|
||||
{
|
||||
m_terrainProbeEnabled = parsed[CXSwiftBusSettingsQtFree::JsonTerrainProbe].get<bool>();
|
||||
c++;
|
||||
}
|
||||
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonLogRenderPhases) &&
|
||||
parsed[CXSwiftBusSettingsQtFree::JsonLogRenderPhases].is_boolean())
|
||||
{
|
||||
m_logRenderPhases = parsed[CXSwiftBusSettingsQtFree::JsonLogRenderPhases].get<bool>();
|
||||
c++;
|
||||
}
|
||||
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonMaxPlanes) &&
|
||||
parsed[CXSwiftBusSettingsQtFree::JsonMaxPlanes].is_number_integer())
|
||||
{
|
||||
m_maxPlanes = parsed[CXSwiftBusSettingsQtFree::JsonMaxPlanes].get<int>();
|
||||
c++;
|
||||
}
|
||||
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonMaxDrawDistance) &&
|
||||
parsed[CXSwiftBusSettingsQtFree::JsonMaxDrawDistance].is_number_float())
|
||||
{
|
||||
m_maxDrawDistanceNM = parsed[CXSwiftBusSettingsQtFree::JsonMaxDrawDistance].get<double>();
|
||||
c++;
|
||||
}
|
||||
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonFollowAircraftDistanceM) &&
|
||||
parsed[CXSwiftBusSettingsQtFree::JsonFollowAircraftDistanceM].is_number_integer())
|
||||
{
|
||||
m_followAircraftDistanceM = parsed[CXSwiftBusSettingsQtFree::JsonFollowAircraftDistanceM].get<int>();
|
||||
c++;
|
||||
}
|
||||
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonTimestamp) &&
|
||||
parsed[CXSwiftBusSettingsQtFree::JsonTimestamp].is_number_integer())
|
||||
{
|
||||
m_msSinceEpochQtFree = parsed[CXSwiftBusSettingsQtFree::JsonTimestamp].get<int64_t>();
|
||||
c++;
|
||||
}
|
||||
this->objectUpdated(); // post processing
|
||||
return c == 13;
|
||||
}
|
||||
|
||||
const nlohmann::basic_json parsed = nlohmann::json::parse(json, nullptr, false);
|
||||
std::string CXSwiftBusSettingsQtFree::toXSwiftBusJsonString() const
|
||||
{
|
||||
nlohmann::json json;
|
||||
|
||||
if (parsed.is_discarded()) { return false; }
|
||||
json[JsonDBusServerAddress] = m_dBusServerAddress;
|
||||
json[JsonNightTextureMode] = m_nightTextureMode;
|
||||
json[JsonMessageBox] = m_msgBox;
|
||||
json[JsonMaxPlanes] = m_maxPlanes;
|
||||
json[JsonMaxDrawDistance] = m_maxDrawDistanceNM;
|
||||
json[JsonTimestamp] = m_msSinceEpochQtFree;
|
||||
json[JsonDrawingLabels] = m_drawingLabels;
|
||||
json[JsonLabelColor] = m_labelColor;
|
||||
json[JsonBundleTaxiLandingLights] = m_bundleTaxiLandingLights;
|
||||
json[JsonFollowAircraftDistanceM] = m_followAircraftDistanceM;
|
||||
json[JsonLogRenderPhases] = m_logRenderPhases;
|
||||
json[JsonTcas] = m_tcasEnabled;
|
||||
json[JsonTerrainProbe] = m_terrainProbeEnabled;
|
||||
|
||||
int c = 0;
|
||||
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonDBusServerAddress) &&
|
||||
parsed[CXSwiftBusSettingsQtFree::JsonDBusServerAddress].is_string())
|
||||
{
|
||||
m_dBusServerAddress = parsed[CXSwiftBusSettingsQtFree::JsonDBusServerAddress].get<std::string>();
|
||||
c++;
|
||||
}
|
||||
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonMessageBox) &&
|
||||
parsed[CXSwiftBusSettingsQtFree::JsonMessageBox].is_string())
|
||||
{
|
||||
m_msgBox = parsed[CXSwiftBusSettingsQtFree::JsonMessageBox].get<std::string>();
|
||||
c++;
|
||||
}
|
||||
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonNightTextureMode) &&
|
||||
parsed[CXSwiftBusSettingsQtFree::JsonNightTextureMode].is_string())
|
||||
{
|
||||
m_nightTextureMode = parsed[CXSwiftBusSettingsQtFree::JsonNightTextureMode].get<std::string>();
|
||||
c++;
|
||||
}
|
||||
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonDrawingLabels) &&
|
||||
parsed[CXSwiftBusSettingsQtFree::JsonDrawingLabels].is_boolean())
|
||||
{
|
||||
m_drawingLabels = parsed[CXSwiftBusSettingsQtFree::JsonDrawingLabels].get<bool>();
|
||||
c++;
|
||||
}
|
||||
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonLabelColor) &&
|
||||
parsed[CXSwiftBusSettingsQtFree::JsonLabelColor].is_number_integer())
|
||||
{
|
||||
m_labelColor = parsed[CXSwiftBusSettingsQtFree::JsonLabelColor].get<int>();
|
||||
c++;
|
||||
}
|
||||
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonBundleTaxiLandingLights) &&
|
||||
parsed[CXSwiftBusSettingsQtFree::JsonBundleTaxiLandingLights].is_boolean())
|
||||
{
|
||||
m_bundleTaxiLandingLights =
|
||||
parsed[CXSwiftBusSettingsQtFree::JsonBundleTaxiLandingLights].get<bool>();
|
||||
c++;
|
||||
}
|
||||
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonTcas) &&
|
||||
parsed[CXSwiftBusSettingsQtFree::JsonTcas].is_boolean())
|
||||
{
|
||||
m_tcasEnabled = parsed[CXSwiftBusSettingsQtFree::JsonTcas].get<bool>();
|
||||
c++;
|
||||
}
|
||||
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonTerrainProbe) &&
|
||||
parsed[CXSwiftBusSettingsQtFree::JsonTerrainProbe].is_boolean())
|
||||
{
|
||||
m_terrainProbeEnabled = parsed[CXSwiftBusSettingsQtFree::JsonTerrainProbe].get<bool>();
|
||||
c++;
|
||||
}
|
||||
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonLogRenderPhases) &&
|
||||
parsed[CXSwiftBusSettingsQtFree::JsonLogRenderPhases].is_boolean())
|
||||
{
|
||||
m_logRenderPhases = parsed[CXSwiftBusSettingsQtFree::JsonLogRenderPhases].get<bool>();
|
||||
c++;
|
||||
}
|
||||
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonMaxPlanes) &&
|
||||
parsed[CXSwiftBusSettingsQtFree::JsonMaxPlanes].is_number_integer())
|
||||
{
|
||||
m_maxPlanes = parsed[CXSwiftBusSettingsQtFree::JsonMaxPlanes].get<int>();
|
||||
c++;
|
||||
}
|
||||
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonMaxDrawDistance) &&
|
||||
parsed[CXSwiftBusSettingsQtFree::JsonMaxDrawDistance].is_number_float())
|
||||
{
|
||||
m_maxDrawDistanceNM = parsed[CXSwiftBusSettingsQtFree::JsonMaxDrawDistance].get<double>();
|
||||
c++;
|
||||
}
|
||||
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonFollowAircraftDistanceM) &&
|
||||
parsed[CXSwiftBusSettingsQtFree::JsonFollowAircraftDistanceM].is_number_integer())
|
||||
{
|
||||
m_followAircraftDistanceM =
|
||||
parsed[CXSwiftBusSettingsQtFree::JsonFollowAircraftDistanceM].get<int>();
|
||||
c++;
|
||||
}
|
||||
if (parsed.contains(CXSwiftBusSettingsQtFree::JsonTimestamp) &&
|
||||
parsed[CXSwiftBusSettingsQtFree::JsonTimestamp].is_number_integer())
|
||||
{
|
||||
m_msSinceEpochQtFree = parsed[CXSwiftBusSettingsQtFree::JsonTimestamp].get<int64_t>();
|
||||
c++;
|
||||
}
|
||||
this->objectUpdated(); // post processing
|
||||
return c == 13;
|
||||
}
|
||||
return json.dump(2);
|
||||
}
|
||||
|
||||
std::string CXSwiftBusSettingsQtFree::toXSwiftBusJsonString() const
|
||||
{
|
||||
nlohmann::json json;
|
||||
std::string CXSwiftBusSettingsQtFree::convertToString() const
|
||||
{
|
||||
return "DBusServer: " + m_dBusServerAddress + ", drawLabels: " + qtfreeutils::boolToYesNo(m_drawingLabels) +
|
||||
", labelColor: " + std::to_string((m_labelColor >> 16) & 0xff) + ";" +
|
||||
std::to_string((m_labelColor >> 8) & 0xff) + ";" + std::to_string(m_labelColor & 0xff) +
|
||||
", bundle lights: " + qtfreeutils::boolToYesNo(m_bundleTaxiLandingLights) +
|
||||
", phases: " + qtfreeutils::boolToYesNo(m_logRenderPhases) +
|
||||
", TCAS: " + qtfreeutils::boolToYesNo(m_tcasEnabled) +
|
||||
", terr.probe: " + qtfreeutils::boolToYesNo(m_terrainProbeEnabled) +
|
||||
", night t.: " + m_nightTextureMode + ", max planes: " + std::to_string(m_maxPlanes) +
|
||||
", max distance NM: " + std::to_string(m_maxDrawDistanceNM) +
|
||||
", follow dist m: " + std::to_string(m_followAircraftDistanceM) + ", msg.box: " + m_msgBox +
|
||||
", ts: " + std::to_string(m_msSinceEpochQtFree);
|
||||
}
|
||||
|
||||
json[JsonDBusServerAddress] = m_dBusServerAddress;
|
||||
json[JsonNightTextureMode] = m_nightTextureMode;
|
||||
json[JsonMessageBox] = m_msgBox;
|
||||
json[JsonMaxPlanes] = m_maxPlanes;
|
||||
json[JsonMaxDrawDistance] = m_maxDrawDistanceNM;
|
||||
json[JsonTimestamp] = m_msSinceEpochQtFree;
|
||||
json[JsonDrawingLabels] = m_drawingLabels;
|
||||
json[JsonLabelColor] = m_labelColor;
|
||||
json[JsonBundleTaxiLandingLights] = m_bundleTaxiLandingLights;
|
||||
json[JsonFollowAircraftDistanceM] = m_followAircraftDistanceM;
|
||||
json[JsonLogRenderPhases] = m_logRenderPhases;
|
||||
json[JsonTcas] = m_tcasEnabled;
|
||||
json[JsonTerrainProbe] = m_terrainProbeEnabled;
|
||||
int CXSwiftBusSettingsQtFree::update(const CXSwiftBusSettingsQtFree &newValues)
|
||||
{
|
||||
int changed = 0;
|
||||
if (m_dBusServerAddress != newValues.m_dBusServerAddress)
|
||||
{
|
||||
m_dBusServerAddress = newValues.m_dBusServerAddress;
|
||||
changed++;
|
||||
}
|
||||
if (m_msgBox != newValues.m_msgBox)
|
||||
{
|
||||
m_msgBox = newValues.m_msgBox;
|
||||
changed++;
|
||||
}
|
||||
if (m_drawingLabels != newValues.m_drawingLabels)
|
||||
{
|
||||
m_drawingLabels = newValues.m_drawingLabels;
|
||||
changed++;
|
||||
}
|
||||
if (m_labelColor != newValues.m_labelColor)
|
||||
{
|
||||
m_labelColor = newValues.m_labelColor;
|
||||
changed++;
|
||||
}
|
||||
if (m_nightTextureMode != newValues.m_nightTextureMode)
|
||||
{
|
||||
m_nightTextureMode = newValues.m_nightTextureMode;
|
||||
changed++;
|
||||
}
|
||||
if (m_logRenderPhases != newValues.m_logRenderPhases)
|
||||
{
|
||||
m_logRenderPhases = newValues.m_logRenderPhases;
|
||||
changed++;
|
||||
}
|
||||
if (m_tcasEnabled != newValues.m_tcasEnabled)
|
||||
{
|
||||
m_tcasEnabled = newValues.m_tcasEnabled;
|
||||
changed++;
|
||||
}
|
||||
if (m_terrainProbeEnabled != newValues.m_terrainProbeEnabled)
|
||||
{
|
||||
m_terrainProbeEnabled = newValues.m_terrainProbeEnabled;
|
||||
changed++;
|
||||
}
|
||||
if (m_maxPlanes != newValues.m_maxPlanes)
|
||||
{
|
||||
m_maxPlanes = newValues.m_maxPlanes;
|
||||
changed++;
|
||||
}
|
||||
if (m_msSinceEpochQtFree != newValues.m_msSinceEpochQtFree)
|
||||
{
|
||||
m_msSinceEpochQtFree = newValues.m_msSinceEpochQtFree;
|
||||
changed++;
|
||||
}
|
||||
if (m_bundleTaxiLandingLights != newValues.m_bundleTaxiLandingLights)
|
||||
{
|
||||
m_bundleTaxiLandingLights = newValues.m_bundleTaxiLandingLights;
|
||||
changed++;
|
||||
}
|
||||
if (m_followAircraftDistanceM != newValues.m_followAircraftDistanceM)
|
||||
{
|
||||
m_followAircraftDistanceM = newValues.m_followAircraftDistanceM;
|
||||
changed++;
|
||||
}
|
||||
if (!qtfreeutils::isFuzzyEqual(m_maxDrawDistanceNM, newValues.m_maxDrawDistanceNM))
|
||||
{
|
||||
m_maxDrawDistanceNM = newValues.m_maxDrawDistanceNM;
|
||||
changed++;
|
||||
}
|
||||
|
||||
return json.dump(2);
|
||||
}
|
||||
if (changed > 0) { this->objectUpdated(); } // post processing
|
||||
return changed;
|
||||
}
|
||||
|
||||
std::string CXSwiftBusSettingsQtFree::convertToString() const
|
||||
{
|
||||
return "DBusServer: " + m_dBusServerAddress +
|
||||
", drawLabels: " + qtfreeutils::boolToYesNo(m_drawingLabels) +
|
||||
", labelColor: " + std::to_string((m_labelColor >> 16) & 0xff) + ";" +
|
||||
std::to_string((m_labelColor >> 8) & 0xff) + ";" + std::to_string(m_labelColor & 0xff) +
|
||||
", bundle lights: " + qtfreeutils::boolToYesNo(m_bundleTaxiLandingLights) +
|
||||
", phases: " + qtfreeutils::boolToYesNo(m_logRenderPhases) +
|
||||
", TCAS: " + qtfreeutils::boolToYesNo(m_tcasEnabled) +
|
||||
", terr.probe: " + qtfreeutils::boolToYesNo(m_terrainProbeEnabled) +
|
||||
", night t.: " + m_nightTextureMode + ", max planes: " + std::to_string(m_maxPlanes) +
|
||||
", max distance NM: " + std::to_string(m_maxDrawDistanceNM) +
|
||||
", follow dist m: " + std::to_string(m_followAircraftDistanceM) + ", msg.box: " + m_msgBox +
|
||||
", ts: " + std::to_string(m_msSinceEpochQtFree);
|
||||
}
|
||||
|
||||
int CXSwiftBusSettingsQtFree::update(const CXSwiftBusSettingsQtFree &newValues)
|
||||
{
|
||||
int changed = 0;
|
||||
if (m_dBusServerAddress != newValues.m_dBusServerAddress)
|
||||
{
|
||||
m_dBusServerAddress = newValues.m_dBusServerAddress;
|
||||
changed++;
|
||||
}
|
||||
if (m_msgBox != newValues.m_msgBox)
|
||||
{
|
||||
m_msgBox = newValues.m_msgBox;
|
||||
changed++;
|
||||
}
|
||||
if (m_drawingLabels != newValues.m_drawingLabels)
|
||||
{
|
||||
m_drawingLabels = newValues.m_drawingLabels;
|
||||
changed++;
|
||||
}
|
||||
if (m_labelColor != newValues.m_labelColor)
|
||||
{
|
||||
m_labelColor = newValues.m_labelColor;
|
||||
changed++;
|
||||
}
|
||||
if (m_nightTextureMode != newValues.m_nightTextureMode)
|
||||
{
|
||||
m_nightTextureMode = newValues.m_nightTextureMode;
|
||||
changed++;
|
||||
}
|
||||
if (m_logRenderPhases != newValues.m_logRenderPhases)
|
||||
{
|
||||
m_logRenderPhases = newValues.m_logRenderPhases;
|
||||
changed++;
|
||||
}
|
||||
if (m_tcasEnabled != newValues.m_tcasEnabled)
|
||||
{
|
||||
m_tcasEnabled = newValues.m_tcasEnabled;
|
||||
changed++;
|
||||
}
|
||||
if (m_terrainProbeEnabled != newValues.m_terrainProbeEnabled)
|
||||
{
|
||||
m_terrainProbeEnabled = newValues.m_terrainProbeEnabled;
|
||||
changed++;
|
||||
}
|
||||
if (m_maxPlanes != newValues.m_maxPlanes)
|
||||
{
|
||||
m_maxPlanes = newValues.m_maxPlanes;
|
||||
changed++;
|
||||
}
|
||||
if (m_msSinceEpochQtFree != newValues.m_msSinceEpochQtFree)
|
||||
{
|
||||
m_msSinceEpochQtFree = newValues.m_msSinceEpochQtFree;
|
||||
changed++;
|
||||
}
|
||||
if (m_bundleTaxiLandingLights != newValues.m_bundleTaxiLandingLights)
|
||||
{
|
||||
m_bundleTaxiLandingLights = newValues.m_bundleTaxiLandingLights;
|
||||
changed++;
|
||||
}
|
||||
if (m_followAircraftDistanceM != newValues.m_followAircraftDistanceM)
|
||||
{
|
||||
m_followAircraftDistanceM = newValues.m_followAircraftDistanceM;
|
||||
changed++;
|
||||
}
|
||||
if (!qtfreeutils::isFuzzyEqual(m_maxDrawDistanceNM, newValues.m_maxDrawDistanceNM))
|
||||
{
|
||||
m_maxDrawDistanceNM = newValues.m_maxDrawDistanceNM;
|
||||
changed++;
|
||||
}
|
||||
|
||||
if (changed > 0) { this->objectUpdated(); } // post processing
|
||||
return changed;
|
||||
}
|
||||
|
||||
} // namespace settings
|
||||
} // namespace simulation
|
||||
} // namespace swift::misc
|
||||
} // namespace swift::misc::simulation::settings
|
||||
|
||||
#ifdef __GNUC__
|
||||
# pragma GCC diagnostic pop
|
||||
|
||||
@@ -404,7 +404,7 @@ namespace swift::misc::simulation
|
||||
|
||||
protected:
|
||||
//! Default constructor
|
||||
CSimulationEnvironmentAware() {}
|
||||
CSimulationEnvironmentAware() {} // NOLINT(modernize-use-equals-default)
|
||||
|
||||
//! Constructor
|
||||
CSimulationEnvironmentAware(ISimulationEnvironmentProvider *simEnvProvider) : IProviderAware(simEnvProvider)
|
||||
|
||||
@@ -3,9 +3,8 @@
|
||||
|
||||
#include "misc/simulation/xplane/aircraftmodelloaderxplane.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <functional>
|
||||
|
||||
#include <QChar>
|
||||
@@ -614,9 +613,14 @@ namespace swift::misc::simulation::xplane
|
||||
using command = std::function<bool(const QStringList &, CSLPackage &, const QString &, int)>;
|
||||
using namespace std::placeholders;
|
||||
|
||||
const QMap<QString, command> commands {
|
||||
{ "EXPORT_NAME", std::bind(&CAircraftModelLoaderXPlane::parseExportCommand, this, _1, _2, _3, _4) }
|
||||
};
|
||||
const QMap<QString, command> commands { { "EXPORT_NAME",
|
||||
[this](auto &&tokens, auto &&package, auto &&path, auto &&lineNum) {
|
||||
return parseExportCommand(
|
||||
std::forward<decltype(tokens)>(tokens),
|
||||
std::forward<decltype(package)>(package),
|
||||
std::forward<decltype(path)>(path),
|
||||
std::forward<decltype(lineNum)>(lineNum));
|
||||
} } };
|
||||
|
||||
CSLPackage package;
|
||||
int lineNum = 0;
|
||||
@@ -648,18 +652,68 @@ namespace swift::misc::simulation::xplane
|
||||
using namespace std::placeholders;
|
||||
|
||||
const QMap<QString, command> commands {
|
||||
{ "EXPORT_NAME", std::bind(&CAircraftModelLoaderXPlane::parseDummyCommand, this, _1, _2, _3, _4) },
|
||||
{ "DEPENDENCY", std::bind(&CAircraftModelLoaderXPlane::parseDependencyCommand, this, _1, _2, _3, _4) },
|
||||
{ "OBJECT", std::bind(&CAircraftModelLoaderXPlane::parseObjectCommand, this, _1, _2, _3, _4) },
|
||||
{ "TEXTURE", std::bind(&CAircraftModelLoaderXPlane::parseTextureCommand, this, _1, _2, _3, _4) },
|
||||
{ "AIRCRAFT", std::bind(&CAircraftModelLoaderXPlane::parseAircraftCommand, this, _1, _2, _3, _4) },
|
||||
{ "OBJ8_AIRCRAFT", std::bind(&CAircraftModelLoaderXPlane::parseObj8AircraftCommand, this, _1, _2, _3, _4) },
|
||||
{ "OBJ8", std::bind(&CAircraftModelLoaderXPlane::parseObj8Command, this, _1, _2, _3, _4) },
|
||||
{ "HASGEAR", std::bind(&CAircraftModelLoaderXPlane::parseHasGearCommand, this, _1, _2, _3, _4) },
|
||||
{ "ICAO", std::bind(&CAircraftModelLoaderXPlane::parseIcaoCommand, this, _1, _2, _3, _4) },
|
||||
{ "AIRLINE", std::bind(&CAircraftModelLoaderXPlane::parseAirlineCommand, this, _1, _2, _3, _4) },
|
||||
{ "LIVERY", std::bind(&CAircraftModelLoaderXPlane::parseLiveryCommand, this, _1, _2, _3, _4) },
|
||||
{ "VERT_OFFSET", std::bind(&CAircraftModelLoaderXPlane::parseDummyCommand, this, _1, _2, _3, _4) },
|
||||
{ "EXPORT_NAME",
|
||||
[this](auto &&PH1, auto &&PH2, auto &&PH3, auto &&PH4) {
|
||||
return parseDummyCommand(std::forward<decltype(PH1)>(PH1), std::forward<decltype(PH2)>(PH2),
|
||||
std::forward<decltype(PH3)>(PH3), std::forward<decltype(PH4)>(PH4));
|
||||
} },
|
||||
{ "DEPENDENCY",
|
||||
[this](auto &&PH1, auto &&PH2, auto &&PH3, auto &&PH4) {
|
||||
return parseDependencyCommand(std::forward<decltype(PH1)>(PH1), std::forward<decltype(PH2)>(PH2),
|
||||
std::forward<decltype(PH3)>(PH3), std::forward<decltype(PH4)>(PH4));
|
||||
} },
|
||||
{ "OBJECT",
|
||||
[this](auto &&PH1, auto &&PH2, auto &&PH3, auto &&PH4) {
|
||||
return parseObjectCommand(std::forward<decltype(PH1)>(PH1), std::forward<decltype(PH2)>(PH2),
|
||||
std::forward<decltype(PH3)>(PH3), std::forward<decltype(PH4)>(PH4));
|
||||
} },
|
||||
{ "TEXTURE",
|
||||
[this](auto &&PH1, auto &&PH2, auto &&PH3, auto &&PH4) {
|
||||
return parseTextureCommand(std::forward<decltype(PH1)>(PH1), std::forward<decltype(PH2)>(PH2),
|
||||
std::forward<decltype(PH3)>(PH3), std::forward<decltype(PH4)>(PH4));
|
||||
} },
|
||||
{
|
||||
"AIRCRAFT",
|
||||
[this](auto &&PH1, auto &&PH2, auto &&PH3, auto &&PH4) {
|
||||
return parseAircraftCommand(std::forward<decltype(PH1)>(PH1), std::forward<decltype(PH2)>(PH2),
|
||||
std::forward<decltype(PH3)>(PH3), std::forward<decltype(PH4)>(PH4));
|
||||
},
|
||||
},
|
||||
{ "OBJ8_AIRCRAFT",
|
||||
[this](auto &&PH1, auto &&PH2, auto &&PH3, auto &&PH4) {
|
||||
return parseObj8AircraftCommand(std::forward<decltype(PH1)>(PH1), std::forward<decltype(PH2)>(PH2),
|
||||
std::forward<decltype(PH3)>(PH3), std::forward<decltype(PH4)>(PH4));
|
||||
} },
|
||||
{ "OBJ8",
|
||||
[this](auto &&PH1, auto &&PH2, auto &&PH3, auto &&PH4) {
|
||||
return parseObj8Command(std::forward<decltype(PH1)>(PH1), std::forward<decltype(PH2)>(PH2),
|
||||
std::forward<decltype(PH3)>(PH3), std::forward<decltype(PH4)>(PH4));
|
||||
} },
|
||||
{ "HASGEAR",
|
||||
[this](auto &&PH1, auto &&PH2, auto &&PH3, auto &&PH4) {
|
||||
return parseHasGearCommand(std::forward<decltype(PH1)>(PH1), std::forward<decltype(PH2)>(PH2),
|
||||
std::forward<decltype(PH3)>(PH3), std::forward<decltype(PH4)>(PH4));
|
||||
} },
|
||||
{ "ICAO",
|
||||
[this](auto &&PH1, auto &&PH2, auto &&PH3, auto &&PH4) {
|
||||
return parseIcaoCommand(std::forward<decltype(PH1)>(PH1), std::forward<decltype(PH2)>(PH2),
|
||||
std::forward<decltype(PH3)>(PH3), std::forward<decltype(PH4)>(PH4));
|
||||
} },
|
||||
{ "AIRLINE",
|
||||
[this](auto &&PH1, auto &&PH2, auto &&PH3, auto &&PH4) {
|
||||
return parseAirlineCommand(std::forward<decltype(PH1)>(PH1), std::forward<decltype(PH2)>(PH2),
|
||||
std::forward<decltype(PH3)>(PH3), std::forward<decltype(PH4)>(PH4));
|
||||
} },
|
||||
{ "LIVERY",
|
||||
[this](auto &&PH1, auto &&PH2, auto &&PH3, auto &&PH4) {
|
||||
return parseLiveryCommand(std::forward<decltype(PH1)>(PH1), std::forward<decltype(PH2)>(PH2),
|
||||
std::forward<decltype(PH3)>(PH3), std::forward<decltype(PH4)>(PH4));
|
||||
} },
|
||||
{ "VERT_OFFSET",
|
||||
[this](auto &&PH1, auto &&PH2, auto &&PH3, auto &&PH4) {
|
||||
return parseDummyCommand(std::forward<decltype(PH1)>(PH1), std::forward<decltype(PH2)>(PH2),
|
||||
std::forward<decltype(PH3)>(PH3), std::forward<decltype(PH4)>(PH4));
|
||||
} },
|
||||
};
|
||||
|
||||
int lineNum = 0;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "simulatorflightgear.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
|
||||
#include <QColor>
|
||||
#include <QDBusServiceWatcher>
|
||||
@@ -872,7 +872,10 @@ namespace swift::simplugin::flightgear
|
||||
}
|
||||
|
||||
using namespace std::placeholders;
|
||||
auto callback = std::bind(&CSimulatorFlightgear::callbackReceivedRequestedElevation, this, _1, _2, false);
|
||||
auto callback = [this](auto &&plane, auto &&callsign) {
|
||||
callbackReceivedRequestedElevation(std::forward<decltype(plane)>(plane),
|
||||
std::forward<decltype(callsign)>(callsign), false);
|
||||
};
|
||||
|
||||
// Request
|
||||
m_trafficProxy->getElevationAtPosition(callsign, pos.latitude().value(CAngleUnit::deg()),
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "simulatorxplane.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
|
||||
#include <QColor>
|
||||
#include <QDBusServiceWatcher>
|
||||
@@ -267,7 +267,11 @@ namespace swift::simplugin::xplane
|
||||
}
|
||||
|
||||
using namespace std::placeholders;
|
||||
auto callback = std::bind(&CSimulatorXPlane::callbackReceivedRequestedElevation, this, _1, _2, _3);
|
||||
auto callback = [this](auto &&plane, auto &&callsign, auto &&isWater) {
|
||||
callbackReceivedRequestedElevation(std::forward<decltype(plane)>(plane),
|
||||
std::forward<decltype(callsign)>(callsign),
|
||||
std::forward<decltype(isWater)>(isWater));
|
||||
};
|
||||
|
||||
// Request
|
||||
m_trafficProxy->getElevationAtPosition(callsign, pos.latitude().value(CAngleUnit::deg()),
|
||||
|
||||
@@ -181,7 +181,7 @@ void CSwiftLauncher::clearWindowsRegistry()
|
||||
CGuiApplication::removeAllWindowsSwiftRegistryEntries();
|
||||
}
|
||||
|
||||
CSwiftLauncher::~CSwiftLauncher() {}
|
||||
CSwiftLauncher::~CSwiftLauncher() = default;
|
||||
|
||||
QString CSwiftLauncher::getCmdLine() const { return this->toCmdLine(m_executable, m_executableArgs); }
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
CSwiftLauncher(bool installerMode, QWidget *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
virtual ~CSwiftLauncher() override;
|
||||
~CSwiftLauncher() override;
|
||||
|
||||
//! Executable (to be started)
|
||||
const QString &getExecutable() const { return m_executable; }
|
||||
|
||||
Reference in New Issue
Block a user