Compare commits

...

5 Commits

Author SHA1 Message Date
WarmUpTill
db50822b05 Prepare to fix deprecation warning when using OBS 31
Some checks failed
debian-build / build (push) Has been cancelled
Push to master / Check Formatting 🔍 (push) Has been cancelled
Push to master / Build Project 🧱 (push) Has been cancelled
Push to master / Create Release 🛫 (push) Has been cancelled
The following log message will be present in OBS 31 when
CheckIfTrayIsDisabled() is called:

DEPRECATION: obs_frontend_get_global_config is deprecated. Read from
global or user configuration explicitly instead.

It will be resolved when the minimum OBS version is bumped to OBS 31.
2024-11-02 08:28:52 +01:00
WarmUpTill
63a545b293 Fix "Date" condition returning true unexpectedly
This could happen if the plugin was stopped on the General tab and
restarted or the first time the plugin was started.
2024-11-02 08:28:52 +01:00
WarmUpTill
bc0497d2c9 Add MacroWasCheckedSinceLastStart() 2024-11-02 08:28:52 +01:00
WarmUpTill
37226a3a4c Fix macro group icon not being displayed correctly in OBS 31
Some checks failed
debian-build / build (push) Has been cancelled
Push to master / Check Formatting 🔍 (push) Has been cancelled
Push to master / Build Project 🧱 (push) Has been cancelled
Push to master / Create Release 🛫 (push) Has been cancelled
2024-10-31 19:39:38 +01:00
WarmUpTill
9f15fbe47c Recursively search for source button in property groups
Some checks are pending
debian-build / build (push) Waiting to run
Push to master / Check Formatting 🔍 (push) Waiting to run
Push to master / Build Project 🧱 (push) Waiting to run
Push to master / Create Release 🛫 (push) Blocked by required conditions
2024-10-30 18:29:23 +01:00
6 changed files with 50 additions and 21 deletions

View File

@@ -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) {

View File

@@ -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 &&);

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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());

View File

@@ -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;
}