refactor: clang format line length

This commit is contained in:
Lars Toenning
2024-11-16 19:27:30 +01:00
parent c7779e1461
commit 1a0b2a8c5f
1352 changed files with 25994 additions and 26603 deletions

View File

@@ -16,11 +16,10 @@ SWIFT_DEFINE_VALUEOBJECT_MIXINS(swift::misc::audio, CAudioDeviceInfo)
namespace swift::misc::audio
{
CAudioDeviceInfo::CAudioDeviceInfo() : m_type(Unknown)
{}
CAudioDeviceInfo::CAudioDeviceInfo() : m_type(Unknown) {}
CAudioDeviceInfo::CAudioDeviceInfo(DeviceType type, const QString &name) : m_type(static_cast<int>(type)),
m_deviceName(name)
CAudioDeviceInfo::CAudioDeviceInfo(DeviceType type, const QString &name)
: m_type(static_cast<int>(type)), m_deviceName(name)
{}
bool CAudioDeviceInfo::isDefault() const
@@ -28,7 +27,10 @@ namespace swift::misc::audio
if (m_deviceName.isEmpty()) { return false; }
if (m_deviceName == "default") { return true; }
if (this->isInputDevice() && m_deviceName == QMediaDevices::defaultAudioInput().description()) { return true; }
if (this->isOutputDevice() && m_deviceName == QMediaDevices::defaultAudioOutput().description()) { return true; }
if (this->isOutputDevice() && m_deviceName == QMediaDevices::defaultAudioOutput().description())
{
return true;
}
return false;
}
@@ -96,7 +98,8 @@ namespace swift::misc::audio
case IndexDeviceTypeAsString:
case IndexDeviceType: return Compare::compare(m_type, compareValue.m_type);
case IndexName: return m_deviceName.compare(compareValue.m_deviceName, Qt::CaseInsensitive);
case IndexIdentifier: return m_identifier.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getIdentifier());
case IndexIdentifier:
return m_identifier.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getIdentifier());
default: break;
}
SWIFT_VERIFY_X(false, Q_FUNC_INFO, qUtf8Printable("No comparison for index " + index.toQString()));

View File

@@ -106,7 +106,8 @@ namespace swift::misc::audio
private:
int m_type = static_cast<int>(Unknown); //!< Device type, @see CAudioDeviceInfo::DeviceType
QString m_deviceName; //!< Device name
CIdentifier m_identifier; //!< We use a DBus based system. Hence an audio device can reside on a different computers, this here is its name
CIdentifier m_identifier; //!< We use a DBus based system. Hence an audio device can reside on a different
//!< computers, this here is its name
SWIFT_METACLASS(
CAudioDeviceInfo,

View File

@@ -14,8 +14,7 @@ SWIFT_DEFINE_SEQUENCE_MIXINS(swift::misc::audio, CAudioDeviceInfo, CAudioDeviceI
namespace swift::misc::audio
{
CAudioDeviceInfoList::CAudioDeviceInfoList(const CSequence &other) : CSequence(other)
{}
CAudioDeviceInfoList::CAudioDeviceInfoList(const CSequence &other) : CSequence(other) {}
CAudioDeviceInfoList CAudioDeviceInfoList::getOutputDevices() const
{
@@ -32,7 +31,8 @@ namespace swift::misc::audio
return this->findByNameOrDefault(name, CAudioDeviceInfo(), strict);
}
CAudioDeviceInfo CAudioDeviceInfoList::findByNameOrDefault(const QString &name, const CAudioDeviceInfo &defaultDevice, bool strict) const
CAudioDeviceInfo CAudioDeviceInfoList::findByNameOrDefault(const QString &name,
const CAudioDeviceInfo &defaultDevice, bool strict) const
{
if (name.isEmpty()) { return defaultDevice; }
for (const CAudioDeviceInfo &d : *this)
@@ -57,10 +57,7 @@ namespace swift::misc::audio
CAudioDeviceInfoList devices;
for (const CAudioDeviceInfo &d : *this)
{
if (stringCompare(hostName, d.getMachineName(), Qt::CaseInsensitive))
{
devices.push_back(d);
}
if (stringCompare(hostName, d.getMachineName(), Qt::CaseInsensitive)) { devices.push_back(d); }
}
return devices;
}
@@ -83,28 +80,19 @@ namespace swift::misc::audio
void CAudioDeviceInfoList::registerDevices(const CAudioDeviceInfoList &devices)
{
for (const CAudioDeviceInfo &device : devices)
{
this->registerDevice(device);
}
for (const CAudioDeviceInfo &device : devices) { this->registerDevice(device); }
}
void CAudioDeviceInfoList::unRegisterDevice(const CAudioDeviceInfo &device)
{
if (!device.isValid()) { return; }
const CAudioDeviceInfo registeredDevice = this->findRegisteredDeviceOrDefault(device);
if (registeredDevice.isValid())
{
this->remove(registeredDevice);
}
if (registeredDevice.isValid()) { this->remove(registeredDevice); }
}
void CAudioDeviceInfoList::unRegisterDevices(const CAudioDeviceInfoList &devices)
{
for (const CAudioDeviceInfo &device : devices)
{
this->unRegisterDevice(device);
}
for (const CAudioDeviceInfo &device : devices) { this->unRegisterDevice(device); }
}
void CAudioDeviceInfoList::unRegisterDevices(const CIdentifier &identifier)
@@ -119,18 +107,14 @@ namespace swift::misc::audio
int CAudioDeviceInfoList::count(CAudioDeviceInfo::DeviceType type) const
{
return static_cast<int>(std::count_if(this->begin(), this->end(), [type](const CAudioDeviceInfo &device) {
return device.getType() == type;
}));
return static_cast<int>(std::count_if(
this->begin(), this->end(), [type](const CAudioDeviceInfo &device) { return device.getType() == type; }));
}
QStringList CAudioDeviceInfoList::getDeviceNames() const
{
QStringList names;
for (const CAudioDeviceInfo &d : *this)
{
names << d.getName();
}
for (const CAudioDeviceInfo &d : *this) { names << d.getName(); }
return names;
}
@@ -206,15 +190,9 @@ namespace swift::misc::audio
return devices;
}
QAudioDevice CAudioDeviceInfoList::defaultQtInputDevice()
{
return QMediaDevices::defaultAudioInput();
}
QAudioDevice CAudioDeviceInfoList::defaultQtInputDevice() { return QMediaDevices::defaultAudioInput(); }
QAudioDevice CAudioDeviceInfoList::defaultQtOutputDevice()
{
return QMediaDevices::defaultAudioOutput();
}
QAudioDevice CAudioDeviceInfoList::defaultQtOutputDevice() { return QMediaDevices::defaultAudioOutput(); }
CAudioDeviceInfo CAudioDeviceInfoList::defaultInputDevice()
{

View File

@@ -45,7 +45,8 @@ namespace swift::misc::audio
CAudioDeviceInfo findByName(const QString &name, bool strict = false) const;
//! Find by name
CAudioDeviceInfo findByNameOrDefault(const QString &name, const CAudioDeviceInfo &defaultDevice, bool strict = false) const;
CAudioDeviceInfo findByNameOrDefault(const QString &name, const CAudioDeviceInfo &defaultDevice,
bool strict = false) const;
//! Find by host name
CAudioDeviceInfoList findByHostName(const QString &hostName) const;

View File

@@ -36,14 +36,8 @@ namespace swift::misc::audio
void CSettings::setNotificationFlag(CNotificationSounds::NotificationFlag notification, bool value)
{
if (value)
{
m_notification |= notification;
}
else
{
m_notification &= ~notification;
}
if (value) { m_notification |= notification; }
else { m_notification &= ~notification; }
}
void CSettings::setNotificationSoundDirectory(const QString &dir)
@@ -75,35 +69,20 @@ namespace swift::misc::audio
return CSwiftDirectories::soundFilePathOrDefaultPath(m_notificationSoundDir, fileName);
}
void CSettings::setNotificationVolume(int volume)
{
m_notificationVolume = std::clamp(volume, 0, 100);
}
void CSettings::setNotificationVolume(int volume) { m_notificationVolume = std::clamp(volume, 0, 100); }
void CSettings::setOutVolume(int volume)
{
m_outVolume = fixOutVolume(volume);
}
void CSettings::setOutVolume(int volume) { m_outVolume = fixOutVolume(volume); }
void CSettings::setOutVolumeCom1(int volume)
{
m_outVolumeCom1 = fixOutVolume(volume);
}
void CSettings::setOutVolumeCom1(int volume) { m_outVolumeCom1 = fixOutVolume(volume); }
void CSettings::setOutVolumeCom2(int volume)
{
m_outVolumeCom2 = fixOutVolume(volume);
}
void CSettings::setOutVolumeCom2(int volume) { m_outVolumeCom2 = fixOutVolume(volume); }
void CSettings::setInVolume(int volume)
{
m_inVolume = fixInVolume(volume);
}
void CSettings::setInVolume(int volume) { m_inVolume = fixInVolume(volume); }
QString CSettings::convertToQString(bool i18n) const
{
Q_UNUSED(i18n)
return u"Notification flags: " % CNotificationSounds::toString(this->getNotification()) %
u" volume: " % QString::number(m_notificationVolume);
return u"Notification flags: " % CNotificationSounds::toString(this->getNotification()) % u" volume: " %
QString::number(m_notificationVolume);
}
} // namespace swift::misc::audio

View File

@@ -48,16 +48,31 @@ namespace swift::misc::audio
void setNotificationFlag(CNotificationSounds::NotificationFlag notification, bool value);
//! Get notification
CNotificationSounds::Notification getNotification() const { return static_cast<CNotificationSounds::Notification>(m_notification); }
CNotificationSounds::Notification getNotification() const
{
return static_cast<CNotificationSounds::Notification>(m_notification);
}
//! Set notification
void setNotification(CNotificationSounds::Notification notification) { m_notification = static_cast<int>(notification); }
void setNotification(CNotificationSounds::Notification notification)
{
m_notification = static_cast<int>(notification);
}
//! @{
//! Simplified functions
bool textMessagePrivate() const { return this->isNotificationFlagSet(CNotificationSounds::NotificationTextMessagePrivate); }
bool textMessageSupervisor() const { return this->isNotificationFlagSet(CNotificationSounds::NotificationTextMessageSupervisor); }
bool textCallsignMentioned() const { return this->isNotificationFlagSet(CNotificationSounds::NotificationTextCallsignMentioned); }
bool textMessagePrivate() const
{
return this->isNotificationFlagSet(CNotificationSounds::NotificationTextMessagePrivate);
}
bool textMessageSupervisor() const
{
return this->isNotificationFlagSet(CNotificationSounds::NotificationTextMessageSupervisor);
}
bool textCallsignMentioned() const
{
return this->isNotificationFlagSet(CNotificationSounds::NotificationTextCallsignMentioned);
}
bool pttClickDown() const { return this->isNotificationFlagSet(CNotificationSounds::PTTClickKeyDown); }
bool pttClickUp() const { return this->isNotificationFlagSet(CNotificationSounds::PTTClickKeyUp); }
@@ -120,7 +135,9 @@ namespace swift::misc::audio
private:
QString m_notificationSoundDir;
int m_notification = static_cast<int>(CNotificationSounds::DefaultNotifications); //!< play notification for notification x, a little trick to use a string here (streamable, hashable, ..)
int m_notification = static_cast<int>(
CNotificationSounds::DefaultNotifications); //!< play notification for notification x, a little trick to use
//!< a string here (streamable, hashable, ..)
int m_notificationVolume = 90; //!< 0-90
int m_outVolume = 40; //!< 0-100, AFV
int m_outVolumeCom1 = 100; //!< 0-100, AFV

View File

@@ -51,11 +51,14 @@ namespace swift::misc::audio
if (notification.testFlag(NotificationError)) n << flagToString(NotificationError);
if (notification.testFlag(NotificationLogin)) n << flagToString(NotificationLogin);
if (notification.testFlag(NotificationLogoff)) n << flagToString(NotificationLogoff);
if (notification.testFlag(NotificationTextMessageFrequency)) n << flagToString(NotificationTextMessageFrequency);
if (notification.testFlag(NotificationTextMessageFrequency))
n << flagToString(NotificationTextMessageFrequency);
if (notification.testFlag(NotificationTextMessagePrivate)) n << flagToString(NotificationTextMessagePrivate);
if (notification.testFlag(NotificationTextMessageSupervisor)) n << flagToString(NotificationTextMessageSupervisor);
if (notification.testFlag(NotificationTextMessageSupervisor))
n << flagToString(NotificationTextMessageSupervisor);
if (notification.testFlag(NotificationTextMessageUnicom)) n << flagToString(NotificationTextMessageUnicom);
if (notification.testFlag(NotificationTextCallsignMentioned)) n << flagToString(NotificationTextCallsignMentioned);
if (notification.testFlag(NotificationTextCallsignMentioned))
n << flagToString(NotificationTextCallsignMentioned);
if (notification.testFlag(PTTClickKeyUp)) n << flagToString(PTTClickKeyUp);
if (notification.testFlag(PTTClickKeyDown)) n << flagToString(PTTClickKeyDown);

View File

@@ -38,9 +38,9 @@ namespace swift::misc::audio
PTTClickKeyUp = 1 << 8,
// 1 << 9 previously used for PTTBlocked
// AFVClicked and AFVBlocked are not played back from the notification player itself (except for preview playback).
// Instead, they are provided from swift::sound::sample_provider::Samples.
// They are included here to allow to disable playing them.
// AFVClicked and AFVBlocked are not played back from the notification player itself (except for preview
// playback). Instead, they are provided from swift::sound::sample_provider::Samples. They are included here
// to allow to disable playing them.
AFVClicked = 1 << 14,
AFVBlocked = 1 << 15
};
@@ -48,7 +48,8 @@ namespace swift::misc::audio
//! All text notification flags
constexpr static Notification AllTextNotifications = Notification(
NotificationTextMessageFrequency | NotificationTextMessagePrivate | NotificationTextCallsignMentioned | NotificationTextMessageSupervisor | NotificationTextMessageUnicom);
NotificationTextMessageFrequency | NotificationTextMessagePrivate | NotificationTextCallsignMentioned |
NotificationTextMessageSupervisor | NotificationTextMessageUnicom);
//! All login notification flags
constexpr static Notification AllLoginNotifications = Notification(NotificationLogin | NotificationLogoff);
@@ -60,10 +61,12 @@ namespace swift::misc::audio
constexpr static Notification AllAfv = Notification(AFVClicked | AFVBlocked);
//! All notification flags
constexpr static Notification AllNotifications = Notification(NotificationError | AllTextNotifications | AllLoginNotifications | AllPTTNotifications | AllAfv);
constexpr static Notification AllNotifications = Notification(
NotificationError | AllTextNotifications | AllLoginNotifications | AllPTTNotifications | AllAfv);
//! Default notification flags
constexpr static Notification DefaultNotifications = Notification(AllNotifications & ~(NotificationTextMessageFrequency | NotificationTextMessageUnicom));
constexpr static Notification DefaultNotifications =
Notification(AllNotifications & ~(NotificationTextMessageFrequency | NotificationTextMessageUnicom));
//! As string
static const QString &flagToString(NotificationFlag notification);