clang format
This commit is contained in:
@@ -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") {
|
||||
@@ -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) {
|
||||
|
||||
@@ -284,26 +284,26 @@ void HyprlandService::handleSocketMessage(SocketHelper::SocketMessage message) {
|
||||
void HyprlandService::onMonitorAdded(std::string monitorName) {
|
||||
spdlog::info("[Hyprland] Monitor added: {}", monitorName);
|
||||
auto monitorDataJson = HyprctlHelper::getMonitorData();
|
||||
auto monitorIt = std::ranges::find_if(monitorDataJson,
|
||||
[&monitorName](const auto &item) {
|
||||
return item.contains("name") && item["name"] == monitorName;
|
||||
});
|
||||
auto monitorIt = std::ranges::find_if(monitorDataJson,
|
||||
[&monitorName](const auto &item) {
|
||||
return item.contains("name") && item["name"] == monitorName;
|
||||
});
|
||||
|
||||
if (monitorIt == monitorDataJson.end()) {
|
||||
spdlog::warn("[Hyprland] Monitor data not found for {}", monitorName);
|
||||
return;
|
||||
}
|
||||
|
||||
auto monitorPtr = std::make_shared<Monitor>();
|
||||
monitorPtr->id = (*monitorIt)["id"];
|
||||
monitorPtr->name = monitorName;
|
||||
monitorPtr->activeWorkspaceId = (*monitorIt)["activeWorkspace"]["id"];
|
||||
monitorPtr->focused = (*monitorIt)["focused"];
|
||||
this->monitors[monitorName] = monitorPtr;
|
||||
auto monitorPtr = std::make_shared<Monitor>();
|
||||
monitorPtr->id = (*monitorIt)["id"];
|
||||
monitorPtr->name = monitorName;
|
||||
monitorPtr->activeWorkspaceId = (*monitorIt)["activeWorkspace"]["id"];
|
||||
monitorPtr->focused = (*monitorIt)["focused"];
|
||||
this->monitors[monitorName] = monitorPtr;
|
||||
|
||||
auto onClick = sigc::mem_fun(*this, &HyprlandService::switchToWorkspace);
|
||||
for (int i = 1; i <= NUM_WORKSPACES; i++) {
|
||||
auto state = std::make_shared<WorkspaceData>();
|
||||
auto state = std::make_shared<WorkspaceData>();
|
||||
int workspaceId = i + (NUM_WORKSPACES * monitorPtr->id);
|
||||
|
||||
state->id = workspaceId;
|
||||
@@ -337,7 +337,7 @@ void HyprlandService::onMonitorAdded(std::string monitorName) {
|
||||
if (this->clients.find(address) != this->clients.end()) {
|
||||
continue;
|
||||
}
|
||||
int workspaceId = client["workspace"]["id"].get<int>();
|
||||
int workspaceId = client["workspace"]["id"].get<int>();
|
||||
auto workspaceIt = workspaces.find(workspaceId);
|
||||
if (workspaceIt == workspaces.end()) {
|
||||
continue;
|
||||
@@ -413,7 +413,7 @@ void HyprlandService::onActiveWindowChanged(std::string windowAddress) {
|
||||
}
|
||||
|
||||
std::shared_ptr<Gtk::Box> HyprlandService::getWorkspaceIndicatorsForMonitor(std::string monitorName) {
|
||||
auto box = std::make_shared<Gtk::Box>(Gtk::Orientation::HORIZONTAL);
|
||||
auto box = std::make_shared<Gtk::Box>(Gtk::Orientation::HORIZONTAL);
|
||||
auto monitorIt = monitors.find(monitorName);
|
||||
if (monitorIt == monitors.end()) {
|
||||
return box;
|
||||
@@ -434,7 +434,7 @@ void HyprlandService::switchToWorkspace(int workspaceId) {
|
||||
void HyprlandService::refreshIndicator(std::shared_ptr<Workspace> workspace) {
|
||||
auto view = workspace->view;
|
||||
|
||||
auto state = workspace->state;
|
||||
auto state = workspace->state;
|
||||
auto monitorIt = monitors.find(state->monitorName);
|
||||
if (monitorIt == monitors.end()) {
|
||||
return;
|
||||
|
||||
@@ -154,7 +154,7 @@ void NotificationController::closeNotification(uint64_t notificationId) {
|
||||
}
|
||||
|
||||
void NotificationController::addMonitor(std::shared_ptr<Gdk::Monitor> monitor) {
|
||||
auto name = monitor->get_connector();
|
||||
auto name = monitor->get_connector();
|
||||
this->activeMonitors[name] = monitor;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,9 +24,9 @@ ControlCenter::ControlCenter(Icon::Type icon, std::string name)
|
||||
this->tabRow.set_margin_bottom(4);
|
||||
this->tabRow.add_css_class("control-center-tab-row");
|
||||
|
||||
this->mediaTabButton = std::make_unique<TabButton>(Icon::PLAY_CIRCLE);
|
||||
this->infoTabButton = std::make_unique<TabButton>(Icon::EMPTY_DASHBOARD);
|
||||
this->timerButton = std::make_unique<TabButton>(Icon::TOKEN);
|
||||
this->mediaTabButton = std::make_unique<TabButton>(Icon::PLAY_CIRCLE);
|
||||
this->infoTabButton = std::make_unique<TabButton>(Icon::EMPTY_DASHBOARD);
|
||||
this->timerButton = std::make_unique<TabButton>(Icon::TOKEN);
|
||||
this->settingsTabButton = std::make_unique<TabButton>(Icon::SETTINGS);
|
||||
|
||||
this->tabRow.append(*this->mediaTabButton);
|
||||
@@ -41,9 +41,9 @@ ControlCenter::ControlCenter(Icon::Type icon, std::string name)
|
||||
this->contentStack.set_transition_type(Gtk::StackTransitionType::CROSSFADE);
|
||||
|
||||
this->mediaControlWidget = std::make_unique<MediaWidget>();
|
||||
this->weatherWidget = std::make_unique<WeatherWidget>();
|
||||
this->timerWidget = std::make_unique<TimerWidget>();
|
||||
this->settingsWidget = std::make_unique<SettingsWidget>();
|
||||
this->weatherWidget = std::make_unique<WeatherWidget>();
|
||||
this->timerWidget = std::make_unique<TimerWidget>();
|
||||
this->settingsWidget = std::make_unique<SettingsWidget>();
|
||||
|
||||
this->contentStack.add(*this->mediaControlWidget, "controls", "Controls");
|
||||
this->contentStack.add(*this->weatherWidget, "info", "Info");
|
||||
@@ -87,4 +87,3 @@ void ControlCenter::setActiveTab(const std::string &tab_name) {
|
||||
this->timerButton->setActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ void MediaWidget::addPlayerWidget(const std::string &bus_name) {
|
||||
|
||||
auto controller = MprisController::createForPlayer(bus_name);
|
||||
auto widget = std::make_unique<MediaPlayer>(controller);
|
||||
|
||||
|
||||
this->mediaWidgets.emplace(bus_name, std::move(widget));
|
||||
this->container.append(*this->mediaWidgets[bus_name]);
|
||||
}
|
||||
@@ -44,7 +44,7 @@ void MediaWidget::removePlayerWidget(const std::string &bus_name) {
|
||||
if (it == this->mediaWidgets.end()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
this->container.remove(*it->second);
|
||||
this->mediaWidgets.erase(it);
|
||||
}
|
||||
@@ -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