clang-format

This commit is contained in:
Lena
2026-07-04 01:36:24 +02:00
committed by Alex
parent cd73e6cdfb
commit 11fdbe8ae3
2 changed files with 35 additions and 51 deletions
+1 -3
View File
@@ -1,12 +1,11 @@
#pragma once #pragma once
#include <fmt/format.h> #include <fmt/format.h>
#include <libmm-glib/libmm-glib.h>
#include <sys/statvfs.h> #include <sys/statvfs.h>
#include <fstream> #include <fstream>
#include <libmm-glib/libmm-glib.h>
#include "ALabel.hpp" #include "ALabel.hpp"
#include "util/format.hpp" #include "util/format.hpp"
#include "util/sleeper_thread.hpp" #include "util/sleeper_thread.hpp"
@@ -20,7 +19,6 @@ namespace waybar::modules {
auto update() -> void override; auto update() -> void override;
private: private:
void updateCurrentModem(); void updateCurrentModem();
util::SleeperThread thread_; util::SleeperThread thread_;
+9 -23
View File
@@ -1,8 +1,10 @@
#include "modules/wwan.hpp" #include "modules/wwan.hpp"
#include <spdlog/spdlog.h> #include <spdlog/spdlog.h>
#include <cmath> #include <cmath>
#include <cstdio> #include <cstdio>
#include "ModemManager.h" #include "ModemManager.h"
#include "libmm-glib.h" #include "libmm-glib.h"
@@ -20,7 +22,6 @@ namespace {
constexpr const char* DEFAULT_FORMAT = "{state}"; constexpr const char* DEFAULT_FORMAT = "{state}";
} // namespace } // namespace
waybar::modules::Wwan::Wwan(const std::string& id, const Json::Value& config) waybar::modules::Wwan::Wwan(const std::string& id, const Json::Value& config)
: ALabel(config, "wwan", id, "{}", 5) { : ALabel(config, "wwan", id, "{}", 5) {
thread_ = [this] { thread_ = [this] {
@@ -35,13 +36,9 @@ waybar::modules::Wwan::Wwan(const std::string& id, const Json::Value& config)
return; return;
} }
manager = mm_manager_new_sync(connection, G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE,
manager = mm_manager_new_sync(
connection,
G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE,
nullptr, // cancellable nullptr, // cancellable
&error &error);
);
if (error) { if (error) {
spdlog::error("Failed to create ModemManager proxy: " + std::string(error->message)); spdlog::error("Failed to create ModemManager proxy: " + std::string(error->message));
@@ -55,7 +52,6 @@ waybar::modules::Wwan::Wwan(const std::string& id, const Json::Value& config)
if (config_["hide-disconnected"].isBool()) { if (config_["hide-disconnected"].isBool()) {
hideDisconnected = config_["hide-disconnected"].asBool(); hideDisconnected = config_["hide-disconnected"].asBool();
} }
} }
void waybar::modules::Wwan::updateCurrentModem() { void waybar::modules::Wwan::updateCurrentModem() {
@@ -155,7 +151,6 @@ std::string getModemStateFormatString(MMModem* modem) {
} }
std::string getPreferredModeString(MMModem* modem) { std::string getPreferredModeString(MMModem* modem) {
MMModemModeCombination combination; MMModemModeCombination combination;
mm_modem_get_current_modes(modem, &combination.allowed, &combination.preferred); mm_modem_get_current_modes(modem, &combination.allowed, &combination.preferred);
@@ -175,24 +170,17 @@ std::string getPreferredModeString(MMModem* modem) {
} }
} }
std::string getCurrentModesString(MMModem* modem) { std::string getCurrentModesString(MMModem* modem) {
MMModemModeCombination combination; MMModemModeCombination combination;
mm_modem_get_current_modes(modem, &combination.allowed, &combination.preferred); mm_modem_get_current_modes(modem, &combination.allowed, &combination.preferred);
std::string buffer; std::string buffer;
if(combination.allowed & MMModemMode::MM_MODEM_MODE_CS) if (combination.allowed & MMModemMode::MM_MODEM_MODE_CS) buffer += "CS | ";
buffer += "CS | "; if (combination.allowed & MMModemMode::MM_MODEM_MODE_2G) buffer += "2G | ";
if(combination.allowed & MMModemMode::MM_MODEM_MODE_2G) if (combination.allowed & MMModemMode::MM_MODEM_MODE_3G) buffer += "3G | ";
buffer += "2G | "; if (combination.allowed & MMModemMode::MM_MODEM_MODE_4G) buffer += "4G | ";
if(combination.allowed & MMModemMode::MM_MODEM_MODE_3G) if (combination.allowed & MMModemMode::MM_MODEM_MODE_5G) buffer += "5G | ";
buffer += "3G | ";
if(combination.allowed & MMModemMode::MM_MODEM_MODE_4G)
buffer += "4G | ";
if(combination.allowed & MMModemMode::MM_MODEM_MODE_5G)
buffer += "5G | ";
if (buffer.length() > 2) { if (buffer.length() > 2) {
buffer.erase(buffer.length() - 2); buffer.erase(buffer.length() - 2);
@@ -216,7 +204,6 @@ std::string getPowerStateString(MMModem* modem) {
} }
std::string getOperatorNameString(MMModem* modem) { std::string getOperatorNameString(MMModem* modem) {
MMSim* sim = mm_modem_get_sim_sync(modem, nullptr, nullptr); MMSim* sim = mm_modem_get_sim_sync(modem, nullptr, nullptr);
if (sim == nullptr) { if (sim == nullptr) {
@@ -268,7 +255,6 @@ auto waybar::modules::Wwan::update() -> void {
state_ = state; state_ = state;
} }
auto format = format_; auto format = format_;
fmt::dynamic_format_arg_store<fmt::format_context> store; fmt::dynamic_format_arg_store<fmt::format_context> store;