2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +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:
John Preston
2018-06-04 18:35:11 +03:00
parent 8d1cdea31a
commit dd81f5d59f
216 changed files with 792 additions and 1455 deletions

View File

@@ -367,7 +367,7 @@ SuggestionsController::SuggestionsController(QWidget *parent, not_null<QTextEdit
}
void SuggestionsController::setReplaceCallback(
base::lambda<void(
Fn<void(
int from,
int till,
const QString &replacement)> callback) {

View File

@@ -68,7 +68,7 @@ public:
SuggestionsController(QWidget *parent, not_null<QTextEdit*> field);
void raise();
void setReplaceCallback(base::lambda<void(
void setReplaceCallback(Fn<void(
int from,
int till,
const QString &replacement)> callback);
@@ -91,7 +91,7 @@ private:
bool _ignoreCursorPositionChange = false;
bool _textChangeAfterKeyPress = false;
QPointer<QTextEdit> _field;
base::lambda<void(
Fn<void(
int from,
int till,
const QString &replacement)> _replaceCallback;

View File

@@ -57,7 +57,7 @@ public:
QWidget*,
const QString &text,
const QString &link,
base::lambda<void(QString, QString)> callback);
Fn<void(QString, QString)> callback);
void setInnerFocus() override;
@@ -67,8 +67,8 @@ protected:
private:
QString _startText;
QString _startLink;
base::lambda<void(QString, QString)> _callback;
base::lambda<void()> _setInnerFocus;
Fn<void(QString, QString)> _callback;
Fn<void()> _setInnerFocus;
};
@@ -120,7 +120,7 @@ EditLinkBox::EditLinkBox(
QWidget*,
const QString &text,
const QString &link,
base::lambda<void(QString, QString)> callback)
Fn<void(QString, QString)> callback)
: _startText(text)
, _startLink(link)
, _callback(std::move(callback)) {
@@ -307,7 +307,7 @@ void SetClipboardWithEntities(
}
}
base::lambda<bool(
Fn<bool(
Ui::InputField::EditLinkSelection selection,
QString text,
QString link,

View File

@@ -27,7 +27,7 @@ void SetClipboardWithEntities(
const TextWithEntities &forClipboard,
QClipboard::Mode mode = QClipboard::Clipboard);
base::lambda<bool(
Fn<bool(
Ui::InputField::EditLinkSelection selection,
QString text,
QString link,

View File

@@ -2343,7 +2343,7 @@ void StickersListWidget::removeMegagroupSet(bool locally) {
return;
}
_removingSetId = Stickers::MegagroupSetId;
Ui::show(Box<ConfirmBox>(lang(lng_stickers_remove_group_set), base::lambda_guarded(this, [this, group = _megagroupSet] {
Ui::show(Box<ConfirmBox>(lang(lng_stickers_remove_group_set), crl::guard(this, [this, group = _megagroupSet] {
Expects(group->mgInfo != nullptr);
if (group->mgInfo->stickerSet.type() != mtpc_inputStickerSetEmpty) {
Auth().api().setGroupStickerSet(group, MTP_inputStickerSetEmpty());
@@ -2351,7 +2351,7 @@ void StickersListWidget::removeMegagroupSet(bool locally) {
Ui::hideLayer();
_removingSetId = 0;
emit checkForHide();
}), base::lambda_guarded(this, [this] {
}), crl::guard(this, [this] {
_removingSetId = 0;
emit checkForHide();
})));
@@ -2363,7 +2363,7 @@ void StickersListWidget::removeSet(uint64 setId) {
if (it != sets.cend()) {
_removingSetId = it->id;
auto text = lng_stickers_remove_pack(lt_sticker_pack, it->title);
Ui::show(Box<ConfirmBox>(text, lang(lng_stickers_remove_pack_confirm), base::lambda_guarded(this, [this] {
Ui::show(Box<ConfirmBox>(text, lang(lng_stickers_remove_pack_confirm), crl::guard(this, [this] {
Ui::hideLayer();
auto &sets = Auth().data().stickerSetsRef();
auto it = sets.find(_removingSetId);
@@ -2400,7 +2400,7 @@ void StickersListWidget::removeSet(uint64 setId) {
}
_removingSetId = 0;
emit checkForHide();
}), base::lambda_guarded(this, [this] {
}), crl::guard(this, [this] {
_removingSetId = 0;
emit checkForHide();
})));

View File

@@ -14,7 +14,7 @@ namespace ChatHelpers {
TabbedMemento::TabbedMemento(
object_ptr<TabbedSelector> selector,
base::lambda<void(object_ptr<TabbedSelector>)> returnMethod)
Fn<void(object_ptr<TabbedSelector>)> returnMethod)
: _selector(std::move(selector))
, _returnMethod(std::move(returnMethod)) {
}
@@ -46,14 +46,14 @@ TabbedSection::TabbedSection(
parent,
controller,
object_ptr<TabbedSelector>(this, controller),
base::lambda<void(object_ptr<TabbedSelector>)>()) {
Fn<void(object_ptr<TabbedSelector>)>()) {
}
TabbedSection::TabbedSection(
QWidget *parent,
not_null<Window::Controller*> controller,
object_ptr<TabbedSelector> selector,
base::lambda<void(object_ptr<TabbedSelector>)> returnMethod)
Fn<void(object_ptr<TabbedSelector>)> returnMethod)
: Window::SectionWidget(parent, controller)
, _selector(std::move(selector))
, _returnMethod(std::move(returnMethod)) {
@@ -67,8 +67,8 @@ TabbedSection::TabbedSection(
_cancelledCallback();
}
});
_selector->setAfterShownCallback(base::lambda<void(SelectorTab)>());
_selector->setBeforeHidingCallback(base::lambda<void(SelectorTab)>());
_selector->setAfterShownCallback(Fn<void(SelectorTab)>());
_selector->setBeforeHidingCallback(Fn<void(SelectorTab)>());
setAttribute(Qt::WA_OpaquePaintEvent, true);
}

View File

@@ -18,7 +18,7 @@ class TabbedMemento : public Window::SectionMemento {
public:
TabbedMemento(
object_ptr<TabbedSelector> selector,
base::lambda<void(object_ptr<TabbedSelector>)> returnMethod);
Fn<void(object_ptr<TabbedSelector>)> returnMethod);
TabbedMemento(TabbedMemento &&other) = default;
TabbedMemento &operator=(TabbedMemento &&other) = default;
@@ -32,7 +32,7 @@ public:
private:
object_ptr<TabbedSelector> _selector;
base::lambda<void(object_ptr<TabbedSelector>)> _returnMethod;
Fn<void(object_ptr<TabbedSelector>)> _returnMethod;
};
@@ -45,11 +45,11 @@ public:
QWidget *parent,
not_null<Window::Controller*> controller,
object_ptr<TabbedSelector> selector,
base::lambda<void(object_ptr<TabbedSelector>)> returnMethod);
Fn<void(object_ptr<TabbedSelector>)> returnMethod);
void beforeHiding();
void afterShown();
void setCancelledCallback(base::lambda<void()> callback) {
void setCancelledCallback(Fn<void()> callback) {
_cancelledCallback = std::move(callback);
}
@@ -77,8 +77,8 @@ protected:
private:
object_ptr<TabbedSelector> _selector;
base::lambda<void()> _cancelledCallback;
base::lambda<void(object_ptr<TabbedSelector>)> _returnMethod;
Fn<void()> _cancelledCallback;
Fn<void(object_ptr<TabbedSelector>)> _returnMethod;
};

View File

@@ -63,10 +63,10 @@ public:
return _a_slide.animating();
}
void setAfterShownCallback(base::lambda<void(SelectorTab)> callback) {
void setAfterShownCallback(Fn<void(SelectorTab)> callback) {
_afterShownCallback = std::move(callback);
}
void setBeforeHidingCallback(base::lambda<void(SelectorTab)> callback) {
void setBeforeHidingCallback(Fn<void(SelectorTab)> callback) {
_beforeHidingCallback = std::move(callback);
}
@@ -187,8 +187,8 @@ private:
std::array<Tab, Tab::kCount> _tabs;
SelectorTab _currentTabType = SelectorTab::Emoji;
base::lambda<void(SelectorTab)> _afterShownCallback;
base::lambda<void(SelectorTab)> _beforeHidingCallback;
Fn<void(SelectorTab)> _afterShownCallback;
Fn<void(SelectorTab)> _beforeHidingCallback;
rpl::event_stream<> _showRequests;