aboutsummaryrefslogtreecommitdiff
path: root/src/ui/helper
diff options
context:
space:
mode:
authorYuqian Yang <crupest@crupest.life>2025-12-05 20:49:10 +0800
committerYuqian Yang <crupest@crupest.life>2025-12-05 20:49:10 +0800
commitf5c801de04f423269d9cefa3d725b52b87c7a0b9 (patch)
tree51bbda6cf58cdd0a6d9128d073ad00c9337680aa /src/ui/helper
parent5edaa008efabb1b97446bed2f6b542cf01eb3c70 (diff)
downloadcru-f5c801de04f423269d9cefa3d725b52b87c7a0b9.tar.gz
cru-f5c801de04f423269d9cefa3d725b52b87c7a0b9.tar.bz2
cru-f5c801de04f423269d9cefa3d725b52b87c7a0b9.zip
Refactor CRU_LOG_TAG_*.
Diffstat (limited to 'src/ui/helper')
-rw-r--r--src/ui/helper/ClickDetector.cpp7
-rw-r--r--src/ui/helper/ShortcutHub.cpp25
2 files changed, 17 insertions, 15 deletions
diff --git a/src/ui/helper/ClickDetector.cpp b/src/ui/helper/ClickDetector.cpp
index 0ac0515f..caa7061f 100644
--- a/src/ui/helper/ClickDetector.cpp
+++ b/src/ui/helper/ClickDetector.cpp
@@ -55,8 +55,8 @@ ClickDetector::ClickDetector(controls::Control* control) {
this->state_ == ClickState::Hover) {
if (!this->control_->CaptureMouse()) {
if constexpr (debug_flags::click_detector) {
- CRU_LOG_TAG_DEBUG(
- "Failed to capture mouse when begin click.");
+ CruLogDebug(kLogTag,
+ "Failed to capture mouse when begin click.");
}
return;
}
@@ -133,7 +133,8 @@ void ClickDetector::SetState(ClickState state) {
UnreachableCode();
}
};
- CRU_LOG_TAG_DEBUG("Click state changed, new state: {}.", to_string(state));
+ CruLogDebug(kLogTag, "Click state changed, new state: {}.",
+ to_string(state));
}
state_ = state;
diff --git a/src/ui/helper/ShortcutHub.cpp b/src/ui/helper/ShortcutHub.cpp
index fd23802e..13cce216 100644
--- a/src/ui/helper/ShortcutHub.cpp
+++ b/src/ui/helper/ShortcutHub.cpp
@@ -64,7 +64,8 @@ const std::vector<ShortcutInfo>& ShortcutHub::GetShortcutByKeyBind(
void ShortcutHub::Install(controls::Control* control) {
if (!event_guard_.IsEmpty()) {
- CRU_LOG_TAG_ERROR("Shortcut hub is already installed. Failed to install.");
+ CruLogError(kLogTag,
+ "Shortcut hub is already installed. Failed to install.");
return;
}
@@ -74,7 +75,7 @@ void ShortcutHub::Install(controls::Control* control) {
void ShortcutHub::Uninstall() {
if (event_guard_.IsEmpty()) {
- CRU_LOG_TAG_WARN("Shortcut hub is not installed. Failed to uninstall.");
+ CruLogWarn(kLogTag, "Shortcut hub is not installed. Failed to uninstall.");
return;
}
@@ -89,17 +90,17 @@ void ShortcutHub::OnKeyDown(events::KeyEventArgs& event) {
if constexpr (debug_flags::shortcut) {
if (shortcut_list.empty()) {
- CRU_LOG_TAG_DEBUG("No shortcut for key bind {}.", key_bind.ToString());
+ CruLogDebug(kLogTag, "No shortcut for key bind {}.", key_bind.ToString());
}
- CRU_LOG_TAG_DEBUG("Begin to handle shortcut for key bind {}.",
- key_bind.ToString());
+ CruLogDebug(kLogTag, "Begin to handle shortcut for key bind {}.",
+ key_bind.ToString());
}
for (const auto& shortcut : shortcut_list) {
auto is_handled = shortcut.handler();
if (is_handled) {
if constexpr (debug_flags::shortcut) {
- CRU_LOG_TAG_DEBUG("Handle {} handled it.", shortcut.name);
+ CruLogDebug(kLogTag, "Handle {} handled it.", shortcut.name);
}
handled = true;
@@ -108,23 +109,23 @@ void ShortcutHub::OnKeyDown(events::KeyEventArgs& event) {
break;
} else {
if constexpr (debug_flags::shortcut) {
- CRU_LOG_TAG_DEBUG("Handle {} didn't handle it.", shortcut.name);
+ CruLogDebug(kLogTag, "Handle {} didn't handle it.", shortcut.name);
}
}
}
if constexpr (debug_flags::shortcut) {
if (!shortcut_list.empty()) {
- CRU_LOG_TAG_DEBUG("End handling shortcut for key bind {}.",
- key_bind.ToString());
+ CruLogDebug(kLogTag, "End handling shortcut for key bind {}.",
+ key_bind.ToString());
}
}
if (!handled) {
if constexpr (debug_flags::shortcut) {
- CRU_LOG_TAG_DEBUG(
- "Raise fallback event for unhandled shortcut of key bind {}.",
- key_bind.ToString());
+ CruLogDebug(kLogTag,
+ "Raise fallback event for unhandled shortcut of key bind {}.",
+ key_bind.ToString());
}
fallback_event_.Raise(event);
}