Moved ConfirmBox to Ui namespace.

This commit is contained in:
23rd 2021-10-19 01:28:08 +03:00
parent 6148edbc7d
commit 80461bd9fe
88 changed files with 352 additions and 285 deletions

View file

@ -37,7 +37,7 @@ void AttachedStickers::request(
} }
if (result.v.isEmpty()) { if (result.v.isEmpty()) {
strongController->show( strongController->show(
Box<InformBox>(tr::lng_stickers_not_found(tr::now))); Box<Ui::InformBox>(tr::lng_stickers_not_found(tr::now)));
return; return;
} else if (result.v.size() > 1) { } else if (result.v.size() > 1) {
strongController->show( strongController->show(
@ -63,7 +63,7 @@ void AttachedStickers::request(
_requestId = 0; _requestId = 0;
if (const auto strongController = weak.get()) { if (const auto strongController = weak.get()) {
strongController->show( strongController->show(
Box<InformBox>(tr::lng_stickers_not_found(tr::now))); Box<Ui::InformBox>(tr::lng_stickers_not_found(tr::now)));
} }
}).send(); }).send();
} }

View file

@ -91,7 +91,7 @@ void SendBotCallbackData(
result.match([&](const MTPDmessages_botCallbackAnswer &data) { result.match([&](const MTPDmessages_botCallbackAnswer &data) {
if (const auto message = data.vmessage()) { if (const auto message = data.vmessage()) {
if (data.is_alert()) { if (data.is_alert()) {
Ui::show(Box<InformBox>(qs(*message))); Ui::show(Box<Ui::InformBox>(qs(*message)));
} else { } else {
if (withPassword) { if (withPassword) {
Ui::hideLayer(); Ui::hideLayer();

View file

@ -86,7 +86,7 @@ void CheckChatInvite(
Core::App().hideMediaView(); Core::App().hideMediaView();
if (const auto strong = weak.get()) { if (const auto strong = weak.get()) {
strong->show( strong->show(
Box<InformBox>(tr::lng_group_invite_bad_link(tr::now))); Box<Ui::InformBox>(tr::lng_group_invite_bad_link(tr::now)));
} }
}); });
} }

View file

@ -83,7 +83,7 @@ void ConfirmPhone::resolve(
)).done([=](const MTPBool &result) { )).done([=](const MTPBool &result) {
_checkRequestId = 0; _checkRequestId = 0;
controller->show( controller->show(
Box<InformBox>( Box<Ui::InformBox>(
tr::lng_confirm_phone_success( tr::lng_confirm_phone_success(
tr::now, tr::now,
lt_phone, lt_phone,
@ -117,7 +117,7 @@ void ConfirmPhone::resolve(
? tr::lng_confirm_phone_link_invalid(tr::now) ? tr::lng_confirm_phone_link_invalid(tr::now)
: Lang::Hard::ServerError(); : Lang::Hard::ServerError();
controller->show( controller->show(
Box<InformBox>(errorText), Box<Ui::InformBox>(errorText),
Ui::LayerOption::CloseOther); Ui::LayerOption::CloseOther);
}).handleFloodErrors().send(); }).handleFloodErrors().send();
} }

View file

@ -149,7 +149,8 @@ void EditMessageWithUploadedMedia(
session->data().sendHistoryChangeNotifications(); session->data().sendHistoryChangeNotifications();
if (mediaInvalid) { if (mediaInvalid) {
Ui::show( Ui::show(
Box<InformBox>(tr::lng_edit_media_invalid_file(tr::now)), Box<Ui::InformBox>(
tr::lng_edit_media_invalid_file(tr::now)),
Ui::LayerOption::KeepOther); Ui::LayerOption::KeepOther);
} }
} else { } else {

View file

@ -1976,7 +1976,7 @@ void Updates::feedUpdate(const MTPUpdate &update) {
} else if (d.is_popup()) { } else if (d.is_popup()) {
const auto &windows = session().windows(); const auto &windows = session().windows();
if (!windows.empty()) { if (!windows.empty()) {
windows.front()->window().show(Box<InformBox>(text)); windows.front()->window().show(Box<Ui::InformBox>(text));
} }
} else { } else {
session().data().serviceNotification(text, d.vmedia()); session().data().serviceNotification(text, d.vmedia());

View file

@ -394,9 +394,9 @@ void ApiWrap::importChatInvite(const QString &hash) {
}).fail([=](const MTP::Error &error) { }).fail([=](const MTP::Error &error) {
const auto &type = error.type(); const auto &type = error.type();
if (type == qstr("CHANNELS_TOO_MUCH")) { if (type == qstr("CHANNELS_TOO_MUCH")) {
Ui::show(Box<InformBox>(tr::lng_join_channel_error(tr::now))); Ui::show(Box<Ui::InformBox>(tr::lng_join_channel_error(tr::now)));
} else if (error.code() == 400) { } else if (error.code() == 400) {
Ui::show(Box<InformBox>((type == qstr("USERS_TOO_MUCH")) Ui::show(Box<Ui::InformBox>((type == qstr("USERS_TOO_MUCH"))
? tr::lng_group_invite_no_room(tr::now) ? tr::lng_group_invite_no_room(tr::now)
: tr::lng_group_invite_bad_link(tr::now))); : tr::lng_group_invite_bad_link(tr::now)));
} }
@ -468,13 +468,13 @@ void ApiWrap::sendMessageFail(
uint64 randomId, uint64 randomId,
FullMsgId itemId) { FullMsgId itemId) {
if (error.type() == qstr("PEER_FLOOD")) { if (error.type() == qstr("PEER_FLOOD")) {
Ui::show(Box<InformBox>( Ui::show(Box<Ui::InformBox>(
PeerFloodErrorText(&session(), PeerFloodType::Send))); PeerFloodErrorText(&session(), PeerFloodType::Send)));
} else if (error.type() == qstr("USER_BANNED_IN_CHANNEL")) { } else if (error.type() == qstr("USER_BANNED_IN_CHANNEL")) {
const auto link = textcmdLink( const auto link = textcmdLink(
session().createInternalLinkFull(qsl("spambot")), session().createInternalLinkFull(qsl("spambot")),
tr::lng_cant_more_info(tr::now)); tr::lng_cant_more_info(tr::now));
Ui::show(Box<InformBox>(tr::lng_error_public_groups_denied( Ui::show(Box<Ui::InformBox>(tr::lng_error_public_groups_denied(
tr::now, tr::now,
lt_more_info, lt_more_info,
link))); link)));
@ -495,7 +495,7 @@ void ApiWrap::sendMessageFail(
Assert(peer->isUser()); Assert(peer->isUser());
if (const auto item = scheduled.lookupItem(peer->id, itemId.msg)) { if (const auto item = scheduled.lookupItem(peer->id, itemId.msg)) {
scheduled.removeSending(item); scheduled.removeSending(item);
Ui::show(Box<InformBox>(tr::lng_cant_do_this(tr::now))); Ui::show(Box<Ui::InformBox>(tr::lng_cant_do_this(tr::now)));
} }
} }
if (const auto item = _session->data().message(itemId)) { if (const auto item = _session->data().message(itemId)) {
@ -1253,7 +1253,7 @@ void ApiWrap::migrateDone(
void ApiWrap::migrateFail(not_null<PeerData*> peer, const MTP::Error &error) { void ApiWrap::migrateFail(not_null<PeerData*> peer, const MTP::Error &error) {
const auto &type = error.type(); const auto &type = error.type();
if (type == qstr("CHANNELS_TOO_MUCH")) { if (type == qstr("CHANNELS_TOO_MUCH")) {
Ui::show(Box<InformBox>(tr::lng_migrate_error(tr::now))); Ui::show(Box<Ui::InformBox>(tr::lng_migrate_error(tr::now)));
} }
if (auto handlers = _migrateCallbacks.take(peer)) { if (auto handlers = _migrateCallbacks.take(peer)) {
for (auto &handler : *handlers) { for (auto &handler : *handlers) {
@ -2086,13 +2086,14 @@ void ApiWrap::joinChannel(not_null<ChannelData*> channel) {
} else if (error.type() == qstr("CHANNEL_PRIVATE") } else if (error.type() == qstr("CHANNEL_PRIVATE")
|| error.type() == qstr("CHANNEL_PUBLIC_GROUP_NA") || error.type() == qstr("CHANNEL_PUBLIC_GROUP_NA")
|| error.type() == qstr("USER_BANNED_IN_CHANNEL")) { || error.type() == qstr("USER_BANNED_IN_CHANNEL")) {
Ui::show(Box<InformBox>(channel->isMegagroup() Ui::show(Box<Ui::InformBox>(channel->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)));
} else if (error.type() == qstr("CHANNELS_TOO_MUCH")) { } else if (error.type() == qstr("CHANNELS_TOO_MUCH")) {
Ui::show(Box<InformBox>(tr::lng_join_channel_error(tr::now))); Ui::show(Box<Ui::InformBox>(
tr::lng_join_channel_error(tr::now)));
} else if (error.type() == qstr("USERS_TOO_MUCH")) { } else if (error.type() == qstr("USERS_TOO_MUCH")) {
Ui::show(Box<InformBox>(tr::lng_group_full(tr::now))); Ui::show(Box<Ui::InformBox>(tr::lng_group_full(tr::now)));
} }
_channelAmInRequests.remove(channel); _channelAmInRequests.remove(channel);
}).send(); }).send();

View file

@ -104,7 +104,8 @@ void AboutBox::showVersionHistory() {
QGuiApplication::clipboard()->setText(url); QGuiApplication::clipboard()->setText(url);
Ui::show(Box<InformBox>("The link to the current private alpha version of Telegram Desktop was copied to the clipboard.")); Ui::show(Box<Ui::InformBox>("The link to the current private alpha "
"version of Telegram Desktop was copied to the clipboard."));
} else { } else {
UrlClickHandler::Open(Core::App().changelogLink()); UrlClickHandler::Open(Core::App().changelogLink());
} }

View file

@ -156,7 +156,7 @@ void ShowAddParticipantsError(
*weak = Ui::show(std::move(box)); *weak = Ui::show(std::move(box));
}; };
Ui::show( Ui::show(
Box<ConfirmBox>( Box<Ui::ConfirmBox>(
tr::lng_cant_invite_offer_admin(tr::now), tr::lng_cant_invite_offer_admin(tr::now),
tr::lng_cant_invite_make_admin(tr::now), tr::lng_cant_invite_make_admin(tr::now),
tr::lng_cancel(tr::now), tr::lng_cancel(tr::now),
@ -195,7 +195,7 @@ void ShowAddParticipantsError(
} }
return tr::lng_failed_add_participant(tr::now); return tr::lng_failed_add_participant(tr::now);
}(); }();
Ui::show(Box<InformBox>(text), Ui::LayerOption::KeepOther); Ui::show(Box<Ui::InformBox>(text), Ui::LayerOption::KeepOther);
} }
class RevokePublicLinkBox::Inner : public TWidget { class RevokePublicLinkBox::Inner : public TWidget {
@ -641,18 +641,18 @@ void GroupInfoBox::createGroup(
} }
} else if (error.type() == qstr("USERS_TOO_FEW")) { } else if (error.type() == qstr("USERS_TOO_FEW")) {
Ui::show( Ui::show(
Box<InformBox>(tr::lng_cant_invite_privacy(tr::now)), Box<Ui::InformBox>(tr::lng_cant_invite_privacy(tr::now)),
Ui::LayerOption::KeepOther); Ui::LayerOption::KeepOther);
} else if (error.type() == qstr("PEER_FLOOD")) { } else if (error.type() == qstr("PEER_FLOOD")) {
Ui::show( Ui::show(
Box<InformBox>( Box<Ui::InformBox>(
PeerFloodErrorText( PeerFloodErrorText(
&_navigation->session(), &_navigation->session(),
PeerFloodType::InviteGroup)), PeerFloodType::InviteGroup)),
Ui::LayerOption::KeepOther); Ui::LayerOption::KeepOther);
} else if (error.type() == qstr("USER_RESTRICTED")) { } else if (error.type() == qstr("USER_RESTRICTED")) {
Ui::show( Ui::show(
Box<InformBox>(tr::lng_cant_do_this(tr::now)), Box<Ui::InformBox>(tr::lng_cant_do_this(tr::now)),
Ui::LayerOption::KeepOther); Ui::LayerOption::KeepOther);
} }
}).send(); }).send();
@ -759,9 +759,9 @@ void GroupInfoBox::createChannel(
_title->setFocus(); _title->setFocus();
_title->showError(); _title->showError();
} else if (error.type() == qstr("USER_RESTRICTED")) { } else if (error.type() == qstr("USER_RESTRICTED")) {
Ui::show(Box<InformBox>(tr::lng_cant_do_this(tr::now))); Ui::show(Box<Ui::InformBox>(tr::lng_cant_do_this(tr::now)));
} else if (error.type() == qstr("CHANNELS_TOO_MUCH")) { } else if (error.type() == qstr("CHANNELS_TOO_MUCH")) {
Ui::show(Box<InformBox>(tr::lng_cant_do_this(tr::now))); // TODO Ui::show(Box<Ui::InformBox>(tr::lng_cant_do_this(tr::now))); // TODO
} }
}).send(); }).send();
} }
@ -1598,7 +1598,7 @@ void RevokePublicLinkBox::Inner::mouseReleaseEvent(QMouseEvent *e) {
}).send(); }).send();
}); });
Ui::show( Ui::show(
Box<ConfirmBox>(text, confirmText, std::move(callback)), Box<Ui::ConfirmBox>(text, confirmText, std::move(callback)),
Ui::LayerOption::KeepOther); Ui::LayerOption::KeepOther);
} }
} }

View file

@ -11,7 +11,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/timer.h" #include "base/timer.h"
#include "mtproto/sender.h" #include "mtproto/sender.h"
class ConfirmBox;
class PeerListBox; class PeerListBox;
namespace Window { namespace Window {
@ -23,6 +22,7 @@ class Session;
} // namespace Main } // namespace Main
namespace Ui { namespace Ui {
class ConfirmBox;
class FlatLabel; class FlatLabel;
class InputField; class InputField;
class PhoneInput; class PhoneInput;

View file

@ -176,7 +176,7 @@ void BackgroundBox::removePaper(const Data::WallPaper &paper) {
)).send(); )).send();
}; };
_controller->show( _controller->show(
Box<ConfirmBox>( Box<Ui::ConfirmBox>(
tr::lng_background_sure_delete(tr::now), tr::lng_background_sure_delete(tr::now),
tr::lng_selected_delete(tr::now), tr::lng_selected_delete(tr::now),
tr::lng_cancel(tr::now), tr::lng_cancel(tr::now),

View file

@ -784,7 +784,7 @@ bool BackgroundPreviewBox::Start(
} }
if (!IsValidWallPaperSlug(slug)) { if (!IsValidWallPaperSlug(slug)) {
controller->show( controller->show(
Box<InformBox>(tr::lng_background_bad_link(tr::now))); Box<Ui::InformBox>(tr::lng_background_bad_link(tr::now)));
return false; return false;
} }
controller->session().api().requestWallPaper(slug, crl::guard(controller, [=]( controller->session().api().requestWallPaper(slug, crl::guard(controller, [=](
@ -794,7 +794,7 @@ bool BackgroundPreviewBox::Start(
result.withUrlParams(params))); result.withUrlParams(params)));
}), crl::guard(controller, [=](const MTP::Error &error) { }), crl::guard(controller, [=](const MTP::Error &error) {
controller->show( controller->show(
Box<InformBox>(tr::lng_background_bad_link(tr::now))); Box<Ui::InformBox>(tr::lng_background_bad_link(tr::now)));
})); }));
return true; return true;
} }

View file

@ -234,7 +234,7 @@ void ChangePhoneBox::EnterPhone::sendPhoneFail(const MTP::Error &error, const QS
Ui::ShowPhoneBannedError(&_controller->window(), phoneNumber); Ui::ShowPhoneBannedError(&_controller->window(), phoneNumber);
} else if (error.type() == qstr("PHONE_NUMBER_OCCUPIED")) { } else if (error.type() == qstr("PHONE_NUMBER_OCCUPIED")) {
_controller->show( _controller->show(
Box<InformBox>( Box<Ui::InformBox>(
tr::lng_change_phone_occupied( tr::lng_change_phone_occupied(
tr::now, tr::now,
lt_phone, lt_phone,
@ -389,7 +389,7 @@ void ChangePhoneBox::prepare() {
Ui::LayerOption::CloseOther); Ui::LayerOption::CloseOther);
}; };
controller->show( controller->show(
Box<ConfirmBox>( Box<Ui::ConfirmBox>(
tr::lng_change_phone_warning(tr::now), tr::lng_change_phone_warning(tr::now),
std::move(callback)), std::move(callback)),
Ui::LayerOption::CloseOther); Ui::LayerOption::CloseOther);

View file

@ -1131,13 +1131,13 @@ void ProxiesBoxController::ShowApplyConfirmation(
close(); close();
}; };
Ui::show( Ui::show(
Box<ConfirmBox>( Box<Ui::ConfirmBox>(
text, text,
tr::lng_sure_enable(tr::now), tr::lng_sure_enable(tr::now),
std::move(callback)), std::move(callback)),
Ui::LayerOption::KeepOther); Ui::LayerOption::KeepOther);
} else { } else {
Ui::show(Box<InformBox>( Ui::show(Box<Ui::InformBox>(
(proxy.status() == ProxyData::Status::Unsupported (proxy.status() == ProxyData::Status::Unsupported
? tr::lng_proxy_unsupported(tr::now) ? tr::lng_proxy_unsupported(tr::now)
: tr::lng_proxy_invalid(tr::now)))); : tr::lng_proxy_invalid(tr::now))));

View file

@ -107,7 +107,7 @@ void StartPendingReset(
auto finish = [=](const QString &message) mutable { auto finish = [=](const QString &message) mutable {
if (const auto strong = weak.data()) { if (const auto strong = weak.data()) {
if (!message.isEmpty()) { if (!message.isEmpty()) {
strong->getDelegate()->show(Box<InformBox>(message)); strong->getDelegate()->show(Box<Ui::InformBox>(message));
} }
strong->closeBox(); strong->closeBox();
} }
@ -138,7 +138,7 @@ void StartPendingReset(
lt_count, lt_count,
minutes); minutes);
if (const auto strong = weak.data()) { if (const auto strong = weak.data()) {
strong->getDelegate()->show(Box<InformBox>( strong->getDelegate()->show(Box<Ui::InformBox>(
tr::lng_cloud_password_reset_later( tr::lng_cloud_password_reset_later(
tr::now, tr::now,
lt_duration, lt_duration,
@ -440,7 +440,7 @@ void PasscodeBox::recoverPasswordDone(
if (weak) { if (weak) {
_newPasswordSet.fire_copy(newPasswordBytes); _newPasswordSet.fire_copy(newPasswordBytes);
if (weak) { if (weak) {
getDelegate()->show(Box<InformBox>( getDelegate()->show(Box<Ui::InformBox>(
tr::lng_cloud_password_updated(tr::now))); tr::lng_cloud_password_updated(tr::now)));
if (weak) { if (weak) {
closeBox(); closeBox();
@ -462,7 +462,7 @@ void PasscodeBox::setPasswordDone(const QByteArray &newPasswordBytes) {
: _oldPasscode->isHidden() : _oldPasscode->isHidden()
? tr::lng_cloud_password_was_set(tr::now) ? tr::lng_cloud_password_was_set(tr::now)
: tr::lng_cloud_password_updated(tr::now); : tr::lng_cloud_password_updated(tr::now);
getDelegate()->show(Box<InformBox>(text)); getDelegate()->show(Box<Ui::InformBox>(text));
if (weak) { if (weak) {
closeBox(); closeBox();
} }
@ -562,7 +562,7 @@ void PasscodeBox::validateEmail(
const auto weak = Ui::MakeWeak(this); const auto weak = Ui::MakeWeak(this);
_clearUnconfirmedPassword.fire({}); _clearUnconfirmedPassword.fire({});
if (weak) { if (weak) {
auto box = Box<InformBox>( auto box = Box<Ui::InformBox>(
Lang::Hard::EmailConfirmationExpired()); Lang::Hard::EmailConfirmationExpired());
weak->getDelegate()->show( weak->getDelegate()->show(
std::move(box), std::move(box),
@ -689,7 +689,7 @@ void PasscodeBox::save(bool force) {
if (!onlyCheck && !_recoverEmail->isHidden() && email.isEmpty() && !force) { if (!onlyCheck && !_recoverEmail->isHidden() && email.isEmpty() && !force) {
_skipEmailWarning = true; _skipEmailWarning = true;
_replacedBy = getDelegate()->show( _replacedBy = getDelegate()->show(
Box<ConfirmBox>( Box<Ui::ConfirmBox>(
tr::lng_cloud_password_about_recover(tr::now), tr::lng_cloud_password_about_recover(tr::now),
tr::lng_cloud_password_skip_email(tr::now), tr::lng_cloud_password_skip_email(tr::now),
st::attentionBoxButton, st::attentionBoxButton,
@ -726,7 +726,7 @@ void PasscodeBox::submitOnlyCheckCloudPassword(const QString &oldPassword) {
send(); send();
close(); close();
}; };
getDelegate()->show(Box<ConfirmBox>( getDelegate()->show(Box<Ui::ConfirmBox>(
tr::lng_cloud_password_passport_losing(tr::now), tr::lng_cloud_password_passport_losing(tr::now),
tr::lng_continue(tr::now), tr::lng_continue(tr::now),
confirmed)); confirmed));
@ -797,7 +797,7 @@ void PasscodeBox::requestPasswordData() {
} }
void PasscodeBox::serverError() { void PasscodeBox::serverError() {
getDelegate()->show(Box<InformBox>(Lang::Hard::ServerError())); getDelegate()->show(Box<Ui::InformBox>(Lang::Hard::ServerError()));
closeBox(); closeBox();
} }
@ -952,7 +952,7 @@ void PasscodeBox::suggestSecretReset(const QString &newPassword) {
resetSecret(check, newPassword, std::move(close)); resetSecret(check, newPassword, std::move(close));
}); });
}; };
getDelegate()->show(Box<ConfirmBox>( getDelegate()->show(Box<Ui::ConfirmBox>(
Lang::Hard::PassportCorruptedChange(), Lang::Hard::PassportCorruptedChange(),
Lang::Hard::PassportCorruptedReset(), Lang::Hard::PassportCorruptedReset(),
std::move(resetSecretAndSave))); std::move(resetSecretAndSave)));
@ -1085,7 +1085,7 @@ void PasscodeBox::recoverByEmail() {
} }
}); });
}); });
*confirmBox = getDelegate()->show(Box<ConfirmBox>( *confirmBox = getDelegate()->show(Box<Ui::ConfirmBox>(
tr::lng_cloud_password_reset_no_email(tr::now), tr::lng_cloud_password_reset_no_email(tr::now),
tr::lng_cloud_password_reset_ok(tr::now), tr::lng_cloud_password_reset_ok(tr::now),
reset)); reset));
@ -1170,7 +1170,7 @@ RecoverBox::RecoverBox(
} }
}); });
}); });
*confirmBox = getDelegate()->show(Box<ConfirmBox>( *confirmBox = getDelegate()->show(Box<Ui::ConfirmBox>(
tr::lng_cloud_password_reset_with_email(tr::now), tr::lng_cloud_password_reset_with_email(tr::now),
tr::lng_cloud_password_reset_ok(tr::now), tr::lng_cloud_password_reset_ok(tr::now),
reset)); reset));
@ -1272,7 +1272,7 @@ void RecoverBox::submit() {
send(); send();
close(); close();
}; };
getDelegate()->show(Box<ConfirmBox>( getDelegate()->show(Box<Ui::ConfirmBox>(
tr::lng_cloud_password_passport_losing(tr::now), tr::lng_cloud_password_passport_losing(tr::now),
tr::lng_continue(tr::now), tr::lng_continue(tr::now),
confirmed)); confirmed));
@ -1297,7 +1297,7 @@ void RecoverBox::proceedToClear() {
_submitRequest = 0; _submitRequest = 0;
_newPasswordSet.fire({}); _newPasswordSet.fire({});
getDelegate()->show( getDelegate()->show(
Box<InformBox>(tr::lng_cloud_password_removed(tr::now)), Box<Ui::InformBox>(tr::lng_cloud_password_removed(tr::now)),
Ui::LayerOption::CloseOther); Ui::LayerOption::CloseOther);
} }
@ -1345,7 +1345,7 @@ void RecoverBox::checkSubmitFail(const MTP::Error &error) {
if (err == qstr("PASSWORD_EMPTY")) { if (err == qstr("PASSWORD_EMPTY")) {
_newPasswordSet.fire(QByteArray()); _newPasswordSet.fire(QByteArray());
getDelegate()->show( getDelegate()->show(
Box<InformBox>(tr::lng_cloud_password_removed(tr::now)), Box<Ui::InformBox>(tr::lng_cloud_password_removed(tr::now)),
Ui::LayerOption::CloseOther); Ui::LayerOption::CloseOther);
} else if (err == qstr("PASSWORD_RECOVERY_NA")) { } else if (err == qstr("PASSWORD_RECOVERY_NA")) {
closeBox(); closeBox();
@ -1386,7 +1386,8 @@ RecoveryEmailValidation ConfirmRecoveryEmail(
reloads->fire({}); reloads->fire({});
if (*weak) { if (*weak) {
(*weak)->getDelegate()->show( (*weak)->getDelegate()->show(
Box<InformBox>(tr::lng_cloud_password_was_set(tr::now)), Box<Ui::InformBox>(
tr::lng_cloud_password_was_set(tr::now)),
Ui::LayerOption::CloseOther); Ui::LayerOption::CloseOther);
} }
}).fail([=](const MTP::Error &error) { }).fail([=](const MTP::Error &error) {
@ -1398,7 +1399,7 @@ RecoveryEmailValidation ConfirmRecoveryEmail(
} else if (error.type() == qstr("EMAIL_HASH_EXPIRED")) { } else if (error.type() == qstr("EMAIL_HASH_EXPIRED")) {
cancels->fire({}); cancels->fire({});
if (*weak) { if (*weak) {
auto box = Box<InformBox>( auto box = Box<Ui::InformBox>(
Lang::Hard::EmailConfirmationExpired()); Lang::Hard::EmailConfirmationExpired());
(*weak)->getDelegate()->show( (*weak)->getDelegate()->show(
std::move(box), std::move(box),

View file

@ -482,7 +482,7 @@ void AddBotToGroupBoxController::shareBotGame(not_null<PeerData*> chat) {
return tr::lng_bot_sure_share_game_group(tr::now, lt_group, chat->name); return tr::lng_bot_sure_share_game_group(tr::now, lt_group, chat->name);
}(); }();
Ui::show( Ui::show(
Box<ConfirmBox>(confirmText, std::move(send)), Box<Ui::ConfirmBox>(confirmText, std::move(send)),
Ui::LayerOption::KeepOther); Ui::LayerOption::KeepOther);
} }
@ -490,7 +490,7 @@ void AddBotToGroupBoxController::addBotToGroup(not_null<PeerData*> chat) {
if (const auto megagroup = chat->asMegagroup()) { if (const auto megagroup = chat->asMegagroup()) {
if (!megagroup->canAddMembers()) { if (!megagroup->canAddMembers()) {
Ui::show( Ui::show(
Box<InformBox>(tr::lng_error_cant_add_member(tr::now)), Box<Ui::InformBox>(tr::lng_error_cant_add_member(tr::now)),
Ui::LayerOption::KeepOther); Ui::LayerOption::KeepOther);
return; return;
} }
@ -500,7 +500,7 @@ void AddBotToGroupBoxController::addBotToGroup(not_null<PeerData*> chat) {
}); });
auto confirmText = tr::lng_bot_sure_invite(tr::now, lt_group, chat->name); auto confirmText = tr::lng_bot_sure_invite(tr::now, lt_group, chat->name);
Ui::show( Ui::show(
Box<ConfirmBox>(confirmText, send), Box<Ui::ConfirmBox>(confirmText, send),
Ui::LayerOption::KeepOther); Ui::LayerOption::KeepOther);
} }

View file

@ -106,7 +106,8 @@ void AddParticipantsBoxController::rowClicked(not_null<PeerListRow*> row) {
} else if (count >= serverConfig.chatSizeMax } else if (count >= serverConfig.chatSizeMax
&& count < serverConfig.megagroupSizeMax) { && count < serverConfig.megagroupSizeMax) {
Ui::show( Ui::show(
Box<InformBox>(tr::lng_profile_add_more_after_create(tr::now)), Box<Ui::InformBox>(
tr::lng_profile_add_more_after_create(tr::now)),
Ui::LayerOption::KeepOther); Ui::LayerOption::KeepOther);
} }
} }
@ -566,20 +567,20 @@ void AddSpecialBoxController::showAdmin(
if (canBanMembers) { if (canBanMembers) {
if (!sure) { if (!sure) {
_editBox = Ui::show( _editBox = Ui::show(
Box<ConfirmBox>( Box<Ui::ConfirmBox>(
tr::lng_sure_add_admin_unremove(tr::now), tr::lng_sure_add_admin_unremove(tr::now),
showAdminSure), showAdminSure),
Ui::LayerOption::KeepOther); Ui::LayerOption::KeepOther);
return; return;
} }
} else { } else {
Ui::show(Box<InformBox>( Ui::show(Box<Ui::InformBox>(
tr::lng_error_cant_add_admin_unban(tr::now)), tr::lng_error_cant_add_admin_unban(tr::now)),
Ui::LayerOption::KeepOther); Ui::LayerOption::KeepOther);
return; return;
} }
} else { } else {
Ui::show(Box<InformBox>( Ui::show(Box<Ui::InformBox>(
tr::lng_error_cant_add_admin_invite(tr::now)), tr::lng_error_cant_add_admin_invite(tr::now)),
Ui::LayerOption::KeepOther); Ui::LayerOption::KeepOther);
return; return;
@ -589,14 +590,14 @@ void AddSpecialBoxController::showAdmin(
if (canBanMembers) { if (canBanMembers) {
if (!sure) { if (!sure) {
_editBox = Ui::show( _editBox = Ui::show(
Box<ConfirmBox>( Box<Ui::ConfirmBox>(
tr::lng_sure_add_admin_unremove(tr::now), tr::lng_sure_add_admin_unremove(tr::now),
showAdminSure), showAdminSure),
Ui::LayerOption::KeepOther); Ui::LayerOption::KeepOther);
return; return;
} }
} else { } else {
Ui::show(Box<InformBox>( Ui::show(Box<Ui::InformBox>(
tr::lng_error_cant_add_admin_unban(tr::now)), tr::lng_error_cant_add_admin_unban(tr::now)),
Ui::LayerOption::KeepOther); Ui::LayerOption::KeepOther);
return; return;
@ -609,7 +610,7 @@ void AddSpecialBoxController::showAdmin(
? tr::lng_sure_add_admin_invite ? tr::lng_sure_add_admin_invite
: tr::lng_sure_add_admin_invite_channel)(tr::now); : tr::lng_sure_add_admin_invite_channel)(tr::now);
_editBox = Ui::show( _editBox = Ui::show(
Box<ConfirmBox>( Box<Ui::ConfirmBox>(
text, text,
showAdminSure), showAdminSure),
Ui::LayerOption::KeepOther); Ui::LayerOption::KeepOther);
@ -617,7 +618,8 @@ void AddSpecialBoxController::showAdmin(
} }
} else { } else {
Ui::show( Ui::show(
Box<InformBox>(tr::lng_error_cant_add_admin_invite(tr::now)), Box<Ui::InformBox>(
tr::lng_error_cant_add_admin_invite(tr::now)),
Ui::LayerOption::KeepOther); Ui::LayerOption::KeepOther);
return; return;
} }
@ -717,7 +719,7 @@ void AddSpecialBoxController::showRestricted(
if (!_additional.isCreator(user) && _additional.canEditAdmin(user)) { if (!_additional.isCreator(user) && _additional.canEditAdmin(user)) {
if (!sure) { if (!sure) {
_editBox = Ui::show( _editBox = Ui::show(
Box<ConfirmBox>( Box<Ui::ConfirmBox>(
tr::lng_sure_ban_admin(tr::now), tr::lng_sure_ban_admin(tr::now),
showRestrictedSure), showRestrictedSure),
Ui::LayerOption::KeepOther); Ui::LayerOption::KeepOther);
@ -725,7 +727,7 @@ void AddSpecialBoxController::showRestricted(
} }
} else { } else {
Ui::show( Ui::show(
Box<InformBox>(tr::lng_error_cant_ban_admin(tr::now)), Box<Ui::InformBox>(tr::lng_error_cant_ban_admin(tr::now)),
Ui::LayerOption::KeepOther); Ui::LayerOption::KeepOther);
return; return;
} }
@ -814,7 +816,7 @@ void AddSpecialBoxController::kickUser(
if (!_additional.isCreator(user) && _additional.canEditAdmin(user)) { if (!_additional.isCreator(user) && _additional.canEditAdmin(user)) {
if (!sure) { if (!sure) {
_editBox = Ui::show( _editBox = Ui::show(
Box<ConfirmBox>( Box<Ui::ConfirmBox>(
tr::lng_sure_ban_admin(tr::now), tr::lng_sure_ban_admin(tr::now),
kickUserSure), kickUserSure),
Ui::LayerOption::KeepOther); Ui::LayerOption::KeepOther);
@ -822,7 +824,7 @@ void AddSpecialBoxController::kickUser(
} }
} else { } else {
Ui::show( Ui::show(
Box<InformBox>(tr::lng_error_cant_ban_admin(tr::now)), Box<Ui::InformBox>(tr::lng_error_cant_ban_admin(tr::now)),
Ui::LayerOption::KeepOther); Ui::LayerOption::KeepOther);
return; return;
} }
@ -837,7 +839,7 @@ void AddSpecialBoxController::kickUser(
lt_user, lt_user,
participant->name); participant->name);
_editBox = Ui::show( _editBox = Ui::show(
Box<ConfirmBox>(text, kickUserSure), Box<Ui::ConfirmBox>(text, kickUserSure),
Ui::LayerOption::KeepOther); Ui::LayerOption::KeepOther);
return; return;
} }

View file

@ -152,7 +152,7 @@ void Controller::choose(not_null<ChannelData*> chat) {
onstack(chat); onstack(chat);
}; };
Ui::show( Ui::show(
Box<ConfirmBox>( Box<Ui::ConfirmBox>(
text, text,
tr::lng_manage_discussion_group_link(tr::now), tr::lng_manage_discussion_group_link(tr::now),
sure), sure),
@ -184,7 +184,7 @@ void Controller::choose(not_null<ChatData*> chat) {
chat->session().api().migrateChat(chat, crl::guard(this, done)); chat->session().api().migrateChat(chat, crl::guard(this, done));
}; };
Ui::show( Ui::show(
Box<ConfirmBox>( Box<Ui::ConfirmBox>(
text, text,
tr::lng_manage_discussion_group_link(tr::now), tr::lng_manage_discussion_group_link(tr::now),
sure), sure),

View file

@ -453,14 +453,14 @@ void EditAdminBox::transferOwnership() {
)).fail([=](const MTP::Error &error) { )).fail([=](const MTP::Error &error) {
_checkTransferRequestId = 0; _checkTransferRequestId = 0;
if (!handleTransferPasswordError(error)) { if (!handleTransferPasswordError(error)) {
const auto box = std::make_shared<QPointer<ConfirmBox>>(); const auto box = std::make_shared<QPointer<Ui::ConfirmBox>>();
const auto callback = crl::guard(this, [=] { const auto callback = crl::guard(this, [=] {
transferOwnershipChecked(); transferOwnershipChecked();
if (*box) { if (*box) {
(*box)->closeBox(); (*box)->closeBox();
} }
}); });
*box = getDelegate()->show(Box<ConfirmBox>( *box = getDelegate()->show(Box<Ui::ConfirmBox>(
tr::lng_rights_transfer_about( tr::lng_rights_transfer_about(
tr::now, tr::now,
lt_group, lt_group,
@ -577,7 +577,7 @@ void EditAdminBox::sendTransferRequestFrom(
|| (type == qstr("SESSION_TOO_FRESH_XXX")); || (type == qstr("SESSION_TOO_FRESH_XXX"));
}(); }();
const auto weak = Ui::MakeWeak(this); const auto weak = Ui::MakeWeak(this);
getDelegate()->show(Box<InformBox>(problem)); getDelegate()->show(Box<Ui::InformBox>(problem));
if (box) { if (box) {
box->closeBox(); box->closeBox();
} }

View file

@ -1691,7 +1691,7 @@ void ParticipantsBoxController::kickParticipant(not_null<PeerData*> participant)
lt_user, lt_user,
user ? user->firstName : participant->name); user ? user->firstName : participant->name);
_editBox = Ui::show( _editBox = Ui::show(
Box<ConfirmBox>( Box<Ui::ConfirmBox>(
text, text,
tr::lng_box_remove(tr::now), tr::lng_box_remove(tr::now),
crl::guard(this, [=] { kickParticipantSure(participant); })), crl::guard(this, [=] { kickParticipantSure(participant); })),
@ -1730,7 +1730,7 @@ void ParticipantsBoxController::kickParticipantSure(
void ParticipantsBoxController::removeAdmin(not_null<UserData*> user) { void ParticipantsBoxController::removeAdmin(not_null<UserData*> user) {
_editBox = Ui::show( _editBox = Ui::show(
Box<ConfirmBox>( Box<Ui::ConfirmBox>(
tr::lng_profile_sure_remove_admin( tr::lng_profile_sure_remove_admin(
tr::now, tr::now,
lt_user, lt_user,

View file

@ -1485,7 +1485,7 @@ void Controller::deleteWithConfirmation() {
deleteChannel(); deleteChannel();
}); });
_navigation->parentController()->show( _navigation->parentController()->show(
Box<ConfirmBox>( Box<Ui::ConfirmBox>(
text, text,
tr::lng_box_delete(tr::now), tr::lng_box_delete(tr::now),
st::attentionBoxButton, st::attentionBoxButton,
@ -1512,7 +1512,7 @@ void Controller::deleteChannel() {
session->api().applyUpdates(result); session->api().applyUpdates(result);
//}).fail([=](const MTP::Error &error) { //}).fail([=](const MTP::Error &error) {
// if (error.type() == qstr("CHANNEL_TOO_LARGE")) { // if (error.type() == qstr("CHANNEL_TOO_LARGE")) {
// Ui::show(Box<InformBox>(tr::lng_cant_delete_channel(tr::now))); // Ui::show(Box<Ui::InformBox>(tr::lng_cant_delete_channel(tr::now)));
// } // }
}).send(); }).send();
} }

View file

@ -680,7 +680,7 @@ void AddPermanentLinkBlock(
} }
}); });
const auto revokeLink = crl::guard(weak, [=] { const auto revokeLink = crl::guard(weak, [=] {
const auto box = std::make_shared<QPointer<ConfirmBox>>(); const auto box = std::make_shared<QPointer<Ui::ConfirmBox>>();
const auto done = crl::guard(weak, [=] { const auto done = crl::guard(weak, [=] {
const auto close = [=] { const auto close = [=] {
if (*box) { if (*box) {
@ -694,7 +694,9 @@ void AddPermanentLinkBlock(
close); close);
}); });
*box = Ui::show( *box = Ui::show(
Box<ConfirmBox>(tr::lng_group_invite_about_new(tr::now), done), Box<Ui::ConfirmBox>(
tr::lng_group_invite_about_new(tr::now),
done),
Ui::LayerOption::KeepOther); Ui::LayerOption::KeepOther);
}); });
@ -868,7 +870,7 @@ void ShareInviteLinkBox(not_null<PeerData*> peer, const QString &link) {
} }
text.append(error.first); text.append(error.first);
Ui::show( Ui::show(
Box<InformBox>(text), Box<Ui::InformBox>(text),
Ui::LayerOption::KeepOther); Ui::LayerOption::KeepOther);
return; return;
} }
@ -968,7 +970,7 @@ void RevokeLink(
not_null<PeerData*> peer, not_null<PeerData*> peer,
not_null<UserData*> admin, not_null<UserData*> admin,
const QString &link) { const QString &link) {
const auto box = std::make_shared<QPointer<ConfirmBox>>(); const auto box = std::make_shared<QPointer<Ui::ConfirmBox>>();
const auto revoke = [=] { const auto revoke = [=] {
const auto done = [=](const LinkData &data) { const auto done = [=](const LinkData &data) {
if (*box) { if (*box) {
@ -978,7 +980,7 @@ void RevokeLink(
peer->session().api().inviteLinks().revoke(peer, admin, link, done); peer->session().api().inviteLinks().revoke(peer, admin, link, done);
}; };
*box = Ui::show( *box = Ui::show(
Box<ConfirmBox>( Box<Ui::ConfirmBox>(
tr::lng_group_invite_revoke_about(tr::now), tr::lng_group_invite_revoke_about(tr::now),
revoke), revoke),
Ui::LayerOption::KeepOther); Ui::LayerOption::KeepOther);
@ -988,7 +990,7 @@ void DeleteLink(
not_null<PeerData*> peer, not_null<PeerData*> peer,
not_null<UserData*> admin, not_null<UserData*> admin,
const QString &link) { const QString &link) {
const auto box = std::make_shared<QPointer<ConfirmBox>>(); const auto box = std::make_shared<QPointer<Ui::ConfirmBox>>();
const auto sure = [=] { const auto sure = [=] {
const auto finish = [=] { const auto finish = [=] {
if (*box) { if (*box) {
@ -1002,7 +1004,7 @@ void DeleteLink(
finish); finish);
}; };
*box = Ui::show( *box = Ui::show(
Box<ConfirmBox>(tr::lng_group_invite_delete_sure(tr::now), sure), Box<Ui::ConfirmBox>(tr::lng_group_invite_delete_sure(tr::now), sure),
Ui::LayerOption::KeepOther); Ui::LayerOption::KeepOther);
} }

View file

@ -197,7 +197,7 @@ private:
void DeleteAllRevoked( void DeleteAllRevoked(
not_null<PeerData*> peer, not_null<PeerData*> peer,
not_null<UserData*> admin) { not_null<UserData*> admin) {
const auto box = std::make_shared<QPointer<ConfirmBox>>(); const auto box = std::make_shared<QPointer<Ui::ConfirmBox>>();
const auto sure = [=] { const auto sure = [=] {
const auto finish = [=] { const auto finish = [=] {
if (*box) { if (*box) {
@ -210,7 +210,9 @@ void DeleteAllRevoked(
finish); finish);
}; };
*box = Ui::show( *box = Ui::show(
Box<ConfirmBox>(tr::lng_group_invite_delete_all_sure(tr::now), sure), Box<Ui::ConfirmBox>(
tr::lng_group_invite_delete_all_sure(tr::now),
sure),
Ui::LayerOption::KeepOther); Ui::LayerOption::KeepOther);
} }

View file

@ -56,7 +56,7 @@ void ShowPhoneBannedError(
} }
}; };
*box = controller->show( *box = controller->show(
Box<ConfirmBox>( Box<Ui::ConfirmBox>(
tr::lng_signin_banned_text(tr::now), tr::lng_signin_banned_text(tr::now),
tr::lng_box_ok(tr::now), tr::lng_box_ok(tr::now),
tr::lng_signin_banned_help(tr::now), tr::lng_signin_banned_help(tr::now),

View file

@ -81,7 +81,7 @@ private:
Full _data; Full _data;
object_ptr<Inner> _inner; object_ptr<Inner> _inner;
QPointer<ConfirmBox> _terminateBox; QPointer<Ui::ConfirmBox> _terminateBox;
base::Timer _shortPollTimer; base::Timer _shortPollTimer;
@ -250,7 +250,7 @@ void SessionsContent::terminate(Fn<void()> terminateRequest, QString message) {
terminateRequest(); terminateRequest();
}); });
_terminateBox = Ui::show( _terminateBox = Ui::show(
Box<ConfirmBox>( Box<Ui::ConfirmBox>(
message, message,
tr::lng_settings_reset_button(tr::now), tr::lng_settings_reset_button(tr::now),
st::attentionBoxButton, st::attentionBoxButton,

View file

@ -1155,7 +1155,8 @@ void ShareGameScoreByHash(
auto hashEncrypted = QByteArray::fromBase64(hash.toLatin1(), QByteArray::Base64UrlEncoding | QByteArray::OmitTrailingEquals); auto hashEncrypted = QByteArray::fromBase64(hash.toLatin1(), QByteArray::Base64UrlEncoding | QByteArray::OmitTrailingEquals);
if (hashEncrypted.size() <= key128Size || (hashEncrypted.size() != key128Size + 0x20)) { if (hashEncrypted.size() <= key128Size || (hashEncrypted.size() != key128Size + 0x20)) {
Ui::show(Box<InformBox>(tr::lng_confirm_phone_link_invalid(tr::now))); Ui::show(Box<Ui::InformBox>(
tr::lng_confirm_phone_link_invalid(tr::now)));
return; return;
} }
@ -1175,19 +1176,19 @@ void ShareGameScoreByHash(
//// Check next 64 bits of SHA1() of data. //// Check next 64 bits of SHA1() of data.
//auto skipSha1Part = sizeof(channelAccessHash); //auto skipSha1Part = sizeof(channelAccessHash);
//if (memcmp(dataSha1 + skipSha1Part, hashEncrypted.constData() + skipSha1Part, key128Size - skipSha1Part) != 0) { //if (memcmp(dataSha1 + skipSha1Part, hashEncrypted.constData() + skipSha1Part, key128Size - skipSha1Part) != 0) {
// Ui::show(Box<InformBox>(tr::lng_share_wrong_user(tr::now))); // Ui::show(Box<Ui::InformBox>(tr::lng_share_wrong_user(tr::now)));
// return; // return;
//} //}
// Check 128 bits of SHA1() of data. // Check 128 bits of SHA1() of data.
if (memcmp(dataSha1, hashEncrypted.constData(), key128Size) != 0) { if (memcmp(dataSha1, hashEncrypted.constData(), key128Size) != 0) {
Ui::show(Box<InformBox>(tr::lng_share_wrong_user(tr::now))); Ui::show(Box<Ui::InformBox>(tr::lng_share_wrong_user(tr::now)));
return; return;
} }
auto hashDataInts = reinterpret_cast<uint64*>(hashData.data()); auto hashDataInts = reinterpret_cast<uint64*>(hashData.data());
if (hashDataInts[0] != session->userId().bare) { if (hashDataInts[0] != session->userId().bare) {
Ui::show(Box<InformBox>(tr::lng_share_wrong_user(tr::now))); Ui::show(Box<Ui::InformBox>(tr::lng_share_wrong_user(tr::now)));
return; return;
} }
@ -1195,14 +1196,14 @@ void ShareGameScoreByHash(
auto channelAccessHash = hashDataInts[3]; auto channelAccessHash = hashDataInts[3];
//auto channelAccessHashInts = reinterpret_cast<int32*>(&channelAccessHash); //auto channelAccessHashInts = reinterpret_cast<int32*>(&channelAccessHash);
//if (channelAccessHashInts[0] != hashDataInts[3]) { //if (channelAccessHashInts[0] != hashDataInts[3]) {
// Ui::show(Box<InformBox>(tr::lng_share_wrong_user(tr::now))); // Ui::show(Box<Ui::InformBox>(tr::lng_share_wrong_user(tr::now)));
// return; // return;
//} //}
if (((hashDataInts[1] >> 40) != 0) if (((hashDataInts[1] >> 40) != 0)
|| (!hashDataInts[1] && channelAccessHash)) { || (!hashDataInts[1] && channelAccessHash)) {
// If there is no channel id, there should be no channel access_hash. // If there is no channel id, there should be no channel access_hash.
Ui::show(Box<InformBox>(tr::lng_share_wrong_user(tr::now))); Ui::show(Box<Ui::InformBox>(tr::lng_share_wrong_user(tr::now)));
return; return;
} }
@ -1218,7 +1219,8 @@ void ShareGameScoreByHash(
if (const auto item = session->data().message(channel, msgId)) { if (const auto item = session->data().message(channel, msgId)) {
FastShareMessage(item); FastShareMessage(item);
} else { } else {
Ui::show(Box<InformBox>(tr::lng_edit_deleted(tr::now))); Ui::show(Box<Ui::InformBox>(
tr::lng_edit_deleted(tr::now)));
} }
}); });
}; };

View file

@ -257,7 +257,7 @@ void StickerSetBox::handleError(Error error) {
switch (error) { switch (error) {
case Error::NotFound: case Error::NotFound:
_controller->show( _controller->show(
Box<InformBox>(tr::lng_stickers_not_found(tr::now))); Box<Ui::InformBox>(tr::lng_stickers_not_found(tr::now)));
break; break;
default: Unexpected("Error in StickerSetBox::handleError."); default: Unexpected("Error in StickerSetBox::handleError.");
} }

View file

@ -11,13 +11,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/timer.h" #include "base/timer.h"
#include "data/stickers/data_stickers.h" #include "data/stickers/data_stickers.h"
class ConfirmBox;
namespace Window { namespace Window {
class SessionController; class SessionController;
} // namespace Window } // namespace Window
namespace Ui { namespace Ui {
class ConfirmBox;
class PlainShadow; class PlainShadow;
} // namespace Ui } // namespace Ui

View file

@ -14,13 +14,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/effects/animations.h" #include "ui/effects/animations.h"
#include "ui/special_fields.h" #include "ui/special_fields.h"
class ConfirmBox;
namespace style { namespace style {
struct RippleAnimation; struct RippleAnimation;
} // namespace style } // namespace style
namespace Ui { namespace Ui {
class ConfirmBox;
class PlainShadow; class PlainShadow;
class RippleAnimation; class RippleAnimation;
class SettingsSlider; class SettingsSlider;

View file

@ -1152,23 +1152,28 @@ void Call::setFailedQueued(const QString &error) {
void Call::handleRequestError(const MTP::Error &error) { void Call::handleRequestError(const MTP::Error &error) {
if (error.type() == qstr("USER_PRIVACY_RESTRICTED")) { if (error.type() == qstr("USER_PRIVACY_RESTRICTED")) {
Ui::show(Box<InformBox>(tr::lng_call_error_not_available(tr::now, lt_user, _user->name))); Ui::show(Box<Ui::InformBox>(
tr::lng_call_error_not_available(tr::now, lt_user, _user->name)));
} else if (error.type() == qstr("PARTICIPANT_VERSION_OUTDATED")) { } else if (error.type() == qstr("PARTICIPANT_VERSION_OUTDATED")) {
Ui::show(Box<InformBox>(tr::lng_call_error_outdated(tr::now, lt_user, _user->name))); Ui::show(Box<Ui::InformBox>(
tr::lng_call_error_outdated(tr::now, lt_user, _user->name)));
} else if (error.type() == qstr("CALL_PROTOCOL_LAYER_INVALID")) { } else if (error.type() == qstr("CALL_PROTOCOL_LAYER_INVALID")) {
Ui::show(Box<InformBox>(Lang::Hard::CallErrorIncompatible().replace("{user}", _user->name))); Ui::show(Box<Ui::InformBox>(
Lang::Hard::CallErrorIncompatible().replace(
"{user}",
_user->name)));
} }
finish(FinishType::Failed); finish(FinishType::Failed);
} }
void Call::handleControllerError(const QString &error) { void Call::handleControllerError(const QString &error) {
if (error == u"ERROR_INCOMPATIBLE"_q) { if (error == u"ERROR_INCOMPATIBLE"_q) {
Ui::show(Box<InformBox>( Ui::show(Box<Ui::InformBox>(
Lang::Hard::CallErrorIncompatible().replace( Lang::Hard::CallErrorIncompatible().replace(
"{user}", "{user}",
_user->name))); _user->name)));
} else if (error == u"ERROR_AUDIO_IO"_q) { } else if (error == u"ERROR_AUDIO_IO"_q) {
Ui::show(Box<InformBox>(tr::lng_call_error_audio_io(tr::now))); Ui::show(Box<Ui::InformBox>(tr::lng_call_error_audio_io(tr::now)));
} }
finish(FinishType::Failed); finish(FinishType::Failed);
} }

View file

@ -192,7 +192,7 @@ void Instance::startOutgoingCall(not_null<UserData*> user, bool video) {
if (user->callsStatus() == UserData::CallsStatus::Private) { if (user->callsStatus() == UserData::CallsStatus::Private) {
// Request full user once more to refresh the setting in case it was changed. // Request full user once more to refresh the setting in case it was changed.
user->session().api().requestFullPeer(user); user->session().api().requestFullPeer(user);
Ui::show(Box<InformBox>( Ui::show(Box<Ui::InformBox>(
tr::lng_call_error_not_available(tr::now, lt_user, user->name))); tr::lng_call_error_not_available(tr::now, lt_user, user->name)));
return; return;
} }
@ -695,10 +695,13 @@ void Instance::requestPermissionOrFail(Platform::PermissionType type, Fn<void()>
if (inGroupCall()) { if (inGroupCall()) {
_currentGroupCall->hangup(); _currentGroupCall->hangup();
} }
Ui::show(Box<ConfirmBox>(tr::lng_no_mic_permission(tr::now), tr::lng_menu_settings(tr::now), crl::guard(this, [=] { Ui::show(Box<Ui::ConfirmBox>(
Platform::OpenSystemSettingsForPermission(type); tr::lng_no_mic_permission(tr::now),
Ui::hideLayer(); tr::lng_menu_settings(tr::now),
}))); crl::guard(this, [=] {
Platform::OpenSystemSettingsForPermission(type);
Ui::hideLayer();
})));
} }
} }

View file

@ -3156,19 +3156,21 @@ void StickersListWidget::removeMegagroupSet(bool locally) {
return; return;
} }
_removingSetId = Data::Stickers::MegagroupSetId; _removingSetId = Data::Stickers::MegagroupSetId;
controller()->show(Box<ConfirmBox>(tr::lng_stickers_remove_group_set(tr::now), crl::guard(this, [this, group = _megagroupSet] { controller()->show(Box<Ui::ConfirmBox>(
Expects(group->mgInfo != nullptr); tr::lng_stickers_remove_group_set(tr::now),
crl::guard(this, [this, group = _megagroupSet] {
Expects(group->mgInfo != nullptr);
if (group->mgInfo->stickerSet) { if (group->mgInfo->stickerSet) {
session().api().setGroupStickerSet(group, {}); session().api().setGroupStickerSet(group, {});
} }
Ui::hideLayer(); Ui::hideLayer();
_removingSetId = 0; _removingSetId = 0;
_checkForHide.fire({}); _checkForHide.fire({});
}), crl::guard(this, [this] { }), crl::guard(this, [this] {
_removingSetId = 0; _removingSetId = 0;
_checkForHide.fire({}); _checkForHide.fire({});
}))); })));
} }
void StickersListWidget::removeSet(uint64 setId) { void StickersListWidget::removeSet(uint64 setId) {
@ -3184,7 +3186,7 @@ void StickersListWidget::removeSet(uint64 setId) {
lt_sticker_pack, lt_sticker_pack,
set->title); set->title);
const auto confirm = tr::lng_stickers_remove_pack_confirm(tr::now); const auto confirm = tr::lng_stickers_remove_pack_confirm(tr::now);
controller()->show(Box<ConfirmBox>(text, confirm, crl::guard(this, [=]( controller()->show(Box<Ui::ConfirmBox>(text, confirm, crl::guard(this, [=](
Fn<void()> &&close) { Fn<void()> &&close) {
close(); close();
const auto &sets = session().data().stickers().sets(); const auto &sets = session().data().stickers().sets();

View file

@ -345,7 +345,7 @@ void Application::showOpenGLCrashNotification() {
Core::App().settings().setDisableOpenGL(true); Core::App().settings().setDisableOpenGL(true);
Local::writeSettings(); Local::writeSettings();
}; };
_window->show(Box<ConfirmBox>( _window->show(Box<Ui::ConfirmBox>(
"There may be a problem with your graphics drivers and OpenGL. " "There may be a problem with your graphics drivers and OpenGL. "
"Try updating your drivers.\n\n" "Try updating your drivers.\n\n"
"OpenGL has been disabled. You can try to enable it again " "OpenGL has been disabled. You can try to enable it again "
@ -537,7 +537,7 @@ void Application::badMtprotoConfigurationError() {
_settings.proxy().selected(), _settings.proxy().selected(),
MTP::ProxyData::Settings::System); MTP::ProxyData::Settings::System);
}; };
_badProxyDisableBox = Ui::show(Box<InformBox>( _badProxyDisableBox = Ui::show(Box<Ui::InformBox>(
Lang::Hard::ProxyConfigError(), Lang::Hard::ProxyConfigError(),
disableCallback)); disableCallback));
} }
@ -636,7 +636,7 @@ void Application::logout(Main::Account *account) {
void Application::forceLogOut( void Application::forceLogOut(
not_null<Main::Account*> account, not_null<Main::Account*> account,
const TextWithEntities &explanation) { const TextWithEntities &explanation) {
const auto box = Ui::show(Box<InformBox>( const auto box = Ui::show(Box<Ui::InformBox>(
explanation, explanation,
tr::lng_passcode_logout(tr::now))); tr::lng_passcode_logout(tr::now)));
box->setCloseByEscape(false); box->setCloseByEscape(false);

View file

@ -91,7 +91,7 @@ void HiddenUrlClickHandler::Open(QString url, QVariant context) {
? QString::fromUtf8(parsedUrl.toEncoded()) ? QString::fromUtf8(parsedUrl.toEncoded())
: ShowEncoded(displayed); : ShowEncoded(displayed);
Ui::show( Ui::show(
Box<ConfirmBox>( Box<Ui::ConfirmBox>(
(tr::lng_open_this_link(tr::now) (tr::lng_open_this_link(tr::now)
+ qsl("\n\n") + qsl("\n\n")
+ displayUrl), + displayUrl),
@ -125,7 +125,7 @@ void BotGameUrlClickHandler::onClick(ClickContext context) const {
bot->session().local().markBotTrustedOpenGame(bot->id); bot->session().local().markBotTrustedOpenGame(bot->id);
open(); open();
}; };
Ui::show(Box<ConfirmBox>( Ui::show(Box<Ui::ConfirmBox>(
tr::lng_allow_bot_pass(tr::now, lt_bot_name, _bot->name), tr::lng_allow_bot_pass(tr::now, lt_bot_name, _bot->name),
tr::lng_allow_bot(tr::now), tr::lng_allow_bot(tr::now),
callback)); callback));

View file

@ -412,12 +412,12 @@ bool HandleUnknown(
Core::UpdateApplication(); Core::UpdateApplication();
close(); close();
}; };
controller->show(Box<ConfirmBox>( controller->show(Box<Ui::ConfirmBox>(
text, text,
tr::lng_menu_update(tr::now), tr::lng_menu_update(tr::now),
callback)); callback));
} else { } else {
controller->show(Box<InformBox>(text)); controller->show(Box<Ui::InformBox>(text));
} }
}); });
controller->session().api().requestDeepLinkInfo(request, callback); controller->session().api().requestDeepLinkInfo(request, callback);

View file

@ -224,7 +224,7 @@ void CloudThemes::resolve(
showPreview(controller, result); showPreview(controller, result);
}).fail([=](const MTP::Error &error) { }).fail([=](const MTP::Error &error) {
if (error.type() == qstr("THEME_FORMAT_INVALID")) { if (error.type() == qstr("THEME_FORMAT_INVALID")) {
controller->show(Box<InformBox>( controller->show(Box<Ui::InformBox>(
tr::lng_theme_no_desktop(tr::now))); tr::lng_theme_no_desktop(tr::now)));
} }
}).send(); }).send();
@ -249,7 +249,7 @@ void CloudThemes::showPreview(
controller, controller,
cloud)); cloud));
} else { } else {
controller->show(Box<InformBox>( controller->show(Box<Ui::InformBox>(
tr::lng_theme_no_desktop(tr::now))); tr::lng_theme_no_desktop(tr::now)));
} }
} }

View file

@ -905,7 +905,7 @@ void DocumentData::handleLoaderUpdates() {
Ui::hideLayer(); Ui::hideLayer();
save(origin, failedFileName); save(origin, failedFileName);
}; };
Ui::show(Box<ConfirmBox>( Ui::show(Box<Ui::ConfirmBox>(
tr::lng_download_finish_failed(tr::now), tr::lng_download_finish_failed(tr::now),
crl::guard(&session(), retry))); crl::guard(&session(), retry)));
} else { } else {
@ -917,7 +917,7 @@ void DocumentData::handleLoaderUpdates() {
// Core::App().settings().setDownloadPath(QString()); // Core::App().settings().setDownloadPath(QString());
// Ui::show(Box<DownloadPathBox>()); // Ui::show(Box<DownloadPathBox>());
//}; //};
//Ui::show(Box<ConfirmBox>( //Ui::show(Box<Ui::ConfirmBox>(
// tr::lng_download_path_failed(tr::now), // tr::lng_download_path_failed(tr::now),
// tr::lng_download_path_settings(tr::now), // tr::lng_download_path_settings(tr::now),
// crl::guard(&session(), openSettings))); // crl::guard(&session(), openSettings)));

View file

@ -80,7 +80,7 @@ void LaunchWithWarning(
rpl::single(Ui::Text::Bold(extension)), rpl::single(Ui::Text::Bold(extension)),
Ui::Text::WithEntities) Ui::Text::WithEntities)
: tr::lng_launch_svg_warning(Ui::Text::WithEntities); : tr::lng_launch_svg_warning(Ui::Text::WithEntities);
Ui::show(Box<ConfirmDontWarnBox>( Ui::show(Box<Ui::ConfirmDontWarnBox>(
std::move(text), std::move(text),
tr::lng_launch_exe_dont_ask(tr::now), tr::lng_launch_exe_dont_ask(tr::now),
(isExecutable ? tr::lng_launch_exe_sure : tr::lng_continue)(), (isExecutable ? tr::lng_launch_exe_sure : tr::lng_continue)(),

View file

@ -646,7 +646,7 @@ void Histories::deleteAllMessages(
session().api().applyUpdates(result); session().api().applyUpdates(result);
//}).fail([=](const MTP::Error &error) { //}).fail([=](const MTP::Error &error) {
// if (error.type() == qstr("CHANNEL_TOO_LARGE")) { // if (error.type() == qstr("CHANNEL_TOO_LARGE")) {
// Ui::show(Box<InformBox>(tr::lng_cant_delete_channel(tr::now))); // Ui::show(Box<Ui::InformBox>(tr::lng_cant_delete_channel(tr::now)));
// } // }
}).send(); }).send();
} else if (channel) { } else if (channel) {

View file

@ -402,7 +402,7 @@ void Stickers::undoInstallLocally(uint64 setId) {
notifyUpdated(); notifyUpdated();
Ui::show( Ui::show(
Box<InformBox>(tr::lng_stickers_not_found(tr::now)), Box<Ui::InformBox>(tr::lng_stickers_not_found(tr::now)),
Ui::LayerOption::KeepOther); Ui::LayerOption::KeepOther);
} }

View file

@ -195,7 +195,7 @@ void Paint::handleMimeData(const QMimeData *data) {
} }
if (!Ui::ValidateThumbDimensions(image.width(), image.height())) { if (!Ui::ValidateThumbDimensions(image.width(), image.height())) {
_controllers->showBox( _controllers->showBox(
Box<InformBox>(tr::lng_edit_media_invalid_file(tr::now))); Box<Ui::InformBox>(tr::lng_edit_media_invalid_file(tr::now)));
return; return;
} }

View file

@ -87,7 +87,7 @@ void PrepareProfilePhoto(
if (image.isNull() if (image.isNull()
|| (image.width() > (10 * image.height())) || (image.width() > (10 * image.height()))
|| (image.height() > (10 * image.width()))) { || (image.height() > (10 * image.width()))) {
controller->show(Box<InformBox>(tr::lng_bad_photo(tr::now))); controller->show(Box<Ui::InformBox>(tr::lng_bad_photo(tr::now)));
return; return;
} }
image = resizeToMinSize( image = resizeToMinSize(

View file

@ -271,7 +271,7 @@ void PanelController::showCriticalError(const QString &text) {
} }
void PanelController::showError(const QString &text) { void PanelController::showError(const QString &text) {
auto box = Box<InformBox>(text); auto box = Box<Ui::InformBox>(text);
const auto weak = Ui::MakeWeak(box.data()); const auto weak = Ui::MakeWeak(box.data());
const auto hidden = _panel->isHidden(); const auto hidden = _panel->isHidden();
_panel->showBox( _panel->showBox(
@ -347,7 +347,7 @@ void PanelController::stopWithConfirmation(FnMut<void()> callback) {
}; };
const auto hidden = _panel->isHidden(); const auto hidden = _panel->isHidden();
const auto old = _confirmStopBox; const auto old = _confirmStopBox;
auto box = Box<ConfirmBox>( auto box = Box<Ui::ConfirmBox>(
tr::lng_export_sure_stop(tr::now), tr::lng_export_sure_stop(tr::now),
tr::lng_export_stop(tr::now), tr::lng_export_stop(tr::now),
st::attentionBoxButton, st::attentionBoxButton,

View file

@ -140,7 +140,7 @@ void activateBotCommand(
case ButtonType::RequestLocation: { case ButtonType::RequestLocation: {
hideSingleUseKeyboard(msg); hideSingleUseKeyboard(msg);
Ui::show(Box<InformBox>( Ui::show(Box<Ui::InformBox>(
tr::lng_bot_share_location_unavailable(tr::now))); tr::lng_bot_share_location_unavailable(tr::now)));
} break; } break;
@ -148,15 +148,18 @@ void activateBotCommand(
hideSingleUseKeyboard(msg); hideSingleUseKeyboard(msg);
const auto msgId = msg->id; const auto msgId = msg->id;
const auto history = msg->history(); const auto history = msg->history();
Ui::show(Box<ConfirmBox>(tr::lng_bot_share_phone(tr::now), tr::lng_bot_share_phone_confirm(tr::now), [=] { Ui::show(Box<Ui::ConfirmBox>(
Ui::showPeerHistory(history, ShowAtTheEndMsgId); tr::lng_bot_share_phone(tr::now),
auto action = Api::SendAction(history); tr::lng_bot_share_phone_confirm(tr::now),
action.clearDraft = false; [=] {
action.replyTo = msgId; Ui::showPeerHistory(history, ShowAtTheEndMsgId);
history->session().api().shareContact( auto action = Api::SendAction(history);
history->session().user(), action.clearDraft = false;
action); action.replyTo = msgId;
})); history->session().api().shareContact(
history->session().user(),
action);
}));
} break; } break;
case ButtonType::RequestPoll: { case ButtonType::RequestPoll: {

View file

@ -328,7 +328,7 @@ Widget::Widget(
}, lifetime()); }, lifetime());
_whatIsThis->setClickedCallback([=] { _whatIsThis->setClickedCallback([=] {
controller->show(Box<InformBox>(channel->isMegagroup() controller->show(Box<Ui::InformBox>(channel->isMegagroup()
? tr::lng_admin_log_about_text(tr::now) ? tr::lng_admin_log_about_text(tr::now)
: tr::lng_admin_log_about_text_channel(tr::now))); : tr::lng_admin_log_about_text_channel(tr::now)));
}); });

View file

@ -264,7 +264,7 @@ void FastShareMessage(not_null<HistoryItem*> item) {
} }
text.append(error.first); text.append(error.first);
Ui::show( Ui::show(
Box<InformBox>(text), Box<Ui::InformBox>(text),
Ui::LayerOption::KeepOther); Ui::LayerOption::KeepOther);
return; return;
} }

View file

@ -671,7 +671,7 @@ HistoryWidget::HistoryWidget(
const auto unavailable = _peer->computeUnavailableReason(); const auto unavailable = _peer->computeUnavailableReason();
if (!unavailable.isEmpty()) { if (!unavailable.isEmpty()) {
controller->showBackFromStack(); controller->showBackFromStack();
controller->show(Box<InformBox>(unavailable)); controller->show(Box<Ui::InformBox>(unavailable));
return; return;
} }
} }
@ -858,7 +858,7 @@ void HistoryWidget::initVoiceRecordBar() {
? Data::RestrictionError(_peer, ChatRestriction::SendMedia) ? Data::RestrictionError(_peer, ChatRestriction::SendMedia)
: std::nullopt; : std::nullopt;
if (error) { if (error) {
controller()->show(Box<InformBox>(*error)); controller()->show(Box<Ui::InformBox>(*error));
return true; return true;
} else if (showSlowmodeError()) { } else if (showSlowmodeError()) {
return true; return true;
@ -3308,7 +3308,8 @@ void HistoryWidget::saveEditMsg() {
Box<DeleteMessagesBox>(item, suggestModerateActions)); Box<DeleteMessagesBox>(item, suggestModerateActions));
return; return;
} else if (!left.text.isEmpty()) { } else if (!left.text.isEmpty()) {
controller()->show(Box<InformBox>(tr::lng_edit_too_long(tr::now))); controller()->show(Box<Ui::InformBox>(
tr::lng_edit_too_long(tr::now)));
return; return;
} }
@ -3343,7 +3344,7 @@ void HistoryWidget::saveEditMsg() {
const auto &err = error.type(); const auto &err = error.type();
if (ranges::contains(Api::kDefaultEditMessagesErrors, err)) { if (ranges::contains(Api::kDefaultEditMessagesErrors, err)) {
controller()->show( controller()->show(
Box<InformBox>(tr::lng_edit_error(tr::now))); Box<Ui::InformBox>(tr::lng_edit_error(tr::now)));
} else if (err == u"MESSAGE_NOT_MODIFIED"_q) { } else if (err == u"MESSAGE_NOT_MODIFIED"_q) {
cancelEdit(); cancelEdit();
} else if (err == u"MESSAGE_EMPTY"_q) { } else if (err == u"MESSAGE_EMPTY"_q) {
@ -3351,7 +3352,7 @@ void HistoryWidget::saveEditMsg() {
_field->setFocus(); _field->setFocus();
} else { } else {
controller()->show( controller()->show(
Box<InformBox>(tr::lng_edit_error(tr::now))); Box<Ui::InformBox>(tr::lng_edit_error(tr::now)));
} }
update(); update();
})(); })();
@ -3729,7 +3730,7 @@ void HistoryWidget::unreadMentionsAnimationFinish() {
void HistoryWidget::chooseAttach() { void HistoryWidget::chooseAttach() {
if (_editMsgId) { if (_editMsgId) {
controller()->show( controller()->show(
Box<InformBox>(tr::lng_edit_caption_attach(tr::now))); Box<Ui::InformBox>(tr::lng_edit_caption_attach(tr::now)));
return; return;
} }
@ -4544,7 +4545,7 @@ bool HistoryWidget::confirmSendingFiles(
} }
if (_editMsgId) { if (_editMsgId) {
controller()->show( controller()->show(
Box<InformBox>(tr::lng_edit_caption_attach(tr::now))); Box<Ui::InformBox>(tr::lng_edit_caption_attach(tr::now)));
return false; return false;
} }
@ -5714,7 +5715,7 @@ void HistoryWidget::sendInlineResult(InlineBots::ResultSelected result) {
auto errorText = result.result->getErrorOnSend(_history); auto errorText = result.result->getErrorOnSend(_history);
if (!errorText.isEmpty()) { if (!errorText.isEmpty()) {
controller()->show(Box<InformBox>(errorText)); controller()->show(Box<Ui::InformBox>(errorText));
return; return;
} }
@ -6048,7 +6049,7 @@ bool HistoryWidget::sendExistingDocument(
: std::nullopt; : std::nullopt;
if (error) { if (error) {
controller()->show( controller()->show(
Box<InformBox>(*error), Box<Ui::InformBox>(*error),
Ui::LayerOption::KeepOther); Ui::LayerOption::KeepOther);
return false; return false;
} else if (!_peer || !_peer->canWrite()) { } else if (!_peer || !_peer->canWrite()) {
@ -6084,7 +6085,7 @@ bool HistoryWidget::sendExistingPhoto(
: std::nullopt; : std::nullopt;
if (error) { if (error) {
controller()->show( controller()->show(
Box<InformBox>(*error), Box<Ui::InformBox>(*error),
Ui::LayerOption::KeepOther); Ui::LayerOption::KeepOther);
return false; return false;
} else if (!_peer || !_peer->canWrite()) { } else if (!_peer || !_peer->canWrite()) {
@ -6169,11 +6170,12 @@ void HistoryWidget::replyToMessage(not_null<HistoryItem*> item) {
} }
if (item->history() == _migrated) { if (item->history() == _migrated) {
if (item->serviceMsg()) { if (item->serviceMsg()) {
controller()->show(Box<InformBox>(tr::lng_reply_cant(tr::now))); controller()->show(Box<Ui::InformBox>(
tr::lng_reply_cant(tr::now)));
} else { } else {
const auto itemId = item->fullId(); const auto itemId = item->fullId();
controller()->show( controller()->show(
Box<ConfirmBox>( Box<Ui::ConfirmBox>(
tr::lng_reply_cant_forward(tr::now), tr::lng_reply_cant_forward(tr::now),
tr::lng_selected_forward(tr::now), tr::lng_selected_forward(tr::now),
crl::guard(this, [=] { crl::guard(this, [=] {
@ -6231,7 +6233,7 @@ void HistoryWidget::editMessage(not_null<HistoryItem*> item) {
toggleChooseChatTheme(_peer); toggleChooseChatTheme(_peer);
} else if (_voiceRecordBar->isActive()) { } else if (_voiceRecordBar->isActive()) {
controller()->show( controller()->show(
Box<InformBox>(tr::lng_edit_caption_voice(tr::now))); Box<Ui::InformBox>(tr::lng_edit_caption_voice(tr::now)));
return; return;
} }
@ -6691,7 +6693,7 @@ void HistoryWidget::escape() {
} else if (_editMsgId) { } else if (_editMsgId) {
if (_replyEditMsg if (_replyEditMsg
&& PrepareEditText(_replyEditMsg) != _field->getTextWithTags()) { && PrepareEditText(_replyEditMsg) != _field->getTextWithTags()) {
controller()->show(Box<ConfirmBox>( controller()->show(Box<Ui::ConfirmBox>(
tr::lng_cancel_edit_post_sure(tr::now), tr::lng_cancel_edit_post_sure(tr::now),
tr::lng_cancel_edit_post_yes(tr::now), tr::lng_cancel_edit_post_yes(tr::now),
tr::lng_cancel_edit_post_no(tr::now), tr::lng_cancel_edit_post_no(tr::now),

View file

@ -798,7 +798,7 @@ rpl::producer<> ComposeControls::attachRequests() const {
) | rpl::filter([=] { ) | rpl::filter([=] {
if (isEditingMessage()) { if (isEditingMessage()) {
_window->show( _window->show(
Box<InformBox>(tr::lng_edit_caption_attach(tr::now))); Box<Ui::InformBox>(tr::lng_edit_caption_attach(tr::now)));
return false; return false;
} }
return true; return true;
@ -1715,7 +1715,7 @@ void ComposeControls::initVoiceRecordBar() {
ChatRestriction::SendMedia) ChatRestriction::SendMedia)
: std::nullopt; : std::nullopt;
if (error) { if (error) {
_window->show(Box<InformBox>(*error)); _window->show(Box<Ui::InformBox>(*error));
return true; return true;
} else if (_showSlowmodeError && _showSlowmodeError()) { } else if (_showSlowmodeError && _showSlowmodeError()) {
return true; return true;
@ -2014,7 +2014,8 @@ void ComposeControls::editMessage(not_null<HistoryItem*> item) {
Expects(draftKeyCurrent() != Data::DraftKey::None()); Expects(draftKeyCurrent() != Data::DraftKey::None());
if (_voiceRecordBar->isActive()) { if (_voiceRecordBar->isActive()) {
_window->show(Box<InformBox>(tr::lng_edit_caption_voice(tr::now))); _window->show(Box<Ui::InformBox>(
tr::lng_edit_caption_voice(tr::now)));
return; return;
} }

View file

@ -1636,7 +1636,7 @@ void VoiceRecordBar::showDiscardBox(
callback(); callback();
} }
}; };
_controller->show(Box<ConfirmBox>( _controller->show(Box<Ui::ConfirmBox>(
(isListenState() (isListenState()
? tr::lng_record_listen_cancel_sure ? tr::lng_record_listen_cancel_sure
: tr::lng_record_lock_cancel_sure)(tr::now), : tr::lng_record_lock_cancel_sure)(tr::now),

View file

@ -341,7 +341,7 @@ void ContactStatus::setupShareHandler(not_null<UserData*> user) {
}).send(); }).send();
close(); close();
}; };
_controller->window().show(Box<ConfirmBox>( _controller->window().show(Box<Ui::ConfirmBox>(
tr::lng_new_contact_share_sure( tr::lng_new_contact_share_sure(
tr::now, tr::now,
lt_phone, lt_phone,
@ -399,7 +399,7 @@ void ContactStatus::setupReportHandler(not_null<PeerData*> peer) {
const auto text = ((peer->isChat() || peer->isMegagroup()) const auto text = ((peer->isChat() || peer->isMegagroup())
? tr::lng_report_spam_sure_group ? tr::lng_report_spam_sure_group
: tr::lng_report_spam_sure_channel)(tr::now); : tr::lng_report_spam_sure_channel)(tr::now);
_controller->window().show(Box<ConfirmBox>( _controller->window().show(Box<Ui::ConfirmBox>(
text, text,
tr::lng_report_spam_ok(tr::now), tr::lng_report_spam_ok(tr::now),
st::attentionBoxButton, st::attentionBoxButton,

View file

@ -1010,7 +1010,7 @@ void StopPoll(not_null<Main::Session*> session, FullMsgId itemId) {
session->api().closePoll(item); session->api().closePoll(item);
} }
}; };
Ui::show(Box<ConfirmBox>( Ui::show(Box<Ui::ConfirmBox>(
tr::lng_polls_stop_warning(tr::now), tr::lng_polls_stop_warning(tr::now),
tr::lng_polls_stop_sure(tr::now), tr::lng_polls_stop_sure(tr::now),
tr::lng_cancel(tr::now), tr::lng_cancel(tr::now),

View file

@ -1010,7 +1010,8 @@ void RepliesWidget::edit(
} }
return; return;
} else if (!left.text.isEmpty()) { } else if (!left.text.isEmpty()) {
controller()->show(Box<InformBox>(tr::lng_edit_too_long(tr::now))); controller()->show(Box<Ui::InformBox>(
tr::lng_edit_too_long(tr::now)));
return; return;
} }
@ -1035,13 +1036,15 @@ void RepliesWidget::edit(
const auto &err = error.type(); const auto &err = error.type();
if (ranges::contains(Api::kDefaultEditMessagesErrors, err)) { if (ranges::contains(Api::kDefaultEditMessagesErrors, err)) {
controller()->show(Box<InformBox>(tr::lng_edit_error(tr::now))); controller()->show(Box<Ui::InformBox>(
tr::lng_edit_error(tr::now)));
} else if (err == u"MESSAGE_NOT_MODIFIED"_q) { } else if (err == u"MESSAGE_NOT_MODIFIED"_q) {
_composeControls->cancelEditMessage(); _composeControls->cancelEditMessage();
} else if (err == u"MESSAGE_EMPTY"_q) { } else if (err == u"MESSAGE_EMPTY"_q) {
doSetInnerFocus(); doSetInnerFocus();
} else { } else {
controller()->show(Box<InformBox>(tr::lng_edit_error(tr::now))); controller()->show(Box<Ui::InformBox>(
tr::lng_edit_error(tr::now)));
} }
update(); update();
return true; return true;
@ -1078,7 +1081,7 @@ bool RepliesWidget::sendExistingDocument(
ChatRestriction::SendStickers); ChatRestriction::SendStickers);
if (error) { if (error) {
controller()->show( controller()->show(
Box<InformBox>(*error), Box<Ui::InformBox>(*error),
Ui::LayerOption::KeepOther); Ui::LayerOption::KeepOther);
return false; return false;
} else if (showSlowmodeError()) { } else if (showSlowmodeError()) {
@ -1114,7 +1117,7 @@ bool RepliesWidget::sendExistingPhoto(
ChatRestriction::SendMedia); ChatRestriction::SendMedia);
if (error) { if (error) {
controller()->show( controller()->show(
Box<InformBox>(*error), Box<Ui::InformBox>(*error),
Ui::LayerOption::KeepOther); Ui::LayerOption::KeepOther);
return false; return false;
} else if (showSlowmodeError()) { } else if (showSlowmodeError()) {
@ -1136,7 +1139,7 @@ void RepliesWidget::sendInlineResult(
not_null<UserData*> bot) { not_null<UserData*> bot) {
const auto errorText = result->getErrorOnSend(_history); const auto errorText = result->getErrorOnSend(_history);
if (!errorText.isEmpty()) { if (!errorText.isEmpty()) {
controller()->show(Box<InformBox>(errorText)); controller()->show(Box<Ui::InformBox>(errorText));
return; return;
} }
sendInlineResult(result, bot, Api::SendOptions()); sendInlineResult(result, bot, Api::SendOptions());

View file

@ -609,7 +609,8 @@ void ScheduledWidget::edit(
} }
return; return;
} else if (!left.text.isEmpty()) { } else if (!left.text.isEmpty()) {
controller()->show(Box<InformBox>(tr::lng_edit_too_long(tr::now))); controller()->show(Box<Ui::InformBox>(
tr::lng_edit_too_long(tr::now)));
return; return;
} }
@ -634,13 +635,15 @@ void ScheduledWidget::edit(
const auto &err = error.type(); const auto &err = error.type();
if (ranges::contains(Api::kDefaultEditMessagesErrors, err)) { if (ranges::contains(Api::kDefaultEditMessagesErrors, err)) {
controller()->show(Box<InformBox>(tr::lng_edit_error(tr::now))); controller()->show(Box<Ui::InformBox>(
tr::lng_edit_error(tr::now)));
} else if (err == u"MESSAGE_NOT_MODIFIED"_q) { } else if (err == u"MESSAGE_NOT_MODIFIED"_q) {
_composeControls->cancelEditMessage(); _composeControls->cancelEditMessage();
} else if (err == u"MESSAGE_EMPTY"_q) { } else if (err == u"MESSAGE_EMPTY"_q) {
_composeControls->focus(); _composeControls->focus();
} else { } else {
controller()->show(Box<InformBox>(tr::lng_edit_error(tr::now))); controller()->show(Box<Ui::InformBox>(
tr::lng_edit_error(tr::now)));
} }
update(); update();
return true; return true;
@ -675,7 +678,7 @@ bool ScheduledWidget::sendExistingDocument(
ChatRestriction::SendStickers); ChatRestriction::SendStickers);
if (error) { if (error) {
controller()->show( controller()->show(
Box<InformBox>(*error), Box<Ui::InformBox>(*error),
Ui::LayerOption::KeepOther); Ui::LayerOption::KeepOther);
return false; return false;
} }
@ -707,7 +710,7 @@ bool ScheduledWidget::sendExistingPhoto(
ChatRestriction::SendMedia); ChatRestriction::SendMedia);
if (error) { if (error) {
controller()->show( controller()->show(
Box<InformBox>(*error), Box<Ui::InformBox>(*error),
Ui::LayerOption::KeepOther); Ui::LayerOption::KeepOther);
return false; return false;
} }
@ -727,7 +730,7 @@ void ScheduledWidget::sendInlineResult(
not_null<UserData*> bot) { not_null<UserData*> bot) {
const auto errorText = result->getErrorOnSend(_history); const auto errorText = result->getErrorOnSend(_history);
if (!errorText.isEmpty()) { if (!errorText.isEmpty()) {
controller()->show(Box<InformBox>(errorText)); controller()->show(Box<Ui::InformBox>(errorText));
return; return;
} }
const auto callback = [=](Api::SendOptions options) { const auto callback = [=](Api::SendOptions options) {

View file

@ -411,7 +411,7 @@ void WrapWidget::checkBeforeClose(Fn<void()> close) {
close(); close();
}; };
if (_controller->canSaveChangesNow()) { if (_controller->canSaveChangesNow()) {
Ui::show(Box<ConfirmBox>( Ui::show(Box<Ui::ConfirmBox>(
tr::lng_settings_close_sure(tr::now), tr::lng_settings_close_sure(tr::now),
tr::lng_close(tr::now), tr::lng_close(tr::now),
confirmed)); confirmed));

View file

@ -351,7 +351,7 @@ void CodeWidget::gotPassword(const MTPaccount_Password &result) {
Core::UpdateApplication(); Core::UpdateApplication();
close(); close();
}; };
Ui::show(Box<ConfirmBox>( Ui::show(Box<Ui::ConfirmBox>(
tr::lng_passport_app_out_of_date(tr::now), tr::lng_passport_app_out_of_date(tr::now),
tr::lng_menu_update(tr::now), tr::lng_menu_update(tr::now),
callback)); callback));

View file

@ -311,14 +311,14 @@ void PasswordCheckWidget::toRecover() {
}).send(); }).send();
} }
} else { } else {
Ui::show(Box<InformBox>( Ui::show(Box<Ui::InformBox>(
tr::lng_signin_no_email_forgot(tr::now), tr::lng_signin_no_email_forgot(tr::now),
[=] { showReset(); })); [=] { showReset(); }));
} }
} }
void PasswordCheckWidget::toPassword() { void PasswordCheckWidget::toPassword() {
Ui::show(Box<InformBox>( Ui::show(Box<Ui::InformBox>(
tr::lng_signin_cant_email_forgot(tr::now), tr::lng_signin_cant_email_forgot(tr::now),
[=] { showReset(); })); [=] { showReset(); }));
} }
@ -372,7 +372,7 @@ void PasswordCheckWidget::submit() {
send(); send();
close(); close();
}; };
Ui::show(Box<ConfirmBox>( Ui::show(Box<Ui::ConfirmBox>(
tr::lng_cloud_password_passport_losing(tr::now), tr::lng_cloud_password_passport_losing(tr::now),
tr::lng_continue(tr::now), tr::lng_continue(tr::now),
confirmed)); confirmed));

View file

@ -236,7 +236,7 @@ void PhoneWidget::phoneSubmitFail(const MTP::Error &error) {
_sentRequest = 0; _sentRequest = 0;
auto &err = error.type(); auto &err = error.type();
if (err == qstr("PHONE_NUMBER_FLOOD")) { if (err == qstr("PHONE_NUMBER_FLOOD")) {
Ui::show(Box<InformBox>(tr::lng_error_phone_flood(tr::now))); Ui::show(Box<Ui::InformBox>(tr::lng_error_phone_flood(tr::now)));
} else if (err == qstr("PHONE_NUMBER_INVALID")) { // show error } else if (err == qstr("PHONE_NUMBER_INVALID")) { // show error
showPhoneError(tr::lng_bad_phone()); showPhoneError(tr::lng_bad_phone());
} else if (err == qstr("PHONE_NUMBER_BANNED")) { } else if (err == qstr("PHONE_NUMBER_BANNED")) {

View file

@ -401,7 +401,7 @@ void QrWidget::sendCheckPasswordRequest() {
Core::UpdateApplication(); Core::UpdateApplication();
close(); close();
}; };
Ui::show(Box<ConfirmBox>( Ui::show(Box<Ui::ConfirmBox>(
tr::lng_passport_app_out_of_date(tr::now), tr::lng_passport_app_out_of_date(tr::now),
tr::lng_menu_update(tr::now), tr::lng_menu_update(tr::now),
callback)); callback));

View file

@ -130,7 +130,7 @@ void SignupWidget::nameSubmitFail(const MTP::Error &error) {
auto &err = error.type(); auto &err = error.type();
if (err == qstr("PHONE_NUMBER_FLOOD")) { if (err == qstr("PHONE_NUMBER_FLOOD")) {
Ui::show(Box<InformBox>(tr::lng_error_phone_flood(tr::now))); Ui::show(Box<Ui::InformBox>(tr::lng_error_phone_flood(tr::now)));
} else if (err == qstr("PHONE_NUMBER_INVALID") } else if (err == qstr("PHONE_NUMBER_INVALID")
|| err == qstr("PHONE_NUMBER_BANNED") || err == qstr("PHONE_NUMBER_BANNED")
|| err == qstr("PHONE_CODE_EXPIRED") || err == qstr("PHONE_CODE_EXPIRED")

View file

@ -141,7 +141,8 @@ void Step::finish(const MTPUser &user, QImage &&photo) {
|| !user.c_user().vid().v) { || !user.c_user().vid().v) {
// No idea what to do here. // No idea what to do here.
// We could've reset intro and MTP, but this really should not happen. // We could've reset intro and MTP, but this really should not happen.
Ui::show(Box<InformBox>("Internal error: bad user.is_self() after sign in.")); Ui::show(Box<Ui::InformBox>(
"Internal error: bad user.is_self() after sign in."));
return; return;
} }

View file

@ -237,7 +237,7 @@ void Widget::handleUpdate(const MTPUpdate &update) {
qs(data.vmessage()), qs(data.vmessage()),
Api::EntitiesFromMTP(nullptr, data.ventities().v) Api::EntitiesFromMTP(nullptr, data.ventities().v)
}; };
Ui::show(Box<InformBox>(text)); Ui::show(Box<Ui::InformBox>(text));
}, [](const auto &) {}); }, [](const auto &) {});
} }
@ -486,7 +486,7 @@ void Widget::resetAccount() {
return; return;
} }
Ui::show(Box<ConfirmBox>(tr::lng_signin_sure_reset(tr::now), tr::lng_signin_reset(tr::now), st::attentionBoxButton, crl::guard(this, [this] { const auto callback = crl::guard(this, [this] {
if (_resetRequest) { if (_resetRequest) {
return; return;
} }
@ -512,7 +512,8 @@ void Widget::resetAccount() {
const auto &type = error.type(); const auto &type = error.type();
if (type.startsWith(qstr("2FA_CONFIRM_WAIT_"))) { if (type.startsWith(qstr("2FA_CONFIRM_WAIT_"))) {
const auto seconds = type.midRef(qstr("2FA_CONFIRM_WAIT_").size()).toInt(); const auto seconds = type.midRef(
qstr("2FA_CONFIRM_WAIT_").size()).toInt();
const auto days = (seconds + 59) / 86400; const auto days = (seconds + 59) / 86400;
const auto hours = ((seconds + 59) % 86400) / 3600; const auto hours = ((seconds + 59) % 86400) / 3600;
const auto minutes = ((seconds + 59) % 3600) / 60; const auto minutes = ((seconds + 59) % 3600) / 60;
@ -549,21 +550,27 @@ void Widget::resetAccount() {
lt_minutes_count, lt_minutes_count,
when); when);
} }
Ui::show(Box<InformBox>(tr::lng_signin_reset_wait( Ui::show(Box<Ui::InformBox>(tr::lng_signin_reset_wait(
tr::now, tr::now,
lt_phone_number, lt_phone_number,
Ui::FormatPhone(getData()->phone), Ui::FormatPhone(getData()->phone),
lt_when, lt_when,
when))); when)));
} else if (type == qstr("2FA_RECENT_CONFIRM")) { } else if (type == qstr("2FA_RECENT_CONFIRM")) {
Ui::show(Box<InformBox>( Ui::show(Box<Ui::InformBox>(
tr::lng_signin_reset_cancelled(tr::now))); tr::lng_signin_reset_cancelled(tr::now)));
} else { } else {
Ui::hideLayer(); Ui::hideLayer();
getStep()->showError(rpl::single(Lang::Hard::ServerError())); getStep()->showError(rpl::single(Lang::Hard::ServerError()));
} }
}).send(); }).send();
}))); });
Ui::show(Box<Ui::ConfirmBox>(
tr::lng_signin_sure_reset(tr::now),
tr::lng_signin_reset(tr::now),
st::attentionBoxButton,
callback));
} }
void Widget::getNearestDC() { void Widget::getNearestDC() {

View file

@ -368,7 +368,7 @@ bool CloudManager::showOfferSwitchBox() {
Local::writeLangPack(); Local::writeLangPack();
}; };
Ui::show( Ui::show(
Box<ConfirmBox>( Box<Ui::ConfirmBox>(
"Do you want to switch your language to " "Do you want to switch your language to "
+ language.nativeName + language.nativeName
+ "? You can always change your language in Settings.", + "? You can always change your language in Settings.",
@ -420,7 +420,7 @@ void CloudManager::requestLanguageAndSwitch(
Expects(!id.isEmpty()); Expects(!id.isEmpty());
if (LanguageIdOrDefault(_langpack.id()) == id) { if (LanguageIdOrDefault(_langpack.id()) == id) {
Ui::show(Box<InformBox>(tr::lng_language_already(tr::now))); Ui::show(Box<Ui::InformBox>(tr::lng_language_already(tr::now)));
return; return;
} else if (id == qstr("#custom")) { } else if (id == qstr("#custom")) {
performSwitchToCustom(); performSwitchToCustom();
@ -465,7 +465,7 @@ void CloudManager::sendSwitchingToLanguageRequest() {
}).fail([=](const MTP::Error &error) { }).fail([=](const MTP::Error &error) {
_switchingToLanguageRequest = 0; _switchingToLanguageRequest = 0;
if (error.type() == "LANG_CODE_NOT_SUPPORTED") { if (error.type() == "LANG_CODE_NOT_SUPPORTED") {
Ui::show(Box<InformBox>(tr::lng_language_not_found(tr::now))); Ui::show(Box<Ui::InformBox>(tr::lng_language_not_found(tr::now)));
} }
}).send(); }).send();
} }
@ -503,7 +503,7 @@ void CloudManager::switchToLanguage(const Language &data) {
+ "\n\n" + "\n\n"
+ getValue(tr::lng_sure_save_language.base); + getValue(tr::lng_sure_save_language.base);
Ui::show( Ui::show(
Box<ConfirmBox>( Box<Ui::ConfirmBox>(
text, text,
tr::lng_box_ok(tr::now), tr::lng_box_ok(tr::now),
tr::lng_cancel(tr::now), tr::lng_cancel(tr::now),
@ -551,7 +551,7 @@ void CloudManager::performSwitchToCustom() {
App::restart(); App::restart();
}; };
Ui::show( Ui::show(
Box<ConfirmBox>( Box<Ui::ConfirmBox>(
text, text,
tr::lng_box_ok(tr::now), tr::lng_box_ok(tr::now),
tr::lng_cancel(tr::now), tr::lng_cancel(tr::now),
@ -560,7 +560,8 @@ void CloudManager::performSwitchToCustom() {
} }
} else { } else {
Ui::show( Ui::show(
Box<InformBox>("Custom lang failed :(\n\nError: " + loader.errors()), Box<Ui::InformBox>(
"Custom lang failed :(\n\nError: " + loader.errors()),
Ui::LayerOption::KeepOther); Ui::LayerOption::KeepOther);
} }
}); });

View file

@ -504,7 +504,7 @@ bool MainWidget::setForwardDraft(PeerId peerId, Data::ForwardDraft &&draft) {
session().data().idsToItems(draft.ids), session().data().idsToItems(draft.ids),
true); true);
if (!error.isEmpty()) { if (!error.isEmpty()) {
Ui::show(Box<InformBox>(error), Ui::LayerOption::KeepOther); Ui::show(Box<Ui::InformBox>(error), Ui::LayerOption::KeepOther);
return false; return false;
} }
@ -525,7 +525,7 @@ bool MainWidget::shareUrl(
const auto peer = session().data().peer(peerId); const auto peer = session().data().peer(peerId);
if (!peer->canWrite()) { if (!peer->canWrite()) {
Ui::show(Box<InformBox>(tr::lng_share_cant(tr::now))); Ui::show(Box<Ui::InformBox>(tr::lng_share_cant(tr::now)));
return false; return false;
} }
TextWithTags textWithTags = { TextWithTags textWithTags = {
@ -555,7 +555,7 @@ bool MainWidget::inlineSwitchChosen(PeerId peerId, const QString &botAndQuery) {
const auto peer = session().data().peer(peerId); const auto peer = session().data().peer(peerId);
if (!peer->canWrite()) { if (!peer->canWrite()) {
Ui::show(Box<InformBox>(tr::lng_inline_switch_cant(tr::now))); Ui::show(Box<Ui::InformBox>(tr::lng_inline_switch_cant(tr::now)));
return false; return false;
} }
const auto h = peer->owner().history(peer); const auto h = peer->owner().history(peer);
@ -578,12 +578,13 @@ bool MainWidget::sendPaths(PeerId peerId) {
auto peer = session().data().peer(peerId); auto peer = session().data().peer(peerId);
if (!peer->canWrite()) { if (!peer->canWrite()) {
Ui::show(Box<InformBox>(tr::lng_forward_send_files_cant(tr::now))); Ui::show(Box<Ui::InformBox>(
tr::lng_forward_send_files_cant(tr::now)));
return false; return false;
} else if (const auto error = Data::RestrictionError( } else if (const auto error = Data::RestrictionError(
peer, peer,
ChatRestriction::SendMedia)) { ChatRestriction::SendMedia)) {
Ui::show(Box<InformBox>(*error)); Ui::show(Box<Ui::InformBox>(*error));
return false; return false;
} }
Ui::showPeerHistory(peer, ShowAtTheEndMsgId); Ui::showPeerHistory(peer, ShowAtTheEndMsgId);
@ -609,7 +610,8 @@ void MainWidget::onFilesOrForwardDrop(
} else { } else {
auto peer = session().data().peer(peerId); auto peer = session().data().peer(peerId);
if (!peer->canWrite()) { if (!peer->canWrite()) {
Ui::show(Box<InformBox>(tr::lng_forward_send_files_cant(tr::now))); Ui::show(Box<Ui::InformBox>(
tr::lng_forward_send_files_cant(tr::now)));
return; return;
} }
Ui::showPeerHistory(peer, ShowAtTheEndMsgId); Ui::showPeerHistory(peer, ShowAtTheEndMsgId);
@ -726,10 +728,13 @@ void MainWidget::showSendPathsLayer() {
void MainWidget::deletePhotoLayer(PhotoData *photo) { void MainWidget::deletePhotoLayer(PhotoData *photo) {
if (!photo) return; if (!photo) return;
Ui::show(Box<ConfirmBox>(tr::lng_delete_photo_sure(tr::now), tr::lng_box_delete(tr::now), crl::guard(this, [=] { Ui::show(Box<Ui::ConfirmBox>(
session().api().clearPeerPhoto(photo); tr::lng_delete_photo_sure(tr::now),
Ui::hideLayer(); tr::lng_box_delete(tr::now),
}))); crl::guard(this, [=] {
session().api().clearPeerPhoto(photo);
Ui::hideLayer();
})));
} }
void MainWidget::shareUrlLayer(const QString &url, const QString &text) { void MainWidget::shareUrlLayer(const QString &url, const QString &text) {
@ -1266,7 +1271,7 @@ void MainWidget::ui_showPeerHistory(
const auto unavailable = peer->computeUnavailableReason(); const auto unavailable = peer->computeUnavailableReason();
if (!unavailable.isEmpty()) { if (!unavailable.isEmpty()) {
if (params.activation != anim::activation::background) { if (params.activation != anim::activation::background) {
Ui::show(Box<InformBox>(unavailable)); Ui::show(Box<Ui::InformBox>(unavailable));
} }
return; return;
} }
@ -1989,7 +1994,7 @@ void MainWidget::hideAll() {
void MainWidget::showAll() { void MainWidget::showAll() {
if (cPasswordRecovered()) { if (cPasswordRecovered()) {
cSetPasswordRecovered(false); cSetPasswordRecovered(false);
Ui::show(Box<InformBox>(tr::lng_cloud_password_updated(tr::now))); Ui::show(Box<Ui::InformBox>(tr::lng_cloud_password_updated(tr::now)));
} }
if (isOneColumn()) { if (isOneColumn()) {
_sideShadow->hide(); _sideShadow->hide();
@ -2542,7 +2547,7 @@ void MainWidget::activate() {
_controller, _controller,
path.mid(interpret.size())); path.mid(interpret.size()));
if (!error.isEmpty()) { if (!error.isEmpty()) {
Ui::show(Box<InformBox>(error)); Ui::show(Box<Ui::InformBox>(error));
} }
} else { } else {
showSendPathsLayer(); showSendPathsLayer();

View file

@ -17,7 +17,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
struct HistoryMessageMarkupButton; struct HistoryMessageMarkupButton;
class MainWindow; class MainWindow;
class ConfirmBox;
class HistoryWidget; class HistoryWidget;
class StackItem; class StackItem;
struct FileLoadResult; struct FileLoadResult;
@ -66,6 +65,7 @@ struct Content;
} // namespace Export } // namespace Export
namespace Ui { namespace Ui {
class ConfirmBox;
class ResizeArea; class ResizeArea;
class PlainShadow; class PlainShadow;
class DropdownMenu; class DropdownMenu;

View file

@ -739,7 +739,7 @@ bool MainWindow::skipTrayClick() const {
void MainWindow::toggleDisplayNotifyFromTray() { void MainWindow::toggleDisplayNotifyFromTray() {
if (controller().locked()) { if (controller().locked()) {
if (!isActive()) showFromTray(); if (!isActive()) showFromTray();
Ui::show(Box<InformBox>(tr::lng_passcode_need_unblock(tr::now))); Ui::show(Box<Ui::InformBox>(tr::lng_passcode_need_unblock(tr::now)));
return; return;
} }
if (!sessionController()) { if (!sessionController()) {

View file

@ -765,7 +765,7 @@ std::vector<not_null<const Value*>> FormController::submitGetErrors() {
} else if (AcceptErrorRequiresRestart(error.type())) { } else if (AcceptErrorRequiresRestart(error.type())) {
suggestRestart(); suggestRestart();
} else { } else {
_view->show(Box<InformBox>( _view->show(Box<Ui::InformBox>(
Lang::Hard::SecureAcceptError() + "\n" + error.type())); Lang::Hard::SecureAcceptError() + "\n" + error.type()));
} }
}).send(); }).send();
@ -974,7 +974,8 @@ void FormController::checkSavedPasswordSettings(
void FormController::recoverPassword() { void FormController::recoverPassword() {
if (!_password.hasRecovery) { if (!_password.hasRecovery) {
_view->show(Box<InformBox>(tr::lng_signin_no_email_forgot(tr::now))); _view->show(Box<Ui::InformBox>(
tr::lng_signin_no_email_forgot(tr::now)));
return; return;
} else if (_recoverRequestId) { } else if (_recoverRequestId) {
return; return;
@ -1014,7 +1015,7 @@ void FormController::recoverPassword() {
}, box->lifetime()); }, box->lifetime());
}).fail([=](const MTP::Error &error) { }).fail([=](const MTP::Error &error) {
_recoverRequestId = 0; _recoverRequestId = 0;
_view->show(Box<InformBox>(Lang::Hard::ServerError() _view->show(Box<Ui::InformBox>(Lang::Hard::ServerError()
+ '\n' + '\n'
+ error.type())); + error.type()));
}).send(); }).send();
@ -2248,7 +2249,7 @@ void FormController::requestPhoneCall(not_null<Value*> value) {
void FormController::valueSaveShowError( void FormController::valueSaveShowError(
not_null<Value*> value, not_null<Value*> value,
const MTP::Error &error) { const MTP::Error &error) {
_view->show(Box<InformBox>( _view->show(Box<Ui::InformBox>(
Lang::Hard::SecureSaveError() + "\n" + error.type())); Lang::Hard::SecureSaveError() + "\n" + error.type()));
valueSaveFailed(value); valueSaveFailed(value);
} }
@ -2323,7 +2324,7 @@ void FormController::saveSecret(
void FormController::suggestRestart() { void FormController::suggestRestart() {
_suggestingRestart = true; _suggestingRestart = true;
_view->show(Box<ConfirmBox>( _view->show(Box<Ui::ConfirmBox>(
tr::lng_passport_restart_sure(tr::now), tr::lng_passport_restart_sure(tr::now),
tr::lng_passport_restart(tr::now), tr::lng_passport_restart(tr::now),
[=] { _controller->showPassportForm(_request); }, [=] { _controller->showPassportForm(_request); },
@ -2687,7 +2688,7 @@ bool FormController::applyPassword(PasswordSettings &&settings) {
void FormController::cancel() { void FormController::cancel() {
if (!_submitSuccess && _serviceErrorText.isEmpty()) { if (!_submitSuccess && _serviceErrorText.isEmpty()) {
_view->show(Box<ConfirmBox>( _view->show(Box<Ui::ConfirmBox>(
tr::lng_passport_stop_sure(tr::now), tr::lng_passport_stop_sure(tr::now),
tr::lng_passport_stop(tr::now), tr::lng_passport_stop(tr::now),
[=] { cancelSure(); }, [=] { cancelSure(); },

View file

@ -710,7 +710,7 @@ void PanelController::setupPassword() {
} }
void PanelController::cancelPasswordSubmit() { void PanelController::cancelPasswordSubmit() {
show(Box<ConfirmBox>( show(Box<Ui::ConfirmBox>(
tr::lng_passport_stop_password_sure(tr::now), tr::lng_passport_stop_password_sure(tr::now),
tr::lng_passport_stop(tr::now), tr::lng_passport_stop(tr::now),
[=](Fn<void()> &&close) { close(); _form->cancelPassword(); })); [=](Fn<void()> &&close) { close(); _form->cancelPassword(); }));
@ -887,7 +887,7 @@ void PanelController::deleteValueSure(bool withDetails) {
} }
void PanelController::suggestReset(Fn<void()> callback) { void PanelController::suggestReset(Fn<void()> callback) {
_resetBox = Ui::BoxPointer(show(Box<ConfirmBox>( _resetBox = Ui::BoxPointer(show(Box<Ui::ConfirmBox>(
Lang::Hard::PassportCorrupted(), Lang::Hard::PassportCorrupted(),
Lang::Hard::PassportCorruptedReset(), Lang::Hard::PassportCorruptedReset(),
[=] { resetPassport(callback); }, [=] { resetPassport(callback); },
@ -895,7 +895,7 @@ void PanelController::suggestReset(Fn<void()> callback) {
} }
void PanelController::resetPassport(Fn<void()> callback) { void PanelController::resetPassport(Fn<void()> callback) {
const auto box = show(Box<ConfirmBox>( const auto box = show(Box<Ui::ConfirmBox>(
Lang::Hard::PassportCorruptedResetSure(), Lang::Hard::PassportCorruptedResetSure(),
Lang::Hard::PassportCorruptedReset(), Lang::Hard::PassportCorruptedReset(),
st::attentionBoxButton, st::attentionBoxButton,
@ -942,7 +942,7 @@ void PanelController::showUpdateAppBox() {
Core::UpdateApplication(); Core::UpdateApplication();
}; };
show( show(
Box<ConfirmBox>( Box<Ui::ConfirmBox>(
tr::lng_passport_app_out_of_date(tr::now), tr::lng_passport_app_out_of_date(tr::now),
tr::lng_menu_update(tr::now), tr::lng_menu_update(tr::now),
callback, callback,
@ -1076,7 +1076,7 @@ void PanelController::editWithUpload(int index, int documentIndex) {
} }
void PanelController::readScanError(ReadScanError error) { void PanelController::readScanError(ReadScanError error) {
show(Box<InformBox>([&] { show(Box<Ui::InformBox>([&] {
switch (error) { switch (error) {
case ReadScanError::FileTooLarge: case ReadScanError::FileTooLarge:
return tr::lng_passport_error_too_large(tr::now); return tr::lng_passport_error_too_large(tr::now);
@ -1402,7 +1402,7 @@ void PanelController::cancelEditScope() {
if (_panelHasUnsavedChanges && _panelHasUnsavedChanges()) { if (_panelHasUnsavedChanges && _panelHasUnsavedChanges()) {
if (!_confirmForgetChangesBox) { if (!_confirmForgetChangesBox) {
_confirmForgetChangesBox = show(Box<ConfirmBox>( _confirmForgetChangesBox = show(Box<Ui::ConfirmBox>(
tr::lng_passport_sure_cancel(tr::now), tr::lng_passport_sure_cancel(tr::now),
tr::lng_continue(tr::now), tr::lng_continue(tr::now),
[=] { _panel->showForm(); })); [=] { _panel->showForm(); }));

View file

@ -462,7 +462,7 @@ void AppendEmojiPacks(
auto callback = [=] { auto callback = [=] {
if (document) { if (document) {
if (const auto error = RestrictionToSendStickers(_controller)) { if (const auto error = RestrictionToSendStickers(_controller)) {
_controller->show(Box<InformBox>(*error)); _controller->show(Box<Ui::InformBox>(*error));
return true; return true;
} }
Api::SendExistingDocument( Api::SendExistingDocument(

View file

@ -98,7 +98,7 @@ void GroupMembersWidget::removePeer(PeerData *selectedPeer) {
currentRestrictedRights); currentRestrictedRights);
} }
}; };
Ui::show(Box<ConfirmBox>( Ui::show(Box<Ui::ConfirmBox>(
text, text,
tr::lng_box_remove(tr::now), tr::lng_box_remove(tr::now),
crl::guard(&peer->session(), callback))); crl::guard(&peer->session(), callback)));

View file

@ -479,7 +479,7 @@ void SetupSystemIntegrationContent(
}) | rpl::start_with_next([=](bool checked) { }) | rpl::start_with_next([=](bool checked) {
if (controller->session().domain().local().hasLocalPasscode()) { if (controller->session().domain().local().hasLocalPasscode()) {
minimized->entity()->setChecked(false); minimized->entity()->setChecked(false);
controller->show(Box<InformBox>( controller->show(Box<Ui::InformBox>(
tr::lng_error_start_minimized_passcoded(tr::now))); tr::lng_error_start_minimized_passcoded(tr::now)));
} else { } else {
cSetStartMinimized(checked); cSetStartMinimized(checked);
@ -596,7 +596,7 @@ void SetupANGLE(
} }
App::restart(); App::restart();
}); });
controller->show(Box<ConfirmBox>( controller->show(Box<Ui::ConfirmBox>(
tr::lng_settings_need_restart(tr::now), tr::lng_settings_need_restart(tr::now),
tr::lng_settings_restart_now(tr::now), tr::lng_settings_restart_now(tr::now),
confirmed)); confirmed));
@ -638,7 +638,7 @@ void SetupOpenGL(
const auto cancelled = crl::guard(button, [=] { const auto cancelled = crl::guard(button, [=] {
toggles->fire(!enabled); toggles->fire(!enabled);
}); });
controller->show(Box<ConfirmBox>( controller->show(Box<Ui::ConfirmBox>(
tr::lng_settings_need_restart(tr::now), tr::lng_settings_need_restart(tr::now),
tr::lng_settings_restart_now(tr::now), tr::lng_settings_restart_now(tr::now),
confirmed, confirmed,

View file

@ -290,7 +290,7 @@ void Calls::setupContent() {
Platform::SystemSettingsType::Audio); Platform::SystemSettingsType::Audio);
if (!opened) { if (!opened) {
_controller->show( _controller->show(
Box<InformBox>(tr::lng_linux_no_audio_prefs(tr::now))); Box<Ui::InformBox>(tr::lng_linux_no_audio_prefs(tr::now)));
} }
}); });
@ -322,7 +322,7 @@ void Calls::requestPermissionAndStartTestingMicrophone() {
Platform::PermissionType::Microphone); Platform::PermissionType::Microphone);
Ui::hideLayer(); Ui::hideLayer();
}; };
_controller->show(Box<ConfirmBox>( _controller->show(Box<Ui::ConfirmBox>(
tr::lng_no_mic_permission(tr::now), tr::lng_no_mic_permission(tr::now),
tr::lng_menu_settings(tr::now), tr::lng_menu_settings(tr::now),
showSystemSettings)); showSystemSettings));

View file

@ -1172,7 +1172,7 @@ void SetupDefaultThemes(
// in Window::Theme::Revert which is called by Editor. // in Window::Theme::Revert which is called by Editor.
// //
// So we check here, before we change the saved accent color. // So we check here, before we change the saved accent color.
window->show(Box<InformBox>( window->show(Box<Ui::InformBox>(
tr::lng_theme_editor_cant_change_theme(tr::now))); tr::lng_theme_editor_cant_change_theme(tr::now)));
return; return;
} }
@ -1326,7 +1326,7 @@ void SetupAutoNightMode(
}) | rpl::start_with_next([=](bool checked) { }) | rpl::start_with_next([=](bool checked) {
if (checked && Window::Theme::Background()->editingTheme()) { if (checked && Window::Theme::Background()->editingTheme()) {
autoNight->setChecked(false); autoNight->setChecked(false);
controller->show(Box<InformBox>( controller->show(Box<Ui::InformBox>(
tr::lng_theme_editor_cant_change_theme(tr::now))); tr::lng_theme_editor_cant_change_theme(tr::now)));
} else { } else {
Core::App().settings().setSystemDarkModeEnabled(checked); Core::App().settings().setSystemDarkModeEnabled(checked);

View file

@ -76,7 +76,7 @@ auto GenerateCodes() {
? qsl("Do you want to disable DEBUG logs?") ? qsl("Do you want to disable DEBUG logs?")
: qsl("Do you want to enable DEBUG logs?\n\n" : qsl("Do you want to enable DEBUG logs?\n\n"
"All network events will be logged."); "All network events will be logged.");
Ui::show(Box<ConfirmBox>(text, [] { Ui::show(Box<Ui::ConfirmBox>(text, [] {
Core::App().switchDebugMode(); Core::App().switchDebugMode();
})); }));
}); });
@ -96,7 +96,7 @@ auto GenerateCodes() {
}); });
codes.emplace(qsl("moderate"), [](SessionController *window) { codes.emplace(qsl("moderate"), [](SessionController *window) {
auto text = Core::App().settings().moderateModeEnabled() ? qsl("Disable moderate mode?") : qsl("Enable moderate mode?"); auto text = Core::App().settings().moderateModeEnabled() ? qsl("Disable moderate mode?") : qsl("Enable moderate mode?");
Ui::show(Box<ConfirmBox>(text, [=] { Ui::show(Box<Ui::ConfirmBox>(text, [=] {
Core::App().settings().setModerateModeEnabled(!Core::App().settings().moderateModeEnabled()); Core::App().settings().setModerateModeEnabled(!Core::App().settings().moderateModeEnabled());
Core::App().saveSettingsDelayed(); Core::App().saveSettingsDelayed();
Ui::hideLayer(); Ui::hideLayer();
@ -119,7 +119,7 @@ auto GenerateCodes() {
return; return;
} }
auto text = cUseExternalVideoPlayer() ? qsl("Use internal video player?") : qsl("Use external video player?"); auto text = cUseExternalVideoPlayer() ? qsl("Use internal video player?") : qsl("Use external video player?");
Ui::show(Box<ConfirmBox>(text, [=] { Ui::show(Box<Ui::ConfirmBox>(text, [=] {
cSetUseExternalVideoPlayer(!cUseExternalVideoPlayer()); cSetUseExternalVideoPlayer(!cUseExternalVideoPlayer());
window->session().saveSettingsDelayed(); window->session().saveSettingsDelayed();
Ui::hideLayer(); Ui::hideLayer();
@ -136,7 +136,8 @@ auto GenerateCodes() {
if (!result.paths.isEmpty()) { if (!result.paths.isEmpty()) {
const auto loadFor = [&](not_null<Main::Account*> account) { const auto loadFor = [&](not_null<Main::Account*> account) {
if (!account->mtp().dcOptions().loadFromFile(result.paths.front())) { if (!account->mtp().dcOptions().loadFromFile(result.paths.front())) {
Ui::show(Box<InformBox>("Could not load endpoints :( Errors in 'log.txt'.")); Ui::show(Box<Ui::InformBox>("Could not load endpoints"
" :( Errors in 'log.txt'."));
} }
}; };
if (const auto strong = weak.get()) { if (const auto strong = weak.get()) {
@ -185,7 +186,7 @@ auto GenerateCodes() {
#endif // !Q_OS_WIN #endif // !Q_OS_WIN
: qsl("Switch font engine to FreeType?"); : qsl("Switch font engine to FreeType?");
Ui::show(Box<ConfirmBox>(text, [] { Ui::show(Box<Ui::ConfirmBox>(text, [] {
Core::App().switchFreeType(); Core::App().switchFreeType();
})); }));
}); });
@ -214,7 +215,7 @@ auto GenerateCodes() {
auto track = Media::Audio::Current().createTrack(); auto track = Media::Audio::Current().createTrack();
track->fillFromFile(result.paths.front()); track->fillFromFile(result.paths.front());
if (track->failed()) { if (track->failed()) {
Ui::show(Box<InformBox>( Ui::show(Box<Ui::InformBox>(
"Could not audio :( Errors in 'log.txt'.")); "Could not audio :( Errors in 'log.txt'."));
} else { } else {
Core::App().settings().setSoundOverride( Core::App().settings().setSoundOverride(
@ -229,7 +230,7 @@ auto GenerateCodes() {
codes.emplace(qsl("sounds_reset"), [](SessionController *window) { codes.emplace(qsl("sounds_reset"), [](SessionController *window) {
Core::App().settings().clearSoundOverrides(); Core::App().settings().clearSoundOverrides();
Core::App().saveSettingsDelayed(); Core::App().saveSettingsDelayed();
Ui::show(Box<InformBox>("All sound overrides were reset.")); Ui::show(Box<Ui::InformBox>("All sound overrides were reset."));
}); });
codes.emplace(qsl("unpacklog"), [](SessionController *window) { codes.emplace(qsl("unpacklog"), [](SessionController *window) {
FileDialog::GetOpenPath(Core::App().getFileDialogParent(), "Open crash log file", "Crash dump (*.txt)", [=](const FileDialog::OpenResult &result) { FileDialog::GetOpenPath(Core::App().getFileDialogParent(), "Open crash log file", "Crash dump (*.txt)", [=](const FileDialog::OpenResult &result) {

View file

@ -237,7 +237,7 @@ void SetupInterfaceScale(
button, button,
[=] { repeatSetScale(cConfigScale(), repeatSetScale); }); [=] { repeatSetScale(cConfigScale(), repeatSetScale); });
}); });
window->show(Box<ConfirmBox>( window->show(Box<Ui::ConfirmBox>(
tr::lng_settings_need_restart(tr::now), tr::lng_settings_need_restart(tr::now),
tr::lng_settings_restart_now(tr::now), tr::lng_settings_restart_now(tr::now),
confirmed, confirmed,
@ -328,7 +328,7 @@ void SetupHelp(
*requestId = 0; *requestId = 0;
}).send(); }).send();
}); });
auto box = Box<ConfirmBox>( auto box = Box<Ui::ConfirmBox>(
tr::lng_settings_ask_sure(tr::now), tr::lng_settings_ask_sure(tr::now),
tr::lng_settings_ask_ok(tr::now), tr::lng_settings_ask_ok(tr::now),
tr::lng_settings_faq_button(tr::now), tr::lng_settings_faq_button(tr::now),

View file

@ -480,7 +480,7 @@ void LastSeenPrivacyController::confirmSave(
Core::App().settings().setLastSeenWarningSeen(true); Core::App().settings().setLastSeenWarningSeen(true);
Core::App().saveSettingsDelayed(); Core::App().saveSettingsDelayed();
}; };
auto box = Box<ConfirmBox>( auto box = Box<Ui::ConfirmBox>(
tr::lng_edit_privacy_lastseen_warning(tr::now), tr::lng_edit_privacy_lastseen_warning(tr::now),
tr::lng_continue(tr::now), tr::lng_continue(tr::now),
tr::lng_cancel(tr::now), tr::lng_cancel(tr::now),

View file

@ -585,7 +585,7 @@ void SetupCloudPassword(
*sent = false; *sent = false;
}, container->lifetime()); }, container->lifetime());
}; };
Ui::show(Box<ConfirmBox>( Ui::show(Box<Ui::ConfirmBox>(
tr::lng_cloud_password_reset_cancel_sure(tr::now), tr::lng_cloud_password_reset_cancel_sure(tr::now),
tr::lng_box_yes(tr::now), tr::lng_box_yes(tr::now),
tr::lng_box_no(tr::now), tr::lng_box_no(tr::now),
@ -889,7 +889,7 @@ object_ptr<Ui::BoxContent> CloudPasswordAppOutdatedBox() {
Core::UpdateApplication(); Core::UpdateApplication();
close(); close();
}; };
return Box<ConfirmBox>( return Box<Ui::ConfirmBox>(
tr::lng_passport_app_out_of_date(tr::now), tr::lng_passport_app_out_of_date(tr::now),
tr::lng_menu_update(tr::now), tr::lng_menu_update(tr::now),
callback); callback);

View file

@ -1040,13 +1040,13 @@ void FileLoadTask::process(Args &&args) {
void FileLoadTask::finish() { void FileLoadTask::finish() {
if (!_result || !_result->filesize || _result->filesize < 0) { if (!_result || !_result->filesize || _result->filesize < 0) {
Ui::show( Ui::show(
Box<InformBox>( Box<Ui::InformBox>(
tr::lng_send_image_empty(tr::now, lt_name, _filepath)), tr::lng_send_image_empty(tr::now, lt_name, _filepath)),
Ui::LayerOption::KeepOther); Ui::LayerOption::KeepOther);
removeFromAlbum(); removeFromAlbum();
} else if (_result->filesize > kFileSizeLimit) { } else if (_result->filesize > kFileSizeLimit) {
Ui::show( Ui::show(
Box<InformBox>( Box<Ui::InformBox>(
tr::lng_send_image_too_large(tr::now, lt_name, _filepath)), tr::lng_send_image_too_large(tr::now, lt_name, _filepath)),
Ui::LayerOption::KeepOther); Ui::LayerOption::KeepOther);
removeFromAlbum(); removeFromAlbum();

View file

@ -13,6 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "styles/style_layers.h" #include "styles/style_layers.h"
#include "styles/style_boxes.h" #include "styles/style_boxes.h"
namespace Ui {
namespace { namespace {
TextParseOptions kInformBoxTextOptions = { TextParseOptions kInformBoxTextOptions = {
@ -444,3 +445,5 @@ not_null<Ui::RpWidget*> ConfirmDontWarnBox::setupContent(
}; };
return result; return result;
} }
} // namespace Ui

View file

@ -9,6 +9,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "boxes/abstract_box.h" #include "boxes/abstract_box.h"
namespace Ui {
class InformBox; class InformBox;
class ConfirmBox : public Ui::BoxContent, public ClickHandlerHost { class ConfirmBox : public Ui::BoxContent, public ClickHandlerHost {
public: public:
@ -174,3 +176,5 @@ private:
not_null<Ui::RpWidget*> _content; not_null<Ui::RpWidget*> _content;
}; };
} // namespace Ui

View file

@ -1404,7 +1404,7 @@ void ToggleNightModeWithConfirmation(
toggle(); toggle();
close(); close();
}; };
window->show(Box<ConfirmBox>( window->show(Box<Ui::ConfirmBox>(
tr::lng_settings_auto_night_warning(tr::now), tr::lng_settings_auto_night_warning(tr::now),
tr::lng_settings_auto_night_disable(tr::now), tr::lng_settings_auto_night_disable(tr::now),
disableAndToggle)); disableAndToggle));

View file

@ -422,7 +422,7 @@ Editor::Inner::Inner(QWidget *parent, const QString &path)
if (update.type == BackgroundUpdate::Type::TestingTheme) { if (update.type == BackgroundUpdate::Type::TestingTheme) {
Revert(); Revert();
base::call_delayed(st::slideDuration, this, [] { base::call_delayed(st::slideDuration, this, [] {
Ui::show(Box<InformBox>( Ui::show(Box<Ui::InformBox>(
tr::lng_theme_editor_cant_change_theme(tr::now))); tr::lng_theme_editor_cant_change_theme(tr::now)));
}); });
} }
@ -667,7 +667,7 @@ Editor::Editor(
[=] { save(); })); [=] { save(); }));
_inner->setErrorCallback([=] { _inner->setErrorCallback([=] {
window->show(Box<InformBox>(tr::lng_theme_editor_error(tr::now))); window->show(Box<Ui::InformBox>(tr::lng_theme_editor_error(tr::now)));
// This could be from inner->_context observable notification. // This could be from inner->_context observable notification.
// We should not destroy it while iterating in subscribers. // We should not destroy it while iterating in subscribers.
@ -750,13 +750,13 @@ void Editor::exportTheme() {
if (!f.open(QIODevice::WriteOnly)) { if (!f.open(QIODevice::WriteOnly)) {
LOG(("Theme Error: could not open zip-ed theme file '%1' for writing").arg(path)); LOG(("Theme Error: could not open zip-ed theme file '%1' for writing").arg(path));
_window->show( _window->show(
Box<InformBox>(tr::lng_theme_editor_error(tr::now))); Box<Ui::InformBox>(tr::lng_theme_editor_error(tr::now)));
return; return;
} }
if (f.write(result) != result.size()) { if (f.write(result) != result.size()) {
LOG(("Theme Error: could not write zip-ed theme to file '%1'").arg(path)); LOG(("Theme Error: could not write zip-ed theme to file '%1'").arg(path));
_window->show( _window->show(
Box<InformBox>(tr::lng_theme_editor_error(tr::now))); Box<Ui::InformBox>(tr::lng_theme_editor_error(tr::now)));
return; return;
} }
Ui::Toast::Show(tr::lng_theme_editor_done(tr::now)); Ui::Toast::Show(tr::lng_theme_editor_done(tr::now));
@ -903,7 +903,7 @@ void Editor::closeWithConfirmation() {
closeEditor(); closeEditor();
close(); close();
}); });
_window->show(Box<ConfirmBox>( _window->show(Box<Ui::ConfirmBox>(
tr::lng_theme_editor_sure_close(tr::now), tr::lng_theme_editor_sure_close(tr::now),
tr::lng_close(tr::now), tr::lng_close(tr::now),
close)); close));

View file

@ -655,7 +655,7 @@ void StartEditor(
? GenerateDefaultPalette() ? GenerateDefaultPalette()
: ParseTheme(object, true).palette; : ParseTheme(object, true).palette;
if (palette.isEmpty() || !CopyColorsToPalette(path, palette, cloud)) { if (palette.isEmpty() || !CopyColorsToPalette(path, palette, cloud)) {
window->show(Box<InformBox>(tr::lng_theme_editor_error(tr::now))); window->show(Box<Ui::InformBox>(tr::lng_theme_editor_error(tr::now)));
return; return;
} }
if (Core::App().settings().systemDarkModeEnabled()) { if (Core::App().settings().systemDarkModeEnabled()) {

View file

@ -617,7 +617,7 @@ void CloudList::showMenu(Element &element) {
_window->session().data().cloudThemes().remove(id); _window->session().data().cloudThemes().remove(id);
} }
}; };
_window->window().show(Box<ConfirmBox>( _window->window().show(Box<Ui::ConfirmBox>(
tr::lng_theme_delete_sure(tr::now), tr::lng_theme_delete_sure(tr::now),
tr::lng_theme_delete(tr::now), tr::lng_theme_delete(tr::now),
remove)); remove));

View file

@ -195,7 +195,7 @@ void Controller::showTermsDelete() {
} }
}; };
show( show(
Box<ConfirmBox>( Box<Ui::ConfirmBox>(
tr::lng_terms_delete_warning(tr::now), tr::lng_terms_delete_warning(tr::now),
tr::lng_terms_delete_now(tr::now), tr::lng_terms_delete_now(tr::now),
st::attentionBoxButton, st::attentionBoxButton,
@ -371,7 +371,7 @@ void Controller::showLogoutConfirmation() {
Core::App().logout(account); Core::App().logout(account);
} }
}; };
show(Box<ConfirmBox>( show(Box<Ui::ConfirmBox>(
tr::lng_sure_logout(tr::now), tr::lng_sure_logout(tr::now),
tr::lng_settings_logout(tr::now), tr::lng_settings_logout(tr::now),
st::attentionBoxButton, st::attentionBoxButton,

View file

@ -336,7 +336,7 @@ void FiltersMenu::showEditBox(FilterId id) {
} }
void FiltersMenu::showRemoveBox(FilterId id) { void FiltersMenu::showRemoveBox(FilterId id) {
_session->window().show(Box<ConfirmBox>( _session->window().show(Box<Ui::ConfirmBox>(
tr::lng_filters_remove_sure(tr::now), tr::lng_filters_remove_sure(tr::now),
tr::lng_filters_remove_yes(tr::now), tr::lng_filters_remove_yes(tr::now),
[=](Fn<void()> &&close) { close(); remove(id); })); [=](Fn<void()> &&close) { close(); remove(id); }));

View file

@ -339,7 +339,7 @@ void MainMenu::AccountButton::contextMenuEvent(QContextMenuEvent *e) {
close(); close();
Core::App().logout(&session->account()); Core::App().logout(&session->account());
}; };
Ui::show(Box<ConfirmBox>( Ui::show(Box<Ui::ConfirmBox>(
tr::lng_sure_logout(tr::now), tr::lng_sure_logout(tr::now),
tr::lng_settings_logout(tr::now), tr::lng_settings_logout(tr::now),
st::attentionBoxButton, st::attentionBoxButton,
@ -941,7 +941,7 @@ void MainMenu::refreshMenu() {
auto nightCallback = [=] { auto nightCallback = [=] {
if (Window::Theme::Background()->editingTheme()) { if (Window::Theme::Background()->editingTheme()) {
controller->show(Box<InformBox>( controller->show(Box<Ui::InformBox>(
tr::lng_theme_editor_cant_change_theme(tr::now))); tr::lng_theme_editor_cant_change_theme(tr::now)));
return; return;
} }

View file

@ -188,7 +188,7 @@ bool PinnedLimitReached(Dialogs::Key key, FilterId filterId) {
tr::now, tr::now,
lt_count, lt_count,
pinnedMax); pinnedMax);
Ui::show(Box<InformBox>(errorText)); Ui::show(Box<Ui::InformBox>(errorText));
} }
return true; return true;
} }
@ -742,7 +742,7 @@ void PeerMenuDeleteContact(not_null<UserData*> user) {
user->session().api().applyUpdates(result); user->session().api().applyUpdates(result);
}).send(); }).send();
}; };
Ui::show(Box<ConfirmBox>( Ui::show(Box<Ui::ConfirmBox>(
text, text,
tr::lng_box_delete(tr::now), tr::lng_box_delete(tr::now),
deleteSure)); deleteSure));
@ -754,7 +754,7 @@ void PeerMenuShareContactBox(
const auto weak = std::make_shared<QPointer<PeerListBox>>(); const auto weak = std::make_shared<QPointer<PeerListBox>>();
auto callback = [=](not_null<PeerData*> peer) { auto callback = [=](not_null<PeerData*> peer) {
if (!peer->canWrite()) { if (!peer->canWrite()) {
Ui::show(Box<InformBox>( Ui::show(Box<Ui::InformBox>(
tr::lng_forward_share_cant(tr::now)), tr::lng_forward_share_cant(tr::now)),
Ui::LayerOption::KeepOther); Ui::LayerOption::KeepOther);
return; return;
@ -771,7 +771,7 @@ void PeerMenuShareContactBox(
auto recipient = peer->isUser() auto recipient = peer->isUser()
? peer->name ? peer->name
: '\xAB' + peer->name + '\xBB'; : '\xAB' + peer->name + '\xBB';
Ui::show(Box<ConfirmBox>( Ui::show(Box<Ui::ConfirmBox>(
tr::lng_forward_share_contact(tr::now, lt_recipient, recipient), tr::lng_forward_share_contact(tr::now, lt_recipient, recipient),
tr::lng_forward_send(tr::now), tr::lng_forward_send(tr::now),
[peer, user, navigation] { [peer, user, navigation] {
@ -1072,7 +1072,7 @@ QPointer<Ui::RpWidget> ShowSendNowMessagesBox(
} }
}; };
return Ui::show( return Ui::show(
Box<ConfirmBox>(text, tr::lng_send_button(tr::now), std::move(done)), Box<Ui::ConfirmBox>(text, tr::lng_send_button(tr::now), std::move(done)),
Ui::LayerOption::KeepOther).data(); Ui::LayerOption::KeepOther).data();
} }
@ -1133,7 +1133,7 @@ void ToggleMessagePinned(
} else { } else {
const auto peer = item->history()->peer; const auto peer = item->history()->peer;
const auto session = &peer->session(); const auto session = &peer->session();
Ui::show(Box<ConfirmBox>(tr::lng_pinned_unpin_sure(tr::now), tr::lng_pinned_unpin(tr::now), crl::guard(session, [=] { const auto callback = crl::guard(session, [=] {
Ui::hideLayer(); Ui::hideLayer();
session->api().request(MTPmessages_UpdatePinnedMessage( session->api().request(MTPmessages_UpdatePinnedMessage(
MTP_flags(MTPmessages_UpdatePinnedMessage::Flag::f_unpin), MTP_flags(MTPmessages_UpdatePinnedMessage::Flag::f_unpin),
@ -1142,7 +1142,11 @@ void ToggleMessagePinned(
)).done([=](const MTPUpdates &result) { )).done([=](const MTPUpdates &result) {
session->api().applyUpdates(result); session->api().applyUpdates(result);
}).send(); }).send();
}))); });
Ui::show(Box<Ui::ConfirmBox>(
tr::lng_pinned_unpin_sure(tr::now),
tr::lng_pinned_unpin(tr::now),
callback));
} }
} }
@ -1150,7 +1154,7 @@ void HidePinnedBar(
not_null<Window::SessionNavigation*> navigation, not_null<Window::SessionNavigation*> navigation,
not_null<PeerData*> peer, not_null<PeerData*> peer,
Fn<void()> onHidden) { Fn<void()> onHidden) {
Ui::show(Box<ConfirmBox>(tr::lng_pinned_hide_all_sure(tr::now), tr::lng_pinned_hide_all_hide(tr::now), crl::guard(navigation, [=] { const auto callback = crl::guard(navigation, [=] {
Ui::hideLayer(); Ui::hideLayer();
auto &session = peer->session(); auto &session = peer->session();
const auto migrated = peer->migrateFrom(); const auto migrated = peer->migrateFrom();
@ -1169,13 +1173,17 @@ void HidePinnedBar(
} else { } else {
session.api().requestFullPeer(peer); session.api().requestFullPeer(peer);
} }
}))); });
Ui::show(Box<Ui::ConfirmBox>(
tr::lng_pinned_hide_all_sure(tr::now),
tr::lng_pinned_hide_all_hide(tr::now),
callback));
} }
void UnpinAllMessages( void UnpinAllMessages(
not_null<Window::SessionNavigation*> navigation, not_null<Window::SessionNavigation*> navigation,
not_null<History*> history) { not_null<History*> history) {
Ui::show(Box<ConfirmBox>(tr::lng_pinned_unpin_all_sure(tr::now), tr::lng_pinned_unpin(tr::now), crl::guard(navigation, [=] { const auto callback = crl::guard(navigation, [=] {
Ui::hideLayer(); Ui::hideLayer();
const auto api = &history->session().api(); const auto api = &history->session().api();
const auto sendRequest = [=](auto self) -> void { const auto sendRequest = [=](auto self) -> void {
@ -1192,7 +1200,11 @@ void UnpinAllMessages(
}).send(); }).send();
}; };
sendRequest(sendRequest); sendRequest(sendRequest);
}))); });
Ui::show(Box<Ui::ConfirmBox>(
tr::lng_pinned_unpin_all_sure(tr::now),
tr::lng_pinned_unpin(tr::now),
callback));
} }
void PeerMenuAddMuteAction( void PeerMenuAddMuteAction(
@ -1230,7 +1242,7 @@ void MenuAddMarkAsReadAllChatsAction(
MarkAsReadChatList(folder->chatsList()); MarkAsReadChatList(folder->chatsList());
} }
}; };
Ui::show(Box<ConfirmBox>( Ui::show(Box<Ui::ConfirmBox>(
tr::lng_context_mark_read_all_sure(tr::now), tr::lng_context_mark_read_all_sure(tr::now),
std::move(boxCallback))); std::move(boxCallback)));
}; };
@ -1253,7 +1265,7 @@ void MenuAddMarkAsReadChatListAction(
MarkAsReadChatList(list()); MarkAsReadChatList(list());
close(); close();
}; };
Ui::show(Box<ConfirmBox>( Ui::show(Box<Ui::ConfirmBox>(
tr::lng_context_mark_read_sure(tr::now), tr::lng_context_mark_read_sure(tr::now),
std::move(boxCallback))); std::move(boxCallback)));
} else { } else {

View file

@ -201,7 +201,7 @@ void SessionNavigation::resolveUsername(
}).fail([=](const MTP::Error &error) { }).fail([=](const MTP::Error &error) {
_resolveRequestId = 0; _resolveRequestId = 0;
if (error.code() == 400) { if (error.code() == 400) {
show(Box<InformBox>( show(Box<Ui::InformBox>(
tr::lng_username_not_found(tr::now, lt_user, username))); tr::lng_username_not_found(tr::now, lt_user, username)));
} }
}).send(); }).send();
@ -1104,7 +1104,7 @@ void SessionController::startOrJoinGroupCall(
GroupCallJoinConfirm confirm) { GroupCallJoinConfirm confirm) {
auto &calls = Core::App().calls(); auto &calls = Core::App().calls();
const auto askConfirmation = [&](QString text, QString button) { const auto askConfirmation = [&](QString text, QString button) {
show(Box<ConfirmBox>(text, button, crl::guard(this, [=] { show(Box<Ui::ConfirmBox>(text, button, crl::guard(this, [=] {
Ui::hideLayer(); Ui::hideLayer();
startOrJoinGroupCall(peer, joinHash, GroupCallJoinConfirm::None); startOrJoinGroupCall(peer, joinHash, GroupCallJoinConfirm::None);
}))); })));
@ -1293,7 +1293,7 @@ void SessionController::cancelUploadLayer(not_null<HistoryItem*> item) {
session().uploader().unpause(); session().uploader().unpause();
}; };
show(Box<ConfirmBox>( show(Box<Ui::ConfirmBox>(
tr::lng_selected_cancel_sure_this(tr::now), tr::lng_selected_cancel_sure_this(tr::now),
tr::lng_selected_upload_stop(tr::now), tr::lng_selected_upload_stop(tr::now),
tr::lng_continue(tr::now), tr::lng_continue(tr::now),