diff --git a/.clang-tidy b/.clang-tidy index f74eae65..3d4cf260 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -15,15 +15,15 @@ Checks: > -readability-redundant-member-init, -readability-redundant-string-init, -readability-identifier-length -CheckOptions: - - { key: readability-identifier-naming.NamespaceCase, value: lower_case } - - { key: readability-identifier-naming.ClassCase, value: CamelCase } - - { key: readability-identifier-naming.StructCase, value: CamelCase } - - { key: readability-identifier-naming.FunctionCase, value: camelBack } - - { key: readability-identifier-naming.VariableCase, value: camelBack } - - { key: readability-identifier-naming.PrivateMemberCase, value: camelBack } - - { key: readability-identifier-naming.PrivateMemberSuffix, value: _ } - - { key: readability-identifier-naming.EnumCase, value: CamelCase } - - { key: readability-identifier-naming.EnumConstantCase, value: UPPER_CASE } - - { key: readability-identifier-naming.GlobalConstantCase, value: UPPER_CASE } - - { key: readability-identifier-naming.StaticConstantCase, value: UPPER_CASE } +# CheckOptions: +# - { key: readability-identifier-naming.NamespaceCase, value: lower_case } +# - { key: readability-identifier-naming.ClassCase, value: CamelCase } +# - { key: readability-identifier-naming.StructCase, value: CamelCase } +# - { key: readability-identifier-naming.FunctionCase, value: camelBack } +# - { key: readability-identifier-naming.VariableCase, value: camelBack } +# - { key: readability-identifier-naming.PrivateMemberCase, value: camelBack } +# - { key: readability-identifier-naming.PrivateMemberSuffix, value: _ } +# - { key: readability-identifier-naming.EnumCase, value: CamelCase } +# - { key: readability-identifier-naming.EnumConstantCase, value: UPPER_CASE } +# - { key: readability-identifier-naming.GlobalConstantCase, value: UPPER_CASE } +# - { key: readability-identifier-naming.StaticConstantCase, value: UPPER_CASE } diff --git a/include/modules/privacy/privacy.hpp b/include/modules/privacy/privacy.hpp index b8e76768..d7656d31 100644 --- a/include/modules/privacy/privacy.hpp +++ b/include/modules/privacy/privacy.hpp @@ -1,10 +1,7 @@ #pragma once -#include -#include #include -#include "ALabel.hpp" #include "gtkmm/box.h" #include "modules/privacy/privacy_item.hpp" #include "util/pipewire/pipewire_backend.hpp" diff --git a/include/modules/privacy/privacy_item.hpp b/include/modules/privacy/privacy_item.hpp index a0e3038b..836bd994 100644 --- a/include/modules/privacy/privacy_item.hpp +++ b/include/modules/privacy/privacy_item.hpp @@ -2,9 +2,6 @@ #include -#include -#include -#include #include #include "gtkmm/box.h" diff --git a/src/modules/privacy/privacy.cpp b/src/modules/privacy/privacy.cpp index b7eede75..d3e3d4b2 100644 --- a/src/modules/privacy/privacy.cpp +++ b/src/modules/privacy/privacy.cpp @@ -6,7 +6,6 @@ #include #include "AModule.hpp" -#include "gtkmm/image.h" #include "modules/privacy/privacy_item.hpp" namespace waybar::modules::privacy { @@ -46,30 +45,29 @@ Privacy::Privacy(const std::string& id, const Json::Value& config, const std::st // Initialize each privacy module Json::Value modules = config_["modules"]; // Add Screenshare and Mic usage as default modules if none are specified - if (!modules.isArray() || modules.size() == 0) { + if (!modules.isArray() || modules.empty()) { modules = Json::Value(Json::arrayValue); - for (auto& type : {"screenshare", "audio-in"}) { + for (const auto& type : {"screenshare", "audio-in"}) { Json::Value obj = Json::Value(Json::objectValue); obj["type"] = type; modules.append(obj); } } - for (uint i = 0; i < modules.size(); i++) { - const Json::Value& module_config = modules[i]; + for (const auto& module_config : modules) { if (!module_config.isObject() || !module_config["type"].isString()) continue; const std::string type = module_config["type"].asString(); if (type == "screenshare") { - auto item = + auto* item = Gtk::make_managed(module_config, PRIVACY_NODE_TYPE_VIDEO_INPUT, &nodes_screenshare, pos, iconSize, transition_duration); box_.add(*item); } else if (type == "audio-in") { - auto item = + auto* item = Gtk::make_managed(module_config, PRIVACY_NODE_TYPE_AUDIO_INPUT, &nodes_audio_in, pos, iconSize, transition_duration); box_.add(*item); } else if (type == "audio-out") { - auto item = + auto* item = Gtk::make_managed(module_config, PRIVACY_NODE_TYPE_AUDIO_OUTPUT, &nodes_audio_out, pos, iconSize, transition_duration); box_.add(*item); @@ -117,11 +115,13 @@ void Privacy::onPrivacyNodesChanged() { auto Privacy::update() -> void { mutex_.lock(); - bool screenshare, audio_in, audio_out; + bool screenshare = false; + bool audio_in = false; + bool audio_out = false; for (Gtk::Widget* widget : box_.get_children()) { - PrivacyItem* module = dynamic_cast(widget); - if (!module) continue; + auto* module = dynamic_cast(widget); + if (module == nullptr) continue; switch (module->privacy_type) { case util::PipewireBackend::PRIVACY_NODE_TYPE_VIDEO_INPUT: screenshare = !nodes_screenshare.empty(); diff --git a/src/modules/privacy/privacy_item.cpp b/src/modules/privacy/privacy_item.cpp index c5b617d5..a38b95a4 100644 --- a/src/modules/privacy/privacy_item.cpp +++ b/src/modules/privacy/privacy_item.cpp @@ -1,14 +1,11 @@ #include "modules/privacy/privacy_item.hpp" #include -#include -#include "AModule.hpp" #include "glibmm/main.h" #include "gtkmm/label.h" #include "gtkmm/revealer.h" #include "gtkmm/tooltip.h" -#include "sigc++/adaptors/bind.h" #include "util/pipewire/privacy_node_info.hpp" namespace waybar::modules::privacy { @@ -89,7 +86,7 @@ PrivacyItem::PrivacyItem(const Json::Value &config_, enum PrivacyNodeType privac void PrivacyItem::update_tooltip() { // Removes all old nodes - for (auto child : tooltip_window.get_children()) { + for (auto *child : tooltip_window.get_children()) { delete child; }