mirror of https://github.com/procxx/kepka.git
parent
e7bace9ab3
commit
38efa1bf4b
|
@ -54,7 +54,7 @@ public:
|
|||
void start();
|
||||
void applyUpdates(const MTPUpdates &updates, quint64 sentMessageRandomId = 0);
|
||||
|
||||
using RequestMessageDataCallback = base::lambda<void(ChannelData *, MsgId)>;
|
||||
using RequestMessageDataCallback = Fn<void(ChannelData *, MsgId)>;
|
||||
void requestMessageData(ChannelData *channel, MsgId msgId, RequestMessageDataCallback callback);
|
||||
|
||||
void requestFullPeer(PeerData *peer);
|
||||
|
|
|
@ -1582,7 +1582,7 @@ PeerData *peer(const PeerId &id, PeerData::LoadedStatus restriction) {
|
|||
return i.value();
|
||||
}
|
||||
|
||||
void enumerateUsers(base::lambda<void(UserData *)> action) {
|
||||
void enumerateUsers(Fn<void(UserData *)> action) {
|
||||
for_const (auto peer, peersData) {
|
||||
if (auto user = peer->asUser()) {
|
||||
action(user);
|
||||
|
|
|
@ -142,7 +142,7 @@ inline ChatData *chatLoaded(ChatId chatId) {
|
|||
inline ChannelData *channelLoaded(ChannelId channelId) {
|
||||
return channel(channelId, PeerData::FullLoaded);
|
||||
}
|
||||
void enumerateUsers(base::lambda<void(UserData *)> action);
|
||||
void enumerateUsers(Fn<void(UserData *)> action);
|
||||
|
||||
UserData *self();
|
||||
PeerData *peerByName(const QString &username);
|
||||
|
|
|
@ -30,10 +30,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
|||
|
||||
namespace base {
|
||||
|
||||
template <typename Function> using lambda = std::function<Function>;
|
||||
|
||||
template <typename Function> using lambda_once = unique_function<Function>;
|
||||
|
||||
namespace lambda_internal {
|
||||
|
||||
template <typename Lambda> struct lambda_call_type { using type = decltype(&Lambda::operator()); };
|
||||
|
|
|
@ -21,7 +21,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
|||
#pragma once
|
||||
|
||||
#include "base/assertion.h"
|
||||
#include "base/lambda.h"
|
||||
#include "base/type_traits.h"
|
||||
#include "core/utils.h"
|
||||
#include <QSharedPointer>
|
||||
|
@ -31,16 +30,14 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
|||
namespace base {
|
||||
namespace internal {
|
||||
|
||||
using ObservableCallHandlers = base::lambda<void()>;
|
||||
using ObservableCallHandlers = Fn<void()>;
|
||||
void RegisterPendingObservable(ObservableCallHandlers *handlers);
|
||||
void UnregisterActiveObservable(ObservableCallHandlers *handlers);
|
||||
void UnregisterObservable(ObservableCallHandlers *handlers);
|
||||
|
||||
template <typename EventType> struct SubscriptionHandlerHelper {
|
||||
using type = base::lambda<void(parameter_type<EventType>)>;
|
||||
};
|
||||
template <typename EventType> struct SubscriptionHandlerHelper { using type = Fn<void(parameter_type<EventType>)>; };
|
||||
|
||||
template <> struct SubscriptionHandlerHelper<void> { using type = base::lambda<void()>; };
|
||||
template <> struct SubscriptionHandlerHelper<void> { using type = Fn<void()>; };
|
||||
|
||||
template <typename EventType> using SubscriptionHandler = typename SubscriptionHandlerHelper<EventType>::type;
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#include "base/lambda.h"
|
||||
#include "base/timer.h"
|
||||
#include <QMutex>
|
||||
#include <deque>
|
||||
|
@ -28,7 +27,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
|||
|
||||
namespace base {
|
||||
|
||||
using Task = lambda_once<void()>;
|
||||
using Task = FnMut<void()>;
|
||||
|
||||
// An attempt to create/use a TaskQueue or one of the default queues
|
||||
// after the main() has returned leads to an undefined behaviour.
|
||||
|
|
|
@ -31,7 +31,7 @@ QObject *TimersAdjuster() {
|
|||
|
||||
} // namespace
|
||||
|
||||
Timer::Timer(base::lambda<void()> callback)
|
||||
Timer::Timer(Fn<void()> callback)
|
||||
: QObject(nullptr)
|
||||
, _callback(std::move(callback))
|
||||
, _type(Qt::PreciseTimer)
|
||||
|
@ -108,7 +108,7 @@ void Timer::timerEvent(QTimerEvent *e) {
|
|||
}
|
||||
}
|
||||
|
||||
int DelayedCallTimer::call(TimeMs timeout, lambda_once<void()> callback, Qt::TimerType type) {
|
||||
int DelayedCallTimer::call(TimeMs timeout, FnMut<void()> callback, Qt::TimerType type) {
|
||||
Expects(timeout >= 0);
|
||||
if (!callback) {
|
||||
return 0;
|
||||
|
|
|
@ -20,7 +20,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#include "base/lambda.h"
|
||||
#include "base/observer.h"
|
||||
|
||||
using TimeMs = qint64;
|
||||
|
@ -29,14 +28,14 @@ namespace base {
|
|||
|
||||
class Timer final : private QObject {
|
||||
public:
|
||||
Timer(base::lambda<void()> callback = base::lambda<void()>());
|
||||
Timer(Fn<void()> callback = Fn<void()>());
|
||||
|
||||
static Qt::TimerType DefaultType(TimeMs timeout) {
|
||||
constexpr auto kThreshold = TimeMs(1000);
|
||||
return (timeout > kThreshold) ? Qt::CoarseTimer : Qt::PreciseTimer;
|
||||
}
|
||||
|
||||
void setCallback(base::lambda<void()> callback) {
|
||||
void setCallback(Fn<void()> callback) {
|
||||
_callback = std::move(callback);
|
||||
}
|
||||
|
||||
|
@ -86,7 +85,7 @@ private:
|
|||
return static_cast<Repeat>(_repeat);
|
||||
}
|
||||
|
||||
base::lambda<void()> _callback;
|
||||
Fn<void()> _callback;
|
||||
TimeMs _next = 0;
|
||||
int _timeout = 0;
|
||||
int _timerId = 0;
|
||||
|
@ -98,18 +97,18 @@ private:
|
|||
|
||||
class DelayedCallTimer final : private QObject {
|
||||
public:
|
||||
int call(TimeMs timeout, lambda_once<void()> callback) {
|
||||
int call(TimeMs timeout, FnMut<void()> callback) {
|
||||
return call(timeout, std::move(callback), Timer::DefaultType(timeout));
|
||||
}
|
||||
|
||||
int call(TimeMs timeout, lambda_once<void()> callback, Qt::TimerType type);
|
||||
int call(TimeMs timeout, FnMut<void()> callback, Qt::TimerType type);
|
||||
void cancel(int callId);
|
||||
|
||||
protected:
|
||||
void timerEvent(QTimerEvent *e) override;
|
||||
|
||||
private:
|
||||
std::map<int, lambda_once<void()>> _callbacks; // Better to use flatmap.
|
||||
std::map<int, FnMut<void()>> _callbacks; // Better to use flatmap.
|
||||
};
|
||||
|
||||
} // namespace base
|
||||
|
|
|
@ -32,13 +32,11 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
|||
#include "ui/widgets/labels.h"
|
||||
#include "ui/widgets/scroll_area.h"
|
||||
|
||||
QPointer<Ui::RoundButton> BoxContent::addButton(base::lambda<QString()> textFactory,
|
||||
base::lambda<void()> clickCallback) {
|
||||
QPointer<Ui::RoundButton> BoxContent::addButton(Fn<QString()> textFactory, Fn<void()> clickCallback) {
|
||||
return addButton(std::move(textFactory), std::move(clickCallback), st::defaultBoxButton);
|
||||
}
|
||||
|
||||
QPointer<Ui::RoundButton> BoxContent::addLeftButton(base::lambda<QString()> textFactory,
|
||||
base::lambda<void()> clickCallback) {
|
||||
QPointer<Ui::RoundButton> BoxContent::addLeftButton(Fn<QString()> textFactory, Fn<void()> clickCallback) {
|
||||
return getDelegate()->addLeftButton(std::move(textFactory), std::move(clickCallback), st::defaultBoxButton);
|
||||
}
|
||||
|
||||
|
@ -279,7 +277,7 @@ void AbstractBox::parentResized() {
|
|||
update();
|
||||
}
|
||||
|
||||
void AbstractBox::setTitle(base::lambda<TextWithEntities()> titleFactory) {
|
||||
void AbstractBox::setTitle(Fn<TextWithEntities()> titleFactory) {
|
||||
_titleFactory = std::move(titleFactory);
|
||||
refreshTitle();
|
||||
}
|
||||
|
@ -300,7 +298,7 @@ void AbstractBox::refreshTitle() {
|
|||
}
|
||||
}
|
||||
|
||||
void AbstractBox::setAdditionalTitle(base::lambda<QString()> additionalFactory) {
|
||||
void AbstractBox::setAdditionalTitle(Fn<QString()> additionalFactory) {
|
||||
_additionalTitleFactory = std::move(additionalFactory);
|
||||
refreshAdditionalTitle();
|
||||
}
|
||||
|
@ -355,8 +353,8 @@ void AbstractBox::clearButtons() {
|
|||
_leftButton.destroy();
|
||||
}
|
||||
|
||||
QPointer<Ui::RoundButton> AbstractBox::addButton(base::lambda<QString()> textFactory,
|
||||
base::lambda<void()> clickCallback, const style::RoundButton &st) {
|
||||
QPointer<Ui::RoundButton> AbstractBox::addButton(Fn<QString()> textFactory, Fn<void()> clickCallback,
|
||||
const style::RoundButton &st) {
|
||||
_buttons.push_back(object_ptr<Ui::RoundButton>(this, std::move(textFactory), st));
|
||||
auto result = QPointer<Ui::RoundButton>(_buttons.back());
|
||||
result->setClickedCallback(std::move(clickCallback));
|
||||
|
@ -365,8 +363,8 @@ QPointer<Ui::RoundButton> AbstractBox::addButton(base::lambda<QString()> textFac
|
|||
return result;
|
||||
}
|
||||
|
||||
QPointer<Ui::RoundButton> AbstractBox::addLeftButton(base::lambda<QString()> textFactory,
|
||||
base::lambda<void()> clickCallback, const style::RoundButton &st) {
|
||||
QPointer<Ui::RoundButton> AbstractBox::addLeftButton(Fn<QString()> textFactory, Fn<void()> clickCallback,
|
||||
const style::RoundButton &st) {
|
||||
_leftButton = object_ptr<Ui::RoundButton>(this, std::move(textFactory), st);
|
||||
auto result = QPointer<Ui::RoundButton>(_leftButton);
|
||||
result->setClickedCallback(std::move(clickCallback));
|
||||
|
|
|
@ -20,7 +20,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#include "base/lambda.h"
|
||||
#include "base/observer.h"
|
||||
#include "layerwidget.h"
|
||||
#include "ui/text/text_entity.h"
|
||||
|
@ -46,14 +45,13 @@ public:
|
|||
virtual Window::Controller *controller() const = 0;
|
||||
|
||||
virtual void setLayerType(bool layerType) = 0;
|
||||
virtual void setTitle(base::lambda<TextWithEntities()> titleFactory) = 0;
|
||||
virtual void setAdditionalTitle(base::lambda<QString()> additionalFactory) = 0;
|
||||
virtual void setTitle(Fn<TextWithEntities()> titleFactory) = 0;
|
||||
virtual void setAdditionalTitle(Fn<QString()> additionalFactory) = 0;
|
||||
|
||||
virtual void clearButtons() = 0;
|
||||
virtual QPointer<Ui::RoundButton> addButton(base::lambda<QString()> textFactory, base::lambda<void()> clickCallback,
|
||||
virtual QPointer<Ui::RoundButton> addButton(Fn<QString()> textFactory, Fn<void()> clickCallback,
|
||||
const style::RoundButton &st) = 0;
|
||||
virtual QPointer<Ui::RoundButton> addLeftButton(base::lambda<QString()> textFactory,
|
||||
base::lambda<void()> clickCallback,
|
||||
virtual QPointer<Ui::RoundButton> addLeftButton(Fn<QString()> textFactory, Fn<void()> clickCallback,
|
||||
const style::RoundButton &st) = 0;
|
||||
virtual void updateButtonsPositions() = 0;
|
||||
|
||||
|
@ -78,26 +76,26 @@ public:
|
|||
getDelegate()->closeBox();
|
||||
}
|
||||
|
||||
void setTitle(base::lambda<QString()> titleFactory) {
|
||||
void setTitle(Fn<QString()> titleFactory) {
|
||||
if (titleFactory) {
|
||||
getDelegate()->setTitle([titleFactory] { return TextWithEntities{titleFactory(), EntitiesInText()}; });
|
||||
} else {
|
||||
getDelegate()->setTitle(base::lambda<TextWithEntities()>());
|
||||
getDelegate()->setTitle(Fn<TextWithEntities()>());
|
||||
}
|
||||
}
|
||||
void setTitle(base::lambda<TextWithEntities()> titleFactory) {
|
||||
void setTitle(Fn<TextWithEntities()> titleFactory) {
|
||||
getDelegate()->setTitle(std::move(titleFactory));
|
||||
}
|
||||
void setAdditionalTitle(base::lambda<QString()> additional) {
|
||||
void setAdditionalTitle(Fn<QString()> additional) {
|
||||
getDelegate()->setAdditionalTitle(std::move(additional));
|
||||
}
|
||||
|
||||
void clearButtons() {
|
||||
getDelegate()->clearButtons();
|
||||
}
|
||||
QPointer<Ui::RoundButton> addButton(base::lambda<QString()> textFactory, base::lambda<void()> clickCallback);
|
||||
QPointer<Ui::RoundButton> addLeftButton(base::lambda<QString()> textFactory, base::lambda<void()> clickCallback);
|
||||
QPointer<Ui::RoundButton> addButton(base::lambda<QString()> textFactory, base::lambda<void()> clickCallback,
|
||||
QPointer<Ui::RoundButton> addButton(Fn<QString()> textFactory, Fn<void()> clickCallback);
|
||||
QPointer<Ui::RoundButton> addLeftButton(Fn<QString()> textFactory, Fn<void()> clickCallback);
|
||||
QPointer<Ui::RoundButton> addButton(Fn<QString()> textFactory, Fn<void()> clickCallback,
|
||||
const style::RoundButton &st) {
|
||||
return getDelegate()->addButton(std::move(textFactory), std::move(clickCallback), st);
|
||||
}
|
||||
|
@ -214,13 +212,13 @@ public:
|
|||
void parentResized() override;
|
||||
|
||||
void setLayerType(bool layerType) override;
|
||||
void setTitle(base::lambda<TextWithEntities()> titleFactory) override;
|
||||
void setAdditionalTitle(base::lambda<QString()> additionalFactory) override;
|
||||
void setTitle(Fn<TextWithEntities()> titleFactory) override;
|
||||
void setAdditionalTitle(Fn<QString()> additionalFactory) override;
|
||||
|
||||
void clearButtons() override;
|
||||
QPointer<Ui::RoundButton> addButton(base::lambda<QString()> textFactory, base::lambda<void()> clickCallback,
|
||||
QPointer<Ui::RoundButton> addButton(Fn<QString()> textFactory, Fn<void()> clickCallback,
|
||||
const style::RoundButton &st) override;
|
||||
QPointer<Ui::RoundButton> addLeftButton(base::lambda<QString()> textFactory, base::lambda<void()> clickCallback,
|
||||
QPointer<Ui::RoundButton> addLeftButton(Fn<QString()> textFactory, Fn<void()> clickCallback,
|
||||
const style::RoundButton &st) override;
|
||||
void updateButtonsPositions() override;
|
||||
|
||||
|
@ -276,9 +274,9 @@ private:
|
|||
object_ptr<BoxContent> _content;
|
||||
|
||||
object_ptr<Ui::FlatLabel> _title = {nullptr};
|
||||
base::lambda<TextWithEntities()> _titleFactory;
|
||||
Fn<TextWithEntities()> _titleFactory;
|
||||
QString _additionalTitle;
|
||||
base::lambda<QString()> _additionalTitleFactory;
|
||||
Fn<QString()> _additionalTitleFactory;
|
||||
int _titleLeft = 0;
|
||||
int _titleTop = 0;
|
||||
bool _layerType = false;
|
||||
|
|
|
@ -68,7 +68,7 @@ QString PeerFloodErrorText(PeerFloodType type) {
|
|||
|
||||
class RevokePublicLinkBox::Inner : public TWidget, private MTP::Sender {
|
||||
public:
|
||||
Inner(QWidget *parent, base::lambda<void()> revokeCallback);
|
||||
Inner(QWidget *parent, Fn<void()> revokeCallback);
|
||||
|
||||
protected:
|
||||
void mouseMoveEvent(QMouseEvent *e) override;
|
||||
|
@ -96,7 +96,7 @@ private:
|
|||
int _rowHeight = 0;
|
||||
int _revokeWidth = 0;
|
||||
|
||||
base::lambda<void()> _revokeCallback;
|
||||
Fn<void()> _revokeCallback;
|
||||
mtpRequestId _revokeRequestId = 0;
|
||||
QPointer<ConfirmBox> _weakRevokeConfirmBox;
|
||||
};
|
||||
|
@ -600,7 +600,7 @@ SetupChannelBox::SetupChannelBox(QWidget *, ChannelData *channel, bool existing)
|
|||
, _aboutPrivate(st::defaultTextStyle,
|
||||
lang(channel->isMegagroup() ? lng_create_private_group_about : lng_create_private_channel_about),
|
||||
_defaultOptions, _aboutPublicWidth)
|
||||
, _link(this, st::setupChannelLink, base::lambda<QString()>(), channel->username, true) {}
|
||||
, _link(this, st::setupChannelLink, Fn<QString()>(), channel->username, true) {}
|
||||
|
||||
void SetupChannelBox::prepare() {
|
||||
_aboutPublicHeight = _aboutPublic.countHeight(_aboutPublicWidth);
|
||||
|
@ -1479,7 +1479,7 @@ void EditChannelBox::onSaveInvitesDone(const MTPUpdates &result) {
|
|||
closeBox();
|
||||
}
|
||||
|
||||
RevokePublicLinkBox::Inner::Inner(QWidget *parent, base::lambda<void()> revokeCallback)
|
||||
RevokePublicLinkBox::Inner::Inner(QWidget *parent, Fn<void()> revokeCallback)
|
||||
: TWidget(parent)
|
||||
, _rowHeight(st::contactsPadding.top() + st::contactsPhotoSize + st::contactsPadding.bottom())
|
||||
, _revokeWidth(st::normalFont->width(lang(lng_channels_too_much_public_revoke)))
|
||||
|
@ -1513,7 +1513,7 @@ RevokePublicLinkBox::Inner::Inner(QWidget *parent, base::lambda<void()> revokeCa
|
|||
.send();
|
||||
}
|
||||
|
||||
RevokePublicLinkBox::RevokePublicLinkBox(QWidget *, base::lambda<void()> revokeCallback)
|
||||
RevokePublicLinkBox::RevokePublicLinkBox(QWidget *, Fn<void()> revokeCallback)
|
||||
: _aboutRevoke(this, lang(lng_channels_too_much_public_about), Ui::FlatLabel::InitType::Simple,
|
||||
st::aboutRevokePublicLabel)
|
||||
, _revokeCallback(std::move(revokeCallback)) {}
|
||||
|
|
|
@ -321,7 +321,7 @@ private:
|
|||
|
||||
class RevokePublicLinkBox : public BoxContent, public RPCSender {
|
||||
public:
|
||||
RevokePublicLinkBox(QWidget *, base::lambda<void()> revokeCallback);
|
||||
RevokePublicLinkBox(QWidget *, Fn<void()> revokeCallback);
|
||||
|
||||
protected:
|
||||
void prepare() override;
|
||||
|
@ -335,5 +335,5 @@ private:
|
|||
QPointer<Inner> _inner;
|
||||
|
||||
int _innerTop = 0;
|
||||
base::lambda<void()> _revokeCallback;
|
||||
Fn<void()> _revokeCallback;
|
||||
};
|
||||
|
|
|
@ -33,7 +33,7 @@ class BackgroundBox::Inner : public TWidget, public RPCSender, private base::Sub
|
|||
public:
|
||||
Inner(QWidget *parent);
|
||||
|
||||
void setBackgroundChosenCallback(base::lambda<void(int index)> callback) {
|
||||
void setBackgroundChosenCallback(Fn<void(int index)> callback) {
|
||||
_backgroundChosenCallback = std::move(callback);
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ private:
|
|||
void gotWallpapers(const MTPVector<MTPWallPaper> &result);
|
||||
void updateWallpapers();
|
||||
|
||||
base::lambda<void(int index)> _backgroundChosenCallback;
|
||||
Fn<void(int index)> _backgroundChosenCallback;
|
||||
|
||||
int _bgCount = 0;
|
||||
int _rows = 0;
|
||||
|
|
|
@ -204,7 +204,7 @@ public:
|
|||
return st::calendarPadding.top() + innerHeight + st::calendarPadding.bottom();
|
||||
}
|
||||
|
||||
void setDateChosenCallback(base::lambda<void(QDate)> callback) {
|
||||
void setDateChosenCallback(Fn<void(QDate)> callback) {
|
||||
_dateChosenCallback = std::move(callback);
|
||||
}
|
||||
|
||||
|
@ -230,7 +230,7 @@ private:
|
|||
|
||||
std::map<int, std::unique_ptr<Ui::RippleAnimation>> _ripples;
|
||||
|
||||
base::lambda<void(QDate)> _dateChosenCallback;
|
||||
Fn<void(QDate)> _dateChosenCallback;
|
||||
|
||||
static constexpr auto kEmptySelection = -kDaysInWeek;
|
||||
int _selected = kEmptySelection;
|
||||
|
@ -438,7 +438,7 @@ void CalendarBox::Title::paintEvent(QPaintEvent *e) {
|
|||
_textWidth);
|
||||
}
|
||||
|
||||
CalendarBox::CalendarBox(QWidget *, QDate month, QDate highlighted, base::lambda<void(QDate date)> callback)
|
||||
CalendarBox::CalendarBox(QWidget *, QDate month, QDate highlighted, Fn<void(QDate date)> callback)
|
||||
: _context(std::make_unique<Context>(month, highlighted))
|
||||
, _inner(this, _context.get())
|
||||
, _title(this, _context.get())
|
||||
|
|
|
@ -28,7 +28,7 @@ class IconButton;
|
|||
|
||||
class CalendarBox : public BoxContent {
|
||||
public:
|
||||
CalendarBox(QWidget *, QDate month, QDate highlighted, base::lambda<void(QDate date)> callback);
|
||||
CalendarBox(QWidget *, QDate month, QDate highlighted, Fn<void(QDate date)> callback);
|
||||
|
||||
void setMinDate(QDate date);
|
||||
void setMaxDate(QDate date);
|
||||
|
@ -57,5 +57,5 @@ private:
|
|||
object_ptr<Ui::IconButton> _previous;
|
||||
object_ptr<Ui::IconButton> _next;
|
||||
|
||||
base::lambda<void(QDate date)> _callback;
|
||||
Fn<void(QDate date)> _callback;
|
||||
};
|
||||
|
|
|
@ -42,8 +42,7 @@ TextParseOptions _confirmBoxTextOptions = {
|
|||
Qt::LayoutDirectionAuto, // dir
|
||||
};
|
||||
|
||||
ConfirmBox::ConfirmBox(QWidget *, const QString &text, base::lambda_once<void()> confirmedCallback,
|
||||
base::lambda_once<void()> cancelledCallback)
|
||||
ConfirmBox::ConfirmBox(QWidget *, const QString &text, FnMut<void()> confirmedCallback, FnMut<void()> cancelledCallback)
|
||||
: _confirmText(lang(lng_box_ok))
|
||||
, _cancelText(lang(lng_cancel))
|
||||
, _confirmStyle(st::defaultBoxButton)
|
||||
|
@ -53,8 +52,8 @@ ConfirmBox::ConfirmBox(QWidget *, const QString &text, base::lambda_once<void()>
|
|||
init(text);
|
||||
}
|
||||
|
||||
ConfirmBox::ConfirmBox(QWidget *, const QString &text, const QString &confirmText,
|
||||
base::lambda_once<void()> confirmedCallback, base::lambda_once<void()> cancelledCallback)
|
||||
ConfirmBox::ConfirmBox(QWidget *, const QString &text, const QString &confirmText, FnMut<void()> confirmedCallback,
|
||||
FnMut<void()> cancelledCallback)
|
||||
: _confirmText(confirmText)
|
||||
, _cancelText(lang(lng_cancel))
|
||||
, _confirmStyle(st::defaultBoxButton)
|
||||
|
@ -65,8 +64,8 @@ ConfirmBox::ConfirmBox(QWidget *, const QString &text, const QString &confirmTex
|
|||
}
|
||||
|
||||
ConfirmBox::ConfirmBox(QWidget *, const QString &text, const QString &confirmText,
|
||||
const style::RoundButton &confirmStyle, base::lambda_once<void()> confirmedCallback,
|
||||
base::lambda_once<void()> cancelledCallback)
|
||||
const style::RoundButton &confirmStyle, FnMut<void()> confirmedCallback,
|
||||
FnMut<void()> cancelledCallback)
|
||||
: _confirmText(confirmText)
|
||||
, _cancelText(lang(lng_cancel))
|
||||
, _confirmStyle(confirmStyle)
|
||||
|
@ -77,7 +76,7 @@ ConfirmBox::ConfirmBox(QWidget *, const QString &text, const QString &confirmTex
|
|||
}
|
||||
|
||||
ConfirmBox::ConfirmBox(QWidget *, const QString &text, const QString &confirmText, const QString &cancelText,
|
||||
base::lambda_once<void()> confirmedCallback, base::lambda_once<void()> cancelledCallback)
|
||||
FnMut<void()> confirmedCallback, FnMut<void()> cancelledCallback)
|
||||
: _confirmText(confirmText)
|
||||
, _cancelText(cancelText)
|
||||
, _confirmStyle(st::defaultBoxButton)
|
||||
|
@ -89,7 +88,7 @@ ConfirmBox::ConfirmBox(QWidget *, const QString &text, const QString &confirmTex
|
|||
|
||||
ConfirmBox::ConfirmBox(QWidget *, const QString &text, const QString &confirmText,
|
||||
const style::RoundButton &confirmStyle, const QString &cancelText,
|
||||
base::lambda_once<void()> confirmedCallback, base::lambda_once<void()> cancelledCallback)
|
||||
FnMut<void()> confirmedCallback, FnMut<void()> cancelledCallback)
|
||||
: _confirmText(confirmText)
|
||||
, _cancelText(cancelText)
|
||||
, _confirmStyle(st::defaultBoxButton)
|
||||
|
@ -99,8 +98,7 @@ ConfirmBox::ConfirmBox(QWidget *, const QString &text, const QString &confirmTex
|
|||
init(text);
|
||||
}
|
||||
|
||||
ConfirmBox::ConfirmBox(const InformBoxTag &, const QString &text, const QString &doneText,
|
||||
base::lambda<void()> closedCallback)
|
||||
ConfirmBox::ConfirmBox(const InformBoxTag &, const QString &text, const QString &doneText, Fn<void()> closedCallback)
|
||||
: _confirmText(doneText)
|
||||
, _confirmStyle(st::defaultBoxButton)
|
||||
, _informative(true)
|
||||
|
@ -110,7 +108,7 @@ ConfirmBox::ConfirmBox(const InformBoxTag &, const QString &text, const QString
|
|||
init(text);
|
||||
}
|
||||
|
||||
base::lambda_once<void()> ConfirmBox::generateInformCallback(base::lambda<void()> closedCallback) {
|
||||
FnMut<void()> ConfirmBox::generateInformCallback(Fn<void()> closedCallback) {
|
||||
return base::lambda_guarded(this, [this, closedCallback] {
|
||||
closeBox();
|
||||
if (closedCallback) {
|
||||
|
@ -222,10 +220,10 @@ void ConfirmBox::paintEvent(QPaintEvent *e) {
|
|||
_text.drawLeftElided(p, st::boxPadding.left(), st::boxPadding.top(), _textWidth, width(), 16, style::al_left);
|
||||
}
|
||||
|
||||
InformBox::InformBox(QWidget *, const QString &text, base::lambda<void()> closedCallback)
|
||||
InformBox::InformBox(QWidget *, const QString &text, Fn<void()> closedCallback)
|
||||
: ConfirmBox(ConfirmBox::InformBoxTag(), text, lang(lng_box_ok), std::move(closedCallback)) {}
|
||||
|
||||
InformBox::InformBox(QWidget *, const QString &text, const QString &doneText, base::lambda<void()> closedCallback)
|
||||
InformBox::InformBox(QWidget *, const QString &text, const QString &doneText, Fn<void()> closedCallback)
|
||||
: ConfirmBox(ConfirmBox::InformBoxTag(), text, doneText, std::move(closedCallback)) {}
|
||||
|
||||
MaxInviteBox::MaxInviteBox(QWidget *, not_null<ChannelData *> channel)
|
||||
|
|
|
@ -31,21 +31,17 @@ class FlatLabel;
|
|||
class InformBox;
|
||||
class ConfirmBox : public BoxContent, public ClickHandlerHost {
|
||||
public:
|
||||
ConfirmBox(QWidget *, const QString &text,
|
||||
base::lambda_once<void()> confirmedCallback = base::lambda_once<void()>(),
|
||||
base::lambda_once<void()> cancelledCallback = base::lambda_once<void()>());
|
||||
ConfirmBox(QWidget *, const QString &text, FnMut<void()> confirmedCallback = FnMut<void()>(),
|
||||
FnMut<void()> cancelledCallback = FnMut<void()>());
|
||||
ConfirmBox(QWidget *, const QString &text, const QString &confirmText,
|
||||
base::lambda_once<void()> confirmedCallback = base::lambda_once<void()>(),
|
||||
base::lambda_once<void()> cancelledCallback = base::lambda_once<void()>());
|
||||
FnMut<void()> confirmedCallback = FnMut<void()>(), FnMut<void()> cancelledCallback = FnMut<void()>());
|
||||
ConfirmBox(QWidget *, const QString &text, const QString &confirmText, const style::RoundButton &confirmStyle,
|
||||
base::lambda_once<void()> confirmedCallback = base::lambda_once<void()>(),
|
||||
base::lambda_once<void()> cancelledCallback = base::lambda_once<void()>());
|
||||
FnMut<void()> confirmedCallback = FnMut<void()>(), FnMut<void()> cancelledCallback = FnMut<void()>());
|
||||
ConfirmBox(QWidget *, const QString &text, const QString &confirmText, const QString &cancelText,
|
||||
base::lambda_once<void()> confirmedCallback = base::lambda_once<void()>(),
|
||||
base::lambda_once<void()> cancelledCallback = base::lambda_once<void()>());
|
||||
FnMut<void()> confirmedCallback = FnMut<void()>(), FnMut<void()> cancelledCallback = FnMut<void()>());
|
||||
ConfirmBox(QWidget *, const QString &text, const QString &confirmText, const style::RoundButton &confirmStyle,
|
||||
const QString &cancelText, base::lambda_once<void()> confirmedCallback = base::lambda_once<void()>(),
|
||||
base::lambda_once<void()> cancelledCallback = base::lambda_once<void()>());
|
||||
const QString &cancelText, FnMut<void()> confirmedCallback = FnMut<void()>(),
|
||||
FnMut<void()> cancelledCallback = FnMut<void()>());
|
||||
|
||||
void updateLink();
|
||||
|
||||
|
@ -70,8 +66,8 @@ protected:
|
|||
|
||||
private:
|
||||
struct InformBoxTag {};
|
||||
ConfirmBox(const InformBoxTag &, const QString &text, const QString &doneText, base::lambda<void()> closedCallback);
|
||||
base::lambda_once<void()> generateInformCallback(base::lambda<void()> closedCallback);
|
||||
ConfirmBox(const InformBoxTag &, const QString &text, const QString &doneText, Fn<void()> closedCallback);
|
||||
FnMut<void()> generateInformCallback(Fn<void()> closedCallback);
|
||||
friend class InformBox;
|
||||
|
||||
void confirmed();
|
||||
|
@ -94,15 +90,14 @@ private:
|
|||
bool _confirmed = false;
|
||||
bool _cancelled = false;
|
||||
bool _strictCancel = false;
|
||||
base::lambda_once<void()> _confirmedCallback;
|
||||
base::lambda_once<void()> _cancelledCallback;
|
||||
FnMut<void()> _confirmedCallback;
|
||||
FnMut<void()> _cancelledCallback;
|
||||
};
|
||||
|
||||
class InformBox : public ConfirmBox {
|
||||
public:
|
||||
InformBox(QWidget *, const QString &text, base::lambda<void()> closedCallback = base::lambda<void()>());
|
||||
InformBox(QWidget *, const QString &text, const QString &doneText,
|
||||
base::lambda<void()> closedCallback = base::lambda<void()>());
|
||||
InformBox(QWidget *, const QString &text, Fn<void()> closedCallback = Fn<void()>());
|
||||
InformBox(QWidget *, const QString &text, const QString &doneText, Fn<void()> closedCallback = Fn<void()>());
|
||||
};
|
||||
|
||||
class MaxInviteBox : public BoxContent {
|
||||
|
|
|
@ -89,7 +89,7 @@ void SentCodeField::fix() {
|
|||
}
|
||||
}
|
||||
|
||||
SentCodeCall::SentCodeCall(QObject *parent, base::lambda_once<void()> callCallback, base::lambda<void()> updateCallback)
|
||||
SentCodeCall::SentCodeCall(QObject *parent, FnMut<void()> callCallback, Fn<void()> updateCallback)
|
||||
: _timer(parent)
|
||||
, _call(std::move(callCallback))
|
||||
, _update(std::move(updateCallback)) {
|
||||
|
|
|
@ -30,18 +30,17 @@ class FlatLabel;
|
|||
|
||||
class SentCodeField : public Ui::InputField {
|
||||
public:
|
||||
SentCodeField(QWidget *parent, const style::InputField &st,
|
||||
base::lambda<QString()> placeholderFactory = base::lambda<QString()>(),
|
||||
SentCodeField(QWidget *parent, const style::InputField &st, Fn<QString()> placeholderFactory = Fn<QString()>(),
|
||||
const QString &val = QString())
|
||||
: Ui::InputField(parent, st, std::move(placeholderFactory), val) {
|
||||
connect(this, &Ui::InputField::changed, [this] { fix(); });
|
||||
}
|
||||
|
||||
void setAutoSubmit(int length, base::lambda<void()> submitCallback) {
|
||||
void setAutoSubmit(int length, Fn<void()> submitCallback) {
|
||||
_autoSubmitLength = length;
|
||||
_submitCallback = std::move(submitCallback);
|
||||
}
|
||||
void setChangedCallback(base::lambda<void()> changedCallback) {
|
||||
void setChangedCallback(Fn<void()> changedCallback) {
|
||||
_changedCallback = std::move(changedCallback);
|
||||
}
|
||||
|
||||
|
@ -52,13 +51,13 @@ private:
|
|||
bool _fixing = false;
|
||||
|
||||
int _autoSubmitLength = 0;
|
||||
base::lambda<void()> _submitCallback;
|
||||
base::lambda<void()> _changedCallback;
|
||||
Fn<void()> _submitCallback;
|
||||
Fn<void()> _changedCallback;
|
||||
};
|
||||
|
||||
class SentCodeCall {
|
||||
public:
|
||||
SentCodeCall(QObject *parent, base::lambda_once<void()> callCallback, base::lambda<void()> updateCallback);
|
||||
SentCodeCall(QObject *parent, FnMut<void()> callCallback, Fn<void()> updateCallback);
|
||||
|
||||
enum class State {
|
||||
Waiting,
|
||||
|
@ -91,8 +90,8 @@ public:
|
|||
private:
|
||||
Status _status;
|
||||
object_ptr<QTimer> _timer;
|
||||
base::lambda_once<void()> _call;
|
||||
base::lambda<void()> _update;
|
||||
FnMut<void()> _call;
|
||||
Fn<void()> _update;
|
||||
};
|
||||
|
||||
class ConfirmPhoneBox : public BoxContent, public RPCSender {
|
||||
|
|
|
@ -731,7 +731,7 @@ void EditColorBox::onFieldSubmitted() {
|
|||
}
|
||||
|
||||
void EditColorBox::saveColor() {
|
||||
_cancelCallback = base::lambda<void()>();
|
||||
_cancelCallback = Fn<void()>();
|
||||
if (_saveCallback) {
|
||||
_saveCallback(_new.toRgb());
|
||||
}
|
||||
|
|
|
@ -28,11 +28,11 @@ class EditColorBox : public BoxContent {
|
|||
public:
|
||||
EditColorBox(QWidget *, const QString &title, QColor current = QColor(255, 255, 255));
|
||||
|
||||
void setSaveCallback(base::lambda<void(QColor)> callback) {
|
||||
void setSaveCallback(Fn<void(QColor)> callback) {
|
||||
_saveCallback = std::move(callback);
|
||||
}
|
||||
|
||||
void setCancelCallback(base::lambda<void()> callback) {
|
||||
void setCancelCallback(Fn<void()> callback) {
|
||||
_cancelCallback = std::move(callback);
|
||||
}
|
||||
|
||||
|
@ -103,6 +103,6 @@ private:
|
|||
QRect _currentRect;
|
||||
QRect _newRect;
|
||||
|
||||
base::lambda<void(QColor)> _saveCallback;
|
||||
base::lambda<void()> _cancelCallback;
|
||||
Fn<void(QColor)> _saveCallback;
|
||||
Fn<void()> _cancelCallback;
|
||||
};
|
||||
|
|
|
@ -70,7 +70,7 @@ public:
|
|||
EditAdminBox(QWidget *, not_null<ChannelData *> channel, not_null<UserData *> user,
|
||||
const MTPChannelAdminRights &rights);
|
||||
|
||||
void setSaveCallback(base::lambda<void(MTPChannelAdminRights, MTPChannelAdminRights)> callback) {
|
||||
void setSaveCallback(Fn<void(MTPChannelAdminRights, MTPChannelAdminRights)> callback) {
|
||||
_saveCallback = std::move(callback);
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ private:
|
|||
|
||||
const MTPChannelAdminRights _oldRights;
|
||||
std::vector<std::pair<Flag, Flag>> _dependencies;
|
||||
base::lambda<void(MTPChannelAdminRights, MTPChannelAdminRights)> _saveCallback;
|
||||
Fn<void(MTPChannelAdminRights, MTPChannelAdminRights)> _saveCallback;
|
||||
|
||||
std::map<Flags, QPointer<Ui::Checkbox>> _checkboxes;
|
||||
QPointer<Ui::FlatLabel> _aboutAddAdmins;
|
||||
|
@ -105,7 +105,7 @@ public:
|
|||
EditRestrictedBox(QWidget *, not_null<ChannelData *> channel, not_null<UserData *> user, bool hasAdminRights,
|
||||
const MTPChannelBannedRights &rights);
|
||||
|
||||
void setSaveCallback(base::lambda<void(MTPChannelBannedRights, MTPChannelBannedRights)> callback) {
|
||||
void setSaveCallback(Fn<void(MTPChannelBannedRights, MTPChannelBannedRights)> callback) {
|
||||
_saveCallback = std::move(callback);
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,7 @@ private:
|
|||
const MTPChannelBannedRights _oldRights;
|
||||
TimeId _until = 0;
|
||||
std::vector<std::pair<Flag, Flag>> _dependencies;
|
||||
base::lambda<void(MTPChannelBannedRights, MTPChannelBannedRights)> _saveCallback;
|
||||
Fn<void(MTPChannelBannedRights, MTPChannelBannedRights)> _saveCallback;
|
||||
|
||||
std::map<Flags, QPointer<Ui::Checkbox>> _checkboxes;
|
||||
|
||||
|
|
|
@ -36,8 +36,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;
|
||||
|
@ -47,11 +46,11 @@ 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,
|
||||
PrivacyExceptionsBoxController::PrivacyExceptionsBoxController(Fn<QString()> titleFactory,
|
||||
const std::vector<not_null<UserData *>> &selected)
|
||||
: _titleFactory(std::move(titleFactory))
|
||||
, _selected(selected) {}
|
||||
|
|
|
@ -59,7 +59,7 @@ public:
|
|||
virtual QString exceptionBoxTitle(Exception exception) = 0;
|
||||
virtual QString exceptionsDescription() = 0;
|
||||
|
||||
virtual void confirmSave(bool someAreDisallowed, base::lambda_once<void()> saveCallback) {
|
||||
virtual void confirmSave(bool someAreDisallowed, FnMut<void()> saveCallback) {
|
||||
saveCallback();
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
|||
#include "window/themes/window_theme.h"
|
||||
|
||||
PeerListBox::PeerListBox(QWidget *, std::unique_ptr<PeerListController> controller,
|
||||
base::lambda<void(not_null<PeerListBox *>)> init)
|
||||
Fn<void(not_null<PeerListBox *>)> init)
|
||||
: _controller(std::move(controller))
|
||||
, _init(std::move(init)) {
|
||||
Expects(_controller != nullptr);
|
||||
|
@ -247,13 +247,13 @@ void PeerListBox::peerListSetSearchMode(PeerListSearchMode mode) {
|
|||
}
|
||||
}
|
||||
|
||||
void PeerListBox::peerListSortRows(base::lambda<bool(PeerListRow &a, PeerListRow &b)> compare) {
|
||||
void PeerListBox::peerListSortRows(Fn<bool(PeerListRow &a, PeerListRow &b)> compare) {
|
||||
_inner->reorderRows([compare = std::move(compare)](auto &&begin, auto &&end) {
|
||||
std::sort(begin, end, [compare](auto &&a, auto &&b) { return compare(*a, *b); });
|
||||
});
|
||||
}
|
||||
|
||||
void PeerListBox::peerListPartitionRows(base::lambda<bool(PeerListRow &a)> border) {
|
||||
void PeerListBox::peerListPartitionRows(Fn<bool(PeerListRow &a)> border) {
|
||||
_inner->reorderRows([border = std::move(border)](auto &&begin, auto &&end) {
|
||||
std::stable_partition(begin, end, [border](auto &¤t) { return border(*current); });
|
||||
});
|
||||
|
@ -507,7 +507,7 @@ void PeerListRow::lazyInitialize() {
|
|||
refreshStatus();
|
||||
}
|
||||
|
||||
void PeerListRow::createCheckbox(base::lambda<void()> updateCallback) {
|
||||
void PeerListRow::createCheckbox(Fn<void()> updateCallback) {
|
||||
_checkbox = std::make_unique<Ui::RoundImageCheckbox>(st::contactsPhotoCheckbox, std::move(updateCallback),
|
||||
PaintUserpicCallback(_peer));
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ public:
|
|||
virtual QMargins actionMargins() const {
|
||||
return QMargins();
|
||||
}
|
||||
virtual void addActionRipple(QPoint point, base::lambda<void()> updateCallback) {}
|
||||
virtual void addActionRipple(QPoint point, Fn<void()> updateCallback) {}
|
||||
virtual void stopLastActionRipple() {}
|
||||
virtual void paintAction(Painter &p, TimeMs ms, int x, int y, int outerWidth, bool actionSelected) {}
|
||||
|
||||
|
@ -151,7 +151,7 @@ protected:
|
|||
}
|
||||
|
||||
private:
|
||||
void createCheckbox(base::lambda<void()> updateCallback);
|
||||
void createCheckbox(Fn<void()> updateCallback);
|
||||
void setCheckedInternal(bool checked, SetStyle style);
|
||||
void paintDisabledCheckUserpic(Painter &p, int x, int y, int outerWidth) const;
|
||||
void setStatusText(const QString &text);
|
||||
|
@ -177,8 +177,8 @@ enum class PeerListSearchMode {
|
|||
|
||||
class PeerListDelegate {
|
||||
public:
|
||||
virtual void peerListSetTitle(base::lambda<QString()> title) = 0;
|
||||
virtual void peerListSetAdditionalTitle(base::lambda<QString()> title) = 0;
|
||||
virtual void peerListSetTitle(Fn<QString()> title) = 0;
|
||||
virtual void peerListSetAdditionalTitle(Fn<QString()> title) = 0;
|
||||
virtual void peerListSetDescription(object_ptr<Ui::FlatLabel> description) = 0;
|
||||
virtual void peerListSetSearchLoading(object_ptr<Ui::FlatLabel> loading) = 0;
|
||||
virtual void peerListSetSearchNoResults(object_ptr<Ui::FlatLabel> noResults) = 0;
|
||||
|
@ -199,8 +199,8 @@ public:
|
|||
virtual void peerListScrollToTop() = 0;
|
||||
virtual int peerListFullRowsCount() = 0;
|
||||
virtual PeerListRow *peerListFindRow(PeerListRowId id) = 0;
|
||||
virtual void peerListSortRows(base::lambda<bool(PeerListRow &a, PeerListRow &b)> compare) = 0;
|
||||
virtual void peerListPartitionRows(base::lambda<bool(PeerListRow &a)> border) = 0;
|
||||
virtual void peerListSortRows(Fn<bool(PeerListRow &a, PeerListRow &b)> compare) = 0;
|
||||
virtual void peerListPartitionRows(Fn<bool(PeerListRow &a)> border) = 0;
|
||||
|
||||
template <typename PeerDataRange> void peerListAddSelectedRows(PeerDataRange &&range) {
|
||||
for (auto peer : range) {
|
||||
|
@ -310,13 +310,12 @@ private:
|
|||
|
||||
class PeerListBox : public BoxContent, public PeerListDelegate {
|
||||
public:
|
||||
PeerListBox(QWidget *, std::unique_ptr<PeerListController> controller,
|
||||
base::lambda<void(not_null<PeerListBox *>)> init);
|
||||
PeerListBox(QWidget *, std::unique_ptr<PeerListController> controller, Fn<void(not_null<PeerListBox *>)> init);
|
||||
|
||||
void peerListSetTitle(base::lambda<QString()> title) override {
|
||||
void peerListSetTitle(Fn<QString()> title) override {
|
||||
setTitle(std::move(title));
|
||||
}
|
||||
void peerListSetAdditionalTitle(base::lambda<QString()> title) override {
|
||||
void peerListSetAdditionalTitle(Fn<QString()> title) override {
|
||||
setAdditionalTitle(std::move(title));
|
||||
}
|
||||
void peerListSetDescription(object_ptr<Ui::FlatLabel> description) override;
|
||||
|
@ -341,8 +340,8 @@ public:
|
|||
void peerListScrollToTop() override;
|
||||
int peerListFullRowsCount() override;
|
||||
PeerListRow *peerListFindRow(PeerListRowId id) override;
|
||||
void peerListSortRows(base::lambda<bool(PeerListRow &a, PeerListRow &b)> compare) override;
|
||||
void peerListPartitionRows(base::lambda<bool(PeerListRow &a)> border) override;
|
||||
void peerListSortRows(Fn<bool(PeerListRow &a, PeerListRow &b)> compare) override;
|
||||
void peerListPartitionRows(Fn<bool(PeerListRow &a)> border) override;
|
||||
|
||||
protected:
|
||||
void prepare() override;
|
||||
|
@ -370,7 +369,7 @@ private:
|
|||
QPointer<Inner> _inner;
|
||||
|
||||
std::unique_ptr<PeerListController> _controller;
|
||||
base::lambda<void(PeerListBox *)> _init;
|
||||
Fn<void(PeerListBox *)> _init;
|
||||
bool _scrollBottomFixed = true;
|
||||
};
|
||||
|
||||
|
|
|
@ -269,7 +269,7 @@ void SendFilesBox::prepare() {
|
|||
updateBoxSize();
|
||||
}
|
||||
|
||||
base::lambda<QString()> SendFilesBox::getSendButtonText() const {
|
||||
Fn<QString()> SendFilesBox::getSendButtonText() const {
|
||||
if (!_contactPhone.isEmpty()) {
|
||||
return langFactory(lng_send_button);
|
||||
} else if (_compressed && _compressed->checked()) {
|
||||
|
|
|
@ -38,13 +38,13 @@ public:
|
|||
SendFilesBox(QWidget *, const QStringList &files, CompressConfirm compressed);
|
||||
SendFilesBox(QWidget *, const QString &phone, const QString &firstname, const QString &lastname);
|
||||
|
||||
void setConfirmedCallback(base::lambda<void(const QStringList &files, const QImage &image,
|
||||
std::unique_ptr<FileLoadTask::MediaInformation> information,
|
||||
bool compressed, const QString &caption, bool ctrlShiftEnter)>
|
||||
void setConfirmedCallback(Fn<void(const QStringList &files, const QImage &image,
|
||||
std::unique_ptr<FileLoadTask::MediaInformation> information, bool compressed,
|
||||
const QString &caption, bool ctrlShiftEnter)>
|
||||
callback) {
|
||||
_confirmedCallback = std::move(callback);
|
||||
}
|
||||
void setCancelledCallback(base::lambda<void()> callback) {
|
||||
void setCancelledCallback(Fn<void()> callback) {
|
||||
_cancelledCallback = std::move(callback);
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ private:
|
|||
void updateTitleText();
|
||||
void updateBoxSize();
|
||||
void updateControlsGeometry();
|
||||
base::lambda<QString()> getSendButtonText() const;
|
||||
Fn<QString()> getSendButtonText() const;
|
||||
|
||||
QString _titleText;
|
||||
QStringList _files;
|
||||
|
@ -102,11 +102,10 @@ private:
|
|||
QString _contactLastName;
|
||||
EmptyUserpic _contactPhotoEmpty;
|
||||
|
||||
base::lambda<void(const QStringList &files, const QImage &image,
|
||||
std::unique_ptr<FileLoadTask::MediaInformation> information, bool compressed,
|
||||
const QString &caption, bool ctrlShiftEnter)>
|
||||
Fn<void(const QStringList &files, const QImage &image, std::unique_ptr<FileLoadTask::MediaInformation> information,
|
||||
bool compressed, const QString &caption, bool ctrlShiftEnter)>
|
||||
_confirmedCallback;
|
||||
base::lambda<void()> _cancelledCallback;
|
||||
Fn<void()> _cancelledCallback;
|
||||
bool _confirmed = false;
|
||||
|
||||
object_ptr<Ui::InputArea> _caption = {nullptr};
|
||||
|
|
|
@ -513,7 +513,7 @@ void ShareBox::Inner::paintChat(Painter &p, TimeMs ms, Chat *chat, int index) {
|
|||
chat->name.drawLeftElided(p, x + nameLeft, y + nameTop, nameWidth, outerWidth, 2, style::al_top, 0, -1, 0, true);
|
||||
}
|
||||
|
||||
ShareBox::Inner::Chat::Chat(PeerData *peer, base::lambda<void()> updateCallback)
|
||||
ShareBox::Inner::Chat::Chat(PeerData *peer, Fn<void()> updateCallback)
|
||||
: peer(peer)
|
||||
, checkbox(st::sharePhotoCheckbox, updateCallback, PaintUserpicCallback(peer))
|
||||
, name(st::sharePhotoCheckbox.imageRadius * 2) {}
|
||||
|
@ -649,7 +649,7 @@ void ShareBox::Inner::peerUnselected(PeerData *peer) {
|
|||
changePeerCheckState(chat, false, ChangeStateWay::SkipCallback);
|
||||
}
|
||||
|
||||
void ShareBox::Inner::setPeerSelectedChangedCallback(base::lambda<void(PeerData *peer, bool selected)> callback) {
|
||||
void ShareBox::Inner::setPeerSelectedChangedCallback(Fn<void(PeerData *peer, bool selected)> callback) {
|
||||
_peerSelectedChangedCallback = std::move(callback);
|
||||
}
|
||||
|
||||
|
|
|
@ -44,9 +44,9 @@ class ShareBox : public BoxContent, public RPCSender {
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
using CopyCallback = base::lambda<void()>;
|
||||
using SubmitCallback = base::lambda<void(const QVector<PeerData *> &)>;
|
||||
using FilterCallback = base::lambda<bool(PeerData *)>;
|
||||
using CopyCallback = Fn<void()>;
|
||||
using SubmitCallback = Fn<void(const QVector<PeerData *> &)>;
|
||||
using FilterCallback = Fn<bool(PeerData *)>;
|
||||
ShareBox(QWidget *, CopyCallback &©Callback, SubmitCallback &&submitCallback, FilterCallback &&filterCallback);
|
||||
|
||||
protected:
|
||||
|
@ -113,7 +113,7 @@ class ShareBox::Inner : public TWidget, public RPCSender, private base::Subscrib
|
|||
public:
|
||||
Inner(QWidget *parent, ShareBox::FilterCallback &&filterCallback);
|
||||
|
||||
void setPeerSelectedChangedCallback(base::lambda<void(PeerData *peer, bool selected)> callback);
|
||||
void setPeerSelectedChangedCallback(Fn<void(PeerData *peer, bool selected)> callback);
|
||||
void peerUnselected(PeerData *peer);
|
||||
|
||||
QVector<PeerData *> selected() const;
|
||||
|
@ -152,7 +152,7 @@ private:
|
|||
int displayedChatsCount() const;
|
||||
|
||||
struct Chat {
|
||||
Chat(PeerData *peer, base::lambda<void()> updateCallback);
|
||||
Chat(PeerData *peer, Fn<void()> updateCallback);
|
||||
|
||||
PeerData *peer;
|
||||
Ui::RoundImageCheckbox checkbox;
|
||||
|
@ -202,7 +202,7 @@ private:
|
|||
using SelectedChats = std::set<PeerData *>;
|
||||
SelectedChats _selected;
|
||||
|
||||
base::lambda<void(PeerData *peer, bool selected)> _peerSelectedChangedCallback;
|
||||
Fn<void(PeerData *peer, bool selected)> _peerSelectedChangedCallback;
|
||||
|
||||
ChatData *data(Dialogs::Row *row);
|
||||
|
||||
|
|
|
@ -440,7 +440,7 @@ bool StickerSetBox::Inner::official() const {
|
|||
return _loaded && _setShortName.isEmpty();
|
||||
}
|
||||
|
||||
base::lambda<TextWithEntities()> StickerSetBox::Inner::title() const {
|
||||
Fn<TextWithEntities()> StickerSetBox::Inner::title() const {
|
||||
auto text = TextWithEntities{_setTitle};
|
||||
if (_loaded) {
|
||||
if (_pack.isEmpty()) {
|
||||
|
|
|
@ -69,7 +69,7 @@ public:
|
|||
bool loaded() const;
|
||||
qint32 notInstalled() const;
|
||||
bool official() const;
|
||||
base::lambda<TextWithEntities()> title() const;
|
||||
Fn<TextWithEntities()> title() const;
|
||||
QString shortName() const;
|
||||
|
||||
void setVisibleTopBottom(int visibleTop, int visibleBottom) override;
|
||||
|
|
|
@ -163,10 +163,10 @@ public:
|
|||
void setFullOrder(const Stickers::Order &order);
|
||||
void setRemovedSets(const Stickers::Order &removed);
|
||||
|
||||
void setInstallSetCallback(base::lambda<void(quint64 setId)> callback) {
|
||||
void setInstallSetCallback(Fn<void(quint64 setId)> callback) {
|
||||
_installSetCallback = std::move(callback);
|
||||
}
|
||||
void setLoadMoreCallback(base::lambda<void()> callback) {
|
||||
void setLoadMoreCallback(Fn<void()> callback) {
|
||||
_loadMoreCallback = std::move(callback);
|
||||
}
|
||||
|
||||
|
@ -265,8 +265,8 @@ private:
|
|||
anim::value _aboveShadowFadeOpacity;
|
||||
BasicAnimation _a_shifting;
|
||||
|
||||
base::lambda<void(quint64 setId)> _installSetCallback;
|
||||
base::lambda<void()> _loadMoreCallback;
|
||||
Fn<void(quint64 setId)> _installSetCallback;
|
||||
Fn<void()> _loadMoreCallback;
|
||||
|
||||
int _visibleTop = 0;
|
||||
int _visibleBottom = 0;
|
||||
|
|
|
@ -77,7 +77,7 @@ public:
|
|||
}
|
||||
|
||||
void paintStatusText(Painter &p, int x, int y, int availableWidth, int outerWidth, bool selected) override;
|
||||
void addActionRipple(QPoint point, base::lambda<void()> updateCallback) override;
|
||||
void addActionRipple(QPoint point, Fn<void()> updateCallback) override;
|
||||
void stopLastActionRipple() override;
|
||||
|
||||
bool needsVerifiedIcon() const override {
|
||||
|
@ -172,7 +172,7 @@ BoxController::Row::Type BoxController::Row::ComputeType(HistoryItem *item) {
|
|||
return Type::In;
|
||||
}
|
||||
|
||||
void BoxController::Row::addActionRipple(QPoint point, base::lambda<void()> updateCallback) {
|
||||
void BoxController::Row::addActionRipple(QPoint point, Fn<void()> updateCallback) {
|
||||
if (!_actionRipple) {
|
||||
auto mask =
|
||||
Ui::RippleAnimation::ellipseMask(QSize(st::callReDial.rippleAreaSize, st::callReDial.rippleAreaSize));
|
||||
|
|
|
@ -114,7 +114,7 @@ std::unique_ptr<QMimeData> MimeDataFromTextWithEntities(const TextWithEntities &
|
|||
}
|
||||
|
||||
MessageField::MessageField(QWidget *parent, not_null<Window::Controller *> controller, const style::FlatTextarea &st,
|
||||
base::lambda<QString()> placeholderFactory, const QString &val)
|
||||
Fn<QString()> placeholderFactory, const QString &val)
|
||||
: Ui::FlatTextarea(parent, st, std::move(placeholderFactory), val)
|
||||
, _controller(controller) {
|
||||
setMinHeight(st::historySendSize.height() - 2 * st::historySendPadding);
|
||||
|
|
|
@ -38,12 +38,11 @@ class MessageField final : public Ui::FlatTextarea {
|
|||
|
||||
public:
|
||||
MessageField(QWidget *parent, not_null<Window::Controller *> controller, const style::FlatTextarea &st,
|
||||
base::lambda<QString()> placeholderFactory = base::lambda<QString()>(),
|
||||
const QString &val = QString());
|
||||
Fn<QString()> placeholderFactory = Fn<QString()>(), const QString &val = QString());
|
||||
|
||||
bool hasSendText() const;
|
||||
|
||||
void setInsertFromMimeDataHook(base::lambda<bool(const QMimeData *data)> hook) {
|
||||
void setInsertFromMimeDataHook(Fn<bool(const QMimeData *data)> hook) {
|
||||
_insertFromMimeDataHook = std::move(hook);
|
||||
}
|
||||
|
||||
|
@ -61,5 +60,5 @@ protected:
|
|||
|
||||
private:
|
||||
not_null<Window::Controller *> _controller;
|
||||
base::lambda<bool(const QMimeData *data)> _insertFromMimeDataHook;
|
||||
Fn<bool(const QMimeData *data)> _insertFromMimeDataHook;
|
||||
};
|
||||
|
|
|
@ -44,8 +44,8 @@ TabbedSection::TabbedSection(QWidget *parent, not_null<Window::Controller *> con
|
|||
_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);
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ public:
|
|||
|
||||
void beforeHiding();
|
||||
void afterShown();
|
||||
void setCancelledCallback(base::lambda<void()> callback) {
|
||||
void setCancelledCallback(Fn<void()> callback) {
|
||||
_cancelledCallback = std::move(callback);
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ protected:
|
|||
|
||||
private:
|
||||
object_ptr<TabbedSelector> _selector;
|
||||
base::lambda<void()> _cancelledCallback;
|
||||
Fn<void()> _cancelledCallback;
|
||||
};
|
||||
|
||||
} // namespace ChatHelpers
|
||||
|
|
|
@ -77,10 +77,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);
|
||||
}
|
||||
|
||||
|
@ -195,8 +195,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;
|
||||
};
|
||||
|
||||
class TabbedSelector::Inner : public TWidget {
|
||||
|
|
|
@ -21,16 +21,25 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
|||
#pragma once
|
||||
|
||||
#include "base/build_config.h"
|
||||
#include "base/functors.h"
|
||||
#include "base/unique_function.h"
|
||||
#include <QLatin1String>
|
||||
#include <QString>
|
||||
#include <cstdint>
|
||||
#include <ctime>
|
||||
#include <exception>
|
||||
#include <functional>
|
||||
#include <gsl/gsl>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
template <typename Type> using not_null = gsl::not_null<Type>;
|
||||
namespace func = base::functors;
|
||||
|
||||
using gsl::not_null;
|
||||
|
||||
template <typename Signature> using Fn = std::function<Signature>;
|
||||
|
||||
template <typename Signature> using FnMut = base::unique_function<Signature>;
|
||||
|
||||
#define qsl(s) QStringLiteral(s)
|
||||
#define qstr(s) QLatin1String(s, static_cast<int>(sizeof(s) - 1))
|
||||
#define qstr(s) QLatin1String((s), static_cast<int>(sizeof(s) - 1))
|
||||
|
|
|
@ -22,7 +22,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
|||
|
||||
#include <QSharedPointer>
|
||||
|
||||
#include "base/lambda.h"
|
||||
#include "core/utils.h"
|
||||
#include "ui/text/text_entity.h"
|
||||
|
||||
|
@ -180,7 +179,7 @@ protected:
|
|||
|
||||
class LambdaClickHandler : public ClickHandler {
|
||||
public:
|
||||
LambdaClickHandler(base::lambda<void()> handler)
|
||||
LambdaClickHandler(Fn<void()> handler)
|
||||
: _handler(std::move(handler)) {}
|
||||
void onClick(Qt::MouseButton button) const override final {
|
||||
if (button == Qt::LeftButton && _handler) {
|
||||
|
@ -189,5 +188,5 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
base::lambda<void()> _handler;
|
||||
Fn<void()> _handler;
|
||||
};
|
||||
|
|
|
@ -135,8 +135,8 @@ void UnsafeLaunchDefault(const QString &filepath) {
|
|||
|
||||
namespace FileDialog {
|
||||
|
||||
void GetOpenPath(const QString &caption, const QString &filter, base::lambda<void(const OpenResult &result)> callback,
|
||||
base::lambda<void()> failed) {
|
||||
void GetOpenPath(const QString &caption, const QString &filter, Fn<void(const OpenResult &result)> callback,
|
||||
Fn<void()> failed) {
|
||||
base::TaskQueue::Main().Put([caption, filter, callback = std::move(callback), failed = std::move(failed)] {
|
||||
auto files = QStringList();
|
||||
auto remoteContent = QByteArray();
|
||||
|
@ -156,8 +156,8 @@ void GetOpenPath(const QString &caption, const QString &filter, base::lambda<voi
|
|||
});
|
||||
}
|
||||
|
||||
void GetOpenPaths(const QString &caption, const QString &filter, base::lambda<void(const OpenResult &result)> callback,
|
||||
base::lambda<void()> failed) {
|
||||
void GetOpenPaths(const QString &caption, const QString &filter, Fn<void(const OpenResult &result)> callback,
|
||||
Fn<void()> failed) {
|
||||
base::TaskQueue::Main().Put([caption, filter, callback = std::move(callback), failed = std::move(failed)] {
|
||||
auto files = QStringList();
|
||||
auto remoteContent = QByteArray();
|
||||
|
@ -176,7 +176,7 @@ void GetOpenPaths(const QString &caption, const QString &filter, base::lambda<vo
|
|||
}
|
||||
|
||||
void GetWritePath(const QString &caption, const QString &filter, const QString &initialPath,
|
||||
base::lambda<void(const QString &result)> callback, base::lambda<void()> failed) {
|
||||
Fn<void(const QString &result)> callback, Fn<void()> failed) {
|
||||
base::TaskQueue::Main().Put(
|
||||
[caption, filter, initialPath, callback = std::move(callback), failed = std::move(failed)] {
|
||||
auto file = QString();
|
||||
|
@ -190,8 +190,8 @@ void GetWritePath(const QString &caption, const QString &filter, const QString &
|
|||
});
|
||||
}
|
||||
|
||||
void GetFolder(const QString &caption, const QString &initialPath, base::lambda<void(const QString &result)> callback,
|
||||
base::lambda<void()> failed) {
|
||||
void GetFolder(const QString &caption, const QString &initialPath, Fn<void(const QString &result)> callback,
|
||||
Fn<void()> failed) {
|
||||
base::TaskQueue::Main().Put([caption, initialPath, callback = std::move(callback), failed = std::move(failed)] {
|
||||
auto files = QStringList();
|
||||
auto remoteContent = QByteArray();
|
||||
|
|
|
@ -60,15 +60,14 @@ struct OpenResult {
|
|||
QStringList paths;
|
||||
QByteArray remoteContent;
|
||||
};
|
||||
void GetOpenPath(const QString &caption, const QString &filter, base::lambda<void(const OpenResult &result)> callback,
|
||||
base::lambda<void()> failed = base::lambda<void()>());
|
||||
void GetOpenPaths(const QString &caption, const QString &filter, base::lambda<void(const OpenResult &result)> callback,
|
||||
base::lambda<void()> failed = base::lambda<void()>());
|
||||
void GetOpenPath(const QString &caption, const QString &filter, Fn<void(const OpenResult &result)> callback,
|
||||
Fn<void()> failed = Fn<void()>());
|
||||
void GetOpenPaths(const QString &caption, const QString &filter, Fn<void(const OpenResult &result)> callback,
|
||||
Fn<void()> failed = Fn<void()>());
|
||||
void GetWritePath(const QString &caption, const QString &filter, const QString &initialPath,
|
||||
base::lambda<void(const QString &result)> callback,
|
||||
base::lambda<void()> failed = base::lambda<void()>());
|
||||
void GetFolder(const QString &caption, const QString &initialPath, base::lambda<void(const QString &result)> callback,
|
||||
base::lambda<void()> failed = base::lambda<void()>());
|
||||
Fn<void(const QString &result)> callback, Fn<void()> failed = Fn<void()>());
|
||||
void GetFolder(const QString &caption, const QString &initialPath, Fn<void(const QString &result)> callback,
|
||||
Fn<void()> failed = Fn<void()>());
|
||||
|
||||
QString AllFilesFilter();
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ SingleTimer::SingleTimer(QObject *parent)
|
|||
Sandbox::connect(SIGNAL(adjustSingleTimers()), this, SLOT(adjust()));
|
||||
}
|
||||
|
||||
void SingleTimer::setTimeoutHandler(base::lambda<void()> handler) {
|
||||
void SingleTimer::setTimeoutHandler(Fn<void()> handler) {
|
||||
if (_handler && !handler) {
|
||||
disconnect(this, SIGNAL(timeout()), this, SLOT(onTimeout()));
|
||||
} else if (handler && !_handler) {
|
||||
|
|
|
@ -35,7 +35,7 @@ public:
|
|||
void setSingleShot(bool); // is not available
|
||||
void start(); // is not available
|
||||
|
||||
void setTimeoutHandler(base::lambda<void()> handler);
|
||||
void setTimeoutHandler(Fn<void()> handler);
|
||||
|
||||
public slots:
|
||||
void start(int msec);
|
||||
|
@ -47,5 +47,5 @@ private slots:
|
|||
|
||||
private:
|
||||
TimeMs _finishing = 0;
|
||||
base::lambda<void()> _handler;
|
||||
Fn<void()> _handler;
|
||||
};
|
||||
|
|
|
@ -1285,11 +1285,9 @@ void DialogsInner::contextMenuEvent(QContextMenuEvent *e) {
|
|||
}
|
||||
|
||||
_menu = new Ui::PopupMenu(nullptr);
|
||||
App::main()->fillPeerMenu(_menuPeer,
|
||||
[this](const QString &text, base::lambda<void()> callback) {
|
||||
return _menu->addAction(text, std::move(callback));
|
||||
},
|
||||
true);
|
||||
App::main()->fillPeerMenu(
|
||||
_menuPeer,
|
||||
[this](const QString &text, Fn<void()> callback) { return _menu->addAction(text, std::move(callback)); }, true);
|
||||
connect(_menu, SIGNAL(destroyed(QObject *)), this, SLOT(onMenuDestroyed(QObject *)));
|
||||
_menu->popup(e->globalPos());
|
||||
e->accept();
|
||||
|
|
|
@ -105,7 +105,7 @@ public:
|
|||
|
||||
PeerData *updateFromParentDrag(QPoint globalPos);
|
||||
|
||||
void setLoadMoreCallback(base::lambda<void()> callback) {
|
||||
void setLoadMoreCallback(Fn<void()> callback) {
|
||||
_loadMoreCallback = std::move(callback);
|
||||
}
|
||||
void setVisibleTopBottom(int visibleTop, int visibleBottom) override;
|
||||
|
@ -301,5 +301,5 @@ private:
|
|||
|
||||
Ui::PopupMenu *_menu = nullptr;
|
||||
|
||||
base::lambda<void()> _loadMoreCallback;
|
||||
Fn<void()> _loadMoreCallback;
|
||||
};
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace Dialogs {
|
|||
RippleRow::RippleRow() = default;
|
||||
RippleRow::~RippleRow() = default;
|
||||
|
||||
void RippleRow::addRipple(QPoint origin, QSize size, base::lambda<void()> updateCallback) {
|
||||
void RippleRow::addRipple(QPoint origin, QSize size, Fn<void()> updateCallback) {
|
||||
if (!_ripple) {
|
||||
auto mask = Ui::RippleAnimation::rectMask(size);
|
||||
_ripple = std::make_unique<Ui::RippleAnimation>(st::dialogsRipple, std::move(mask), std::move(updateCallback));
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
RippleRow();
|
||||
~RippleRow();
|
||||
|
||||
void addRipple(QPoint origin, QSize size, base::lambda<void()> updateCallback);
|
||||
void addRipple(QPoint origin, QSize size, Fn<void()> updateCallback);
|
||||
void stopLastRipple();
|
||||
|
||||
void paintRipple(Painter &p, int x, int y, int outerWidth, TimeMs ms, const QColor *colorOverride = nullptr) const;
|
||||
|
|
|
@ -28,8 +28,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
|||
|
||||
namespace Dialogs {
|
||||
|
||||
void ShowSearchFromBox(PeerData *peer, base::lambda<void(not_null<UserData *>)> callback,
|
||||
base::lambda<void()> closedCallback) {
|
||||
void ShowSearchFromBox(PeerData *peer, Fn<void(not_null<UserData *>)> callback, Fn<void()> closedCallback) {
|
||||
auto createController = [peer, callback = std::move(callback)]() -> std::unique_ptr<PeerListController> {
|
||||
if (peer) {
|
||||
if (auto chat = peer->asChat()) {
|
||||
|
@ -52,8 +51,7 @@ void ShowSearchFromBox(PeerData *peer, base::lambda<void(not_null<UserData *>)>
|
|||
}
|
||||
}
|
||||
|
||||
ChatSearchFromController::ChatSearchFromController(not_null<ChatData *> chat,
|
||||
base::lambda<void(not_null<UserData *>)> callback)
|
||||
ChatSearchFromController::ChatSearchFromController(not_null<ChatData *> chat, Fn<void(not_null<UserData *>)> callback)
|
||||
: PeerListController()
|
||||
, _chat(chat)
|
||||
, _callback(std::move(callback)) {}
|
||||
|
@ -120,7 +118,7 @@ void ChatSearchFromController::appendRow(not_null<UserData *> user) {
|
|||
}
|
||||
|
||||
ChannelSearchFromController::ChannelSearchFromController(not_null<ChannelData *> channel,
|
||||
base::lambda<void(not_null<UserData *>)> callback)
|
||||
Fn<void(not_null<UserData *>)> callback)
|
||||
: ParticipantsBoxController(channel, ParticipantsBoxController::Role::Members)
|
||||
, _callback(std::move(callback)) {}
|
||||
|
||||
|
|
|
@ -25,12 +25,11 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
|||
|
||||
namespace Dialogs {
|
||||
|
||||
void ShowSearchFromBox(PeerData *peer, base::lambda<void(not_null<UserData *>)> callback,
|
||||
base::lambda<void()> closedCallback);
|
||||
void ShowSearchFromBox(PeerData *peer, Fn<void(not_null<UserData *>)> callback, Fn<void()> closedCallback);
|
||||
|
||||
class ChatSearchFromController : public PeerListController, protected base::Subscriber {
|
||||
public:
|
||||
ChatSearchFromController(not_null<ChatData *> chat, base::lambda<void(not_null<UserData *>)> callback);
|
||||
ChatSearchFromController(not_null<ChatData *> chat, Fn<void(not_null<UserData *>)> callback);
|
||||
|
||||
void prepare() override;
|
||||
void rowClicked(not_null<PeerListRow *> row) override;
|
||||
|
@ -41,12 +40,12 @@ private:
|
|||
void appendRow(not_null<UserData *> user);
|
||||
|
||||
not_null<ChatData *> _chat;
|
||||
base::lambda<void(not_null<UserData *>)> _callback;
|
||||
Fn<void(not_null<UserData *>)> _callback;
|
||||
};
|
||||
|
||||
class ChannelSearchFromController : public Profile::ParticipantsBoxController {
|
||||
public:
|
||||
ChannelSearchFromController(not_null<ChannelData *> channel, base::lambda<void(not_null<UserData *>)> callback);
|
||||
ChannelSearchFromController(not_null<ChannelData *> channel, Fn<void(not_null<UserData *>)> callback);
|
||||
|
||||
void prepare() override;
|
||||
void rowClicked(not_null<PeerListRow *> row) override;
|
||||
|
@ -55,7 +54,7 @@ protected:
|
|||
std::unique_ptr<PeerListRow> createRow(not_null<UserData *> user) const override;
|
||||
|
||||
private:
|
||||
base::lambda<void(not_null<UserData *>)> _callback;
|
||||
Fn<void(not_null<UserData *>)> _callback;
|
||||
};
|
||||
|
||||
} // namespace Dialogs
|
||||
|
|
|
@ -42,7 +42,7 @@ Q_DECLARE_METATYPE(Ui::ShowWay);
|
|||
namespace App {
|
||||
namespace internal {
|
||||
|
||||
void CallDelayed(int duration, base::lambda_once<void()> &&lambda) {
|
||||
void CallDelayed(int duration, FnMut<void()> &&lambda) {
|
||||
Messenger::Instance().callDelayed(duration, std::move(lambda));
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ class ItemBase;
|
|||
namespace App {
|
||||
namespace internal {
|
||||
|
||||
void CallDelayed(int duration, base::lambda_once<void()> &&lambda);
|
||||
void CallDelayed(int duration, FnMut<void()> &&lambda);
|
||||
|
||||
} // namespace internal
|
||||
|
||||
|
|
|
@ -150,7 +150,7 @@ QPoint UserCheckbox::prepareRippleStartPosition() const {
|
|||
class FilterBox::Inner : public TWidget, private base::Subscriber {
|
||||
public:
|
||||
Inner(QWidget *parent, not_null<ChannelData *> channel, const std::vector<not_null<UserData *>> &admins,
|
||||
const FilterValue &filter, base::lambda<void()> changedCallback);
|
||||
const FilterValue &filter, Fn<void()> changedCallback);
|
||||
|
||||
template <typename Widget> QPointer<Widget> addRow(object_ptr<Widget> widget, int marginTop) {
|
||||
widget->setParent(this);
|
||||
|
@ -191,12 +191,12 @@ private:
|
|||
};
|
||||
std::vector<Row> _rows;
|
||||
|
||||
base::lambda<void()> _changedCallback;
|
||||
Fn<void()> _changedCallback;
|
||||
};
|
||||
|
||||
FilterBox::Inner::Inner(QWidget *parent, not_null<ChannelData *> channel,
|
||||
const std::vector<not_null<UserData *>> &admins, const FilterValue &filter,
|
||||
base::lambda<void()> changedCallback)
|
||||
Fn<void()> changedCallback)
|
||||
: TWidget(parent)
|
||||
, _channel(channel)
|
||||
, _changedCallback(std::move(changedCallback)) {
|
||||
|
@ -365,7 +365,7 @@ void FilterBox::Inner::resizeEvent(QResizeEvent *e) {
|
|||
}
|
||||
|
||||
FilterBox::FilterBox(QWidget *, not_null<ChannelData *> channel, const std::vector<not_null<UserData *>> &admins,
|
||||
const FilterValue &filter, base::lambda<void(FilterValue &&filter)> saveCallback)
|
||||
const FilterValue &filter, Fn<void(FilterValue &&filter)> saveCallback)
|
||||
: BoxContent()
|
||||
, _channel(channel)
|
||||
, _admins(admins)
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace AdminLog {
|
|||
class FilterBox : public BoxContent {
|
||||
public:
|
||||
FilterBox(QWidget *, not_null<ChannelData *> channel, const std::vector<not_null<UserData *>> &admins,
|
||||
const FilterValue &filter, base::lambda<void(FilterValue &&filter)> saveCallback);
|
||||
const FilterValue &filter, Fn<void(FilterValue &&filter)> saveCallback);
|
||||
|
||||
protected:
|
||||
void prepare() override;
|
||||
|
@ -40,7 +40,7 @@ private:
|
|||
not_null<ChannelData *> _channel;
|
||||
std::vector<not_null<UserData *>> _admins;
|
||||
FilterValue _initialFilter;
|
||||
base::lambda<void(FilterValue &&filter)> _saveCallback;
|
||||
Fn<void(FilterValue &&filter)> _saveCallback;
|
||||
|
||||
class Inner;
|
||||
QPointer<Inner> _inner;
|
||||
|
|
|
@ -375,7 +375,7 @@ void InnerWidget::requestAdmins() {
|
|||
.send();
|
||||
}
|
||||
|
||||
void InnerWidget::showFilter(base::lambda<void(FilterValue &&filter)> callback) {
|
||||
void InnerWidget::showFilter(Fn<void(FilterValue &&filter)> callback) {
|
||||
if (_admins.empty()) {
|
||||
_showFilterCallback = std::move(callback);
|
||||
} else {
|
||||
|
|
|
@ -72,7 +72,7 @@ public:
|
|||
// Empty "flags" means all events.
|
||||
void applyFilter(FilterValue &&value);
|
||||
void applySearch(const QString &query);
|
||||
void showFilter(base::lambda<void(FilterValue &&filter)> callback);
|
||||
void showFilter(Fn<void(FilterValue &&filter)> callback);
|
||||
|
||||
// AbstractTooltipShower interface
|
||||
QString tooltipText() const override;
|
||||
|
@ -240,7 +240,7 @@ private:
|
|||
QString _searchQuery;
|
||||
std::vector<not_null<UserData *>> _admins;
|
||||
std::vector<not_null<UserData *>> _adminsCanEdit;
|
||||
base::lambda<void(FilterValue &&filter)> _showFilterCallback;
|
||||
Fn<void(FilterValue &&filter)> _showFilterCallback;
|
||||
};
|
||||
|
||||
} // namespace AdminLog
|
||||
|
|
|
@ -271,7 +271,7 @@ TextWithEntities GenerateParticipantChangeText(not_null<ChannelData *> channel,
|
|||
} // namespace
|
||||
|
||||
void GenerateItems(not_null<History *> history, LocalIdManager &idManager, const MTPDchannelAdminLogEvent &event,
|
||||
base::lambda<void(HistoryItemOwned item)> callback) {
|
||||
Fn<void(HistoryItemOwned item)> callback) {
|
||||
Expects(history->peer->isChannel());
|
||||
|
||||
auto id = event.vid.v;
|
||||
|
|
|
@ -20,7 +20,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#include "base/lambda.h"
|
||||
#include "core/basic_types.h"
|
||||
#include "core/utils.h"
|
||||
#include "history/history_item.h"
|
||||
|
@ -33,7 +32,7 @@ class HistoryItemOwned;
|
|||
class LocalIdManager;
|
||||
|
||||
void GenerateItems(not_null<History *> history, LocalIdManager &idManager, const MTPDchannelAdminLogEvent &event,
|
||||
base::lambda<void(HistoryItemOwned item)> callback);
|
||||
Fn<void(HistoryItemOwned item)> callback);
|
||||
|
||||
// Smart pointer wrapper for HistoryItem* that destroys the owned item.
|
||||
class HistoryItemOwned {
|
||||
|
|
|
@ -20,7 +20,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#include "base/lambda.h"
|
||||
#include "ui/animation.h"
|
||||
#include "ui/twidget.h"
|
||||
#include <QMimeData>
|
||||
|
@ -40,7 +39,7 @@ public:
|
|||
|
||||
void hideFast();
|
||||
|
||||
void setDroppedCallback(base::lambda<void(const QMimeData *data)> callback) {
|
||||
void setDroppedCallback(Fn<void(const QMimeData *data)> callback) {
|
||||
_droppedCallback = std::move(callback);
|
||||
}
|
||||
|
||||
|
@ -70,7 +69,7 @@ private:
|
|||
bool _hiding = false;
|
||||
bool _in = false;
|
||||
QPixmap _cache;
|
||||
base::lambda<void(const QMimeData *data)> _droppedCallback;
|
||||
Fn<void(const QMimeData *data)> _droppedCallback;
|
||||
|
||||
Animation _a_opacity;
|
||||
Animation _a_in;
|
||||
|
|
|
@ -266,7 +266,7 @@ void FastShareMessage(not_null<HistoryItem *> item) {
|
|||
}
|
||||
return false;
|
||||
};
|
||||
auto copyLinkCallback = canCopyLink ? base::lambda<void()>(std::move(copyCallback)) : base::lambda<void()>();
|
||||
auto copyLinkCallback = canCopyLink ? Fn<void()>(std::move(copyCallback)) : Fn<void()>();
|
||||
Ui::show(Box<ShareBox>(std::move(copyLinkCallback), std::move(submitCallback), std::move(filterCallback)));
|
||||
}
|
||||
|
||||
|
@ -274,7 +274,7 @@ void HistoryInitMessages() {
|
|||
initTextOptions();
|
||||
}
|
||||
|
||||
base::lambda<void(ChannelData *, MsgId)> HistoryDependentItemCallback(const FullMsgId &msgId) {
|
||||
Fn<void(ChannelData *, MsgId)> HistoryDependentItemCallback(const FullMsgId &msgId) {
|
||||
return [dependent = msgId](ChannelData *channel, MsgId msgId) {
|
||||
if (auto item = App::histItemById(dependent)) {
|
||||
item->updateDependencyItem();
|
||||
|
|
|
@ -20,7 +20,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#include "base/lambda.h"
|
||||
#include "core/basic_types.h"
|
||||
#include "history/history.h"
|
||||
#include "history/history_item.h"
|
||||
|
@ -28,7 +27,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
|||
#include "structs.h"
|
||||
|
||||
void HistoryInitMessages();
|
||||
base::lambda<void(ChannelData *, MsgId)> HistoryDependentItemCallback(const FullMsgId &msgId);
|
||||
Fn<void(ChannelData *, MsgId)> HistoryDependentItemCallback(const FullMsgId &msgId);
|
||||
MTPDmessage::Flags NewMessageFlags(not_null<PeerData *> peer);
|
||||
QString GetErrorTextForForward(not_null<PeerData *> peer, const SelectedItemSet &items);
|
||||
void FastShareMessage(not_null<HistoryItem *> item);
|
||||
|
|
|
@ -427,7 +427,7 @@ void Inner::refreshSwitchPmButton(const CacheEntry *entry) {
|
|||
_switchPmStartToken.clear();
|
||||
} else {
|
||||
if (!_switchPmButton) {
|
||||
_switchPmButton.create(this, base::lambda<QString()>(), st::switchPmButton);
|
||||
_switchPmButton.create(this, Fn<QString()>(), st::switchPmButton);
|
||||
_switchPmButton->show();
|
||||
_switchPmButton->setTextTransform(Ui::RoundButton::TextTransform::NoTransform);
|
||||
connect(_switchPmButton, SIGNAL(clicked()), this, SLOT(onSwitchPm()));
|
||||
|
|
|
@ -83,7 +83,7 @@ public:
|
|||
|
||||
int countHeight();
|
||||
|
||||
void setResultSelectedCallback(base::lambda<void(Result *result, UserData *bot)> callback) {
|
||||
void setResultSelectedCallback(Fn<void(Result *result, UserData *bot)> callback) {
|
||||
_resultSelectedCallback = std::move(callback);
|
||||
}
|
||||
|
||||
|
@ -160,7 +160,7 @@ private:
|
|||
QTimer _previewTimer;
|
||||
bool _previewShown = false;
|
||||
|
||||
base::lambda<void(Result *result, UserData *bot)> _resultSelectedCallback;
|
||||
Fn<void(Result *result, UserData *bot)> _resultSelectedCallback;
|
||||
};
|
||||
|
||||
} // namespace internal
|
||||
|
@ -186,7 +186,7 @@ public:
|
|||
void showAnimated();
|
||||
void hideAnimated();
|
||||
|
||||
void setResultSelectedCallback(base::lambda<void(Result *result, UserData *bot)> callback) {
|
||||
void setResultSelectedCallback(Fn<void(Result *result, UserData *bot)> callback) {
|
||||
_inner->setResultSelectedCallback(std::move(callback));
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
|||
|
||||
namespace Intro {
|
||||
|
||||
CodeInput::CodeInput(QWidget *parent, const style::InputField &st, base::lambda<QString()> placeholderFactory)
|
||||
CodeInput::CodeInput(QWidget *parent, const style::InputField &st, Fn<QString()> placeholderFactory)
|
||||
: Ui::MaskedInputField(parent, st, std::move(placeholderFactory)) {}
|
||||
|
||||
void CodeInput::setDigitsCountMax(int digitsCount) {
|
||||
|
@ -163,7 +163,7 @@ void CodeWidget::updateControlsGeometry() {
|
|||
_callLabel->moveToLeft(contentLeft() + st::buttonRadius, linkTop);
|
||||
}
|
||||
|
||||
void CodeWidget::showCodeError(base::lambda<QString()> textFactory) {
|
||||
void CodeWidget::showCodeError(Fn<QString()> textFactory) {
|
||||
if (textFactory) _code->showError();
|
||||
showError(std::move(textFactory));
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ class CodeInput final : public Ui::MaskedInputField {
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CodeInput(QWidget *parent, const style::InputField &st, base::lambda<QString()> placeholderFactory);
|
||||
CodeInput(QWidget *parent, const style::InputField &st, Fn<QString()> placeholderFactory);
|
||||
|
||||
void setDigitsCountMax(int digitsCount);
|
||||
|
||||
|
@ -83,7 +83,7 @@ private:
|
|||
void codeSubmitDone(const MTPauth_Authorization &result);
|
||||
bool codeSubmitFail(const RPCError &error);
|
||||
|
||||
void showCodeError(base::lambda<QString()> textFactory);
|
||||
void showCodeError(Fn<QString()> textFactory);
|
||||
void callDone(const MTPauth_SentCode &v);
|
||||
void gotPassword(const MTPaccount_Password &result);
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ void PhoneWidget::updateSignupGeometry() {
|
|||
}
|
||||
}
|
||||
|
||||
void PhoneWidget::showPhoneError(base::lambda<QString()> textFactory) {
|
||||
void PhoneWidget::showPhoneError(Fn<QString()> textFactory) {
|
||||
_phone->showError();
|
||||
showError(std::move(textFactory));
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ private:
|
|||
QString fullNumber() const;
|
||||
void stopCheck();
|
||||
|
||||
void showPhoneError(base::lambda<QString()> textFactory);
|
||||
void showPhoneError(Fn<QString()> textFactory);
|
||||
void hidePhoneError();
|
||||
void showSignup();
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ Widget::Widget(QWidget *parent)
|
|||
, _back(this, object_ptr<Ui::IconButton>(this, st::introBackButton), st::introSlideDuration)
|
||||
, _settings(this, object_ptr<Ui::RoundButton>(this, langFactory(lng_menu_settings), st::defaultBoxButton),
|
||||
st::introCoverDuration)
|
||||
, _next(this, base::lambda<QString()>(), st::introNextButton) {
|
||||
, _next(this, Fn<QString()>(), st::introNextButton) {
|
||||
auto country = Platform::SystemCountry();
|
||||
if (country.isEmpty()) {
|
||||
country = str_const_toString(kDefaultCountry);
|
||||
|
@ -484,7 +484,7 @@ void Widget::Step::updateLabelsPosition() {
|
|||
}
|
||||
}
|
||||
|
||||
void Widget::Step::setTitleText(base::lambda<QString()> richTitleTextFactory) {
|
||||
void Widget::Step::setTitleText(Fn<QString()> richTitleTextFactory) {
|
||||
_titleTextFactory = std::move(richTitleTextFactory);
|
||||
refreshTitle();
|
||||
updateLabelsPosition();
|
||||
|
@ -494,7 +494,7 @@ void Widget::Step::refreshTitle() {
|
|||
_title->setRichText(_titleTextFactory());
|
||||
}
|
||||
|
||||
void Widget::Step::setDescriptionText(base::lambda<QString()> richDescriptionTextFactory) {
|
||||
void Widget::Step::setDescriptionText(Fn<QString()> richDescriptionTextFactory) {
|
||||
_descriptionTextFactory = std::move(richDescriptionTextFactory);
|
||||
refreshDescription();
|
||||
updateLabelsPosition();
|
||||
|
@ -689,7 +689,7 @@ void Widget::Step::setErrorBelowLink(bool below) {
|
|||
}
|
||||
}
|
||||
|
||||
void Widget::Step::showError(base::lambda<QString()> textFactory) {
|
||||
void Widget::Step::showError(Fn<QString()> textFactory) {
|
||||
_errorTextFactory = std::move(textFactory);
|
||||
refreshError();
|
||||
updateLabelsPosition();
|
||||
|
@ -778,11 +778,11 @@ void Widget::Step::showAnimated(Direction direction) {
|
|||
}
|
||||
}
|
||||
|
||||
void Widget::Step::setGoCallback(base::lambda<void(Step *step, Direction direction)> callback) {
|
||||
void Widget::Step::setGoCallback(Fn<void(Step *step, Direction direction)> callback) {
|
||||
_goCallback = std::move(callback);
|
||||
}
|
||||
|
||||
void Widget::Step::setShowResetCallback(base::lambda<void()> callback) {
|
||||
void Widget::Step::setShowResetCallback(Fn<void()> callback) {
|
||||
_showResetCallback = std::move(callback);
|
||||
}
|
||||
|
||||
|
|
|
@ -95,8 +95,8 @@ public:
|
|||
setFocus();
|
||||
}
|
||||
|
||||
void setGoCallback(base::lambda<void(Step *step, Direction direction)> callback);
|
||||
void setShowResetCallback(base::lambda<void()> callback);
|
||||
void setGoCallback(Fn<void(Step *step, Direction direction)> callback);
|
||||
void setShowResetCallback(Fn<void()> callback);
|
||||
|
||||
void prepareShowAnimated(Step *after);
|
||||
void showAnimated(Direction direction);
|
||||
|
@ -117,9 +117,9 @@ public:
|
|||
|
||||
void setErrorCentered(bool centered);
|
||||
void setErrorBelowLink(bool below);
|
||||
void showError(base::lambda<QString()> textFactory);
|
||||
void showError(Fn<QString()> textFactory);
|
||||
void hideError() {
|
||||
showError(base::lambda<QString()>());
|
||||
showError(Fn<QString()>());
|
||||
}
|
||||
|
||||
~Step();
|
||||
|
@ -128,8 +128,8 @@ public:
|
|||
void paintEvent(QPaintEvent *e) override;
|
||||
void resizeEvent(QResizeEvent *e) override;
|
||||
|
||||
void setTitleText(base::lambda<QString()> richTitleTextFactory);
|
||||
void setDescriptionText(base::lambda<QString()> richDescriptionTextFactory);
|
||||
void setTitleText(Fn<QString()> richTitleTextFactory);
|
||||
void setDescriptionText(Fn<QString()> richDescriptionTextFactory);
|
||||
bool paintAnimated(Painter &p, QRect clip);
|
||||
|
||||
void fillSentCodeData(const MTPauth_SentCodeType &type);
|
||||
|
@ -186,17 +186,17 @@ public:
|
|||
|
||||
Data *_data = nullptr;
|
||||
bool _hasCover = false;
|
||||
base::lambda<void(Step *step, Direction direction)> _goCallback;
|
||||
base::lambda<void()> _showResetCallback;
|
||||
Fn<void(Step *step, Direction direction)> _goCallback;
|
||||
Fn<void()> _showResetCallback;
|
||||
|
||||
object_ptr<Ui::FlatLabel> _title;
|
||||
base::lambda<QString()> _titleTextFactory;
|
||||
Fn<QString()> _titleTextFactory;
|
||||
object_ptr<Ui::WidgetFadeWrap<Ui::FlatLabel>> _description;
|
||||
base::lambda<QString()> _descriptionTextFactory;
|
||||
Fn<QString()> _descriptionTextFactory;
|
||||
|
||||
bool _errorCentered = false;
|
||||
bool _errorBelowLink = false;
|
||||
base::lambda<QString()> _errorTextFactory;
|
||||
Fn<QString()> _errorTextFactory;
|
||||
object_ptr<Ui::WidgetFadeWrap<Ui::FlatLabel>> _error = {nullptr};
|
||||
|
||||
Animation _a_show;
|
||||
|
|
|
@ -35,8 +35,7 @@ FileParser::FileParser(const QString &file, const std::set<LangKey> &request)
|
|||
parse();
|
||||
}
|
||||
|
||||
FileParser::FileParser(const QByteArray &content,
|
||||
base::lambda<void(QLatin1String key, const QByteArray &value)> callback)
|
||||
FileParser::FileParser(const QByteArray &content, Fn<void(QLatin1String key, const QByteArray &value)> callback)
|
||||
: _content(base::parse::stripComments(content))
|
||||
, _callback(std::move(callback)) {
|
||||
parse();
|
||||
|
|
|
@ -29,7 +29,7 @@ public:
|
|||
using Result = QMap<LangKey, QString>;
|
||||
|
||||
FileParser(const QString &file, const std::set<LangKey> &request);
|
||||
FileParser(const QByteArray &content, base::lambda<void(QLatin1String key, const QByteArray &value)> callback);
|
||||
FileParser(const QByteArray &content, Fn<void(QLatin1String key, const QByteArray &value)> callback);
|
||||
|
||||
static QByteArray ReadFile(const QString &absolutePath, const QString &relativePath);
|
||||
|
||||
|
@ -57,7 +57,7 @@ private:
|
|||
|
||||
const QByteArray _content;
|
||||
const std::set<LangKey> _request;
|
||||
const base::lambda<void(QLatin1String key, const QByteArray &value)> _callback;
|
||||
const Fn<void(QLatin1String key, const QByteArray &value)> _callback;
|
||||
|
||||
Result _result;
|
||||
};
|
||||
|
|
|
@ -20,7 +20,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#include "base/lambda.h"
|
||||
#include "lang/lang_instance.h"
|
||||
#include <QDate>
|
||||
|
||||
|
@ -28,7 +27,7 @@ inline QString lang(LangKey key) {
|
|||
return Lang::Current().getValue(key);
|
||||
}
|
||||
|
||||
inline base::lambda<QString()> langFactory(LangKey key) {
|
||||
inline Fn<QString()> langFactory(LangKey key) {
|
||||
return [key] { return Lang::Current().getValue(key); };
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ public:
|
|||
BackgroundWidget(QWidget *parent)
|
||||
: TWidget(parent) {}
|
||||
|
||||
void setDoneCallback(base::lambda<void()> callback) {
|
||||
void setDoneCallback(Fn<void()> callback) {
|
||||
_doneCallback = std::move(callback);
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ private:
|
|||
QPixmap _specialLayerCache;
|
||||
QPixmap _layerCache;
|
||||
|
||||
base::lambda<void()> _doneCallback;
|
||||
Fn<void()> _doneCallback;
|
||||
|
||||
bool _wasAnimating = false;
|
||||
bool _inPaintEvent = false;
|
||||
|
|
|
@ -22,7 +22,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
|||
|
||||
#include <QMouseEvent>
|
||||
|
||||
#include "base/lambda.h"
|
||||
#include "structs.h"
|
||||
#include "ui/animation.h"
|
||||
#include "ui/twidget.h"
|
||||
|
@ -54,10 +53,10 @@ public:
|
|||
|
||||
bool overlaps(const QRect &globalRect);
|
||||
|
||||
void setClosedCallback(base::lambda<void()> callback) {
|
||||
void setClosedCallback(Fn<void()> callback) {
|
||||
_closedCallback = std::move(callback);
|
||||
}
|
||||
void setResizedCallback(base::lambda<void()> callback) {
|
||||
void setResizedCallback(Fn<void()> callback) {
|
||||
_resizedCallback = std::move(callback);
|
||||
}
|
||||
|
||||
|
@ -82,8 +81,8 @@ protected:
|
|||
|
||||
private:
|
||||
bool _closing = false;
|
||||
base::lambda<void()> _closedCallback;
|
||||
base::lambda<void()> _resizedCallback;
|
||||
Fn<void()> _closedCallback;
|
||||
Fn<void()> _resizedCallback;
|
||||
};
|
||||
|
||||
class LayerStackWidget : public TWidget {
|
||||
|
|
|
@ -2265,8 +2265,7 @@ void MainWidget::scheduleViewIncrement(HistoryItem *item) {
|
|||
j.value().insert(item->id, true);
|
||||
}
|
||||
|
||||
void MainWidget::fillPeerMenu(PeerData *peer,
|
||||
base::lambda<QAction *(const QString &text, base::lambda<void()> handler)> callback,
|
||||
void MainWidget::fillPeerMenu(PeerData *peer, Fn<QAction *(const QString &text, Fn<void()> handler)> callback,
|
||||
bool pinToggle) {
|
||||
if (pinToggle) {
|
||||
auto isPinned = false;
|
||||
|
|
|
@ -368,9 +368,7 @@ public:
|
|||
|
||||
void scheduleViewIncrement(HistoryItem *item);
|
||||
|
||||
void fillPeerMenu(PeerData *peer,
|
||||
base::lambda<QAction *(const QString &text, base::lambda<void()> handler)> callback,
|
||||
bool pinToggle);
|
||||
void fillPeerMenu(PeerData *peer, Fn<QAction *(const QString &text, Fn<void()> handler)> callback, bool pinToggle);
|
||||
|
||||
void gotRangeDifference(ChannelData *channel, const MTPupdates_ChannelDifference &diff);
|
||||
void onSelfParticipantUpdated(ChannelData *channel);
|
||||
|
|
|
@ -58,7 +58,7 @@ enum ReaderSteps {
|
|||
class ReaderPrivate;
|
||||
class Reader {
|
||||
public:
|
||||
using Callback = base::lambda<void(Notification)>;
|
||||
using Callback = Fn<void(Notification)>;
|
||||
enum class Mode {
|
||||
Gif,
|
||||
Video,
|
||||
|
|
|
@ -25,7 +25,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
|||
namespace Media {
|
||||
namespace Player {
|
||||
|
||||
PlayButtonLayout::PlayButtonLayout(const style::MediaPlayerButton &st, base::lambda<void()> callback)
|
||||
PlayButtonLayout::PlayButtonLayout(const style::MediaPlayerButton &st, Fn<void()> callback)
|
||||
: _st(st)
|
||||
, _callback(std::move(callback)) {}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ public:
|
|||
Pause,
|
||||
Cancel,
|
||||
};
|
||||
PlayButtonLayout(const style::MediaPlayerButton &st, base::lambda<void()> callback);
|
||||
PlayButtonLayout(const style::MediaPlayerButton &st, Fn<void()> callback);
|
||||
|
||||
void setState(State state);
|
||||
void finishTransform();
|
||||
|
@ -57,7 +57,7 @@ private:
|
|||
Animation _transformProgress;
|
||||
bool _transformBackward = false;
|
||||
|
||||
base::lambda<void()> _callback;
|
||||
Fn<void()> _callback;
|
||||
};
|
||||
|
||||
} // namespace Player
|
||||
|
|
|
@ -46,7 +46,7 @@ class CoverWidget : public TWidget, private base::Subscriber {
|
|||
public:
|
||||
CoverWidget(QWidget *parent);
|
||||
|
||||
using ButtonCallback = base::lambda<void()>;
|
||||
using ButtonCallback = Fn<void()>;
|
||||
void setPinCallback(ButtonCallback &&callback);
|
||||
void setCloseCallback(ButtonCallback &&callback);
|
||||
|
||||
|
|
|
@ -33,8 +33,8 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
|||
namespace Media {
|
||||
namespace Player {
|
||||
|
||||
Float::Float(QWidget *parent, HistoryItem *item, base::lambda<void(bool visible)> toggleCallback,
|
||||
base::lambda<void(bool closed)> draggedCallback)
|
||||
Float::Float(QWidget *parent, HistoryItem *item, Fn<void(bool visible)> toggleCallback,
|
||||
Fn<void(bool closed)> draggedCallback)
|
||||
: TWidget(parent)
|
||||
, _item(item)
|
||||
, _toggleCallback(std::move(toggleCallback))
|
||||
|
|
|
@ -35,8 +35,8 @@ namespace Player {
|
|||
|
||||
class Float : public TWidget, private base::Subscriber {
|
||||
public:
|
||||
Float(QWidget *parent, HistoryItem *item, base::lambda<void(bool visible)> toggleCallback,
|
||||
base::lambda<void(bool closed)> draggedCallback);
|
||||
Float(QWidget *parent, HistoryItem *item, Fn<void(bool visible)> toggleCallback,
|
||||
Fn<void(bool closed)> draggedCallback);
|
||||
|
||||
HistoryItem *item() const {
|
||||
return _item;
|
||||
|
@ -91,7 +91,7 @@ private:
|
|||
void finishDrag(bool closed);
|
||||
|
||||
HistoryItem *_item = nullptr;
|
||||
base::lambda<void(bool visible)> _toggleCallback;
|
||||
Fn<void(bool visible)> _toggleCallback;
|
||||
|
||||
double _opacity = 1.;
|
||||
|
||||
|
@ -102,7 +102,7 @@ private:
|
|||
|
||||
bool _drag = false;
|
||||
QPoint _dragLocalPoint;
|
||||
base::lambda<void(bool closed)> _draggedCallback;
|
||||
Fn<void(bool closed)> _draggedCallback;
|
||||
|
||||
std::unique_ptr<Clip::Playback> _roundPlayback;
|
||||
};
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
void showFromOther();
|
||||
void hideFromOther();
|
||||
|
||||
using ButtonCallback = base::lambda<void()>;
|
||||
using ButtonCallback = Fn<void()>;
|
||||
void setPinCallback(ButtonCallback &&callback);
|
||||
void setCloseCallback(ButtonCallback &&callback);
|
||||
|
||||
|
|
|
@ -180,7 +180,7 @@ void Widget::updateVolumeToggleIcon() {
|
|||
_volumeToggle->setIconOverride(icon());
|
||||
}
|
||||
|
||||
void Widget::setCloseCallback(base::lambda<void()> callback) {
|
||||
void Widget::setCloseCallback(Fn<void()> callback) {
|
||||
_closeCallback = std::move(callback);
|
||||
_close->setClickedCallback([this] { stopAndClose(); });
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ class Widget : public TWidget, private base::Subscriber {
|
|||
public:
|
||||
Widget(QWidget *parent);
|
||||
|
||||
void setCloseCallback(base::lambda<void()> callback);
|
||||
void setCloseCallback(Fn<void()> callback);
|
||||
void stopAndClose();
|
||||
void setShadowGeometryToLeft(int x, int y, int w, int h);
|
||||
void showShadow();
|
||||
|
@ -103,7 +103,7 @@ private:
|
|||
// We change _voiceIsActive to false only manually or from tracksFinished().
|
||||
AudioMsgId::Type _type = AudioMsgId::Type::Unknown;
|
||||
bool _voiceIsActive = false;
|
||||
base::lambda<void()> _closeCallback;
|
||||
Fn<void()> _closeCallback;
|
||||
|
||||
bool _labelsOver = false;
|
||||
bool _labelsDown = false;
|
||||
|
|
|
@ -20,7 +20,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#include "base/lambda.h"
|
||||
#include "ui/animation.h"
|
||||
#include "ui/widgets/continuous_sliders.h"
|
||||
|
||||
|
@ -35,10 +34,10 @@ class Playback {
|
|||
public:
|
||||
Playback();
|
||||
|
||||
void setValueChangedCallback(base::lambda<void(double)> callback) {
|
||||
void setValueChangedCallback(Fn<void(double)> callback) {
|
||||
_valueChanged = std::move(callback);
|
||||
}
|
||||
void setInLoadingStateChangedCallback(base::lambda<void(bool)> callback) {
|
||||
void setInLoadingStateChangedCallback(Fn<void(bool)> callback) {
|
||||
_inLoadingStateChanged = std::move(callback);
|
||||
}
|
||||
void setValue(double value, bool animated);
|
||||
|
@ -55,10 +54,10 @@ private:
|
|||
// so it should be a BasicAnimation, not an Animation.
|
||||
anim::value a_value;
|
||||
BasicAnimation _a_value;
|
||||
base::lambda<void(double)> _valueChanged;
|
||||
Fn<void(double)> _valueChanged;
|
||||
|
||||
bool _inLoadingState = false;
|
||||
base::lambda<void(bool)> _inLoadingStateChanged;
|
||||
Fn<void(bool)> _inLoadingStateChanged;
|
||||
|
||||
qint64 _position = 0;
|
||||
qint64 _length = 0;
|
||||
|
|
|
@ -200,7 +200,7 @@ public:
|
|||
void call_handleDelayedPeerUpdates();
|
||||
void call_handleObservables();
|
||||
|
||||
void callDelayed(int duration, base::lambda_once<void()> &&lambda) {
|
||||
void callDelayed(int duration, FnMut<void()> &&lambda) {
|
||||
_callDelayedTimer.call(duration, std::move(lambda));
|
||||
}
|
||||
|
||||
|
|
|
@ -97,8 +97,8 @@ public:
|
|||
|
||||
void setUpdatesHandler(RPCDoneHandlerPtr onDone);
|
||||
void setGlobalFailHandler(RPCFailHandlerPtr onFail);
|
||||
void setStateChangedHandler(base::lambda<void(ShiftedDcId shiftedDcId, qint32 state)> handler);
|
||||
void setSessionResetHandler(base::lambda<void(ShiftedDcId shiftedDcId)> handler);
|
||||
void setStateChangedHandler(Fn<void(ShiftedDcId shiftedDcId, qint32 state)> handler);
|
||||
void setSessionResetHandler(Fn<void(ShiftedDcId shiftedDcId)> handler);
|
||||
void clearGlobalHandlers();
|
||||
|
||||
internal::Session *getSession(ShiftedDcId shiftedDcId);
|
||||
|
@ -185,8 +185,8 @@ private:
|
|||
RPCCallbackClears _toClear;
|
||||
|
||||
RPCResponseHandler _globalHandler;
|
||||
base::lambda<void(ShiftedDcId shiftedDcId, qint32 state)> _stateChangedHandler;
|
||||
base::lambda<void(ShiftedDcId shiftedDcId)> _sessionResetHandler;
|
||||
Fn<void(ShiftedDcId shiftedDcId, qint32 state)> _stateChangedHandler;
|
||||
Fn<void(ShiftedDcId shiftedDcId)> _sessionResetHandler;
|
||||
|
||||
base::Timer _checkDelayedTimer;
|
||||
|
||||
|
@ -1277,19 +1277,19 @@ void Instance::Private::setGlobalFailHandler(RPCFailHandlerPtr onFail) {
|
|||
_globalHandler.onFail = onFail;
|
||||
}
|
||||
|
||||
void Instance::Private::setStateChangedHandler(base::lambda<void(ShiftedDcId shiftedDcId, qint32 state)> handler) {
|
||||
void Instance::Private::setStateChangedHandler(Fn<void(ShiftedDcId shiftedDcId, qint32 state)> handler) {
|
||||
_stateChangedHandler = std::move(handler);
|
||||
}
|
||||
|
||||
void Instance::Private::setSessionResetHandler(base::lambda<void(ShiftedDcId shiftedDcId)> handler) {
|
||||
void Instance::Private::setSessionResetHandler(Fn<void(ShiftedDcId shiftedDcId)> handler) {
|
||||
_sessionResetHandler = std::move(handler);
|
||||
}
|
||||
|
||||
void Instance::Private::clearGlobalHandlers() {
|
||||
setUpdatesHandler(RPCDoneHandlerPtr());
|
||||
setGlobalFailHandler(RPCFailHandlerPtr());
|
||||
setStateChangedHandler(base::lambda<void(ShiftedDcId, qint32)>());
|
||||
setSessionResetHandler(base::lambda<void(ShiftedDcId)>());
|
||||
setStateChangedHandler(Fn<void(ShiftedDcId, qint32)>());
|
||||
setSessionResetHandler(Fn<void(ShiftedDcId)>());
|
||||
}
|
||||
|
||||
void Instance::Private::prepareToDestroy() {
|
||||
|
@ -1424,11 +1424,11 @@ void Instance::setGlobalFailHandler(RPCFailHandlerPtr onFail) {
|
|||
_private->setGlobalFailHandler(onFail);
|
||||
}
|
||||
|
||||
void Instance::setStateChangedHandler(base::lambda<void(ShiftedDcId shiftedDcId, qint32 state)> handler) {
|
||||
void Instance::setStateChangedHandler(Fn<void(ShiftedDcId shiftedDcId, qint32 state)> handler) {
|
||||
_private->setStateChangedHandler(std::move(handler));
|
||||
}
|
||||
|
||||
void Instance::setSessionResetHandler(base::lambda<void(ShiftedDcId shiftedDcId)> handler) {
|
||||
void Instance::setSessionResetHandler(Fn<void(ShiftedDcId shiftedDcId)> handler) {
|
||||
_private->setSessionResetHandler(std::move(handler));
|
||||
}
|
||||
|
||||
|
|
|
@ -118,8 +118,8 @@ public:
|
|||
|
||||
void setUpdatesHandler(RPCDoneHandlerPtr onDone);
|
||||
void setGlobalFailHandler(RPCFailHandlerPtr onFail);
|
||||
void setStateChangedHandler(base::lambda<void(ShiftedDcId shiftedDcId, qint32 state)> handler);
|
||||
void setSessionResetHandler(base::lambda<void(ShiftedDcId shiftedDcId)> handler);
|
||||
void setStateChangedHandler(Fn<void(ShiftedDcId shiftedDcId, qint32 state)> handler);
|
||||
void setSessionResetHandler(Fn<void(ShiftedDcId shiftedDcId)> handler);
|
||||
void clearGlobalHandlers();
|
||||
|
||||
void onStateChange(ShiftedDcId dcWithShift, qint32 state);
|
||||
|
|
|
@ -854,7 +854,7 @@ using MTPSessionResetHandler = void (*)(qint32 dcId);
|
|||
|
||||
template <typename Base, typename FunctionType> class RPCHandlerImplementation : public Base {
|
||||
protected:
|
||||
using Lambda = base::lambda_once<FunctionType>;
|
||||
using Lambda = FnMut<FunctionType>;
|
||||
using Parent = RPCHandlerImplementation<Base, FunctionType>;
|
||||
|
||||
public:
|
||||
|
|
|
@ -20,7 +20,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#include "base/lambda.h"
|
||||
#include "base/variant.h"
|
||||
#include "facades.h"
|
||||
#include "mtproto/rpc_sender.h"
|
||||
|
@ -38,21 +37,21 @@ class Sender {
|
|||
RequestBuilder &operator=(RequestBuilder &&other) = delete;
|
||||
|
||||
protected:
|
||||
using FailPlainHandler = base::lambda_once<void(const RPCError &error)>;
|
||||
using FailRequestIdHandler = base::lambda_once<void(const RPCError &error, mtpRequestId requestId)>;
|
||||
using FailPlainHandler = FnMut<void(const RPCError &error)>;
|
||||
using FailRequestIdHandler = FnMut<void(const RPCError &error, mtpRequestId requestId)>;
|
||||
enum class FailSkipPolicy {
|
||||
Simple,
|
||||
HandleFlood,
|
||||
HandleAll,
|
||||
};
|
||||
template <typename Response> struct DonePlainPolicy {
|
||||
using Callback = base::lambda_once<void(const Response &result)>;
|
||||
using Callback = FnMut<void(const Response &result)>;
|
||||
static void handle(Callback &&handler, mtpRequestId requestId, Response &&result) {
|
||||
handler(result);
|
||||
}
|
||||
};
|
||||
template <typename Response> struct DoneRequestIdPolicy {
|
||||
using Callback = base::lambda_once<void(const Response &result, mtpRequestId requestId)>;
|
||||
using Callback = FnMut<void(const Response &result, mtpRequestId requestId)>;
|
||||
static void handle(Callback &&handler, mtpRequestId requestId, Response &&result) {
|
||||
handler(result, requestId);
|
||||
}
|
||||
|
@ -84,13 +83,13 @@ class Sender {
|
|||
};
|
||||
|
||||
struct FailPlainPolicy {
|
||||
using Callback = base::lambda_once<void(const RPCError &error)>;
|
||||
using Callback = FnMut<void(const RPCError &error)>;
|
||||
static void handle(Callback &&handler, mtpRequestId requestId, const RPCError &error) {
|
||||
handler(error);
|
||||
}
|
||||
};
|
||||
struct FailRequestIdPolicy {
|
||||
using Callback = base::lambda_once<void(const RPCError &error, mtpRequestId requestId)>;
|
||||
using Callback = FnMut<void(const RPCError &error, mtpRequestId requestId)>;
|
||||
static void handle(Callback &&handler, mtpRequestId requestId, const RPCError &error) {
|
||||
handler(error, requestId);
|
||||
}
|
||||
|
@ -215,25 +214,24 @@ public:
|
|||
return *this;
|
||||
}
|
||||
SpecificRequestBuilder &
|
||||
done(base::lambda_once<void(const typename Request::ResponseType &result)> callback) WARN_UNUSED_RESULT {
|
||||
done(FnMut<void(const typename Request::ResponseType &result)> callback) WARN_UNUSED_RESULT {
|
||||
setDoneHandler(MakeShared<DoneHandler<typename Request::ResponseType, DonePlainPolicy>>(
|
||||
sender(), std::move(callback)));
|
||||
return *this;
|
||||
}
|
||||
SpecificRequestBuilder &
|
||||
done(base::lambda_once<void(const typename Request::ResponseType &result, mtpRequestId requestId)> callback)
|
||||
done(FnMut<void(const typename Request::ResponseType &result, mtpRequestId requestId)> callback)
|
||||
WARN_UNUSED_RESULT {
|
||||
setDoneHandler(MakeShared<DoneHandler<typename Request::ResponseType, DoneRequestIdPolicy>>(
|
||||
sender(), std::move(callback)));
|
||||
return *this;
|
||||
}
|
||||
SpecificRequestBuilder &
|
||||
fail(base::lambda_once<void(const RPCError &error)> callback) noexcept WARN_UNUSED_RESULT {
|
||||
SpecificRequestBuilder &fail(FnMut<void(const RPCError &error)> callback) noexcept WARN_UNUSED_RESULT {
|
||||
setFailHandler(std::move(callback));
|
||||
return *this;
|
||||
}
|
||||
SpecificRequestBuilder &fail(base::lambda_once<void(const RPCError &error, mtpRequestId requestId)>
|
||||
callback) noexcept WARN_UNUSED_RESULT {
|
||||
SpecificRequestBuilder &
|
||||
fail(FnMut<void(const RPCError &error, mtpRequestId requestId)> callback) noexcept WARN_UNUSED_RESULT {
|
||||
setFailHandler(std::move(callback));
|
||||
return *this;
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ Y1hZCxdv6cs5UnW9+PWvS+WIbkh+GaWYxwIDAQAB\n\
|
|||
|
||||
} // namespace
|
||||
|
||||
SpecialConfigRequest::SpecialConfigRequest(base::lambda<void(DcId dcId, const std::string &ip, int port)> callback)
|
||||
SpecialConfigRequest::SpecialConfigRequest(Fn<void(DcId dcId, const std::string &ip, int port)> callback)
|
||||
: _callback(std::move(callback)) {
|
||||
App::setProxySettings(_manager);
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#include "base/lambda.h"
|
||||
|
||||
#include "mtproto/mtp_instance.h"
|
||||
#include <QNetworkAccessManager>
|
||||
|
@ -30,7 +29,7 @@ namespace MTP {
|
|||
|
||||
class SpecialConfigRequest : public QObject {
|
||||
public:
|
||||
SpecialConfigRequest(base::lambda<void(DcId dcId, const std::string &ip, int port)> callback);
|
||||
SpecialConfigRequest(Fn<void(DcId dcId, const std::string &ip, int port)> callback);
|
||||
|
||||
~SpecialConfigRequest();
|
||||
|
||||
|
@ -42,7 +41,7 @@ private:
|
|||
void handleResponse(const QByteArray &bytes);
|
||||
bool decryptSimpleConfig(const QByteArray &bytes);
|
||||
|
||||
base::lambda<void(DcId dcId, const std::string &ip, int port)> _callback;
|
||||
Fn<void(DcId dcId, const std::string &ip, int port)> _callback;
|
||||
MTPhelp_ConfigSimple _simpleConfig;
|
||||
|
||||
QNetworkAccessManager _manager;
|
||||
|
|
|
@ -122,7 +122,7 @@ public:
|
|||
|
||||
private:
|
||||
PeerUpdate::Flags _events;
|
||||
base::lambda<void(const PeerUpdate &)> _handler;
|
||||
Fn<void(const PeerUpdate &)> _handler;
|
||||
};
|
||||
base::Observable<PeerUpdate, PeerUpdatedHandler> &PeerUpdated();
|
||||
|
||||
|
|
|
@ -177,7 +177,7 @@ public:
|
|||
private:
|
||||
void startAnimation();
|
||||
|
||||
base::lambda<void()> _updateCallback;
|
||||
Fn<void()> _updateCallback;
|
||||
Ui::RoundCheckbox _check;
|
||||
|
||||
Animation _pression;
|
||||
|
|
|
@ -219,7 +219,7 @@ public:
|
|||
, _weak(guarded) {}
|
||||
~ToastEventHandler() = default;
|
||||
|
||||
void performOnMainQueue(base::lambda_once<void(Manager *manager)> task) {
|
||||
void performOnMainQueue(FnMut<void(Manager *manager)> task) {
|
||||
base::TaskQueue::Main().Put([weak = _weak, task = std::move(task)]() mutable {
|
||||
if (auto strong = weak.lock()) {
|
||||
task(*strong);
|
||||
|
|
|
@ -87,16 +87,16 @@ public:
|
|||
qSort(_items.begin(), _items.end(), std::move(predicate));
|
||||
}
|
||||
|
||||
void setPreloadMoreCallback(base::lambda<void()> callback) {
|
||||
void setPreloadMoreCallback(Fn<void()> callback) {
|
||||
_preloadMoreCallback = std::move(callback);
|
||||
}
|
||||
void setSelectedCallback(base::lambda<void(PeerData *)> callback) {
|
||||
void setSelectedCallback(Fn<void(PeerData *)> callback) {
|
||||
_selectedCallback = std::move(callback);
|
||||
}
|
||||
void setRemovedCallback(base::lambda<void(PeerData *)> callback) {
|
||||
void setRemovedCallback(Fn<void(PeerData *)> callback) {
|
||||
_removedCallback = std::move(callback);
|
||||
}
|
||||
void setUpdateItemCallback(base::lambda<void(Item *)> callback) {
|
||||
void setUpdateItemCallback(Fn<void(Item *)> callback) {
|
||||
_updateItemCallback = std::move(callback);
|
||||
}
|
||||
|
||||
|
@ -139,10 +139,10 @@ private:
|
|||
|
||||
const style::ProfilePeerListItem &_st;
|
||||
|
||||
base::lambda<void()> _preloadMoreCallback;
|
||||
base::lambda<void(PeerData *)> _selectedCallback;
|
||||
base::lambda<void(PeerData *)> _removedCallback;
|
||||
base::lambda<void(Item *)> _updateItemCallback;
|
||||
Fn<void()> _preloadMoreCallback;
|
||||
Fn<void(PeerData *)> _selectedCallback;
|
||||
Fn<void(PeerData *)> _removedCallback;
|
||||
Fn<void(Item *)> _updateItemCallback;
|
||||
|
||||
QList<Item *> _items;
|
||||
|
||||
|
|
|
@ -147,9 +147,8 @@ public:
|
|||
using Role = ParticipantsBoxController::Role;
|
||||
using Additional = ParticipantsBoxController::Additional;
|
||||
|
||||
using AdminDoneCallback = base::lambda<void(not_null<UserData *> user, const MTPChannelAdminRights &adminRights)>;
|
||||
using BannedDoneCallback =
|
||||
base::lambda<void(not_null<UserData *> user, const MTPChannelBannedRights &bannedRights)>;
|
||||
using AdminDoneCallback = Fn<void(not_null<UserData *> user, const MTPChannelAdminRights &adminRights)>;
|
||||
using BannedDoneCallback = Fn<void(not_null<UserData *> user, const MTPChannelBannedRights &bannedRights)>;
|
||||
AddParticipantBoxController(not_null<ChannelData *> channel, Role role, AdminDoneCallback adminDoneCallback,
|
||||
BannedDoneCallback bannedDoneCallback);
|
||||
|
||||
|
|
|
@ -473,15 +473,13 @@ void CoverWidget::clearButtons() {
|
|||
}
|
||||
}
|
||||
|
||||
void CoverWidget::addButton(base::lambda<QString()> textFactory, const char *slot,
|
||||
const style::RoundButton *replacementStyle) {
|
||||
void CoverWidget::addButton(Fn<QString()> textFactory, const char *slot, const style::RoundButton *replacementStyle) {
|
||||
auto &buttonStyle = _buttons.isEmpty() ? st::profilePrimaryButton : st::profileSecondaryButton;
|
||||
auto button = new Ui::RoundButton(this, std::move(textFactory), buttonStyle);
|
||||
connect(button, SIGNAL(clicked()), this, slot);
|
||||
button->show();
|
||||
|
||||
auto replacement =
|
||||
replacementStyle ? new Ui::RoundButton(this, base::lambda<QString()>(), *replacementStyle) : nullptr;
|
||||
auto replacement = replacementStyle ? new Ui::RoundButton(this, Fn<QString()>(), *replacementStyle) : nullptr;
|
||||
if (replacement) {
|
||||
connect(replacement, SIGNAL(clicked()), this, slot);
|
||||
replacement->hide();
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue