2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Detach ComposeControls from SessionController.

This commit is contained in:
John Preston
2023-05-02 13:33:19 +04:00
parent 665467b02d
commit 65afa2c402
178 changed files with 2080 additions and 1869 deletions

View File

@@ -202,9 +202,7 @@ void InviteForbiddenController::send(
int(list.size()),
Ui::Text::RichLangValue);
close();
Ui::Toast::Show(
show->toastParent(),
{ .text = std::move(text), .st = &st::defaultToast });
show->showToast(std::move(text));
return true;
};
const auto sendForFull = [=] {
@@ -368,7 +366,7 @@ bool AddParticipantsBoxController::needsInviteLinkButton() {
QPointer<Ui::BoxContent> AddParticipantsBoxController::showBox(
object_ptr<Ui::BoxContent> box) const {
const auto weak = Ui::MakeWeak(box.data());
delegate()->peerListShowBox(std::move(box), Ui::LayerOption::KeepOther);
delegate()->peerListShowBox(std::move(box));
return weak;
}
@@ -425,7 +423,7 @@ void AddParticipantsBoxController::inviteSelectedUsers(
if (users.empty()) {
return;
}
const auto show = std::make_shared<Ui::BoxShow>(box);
const auto show = box->uiShow();
const auto request = [=](bool checked) {
_peer->session().api().chatParticipants().add(
_peer,
@@ -493,9 +491,8 @@ void AddParticipantsBoxController::Start(
});
box->addButton(tr::lng_cancel(), [=] { box->closeBox(); });
};
Window::Show(navigation).showBox(
Box<PeerListBox>(std::move(controller), std::move(initBox)),
Ui::LayerOption::KeepOther);
parent->show(
Box<PeerListBox>(std::move(controller), std::move(initBox)));
}
void AddParticipantsBoxController::Start(
@@ -538,9 +535,8 @@ void AddParticipantsBoxController::Start(
}, box->lifetime());
}
};
Window::Show(navigation).showBox(
Box<PeerListBox>(std::move(controller), std::move(initBox)),
Ui::LayerOption::KeepOther);
parent->show(
Box<PeerListBox>(std::move(controller), std::move(initBox)));
}
void AddParticipantsBoxController::Start(
@@ -616,7 +612,7 @@ bool ChatInviteForbidden(
box->addButton(tr::lng_via_link_send(), [=] {
weak->send(
box->collectSelectedRows(),
std::make_shared<Ui::BoxShow>(box),
box->uiShow(),
crl::guard(box, [=] { box->closeBox(); }));
});
}
@@ -626,8 +622,7 @@ bool ChatInviteForbidden(
}, box->lifetime());
};
show->showBox(
Box<PeerListBox>(std::move(controller), std::move(initBox)),
Ui::LayerOption::KeepOther);
Box<PeerListBox>(std::move(controller), std::move(initBox)));
return true;
}
@@ -673,7 +668,7 @@ void AddSpecialBoxController::migrate(
QPointer<Ui::BoxContent> AddSpecialBoxController::showBox(
object_ptr<Ui::BoxContent> box) const {
const auto weak = Ui::MakeWeak(box.data());
delegate()->peerListShowBox(std::move(box), Ui::LayerOption::KeepOther);
delegate()->peerListShowBox(std::move(box));
return weak;
}