mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-09-03 08:05:12 +00:00
Replace base::lambda with shorter term.
base::lambda -> Fn (type alias for std::function). base::lambda_once -> FnMut (type alias for base::unique_function). base::lambda_guarded -> crl::guard. base::lambda_call_type_t -> crl::deduced_call_type.
This commit is contained in:
@@ -22,7 +22,7 @@ namespace {
|
||||
|
||||
class PrivacyExceptionsBoxController : public ChatsListBoxController {
|
||||
public:
|
||||
PrivacyExceptionsBoxController(base::lambda<QString()> titleFactory, const std::vector<not_null<UserData*>> &selected);
|
||||
PrivacyExceptionsBoxController(Fn<QString()> titleFactory, const std::vector<not_null<UserData*>> &selected);
|
||||
void rowClicked(not_null<PeerListRow*> row) override;
|
||||
|
||||
std::vector<not_null<UserData*>> getResult() const;
|
||||
@@ -32,12 +32,12 @@ protected:
|
||||
std::unique_ptr<Row> createRow(not_null<History*> history) override;
|
||||
|
||||
private:
|
||||
base::lambda<QString()> _titleFactory;
|
||||
Fn<QString()> _titleFactory;
|
||||
std::vector<not_null<UserData*>> _selected;
|
||||
|
||||
};
|
||||
|
||||
PrivacyExceptionsBoxController::PrivacyExceptionsBoxController(base::lambda<QString()> titleFactory, const std::vector<not_null<UserData*>> &selected)
|
||||
PrivacyExceptionsBoxController::PrivacyExceptionsBoxController(Fn<QString()> titleFactory, const std::vector<not_null<UserData*>> &selected)
|
||||
: _titleFactory(std::move(titleFactory))
|
||||
, _selected(selected) {
|
||||
}
|
||||
@@ -163,11 +163,11 @@ int EditPrivacyBox::countDefaultHeight(int newWidth) {
|
||||
}
|
||||
|
||||
void EditPrivacyBox::editExceptionUsers(Exception exception) {
|
||||
auto controller = std::make_unique<PrivacyExceptionsBoxController>(base::lambda_guarded(this, [this, exception] {
|
||||
auto controller = std::make_unique<PrivacyExceptionsBoxController>(crl::guard(this, [this, exception] {
|
||||
return _controller->exceptionBoxTitle(exception);
|
||||
}), exceptionUsers(exception));
|
||||
auto initBox = [this, exception, controller = controller.get()](not_null<PeerListBox*> box) {
|
||||
box->addButton(langFactory(lng_settings_save), base::lambda_guarded(this, [this, box, exception, controller] {
|
||||
box->addButton(langFactory(lng_settings_save), crl::guard(this, [this, box, exception, controller] {
|
||||
exceptionUsers(exception) = controller->getResult();
|
||||
exceptionLink(exception)->entity()->setText(exceptionLinkText(exception));
|
||||
auto removeFrom = ([exception] {
|
||||
@@ -295,7 +295,7 @@ void EditPrivacyBox::createWidgets() {
|
||||
clearButtons();
|
||||
addButton(langFactory(lng_settings_save), [this] {
|
||||
auto someAreDisallowed = (_option != Option::Everyone) || !_neverUsers.empty();
|
||||
_controller->confirmSave(someAreDisallowed, base::lambda_guarded(this, [this] {
|
||||
_controller->confirmSave(someAreDisallowed, crl::guard(this, [this] {
|
||||
Auth().api().savePrivacy(_controller->key(), collectResult());
|
||||
closeBox();
|
||||
}));
|
||||
|
Reference in New Issue
Block a user