mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Replaced signature ApplyDependencies function with more abstract one.
This commit is contained in:
parent
fecf538e31
commit
6dd6066738
1 changed files with 7 additions and 7 deletions
|
@ -61,7 +61,7 @@ template <typename CheckboxesMap, typename DependenciesMap>
|
||||||
void ApplyDependencies(
|
void ApplyDependencies(
|
||||||
const CheckboxesMap &checkboxes,
|
const CheckboxesMap &checkboxes,
|
||||||
const DependenciesMap &dependencies,
|
const DependenciesMap &dependencies,
|
||||||
QPointer<Ui::Checkbox> changed) {
|
Ui::AbstractCheckView *changed) {
|
||||||
const auto checkAndApply = [&](
|
const auto checkAndApply = [&](
|
||||||
auto &¤t,
|
auto &¤t,
|
||||||
auto dependency,
|
auto dependency,
|
||||||
|
@ -69,7 +69,7 @@ void ApplyDependencies(
|
||||||
for (auto &&checkbox : checkboxes) {
|
for (auto &&checkbox : checkboxes) {
|
||||||
if ((checkbox.first & dependency)
|
if ((checkbox.first & dependency)
|
||||||
&& (checkbox.second->checked() == isChecked)) {
|
&& (checkbox.second->checked() == isChecked)) {
|
||||||
current->setChecked(isChecked);
|
current->setChecked(isChecked, anim::type::normal);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -591,7 +591,7 @@ template <
|
||||||
const auto container = widget.data();
|
const auto container = widget.data();
|
||||||
|
|
||||||
const auto checkboxes = container->lifetime(
|
const auto checkboxes = container->lifetime(
|
||||||
).make_state<std::map<Flags, QPointer<Ui::Checkbox>>>();
|
).make_state<std::map<Flags, not_null<Ui::AbstractCheckView*>>>();
|
||||||
|
|
||||||
const auto value = [=] {
|
const auto value = [=] {
|
||||||
auto result = Flags(0);
|
auto result = Flags(0);
|
||||||
|
@ -608,9 +608,9 @@ template <
|
||||||
const auto changes = container->lifetime(
|
const auto changes = container->lifetime(
|
||||||
).make_state<rpl::event_stream<>>();
|
).make_state<rpl::event_stream<>>();
|
||||||
|
|
||||||
const auto applyDependencies = [=](Ui::Checkbox *control) {
|
const auto applyDependencies = [=](Ui::AbstractCheckView *view) {
|
||||||
static const auto dependencies = Dependencies(Flags());
|
static const auto dependencies = Dependencies(Flags());
|
||||||
ApplyDependencies(*checkboxes, dependencies, control);
|
ApplyDependencies(*checkboxes, dependencies, view);
|
||||||
};
|
};
|
||||||
|
|
||||||
container->add(
|
container->add(
|
||||||
|
@ -651,12 +651,12 @@ template <
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
InvokeQueued(control, [=] {
|
InvokeQueued(control, [=] {
|
||||||
applyDependencies(control);
|
applyDependencies(control->checkView());
|
||||||
changes->fire({});
|
changes->fire({});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, control->lifetime());
|
}, control->lifetime());
|
||||||
checkboxes->emplace(flags, control);
|
checkboxes->emplace(flags, control->checkView());
|
||||||
};
|
};
|
||||||
for (const auto &[flags, label] : flagLabelPairs) {
|
for (const auto &[flags, label] : flagLabelPairs) {
|
||||||
addCheckbox(flags, label);
|
addCheckbox(flags, label);
|
||||||
|
|
Loading…
Add table
Reference in a new issue