Allow all toasts to be multiline in voice chats.
This commit is contained in:
parent
a33a4c0589
commit
b439ecce16
|
@ -23,7 +23,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "ui/layers/layer_manager.h"
|
#include "ui/layers/layer_manager.h"
|
||||||
#include "ui/layers/generic_box.h"
|
#include "ui/layers/generic_box.h"
|
||||||
#include "ui/text/text_utilities.h"
|
#include "ui/text/text_utilities.h"
|
||||||
#include "ui/toast/toast.h"
|
|
||||||
#include "ui/toasts/common_toasts.h"
|
#include "ui/toasts/common_toasts.h"
|
||||||
#include "ui/special_buttons.h"
|
#include "ui/special_buttons.h"
|
||||||
#include "info/profile/info_profile_values.h" // Info::Profile::Value.
|
#include "info/profile/info_profile_values.h" // Info::Profile::Value.
|
||||||
|
@ -292,9 +291,10 @@ Panel::Panel(not_null<GroupCall*> call)
|
||||||
call->allowedToSpeakNotifications(
|
call->allowedToSpeakNotifications(
|
||||||
) | rpl::start_with_next([=] {
|
) | rpl::start_with_next([=] {
|
||||||
if (isActive()) {
|
if (isActive()) {
|
||||||
Ui::Toast::Show(
|
Ui::ShowMultilineToast({
|
||||||
widget(),
|
.parentOverride = widget(),
|
||||||
tr::lng_group_call_can_speak_here(tr::now));
|
.text = { tr::lng_group_call_can_speak_here(tr::now) },
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
const auto real = _peer->groupCall();
|
const auto real = _peer->groupCall();
|
||||||
const auto name = (real
|
const auto name = (real
|
||||||
|
@ -302,13 +302,12 @@ Panel::Panel(not_null<GroupCall*> call)
|
||||||
&& !real->title().isEmpty())
|
&& !real->title().isEmpty())
|
||||||
? real->title()
|
? real->title()
|
||||||
: _peer->name;
|
: _peer->name;
|
||||||
Ui::Toast::Show(Ui::Toast::Config{
|
Ui::ShowMultilineToast({
|
||||||
.text = tr::lng_group_call_can_speak(
|
.text = tr::lng_group_call_can_speak(
|
||||||
tr::now,
|
tr::now,
|
||||||
lt_chat,
|
lt_chat,
|
||||||
Ui::Text::Bold(name),
|
Ui::Text::Bold(name),
|
||||||
Ui::Text::WithEntities),
|
Ui::Text::WithEntities),
|
||||||
.st = &st::defaultToast,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, widget()->lifetime());
|
}, widget()->lifetime());
|
||||||
|
@ -537,7 +536,10 @@ void Panel::initWithCall(GroupCall *call) {
|
||||||
_layerBg->showBox(std::move(next));
|
_layerBg->showBox(std::move(next));
|
||||||
};
|
};
|
||||||
const auto showToast = [=](QString text) {
|
const auto showToast = [=](QString text) {
|
||||||
Ui::Toast::Show(widget(), text);
|
Ui::ShowMultilineToast({
|
||||||
|
.parentOverride = widget(),
|
||||||
|
.text = { text },
|
||||||
|
});
|
||||||
};
|
};
|
||||||
auto [shareLinkCallback, shareLinkLifetime] = ShareInviteLinkAction(
|
auto [shareLinkCallback, shareLinkLifetime] = ShareInviteLinkAction(
|
||||||
_peer,
|
_peer,
|
||||||
|
@ -658,9 +660,10 @@ void Panel::subscribeToChanges(not_null<Data::GroupCall*> real) {
|
||||||
const auto skip = st::groupCallRecordingMarkSkip;
|
const auto skip = st::groupCallRecordingMarkSkip;
|
||||||
_recordingMark->resize(size + 2 * skip, size + 2 * skip);
|
_recordingMark->resize(size + 2 * skip, size + 2 * skip);
|
||||||
_recordingMark->setClickedCallback([=] {
|
_recordingMark->setClickedCallback([=] {
|
||||||
Ui::Toast::Show(
|
Ui::ShowMultilineToast({
|
||||||
widget(),
|
.parentOverride = widget(),
|
||||||
tr::lng_group_call_is_recorded(tr::now));
|
.text = { tr::lng_group_call_is_recorded(tr::now) },
|
||||||
|
});
|
||||||
});
|
});
|
||||||
const auto animate = [=] {
|
const auto animate = [=] {
|
||||||
const auto opaque = state->opaque;
|
const auto opaque = state->opaque;
|
||||||
|
@ -696,13 +699,14 @@ void Panel::subscribeToChanges(not_null<Data::GroupCall*> real) {
|
||||||
) | rpl::distinct_until_changed(
|
) | rpl::distinct_until_changed(
|
||||||
) | rpl::start_with_next([=](bool recorded) {
|
) | rpl::start_with_next([=](bool recorded) {
|
||||||
validateRecordingMark(recorded);
|
validateRecordingMark(recorded);
|
||||||
Ui::Toast::Show(
|
Ui::ShowMultilineToast({
|
||||||
widget(),
|
.parentOverride = widget(),
|
||||||
(recorded
|
.text = { recorded
|
||||||
? tr::lng_group_call_recording_started(tr::now)
|
? tr::lng_group_call_recording_started(tr::now)
|
||||||
: (_call && _call->recordingStoppedByMe())
|
: (_call && _call->recordingStoppedByMe())
|
||||||
? tr::lng_group_call_recording_saved(tr::now)
|
? tr::lng_group_call_recording_saved(tr::now)
|
||||||
: tr::lng_group_call_recording_stopped(tr::now)));
|
: tr::lng_group_call_recording_stopped(tr::now) },
|
||||||
|
});
|
||||||
}, widget()->lifetime());
|
}, widget()->lifetime());
|
||||||
validateRecordingMark(real->recordStartDate() != 0);
|
validateRecordingMark(real->recordStartDate() != 0);
|
||||||
|
|
||||||
|
@ -754,7 +758,10 @@ void Panel::chooseJoinAs() {
|
||||||
_layerBg->showBox(std::move(next));
|
_layerBg->showBox(std::move(next));
|
||||||
};
|
};
|
||||||
const auto showToast = [=](QString text) {
|
const auto showToast = [=](QString text) {
|
||||||
Ui::Toast::Show(widget(), text);
|
Ui::ShowMultilineToast({
|
||||||
|
.parentOverride = widget(),
|
||||||
|
.text = { text },
|
||||||
|
});
|
||||||
};
|
};
|
||||||
_joinAsProcess.start(
|
_joinAsProcess.start(
|
||||||
_peer,
|
_peer,
|
||||||
|
@ -848,28 +855,24 @@ void Panel::addMembers() {
|
||||||
}
|
}
|
||||||
const auto result = call->inviteUsers(users);
|
const auto result = call->inviteUsers(users);
|
||||||
if (const auto user = std::get_if<not_null<UserData*>>(&result)) {
|
if (const auto user = std::get_if<not_null<UserData*>>(&result)) {
|
||||||
Ui::Toast::Show(
|
Ui::ShowMultilineToast({
|
||||||
widget(),
|
.parentOverride = widget(),
|
||||||
Ui::Toast::Config{
|
.text = tr::lng_group_call_invite_done_user(
|
||||||
.text = tr::lng_group_call_invite_done_user(
|
tr::now,
|
||||||
tr::now,
|
lt_user,
|
||||||
lt_user,
|
Ui::Text::Bold((*user)->firstName),
|
||||||
Ui::Text::Bold((*user)->firstName),
|
Ui::Text::WithEntities),
|
||||||
Ui::Text::WithEntities),
|
});
|
||||||
.st = &st::defaultToast,
|
|
||||||
});
|
|
||||||
} else if (const auto count = std::get_if<int>(&result)) {
|
} else if (const auto count = std::get_if<int>(&result)) {
|
||||||
if (*count > 0) {
|
if (*count > 0) {
|
||||||
Ui::Toast::Show(
|
Ui::ShowMultilineToast({
|
||||||
widget(),
|
.parentOverride = widget(),
|
||||||
Ui::Toast::Config{
|
.text = tr::lng_group_call_invite_done_many(
|
||||||
.text = tr::lng_group_call_invite_done_many(
|
tr::now,
|
||||||
tr::now,
|
lt_count,
|
||||||
lt_count,
|
*count,
|
||||||
*count,
|
Ui::Text::RichLangValue),
|
||||||
Ui::Text::RichLangValue),
|
});
|
||||||
.st = &st::defaultToast,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Unexpected("Result in GroupCall::inviteUsers.");
|
Unexpected("Result in GroupCall::inviteUsers.");
|
||||||
|
|
|
@ -19,7 +19,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "ui/widgets/input_fields.h"
|
#include "ui/widgets/input_fields.h"
|
||||||
#include "ui/wrap/slide_wrap.h"
|
#include "ui/wrap/slide_wrap.h"
|
||||||
#include "ui/text/text_utilities.h"
|
#include "ui/text/text_utilities.h"
|
||||||
#include "ui/toast/toast.h"
|
#include "ui/toasts/common_toasts.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
#include "boxes/share_box.h"
|
#include "boxes/share_box.h"
|
||||||
#include "history/history_message.h" // GetErrorTextForSending.
|
#include "history/history_message.h" // GetErrorTextForSending.
|
||||||
|
@ -535,9 +535,10 @@ void SettingsBox(
|
||||||
box->getDelegate()->show(std::move(next));
|
box->getDelegate()->show(std::move(next));
|
||||||
});
|
});
|
||||||
const auto showToast = crl::guard(box, [=](QString text) {
|
const auto showToast = crl::guard(box, [=](QString text) {
|
||||||
Ui::Toast::Show(
|
Ui::ShowMultilineToast({
|
||||||
box->getDelegate()->outerContainer(),
|
.parentOverride = box->getDelegate()->outerContainer(),
|
||||||
text);
|
.text = { text },
|
||||||
|
});
|
||||||
});
|
});
|
||||||
auto [shareLinkCallback, shareLinkLifetime] = ShareInviteLinkAction(
|
auto [shareLinkCallback, shareLinkLifetime] = ShareInviteLinkAction(
|
||||||
peer,
|
peer,
|
||||||
|
@ -572,9 +573,10 @@ void SettingsBox(
|
||||||
}
|
}
|
||||||
QGuiApplication::clipboard()->setText(link);
|
QGuiApplication::clipboard()->setText(link);
|
||||||
if (weakBox) {
|
if (weakBox) {
|
||||||
Ui::Toast::Show(
|
Ui::ShowMultilineToast({
|
||||||
box->getDelegate()->outerContainer(),
|
.parentOverride = box->getDelegate()->outerContainer(),
|
||||||
tr::lng_create_channel_link_copied(tr::now));
|
.text = { tr::lng_create_channel_link_copied(tr::now) },
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue