clang format

This commit is contained in:
2026-02-09 13:50:26 +01:00
parent e1217305a5
commit ea9ab4b2cb
19 changed files with 66 additions and 67 deletions
+20 -14
View File
@@ -84,7 +84,8 @@ void BluetoothController::pairDevice(const std::string &object_path) {
void BluetoothController::unpairDevice(const std::string &object_path) {
spdlog::info("Bluetooth: unpairing device {}", object_path);
if (!m_adapter_proxy) return;
if (!m_adapter_proxy)
return;
auto params = Glib::VariantContainerBase::create_tuple(
Glib::Variant<Glib::DBusObjectPathString>::create(object_path));
@@ -148,7 +149,8 @@ void BluetoothController::onBusConnected(const Glib::RefPtr<Gio::AsyncResult> &r
// ---------------------------------------------------------------------------
void BluetoothController::enumerateObjects() {
if (!m_object_manager_proxy) return;
if (!m_object_manager_proxy)
return;
try {
auto result = m_object_manager_proxy->call_sync("GetManagedObjects");
@@ -230,7 +232,8 @@ void BluetoothController::onObjectManagerSignal(
.get());
auto ifaces = Glib::VariantBase::cast_dynamic<
Glib::Variant<std::vector<Glib::ustring>>>(parameters.get_child(1)).get();
Glib::Variant<std::vector<Glib::ustring>>>(parameters.get_child(1))
.get();
for (const auto &iface : ifaces) {
if (iface == "org.bluez.Device1") {
@@ -307,7 +310,7 @@ void BluetoothController::onAdapterPropertiesChanged(
void BluetoothController::addDevice(const std::string &path,
const PropertiesMap &properties) {
auto device = parseDeviceProperties(path, properties);
auto device = parseDeviceProperties(path, properties);
m_devices[path] = device;
spdlog::info("Bluetooth device added: {} ({}) {}", device.name, device.address, device.icon);
@@ -344,7 +347,8 @@ void BluetoothController::onDevicePropertiesChanged(
const std::vector<Glib::ustring> &) {
auto it = m_devices.find(object_path);
if (it == m_devices.end()) return;
if (it == m_devices.end())
return;
auto &device = it->second;
@@ -404,10 +408,12 @@ BluetoothDevice BluetoothController::parseDeviceProperties(
return false;
};
device.address = getString("Address");
device.name = getString("Name");
if (device.name.empty()) device.name = getString("Alias");
if (device.name.empty()) device.name = device.address;
device.address = getString("Address");
device.name = getString("Name");
if (device.name.empty())
device.name = getString("Alias");
if (device.name.empty())
device.name = device.address;
device.icon = getString("Icon");
device.paired = getBool("Paired");
device.connected = getBool("Connected");
@@ -429,17 +435,17 @@ void BluetoothController::setDbusProperty(const std::string &object_path,
const std::string &interface,
const std::string &property,
const Glib::VariantBase &value) {
if (!connection || object_path.empty()) return;
if (!connection || object_path.empty())
return;
try {
auto props_proxy = Gio::DBus::Proxy::create_sync(
connection, "org.bluez", object_path, "org.freedesktop.DBus.Properties");
auto wrapped = Glib::Variant<Glib::VariantBase>::create(value);
auto params = Glib::VariantContainerBase::create_tuple({
Glib::Variant<Glib::ustring>::create(interface),
Glib::Variant<Glib::ustring>::create(property),
wrapped});
auto params = Glib::VariantContainerBase::create_tuple({Glib::Variant<Glib::ustring>::create(interface),
Glib::Variant<Glib::ustring>::create(property),
wrapped});
props_proxy->call_sync("Set", params);
} catch (const Glib::Error &ex) {