refactor: Fix clang-tidy warnings

This commit is contained in:
Lars Toenning
2024-12-01 11:04:25 +01:00
parent 7bc99ff6f2
commit a43b5ddc2b
38 changed files with 184 additions and 207 deletions

View File

@@ -36,7 +36,7 @@ namespace swift::core::context
public:
//! Destructor
virtual ~IContext() override {}
~IContext() override = default;
//! Log categories
static const QStringList &getLogCategories();
@@ -144,7 +144,7 @@ namespace swift::core::context
//! Empty context called
void logEmptyContextWarning(const QString &functionName) const
{
swift::misc::CLogMessage(this, swift::misc::CLogCategories::contextSlot())
misc::CLogMessage(this, swift::misc::CLogCategories::contextSlot())
.warning(u"Empty context called, details: %1")
<< functionName;
}
@@ -153,7 +153,7 @@ namespace swift::core::context
virtual void onAboutToShutdown() {}
//! Standard message when status message is returned in empty context
static const swift::misc::CStatusMessage &statusMessageEmptyContext();
static const misc::CStatusMessage &statusMessageEmptyContext();
private:
CCoreFacadeConfig::ContextMode m_mode; //!< How context is used

View File

@@ -69,14 +69,14 @@ namespace swift::core
}
//! \copydoc IContext::getPathAndContextId()
virtual QString getPathAndContextId() const override { return this->buildPathAndContextId(ObjectPath()); }
QString getPathAndContextId() const override { return this->buildPathAndContextId(ObjectPath()); }
//! Factory method
static IContextApplication *create(CCoreFacade *parent, CCoreFacadeConfig::ContextMode mode,
swift::misc::CDBusServer *server, QDBusConnection &connection);
//! Destructor
virtual ~IContextApplication() override {}
~IContextApplication() override = default;
signals:
//! A component changes
@@ -99,56 +99,54 @@ namespace swift::core
//! Ratify some settings changed by another process
//! \note Not pure because it can be called from the base class constructor.
//! \note This is the function which relays cache changes via DBus.
virtual void changeSettings(const swift::misc::CValueCachePacket &settings,
const swift::misc::CIdentifier &origin);
virtual void changeSettings(const misc::CValueCachePacket &settings, const misc::CIdentifier &origin);
//! Get all settings currently in core settings cache
virtual swift::misc::CValueCachePacket getAllSettings() const = 0;
virtual misc::CValueCachePacket getAllSettings() const = 0;
//! Get keys of all unsaved settings currently in core settings cache
virtual QStringList getUnsavedSettingsKeys() const = 0;
//! Get keys and descriptions of all unsaved settings currently in core settings cache
virtual swift::core::context::CSettingsDictionary getUnsavedSettingsKeysDescribed() const = 0;
virtual CSettingsDictionary getUnsavedSettingsKeysDescribed() const = 0;
//! Update local settings with settings from core
virtual void synchronizeLocalSettings() = 0;
//! Save core settings to disk
virtual swift::misc::CStatusMessage saveSettings(const QString &keyPrefix = {}) = 0;
virtual misc::CStatusMessage saveSettings(const QString &keyPrefix = {}) = 0;
//! Save core settings to disk
virtual swift::misc::CStatusMessage saveSettingsByKey(const QStringList &keys) = 0;
virtual misc::CStatusMessage saveSettingsByKey(const QStringList &keys) = 0;
//! Load core settings from disk
virtual swift::misc::CStatusMessage loadSettings() = 0;
virtual misc::CStatusMessage loadSettings() = 0;
//! Register hotkey action implemented by another process
//! \note Not pure because it can be called from the base class constructor.
//! \note This is the function which relays action registrations via DBus
virtual void registerHotkeyActions(const QStringList &actions, const swift::misc::CIdentifier &origin);
virtual void registerHotkeyActions(const QStringList &actions, const misc::CIdentifier &origin);
//! Call a hotkey action on a remote process
//! \note Not pure because it can be called from the base class constructor.
//! \note This is the function which relays action calls via DBus
virtual void callHotkeyActionRemotely(const QString &action, bool argument,
const swift::misc::CIdentifier &origin);
const misc::CIdentifier &origin);
//! Register application, can also be used for ping
virtual swift::misc::CIdentifier registerApplication(const swift::misc::CIdentifier &application) = 0;
virtual misc::CIdentifier registerApplication(const misc::CIdentifier &application) = 0;
//! Unregister application
virtual void unregisterApplication(const swift::misc::CIdentifier &application) = 0;
virtual void unregisterApplication(const misc::CIdentifier &application) = 0;
//! All registered applications
virtual swift::misc::CIdentifierList getRegisteredApplications() const = 0;
virtual misc::CIdentifierList getRegisteredApplications() const = 0;
//! Identifier of application, remote side if distributed
virtual swift::misc::CIdentifier getApplicationIdentifier() const = 0;
virtual misc::CIdentifier getApplicationIdentifier() const = 0;
//! Forward to facade
virtual bool parseCommandLine(const QString &commandLine,
const swift::misc::CIdentifier &originator) override;
bool parseCommandLine(const QString &commandLine, const swift::misc::CIdentifier &originator) override;
protected:
static constexpr int PingIdentifiersMs = 20000; //!< how often identifiers are pinged

View File

@@ -33,38 +33,38 @@ namespace swift::core
public slots:
//! \copydoc swift::core::context::CContextAudioBase::getRegisteredDevices
virtual swift::misc::audio::CAudioDeviceInfoList getRegisteredDevices() const override;
misc::audio::CAudioDeviceInfoList getRegisteredDevices() const override;
//! \copydoc swift::core::context::CContextAudioBase::registerDevices
virtual void registerDevices(const swift::misc::audio::CAudioDeviceInfoList &devices) override;
void registerDevices(const swift::misc::audio::CAudioDeviceInfoList &devices) override;
//! \copydoc swift::core::context::CContextAudioBase::unRegisterDevices
virtual void unRegisterDevices(const swift::misc::audio::CAudioDeviceInfoList &devices) override;
void unRegisterDevices(const swift::misc::audio::CAudioDeviceInfoList &devices) override;
//! \copydoc swift::core::context::CContextAudioBase::unRegisterDevicesFor
virtual void unRegisterDevicesFor(const swift::misc::CIdentifier &identifier) override;
void unRegisterDevicesFor(const swift::misc::CIdentifier &identifier) override;
//! \copydoc swift::core::context::CContextAudioBase::registerAudioCallsign
virtual void registerAudioCallsign(const swift::misc::aviation::CCallsign &callsign,
const swift::misc::CIdentifier &identifier) override;
void registerAudioCallsign(const swift::misc::aviation::CCallsign &callsign,
const swift::misc::CIdentifier &identifier) override;
//! \copydoc swift::core::context::CContextAudioBase::unRegisterAudioCallsign
virtual void unRegisterAudioCallsign(const swift::misc::aviation::CCallsign &callsign,
const swift::misc::CIdentifier &identifier) override;
void unRegisterAudioCallsign(const swift::misc::aviation::CCallsign &callsign,
const swift::misc::CIdentifier &identifier) override;
//! \copydoc swift::core::context::CContextAudioBase::hasRegisteredAudioCallsign
virtual bool hasRegisteredAudioCallsign(const swift::misc::aviation::CCallsign &callsign) const override;
bool hasRegisteredAudioCallsign(const swift::misc::aviation::CCallsign &callsign) const override;
protected:
//! Constructor
CContextAudio(CCoreFacadeConfig::ContextMode mode, CCoreFacade *runtime);
//! Register myself in DBus
CContextAudio *registerWithDBus(swift::misc::CDBusServer *server);
CContextAudio *registerWithDBus(misc::CDBusServer *server);
private:
swift::misc::audio::CAudioDeviceInfoList m_registeredDevices;
QMap<swift::misc::CIdentifier, swift::misc::aviation::CCallsign> m_registeredCallsigns;
misc::audio::CAudioDeviceInfoList m_registeredDevices;
QMap<misc::CIdentifier, misc::aviation::CCallsign> m_registeredCallsigns;
};
} // namespace context
} // namespace swift::core

View File

@@ -65,23 +65,23 @@ namespace swift::core::context
static const QString &ObjectPath();
//! \copydoc IContext::getPathAndContextId()
virtual QString getPathAndContextId() const override { return this->buildPathAndContextId(ObjectPath()); }
QString getPathAndContextId() const override { return this->buildPathAndContextId(ObjectPath()); }
//! Factory method
static IContextSimulator *create(CCoreFacade *parent, CCoreFacadeConfig::ContextMode mode,
swift::misc::CDBusServer *server, QDBusConnection &connection);
//! Destructor
virtual ~IContextSimulator() override {}
~IContextSimulator() override {}
//! Get simulator status as enum
//! \fixme To be removed with Qt 5.5 when getSimualtorStatus directly provides the enum
swift::core::ISimulator::SimulatorStatus getSimulatorStatusEnum() const;
ISimulator::SimulatorStatus getSimulatorStatusEnum() const;
// ---- some convenienc functions implemented on interface level
//! Current simulator
swift::misc::simulation::CSimulatorInfo getSimulatorInfo() const;
misc::simulation::CSimulatorInfo getSimulatorInfo() const;
signals:
//! Simulator combined status

View File

@@ -49,6 +49,7 @@ using namespace swift::misc::weather;
using namespace swift::misc::simulation;
using namespace swift::misc::simulation::settings;
using namespace swift::misc::simulation::data;
using namespace std::chrono_literals;
namespace swift::core::context
{
@@ -71,7 +72,7 @@ namespace swift::core::context
// deferred init of last model set, if no other data are set in meantime
const QPointer<CContextSimulator> myself(this);
QTimer::singleShot(2500, this, [=] {
QTimer::singleShot(2500ms, this, [=] {
if (!myself) { return; }
this->initByLastUsedModelSet();
m_aircraftMatcher.setSetup(m_matchingSettings.get());