mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-04-16 22:58:18 -05:00
Add helpers for logging, translation, and synchronized data access
This commit is contained in:
parent
e4d064aaa3
commit
20eb56db2d
|
|
@ -249,6 +249,7 @@ target_sources(
|
|||
src/utils/duration-control.hpp
|
||||
src/utils/item-selection-helpers.cpp
|
||||
src/utils/item-selection-helpers.hpp
|
||||
src/utils/log-helper.hpp
|
||||
src/utils/file-selection.cpp
|
||||
src/utils/file-selection.hpp
|
||||
src/utils/macro-list.cpp
|
||||
|
|
@ -260,6 +261,8 @@ target_sources(
|
|||
src/utils/name-dialog.cpp
|
||||
src/utils/name-dialog.hpp
|
||||
src/utils/obs-dock.hpp
|
||||
src/utils/obs-module-helper.cpp
|
||||
src/utils/obs-module-helper.hpp
|
||||
src/utils/priority-helper.cpp
|
||||
src/utils/priority-helper.hpp
|
||||
src/utils/process-config.cpp
|
||||
|
|
@ -286,6 +289,8 @@ target_sources(
|
|||
src/utils/string-list.hpp
|
||||
src/utils/striped-frame.cpp
|
||||
src/utils/striped-frame.hpp
|
||||
src/utils/sync-helper.cpp
|
||||
src/utils/sync-helper.hpp
|
||||
src/utils/transition-selection.cpp
|
||||
src/utils/transition-selection.hpp
|
||||
src/utils/utility.cpp
|
||||
|
|
|
|||
16
src/utils/log-helper.hpp
Normal file
16
src/utils/log-helper.hpp
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#pragma once
|
||||
#include <util/base.h>
|
||||
|
||||
namespace advss {
|
||||
|
||||
bool VerboseLoggingEnabled();
|
||||
|
||||
#define blog(level, msg, ...) blog(level, "[adv-ss] " msg, ##__VA_ARGS__)
|
||||
#define vblog(level, msg, ...) \
|
||||
do { \
|
||||
if (VerboseLoggingEnabled()) { \
|
||||
blog(level, msg, ##__VA_ARGS__); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
} // namespace advss
|
||||
18
src/utils/obs-module-helper.cpp
Normal file
18
src/utils/obs-module-helper.cpp
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#include "obs-module-helper.hpp"
|
||||
#include "switcher-data.hpp"
|
||||
|
||||
const char *obs_module_text(const char *text)
|
||||
{
|
||||
if (!advss::switcher) {
|
||||
return "";
|
||||
}
|
||||
return advss::switcher->Translate(text);
|
||||
}
|
||||
|
||||
obs_module_t *obs_current_module()
|
||||
{
|
||||
if (!advss::switcher) {
|
||||
return nullptr;
|
||||
}
|
||||
return advss::switcher->GetModule();
|
||||
}
|
||||
5
src/utils/obs-module-helper.hpp
Normal file
5
src/utils/obs-module-helper.hpp
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#pragma once
|
||||
#include <obs-module.h>
|
||||
|
||||
const char *obs_module_text(const char *text);
|
||||
obs_module_t *obs_current_module();
|
||||
11
src/utils/sync-helper.cpp
Normal file
11
src/utils/sync-helper.cpp
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#include "sync-helper.hpp"
|
||||
|
||||
namespace advss {
|
||||
|
||||
std::mutex *GetSwitcherMutex();
|
||||
std::lock_guard<std::mutex> LockContext()
|
||||
{
|
||||
return std::lock_guard<std::mutex>(*GetSwitcherMutex());
|
||||
}
|
||||
|
||||
} // namespace advss
|
||||
8
src/utils/sync-helper.hpp
Normal file
8
src/utils/sync-helper.hpp
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#pragma once
|
||||
#include <mutex>
|
||||
|
||||
namespace advss {
|
||||
|
||||
[[nodiscard]] std::lock_guard<std::mutex> LockContext();
|
||||
|
||||
} // namespace advss
|
||||
Loading…
Reference in New Issue
Block a user