mirror of https://github.com/procxx/kepka.git
Strict alignment request for base::lambda. Various improvements.
This commit is contained in:
parent
8a0c275658
commit
e880c4876e
Binary file not shown.
Before Width: | Height: | Size: 243 B After Width: | Height: | Size: 313 B |
Binary file not shown.
Before Width: | Height: | Size: 424 B After Width: | Height: | Size: 632 B |
|
@ -110,7 +110,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
"lng_status_online" = "online";
|
||||
"lng_status_connecting" = "connecting...";
|
||||
|
||||
"lng_chat_status_unaccessible" = "group is unaccessible";
|
||||
"lng_chat_status_unaccessible" = "group is inaccessible";
|
||||
"lng_chat_status_members" = "{count:no members|# member|# members}";
|
||||
"lng_chat_status_members_online" = "{count:_not_used_|# member|# members}, {count_online:_not_used_|# online|# online}";
|
||||
|
||||
|
@ -422,7 +422,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
|
||||
"lng_preview_loading" = "Getting Link Info...";
|
||||
|
||||
"lng_profile_chat_unaccessible" = "Group is unaccessible";
|
||||
"lng_profile_chat_unaccessible" = "Group is inaccessible";
|
||||
"lng_profile_about_section" = "About";
|
||||
"lng_profile_description_section" = "Description";
|
||||
"lng_profile_settings_section" = "Settings";
|
||||
|
|
|
@ -43,10 +43,10 @@ ApiWrap::ApiWrap(QObject *parent) : QObject(parent)
|
|||
void ApiWrap::init() {
|
||||
}
|
||||
|
||||
void ApiWrap::requestMessageData(ChannelData *channel, MsgId msgId, RequestMessageDataCallback &&callback) {
|
||||
void ApiWrap::requestMessageData(ChannelData *channel, MsgId msgId, const RequestMessageDataCallback &callback) {
|
||||
MessageDataRequest &req(channel ? _channelMessageDataRequests[channel][msgId] : _messageDataRequests[msgId]);
|
||||
if (callback) {
|
||||
req.callbacks.append(std_::move(callback));
|
||||
req.callbacks.append(callback);
|
||||
}
|
||||
if (!req.req) _messageDataResolveDelayed->call();
|
||||
}
|
||||
|
|
|
@ -30,8 +30,8 @@ public:
|
|||
ApiWrap(QObject *parent);
|
||||
void init();
|
||||
|
||||
using RequestMessageDataCallback = base::lambda_wrap<void(ChannelData*, MsgId)>;
|
||||
void requestMessageData(ChannelData *channel, MsgId msgId, RequestMessageDataCallback &&callback);
|
||||
using RequestMessageDataCallback = base::lambda_copy<void(ChannelData*, MsgId)>;
|
||||
void requestMessageData(ChannelData *channel, MsgId msgId, const RequestMessageDataCallback &callback);
|
||||
|
||||
void requestFullPeer(PeerData *peer);
|
||||
void requestPeer(PeerData *peer);
|
||||
|
|
|
@ -1150,7 +1150,7 @@ void EditChannelBox::onSaveSignDone(const MTPUpdates &updates) {
|
|||
onClose();
|
||||
}
|
||||
|
||||
RevokePublicLinkBox::RevokePublicLinkBox(base::lambda_unique<void()> &&revokeCallback) : AbstractBox()
|
||||
RevokePublicLinkBox::RevokePublicLinkBox(base::lambda<void()> &&revokeCallback) : AbstractBox()
|
||||
, _rowHeight(st::contactsPadding.top() + st::contactsPhotoSize + st::contactsPadding.bottom())
|
||||
, _revokeWidth(st::normalFont->width(lang(lng_channels_too_much_public_revoke)))
|
||||
, _aboutRevoke(this, lang(lng_channels_too_much_public_about), Ui::FlatLabel::InitType::Simple, st::aboutRevokePublicLabel)
|
||||
|
|
|
@ -286,7 +286,7 @@ class RevokePublicLinkBox : public AbstractBox, public RPCSender {
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
RevokePublicLinkBox(base::lambda_unique<void()> &&revokeCallback);
|
||||
RevokePublicLinkBox(base::lambda<void()> &&revokeCallback);
|
||||
|
||||
protected:
|
||||
void mouseMoveEvent(QMouseEvent *e) override;
|
||||
|
@ -323,7 +323,7 @@ private:
|
|||
ChildWidget<Ui::FlatLabel> _aboutRevoke;
|
||||
ChildWidget<Ui::RoundButton> _cancel;
|
||||
|
||||
base::lambda_unique<void()> _revokeCallback;
|
||||
base::lambda<void()> _revokeCallback;
|
||||
mtpRequestId _revokeRequestId = 0;
|
||||
QPointer<ConfirmBox> weakRevokeConfirmBox;
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#pragma once
|
||||
|
||||
#include "boxes/abstractbox.h"
|
||||
#include "core/lambda_wrap.h"
|
||||
|
||||
class BackgroundBox : public ItemListBox {
|
||||
Q_OBJECT
|
||||
|
|
|
@ -43,7 +43,7 @@ public:
|
|||
void updateLink();
|
||||
|
||||
// You can use this instead of connecting to "confirmed()" signal.
|
||||
void setConfirmedCallback(base::lambda_unique<void()> &&callback) {
|
||||
void setConfirmedCallback(base::lambda<void()> &&callback) {
|
||||
_confirmedCallback = std_::move(callback);
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ private:
|
|||
ChildWidget<Ui::RoundButton> _confirm;
|
||||
ChildWidget<Ui::RoundButton> _cancel;
|
||||
|
||||
base::lambda_unique<void()> _confirmedCallback;
|
||||
base::lambda<void()> _confirmedCallback;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -545,8 +545,8 @@ bool ContactsBox::creationFail(const RPCError &error) {
|
|||
return false;
|
||||
}
|
||||
|
||||
ContactsBox::Inner::ContactData::ContactData(PeerData *peer, base::lambda_wrap<void()> updateCallback)
|
||||
: checkbox(std_::make_unique<Ui::RoundImageCheckbox>(st::contactsPhotoCheckbox, std_::move(updateCallback), PaintUserpicCallback(peer))) {
|
||||
ContactsBox::Inner::ContactData::ContactData(PeerData *peer, const base::lambda_copy<void()> &updateCallback)
|
||||
: checkbox(std_::make_unique<Ui::RoundImageCheckbox>(st::contactsPhotoCheckbox, updateCallback, PaintUserpicCallback(peer))) {
|
||||
}
|
||||
|
||||
ContactsBox::Inner::Inner(QWidget *parent, CreatingGroupType creating) : TWidget(parent)
|
||||
|
@ -1371,7 +1371,7 @@ void ContactsBox::Inner::peerUnselected(PeerData *peer) {
|
|||
changePeerCheckState(data, peer, false, ChangeStateWay::SkipCallback);
|
||||
}
|
||||
|
||||
void ContactsBox::Inner::setPeerSelectedChangedCallback(base::lambda_unique<void(PeerData *peer, bool selected)> callback) {
|
||||
void ContactsBox::Inner::setPeerSelectedChangedCallback(base::lambda<void(PeerData *peer, bool selected)> &&callback) {
|
||||
_peerSelectedChangedCallback = std_::move(callback);
|
||||
}
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ public:
|
|||
Inner(QWidget *parent, ChatData *chat, MembersFilter membersFilter);
|
||||
Inner(QWidget *parent, UserData *bot);
|
||||
|
||||
void setPeerSelectedChangedCallback(base::lambda_unique<void(PeerData *peer, bool selected)> callback);
|
||||
void setPeerSelectedChangedCallback(base::lambda<void(PeerData *peer, bool selected)> &&callback);
|
||||
void peerUnselected(PeerData *peer);
|
||||
|
||||
void updateFilter(QString filter = QString());
|
||||
|
@ -157,7 +157,7 @@ public:
|
|||
QVector<UserData*> selected();
|
||||
QVector<MTPInputUser> selectedInputs();
|
||||
bool allAdmins() const;
|
||||
void setAllAdminsChangedCallback(base::lambda_unique<void()> allAdminsChangedCallback) {
|
||||
void setAllAdminsChangedCallback(base::lambda<void()> &&allAdminsChangedCallback) {
|
||||
_allAdminsChangedCallback = std_::move(allAdminsChangedCallback);
|
||||
}
|
||||
|
||||
|
@ -213,7 +213,7 @@ protected:
|
|||
private:
|
||||
struct ContactData {
|
||||
ContactData() = default;
|
||||
ContactData(PeerData *peer, base::lambda_wrap<void()> updateCallback);
|
||||
ContactData(PeerData *peer, const base::lambda_copy<void()> &updateCallback);
|
||||
|
||||
std_::unique_ptr<Ui::RoundImageCheckbox> checkbox;
|
||||
Text name;
|
||||
|
@ -251,7 +251,7 @@ private:
|
|||
return (_chat != nullptr) || (_creating != CreatingGroupNone && (!_channel || _membersFilter != MembersFilter::Admins));
|
||||
}
|
||||
|
||||
base::lambda_unique<void(PeerData *peer, bool selected)> _peerSelectedChangedCallback;
|
||||
base::lambda<void(PeerData *peer, bool selected)> _peerSelectedChangedCallback;
|
||||
|
||||
int _rowHeight;
|
||||
int _aboutHeight = 0;
|
||||
|
@ -266,7 +266,7 @@ private:
|
|||
ChildWidget<Ui::Checkbox> _allAdmins;
|
||||
int32 _aboutWidth;
|
||||
Text _aboutAllAdmins, _aboutAdmins;
|
||||
base::lambda_unique<void()> _allAdminsChangedCallback;
|
||||
base::lambda<void()> _allAdminsChangedCallback;
|
||||
|
||||
PeerData *_addToPeer = nullptr;
|
||||
UserData *_addAdmin = nullptr;
|
||||
|
|
|
@ -513,9 +513,9 @@ void ShareBox::Inner::paintChat(Painter &p, uint64 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_wrap<void()> updateCallback)
|
||||
ShareBox::Inner::Chat::Chat(PeerData *peer, const base::lambda_copy<void()> &updateCallback)
|
||||
: peer(peer)
|
||||
, checkbox(st::sharePhotoCheckbox, std_::move(updateCallback), PaintUserpicCallback(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_unique<void(PeerData *peer, bool selected)> callback) {
|
||||
void ShareBox::Inner::setPeerSelectedChangedCallback(base::lambda<void(PeerData *peer, bool selected)> &&callback) {
|
||||
_peerSelectedChangedCallback = std_::move(callback);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#pragma once
|
||||
|
||||
#include "boxes/abstractbox.h"
|
||||
#include "core/lambda_wrap.h"
|
||||
#include "core/observer.h"
|
||||
#include "core/vector_of_moveable.h"
|
||||
#include "ui/effects/round_image_checkbox.h"
|
||||
|
@ -47,9 +46,9 @@ class ShareBox : public ItemListBox, public RPCSender {
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
using CopyCallback = base::lambda_unique<void()>;
|
||||
using SubmitCallback = base::lambda_unique<void(const QVector<PeerData*> &)>;
|
||||
using FilterCallback = base::lambda_unique<bool(PeerData*)>;
|
||||
using CopyCallback = base::lambda<void()>;
|
||||
using SubmitCallback = base::lambda<void(const QVector<PeerData*> &)>;
|
||||
using FilterCallback = base::lambda<bool(PeerData*)>;
|
||||
ShareBox(CopyCallback &©Callback, SubmitCallback &&submitCallback, FilterCallback &&filterCallback);
|
||||
|
||||
private slots:
|
||||
|
@ -119,7 +118,7 @@ class ShareBox::Inner : public TWidget, public RPCSender, private base::Subscrib
|
|||
public:
|
||||
Inner(QWidget *parent, ShareBox::FilterCallback &&filterCallback);
|
||||
|
||||
void setPeerSelectedChangedCallback(base::lambda_unique<void(PeerData *peer, bool selected)> callback);
|
||||
void setPeerSelectedChangedCallback(base::lambda<void(PeerData *peer, bool selected)> &&callback);
|
||||
void peerUnselected(PeerData *peer);
|
||||
|
||||
QVector<PeerData*> selected() const;
|
||||
|
@ -157,7 +156,7 @@ private:
|
|||
int displayedChatsCount() const;
|
||||
|
||||
struct Chat {
|
||||
Chat(PeerData *peer, base::lambda_wrap<void()> updateCallback);
|
||||
Chat(PeerData *peer, const base::lambda_copy<void()> &updateCallback);
|
||||
|
||||
PeerData *peer;
|
||||
Ui::RoundImageCheckbox checkbox;
|
||||
|
@ -207,7 +206,7 @@ private:
|
|||
using SelectedChats = OrderedSet<PeerData*>;
|
||||
SelectedChats _selected;
|
||||
|
||||
base::lambda_unique<void(PeerData *peer, bool selected)> _peerSelectedChangedCallback;
|
||||
base::lambda<void(PeerData *peer, bool selected)> _peerSelectedChangedCallback;
|
||||
|
||||
ChatData *data(Dialogs::Row *row);
|
||||
|
||||
|
|
|
@ -181,7 +181,7 @@ protected:
|
|||
|
||||
class LambdaClickHandler : public ClickHandler {
|
||||
public:
|
||||
LambdaClickHandler(base::lambda_unique<void()> handler) : _handler(std_::move(handler)) {
|
||||
LambdaClickHandler(base::lambda<void()> &&handler) : _handler(std_::move(handler)) {
|
||||
}
|
||||
void onClick(Qt::MouseButton button) const override final {
|
||||
if (button == Qt::LeftButton && _handler) {
|
||||
|
@ -190,6 +190,6 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
base::lambda_unique<void()> _handler;
|
||||
base::lambda<void()> _handler;
|
||||
|
||||
};
|
||||
|
|
|
@ -40,8 +40,8 @@ QString tryConvertUrlToLocal(QString url) {
|
|||
|
||||
using namespace qthelp;
|
||||
auto matchOptions = RegExOption::CaseInsensitive;
|
||||
if (auto telegramMeMatch = regex_match(qsl("https?://telegram\\.me/(.+)$"), url, matchOptions)) {
|
||||
auto query = telegramMeMatch->capturedRef(1);
|
||||
if (auto telegramMeMatch = regex_match(qsl("https?://(www\\.)?telegram\\.me/(.+)$"), url, matchOptions)) {
|
||||
auto query = telegramMeMatch->capturedRef(2);
|
||||
if (auto joinChatMatch = regex_match(qsl("^joinchat/([a-zA-Z0-9\\.\\_\\-]+)(\\?|$)"), query, matchOptions)) {
|
||||
return qsl("tg://join?invite=") + url_encode(joinChatMatch->captured(1));
|
||||
} else if (auto stickerSetMatch = regex_match(qsl("^addstickers/([a-zA-Z0-9\\.\\_]+)(\\?|$)"), query, matchOptions)) {
|
||||
|
|
|
@ -147,9 +147,8 @@ struct lambda_wrap_helper_move_impl<Lambda, std_::false_type, Return, Args...> :
|
|||
static void construct_move_lambda_method(void *lambda, void *source) {
|
||||
static_assert(alignof(JustLambda) <= alignof(typename Parent::alignment), "Bad lambda alignment.");
|
||||
auto space = sizeof(JustLambda);
|
||||
// We want to be able to pass lambda by value in 32bit Windows version.
|
||||
//auto aligned = std_::align(alignof(JustLambda), space, lambda, space);
|
||||
//t_assert(aligned == lambda);
|
||||
auto aligned = std_::align(alignof(JustLambda), space, lambda, space);
|
||||
t_assert(aligned == lambda);
|
||||
auto source_lambda = static_cast<JustLambda*>(source);
|
||||
new (lambda) JustLambda(static_cast<JustLambda&&>(*source_lambda));
|
||||
}
|
||||
|
@ -223,9 +222,8 @@ struct lambda_wrap_helper_copy_impl<Lambda, std_::false_type, Return, Args...> :
|
|||
static void construct_copy_lambda_method(void *lambda, const void *source) {
|
||||
static_assert(alignof(JustLambda) <= alignof(typename Parent::alignment), "Bad lambda alignment.");
|
||||
auto space = sizeof(JustLambda);
|
||||
// We want to be able to pass lambda by value in 32bit Windows version.
|
||||
//auto aligned = std_::align(alignof(JustLambda), space, lambda, space);
|
||||
//t_assert(aligned == lambda);
|
||||
auto aligned = std_::align(alignof(JustLambda), space, lambda, space);
|
||||
t_assert(aligned == lambda);
|
||||
auto source_lambda = static_cast<const JustLambda*>(source);
|
||||
new (lambda) JustLambda(static_cast<const JustLambda &>(*source_lambda));
|
||||
}
|
||||
|
@ -246,34 +244,34 @@ const lambda_wrap_helper_copy<Lambda, Return, Args...> lambda_wrap_helper_copy<L
|
|||
|
||||
} // namespace internal
|
||||
|
||||
template <typename Function> class lambda_unique;
|
||||
template <typename Function> class lambda_wrap;
|
||||
template <typename Function> class lambda;
|
||||
template <typename Function> class lambda_copy;
|
||||
|
||||
template <typename Return, typename ...Args>
|
||||
class lambda_unique<Return(Args...)> {
|
||||
class lambda<Return(Args...)> {
|
||||
using BaseHelper = internal::lambda_wrap_helper_base<Return, Args...>;
|
||||
using EmptyHelper = internal::lambda_wrap_empty<Return, Args...>;
|
||||
|
||||
template <typename Lambda>
|
||||
using IsUnique = std_::is_same<lambda_unique, std_::decay_simple_t<Lambda>>;
|
||||
using IsUnique = std_::is_same<lambda, std_::decay_simple_t<Lambda>>;
|
||||
template <typename Lambda>
|
||||
using IsWrap = std_::is_same<lambda_wrap<Return(Args...)>, std_::decay_simple_t<Lambda>>;
|
||||
using IsWrap = std_::is_same<lambda_copy<Return(Args...)>, std_::decay_simple_t<Lambda>>;
|
||||
template <typename Lambda>
|
||||
using IsOther = std_::enable_if_t<!IsUnique<Lambda>::value && !IsWrap<Lambda>::value>;
|
||||
template <typename Lambda>
|
||||
using IsRvalue = std_::enable_if_t<std_::is_rvalue_reference<Lambda&&>::value>;
|
||||
|
||||
public:
|
||||
lambda_unique() : helper_(&EmptyHelper::instance) {
|
||||
lambda() : helper_(&EmptyHelper::instance) {
|
||||
}
|
||||
|
||||
lambda_unique(const lambda_unique &other) = delete;
|
||||
lambda_unique &operator=(const lambda_unique &other) = delete;
|
||||
lambda(const lambda &other) = delete;
|
||||
lambda &operator=(const lambda &other) = delete;
|
||||
|
||||
lambda_unique(lambda_unique &&other) : helper_(other.helper_) {
|
||||
lambda(lambda &&other) : helper_(other.helper_) {
|
||||
helper_->construct_move_other(storage_, other.storage_);
|
||||
}
|
||||
lambda_unique &operator=(lambda_unique &&other) {
|
||||
lambda &operator=(lambda &&other) {
|
||||
auto temp = std_::move(other);
|
||||
helper_->destruct(storage_);
|
||||
helper_ = temp.helper_;
|
||||
|
@ -281,21 +279,17 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
void swap(lambda_unique &other) {
|
||||
if (this != &other) {
|
||||
lambda_unique temp = std_::move(other);
|
||||
other = std_::move(*this);
|
||||
*this = std_::move(other);
|
||||
}
|
||||
void swap(lambda &other) {
|
||||
if (this != &other) std_::swap_moveable(*this, other);
|
||||
}
|
||||
|
||||
template <typename Lambda, typename = IsOther<Lambda>, typename = IsRvalue<Lambda>>
|
||||
lambda_unique(Lambda &&other) : helper_(&internal::lambda_wrap_helper_move<Lambda, Return, Args...>::instance) {
|
||||
lambda(Lambda &&other) : helper_(&internal::lambda_wrap_helper_move<Lambda, Return, Args...>::instance) {
|
||||
internal::lambda_wrap_helper_move<Lambda, Return, Args...>::construct_move_lambda_method(storage_, &other);
|
||||
}
|
||||
|
||||
template <typename Lambda, typename = IsOther<Lambda>, typename = IsRvalue<Lambda>>
|
||||
lambda_unique &operator=(Lambda &&other) {
|
||||
lambda &operator=(Lambda &&other) {
|
||||
auto temp = std_::move(other);
|
||||
helper_->destruct(storage_);
|
||||
helper_ = &internal::lambda_wrap_helper_move<Lambda, Return, Args...>::instance;
|
||||
|
@ -311,74 +305,70 @@ public:
|
|||
return (helper_ != &EmptyHelper::instance);
|
||||
}
|
||||
|
||||
~lambda_unique() {
|
||||
~lambda() {
|
||||
helper_->destruct(storage_);
|
||||
}
|
||||
|
||||
protected:
|
||||
struct Private {
|
||||
};
|
||||
lambda_unique(const BaseHelper *helper, const Private &) : helper_(helper) {
|
||||
lambda(const BaseHelper *helper, const Private &) : helper_(helper) {
|
||||
}
|
||||
|
||||
using alignment = typename BaseHelper::alignment;
|
||||
static_assert(BaseHelper::kStorageSize % sizeof(alignment) == 0, "Bad storage size.");
|
||||
alignment storage_[BaseHelper::kStorageSize / sizeof(alignment)];
|
||||
alignas(typename BaseHelper::alignment) alignment storage_[BaseHelper::kStorageSize / sizeof(alignment)];
|
||||
const BaseHelper *helper_;
|
||||
|
||||
};
|
||||
|
||||
template <typename Return, typename ...Args>
|
||||
class lambda_wrap<Return(Args...)> : public lambda_unique<Return(Args...)> {
|
||||
class lambda_copy<Return(Args...)> : public lambda<Return(Args...)> {
|
||||
using BaseHelper = internal::lambda_wrap_helper_base<Return, Args...>;
|
||||
using Parent = lambda_unique<Return(Args...)>;
|
||||
using Parent = lambda<Return(Args...)>;
|
||||
|
||||
template <typename Lambda>
|
||||
using IsOther = std_::enable_if_t<!std_::is_same<lambda_wrap, std_::decay_simple_t<Lambda>>::value>;
|
||||
using IsOther = std_::enable_if_t<!std_::is_same<lambda_copy, std_::decay_simple_t<Lambda>>::value>;
|
||||
template <typename Lambda>
|
||||
using IsRvalue = std_::enable_if_t<std_::is_rvalue_reference<Lambda&&>::value>;
|
||||
template <typename Lambda>
|
||||
using IsNotRvalue = std_::enable_if_t<!std_::is_rvalue_reference<Lambda&&>::value>;
|
||||
|
||||
public:
|
||||
lambda_wrap() = default;
|
||||
lambda_copy() = default;
|
||||
|
||||
lambda_wrap(const lambda_wrap &other) : Parent(other.helper_, typename Parent::Private()) {
|
||||
lambda_copy(const lambda_copy &other) : Parent(other.helper_, typename Parent::Private()) {
|
||||
this->helper_->construct_copy_other(this->storage_, other.storage_);
|
||||
}
|
||||
lambda_wrap &operator=(const lambda_wrap &other) {
|
||||
lambda_copy &operator=(const lambda_copy &other) {
|
||||
auto temp = other;
|
||||
temp.swap(*this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
lambda_wrap(lambda_wrap &&other) = default;
|
||||
lambda_wrap &operator=(lambda_wrap &&other) = default;
|
||||
lambda_copy(lambda_copy &&other) = default;
|
||||
lambda_copy &operator=(lambda_copy &&other) = default;
|
||||
|
||||
void swap(lambda_wrap &other) {
|
||||
if (this != &other) {
|
||||
lambda_wrap temp = std_::move(other);
|
||||
other = std_::move(*this);
|
||||
*this = std_::move(other);
|
||||
}
|
||||
void swap(lambda_copy &other) {
|
||||
if (this != &other) std_::swap_moveable(*this, other);
|
||||
}
|
||||
|
||||
lambda_wrap clone() const {
|
||||
lambda_copy clone() const {
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename Lambda, typename = IsOther<Lambda>>
|
||||
lambda_wrap(const Lambda &other) : Parent(&internal::lambda_wrap_helper_copy<Lambda, Return, Args...>::instance, typename Parent::Private()) {
|
||||
lambda_copy(const Lambda &other) : Parent(&internal::lambda_wrap_helper_copy<Lambda, Return, Args...>::instance, typename Parent::Private()) {
|
||||
internal::lambda_wrap_helper_copy<Lambda, Return, Args...>::construct_copy_lambda_method(this->storage_, &other);
|
||||
}
|
||||
|
||||
template <typename Lambda, typename = IsOther<Lambda>, typename = IsRvalue<Lambda>>
|
||||
lambda_wrap(Lambda &&other) : Parent(&internal::lambda_wrap_helper_copy<Lambda, Return, Args...>::instance, typename Parent::Private()) {
|
||||
lambda_copy(Lambda &&other) : Parent(&internal::lambda_wrap_helper_copy<Lambda, Return, Args...>::instance, typename Parent::Private()) {
|
||||
internal::lambda_wrap_helper_copy<Lambda, Return, Args...>::construct_move_lambda_method(this->storage_, &other);
|
||||
}
|
||||
|
||||
template <typename Lambda, typename = IsOther<Lambda>>
|
||||
lambda_wrap &operator=(const Lambda &other) {
|
||||
lambda_copy &operator=(const Lambda &other) {
|
||||
auto temp = other;
|
||||
this->helper_->destruct(this->storage_);
|
||||
this->helper_ = &internal::lambda_wrap_helper_copy<Lambda, Return, Args...>::instance;
|
||||
|
@ -387,7 +377,7 @@ public:
|
|||
}
|
||||
|
||||
template <typename Lambda, typename = IsOther<Lambda>, typename = IsRvalue<Lambda>>
|
||||
lambda_wrap &operator=(Lambda &&other) {
|
||||
lambda_copy &operator=(Lambda &&other) {
|
||||
auto temp = std_::move(other);
|
||||
this->helper_->destruct(this->storage_);
|
||||
this->helper_ = &internal::lambda_wrap_helper_copy<Lambda, Return, Args...>::instance;
|
||||
|
@ -401,7 +391,7 @@ class lambda_slot_wrap : public QObject {
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
lambda_slot_wrap(QObject *parent, lambda_unique<void()> lambda) : QObject(parent), _lambda(std_::move(lambda)) {
|
||||
lambda_slot_wrap(QObject *parent, lambda<void()> &&lambda) : QObject(parent), _lambda(std_::move(lambda)) {
|
||||
}
|
||||
|
||||
public slots:
|
||||
|
@ -410,11 +400,11 @@ public slots:
|
|||
}
|
||||
|
||||
private:
|
||||
lambda_unique<void()> _lambda;
|
||||
lambda<void()> _lambda;
|
||||
|
||||
};
|
||||
|
||||
inline lambda_slot_wrap *lambda_slot(QObject *parent, lambda_unique<void()> lambda) {
|
||||
inline lambda_slot_wrap *lambda_slot(QObject *parent, lambda<void()> &&lambda) {
|
||||
return new lambda_slot_wrap(parent, std_::move(lambda));
|
||||
}
|
||||
|
|
@ -26,7 +26,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
namespace base {
|
||||
namespace internal {
|
||||
|
||||
using ObservableCallHandlers = base::lambda_unique<void()>;
|
||||
using ObservableCallHandlers = base::lambda<void()>;
|
||||
void RegisterPendingObservable(ObservableCallHandlers *handlers);
|
||||
void UnregisterActiveObservable(ObservableCallHandlers *handlers);
|
||||
void UnregisterObservable(ObservableCallHandlers *handlers);
|
||||
|
@ -36,12 +36,12 @@ using EventParamType = typename base::type_traits<EventType>::parameter_type;
|
|||
|
||||
template <typename EventType>
|
||||
struct SubscriptionHandlerHelper {
|
||||
using type = base::lambda_unique<void(EventParamType<EventType>)>;
|
||||
using type = base::lambda<void(EventParamType<EventType>)>;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct SubscriptionHandlerHelper<void> {
|
||||
using type = base::lambda_unique<void()>;
|
||||
using type = base::lambda<void()>;
|
||||
};
|
||||
|
||||
template <typename EventType>
|
||||
|
|
|
@ -31,7 +31,7 @@ SingleTimer::SingleTimer() {
|
|||
}
|
||||
}
|
||||
|
||||
void SingleTimer::setTimeoutHandler(base::lambda_unique<void()> &&handler) {
|
||||
void SingleTimer::setTimeoutHandler(base::lambda<void()> &&handler) {
|
||||
if (_handler && !handler) {
|
||||
disconnect(this, SIGNAL(timeout()), this, SLOT(onTimeout()));
|
||||
} else if (handler && !_handler) {
|
||||
|
|
|
@ -21,7 +21,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#pragma once
|
||||
|
||||
#include "core/basic_types.h"
|
||||
#include "core/lambda_wrap.h"
|
||||
|
||||
class SingleTimer : public QTimer { // single shot timer with check
|
||||
Q_OBJECT
|
||||
|
@ -32,7 +31,7 @@ public:
|
|||
void setSingleShot(bool); // is not available
|
||||
void start(); // is not available
|
||||
|
||||
void setTimeoutHandler(base::lambda_unique<void()> &&handler);
|
||||
void setTimeoutHandler(base::lambda<void()> &&handler);
|
||||
|
||||
public slots:
|
||||
void start(int msec);
|
||||
|
@ -45,6 +44,6 @@ private slots:
|
|||
private:
|
||||
uint64 _finishing = 0;
|
||||
bool _inited = false;
|
||||
base::lambda_unique<void()> _handler;
|
||||
base::lambda<void()> _handler;
|
||||
|
||||
};
|
||||
|
|
|
@ -644,7 +644,7 @@ void DialogsInner::contextMenuEvent(QContextMenuEvent *e) {
|
|||
_menuPeer = history->peer;
|
||||
|
||||
_menu = new Ui::PopupMenu();
|
||||
App::main()->fillPeerMenu(_menuPeer, [this](const QString &text, base::lambda_unique<void()> callback) {
|
||||
App::main()->fillPeerMenu(_menuPeer, [this](const QString &text, base::lambda<void()> &&callback) {
|
||||
return _menu->addAction(text, std_::move(callback));
|
||||
});
|
||||
connect(_menu, SIGNAL(destroyed(QObject*)), this, SLOT(onMenuDestroyed(QObject*)));
|
||||
|
|
|
@ -44,6 +44,12 @@ void sendBotCommand(PeerData *peer, UserData *bot, const QString &cmd, MsgId rep
|
|||
}
|
||||
}
|
||||
|
||||
void hideSingleUseKeyboard(const HistoryItem *msg) {
|
||||
if (auto m = main()) {
|
||||
m->hideSingleUseKeyboard(msg->history()->peer, msg->id);
|
||||
}
|
||||
}
|
||||
|
||||
bool insertBotCommand(const QString &cmd, bool specialGif) {
|
||||
if (auto m = main()) {
|
||||
return m->insertBotCommand(cmd, specialGif);
|
||||
|
@ -85,11 +91,13 @@ void activateBotCommand(const HistoryItem *msg, int row, int col) {
|
|||
} break;
|
||||
|
||||
case ButtonType::RequestLocation: {
|
||||
hideSingleUseKeyboard(msg);
|
||||
Ui::showLayer(new InformBox(lang(lng_bot_share_location_unavailable)));
|
||||
} break;
|
||||
|
||||
case ButtonType::RequestPhone: {
|
||||
SharePhoneConfirmBox *box = new SharePhoneConfirmBox(msg->history()->peer);
|
||||
hideSingleUseKeyboard(msg);
|
||||
auto box = new SharePhoneConfirmBox(msg->history()->peer);
|
||||
box->connect(box, SIGNAL(confirmed(PeerData*)), App::main(), SLOT(onSharePhoneWithBot(PeerData*)));
|
||||
Ui::showLayer(box);
|
||||
} break;
|
||||
|
|
|
@ -538,7 +538,7 @@ void HistoryInner::paintEvent(QPaintEvent *e) {
|
|||
|
||||
if (mtop >= 0 || htop >= 0) {
|
||||
enumerateUserpics([&p, &r](HistoryMessage *message, int userpicTop) {
|
||||
// stop the enumeration if the userpic is above the painted rect
|
||||
// stop the enumeration if the userpic is below the painted rect
|
||||
if (userpicTop >= r.top() + r.height()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -2024,8 +2024,8 @@ void HistoryInner::onUpdateSelected() {
|
|||
if (auto msg = item->toHistoryMessage()) {
|
||||
if (msg->hasFromPhoto()) {
|
||||
enumerateUserpics([&dragState, &lnkhost, &point](HistoryMessage *message, int userpicTop) -> bool {
|
||||
// stop enumeration if the userpic is above our point
|
||||
if (userpicTop + st::msgPhotoSize <= point.y()) {
|
||||
// stop enumeration if the userpic is below our point
|
||||
if (userpicTop > point.y()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -5823,6 +5823,22 @@ void HistoryWidget::sendBotCommand(PeerData *peer, UserData *bot, const QString
|
|||
_field->setFocus();
|
||||
}
|
||||
|
||||
void HistoryWidget::hideSingleUseKeyboard(PeerData *peer, MsgId replyTo) {
|
||||
if (!_peer || _peer != peer) return;
|
||||
|
||||
bool lastKeyboardUsed = (_keyboard->forMsgId() == FullMsgId(_channel, _history->lastKeyboardId)) && (_keyboard->forMsgId() == FullMsgId(_channel, replyTo));
|
||||
if (replyTo) {
|
||||
if (_replyToId == replyTo) {
|
||||
cancelReply();
|
||||
onCloudDraftSave();
|
||||
}
|
||||
if (_keyboard->singleUse() && _keyboard->hasMarkup() && lastKeyboardUsed) {
|
||||
if (_kbShown) onKbToggle(false);
|
||||
_history->lastKeyboardUsed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void HistoryWidget::app_sendBotCallback(const HistoryMessageReplyMarkup::Button *button, const HistoryItem *msg, int row, int col) {
|
||||
if (msg->id < 0 || _peer != msg->history()->peer) {
|
||||
return;
|
||||
|
|
|
@ -657,6 +657,7 @@ public:
|
|||
void onListEnterPressed();
|
||||
|
||||
void sendBotCommand(PeerData *peer, UserData *bot, const QString &cmd, MsgId replyTo);
|
||||
void hideSingleUseKeyboard(PeerData *peer, MsgId replyTo);
|
||||
bool insertBotCommand(const QString &cmd, bool specialGif);
|
||||
|
||||
bool eventFilter(QObject *obj, QEvent *e) override;
|
||||
|
|
|
@ -134,18 +134,17 @@ introErrorLabel: FlatLabel(defaultFlatLabel) {
|
|||
font: introErrorFont;
|
||||
align: align(center);
|
||||
}
|
||||
introBackButton: IconButton {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
introBackButton: IconButton(defaultIconButton) {
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
|
||||
icon: icon {
|
||||
{ size(40px, 40px), #f2f2f2 },
|
||||
{ "title_back", #adadad, point(12px, 12px) },
|
||||
};
|
||||
iconOver: icon {
|
||||
{ size(40px, 40px), #eeeeee },
|
||||
{ "title_back", #969696, point(12px, 12px) },
|
||||
};
|
||||
iconPosition: point(0px, 0px);
|
||||
icon: icon {{ "box_button_back", menuIconFg }};
|
||||
iconOver: icon {{ "box_button_back", menuIconFgOver }};
|
||||
|
||||
rippleAreaPosition: point(8px, 8px);
|
||||
rippleAreaSize: 40px;
|
||||
ripple: RippleAnimation(defaultRippleAnimation) {
|
||||
color: windowBgOver;
|
||||
}
|
||||
}
|
||||
introBackPosition: point(32px, 32px);
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
IntroWidget::IntroWidget(QWidget *parent) : TWidget(parent)
|
||||
, _a_stage(animation(this, &IntroWidget::step_stage))
|
||||
, _a_show(animation(this, &IntroWidget::step_show))
|
||||
, _back(this, new Ui::IconButton(this, st::introBackButton), base::lambda_unique<void()>(), st::introSlideDuration)
|
||||
, _back(this, new Ui::IconButton(this, st::introBackButton), base::lambda<void()>(), st::introSlideDuration)
|
||||
, _settings(this, lang(lng_menu_settings), st::defaultBoxButton) {
|
||||
_back->entity()->setClickedCallback([this] { onBack(); });
|
||||
_back->hideFast();
|
||||
|
@ -62,7 +62,7 @@ IntroWidget::IntroWidget(QWidget *parent) : TWidget(parent)
|
|||
|
||||
cSetPasswordRecovered(false);
|
||||
|
||||
_back->moveToLeft(st::introBackPosition.x(), st::introBackPosition.y());
|
||||
_back->moveToLeft(0, 0);
|
||||
|
||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||
Sandbox::connect(SIGNAL(updateLatest()), this, SLOT(onCheckUpdateStatus()));
|
||||
|
@ -378,9 +378,9 @@ void IntroWidget::resizeEvent(QResizeEvent *e) {
|
|||
}
|
||||
|
||||
void IntroWidget::updateControlsGeometry() {
|
||||
_settings->moveToLeft(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _settings->height());
|
||||
_settings->moveToRight(st::boxButtonPadding.right(), st::boxButtonPadding.top());
|
||||
if (_update) {
|
||||
_update->moveToLeft(st::boxButtonPadding.right() + _settings->width() + st::boxButtonPadding.left(), _settings->y());
|
||||
_update->moveToRight(st::boxButtonPadding.right() + _settings->width() + st::boxButtonPadding.left(), _settings->y());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,8 +20,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#include "mtproto/rpc_sender.h"
|
||||
|
||||
namespace Ui {
|
||||
class IconButton;
|
||||
class RoundButton;
|
||||
|
|
|
@ -43,7 +43,7 @@ public:
|
|||
, _shadow(st::boxShadow) {
|
||||
}
|
||||
|
||||
void setDoneCallback(base::lambda_unique<void()> callback) {
|
||||
void setDoneCallback(base::lambda<void()> &&callback) {
|
||||
_doneCallback = std_::move(callback);
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ private:
|
|||
QPixmap _specialLayerCache;
|
||||
QPixmap _layerCache;
|
||||
|
||||
base::lambda_unique<void()> _doneCallback;
|
||||
base::lambda<void()> _doneCallback;
|
||||
|
||||
bool _wasAnimating = false;
|
||||
bool _inPaintEvent = false;
|
||||
|
|
|
@ -1303,6 +1303,10 @@ void MainWidget::sendBotCommand(PeerData *peer, UserData *bot, const QString &cm
|
|||
_history->sendBotCommand(peer, bot, cmd, replyTo);
|
||||
}
|
||||
|
||||
void MainWidget::hideSingleUseKeyboard(PeerData *peer, MsgId replyTo) {
|
||||
_history->hideSingleUseKeyboard(peer, replyTo);
|
||||
}
|
||||
|
||||
void MainWidget::app_sendBotCallback(const HistoryMessageReplyMarkup::Button *button, const HistoryItem *msg, int row, int col) {
|
||||
_history->app_sendBotCallback(button, msg, row, col);
|
||||
}
|
||||
|
@ -1997,7 +2001,7 @@ void MainWidget::scheduleViewIncrement(HistoryItem *item) {
|
|||
j.value().insert(item->id, true);
|
||||
}
|
||||
|
||||
void MainWidget::fillPeerMenu(PeerData *peer, base::lambda_unique<QAction*(const QString &text, base::lambda_unique<void()> handler)> callback) {
|
||||
void MainWidget::fillPeerMenu(PeerData *peer, base::lambda<QAction*(const QString &text, base::lambda<void()> &&handler)> &&callback) {
|
||||
callback(lang((peer->isChat() || peer->isMegagroup()) ? lng_context_view_group : (peer->isUser() ? lng_context_view_profile : lng_context_view_channel)), [peer] {
|
||||
Ui::showPeerProfile(peer);
|
||||
});
|
||||
|
@ -2051,8 +2055,8 @@ void MainWidget::fillPeerMenu(PeerData *peer, base::lambda_unique<QAction*(const
|
|||
Ui::showLayer(box);
|
||||
};
|
||||
if (auto user = peer->asUser()) {
|
||||
callback(lang(lng_profile_clear_history), std_::move(clearHistoryHandler));
|
||||
callback(lang(lng_profile_delete_conversation), std_::move(deleteAndLeaveHandler));
|
||||
callback(lang(lng_profile_clear_history), std_::move(clearHistoryHandler));
|
||||
if (user->access != UserNoAccess && user != App::self()) {
|
||||
auto blockSubscription = MakeShared<base::Subscription>();
|
||||
auto blockAction = callback(lang(user->isBlocked() ? (user->botInfo ? lng_profile_unblock_bot : lng_profile_unblock_user) : (user->botInfo ? lng_profile_block_bot : lng_profile_block_user)), [user, blockSubscription] {
|
||||
|
|
|
@ -300,6 +300,7 @@ public:
|
|||
void stopAnimActive();
|
||||
|
||||
void sendBotCommand(PeerData *peer, UserData *bot, const QString &cmd, MsgId replyTo);
|
||||
void hideSingleUseKeyboard(PeerData *peer, MsgId replyTo);
|
||||
bool insertBotCommand(const QString &cmd, bool specialGif);
|
||||
|
||||
void searchMessages(const QString &query, PeerData *inPeer);
|
||||
|
@ -364,7 +365,7 @@ public:
|
|||
|
||||
void scheduleViewIncrement(HistoryItem *item);
|
||||
|
||||
void fillPeerMenu(PeerData *peer, base::lambda_unique<QAction*(const QString &text, base::lambda_unique<void()> handler)> callback);
|
||||
void fillPeerMenu(PeerData *peer, base::lambda<QAction*(const QString &text, base::lambda<void()> &&handler)> &&callback);
|
||||
|
||||
void gotRangeDifference(ChannelData *channel, const MTPupdates_ChannelDifference &diff);
|
||||
void onSelfParticipantUpdated(ChannelData *channel);
|
||||
|
|
|
@ -52,7 +52,7 @@ enum ReaderSteps {
|
|||
class ReaderPrivate;
|
||||
class Reader {
|
||||
public:
|
||||
using Callback = base::lambda_unique<void(Notification)>;
|
||||
using Callback = base::lambda<void(Notification)>;
|
||||
enum class Mode {
|
||||
Gif,
|
||||
Video,
|
||||
|
|
|
@ -43,7 +43,7 @@ class CoverWidget : public TWidget, private base::Subscriber {
|
|||
public:
|
||||
CoverWidget(QWidget *parent);
|
||||
|
||||
using ButtonCallback = base::lambda_unique<void()>;
|
||||
using ButtonCallback = base::lambda<void()>;
|
||||
void setPinCallback(ButtonCallback &&callback);
|
||||
void setCloseCallback(ButtonCallback &&callback);
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
void showFromOther();
|
||||
void hideFromOther();
|
||||
|
||||
using ButtonCallback = base::lambda_wrap<void()>;
|
||||
using ButtonCallback = base::lambda_copy<void()>;
|
||||
void setPinCallback(ButtonCallback &&callback);
|
||||
void setCloseCallback(ButtonCallback &&callback);
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ class Widget : public TWidget, private base::Subscriber {
|
|||
public:
|
||||
Widget(QWidget *parent);
|
||||
|
||||
using CloseCallback = base::lambda_unique<void()>;
|
||||
using CloseCallback = base::lambda<void()>;
|
||||
void setCloseCallback(CloseCallback &&callback);
|
||||
|
||||
void setShadowGeometryToLeft(int x, int y, int w, int h);
|
||||
|
|
|
@ -20,8 +20,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#include "core/lambda_wrap.h"
|
||||
|
||||
class RPCError {
|
||||
public:
|
||||
RPCError(const MTPrpcError &error) : _code(error.c_rpc_error().verror_code.v) {
|
||||
|
@ -834,7 +832,7 @@ struct LambdaUniqueHelper;
|
|||
|
||||
template <typename Lambda, typename R, typename ...Args>
|
||||
struct LambdaUniqueHelper<R(Lambda::*)(Args...) const> {
|
||||
using UniqueType = base::lambda_unique<R(Args...)>;
|
||||
using UniqueType = base::lambda<R(Args...)>;
|
||||
};
|
||||
|
||||
template <typename FunctionType>
|
||||
|
@ -843,7 +841,7 @@ using LambdaGetUnique = typename LambdaUniqueHelper<FunctionType>::UniqueType;
|
|||
template <typename Base, typename FunctionType>
|
||||
class RPCHandlerImplementation : public Base {
|
||||
protected:
|
||||
using Lambda = base::lambda_unique<FunctionType>;
|
||||
using Lambda = base::lambda<FunctionType>;
|
||||
using Parent = RPCHandlerImplementation<Base, FunctionType>;
|
||||
|
||||
public:
|
||||
|
@ -919,32 +917,32 @@ public:
|
|||
};
|
||||
|
||||
template <typename R>
|
||||
inline RPCDoneHandlerPtr rpcDone_lambda_wrap_helper(base::lambda_unique<R(const mtpPrime*, const mtpPrime*)> &&lambda) {
|
||||
inline RPCDoneHandlerPtr rpcDone_lambda_wrap_helper(base::lambda<R(const mtpPrime*, const mtpPrime*)> &&lambda) {
|
||||
return RPCDoneHandlerPtr(new RPCDoneHandlerImplementationBare<R>(std_::move(lambda)));
|
||||
}
|
||||
|
||||
template <typename R>
|
||||
inline RPCDoneHandlerPtr rpcDone_lambda_wrap_helper(base::lambda_unique<R(const mtpPrime*, const mtpPrime*, mtpRequestId)> &&lambda) {
|
||||
inline RPCDoneHandlerPtr rpcDone_lambda_wrap_helper(base::lambda<R(const mtpPrime*, const mtpPrime*, mtpRequestId)> &&lambda) {
|
||||
return RPCDoneHandlerPtr(new RPCDoneHandlerImplementationBareReq<R>(std_::move(lambda)));
|
||||
}
|
||||
|
||||
template <typename R, typename T>
|
||||
inline RPCDoneHandlerPtr rpcDone_lambda_wrap_helper(base::lambda_unique<R(const T&)> &&lambda) {
|
||||
inline RPCDoneHandlerPtr rpcDone_lambda_wrap_helper(base::lambda<R(const T&)> &&lambda) {
|
||||
return RPCDoneHandlerPtr(new RPCDoneHandlerImplementationPlain<R, T>(std_::move(lambda)));
|
||||
}
|
||||
|
||||
template <typename R, typename T>
|
||||
inline RPCDoneHandlerPtr rpcDone_lambda_wrap_helper(base::lambda_unique<R(const T&, mtpRequestId)> &&lambda) {
|
||||
inline RPCDoneHandlerPtr rpcDone_lambda_wrap_helper(base::lambda<R(const T&, mtpRequestId)> &&lambda) {
|
||||
return RPCDoneHandlerPtr(new RPCDoneHandlerImplementationReq<R, T>(std_::move(lambda)));
|
||||
}
|
||||
|
||||
template <typename R>
|
||||
inline RPCDoneHandlerPtr rpcDone_lambda_wrap_helper(base::lambda_unique<R()> &&lambda) {
|
||||
inline RPCDoneHandlerPtr rpcDone_lambda_wrap_helper(base::lambda<R()> &&lambda) {
|
||||
return RPCDoneHandlerPtr(new RPCDoneHandlerImplementationNo<R>(std_::move(lambda)));
|
||||
}
|
||||
|
||||
template <typename R>
|
||||
inline RPCDoneHandlerPtr rpcDone_lambda_wrap_helper(base::lambda_unique<R(mtpRequestId)> &&lambda) {
|
||||
inline RPCDoneHandlerPtr rpcDone_lambda_wrap_helper(base::lambda<R(mtpRequestId)> &&lambda) {
|
||||
return RPCDoneHandlerPtr(new RPCDoneHandlerImplementationNoReq<R>(std_::move(lambda)));
|
||||
}
|
||||
|
||||
|
@ -992,19 +990,19 @@ public:
|
|||
|
||||
};
|
||||
|
||||
inline RPCFailHandlerPtr rpcFail_lambda_wrap_helper(base::lambda_unique<bool(const RPCError&)> &&lambda) {
|
||||
inline RPCFailHandlerPtr rpcFail_lambda_wrap_helper(base::lambda<bool(const RPCError&)> &&lambda) {
|
||||
return RPCFailHandlerPtr(new RPCFailHandlerImplementationPlain(std_::move(lambda)));
|
||||
}
|
||||
|
||||
inline RPCFailHandlerPtr rpcFail_lambda_wrap_helper(base::lambda_unique<bool(const RPCError&, mtpRequestId)> &&lambda) {
|
||||
inline RPCFailHandlerPtr rpcFail_lambda_wrap_helper(base::lambda<bool(const RPCError&, mtpRequestId)> &&lambda) {
|
||||
return RPCFailHandlerPtr(new RPCFailHandlerImplementationReq(std_::move(lambda)));
|
||||
}
|
||||
|
||||
inline RPCFailHandlerPtr rpcFail_lambda_wrap_helper(base::lambda_unique<bool()> &&lambda) {
|
||||
inline RPCFailHandlerPtr rpcFail_lambda_wrap_helper(base::lambda<bool()> &&lambda) {
|
||||
return RPCFailHandlerPtr(new RPCFailHandlerImplementationNo(std_::move(lambda)));
|
||||
}
|
||||
|
||||
inline RPCFailHandlerPtr rpcFail_lambda_wrap_helper(base::lambda_unique<bool(mtpRequestId)> &&lambda) {
|
||||
inline RPCFailHandlerPtr rpcFail_lambda_wrap_helper(base::lambda<bool(mtpRequestId)> &&lambda) {
|
||||
return RPCFailHandlerPtr(new RPCFailHandlerImplementationNoReq(std_::move(lambda)));
|
||||
}
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ public:
|
|||
|
||||
private:
|
||||
PeerUpdate::Flags _events;
|
||||
base::lambda_unique<void(const PeerUpdate&)> _handler;
|
||||
base::lambda<void(const PeerUpdate&)> _handler;
|
||||
|
||||
};
|
||||
base::Observable<PeerUpdate, PeerUpdatedHandler> &PeerUpdated();
|
||||
|
|
|
@ -43,19 +43,19 @@ OverviewFileLayout {
|
|||
fileDateTop: pixels;
|
||||
}
|
||||
|
||||
overviewCheckBg: #00000066;
|
||||
overviewCheckBg: #00000042;
|
||||
overviewCheckedBg: #2fa9e2;
|
||||
|
||||
overviewPhotoSkip: 10px;
|
||||
overviewPhotoBg: #F1F1F1;
|
||||
overviewPhotoMinSize: minPhotoSize;
|
||||
overviewPhotoCheck: icon {
|
||||
{ size(32px, 32px), overviewCheckBg },
|
||||
{ "overview_photo_check", #ffffff, point(8px, 10px) },
|
||||
{ size(31px, 31px), overviewCheckBg },
|
||||
{ "overview_photo_check", #ffffff, point(4px, 8px) },
|
||||
};
|
||||
overviewPhotoChecked: icon {
|
||||
{ size(32px, 32px), overviewCheckedBg },
|
||||
{ "overview_photo_check", #ffffff, point(8px, 10px) },
|
||||
{ size(31px, 31px), overviewCheckedBg },
|
||||
{ "overview_photo_check", #ffffff, point(4px, 8px) },
|
||||
};
|
||||
overviewPhotoSelectOverlay: #0a7bb03f;
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
|
||||
void showAnimated();
|
||||
|
||||
using HideFinishCallback = base::lambda_unique<void(CoverDropArea*)>;
|
||||
using HideFinishCallback = base::lambda<void(CoverDropArea*)>;
|
||||
void hideAnimated(HideFinishCallback &&callback);
|
||||
|
||||
bool hiding() const {
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace Settings {
|
|||
namespace {
|
||||
|
||||
QString SecretText;
|
||||
QMap<QString, base::lambda_wrap<void()>> Codes;
|
||||
QMap<QString, base::lambda_copy<void()>> Codes;
|
||||
|
||||
void fillCodes() {
|
||||
Codes.insert(qsl("debugmode"), []() {
|
||||
|
|
|
@ -59,6 +59,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "core/basic_types.h"
|
||||
#include "logs.h"
|
||||
#include "core/utils.h"
|
||||
#include "core/lambda.h"
|
||||
#include "config.h"
|
||||
|
||||
#include "mtproto/facade.h"
|
||||
|
|
|
@ -2845,9 +2845,17 @@ void EmojiPan::paintEvent(QPaintEvent *e) {
|
|||
Painter p(this);
|
||||
|
||||
auto ms = getms();
|
||||
auto showAnimating = _a_show.animating(ms);
|
||||
auto opacityAnimating = _a_opacity.animating(ms);
|
||||
auto switching = (_slideAnimation != nullptr);
|
||||
if (_a_show.animating(ms)) {
|
||||
if (_showAnimation && !showAnimating) {
|
||||
_showAnimation.reset();
|
||||
if (!switching && !opacityAnimating) {
|
||||
showAll();
|
||||
}
|
||||
}
|
||||
|
||||
if (showAnimating) {
|
||||
if (auto opacity = _a_opacity.current(_hiding ? 0. : 1.)) {
|
||||
_showAnimation->paintFrame(p, 0, 0, width(), _a_show.current(1.), opacity);
|
||||
}
|
||||
|
@ -2856,10 +2864,6 @@ void EmojiPan::paintEvent(QPaintEvent *e) {
|
|||
p.drawPixmap(0, 0, _cache);
|
||||
} else if ((!switching && _hiding) || isHidden()) {
|
||||
hideFinished();
|
||||
} else if (_showAnimation) {
|
||||
_showAnimation->paintFrame(p, 0, 0, width(), 1., 1.);
|
||||
_showAnimation.reset();
|
||||
if (!switching && !opacityAnimating) showAll();
|
||||
} else if (switching) {
|
||||
auto slideDt = _a_slide.current(ms, 1.);
|
||||
_slideAnimation->paintFrame(p, slideDt, _a_opacity.current(_hiding ? 0. : 1.));
|
||||
|
|
|
@ -21,7 +21,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#pragma once
|
||||
|
||||
#include "ui/twidget.h"
|
||||
#include "core/lambda_wrap.h"
|
||||
|
||||
namespace Ui {
|
||||
|
||||
|
@ -61,7 +60,7 @@ public:
|
|||
|
||||
void setAcceptBoth(bool acceptBoth = true);
|
||||
|
||||
void setClickedCallback(base::lambda_unique<void()> &&callback) {
|
||||
void setClickedCallback(base::lambda<void()> &&callback) {
|
||||
_clickedCallback = std_::move(callback);
|
||||
}
|
||||
|
||||
|
@ -83,7 +82,7 @@ protected:
|
|||
int _state = StateNone;
|
||||
bool _acceptBoth = false;
|
||||
|
||||
base::lambda_unique<void()> _clickedCallback;
|
||||
base::lambda<void()> _clickedCallback;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#pragma once
|
||||
|
||||
#include "core/basic_types.h"
|
||||
#include "core/lambda_wrap.h"
|
||||
#include <QtCore/QTimer>
|
||||
#include <QtGui/QColor>
|
||||
|
||||
|
@ -89,7 +88,7 @@ enum Notification {
|
|||
|
||||
namespace anim {
|
||||
|
||||
using transition = base::lambda_wrap<float64(float64 delta, float64 dt)>;
|
||||
using transition = base::lambda_copy<float64(float64 delta, float64 dt)>;
|
||||
|
||||
extern transition linear;
|
||||
extern transition sineInOut;
|
||||
|
@ -584,7 +583,7 @@ template <typename AnimType>
|
|||
class SimpleAnimation {
|
||||
public:
|
||||
using ValueType = typename AnimType::ValueType;
|
||||
using Callback = base::lambda_unique<void()>;
|
||||
using Callback = base::lambda<void()>;
|
||||
|
||||
void step(uint64 ms) {
|
||||
if (_data) {
|
||||
|
@ -621,7 +620,7 @@ public:
|
|||
}
|
||||
|
||||
template <typename Lambda>
|
||||
void start(Lambda &&updateCallback, const ValueType &from, const ValueType &to, float64 duration, anim::transition transition = anim::linear) {
|
||||
void start(Lambda &&updateCallback, const ValueType &from, const ValueType &to, float64 duration, const anim::transition &transition = anim::linear) {
|
||||
if (!_data) {
|
||||
_data = std_::make_unique<Data>(from, std_::forward<Lambda>(updateCallback));
|
||||
}
|
||||
|
@ -647,10 +646,10 @@ private:
|
|||
, a_animation(animation(this, &Data::step))
|
||||
, updateCallback(std_::move(updateCallback)) {
|
||||
}
|
||||
Data(const ValueType &from, const base::lambda_wrap<void()> &updateCallback)
|
||||
Data(const ValueType &from, const base::lambda_copy<void()> &updateCallback)
|
||||
: value(from, from)
|
||||
, a_animation(animation(this, &Data::step))
|
||||
, updateCallback(base::lambda_wrap<void()>(updateCallback)) {
|
||||
, updateCallback(base::lambda_copy<void()>(updateCallback)) {
|
||||
}
|
||||
void step(float64 ms, bool timer) {
|
||||
auto dt = (ms >= duration) ? 1. : (ms / duration);
|
||||
|
|
|
@ -25,8 +25,8 @@ namespace Ui {
|
|||
|
||||
class RippleAnimation::Ripple {
|
||||
public:
|
||||
Ripple(const style::RippleAnimation &st, QPoint origin, int startRadius, const QPixmap &mask, UpdateCallback update);
|
||||
Ripple(const style::RippleAnimation &st, const QPixmap &mask, UpdateCallback update);
|
||||
Ripple(const style::RippleAnimation &st, QPoint origin, int startRadius, const QPixmap &mask, const UpdateCallback &update);
|
||||
Ripple(const style::RippleAnimation &st, const QPixmap &mask, const UpdateCallback &update);
|
||||
|
||||
void paint(QPainter &p, const QPixmap &mask, uint64 ms);
|
||||
|
||||
|
@ -53,7 +53,7 @@ private:
|
|||
|
||||
};
|
||||
|
||||
RippleAnimation::Ripple::Ripple(const style::RippleAnimation &st, QPoint origin, int startRadius, const QPixmap &mask, UpdateCallback update)
|
||||
RippleAnimation::Ripple::Ripple(const style::RippleAnimation &st, QPoint origin, int startRadius, const QPixmap &mask, const UpdateCallback &update)
|
||||
: _st(st)
|
||||
, _update(update)
|
||||
, _origin(origin)
|
||||
|
@ -75,7 +75,7 @@ RippleAnimation::Ripple::Ripple(const style::RippleAnimation &st, QPoint origin,
|
|||
_show.start(UpdateCallback(_update), 0., 1., _st.showDuration);
|
||||
}
|
||||
|
||||
RippleAnimation::Ripple::Ripple(const style::RippleAnimation &st, const QPixmap &mask, UpdateCallback update)
|
||||
RippleAnimation::Ripple::Ripple(const style::RippleAnimation &st, const QPixmap &mask, const UpdateCallback &update)
|
||||
: _st(st)
|
||||
, _update(update)
|
||||
, _origin(mask.width() / (2 * cIntRetinaFactor()), mask.height() / (2 * cIntRetinaFactor()))
|
||||
|
@ -141,10 +141,10 @@ void RippleAnimation::Ripple::finish() {
|
|||
_hide.finish();
|
||||
}
|
||||
|
||||
RippleAnimation::RippleAnimation(const style::RippleAnimation &st, QImage mask, UpdateCallback callback)
|
||||
RippleAnimation::RippleAnimation(const style::RippleAnimation &st, QImage mask, const UpdateCallback &callback)
|
||||
: _st(st)
|
||||
, _mask(App::pixmapFromImageInPlace(std_::move(mask)))
|
||||
, _update(std_::move(callback)) {
|
||||
, _update(callback) {
|
||||
}
|
||||
|
||||
|
||||
|
@ -190,7 +190,7 @@ void RippleAnimation::paint(QPainter &p, int x, int y, int outerWidth, uint64 ms
|
|||
clearFinished();
|
||||
}
|
||||
|
||||
QImage RippleAnimation::maskByDrawer(QSize size, bool filled, base::lambda_unique<void(QPainter &p)> drawer) {
|
||||
QImage RippleAnimation::maskByDrawer(QSize size, bool filled, base::lambda<void(QPainter &p)> &&drawer) {
|
||||
auto result = QImage(size * cIntRetinaFactor(), QImage::Format_ARGB32_Premultiplied);
|
||||
result.fill(filled ? QColor(255, 255, 255) : Qt::transparent);
|
||||
if (drawer) {
|
||||
|
@ -204,7 +204,7 @@ QImage RippleAnimation::maskByDrawer(QSize size, bool filled, base::lambda_uniqu
|
|||
}
|
||||
|
||||
QImage RippleAnimation::rectMask(QSize size) {
|
||||
return maskByDrawer(size, true, base::lambda_unique<void(QPainter&)>());
|
||||
return maskByDrawer(size, true, base::lambda<void(QPainter&)>());
|
||||
}
|
||||
|
||||
QImage RippleAnimation::roundRectMask(QSize size, int radius) {
|
||||
|
|
|
@ -26,12 +26,10 @@ namespace Ui {
|
|||
|
||||
class RippleAnimation {
|
||||
public:
|
||||
using UpdateCallback = base::lambda_wrap<void()>;
|
||||
using UpdateCallback = base::lambda_copy<void()>;
|
||||
|
||||
// White upon transparent mask, like colorizeImage(black-white-mask, white).
|
||||
RippleAnimation(const style::RippleAnimation &st, QImage mask, UpdateCallback update);
|
||||
|
||||
void setMask(QImage &&mask);
|
||||
RippleAnimation(const style::RippleAnimation &st, QImage mask, const UpdateCallback &update);
|
||||
|
||||
void add(QPoint origin, int startRadius = 0);
|
||||
void addFading();
|
||||
|
@ -45,7 +43,7 @@ public:
|
|||
return _ripples.isEmpty();
|
||||
}
|
||||
|
||||
static QImage maskByDrawer(QSize size, bool filled, base::lambda_unique<void(QPainter &p)> drawer);
|
||||
static QImage maskByDrawer(QSize size, bool filled, base::lambda<void(QPainter &p)> &&drawer);
|
||||
static QImage rectMask(QSize size);
|
||||
static QImage roundRectMask(QSize size, int radius);
|
||||
static QImage ellipseMask(QSize size);
|
||||
|
|
|
@ -58,9 +58,9 @@ void prepareCheckCaches(const style::RoundImageCheckbox *st, QPixmap &checkBgCac
|
|||
|
||||
} // namespace
|
||||
|
||||
RoundImageCheckbox::RoundImageCheckbox(const style::RoundImageCheckbox &st, base::lambda_wrap<void()> updateCallback, PaintRoundImage paintRoundImage)
|
||||
RoundImageCheckbox::RoundImageCheckbox(const style::RoundImageCheckbox &st, const base::lambda_copy<void()> &updateCallback, PaintRoundImage &&paintRoundImage)
|
||||
: _st(st)
|
||||
, _updateCallback(std_::move(updateCallback))
|
||||
, _updateCallback(updateCallback)
|
||||
, _paintRoundImage(std_::move(paintRoundImage)) {
|
||||
prepareCheckCaches(&_st, _wideCheckBgCache, _wideCheckFullCache);
|
||||
}
|
||||
|
|
|
@ -26,8 +26,8 @@ namespace Ui {
|
|||
|
||||
class RoundImageCheckbox {
|
||||
public:
|
||||
using PaintRoundImage = base::lambda_unique<void(Painter &p, int x, int y, int outerWidth, int size)>;
|
||||
RoundImageCheckbox(const style::RoundImageCheckbox &st, base::lambda_wrap<void()> updateCallback, PaintRoundImage paintRoundImage);
|
||||
using PaintRoundImage = base::lambda<void(Painter &p, int x, int y, int outerWidth, int size)>;
|
||||
RoundImageCheckbox(const style::RoundImageCheckbox &st, const base::lambda_copy<void()> &updateCallback, PaintRoundImage &&paintRoundImage);
|
||||
|
||||
void paint(Painter &p, uint64 ms, int x, int y, int outerWidth);
|
||||
float64 checkedAnimationRatio() const;
|
||||
|
@ -52,7 +52,7 @@ private:
|
|||
void prepareWideCheckIconCache(Icon *icon);
|
||||
|
||||
const style::RoundImageCheckbox &_st;
|
||||
base::lambda_wrap<void()> _updateCallback;
|
||||
base::lambda_copy<void()> _updateCallback;
|
||||
PaintRoundImage _paintRoundImage;
|
||||
|
||||
bool _checked = false;
|
||||
|
|
|
@ -115,7 +115,7 @@ void FadeAnimation::updateCallback() {
|
|||
|
||||
WidgetFadeWrap<TWidget>::WidgetFadeWrap(QWidget *parent
|
||||
, TWidget *entity
|
||||
, base::lambda_unique<void()> updateCallback
|
||||
, base::lambda<void()> &&updateCallback
|
||||
, int duration) : TWidget(parent)
|
||||
, _entity(entity)
|
||||
, _duration(duration)
|
||||
|
|
|
@ -33,10 +33,10 @@ public:
|
|||
bool paint(Painter &p);
|
||||
void refreshCache();
|
||||
|
||||
using FinishedCallback = base::lambda_unique<void()>;
|
||||
using FinishedCallback = base::lambda<void()>;
|
||||
void setFinishedCallback(FinishedCallback &&callback);
|
||||
|
||||
using UpdatedCallback = base::lambda_unique<void(float64)>;
|
||||
using UpdatedCallback = base::lambda<void(float64)>;
|
||||
void setUpdatedCallback(UpdatedCallback &&callback);
|
||||
|
||||
void show();
|
||||
|
@ -68,7 +68,7 @@ template <>
|
|||
class WidgetFadeWrap<TWidget> : public TWidget {
|
||||
public:
|
||||
WidgetFadeWrap(QWidget *parent, TWidget *entity
|
||||
, base::lambda_unique<void()> updateCallback
|
||||
, base::lambda<void()> &&updateCallback
|
||||
, int duration = st::widgetFadeDuration);
|
||||
|
||||
void fadeOut() {
|
||||
|
@ -105,7 +105,7 @@ protected:
|
|||
private:
|
||||
TWidget *_entity;
|
||||
int _duration;
|
||||
base::lambda_unique<void()> _updateCallback;
|
||||
base::lambda<void()> _updateCallback;
|
||||
|
||||
FadeAnimation _animation;
|
||||
|
||||
|
@ -115,7 +115,7 @@ template <typename Widget>
|
|||
class WidgetFadeWrap : public WidgetFadeWrap<TWidget> {
|
||||
public:
|
||||
WidgetFadeWrap(QWidget *parent, Widget *entity
|
||||
, base::lambda_unique<void()> updateCallback
|
||||
, base::lambda<void()> &&updateCallback
|
||||
, int duration = st::widgetFadeDuration) : WidgetFadeWrap<TWidget>(parent, entity, std_::move(updateCallback), duration) {
|
||||
}
|
||||
Widget *entity() {
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace Ui {
|
|||
WidgetSlideWrap<TWidget>::WidgetSlideWrap(QWidget *parent
|
||||
, TWidget *entity
|
||||
, style::margins entityPadding
|
||||
, base::lambda_unique<void()> updateCallback
|
||||
, base::lambda<void()> &&updateCallback
|
||||
, int duration) : TWidget(parent)
|
||||
, _entity(entity)
|
||||
, _padding(entityPadding)
|
||||
|
|
|
@ -32,7 +32,7 @@ class WidgetSlideWrap<TWidget> : public TWidget {
|
|||
public:
|
||||
WidgetSlideWrap(QWidget *parent, TWidget *entity
|
||||
, style::margins entityPadding
|
||||
, base::lambda_unique<void()> updateCallback
|
||||
, base::lambda<void()> &&updateCallback
|
||||
, int duration = st::widgetSlideDuration);
|
||||
|
||||
void slideUp();
|
||||
|
@ -61,7 +61,7 @@ private:
|
|||
bool _inResizeToWidth = false;
|
||||
style::margins _padding;
|
||||
int _duration;
|
||||
base::lambda_unique<void()> _updateCallback;
|
||||
base::lambda<void()> _updateCallback;
|
||||
|
||||
style::size _realSize;
|
||||
int _forceHeight = -1;
|
||||
|
@ -76,7 +76,7 @@ class WidgetSlideWrap : public WidgetSlideWrap<TWidget> {
|
|||
public:
|
||||
WidgetSlideWrap(QWidget *parent, Widget *entity
|
||||
, style::margins entityPadding
|
||||
, base::lambda_unique<void()> updateCallback
|
||||
, base::lambda<void()> &&updateCallback
|
||||
, int duration = st::widgetSlideDuration) : WidgetSlideWrap<TWidget>(parent, entity, entityPadding, std_::move(updateCallback), duration) {
|
||||
}
|
||||
Widget *entity() {
|
||||
|
|
|
@ -43,7 +43,7 @@ public:
|
|||
return _disabled;
|
||||
}
|
||||
|
||||
using Callback = base::lambda_unique<void(float64)>;
|
||||
using Callback = base::lambda<void(float64)>;
|
||||
void setChangeProgressCallback(Callback &&callback) {
|
||||
_changeProgressCallback = std_::move(callback);
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ public:
|
|||
void setActiveSection(int index);
|
||||
void setActiveSectionFast(int index);
|
||||
|
||||
using SectionActivatedCallback = base::lambda_unique<void()>;
|
||||
using SectionActivatedCallback = base::lambda<void()>;
|
||||
void setSectionActivatedCallback(SectionActivatedCallback &&callback);
|
||||
|
||||
protected:
|
||||
|
|
|
@ -69,7 +69,7 @@ QAction *DropdownMenu::addAction(const QString &text, const QObject *receiver, c
|
|||
return _menu->addAction(text, receiver, member, icon, iconOver);
|
||||
}
|
||||
|
||||
QAction *DropdownMenu::addAction(const QString &text, base::lambda_unique<void()> callback, const style::icon *icon, const style::icon *iconOver) {
|
||||
QAction *DropdownMenu::addAction(const QString &text, base::lambda<void()> &&callback, const style::icon *icon, const style::icon *iconOver) {
|
||||
return _menu->addAction(text, std_::move(callback), icon, iconOver);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,11 +31,11 @@ public:
|
|||
DropdownMenu(QWidget *parent, const style::DropdownMenu &st = st::defaultDropdownMenu);
|
||||
|
||||
QAction *addAction(const QString &text, const QObject *receiver, const char* member, const style::icon *icon = nullptr, const style::icon *iconOver = nullptr);
|
||||
QAction *addAction(const QString &text, base::lambda_unique<void()> callback, const style::icon *icon = nullptr, const style::icon *iconOver = nullptr);
|
||||
QAction *addAction(const QString &text, base::lambda<void()> &&callback, const style::icon *icon = nullptr, const style::icon *iconOver = nullptr);
|
||||
QAction *addSeparator();
|
||||
void clearActions();
|
||||
|
||||
void setHiddenCallback(base::lambda_unique<void()> callback) {
|
||||
void setHiddenCallback(base::lambda<void()> &&callback) {
|
||||
_hiddenCallback = std_::move(callback);
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ private:
|
|||
void showMenu(const QPoint &p, DropdownMenu *parent, TriggeredSource source);
|
||||
|
||||
const style::DropdownMenu &_st;
|
||||
base::lambda_unique<void()> _hiddenCallback;
|
||||
base::lambda<void()> _hiddenCallback;
|
||||
|
||||
ChildWidget<Ui::Menu> _menu;
|
||||
|
||||
|
|
|
@ -48,13 +48,13 @@ public:
|
|||
void otherLeave();
|
||||
void hideFast();
|
||||
|
||||
void setShowStartCallback(base::lambda_unique<void()> callback) {
|
||||
void setShowStartCallback(base::lambda<void()> &&callback) {
|
||||
_showStartCallback = std_::move(callback);
|
||||
}
|
||||
void setHideStartCallback(base::lambda_unique<void()> callback) {
|
||||
void setHideStartCallback(base::lambda<void()> &&callback) {
|
||||
_hideStartCallback = std_::move(callback);
|
||||
}
|
||||
void setHiddenCallback(base::lambda_unique<void()> callback) {
|
||||
void setHiddenCallback(base::lambda<void()> &&callback) {
|
||||
_hiddenCallback = std_::move(callback);
|
||||
}
|
||||
|
||||
|
@ -116,9 +116,9 @@ private:
|
|||
|
||||
QTimer _hideTimer;
|
||||
bool _ignoreShowEvents = false;
|
||||
base::lambda_unique<void()> _showStartCallback;
|
||||
base::lambda_unique<void()> _hideStartCallback;
|
||||
base::lambda_unique<void()> _hiddenCallback;
|
||||
base::lambda<void()> _showStartCallback;
|
||||
base::lambda<void()> _hideStartCallback;
|
||||
base::lambda<void()> _hiddenCallback;
|
||||
|
||||
ChildWidget<Ui::ScrollArea> _scroll;
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ public:
|
|||
|
||||
void setLink(uint16 lnkIndex, const ClickHandlerPtr &lnk);
|
||||
|
||||
using ClickHandlerHook = base::lambda_unique<bool(const ClickHandlerPtr&, Qt::MouseButton)>;
|
||||
using ClickHandlerHook = base::lambda<bool(const ClickHandlerPtr&, Qt::MouseButton)>;
|
||||
void setClickHandlerHook(ClickHandlerHook &&hook);
|
||||
|
||||
// ClickHandlerHost interface
|
||||
|
|
|
@ -57,7 +57,7 @@ QAction *Menu::addAction(const QString &text, const QObject *receiver, const cha
|
|||
return action;
|
||||
}
|
||||
|
||||
QAction *Menu::addAction(const QString &text, base::lambda_unique<void()> callback, const style::icon *icon, const style::icon *iconOver) {
|
||||
QAction *Menu::addAction(const QString &text, base::lambda<void()> &&callback, const style::icon *icon, const style::icon *iconOver) {
|
||||
auto action = addAction(new QAction(text, this), icon, iconOver);
|
||||
connect(action, SIGNAL(triggered(bool)), base::lambda_slot(action, std_::move(callback)), SLOT(action()), Qt::QueuedConnection);
|
||||
return action;
|
||||
|
|
|
@ -34,7 +34,7 @@ public:
|
|||
Menu(QWidget *parent, QMenu *menu, const style::Menu &st = st::defaultMenu);
|
||||
|
||||
QAction *addAction(const QString &text, const QObject *receiver, const char* member, const style::icon *icon = nullptr, const style::icon *iconOver = nullptr);
|
||||
QAction *addAction(const QString &text, base::lambda_unique<void()> callback, const style::icon *icon = nullptr, const style::icon *iconOver = nullptr);
|
||||
QAction *addAction(const QString &text, base::lambda<void()> &&callback, const style::icon *icon = nullptr, const style::icon *iconOver = nullptr);
|
||||
QAction *addSeparator();
|
||||
void clearActions();
|
||||
|
||||
|
@ -52,33 +52,33 @@ public:
|
|||
using Actions = QList<QAction*>;
|
||||
Actions &actions();
|
||||
|
||||
void setResizedCallback(base::lambda_unique<void()> callback) {
|
||||
void setResizedCallback(base::lambda<void()> &&callback) {
|
||||
_resizedCallback = std_::move(callback);
|
||||
}
|
||||
|
||||
void setActivatedCallback(base::lambda_unique<void(QAction *action, int actionTop, TriggeredSource source)> callback) {
|
||||
void setActivatedCallback(base::lambda<void(QAction *action, int actionTop, TriggeredSource source)> &&callback) {
|
||||
_activatedCallback = std_::move(callback);
|
||||
}
|
||||
void setTriggeredCallback(base::lambda_unique<void(QAction *action, int actionTop, TriggeredSource source)> callback) {
|
||||
void setTriggeredCallback(base::lambda<void(QAction *action, int actionTop, TriggeredSource source)> &&callback) {
|
||||
_triggeredCallback = std_::move(callback);
|
||||
}
|
||||
|
||||
void setKeyPressDelegate(base::lambda_unique<bool(int key)> delegate) {
|
||||
void setKeyPressDelegate(base::lambda<bool(int key)> &&delegate) {
|
||||
_keyPressDelegate = std_::move(delegate);
|
||||
}
|
||||
void handleKeyPress(int key);
|
||||
|
||||
void setMouseMoveDelegate(base::lambda_unique<void(QPoint globalPosition)> delegate) {
|
||||
void setMouseMoveDelegate(base::lambda<void(QPoint globalPosition)> &&delegate) {
|
||||
_mouseMoveDelegate = std_::move(delegate);
|
||||
}
|
||||
void handleMouseMove(QPoint globalPosition);
|
||||
|
||||
void setMousePressDelegate(base::lambda_unique<void(QPoint globalPosition)> delegate) {
|
||||
void setMousePressDelegate(base::lambda<void(QPoint globalPosition)> &&delegate) {
|
||||
_mousePressDelegate = std_::move(delegate);
|
||||
}
|
||||
void handleMousePress(QPoint globalPosition);
|
||||
|
||||
void setMouseReleaseDelegate(base::lambda_unique<void(QPoint globalPosition)> delegate) {
|
||||
void setMouseReleaseDelegate(base::lambda<void(QPoint globalPosition)> &&delegate) {
|
||||
_mouseReleaseDelegate = std_::move(delegate);
|
||||
}
|
||||
void handleMouseRelease(QPoint globalPosition);
|
||||
|
@ -114,13 +114,13 @@ private:
|
|||
|
||||
const style::Menu &_st;
|
||||
|
||||
base::lambda_unique<void()> _resizedCallback;
|
||||
base::lambda_unique<void(QAction *action, int actionTop, TriggeredSource source)> _activatedCallback;
|
||||
base::lambda_unique<void(QAction *action, int actionTop, TriggeredSource source)> _triggeredCallback;
|
||||
base::lambda_unique<bool(int key)> _keyPressDelegate;
|
||||
base::lambda_unique<void(QPoint globalPosition)> _mouseMoveDelegate;
|
||||
base::lambda_unique<void(QPoint globalPosition)> _mousePressDelegate;
|
||||
base::lambda_unique<void(QPoint globalPosition)> _mouseReleaseDelegate;
|
||||
base::lambda<void()> _resizedCallback;
|
||||
base::lambda<void(QAction *action, int actionTop, TriggeredSource source)> _activatedCallback;
|
||||
base::lambda<void(QAction *action, int actionTop, TriggeredSource source)> _triggeredCallback;
|
||||
base::lambda<bool(int key)> _keyPressDelegate;
|
||||
base::lambda<void(QPoint globalPosition)> _mouseMoveDelegate;
|
||||
base::lambda<void(QPoint globalPosition)> _mousePressDelegate;
|
||||
base::lambda<void(QPoint globalPosition)> _mouseReleaseDelegate;
|
||||
|
||||
struct ActionData {
|
||||
bool hasSubmenu = false;
|
||||
|
|
|
@ -36,7 +36,7 @@ constexpr int kWideScale = 3;
|
|||
|
||||
class MultiSelect::Inner::Item {
|
||||
public:
|
||||
Item(const style::MultiSelectItem &st, uint64 id, const QString &text, const style::color &color, PaintRoundImage paintRoundImage);
|
||||
Item(const style::MultiSelectItem &st, uint64 id, const QString &text, const style::color &color, PaintRoundImage &&paintRoundImage);
|
||||
|
||||
uint64 id() const {
|
||||
return _id;
|
||||
|
@ -56,8 +56,8 @@ public:
|
|||
void setPosition(int x, int y, int outerWidth, int maxVisiblePadding);
|
||||
QRect paintArea(int outerWidth) const;
|
||||
|
||||
void setUpdateCallback(base::lambda_wrap<void()> updateCallback) {
|
||||
_updateCallback = std_::move(updateCallback);
|
||||
void setUpdateCallback(const base::lambda_copy<void()> &updateCallback) {
|
||||
_updateCallback = updateCallback;
|
||||
}
|
||||
void setText(const QString &text);
|
||||
void paint(Painter &p, int outerWidth, uint64 ms);
|
||||
|
@ -88,11 +88,11 @@ private:
|
|||
|
||||
uint64 _id;
|
||||
struct SlideAnimation {
|
||||
SlideAnimation(base::lambda_wrap<void()> updateCallback, int fromX, int toX, int y, float64 duration)
|
||||
SlideAnimation(const base::lambda_copy<void()> &updateCallback, int fromX, int toX, int y, float64 duration)
|
||||
: fromX(fromX)
|
||||
, toX(toX)
|
||||
, y(y) {
|
||||
x.start(std_::move(updateCallback), fromX, toX, duration);
|
||||
x.start(updateCallback, fromX, toX, duration);
|
||||
}
|
||||
IntAnimation x;
|
||||
int fromX, toX;
|
||||
|
@ -111,12 +111,12 @@ private:
|
|||
bool _overDelete = false;
|
||||
bool _active = false;
|
||||
PaintRoundImage _paintRoundImage;
|
||||
base::lambda_wrap<void()> _updateCallback;
|
||||
base::lambda_copy<void()> _updateCallback;
|
||||
bool _hiding = false;
|
||||
|
||||
};
|
||||
|
||||
MultiSelect::Inner::Item::Item(const style::MultiSelectItem &st, uint64 id, const QString &text, const style::color &color, PaintRoundImage paintRoundImage)
|
||||
MultiSelect::Inner::Item::Item(const style::MultiSelectItem &st, uint64 id, const QString &text, const style::color &color, PaintRoundImage &&paintRoundImage)
|
||||
: _st(st)
|
||||
, _id(id)
|
||||
, _color(color)
|
||||
|
@ -409,15 +409,15 @@ void MultiSelect::scrollTo(int activeTop, int activeBottom) {
|
|||
}
|
||||
}
|
||||
|
||||
void MultiSelect::setQueryChangedCallback(base::lambda_unique<void(const QString &query)> callback) {
|
||||
void MultiSelect::setQueryChangedCallback(base::lambda<void(const QString &query)> &&callback) {
|
||||
_queryChangedCallback = std_::move(callback);
|
||||
}
|
||||
|
||||
void MultiSelect::setSubmittedCallback(base::lambda_unique<void(bool ctrlShiftEnter)> callback) {
|
||||
void MultiSelect::setSubmittedCallback(base::lambda<void(bool ctrlShiftEnter)> &&callback) {
|
||||
_inner->setSubmittedCallback(std_::move(callback));
|
||||
}
|
||||
|
||||
void MultiSelect::setResizedCallback(base::lambda_unique<void()> callback) {
|
||||
void MultiSelect::setResizedCallback(base::lambda<void()> &&callback) {
|
||||
_resizedCallback = std_::move(callback);
|
||||
}
|
||||
|
||||
|
@ -435,11 +435,11 @@ QString MultiSelect::getQuery() const {
|
|||
return _inner->getQuery();
|
||||
}
|
||||
|
||||
void MultiSelect::addItem(uint64 itemId, const QString &text, const style::color &color, PaintRoundImage paintRoundImage, AddItemWay way) {
|
||||
void MultiSelect::addItem(uint64 itemId, const QString &text, const style::color &color, PaintRoundImage &&paintRoundImage, AddItemWay way) {
|
||||
_inner->addItem(std_::make_unique<Inner::Item>(_st.item, itemId, text, color, std_::move(paintRoundImage)), way);
|
||||
}
|
||||
|
||||
void MultiSelect::setItemRemovedCallback(base::lambda_unique<void(uint64 itemId)> callback) {
|
||||
void MultiSelect::setItemRemovedCallback(base::lambda<void(uint64 itemId)> &&callback) {
|
||||
_inner->setItemRemovedCallback(std_::move(callback));
|
||||
}
|
||||
|
||||
|
@ -456,7 +456,7 @@ int MultiSelect::resizeGetHeight(int newWidth) {
|
|||
return newHeight;
|
||||
}
|
||||
|
||||
MultiSelect::Inner::Inner(QWidget *parent, const style::MultiSelect &st, const QString &placeholder, ScrollCallback callback) : TWidget(parent)
|
||||
MultiSelect::Inner::Inner(QWidget *parent, const style::MultiSelect &st, const QString &placeholder, ScrollCallback &&callback) : TWidget(parent)
|
||||
, _st(st)
|
||||
, _scrollCallback(std_::move(callback))
|
||||
, _field(this, _st.field, placeholder)
|
||||
|
@ -500,11 +500,11 @@ void MultiSelect::Inner::clearQuery() {
|
|||
_field->setText(QString());
|
||||
}
|
||||
|
||||
void MultiSelect::Inner::setQueryChangedCallback(base::lambda_unique<void(const QString &query)> callback) {
|
||||
void MultiSelect::Inner::setQueryChangedCallback(base::lambda<void(const QString &query)> &&callback) {
|
||||
_queryChangedCallback = std_::move(callback);
|
||||
}
|
||||
|
||||
void MultiSelect::Inner::setSubmittedCallback(base::lambda_unique<void(bool ctrlShiftEnter)> callback) {
|
||||
void MultiSelect::Inner::setSubmittedCallback(base::lambda<void(bool ctrlShiftEnter)> &&callback) {
|
||||
_submittedCallback = std_::move(callback);
|
||||
}
|
||||
|
||||
|
@ -805,11 +805,11 @@ void MultiSelect::Inner::setItemText(uint64 itemId, const QString &text) {
|
|||
}
|
||||
}
|
||||
|
||||
void MultiSelect::Inner::setItemRemovedCallback(base::lambda_unique<void(uint64 itemId)> callback) {
|
||||
void MultiSelect::Inner::setItemRemovedCallback(base::lambda<void(uint64 itemId)> &&callback) {
|
||||
_itemRemovedCallback = std_::move(callback);
|
||||
}
|
||||
|
||||
void MultiSelect::Inner::setResizedCallback(base::lambda_unique<void(int heightDelta)> callback) {
|
||||
void MultiSelect::Inner::setResizedCallback(base::lambda<void(int heightDelta)> &&callback) {
|
||||
_resizedCallback = std_::move(callback);
|
||||
}
|
||||
|
||||
|
|
|
@ -36,19 +36,19 @@ public:
|
|||
void setInnerFocus();
|
||||
void clearQuery();
|
||||
|
||||
void setQueryChangedCallback(base::lambda_unique<void(const QString &query)> callback);
|
||||
void setSubmittedCallback(base::lambda_unique<void(bool ctrlShiftEnter)> callback);
|
||||
void setResizedCallback(base::lambda_unique<void()> callback);
|
||||
void setQueryChangedCallback(base::lambda<void(const QString &query)> &&callback);
|
||||
void setSubmittedCallback(base::lambda<void(bool ctrlShiftEnter)> &&callback);
|
||||
void setResizedCallback(base::lambda<void()> &&callback);
|
||||
|
||||
enum class AddItemWay {
|
||||
Default,
|
||||
SkipAnimation,
|
||||
};
|
||||
using PaintRoundImage = base::lambda_unique<void(Painter &p, int x, int y, int outerWidth, int size)>;
|
||||
void addItem(uint64 itemId, const QString &text, const style::color &color, PaintRoundImage paintRoundImage, AddItemWay way = AddItemWay::Default);
|
||||
using PaintRoundImage = base::lambda<void(Painter &p, int x, int y, int outerWidth, int size)>;
|
||||
void addItem(uint64 itemId, const QString &text, const style::color &color, PaintRoundImage &&paintRoundImage, AddItemWay way = AddItemWay::Default);
|
||||
void setItemText(uint64 itemId, const QString &text);
|
||||
|
||||
void setItemRemovedCallback(base::lambda_unique<void(uint64 itemId)> callback);
|
||||
void setItemRemovedCallback(base::lambda<void(uint64 itemId)> &&callback);
|
||||
void removeItem(uint64 itemId);
|
||||
|
||||
protected:
|
||||
|
@ -65,8 +65,8 @@ private:
|
|||
class Inner;
|
||||
ChildWidget<Inner> _inner;
|
||||
|
||||
base::lambda_unique<void()> _resizedCallback;
|
||||
base::lambda_unique<void(const QString &query)> _queryChangedCallback;
|
||||
base::lambda<void()> _resizedCallback;
|
||||
base::lambda<void(const QString &query)> _queryChangedCallback;
|
||||
|
||||
};
|
||||
|
||||
|
@ -75,24 +75,24 @@ class MultiSelect::Inner : public TWidget {
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
using ScrollCallback = base::lambda_unique<void(int activeTop, int activeBottom)>;
|
||||
Inner(QWidget *parent, const style::MultiSelect &st, const QString &placeholder, ScrollCallback callback);
|
||||
using ScrollCallback = base::lambda<void(int activeTop, int activeBottom)>;
|
||||
Inner(QWidget *parent, const style::MultiSelect &st, const QString &placeholder, ScrollCallback &&callback);
|
||||
|
||||
QString getQuery() const;
|
||||
bool setInnerFocus();
|
||||
void clearQuery();
|
||||
|
||||
void setQueryChangedCallback(base::lambda_unique<void(const QString &query)> callback);
|
||||
void setSubmittedCallback(base::lambda_unique<void(bool ctrlShiftEnter)> callback);
|
||||
void setQueryChangedCallback(base::lambda<void(const QString &query)> &&callback);
|
||||
void setSubmittedCallback(base::lambda<void(bool ctrlShiftEnter)> &&callback);
|
||||
|
||||
class Item;
|
||||
void addItem(std_::unique_ptr<Item> item, AddItemWay way);
|
||||
void setItemText(uint64 itemId, const QString &text);
|
||||
|
||||
void setItemRemovedCallback(base::lambda_unique<void(uint64 itemId)> callback);
|
||||
void setItemRemovedCallback(base::lambda<void(uint64 itemId)> &&callback);
|
||||
void removeItem(uint64 itemId);
|
||||
|
||||
void setResizedCallback(base::lambda_unique<void(int heightDelta)> callback);
|
||||
void setResizedCallback(base::lambda<void(int heightDelta)> &&callback);
|
||||
|
||||
~Inner();
|
||||
|
||||
|
@ -159,10 +159,10 @@ private:
|
|||
int _newHeight = 0;
|
||||
IntAnimation _height;
|
||||
|
||||
base::lambda_unique<void(const QString &query)> _queryChangedCallback;
|
||||
base::lambda_unique<void(bool ctrlShiftEnter)> _submittedCallback;
|
||||
base::lambda_unique<void(uint64 itemId)> _itemRemovedCallback;
|
||||
base::lambda_unique<void(int heightDelta)> _resizedCallback;
|
||||
base::lambda<void(const QString &query)> _queryChangedCallback;
|
||||
base::lambda<void(bool ctrlShiftEnter)> _submittedCallback;
|
||||
base::lambda<void(uint64 itemId)> _itemRemovedCallback;
|
||||
base::lambda<void(int heightDelta)> _resizedCallback;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ QAction *PopupMenu::addAction(const QString &text, const QObject *receiver, cons
|
|||
return _menu->addAction(text, receiver, member, icon, iconOver);
|
||||
}
|
||||
|
||||
QAction *PopupMenu::addAction(const QString &text, base::lambda_unique<void()> callback, const style::icon *icon, const style::icon *iconOver) {
|
||||
QAction *PopupMenu::addAction(const QString &text, base::lambda<void()> &&callback, const style::icon *icon, const style::icon *iconOver) {
|
||||
return _menu->addAction(text, std_::move(callback), icon, iconOver);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ public:
|
|||
PopupMenu(QMenu *menu, const style::PopupMenu &st = st::defaultPopupMenu);
|
||||
|
||||
QAction *addAction(const QString &text, const QObject *receiver, const char* member, const style::icon *icon = nullptr, const style::icon *iconOver = nullptr);
|
||||
QAction *addAction(const QString &text, base::lambda_unique<void()> callback, const style::icon *icon = nullptr, const style::icon *iconOver = nullptr);
|
||||
QAction *addAction(const QString &text, base::lambda<void()> &&callback, const style::icon *icon = nullptr, const style::icon *iconOver = nullptr);
|
||||
QAction *addSeparator();
|
||||
void clearActions();
|
||||
|
||||
|
|
|
@ -140,7 +140,6 @@ void ScrollBar::paintEvent(QPaintEvent *e) {
|
|||
if (a_fullOpacity.current() == 0.) return;
|
||||
|
||||
QPainter p(this);
|
||||
|
||||
auto deltal = _vertical ? _st->deltax : 0, deltar = _vertical ? _st->deltax : 0;
|
||||
auto deltat = _vertical ? 0 : _st->deltax, deltab = _vertical ? 0 : _st->deltax;
|
||||
p.setPen(Qt::NoPen);
|
||||
|
|
|
@ -74,7 +74,8 @@ protected:
|
|||
}
|
||||
void paintEvent(QPaintEvent *e) override {
|
||||
Painter p(this);
|
||||
_icon.fill(p, e->rect());
|
||||
auto clip = e->rect();
|
||||
_icon.fill(p, QRect(clip.x(), 0, clip.width(), height()));
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
@ -419,7 +419,7 @@ void Widget::hideStop() {
|
|||
}
|
||||
}
|
||||
|
||||
void Widget::hideAnimated(float64 duration, anim::transition func) {
|
||||
void Widget::hideAnimated(float64 duration, const anim::transition &func) {
|
||||
_opacityDuration = duration;
|
||||
a_func = func;
|
||||
a_opacity.start(0);
|
||||
|
|
|
@ -152,7 +152,7 @@ protected:
|
|||
private:
|
||||
void destroyDelayed();
|
||||
void moveByShift();
|
||||
void hideAnimated(float64 duration, anim::transition func);
|
||||
void hideAnimated(float64 duration, const anim::transition &func);
|
||||
void step_opacity(float64 ms, bool timer);
|
||||
void step_shift(float64 ms, bool timer);
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
|
||||
namespace Window {
|
||||
|
||||
PlayerWrapWidget::PlayerWrapWidget(QWidget *parent, base::lambda_unique<void()> updateCallback) : Parent(parent
|
||||
PlayerWrapWidget::PlayerWrapWidget(QWidget *parent, base::lambda<void()> &&updateCallback) : Parent(parent
|
||||
, new Media::Player::Widget(parent)
|
||||
, style::margins(0, 0, 0, 0)
|
||||
, std_::move(updateCallback)) {
|
||||
|
|
|
@ -13,7 +13,7 @@ class PlayerWrapWidget : public Ui::WidgetSlideWrap<Media::Player::Widget> {
|
|||
using Parent = Ui::WidgetSlideWrap<Media::Player::Widget>;
|
||||
|
||||
public:
|
||||
PlayerWrapWidget(QWidget *parent, base::lambda_unique<void()> updateCallback);
|
||||
PlayerWrapWidget(QWidget *parent, base::lambda<void()> &&updateCallback);
|
||||
|
||||
void updateAdaptiveLayout() {
|
||||
updateShadowGeometry();
|
||||
|
|
|
@ -35,10 +35,10 @@ public:
|
|||
void setPixmaps(const QPixmap &oldContentCache, const QPixmap &newContentCache);
|
||||
void setTopBarShadow(bool enabled);
|
||||
|
||||
using RepaintCallback = base::lambda_unique<void()>;
|
||||
using RepaintCallback = base::lambda<void()>;
|
||||
void setRepaintCallback(RepaintCallback &&callback);
|
||||
|
||||
using FinishedCallback = base::lambda_unique<void()>;
|
||||
using FinishedCallback = base::lambda<void()>;
|
||||
void setFinishedCallback(FinishedCallback &&callback);
|
||||
|
||||
void start();
|
||||
|
|
|
@ -126,7 +126,7 @@ void TopBarWidget::showMenu() {
|
|||
}
|
||||
});
|
||||
_menuToggle->installEventFilter(_menu);
|
||||
App::main()->fillPeerMenu(peer, [this](const QString &text, base::lambda_unique<void()> callback) {
|
||||
App::main()->fillPeerMenu(peer, [this](const QString &text, base::lambda<void()> &&callback) {
|
||||
return _menu->addAction(text, std_::move(callback));
|
||||
});
|
||||
_menu->moveToRight(st::topBarMenuPosition.x(), st::topBarMenuPosition.y());
|
||||
|
|
|
@ -33,7 +33,7 @@ class WarningWidget : public TWidget {
|
|||
public:
|
||||
WarningWidget(QWidget *parent);
|
||||
|
||||
void setHiddenCallback(base::lambda_unique<void()> callback) {
|
||||
void setHiddenCallback(base::lambda<void()> &&callback) {
|
||||
_hiddenCallback = std_::move(callback);
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ private:
|
|||
ChildWidget<Ui::RoundButton> _keepChanges;
|
||||
ChildWidget<Ui::RoundButton> _revert;
|
||||
|
||||
base::lambda_unique<void()> _hiddenCallback;
|
||||
base::lambda<void()> _hiddenCallback;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -207,7 +207,7 @@
|
|||
'<(src_loc)/core/click_handler.h',
|
||||
'<(src_loc)/core/click_handler_types.cpp',
|
||||
'<(src_loc)/core/click_handler_types.h',
|
||||
'<(src_loc)/core/lambda_wrap.h',
|
||||
'<(src_loc)/core/lambda.h',
|
||||
'<(src_loc)/core/observer.cpp',
|
||||
'<(src_loc)/core/observer.h',
|
||||
'<(src_loc)/core/ordered_set.h',
|
||||
|
|
Loading…
Reference in New Issue