clang format
This commit is contained in:
@@ -4,8 +4,8 @@
|
||||
#include <array>
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
#include <span>
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
@@ -57,7 +57,7 @@ class HyprctlHelper {
|
||||
int socketFd = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
assert(socketFd != -1 && "Failed to create Hyprland command socket");
|
||||
|
||||
struct sockaddr_un addr {};
|
||||
struct sockaddr_un addr{};
|
||||
std::memset(&addr, 0, sizeof(addr));
|
||||
addr.sun_family = AF_UNIX;
|
||||
|
||||
@@ -78,7 +78,7 @@ class HyprctlHelper {
|
||||
|
||||
std::string response;
|
||||
constexpr size_t kBufferSize = 4096;
|
||||
std::array<char, kBufferSize> buffer {};
|
||||
std::array<char, kBufferSize> buffer{};
|
||||
while (true) {
|
||||
ssize_t bytesRead = recv(socketFd, buffer.data(), buffer.size(), 0);
|
||||
if (bytesRead <= 0) {
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
class HyprlandService {
|
||||
static inline std::shared_ptr<HyprlandService> instance;
|
||||
|
||||
|
||||
public:
|
||||
struct Client {
|
||||
std::string address;
|
||||
|
||||
@@ -49,7 +49,6 @@ class TimerService {
|
||||
}
|
||||
|
||||
ringingTimerCounter++;
|
||||
|
||||
}
|
||||
|
||||
void removeTimer(uint64_t timerId) {
|
||||
|
||||
@@ -15,7 +15,6 @@ class BluetoothSettingsRow : public Gtk::Box {
|
||||
set_spacing(10);
|
||||
set_margin_bottom(6);
|
||||
|
||||
|
||||
if (!device.icon.empty()) {
|
||||
this->icon.set_from_icon_name(device.icon);
|
||||
this->icon.set_pixel_size(24);
|
||||
@@ -94,12 +93,9 @@ class BluetoothSettings : public Gtk::Box {
|
||||
std::map<std::string, BluetoothDevice> activeBluetoothDevices;
|
||||
std::map<std::string, std::shared_ptr<BluetoothSettingsRow>> deviceRows;
|
||||
|
||||
|
||||
std::shared_ptr<IconButton> powerButton = std::make_shared<IconButton>(Icon::POWER_SETTINGS_NEW);
|
||||
std::shared_ptr<IconButton> scanButton = std::make_shared<IconButton>(Icon::BLUETOOTH_SEARCHING);
|
||||
|
||||
|
||||
|
||||
Gtk::Box connectedDevicesBox;
|
||||
Gtk::Box availableDevicesBox;
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include "components/mediaPlayer.hpp"
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "components/mediaPlayer.hpp"
|
||||
#include "connection/dbus/mpris.hpp"
|
||||
|
||||
#include "gtkmm/box.h"
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
|
||||
#include "connection/dbus/bluetooth.hpp"
|
||||
#include "widgets/controlCenter/bluetoothSettings.hpp"
|
||||
|
||||
#include "gtkmm/box.h"
|
||||
|
||||
class SettingsWidget : public Gtk::Box {
|
||||
public:
|
||||
SettingsWidget();
|
||||
|
||||
private:
|
||||
BluetoothSettings bluetoothSettings;
|
||||
|
||||
};
|
||||
@@ -3,8 +3,10 @@
|
||||
#include <memory>
|
||||
#include <sigc++/connection.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "components/timer.hpp"
|
||||
#include "services/timerService.hpp"
|
||||
|
||||
#include "gtkmm/box.h"
|
||||
|
||||
class TimerWidget : public Gtk::Box {
|
||||
|
||||
3
main.cpp
3
main.cpp
@@ -1,7 +1,6 @@
|
||||
#include "app.hpp"
|
||||
|
||||
int main()
|
||||
{
|
||||
int main() {
|
||||
App app;
|
||||
|
||||
return app.run();
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#include "components/mediaPlayer.hpp"
|
||||
|
||||
#include "components/button/iconButton.hpp"
|
||||
#include "components/mediaPlayer.hpp"
|
||||
#include "helpers/string.hpp"
|
||||
#include "services/textureCache.hpp"
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ Popover::~Popover() {
|
||||
if (popover) {
|
||||
popover->popdown();
|
||||
popover->unparent();
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -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") {
|
||||
@@ -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;
|
||||
|
||||
@@ -406,8 +410,10 @@ BluetoothDevice BluetoothController::parseDeviceProperties(
|
||||
|
||||
device.address = getString("Address");
|
||||
device.name = getString("Name");
|
||||
if (device.name.empty()) device.name = getString("Alias");
|
||||
if (device.name.empty()) device.name = device.address;
|
||||
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,15 +435,15 @@ 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),
|
||||
auto params = Glib::VariantContainerBase::create_tuple({Glib::Variant<Glib::ustring>::create(interface),
|
||||
Glib::Variant<Glib::ustring>::create(property),
|
||||
wrapped});
|
||||
|
||||
|
||||
@@ -87,4 +87,3 @@ void ControlCenter::setActiveTab(const std::string &tab_name) {
|
||||
this->timerButton->setActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
#include "gtkmm/entry.h"
|
||||
#include "gtkmm/eventcontrollerkey.h"
|
||||
#include "gtkmm/label.h"
|
||||
|
||||
Reference in New Issue
Block a user