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