mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-09-08 09:36:07 -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;
|
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)
|
void AddMacroHelperThread(Macro *macro, std::thread &&newThread)
|
||||||
{
|
{
|
||||||
if (!macro) {
|
if (!macro) {
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ EXPORT bool MacroIsPaused(Macro *);
|
|||||||
EXPORT bool
|
EXPORT bool
|
||||||
MacroWasPausedSince(Macro *,
|
MacroWasPausedSince(Macro *,
|
||||||
const std::chrono::high_resolution_clock::time_point &);
|
const std::chrono::high_resolution_clock::time_point &);
|
||||||
|
EXPORT bool MacroWasCheckedSinceLastStart(Macro *);
|
||||||
|
|
||||||
EXPORT void AddMacroHelperThread(Macro *, std::thread &&);
|
EXPORT void AddMacroHelperThread(Macro *, std::thread &&);
|
||||||
|
|
||||||
|
|||||||
@@ -178,6 +178,7 @@ void MacroTreeItem::Update(bool force)
|
|||||||
QSizePolicy::Maximum);
|
QSizePolicy::Maximum);
|
||||||
_expand->setMaximumSize(10, 16);
|
_expand->setMaximumSize(10, 16);
|
||||||
_expand->setMinimumSize(10, 0);
|
_expand->setMinimumSize(10, 0);
|
||||||
|
_expand->setProperty("class", "checkbox-icon indicator-expand");
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
_expand->setAttribute(Qt::WA_LayoutUsesWidgetRect);
|
_expand->setAttribute(Qt::WA_LayoutUsesWidgetRect);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -123,27 +123,23 @@ MacroActionSystrayEdit::MacroActionSystrayEdit(
|
|||||||
|
|
||||||
void MacroActionSystrayEdit::TitleChanged()
|
void MacroActionSystrayEdit::TitleChanged()
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_title = _title->text().toStdString();
|
_entryData->_title = _title->text().toStdString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionSystrayEdit::IconPathChanged(const QString &text)
|
void MacroActionSystrayEdit::IconPathChanged(const QString &text)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
GUARD_LOADING_AND_LOCK();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto lock = LockContext();
|
|
||||||
_entryData->_iconPath = text.toStdString();
|
_entryData->_iconPath = text.toStdString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionSystrayEdit::CheckIfTrayIsDisabled()
|
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();
|
auto config = obs_frontend_get_global_config();
|
||||||
|
#endif
|
||||||
if (!config) {
|
if (!config) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -176,15 +176,21 @@ bool MacroConditionDate::CheckRegularDate(int64_t msSinceLastCheck)
|
|||||||
|
|
||||||
bool MacroConditionDate::CheckCondition()
|
bool MacroConditionDate::CheckCondition()
|
||||||
{
|
{
|
||||||
auto m = GetMacro();
|
auto macro = GetMacro();
|
||||||
if (!m) {
|
if (!macro) {
|
||||||
return false;
|
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 =
|
const auto msSinceLastCheck =
|
||||||
std::chrono::duration_cast<std::chrono::milliseconds>(
|
MacroWasCheckedSinceLastStart(macro)
|
||||||
timePassed);
|
? std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||||
|
timePassed)
|
||||||
|
: std::chrono::milliseconds(0);
|
||||||
|
|
||||||
if (_dayOfWeekCheck) {
|
if (_dayOfWeekCheck) {
|
||||||
return CheckDayOfWeek(msSinceLastCheck.count());
|
return CheckDayOfWeek(msSinceLastCheck.count());
|
||||||
|
|||||||
@@ -29,20 +29,37 @@ std::string SourceSettingButton::ToString() const
|
|||||||
return "[" + id + "] " + description;
|
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);
|
auto it = obs_properties_first(sourceProperties);
|
||||||
do {
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
SourceSettingButton button = {obs_property_name(it),
|
SourceSettingButton button = {obs_property_name(it),
|
||||||
obs_property_description(it)};
|
obs_property_description(it)};
|
||||||
buttons.emplace_back(button);
|
buttons.emplace_back(button);
|
||||||
} while (obs_property_next(&it));
|
} 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);
|
obs_properties_destroy(sourceProperties);
|
||||||
return buttons;
|
return buttons;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user