diff --git a/Telegram/SourceFiles/api/api_attached_stickers.cpp b/Telegram/SourceFiles/api/api_attached_stickers.cpp index 418764387..9a7e9d495 100644 --- a/Telegram/SourceFiles/api/api_attached_stickers.cpp +++ b/Telegram/SourceFiles/api/api_attached_stickers.cpp @@ -37,7 +37,7 @@ void AttachedStickers::request( } if (result.v.isEmpty()) { strongController->show( - Box(tr::lng_stickers_not_found(tr::now))); + Box(tr::lng_stickers_not_found(tr::now))); return; } else if (result.v.size() > 1) { strongController->show( @@ -63,7 +63,7 @@ void AttachedStickers::request( _requestId = 0; if (const auto strongController = weak.get()) { strongController->show( - Box(tr::lng_stickers_not_found(tr::now))); + Box(tr::lng_stickers_not_found(tr::now))); } }).send(); } diff --git a/Telegram/SourceFiles/api/api_bot.cpp b/Telegram/SourceFiles/api/api_bot.cpp index d07192a62..8dbf6fa77 100644 --- a/Telegram/SourceFiles/api/api_bot.cpp +++ b/Telegram/SourceFiles/api/api_bot.cpp @@ -91,7 +91,7 @@ void SendBotCallbackData( result.match([&](const MTPDmessages_botCallbackAnswer &data) { if (const auto message = data.vmessage()) { if (data.is_alert()) { - Ui::show(Box(qs(*message))); + Ui::show(Box(qs(*message))); } else { if (withPassword) { Ui::hideLayer(); diff --git a/Telegram/SourceFiles/api/api_chat_invite.cpp b/Telegram/SourceFiles/api/api_chat_invite.cpp index 2a77e8a8b..566d49538 100644 --- a/Telegram/SourceFiles/api/api_chat_invite.cpp +++ b/Telegram/SourceFiles/api/api_chat_invite.cpp @@ -86,7 +86,7 @@ void CheckChatInvite( Core::App().hideMediaView(); if (const auto strong = weak.get()) { strong->show( - Box(tr::lng_group_invite_bad_link(tr::now))); + Box(tr::lng_group_invite_bad_link(tr::now))); } }); } diff --git a/Telegram/SourceFiles/api/api_confirm_phone.cpp b/Telegram/SourceFiles/api/api_confirm_phone.cpp index 89d586a3f..f7e95bc55 100644 --- a/Telegram/SourceFiles/api/api_confirm_phone.cpp +++ b/Telegram/SourceFiles/api/api_confirm_phone.cpp @@ -83,7 +83,7 @@ void ConfirmPhone::resolve( )).done([=](const MTPBool &result) { _checkRequestId = 0; controller->show( - Box( + Box( tr::lng_confirm_phone_success( tr::now, lt_phone, @@ -117,7 +117,7 @@ void ConfirmPhone::resolve( ? tr::lng_confirm_phone_link_invalid(tr::now) : Lang::Hard::ServerError(); controller->show( - Box(errorText), + Box(errorText), Ui::LayerOption::CloseOther); }).handleFloodErrors().send(); } diff --git a/Telegram/SourceFiles/api/api_editing.cpp b/Telegram/SourceFiles/api/api_editing.cpp index e99d4b903..2f083f389 100644 --- a/Telegram/SourceFiles/api/api_editing.cpp +++ b/Telegram/SourceFiles/api/api_editing.cpp @@ -149,7 +149,8 @@ void EditMessageWithUploadedMedia( session->data().sendHistoryChangeNotifications(); if (mediaInvalid) { Ui::show( - Box(tr::lng_edit_media_invalid_file(tr::now)), + Box( + tr::lng_edit_media_invalid_file(tr::now)), Ui::LayerOption::KeepOther); } } else { diff --git a/Telegram/SourceFiles/api/api_updates.cpp b/Telegram/SourceFiles/api/api_updates.cpp index a125fbba1..2804319ed 100644 --- a/Telegram/SourceFiles/api/api_updates.cpp +++ b/Telegram/SourceFiles/api/api_updates.cpp @@ -1976,7 +1976,7 @@ void Updates::feedUpdate(const MTPUpdate &update) { } else if (d.is_popup()) { const auto &windows = session().windows(); if (!windows.empty()) { - windows.front()->window().show(Box(text)); + windows.front()->window().show(Box(text)); } } else { session().data().serviceNotification(text, d.vmedia()); diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index cf32f7542..dbf3da983 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -394,9 +394,9 @@ void ApiWrap::importChatInvite(const QString &hash) { }).fail([=](const MTP::Error &error) { const auto &type = error.type(); if (type == qstr("CHANNELS_TOO_MUCH")) { - Ui::show(Box(tr::lng_join_channel_error(tr::now))); + Ui::show(Box(tr::lng_join_channel_error(tr::now))); } else if (error.code() == 400) { - Ui::show(Box((type == qstr("USERS_TOO_MUCH")) + Ui::show(Box((type == qstr("USERS_TOO_MUCH")) ? tr::lng_group_invite_no_room(tr::now) : tr::lng_group_invite_bad_link(tr::now))); } @@ -468,13 +468,13 @@ void ApiWrap::sendMessageFail( uint64 randomId, FullMsgId itemId) { if (error.type() == qstr("PEER_FLOOD")) { - Ui::show(Box( + Ui::show(Box( PeerFloodErrorText(&session(), PeerFloodType::Send))); } else if (error.type() == qstr("USER_BANNED_IN_CHANNEL")) { const auto link = textcmdLink( session().createInternalLinkFull(qsl("spambot")), tr::lng_cant_more_info(tr::now)); - Ui::show(Box(tr::lng_error_public_groups_denied( + Ui::show(Box(tr::lng_error_public_groups_denied( tr::now, lt_more_info, link))); @@ -495,7 +495,7 @@ void ApiWrap::sendMessageFail( Assert(peer->isUser()); if (const auto item = scheduled.lookupItem(peer->id, itemId.msg)) { scheduled.removeSending(item); - Ui::show(Box(tr::lng_cant_do_this(tr::now))); + Ui::show(Box(tr::lng_cant_do_this(tr::now))); } } if (const auto item = _session->data().message(itemId)) { @@ -1253,7 +1253,7 @@ void ApiWrap::migrateDone( void ApiWrap::migrateFail(not_null peer, const MTP::Error &error) { const auto &type = error.type(); if (type == qstr("CHANNELS_TOO_MUCH")) { - Ui::show(Box(tr::lng_migrate_error(tr::now))); + Ui::show(Box(tr::lng_migrate_error(tr::now))); } if (auto handlers = _migrateCallbacks.take(peer)) { for (auto &handler : *handlers) { @@ -2086,13 +2086,14 @@ void ApiWrap::joinChannel(not_null channel) { } else if (error.type() == qstr("CHANNEL_PRIVATE") || error.type() == qstr("CHANNEL_PUBLIC_GROUP_NA") || error.type() == qstr("USER_BANNED_IN_CHANNEL")) { - Ui::show(Box(channel->isMegagroup() + Ui::show(Box(channel->isMegagroup() ? tr::lng_group_not_accessible(tr::now) : tr::lng_channel_not_accessible(tr::now))); } else if (error.type() == qstr("CHANNELS_TOO_MUCH")) { - Ui::show(Box(tr::lng_join_channel_error(tr::now))); + Ui::show(Box( + tr::lng_join_channel_error(tr::now))); } else if (error.type() == qstr("USERS_TOO_MUCH")) { - Ui::show(Box(tr::lng_group_full(tr::now))); + Ui::show(Box(tr::lng_group_full(tr::now))); } _channelAmInRequests.remove(channel); }).send(); diff --git a/Telegram/SourceFiles/boxes/about_box.cpp b/Telegram/SourceFiles/boxes/about_box.cpp index d81e1a5de..db7f745d9 100644 --- a/Telegram/SourceFiles/boxes/about_box.cpp +++ b/Telegram/SourceFiles/boxes/about_box.cpp @@ -104,7 +104,8 @@ void AboutBox::showVersionHistory() { QGuiApplication::clipboard()->setText(url); - Ui::show(Box("The link to the current private alpha version of Telegram Desktop was copied to the clipboard.")); + Ui::show(Box("The link to the current private alpha " + "version of Telegram Desktop was copied to the clipboard.")); } else { UrlClickHandler::Open(Core::App().changelogLink()); } diff --git a/Telegram/SourceFiles/boxes/add_contact_box.cpp b/Telegram/SourceFiles/boxes/add_contact_box.cpp index 1c87739f1..2d62a7055 100644 --- a/Telegram/SourceFiles/boxes/add_contact_box.cpp +++ b/Telegram/SourceFiles/boxes/add_contact_box.cpp @@ -156,7 +156,7 @@ void ShowAddParticipantsError( *weak = Ui::show(std::move(box)); }; Ui::show( - Box( + Box( tr::lng_cant_invite_offer_admin(tr::now), tr::lng_cant_invite_make_admin(tr::now), tr::lng_cancel(tr::now), @@ -195,7 +195,7 @@ void ShowAddParticipantsError( } return tr::lng_failed_add_participant(tr::now); }(); - Ui::show(Box(text), Ui::LayerOption::KeepOther); + Ui::show(Box(text), Ui::LayerOption::KeepOther); } class RevokePublicLinkBox::Inner : public TWidget { @@ -641,18 +641,18 @@ void GroupInfoBox::createGroup( } } else if (error.type() == qstr("USERS_TOO_FEW")) { Ui::show( - Box(tr::lng_cant_invite_privacy(tr::now)), + Box(tr::lng_cant_invite_privacy(tr::now)), Ui::LayerOption::KeepOther); } else if (error.type() == qstr("PEER_FLOOD")) { Ui::show( - Box( + Box( PeerFloodErrorText( &_navigation->session(), PeerFloodType::InviteGroup)), Ui::LayerOption::KeepOther); } else if (error.type() == qstr("USER_RESTRICTED")) { Ui::show( - Box(tr::lng_cant_do_this(tr::now)), + Box(tr::lng_cant_do_this(tr::now)), Ui::LayerOption::KeepOther); } }).send(); @@ -759,9 +759,9 @@ void GroupInfoBox::createChannel( _title->setFocus(); _title->showError(); } else if (error.type() == qstr("USER_RESTRICTED")) { - Ui::show(Box(tr::lng_cant_do_this(tr::now))); + Ui::show(Box(tr::lng_cant_do_this(tr::now))); } else if (error.type() == qstr("CHANNELS_TOO_MUCH")) { - Ui::show(Box(tr::lng_cant_do_this(tr::now))); // TODO + Ui::show(Box(tr::lng_cant_do_this(tr::now))); // TODO } }).send(); } @@ -1598,7 +1598,7 @@ void RevokePublicLinkBox::Inner::mouseReleaseEvent(QMouseEvent *e) { }).send(); }); Ui::show( - Box(text, confirmText, std::move(callback)), + Box(text, confirmText, std::move(callback)), Ui::LayerOption::KeepOther); } } diff --git a/Telegram/SourceFiles/boxes/add_contact_box.h b/Telegram/SourceFiles/boxes/add_contact_box.h index 0bad0ebcc..d70adf7fc 100644 --- a/Telegram/SourceFiles/boxes/add_contact_box.h +++ b/Telegram/SourceFiles/boxes/add_contact_box.h @@ -11,7 +11,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "base/timer.h" #include "mtproto/sender.h" -class ConfirmBox; class PeerListBox; namespace Window { @@ -23,6 +22,7 @@ class Session; } // namespace Main namespace Ui { +class ConfirmBox; class FlatLabel; class InputField; class PhoneInput; diff --git a/Telegram/SourceFiles/boxes/background_box.cpp b/Telegram/SourceFiles/boxes/background_box.cpp index 74ba084d1..3695f4a6c 100644 --- a/Telegram/SourceFiles/boxes/background_box.cpp +++ b/Telegram/SourceFiles/boxes/background_box.cpp @@ -176,7 +176,7 @@ void BackgroundBox::removePaper(const Data::WallPaper &paper) { )).send(); }; _controller->show( - Box( + Box( tr::lng_background_sure_delete(tr::now), tr::lng_selected_delete(tr::now), tr::lng_cancel(tr::now), diff --git a/Telegram/SourceFiles/boxes/background_preview_box.cpp b/Telegram/SourceFiles/boxes/background_preview_box.cpp index 0243caf98..6ced45f9f 100644 --- a/Telegram/SourceFiles/boxes/background_preview_box.cpp +++ b/Telegram/SourceFiles/boxes/background_preview_box.cpp @@ -784,7 +784,7 @@ bool BackgroundPreviewBox::Start( } if (!IsValidWallPaperSlug(slug)) { controller->show( - Box(tr::lng_background_bad_link(tr::now))); + Box(tr::lng_background_bad_link(tr::now))); return false; } controller->session().api().requestWallPaper(slug, crl::guard(controller, [=]( @@ -794,7 +794,7 @@ bool BackgroundPreviewBox::Start( result.withUrlParams(params))); }), crl::guard(controller, [=](const MTP::Error &error) { controller->show( - Box(tr::lng_background_bad_link(tr::now))); + Box(tr::lng_background_bad_link(tr::now))); })); return true; } diff --git a/Telegram/SourceFiles/boxes/change_phone_box.cpp b/Telegram/SourceFiles/boxes/change_phone_box.cpp index 13ce3839e..bc09116fe 100644 --- a/Telegram/SourceFiles/boxes/change_phone_box.cpp +++ b/Telegram/SourceFiles/boxes/change_phone_box.cpp @@ -234,7 +234,7 @@ void ChangePhoneBox::EnterPhone::sendPhoneFail(const MTP::Error &error, const QS Ui::ShowPhoneBannedError(&_controller->window(), phoneNumber); } else if (error.type() == qstr("PHONE_NUMBER_OCCUPIED")) { _controller->show( - Box( + Box( tr::lng_change_phone_occupied( tr::now, lt_phone, @@ -389,7 +389,7 @@ void ChangePhoneBox::prepare() { Ui::LayerOption::CloseOther); }; controller->show( - Box( + Box( tr::lng_change_phone_warning(tr::now), std::move(callback)), Ui::LayerOption::CloseOther); diff --git a/Telegram/SourceFiles/boxes/connection_box.cpp b/Telegram/SourceFiles/boxes/connection_box.cpp index 04fae42e3..cfea47330 100644 --- a/Telegram/SourceFiles/boxes/connection_box.cpp +++ b/Telegram/SourceFiles/boxes/connection_box.cpp @@ -1131,13 +1131,13 @@ void ProxiesBoxController::ShowApplyConfirmation( close(); }; Ui::show( - Box( + Box( text, tr::lng_sure_enable(tr::now), std::move(callback)), Ui::LayerOption::KeepOther); } else { - Ui::show(Box( + Ui::show(Box( (proxy.status() == ProxyData::Status::Unsupported ? tr::lng_proxy_unsupported(tr::now) : tr::lng_proxy_invalid(tr::now)))); diff --git a/Telegram/SourceFiles/boxes/passcode_box.cpp b/Telegram/SourceFiles/boxes/passcode_box.cpp index 1415bd414..4e18e4b0b 100644 --- a/Telegram/SourceFiles/boxes/passcode_box.cpp +++ b/Telegram/SourceFiles/boxes/passcode_box.cpp @@ -107,7 +107,7 @@ void StartPendingReset( auto finish = [=](const QString &message) mutable { if (const auto strong = weak.data()) { if (!message.isEmpty()) { - strong->getDelegate()->show(Box(message)); + strong->getDelegate()->show(Box(message)); } strong->closeBox(); } @@ -138,7 +138,7 @@ void StartPendingReset( lt_count, minutes); if (const auto strong = weak.data()) { - strong->getDelegate()->show(Box( + strong->getDelegate()->show(Box( tr::lng_cloud_password_reset_later( tr::now, lt_duration, @@ -440,7 +440,7 @@ void PasscodeBox::recoverPasswordDone( if (weak) { _newPasswordSet.fire_copy(newPasswordBytes); if (weak) { - getDelegate()->show(Box( + getDelegate()->show(Box( tr::lng_cloud_password_updated(tr::now))); if (weak) { closeBox(); @@ -462,7 +462,7 @@ void PasscodeBox::setPasswordDone(const QByteArray &newPasswordBytes) { : _oldPasscode->isHidden() ? tr::lng_cloud_password_was_set(tr::now) : tr::lng_cloud_password_updated(tr::now); - getDelegate()->show(Box(text)); + getDelegate()->show(Box(text)); if (weak) { closeBox(); } @@ -562,7 +562,7 @@ void PasscodeBox::validateEmail( const auto weak = Ui::MakeWeak(this); _clearUnconfirmedPassword.fire({}); if (weak) { - auto box = Box( + auto box = Box( Lang::Hard::EmailConfirmationExpired()); weak->getDelegate()->show( std::move(box), @@ -689,7 +689,7 @@ void PasscodeBox::save(bool force) { if (!onlyCheck && !_recoverEmail->isHidden() && email.isEmpty() && !force) { _skipEmailWarning = true; _replacedBy = getDelegate()->show( - Box( + Box( tr::lng_cloud_password_about_recover(tr::now), tr::lng_cloud_password_skip_email(tr::now), st::attentionBoxButton, @@ -726,7 +726,7 @@ void PasscodeBox::submitOnlyCheckCloudPassword(const QString &oldPassword) { send(); close(); }; - getDelegate()->show(Box( + getDelegate()->show(Box( tr::lng_cloud_password_passport_losing(tr::now), tr::lng_continue(tr::now), confirmed)); @@ -797,7 +797,7 @@ void PasscodeBox::requestPasswordData() { } void PasscodeBox::serverError() { - getDelegate()->show(Box(Lang::Hard::ServerError())); + getDelegate()->show(Box(Lang::Hard::ServerError())); closeBox(); } @@ -952,7 +952,7 @@ void PasscodeBox::suggestSecretReset(const QString &newPassword) { resetSecret(check, newPassword, std::move(close)); }); }; - getDelegate()->show(Box( + getDelegate()->show(Box( Lang::Hard::PassportCorruptedChange(), Lang::Hard::PassportCorruptedReset(), std::move(resetSecretAndSave))); @@ -1085,7 +1085,7 @@ void PasscodeBox::recoverByEmail() { } }); }); - *confirmBox = getDelegate()->show(Box( + *confirmBox = getDelegate()->show(Box( tr::lng_cloud_password_reset_no_email(tr::now), tr::lng_cloud_password_reset_ok(tr::now), reset)); @@ -1170,7 +1170,7 @@ RecoverBox::RecoverBox( } }); }); - *confirmBox = getDelegate()->show(Box( + *confirmBox = getDelegate()->show(Box( tr::lng_cloud_password_reset_with_email(tr::now), tr::lng_cloud_password_reset_ok(tr::now), reset)); @@ -1272,7 +1272,7 @@ void RecoverBox::submit() { send(); close(); }; - getDelegate()->show(Box( + getDelegate()->show(Box( tr::lng_cloud_password_passport_losing(tr::now), tr::lng_continue(tr::now), confirmed)); @@ -1297,7 +1297,7 @@ void RecoverBox::proceedToClear() { _submitRequest = 0; _newPasswordSet.fire({}); getDelegate()->show( - Box(tr::lng_cloud_password_removed(tr::now)), + Box(tr::lng_cloud_password_removed(tr::now)), Ui::LayerOption::CloseOther); } @@ -1345,7 +1345,7 @@ void RecoverBox::checkSubmitFail(const MTP::Error &error) { if (err == qstr("PASSWORD_EMPTY")) { _newPasswordSet.fire(QByteArray()); getDelegate()->show( - Box(tr::lng_cloud_password_removed(tr::now)), + Box(tr::lng_cloud_password_removed(tr::now)), Ui::LayerOption::CloseOther); } else if (err == qstr("PASSWORD_RECOVERY_NA")) { closeBox(); @@ -1386,7 +1386,8 @@ RecoveryEmailValidation ConfirmRecoveryEmail( reloads->fire({}); if (*weak) { (*weak)->getDelegate()->show( - Box(tr::lng_cloud_password_was_set(tr::now)), + Box( + tr::lng_cloud_password_was_set(tr::now)), Ui::LayerOption::CloseOther); } }).fail([=](const MTP::Error &error) { @@ -1398,7 +1399,7 @@ RecoveryEmailValidation ConfirmRecoveryEmail( } else if (error.type() == qstr("EMAIL_HASH_EXPIRED")) { cancels->fire({}); if (*weak) { - auto box = Box( + auto box = Box( Lang::Hard::EmailConfirmationExpired()); (*weak)->getDelegate()->show( std::move(box), diff --git a/Telegram/SourceFiles/boxes/peer_list_controllers.cpp b/Telegram/SourceFiles/boxes/peer_list_controllers.cpp index c9982e219..6b79613e5 100644 --- a/Telegram/SourceFiles/boxes/peer_list_controllers.cpp +++ b/Telegram/SourceFiles/boxes/peer_list_controllers.cpp @@ -482,7 +482,7 @@ void AddBotToGroupBoxController::shareBotGame(not_null chat) { return tr::lng_bot_sure_share_game_group(tr::now, lt_group, chat->name); }(); Ui::show( - Box(confirmText, std::move(send)), + Box(confirmText, std::move(send)), Ui::LayerOption::KeepOther); } @@ -490,7 +490,7 @@ void AddBotToGroupBoxController::addBotToGroup(not_null chat) { if (const auto megagroup = chat->asMegagroup()) { if (!megagroup->canAddMembers()) { Ui::show( - Box(tr::lng_error_cant_add_member(tr::now)), + Box(tr::lng_error_cant_add_member(tr::now)), Ui::LayerOption::KeepOther); return; } @@ -500,7 +500,7 @@ void AddBotToGroupBoxController::addBotToGroup(not_null chat) { }); auto confirmText = tr::lng_bot_sure_invite(tr::now, lt_group, chat->name); Ui::show( - Box(confirmText, send), + Box(confirmText, send), Ui::LayerOption::KeepOther); } diff --git a/Telegram/SourceFiles/boxes/peers/add_participants_box.cpp b/Telegram/SourceFiles/boxes/peers/add_participants_box.cpp index 30adbb1d8..9c7aeb168 100644 --- a/Telegram/SourceFiles/boxes/peers/add_participants_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/add_participants_box.cpp @@ -106,7 +106,8 @@ void AddParticipantsBoxController::rowClicked(not_null row) { } else if (count >= serverConfig.chatSizeMax && count < serverConfig.megagroupSizeMax) { Ui::show( - Box(tr::lng_profile_add_more_after_create(tr::now)), + Box( + tr::lng_profile_add_more_after_create(tr::now)), Ui::LayerOption::KeepOther); } } @@ -566,20 +567,20 @@ void AddSpecialBoxController::showAdmin( if (canBanMembers) { if (!sure) { _editBox = Ui::show( - Box( + Box( tr::lng_sure_add_admin_unremove(tr::now), showAdminSure), Ui::LayerOption::KeepOther); return; } } else { - Ui::show(Box( + Ui::show(Box( tr::lng_error_cant_add_admin_unban(tr::now)), Ui::LayerOption::KeepOther); return; } } else { - Ui::show(Box( + Ui::show(Box( tr::lng_error_cant_add_admin_invite(tr::now)), Ui::LayerOption::KeepOther); return; @@ -589,14 +590,14 @@ void AddSpecialBoxController::showAdmin( if (canBanMembers) { if (!sure) { _editBox = Ui::show( - Box( + Box( tr::lng_sure_add_admin_unremove(tr::now), showAdminSure), Ui::LayerOption::KeepOther); return; } } else { - Ui::show(Box( + Ui::show(Box( tr::lng_error_cant_add_admin_unban(tr::now)), Ui::LayerOption::KeepOther); return; @@ -609,7 +610,7 @@ void AddSpecialBoxController::showAdmin( ? tr::lng_sure_add_admin_invite : tr::lng_sure_add_admin_invite_channel)(tr::now); _editBox = Ui::show( - Box( + Box( text, showAdminSure), Ui::LayerOption::KeepOther); @@ -617,7 +618,8 @@ void AddSpecialBoxController::showAdmin( } } else { Ui::show( - Box(tr::lng_error_cant_add_admin_invite(tr::now)), + Box( + tr::lng_error_cant_add_admin_invite(tr::now)), Ui::LayerOption::KeepOther); return; } @@ -717,7 +719,7 @@ void AddSpecialBoxController::showRestricted( if (!_additional.isCreator(user) && _additional.canEditAdmin(user)) { if (!sure) { _editBox = Ui::show( - Box( + Box( tr::lng_sure_ban_admin(tr::now), showRestrictedSure), Ui::LayerOption::KeepOther); @@ -725,7 +727,7 @@ void AddSpecialBoxController::showRestricted( } } else { Ui::show( - Box(tr::lng_error_cant_ban_admin(tr::now)), + Box(tr::lng_error_cant_ban_admin(tr::now)), Ui::LayerOption::KeepOther); return; } @@ -814,7 +816,7 @@ void AddSpecialBoxController::kickUser( if (!_additional.isCreator(user) && _additional.canEditAdmin(user)) { if (!sure) { _editBox = Ui::show( - Box( + Box( tr::lng_sure_ban_admin(tr::now), kickUserSure), Ui::LayerOption::KeepOther); @@ -822,7 +824,7 @@ void AddSpecialBoxController::kickUser( } } else { Ui::show( - Box(tr::lng_error_cant_ban_admin(tr::now)), + Box(tr::lng_error_cant_ban_admin(tr::now)), Ui::LayerOption::KeepOther); return; } @@ -837,7 +839,7 @@ void AddSpecialBoxController::kickUser( lt_user, participant->name); _editBox = Ui::show( - Box(text, kickUserSure), + Box(text, kickUserSure), Ui::LayerOption::KeepOther); return; } diff --git a/Telegram/SourceFiles/boxes/peers/edit_linked_chat_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_linked_chat_box.cpp index e0022ce32..cf75393ae 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_linked_chat_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_linked_chat_box.cpp @@ -152,7 +152,7 @@ void Controller::choose(not_null chat) { onstack(chat); }; Ui::show( - Box( + Box( text, tr::lng_manage_discussion_group_link(tr::now), sure), @@ -184,7 +184,7 @@ void Controller::choose(not_null chat) { chat->session().api().migrateChat(chat, crl::guard(this, done)); }; Ui::show( - Box( + Box( text, tr::lng_manage_discussion_group_link(tr::now), sure), diff --git a/Telegram/SourceFiles/boxes/peers/edit_participant_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_participant_box.cpp index 38ebc753a..94440a24c 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_participant_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_participant_box.cpp @@ -453,14 +453,14 @@ void EditAdminBox::transferOwnership() { )).fail([=](const MTP::Error &error) { _checkTransferRequestId = 0; if (!handleTransferPasswordError(error)) { - const auto box = std::make_shared>(); + const auto box = std::make_shared>(); const auto callback = crl::guard(this, [=] { transferOwnershipChecked(); if (*box) { (*box)->closeBox(); } }); - *box = getDelegate()->show(Box( + *box = getDelegate()->show(Box( tr::lng_rights_transfer_about( tr::now, lt_group, @@ -577,7 +577,7 @@ void EditAdminBox::sendTransferRequestFrom( || (type == qstr("SESSION_TOO_FRESH_XXX")); }(); const auto weak = Ui::MakeWeak(this); - getDelegate()->show(Box(problem)); + getDelegate()->show(Box(problem)); if (box) { box->closeBox(); } diff --git a/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp index a861d5ba7..225cdecd0 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp @@ -1691,7 +1691,7 @@ void ParticipantsBoxController::kickParticipant(not_null participant) lt_user, user ? user->firstName : participant->name); _editBox = Ui::show( - Box( + Box( text, tr::lng_box_remove(tr::now), crl::guard(this, [=] { kickParticipantSure(participant); })), @@ -1730,7 +1730,7 @@ void ParticipantsBoxController::kickParticipantSure( void ParticipantsBoxController::removeAdmin(not_null user) { _editBox = Ui::show( - Box( + Box( tr::lng_profile_sure_remove_admin( tr::now, lt_user, diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp index 68a94aec1..456d137f0 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp @@ -1485,7 +1485,7 @@ void Controller::deleteWithConfirmation() { deleteChannel(); }); _navigation->parentController()->show( - Box( + Box( text, tr::lng_box_delete(tr::now), st::attentionBoxButton, @@ -1512,7 +1512,7 @@ void Controller::deleteChannel() { session->api().applyUpdates(result); //}).fail([=](const MTP::Error &error) { // if (error.type() == qstr("CHANNEL_TOO_LARGE")) { - // Ui::show(Box(tr::lng_cant_delete_channel(tr::now))); + // Ui::show(Box(tr::lng_cant_delete_channel(tr::now))); // } }).send(); } diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_invite_link.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_invite_link.cpp index 3f8709943..f30026303 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_invite_link.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_invite_link.cpp @@ -680,7 +680,7 @@ void AddPermanentLinkBlock( } }); const auto revokeLink = crl::guard(weak, [=] { - const auto box = std::make_shared>(); + const auto box = std::make_shared>(); const auto done = crl::guard(weak, [=] { const auto close = [=] { if (*box) { @@ -694,7 +694,9 @@ void AddPermanentLinkBlock( close); }); *box = Ui::show( - Box(tr::lng_group_invite_about_new(tr::now), done), + Box( + tr::lng_group_invite_about_new(tr::now), + done), Ui::LayerOption::KeepOther); }); @@ -868,7 +870,7 @@ void ShareInviteLinkBox(not_null peer, const QString &link) { } text.append(error.first); Ui::show( - Box(text), + Box(text), Ui::LayerOption::KeepOther); return; } @@ -968,7 +970,7 @@ void RevokeLink( not_null peer, not_null admin, const QString &link) { - const auto box = std::make_shared>(); + const auto box = std::make_shared>(); const auto revoke = [=] { const auto done = [=](const LinkData &data) { if (*box) { @@ -978,7 +980,7 @@ void RevokeLink( peer->session().api().inviteLinks().revoke(peer, admin, link, done); }; *box = Ui::show( - Box( + Box( tr::lng_group_invite_revoke_about(tr::now), revoke), Ui::LayerOption::KeepOther); @@ -988,7 +990,7 @@ void DeleteLink( not_null peer, not_null admin, const QString &link) { - const auto box = std::make_shared>(); + const auto box = std::make_shared>(); const auto sure = [=] { const auto finish = [=] { if (*box) { @@ -1002,7 +1004,7 @@ void DeleteLink( finish); }; *box = Ui::show( - Box(tr::lng_group_invite_delete_sure(tr::now), sure), + Box(tr::lng_group_invite_delete_sure(tr::now), sure), Ui::LayerOption::KeepOther); } diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_invite_links.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_invite_links.cpp index 4bc651e5c..fd229a8f7 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_invite_links.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_invite_links.cpp @@ -197,7 +197,7 @@ private: void DeleteAllRevoked( not_null peer, not_null admin) { - const auto box = std::make_shared>(); + const auto box = std::make_shared>(); const auto sure = [=] { const auto finish = [=] { if (*box) { @@ -210,7 +210,9 @@ void DeleteAllRevoked( finish); }; *box = Ui::show( - Box(tr::lng_group_invite_delete_all_sure(tr::now), sure), + Box( + tr::lng_group_invite_delete_all_sure(tr::now), + sure), Ui::LayerOption::KeepOther); } diff --git a/Telegram/SourceFiles/boxes/phone_banned_box.cpp b/Telegram/SourceFiles/boxes/phone_banned_box.cpp index 6811b8f3c..cf57a1e16 100644 --- a/Telegram/SourceFiles/boxes/phone_banned_box.cpp +++ b/Telegram/SourceFiles/boxes/phone_banned_box.cpp @@ -56,7 +56,7 @@ void ShowPhoneBannedError( } }; *box = controller->show( - Box( + Box( tr::lng_signin_banned_text(tr::now), tr::lng_box_ok(tr::now), tr::lng_signin_banned_help(tr::now), diff --git a/Telegram/SourceFiles/boxes/sessions_box.cpp b/Telegram/SourceFiles/boxes/sessions_box.cpp index 4abbe9b70..59d955b3d 100644 --- a/Telegram/SourceFiles/boxes/sessions_box.cpp +++ b/Telegram/SourceFiles/boxes/sessions_box.cpp @@ -81,7 +81,7 @@ private: Full _data; object_ptr _inner; - QPointer _terminateBox; + QPointer _terminateBox; base::Timer _shortPollTimer; @@ -250,7 +250,7 @@ void SessionsContent::terminate(Fn terminateRequest, QString message) { terminateRequest(); }); _terminateBox = Ui::show( - Box( + Box( message, tr::lng_settings_reset_button(tr::now), st::attentionBoxButton, diff --git a/Telegram/SourceFiles/boxes/share_box.cpp b/Telegram/SourceFiles/boxes/share_box.cpp index c5a625637..5246ceaa3 100644 --- a/Telegram/SourceFiles/boxes/share_box.cpp +++ b/Telegram/SourceFiles/boxes/share_box.cpp @@ -1155,7 +1155,8 @@ void ShareGameScoreByHash( auto hashEncrypted = QByteArray::fromBase64(hash.toLatin1(), QByteArray::Base64UrlEncoding | QByteArray::OmitTrailingEquals); if (hashEncrypted.size() <= key128Size || (hashEncrypted.size() != key128Size + 0x20)) { - Ui::show(Box(tr::lng_confirm_phone_link_invalid(tr::now))); + Ui::show(Box( + tr::lng_confirm_phone_link_invalid(tr::now))); return; } @@ -1175,19 +1176,19 @@ void ShareGameScoreByHash( //// Check next 64 bits of SHA1() of data. //auto skipSha1Part = sizeof(channelAccessHash); //if (memcmp(dataSha1 + skipSha1Part, hashEncrypted.constData() + skipSha1Part, key128Size - skipSha1Part) != 0) { - // Ui::show(Box(tr::lng_share_wrong_user(tr::now))); + // Ui::show(Box(tr::lng_share_wrong_user(tr::now))); // return; //} // Check 128 bits of SHA1() of data. if (memcmp(dataSha1, hashEncrypted.constData(), key128Size) != 0) { - Ui::show(Box(tr::lng_share_wrong_user(tr::now))); + Ui::show(Box(tr::lng_share_wrong_user(tr::now))); return; } auto hashDataInts = reinterpret_cast(hashData.data()); if (hashDataInts[0] != session->userId().bare) { - Ui::show(Box(tr::lng_share_wrong_user(tr::now))); + Ui::show(Box(tr::lng_share_wrong_user(tr::now))); return; } @@ -1195,14 +1196,14 @@ void ShareGameScoreByHash( auto channelAccessHash = hashDataInts[3]; //auto channelAccessHashInts = reinterpret_cast(&channelAccessHash); //if (channelAccessHashInts[0] != hashDataInts[3]) { - // Ui::show(Box(tr::lng_share_wrong_user(tr::now))); + // Ui::show(Box(tr::lng_share_wrong_user(tr::now))); // return; //} if (((hashDataInts[1] >> 40) != 0) || (!hashDataInts[1] && channelAccessHash)) { // If there is no channel id, there should be no channel access_hash. - Ui::show(Box(tr::lng_share_wrong_user(tr::now))); + Ui::show(Box(tr::lng_share_wrong_user(tr::now))); return; } @@ -1218,7 +1219,8 @@ void ShareGameScoreByHash( if (const auto item = session->data().message(channel, msgId)) { FastShareMessage(item); } else { - Ui::show(Box(tr::lng_edit_deleted(tr::now))); + Ui::show(Box( + tr::lng_edit_deleted(tr::now))); } }); }; diff --git a/Telegram/SourceFiles/boxes/sticker_set_box.cpp b/Telegram/SourceFiles/boxes/sticker_set_box.cpp index 483c77849..5bca06954 100644 --- a/Telegram/SourceFiles/boxes/sticker_set_box.cpp +++ b/Telegram/SourceFiles/boxes/sticker_set_box.cpp @@ -257,7 +257,7 @@ void StickerSetBox::handleError(Error error) { switch (error) { case Error::NotFound: _controller->show( - Box(tr::lng_stickers_not_found(tr::now))); + Box(tr::lng_stickers_not_found(tr::now))); break; default: Unexpected("Error in StickerSetBox::handleError."); } diff --git a/Telegram/SourceFiles/boxes/sticker_set_box.h b/Telegram/SourceFiles/boxes/sticker_set_box.h index cdf06f4db..2dbd37730 100644 --- a/Telegram/SourceFiles/boxes/sticker_set_box.h +++ b/Telegram/SourceFiles/boxes/sticker_set_box.h @@ -11,13 +11,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "base/timer.h" #include "data/stickers/data_stickers.h" -class ConfirmBox; - namespace Window { class SessionController; } // namespace Window namespace Ui { +class ConfirmBox; class PlainShadow; } // namespace Ui diff --git a/Telegram/SourceFiles/boxes/stickers_box.h b/Telegram/SourceFiles/boxes/stickers_box.h index 472b6b12d..29c06b8f1 100644 --- a/Telegram/SourceFiles/boxes/stickers_box.h +++ b/Telegram/SourceFiles/boxes/stickers_box.h @@ -14,13 +14,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/effects/animations.h" #include "ui/special_fields.h" -class ConfirmBox; - namespace style { struct RippleAnimation; } // namespace style namespace Ui { +class ConfirmBox; class PlainShadow; class RippleAnimation; class SettingsSlider; diff --git a/Telegram/SourceFiles/calls/calls_call.cpp b/Telegram/SourceFiles/calls/calls_call.cpp index 25b7180aa..6cd29fe68 100644 --- a/Telegram/SourceFiles/calls/calls_call.cpp +++ b/Telegram/SourceFiles/calls/calls_call.cpp @@ -1152,23 +1152,28 @@ void Call::setFailedQueued(const QString &error) { void Call::handleRequestError(const MTP::Error &error) { if (error.type() == qstr("USER_PRIVACY_RESTRICTED")) { - Ui::show(Box(tr::lng_call_error_not_available(tr::now, lt_user, _user->name))); + Ui::show(Box( + tr::lng_call_error_not_available(tr::now, lt_user, _user->name))); } else if (error.type() == qstr("PARTICIPANT_VERSION_OUTDATED")) { - Ui::show(Box(tr::lng_call_error_outdated(tr::now, lt_user, _user->name))); + Ui::show(Box( + tr::lng_call_error_outdated(tr::now, lt_user, _user->name))); } else if (error.type() == qstr("CALL_PROTOCOL_LAYER_INVALID")) { - Ui::show(Box(Lang::Hard::CallErrorIncompatible().replace("{user}", _user->name))); + Ui::show(Box( + Lang::Hard::CallErrorIncompatible().replace( + "{user}", + _user->name))); } finish(FinishType::Failed); } void Call::handleControllerError(const QString &error) { if (error == u"ERROR_INCOMPATIBLE"_q) { - Ui::show(Box( + Ui::show(Box( Lang::Hard::CallErrorIncompatible().replace( "{user}", _user->name))); } else if (error == u"ERROR_AUDIO_IO"_q) { - Ui::show(Box(tr::lng_call_error_audio_io(tr::now))); + Ui::show(Box(tr::lng_call_error_audio_io(tr::now))); } finish(FinishType::Failed); } diff --git a/Telegram/SourceFiles/calls/calls_instance.cpp b/Telegram/SourceFiles/calls/calls_instance.cpp index 315cd800d..f171e2c57 100644 --- a/Telegram/SourceFiles/calls/calls_instance.cpp +++ b/Telegram/SourceFiles/calls/calls_instance.cpp @@ -192,7 +192,7 @@ void Instance::startOutgoingCall(not_null user, bool video) { if (user->callsStatus() == UserData::CallsStatus::Private) { // Request full user once more to refresh the setting in case it was changed. user->session().api().requestFullPeer(user); - Ui::show(Box( + Ui::show(Box( tr::lng_call_error_not_available(tr::now, lt_user, user->name))); return; } @@ -695,10 +695,13 @@ void Instance::requestPermissionOrFail(Platform::PermissionType type, Fn if (inGroupCall()) { _currentGroupCall->hangup(); } - Ui::show(Box(tr::lng_no_mic_permission(tr::now), tr::lng_menu_settings(tr::now), crl::guard(this, [=] { - Platform::OpenSystemSettingsForPermission(type); - Ui::hideLayer(); - }))); + Ui::show(Box( + tr::lng_no_mic_permission(tr::now), + tr::lng_menu_settings(tr::now), + crl::guard(this, [=] { + Platform::OpenSystemSettingsForPermission(type); + Ui::hideLayer(); + }))); } } diff --git a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp index 7bc7acdf4..9db3b019a 100644 --- a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp +++ b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp @@ -3156,19 +3156,21 @@ void StickersListWidget::removeMegagroupSet(bool locally) { return; } _removingSetId = Data::Stickers::MegagroupSetId; - controller()->show(Box(tr::lng_stickers_remove_group_set(tr::now), crl::guard(this, [this, group = _megagroupSet] { - Expects(group->mgInfo != nullptr); + controller()->show(Box( + tr::lng_stickers_remove_group_set(tr::now), + crl::guard(this, [this, group = _megagroupSet] { + Expects(group->mgInfo != nullptr); - if (group->mgInfo->stickerSet) { - session().api().setGroupStickerSet(group, {}); - } - Ui::hideLayer(); - _removingSetId = 0; - _checkForHide.fire({}); - }), crl::guard(this, [this] { - _removingSetId = 0; - _checkForHide.fire({}); - }))); + if (group->mgInfo->stickerSet) { + session().api().setGroupStickerSet(group, {}); + } + Ui::hideLayer(); + _removingSetId = 0; + _checkForHide.fire({}); + }), crl::guard(this, [this] { + _removingSetId = 0; + _checkForHide.fire({}); + }))); } void StickersListWidget::removeSet(uint64 setId) { @@ -3184,7 +3186,7 @@ void StickersListWidget::removeSet(uint64 setId) { lt_sticker_pack, set->title); const auto confirm = tr::lng_stickers_remove_pack_confirm(tr::now); - controller()->show(Box(text, confirm, crl::guard(this, [=]( + controller()->show(Box(text, confirm, crl::guard(this, [=]( Fn &&close) { close(); const auto &sets = session().data().stickers().sets(); diff --git a/Telegram/SourceFiles/core/application.cpp b/Telegram/SourceFiles/core/application.cpp index c5f44952e..e1910e5df 100644 --- a/Telegram/SourceFiles/core/application.cpp +++ b/Telegram/SourceFiles/core/application.cpp @@ -345,7 +345,7 @@ void Application::showOpenGLCrashNotification() { Core::App().settings().setDisableOpenGL(true); Local::writeSettings(); }; - _window->show(Box( + _window->show(Box( "There may be a problem with your graphics drivers and OpenGL. " "Try updating your drivers.\n\n" "OpenGL has been disabled. You can try to enable it again " @@ -537,7 +537,7 @@ void Application::badMtprotoConfigurationError() { _settings.proxy().selected(), MTP::ProxyData::Settings::System); }; - _badProxyDisableBox = Ui::show(Box( + _badProxyDisableBox = Ui::show(Box( Lang::Hard::ProxyConfigError(), disableCallback)); } @@ -636,7 +636,7 @@ void Application::logout(Main::Account *account) { void Application::forceLogOut( not_null account, const TextWithEntities &explanation) { - const auto box = Ui::show(Box( + const auto box = Ui::show(Box( explanation, tr::lng_passcode_logout(tr::now))); box->setCloseByEscape(false); diff --git a/Telegram/SourceFiles/core/click_handler_types.cpp b/Telegram/SourceFiles/core/click_handler_types.cpp index 65f19a8e5..74a9009e9 100644 --- a/Telegram/SourceFiles/core/click_handler_types.cpp +++ b/Telegram/SourceFiles/core/click_handler_types.cpp @@ -91,7 +91,7 @@ void HiddenUrlClickHandler::Open(QString url, QVariant context) { ? QString::fromUtf8(parsedUrl.toEncoded()) : ShowEncoded(displayed); Ui::show( - Box( + Box( (tr::lng_open_this_link(tr::now) + qsl("\n\n") + displayUrl), @@ -125,7 +125,7 @@ void BotGameUrlClickHandler::onClick(ClickContext context) const { bot->session().local().markBotTrustedOpenGame(bot->id); open(); }; - Ui::show(Box( + Ui::show(Box( tr::lng_allow_bot_pass(tr::now, lt_bot_name, _bot->name), tr::lng_allow_bot(tr::now), callback)); diff --git a/Telegram/SourceFiles/core/local_url_handlers.cpp b/Telegram/SourceFiles/core/local_url_handlers.cpp index 370fa6a76..18d900874 100644 --- a/Telegram/SourceFiles/core/local_url_handlers.cpp +++ b/Telegram/SourceFiles/core/local_url_handlers.cpp @@ -412,12 +412,12 @@ bool HandleUnknown( Core::UpdateApplication(); close(); }; - controller->show(Box( + controller->show(Box( text, tr::lng_menu_update(tr::now), callback)); } else { - controller->show(Box(text)); + controller->show(Box(text)); } }); controller->session().api().requestDeepLinkInfo(request, callback); diff --git a/Telegram/SourceFiles/data/data_cloud_themes.cpp b/Telegram/SourceFiles/data/data_cloud_themes.cpp index af25bb47c..04f2a5078 100644 --- a/Telegram/SourceFiles/data/data_cloud_themes.cpp +++ b/Telegram/SourceFiles/data/data_cloud_themes.cpp @@ -224,7 +224,7 @@ void CloudThemes::resolve( showPreview(controller, result); }).fail([=](const MTP::Error &error) { if (error.type() == qstr("THEME_FORMAT_INVALID")) { - controller->show(Box( + controller->show(Box( tr::lng_theme_no_desktop(tr::now))); } }).send(); @@ -249,7 +249,7 @@ void CloudThemes::showPreview( controller, cloud)); } else { - controller->show(Box( + controller->show(Box( tr::lng_theme_no_desktop(tr::now))); } } diff --git a/Telegram/SourceFiles/data/data_document.cpp b/Telegram/SourceFiles/data/data_document.cpp index 495e29fbd..1d687d9d1 100644 --- a/Telegram/SourceFiles/data/data_document.cpp +++ b/Telegram/SourceFiles/data/data_document.cpp @@ -905,7 +905,7 @@ void DocumentData::handleLoaderUpdates() { Ui::hideLayer(); save(origin, failedFileName); }; - Ui::show(Box( + Ui::show(Box( tr::lng_download_finish_failed(tr::now), crl::guard(&session(), retry))); } else { @@ -917,7 +917,7 @@ void DocumentData::handleLoaderUpdates() { // Core::App().settings().setDownloadPath(QString()); // Ui::show(Box()); //}; - //Ui::show(Box( + //Ui::show(Box( // tr::lng_download_path_failed(tr::now), // tr::lng_download_path_settings(tr::now), // crl::guard(&session(), openSettings))); diff --git a/Telegram/SourceFiles/data/data_document_resolver.cpp b/Telegram/SourceFiles/data/data_document_resolver.cpp index d1266f40f..2033bf632 100644 --- a/Telegram/SourceFiles/data/data_document_resolver.cpp +++ b/Telegram/SourceFiles/data/data_document_resolver.cpp @@ -80,7 +80,7 @@ void LaunchWithWarning( rpl::single(Ui::Text::Bold(extension)), Ui::Text::WithEntities) : tr::lng_launch_svg_warning(Ui::Text::WithEntities); - Ui::show(Box( + Ui::show(Box( std::move(text), tr::lng_launch_exe_dont_ask(tr::now), (isExecutable ? tr::lng_launch_exe_sure : tr::lng_continue)(), diff --git a/Telegram/SourceFiles/data/data_histories.cpp b/Telegram/SourceFiles/data/data_histories.cpp index eb16e3b99..5ba745601 100644 --- a/Telegram/SourceFiles/data/data_histories.cpp +++ b/Telegram/SourceFiles/data/data_histories.cpp @@ -646,7 +646,7 @@ void Histories::deleteAllMessages( session().api().applyUpdates(result); //}).fail([=](const MTP::Error &error) { // if (error.type() == qstr("CHANNEL_TOO_LARGE")) { - // Ui::show(Box(tr::lng_cant_delete_channel(tr::now))); + // Ui::show(Box(tr::lng_cant_delete_channel(tr::now))); // } }).send(); } else if (channel) { diff --git a/Telegram/SourceFiles/data/stickers/data_stickers.cpp b/Telegram/SourceFiles/data/stickers/data_stickers.cpp index 56024b529..d85c2d142 100644 --- a/Telegram/SourceFiles/data/stickers/data_stickers.cpp +++ b/Telegram/SourceFiles/data/stickers/data_stickers.cpp @@ -402,7 +402,7 @@ void Stickers::undoInstallLocally(uint64 setId) { notifyUpdated(); Ui::show( - Box(tr::lng_stickers_not_found(tr::now)), + Box(tr::lng_stickers_not_found(tr::now)), Ui::LayerOption::KeepOther); } diff --git a/Telegram/SourceFiles/editor/editor_paint.cpp b/Telegram/SourceFiles/editor/editor_paint.cpp index a675fce00..45780ce13 100644 --- a/Telegram/SourceFiles/editor/editor_paint.cpp +++ b/Telegram/SourceFiles/editor/editor_paint.cpp @@ -195,7 +195,7 @@ void Paint::handleMimeData(const QMimeData *data) { } if (!Ui::ValidateThumbDimensions(image.width(), image.height())) { _controllers->showBox( - Box(tr::lng_edit_media_invalid_file(tr::now))); + Box(tr::lng_edit_media_invalid_file(tr::now))); return; } diff --git a/Telegram/SourceFiles/editor/photo_editor_layer_widget.cpp b/Telegram/SourceFiles/editor/photo_editor_layer_widget.cpp index 20beee810..76c5dd1c8 100644 --- a/Telegram/SourceFiles/editor/photo_editor_layer_widget.cpp +++ b/Telegram/SourceFiles/editor/photo_editor_layer_widget.cpp @@ -87,7 +87,7 @@ void PrepareProfilePhoto( if (image.isNull() || (image.width() > (10 * image.height())) || (image.height() > (10 * image.width()))) { - controller->show(Box(tr::lng_bad_photo(tr::now))); + controller->show(Box(tr::lng_bad_photo(tr::now))); return; } image = resizeToMinSize( diff --git a/Telegram/SourceFiles/export/view/export_view_panel_controller.cpp b/Telegram/SourceFiles/export/view/export_view_panel_controller.cpp index bb5223c85..cc7159ccb 100644 --- a/Telegram/SourceFiles/export/view/export_view_panel_controller.cpp +++ b/Telegram/SourceFiles/export/view/export_view_panel_controller.cpp @@ -271,7 +271,7 @@ void PanelController::showCriticalError(const QString &text) { } void PanelController::showError(const QString &text) { - auto box = Box(text); + auto box = Box(text); const auto weak = Ui::MakeWeak(box.data()); const auto hidden = _panel->isHidden(); _panel->showBox( @@ -347,7 +347,7 @@ void PanelController::stopWithConfirmation(FnMut callback) { }; const auto hidden = _panel->isHidden(); const auto old = _confirmStopBox; - auto box = Box( + auto box = Box( tr::lng_export_sure_stop(tr::now), tr::lng_export_stop(tr::now), st::attentionBoxButton, diff --git a/Telegram/SourceFiles/facades.cpp b/Telegram/SourceFiles/facades.cpp index a5319f86e..fc5a0f2dd 100644 --- a/Telegram/SourceFiles/facades.cpp +++ b/Telegram/SourceFiles/facades.cpp @@ -140,7 +140,7 @@ void activateBotCommand( case ButtonType::RequestLocation: { hideSingleUseKeyboard(msg); - Ui::show(Box( + Ui::show(Box( tr::lng_bot_share_location_unavailable(tr::now))); } break; @@ -148,15 +148,18 @@ void activateBotCommand( hideSingleUseKeyboard(msg); const auto msgId = msg->id; const auto history = msg->history(); - Ui::show(Box(tr::lng_bot_share_phone(tr::now), tr::lng_bot_share_phone_confirm(tr::now), [=] { - Ui::showPeerHistory(history, ShowAtTheEndMsgId); - auto action = Api::SendAction(history); - action.clearDraft = false; - action.replyTo = msgId; - history->session().api().shareContact( - history->session().user(), - action); - })); + Ui::show(Box( + tr::lng_bot_share_phone(tr::now), + tr::lng_bot_share_phone_confirm(tr::now), + [=] { + Ui::showPeerHistory(history, ShowAtTheEndMsgId); + auto action = Api::SendAction(history); + action.clearDraft = false; + action.replyTo = msgId; + history->session().api().shareContact( + history->session().user(), + action); + })); } break; case ButtonType::RequestPoll: { diff --git a/Telegram/SourceFiles/history/admin_log/history_admin_log_section.cpp b/Telegram/SourceFiles/history/admin_log/history_admin_log_section.cpp index 5668b0fcb..961da5fd6 100644 --- a/Telegram/SourceFiles/history/admin_log/history_admin_log_section.cpp +++ b/Telegram/SourceFiles/history/admin_log/history_admin_log_section.cpp @@ -328,7 +328,7 @@ Widget::Widget( }, lifetime()); _whatIsThis->setClickedCallback([=] { - controller->show(Box(channel->isMegagroup() + controller->show(Box(channel->isMegagroup() ? tr::lng_admin_log_about_text(tr::now) : tr::lng_admin_log_about_text_channel(tr::now))); }); diff --git a/Telegram/SourceFiles/history/history_message.cpp b/Telegram/SourceFiles/history/history_message.cpp index a465e294c..73745ba24 100644 --- a/Telegram/SourceFiles/history/history_message.cpp +++ b/Telegram/SourceFiles/history/history_message.cpp @@ -264,7 +264,7 @@ void FastShareMessage(not_null item) { } text.append(error.first); Ui::show( - Box(text), + Box(text), Ui::LayerOption::KeepOther); return; } diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index 5d19fcd41..71938515d 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -671,7 +671,7 @@ HistoryWidget::HistoryWidget( const auto unavailable = _peer->computeUnavailableReason(); if (!unavailable.isEmpty()) { controller->showBackFromStack(); - controller->show(Box(unavailable)); + controller->show(Box(unavailable)); return; } } @@ -858,7 +858,7 @@ void HistoryWidget::initVoiceRecordBar() { ? Data::RestrictionError(_peer, ChatRestriction::SendMedia) : std::nullopt; if (error) { - controller()->show(Box(*error)); + controller()->show(Box(*error)); return true; } else if (showSlowmodeError()) { return true; @@ -3308,7 +3308,8 @@ void HistoryWidget::saveEditMsg() { Box(item, suggestModerateActions)); return; } else if (!left.text.isEmpty()) { - controller()->show(Box(tr::lng_edit_too_long(tr::now))); + controller()->show(Box( + tr::lng_edit_too_long(tr::now))); return; } @@ -3343,7 +3344,7 @@ void HistoryWidget::saveEditMsg() { const auto &err = error.type(); if (ranges::contains(Api::kDefaultEditMessagesErrors, err)) { controller()->show( - Box(tr::lng_edit_error(tr::now))); + Box(tr::lng_edit_error(tr::now))); } else if (err == u"MESSAGE_NOT_MODIFIED"_q) { cancelEdit(); } else if (err == u"MESSAGE_EMPTY"_q) { @@ -3351,7 +3352,7 @@ void HistoryWidget::saveEditMsg() { _field->setFocus(); } else { controller()->show( - Box(tr::lng_edit_error(tr::now))); + Box(tr::lng_edit_error(tr::now))); } update(); })(); @@ -3729,7 +3730,7 @@ void HistoryWidget::unreadMentionsAnimationFinish() { void HistoryWidget::chooseAttach() { if (_editMsgId) { controller()->show( - Box(tr::lng_edit_caption_attach(tr::now))); + Box(tr::lng_edit_caption_attach(tr::now))); return; } @@ -4544,7 +4545,7 @@ bool HistoryWidget::confirmSendingFiles( } if (_editMsgId) { controller()->show( - Box(tr::lng_edit_caption_attach(tr::now))); + Box(tr::lng_edit_caption_attach(tr::now))); return false; } @@ -5714,7 +5715,7 @@ void HistoryWidget::sendInlineResult(InlineBots::ResultSelected result) { auto errorText = result.result->getErrorOnSend(_history); if (!errorText.isEmpty()) { - controller()->show(Box(errorText)); + controller()->show(Box(errorText)); return; } @@ -6048,7 +6049,7 @@ bool HistoryWidget::sendExistingDocument( : std::nullopt; if (error) { controller()->show( - Box(*error), + Box(*error), Ui::LayerOption::KeepOther); return false; } else if (!_peer || !_peer->canWrite()) { @@ -6084,7 +6085,7 @@ bool HistoryWidget::sendExistingPhoto( : std::nullopt; if (error) { controller()->show( - Box(*error), + Box(*error), Ui::LayerOption::KeepOther); return false; } else if (!_peer || !_peer->canWrite()) { @@ -6169,11 +6170,12 @@ void HistoryWidget::replyToMessage(not_null item) { } if (item->history() == _migrated) { if (item->serviceMsg()) { - controller()->show(Box(tr::lng_reply_cant(tr::now))); + controller()->show(Box( + tr::lng_reply_cant(tr::now))); } else { const auto itemId = item->fullId(); controller()->show( - Box( + Box( tr::lng_reply_cant_forward(tr::now), tr::lng_selected_forward(tr::now), crl::guard(this, [=] { @@ -6231,7 +6233,7 @@ void HistoryWidget::editMessage(not_null item) { toggleChooseChatTheme(_peer); } else if (_voiceRecordBar->isActive()) { controller()->show( - Box(tr::lng_edit_caption_voice(tr::now))); + Box(tr::lng_edit_caption_voice(tr::now))); return; } @@ -6691,7 +6693,7 @@ void HistoryWidget::escape() { } else if (_editMsgId) { if (_replyEditMsg && PrepareEditText(_replyEditMsg) != _field->getTextWithTags()) { - controller()->show(Box( + controller()->show(Box( tr::lng_cancel_edit_post_sure(tr::now), tr::lng_cancel_edit_post_yes(tr::now), tr::lng_cancel_edit_post_no(tr::now), diff --git a/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp b/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp index d11b4ccfe..c6c542636 100644 --- a/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp +++ b/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp @@ -798,7 +798,7 @@ rpl::producer<> ComposeControls::attachRequests() const { ) | rpl::filter([=] { if (isEditingMessage()) { _window->show( - Box(tr::lng_edit_caption_attach(tr::now))); + Box(tr::lng_edit_caption_attach(tr::now))); return false; } return true; @@ -1715,7 +1715,7 @@ void ComposeControls::initVoiceRecordBar() { ChatRestriction::SendMedia) : std::nullopt; if (error) { - _window->show(Box(*error)); + _window->show(Box(*error)); return true; } else if (_showSlowmodeError && _showSlowmodeError()) { return true; @@ -2014,7 +2014,8 @@ void ComposeControls::editMessage(not_null item) { Expects(draftKeyCurrent() != Data::DraftKey::None()); if (_voiceRecordBar->isActive()) { - _window->show(Box(tr::lng_edit_caption_voice(tr::now))); + _window->show(Box( + tr::lng_edit_caption_voice(tr::now))); return; } diff --git a/Telegram/SourceFiles/history/view/controls/history_view_voice_record_bar.cpp b/Telegram/SourceFiles/history/view/controls/history_view_voice_record_bar.cpp index 10d1f9580..d056712a7 100644 --- a/Telegram/SourceFiles/history/view/controls/history_view_voice_record_bar.cpp +++ b/Telegram/SourceFiles/history/view/controls/history_view_voice_record_bar.cpp @@ -1636,7 +1636,7 @@ void VoiceRecordBar::showDiscardBox( callback(); } }; - _controller->show(Box( + _controller->show(Box( (isListenState() ? tr::lng_record_listen_cancel_sure : tr::lng_record_lock_cancel_sure)(tr::now), diff --git a/Telegram/SourceFiles/history/view/history_view_contact_status.cpp b/Telegram/SourceFiles/history/view/history_view_contact_status.cpp index 20d98450e..8fa55ad9a 100644 --- a/Telegram/SourceFiles/history/view/history_view_contact_status.cpp +++ b/Telegram/SourceFiles/history/view/history_view_contact_status.cpp @@ -341,7 +341,7 @@ void ContactStatus::setupShareHandler(not_null user) { }).send(); close(); }; - _controller->window().show(Box( + _controller->window().show(Box( tr::lng_new_contact_share_sure( tr::now, lt_phone, @@ -399,7 +399,7 @@ void ContactStatus::setupReportHandler(not_null peer) { const auto text = ((peer->isChat() || peer->isMegagroup()) ? tr::lng_report_spam_sure_group : tr::lng_report_spam_sure_channel)(tr::now); - _controller->window().show(Box( + _controller->window().show(Box( text, tr::lng_report_spam_ok(tr::now), st::attentionBoxButton, diff --git a/Telegram/SourceFiles/history/view/history_view_context_menu.cpp b/Telegram/SourceFiles/history/view/history_view_context_menu.cpp index cbe016221..b3d5b115e 100644 --- a/Telegram/SourceFiles/history/view/history_view_context_menu.cpp +++ b/Telegram/SourceFiles/history/view/history_view_context_menu.cpp @@ -1010,7 +1010,7 @@ void StopPoll(not_null session, FullMsgId itemId) { session->api().closePoll(item); } }; - Ui::show(Box( + Ui::show(Box( tr::lng_polls_stop_warning(tr::now), tr::lng_polls_stop_sure(tr::now), tr::lng_cancel(tr::now), diff --git a/Telegram/SourceFiles/history/view/history_view_replies_section.cpp b/Telegram/SourceFiles/history/view/history_view_replies_section.cpp index c76f1d7b0..743691390 100644 --- a/Telegram/SourceFiles/history/view/history_view_replies_section.cpp +++ b/Telegram/SourceFiles/history/view/history_view_replies_section.cpp @@ -1010,7 +1010,8 @@ void RepliesWidget::edit( } return; } else if (!left.text.isEmpty()) { - controller()->show(Box(tr::lng_edit_too_long(tr::now))); + controller()->show(Box( + tr::lng_edit_too_long(tr::now))); return; } @@ -1035,13 +1036,15 @@ void RepliesWidget::edit( const auto &err = error.type(); if (ranges::contains(Api::kDefaultEditMessagesErrors, err)) { - controller()->show(Box(tr::lng_edit_error(tr::now))); + controller()->show(Box( + tr::lng_edit_error(tr::now))); } else if (err == u"MESSAGE_NOT_MODIFIED"_q) { _composeControls->cancelEditMessage(); } else if (err == u"MESSAGE_EMPTY"_q) { doSetInnerFocus(); } else { - controller()->show(Box(tr::lng_edit_error(tr::now))); + controller()->show(Box( + tr::lng_edit_error(tr::now))); } update(); return true; @@ -1078,7 +1081,7 @@ bool RepliesWidget::sendExistingDocument( ChatRestriction::SendStickers); if (error) { controller()->show( - Box(*error), + Box(*error), Ui::LayerOption::KeepOther); return false; } else if (showSlowmodeError()) { @@ -1114,7 +1117,7 @@ bool RepliesWidget::sendExistingPhoto( ChatRestriction::SendMedia); if (error) { controller()->show( - Box(*error), + Box(*error), Ui::LayerOption::KeepOther); return false; } else if (showSlowmodeError()) { @@ -1136,7 +1139,7 @@ void RepliesWidget::sendInlineResult( not_null bot) { const auto errorText = result->getErrorOnSend(_history); if (!errorText.isEmpty()) { - controller()->show(Box(errorText)); + controller()->show(Box(errorText)); return; } sendInlineResult(result, bot, Api::SendOptions()); diff --git a/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp b/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp index c2d4990ea..48ac4f7ca 100644 --- a/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp +++ b/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp @@ -609,7 +609,8 @@ void ScheduledWidget::edit( } return; } else if (!left.text.isEmpty()) { - controller()->show(Box(tr::lng_edit_too_long(tr::now))); + controller()->show(Box( + tr::lng_edit_too_long(tr::now))); return; } @@ -634,13 +635,15 @@ void ScheduledWidget::edit( const auto &err = error.type(); if (ranges::contains(Api::kDefaultEditMessagesErrors, err)) { - controller()->show(Box(tr::lng_edit_error(tr::now))); + controller()->show(Box( + tr::lng_edit_error(tr::now))); } else if (err == u"MESSAGE_NOT_MODIFIED"_q) { _composeControls->cancelEditMessage(); } else if (err == u"MESSAGE_EMPTY"_q) { _composeControls->focus(); } else { - controller()->show(Box(tr::lng_edit_error(tr::now))); + controller()->show(Box( + tr::lng_edit_error(tr::now))); } update(); return true; @@ -675,7 +678,7 @@ bool ScheduledWidget::sendExistingDocument( ChatRestriction::SendStickers); if (error) { controller()->show( - Box(*error), + Box(*error), Ui::LayerOption::KeepOther); return false; } @@ -707,7 +710,7 @@ bool ScheduledWidget::sendExistingPhoto( ChatRestriction::SendMedia); if (error) { controller()->show( - Box(*error), + Box(*error), Ui::LayerOption::KeepOther); return false; } @@ -727,7 +730,7 @@ void ScheduledWidget::sendInlineResult( not_null bot) { const auto errorText = result->getErrorOnSend(_history); if (!errorText.isEmpty()) { - controller()->show(Box(errorText)); + controller()->show(Box(errorText)); return; } const auto callback = [=](Api::SendOptions options) { diff --git a/Telegram/SourceFiles/info/info_wrap_widget.cpp b/Telegram/SourceFiles/info/info_wrap_widget.cpp index 48000c63f..a9f72b9c5 100644 --- a/Telegram/SourceFiles/info/info_wrap_widget.cpp +++ b/Telegram/SourceFiles/info/info_wrap_widget.cpp @@ -411,7 +411,7 @@ void WrapWidget::checkBeforeClose(Fn close) { close(); }; if (_controller->canSaveChangesNow()) { - Ui::show(Box( + Ui::show(Box( tr::lng_settings_close_sure(tr::now), tr::lng_close(tr::now), confirmed)); diff --git a/Telegram/SourceFiles/intro/intro_code.cpp b/Telegram/SourceFiles/intro/intro_code.cpp index 14323fe98..c38770e34 100644 --- a/Telegram/SourceFiles/intro/intro_code.cpp +++ b/Telegram/SourceFiles/intro/intro_code.cpp @@ -351,7 +351,7 @@ void CodeWidget::gotPassword(const MTPaccount_Password &result) { Core::UpdateApplication(); close(); }; - Ui::show(Box( + Ui::show(Box( tr::lng_passport_app_out_of_date(tr::now), tr::lng_menu_update(tr::now), callback)); diff --git a/Telegram/SourceFiles/intro/intro_password_check.cpp b/Telegram/SourceFiles/intro/intro_password_check.cpp index 4f4db1efe..6c3cc5126 100644 --- a/Telegram/SourceFiles/intro/intro_password_check.cpp +++ b/Telegram/SourceFiles/intro/intro_password_check.cpp @@ -311,14 +311,14 @@ void PasswordCheckWidget::toRecover() { }).send(); } } else { - Ui::show(Box( + Ui::show(Box( tr::lng_signin_no_email_forgot(tr::now), [=] { showReset(); })); } } void PasswordCheckWidget::toPassword() { - Ui::show(Box( + Ui::show(Box( tr::lng_signin_cant_email_forgot(tr::now), [=] { showReset(); })); } @@ -372,7 +372,7 @@ void PasswordCheckWidget::submit() { send(); close(); }; - Ui::show(Box( + Ui::show(Box( tr::lng_cloud_password_passport_losing(tr::now), tr::lng_continue(tr::now), confirmed)); diff --git a/Telegram/SourceFiles/intro/intro_phone.cpp b/Telegram/SourceFiles/intro/intro_phone.cpp index 531fa5bc4..b85b6d592 100644 --- a/Telegram/SourceFiles/intro/intro_phone.cpp +++ b/Telegram/SourceFiles/intro/intro_phone.cpp @@ -236,7 +236,7 @@ void PhoneWidget::phoneSubmitFail(const MTP::Error &error) { _sentRequest = 0; auto &err = error.type(); if (err == qstr("PHONE_NUMBER_FLOOD")) { - Ui::show(Box(tr::lng_error_phone_flood(tr::now))); + Ui::show(Box(tr::lng_error_phone_flood(tr::now))); } else if (err == qstr("PHONE_NUMBER_INVALID")) { // show error showPhoneError(tr::lng_bad_phone()); } else if (err == qstr("PHONE_NUMBER_BANNED")) { diff --git a/Telegram/SourceFiles/intro/intro_qr.cpp b/Telegram/SourceFiles/intro/intro_qr.cpp index f8a9d80ae..5426051b1 100644 --- a/Telegram/SourceFiles/intro/intro_qr.cpp +++ b/Telegram/SourceFiles/intro/intro_qr.cpp @@ -401,7 +401,7 @@ void QrWidget::sendCheckPasswordRequest() { Core::UpdateApplication(); close(); }; - Ui::show(Box( + Ui::show(Box( tr::lng_passport_app_out_of_date(tr::now), tr::lng_menu_update(tr::now), callback)); diff --git a/Telegram/SourceFiles/intro/intro_signup.cpp b/Telegram/SourceFiles/intro/intro_signup.cpp index 00170d556..2114b5893 100644 --- a/Telegram/SourceFiles/intro/intro_signup.cpp +++ b/Telegram/SourceFiles/intro/intro_signup.cpp @@ -130,7 +130,7 @@ void SignupWidget::nameSubmitFail(const MTP::Error &error) { auto &err = error.type(); if (err == qstr("PHONE_NUMBER_FLOOD")) { - Ui::show(Box(tr::lng_error_phone_flood(tr::now))); + Ui::show(Box(tr::lng_error_phone_flood(tr::now))); } else if (err == qstr("PHONE_NUMBER_INVALID") || err == qstr("PHONE_NUMBER_BANNED") || err == qstr("PHONE_CODE_EXPIRED") diff --git a/Telegram/SourceFiles/intro/intro_step.cpp b/Telegram/SourceFiles/intro/intro_step.cpp index 2344877eb..4639aa737 100644 --- a/Telegram/SourceFiles/intro/intro_step.cpp +++ b/Telegram/SourceFiles/intro/intro_step.cpp @@ -141,7 +141,8 @@ void Step::finish(const MTPUser &user, QImage &&photo) { || !user.c_user().vid().v) { // No idea what to do here. // We could've reset intro and MTP, but this really should not happen. - Ui::show(Box("Internal error: bad user.is_self() after sign in.")); + Ui::show(Box( + "Internal error: bad user.is_self() after sign in.")); return; } diff --git a/Telegram/SourceFiles/intro/intro_widget.cpp b/Telegram/SourceFiles/intro/intro_widget.cpp index fb62e47f2..dff8e808d 100644 --- a/Telegram/SourceFiles/intro/intro_widget.cpp +++ b/Telegram/SourceFiles/intro/intro_widget.cpp @@ -237,7 +237,7 @@ void Widget::handleUpdate(const MTPUpdate &update) { qs(data.vmessage()), Api::EntitiesFromMTP(nullptr, data.ventities().v) }; - Ui::show(Box(text)); + Ui::show(Box(text)); }, [](const auto &) {}); } @@ -486,7 +486,7 @@ void Widget::resetAccount() { return; } - Ui::show(Box(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) { return; } @@ -512,7 +512,8 @@ void Widget::resetAccount() { const auto &type = error.type(); 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 hours = ((seconds + 59) % 86400) / 3600; const auto minutes = ((seconds + 59) % 3600) / 60; @@ -549,21 +550,27 @@ void Widget::resetAccount() { lt_minutes_count, when); } - Ui::show(Box(tr::lng_signin_reset_wait( + Ui::show(Box(tr::lng_signin_reset_wait( tr::now, lt_phone_number, Ui::FormatPhone(getData()->phone), lt_when, when))); } else if (type == qstr("2FA_RECENT_CONFIRM")) { - Ui::show(Box( + Ui::show(Box( tr::lng_signin_reset_cancelled(tr::now))); } else { Ui::hideLayer(); getStep()->showError(rpl::single(Lang::Hard::ServerError())); } }).send(); - }))); + }); + + Ui::show(Box( + tr::lng_signin_sure_reset(tr::now), + tr::lng_signin_reset(tr::now), + st::attentionBoxButton, + callback)); } void Widget::getNearestDC() { diff --git a/Telegram/SourceFiles/lang/lang_cloud_manager.cpp b/Telegram/SourceFiles/lang/lang_cloud_manager.cpp index 114fdc3b9..af1654626 100644 --- a/Telegram/SourceFiles/lang/lang_cloud_manager.cpp +++ b/Telegram/SourceFiles/lang/lang_cloud_manager.cpp @@ -368,7 +368,7 @@ bool CloudManager::showOfferSwitchBox() { Local::writeLangPack(); }; Ui::show( - Box( + Box( "Do you want to switch your language to " + language.nativeName + "? You can always change your language in Settings.", @@ -420,7 +420,7 @@ void CloudManager::requestLanguageAndSwitch( Expects(!id.isEmpty()); if (LanguageIdOrDefault(_langpack.id()) == id) { - Ui::show(Box(tr::lng_language_already(tr::now))); + Ui::show(Box(tr::lng_language_already(tr::now))); return; } else if (id == qstr("#custom")) { performSwitchToCustom(); @@ -465,7 +465,7 @@ void CloudManager::sendSwitchingToLanguageRequest() { }).fail([=](const MTP::Error &error) { _switchingToLanguageRequest = 0; if (error.type() == "LANG_CODE_NOT_SUPPORTED") { - Ui::show(Box(tr::lng_language_not_found(tr::now))); + Ui::show(Box(tr::lng_language_not_found(tr::now))); } }).send(); } @@ -503,7 +503,7 @@ void CloudManager::switchToLanguage(const Language &data) { + "\n\n" + getValue(tr::lng_sure_save_language.base); Ui::show( - Box( + Box( text, tr::lng_box_ok(tr::now), tr::lng_cancel(tr::now), @@ -551,7 +551,7 @@ void CloudManager::performSwitchToCustom() { App::restart(); }; Ui::show( - Box( + Box( text, tr::lng_box_ok(tr::now), tr::lng_cancel(tr::now), @@ -560,7 +560,8 @@ void CloudManager::performSwitchToCustom() { } } else { Ui::show( - Box("Custom lang failed :(\n\nError: " + loader.errors()), + Box( + "Custom lang failed :(\n\nError: " + loader.errors()), Ui::LayerOption::KeepOther); } }); diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index 7d46893de..4bbf57799 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -504,7 +504,7 @@ bool MainWidget::setForwardDraft(PeerId peerId, Data::ForwardDraft &&draft) { session().data().idsToItems(draft.ids), true); if (!error.isEmpty()) { - Ui::show(Box(error), Ui::LayerOption::KeepOther); + Ui::show(Box(error), Ui::LayerOption::KeepOther); return false; } @@ -525,7 +525,7 @@ bool MainWidget::shareUrl( const auto peer = session().data().peer(peerId); if (!peer->canWrite()) { - Ui::show(Box(tr::lng_share_cant(tr::now))); + Ui::show(Box(tr::lng_share_cant(tr::now))); return false; } TextWithTags textWithTags = { @@ -555,7 +555,7 @@ bool MainWidget::inlineSwitchChosen(PeerId peerId, const QString &botAndQuery) { const auto peer = session().data().peer(peerId); if (!peer->canWrite()) { - Ui::show(Box(tr::lng_inline_switch_cant(tr::now))); + Ui::show(Box(tr::lng_inline_switch_cant(tr::now))); return false; } const auto h = peer->owner().history(peer); @@ -578,12 +578,13 @@ bool MainWidget::sendPaths(PeerId peerId) { auto peer = session().data().peer(peerId); if (!peer->canWrite()) { - Ui::show(Box(tr::lng_forward_send_files_cant(tr::now))); + Ui::show(Box( + tr::lng_forward_send_files_cant(tr::now))); return false; } else if (const auto error = Data::RestrictionError( peer, ChatRestriction::SendMedia)) { - Ui::show(Box(*error)); + Ui::show(Box(*error)); return false; } Ui::showPeerHistory(peer, ShowAtTheEndMsgId); @@ -609,7 +610,8 @@ void MainWidget::onFilesOrForwardDrop( } else { auto peer = session().data().peer(peerId); if (!peer->canWrite()) { - Ui::show(Box(tr::lng_forward_send_files_cant(tr::now))); + Ui::show(Box( + tr::lng_forward_send_files_cant(tr::now))); return; } Ui::showPeerHistory(peer, ShowAtTheEndMsgId); @@ -726,10 +728,13 @@ void MainWidget::showSendPathsLayer() { void MainWidget::deletePhotoLayer(PhotoData *photo) { if (!photo) return; - Ui::show(Box(tr::lng_delete_photo_sure(tr::now), tr::lng_box_delete(tr::now), crl::guard(this, [=] { - session().api().clearPeerPhoto(photo); - Ui::hideLayer(); - }))); + Ui::show(Box( + tr::lng_delete_photo_sure(tr::now), + tr::lng_box_delete(tr::now), + crl::guard(this, [=] { + session().api().clearPeerPhoto(photo); + Ui::hideLayer(); + }))); } void MainWidget::shareUrlLayer(const QString &url, const QString &text) { @@ -1266,7 +1271,7 @@ void MainWidget::ui_showPeerHistory( const auto unavailable = peer->computeUnavailableReason(); if (!unavailable.isEmpty()) { if (params.activation != anim::activation::background) { - Ui::show(Box(unavailable)); + Ui::show(Box(unavailable)); } return; } @@ -1989,7 +1994,7 @@ void MainWidget::hideAll() { void MainWidget::showAll() { if (cPasswordRecovered()) { cSetPasswordRecovered(false); - Ui::show(Box(tr::lng_cloud_password_updated(tr::now))); + Ui::show(Box(tr::lng_cloud_password_updated(tr::now))); } if (isOneColumn()) { _sideShadow->hide(); @@ -2542,7 +2547,7 @@ void MainWidget::activate() { _controller, path.mid(interpret.size())); if (!error.isEmpty()) { - Ui::show(Box(error)); + Ui::show(Box(error)); } } else { showSendPathsLayer(); diff --git a/Telegram/SourceFiles/mainwidget.h b/Telegram/SourceFiles/mainwidget.h index 169ad7c77..c6f4fed64 100644 --- a/Telegram/SourceFiles/mainwidget.h +++ b/Telegram/SourceFiles/mainwidget.h @@ -17,7 +17,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL struct HistoryMessageMarkupButton; class MainWindow; -class ConfirmBox; class HistoryWidget; class StackItem; struct FileLoadResult; @@ -66,6 +65,7 @@ struct Content; } // namespace Export namespace Ui { +class ConfirmBox; class ResizeArea; class PlainShadow; class DropdownMenu; diff --git a/Telegram/SourceFiles/mainwindow.cpp b/Telegram/SourceFiles/mainwindow.cpp index 82fb9efeb..4b80f55f3 100644 --- a/Telegram/SourceFiles/mainwindow.cpp +++ b/Telegram/SourceFiles/mainwindow.cpp @@ -739,7 +739,7 @@ bool MainWindow::skipTrayClick() const { void MainWindow::toggleDisplayNotifyFromTray() { if (controller().locked()) { if (!isActive()) showFromTray(); - Ui::show(Box(tr::lng_passcode_need_unblock(tr::now))); + Ui::show(Box(tr::lng_passcode_need_unblock(tr::now))); return; } if (!sessionController()) { diff --git a/Telegram/SourceFiles/passport/passport_form_controller.cpp b/Telegram/SourceFiles/passport/passport_form_controller.cpp index abaf080af..aa54ed1df 100644 --- a/Telegram/SourceFiles/passport/passport_form_controller.cpp +++ b/Telegram/SourceFiles/passport/passport_form_controller.cpp @@ -765,7 +765,7 @@ std::vector> FormController::submitGetErrors() { } else if (AcceptErrorRequiresRestart(error.type())) { suggestRestart(); } else { - _view->show(Box( + _view->show(Box( Lang::Hard::SecureAcceptError() + "\n" + error.type())); } }).send(); @@ -974,7 +974,8 @@ void FormController::checkSavedPasswordSettings( void FormController::recoverPassword() { if (!_password.hasRecovery) { - _view->show(Box(tr::lng_signin_no_email_forgot(tr::now))); + _view->show(Box( + tr::lng_signin_no_email_forgot(tr::now))); return; } else if (_recoverRequestId) { return; @@ -1014,7 +1015,7 @@ void FormController::recoverPassword() { }, box->lifetime()); }).fail([=](const MTP::Error &error) { _recoverRequestId = 0; - _view->show(Box(Lang::Hard::ServerError() + _view->show(Box(Lang::Hard::ServerError() + '\n' + error.type())); }).send(); @@ -2248,7 +2249,7 @@ void FormController::requestPhoneCall(not_null value) { void FormController::valueSaveShowError( not_null value, const MTP::Error &error) { - _view->show(Box( + _view->show(Box( Lang::Hard::SecureSaveError() + "\n" + error.type())); valueSaveFailed(value); } @@ -2323,7 +2324,7 @@ void FormController::saveSecret( void FormController::suggestRestart() { _suggestingRestart = true; - _view->show(Box( + _view->show(Box( tr::lng_passport_restart_sure(tr::now), tr::lng_passport_restart(tr::now), [=] { _controller->showPassportForm(_request); }, @@ -2687,7 +2688,7 @@ bool FormController::applyPassword(PasswordSettings &&settings) { void FormController::cancel() { if (!_submitSuccess && _serviceErrorText.isEmpty()) { - _view->show(Box( + _view->show(Box( tr::lng_passport_stop_sure(tr::now), tr::lng_passport_stop(tr::now), [=] { cancelSure(); }, diff --git a/Telegram/SourceFiles/passport/passport_panel_controller.cpp b/Telegram/SourceFiles/passport/passport_panel_controller.cpp index bc87620d2..5dc252951 100644 --- a/Telegram/SourceFiles/passport/passport_panel_controller.cpp +++ b/Telegram/SourceFiles/passport/passport_panel_controller.cpp @@ -710,7 +710,7 @@ void PanelController::setupPassword() { } void PanelController::cancelPasswordSubmit() { - show(Box( + show(Box( tr::lng_passport_stop_password_sure(tr::now), tr::lng_passport_stop(tr::now), [=](Fn &&close) { close(); _form->cancelPassword(); })); @@ -887,7 +887,7 @@ void PanelController::deleteValueSure(bool withDetails) { } void PanelController::suggestReset(Fn callback) { - _resetBox = Ui::BoxPointer(show(Box( + _resetBox = Ui::BoxPointer(show(Box( Lang::Hard::PassportCorrupted(), Lang::Hard::PassportCorruptedReset(), [=] { resetPassport(callback); }, @@ -895,7 +895,7 @@ void PanelController::suggestReset(Fn callback) { } void PanelController::resetPassport(Fn callback) { - const auto box = show(Box( + const auto box = show(Box( Lang::Hard::PassportCorruptedResetSure(), Lang::Hard::PassportCorruptedReset(), st::attentionBoxButton, @@ -942,7 +942,7 @@ void PanelController::showUpdateAppBox() { Core::UpdateApplication(); }; show( - Box( + Box( tr::lng_passport_app_out_of_date(tr::now), tr::lng_menu_update(tr::now), callback, @@ -1076,7 +1076,7 @@ void PanelController::editWithUpload(int index, int documentIndex) { } void PanelController::readScanError(ReadScanError error) { - show(Box([&] { + show(Box([&] { switch (error) { case ReadScanError::FileTooLarge: return tr::lng_passport_error_too_large(tr::now); @@ -1402,7 +1402,7 @@ void PanelController::cancelEditScope() { if (_panelHasUnsavedChanges && _panelHasUnsavedChanges()) { if (!_confirmForgetChangesBox) { - _confirmForgetChangesBox = show(Box( + _confirmForgetChangesBox = show(Box( tr::lng_passport_sure_cancel(tr::now), tr::lng_continue(tr::now), [=] { _panel->showForm(); })); diff --git a/Telegram/SourceFiles/platform/mac/touchbar/items/mac_scrubber_item.mm b/Telegram/SourceFiles/platform/mac/touchbar/items/mac_scrubber_item.mm index 7d2cddadf..36be91b02 100644 --- a/Telegram/SourceFiles/platform/mac/touchbar/items/mac_scrubber_item.mm +++ b/Telegram/SourceFiles/platform/mac/touchbar/items/mac_scrubber_item.mm @@ -462,7 +462,7 @@ void AppendEmojiPacks( auto callback = [=] { if (document) { if (const auto error = RestrictionToSendStickers(_controller)) { - _controller->show(Box(*error)); + _controller->show(Box(*error)); return true; } Api::SendExistingDocument( diff --git a/Telegram/SourceFiles/profile/profile_block_group_members.cpp b/Telegram/SourceFiles/profile/profile_block_group_members.cpp index ac89e0026..16e22304a 100644 --- a/Telegram/SourceFiles/profile/profile_block_group_members.cpp +++ b/Telegram/SourceFiles/profile/profile_block_group_members.cpp @@ -98,7 +98,7 @@ void GroupMembersWidget::removePeer(PeerData *selectedPeer) { currentRestrictedRights); } }; - Ui::show(Box( + Ui::show(Box( text, tr::lng_box_remove(tr::now), crl::guard(&peer->session(), callback))); diff --git a/Telegram/SourceFiles/settings/settings_advanced.cpp b/Telegram/SourceFiles/settings/settings_advanced.cpp index 063c97ba3..879380bc1 100644 --- a/Telegram/SourceFiles/settings/settings_advanced.cpp +++ b/Telegram/SourceFiles/settings/settings_advanced.cpp @@ -479,7 +479,7 @@ void SetupSystemIntegrationContent( }) | rpl::start_with_next([=](bool checked) { if (controller->session().domain().local().hasLocalPasscode()) { minimized->entity()->setChecked(false); - controller->show(Box( + controller->show(Box( tr::lng_error_start_minimized_passcoded(tr::now))); } else { cSetStartMinimized(checked); @@ -596,7 +596,7 @@ void SetupANGLE( } App::restart(); }); - controller->show(Box( + controller->show(Box( tr::lng_settings_need_restart(tr::now), tr::lng_settings_restart_now(tr::now), confirmed)); @@ -638,7 +638,7 @@ void SetupOpenGL( const auto cancelled = crl::guard(button, [=] { toggles->fire(!enabled); }); - controller->show(Box( + controller->show(Box( tr::lng_settings_need_restart(tr::now), tr::lng_settings_restart_now(tr::now), confirmed, diff --git a/Telegram/SourceFiles/settings/settings_calls.cpp b/Telegram/SourceFiles/settings/settings_calls.cpp index 8a13b11f9..df6dbdeb5 100644 --- a/Telegram/SourceFiles/settings/settings_calls.cpp +++ b/Telegram/SourceFiles/settings/settings_calls.cpp @@ -290,7 +290,7 @@ void Calls::setupContent() { Platform::SystemSettingsType::Audio); if (!opened) { _controller->show( - Box(tr::lng_linux_no_audio_prefs(tr::now))); + Box(tr::lng_linux_no_audio_prefs(tr::now))); } }); @@ -322,7 +322,7 @@ void Calls::requestPermissionAndStartTestingMicrophone() { Platform::PermissionType::Microphone); Ui::hideLayer(); }; - _controller->show(Box( + _controller->show(Box( tr::lng_no_mic_permission(tr::now), tr::lng_menu_settings(tr::now), showSystemSettings)); diff --git a/Telegram/SourceFiles/settings/settings_chat.cpp b/Telegram/SourceFiles/settings/settings_chat.cpp index f4878f7e9..7e98193d2 100644 --- a/Telegram/SourceFiles/settings/settings_chat.cpp +++ b/Telegram/SourceFiles/settings/settings_chat.cpp @@ -1172,7 +1172,7 @@ void SetupDefaultThemes( // in Window::Theme::Revert which is called by Editor. // // So we check here, before we change the saved accent color. - window->show(Box( + window->show(Box( tr::lng_theme_editor_cant_change_theme(tr::now))); return; } @@ -1326,7 +1326,7 @@ void SetupAutoNightMode( }) | rpl::start_with_next([=](bool checked) { if (checked && Window::Theme::Background()->editingTheme()) { autoNight->setChecked(false); - controller->show(Box( + controller->show(Box( tr::lng_theme_editor_cant_change_theme(tr::now))); } else { Core::App().settings().setSystemDarkModeEnabled(checked); diff --git a/Telegram/SourceFiles/settings/settings_codes.cpp b/Telegram/SourceFiles/settings/settings_codes.cpp index 2011a2fdc..20953b948 100644 --- a/Telegram/SourceFiles/settings/settings_codes.cpp +++ b/Telegram/SourceFiles/settings/settings_codes.cpp @@ -76,7 +76,7 @@ auto GenerateCodes() { ? qsl("Do you want to disable DEBUG logs?") : qsl("Do you want to enable DEBUG logs?\n\n" "All network events will be logged."); - Ui::show(Box(text, [] { + Ui::show(Box(text, [] { Core::App().switchDebugMode(); })); }); @@ -96,7 +96,7 @@ auto GenerateCodes() { }); codes.emplace(qsl("moderate"), [](SessionController *window) { auto text = Core::App().settings().moderateModeEnabled() ? qsl("Disable moderate mode?") : qsl("Enable moderate mode?"); - Ui::show(Box(text, [=] { + Ui::show(Box(text, [=] { Core::App().settings().setModerateModeEnabled(!Core::App().settings().moderateModeEnabled()); Core::App().saveSettingsDelayed(); Ui::hideLayer(); @@ -119,7 +119,7 @@ auto GenerateCodes() { return; } auto text = cUseExternalVideoPlayer() ? qsl("Use internal video player?") : qsl("Use external video player?"); - Ui::show(Box(text, [=] { + Ui::show(Box(text, [=] { cSetUseExternalVideoPlayer(!cUseExternalVideoPlayer()); window->session().saveSettingsDelayed(); Ui::hideLayer(); @@ -136,7 +136,8 @@ auto GenerateCodes() { if (!result.paths.isEmpty()) { const auto loadFor = [&](not_null account) { if (!account->mtp().dcOptions().loadFromFile(result.paths.front())) { - Ui::show(Box("Could not load endpoints :( Errors in 'log.txt'.")); + Ui::show(Box("Could not load endpoints" + " :( Errors in 'log.txt'.")); } }; if (const auto strong = weak.get()) { @@ -185,7 +186,7 @@ auto GenerateCodes() { #endif // !Q_OS_WIN : qsl("Switch font engine to FreeType?"); - Ui::show(Box(text, [] { + Ui::show(Box(text, [] { Core::App().switchFreeType(); })); }); @@ -214,7 +215,7 @@ auto GenerateCodes() { auto track = Media::Audio::Current().createTrack(); track->fillFromFile(result.paths.front()); if (track->failed()) { - Ui::show(Box( + Ui::show(Box( "Could not audio :( Errors in 'log.txt'.")); } else { Core::App().settings().setSoundOverride( @@ -229,7 +230,7 @@ auto GenerateCodes() { codes.emplace(qsl("sounds_reset"), [](SessionController *window) { Core::App().settings().clearSoundOverrides(); Core::App().saveSettingsDelayed(); - Ui::show(Box("All sound overrides were reset.")); + Ui::show(Box("All sound overrides were reset.")); }); codes.emplace(qsl("unpacklog"), [](SessionController *window) { FileDialog::GetOpenPath(Core::App().getFileDialogParent(), "Open crash log file", "Crash dump (*.txt)", [=](const FileDialog::OpenResult &result) { diff --git a/Telegram/SourceFiles/settings/settings_main.cpp b/Telegram/SourceFiles/settings/settings_main.cpp index 26fb74876..39480a4bf 100644 --- a/Telegram/SourceFiles/settings/settings_main.cpp +++ b/Telegram/SourceFiles/settings/settings_main.cpp @@ -237,7 +237,7 @@ void SetupInterfaceScale( button, [=] { repeatSetScale(cConfigScale(), repeatSetScale); }); }); - window->show(Box( + window->show(Box( tr::lng_settings_need_restart(tr::now), tr::lng_settings_restart_now(tr::now), confirmed, @@ -328,7 +328,7 @@ void SetupHelp( *requestId = 0; }).send(); }); - auto box = Box( + auto box = Box( tr::lng_settings_ask_sure(tr::now), tr::lng_settings_ask_ok(tr::now), tr::lng_settings_faq_button(tr::now), diff --git a/Telegram/SourceFiles/settings/settings_privacy_controllers.cpp b/Telegram/SourceFiles/settings/settings_privacy_controllers.cpp index 9e87d79ef..33e211753 100644 --- a/Telegram/SourceFiles/settings/settings_privacy_controllers.cpp +++ b/Telegram/SourceFiles/settings/settings_privacy_controllers.cpp @@ -480,7 +480,7 @@ void LastSeenPrivacyController::confirmSave( Core::App().settings().setLastSeenWarningSeen(true); Core::App().saveSettingsDelayed(); }; - auto box = Box( + auto box = Box( tr::lng_edit_privacy_lastseen_warning(tr::now), tr::lng_continue(tr::now), tr::lng_cancel(tr::now), diff --git a/Telegram/SourceFiles/settings/settings_privacy_security.cpp b/Telegram/SourceFiles/settings/settings_privacy_security.cpp index 77ea77330..b288a0079 100644 --- a/Telegram/SourceFiles/settings/settings_privacy_security.cpp +++ b/Telegram/SourceFiles/settings/settings_privacy_security.cpp @@ -585,7 +585,7 @@ void SetupCloudPassword( *sent = false; }, container->lifetime()); }; - Ui::show(Box( + Ui::show(Box( tr::lng_cloud_password_reset_cancel_sure(tr::now), tr::lng_box_yes(tr::now), tr::lng_box_no(tr::now), @@ -889,7 +889,7 @@ object_ptr CloudPasswordAppOutdatedBox() { Core::UpdateApplication(); close(); }; - return Box( + return Box( tr::lng_passport_app_out_of_date(tr::now), tr::lng_menu_update(tr::now), callback); diff --git a/Telegram/SourceFiles/storage/localimageloader.cpp b/Telegram/SourceFiles/storage/localimageloader.cpp index 2b826e078..3c77ba723 100644 --- a/Telegram/SourceFiles/storage/localimageloader.cpp +++ b/Telegram/SourceFiles/storage/localimageloader.cpp @@ -1040,13 +1040,13 @@ void FileLoadTask::process(Args &&args) { void FileLoadTask::finish() { if (!_result || !_result->filesize || _result->filesize < 0) { Ui::show( - Box( + Box( tr::lng_send_image_empty(tr::now, lt_name, _filepath)), Ui::LayerOption::KeepOther); removeFromAlbum(); } else if (_result->filesize > kFileSizeLimit) { Ui::show( - Box( + Box( tr::lng_send_image_too_large(tr::now, lt_name, _filepath)), Ui::LayerOption::KeepOther); removeFromAlbum(); diff --git a/Telegram/SourceFiles/ui/boxes/confirm_box.cpp b/Telegram/SourceFiles/ui/boxes/confirm_box.cpp index 6c50cc25a..d5d51f96f 100644 --- a/Telegram/SourceFiles/ui/boxes/confirm_box.cpp +++ b/Telegram/SourceFiles/ui/boxes/confirm_box.cpp @@ -13,6 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "styles/style_layers.h" #include "styles/style_boxes.h" +namespace Ui { namespace { TextParseOptions kInformBoxTextOptions = { @@ -444,3 +445,5 @@ not_null ConfirmDontWarnBox::setupContent( }; return result; } + +} // namespace Ui diff --git a/Telegram/SourceFiles/ui/boxes/confirm_box.h b/Telegram/SourceFiles/ui/boxes/confirm_box.h index 71bd18323..1b55e5e76 100644 --- a/Telegram/SourceFiles/ui/boxes/confirm_box.h +++ b/Telegram/SourceFiles/ui/boxes/confirm_box.h @@ -9,6 +9,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "boxes/abstract_box.h" +namespace Ui { + class InformBox; class ConfirmBox : public Ui::BoxContent, public ClickHandlerHost { public: @@ -174,3 +176,5 @@ private: not_null _content; }; + +} // namespace Ui diff --git a/Telegram/SourceFiles/window/themes/window_theme.cpp b/Telegram/SourceFiles/window/themes/window_theme.cpp index d54bed8df..3813ac809 100644 --- a/Telegram/SourceFiles/window/themes/window_theme.cpp +++ b/Telegram/SourceFiles/window/themes/window_theme.cpp @@ -1404,7 +1404,7 @@ void ToggleNightModeWithConfirmation( toggle(); close(); }; - window->show(Box( + window->show(Box( tr::lng_settings_auto_night_warning(tr::now), tr::lng_settings_auto_night_disable(tr::now), disableAndToggle)); diff --git a/Telegram/SourceFiles/window/themes/window_theme_editor.cpp b/Telegram/SourceFiles/window/themes/window_theme_editor.cpp index fd244a0d5..4531035a6 100644 --- a/Telegram/SourceFiles/window/themes/window_theme_editor.cpp +++ b/Telegram/SourceFiles/window/themes/window_theme_editor.cpp @@ -422,7 +422,7 @@ Editor::Inner::Inner(QWidget *parent, const QString &path) if (update.type == BackgroundUpdate::Type::TestingTheme) { Revert(); base::call_delayed(st::slideDuration, this, [] { - Ui::show(Box( + Ui::show(Box( tr::lng_theme_editor_cant_change_theme(tr::now))); }); } @@ -667,7 +667,7 @@ Editor::Editor( [=] { save(); })); _inner->setErrorCallback([=] { - window->show(Box(tr::lng_theme_editor_error(tr::now))); + window->show(Box(tr::lng_theme_editor_error(tr::now))); // This could be from inner->_context observable notification. // We should not destroy it while iterating in subscribers. @@ -750,13 +750,13 @@ void Editor::exportTheme() { if (!f.open(QIODevice::WriteOnly)) { LOG(("Theme Error: could not open zip-ed theme file '%1' for writing").arg(path)); _window->show( - Box(tr::lng_theme_editor_error(tr::now))); + Box(tr::lng_theme_editor_error(tr::now))); return; } if (f.write(result) != result.size()) { LOG(("Theme Error: could not write zip-ed theme to file '%1'").arg(path)); _window->show( - Box(tr::lng_theme_editor_error(tr::now))); + Box(tr::lng_theme_editor_error(tr::now))); return; } Ui::Toast::Show(tr::lng_theme_editor_done(tr::now)); @@ -903,7 +903,7 @@ void Editor::closeWithConfirmation() { closeEditor(); close(); }); - _window->show(Box( + _window->show(Box( tr::lng_theme_editor_sure_close(tr::now), tr::lng_close(tr::now), close)); diff --git a/Telegram/SourceFiles/window/themes/window_theme_editor_box.cpp b/Telegram/SourceFiles/window/themes/window_theme_editor_box.cpp index 3aadd35c2..54e3ee28a 100644 --- a/Telegram/SourceFiles/window/themes/window_theme_editor_box.cpp +++ b/Telegram/SourceFiles/window/themes/window_theme_editor_box.cpp @@ -655,7 +655,7 @@ void StartEditor( ? GenerateDefaultPalette() : ParseTheme(object, true).palette; if (palette.isEmpty() || !CopyColorsToPalette(path, palette, cloud)) { - window->show(Box(tr::lng_theme_editor_error(tr::now))); + window->show(Box(tr::lng_theme_editor_error(tr::now))); return; } if (Core::App().settings().systemDarkModeEnabled()) { diff --git a/Telegram/SourceFiles/window/themes/window_themes_cloud_list.cpp b/Telegram/SourceFiles/window/themes/window_themes_cloud_list.cpp index 76440db90..fc89a4d64 100644 --- a/Telegram/SourceFiles/window/themes/window_themes_cloud_list.cpp +++ b/Telegram/SourceFiles/window/themes/window_themes_cloud_list.cpp @@ -617,7 +617,7 @@ void CloudList::showMenu(Element &element) { _window->session().data().cloudThemes().remove(id); } }; - _window->window().show(Box( + _window->window().show(Box( tr::lng_theme_delete_sure(tr::now), tr::lng_theme_delete(tr::now), remove)); diff --git a/Telegram/SourceFiles/window/window_controller.cpp b/Telegram/SourceFiles/window/window_controller.cpp index 1c370d8ca..9ce026a8d 100644 --- a/Telegram/SourceFiles/window/window_controller.cpp +++ b/Telegram/SourceFiles/window/window_controller.cpp @@ -195,7 +195,7 @@ void Controller::showTermsDelete() { } }; show( - Box( + Box( tr::lng_terms_delete_warning(tr::now), tr::lng_terms_delete_now(tr::now), st::attentionBoxButton, @@ -371,7 +371,7 @@ void Controller::showLogoutConfirmation() { Core::App().logout(account); } }; - show(Box( + show(Box( tr::lng_sure_logout(tr::now), tr::lng_settings_logout(tr::now), st::attentionBoxButton, diff --git a/Telegram/SourceFiles/window/window_filters_menu.cpp b/Telegram/SourceFiles/window/window_filters_menu.cpp index c1d7907b7..d097a8d5d 100644 --- a/Telegram/SourceFiles/window/window_filters_menu.cpp +++ b/Telegram/SourceFiles/window/window_filters_menu.cpp @@ -336,7 +336,7 @@ void FiltersMenu::showEditBox(FilterId id) { } void FiltersMenu::showRemoveBox(FilterId id) { - _session->window().show(Box( + _session->window().show(Box( tr::lng_filters_remove_sure(tr::now), tr::lng_filters_remove_yes(tr::now), [=](Fn &&close) { close(); remove(id); })); diff --git a/Telegram/SourceFiles/window/window_main_menu.cpp b/Telegram/SourceFiles/window/window_main_menu.cpp index cdc4367d5..c56cd1bfd 100644 --- a/Telegram/SourceFiles/window/window_main_menu.cpp +++ b/Telegram/SourceFiles/window/window_main_menu.cpp @@ -339,7 +339,7 @@ void MainMenu::AccountButton::contextMenuEvent(QContextMenuEvent *e) { close(); Core::App().logout(&session->account()); }; - Ui::show(Box( + Ui::show(Box( tr::lng_sure_logout(tr::now), tr::lng_settings_logout(tr::now), st::attentionBoxButton, @@ -941,7 +941,7 @@ void MainMenu::refreshMenu() { auto nightCallback = [=] { if (Window::Theme::Background()->editingTheme()) { - controller->show(Box( + controller->show(Box( tr::lng_theme_editor_cant_change_theme(tr::now))); return; } diff --git a/Telegram/SourceFiles/window/window_peer_menu.cpp b/Telegram/SourceFiles/window/window_peer_menu.cpp index 7b0d0855b..c6f5cac66 100644 --- a/Telegram/SourceFiles/window/window_peer_menu.cpp +++ b/Telegram/SourceFiles/window/window_peer_menu.cpp @@ -188,7 +188,7 @@ bool PinnedLimitReached(Dialogs::Key key, FilterId filterId) { tr::now, lt_count, pinnedMax); - Ui::show(Box(errorText)); + Ui::show(Box(errorText)); } return true; } @@ -742,7 +742,7 @@ void PeerMenuDeleteContact(not_null user) { user->session().api().applyUpdates(result); }).send(); }; - Ui::show(Box( + Ui::show(Box( text, tr::lng_box_delete(tr::now), deleteSure)); @@ -754,7 +754,7 @@ void PeerMenuShareContactBox( const auto weak = std::make_shared>(); auto callback = [=](not_null peer) { if (!peer->canWrite()) { - Ui::show(Box( + Ui::show(Box( tr::lng_forward_share_cant(tr::now)), Ui::LayerOption::KeepOther); return; @@ -771,7 +771,7 @@ void PeerMenuShareContactBox( auto recipient = peer->isUser() ? peer->name : '\xAB' + peer->name + '\xBB'; - Ui::show(Box( + Ui::show(Box( tr::lng_forward_share_contact(tr::now, lt_recipient, recipient), tr::lng_forward_send(tr::now), [peer, user, navigation] { @@ -1072,7 +1072,7 @@ QPointer ShowSendNowMessagesBox( } }; return Ui::show( - Box(text, tr::lng_send_button(tr::now), std::move(done)), + Box(text, tr::lng_send_button(tr::now), std::move(done)), Ui::LayerOption::KeepOther).data(); } @@ -1133,7 +1133,7 @@ void ToggleMessagePinned( } else { const auto peer = item->history()->peer; const auto session = &peer->session(); - Ui::show(Box(tr::lng_pinned_unpin_sure(tr::now), tr::lng_pinned_unpin(tr::now), crl::guard(session, [=] { + const auto callback = crl::guard(session, [=] { Ui::hideLayer(); session->api().request(MTPmessages_UpdatePinnedMessage( MTP_flags(MTPmessages_UpdatePinnedMessage::Flag::f_unpin), @@ -1142,7 +1142,11 @@ void ToggleMessagePinned( )).done([=](const MTPUpdates &result) { session->api().applyUpdates(result); }).send(); - }))); + }); + Ui::show(Box( + tr::lng_pinned_unpin_sure(tr::now), + tr::lng_pinned_unpin(tr::now), + callback)); } } @@ -1150,7 +1154,7 @@ void HidePinnedBar( not_null navigation, not_null peer, Fn onHidden) { - Ui::show(Box(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(); auto &session = peer->session(); const auto migrated = peer->migrateFrom(); @@ -1169,13 +1173,17 @@ void HidePinnedBar( } else { session.api().requestFullPeer(peer); } - }))); + }); + Ui::show(Box( + tr::lng_pinned_hide_all_sure(tr::now), + tr::lng_pinned_hide_all_hide(tr::now), + callback)); } void UnpinAllMessages( not_null navigation, not_null history) { - Ui::show(Box(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(); const auto api = &history->session().api(); const auto sendRequest = [=](auto self) -> void { @@ -1192,7 +1200,11 @@ void UnpinAllMessages( }).send(); }; sendRequest(sendRequest); - }))); + }); + Ui::show(Box( + tr::lng_pinned_unpin_all_sure(tr::now), + tr::lng_pinned_unpin(tr::now), + callback)); } void PeerMenuAddMuteAction( @@ -1230,7 +1242,7 @@ void MenuAddMarkAsReadAllChatsAction( MarkAsReadChatList(folder->chatsList()); } }; - Ui::show(Box( + Ui::show(Box( tr::lng_context_mark_read_all_sure(tr::now), std::move(boxCallback))); }; @@ -1253,7 +1265,7 @@ void MenuAddMarkAsReadChatListAction( MarkAsReadChatList(list()); close(); }; - Ui::show(Box( + Ui::show(Box( tr::lng_context_mark_read_sure(tr::now), std::move(boxCallback))); } else { diff --git a/Telegram/SourceFiles/window/window_session_controller.cpp b/Telegram/SourceFiles/window/window_session_controller.cpp index af5c44a9d..094e68c80 100644 --- a/Telegram/SourceFiles/window/window_session_controller.cpp +++ b/Telegram/SourceFiles/window/window_session_controller.cpp @@ -201,7 +201,7 @@ void SessionNavigation::resolveUsername( }).fail([=](const MTP::Error &error) { _resolveRequestId = 0; if (error.code() == 400) { - show(Box( + show(Box( tr::lng_username_not_found(tr::now, lt_user, username))); } }).send(); @@ -1104,7 +1104,7 @@ void SessionController::startOrJoinGroupCall( GroupCallJoinConfirm confirm) { auto &calls = Core::App().calls(); const auto askConfirmation = [&](QString text, QString button) { - show(Box(text, button, crl::guard(this, [=] { + show(Box(text, button, crl::guard(this, [=] { Ui::hideLayer(); startOrJoinGroupCall(peer, joinHash, GroupCallJoinConfirm::None); }))); @@ -1293,7 +1293,7 @@ void SessionController::cancelUploadLayer(not_null item) { session().uploader().unpause(); }; - show(Box( + show(Box( tr::lng_selected_cancel_sure_this(tr::now), tr::lng_selected_upload_stop(tr::now), tr::lng_continue(tr::now),