mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-08-29 04:36:21 -05:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
db50822b05 | ||
|
|
63a545b293 | ||
|
|
bc0497d2c9 | ||
|
|
37226a3a4c | ||
|
|
9f15fbe47c |
@@ -109,6 +109,14 @@ bool MacroWasPausedSince(
|
||||
return macro ? macro->WasPausedSince(time) : false;
|
||||
}
|
||||
|
||||
bool MacroWasCheckedSinceLastStart(Macro *macro)
|
||||
{
|
||||
if (!macro) {
|
||||
return false;
|
||||
}
|
||||
return macro->LastConditionCheckTime().time_since_epoch().count() != 0;
|
||||
}
|
||||
|
||||
void AddMacroHelperThread(Macro *macro, std::thread &&newThread)
|
||||
{
|
||||
if (!macro) {
|
||||
|
||||
@@ -51,6 +51,7 @@ EXPORT bool MacroIsPaused(Macro *);
|
||||
EXPORT bool
|
||||
MacroWasPausedSince(Macro *,
|
||||
const std::chrono::high_resolution_clock::time_point &);
|
||||
EXPORT bool MacroWasCheckedSinceLastStart(Macro *);
|
||||
|
||||
EXPORT void AddMacroHelperThread(Macro *, std::thread &&);
|
||||
|
||||
|
||||
@@ -178,6 +178,7 @@ void MacroTreeItem::Update(bool force)
|
||||
QSizePolicy::Maximum);
|
||||
_expand->setMaximumSize(10, 16);
|
||||
_expand->setMinimumSize(10, 0);
|
||||
_expand->setProperty("class", "checkbox-icon indicator-expand");
|
||||
#ifdef __APPLE__
|
||||
_expand->setAttribute(Qt::WA_LayoutUsesWidgetRect);
|
||||
#endif
|
||||
|
||||
@@ -123,27 +123,23 @@ MacroActionSystrayEdit::MacroActionSystrayEdit(
|
||||
|
||||
void MacroActionSystrayEdit::TitleChanged()
|
||||
{
|
||||
if (_loading || !_entryData) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto lock = LockContext();
|
||||
GUARD_LOADING_AND_LOCK();
|
||||
_entryData->_title = _title->text().toStdString();
|
||||
}
|
||||
|
||||
void MacroActionSystrayEdit::IconPathChanged(const QString &text)
|
||||
{
|
||||
if (_loading || !_entryData) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto lock = LockContext();
|
||||
GUARD_LOADING_AND_LOCK();
|
||||
_entryData->_iconPath = text.toStdString();
|
||||
}
|
||||
|
||||
void MacroActionSystrayEdit::CheckIfTrayIsDisabled()
|
||||
{
|
||||
#if LIBOBS_API_VER >= MAKE_SEMANTIC_VERSION(31, 0, 0)
|
||||
auto config = obs_frontend_get_user_config();
|
||||
#else
|
||||
auto config = obs_frontend_get_global_config();
|
||||
#endif
|
||||
if (!config) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -176,15 +176,21 @@ bool MacroConditionDate::CheckRegularDate(int64_t msSinceLastCheck)
|
||||
|
||||
bool MacroConditionDate::CheckCondition()
|
||||
{
|
||||
auto m = GetMacro();
|
||||
if (!m) {
|
||||
auto macro = GetMacro();
|
||||
if (!macro) {
|
||||
return false;
|
||||
}
|
||||
const auto timePassed = std::chrono::high_resolution_clock::now() -
|
||||
LastMacroConditionCheckTime(m);
|
||||
|
||||
const auto now = std::chrono::high_resolution_clock::now();
|
||||
const auto lastCheck = LastMacroConditionCheckTime(macro);
|
||||
|
||||
const auto timePassed = now - lastCheck;
|
||||
|
||||
const auto msSinceLastCheck =
|
||||
std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||
timePassed);
|
||||
MacroWasCheckedSinceLastStart(macro)
|
||||
? std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||
timePassed)
|
||||
: std::chrono::milliseconds(0);
|
||||
|
||||
if (_dayOfWeekCheck) {
|
||||
return CheckDayOfWeek(msSinceLastCheck.count());
|
||||
|
||||
@@ -29,20 +29,37 @@ std::string SourceSettingButton::ToString() const
|
||||
return "[" + id + "] " + description;
|
||||
}
|
||||
|
||||
std::vector<SourceSettingButton> GetSourceButtons(OBSWeakSource source)
|
||||
static void getSourceButtonsHelper(obs_properties_t *sourceProperties,
|
||||
std::vector<SourceSettingButton> &buttons)
|
||||
{
|
||||
OBSSourceAutoRelease s = obs_weak_source_get_source(source);
|
||||
std::vector<SourceSettingButton> buttons;
|
||||
obs_properties_t *sourceProperties = obs_source_properties(s);
|
||||
auto it = obs_properties_first(sourceProperties);
|
||||
do {
|
||||
if (!it || obs_property_get_type(it) != OBS_PROPERTY_BUTTON) {
|
||||
if (!it) {
|
||||
continue;
|
||||
}
|
||||
|
||||
auto type = obs_property_get_type(it);
|
||||
if (type == OBS_PROPERTY_GROUP) {
|
||||
auto group = obs_property_group_content(it);
|
||||
getSourceButtonsHelper(group, buttons);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (obs_property_get_type(it) != OBS_PROPERTY_BUTTON) {
|
||||
continue;
|
||||
}
|
||||
SourceSettingButton button = {obs_property_name(it),
|
||||
obs_property_description(it)};
|
||||
buttons.emplace_back(button);
|
||||
} while (obs_property_next(&it));
|
||||
}
|
||||
|
||||
std::vector<SourceSettingButton> GetSourceButtons(OBSWeakSource source)
|
||||
{
|
||||
OBSSourceAutoRelease s = obs_weak_source_get_source(source);
|
||||
std::vector<SourceSettingButton> buttons;
|
||||
auto sourceProperties = obs_source_properties(s);
|
||||
getSourceButtonsHelper(sourceProperties, buttons);
|
||||
obs_properties_destroy(sourceProperties);
|
||||
return buttons;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user