mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-30 05:58:38 +00:00
Use base::weak_qptr / base::make_weak.
This commit is contained in:
parent
321c7120df
commit
b754ad5248
@ -245,7 +245,7 @@ void SendBotCallbackDataWithPassword(
|
|||||||
fields.customSubmitButton = tr::lng_passcode_submit();
|
fields.customSubmitButton = tr::lng_passcode_submit();
|
||||||
fields.customCheckCallback = [=](
|
fields.customCheckCallback = [=](
|
||||||
const Core::CloudPasswordResult &result,
|
const Core::CloudPasswordResult &result,
|
||||||
QPointer<PasscodeBox> box) {
|
base::weak_qptr<PasscodeBox> box) {
|
||||||
if (const auto button = getButton()) {
|
if (const auto button = getButton()) {
|
||||||
if (button->requestId) {
|
if (button->requestId) {
|
||||||
return;
|
return;
|
||||||
|
@ -57,7 +57,7 @@ void RemoveChatFilter(
|
|||||||
RemoveComplexChatFilter::RemoveComplexChatFilter() = default;
|
RemoveComplexChatFilter::RemoveComplexChatFilter() = default;
|
||||||
|
|
||||||
void RemoveComplexChatFilter::request(
|
void RemoveComplexChatFilter::request(
|
||||||
QPointer<Ui::RpWidget> widget,
|
base::weak_qptr<Ui::RpWidget> widget,
|
||||||
base::weak_ptr<Window::SessionController> weak,
|
base::weak_ptr<Window::SessionController> weak,
|
||||||
FilterId id) {
|
FilterId id) {
|
||||||
const auto session = &weak->session();
|
const auto session = &weak->session();
|
||||||
|
@ -22,7 +22,7 @@ public:
|
|||||||
RemoveComplexChatFilter();
|
RemoveComplexChatFilter();
|
||||||
|
|
||||||
void request(
|
void request(
|
||||||
QPointer<Ui::RpWidget> widget,
|
base::weak_qptr<Ui::RpWidget> widget,
|
||||||
base::weak_ptr<Window::SessionController> weak,
|
base::weak_ptr<Window::SessionController> weak,
|
||||||
FilterId id);
|
FilterId id);
|
||||||
|
|
||||||
|
@ -272,7 +272,7 @@ void ConfirmSubscriptionBox(
|
|||||||
}, balance->lifetime());
|
}, balance->lifetime());
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto sendCredits = [=, weak = Ui::MakeWeak(box)] {
|
const auto sendCredits = [=, weak = base::make_weak(box)] {
|
||||||
const auto show = box->uiShow();
|
const auto show = box->uiShow();
|
||||||
const auto buttonWidth = state->saveButton
|
const auto buttonWidth = state->saveButton
|
||||||
? state->saveButton->width()
|
? state->saveButton->width()
|
||||||
@ -280,7 +280,7 @@ void ConfirmSubscriptionBox(
|
|||||||
const auto finish = [=] {
|
const auto finish = [=] {
|
||||||
state->api = std::nullopt;
|
state->api = std::nullopt;
|
||||||
state->loading.force_assign(false);
|
state->loading.force_assign(false);
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -294,7 +294,7 @@ void ConfirmSubscriptionBox(
|
|||||||
}, [](const MTPDpayments_paymentVerificationNeeded &data) {
|
}, [](const MTPDpayments_paymentVerificationNeeded &data) {
|
||||||
});
|
});
|
||||||
const auto refill = session->data().activeCreditsSubsRebuilder();
|
const auto refill = session->data().activeCreditsSubsRebuilder();
|
||||||
const auto strong = weak.data();
|
const auto strong = weak.get();
|
||||||
if (!strong) {
|
if (!strong) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,7 @@ void ConfirmPhone::resolve(
|
|||||||
sentCodeLength,
|
sentCodeLength,
|
||||||
fragmentUrl,
|
fragmentUrl,
|
||||||
timeout);
|
timeout);
|
||||||
const auto boxWeak = Ui::MakeWeak(box.data());
|
const auto boxWeak = base::make_weak(box.data());
|
||||||
using LoginCode = rpl::event_stream<QString>;
|
using LoginCode = rpl::event_stream<QString>;
|
||||||
const auto codeHandles = box->lifetime().make_state<LoginCode>();
|
const auto codeHandles = box->lifetime().make_state<LoginCode>();
|
||||||
controller->session().account().setHandleLoginCode([=](
|
controller->session().account().setHandleLoginCode([=](
|
||||||
|
@ -82,7 +82,7 @@ void HandleWithdrawalButton(
|
|||||||
fields.customSubmitButton = tr::lng_passcode_submit();
|
fields.customSubmitButton = tr::lng_passcode_submit();
|
||||||
fields.customCheckCallback = crl::guard(button, [=](
|
fields.customCheckCallback = crl::guard(button, [=](
|
||||||
const Core::CloudPasswordResult &result,
|
const Core::CloudPasswordResult &result,
|
||||||
QPointer<PasscodeBox> box) {
|
base::weak_qptr<PasscodeBox> box) {
|
||||||
const auto done = [=](const QString &result) {
|
const auto done = [=](const QString &result) {
|
||||||
if (!result.isEmpty()) {
|
if (!result.isEmpty()) {
|
||||||
UrlClickHandler::Open(result);
|
UrlClickHandler::Open(result);
|
||||||
|
@ -223,7 +223,7 @@ void ConfirmApproval(
|
|||||||
.confirmText = tr::lng_suggest_accept_send(),
|
.confirmText = tr::lng_suggest_accept_send(),
|
||||||
.title = tr::lng_suggest_accept_title(),
|
.title = tr::lng_suggest_accept_title(),
|
||||||
});
|
});
|
||||||
*callback = [=, weak = Ui::MakeWeak(box)] {
|
*callback = [=, weak = base::make_weak(box)] {
|
||||||
if (const auto onstack = accepted) {
|
if (const auto onstack = accepted) {
|
||||||
onstack();
|
onstack();
|
||||||
}
|
}
|
||||||
@ -232,7 +232,7 @@ void ConfirmApproval(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SendApproval(show, item, scheduleDate);
|
SendApproval(show, item, scheduleDate);
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -283,9 +283,9 @@ void RequestApprovalDate(
|
|||||||
std::shared_ptr<Main::SessionShow> show,
|
std::shared_ptr<Main::SessionShow> show,
|
||||||
not_null<HistoryItem*> item) {
|
not_null<HistoryItem*> item) {
|
||||||
const auto id = item->fullId();
|
const auto id = item->fullId();
|
||||||
const auto weak = std::make_shared<QPointer<Ui::BoxContent>>();
|
const auto weak = std::make_shared<base::weak_qptr<Ui::BoxContent>>();
|
||||||
const auto close = [=] {
|
const auto close = [=] {
|
||||||
if (const auto strong = weak->data()) {
|
if (const auto strong = weak->get()) {
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -339,13 +339,13 @@ void RequestDeclineComment(
|
|||||||
box->setFocusCallback([=] {
|
box->setFocusCallback([=] {
|
||||||
reason->setFocusFast();
|
reason->setFocusFast();
|
||||||
});
|
});
|
||||||
*callback = [=, weak = Ui::MakeWeak(box)] {
|
*callback = [=, weak = base::make_weak(box)] {
|
||||||
const auto item = show->session().data().message(id);
|
const auto item = show->session().data().message(id);
|
||||||
if (!item) {
|
if (!item) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SendDecline(show, item, reason->getLastText().trimmed());
|
SendDecline(show, item, reason->getLastText().trimmed());
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -422,14 +422,14 @@ void SuggestApprovalDate(
|
|||||||
}
|
}
|
||||||
const auto id = item->fullId();
|
const auto id = item->fullId();
|
||||||
const auto state = std::make_shared<SendSuggestState>();
|
const auto state = std::make_shared<SendSuggestState>();
|
||||||
const auto weak = std::make_shared<QPointer<Ui::BoxContent>>();
|
const auto weak = std::make_shared<base::weak_qptr<Ui::BoxContent>>();
|
||||||
const auto done = [=](TimeId result) {
|
const auto done = [=](TimeId result) {
|
||||||
const auto item = show->session().data().message(id);
|
const auto item = show->session().data().message(id);
|
||||||
if (!item) {
|
if (!item) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto close = [=] {
|
const auto close = [=] {
|
||||||
if (const auto strong = weak->data()) {
|
if (const auto strong = weak->get()) {
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -458,14 +458,14 @@ void SuggestOfferForMessage(
|
|||||||
HistoryView::SuggestMode mode) {
|
HistoryView::SuggestMode mode) {
|
||||||
const auto id = item->fullId();
|
const auto id = item->fullId();
|
||||||
const auto state = std::make_shared<SendSuggestState>();
|
const auto state = std::make_shared<SendSuggestState>();
|
||||||
const auto weak = std::make_shared<QPointer<Ui::BoxContent>>();
|
const auto weak = std::make_shared<base::weak_qptr<Ui::BoxContent>>();
|
||||||
const auto done = [=](SuggestPostOptions result) {
|
const auto done = [=](SuggestPostOptions result) {
|
||||||
const auto item = show->session().data().message(id);
|
const auto item = show->session().data().message(id);
|
||||||
if (!item) {
|
if (!item) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto close = [=] {
|
const auto close = [=] {
|
||||||
if (const auto strong = weak->data()) {
|
if (const auto strong = weak->get()) {
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -240,13 +240,13 @@ struct State {
|
|||||||
[[nodiscard]] rpl::producer<Peers> WhoReadIds(
|
[[nodiscard]] rpl::producer<Peers> WhoReadIds(
|
||||||
not_null<HistoryItem*> item,
|
not_null<HistoryItem*> item,
|
||||||
not_null<QWidget*> context) {
|
not_null<QWidget*> context) {
|
||||||
auto weak = QPointer<QWidget>(context.get());
|
auto weak = base::make_weak(context);
|
||||||
const auto session = &item->history()->session();
|
const auto session = &item->history()->session();
|
||||||
return [=](auto consumer) {
|
return [=](auto consumer) {
|
||||||
if (!weak) {
|
if (!weak) {
|
||||||
return rpl::lifetime();
|
return rpl::lifetime();
|
||||||
}
|
}
|
||||||
const auto context = PreparedContextAt(weak.data(), session);
|
const auto context = PreparedContextAt(weak.get(), session);
|
||||||
auto &entry = context->cacheRead(item);
|
auto &entry = context->cacheRead(item);
|
||||||
if (entry.requestId) {
|
if (entry.requestId) {
|
||||||
} else if (const auto user = item->history()->peer->asUser()) {
|
} else if (const auto user = item->history()->peer->asUser()) {
|
||||||
@ -325,13 +325,13 @@ struct State {
|
|||||||
not_null<HistoryItem*> item,
|
not_null<HistoryItem*> item,
|
||||||
const ReactionId &reaction,
|
const ReactionId &reaction,
|
||||||
not_null<QWidget*> context) {
|
not_null<QWidget*> context) {
|
||||||
auto weak = QPointer<QWidget>(context.get());
|
auto weak = base::make_weak(context);
|
||||||
const auto session = &item->history()->session();
|
const auto session = &item->history()->session();
|
||||||
return [=](auto consumer) {
|
return [=](auto consumer) {
|
||||||
if (!weak) {
|
if (!weak) {
|
||||||
return rpl::lifetime();
|
return rpl::lifetime();
|
||||||
}
|
}
|
||||||
const auto context = PreparedContextAt(weak.data(), session);
|
const auto context = PreparedContextAt(weak.get(), session);
|
||||||
auto &entry = context->cacheReacted(item, reaction);
|
auto &entry = context->cacheReacted(item, reaction);
|
||||||
if (!entry.requestId) {
|
if (!entry.requestId) {
|
||||||
using Flag = MTPmessages_GetMessageReactionsList::Flag;
|
using Flag = MTPmessages_GetMessageReactionsList::Flag;
|
||||||
|
@ -37,11 +37,11 @@ void showBox(
|
|||||||
} // namespace internal
|
} // namespace internal
|
||||||
|
|
||||||
template <typename BoxType>
|
template <typename BoxType>
|
||||||
QPointer<BoxType> show(
|
base::weak_qptr<BoxType> show(
|
||||||
object_ptr<BoxType> content,
|
object_ptr<BoxType> content,
|
||||||
Ui::LayerOptions options = Ui::LayerOption::CloseOther,
|
Ui::LayerOptions options = Ui::LayerOption::CloseOther,
|
||||||
anim::type animated = anim::type::normal) {
|
anim::type animated = anim::type::normal) {
|
||||||
auto result = QPointer<BoxType>(content.data());
|
auto result = base::weak_qptr<BoxType>(content.data());
|
||||||
internal::showBox(std::move(content), options, animated);
|
internal::showBox(std::move(content), options, animated);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -194,16 +194,16 @@ void ShowAddParticipantsError(
|
|||||||
&& channel->canAddAdmins()) {
|
&& channel->canAddAdmins()) {
|
||||||
const auto makeAdmin = [=](Fn<void()> close) {
|
const auto makeAdmin = [=](Fn<void()> close) {
|
||||||
const auto user = forbidden.users.front();
|
const auto user = forbidden.users.front();
|
||||||
const auto weak = std::make_shared<QPointer<EditAdminBox>>();
|
const auto weak = std::make_shared<base::weak_qptr<EditAdminBox>>();
|
||||||
const auto done = [=](auto&&...) {
|
const auto done = [=](auto&&...) {
|
||||||
if (const auto strong = weak->data()) {
|
if (const auto strong = weak->get()) {
|
||||||
strong->uiShow()->showToast(
|
strong->uiShow()->showToast(
|
||||||
tr::lng_box_done(tr::now));
|
tr::lng_box_done(tr::now));
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const auto fail = [=] {
|
const auto fail = [=] {
|
||||||
if (const auto strong = weak->data()) {
|
if (const auto strong = weak->get()) {
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -446,7 +446,7 @@ void AddContactBox::save() {
|
|||||||
firstName = lastName;
|
firstName = lastName;
|
||||||
lastName = QString();
|
lastName = QString();
|
||||||
}
|
}
|
||||||
const auto weak = Ui::MakeWeak(this);
|
const auto weak = base::make_weak(this);
|
||||||
const auto session = _session;
|
const auto session = _session;
|
||||||
_sentName = firstName;
|
_sentName = firstName;
|
||||||
_contactId = base::RandomValue<uint64>();
|
_contactId = base::RandomValue<uint64>();
|
||||||
@ -716,7 +716,7 @@ TimeId GroupInfoBox::ttlPeriod() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GroupInfoBox::createGroup(
|
void GroupInfoBox::createGroup(
|
||||||
QPointer<Ui::BoxContent> selectUsersBox,
|
base::weak_qptr<Ui::BoxContent> selectUsersBox,
|
||||||
const QString &title,
|
const QString &title,
|
||||||
const std::vector<not_null<PeerData*>> &users) {
|
const std::vector<not_null<PeerData*>> &users) {
|
||||||
if (_creationRequestId) {
|
if (_creationRequestId) {
|
||||||
@ -750,8 +750,8 @@ void GroupInfoBox::createGroup(
|
|||||||
_creationRequestId = 0;
|
_creationRequestId = 0;
|
||||||
const auto controller = _navigation->parentController();
|
const auto controller = _navigation->parentController();
|
||||||
if (type == u"NO_CHAT_TITLE"_q) {
|
if (type == u"NO_CHAT_TITLE"_q) {
|
||||||
const auto weak = Ui::MakeWeak(this);
|
const auto weak = base::make_weak(this);
|
||||||
if (const auto strong = selectUsersBox.data()) {
|
if (const auto strong = selectUsersBox.get()) {
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
}
|
}
|
||||||
if (weak) {
|
if (weak) {
|
||||||
@ -792,10 +792,10 @@ void GroupInfoBox::submit() {
|
|||||||
} else if (_canAddBot) {
|
} else if (_canAddBot) {
|
||||||
createGroup(nullptr, title, { not_null<PeerData*>(_canAddBot) });
|
createGroup(nullptr, title, { not_null<PeerData*>(_canAddBot) });
|
||||||
} else {
|
} else {
|
||||||
auto initBox = [title, weak = Ui::MakeWeak(this)](
|
auto initBox = [title, weak = base::make_weak(this)](
|
||||||
not_null<PeerListBox*> box) {
|
not_null<PeerListBox*> box) {
|
||||||
auto create = [box, title, weak] {
|
auto create = [box, title, weak] {
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
strong->createGroup(
|
strong->createGroup(
|
||||||
box.get(),
|
box.get(),
|
||||||
title,
|
title,
|
||||||
|
@ -129,7 +129,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
void createChannel(const QString &title, const QString &description);
|
void createChannel(const QString &title, const QString &description);
|
||||||
void createGroup(
|
void createGroup(
|
||||||
QPointer<Ui::BoxContent> selectUsersBox,
|
base::weak_qptr<Ui::BoxContent> selectUsersBox,
|
||||||
const QString &title,
|
const QString &title,
|
||||||
const std::vector<not_null<PeerData*>> &users);
|
const std::vector<not_null<PeerData*>> &users);
|
||||||
void submitName();
|
void submitName();
|
||||||
|
@ -345,7 +345,7 @@ void BackgroundBox::resetForPeer() {
|
|||||||
api->applyUpdates(result);
|
api->applyUpdates(result);
|
||||||
}).send();
|
}).send();
|
||||||
|
|
||||||
const auto weak = Ui::MakeWeak(this);
|
const auto weak = base::make_weak(this);
|
||||||
_forPeer->setWallPaper({});
|
_forPeer->setWallPaper({});
|
||||||
if (weak) {
|
if (weak) {
|
||||||
_controller->finishChatThemeEdit(_forPeer);
|
_controller->finishChatThemeEdit(_forPeer);
|
||||||
@ -358,7 +358,7 @@ bool BackgroundBox::forChannel() const {
|
|||||||
|
|
||||||
void BackgroundBox::removePaper(const Data::WallPaper &paper) {
|
void BackgroundBox::removePaper(const Data::WallPaper &paper) {
|
||||||
const auto session = &_controller->session();
|
const auto session = &_controller->session();
|
||||||
const auto remove = [=, weak = Ui::MakeWeak(this)](Fn<void()> &&close) {
|
const auto remove = [=, weak = base::make_weak(this)](Fn<void()> &&close) {
|
||||||
close();
|
close();
|
||||||
if (weak) {
|
if (weak) {
|
||||||
weak->_inner->removePaper(paper);
|
weak->_inner->removePaper(paper);
|
||||||
|
@ -241,12 +241,12 @@ BackgroundPreviewBox::BackgroundPreviewBox(
|
|||||||
}, lifetime());
|
}, lifetime());
|
||||||
|
|
||||||
const auto prepare = [=](bool dark, auto pointer) {
|
const auto prepare = [=](bool dark, auto pointer) {
|
||||||
const auto weak = Ui::MakeWeak(this);
|
const auto weak = base::make_weak(this);
|
||||||
crl::async([=] {
|
crl::async([=] {
|
||||||
auto result = std::make_unique<style::palette>();
|
auto result = std::make_unique<style::palette>();
|
||||||
Window::Theme::PreparePaletteCallback(dark, {})(*result);
|
Window::Theme::PreparePaletteCallback(dark, {})(*result);
|
||||||
crl::on_main([=, result = std::move(result)]() mutable {
|
crl::on_main([=, result = std::move(result)]() mutable {
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
strong->*pointer = std::move(result);
|
strong->*pointer = std::move(result);
|
||||||
strong->paletteReady();
|
strong->paletteReady();
|
||||||
}
|
}
|
||||||
@ -685,7 +685,7 @@ void BackgroundPreviewBox::checkLevelForChannel() {
|
|||||||
|
|
||||||
const auto show = _controller->uiShow();
|
const auto show = _controller->uiShow();
|
||||||
_forPeerLevelCheck = true;
|
_forPeerLevelCheck = true;
|
||||||
const auto weak = Ui::MakeWeak(this);
|
const auto weak = base::make_weak(this);
|
||||||
CheckBoostLevel(show, _forPeer, [=](int level) {
|
CheckBoostLevel(show, _forPeer, [=](int level) {
|
||||||
if (!weak) {
|
if (!weak) {
|
||||||
return std::optional<Ui::AskBoostReason>();
|
return std::optional<Ui::AskBoostReason>();
|
||||||
|
@ -522,10 +522,10 @@ void DeleteMessagesBox::deleteAndClear() {
|
|||||||
? PaidPostType::None
|
? PaidPostType::None
|
||||||
: paidPostType();
|
: paidPostType();
|
||||||
if (warnPaidType != PaidPostType::None) {
|
if (warnPaidType != PaidPostType::None) {
|
||||||
const auto weak = Ui::MakeWeak(this);
|
const auto weak = base::make_weak(this);
|
||||||
const auto callback = [=](Fn<void()> close) {
|
const auto callback = [=](Fn<void()> close) {
|
||||||
close();
|
close();
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
strong->_confirmedDeletePaidSuggestedPosts = true;
|
strong->_confirmedDeletePaidSuggestedPosts = true;
|
||||||
strong->deleteAndClear();
|
strong->deleteAndClear();
|
||||||
}
|
}
|
||||||
@ -559,11 +559,11 @@ void DeleteMessagesBox::deleteAndClear() {
|
|||||||
const auto invokeCallbackAndClose = [&] {
|
const auto invokeCallbackAndClose = [&] {
|
||||||
// deleteMessages can initiate closing of the current section,
|
// deleteMessages can initiate closing of the current section,
|
||||||
// which will cause this box to be destroyed.
|
// which will cause this box to be destroyed.
|
||||||
const auto weak = Ui::MakeWeak(this);
|
const auto weak = base::make_weak(this);
|
||||||
if (const auto callback = _deleteConfirmedCallback) {
|
if (const auto callback = _deleteConfirmedCallback) {
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -282,7 +282,7 @@ auto AddButtonWithLoader(
|
|||||||
) | rpl::start_with_next([=](bool toggled) {
|
) | rpl::start_with_next([=](bool toggled) {
|
||||||
const auto &state = buttonState->current();
|
const auto &state = buttonState->current();
|
||||||
if (toggled && (v::is<Available>(state) || v::is<Failed>(state))) {
|
if (toggled && (v::is<Available>(state) || v::is<Failed>(state))) {
|
||||||
const auto weak = Ui::MakeWeak(button);
|
const auto weak = base::make_weak(button);
|
||||||
setLocalLoader(base::make_unique_q<Loader>(
|
setLocalLoader(base::make_unique_q<Loader>(
|
||||||
QCoreApplication::instance(),
|
QCoreApplication::instance(),
|
||||||
session,
|
session,
|
||||||
|
@ -1075,7 +1075,7 @@ void EditCaptionBox::save() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EditCaptionBox::closeAfterSave() {
|
void EditCaptionBox::closeAfterSave() {
|
||||||
const auto weak = MakeWeak(this);
|
const auto weak = base::make_weak(this);
|
||||||
if (_saved) {
|
if (_saved) {
|
||||||
_saved();
|
_saved();
|
||||||
}
|
}
|
||||||
|
@ -1313,9 +1313,9 @@ void EditDirectMessagesPriceBox(
|
|||||||
}, box->lifetime());
|
}, box->lifetime());
|
||||||
|
|
||||||
box->addButton(tr::lng_settings_save(), [=] {
|
box->addButton(tr::lng_settings_save(), [=] {
|
||||||
const auto weak = Ui::MakeWeak(box);
|
const auto weak = base::make_weak(box);
|
||||||
callback(toggle->toggled() ? *result : std::optional<int>());
|
callback(toggle->toggled() ? *result : std::optional<int>());
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -582,7 +582,7 @@ void LinkController::addLinkBlock(not_null<Ui::VerticalLayout*> container) {
|
|||||||
using namespace Settings;
|
using namespace Settings;
|
||||||
|
|
||||||
const auto link = _data.url;
|
const auto link = _data.url;
|
||||||
const auto weak = Ui::MakeWeak(container);
|
const auto weak = base::make_weak(container);
|
||||||
const auto copyLink = crl::guard(weak, [=] {
|
const auto copyLink = crl::guard(weak, [=] {
|
||||||
CopyInviteLink(delegate()->peerListUiShow(), link);
|
CopyInviteLink(delegate()->peerListUiShow(), link);
|
||||||
});
|
});
|
||||||
|
@ -49,7 +49,7 @@ void SetCloudPassword(
|
|||||||
session->api().cloudPassword().state(
|
session->api().cloudPassword().state(
|
||||||
) | rpl::start_with_next([=] {
|
) | rpl::start_with_next([=] {
|
||||||
using namespace Settings;
|
using namespace Settings;
|
||||||
const auto weak = Ui::MakeWeak(box);
|
const auto weak = base::make_weak(box);
|
||||||
if (CheckEditCloudPassword(session)) {
|
if (CheckEditCloudPassword(session)) {
|
||||||
box->getDelegate()->show(
|
box->getDelegate()->show(
|
||||||
EditCloudPasswordBox(session));
|
EditCloudPasswordBox(session));
|
||||||
@ -103,11 +103,11 @@ void StartPendingReset(
|
|||||||
not_null<Main::Session*> session,
|
not_null<Main::Session*> session,
|
||||||
not_null<Ui::BoxContent*> context,
|
not_null<Ui::BoxContent*> context,
|
||||||
Fn<void()> close) {
|
Fn<void()> close) {
|
||||||
const auto weak = Ui::MakeWeak(context.get());
|
const auto weak = base::make_weak(context.get());
|
||||||
auto lifetime = std::make_shared<rpl::lifetime>();
|
auto lifetime = std::make_shared<rpl::lifetime>();
|
||||||
|
|
||||||
auto finish = [=](const QString &message) mutable {
|
auto finish = [=](const QString &message) mutable {
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
if (!message.isEmpty()) {
|
if (!message.isEmpty()) {
|
||||||
strong->getDelegate()->show(Ui::MakeInformBox(message));
|
strong->getDelegate()->show(Ui::MakeInformBox(message));
|
||||||
}
|
}
|
||||||
@ -136,7 +136,7 @@ void StartPendingReset(
|
|||||||
: hours
|
: hours
|
||||||
? tr::lng_hours(tr::now, lt_count, hours)
|
? tr::lng_hours(tr::now, lt_count, hours)
|
||||||
: tr::lng_minutes(tr::now, lt_count, minutes);
|
: tr::lng_minutes(tr::now, lt_count, minutes);
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
strong->getDelegate()->show(Ui::MakeInformBox(
|
strong->getDelegate()->show(Ui::MakeInformBox(
|
||||||
tr::lng_cloud_password_reset_later(
|
tr::lng_cloud_password_reset_later(
|
||||||
tr::now,
|
tr::now,
|
||||||
@ -447,7 +447,7 @@ void PasscodeBox::recoverPasswordDone(
|
|||||||
_replacedBy->closeBox();
|
_replacedBy->closeBox();
|
||||||
}
|
}
|
||||||
_setRequest = 0;
|
_setRequest = 0;
|
||||||
const auto weak = Ui::MakeWeak(this);
|
const auto weak = base::make_weak(this);
|
||||||
_newAuthorization.fire_copy(result);
|
_newAuthorization.fire_copy(result);
|
||||||
if (weak) {
|
if (weak) {
|
||||||
_newPasswordSet.fire_copy(newPasswordBytes);
|
_newPasswordSet.fire_copy(newPasswordBytes);
|
||||||
@ -466,7 +466,7 @@ void PasscodeBox::setPasswordDone(const QByteArray &newPasswordBytes) {
|
|||||||
_replacedBy->closeBox();
|
_replacedBy->closeBox();
|
||||||
}
|
}
|
||||||
_setRequest = 0;
|
_setRequest = 0;
|
||||||
const auto weak = Ui::MakeWeak(this);
|
const auto weak = base::make_weak(this);
|
||||||
_newPasswordSet.fire_copy(newPasswordBytes);
|
_newPasswordSet.fire_copy(newPasswordBytes);
|
||||||
if (weak) {
|
if (weak) {
|
||||||
auto text = _reenterPasscode->isHidden()
|
auto text = _reenterPasscode->isHidden()
|
||||||
@ -567,9 +567,9 @@ void PasscodeBox::validateEmail(
|
|||||||
} else if (error.type() == u"CODE_INVALID"_q) {
|
} else if (error.type() == u"CODE_INVALID"_q) {
|
||||||
errors->fire(tr::lng_signin_wrong_code(tr::now));
|
errors->fire(tr::lng_signin_wrong_code(tr::now));
|
||||||
} else if (error.type() == u"EMAIL_HASH_EXPIRED"_q) {
|
} else if (error.type() == u"EMAIL_HASH_EXPIRED"_q) {
|
||||||
const auto weak = Ui::MakeWeak(this);
|
const auto weak = base::make_weak(this);
|
||||||
_clearUnconfirmedPassword.fire({});
|
_clearUnconfirmedPassword.fire({});
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
strong->getDelegate()->show(
|
strong->getDelegate()->show(
|
||||||
Ui::MakeInformBox(
|
Ui::MakeInformBox(
|
||||||
Lang::Hard::EmailConfirmationExpired()),
|
Lang::Hard::EmailConfirmationExpired()),
|
||||||
@ -607,7 +607,7 @@ void PasscodeBox::validateEmail(
|
|||||||
box->boxClosing(
|
box->boxClosing(
|
||||||
) | rpl::filter([=] {
|
) | rpl::filter([=] {
|
||||||
return !*set;
|
return !*set;
|
||||||
}) | start_with_next([=, weak = Ui::MakeWeak(this)] {
|
}) | start_with_next([=, weak = base::make_weak(this)] {
|
||||||
if (weak) {
|
if (weak) {
|
||||||
weak->_clearUnconfirmedPassword.fire({});
|
weak->_clearUnconfirmedPassword.fire({});
|
||||||
}
|
}
|
||||||
@ -710,7 +710,7 @@ void PasscodeBox::save(bool force) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
closeReplacedBy();
|
closeReplacedBy();
|
||||||
const auto weak = Ui::MakeWeak(this);
|
const auto weak = base::make_weak(this);
|
||||||
cSetPasscodeBadTries(0);
|
cSetPasscodeBadTries(0);
|
||||||
_session->domain().local().setPasscode(pwd.toUtf8());
|
_session->domain().local().setPasscode(pwd.toUtf8());
|
||||||
Core::App().localPasscodeChanged();
|
Core::App().localPasscodeChanged();
|
||||||
@ -742,7 +742,7 @@ void PasscodeBox::submitOnlyCheckCloudPassword(const QString &oldPassword) {
|
|||||||
void PasscodeBox::sendOnlyCheckCloudPassword(const QString &oldPassword) {
|
void PasscodeBox::sendOnlyCheckCloudPassword(const QString &oldPassword) {
|
||||||
checkPassword(oldPassword, [=](const Core::CloudPasswordResult &check) {
|
checkPassword(oldPassword, [=](const Core::CloudPasswordResult &check) {
|
||||||
if (const auto onstack = _cloudFields.customCheckCallback) {
|
if (const auto onstack = _cloudFields.customCheckCallback) {
|
||||||
onstack(check, Ui::MakeWeak(this));
|
onstack(check, base::make_weak(this));
|
||||||
} else {
|
} else {
|
||||||
Assert(_cloudFields.turningOff);
|
Assert(_cloudFields.turningOff);
|
||||||
sendClearCloudPassword(check);
|
sendClearCloudPassword(check);
|
||||||
@ -1105,7 +1105,7 @@ void PasscodeBox::recover() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto weak = Ui::MakeWeak(this);
|
const auto weak = base::make_weak(this);
|
||||||
const auto box = getDelegate()->show(Box<RecoverBox>(
|
const auto box = getDelegate()->show(Box<RecoverBox>(
|
||||||
&_api.instance(),
|
&_api.instance(),
|
||||||
_session,
|
_session,
|
||||||
@ -1343,7 +1343,7 @@ void RecoverBox::proceedToChange(const QString &code) {
|
|||||||
|
|
||||||
box->boxClosing(
|
box->boxClosing(
|
||||||
) | rpl::start_with_next([=] {
|
) | rpl::start_with_next([=] {
|
||||||
const auto weak = Ui::MakeWeak(this);
|
const auto weak = base::make_weak(this);
|
||||||
if (const auto onstack = _closeParent) {
|
if (const auto onstack = _closeParent) {
|
||||||
onstack();
|
onstack();
|
||||||
}
|
}
|
||||||
@ -1399,7 +1399,7 @@ RecoveryEmailValidation ConfirmRecoveryEmail(
|
|||||||
const auto errors = std::make_shared<rpl::event_stream<QString>>();
|
const auto errors = std::make_shared<rpl::event_stream<QString>>();
|
||||||
const auto resent = std::make_shared<rpl::event_stream<QString>>();
|
const auto resent = std::make_shared<rpl::event_stream<QString>>();
|
||||||
const auto requestId = std::make_shared<mtpRequestId>(0);
|
const auto requestId = std::make_shared<mtpRequestId>(0);
|
||||||
const auto weak = std::make_shared<QPointer<Ui::BoxContent>>();
|
const auto weak = std::make_shared<base::weak_qptr<Ui::BoxContent>>();
|
||||||
const auto reloads = std::make_shared<rpl::event_stream<>>();
|
const auto reloads = std::make_shared<rpl::event_stream<>>();
|
||||||
const auto cancels = std::make_shared<rpl::event_stream<>>();
|
const auto cancels = std::make_shared<rpl::event_stream<>>();
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ public:
|
|||||||
// Check cloud password for some action.
|
// Check cloud password for some action.
|
||||||
using CustomCheck = Fn<void(
|
using CustomCheck = Fn<void(
|
||||||
const Core::CloudPasswordResult &,
|
const Core::CloudPasswordResult &,
|
||||||
QPointer<PasscodeBox>)>;
|
base::weak_qptr<PasscodeBox>)>;
|
||||||
CustomCheck customCheckCallback;
|
CustomCheck customCheckCallback;
|
||||||
rpl::producer<QString> customTitle;
|
rpl::producer<QString> customTitle;
|
||||||
std::optional<QString> customDescription;
|
std::optional<QString> customDescription;
|
||||||
@ -158,7 +158,7 @@ private:
|
|||||||
|
|
||||||
QString _pattern;
|
QString _pattern;
|
||||||
|
|
||||||
QPointer<Ui::BoxContent> _replacedBy;
|
base::weak_qptr<Ui::BoxContent> _replacedBy;
|
||||||
bool _turningOff = false;
|
bool _turningOff = false;
|
||||||
bool _cloudPwd = false;
|
bool _cloudPwd = false;
|
||||||
CloudFields _cloudFields;
|
CloudFields _cloudFields;
|
||||||
|
@ -831,7 +831,7 @@ void ChooseRecipientBoxController::rowClicked(not_null<PeerListRow*> row) {
|
|||||||
auto guard = base::make_weak(this);
|
auto guard = base::make_weak(this);
|
||||||
const auto peer = row->peer();
|
const auto peer = row->peer();
|
||||||
if (const auto forum = peer->forum()) {
|
if (const auto forum = peer->forum()) {
|
||||||
const auto weak = std::make_shared<QPointer<Ui::BoxContent>>();
|
const auto weak = std::make_shared<base::weak_qptr<Ui::BoxContent>>();
|
||||||
auto callback = [=](not_null<Data::ForumTopic*> topic) {
|
auto callback = [=](not_null<Data::ForumTopic*> topic) {
|
||||||
const auto exists = guard.get();
|
const auto exists = guard.get();
|
||||||
if (!exists) {
|
if (!exists) {
|
||||||
@ -870,7 +870,7 @@ void ChooseRecipientBoxController::rowClicked(not_null<PeerListRow*> row) {
|
|||||||
delegate()->peerListUiShow()->showBox(std::move(owned));
|
delegate()->peerListUiShow()->showBox(std::move(owned));
|
||||||
return;
|
return;
|
||||||
} else if (const auto monoforum = peer->monoforum()) {
|
} else if (const auto monoforum = peer->monoforum()) {
|
||||||
const auto weak = std::make_shared<QPointer<Ui::BoxContent>>();
|
const auto weak = std::make_shared<base::weak_qptr<Ui::BoxContent>>();
|
||||||
auto callback = [=](not_null<Data::SavedSublist*> sublist) {
|
auto callback = [=](not_null<Data::SavedSublist*> sublist) {
|
||||||
const auto exists = guard.get();
|
const auto exists = guard.get();
|
||||||
if (!exists) {
|
if (!exists) {
|
||||||
|
@ -898,9 +898,9 @@ bool AddParticipantsBoxController::needsInviteLinkButton() {
|
|||||||
return _peer->asChat()->canHaveInviteLink();
|
return _peer->asChat()->canHaveInviteLink();
|
||||||
}
|
}
|
||||||
|
|
||||||
QPointer<Ui::BoxContent> AddParticipantsBoxController::showBox(
|
base::weak_qptr<Ui::BoxContent> AddParticipantsBoxController::showBox(
|
||||||
object_ptr<Ui::BoxContent> box) const {
|
object_ptr<Ui::BoxContent> box) const {
|
||||||
const auto weak = Ui::MakeWeak(box.data());
|
const auto weak = base::make_weak(box.data());
|
||||||
delegate()->peerListUiShow()->showBox(std::move(box));
|
delegate()->peerListUiShow()->showBox(std::move(box));
|
||||||
return weak;
|
return weak;
|
||||||
}
|
}
|
||||||
@ -976,7 +976,7 @@ void AddParticipantsBoxController::inviteSelectedUsers(
|
|||||||
tr::lng_participant_invite_history(),
|
tr::lng_participant_invite_history(),
|
||||||
true,
|
true,
|
||||||
st::defaultBoxCheckbox);
|
st::defaultBoxCheckbox);
|
||||||
const auto weak = Ui::MakeWeak(checkbox.data());
|
const auto weak = base::make_weak(checkbox.data());
|
||||||
|
|
||||||
auto text = (users.size() == 1)
|
auto text = (users.size() == 1)
|
||||||
? tr::lng_participant_invite_sure(
|
? tr::lng_participant_invite_sure(
|
||||||
@ -1205,9 +1205,9 @@ void AddSpecialBoxController::migrate(
|
|||||||
_additional.migrate(chat, channel);
|
_additional.migrate(chat, channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
QPointer<Ui::BoxContent> AddSpecialBoxController::showBox(
|
base::weak_qptr<Ui::BoxContent> AddSpecialBoxController::showBox(
|
||||||
object_ptr<Ui::BoxContent> box) const {
|
object_ptr<Ui::BoxContent> box) const {
|
||||||
const auto weak = Ui::MakeWeak(box.data());
|
const auto weak = base::make_weak(box.data());
|
||||||
delegate()->peerListUiShow()->showBox(std::move(box));
|
delegate()->peerListUiShow()->showBox(std::move(box));
|
||||||
return weak;
|
return weak;
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ private:
|
|||||||
base::flat_set<not_null<UserData*>> &&alreadyIn,
|
base::flat_set<not_null<UserData*>> &&alreadyIn,
|
||||||
bool justCreated);
|
bool justCreated);
|
||||||
|
|
||||||
QPointer<Ui::BoxContent> showBox(object_ptr<Ui::BoxContent> box) const;
|
base::weak_qptr<Ui::BoxContent> showBox(object_ptr<Ui::BoxContent> box) const;
|
||||||
|
|
||||||
void addInviteLinkButton();
|
void addInviteLinkButton();
|
||||||
void inviteSelectedUsers(
|
void inviteSelectedUsers(
|
||||||
@ -147,7 +147,7 @@ private:
|
|||||||
void subscribeToMigration();
|
void subscribeToMigration();
|
||||||
void migrate(not_null<ChatData*> chat, not_null<ChannelData*> channel);
|
void migrate(not_null<ChatData*> chat, not_null<ChannelData*> channel);
|
||||||
|
|
||||||
QPointer<Ui::BoxContent> showBox(object_ptr<Ui::BoxContent> box) const;
|
base::weak_qptr<Ui::BoxContent> showBox(object_ptr<Ui::BoxContent> box) const;
|
||||||
|
|
||||||
not_null<PeerData*> _peer;
|
not_null<PeerData*> _peer;
|
||||||
MTP::Sender _api;
|
MTP::Sender _api;
|
||||||
@ -158,7 +158,7 @@ private:
|
|||||||
ParticipantsAdditionalData _additional;
|
ParticipantsAdditionalData _additional;
|
||||||
std::unique_ptr<ParticipantsOnlineSorter> _onlineSorter;
|
std::unique_ptr<ParticipantsOnlineSorter> _onlineSorter;
|
||||||
Ui::BoxPointer _editBox;
|
Ui::BoxPointer _editBox;
|
||||||
QPointer<Ui::BoxContent> _editParticipantBox;
|
base::weak_qptr<Ui::BoxContent> _editParticipantBox;
|
||||||
AdminDoneCallback _adminDoneCallback;
|
AdminDoneCallback _adminDoneCallback;
|
||||||
BannedDoneCallback _bannedDoneCallback;
|
BannedDoneCallback _bannedDoneCallback;
|
||||||
|
|
||||||
|
@ -246,10 +246,10 @@ object_ptr<Ui::BoxContent> CreatePeerByQueryBox(
|
|||||||
not_null<UserData*> bot,
|
not_null<UserData*> bot,
|
||||||
RequestPeerQuery query,
|
RequestPeerQuery query,
|
||||||
Fn<void(std::vector<not_null<PeerData*>>)> done) {
|
Fn<void(std::vector<not_null<PeerData*>>)> done) {
|
||||||
const auto weak = std::make_shared<QPointer<Ui::BoxContent>>();
|
const auto weak = std::make_shared<base::weak_qptr<Ui::BoxContent>>();
|
||||||
auto callback = [=](not_null<PeerData*> peer) {
|
auto callback = [=](not_null<PeerData*> peer) {
|
||||||
done({ peer });
|
done({ peer });
|
||||||
if (const auto strong = weak->data()) {
|
if (const auto strong = weak->get()) {
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -506,11 +506,11 @@ void ShowChoosePeerBox(
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto weak = std::make_shared<QPointer<Ui::BoxContent>>();
|
const auto weak = std::make_shared<base::weak_qptr<Ui::BoxContent>>();
|
||||||
auto callback = [=, done = std::move(chosen)](
|
auto callback = [=, done = std::move(chosen)](
|
||||||
std::vector<not_null<PeerData*>> peers) {
|
std::vector<not_null<PeerData*>> peers) {
|
||||||
done(std::move(peers));
|
done(std::move(peers));
|
||||||
if (const auto strong = weak->data()) {
|
if (const auto strong = weak->get()) {
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -37,7 +37,7 @@ QString UserPhone(not_null<UserData*> user) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SendRequest(
|
void SendRequest(
|
||||||
QPointer<Ui::GenericBox> box,
|
base::weak_qptr<Ui::GenericBox> box,
|
||||||
not_null<UserData*> user,
|
not_null<UserData*> user,
|
||||||
bool sharePhone,
|
bool sharePhone,
|
||||||
const QString &first,
|
const QString &first,
|
||||||
@ -219,7 +219,7 @@ void Controller::initNameFields(
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
SendRequest(
|
SendRequest(
|
||||||
Ui::MakeWeak(_box),
|
base::make_weak(_box),
|
||||||
user,
|
user,
|
||||||
_sharePhone && _sharePhone->checked(),
|
_sharePhone && _sharePhone->checked(),
|
||||||
firstValue,
|
firstValue,
|
||||||
|
@ -554,7 +554,7 @@ void EditForumTopicBox(
|
|||||||
} else {
|
} else {
|
||||||
using Flag = MTPchannels_EditForumTopic::Flag;
|
using Flag = MTPchannels_EditForumTopic::Flag;
|
||||||
const auto api = &forum->session().api();
|
const auto api = &forum->session().api();
|
||||||
const auto weak = Ui::MakeWeak(box.get());
|
const auto weak = base::make_weak(box);
|
||||||
state->requestId = api->request(MTPchannels_EditForumTopic(
|
state->requestId = api->request(MTPchannels_EditForumTopic(
|
||||||
MTP_flags(Flag::f_title
|
MTP_flags(Flag::f_title
|
||||||
| (topic->isGeneral() ? Flag() : Flag::f_icon_emoji_id)),
|
| (topic->isGeneral() ? Flag() : Flag::f_icon_emoji_id)),
|
||||||
@ -566,11 +566,11 @@ void EditForumTopicBox(
|
|||||||
MTPBool() // hidden
|
MTPBool() // hidden
|
||||||
)).done([=](const MTPUpdates &result) {
|
)).done([=](const MTPUpdates &result) {
|
||||||
api->applyUpdates(result);
|
api->applyUpdates(result);
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
}
|
}
|
||||||
}).fail([=](const MTP::Error &error) {
|
}).fail([=](const MTP::Error &error) {
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
if (error.type() == u"TOPIC_NOT_MODIFIED") {
|
if (error.type() == u"TOPIC_NOT_MODIFIED") {
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
} else {
|
} else {
|
||||||
|
@ -450,9 +450,9 @@ void EditAdminBox::prepare() {
|
|||||||
if (!_saveCallback) {
|
if (!_saveCallback) {
|
||||||
return;
|
return;
|
||||||
} else if (_addAsAdmin && !_addAsAdmin->checked()) {
|
} else if (_addAsAdmin && !_addAsAdmin->checked()) {
|
||||||
const auto weak = Ui::MakeWeak(this);
|
const auto weak = base::make_weak(this);
|
||||||
AddBotToGroup(show, user(), peer(), _addingBot->token);
|
AddBotToGroup(show, user(), peer(), _addingBot->token);
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -661,7 +661,7 @@ void EditAdminBox::requestTransferPassword(not_null<ChannelData*> channel) {
|
|||||||
fields.customSubmitButton = tr::lng_passcode_submit();
|
fields.customSubmitButton = tr::lng_passcode_submit();
|
||||||
fields.customCheckCallback = crl::guard(this, [=](
|
fields.customCheckCallback = crl::guard(this, [=](
|
||||||
const Core::CloudPasswordResult &result,
|
const Core::CloudPasswordResult &result,
|
||||||
QPointer<PasscodeBox> box) {
|
base::weak_qptr<PasscodeBox> box) {
|
||||||
sendTransferRequestFrom(box, channel, result);
|
sendTransferRequestFrom(box, channel, result);
|
||||||
});
|
});
|
||||||
getDelegate()->show(Box<PasscodeBox>(&channel->session(), fields));
|
getDelegate()->show(Box<PasscodeBox>(&channel->session(), fields));
|
||||||
@ -669,13 +669,13 @@ void EditAdminBox::requestTransferPassword(not_null<ChannelData*> channel) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EditAdminBox::sendTransferRequestFrom(
|
void EditAdminBox::sendTransferRequestFrom(
|
||||||
QPointer<PasscodeBox> box,
|
base::weak_qptr<PasscodeBox> box,
|
||||||
not_null<ChannelData*> channel,
|
not_null<ChannelData*> channel,
|
||||||
const Core::CloudPasswordResult &result) {
|
const Core::CloudPasswordResult &result) {
|
||||||
if (_transferRequestId) {
|
if (_transferRequestId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto weak = Ui::MakeWeak(this);
|
const auto weak = base::make_weak(this);
|
||||||
const auto user = this->user();
|
const auto user = this->user();
|
||||||
const auto api = &channel->session().api();
|
const auto api = &channel->session().api();
|
||||||
_transferRequestId = api->request(MTPchannels_EditCreator(
|
_transferRequestId = api->request(MTPchannels_EditCreator(
|
||||||
@ -726,7 +726,7 @@ void EditAdminBox::sendTransferRequestFrom(
|
|||||||
|| type.startsWith(u"PASSWORD_TOO_FRESH_"_q)
|
|| type.startsWith(u"PASSWORD_TOO_FRESH_"_q)
|
||||||
|| type.startsWith(u"SESSION_TOO_FRESH_"_q);
|
|| type.startsWith(u"SESSION_TOO_FRESH_"_q);
|
||||||
}();
|
}();
|
||||||
const auto weak = Ui::MakeWeak(this);
|
const auto weak = base::make_weak(this);
|
||||||
getDelegate()->show(Ui::MakeInformBox(problem));
|
getDelegate()->show(Ui::MakeInformBox(problem));
|
||||||
if (box) {
|
if (box) {
|
||||||
box->closeBox();
|
box->closeBox();
|
||||||
|
@ -104,7 +104,7 @@ private:
|
|||||||
bool handleTransferPasswordError(const QString &error);
|
bool handleTransferPasswordError(const QString &error);
|
||||||
void requestTransferPassword(not_null<ChannelData*> channel);
|
void requestTransferPassword(not_null<ChannelData*> channel);
|
||||||
void sendTransferRequestFrom(
|
void sendTransferRequestFrom(
|
||||||
QPointer<PasscodeBox> box,
|
base::weak_qptr<PasscodeBox> box,
|
||||||
not_null<ChannelData*> channel,
|
not_null<ChannelData*> channel,
|
||||||
const Core::CloudPasswordResult &result);
|
const Core::CloudPasswordResult &result);
|
||||||
bool canSave() const {
|
bool canSave() const {
|
||||||
@ -124,7 +124,7 @@ private:
|
|||||||
ChatAdminRightsInfo,
|
ChatAdminRightsInfo,
|
||||||
const QString &rank)> _saveCallback;
|
const QString &rank)> _saveCallback;
|
||||||
|
|
||||||
QPointer<Ui::BoxContent> _confirmBox;
|
base::weak_qptr<Ui::BoxContent> _confirmBox;
|
||||||
Ui::Checkbox *_addAsAdmin = nullptr;
|
Ui::Checkbox *_addAsAdmin = nullptr;
|
||||||
Ui::SlideWrap<Ui::VerticalLayout> *_adminControlsWrap = nullptr;
|
Ui::SlideWrap<Ui::VerticalLayout> *_adminControlsWrap = nullptr;
|
||||||
Ui::InputField *_rank = nullptr;
|
Ui::InputField *_rank = nullptr;
|
||||||
|
@ -1324,9 +1324,9 @@ void ParticipantsBoxController::rebuild() {
|
|||||||
refreshRows();
|
refreshRows();
|
||||||
}
|
}
|
||||||
|
|
||||||
QPointer<Ui::BoxContent> ParticipantsBoxController::showBox(
|
base::weak_qptr<Ui::BoxContent> ParticipantsBoxController::showBox(
|
||||||
object_ptr<Ui::BoxContent> box) const {
|
object_ptr<Ui::BoxContent> box) const {
|
||||||
const auto weak = Ui::MakeWeak(box.data());
|
const auto weak = base::make_weak(box.data());
|
||||||
delegate()->peerListUiShow()->showBox(std::move(box));
|
delegate()->peerListUiShow()->showBox(std::move(box));
|
||||||
return weak;
|
return weak;
|
||||||
}
|
}
|
||||||
|
@ -240,7 +240,7 @@ private:
|
|||||||
Role role,
|
Role role,
|
||||||
not_null<ParticipantsAdditionalData*> additional);
|
not_null<ParticipantsAdditionalData*> additional);
|
||||||
|
|
||||||
QPointer<Ui::BoxContent> showBox(object_ptr<Ui::BoxContent> box) const;
|
base::weak_qptr<Ui::BoxContent> showBox(object_ptr<Ui::BoxContent> box) const;
|
||||||
|
|
||||||
void prepareChatRows(not_null<ChatData*> chat);
|
void prepareChatRows(not_null<ChatData*> chat);
|
||||||
void rebuildChatRows(not_null<ChatData*> chat);
|
void rebuildChatRows(not_null<ChatData*> chat);
|
||||||
@ -304,7 +304,7 @@ private:
|
|||||||
rpl::variable<int> _fullCountValue;
|
rpl::variable<int> _fullCountValue;
|
||||||
Ui::BoxPointer _editBox;
|
Ui::BoxPointer _editBox;
|
||||||
Ui::BoxPointer _addBox;
|
Ui::BoxPointer _addBox;
|
||||||
QPointer<Ui::BoxContent> _editParticipantBox;
|
base::weak_qptr<Ui::BoxContent> _editParticipantBox;
|
||||||
|
|
||||||
std::unique_ptr<PeerListStories> _stories;
|
std::unique_ptr<PeerListStories> _stories;
|
||||||
|
|
||||||
|
@ -906,7 +906,7 @@ void Controller::showEditDiscussionLinkBox() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto box = std::make_shared<QPointer<Ui::BoxContent>>();
|
const auto box = std::make_shared<base::weak_qptr<Ui::BoxContent>>();
|
||||||
const auto channel = _peer->asChannel();
|
const auto channel = _peer->asChannel();
|
||||||
const auto callback = [=](ChannelData *result) {
|
const auto callback = [=](ChannelData *result) {
|
||||||
if (*box) {
|
if (*box) {
|
||||||
@ -1252,12 +1252,12 @@ void Controller::fillAutoTranslateButton() {
|
|||||||
_autotranslateSavedValue = value;
|
_autotranslateSavedValue = value;
|
||||||
} else if (value) {
|
} else if (value) {
|
||||||
state->toggled.fire(false);
|
state->toggled.fire(false);
|
||||||
auto weak = Ui::MakeWeak(autotranslate);
|
auto weak = base::make_weak(autotranslate);
|
||||||
CheckBoostLevel(
|
CheckBoostLevel(
|
||||||
_navigation->uiShow(),
|
_navigation->uiShow(),
|
||||||
_peer,
|
_peer,
|
||||||
[=](int level) {
|
[=](int level) {
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
state->isLocked = (level < requiredLevel);
|
state->isLocked = (level < requiredLevel);
|
||||||
}
|
}
|
||||||
return (level < requiredLevel)
|
return (level < requiredLevel)
|
||||||
|
@ -424,7 +424,7 @@ void Controller::addHeaderBlock(not_null<Ui::VerticalLayout*> container) {
|
|||||||
const auto revoked = current.revoked;
|
const auto revoked = current.revoked;
|
||||||
const auto link = current.link;
|
const auto link = current.link;
|
||||||
const auto admin = current.admin;
|
const auto admin = current.admin;
|
||||||
const auto weak = Ui::MakeWeak(container);
|
const auto weak = base::make_weak(container);
|
||||||
const auto copyLink = crl::guard(weak, [=] {
|
const auto copyLink = crl::guard(weak, [=] {
|
||||||
CopyInviteLink(delegate()->peerListUiShow(), link);
|
CopyInviteLink(delegate()->peerListUiShow(), link);
|
||||||
});
|
});
|
||||||
@ -1290,7 +1290,7 @@ void AddPermanentLinkBlock(
|
|||||||
return LinkData{ link.link, link.usage };
|
return LinkData{ link.link, link.usage };
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
const auto weak = Ui::MakeWeak(container);
|
const auto weak = base::make_weak(container);
|
||||||
const auto copyLink = crl::guard(weak, [=] {
|
const auto copyLink = crl::guard(weak, [=] {
|
||||||
if (const auto current = value->current(); !current.link.isEmpty()) {
|
if (const auto current = value->current(); !current.link.isEmpty()) {
|
||||||
CopyInviteLink(show, current.link);
|
CopyInviteLink(show, current.link);
|
||||||
@ -1471,7 +1471,7 @@ object_ptr<Ui::BoxContent> ShareInviteLinkBox(
|
|||||||
const QString &link,
|
const QString &link,
|
||||||
const QString &copied) {
|
const QString &copied) {
|
||||||
const auto sending = std::make_shared<bool>();
|
const auto sending = std::make_shared<bool>();
|
||||||
const auto box = std::make_shared<QPointer<ShareBox>>();
|
const auto box = std::make_shared<base::weak_qptr<ShareBox>>();
|
||||||
|
|
||||||
const auto showToast = [=](const QString &text) {
|
const auto showToast = [=](const QString &text) {
|
||||||
if (*box) {
|
if (*box) {
|
||||||
@ -1551,7 +1551,7 @@ object_ptr<Ui::BoxContent> ShareInviteLinkBox(
|
|||||||
.filterCallback = std::move(filterCallback),
|
.filterCallback = std::move(filterCallback),
|
||||||
.moneyRestrictionError = ShareMessageMoneyRestrictionError(),
|
.moneyRestrictionError = ShareMessageMoneyRestrictionError(),
|
||||||
});
|
});
|
||||||
*box = Ui::MakeWeak(object.data());
|
*box = base::make_weak(object.data());
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1573,7 +1573,7 @@ object_ptr<Ui::BoxContent> EditLinkBox(
|
|||||||
constexpr auto kPeriod = 3600 * 24 * 30;
|
constexpr auto kPeriod = 3600 * 24 * 30;
|
||||||
constexpr auto kTestModePeriod = 300;
|
constexpr auto kTestModePeriod = 300;
|
||||||
const auto creating = data.link.isEmpty();
|
const auto creating = data.link.isEmpty();
|
||||||
const auto box = std::make_shared<QPointer<Ui::GenericBox>>();
|
const auto box = std::make_shared<base::weak_qptr<Ui::GenericBox>>();
|
||||||
using Fields = Ui::InviteLinkFields;
|
using Fields = Ui::InviteLinkFields;
|
||||||
const auto done = [=](Fields result) {
|
const auto done = [=](Fields result) {
|
||||||
const auto finish = [=](Api::InviteLink finished) {
|
const auto finish = [=](Api::InviteLink finished) {
|
||||||
@ -1645,7 +1645,7 @@ object_ptr<Ui::BoxContent> EditLinkBox(
|
|||||||
done);
|
done);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
*box = Ui::MakeWeak(object.data());
|
*box = base::make_weak(object.data());
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,11 +127,11 @@ void Controller::confirmAdd(not_null<PeerData*> peer) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
state->sent = true;
|
state->sent = true;
|
||||||
const auto weak = Ui::MakeWeak(box);
|
const auto weak = base::make_weak(box);
|
||||||
const auto description = modify ? state->description : QString();
|
const auto description = modify ? state->description : QString();
|
||||||
Setup(bot, peer, description, [=](QString error) {
|
Setup(bot, peer, description, [=](QString error) {
|
||||||
if (error.isEmpty()) {
|
if (error.isEmpty()) {
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
}
|
}
|
||||||
show->showToast({
|
show->showToast({
|
||||||
@ -204,10 +204,10 @@ void Controller::confirmRemove(not_null<PeerData*> peer) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
*sent = true;
|
*sent = true;
|
||||||
const auto weak = Ui::MakeWeak(box);
|
const auto weak = base::make_weak(box);
|
||||||
Remove(bot, peer, [=](QString error) {
|
Remove(bot, peer, [=](QString error) {
|
||||||
if (error.isEmpty()) {
|
if (error.isEmpty()) {
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
}
|
}
|
||||||
show->showToast(tr::lng_bot_verify_remove_done(tr::now));
|
show->showToast(tr::lng_bot_verify_remove_done(tr::now));
|
||||||
|
@ -49,7 +49,7 @@ Locale: ") + ::Platform::SystemLanguage();
|
|||||||
void ShowPhoneBannedError(
|
void ShowPhoneBannedError(
|
||||||
not_null<Window::Controller*> controller,
|
not_null<Window::Controller*> controller,
|
||||||
const QString &phone) {
|
const QString &phone) {
|
||||||
const auto box = std::make_shared<QPointer<Ui::BoxContent>>();
|
const auto box = std::make_shared<base::weak_qptr<Ui::BoxContent>>();
|
||||||
const auto close = [=] {
|
const auto close = [=] {
|
||||||
if (*box) {
|
if (*box) {
|
||||||
(*box)->closeBox();
|
(*box)->closeBox();
|
||||||
|
@ -50,8 +50,8 @@ void PinMessageBox(
|
|||||||
not_null<Ui::GenericBox*> box,
|
not_null<Ui::GenericBox*> box,
|
||||||
not_null<HistoryItem*> item) {
|
not_null<HistoryItem*> item) {
|
||||||
struct State {
|
struct State {
|
||||||
QPointer<Ui::Checkbox> pinForPeer;
|
base::weak_qptr<Ui::Checkbox> pinForPeer;
|
||||||
QPointer<Ui::Checkbox> notify;
|
base::weak_qptr<Ui::Checkbox> notify;
|
||||||
mtpRequestId requestId = 0;
|
mtpRequestId requestId = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ void PinMessageBox(
|
|||||||
false,
|
false,
|
||||||
st::urlAuthCheckbox);
|
st::urlAuthCheckbox);
|
||||||
object->setAllowTextLines();
|
object->setAllowTextLines();
|
||||||
state->pinForPeer = Ui::MakeWeak(object.data());
|
state->pinForPeer = base::make_weak(object.data());
|
||||||
return object;
|
return object;
|
||||||
} else if (!pinningOld
|
} else if (!pinningOld
|
||||||
&& (peer->isChat() || peer->isMegagroup())
|
&& (peer->isChat() || peer->isMegagroup())
|
||||||
@ -92,7 +92,7 @@ void PinMessageBox(
|
|||||||
true,
|
true,
|
||||||
st::urlAuthCheckbox);
|
st::urlAuthCheckbox);
|
||||||
object->setAllowTextLines();
|
object->setAllowTextLines();
|
||||||
state->notify = Ui::MakeWeak(object.data());
|
state->notify = base::make_weak(object.data());
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
return { nullptr };
|
return { nullptr };
|
||||||
|
@ -56,7 +56,7 @@ void AddDeleteAccount(
|
|||||||
fields.customSubmitButton = tr::lng_theme_delete();
|
fields.customSubmitButton = tr::lng_theme_delete();
|
||||||
fields.customCheckCallback = [=](
|
fields.customCheckCallback = [=](
|
||||||
const Core::CloudPasswordResult &result,
|
const Core::CloudPasswordResult &result,
|
||||||
QPointer<PasscodeBox> box) {
|
base::weak_qptr<PasscodeBox> box) {
|
||||||
session->api().request(MTPaccount_DeleteAccount(
|
session->api().request(MTPaccount_DeleteAccount(
|
||||||
MTP_flags(MTPaccount_DeleteAccount::Flag::f_password),
|
MTP_flags(MTPaccount_DeleteAccount::Flag::f_password),
|
||||||
MTP_string("Manual"),
|
MTP_string("Manual"),
|
||||||
|
@ -397,7 +397,7 @@ void SendCreditsBox(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto show = box->uiShow();
|
const auto show = box->uiShow();
|
||||||
const auto weak = MakeWeak(box.get());
|
const auto weak = base::make_weak(box.get());
|
||||||
state->confirmButtonBusy = true;
|
state->confirmButtonBusy = true;
|
||||||
session->api().request(
|
session->api().request(
|
||||||
MTPpayments_SendStarsForm(
|
MTPpayments_SendStarsForm(
|
||||||
@ -422,7 +422,7 @@ void SendCreditsBox(
|
|||||||
auto error = ::Ui::MakeInformBox(
|
auto error = ::Ui::MakeInformBox(
|
||||||
tr::lng_payments_precheckout_stars_failed(tr::now));
|
tr::lng_payments_precheckout_stars_failed(tr::now));
|
||||||
error->boxClosing() | rpl::start_with_next([=] {
|
error->boxClosing() | rpl::start_with_next([=] {
|
||||||
if (const auto paybox = weak.data()) {
|
if (const auto paybox = weak.get()) {
|
||||||
paybox->closeBox();
|
paybox->closeBox();
|
||||||
}
|
}
|
||||||
}, error->lifetime());
|
}, error->lifetime());
|
||||||
|
@ -175,9 +175,9 @@ void EditPriceBox(
|
|||||||
field->showError();
|
field->showError();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto weak = Ui::MakeWeak(box);
|
const auto weak = base::make_weak(box);
|
||||||
apply(now);
|
apply(now);
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -597,7 +597,7 @@ void SendFilesBox::enqueueNextPrepare() {
|
|||||||
}
|
}
|
||||||
auto file = std::move(_list.filesToProcess.front());
|
auto file = std::move(_list.filesToProcess.front());
|
||||||
_list.filesToProcess.pop_front();
|
_list.filesToProcess.pop_front();
|
||||||
const auto weak = Ui::MakeWeak(this);
|
const auto weak = base::make_weak(this);
|
||||||
_preparing = true;
|
_preparing = true;
|
||||||
const auto sideLimit = PhotoSideLimit(); // Get on main thread.
|
const auto sideLimit = PhotoSideLimit(); // Get on main thread.
|
||||||
crl::async([weak, sideLimit, file = std::move(file)]() mutable {
|
crl::async([weak, sideLimit, file = std::move(file)]() mutable {
|
||||||
@ -803,7 +803,7 @@ void SendFilesBox::toggleSpoilers(bool enabled) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SendFilesBox::changePrice() {
|
void SendFilesBox::changePrice() {
|
||||||
const auto weak = Ui::MakeWeak(this);
|
const auto weak = base::make_weak(this);
|
||||||
const auto session = &_show->session();
|
const auto session = &_show->session();
|
||||||
const auto now = _price.current();
|
const auto now = _price.current();
|
||||||
_show->show(Box(EditPriceBox, session, now, [=](uint64 price) {
|
_show->show(Box(EditPriceBox, session, now, [=](uint64 price) {
|
||||||
|
@ -677,7 +677,7 @@ void ShareBox::submit(Api::SendOptions options) {
|
|||||||
_submitLifetime.destroy();
|
_submitLifetime.destroy();
|
||||||
|
|
||||||
auto threads = _inner->selected();
|
auto threads = _inner->selected();
|
||||||
const auto weak = Ui::MakeWeak(this);
|
const auto weak = base::make_weak(this);
|
||||||
const auto field = _comment->entity();
|
const auto field = _comment->entity();
|
||||||
auto comment = field->getTextWithAppliedMarkdown();
|
auto comment = field->getTextWithAppliedMarkdown();
|
||||||
const auto checkPaid = [=] {
|
const auto checkPaid = [=] {
|
||||||
@ -1371,8 +1371,8 @@ void ShareBox::Inner::changeCheckState(Chat *chat) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ShareBox::Inner::chooseForumTopic(not_null<Data::Forum*> forum) {
|
void ShareBox::Inner::chooseForumTopic(not_null<Data::Forum*> forum) {
|
||||||
const auto guard = Ui::MakeWeak(this);
|
const auto guard = base::make_weak(this);
|
||||||
const auto weak = std::make_shared<QPointer<Ui::BoxContent>>();
|
const auto weak = std::make_shared<base::weak_qptr<Ui::BoxContent>>();
|
||||||
auto chosen = [=](not_null<Data::ForumTopic*> topic) {
|
auto chosen = [=](not_null<Data::ForumTopic*> topic) {
|
||||||
if (const auto strong = *weak) {
|
if (const auto strong = *weak) {
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
@ -1419,8 +1419,8 @@ void ShareBox::Inner::chooseForumTopic(not_null<Data::Forum*> forum) {
|
|||||||
|
|
||||||
void ShareBox::Inner::chooseMonoforumSublist(
|
void ShareBox::Inner::chooseMonoforumSublist(
|
||||||
not_null<Data::SavedMessages*> monoforum) {
|
not_null<Data::SavedMessages*> monoforum) {
|
||||||
const auto guard = Ui::MakeWeak(this);
|
const auto guard = base::make_weak(this);
|
||||||
const auto weak = std::make_shared<QPointer<Ui::BoxContent>>();
|
const auto weak = std::make_shared<base::weak_qptr<Ui::BoxContent>>();
|
||||||
auto chosen = [=](not_null<Data::SavedSublist*> sublist) {
|
auto chosen = [=](not_null<Data::SavedSublist*> sublist) {
|
||||||
if (const auto strong = *weak) {
|
if (const auto strong = *weak) {
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
@ -1953,7 +1953,7 @@ void FastShareLink(
|
|||||||
std::shared_ptr<Main::SessionShow> show,
|
std::shared_ptr<Main::SessionShow> show,
|
||||||
const QString &url,
|
const QString &url,
|
||||||
ShareBoxStyleOverrides st) {
|
ShareBoxStyleOverrides st) {
|
||||||
const auto box = std::make_shared<QPointer<Ui::BoxContent>>();
|
const auto box = std::make_shared<base::weak_qptr<Ui::BoxContent>>();
|
||||||
const auto sending = std::make_shared<bool>();
|
const auto sending = std::make_shared<bool>();
|
||||||
auto copyCallback = [=] {
|
auto copyCallback = [=] {
|
||||||
QGuiApplication::clipboard()->setText(url);
|
QGuiApplication::clipboard()->setText(url);
|
||||||
|
@ -2516,7 +2516,7 @@ void SendGiftBox(
|
|||||||
if (!state->messageAllowed.current()) {
|
if (!state->messageAllowed.current()) {
|
||||||
details.text = {};
|
details.text = {};
|
||||||
}
|
}
|
||||||
const auto weak = MakeWeak(box);
|
const auto weak = base::make_weak(box);
|
||||||
const auto done = [=](Payments::CheckoutResult result) {
|
const auto done = [=](Payments::CheckoutResult result) {
|
||||||
if (result == Payments::CheckoutResult::Paid) {
|
if (result == Payments::CheckoutResult::Paid) {
|
||||||
if (details.byStars
|
if (details.byStars
|
||||||
@ -2527,7 +2527,7 @@ void SendGiftBox(
|
|||||||
window->showPeerHistory(peer);
|
window->showPeerHistory(peer);
|
||||||
ShowSentToast(window, details.descriptor, details);
|
ShowSentToast(window, details.descriptor, details);
|
||||||
}
|
}
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -4337,12 +4337,12 @@ void ShowUniqueGiftWearBox(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
*checking = true;
|
*checking = true;
|
||||||
const auto weak = Ui::MakeWeak(box);
|
const auto weak = base::make_weak(box);
|
||||||
CheckBoostLevel(show, peer, [=](int level) {
|
CheckBoostLevel(show, peer, [=](int level) {
|
||||||
const auto limits = Data::LevelLimits(&peer->session());
|
const auto limits = Data::LevelLimits(&peer->session());
|
||||||
const auto wanted = limits.channelEmojiStatusLevelMin();
|
const auto wanted = limits.channelEmojiStatusLevelMin();
|
||||||
if (level >= wanted) {
|
if (level >= wanted) {
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
}
|
}
|
||||||
emojiStatuses->set(peer, id);
|
emojiStatuses->set(peer, id);
|
||||||
@ -4835,13 +4835,13 @@ void UpgradeBox(
|
|||||||
}
|
}
|
||||||
state->sent = true;
|
state->sent = true;
|
||||||
const auto keepDetails = state->preserveDetails;
|
const auto keepDetails = state->preserveDetails;
|
||||||
const auto weak = Ui::MakeWeak(box);
|
const auto weak = base::make_weak(box);
|
||||||
const auto done = [=](Payments::CheckoutResult result) {
|
const auto done = [=](Payments::CheckoutResult result) {
|
||||||
if (result != Payments::CheckoutResult::Paid) {
|
if (result != Payments::CheckoutResult::Paid) {
|
||||||
state->sent = false;
|
state->sent = false;
|
||||||
} else {
|
} else {
|
||||||
controller->showPeerHistory(args.peer);
|
controller->showPeerHistory(args.peer);
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -494,7 +494,7 @@ StickerSetBox::StickerSetBox(
|
|||||||
: StickerSetBox(parent, std::move(show), set->identifier(), set->type()) {
|
: StickerSetBox(parent, std::move(show), set->identifier(), set->type()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
QPointer<Ui::BoxContent> StickerSetBox::Show(
|
base::weak_qptr<Ui::BoxContent> StickerSetBox::Show(
|
||||||
std::shared_ptr<ChatHelpers::Show> show,
|
std::shared_ptr<ChatHelpers::Show> show,
|
||||||
not_null<DocumentData*> document) {
|
not_null<DocumentData*> document) {
|
||||||
if (const auto sticker = document->sticker()) {
|
if (const auto sticker = document->sticker()) {
|
||||||
@ -503,7 +503,7 @@ QPointer<Ui::BoxContent> StickerSetBox::Show(
|
|||||||
show,
|
show,
|
||||||
sticker->set,
|
sticker->set,
|
||||||
sticker->setType);
|
sticker->setType);
|
||||||
const auto result = QPointer<Ui::BoxContent>(box.data());
|
const auto result = base::make_weak(box.data());
|
||||||
show->showBox(std::move(box));
|
show->showBox(std::move(box));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -1485,7 +1485,7 @@ void StickerSetBox::Inner::fillDeleteStickerBox(
|
|||||||
int index) {
|
int index) {
|
||||||
Expects(index >= 0 || index < _pack.size());
|
Expects(index >= 0 || index < _pack.size());
|
||||||
const auto document = _pack[index];
|
const auto document = _pack[index];
|
||||||
const auto weak = Ui::MakeWeak(this);
|
const auto weak = base::make_weak(this);
|
||||||
const auto show = _show;
|
const auto show = _show;
|
||||||
|
|
||||||
const auto container = box->verticalLayout();
|
const auto container = box->verticalLayout();
|
||||||
@ -1510,7 +1510,7 @@ void StickerSetBox::Inner::fillDeleteStickerBox(
|
|||||||
sticker->paintRequest(
|
sticker->paintRequest(
|
||||||
) | rpl::start_with_next([=] {
|
) | rpl::start_with_next([=] {
|
||||||
auto p = Painter(sticker);
|
auto p = Painter(sticker);
|
||||||
if ([[maybe_unused]] const auto strong = weak.data()) {
|
if ([[maybe_unused]] const auto strong = weak.get()) {
|
||||||
const auto paused = On(PowerSaving::kStickersPanel)
|
const auto paused = On(PowerSaving::kStickersPanel)
|
||||||
|| show->paused(ChatHelpers::PauseReason::Layer);
|
|| show->paused(ChatHelpers::PauseReason::Layer);
|
||||||
paintSticker(p, index, QPoint(), paused, crl::now());
|
paintSticker(p, index, QPoint(), paused, crl::now());
|
||||||
@ -1551,7 +1551,7 @@ void StickerSetBox::Inner::fillDeleteStickerBox(
|
|||||||
if (state->requestId.current()) {
|
if (state->requestId.current()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto weakBox = Ui::MakeWeak(box);
|
const auto weakBox = base::make_weak(box);
|
||||||
const auto buttonWidth = state->saveButton
|
const auto buttonWidth = state->saveButton
|
||||||
? state->saveButton->width()
|
? state->saveButton->width()
|
||||||
: 0;
|
: 0;
|
||||||
@ -1564,14 +1564,14 @@ void StickerSetBox::Inner::fillDeleteStickerBox(
|
|||||||
Data::StickersType::Stickers);
|
Data::StickersType::Stickers);
|
||||||
}, [](const auto &) {
|
}, [](const auto &) {
|
||||||
});
|
});
|
||||||
if ([[maybe_unused]] const auto strong = weak.data()) {
|
if ([[maybe_unused]] const auto strong = weak.get()) {
|
||||||
applySet(result);
|
applySet(result);
|
||||||
}
|
}
|
||||||
if (const auto strongBox = weakBox.data()) {
|
if (const auto strongBox = weakBox.get()) {
|
||||||
strongBox->closeBox();
|
strongBox->closeBox();
|
||||||
}
|
}
|
||||||
}).fail([=](const MTP::Error &error) {
|
}).fail([=](const MTP::Error &error) {
|
||||||
if (const auto strongBox = weakBox.data()) {
|
if (const auto strongBox = weakBox.get()) {
|
||||||
strongBox->uiShow()->showToast(error.type());
|
strongBox->uiShow()->showToast(error.type());
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
|
@ -70,7 +70,7 @@ public:
|
|||||||
std::shared_ptr<ChatHelpers::Show> show,
|
std::shared_ptr<ChatHelpers::Show> show,
|
||||||
not_null<Data::StickersSet*> set);
|
not_null<Data::StickersSet*> set);
|
||||||
|
|
||||||
static QPointer<Ui::BoxContent> Show(
|
static base::weak_qptr<Ui::BoxContent> Show(
|
||||||
std::shared_ptr<ChatHelpers::Show> show,
|
std::shared_ptr<ChatHelpers::Show> show,
|
||||||
not_null<DocumentData*> document);
|
not_null<DocumentData*> document);
|
||||||
|
|
||||||
|
@ -2058,7 +2058,7 @@ void StickersBox::Inner::checkGroupLevel(Fn<void()> done) {
|
|||||||
}
|
}
|
||||||
_checkingGroupLevel = true;
|
_checkingGroupLevel = true;
|
||||||
|
|
||||||
const auto weak = Ui::MakeWeak(this);
|
const auto weak = base::make_weak(this);
|
||||||
CheckBoostLevel(_show, peer, [=](int level) {
|
CheckBoostLevel(_show, peer, [=](int level) {
|
||||||
if (!weak) {
|
if (!weak) {
|
||||||
return std::optional<Ui::AskBoostReason>();
|
return std::optional<Ui::AskBoostReason>();
|
||||||
|
@ -90,8 +90,8 @@ void ConfirmExportBox(
|
|||||||
Ui::Text::WithEntities),
|
Ui::Text::WithEntities),
|
||||||
st::boxLabel));
|
st::boxLabel));
|
||||||
box->addButton(tr::lng_gift_transfer_confirm_button(), [=] {
|
box->addButton(tr::lng_gift_transfer_confirm_button(), [=] {
|
||||||
confirmed([weak = Ui::MakeWeak(box)] {
|
confirmed([weak = base::make_weak(box)] {
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -143,7 +143,7 @@ void ExportOnBlockchain(
|
|||||||
fields.customSubmitButton = tr::lng_passcode_submit();
|
fields.customSubmitButton = tr::lng_passcode_submit();
|
||||||
fields.customCheckCallback = crl::guard(parent, [=](
|
fields.customCheckCallback = crl::guard(parent, [=](
|
||||||
const Core::CloudPasswordResult &result,
|
const Core::CloudPasswordResult &result,
|
||||||
QPointer<PasscodeBox> box) {
|
base::weak_qptr<PasscodeBox> box) {
|
||||||
using ExportUrl = MTPpayments_StarGiftWithdrawalUrl;
|
using ExportUrl = MTPpayments_StarGiftWithdrawalUrl;
|
||||||
session->api().request(
|
session->api().request(
|
||||||
MTPpayments_GetStarGiftWithdrawalUrl(
|
MTPpayments_GetStarGiftWithdrawalUrl(
|
||||||
@ -180,7 +180,7 @@ void ExportOnBlockchain(
|
|||||||
const auto state = std::make_shared<State>();
|
const auto state = std::make_shared<State>();
|
||||||
const auto activate = [=] {
|
const auto activate = [=] {
|
||||||
const auto now = base::unixtime::now();
|
const auto now = base::unixtime::now();
|
||||||
const auto weak = Ui::MakeWeak(box);
|
const auto weak = base::make_weak(box);
|
||||||
const auto left = (when > now) ? (when - now) : 0;
|
const auto left = (when > now) ? (when - now) : 0;
|
||||||
const auto hours = left ? std::max((left + 1800) / 3600, 1) : 0;
|
const auto hours = left ? std::max((left + 1800) / 3600, 1) : 0;
|
||||||
if (!hours) {
|
if (!hours) {
|
||||||
@ -193,7 +193,7 @@ void ExportOnBlockchain(
|
|||||||
state->exporting = false;
|
state->exporting = false;
|
||||||
close();
|
close();
|
||||||
}, [=] {
|
}, [=] {
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
}
|
}
|
||||||
close();
|
close();
|
||||||
@ -572,11 +572,11 @@ void ShowTransferToBox(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
state->sent = true;
|
state->sent = true;
|
||||||
const auto weak = Ui::MakeWeak(box);
|
const auto weak = base::make_weak(box);
|
||||||
const auto done = [=](Payments::CheckoutResult result) {
|
const auto done = [=](Payments::CheckoutResult result) {
|
||||||
if (result == Payments::CheckoutResult::Cancelled) {
|
if (result == Payments::CheckoutResult::Cancelled) {
|
||||||
closeParentBox();
|
closeParentBox();
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
}
|
}
|
||||||
} else if (result != Payments::CheckoutResult::Paid) {
|
} else if (result != Payments::CheckoutResult::Paid) {
|
||||||
@ -586,7 +586,7 @@ void ShowTransferToBox(
|
|||||||
controller->showPeerHistory(peer);
|
controller->showPeerHistory(peer);
|
||||||
}
|
}
|
||||||
closeParentBox();
|
closeParentBox();
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -674,7 +674,7 @@ void ShowBuyResaleGiftBox(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
state->sent = true;
|
state->sent = true;
|
||||||
const auto weak = Ui::MakeWeak(box);
|
const auto weak = base::make_weak(box);
|
||||||
const auto done = [=](Payments::CheckoutResult result) {
|
const auto done = [=](Payments::CheckoutResult result) {
|
||||||
if (result == Payments::CheckoutResult::Cancelled) {
|
if (result == Payments::CheckoutResult::Cancelled) {
|
||||||
closeParentBox();
|
closeParentBox();
|
||||||
|
@ -307,7 +307,7 @@ object_ptr<BoxContent> EditSkipTranslationLanguages() {
|
|||||||
auto title = tr::lng_translate_settings_choose();
|
auto title = tr::lng_translate_settings_choose();
|
||||||
const auto selected = std::make_shared<std::vector<LanguageId>>(
|
const auto selected = std::make_shared<std::vector<LanguageId>>(
|
||||||
Core::App().settings().skipTranslationLanguages());
|
Core::App().settings().skipTranslationLanguages());
|
||||||
const auto weak = std::make_shared<QPointer<BoxContent>>();
|
const auto weak = std::make_shared<base::weak_qptr<BoxContent>>();
|
||||||
const auto check = [=](LanguageId id) {
|
const auto check = [=](LanguageId id) {
|
||||||
const auto already = ranges::contains(*selected, id);
|
const auto already = ranges::contains(*selected, id);
|
||||||
if (already) {
|
if (already) {
|
||||||
@ -316,7 +316,7 @@ object_ptr<BoxContent> EditSkipTranslationLanguages() {
|
|||||||
selected->push_back(id);
|
selected->push_back(id);
|
||||||
}
|
}
|
||||||
if (already && selected->empty()) {
|
if (already && selected->empty()) {
|
||||||
if (const auto strong = weak->data()) {
|
if (const auto strong = weak->get()) {
|
||||||
strong->showToast(
|
strong->showToast(
|
||||||
tr::lng_translate_settings_one(tr::now),
|
tr::lng_translate_settings_one(tr::now),
|
||||||
kSkipAtLeastOneDuration);
|
kSkipAtLeastOneDuration);
|
||||||
|
@ -134,7 +134,7 @@ void UrlAuthBox::Request(
|
|||||||
const auto bot = request.is_request_write_access()
|
const auto bot = request.is_request_write_access()
|
||||||
? session->data().processUser(request.vbot()).get()
|
? session->data().processUser(request.vbot()).get()
|
||||||
: nullptr;
|
: nullptr;
|
||||||
const auto box = std::make_shared<QPointer<Ui::BoxContent>>();
|
const auto box = std::make_shared<base::weak_qptr<Ui::BoxContent>>();
|
||||||
const auto finishWithUrl = [=](const QString &url) {
|
const auto finishWithUrl = [=](const QString &url) {
|
||||||
if (*box) {
|
if (*box) {
|
||||||
(*box)->closeBox();
|
(*box)->closeBox();
|
||||||
@ -185,7 +185,7 @@ void UrlAuthBox::Request(
|
|||||||
const auto bot = request.is_request_write_access()
|
const auto bot = request.is_request_write_access()
|
||||||
? session->data().processUser(request.vbot()).get()
|
? session->data().processUser(request.vbot()).get()
|
||||||
: nullptr;
|
: nullptr;
|
||||||
const auto box = std::make_shared<QPointer<Ui::BoxContent>>();
|
const auto box = std::make_shared<base::weak_qptr<Ui::BoxContent>>();
|
||||||
const auto finishWithUrl = [=](const QString &url) {
|
const auto finishWithUrl = [=](const QString &url) {
|
||||||
if (*box) {
|
if (*box) {
|
||||||
(*box)->closeBox();
|
(*box)->closeBox();
|
||||||
|
@ -711,7 +711,7 @@ std::unique_ptr<PeerListRow> BoxController::createRow(
|
|||||||
void ClearCallsBox(
|
void ClearCallsBox(
|
||||||
not_null<Ui::GenericBox*> box,
|
not_null<Ui::GenericBox*> box,
|
||||||
not_null<::Window::SessionController*> window) {
|
not_null<::Window::SessionController*> window) {
|
||||||
const auto weak = Ui::MakeWeak(box);
|
const auto weak = base::make_weak(box);
|
||||||
box->addRow(
|
box->addRow(
|
||||||
object_ptr<Ui::FlatLabel>(
|
object_ptr<Ui::FlatLabel>(
|
||||||
box,
|
box,
|
||||||
@ -754,7 +754,7 @@ void ClearCallsBox(
|
|||||||
self(revoke, self);
|
self(revoke, self);
|
||||||
} else {
|
} else {
|
||||||
api->session().data().destroyAllCallItems();
|
api->session().data().destroyAllCallItems();
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -604,9 +604,9 @@ void SetupFingerprintTooltip(not_null<Ui::RpWidget*> widget) {
|
|||||||
st::confcallFingerprintTooltipLabel),
|
st::confcallFingerprintTooltipLabel),
|
||||||
st::confcallFingerprintTooltip);
|
st::confcallFingerprintTooltip);
|
||||||
const auto raw = state->tooltip.get();
|
const auto raw = state->tooltip.get();
|
||||||
const auto weak = QPointer<QWidget>(raw);
|
const auto weak = base::make_weak(raw);
|
||||||
const auto destroy = [=] {
|
const auto destroy = [=] {
|
||||||
delete weak.data();
|
delete weak.get();
|
||||||
};
|
};
|
||||||
raw->setAttribute(Qt::WA_TransparentForMouseEvents);
|
raw->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||||
raw->setHiddenCallback(destroy);
|
raw->setHiddenCallback(destroy);
|
||||||
|
@ -393,7 +393,7 @@ void ChooseJoinAsProcess::finish(JoinInfo info) {
|
|||||||
const auto box = _request->box;
|
const auto box = _request->box;
|
||||||
_request = nullptr;
|
_request = nullptr;
|
||||||
done(std::move(info));
|
done(std::move(info));
|
||||||
if (const auto strong = box.data()) {
|
if (const auto strong = box.get()) {
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ private:
|
|||||||
std::shared_ptr<Ui::Show> show;
|
std::shared_ptr<Ui::Show> show;
|
||||||
Fn<void(JoinInfo)> done;
|
Fn<void(JoinInfo)> done;
|
||||||
base::has_weak_ptr guard;
|
base::has_weak_ptr guard;
|
||||||
QPointer<Ui::BoxContent> box;
|
base::weak_qptr<Ui::BoxContent> box;
|
||||||
rpl::lifetime lifetime;
|
rpl::lifetime lifetime;
|
||||||
Context context = Context();
|
Context context = Context();
|
||||||
mtpRequestId id = 0;
|
mtpRequestId id = 0;
|
||||||
|
@ -213,8 +213,8 @@ void ConferenceCallJoinConfirm(
|
|||||||
)->setTryMakeSimilarLines(true);
|
)->setTryMakeSimilarLines(true);
|
||||||
}
|
}
|
||||||
const auto joinAndClose = [=] {
|
const auto joinAndClose = [=] {
|
||||||
join([weak = Ui::MakeWeak(box)] {
|
join([weak = base::make_weak(box)] {
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -275,7 +275,7 @@ void ShowConferenceCallLinkBox(
|
|||||||
}
|
}
|
||||||
state->resetting = true;
|
state->resetting = true;
|
||||||
using Flag = MTPphone_ToggleGroupCallSettings::Flag;
|
using Flag = MTPphone_ToggleGroupCallSettings::Flag;
|
||||||
const auto weak = Ui::MakeWeak(box);
|
const auto weak = base::make_weak(box);
|
||||||
call->session().api().request(
|
call->session().api().request(
|
||||||
MTPphone_ToggleGroupCallSettings(
|
MTPphone_ToggleGroupCallSettings(
|
||||||
MTP_flags(Flag::f_reset_invite_hash),
|
MTP_flags(Flag::f_reset_invite_hash),
|
||||||
@ -284,7 +284,7 @@ void ShowConferenceCallLinkBox(
|
|||||||
).done([=](const MTPUpdates &result) {
|
).done([=](const MTPUpdates &result) {
|
||||||
call->session().api().applyUpdates(result);
|
call->session().api().applyUpdates(result);
|
||||||
ShowConferenceCallLinkBox(show, call, args);
|
ShowConferenceCallLinkBox(show, call, args);
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
}
|
}
|
||||||
show->showToast({
|
show->showToast({
|
||||||
|
@ -943,7 +943,7 @@ object_ptr<Ui::BoxContent> PrepareInviteBox(
|
|||||||
: (nonMembers.size() < users.size())
|
: (nonMembers.size() < users.size())
|
||||||
? tr::lng_group_call_add_to_group_some(tr::now, lt_group, name)
|
? tr::lng_group_call_add_to_group_some(tr::now, lt_group, name)
|
||||||
: tr::lng_group_call_add_to_group_all(tr::now, lt_group, name);
|
: tr::lng_group_call_add_to_group_all(tr::now, lt_group, name);
|
||||||
const auto shared = std::make_shared<QPointer<Ui::GenericBox>>();
|
const auto shared = std::make_shared<base::weak_qptr<Ui::GenericBox>>();
|
||||||
const auto finishWithConfirm = [=] {
|
const auto finishWithConfirm = [=] {
|
||||||
if (*shared) {
|
if (*shared) {
|
||||||
(*shared)->closeBox();
|
(*shared)->closeBox();
|
||||||
@ -983,7 +983,7 @@ object_ptr<Ui::BoxContent> PrepareInviteBox(
|
|||||||
return !controller->hasRowFor(user);
|
return !controller->hasRowFor(user);
|
||||||
}) | ranges::to_vector;
|
}) | ranges::to_vector;
|
||||||
|
|
||||||
const auto finish = [box = Ui::MakeWeak(box)]() {
|
const auto finish = [box = base::make_weak(box)]() {
|
||||||
if (box) {
|
if (box) {
|
||||||
box->closeBox();
|
box->closeBox();
|
||||||
}
|
}
|
||||||
@ -1098,14 +1098,14 @@ object_ptr<Ui::BoxContent> PrepareInviteToEmptyBox(
|
|||||||
}, box->lifetime());
|
}, box->lifetime());
|
||||||
|
|
||||||
const auto join = [=] {
|
const auto join = [=] {
|
||||||
const auto weak = Ui::MakeWeak(box);
|
const auto weak = base::make_weak(box);
|
||||||
auto selected = raw->requests(box->collectSelectedRows());
|
auto selected = raw->requests(box->collectSelectedRows());
|
||||||
Core::App().calls().startOrJoinConferenceCall({
|
Core::App().calls().startOrJoinConferenceCall({
|
||||||
.call = call,
|
.call = call,
|
||||||
.joinMessageId = inviteMsgId,
|
.joinMessageId = inviteMsgId,
|
||||||
.invite = std::move(selected),
|
.invite = std::move(selected),
|
||||||
});
|
});
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1346,16 +1346,16 @@ base::unique_qptr<Ui::PopupMenu> Members::Controller::createRowContextMenu(
|
|||||||
: addVolumeItem
|
: addVolumeItem
|
||||||
? st::groupCallPopupMenuWithVolume
|
? st::groupCallPopupMenuWithVolume
|
||||||
: st::groupCallPopupMenu));
|
: st::groupCallPopupMenu));
|
||||||
const auto weakMenu = Ui::MakeWeak(result.get());
|
const auto weakMenu = base::make_weak(result.get());
|
||||||
const auto withActiveWindow = [=](auto callback) {
|
const auto withActiveWindow = [=](auto callback) {
|
||||||
if (const auto window = Core::App().activePrimaryWindow()) {
|
if (const auto window = Core::App().activePrimaryWindow()) {
|
||||||
if (const auto menu = weakMenu.data()) {
|
if (const auto menu = weakMenu.get()) {
|
||||||
menu->discardParentReActivate();
|
menu->discardParentReActivate();
|
||||||
|
|
||||||
// We must hide PopupMenu before we activate the MainWindow,
|
// We must hide PopupMenu before we activate the MainWindow,
|
||||||
// otherwise we set focus in field inside MainWindow and then
|
// otherwise we set focus in field inside MainWindow and then
|
||||||
// PopupMenu::hide activates back the group call panel :(
|
// PopupMenu::hide activates back the group call panel :(
|
||||||
delete weakMenu;
|
delete weakMenu.get();
|
||||||
}
|
}
|
||||||
window->invokeForSessionController(
|
window->invokeForSessionController(
|
||||||
account,
|
account,
|
||||||
|
@ -407,7 +407,7 @@ void Panel::startScheduledNow() {
|
|||||||
} else if (now + kStartNoConfirmation >= date) {
|
} else if (now + kStartNoConfirmation >= date) {
|
||||||
_call->startScheduledNow();
|
_call->startScheduledNow();
|
||||||
} else {
|
} else {
|
||||||
const auto box = std::make_shared<QPointer<Ui::GenericBox>>();
|
const auto box = std::make_shared<base::weak_qptr<Ui::GenericBox>>();
|
||||||
const auto done = [=] {
|
const auto done = [=] {
|
||||||
if (*box) {
|
if (*box) {
|
||||||
(*box)->closeBox();
|
(*box)->closeBox();
|
||||||
@ -1377,7 +1377,7 @@ void Panel::chooseShareScreenSource() {
|
|||||||
tr::now,
|
tr::now,
|
||||||
lt_user,
|
lt_user,
|
||||||
screencastFromPeer->shortName());
|
screencastFromPeer->shortName());
|
||||||
const auto shared = std::make_shared<QPointer<Ui::GenericBox>>();
|
const auto shared = std::make_shared<base::weak_qptr<Ui::GenericBox>>();
|
||||||
const auto done = [=] {
|
const auto done = [=] {
|
||||||
if (*shared) {
|
if (*shared) {
|
||||||
base::take(*shared)->closeBox();
|
base::take(*shared)->closeBox();
|
||||||
@ -2072,9 +2072,9 @@ void Panel::showNiceTooltip(
|
|||||||
? st::groupCallStickedTooltip
|
? st::groupCallStickedTooltip
|
||||||
: st::groupCallNiceTooltip));
|
: st::groupCallNiceTooltip));
|
||||||
const auto tooltip = _niceTooltip.data();
|
const auto tooltip = _niceTooltip.data();
|
||||||
const auto weak = QPointer<QWidget>(tooltip);
|
const auto weak = base::make_weak(tooltip);
|
||||||
const auto destroy = [=] {
|
const auto destroy = [=] {
|
||||||
delete weak.data();
|
delete weak.get();
|
||||||
};
|
};
|
||||||
if (type != NiceTooltipType::Sticked) {
|
if (type != NiceTooltipType::Sticked) {
|
||||||
tooltip->setAttribute(Qt::WA_TransparentForMouseEvents);
|
tooltip->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||||
@ -2098,9 +2098,9 @@ void Panel::updateTooltipGeometry() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto geometry = _niceTooltipControl->geometry();
|
const auto geometry = _niceTooltipControl->geometry();
|
||||||
const auto weak = QPointer<QWidget>(_niceTooltip);
|
const auto weak = base::make_weak(_niceTooltip);
|
||||||
const auto countPosition = [=](QSize size) {
|
const auto countPosition = [=](QSize size) {
|
||||||
const auto strong = weak.data();
|
const auto strong = weak.get();
|
||||||
const auto wide = (_mode.current() == PanelMode::Wide);
|
const auto wide = (_mode.current() == PanelMode::Wide);
|
||||||
const auto top = geometry.y()
|
const auto top = geometry.y()
|
||||||
- (wide ? st::groupCallNiceTooltipTop : 0)
|
- (wide ? st::groupCallNiceTooltipTop : 0)
|
||||||
|
@ -133,7 +133,7 @@ void StartRtmpProcess::start(
|
|||||||
void StartRtmpProcess::close() {
|
void StartRtmpProcess::close() {
|
||||||
if (_request) {
|
if (_request) {
|
||||||
_request->peer->session().api().request(_request->id).cancel();
|
_request->peer->session().api().request(_request->id).cancel();
|
||||||
if (const auto strong = _request->box.data()) {
|
if (const auto strong = _request->box.get()) {
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
}
|
}
|
||||||
_request = nullptr;
|
_request = nullptr;
|
||||||
@ -199,7 +199,7 @@ void StartRtmpProcess::createBox() {
|
|||||||
) | rpl::start_with_next([=] {
|
) | rpl::start_with_next([=] {
|
||||||
_request = nullptr;
|
_request = nullptr;
|
||||||
}, _request->lifetime);
|
}, _request->lifetime);
|
||||||
_request->box = Ui::MakeWeak(object.data());
|
_request->box = base::make_weak(object.data());
|
||||||
_request->show->showBox(std::move(object));
|
_request->show->showBox(std::move(object));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ private:
|
|||||||
std::shared_ptr<Ui::Show> show;
|
std::shared_ptr<Ui::Show> show;
|
||||||
Fn<void(JoinInfo)> done;
|
Fn<void(JoinInfo)> done;
|
||||||
base::has_weak_ptr guard;
|
base::has_weak_ptr guard;
|
||||||
QPointer<Ui::BoxContent> box;
|
base::weak_qptr<Ui::BoxContent> box;
|
||||||
rpl::lifetime lifetime;
|
rpl::lifetime lifetime;
|
||||||
mtpRequestId id = 0;
|
mtpRequestId id = 0;
|
||||||
};
|
};
|
||||||
|
@ -110,7 +110,7 @@ object_ptr<ShareBox> ShareInviteLinkBox(
|
|||||||
const QString &linkListener,
|
const QString &linkListener,
|
||||||
std::shared_ptr<Ui::Show> show) {
|
std::shared_ptr<Ui::Show> show) {
|
||||||
const auto sending = std::make_shared<bool>();
|
const auto sending = std::make_shared<bool>();
|
||||||
const auto box = std::make_shared<QPointer<ShareBox>>();
|
const auto box = std::make_shared<base::weak_qptr<ShareBox>>();
|
||||||
|
|
||||||
auto bottom = linkSpeaker.isEmpty()
|
auto bottom = linkSpeaker.isEmpty()
|
||||||
? nullptr
|
? nullptr
|
||||||
@ -220,7 +220,7 @@ void SettingsBox(
|
|||||||
using namespace Settings;
|
using namespace Settings;
|
||||||
|
|
||||||
const auto weakCall = base::make_weak(call);
|
const auto weakCall = base::make_weak(call);
|
||||||
const auto weakBox = Ui::MakeWeak(box);
|
const auto weakBox = base::make_weak(box);
|
||||||
|
|
||||||
struct State {
|
struct State {
|
||||||
std::unique_ptr<Webrtc::DeviceResolver> deviceId;
|
std::unique_ptr<Webrtc::DeviceResolver> deviceId;
|
||||||
|
@ -351,18 +351,18 @@ void ChooseSourceProcess::setupPanel() {
|
|||||||
if (_selectedId.isEmpty()) {
|
if (_selectedId.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto weak = MakeWeak(_window.get());
|
const auto weak = base::make_weak(_window.get());
|
||||||
_delegate->chooseSourceAccepted(
|
_delegate->chooseSourceAccepted(
|
||||||
_selectedId,
|
_selectedId,
|
||||||
!_withAudio->isHidden() && _withAudio->checked());
|
!_withAudio->isHidden() && _withAudio->checked());
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
strong->close();
|
strong->close();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
_finish->setClickedCallback([=] {
|
_finish->setClickedCallback([=] {
|
||||||
const auto weak = MakeWeak(_window.get());
|
const auto weak = base::make_weak(_window.get());
|
||||||
_delegate->chooseSourceStop();
|
_delegate->chooseSourceStop();
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
strong->close();
|
strong->close();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -173,7 +173,7 @@ Loader::Loader(
|
|||||||
|
|
||||||
void Loader::unpack(const QString &path) {
|
void Loader::unpack(const QString &path) {
|
||||||
const auto folder = internal::SetDataPath(id());
|
const auto folder = internal::SetDataPath(id());
|
||||||
const auto weak = Ui::MakeWeak(this);
|
const auto weak = base::make_weak(this);
|
||||||
crl::async([=] {
|
crl::async([=] {
|
||||||
if (UnpackSet(path, folder)) {
|
if (UnpackSet(path, folder)) {
|
||||||
QFile(path).remove();
|
QFile(path).remove();
|
||||||
|
@ -984,7 +984,7 @@ void SuggestionsController::replaceCurrent(
|
|||||||
const auto position = cursor.position();
|
const auto position = cursor.position();
|
||||||
const auto suggestion = getEmojiQuery();
|
const auto suggestion = getEmojiQuery();
|
||||||
if (v::is<EmojiPtr>(suggestion)) {
|
if (v::is<EmojiPtr>(suggestion)) {
|
||||||
const auto weak = Ui::MakeWeak(_container.get());
|
const auto weak = base::make_weak(_container.get());
|
||||||
const auto count = std::max(_emojiQueryLength, 1);
|
const auto count = std::max(_emojiQueryLength, 1);
|
||||||
for (auto i = 0; i != count; ++i) {
|
for (auto i = 0; i != count; ++i) {
|
||||||
const auto start = position - count + i;
|
const auto start = position - count + i;
|
||||||
|
@ -202,7 +202,7 @@ void EditLinkBox(
|
|||||||
url->showError();
|
url->showError();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto weak = Ui::MakeWeak(box);
|
const auto weak = base::make_weak(box);
|
||||||
callback(linkText, linkUrl);
|
callback(linkText, linkUrl);
|
||||||
if (weak) {
|
if (weak) {
|
||||||
box->closeBox();
|
box->closeBox();
|
||||||
@ -304,9 +304,9 @@ void EditCodeLanguageBox(
|
|||||||
const auto name = field->getLastText().trimmed();
|
const auto name = field->getLastText().trimmed();
|
||||||
const auto check = QRegularExpression("^[a-zA-Z0-9\\+\\-]*$");
|
const auto check = QRegularExpression("^[a-zA-Z0-9\\+\\-]*$");
|
||||||
if (check.match(name).hasMatch()) {
|
if (check.match(name).hasMatch()) {
|
||||||
auto weak = Ui::MakeWeak(box);
|
auto weak = base::make_weak(box);
|
||||||
save(name);
|
save(name);
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -401,7 +401,7 @@ Fn<bool(
|
|||||||
std::shared_ptr<Main::SessionShow> show,
|
std::shared_ptr<Main::SessionShow> show,
|
||||||
not_null<Ui::InputField*> field,
|
not_null<Ui::InputField*> field,
|
||||||
const style::InputField *fieldStyle) {
|
const style::InputField *fieldStyle) {
|
||||||
const auto weak = Ui::MakeWeak(field);
|
const auto weak = base::make_weak(field);
|
||||||
return [=](
|
return [=](
|
||||||
EditLinkSelection selection,
|
EditLinkSelection selection,
|
||||||
TextWithTags text,
|
TextWithTags text,
|
||||||
@ -412,7 +412,7 @@ Fn<bool(
|
|||||||
&& !TextUtilities::IsMentionLink(link);
|
&& !TextUtilities::IsMentionLink(link);
|
||||||
}
|
}
|
||||||
auto callback = [=](const TextWithTags &text, const QString &link) {
|
auto callback = [=](const TextWithTags &text, const QString &link) {
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
strong->commitMarkdownLinkEdit(selection, text, link);
|
strong->commitMarkdownLinkEdit(selection, text, link);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -484,7 +484,7 @@ void InitMessageFieldHandlers(MessageFieldHandlersArgs &&args) {
|
|||||||
EditLinkAction action)> FactcheckEditLinkCallback(
|
EditLinkAction action)> FactcheckEditLinkCallback(
|
||||||
std::shared_ptr<Main::SessionShow> show,
|
std::shared_ptr<Main::SessionShow> show,
|
||||||
not_null<Ui::InputField*> field) {
|
not_null<Ui::InputField*> field) {
|
||||||
const auto weak = Ui::MakeWeak(field);
|
const auto weak = base::make_weak(field);
|
||||||
return [=](
|
return [=](
|
||||||
EditLinkSelection selection,
|
EditLinkSelection selection,
|
||||||
TextWithTags text,
|
TextWithTags text,
|
||||||
@ -503,7 +503,7 @@ void InitMessageFieldHandlers(MessageFieldHandlersArgs &&args) {
|
|||||||
return IsGoodFactcheckUrl(link);
|
return IsGoodFactcheckUrl(link);
|
||||||
}
|
}
|
||||||
auto callback = [=](const TextWithTags &text, const QString &link) {
|
auto callback = [=](const TextWithTags &text, const QString &link) {
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
strong->commitMarkdownLinkEdit(selection, text, link);
|
strong->commitMarkdownLinkEdit(selection, text, link);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -696,9 +696,9 @@ void InitMessageFieldFade(
|
|||||||
bottomFade->move(
|
bottomFade->move(
|
||||||
0,
|
0,
|
||||||
size.height() - st::historyComposeFieldFadeHeight);
|
size.height() - st::historyComposeFieldFadeHeight);
|
||||||
}, [t = Ui::MakeWeak(topFade), b = Ui::MakeWeak(bottomFade)] {
|
}, [t = base::make_weak(topFade), b = base::make_weak(bottomFade)] {
|
||||||
Ui::DestroyChild(t.data());
|
Ui::DestroyChild(t.get());
|
||||||
Ui::DestroyChild(b.data());
|
Ui::DestroyChild(b.get());
|
||||||
}, topFade->lifetime());
|
}, topFade->lifetime());
|
||||||
|
|
||||||
const auto descent = field->st().style.font->descent;
|
const auto descent = field->st().style.font->descent;
|
||||||
|
@ -1736,8 +1736,8 @@ void StickersListWidget::showStickerSetBox(
|
|||||||
base::timer_once(kTimeout),
|
base::timer_once(kTimeout),
|
||||||
document->owner().stickers().updated(
|
document->owner().stickers().updated(
|
||||||
Data::StickersType::Stickers)
|
Data::StickersType::Stickers)
|
||||||
) | rpl::start_with_next([=, weak = Ui::MakeWeak(this)] {
|
) | rpl::start_with_next([=, weak = base::make_weak(this)] {
|
||||||
if (weak.data()) {
|
if (weak.get()) {
|
||||||
showStickerSetBox(document, setId);
|
showStickerSetBox(document, setId);
|
||||||
}
|
}
|
||||||
lifetime->destroy();
|
lifetime->destroy();
|
||||||
|
@ -1471,13 +1471,13 @@ void TabbedSelector::Inner::disableScroll(bool disabled) {
|
|||||||
|
|
||||||
void TabbedSelector::Inner::checkHideWithBox(
|
void TabbedSelector::Inner::checkHideWithBox(
|
||||||
object_ptr<Ui::BoxContent> box) {
|
object_ptr<Ui::BoxContent> box) {
|
||||||
const auto raw = QPointer<Ui::BoxContent>(box.data());
|
const auto raw = base::make_weak(box.data());
|
||||||
_show->showBox(std::move(box));
|
_show->showBox(std::move(box));
|
||||||
if (!raw) {
|
if (!raw) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_preventHideWithBox = true;
|
_preventHideWithBox = true;
|
||||||
connect(raw, &QObject::destroyed, this, [=] {
|
connect(raw.get(), &QObject::destroyed, this, [=] {
|
||||||
_preventHideWithBox = false;
|
_preventHideWithBox = false;
|
||||||
_checkForHide.fire({});
|
_checkForHide.fire({});
|
||||||
});
|
});
|
||||||
|
@ -902,7 +902,7 @@ void Application::forceLogOut(
|
|||||||
box->setCloseByEscape(false);
|
box->setCloseByEscape(false);
|
||||||
box->setCloseByOutsideClick(false);
|
box->setCloseByOutsideClick(false);
|
||||||
const auto weak = base::make_weak(account);
|
const auto weak = base::make_weak(account);
|
||||||
connect(box, &QObject::destroyed, [=] {
|
connect(box.get(), &QObject::destroyed, [=] {
|
||||||
crl::on_main(weak, [=] {
|
crl::on_main(weak, [=] {
|
||||||
account->forcedLogOut();
|
account->forcedLogOut();
|
||||||
});
|
});
|
||||||
@ -1669,7 +1669,7 @@ void Application::registerLeaveSubscription(not_null<QWidget*> widget) {
|
|||||||
if (e->type() == QEvent::Leave) {
|
if (e->type() == QEvent::Leave) {
|
||||||
if (const auto taken = _leaveFilters.take(window)) {
|
if (const auto taken = _leaveFilters.take(window)) {
|
||||||
for (const auto &weak : taken->registered) {
|
for (const auto &weak : taken->registered) {
|
||||||
if (const auto widget = weak.data()) {
|
if (const auto widget = weak.get()) {
|
||||||
QEvent ev(QEvent::Leave);
|
QEvent ev(QEvent::Leave);
|
||||||
QCoreApplication::sendEvent(widget, &ev);
|
QCoreApplication::sendEvent(widget, &ev);
|
||||||
}
|
}
|
||||||
|
@ -437,7 +437,7 @@ private:
|
|||||||
const std::unique_ptr<Lang::CloudManager> _langCloudManager;
|
const std::unique_ptr<Lang::CloudManager> _langCloudManager;
|
||||||
const std::unique_ptr<ChatHelpers::EmojiKeywords> _emojiKeywords;
|
const std::unique_ptr<ChatHelpers::EmojiKeywords> _emojiKeywords;
|
||||||
std::unique_ptr<Lang::Translator> _translator;
|
std::unique_ptr<Lang::Translator> _translator;
|
||||||
QPointer<Ui::BoxContent> _badProxyDisableBox;
|
base::weak_qptr<Ui::BoxContent> _badProxyDisableBox;
|
||||||
|
|
||||||
const std::unique_ptr<Tray> _tray;
|
const std::unique_ptr<Tray> _tray;
|
||||||
|
|
||||||
|
@ -340,7 +340,7 @@ void PhoneClickHandler::onClick(ClickContext context) const {
|
|||||||
if (Trim(phone) != Trim(controller->session().user()->phone())) {
|
if (Trim(phone) != Trim(controller->session().user()->phone())) {
|
||||||
menu->addAction(
|
menu->addAction(
|
||||||
tr::lng_info_add_as_contact(tr::now),
|
tr::lng_info_add_as_contact(tr::now),
|
||||||
[=, raw = Ui::MakeWeak(resolvePhoneAction.get())] {
|
[=, raw = base::make_weak(resolvePhoneAction.get())] {
|
||||||
controller->show(
|
controller->show(
|
||||||
Box<AddContactBox>(
|
Box<AddContactBox>(
|
||||||
&controller->session(),
|
&controller->session(),
|
||||||
|
@ -57,7 +57,7 @@ void ConfirmDontWarnBox(
|
|||||||
std::move(check),
|
std::move(check),
|
||||||
false,
|
false,
|
||||||
st::defaultBoxCheckbox);
|
st::defaultBoxCheckbox);
|
||||||
const auto weak = Ui::MakeWeak(checkbox.data());
|
const auto weak = base::make_weak(checkbox.data());
|
||||||
auto confirmed = crl::guard(weak, [=, callback = std::move(callback)] {
|
auto confirmed = crl::guard(weak, [=, callback = std::move(callback)] {
|
||||||
const auto checked = weak->checked();
|
const auto checked = weak->checked();
|
||||||
box->closeBox();
|
box->closeBox();
|
||||||
|
@ -1008,7 +1008,7 @@ private:
|
|||||||
Storage::DatabasePointer _bigFileCache;
|
Storage::DatabasePointer _bigFileCache;
|
||||||
|
|
||||||
TimeId _exportAvailableAt = 0;
|
TimeId _exportAvailableAt = 0;
|
||||||
QPointer<Ui::BoxContent> _exportSuggestion;
|
base::weak_qptr<Ui::BoxContent> _exportSuggestion;
|
||||||
|
|
||||||
rpl::variable<bool> _contactsLoaded = false;
|
rpl::variable<bool> _contactsLoaded = false;
|
||||||
rpl::variable<int> _groupFreeTranscribeLevel;
|
rpl::variable<int> _groupFreeTranscribeLevel;
|
||||||
|
@ -1966,9 +1966,9 @@ void InnerWidget::mousePressEvent(QMouseEvent *e) {
|
|||||||
});
|
});
|
||||||
} else if (_pressed) {
|
} else if (_pressed) {
|
||||||
auto row = _pressed;
|
auto row = _pressed;
|
||||||
const auto weak = Ui::MakeWeak(this);
|
const auto weak = base::make_weak(this);
|
||||||
const auto updateCallback = [weak, row] {
|
const auto updateCallback = [weak, row] {
|
||||||
const auto strong = weak.data();
|
const auto strong = weak.get();
|
||||||
if (!strong || !strong->_pinnedShiftAnimation.animating()) {
|
if (!strong || !strong->_pinnedShiftAnimation.animating()) {
|
||||||
row->entry()->updateChatListEntry();
|
row->entry()->updateChatListEntry();
|
||||||
}
|
}
|
||||||
|
@ -1010,7 +1010,7 @@ void Widget::setGeometryWithTopMoved(
|
|||||||
_topDelta = topDelta;
|
_topDelta = topDelta;
|
||||||
bool willBeResized = (size() != newGeometry.size());
|
bool willBeResized = (size() != newGeometry.size());
|
||||||
if (geometry() != newGeometry) {
|
if (geometry() != newGeometry) {
|
||||||
auto weak = Ui::MakeWeak(this);
|
auto weak = base::make_weak(this);
|
||||||
setGeometry(newGeometry);
|
setGeometry(newGeometry);
|
||||||
if (!weak) {
|
if (!weak) {
|
||||||
return;
|
return;
|
||||||
|
@ -1452,7 +1452,7 @@ void Suggestions::setupChats() {
|
|||||||
|
|
||||||
_topPeers->showMenuRequests(
|
_topPeers->showMenuRequests(
|
||||||
) | rpl::start_with_next([=](const ShowTopPeerMenuRequest &request) {
|
) | rpl::start_with_next([=](const ShowTopPeerMenuRequest &request) {
|
||||||
const auto weak = Ui::MakeWeak(this);
|
const auto weak = base::make_weak(this);
|
||||||
const auto owner = &_controller->session().data();
|
const auto owner = &_controller->session().data();
|
||||||
const auto peer = owner->peer(PeerId(request.id));
|
const auto peer = owner->peer(PeerId(request.id));
|
||||||
const auto removeOne = [=] {
|
const auto removeOne = [=] {
|
||||||
|
@ -157,12 +157,12 @@ void LayerWidget::checkCacheBackground() {
|
|||||||
|
|
||||||
void LayerWidget::cacheBackground() {
|
void LayerWidget::cacheBackground() {
|
||||||
_backgroundCaching = true;
|
_backgroundCaching = true;
|
||||||
const auto weak = Ui::MakeWeak(this);
|
const auto weak = base::make_weak(this);
|
||||||
const auto night = IsNightMode();
|
const auto night = IsNightMode();
|
||||||
crl::async([weak, night, image = renderBackground()]() mutable {
|
crl::async([weak, night, image = renderBackground()]() mutable {
|
||||||
auto result = ProcessBackground(image, night);
|
auto result = ProcessBackground(image, night);
|
||||||
crl::on_main([weak, night, result = std::move(result)]() mutable {
|
crl::on_main([weak, night, result = std::move(result)]() mutable {
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
strong->backgroundReady(std::move(result), night);
|
strong->backgroundReady(std::move(result), night);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -228,12 +228,12 @@ void InitEditorLayer(
|
|||||||
layer->closeLayer();
|
layer->closeLayer();
|
||||||
}, editor->lifetime());
|
}, editor->lifetime());
|
||||||
|
|
||||||
const auto weak = Ui::MakeWeak(layer.get());
|
const auto weak = base::make_weak(layer.get());
|
||||||
editor->doneRequests(
|
editor->doneRequests(
|
||||||
) | rpl::start_with_next([=, done = std::move(doneCallback)](
|
) | rpl::start_with_next([=, done = std::move(doneCallback)](
|
||||||
const PhotoModifications &mods) {
|
const PhotoModifications &mods) {
|
||||||
done(mods);
|
done(mods);
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
strong->closeLayer();
|
strong->closeLayer();
|
||||||
}
|
}
|
||||||
}, editor->lifetime());
|
}, editor->lifetime());
|
||||||
|
@ -404,7 +404,9 @@ auto ApiWrap::fileRequest(const Data::FileLocation &location, int64 offset) {
|
|||||||
}).toDC(MTP::ShiftDcId(location.dcId, MTP::kExportMediaDcShift)));
|
}).toDC(MTP::ShiftDcId(location.dcId, MTP::kExportMediaDcShift)));
|
||||||
}
|
}
|
||||||
|
|
||||||
ApiWrap::ApiWrap(QPointer<MTP::Instance> weak, Fn<void(FnMut<void()>)> runner)
|
ApiWrap::ApiWrap(
|
||||||
|
base::weak_qptr<MTP::Instance> weak,
|
||||||
|
Fn<void(FnMut<void()>)> runner)
|
||||||
: _mtp(weak, std::move(runner))
|
: _mtp(weak, std::move(runner))
|
||||||
, _fileCache(std::make_unique<LoadedFileCache>(kLocationCacheSize)) {
|
, _fileCache(std::make_unique<LoadedFileCache>(kLocationCacheSize)) {
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,9 @@ struct Settings;
|
|||||||
|
|
||||||
class ApiWrap {
|
class ApiWrap {
|
||||||
public:
|
public:
|
||||||
ApiWrap(QPointer<MTP::Instance> weak, Fn<void(FnMut<void()>)> runner);
|
ApiWrap(
|
||||||
|
base::weak_qptr<MTP::Instance> weak,
|
||||||
|
Fn<void(FnMut<void()>)> runner);
|
||||||
|
|
||||||
rpl::producer<MTP::Error> errors() const;
|
rpl::producer<MTP::Error> errors() const;
|
||||||
rpl::producer<Output::Result> ioErrors() const;
|
rpl::producer<Output::Result> ioErrors() const;
|
||||||
|
@ -96,11 +96,11 @@ Environment PrepareEnvironment(not_null<Main::Session*> session) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QPointer<Ui::BoxContent> SuggestStart(not_null<Main::Session*> session) {
|
base::weak_qptr<Ui::BoxContent> SuggestStart(not_null<Main::Session*> session) {
|
||||||
ClearSuggestStart(session);
|
ClearSuggestStart(session);
|
||||||
return Ui::show(
|
return Ui::show(
|
||||||
Box<SuggestBox>(session),
|
Box<SuggestBox>(session),
|
||||||
Ui::LayerOption::KeepOther).data();
|
Ui::LayerOption::KeepOther).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClearSuggestStart(not_null<Main::Session*> session) {
|
void ClearSuggestStart(not_null<Main::Session*> session) {
|
||||||
@ -277,7 +277,7 @@ void PanelController::showCriticalError(const QString &text) {
|
|||||||
|
|
||||||
void PanelController::showError(const QString &text) {
|
void PanelController::showError(const QString &text) {
|
||||||
auto box = Ui::MakeInformBox(text);
|
auto box = Ui::MakeInformBox(text);
|
||||||
const auto weak = Ui::MakeWeak(box.data());
|
const auto weak = base::make_weak(box.data());
|
||||||
const auto hidden = _panel->isHidden();
|
const auto hidden = _panel->isHidden();
|
||||||
_panel->showBox(
|
_panel->showBox(
|
||||||
std::move(box),
|
std::move(box),
|
||||||
|
@ -24,7 +24,7 @@ class Session;
|
|||||||
namespace Export {
|
namespace Export {
|
||||||
namespace View {
|
namespace View {
|
||||||
|
|
||||||
QPointer<Ui::BoxContent> SuggestStart(not_null<Main::Session*> session);
|
base::weak_qptr<Ui::BoxContent> SuggestStart(not_null<Main::Session*> session);
|
||||||
void ClearSuggestStart(not_null<Main::Session*> session);
|
void ClearSuggestStart(not_null<Main::Session*> session);
|
||||||
bool IsDefaultPath(not_null<Main::Session*> session, const QString &path);
|
bool IsDefaultPath(not_null<Main::Session*> session, const QString &path);
|
||||||
void ResolveSettings(not_null<Main::Session*> session, Settings &settings);
|
void ResolveSettings(not_null<Main::Session*> session, Settings &settings);
|
||||||
@ -79,7 +79,7 @@ private:
|
|||||||
base::unique_qptr<Ui::SeparatePanel> _panel;
|
base::unique_qptr<Ui::SeparatePanel> _panel;
|
||||||
|
|
||||||
State _state;
|
State _state;
|
||||||
QPointer<Ui::BoxContent> _confirmStopBox;
|
base::weak_qptr<Ui::BoxContent> _confirmStopBox;
|
||||||
rpl::event_stream<rpl::producer<>> _panelCloseEvents;
|
rpl::event_stream<rpl::producer<>> _panelCloseEvents;
|
||||||
bool _stopRequested = false;
|
bool _stopRequested = false;
|
||||||
rpl::lifetime _lifetime;
|
rpl::lifetime _lifetime;
|
||||||
|
@ -51,8 +51,8 @@ private:
|
|||||||
void hideCurrentInstance();
|
void hideCurrentInstance();
|
||||||
void setInstanceProgress(Instance &instance, float64 progress);
|
void setInstanceProgress(Instance &instance, float64 progress);
|
||||||
void toggleInstance(Instance &data, bool shown);
|
void toggleInstance(Instance &data, bool shown);
|
||||||
void instanceOpacityCallback(QPointer<Ui::FlatLabel> label);
|
void instanceOpacityCallback(base::weak_qptr<Ui::FlatLabel> label);
|
||||||
void removeOldInstance(QPointer<Ui::FlatLabel> label);
|
void removeOldInstance(base::weak_qptr<Ui::FlatLabel> label);
|
||||||
void paintInstance(QPainter &p, const Instance &data);
|
void paintInstance(QPainter &p, const Instance &data);
|
||||||
|
|
||||||
void updateControlsGeometry(int newWidth);
|
void updateControlsGeometry(int newWidth);
|
||||||
@ -146,7 +146,7 @@ void ProgressWidget::Row::toggleInstance(Instance &instance, bool shown) {
|
|||||||
if (instance.hiding != shown) {
|
if (instance.hiding != shown) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto label = Ui::MakeWeak(instance.label->entity());
|
const auto label = base::make_weak(instance.label->entity());
|
||||||
instance.opacity.start(
|
instance.opacity.start(
|
||||||
[=] { instanceOpacityCallback(label); },
|
[=] { instanceOpacityCallback(label); },
|
||||||
shown ? 0. : 1.,
|
shown ? 0. : 1.,
|
||||||
@ -158,10 +158,10 @@ void ProgressWidget::Row::toggleInstance(Instance &instance, bool shown) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ProgressWidget::Row::instanceOpacityCallback(
|
void ProgressWidget::Row::instanceOpacityCallback(
|
||||||
QPointer<Ui::FlatLabel> label) {
|
base::weak_qptr<Ui::FlatLabel> label) {
|
||||||
update();
|
update();
|
||||||
const auto i = ranges::find(_old, label, [](const Instance &instance) {
|
const auto i = ranges::find(_old, label, [](const Instance &instance) {
|
||||||
return Ui::MakeWeak(instance.label->entity());
|
return base::make_weak(instance.label->entity());
|
||||||
});
|
});
|
||||||
if (i != end(_old) && i->hiding && !i->opacity.animating()) {
|
if (i != end(_old) && i->hiding && !i->opacity.animating()) {
|
||||||
crl::on_main(this, [=] {
|
crl::on_main(this, [=] {
|
||||||
@ -170,9 +170,10 @@ void ProgressWidget::Row::instanceOpacityCallback(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProgressWidget::Row::removeOldInstance(QPointer<Ui::FlatLabel> label) {
|
void ProgressWidget::Row::removeOldInstance(
|
||||||
|
base::weak_qptr<Ui::FlatLabel> label) {
|
||||||
const auto i = ranges::find(_old, label, [](const Instance &instance) {
|
const auto i = ranges::find(_old, label, [](const Instance &instance) {
|
||||||
return Ui::MakeWeak(instance.label->entity());
|
return base::make_weak(instance.label->entity());
|
||||||
});
|
});
|
||||||
if (i != end(_old)) {
|
if (i != end(_old)) {
|
||||||
_old.erase(i);
|
_old.erase(i);
|
||||||
|
@ -320,20 +320,20 @@ void SettingsWidget::addLocationLabel(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SettingsWidget::chooseFormat() {
|
void SettingsWidget::chooseFormat() {
|
||||||
const auto shared = std::make_shared<QPointer<Ui::GenericBox>>();
|
const auto shared = std::make_shared<base::weak_qptr<Ui::GenericBox>>();
|
||||||
const auto callback = [=](Format format) {
|
const auto callback = [=](Format format) {
|
||||||
changeData([&](Settings &data) {
|
changeData([&](Settings &data) {
|
||||||
data.format = format;
|
data.format = format;
|
||||||
});
|
});
|
||||||
if (const auto weak = shared->data()) {
|
if (const auto strong = shared->get()) {
|
||||||
weak->closeBox();
|
strong->closeBox();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
auto box = Box(
|
auto box = Box(
|
||||||
ChooseFormatBox,
|
ChooseFormatBox,
|
||||||
readData().format,
|
readData().format,
|
||||||
callback);
|
callback);
|
||||||
*shared = Ui::MakeWeak(box.data());
|
*shared = base::make_weak(box.data());
|
||||||
_showBoxCallback(std::move(box));
|
_showBoxCallback(std::move(box));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -602,18 +602,18 @@ void SettingsWidget::editDateLimit(
|
|||||||
? base::unixtime::parse(min).date()
|
? base::unixtime::parse(min).date()
|
||||||
: QDate::currentDate();
|
: QDate::currentDate();
|
||||||
const auto month = highlighted;
|
const auto month = highlighted;
|
||||||
const auto shared = std::make_shared<QPointer<Ui::CalendarBox>>();
|
const auto shared = std::make_shared<base::weak_qptr<Ui::CalendarBox>>();
|
||||||
const auto finalize = [=](not_null<Ui::CalendarBox*> box) {
|
const auto finalize = [=](not_null<Ui::CalendarBox*> box) {
|
||||||
box->addLeftButton(std::move(resetLabel), crl::guard(this, [=] {
|
box->addLeftButton(std::move(resetLabel), crl::guard(this, [=] {
|
||||||
done(0);
|
done(0);
|
||||||
if (const auto weak = shared->data()) {
|
if (const auto weak = shared->get()) {
|
||||||
weak->closeBox();
|
weak->closeBox();
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
const auto callback = crl::guard(this, [=](const QDate &date) {
|
const auto callback = crl::guard(this, [=](const QDate &date) {
|
||||||
done(base::unixtime::serialize(date.startOfDay()));
|
done(base::unixtime::serialize(date.startOfDay()));
|
||||||
if (const auto weak = shared->data()) {
|
if (const auto weak = shared->get()) {
|
||||||
weak->closeBox();
|
weak->closeBox();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -630,7 +630,7 @@ void SettingsWidget::editDateLimit(
|
|||||||
? base::unixtime::parse(max).date()
|
? base::unixtime::parse(max).date()
|
||||||
: QDate::currentDate()),
|
: QDate::currentDate()),
|
||||||
});
|
});
|
||||||
*shared = Ui::MakeWeak(box.data());
|
*shared = base::make_weak(box.data());
|
||||||
_showBoxCallback(std::move(box));
|
_showBoxCallback(std::move(box));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1530,7 +1530,7 @@ void InnerWidget::suggestRestrictParticipant(
|
|||||||
UserData *by,
|
UserData *by,
|
||||||
TimeId since) {
|
TimeId since) {
|
||||||
auto weak = QPointer<InnerWidget>(this);
|
auto weak = QPointer<InnerWidget>(this);
|
||||||
auto weakBox = std::make_shared<QPointer<Ui::BoxContent>>();
|
auto weakBox = std::make_shared<base::weak_qptr<Ui::BoxContent>>();
|
||||||
auto box = Box<EditRestrictedBox>(
|
auto box = Box<EditRestrictedBox>(
|
||||||
_channel,
|
_channel,
|
||||||
user,
|
user,
|
||||||
@ -1560,7 +1560,7 @@ void InnerWidget::suggestRestrictParticipant(
|
|||||||
tr::now,
|
tr::now,
|
||||||
lt_user,
|
lt_user,
|
||||||
participant->name());
|
participant->name());
|
||||||
auto weakBox = std::make_shared<QPointer<Ui::BoxContent>>();
|
auto weakBox = std::make_shared<base::weak_qptr<Ui::BoxContent>>();
|
||||||
const auto sure = crl::guard(this, [=] {
|
const auto sure = crl::guard(this, [=] {
|
||||||
restrictParticipant(
|
restrictParticipant(
|
||||||
participant,
|
participant,
|
||||||
@ -1810,10 +1810,8 @@ void InnerWidget::mouseActionFinish(const QPoint &screenPos, Qt::MouseButton but
|
|||||||
ActivateClickHandler(window(), activated, {
|
ActivateClickHandler(window(), activated, {
|
||||||
button,
|
button,
|
||||||
QVariant::fromValue(ClickHandlerContext{
|
QVariant::fromValue(ClickHandlerContext{
|
||||||
.elementDelegate = [weak = Ui::MakeWeak(this)] {
|
.elementDelegate = [weak = base::make_weak(this)] {
|
||||||
return weak
|
return (ElementDelegate*)weak.get();
|
||||||
? (ElementDelegate*)weak
|
|
||||||
: nullptr;
|
|
||||||
},
|
},
|
||||||
.sessionWindow = base::make_weak(_controller),
|
.sessionWindow = base::make_weak(_controller),
|
||||||
})
|
})
|
||||||
|
@ -1671,7 +1671,7 @@ void HistoryInner::touchEvent(QTouchEvent *e) {
|
|||||||
_touchInProgress = false;
|
_touchInProgress = false;
|
||||||
const auto notMoved = (_touchPos - _touchStart).manhattanLength()
|
const auto notMoved = (_touchPos - _touchStart).manhattanLength()
|
||||||
< QApplication::startDragDistance();
|
< QApplication::startDragDistance();
|
||||||
auto weak = Ui::MakeWeak(this);
|
auto weak = base::make_weak(this);
|
||||||
if (_touchSelect) {
|
if (_touchSelect) {
|
||||||
if (notMoved || _touchMaybeSelecting.current()) {
|
if (notMoved || _touchMaybeSelecting.current()) {
|
||||||
mouseActionFinish(_touchPos, Qt::RightButton);
|
mouseActionFinish(_touchPos, Qt::RightButton);
|
||||||
|
@ -356,7 +356,7 @@ void ShowSendPaidConfirm(
|
|||||||
const auto messages = details.messages;
|
const auto messages = details.messages;
|
||||||
const auto stars = details.stars;
|
const auto stars = details.stars;
|
||||||
show->showBox(Box([=](not_null<Ui::GenericBox*> box) {
|
show->showBox(Box([=](not_null<Ui::GenericBox*> box) {
|
||||||
const auto trust = std::make_shared<QPointer<Ui::Checkbox>>();
|
const auto trust = std::make_shared<base::weak_qptr<Ui::Checkbox>>();
|
||||||
const auto proceed = [=](Fn<void()> close) {
|
const auto proceed = [=](Fn<void()> close) {
|
||||||
if (singlePeer && (*trust)->checked()) {
|
if (singlePeer && (*trust)->checked()) {
|
||||||
const auto session = &singlePeer->session();
|
const auto session = &singlePeer->session();
|
||||||
|
@ -1024,7 +1024,7 @@ void HistoryWidget::setGeometryWithTopMoved(
|
|||||||
_topDelta = topDelta;
|
_topDelta = topDelta;
|
||||||
bool willBeResized = (size() != newGeometry.size());
|
bool willBeResized = (size() != newGeometry.size());
|
||||||
if (geometry() != newGeometry) {
|
if (geometry() != newGeometry) {
|
||||||
auto weak = Ui::MakeWeak(this);
|
auto weak = base::make_weak(this);
|
||||||
setGeometry(newGeometry);
|
setGeometry(newGeometry);
|
||||||
if (!weak) {
|
if (!weak) {
|
||||||
return;
|
return;
|
||||||
@ -4494,7 +4494,7 @@ void HistoryWidget::saveEditMessage(Api::SendOptions options) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto weak = Ui::MakeWeak(this);
|
const auto weak = base::make_weak(this);
|
||||||
const auto history = _history;
|
const auto history = _history;
|
||||||
|
|
||||||
const auto done = [=](mtpRequestId requestId) {
|
const auto done = [=](mtpRequestId requestId) {
|
||||||
@ -5603,7 +5603,7 @@ bool HistoryWidget::searchInChatEmbedded(
|
|||||||
if (!peer || Window::SeparateId(peer) != controller()->windowId()) {
|
if (!peer || Window::SeparateId(peer) != controller()->windowId()) {
|
||||||
return false;
|
return false;
|
||||||
} else if (_peer != peer) {
|
} else if (_peer != peer) {
|
||||||
const auto weak = Ui::MakeWeak(this);
|
const auto weak = base::make_weak(this);
|
||||||
controller()->showPeerHistory(peer);
|
controller()->showPeerHistory(peer);
|
||||||
if (!weak) {
|
if (!weak) {
|
||||||
return false;
|
return false;
|
||||||
@ -9054,9 +9054,9 @@ void HistoryWidget::forwardSelected() {
|
|||||||
if (!_list) {
|
if (!_list) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto weak = Ui::MakeWeak(this);
|
const auto weak = base::make_weak(this);
|
||||||
Window::ShowForwardMessagesBox(controller(), getSelectedItems(), [=] {
|
Window::ShowForwardMessagesBox(controller(), getSelectedItems(), [=] {
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
strong->clearSelected();
|
strong->clearSelected();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -256,9 +256,9 @@ List CreateList(
|
|||||||
}, list.container->lifetime());
|
}, list.container->lifetime());
|
||||||
|
|
||||||
list.container->paintRequest(
|
list.container->paintRequest(
|
||||||
) | rpl::start_with_next([weak = Ui::MakeWeak(list.container.get())](
|
) | rpl::start_with_next([weak = base::make_weak(list.container.get())](
|
||||||
const QRect &r) {
|
const QRect &r) {
|
||||||
auto p = QPainter(weak);
|
auto p = QPainter(weak.get());
|
||||||
p.fillRect(r, st::dialogsBg);
|
p.fillRect(r, st::dialogsBg);
|
||||||
}, list.container->lifetime());
|
}, list.container->lifetime());
|
||||||
|
|
||||||
@ -937,7 +937,7 @@ ComposeSearch::Inner::Inner(
|
|||||||
_apiSearch.newFounds(
|
_apiSearch.newFounds(
|
||||||
) | rpl::start_with_next([=] {
|
) | rpl::start_with_next([=] {
|
||||||
const auto &apiData = _apiSearch.messages();
|
const auto &apiData = _apiSearch.messages();
|
||||||
const auto weak = Ui::MakeWeak(_bottomBar.get());
|
const auto weak = base::make_weak(_bottomBar.get());
|
||||||
_bottomBar->setTotal(apiData.total);
|
_bottomBar->setTotal(apiData.total);
|
||||||
if (weak) {
|
if (weak) {
|
||||||
// Activating the first search result may switch the chat.
|
// Activating the first search result may switch the chat.
|
||||||
@ -970,7 +970,7 @@ ComposeSearch::Inner::Inner(
|
|||||||
_pendingJump.data = {};
|
_pendingJump.data = {};
|
||||||
const auto item = _history->owner().message(messages[index]);
|
const auto item = _history->owner().message(messages[index]);
|
||||||
if (item) {
|
if (item) {
|
||||||
const auto weak = Ui::MakeWeak(_topBar.get());
|
const auto weak = base::make_weak(_topBar.get());
|
||||||
_activations.fire_copy({ item, _apiSearch.request().query });
|
_activations.fire_copy({ item, _apiSearch.request().query });
|
||||||
if (weak) {
|
if (weak) {
|
||||||
hideList();
|
hideList();
|
||||||
|
@ -819,7 +819,7 @@ void DraftOptionsBox(
|
|||||||
FullReplyTo result,
|
FullReplyTo result,
|
||||||
Data::WebPageDraft webpage,
|
Data::WebPageDraft webpage,
|
||||||
std::optional<Data::ForwardOptions> options) {
|
std::optional<Data::ForwardOptions> options) {
|
||||||
const auto weak = Ui::MakeWeak(box);
|
const auto weak = base::make_weak(box);
|
||||||
auto forward = Data::ForwardDraft();
|
auto forward = Data::ForwardDraft();
|
||||||
if (options) {
|
if (options) {
|
||||||
forward.options = *options;
|
forward.options = *options;
|
||||||
@ -828,7 +828,7 @@ void DraftOptionsBox(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
done(std::move(result), std::move(webpage), std::move(forward));
|
done(std::move(result), std::move(webpage), std::move(forward));
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -847,7 +847,7 @@ void DraftOptionsBox(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto weak = Ui::MakeWeak(box);
|
const auto weak = base::make_weak(box);
|
||||||
Settings::AddButtonWithIcon(
|
Settings::AddButtonWithIcon(
|
||||||
bottom,
|
bottom,
|
||||||
tr::lng_reply_show_in_chat(),
|
tr::lng_reply_show_in_chat(),
|
||||||
@ -855,7 +855,7 @@ void DraftOptionsBox(
|
|||||||
{ &st::menuIconShowInChat }
|
{ &st::menuIconShowInChat }
|
||||||
)->setClickedCallback([=] {
|
)->setClickedCallback([=] {
|
||||||
highlight(resolveReply());
|
highlight(resolveReply());
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -1402,10 +1402,10 @@ void ShowReplyToChatBox(
|
|||||||
};
|
};
|
||||||
auto callback = [=, chosen = std::move(chosen)](
|
auto callback = [=, chosen = std::move(chosen)](
|
||||||
Controller::Chosen thread) mutable {
|
Controller::Chosen thread) mutable {
|
||||||
const auto weak = Ui::MakeWeak(state->box);
|
const auto weak = base::make_weak(state->box);
|
||||||
if (!chosen(thread)) {
|
if (!chosen(thread)) {
|
||||||
return;
|
return;
|
||||||
} else if (const auto strong = weak.data()) {
|
} else if (const auto strong = weak.get()) {
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -434,11 +434,11 @@ void EditWebPageOptions(
|
|||||||
});
|
});
|
||||||
|
|
||||||
box->addButton(tr::lng_settings_save(), [=] {
|
box->addButton(tr::lng_settings_save(), [=] {
|
||||||
const auto weak = Ui::MakeWeak(box.get());
|
const auto weak = base::make_weak(box.get());
|
||||||
auto result = state->result.current();
|
auto result = state->result.current();
|
||||||
result.manual = true;
|
result.manual = true;
|
||||||
done(result);
|
done(result);
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -484,13 +484,13 @@ void ChooseSuggestPriceBox(
|
|||||||
st::settingsButtonNoIcon);
|
st::settingsButtonNoIcon);
|
||||||
|
|
||||||
time->setClickedCallback([=] {
|
time->setClickedCallback([=] {
|
||||||
const auto weak = std::make_shared<QPointer<Ui::BoxContent>>();
|
const auto weak = std::make_shared<base::weak_qptr<Ui::BoxContent>>();
|
||||||
const auto parentWeak = Ui::MakeWeak(box);
|
const auto parentWeak = base::make_weak(box);
|
||||||
const auto done = [=](TimeId result) {
|
const auto done = [=](TimeId result) {
|
||||||
if (parentWeak) {
|
if (parentWeak) {
|
||||||
state->date = result;
|
state->date = result;
|
||||||
}
|
}
|
||||||
if (const auto strong = weak->data()) {
|
if (const auto strong = weak->get()) {
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -793,12 +793,12 @@ void SuggestOptions::paintLines(QPainter &p, int x, int y, int outerWidth) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SuggestOptions::edit() {
|
void SuggestOptions::edit() {
|
||||||
const auto weak = std::make_shared<QPointer<Ui::BoxContent>>();
|
const auto weak = std::make_shared<base::weak_qptr<Ui::BoxContent>>();
|
||||||
const auto apply = [=](SuggestPostOptions values) {
|
const auto apply = [=](SuggestPostOptions values) {
|
||||||
_values = values;
|
_values = values;
|
||||||
updateTexts();
|
updateTexts();
|
||||||
_updates.fire({});
|
_updates.fire({});
|
||||||
if (const auto strong = weak->data()) {
|
if (const auto strong = weak->get()) {
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -2082,7 +2082,7 @@ void VoiceRecordBar::stopRecording(StopType type, bool ttlBeforeHide) {
|
|||||||
}
|
}
|
||||||
} else if (type == StopType::Send) {
|
} else if (type == StopType::Send) {
|
||||||
if (_videoRecorder) {
|
if (_videoRecorder) {
|
||||||
const auto weak = Ui::MakeWeak(this);
|
const auto weak = base::make_weak(this);
|
||||||
_videoRecorder->hide([=](Ui::RoundVideoResult data) {
|
_videoRecorder->hide([=](Ui::RoundVideoResult data) {
|
||||||
crl::on_main([=, data = std::move(data)]() mutable {
|
crl::on_main([=, data = std::move(data)]() mutable {
|
||||||
if (weak) {
|
if (weak) {
|
||||||
|
@ -941,9 +941,9 @@ ChatPreview MakeChatPreview(
|
|||||||
result.actions = action->actions();
|
result.actions = action->actions();
|
||||||
menu->addAction(std::move(action));
|
menu->addAction(std::move(action));
|
||||||
if (const auto topic = thread->asTopic()) {
|
if (const auto topic = thread->asTopic()) {
|
||||||
const auto weak = Ui::MakeWeak(menu);
|
const auto weak = base::make_weak(menu);
|
||||||
topic->destroyed() | rpl::start_with_next([weak] {
|
topic->destroyed() | rpl::start_with_next([weak] {
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
LOG(("Preview hidden for a destroyed topic."));
|
LOG(("Preview hidden for a destroyed topic."));
|
||||||
strong->hideMenu(true);
|
strong->hideMenu(true);
|
||||||
}
|
}
|
||||||
|
@ -2315,9 +2315,9 @@ bool ChatWidget::preventsClose(Fn<void()> &&continueCallback) const {
|
|||||||
} else if (!_newTopicDiscarded
|
} else if (!_newTopicDiscarded
|
||||||
&& _topic
|
&& _topic
|
||||||
&& _topic->creating()) {
|
&& _topic->creating()) {
|
||||||
const auto weak = Ui::MakeWeak(this);
|
const auto weak = base::make_weak(this);
|
||||||
auto sure = [=](Fn<void()> &&close) {
|
auto sure = [=](Fn<void()> &&close) {
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
strong->_newTopicDiscarded = true;
|
strong->_newTopicDiscarded = true;
|
||||||
}
|
}
|
||||||
close();
|
close();
|
||||||
@ -2602,7 +2602,7 @@ void ChatWidget::subscribeToSublist() {
|
|||||||
void ChatWidget::unreadCountUpdated() {
|
void ChatWidget::unreadCountUpdated() {
|
||||||
if (_sublist && _sublist->unreadMark()) {
|
if (_sublist && _sublist->unreadMark()) {
|
||||||
crl::on_main(this, [=] {
|
crl::on_main(this, [=] {
|
||||||
const auto guard = Ui::MakeWeak(this);
|
const auto guard = base::make_weak(this);
|
||||||
controller()->showPeerHistory(_sublist->owningHistory());
|
controller()->showPeerHistory(_sublist->owningHistory());
|
||||||
if (guard) {
|
if (guard) {
|
||||||
closeCurrent();
|
closeCurrent();
|
||||||
|
@ -947,8 +947,8 @@ void BusinessBotStatus::Bar::showMenu() {
|
|||||||
this,
|
this,
|
||||||
st::popupMenuExpandedSeparator);
|
st::popupMenuExpandedSeparator);
|
||||||
_menu->setDestroyedCallback([
|
_menu->setDestroyedCallback([
|
||||||
weak = Ui::MakeWeak(this),
|
weak = base::make_weak(this),
|
||||||
weakButton = Ui::MakeWeak(_settings.data()),
|
weakButton = base::make_weak(_settings.data()),
|
||||||
menu = _menu.get()] {
|
menu = _menu.get()] {
|
||||||
if (weak && weak->_menu == menu) {
|
if (weak && weak->_menu == menu) {
|
||||||
if (weakButton) {
|
if (weakButton) {
|
||||||
|
@ -287,9 +287,9 @@ void AddDocumentActions(
|
|||||||
item->history()->peer,
|
item->history()->peer,
|
||||||
document);
|
document);
|
||||||
if (notAutoplayedGif) {
|
if (notAutoplayedGif) {
|
||||||
const auto weak = Ui::MakeWeak(list.get());
|
const auto weak = base::make_weak(list.get());
|
||||||
menu->addAction(tr::lng_context_open_gif(tr::now), [=] {
|
menu->addAction(tr::lng_context_open_gif(tr::now), [=] {
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
OpenGif(strong, contextId);
|
OpenGif(strong, contextId);
|
||||||
}
|
}
|
||||||
}, &st::menuIconShowInChat);
|
}, &st::menuIconShowInChat);
|
||||||
@ -390,9 +390,9 @@ bool AddForwardSelectedAction(
|
|||||||
}
|
}
|
||||||
|
|
||||||
menu->addAction(tr::lng_context_forward_selected(tr::now), [=] {
|
menu->addAction(tr::lng_context_forward_selected(tr::now), [=] {
|
||||||
const auto weak = Ui::MakeWeak(list);
|
const auto weak = base::make_weak(list);
|
||||||
const auto callback = [=] {
|
const auto callback = [=] {
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
strong->cancelSelection();
|
strong->cancelSelection();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -471,7 +471,7 @@ bool AddSendNowSelectedAction(
|
|||||||
const auto history = *histories.begin();
|
const auto history = *histories.begin();
|
||||||
|
|
||||||
menu->addAction(tr::lng_context_send_now_selected(tr::now), [=] {
|
menu->addAction(tr::lng_context_send_now_selected(tr::now), [=] {
|
||||||
const auto weak = Ui::MakeWeak(list);
|
const auto weak = base::make_weak(list);
|
||||||
const auto callback = [=] {
|
const auto callback = [=] {
|
||||||
request.navigation->showBackFromStack();
|
request.navigation->showBackFromStack();
|
||||||
};
|
};
|
||||||
@ -1149,9 +1149,9 @@ void EditTagBox(
|
|||||||
field->showError();
|
field->showError();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto weak = Ui::MakeWeak(box);
|
const auto weak = base::make_weak(box);
|
||||||
controller->session().data().reactions().renameTag(id, text);
|
controller->session().data().reactions().renameTag(id, text);
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -1629,10 +1629,10 @@ void AddWhoReactedAction(
|
|||||||
not_null<HistoryItem*> item,
|
not_null<HistoryItem*> item,
|
||||||
not_null<Window::SessionController*> controller) {
|
not_null<Window::SessionController*> controller) {
|
||||||
const auto whoReadIds = std::make_shared<Api::WhoReadList>();
|
const auto whoReadIds = std::make_shared<Api::WhoReadList>();
|
||||||
const auto weak = Ui::MakeWeak(menu.get());
|
const auto weak = base::make_weak(menu.get());
|
||||||
const auto user = item->history()->peer;
|
const auto user = item->history()->peer;
|
||||||
const auto showOrPremium = [=] {
|
const auto showOrPremium = [=] {
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
strong->hideMenu();
|
strong->hideMenu();
|
||||||
}
|
}
|
||||||
const auto type = Ui::ShowOrPremium::ReadTime;
|
const auto type = Ui::ShowOrPremium::ReadTime;
|
||||||
@ -1647,14 +1647,14 @@ void AddWhoReactedAction(
|
|||||||
};
|
};
|
||||||
const auto itemId = item->fullId();
|
const auto itemId = item->fullId();
|
||||||
const auto participantChosen = [=](Ui::WhoReadParticipant who) {
|
const auto participantChosen = [=](Ui::WhoReadParticipant who) {
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
strong->hideMenu();
|
strong->hideMenu();
|
||||||
}
|
}
|
||||||
ShowWhoReadInfo(controller, itemId, who);
|
ShowWhoReadInfo(controller, itemId, who);
|
||||||
};
|
};
|
||||||
const auto showAllChosen = [=, itemId = item->fullId()]{
|
const auto showAllChosen = [=, itemId = item->fullId()]{
|
||||||
// Pressing on an item that has a submenu doesn't hide it :(
|
// Pressing on an item that has a submenu doesn't hide it :(
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
strong->hideMenu();
|
strong->hideMenu();
|
||||||
}
|
}
|
||||||
if (const auto item = controller->session().data().message(itemId)) {
|
if (const auto item = controller->session().data().message(itemId)) {
|
||||||
|
@ -3123,7 +3123,7 @@ void ListWidget::touchEvent(QTouchEvent *e) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_touchInProgress = false;
|
_touchInProgress = false;
|
||||||
auto weak = Ui::MakeWeak(this);
|
auto weak = base::make_weak(this);
|
||||||
const auto notMoved = (_touchPos - _touchStart).manhattanLength()
|
const auto notMoved = (_touchPos - _touchStart).manhattanLength()
|
||||||
< QApplication::startDragDistance();
|
< QApplication::startDragDistance();
|
||||||
if (_touchSelect) {
|
if (_touchSelect) {
|
||||||
@ -3625,10 +3625,8 @@ void ListWidget::mouseActionFinish(
|
|||||||
ClickHandlerContext ListWidget::prepareClickHandlerContext(FullMsgId id) {
|
ClickHandlerContext ListWidget::prepareClickHandlerContext(FullMsgId id) {
|
||||||
return {
|
return {
|
||||||
.itemId = id,
|
.itemId = id,
|
||||||
.elementDelegate = [weak = Ui::MakeWeak(this)] {
|
.elementDelegate = [weak = base::make_weak(this)] {
|
||||||
return weak
|
return (ElementDelegate*)weak.get();
|
||||||
? (ElementDelegate*)weak
|
|
||||||
: nullptr;
|
|
||||||
},
|
},
|
||||||
.sessionWindow = base::make_weak(controller()),
|
.sessionWindow = base::make_weak(controller()),
|
||||||
};
|
};
|
||||||
@ -4347,9 +4345,9 @@ void ConfirmForwardSelectedItems(not_null<ListWidget*> widget) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
auto ids = widget->getSelectedIds();
|
auto ids = widget->getSelectedIds();
|
||||||
const auto weak = Ui::MakeWeak(widget);
|
const auto weak = base::make_weak(widget);
|
||||||
Window::ShowForwardMessagesBox(widget->controller(), std::move(ids), [=] {
|
Window::ShowForwardMessagesBox(widget->controller(), std::move(ids), [=] {
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
strong->cancelSelection();
|
strong->cancelSelection();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -4378,8 +4376,8 @@ void ConfirmSendNowSelectedItems(not_null<ListWidget*> widget) {
|
|||||||
if (!history) {
|
if (!history) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto clearSelection = [weak = Ui::MakeWeak(widget)] {
|
const auto clearSelection = [weak = base::make_weak(widget)] {
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
strong->cancelSelection();
|
strong->cancelSelection();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1340,9 +1340,9 @@ void ScheduledWidget::showProcessingVideoTooltip() {
|
|||||||
st::defaultImportantTooltipLabel),
|
st::defaultImportantTooltipLabel),
|
||||||
st::defaultImportantTooltip);
|
st::defaultImportantTooltip);
|
||||||
const auto tooltip = _processingVideoTooltip.get();
|
const auto tooltip = _processingVideoTooltip.get();
|
||||||
const auto weak = QPointer<QWidget>(tooltip);
|
const auto weak = base::make_weak(tooltip);
|
||||||
const auto destroy = [=] {
|
const auto destroy = [=] {
|
||||||
delete weak.data();
|
delete weak.get();
|
||||||
};
|
};
|
||||||
tooltip->setAttribute(Qt::WA_TransparentForMouseEvents);
|
tooltip->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||||
tooltip->setHiddenCallback([=] {
|
tooltip->setHiddenCallback([=] {
|
||||||
|
@ -336,8 +336,8 @@ bool TopBarWidget::createMenu(not_null<Ui::IconButton*> button) {
|
|||||||
this,
|
this,
|
||||||
st::popupMenuExpandedSeparator);
|
st::popupMenuExpandedSeparator);
|
||||||
_menu->setDestroyedCallback([
|
_menu->setDestroyedCallback([
|
||||||
weak = Ui::MakeWeak(this),
|
weak = base::make_weak(this),
|
||||||
weakButton = Ui::MakeWeak(button),
|
weakButton = base::make_weak(button),
|
||||||
menu = _menu.get()] {
|
menu = _menu.get()] {
|
||||||
if (weak && weak->_menu == menu) {
|
if (weak && weak->_menu == menu) {
|
||||||
if (weakButton) {
|
if (weakButton) {
|
||||||
|
@ -409,8 +409,8 @@ base::unique_qptr<Ui::PopupMenu> TranslateBar::createMenu(
|
|||||||
st::popupMenuExpandedSeparator);
|
st::popupMenuExpandedSeparator);
|
||||||
result->setDestroyedCallback([
|
result->setDestroyedCallback([
|
||||||
this,
|
this,
|
||||||
weak = Ui::MakeWeak(&_wrap),
|
weak = base::make_weak(&_wrap),
|
||||||
weakButton = Ui::MakeWeak(button),
|
weakButton = base::make_weak(button),
|
||||||
menu = result.get()
|
menu = result.get()
|
||||||
] {
|
] {
|
||||||
if (weak && _menu == menu) {
|
if (weak && _menu == menu) {
|
||||||
@ -430,7 +430,7 @@ void TranslateBar::showMenu(base::unique_qptr<Ui::PopupMenu> menu) {
|
|||||||
_menu = std::move(menu);
|
_menu = std::move(menu);
|
||||||
_menu->setForcedOrigin(Ui::PanelAnimation::Origin::TopRight);
|
_menu->setForcedOrigin(Ui::PanelAnimation::Origin::TopRight);
|
||||||
|
|
||||||
const auto guard = Ui::MakeWeak(&_wrap);
|
const auto guard = base::make_weak(&_wrap);
|
||||||
const auto now = _history->translatedTo();
|
const auto now = _history->translatedTo();
|
||||||
const auto to = now ? now : Ui::ChooseTranslateTo(_history);
|
const auto to = now ? now : Ui::ChooseTranslateTo(_history);
|
||||||
const auto weak = base::make_weak(_controller);
|
const auto weak = base::make_weak(_controller);
|
||||||
|
@ -549,7 +549,7 @@ object_ptr<Ui::BoxContent> JoinStarRefBox(
|
|||||||
|
|
||||||
struct State {
|
struct State {
|
||||||
rpl::variable<not_null<PeerData*>> recipient;
|
rpl::variable<not_null<PeerData*>> recipient;
|
||||||
QPointer<Ui::GenericBox> weak;
|
base::weak_qptr<Ui::GenericBox> weak;
|
||||||
bool sent = false;
|
bool sent = false;
|
||||||
};
|
};
|
||||||
const auto state = std::make_shared<State>(State{
|
const auto state = std::make_shared<State>(State{
|
||||||
@ -709,7 +709,7 @@ object_ptr<Ui::BoxContent> JoinStarRefBox(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
show->show(StarRefLinkBox(info, recipient));
|
show->show(StarRefLinkBox(info, recipient));
|
||||||
if (const auto strong = state->weak.data()) {
|
if (const auto strong = state->weak.get()) {
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
}
|
}
|
||||||
}, [=](const QString &error) {
|
}, [=](const QString &error) {
|
||||||
|
@ -1105,7 +1105,7 @@ std::shared_ptr<Info::Memento> Make(not_null<PeerData*> peer) {
|
|||||||
object_ptr<Ui::BoxContent> ProgramsListBox(
|
object_ptr<Ui::BoxContent> ProgramsListBox(
|
||||||
not_null<Window::SessionController*> window,
|
not_null<Window::SessionController*> window,
|
||||||
not_null<PeerData*> peer) {
|
not_null<PeerData*> peer) {
|
||||||
const auto weak = std::make_shared<QPointer<PeerListBox>>();
|
const auto weak = std::make_shared<base::weak_qptr<PeerListBox>>();
|
||||||
const auto initBox = [=](not_null<PeerListBox*> box) {
|
const auto initBox = [=](not_null<PeerListBox*> box) {
|
||||||
*weak = box;
|
*weak = box;
|
||||||
box->addButton(tr::lng_close(), [=] {
|
box->addButton(tr::lng_close(), [=] {
|
||||||
@ -1118,7 +1118,7 @@ object_ptr<Ui::BoxContent> ProgramsListBox(
|
|||||||
peer,
|
peer,
|
||||||
JoinType::Existing);
|
JoinType::Existing);
|
||||||
controller->addForBotRequests() | rpl::start_with_next([=] {
|
controller->addForBotRequests() | rpl::start_with_next([=] {
|
||||||
if (const auto strong = weak->data()) {
|
if (const auto strong = weak->get()) {
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
}
|
}
|
||||||
}, controller->lifetime());
|
}, controller->lifetime());
|
||||||
|
@ -738,7 +738,7 @@ void InnerWidget::setupEnd() {
|
|||||||
tr::lng_star_ref_end(),
|
tr::lng_star_ref_end(),
|
||||||
st::settingsAttentionButton));
|
st::settingsAttentionButton));
|
||||||
end->setClickedCallback([=] {
|
end->setClickedCallback([=] {
|
||||||
const auto weak = Ui::MakeWeak(this);
|
const auto weak = base::make_weak(this);
|
||||||
const auto window = _controller->parentController();
|
const auto window = _controller->parentController();
|
||||||
const auto sent = std::make_shared<bool>();
|
const auto sent = std::make_shared<bool>();
|
||||||
window->show(ConfirmEndBox([=] {
|
window->show(ConfirmEndBox([=] {
|
||||||
@ -751,7 +751,7 @@ void InnerWidget::setupEnd() {
|
|||||||
*sent = false;
|
*sent = false;
|
||||||
if (!success) {
|
if (!success) {
|
||||||
return;
|
return;
|
||||||
} else if ([[maybe_unused]] const auto strong = weak.data()) {
|
} else if ([[maybe_unused]] const auto strong = weak.get()) {
|
||||||
_controller->showBackFromStack();
|
_controller->showBackFromStack();
|
||||||
window->showToast({
|
window->showToast({
|
||||||
.title = tr::lng_star_ref_ended_title(tr::now),
|
.title = tr::lng_star_ref_ended_title(tr::now),
|
||||||
@ -1013,7 +1013,7 @@ std::unique_ptr<Ui::RpWidget> Widget::setupBottom() {
|
|||||||
st::boxDividerLabel),
|
st::boxDividerLabel),
|
||||||
QMargins(margins.left(), 0, margins.right(), 0));
|
QMargins(margins.left(), 0, margins.right(), 0));
|
||||||
save->setClickedCallback([=] {
|
save->setClickedCallback([=] {
|
||||||
const auto weak = Ui::MakeWeak(this);
|
const auto weak = base::make_weak(this);
|
||||||
const auto user = _state->user;
|
const auto user = _state->user;
|
||||||
const auto program = _state->program;
|
const auto program = _state->program;
|
||||||
const auto show = controller()->uiShow();
|
const auto show = controller()->uiShow();
|
||||||
|
@ -1459,11 +1459,11 @@ void CreateGiveawayBox(
|
|||||||
}
|
}
|
||||||
state->confirmButtonBusy = true;
|
state->confirmButtonBusy = true;
|
||||||
const auto show = box->uiShow();
|
const auto show = box->uiShow();
|
||||||
const auto weak = Ui::MakeWeak(box.get());
|
const auto weak = base::make_weak(box.get());
|
||||||
const auto done = [=](Payments::CheckoutResult result) {
|
const auto done = [=](Payments::CheckoutResult result) {
|
||||||
const auto isPaid = result == Payments::CheckoutResult::Paid;
|
const auto isPaid = result == Payments::CheckoutResult::Paid;
|
||||||
if (result == Payments::CheckoutResult::Pending || isPaid) {
|
if (result == Payments::CheckoutResult::Pending || isPaid) {
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.get()) {
|
||||||
strong->window()->setFocus();
|
strong->window()->setFocus();
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user