mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +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:
@@ -204,7 +204,7 @@ void FlatButton::paintEvent(QPaintEvent *e) {
|
||||
p.drawText(r, _text, style::al_top);
|
||||
}
|
||||
|
||||
RoundButton::RoundButton(QWidget *parent, base::lambda<QString()> textFactory, const style::RoundButton &st) : RippleButton(parent, st.ripple)
|
||||
RoundButton::RoundButton(QWidget *parent, Fn<QString()> textFactory, const style::RoundButton &st) : RippleButton(parent, st.ripple)
|
||||
, _textFactory(std::move(textFactory))
|
||||
, _st(st) {
|
||||
subscribe(Lang::Current().updated(), [this] { refreshText(); });
|
||||
@@ -216,7 +216,7 @@ void RoundButton::setTextTransform(TextTransform transform) {
|
||||
refreshText();
|
||||
}
|
||||
|
||||
void RoundButton::setText(base::lambda<QString()> textFactory) {
|
||||
void RoundButton::setText(Fn<QString()> textFactory) {
|
||||
_textFactory = std::move(textFactory);
|
||||
refreshText();
|
||||
}
|
||||
@@ -235,7 +235,7 @@ void RoundButton::setNumbersText(const QString &numbersText, int numbers) {
|
||||
refreshText();
|
||||
}
|
||||
|
||||
void RoundButton::setWidthChangedCallback(base::lambda<void()> callback) {
|
||||
void RoundButton::setWidthChangedCallback(Fn<void()> callback) {
|
||||
if (!_numbers) {
|
||||
_numbers = std::make_unique<NumbersAnimation>(_st.font, [this] {
|
||||
numbersAnimationCallback();
|
||||
|
@@ -100,9 +100,9 @@ private:
|
||||
|
||||
class RoundButton : public RippleButton, private base::Subscriber {
|
||||
public:
|
||||
RoundButton(QWidget *parent, base::lambda<QString()> textFactory, const style::RoundButton &st);
|
||||
RoundButton(QWidget *parent, Fn<QString()> textFactory, const style::RoundButton &st);
|
||||
|
||||
void setText(base::lambda<QString()> textFactory);
|
||||
void setText(Fn<QString()> textFactory);
|
||||
|
||||
void setNumbersText(const QString &numbersText) {
|
||||
setNumbersText(numbersText, numbersText.toInt());
|
||||
@@ -110,7 +110,7 @@ public:
|
||||
void setNumbersText(int numbers) {
|
||||
setNumbersText(QString::number(numbers), numbers);
|
||||
}
|
||||
void setWidthChangedCallback(base::lambda<void()> callback);
|
||||
void setWidthChangedCallback(Fn<void()> callback);
|
||||
void stepNumbersAnimation(TimeMs ms);
|
||||
void finishNumbersAnimation();
|
||||
|
||||
@@ -140,7 +140,7 @@ private:
|
||||
void resizeToText();
|
||||
|
||||
QString _text;
|
||||
base::lambda<QString()> _textFactory;
|
||||
Fn<QString()> _textFactory;
|
||||
int _textWidth;
|
||||
|
||||
std::unique_ptr<NumbersAnimation> _numbers;
|
||||
|
@@ -22,7 +22,7 @@ TextParseOptions _checkboxOptions = {
|
||||
|
||||
} // namespace
|
||||
|
||||
AbstractCheckView::AbstractCheckView(int duration, bool checked, base::lambda<void()> updateCallback)
|
||||
AbstractCheckView::AbstractCheckView(int duration, bool checked, Fn<void()> updateCallback)
|
||||
: _duration(duration)
|
||||
, _checked(checked)
|
||||
, _updateCallback(std::move(updateCallback)) {
|
||||
@@ -36,7 +36,7 @@ void AbstractCheckView::setCheckedFast(bool checked) {
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractCheckView::setUpdateCallback(base::lambda<void()> updateCallback) {
|
||||
void AbstractCheckView::setUpdateCallback(Fn<void()> updateCallback) {
|
||||
_updateCallback = std::move(updateCallback);
|
||||
if (_toggleAnimation.animating()) {
|
||||
_toggleAnimation.setUpdateCallback(_updateCallback);
|
||||
@@ -67,7 +67,7 @@ float64 AbstractCheckView::currentAnimationValue(TimeMs ms) {
|
||||
ToggleView::ToggleView(
|
||||
const style::Toggle &st,
|
||||
bool checked,
|
||||
base::lambda<void()> updateCallback)
|
||||
Fn<void()> updateCallback)
|
||||
: AbstractCheckView(st.duration, checked, std::move(updateCallback))
|
||||
, _st(&st) {
|
||||
}
|
||||
@@ -204,7 +204,7 @@ bool ToggleView::checkRippleStartPosition(QPoint position) const {
|
||||
return QRect(QPoint(0, 0), rippleSize()).contains(position);
|
||||
}
|
||||
|
||||
CheckView::CheckView(const style::Check &st, bool checked, base::lambda<void()> updateCallback) : AbstractCheckView(st.duration, checked, std::move(updateCallback))
|
||||
CheckView::CheckView(const style::Check &st, bool checked, Fn<void()> updateCallback) : AbstractCheckView(st.duration, checked, std::move(updateCallback))
|
||||
, _st(&st) {
|
||||
}
|
||||
|
||||
@@ -261,7 +261,7 @@ void CheckView::setUntoggledOverride(
|
||||
RadioView::RadioView(
|
||||
const style::Radio &st,
|
||||
bool checked,
|
||||
base::lambda<void()> updateCallback)
|
||||
Fn<void()> updateCallback)
|
||||
: AbstractCheckView(st.duration, checked, std::move(updateCallback))
|
||||
, _st(&st) {
|
||||
}
|
||||
|
@@ -15,12 +15,12 @@ namespace Ui {
|
||||
|
||||
class AbstractCheckView {
|
||||
public:
|
||||
AbstractCheckView(int duration, bool checked, base::lambda<void()> updateCallback);
|
||||
AbstractCheckView(int duration, bool checked, Fn<void()> updateCallback);
|
||||
|
||||
void setCheckedFast(bool checked);
|
||||
void setCheckedAnimated(bool checked);
|
||||
void finishAnimating();
|
||||
void setUpdateCallback(base::lambda<void()> updateCallback);
|
||||
void setUpdateCallback(Fn<void()> updateCallback);
|
||||
bool checked() const {
|
||||
return _checked;
|
||||
}
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
private:
|
||||
int _duration = 0;
|
||||
bool _checked = false;
|
||||
base::lambda<void()> _updateCallback;
|
||||
Fn<void()> _updateCallback;
|
||||
Animation _toggleAnimation;
|
||||
|
||||
rpl::event_stream<bool> _checks;
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
CheckView(
|
||||
const style::Check &st,
|
||||
bool checked,
|
||||
base::lambda<void()> updateCallback = nullptr);
|
||||
Fn<void()> updateCallback = nullptr);
|
||||
|
||||
void setStyle(const style::Check &st);
|
||||
|
||||
@@ -86,7 +86,7 @@ public:
|
||||
RadioView(
|
||||
const style::Radio &st,
|
||||
bool checked,
|
||||
base::lambda<void()> updateCallback = nullptr);
|
||||
Fn<void()> updateCallback = nullptr);
|
||||
|
||||
void setStyle(const style::Radio &st);
|
||||
|
||||
@@ -110,7 +110,7 @@ public:
|
||||
ToggleView(
|
||||
const style::Toggle &st,
|
||||
bool checked,
|
||||
base::lambda<void()> updateCallback = nullptr);
|
||||
Fn<void()> updateCallback = nullptr);
|
||||
|
||||
void setStyle(const style::Toggle &st);
|
||||
|
||||
@@ -202,7 +202,7 @@ public:
|
||||
RadiobuttonGroup(int value) : _value(value), _hasValue(true) {
|
||||
}
|
||||
|
||||
void setChangedCallback(base::lambda<void(int value)> callback) {
|
||||
void setChangedCallback(Fn<void(int value)> callback) {
|
||||
_changedCallback = std::move(callback);
|
||||
}
|
||||
|
||||
@@ -227,7 +227,7 @@ private:
|
||||
|
||||
int _value = 0;
|
||||
bool _hasValue = false;
|
||||
base::lambda<void(int value)> _changedCallback;
|
||||
Fn<void(int value)> _changedCallback;
|
||||
std::vector<Radiobutton*> _buttons;
|
||||
|
||||
};
|
||||
|
@@ -32,7 +32,7 @@ public:
|
||||
return _disabled;
|
||||
}
|
||||
|
||||
using Callback = base::lambda<void(float64)>;
|
||||
using Callback = Fn<void(float64)>;
|
||||
void setChangeProgressCallback(Callback &&callback) {
|
||||
_changeProgressCallback = std::move(callback);
|
||||
}
|
||||
|
@@ -56,7 +56,7 @@ QAction *DropdownMenu::addAction(const QString &text, const QObject *receiver, c
|
||||
return _menu->addAction(text, receiver, member, icon, iconOver);
|
||||
}
|
||||
|
||||
QAction *DropdownMenu::addAction(const QString &text, base::lambda<void()> callback, const style::icon *icon, const style::icon *iconOver) {
|
||||
QAction *DropdownMenu::addAction(const QString &text, Fn<void()> callback, const style::icon *icon, const style::icon *iconOver) {
|
||||
return _menu->addAction(text, std::move(callback), icon, iconOver);
|
||||
}
|
||||
|
||||
|
@@ -20,11 +20,11 @@ public:
|
||||
DropdownMenu(QWidget *parent, const style::DropdownMenu &st = st::defaultDropdownMenu);
|
||||
|
||||
QAction *addAction(const QString &text, const QObject *receiver, const char* member, const style::icon *icon = nullptr, const style::icon *iconOver = nullptr);
|
||||
QAction *addAction(const QString &text, base::lambda<void()> callback, const style::icon *icon = nullptr, const style::icon *iconOver = nullptr);
|
||||
QAction *addAction(const QString &text, Fn<void()> callback, const style::icon *icon = nullptr, const style::icon *iconOver = nullptr);
|
||||
QAction *addSeparator();
|
||||
void clearActions();
|
||||
|
||||
void setHiddenCallback(base::lambda<void()> callback) {
|
||||
void setHiddenCallback(Fn<void()> callback) {
|
||||
_hiddenCallback = std::move(callback);
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ private:
|
||||
void showMenu(const QPoint &p, DropdownMenu *parent, TriggeredSource source);
|
||||
|
||||
const style::DropdownMenu &_st;
|
||||
base::lambda<void()> _hiddenCallback;
|
||||
Fn<void()> _hiddenCallback;
|
||||
|
||||
QPointer<Ui::Menu> _menu;
|
||||
|
||||
|
@@ -41,13 +41,13 @@ public:
|
||||
void otherEnter();
|
||||
void otherLeave();
|
||||
|
||||
void setShowStartCallback(base::lambda<void()> callback) {
|
||||
void setShowStartCallback(Fn<void()> callback) {
|
||||
_showStartCallback = std::move(callback);
|
||||
}
|
||||
void setHideStartCallback(base::lambda<void()> callback) {
|
||||
void setHideStartCallback(Fn<void()> callback) {
|
||||
_hideStartCallback = std::move(callback);
|
||||
}
|
||||
void setHiddenCallback(base::lambda<void()> callback) {
|
||||
void setHiddenCallback(Fn<void()> callback) {
|
||||
_hiddenCallback = std::move(callback);
|
||||
}
|
||||
|
||||
@@ -115,9 +115,9 @@ private:
|
||||
|
||||
QTimer _hideTimer;
|
||||
bool _ignoreShowEvents = false;
|
||||
base::lambda<void()> _showStartCallback;
|
||||
base::lambda<void()> _hideStartCallback;
|
||||
base::lambda<void()> _hiddenCallback;
|
||||
Fn<void()> _showStartCallback;
|
||||
Fn<void()> _hideStartCallback;
|
||||
Fn<void()> _hiddenCallback;
|
||||
|
||||
object_ptr<Ui::ScrollArea> _scroll;
|
||||
|
||||
|
@@ -789,7 +789,7 @@ const InstantReplaces &InstantReplaces::Default() {
|
||||
return result;
|
||||
}
|
||||
|
||||
FlatInput::FlatInput(QWidget *parent, const style::FlatInput &st, base::lambda<QString()> placeholderFactory, const QString &v) : TWidgetHelper<QLineEdit>(v, parent)
|
||||
FlatInput::FlatInput(QWidget *parent, const style::FlatInput &st, Fn<QString()> placeholderFactory, const QString &v) : TWidgetHelper<QLineEdit>(v, parent)
|
||||
, _oldtext(v)
|
||||
, _placeholderFactory(std::move(placeholderFactory))
|
||||
, _placeholderVisible(!v.length())
|
||||
@@ -962,7 +962,7 @@ void FlatInput::resizeEvent(QResizeEvent *e) {
|
||||
return QLineEdit::resizeEvent(e);
|
||||
}
|
||||
|
||||
void FlatInput::setPlaceholder(base::lambda<QString()> placeholderFactory) {
|
||||
void FlatInput::setPlaceholder(Fn<QString()> placeholderFactory) {
|
||||
_placeholderFactory = std::move(placeholderFactory);
|
||||
refreshPlaceholder();
|
||||
}
|
||||
@@ -1078,7 +1078,7 @@ void FlatInput::onTextChange(const QString &text) {
|
||||
InputField::InputField(
|
||||
QWidget *parent,
|
||||
const style::InputField &st,
|
||||
base::lambda<QString()> placeholderFactory,
|
||||
Fn<QString()> placeholderFactory,
|
||||
const QString &value)
|
||||
: InputField(
|
||||
parent,
|
||||
@@ -1092,7 +1092,7 @@ InputField::InputField(
|
||||
QWidget *parent,
|
||||
const style::InputField &st,
|
||||
Mode mode,
|
||||
base::lambda<QString()> placeholderFactory,
|
||||
Fn<QString()> placeholderFactory,
|
||||
const QString &value)
|
||||
: InputField(
|
||||
parent,
|
||||
@@ -1106,7 +1106,7 @@ InputField::InputField(
|
||||
QWidget *parent,
|
||||
const style::InputField &st,
|
||||
Mode mode,
|
||||
base::lambda<QString()> placeholderFactory,
|
||||
Fn<QString()> placeholderFactory,
|
||||
const TextWithTags &value)
|
||||
: RpWidget(parent)
|
||||
, _st(st)
|
||||
@@ -3276,7 +3276,7 @@ void InputField::refreshPlaceholder() {
|
||||
}
|
||||
|
||||
void InputField::setPlaceholder(
|
||||
base::lambda<QString()> placeholderFactory,
|
||||
Fn<QString()> placeholderFactory,
|
||||
int afterSymbols) {
|
||||
_placeholderFactory = std::move(placeholderFactory);
|
||||
if (_placeholderAfterSymbols != afterSymbols) {
|
||||
@@ -3287,7 +3287,7 @@ void InputField::setPlaceholder(
|
||||
}
|
||||
|
||||
void InputField::setEditLinkCallback(
|
||||
base::lambda<bool(
|
||||
Fn<bool(
|
||||
EditLinkSelection selection,
|
||||
QString text,
|
||||
QString link,
|
||||
@@ -3313,7 +3313,7 @@ void InputField::setErrorShown(bool error) {
|
||||
MaskedInputField::MaskedInputField(
|
||||
QWidget *parent,
|
||||
const style::InputField &st,
|
||||
base::lambda<QString()> placeholderFactory,
|
||||
Fn<QString()> placeholderFactory,
|
||||
const QString &val)
|
||||
: Parent(val, parent)
|
||||
, _st(st)
|
||||
@@ -3597,7 +3597,7 @@ void MaskedInputField::refreshPlaceholder() {
|
||||
update();
|
||||
}
|
||||
|
||||
void MaskedInputField::setPlaceholder(base::lambda<QString()> placeholderFactory) {
|
||||
void MaskedInputField::setPlaceholder(Fn<QString()> placeholderFactory) {
|
||||
_placeholderFactory = std::move(placeholderFactory);
|
||||
refreshPlaceholder();
|
||||
}
|
||||
@@ -3926,11 +3926,11 @@ void PhonePartInput::onChooseCode(const QString &code) {
|
||||
startPlaceholderAnimation();
|
||||
}
|
||||
|
||||
PasswordInput::PasswordInput(QWidget *parent, const style::InputField &st, base::lambda<QString()> placeholderFactory, const QString &val) : MaskedInputField(parent, st, std::move(placeholderFactory), val) {
|
||||
PasswordInput::PasswordInput(QWidget *parent, const style::InputField &st, Fn<QString()> placeholderFactory, const QString &val) : MaskedInputField(parent, st, std::move(placeholderFactory), val) {
|
||||
setEchoMode(QLineEdit::Password);
|
||||
}
|
||||
|
||||
PortInput::PortInput(QWidget *parent, const style::InputField &st, base::lambda<QString()> placeholderFactory, const QString &val) : MaskedInputField(parent, st, std::move(placeholderFactory), val) {
|
||||
PortInput::PortInput(QWidget *parent, const style::InputField &st, Fn<QString()> placeholderFactory, const QString &val) : MaskedInputField(parent, st, std::move(placeholderFactory), val) {
|
||||
if (!val.toInt() || val.toInt() > 65535) {
|
||||
setText(QString());
|
||||
}
|
||||
@@ -3961,7 +3961,7 @@ void PortInput::correctValue(
|
||||
setCorrectedText(now, nowCursor, newText, newPos);
|
||||
}
|
||||
|
||||
HexInput::HexInput(QWidget *parent, const style::InputField &st, base::lambda<QString()> placeholderFactory, const QString &val) : MaskedInputField(parent, st, std::move(placeholderFactory), val) {
|
||||
HexInput::HexInput(QWidget *parent, const style::InputField &st, Fn<QString()> placeholderFactory, const QString &val) : MaskedInputField(parent, st, std::move(placeholderFactory), val) {
|
||||
if (!QRegularExpression("^[a-fA-F0-9]+$").match(val).hasMatch()) {
|
||||
setText(QString());
|
||||
}
|
||||
@@ -3988,7 +3988,7 @@ void HexInput::correctValue(
|
||||
setCorrectedText(now, nowCursor, newText, newPos);
|
||||
}
|
||||
|
||||
UsernameInput::UsernameInput(QWidget *parent, const style::InputField &st, base::lambda<QString()> placeholderFactory, const QString &val, bool isLink) : MaskedInputField(parent, st, std::move(placeholderFactory), val) {
|
||||
UsernameInput::UsernameInput(QWidget *parent, const style::InputField &st, Fn<QString()> placeholderFactory, const QString &val, bool isLink) : MaskedInputField(parent, st, std::move(placeholderFactory), val) {
|
||||
setLinkPlaceholder(isLink ? Messenger::Instance().createInternalLink(QString()) : QString());
|
||||
}
|
||||
|
||||
@@ -4035,7 +4035,7 @@ void UsernameInput::correctValue(
|
||||
setCorrectedText(now, nowCursor, now.mid(from, len), newPos);
|
||||
}
|
||||
|
||||
PhoneInput::PhoneInput(QWidget *parent, const style::InputField &st, base::lambda<QString()> placeholderFactory, const QString &val) : MaskedInputField(parent, st, std::move(placeholderFactory), val) {
|
||||
PhoneInput::PhoneInput(QWidget *parent, const style::InputField &st, Fn<QString()> placeholderFactory, const QString &val) : MaskedInputField(parent, st, std::move(placeholderFactory), val) {
|
||||
QString phone(val);
|
||||
if (phone.isEmpty()) {
|
||||
clearText();
|
||||
|
@@ -40,11 +40,11 @@ public:
|
||||
FlatInput(
|
||||
QWidget *parent,
|
||||
const style::FlatInput &st,
|
||||
base::lambda<QString()> placeholderFactory = nullptr,
|
||||
Fn<QString()> placeholderFactory = nullptr,
|
||||
const QString &val = QString());
|
||||
|
||||
void updatePlaceholder();
|
||||
void setPlaceholder(base::lambda<QString()> placeholderFactory);
|
||||
void setPlaceholder(Fn<QString()> placeholderFactory);
|
||||
QRect placeholderRect() const;
|
||||
|
||||
void setTextMrg(const QMargins &textMrg);
|
||||
@@ -96,7 +96,7 @@ private:
|
||||
|
||||
QString _oldtext;
|
||||
QString _placeholder;
|
||||
base::lambda<QString()> _placeholderFactory;
|
||||
Fn<QString()> _placeholderFactory;
|
||||
|
||||
bool _customUpDown = false;
|
||||
|
||||
@@ -138,19 +138,19 @@ public:
|
||||
InputField(
|
||||
QWidget *parent,
|
||||
const style::InputField &st,
|
||||
base::lambda<QString()> placeholderFactory,
|
||||
Fn<QString()> placeholderFactory,
|
||||
const QString &value = QString());
|
||||
InputField(
|
||||
QWidget *parent,
|
||||
const style::InputField &st,
|
||||
Mode mode,
|
||||
base::lambda<QString()> placeholderFactory,
|
||||
Fn<QString()> placeholderFactory,
|
||||
const QString &value);
|
||||
InputField(
|
||||
QWidget *parent,
|
||||
const style::InputField &st,
|
||||
Mode mode = Mode::SingleLine,
|
||||
base::lambda<QString()> placeholderFactory = nullptr,
|
||||
Fn<QString()> placeholderFactory = nullptr,
|
||||
const TextWithTags &value = TextWithTags());
|
||||
|
||||
void showError();
|
||||
@@ -200,7 +200,7 @@ public:
|
||||
Edit,
|
||||
};
|
||||
void setEditLinkCallback(
|
||||
base::lambda<bool(
|
||||
Fn<bool(
|
||||
EditLinkSelection selection,
|
||||
QString text,
|
||||
QString link,
|
||||
@@ -233,7 +233,7 @@ public:
|
||||
return _lastTextWithTags.text;
|
||||
}
|
||||
void setPlaceholder(
|
||||
base::lambda<QString()> placeholderFactory,
|
||||
Fn<QString()> placeholderFactory,
|
||||
int afterSymbols = 0);
|
||||
void setPlaceholderHidden(bool forcePlaceholderHidden);
|
||||
void setDisplayFocused(bool focused);
|
||||
@@ -280,7 +280,7 @@ public:
|
||||
Check,
|
||||
Insert,
|
||||
};
|
||||
using MimeDataHook = base::lambda<bool(
|
||||
using MimeDataHook = Fn<bool(
|
||||
not_null<const QMimeData*> data,
|
||||
MimeAction action)>;
|
||||
void setMimeDataHook(MimeDataHook hook) {
|
||||
@@ -412,7 +412,7 @@ private:
|
||||
TextWithTags _lastTextWithTags;
|
||||
std::vector<MarkdownTag> _lastMarkdownTags;
|
||||
QString _lastPreEditText;
|
||||
base::lambda<bool(
|
||||
Fn<bool(
|
||||
EditLinkSelection selection,
|
||||
QString text,
|
||||
QString link,
|
||||
@@ -441,7 +441,7 @@ private:
|
||||
bool _customTab = false;
|
||||
|
||||
QString _placeholder;
|
||||
base::lambda<QString()> _placeholderFactory;
|
||||
Fn<QString()> _placeholderFactory;
|
||||
int _placeholderAfterSymbols = 0;
|
||||
Animation _a_placeholderShifted;
|
||||
bool _placeholderShifted = false;
|
||||
@@ -484,7 +484,7 @@ class MaskedInputField
|
||||
|
||||
using Parent = RpWidgetWrap<QLineEdit>;
|
||||
public:
|
||||
MaskedInputField(QWidget *parent, const style::InputField &st, base::lambda<QString()> placeholderFactory = base::lambda<QString()>(), const QString &val = QString());
|
||||
MaskedInputField(QWidget *parent, const style::InputField &st, Fn<QString()> placeholderFactory = Fn<QString()>(), const QString &val = QString());
|
||||
|
||||
void showError();
|
||||
|
||||
@@ -499,7 +499,7 @@ public:
|
||||
const QString &getLastText() const {
|
||||
return _oldtext;
|
||||
}
|
||||
void setPlaceholder(base::lambda<QString()> placeholderFactory);
|
||||
void setPlaceholder(Fn<QString()> placeholderFactory);
|
||||
void setPlaceholderHidden(bool forcePlaceholderHidden);
|
||||
void setDisplayFocused(bool focused);
|
||||
void finishAnimating();
|
||||
@@ -594,7 +594,7 @@ private:
|
||||
bool _customUpDown = false;
|
||||
|
||||
QString _placeholder;
|
||||
base::lambda<QString()> _placeholderFactory;
|
||||
Fn<QString()> _placeholderFactory;
|
||||
Animation _a_placeholderShifted;
|
||||
bool _placeholderShifted = false;
|
||||
QPainterPath _placeholderPath;
|
||||
@@ -676,13 +676,13 @@ private:
|
||||
|
||||
class PasswordInput : public MaskedInputField {
|
||||
public:
|
||||
PasswordInput(QWidget *parent, const style::InputField &st, base::lambda<QString()> placeholderFactory = base::lambda<QString()>(), const QString &val = QString());
|
||||
PasswordInput(QWidget *parent, const style::InputField &st, Fn<QString()> placeholderFactory = Fn<QString()>(), const QString &val = QString());
|
||||
|
||||
};
|
||||
|
||||
class PortInput : public MaskedInputField {
|
||||
public:
|
||||
PortInput(QWidget *parent, const style::InputField &st, base::lambda<QString()> placeholderFactory, const QString &val);
|
||||
PortInput(QWidget *parent, const style::InputField &st, Fn<QString()> placeholderFactory, const QString &val);
|
||||
|
||||
protected:
|
||||
void correctValue(
|
||||
@@ -695,7 +695,7 @@ protected:
|
||||
|
||||
class HexInput : public MaskedInputField {
|
||||
public:
|
||||
HexInput(QWidget *parent, const style::InputField &st, base::lambda<QString()> placeholderFactory, const QString &val);
|
||||
HexInput(QWidget *parent, const style::InputField &st, Fn<QString()> placeholderFactory, const QString &val);
|
||||
|
||||
protected:
|
||||
void correctValue(
|
||||
@@ -708,7 +708,7 @@ protected:
|
||||
|
||||
class UsernameInput : public MaskedInputField {
|
||||
public:
|
||||
UsernameInput(QWidget *parent, const style::InputField &st, base::lambda<QString()> placeholderFactory, const QString &val, bool isLink);
|
||||
UsernameInput(QWidget *parent, const style::InputField &st, Fn<QString()> placeholderFactory, const QString &val, bool isLink);
|
||||
|
||||
void setLinkPlaceholder(const QString &placeholder);
|
||||
|
||||
@@ -727,7 +727,7 @@ private:
|
||||
|
||||
class PhoneInput : public MaskedInputField {
|
||||
public:
|
||||
PhoneInput(QWidget *parent, const style::InputField &st, base::lambda<QString()> placeholderFactory, const QString &val);
|
||||
PhoneInput(QWidget *parent, const style::InputField &st, Fn<QString()> placeholderFactory, const QString &val);
|
||||
|
||||
void clearText();
|
||||
|
||||
|
@@ -109,7 +109,7 @@ public:
|
||||
|
||||
void setLink(uint16 lnkIndex, const ClickHandlerPtr &lnk);
|
||||
|
||||
using ClickHandlerHook = base::lambda<bool(const ClickHandlerPtr&, Qt::MouseButton)>;
|
||||
using ClickHandlerHook = Fn<bool(const ClickHandlerPtr&, Qt::MouseButton)>;
|
||||
void setClickHandlerHook(ClickHandlerHook &&hook);
|
||||
|
||||
// ClickHandlerHost interface
|
||||
|
@@ -49,7 +49,7 @@ QAction *Menu::addAction(const QString &text, const QObject *receiver, const cha
|
||||
return action;
|
||||
}
|
||||
|
||||
QAction *Menu::addAction(const QString &text, base::lambda<void()> callback, const style::icon *icon, const style::icon *iconOver) {
|
||||
QAction *Menu::addAction(const QString &text, Fn<void()> callback, const style::icon *icon, const style::icon *iconOver) {
|
||||
auto action = addAction(new QAction(text, this), icon, iconOver);
|
||||
connect(action, &QAction::triggered, action, std::move(callback), Qt::QueuedConnection);
|
||||
return action;
|
||||
|
@@ -22,7 +22,7 @@ public:
|
||||
Menu(QWidget *parent, QMenu *menu, const style::Menu &st = st::defaultMenu);
|
||||
|
||||
QAction *addAction(const QString &text, const QObject *receiver, const char* member, const style::icon *icon = nullptr, const style::icon *iconOver = nullptr);
|
||||
QAction *addAction(const QString &text, base::lambda<void()> callback, const style::icon *icon = nullptr, const style::icon *iconOver = nullptr);
|
||||
QAction *addAction(const QString &text, Fn<void()> callback, const style::icon *icon = nullptr, const style::icon *iconOver = nullptr);
|
||||
QAction *addSeparator();
|
||||
void clearActions();
|
||||
void finishAnimating();
|
||||
@@ -42,33 +42,33 @@ public:
|
||||
using Actions = QList<QAction*>;
|
||||
Actions &actions();
|
||||
|
||||
void setResizedCallback(base::lambda<void()> callback) {
|
||||
void setResizedCallback(Fn<void()> callback) {
|
||||
_resizedCallback = std::move(callback);
|
||||
}
|
||||
|
||||
void setActivatedCallback(base::lambda<void(QAction *action, int actionTop, TriggeredSource source)> callback) {
|
||||
void setActivatedCallback(Fn<void(QAction *action, int actionTop, TriggeredSource source)> callback) {
|
||||
_activatedCallback = std::move(callback);
|
||||
}
|
||||
void setTriggeredCallback(base::lambda<void(QAction *action, int actionTop, TriggeredSource source)> callback) {
|
||||
void setTriggeredCallback(Fn<void(QAction *action, int actionTop, TriggeredSource source)> callback) {
|
||||
_triggeredCallback = std::move(callback);
|
||||
}
|
||||
|
||||
void setKeyPressDelegate(base::lambda<bool(int key)> delegate) {
|
||||
void setKeyPressDelegate(Fn<bool(int key)> delegate) {
|
||||
_keyPressDelegate = std::move(delegate);
|
||||
}
|
||||
void handleKeyPress(int key);
|
||||
|
||||
void setMouseMoveDelegate(base::lambda<void(QPoint globalPosition)> delegate) {
|
||||
void setMouseMoveDelegate(Fn<void(QPoint globalPosition)> delegate) {
|
||||
_mouseMoveDelegate = std::move(delegate);
|
||||
}
|
||||
void handleMouseMove(QPoint globalPosition);
|
||||
|
||||
void setMousePressDelegate(base::lambda<void(QPoint globalPosition)> delegate) {
|
||||
void setMousePressDelegate(Fn<void(QPoint globalPosition)> delegate) {
|
||||
_mousePressDelegate = std::move(delegate);
|
||||
}
|
||||
void handleMousePress(QPoint globalPosition);
|
||||
|
||||
void setMouseReleaseDelegate(base::lambda<void(QPoint globalPosition)> delegate) {
|
||||
void setMouseReleaseDelegate(Fn<void(QPoint globalPosition)> delegate) {
|
||||
_mouseReleaseDelegate = std::move(delegate);
|
||||
}
|
||||
void handleMouseRelease(QPoint globalPosition);
|
||||
@@ -122,13 +122,13 @@ private:
|
||||
|
||||
const style::Menu &_st;
|
||||
|
||||
base::lambda<void()> _resizedCallback;
|
||||
base::lambda<void(QAction *action, int actionTop, TriggeredSource source)> _activatedCallback;
|
||||
base::lambda<void(QAction *action, int actionTop, TriggeredSource source)> _triggeredCallback;
|
||||
base::lambda<bool(int key)> _keyPressDelegate;
|
||||
base::lambda<void(QPoint globalPosition)> _mouseMoveDelegate;
|
||||
base::lambda<void(QPoint globalPosition)> _mousePressDelegate;
|
||||
base::lambda<void(QPoint globalPosition)> _mouseReleaseDelegate;
|
||||
Fn<void()> _resizedCallback;
|
||||
Fn<void(QAction *action, int actionTop, TriggeredSource source)> _activatedCallback;
|
||||
Fn<void(QAction *action, int actionTop, TriggeredSource source)> _triggeredCallback;
|
||||
Fn<bool(int key)> _keyPressDelegate;
|
||||
Fn<void(QPoint globalPosition)> _mouseMoveDelegate;
|
||||
Fn<void(QPoint globalPosition)> _mousePressDelegate;
|
||||
Fn<void(QPoint globalPosition)> _mouseReleaseDelegate;
|
||||
|
||||
QMenu *_wappedMenu = nullptr;
|
||||
Actions _actions;
|
||||
|
@@ -234,7 +234,7 @@ void MultiSelect::Item::setOver(bool over) {
|
||||
MultiSelect::MultiSelect(
|
||||
QWidget *parent,
|
||||
const style::MultiSelect &st,
|
||||
base::lambda<QString()> placeholderFactory)
|
||||
Fn<QString()> placeholderFactory)
|
||||
: RpWidget(parent)
|
||||
, _st(st)
|
||||
, _scroll(this, _st.scroll) {
|
||||
@@ -285,15 +285,15 @@ void MultiSelect::scrollTo(int activeTop, int activeBottom) {
|
||||
}
|
||||
}
|
||||
|
||||
void MultiSelect::setQueryChangedCallback(base::lambda<void(const QString &query)> callback) {
|
||||
void MultiSelect::setQueryChangedCallback(Fn<void(const QString &query)> callback) {
|
||||
_queryChangedCallback = std::move(callback);
|
||||
}
|
||||
|
||||
void MultiSelect::setSubmittedCallback(base::lambda<void(Qt::KeyboardModifiers)> callback) {
|
||||
void MultiSelect::setSubmittedCallback(Fn<void(Qt::KeyboardModifiers)> callback) {
|
||||
_inner->setSubmittedCallback(std::move(callback));
|
||||
}
|
||||
|
||||
void MultiSelect::setResizedCallback(base::lambda<void()> callback) {
|
||||
void MultiSelect::setResizedCallback(Fn<void()> callback) {
|
||||
_resizedCallback = std::move(callback);
|
||||
}
|
||||
|
||||
@@ -324,7 +324,7 @@ void MultiSelect::finishItemsBunch() {
|
||||
_inner->finishItemsBunch(AddItemWay::SkipAnimation);
|
||||
}
|
||||
|
||||
void MultiSelect::setItemRemovedCallback(base::lambda<void(uint64 itemId)> callback) {
|
||||
void MultiSelect::setItemRemovedCallback(Fn<void(uint64 itemId)> callback) {
|
||||
_inner->setItemRemovedCallback(std::move(callback));
|
||||
}
|
||||
|
||||
@@ -353,7 +353,7 @@ int MultiSelect::resizeGetHeight(int newWidth) {
|
||||
return newHeight;
|
||||
}
|
||||
|
||||
MultiSelect::Inner::Inner(QWidget *parent, const style::MultiSelect &st, base::lambda<QString()> placeholder, ScrollCallback callback) : TWidget(parent)
|
||||
MultiSelect::Inner::Inner(QWidget *parent, const style::MultiSelect &st, Fn<QString()> placeholder, ScrollCallback callback) : TWidget(parent)
|
||||
, _st(st)
|
||||
, _scrollCallback(std::move(callback))
|
||||
, _field(this, _st.field, std::move(placeholder))
|
||||
@@ -396,12 +396,12 @@ void MultiSelect::Inner::clearQuery() {
|
||||
_field->setText(QString());
|
||||
}
|
||||
|
||||
void MultiSelect::Inner::setQueryChangedCallback(base::lambda<void(const QString &query)> callback) {
|
||||
void MultiSelect::Inner::setQueryChangedCallback(Fn<void(const QString &query)> callback) {
|
||||
_queryChangedCallback = std::move(callback);
|
||||
}
|
||||
|
||||
void MultiSelect::Inner::setSubmittedCallback(
|
||||
base::lambda<void(Qt::KeyboardModifiers)> callback) {
|
||||
Fn<void(Qt::KeyboardModifiers)> callback) {
|
||||
_submittedCallback = std::move(callback);
|
||||
}
|
||||
|
||||
@@ -709,11 +709,11 @@ void MultiSelect::Inner::setItemText(uint64 itemId, const QString &text) {
|
||||
}
|
||||
}
|
||||
|
||||
void MultiSelect::Inner::setItemRemovedCallback(base::lambda<void(uint64 itemId)> callback) {
|
||||
void MultiSelect::Inner::setItemRemovedCallback(Fn<void(uint64 itemId)> callback) {
|
||||
_itemRemovedCallback = std::move(callback);
|
||||
}
|
||||
|
||||
void MultiSelect::Inner::setResizedCallback(base::lambda<void(int heightDelta)> callback) {
|
||||
void MultiSelect::Inner::setResizedCallback(Fn<void(int heightDelta)> callback) {
|
||||
_resizedCallback = std::move(callback);
|
||||
}
|
||||
|
||||
|
@@ -18,27 +18,27 @@ class ScrollArea;
|
||||
|
||||
class MultiSelect : public RpWidget {
|
||||
public:
|
||||
MultiSelect(QWidget *parent, const style::MultiSelect &st, base::lambda<QString()> placeholderFactory = base::lambda<QString()>());
|
||||
MultiSelect(QWidget *parent, const style::MultiSelect &st, Fn<QString()> placeholderFactory = Fn<QString()>());
|
||||
|
||||
QString getQuery() const;
|
||||
void setInnerFocus();
|
||||
void clearQuery();
|
||||
|
||||
void setQueryChangedCallback(base::lambda<void(const QString &query)> callback);
|
||||
void setSubmittedCallback(base::lambda<void(Qt::KeyboardModifiers)> callback);
|
||||
void setResizedCallback(base::lambda<void()> callback);
|
||||
void setQueryChangedCallback(Fn<void(const QString &query)> callback);
|
||||
void setSubmittedCallback(Fn<void(Qt::KeyboardModifiers)> callback);
|
||||
void setResizedCallback(Fn<void()> callback);
|
||||
|
||||
enum class AddItemWay {
|
||||
Default,
|
||||
SkipAnimation,
|
||||
};
|
||||
using PaintRoundImage = base::lambda<void(Painter &p, int x, int y, int outerWidth, int size)>;
|
||||
using PaintRoundImage = Fn<void(Painter &p, int x, int y, int outerWidth, int size)>;
|
||||
void addItem(uint64 itemId, const QString &text, style::color color, PaintRoundImage paintRoundImage, AddItemWay way = AddItemWay::Default);
|
||||
void addItemInBunch(uint64 itemId, const QString &text, style::color color, PaintRoundImage paintRoundImage);
|
||||
void finishItemsBunch();
|
||||
void setItemText(uint64 itemId, const QString &text);
|
||||
|
||||
void setItemRemovedCallback(base::lambda<void(uint64 itemId)> callback);
|
||||
void setItemRemovedCallback(Fn<void(uint64 itemId)> callback);
|
||||
void removeItem(uint64 itemId);
|
||||
|
||||
int getItemsCount() const;
|
||||
@@ -61,8 +61,8 @@ private:
|
||||
class Inner;
|
||||
QPointer<Inner> _inner;
|
||||
|
||||
base::lambda<void()> _resizedCallback;
|
||||
base::lambda<void(const QString &query)> _queryChangedCallback;
|
||||
Fn<void()> _resizedCallback;
|
||||
Fn<void(const QString &query)> _queryChangedCallback;
|
||||
|
||||
};
|
||||
|
||||
@@ -71,28 +71,28 @@ class MultiSelect::Inner : public TWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
using ScrollCallback = base::lambda<void(int activeTop, int activeBottom)>;
|
||||
Inner(QWidget *parent, const style::MultiSelect &st, base::lambda<QString()> placeholderFactory, ScrollCallback callback);
|
||||
using ScrollCallback = Fn<void(int activeTop, int activeBottom)>;
|
||||
Inner(QWidget *parent, const style::MultiSelect &st, Fn<QString()> placeholderFactory, ScrollCallback callback);
|
||||
|
||||
QString getQuery() const;
|
||||
bool setInnerFocus();
|
||||
void clearQuery();
|
||||
|
||||
void setQueryChangedCallback(base::lambda<void(const QString &query)> callback);
|
||||
void setSubmittedCallback(base::lambda<void(Qt::KeyboardModifiers)> callback);
|
||||
void setQueryChangedCallback(Fn<void(const QString &query)> callback);
|
||||
void setSubmittedCallback(Fn<void(Qt::KeyboardModifiers)> callback);
|
||||
|
||||
void addItemInBunch(std::unique_ptr<Item> item);
|
||||
void finishItemsBunch(AddItemWay way);
|
||||
void setItemText(uint64 itemId, const QString &text);
|
||||
|
||||
void setItemRemovedCallback(base::lambda<void(uint64 itemId)> callback);
|
||||
void setItemRemovedCallback(Fn<void(uint64 itemId)> callback);
|
||||
void removeItem(uint64 itemId);
|
||||
|
||||
int getItemsCount() const;
|
||||
QVector<uint64> getItems() const;
|
||||
bool hasItem(uint64 itemId) const;
|
||||
|
||||
void setResizedCallback(base::lambda<void(int heightDelta)> callback);
|
||||
void setResizedCallback(Fn<void(int heightDelta)> callback);
|
||||
|
||||
~Inner();
|
||||
|
||||
@@ -152,10 +152,10 @@ private:
|
||||
int _newHeight = 0;
|
||||
Animation _height;
|
||||
|
||||
base::lambda<void(const QString &query)> _queryChangedCallback;
|
||||
base::lambda<void(Qt::KeyboardModifiers)> _submittedCallback;
|
||||
base::lambda<void(uint64 itemId)> _itemRemovedCallback;
|
||||
base::lambda<void(int heightDelta)> _resizedCallback;
|
||||
Fn<void(const QString &query)> _queryChangedCallback;
|
||||
Fn<void(Qt::KeyboardModifiers)> _submittedCallback;
|
||||
Fn<void(uint64 itemId)> _itemRemovedCallback;
|
||||
Fn<void(int heightDelta)> _resizedCallback;
|
||||
|
||||
};
|
||||
|
||||
@@ -182,7 +182,7 @@ public:
|
||||
void setPosition(int x, int y, int outerWidth, int maxVisiblePadding);
|
||||
QRect paintArea(int outerWidth) const;
|
||||
|
||||
void setUpdateCallback(base::lambda<void()> updateCallback) {
|
||||
void setUpdateCallback(Fn<void()> updateCallback) {
|
||||
_updateCallback = updateCallback;
|
||||
}
|
||||
void setText(const QString &text);
|
||||
@@ -214,7 +214,7 @@ private:
|
||||
|
||||
uint64 _id;
|
||||
struct SlideAnimation {
|
||||
SlideAnimation(base::lambda<void()> updateCallback, int fromX, int toX, int y, float64 duration)
|
||||
SlideAnimation(Fn<void()> updateCallback, int fromX, int toX, int y, float64 duration)
|
||||
: fromX(fromX)
|
||||
, toX(toX)
|
||||
, y(y) {
|
||||
@@ -237,7 +237,7 @@ private:
|
||||
bool _overDelete = false;
|
||||
bool _active = false;
|
||||
PaintRoundImage _paintRoundImage;
|
||||
base::lambda<void()> _updateCallback;
|
||||
Fn<void()> _updateCallback;
|
||||
bool _hiding = false;
|
||||
|
||||
};
|
||||
|
@@ -82,7 +82,7 @@ QAction *PopupMenu::addAction(const QString &text, const QObject *receiver, cons
|
||||
return _menu->addAction(text, receiver, member, icon, iconOver);
|
||||
}
|
||||
|
||||
QAction *PopupMenu::addAction(const QString &text, base::lambda<void()> callback, const style::icon *icon, const style::icon *iconOver) {
|
||||
QAction *PopupMenu::addAction(const QString &text, Fn<void()> callback, const style::icon *icon, const style::icon *iconOver) {
|
||||
return _menu->addAction(text, std::move(callback), icon, iconOver);
|
||||
}
|
||||
|
||||
|
@@ -19,7 +19,7 @@ public:
|
||||
PopupMenu(QWidget*, QMenu *menu, const style::PopupMenu &st = st::defaultPopupMenu);
|
||||
|
||||
QAction *addAction(const QString &text, const QObject *receiver, const char* member, const style::icon *icon = nullptr, const style::icon *iconOver = nullptr);
|
||||
QAction *addAction(const QString &text, base::lambda<void()> callback, const style::icon *icon = nullptr, const style::icon *iconOver = nullptr);
|
||||
QAction *addAction(const QString &text, Fn<void()> callback, const style::icon *icon = nullptr, const style::icon *iconOver = nullptr);
|
||||
QAction *addSeparator();
|
||||
void clearActions();
|
||||
|
||||
@@ -30,7 +30,7 @@ public:
|
||||
void popup(const QPoint &p);
|
||||
void hideMenu(bool fast = false);
|
||||
|
||||
void setDestroyedCallback(base::lambda<void()> callback) {
|
||||
void setDestroyedCallback(Fn<void()> callback) {
|
||||
_destroyedCallback = std::move(callback);
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ private:
|
||||
bool _triggering = false;
|
||||
bool _deleteLater = false;
|
||||
|
||||
base::lambda<void()> _destroyedCallback;
|
||||
Fn<void()> _destroyedCallback;
|
||||
|
||||
};
|
||||
|
||||
|
@@ -75,7 +75,7 @@ public:
|
||||
void toggleFast(bool visible);
|
||||
void hideAfter(TimeMs timeout);
|
||||
|
||||
void setHiddenCallback(base::lambda<void()> callback) {
|
||||
void setHiddenCallback(Fn<void()> callback) {
|
||||
_hiddenCallback = std::move(callback);
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ private:
|
||||
|
||||
Animation _visibleAnimation;
|
||||
bool _visible = false;
|
||||
base::lambda<void()> _hiddenCallback;
|
||||
Fn<void()> _hiddenCallback;
|
||||
bool _useTransparency = true;
|
||||
QPixmap _cache;
|
||||
|
||||
|
Reference in New Issue
Block a user