mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-06 15:13:57 +02:00
Fixed display of most of multiline toasts in corresponding window.
This commit is contained in:
parent
eba606e85e
commit
6d4506f8aa
11 changed files with 38 additions and 11 deletions
|
@ -586,6 +586,7 @@ void ChannelsLimitBox(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ui::ShowMultilineToast({
|
Ui::ShowMultilineToast({
|
||||||
|
.parentOverride = Ui::BoxShow(box).toastParent(),
|
||||||
.text = { tr::lng_channels_leave_done(tr::now) },
|
.text = { tr::lng_channels_leave_done(tr::now) },
|
||||||
});
|
});
|
||||||
box->closeBox();
|
box->closeBox();
|
||||||
|
|
|
@ -594,7 +594,7 @@ void SettingsBox(
|
||||||
});
|
});
|
||||||
const auto showToast = crl::guard(box, [=](QString text) {
|
const auto showToast = crl::guard(box, [=](QString text) {
|
||||||
Ui::ShowMultilineToast({
|
Ui::ShowMultilineToast({
|
||||||
.parentOverride = box->getDelegate()->outerContainer(),
|
.parentOverride = Ui::BoxShow(box).toastParent(),
|
||||||
.text = { text },
|
.text = { text },
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -637,7 +637,7 @@ void SettingsBox(
|
||||||
QGuiApplication::clipboard()->setText(link);
|
QGuiApplication::clipboard()->setText(link);
|
||||||
if (weakBox) {
|
if (weakBox) {
|
||||||
Ui::ShowMultilineToast({
|
Ui::ShowMultilineToast({
|
||||||
.parentOverride = box->getDelegate()->outerContainer(),
|
.parentOverride = Ui::BoxShow(box).toastParent(),
|
||||||
.text = { tr::lng_create_channel_link_copied(tr::now) },
|
.text = { tr::lng_create_channel_link_copied(tr::now) },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -2434,6 +2434,7 @@ bool HistoryInner::showCopyRestriction(HistoryItem *item) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Ui::ShowMultilineToast({
|
Ui::ShowMultilineToast({
|
||||||
|
.parentOverride = Window::Show(_controller).toastParent(),
|
||||||
.text = { _peer->isBroadcast()
|
.text = { _peer->isBroadcast()
|
||||||
? tr::lng_error_nocopy_channel(tr::now)
|
? tr::lng_error_nocopy_channel(tr::now)
|
||||||
: tr::lng_error_nocopy_group(tr::now) },
|
: tr::lng_error_nocopy_group(tr::now) },
|
||||||
|
|
|
@ -1008,6 +1008,7 @@ void HistoryWidget::initVoiceRecordBar() {
|
||||||
_voiceRecordBar->recordingTipRequests(
|
_voiceRecordBar->recordingTipRequests(
|
||||||
) | rpl::start_with_next([=] {
|
) | rpl::start_with_next([=] {
|
||||||
Ui::ShowMultilineToast({
|
Ui::ShowMultilineToast({
|
||||||
|
.parentOverride = Window::Show(controller()).toastParent(),
|
||||||
.text = { tr::lng_record_hold_tip(tr::now) },
|
.text = { tr::lng_record_hold_tip(tr::now) },
|
||||||
});
|
});
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
|
@ -1557,6 +1558,7 @@ void HistoryWidget::toggleChooseChatTheme(not_null<PeerData*> peer) {
|
||||||
return;
|
return;
|
||||||
} else if (_voiceRecordBar->isActive()) {
|
} else if (_voiceRecordBar->isActive()) {
|
||||||
Ui::ShowMultilineToast({
|
Ui::ShowMultilineToast({
|
||||||
|
.parentOverride = Window::Show(controller()).toastParent(),
|
||||||
.text = { tr::lng_chat_theme_cant_voice(tr::now) },
|
.text = { tr::lng_chat_theme_cant_voice(tr::now) },
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
|
@ -2951,6 +2953,7 @@ void HistoryWidget::messagesFailed(const MTP::Error &error, int requestId) {
|
||||||
auto was = _peer;
|
auto was = _peer;
|
||||||
controller()->showBackFromStack();
|
controller()->showBackFromStack();
|
||||||
Ui::ShowMultilineToast({
|
Ui::ShowMultilineToast({
|
||||||
|
.parentOverride = Window::Show(controller()).toastParent(),
|
||||||
.text = { (was && was->isMegagroup())
|
.text = { (was && was->isMegagroup())
|
||||||
? tr::lng_group_not_accessible(tr::now)
|
? tr::lng_group_not_accessible(tr::now)
|
||||||
: tr::lng_channel_not_accessible(tr::now) },
|
: tr::lng_channel_not_accessible(tr::now) },
|
||||||
|
@ -3736,6 +3739,7 @@ void HistoryWidget::send(Api::SendOptions options) {
|
||||||
options.scheduled);
|
options.scheduled);
|
||||||
if (!error.isEmpty()) {
|
if (!error.isEmpty()) {
|
||||||
Ui::ShowMultilineToast({
|
Ui::ShowMultilineToast({
|
||||||
|
.parentOverride = Window::Show(controller()).toastParent(),
|
||||||
.text = { error },
|
.text = { error },
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
|
@ -4043,6 +4047,7 @@ void HistoryWidget::chooseAttach(
|
||||||
_peer,
|
_peer,
|
||||||
ChatRestriction::SendMedia)) {
|
ChatRestriction::SendMedia)) {
|
||||||
Ui::ShowMultilineToast({
|
Ui::ShowMultilineToast({
|
||||||
|
.parentOverride = Window::Show(controller()).toastParent(),
|
||||||
.text = { *error },
|
.text = { *error },
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
|
@ -4915,6 +4920,7 @@ bool HistoryWidget::showSendingFilesError(
|
||||||
}
|
}
|
||||||
|
|
||||||
Ui::ShowMultilineToast({
|
Ui::ShowMultilineToast({
|
||||||
|
.parentOverride = Window::Show(controller()).toastParent(),
|
||||||
.text = { text },
|
.text = { text },
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
|
@ -5313,6 +5319,7 @@ int HistoryWidget::countInitialScrollTop() {
|
||||||
if (itemTop < 0) {
|
if (itemTop < 0) {
|
||||||
setMsgId(0);
|
setMsgId(0);
|
||||||
Ui::ShowMultilineToast({
|
Ui::ShowMultilineToast({
|
||||||
|
.parentOverride = Window::Show(controller()).toastParent(),
|
||||||
.text = { tr::lng_message_not_found(tr::now) },
|
.text = { tr::lng_message_not_found(tr::now) },
|
||||||
});
|
});
|
||||||
return countInitialScrollTop();
|
return countInitialScrollTop();
|
||||||
|
@ -6185,6 +6192,7 @@ bool HistoryWidget::showSlowmodeError() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Ui::ShowMultilineToast({
|
Ui::ShowMultilineToast({
|
||||||
|
.parentOverride = Window::Show(controller()).toastParent(),
|
||||||
.text = { text },
|
.text = { text },
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -674,10 +674,16 @@ ClickHandlerPtr Element::fromLink() const {
|
||||||
}
|
}
|
||||||
if (const auto forwarded = item->Get<HistoryMessageForwarded>()) {
|
if (const auto forwarded = item->Get<HistoryMessageForwarded>()) {
|
||||||
if (forwarded->imported) {
|
if (forwarded->imported) {
|
||||||
static const auto imported = std::make_shared<LambdaClickHandler>([] {
|
static const auto imported = std::make_shared<LambdaClickHandler>([](
|
||||||
Ui::ShowMultilineToast({
|
ClickContext context) {
|
||||||
.text = { tr::lng_forwarded_imported(tr::now) },
|
const auto my = context.other.value<ClickHandlerContext>();
|
||||||
});
|
const auto weak = my.sessionWindow;
|
||||||
|
if (const auto strong = weak.get()) {
|
||||||
|
Ui::ShowMultilineToast({
|
||||||
|
.parentOverride = Window::Show(strong).toastParent(),
|
||||||
|
.text = { tr::lng_forwarded_imported(tr::now) },
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return imported;
|
return imported;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1210,6 +1210,7 @@ bool ListWidget::showCopyRestriction(HistoryItem *item) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Ui::ShowMultilineToast({
|
Ui::ShowMultilineToast({
|
||||||
|
.parentOverride = Window::Show(_controller).toastParent(),
|
||||||
.text = { (type == CopyRestrictionType::Channel)
|
.text = { (type == CopyRestrictionType::Channel)
|
||||||
? tr::lng_error_nocopy_channel(tr::now)
|
? tr::lng_error_nocopy_channel(tr::now)
|
||||||
: tr::lng_error_nocopy_group(tr::now) },
|
: tr::lng_error_nocopy_group(tr::now) },
|
||||||
|
|
|
@ -652,6 +652,7 @@ void RepliesWidget::chooseAttach() {
|
||||||
_history->peer,
|
_history->peer,
|
||||||
ChatRestriction::SendMedia)) {
|
ChatRestriction::SendMedia)) {
|
||||||
Ui::ShowMultilineToast({
|
Ui::ShowMultilineToast({
|
||||||
|
.parentOverride = Window::Show(controller()).toastParent(),
|
||||||
.text = { *error },
|
.text = { *error },
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
|
@ -843,6 +844,7 @@ bool RepliesWidget::showSlowmodeError() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Ui::ShowMultilineToast({
|
Ui::ShowMultilineToast({
|
||||||
|
.parentOverride = Window::Show(controller()).toastParent(),
|
||||||
.text = { text },
|
.text = { text },
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
|
@ -954,6 +956,7 @@ bool RepliesWidget::showSendingFilesError(
|
||||||
}
|
}
|
||||||
|
|
||||||
Ui::ShowMultilineToast({
|
Ui::ShowMultilineToast({
|
||||||
|
.parentOverride = Window::Show(controller()).toastParent(),
|
||||||
.text = { text },
|
.text = { text },
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
|
@ -1009,6 +1012,7 @@ void RepliesWidget::send(Api::SendOptions options) {
|
||||||
// message.textWithTags);
|
// message.textWithTags);
|
||||||
//if (!error.isEmpty()) {
|
//if (!error.isEmpty()) {
|
||||||
// Ui::ShowMultilineToast({
|
// Ui::ShowMultilineToast({
|
||||||
|
// .parentOverride = Window::Show(controller()).toastParent(),
|
||||||
// .text = { error },
|
// .text = { error },
|
||||||
// });
|
// });
|
||||||
// return;
|
// return;
|
||||||
|
|
|
@ -319,6 +319,7 @@ void ScheduledWidget::chooseAttach() {
|
||||||
_history->peer,
|
_history->peer,
|
||||||
ChatRestriction::SendMedia)) {
|
ChatRestriction::SendMedia)) {
|
||||||
Ui::ShowMultilineToast({
|
Ui::ShowMultilineToast({
|
||||||
|
.parentOverride = Window::Show(controller()).toastParent(),
|
||||||
.text = { *error },
|
.text = { *error },
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
|
@ -574,6 +575,7 @@ bool ScheduledWidget::showSendingFilesError(
|
||||||
}
|
}
|
||||||
|
|
||||||
Ui::ShowMultilineToast({
|
Ui::ShowMultilineToast({
|
||||||
|
.parentOverride = Window::Show(controller()).toastParent(),
|
||||||
.text = { text },
|
.text = { text },
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
|
@ -609,6 +611,7 @@ void ScheduledWidget::send(Api::SendOptions options) {
|
||||||
// message.textWithTags);
|
// message.textWithTags);
|
||||||
//if (!error.isEmpty()) {
|
//if (!error.isEmpty()) {
|
||||||
// Ui::ShowMultilineToast({
|
// Ui::ShowMultilineToast({
|
||||||
|
// .parentOverride = Window::Show(controller()).toastParent(),
|
||||||
// .text = { error },
|
// .text = { error },
|
||||||
// });
|
// });
|
||||||
// return;
|
// return;
|
||||||
|
|
|
@ -1253,6 +1253,7 @@ void MainWidget::showChooseReportMessages(
|
||||||
SectionShow::Way::Forward,
|
SectionShow::Way::Forward,
|
||||||
ShowForChooseMessagesMsgId);
|
ShowForChooseMessagesMsgId);
|
||||||
Ui::ShowMultilineToast({
|
Ui::ShowMultilineToast({
|
||||||
|
.parentOverride = Window::Show(controller()).toastParent(),
|
||||||
.text = { tr::lng_report_please_select_messages(tr::now) },
|
.text = { tr::lng_report_please_select_messages(tr::now) },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1266,8 +1266,8 @@ QPointer<Ui::BoxContent> ShowSendNowMessagesBox(
|
||||||
TextWithTags());
|
TextWithTags());
|
||||||
if (!error.isEmpty()) {
|
if (!error.isEmpty()) {
|
||||||
Ui::ShowMultilineToast({
|
Ui::ShowMultilineToast({
|
||||||
navigation->parentController()->widget()->bodyWidget(),
|
.parentOverride = Window::Show(navigation).toastParent(),
|
||||||
{ error },
|
.text = { error },
|
||||||
});
|
});
|
||||||
return { nullptr };
|
return { nullptr };
|
||||||
}
|
}
|
||||||
|
|
|
@ -266,8 +266,9 @@ void SessionNavigation::resolveChannelById(
|
||||||
}
|
}
|
||||||
const auto fail = [=] {
|
const auto fail = [=] {
|
||||||
Ui::ShowMultilineToast({
|
Ui::ShowMultilineToast({
|
||||||
|
.parentOverride = Window::Show(this).toastParent(),
|
||||||
.text = { tr::lng_error_post_link_invalid(tr::now) }
|
.text = { tr::lng_error_post_link_invalid(tr::now) }
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
_api.request(base::take(_resolveRequestId)).cancel();
|
_api.request(base::take(_resolveRequestId)).cancel();
|
||||||
_resolveRequestId = _api.request(MTPchannels_GetChannels(
|
_resolveRequestId = _api.request(MTPchannels_GetChannels(
|
||||||
|
@ -400,6 +401,7 @@ void SessionNavigation::joinVoiceChatFromLink(
|
||||||
|
|
||||||
const auto bad = [=] {
|
const auto bad = [=] {
|
||||||
Ui::ShowMultilineToast({
|
Ui::ShowMultilineToast({
|
||||||
|
.parentOverride = Window::Show(this).toastParent(),
|
||||||
.text = { tr::lng_group_invite_bad_link(tr::now) }
|
.text = { tr::lng_group_invite_bad_link(tr::now) }
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -428,8 +430,7 @@ void SessionNavigation::joinVoiceChatFromLink(
|
||||||
_resolveRequestId = _api.request(
|
_resolveRequestId = _api.request(
|
||||||
MTPphone_GetGroupCall(call->input(), MTP_int(limit))
|
MTPphone_GetGroupCall(call->input(), MTP_int(limit))
|
||||||
).done([=](const MTPphone_GroupCall &result) {
|
).done([=](const MTPphone_GroupCall &result) {
|
||||||
if (const auto now = peer->groupCall()
|
if (const auto now = peer->groupCall(); now && now->id() == id) {
|
||||||
; now && now->id() == id) {
|
|
||||||
if (!now->loaded()) {
|
if (!now->loaded()) {
|
||||||
now->processFullCall(result);
|
now->processFullCall(result);
|
||||||
}
|
}
|
||||||
|
@ -1229,6 +1230,7 @@ void SessionController::showPeer(not_null<PeerData*> peer, MsgId msgId) {
|
||||||
|| currentPeer->asChannel()->linkedChat()
|
|| currentPeer->asChannel()->linkedChat()
|
||||||
!= clickedChannel)) {
|
!= clickedChannel)) {
|
||||||
Ui::ShowMultilineToast({
|
Ui::ShowMultilineToast({
|
||||||
|
.parentOverride = Window::Show(this).toastParent(),
|
||||||
.text = {
|
.text = {
|
||||||
.text = peer->isMegagroup()
|
.text = peer->isMegagroup()
|
||||||
? tr::lng_group_not_accessible(tr::now)
|
? tr::lng_group_not_accessible(tr::now)
|
||||||
|
|
Loading…
Add table
Reference in a new issue