mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Added ability to fill list of chat participant statuses from external.
This commit is contained in:
parent
f21edd1d23
commit
8688a68115
1 changed files with 11 additions and 9 deletions
|
@ -212,14 +212,11 @@ template <
|
||||||
typename DisabledMessagePairs,
|
typename DisabledMessagePairs,
|
||||||
typename FlagLabelPairs>
|
typename FlagLabelPairs>
|
||||||
[[nodiscard]] EditFlagsControl<Flags, Ui::RpWidget> CreateEditFlags(
|
[[nodiscard]] EditFlagsControl<Flags, Ui::RpWidget> CreateEditFlags(
|
||||||
QWidget *parent,
|
not_null<Ui::VerticalLayout*> container,
|
||||||
rpl::producer<QString> header,
|
rpl::producer<QString> header,
|
||||||
Flags checked,
|
Flags checked,
|
||||||
const DisabledMessagePairs &disabledMessagePairs,
|
const DisabledMessagePairs &disabledMessagePairs,
|
||||||
const FlagLabelPairs &flagLabelPairs) {
|
const FlagLabelPairs &flagLabelPairs) {
|
||||||
auto widget = object_ptr<Ui::VerticalLayout>(parent);
|
|
||||||
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, QPointer<Ui::Checkbox>>>();
|
||||||
|
|
||||||
|
@ -274,7 +271,7 @@ template <
|
||||||
if (locked.has_value()) {
|
if (locked.has_value()) {
|
||||||
if (checked != toggled) {
|
if (checked != toggled) {
|
||||||
Ui::ShowMultilineToast({
|
Ui::ShowMultilineToast({
|
||||||
.parentOverride = parent,
|
.parentOverride = container,
|
||||||
.text = { *locked },
|
.text = { *locked },
|
||||||
});
|
});
|
||||||
control->setChecked(toggled);
|
control->setChecked(toggled);
|
||||||
|
@ -298,7 +295,7 @@ template <
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
std::move(widget),
|
nullptr,
|
||||||
value,
|
value,
|
||||||
changes->events() | rpl::map(value)
|
changes->events() | rpl::map(value)
|
||||||
};
|
};
|
||||||
|
@ -737,12 +734,14 @@ EditFlagsControl<ChatRestrictions, Ui::RpWidget> CreateEditRestrictions(
|
||||||
ChatRestrictions restrictions,
|
ChatRestrictions restrictions,
|
||||||
std::map<ChatRestrictions, QString> disabledMessages,
|
std::map<ChatRestrictions, QString> disabledMessages,
|
||||||
Data::RestrictionsSetOptions options) {
|
Data::RestrictionsSetOptions options) {
|
||||||
|
auto widget = object_ptr<Ui::VerticalLayout>(parent);
|
||||||
auto result = CreateEditFlags(
|
auto result = CreateEditFlags(
|
||||||
parent,
|
widget.data(),
|
||||||
header,
|
header,
|
||||||
NegateRestrictions(restrictions),
|
NegateRestrictions(restrictions),
|
||||||
disabledMessages,
|
disabledMessages,
|
||||||
RestrictionLabels(options));
|
RestrictionLabels(options));
|
||||||
|
result.widget = std::move(widget);
|
||||||
result.value = [original = std::move(result.value)]{
|
result.value = [original = std::move(result.value)]{
|
||||||
return NegateRestrictions(original());
|
return NegateRestrictions(original());
|
||||||
};
|
};
|
||||||
|
@ -759,12 +758,15 @@ EditFlagsControl<ChatAdminRights, Ui::RpWidget> CreateEditAdminRights(
|
||||||
ChatAdminRights rights,
|
ChatAdminRights rights,
|
||||||
std::map<ChatAdminRights, QString> disabledMessages,
|
std::map<ChatAdminRights, QString> disabledMessages,
|
||||||
Data::AdminRightsSetOptions options) {
|
Data::AdminRightsSetOptions options) {
|
||||||
return CreateEditFlags(
|
auto widget = object_ptr<Ui::VerticalLayout>(parent);
|
||||||
parent,
|
auto result = CreateEditFlags(
|
||||||
|
widget.data(),
|
||||||
header,
|
header,
|
||||||
rights,
|
rights,
|
||||||
disabledMessages,
|
disabledMessages,
|
||||||
AdminRightLabels(options));
|
AdminRightLabels(options));
|
||||||
|
result.widget = std::move(widget);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatAdminRights DisabledByDefaultRestrictions(not_null<PeerData*> peer) {
|
ChatAdminRights DisabledByDefaultRestrictions(not_null<PeerData*> peer) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue