mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-03-21 17:34:57 -05:00
Fix tempvars being reset across macros for cached widgets
Some checks failed
debian-build / build (push) Has been cancelled
Check locale / ubuntu64 (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
Some checks failed
debian-build / build (push) Has been cancelled
Check locale / ubuntu64 (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
This commit is contained in:
parent
d9d387ad47
commit
20488afdd1
|
|
@ -11,6 +11,7 @@ namespace advss {
|
|||
|
||||
class MacroActionEdit;
|
||||
class MacroConditionEdit;
|
||||
class MacroSegment;
|
||||
class Duration;
|
||||
class SequenceWidget;
|
||||
struct SceneGroup;
|
||||
|
|
@ -192,7 +193,7 @@ signals:
|
|||
void MacroRemoved(const QString &name);
|
||||
void MacroRenamed(const QString &oldName, const QString &newName);
|
||||
void MacroSegmentOrderChanged();
|
||||
void SegmentTempVarsChanged();
|
||||
void SegmentTempVarsChanged(MacroSegment *);
|
||||
void HighlightMacrosChanged(bool value);
|
||||
|
||||
void ConnectionAdded(const QString &);
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ void MacroSegment::SetupTempVars()
|
|||
void MacroSegment::ClearAvailableTempvars()
|
||||
{
|
||||
_tempVariables.clear();
|
||||
NotifyUIAboutTempVarChange();
|
||||
NotifyUIAboutTempVarChange(this);
|
||||
}
|
||||
|
||||
static std::shared_ptr<MacroSegment>
|
||||
|
|
@ -149,7 +149,7 @@ void MacroSegment::AddTempvar(const std::string &id, const std::string &name,
|
|||
|
||||
TempVariable var(id, name, description, sharedSegment);
|
||||
_tempVariables.emplace_back(std::move(var));
|
||||
NotifyUIAboutTempVarChange();
|
||||
NotifyUIAboutTempVarChange(this);
|
||||
}
|
||||
|
||||
void MacroSegment::SetTempVarValue(const std::string &id,
|
||||
|
|
|
|||
|
|
@ -274,8 +274,9 @@ TempVariableSelection::TempVariableSelection(QWidget *parent)
|
|||
SLOT(HighlightChanged(int)));
|
||||
QWidget::connect(window(), SIGNAL(MacroSegmentOrderChanged()), this,
|
||||
SLOT(MacroSegmentsChanged()));
|
||||
QWidget::connect(window(), SIGNAL(SegmentTempVarsChanged()), this,
|
||||
SLOT(SegmentTempVarsChanged()));
|
||||
QWidget::connect(window(),
|
||||
SIGNAL(SegmentTempVarsChanged(MacroSegment *)), this,
|
||||
SLOT(SegmentTempVarsChanged(MacroSegment *)));
|
||||
|
||||
auto layout = new QHBoxLayout();
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
|
|
@ -314,9 +315,15 @@ void TempVariableSelection::MacroSegmentsChanged()
|
|||
SetVariable(currentSelection);
|
||||
}
|
||||
|
||||
void TempVariableSelection::SegmentTempVarsChanged()
|
||||
void TempVariableSelection::SegmentTempVarsChanged(MacroSegment *segment)
|
||||
{
|
||||
MacroSegmentsChanged();
|
||||
const auto currentSegment = GetSegment();
|
||||
const auto currentMacro = currentSegment ? currentSegment->GetMacro()
|
||||
: nullptr;
|
||||
const auto changeMacro = segment ? segment->GetMacro() : nullptr;
|
||||
if (currentMacro == changeMacro) {
|
||||
MacroSegmentsChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void TempVariableSelection::HighlightChanged(int idx)
|
||||
|
|
@ -427,13 +434,11 @@ QString TempVariableSelection::SetupInfoLabel()
|
|||
MacroSegment *TempVariableSelection::GetSegment() const
|
||||
{
|
||||
const QWidget *widget = this;
|
||||
{
|
||||
while (widget) {
|
||||
if (qobject_cast<const MacroSegmentEdit *>(widget)) {
|
||||
break;
|
||||
}
|
||||
widget = widget->parentWidget();
|
||||
while (widget) {
|
||||
if (qobject_cast<const MacroSegmentEdit *>(widget)) {
|
||||
break;
|
||||
}
|
||||
widget = widget->parentWidget();
|
||||
}
|
||||
if (!widget) {
|
||||
return nullptr;
|
||||
|
|
@ -442,17 +447,18 @@ MacroSegment *TempVariableSelection::GetSegment() const
|
|||
return segmentWidget->Data().get();
|
||||
}
|
||||
|
||||
void NotifyUIAboutTempVarChange()
|
||||
void NotifyUIAboutTempVarChange(MacroSegment *segment)
|
||||
{
|
||||
obs_queue_task(
|
||||
OBS_TASK_UI,
|
||||
[](void *) {
|
||||
[](void *segment) {
|
||||
if (!SettingsWindowIsOpened()) {
|
||||
return;
|
||||
}
|
||||
AdvSceneSwitcher::window->SegmentTempVarsChanged();
|
||||
AdvSceneSwitcher::window->SegmentTempVarsChanged(
|
||||
(MacroSegment *)segment);
|
||||
},
|
||||
nullptr, false);
|
||||
segment, false);
|
||||
}
|
||||
|
||||
} // namespace advss
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ public:
|
|||
private slots:
|
||||
void SelectionIdxChanged(int);
|
||||
void MacroSegmentsChanged();
|
||||
void SegmentTempVarsChanged();
|
||||
void SegmentTempVarsChanged(MacroSegment *);
|
||||
void HighlightChanged(int);
|
||||
|
||||
signals:
|
||||
|
|
@ -104,6 +104,6 @@ private:
|
|||
AutoUpdateTooltipLabel *_info;
|
||||
};
|
||||
|
||||
void NotifyUIAboutTempVarChange();
|
||||
void NotifyUIAboutTempVarChange(MacroSegment *);
|
||||
|
||||
} // namespace advss
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user