mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 06:07:06 +02:00
Removed Ui::show from classes that have pointer to Controller.
This commit is contained in:
parent
c8535acad8
commit
b422ec025e
46 changed files with 296 additions and 193 deletions
|
@ -36,10 +36,12 @@ void AttachedStickers::request(
|
|||
return;
|
||||
}
|
||||
if (result.v.isEmpty()) {
|
||||
Ui::show(Box<InformBox>(tr::lng_stickers_not_found(tr::now)));
|
||||
strongController->show(
|
||||
Box<InformBox>(tr::lng_stickers_not_found(tr::now)));
|
||||
return;
|
||||
} else if (result.v.size() > 1) {
|
||||
Ui::show(Box<StickersBox>(strongController, result));
|
||||
strongController->show(
|
||||
Box<StickersBox>(strongController, result));
|
||||
return;
|
||||
}
|
||||
// Single attached sticker pack.
|
||||
|
@ -52,12 +54,15 @@ void AttachedStickers::request(
|
|||
const auto setId = (setData->vid().v && setData->vaccess_hash().v)
|
||||
? MTP_inputStickerSetID(setData->vid(), setData->vaccess_hash())
|
||||
: MTP_inputStickerSetShortName(setData->vshort_name());
|
||||
Ui::show(
|
||||
strongController->show(
|
||||
Box<StickerSetBox>(strongController, setId),
|
||||
Ui::LayerOption::KeepOther);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_requestId = 0;
|
||||
Ui::show(Box<InformBox>(tr::lng_stickers_not_found(tr::now)));
|
||||
if (const auto strongController = weak.get()) {
|
||||
strongController->show(
|
||||
Box<InformBox>(tr::lng_stickers_not_found(tr::now)));
|
||||
}
|
||||
}).send();
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,11 @@ void CheckChatInvite(
|
|||
session->api().checkChatInvite(hash, [=](const MTPChatInvite &result) {
|
||||
Core::App().hideMediaView();
|
||||
result.match([=](const MTPDchatInvite &data) {
|
||||
const auto box = Ui::show(Box<ConfirmInviteBox>(
|
||||
const auto strongController = weak.get();
|
||||
if (!strongController) {
|
||||
return;
|
||||
}
|
||||
const auto box = strongController->show(Box<ConfirmInviteBox>(
|
||||
session,
|
||||
data,
|
||||
invitePeekChannel,
|
||||
|
@ -80,7 +84,10 @@ void CheckChatInvite(
|
|||
return;
|
||||
}
|
||||
Core::App().hideMediaView();
|
||||
Ui::show(Box<InformBox>(tr::lng_group_invite_bad_link(tr::now)));
|
||||
if (const auto strong = weak.get()) {
|
||||
strong->show(
|
||||
Box<InformBox>(tr::lng_group_invite_bad_link(tr::now)));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -151,7 +151,7 @@ void BackgroundBox::prepare() {
|
|||
|
||||
_inner->chooseEvents(
|
||||
) | rpl::start_with_next([=](const Data::WallPaper &paper) {
|
||||
Ui::show(
|
||||
_controller->show(
|
||||
Box<BackgroundPreviewBox>(_controller, paper),
|
||||
Ui::LayerOption::KeepOther);
|
||||
}, _inner->lifetime());
|
||||
|
@ -176,7 +176,7 @@ void BackgroundBox::removePaper(const Data::WallPaper &paper) {
|
|||
paper.mtpSettings()
|
||||
)).send();
|
||||
};
|
||||
Ui::show(
|
||||
_controller->show(
|
||||
Box<ConfirmBox>(
|
||||
tr::lng_background_sure_delete(tr::now),
|
||||
tr::lng_selected_delete(tr::now),
|
||||
|
|
|
@ -769,23 +769,25 @@ bool BackgroundPreviewBox::Start(
|
|||
const QString &slug,
|
||||
const QMap<QString, QString> ¶ms) {
|
||||
if (const auto paper = Data::WallPaper::FromColorSlug(slug)) {
|
||||
Ui::show(Box<BackgroundPreviewBox>(
|
||||
controller->show(Box<BackgroundPreviewBox>(
|
||||
controller,
|
||||
paper->withUrlParams(params)));
|
||||
return true;
|
||||
}
|
||||
if (!IsValidWallPaperSlug(slug)) {
|
||||
Ui::show(Box<InformBox>(tr::lng_background_bad_link(tr::now)));
|
||||
controller->show(
|
||||
Box<InformBox>(tr::lng_background_bad_link(tr::now)));
|
||||
return false;
|
||||
}
|
||||
controller->session().api().requestWallPaper(slug, crl::guard(controller, [=](
|
||||
const Data::WallPaper &result) {
|
||||
Ui::show(Box<BackgroundPreviewBox>(
|
||||
controller->show(Box<BackgroundPreviewBox>(
|
||||
controller,
|
||||
result.withUrlParams(params)));
|
||||
}), [](const MTP::Error &error) {
|
||||
Ui::show(Box<InformBox>(tr::lng_background_bad_link(tr::now)));
|
||||
});
|
||||
}), crl::guard(controller, [=](const MTP::Error &error) {
|
||||
controller->show(
|
||||
Box<InformBox>(tr::lng_background_bad_link(tr::now)));
|
||||
}));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1085,7 +1085,7 @@ object_ptr<Ui::RpWidget> CreatePollBox::setupContent() {
|
|||
send({ .silent = true });
|
||||
};
|
||||
const auto sendScheduled = [=] {
|
||||
Ui::show(
|
||||
_controller->show(
|
||||
HistoryView::PrepareScheduleBox(
|
||||
this,
|
||||
SendMenu::Type::Scheduled,
|
||||
|
|
|
@ -165,7 +165,7 @@ void EditPrivacyBox::editExceptions(
|
|||
}));
|
||||
box->addButton(tr::lng_cancel(), [=] { box->closeBox(); });
|
||||
};
|
||||
Ui::show(
|
||||
_window->show(
|
||||
Box<PeerListBox>(std::move(controller), std::move(initBox)),
|
||||
Ui::LayerOption::KeepOther);
|
||||
}
|
||||
|
|
|
@ -201,8 +201,10 @@ void SaveSlowmodeSeconds(
|
|||
void ShowEditPermissions(
|
||||
not_null<Window::SessionNavigation*> navigation,
|
||||
not_null<PeerData*> peer) {
|
||||
const auto box = Ui::show(
|
||||
Box<EditPeerPermissionsBox>(navigation, peer),
|
||||
auto content = Box<EditPeerPermissionsBox>(navigation, peer);
|
||||
const auto box = QPointer<EditPeerPermissionsBox>(content.data());
|
||||
navigation->parentController()->show(
|
||||
std::move(content),
|
||||
Ui::LayerOption::KeepOther);
|
||||
const auto saving = box->lifetime().make_state<int>(0);
|
||||
const auto save = [=](
|
||||
|
@ -244,8 +246,10 @@ void ShowEditPermissions(
|
|||
void ShowEditInviteLinks(
|
||||
not_null<Window::SessionNavigation*> navigation,
|
||||
not_null<PeerData*> peer) {
|
||||
const auto box = Ui::show(
|
||||
Box<EditPeerPermissionsBox>(navigation, peer),
|
||||
auto content = Box<EditPeerPermissionsBox>(navigation, peer);
|
||||
const auto box = QPointer<EditPeerPermissionsBox>(content.data());
|
||||
navigation->parentController()->show(
|
||||
std::move(content),
|
||||
Ui::LayerOption::KeepOther);
|
||||
const auto saving = box->lifetime().make_state<int>(0);
|
||||
const auto save = [=](
|
||||
|
@ -612,7 +616,7 @@ object_ptr<Ui::RpWidget> Controller::createStickersEdit() {
|
|||
tr::lng_group_stickers_add(tr::now),
|
||||
st::editPeerInviteLinkButton)
|
||||
)->addClickHandler([=] {
|
||||
Ui::show(
|
||||
_navigation->parentController()->show(
|
||||
Box<StickersBox>(_navigation->parentController(), channel),
|
||||
Ui::LayerOption::KeepOther);
|
||||
});
|
||||
|
@ -649,7 +653,7 @@ void Controller::showEditPeerTypeBox(
|
|||
_usernameSavedValue = publicLink;
|
||||
refreshHistoryVisibility();
|
||||
});
|
||||
Ui::show(
|
||||
_navigation->parentController()->show(
|
||||
Box<EditPeerTypeBox>(
|
||||
_peer,
|
||||
_channelHasLocationOriginalValue,
|
||||
|
@ -681,7 +685,7 @@ void Controller::showEditLinkedChatBox() {
|
|||
|| channel->canEditPreHistoryHidden()));
|
||||
|
||||
if (const auto chat = *_linkedChatSavedValue) {
|
||||
*box = Ui::show(
|
||||
*box = _navigation->parentController()->show(
|
||||
EditLinkedChatBox(
|
||||
_navigation,
|
||||
channel,
|
||||
|
@ -709,7 +713,7 @@ void Controller::showEditLinkedChatBox() {
|
|||
for (const auto &item : list) {
|
||||
chats.emplace_back(_peer->owner().processChat(item));
|
||||
}
|
||||
*box = Ui::show(
|
||||
*box = _navigation->parentController()->show(
|
||||
EditLinkedChatBox(
|
||||
_navigation,
|
||||
channel,
|
||||
|
@ -858,7 +862,7 @@ void Controller::fillHistoryVisibilityButton() {
|
|||
_historyVisibilitySavedValue = checked;
|
||||
});
|
||||
const auto buttonCallback = [=] {
|
||||
Ui::show(
|
||||
_navigation->parentController()->show(
|
||||
Box<EditPeerHistoryVisibilityBox>(
|
||||
_peer,
|
||||
boxCallback,
|
||||
|
@ -1023,9 +1027,15 @@ void Controller::fillManageSection() {
|
|||
wrap->entity(),
|
||||
tr::lng_manage_peer_invite_links(),
|
||||
rpl::duplicate(count) | ToPositiveNumberString(),
|
||||
[=] { Ui::show(
|
||||
Box(ManageInviteLinksBox, _peer, _peer->session().user(), 0, 0),
|
||||
Ui::LayerOption::KeepOther);
|
||||
[=] {
|
||||
_navigation->parentController()->show(
|
||||
Box(
|
||||
ManageInviteLinksBox,
|
||||
_peer,
|
||||
_peer->session().user(),
|
||||
0,
|
||||
0),
|
||||
Ui::LayerOption::KeepOther);
|
||||
},
|
||||
st::infoIconInviteLinks);
|
||||
|
||||
|
@ -1520,7 +1530,7 @@ void Controller::deleteWithConfirmation() {
|
|||
const auto deleteCallback = crl::guard(this, [=] {
|
||||
deleteChannel();
|
||||
});
|
||||
Ui::show(
|
||||
_navigation->parentController()->show(
|
||||
Box<ConfirmBox>(
|
||||
text,
|
||||
tr::lng_box_delete(tr::now),
|
||||
|
|
|
@ -1002,7 +1002,7 @@ void SendFilesBox::sendScheduled() {
|
|||
? SendMenu::Type::ScheduledToUser
|
||||
: _sendMenuType;
|
||||
const auto callback = [=](Api::SendOptions options) { send(options); };
|
||||
Ui::show(
|
||||
_controller->show(
|
||||
HistoryView::PrepareScheduleBox(this, type, callback),
|
||||
Ui::LayerOption::KeepOther);
|
||||
}
|
||||
|
|
|
@ -153,7 +153,7 @@ QPointer<Ui::BoxContent> StickerSetBox::Show(
|
|||
not_null<DocumentData*> document) {
|
||||
if (const auto sticker = document->sticker()) {
|
||||
if (sticker->set.type() != mtpc_inputStickerSetEmpty) {
|
||||
return Ui::show(
|
||||
return controller->show(
|
||||
Box<StickerSetBox>(controller, sticker->set),
|
||||
Ui::LayerOption::KeepOther).data();
|
||||
}
|
||||
|
@ -324,7 +324,7 @@ StickerSetBox::Inner::Inner(
|
|||
gotSet(result);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_loaded = true;
|
||||
Ui::show(Box<InformBox>(tr::lng_stickers_not_found(tr::now)));
|
||||
controller->show(Box<InformBox>(tr::lng_stickers_not_found(tr::now)));
|
||||
}).send();
|
||||
|
||||
_controller->session().api().updateStickers();
|
||||
|
@ -419,7 +419,8 @@ void StickerSetBox::Inner::gotSet(const MTPmessages_StickerSet &set) {
|
|||
});
|
||||
|
||||
if (_pack.isEmpty()) {
|
||||
Ui::show(Box<InformBox>(tr::lng_stickers_not_found(tr::now)));
|
||||
_controller->show(
|
||||
Box<InformBox>(tr::lng_stickers_not_found(tr::now)));
|
||||
return;
|
||||
} else {
|
||||
int32 rows = _pack.size() / kStickersPanelPerRow + ((_pack.size() % kStickersPanelPerRow) ? 1 : 0);
|
||||
|
@ -795,7 +796,7 @@ QString StickerSetBox::Inner::shortName() const {
|
|||
|
||||
void StickerSetBox::Inner::install() {
|
||||
if (isMasksSet()) {
|
||||
Ui::show(
|
||||
_controller->show(
|
||||
Box<InformBox>(tr::lng_stickers_masks_pack(tr::now)),
|
||||
Ui::LayerOption::KeepOther);
|
||||
return;
|
||||
|
@ -808,7 +809,8 @@ void StickerSetBox::Inner::install() {
|
|||
)).done([=](const MTPmessages_StickerSetInstallResult &result) {
|
||||
installDone(result);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
Ui::show(Box<InformBox>(tr::lng_stickers_not_found(tr::now)));
|
||||
_controller->show(
|
||||
Box<InformBox>(tr::lng_stickers_not_found(tr::now)));
|
||||
}).send();
|
||||
}
|
||||
|
||||
|
|
|
@ -1592,7 +1592,7 @@ void StickersBox::Inner::mouseReleaseEvent(QMouseEvent *e) {
|
|||
}();
|
||||
const auto showSetByRow = [&](const Row &row) {
|
||||
setSelected(SelectedRow());
|
||||
Ui::show(
|
||||
_controller->show(
|
||||
Box<StickerSetBox>(_controller, row.set->mtpInput()),
|
||||
Ui::LayerOption::KeepOther);
|
||||
};
|
||||
|
|
|
@ -357,7 +357,7 @@ base::unique_qptr<Ui::PopupMenu> BoxController::rowContextMenu(
|
|||
|
||||
auto result = base::make_unique_q<Ui::PopupMenu>(parent);
|
||||
result->addAction(tr::lng_context_delete_selected(tr::now), [=] {
|
||||
Ui::show(
|
||||
_window->show(
|
||||
Box<DeleteMessagesBox>(session, base::duplicate(ids)),
|
||||
Ui::LayerOption::KeepOther);
|
||||
});
|
||||
|
|
|
@ -281,7 +281,7 @@ Fn<bool(
|
|||
return Ui::InputField::IsValidMarkdownLink(link)
|
||||
&& !TextUtilities::IsMentionLink(link);
|
||||
}
|
||||
Ui::show(Box<EditLinkBox>(controller, text, link, [=](
|
||||
controller->show(Box<EditLinkBox>(controller, text, link, [=](
|
||||
const QString &text,
|
||||
const QString &link) {
|
||||
if (const auto strong = weak.data()) {
|
||||
|
@ -321,7 +321,9 @@ void InitSpellchecker(
|
|||
Core::App().settings().spellcheckerEnabledValue(),
|
||||
Spellchecker::SpellingHighlighter::CustomContextMenuItem{
|
||||
tr::lng_settings_manage_dictionaries(tr::now),
|
||||
[=] { Ui::show(Box<Ui::ManageDictionariesBox>(controller)); }
|
||||
[=] {
|
||||
controller->show(Box<Ui::ManageDictionariesBox>(controller));
|
||||
}
|
||||
});
|
||||
field->setExtendedContextMenu(s->contextMenuCreated());
|
||||
#endif // TDESKTOP_DISABLE_SPELLCHECK
|
||||
|
|
|
@ -534,7 +534,7 @@ void StickersListWidget::Footer::mousePressEvent(QMouseEvent *e) {
|
|||
updateSelected();
|
||||
|
||||
if (_iconOver == SpecialOver::Settings) {
|
||||
Ui::show(Box<StickersBox>(
|
||||
_pan->controller()->show(Box<StickersBox>(
|
||||
_pan->controller(),
|
||||
(hasOnlyFeaturedSets()
|
||||
? StickersBox::Section::Featured
|
||||
|
@ -909,7 +909,7 @@ StickersListWidget::StickersListWidget(
|
|||
setAttribute(Qt::WA_OpaquePaintEvent);
|
||||
|
||||
_settings->addClickHandler([=] {
|
||||
Ui::show(
|
||||
controller->show(
|
||||
Box<StickersBox>(controller, StickersBox::Section::Installed));
|
||||
});
|
||||
|
||||
|
@ -2185,7 +2185,7 @@ void StickersListWidget::mouseReleaseEvent(QMouseEvent *e) {
|
|||
removeSet(sets[button->section].id);
|
||||
}
|
||||
} else if (std::get_if<OverGroupAdd>(&pressed)) {
|
||||
Ui::show(Box<StickersBox>(controller(), _megagroupSet));
|
||||
controller()->show(Box<StickersBox>(controller(), _megagroupSet));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3005,7 +3005,7 @@ void StickersListWidget::displaySet(uint64 setId) {
|
|||
if (setId == Data::Stickers::MegagroupSetId) {
|
||||
if (_megagroupSet->canEditStickers()) {
|
||||
_displayingSet = true;
|
||||
checkHideWithBox(Ui::show(
|
||||
checkHideWithBox(controller()->show(
|
||||
Box<StickersBox>(controller(), _megagroupSet),
|
||||
Ui::LayerOption::KeepOther).data());
|
||||
return;
|
||||
|
@ -3019,7 +3019,7 @@ void StickersListWidget::displaySet(uint64 setId) {
|
|||
auto it = sets.find(setId);
|
||||
if (it != sets.cend()) {
|
||||
_displayingSet = true;
|
||||
checkHideWithBox(Ui::show(
|
||||
checkHideWithBox(controller()->show(
|
||||
Box<StickerSetBox>(controller(), it->second->mtpInput()),
|
||||
Ui::LayerOption::KeepOther).data());
|
||||
}
|
||||
|
@ -3083,7 +3083,7 @@ void StickersListWidget::removeMegagroupSet(bool locally) {
|
|||
return;
|
||||
}
|
||||
_removingSetId = Data::Stickers::MegagroupSetId;
|
||||
Ui::show(Box<ConfirmBox>(tr::lng_stickers_remove_group_set(tr::now), crl::guard(this, [this, group = _megagroupSet] {
|
||||
controller()->show(Box<ConfirmBox>(tr::lng_stickers_remove_group_set(tr::now), crl::guard(this, [this, group = _megagroupSet] {
|
||||
Expects(group->mgInfo != nullptr);
|
||||
|
||||
if (group->mgInfo->stickerSet.type() != mtpc_inputStickerSetEmpty) {
|
||||
|
@ -3105,7 +3105,7 @@ void StickersListWidget::removeSet(uint64 setId) {
|
|||
const auto set = it->second.get();
|
||||
_removingSetId = set->id;
|
||||
auto text = tr::lng_stickers_remove_pack(tr::now, lt_sticker_pack, set->title);
|
||||
Ui::show(Box<ConfirmBox>(text, tr::lng_stickers_remove_pack_confirm(tr::now), crl::guard(this, [=] {
|
||||
controller()->show(Box<ConfirmBox>(text, tr::lng_stickers_remove_pack_confirm(tr::now), crl::guard(this, [=] {
|
||||
Ui::hideLayer();
|
||||
const auto &sets = session().data().stickers().sets();
|
||||
const auto it = sets.find(_removingSetId);
|
||||
|
|
|
@ -68,7 +68,7 @@ bool ShowStickerSet(
|
|||
return false;
|
||||
}
|
||||
Core::App().hideMediaView();
|
||||
Ui::show(Box<StickerSetBox>(
|
||||
controller->show(Box<StickerSetBox>(
|
||||
controller,
|
||||
MTP_inputStickerSetShortName(MTP_string(match->captured(1)))));
|
||||
return true;
|
||||
|
@ -368,7 +368,7 @@ bool ResolveSettings(
|
|||
}
|
||||
if (section == qstr("devices")) {
|
||||
controller->session().api().authorizations().reload();
|
||||
Ui::show(Box<SessionsBox>(&controller->session()));
|
||||
controller->show(Box<SessionsBox>(&controller->session()));
|
||||
return true;
|
||||
} else if (section == qstr("language")) {
|
||||
ShowLanguagesBox();
|
||||
|
@ -401,12 +401,12 @@ bool HandleUnknown(
|
|||
Core::UpdateApplication();
|
||||
close();
|
||||
};
|
||||
Ui::show(Box<ConfirmBox>(
|
||||
controller->show(Box<ConfirmBox>(
|
||||
text,
|
||||
tr::lng_menu_update(tr::now),
|
||||
callback));
|
||||
} else {
|
||||
Ui::show(Box<InformBox>(text));
|
||||
controller->show(Box<InformBox>(text));
|
||||
}
|
||||
});
|
||||
controller->session().api().requestDeepLinkInfo(request, callback);
|
||||
|
|
|
@ -3192,7 +3192,7 @@ void InnerWidget::setupShortcuts() {
|
|||
});
|
||||
|
||||
request->check(Command::ShowContacts) && request->handle([=] {
|
||||
Ui::show(PrepareContactsBox(_controller));
|
||||
_controller->show(PrepareContactsBox(_controller));
|
||||
return true;
|
||||
});
|
||||
|
||||
|
|
|
@ -478,7 +478,8 @@ void InnerWidget::showFilter(Fn<void(FilterValue &&filter)> callback) {
|
|||
if (_admins.empty()) {
|
||||
_showFilterCallback = std::move(callback);
|
||||
} else {
|
||||
Ui::show(Box<FilterBox>(_channel, _admins, _filter, std::move(callback)));
|
||||
_controller->show(
|
||||
Box<FilterBox>(_channel, _admins, _filter, std::move(callback)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1317,7 +1318,8 @@ void InnerWidget::suggestRestrictUser(not_null<UserData*> user) {
|
|||
(*weakBox)->closeBox();
|
||||
}
|
||||
});
|
||||
*weakBox = Ui::show(
|
||||
*weakBox = QPointer<EditRestrictedBox>(box.data());
|
||||
_controller->show(
|
||||
std::move(box),
|
||||
Ui::LayerOption::KeepOther);
|
||||
};
|
||||
|
|
|
@ -326,7 +326,7 @@ Widget::Widget(
|
|||
connect(_scroll, &Ui::ScrollArea::scrolled, this, [this] { onScroll(); });
|
||||
|
||||
_whatIsThis->setClickedCallback([=] {
|
||||
Ui::show(Box<InformBox>(channel->isMegagroup()
|
||||
controller->show(Box<InformBox>(channel->isMegagroup()
|
||||
? tr::lng_admin_log_about_text(tr::now)
|
||||
: tr::lng_admin_log_about_text_channel(tr::now)));
|
||||
});
|
||||
|
|
|
@ -3226,7 +3226,7 @@ void HistoryInner::deleteItem(not_null<HistoryItem*> item) {
|
|||
}
|
||||
}
|
||||
const auto suggestModerateActions = true;
|
||||
Ui::show(Box<DeleteMessagesBox>(item, suggestModerateActions));
|
||||
_controller->show(Box<DeleteMessagesBox>(item, suggestModerateActions));
|
||||
}
|
||||
|
||||
bool HistoryInner::hasPendingResizedItems() const {
|
||||
|
@ -3240,7 +3240,7 @@ void HistoryInner::deleteAsGroup(FullMsgId itemId) {
|
|||
if (!group) {
|
||||
return deleteItem(item);
|
||||
}
|
||||
Ui::show(Box<DeleteMessagesBox>(
|
||||
_controller->show(Box<DeleteMessagesBox>(
|
||||
&session(),
|
||||
session().data().itemsToIds(group->items)));
|
||||
}
|
||||
|
@ -3263,7 +3263,7 @@ void HistoryInner::reportAsGroup(FullMsgId itemId) {
|
|||
|
||||
void HistoryInner::blockSenderItem(FullMsgId itemId) {
|
||||
if (const auto item = session().data().message(itemId)) {
|
||||
Ui::show(Box(
|
||||
_controller->show(Box(
|
||||
Window::BlockSenderFromRepliesBox,
|
||||
_controller,
|
||||
itemId));
|
||||
|
|
|
@ -627,7 +627,7 @@ HistoryWidget::HistoryWidget(
|
|||
const auto unavailable = _peer->computeUnavailableReason();
|
||||
if (!unavailable.isEmpty()) {
|
||||
controller->showBackFromStack();
|
||||
Ui::show(Box<InformBox>(unavailable));
|
||||
controller->show(Box<InformBox>(unavailable));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -791,7 +791,7 @@ void HistoryWidget::initVoiceRecordBar() {
|
|||
? Data::RestrictionError(_peer, ChatRestriction::f_send_media)
|
||||
: std::nullopt;
|
||||
if (error) {
|
||||
Ui::show(Box<InformBox>(*error));
|
||||
controller()->show(Box<InformBox>(*error));
|
||||
return true;
|
||||
} else if (showSlowmodeError()) {
|
||||
return true;
|
||||
|
@ -948,7 +948,7 @@ void HistoryWidget::supportShareContact(Support::Contact contact) {
|
|||
contact.lastName,
|
||||
action);
|
||||
};
|
||||
const auto box = Ui::show(Box<Support::ConfirmContactBox>(
|
||||
const auto box = controller()->show(Box<Support::ConfirmContactBox>(
|
||||
controller(),
|
||||
_history,
|
||||
contact,
|
||||
|
@ -3089,10 +3089,11 @@ void HistoryWidget::saveEditMsg() {
|
|||
|
||||
if (!TextUtilities::CutPart(sending, left, MaxMessageSize)) {
|
||||
const auto suggestModerateActions = false;
|
||||
Ui::show(Box<DeleteMessagesBox>(item, suggestModerateActions));
|
||||
controller()->show(
|
||||
Box<DeleteMessagesBox>(item, suggestModerateActions));
|
||||
return;
|
||||
} else if (!left.text.isEmpty()) {
|
||||
Ui::show(Box<InformBox>(tr::lng_edit_too_long(tr::now)));
|
||||
controller()->show(Box<InformBox>(tr::lng_edit_too_long(tr::now)));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3126,14 +3127,16 @@ void HistoryWidget::saveEditMsg() {
|
|||
}
|
||||
const auto &err = error.type();
|
||||
if (ranges::contains(Api::kDefaultEditMessagesErrors, err)) {
|
||||
Ui::show(Box<InformBox>(tr::lng_edit_error(tr::now)));
|
||||
controller()->show(
|
||||
Box<InformBox>(tr::lng_edit_error(tr::now)));
|
||||
} else if (err == u"MESSAGE_NOT_MODIFIED"_q) {
|
||||
cancelEdit();
|
||||
} else if (err == u"MESSAGE_EMPTY"_q) {
|
||||
_field->selectAll();
|
||||
_field->setFocus();
|
||||
} else {
|
||||
Ui::show(Box<InformBox>(tr::lng_edit_error(tr::now)));
|
||||
controller()->show(
|
||||
Box<InformBox>(tr::lng_edit_error(tr::now)));
|
||||
}
|
||||
update();
|
||||
})();
|
||||
|
@ -3256,7 +3259,7 @@ void HistoryWidget::sendScheduled() {
|
|||
return;
|
||||
}
|
||||
const auto callback = [=](Api::SendOptions options) { send(options); };
|
||||
Ui::show(
|
||||
controller()->show(
|
||||
HistoryView::PrepareScheduleBox(_list, sendMenuType(), callback),
|
||||
Ui::LayerOption::KeepOther);
|
||||
}
|
||||
|
@ -3470,7 +3473,7 @@ void HistoryWidget::checkSuggestToGigagroup() {
|
|||
group->input,
|
||||
MTP_string("convert_to_gigagroup")
|
||||
)).send();
|
||||
Ui::show(Box([=](not_null<Ui::GenericBox*> box) {
|
||||
controller()->show(Box([=](not_null<Ui::GenericBox*> box) {
|
||||
box->setTitle(tr::lng_gigagroup_suggest_title());
|
||||
box->addRow(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
|
@ -3508,7 +3511,8 @@ void HistoryWidget::unreadMentionsAnimationFinish() {
|
|||
|
||||
void HistoryWidget::chooseAttach() {
|
||||
if (_editMsgId) {
|
||||
Ui::show(Box<InformBox>(tr::lng_edit_caption_attach(tr::now)));
|
||||
controller()->show(
|
||||
Box<InformBox>(tr::lng_edit_caption_attach(tr::now)));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4335,7 +4339,8 @@ bool HistoryWidget::confirmSendingFiles(
|
|||
return false;
|
||||
}
|
||||
if (_editMsgId) {
|
||||
Ui::show(Box<InformBox>(tr::lng_edit_caption_attach(tr::now)));
|
||||
controller()->show(
|
||||
Box<InformBox>(tr::lng_edit_caption_attach(tr::now)));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -4379,7 +4384,7 @@ bool HistoryWidget::confirmSendingFiles(
|
|||
}));
|
||||
|
||||
Window::ActivateWindow(controller());
|
||||
const auto shown = Ui::show(std::move(box));
|
||||
const auto shown = controller()->show(std::move(box));
|
||||
shown->setCloseByOutsideClick(false);
|
||||
|
||||
return true;
|
||||
|
@ -5330,7 +5335,7 @@ void HistoryWidget::sendInlineResult(InlineBots::ResultSelected result) {
|
|||
|
||||
auto errorText = result.result->getErrorOnSend(_history);
|
||||
if (!errorText.isEmpty()) {
|
||||
Ui::show(Box<InformBox>(errorText));
|
||||
controller()->show(Box<InformBox>(errorText));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -5664,7 +5669,9 @@ bool HistoryWidget::sendExistingDocument(
|
|||
? Data::RestrictionError(_peer, ChatRestriction::f_send_stickers)
|
||||
: std::nullopt;
|
||||
if (error) {
|
||||
Ui::show(Box<InformBox>(*error), Ui::LayerOption::KeepOther);
|
||||
controller()->show(
|
||||
Box<InformBox>(*error),
|
||||
Ui::LayerOption::KeepOther);
|
||||
return false;
|
||||
} else if (!_peer || !_peer->canWrite()) {
|
||||
return false;
|
||||
|
@ -5698,7 +5705,9 @@ bool HistoryWidget::sendExistingPhoto(
|
|||
? Data::RestrictionError(_peer, ChatRestriction::f_send_media)
|
||||
: std::nullopt;
|
||||
if (error) {
|
||||
Ui::show(Box<InformBox>(*error), Ui::LayerOption::KeepOther);
|
||||
controller()->show(
|
||||
Box<InformBox>(*error),
|
||||
Ui::LayerOption::KeepOther);
|
||||
return false;
|
||||
} else if (!_peer || !_peer->canWrite()) {
|
||||
return false;
|
||||
|
@ -5782,14 +5791,18 @@ void HistoryWidget::replyToMessage(not_null<HistoryItem*> item) {
|
|||
}
|
||||
if (item->history() == _migrated) {
|
||||
if (item->serviceMsg()) {
|
||||
Ui::show(Box<InformBox>(tr::lng_reply_cant(tr::now)));
|
||||
controller()->show(Box<InformBox>(tr::lng_reply_cant(tr::now)));
|
||||
} else {
|
||||
const auto itemId = item->fullId();
|
||||
Ui::show(Box<ConfirmBox>(tr::lng_reply_cant_forward(tr::now), tr::lng_selected_forward(tr::now), crl::guard(this, [=] {
|
||||
controller()->content()->setForwardDraft(
|
||||
_peer->id,
|
||||
{ 1, itemId });
|
||||
})));
|
||||
controller()->show(
|
||||
Box<ConfirmBox>(
|
||||
tr::lng_reply_cant_forward(tr::now),
|
||||
tr::lng_selected_forward(tr::now),
|
||||
crl::guard(this, [=] {
|
||||
controller()->content()->setForwardDraft(
|
||||
_peer->id,
|
||||
{ 1, itemId });
|
||||
})));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -5832,12 +5845,13 @@ void HistoryWidget::editMessage(FullMsgId itemId) {
|
|||
|
||||
void HistoryWidget::editMessage(not_null<HistoryItem*> item) {
|
||||
if (_voiceRecordBar->isActive()) {
|
||||
Ui::show(Box<InformBox>(tr::lng_edit_caption_voice(tr::now)));
|
||||
controller()->show(
|
||||
Box<InformBox>(tr::lng_edit_caption_voice(tr::now)));
|
||||
return;
|
||||
}
|
||||
if (const auto media = item->media()) {
|
||||
if (media->allowsEditCaption()) {
|
||||
Ui::show(Box<EditCaptionBox>(controller(), item));
|
||||
controller()->show(Box<EditCaptionBox>(controller(), item));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -6283,14 +6297,13 @@ void HistoryWidget::confirmDeleteSelected() {
|
|||
return;
|
||||
}
|
||||
const auto weak = Ui::MakeWeak(this);
|
||||
const auto box = Ui::show(Box<DeleteMessagesBox>(
|
||||
&session(),
|
||||
std::move(items)));
|
||||
auto box = Box<DeleteMessagesBox>(&session(), std::move(items));
|
||||
box->setDeleteConfirmedCallback([=] {
|
||||
if (const auto strong = weak.data()) {
|
||||
strong->clearSelected();
|
||||
}
|
||||
});
|
||||
controller()->show(std::move(box));
|
||||
}
|
||||
|
||||
void HistoryWidget::escape() {
|
||||
|
@ -6303,7 +6316,7 @@ void HistoryWidget::escape() {
|
|||
} else if (_editMsgId) {
|
||||
if (_replyEditMsg
|
||||
&& PrepareEditText(_replyEditMsg) != _field->getTextWithTags()) {
|
||||
Ui::show(Box<ConfirmBox>(
|
||||
controller()->show(Box<ConfirmBox>(
|
||||
tr::lng_cancel_edit_post_sure(tr::now),
|
||||
tr::lng_cancel_edit_post_yes(tr::now),
|
||||
tr::lng_cancel_edit_post_no(tr::now),
|
||||
|
|
|
@ -795,7 +795,8 @@ rpl::producer<> ComposeControls::attachRequests() const {
|
|||
_attachRequests.events()
|
||||
) | rpl::filter([=] {
|
||||
if (isEditingMessage()) {
|
||||
Ui::show(Box<InformBox>(tr::lng_edit_caption_attach(tr::now)));
|
||||
_window->show(
|
||||
Box<InformBox>(tr::lng_edit_caption_attach(tr::now)));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -1655,7 +1656,7 @@ void ComposeControls::initVoiceRecordBar() {
|
|||
ChatRestriction::f_send_media)
|
||||
: std::nullopt;
|
||||
if (error) {
|
||||
Ui::show(Box<InformBox>(*error));
|
||||
_window->show(Box<InformBox>(*error));
|
||||
return true;
|
||||
} else if (_showSlowmodeError && _showSlowmodeError()) {
|
||||
return true;
|
||||
|
@ -1954,7 +1955,7 @@ void ComposeControls::editMessage(not_null<HistoryItem*> item) {
|
|||
Expects(draftKeyCurrent() != Data::DraftKey::None());
|
||||
|
||||
if (_voiceRecordBar->isActive()) {
|
||||
Ui::show(Box<InformBox>(tr::lng_edit_caption_voice(tr::now)));
|
||||
_window->show(Box<InformBox>(tr::lng_edit_caption_voice(tr::now)));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1638,7 +1638,7 @@ void VoiceRecordBar::showDiscardBox(
|
|||
callback();
|
||||
}
|
||||
};
|
||||
Ui::show(Box<ConfirmBox>(
|
||||
_controller->show(Box<ConfirmBox>(
|
||||
(isListenState()
|
||||
? tr::lng_record_listen_cancel_sure
|
||||
: tr::lng_record_lock_cancel_sure)(tr::now),
|
||||
|
|
|
@ -508,7 +508,7 @@ bool AddRescheduleAction(
|
|||
? HistoryView::DefaultScheduleTime()
|
||||
: itemDate + 600;
|
||||
|
||||
const auto box = Ui::show(
|
||||
const auto box = request.navigation->parentController()->show(
|
||||
HistoryView::PrepareScheduleBox(
|
||||
&request.navigation->session(),
|
||||
sendMenuType,
|
||||
|
@ -676,14 +676,15 @@ bool AddDeleteSelectedAction(
|
|||
menu->addAction(tr::lng_context_delete_selected(tr::now), [=] {
|
||||
const auto weak = Ui::MakeWeak(list);
|
||||
auto items = ExtractIdsList(request.selectedItems);
|
||||
const auto box = Ui::show(Box<DeleteMessagesBox>(
|
||||
auto box = Box<DeleteMessagesBox>(
|
||||
&request.navigation->session(),
|
||||
std::move(items)));
|
||||
std::move(items));
|
||||
box->setDeleteConfirmedCallback([=] {
|
||||
if (const auto strong = weak.data()) {
|
||||
strong->cancelSelection();
|
||||
}
|
||||
});
|
||||
request.navigation->parentController()->show(std::move(box));
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
@ -716,7 +717,7 @@ bool AddDeleteMessageAction(
|
|||
if (const auto item = owner->message(itemId)) {
|
||||
if (asGroup) {
|
||||
if (const auto group = owner->groups().find(item)) {
|
||||
Ui::show(Box<DeleteMessagesBox>(
|
||||
controller->show(Box<DeleteMessagesBox>(
|
||||
&owner->session(),
|
||||
owner->itemsToIds(group->items)));
|
||||
return;
|
||||
|
@ -729,7 +730,8 @@ bool AddDeleteMessageAction(
|
|||
}
|
||||
}
|
||||
const auto suggestModerateActions = true;
|
||||
Ui::show(Box<DeleteMessagesBox>(item, suggestModerateActions));
|
||||
controller->show(
|
||||
Box<DeleteMessagesBox>(item, suggestModerateActions));
|
||||
}
|
||||
});
|
||||
if (const auto message = item->toHistoryMessage()) {
|
||||
|
|
|
@ -2826,14 +2826,15 @@ void ConfirmDeleteSelectedItems(not_null<ListWidget*> widget) {
|
|||
}
|
||||
}
|
||||
const auto weak = Ui::MakeWeak(widget);
|
||||
const auto box = Ui::show(Box<DeleteMessagesBox>(
|
||||
auto box = Box<DeleteMessagesBox>(
|
||||
&widget->controller()->session(),
|
||||
widget->getSelectedIds()));
|
||||
widget->getSelectedIds());
|
||||
box->setDeleteConfirmedCallback([=] {
|
||||
if (const auto strong = weak.data()) {
|
||||
strong->cancelSelection();
|
||||
}
|
||||
});
|
||||
widget->controller()->show(std::move(box));
|
||||
}
|
||||
|
||||
void ConfirmForwardSelectedItems(not_null<ListWidget*> widget) {
|
||||
|
|
|
@ -215,7 +215,7 @@ RepliesWidget::RepliesWidget(
|
|||
const auto media = item->media();
|
||||
if (media && !media->webpage()) {
|
||||
if (media->allowsEditCaption()) {
|
||||
Ui::show(Box<EditCaptionBox>(controller, item));
|
||||
controller->show(Box<EditCaptionBox>(controller, item));
|
||||
}
|
||||
} else {
|
||||
_composeControls->editMessage(fullId);
|
||||
|
@ -655,7 +655,7 @@ bool RepliesWidget::confirmSendingFiles(
|
|||
insertTextOnCancel));
|
||||
|
||||
//ActivateWindow(controller());
|
||||
const auto shown = Ui::show(std::move(box));
|
||||
const auto shown = controller()->show(std::move(box));
|
||||
shown->setCloseByOutsideClick(false);
|
||||
|
||||
return true;
|
||||
|
@ -945,13 +945,13 @@ void RepliesWidget::edit(
|
|||
|
||||
if (!TextUtilities::CutPart(sending, left, MaxMessageSize)) {
|
||||
if (item) {
|
||||
Ui::show(Box<DeleteMessagesBox>(item, false));
|
||||
controller()->show(Box<DeleteMessagesBox>(item, false));
|
||||
} else {
|
||||
doSetInnerFocus();
|
||||
}
|
||||
return;
|
||||
} else if (!left.text.isEmpty()) {
|
||||
Ui::show(Box<InformBox>(tr::lng_edit_too_long(tr::now)));
|
||||
controller()->show(Box<InformBox>(tr::lng_edit_too_long(tr::now)));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -976,13 +976,13 @@ void RepliesWidget::edit(
|
|||
|
||||
const auto &err = error.type();
|
||||
if (ranges::contains(Api::kDefaultEditMessagesErrors, err)) {
|
||||
Ui::show(Box<InformBox>(tr::lng_edit_error(tr::now)));
|
||||
controller()->show(Box<InformBox>(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 {
|
||||
Ui::show(Box<InformBox>(tr::lng_edit_error(tr::now)));
|
||||
controller()->show(Box<InformBox>(tr::lng_edit_error(tr::now)));
|
||||
}
|
||||
update();
|
||||
return true;
|
||||
|
@ -1018,7 +1018,9 @@ bool RepliesWidget::sendExistingDocument(
|
|||
_history->peer,
|
||||
ChatRestriction::f_send_stickers);
|
||||
if (error) {
|
||||
Ui::show(Box<InformBox>(*error), Ui::LayerOption::KeepOther);
|
||||
controller()->show(
|
||||
Box<InformBox>(*error),
|
||||
Ui::LayerOption::KeepOther);
|
||||
return false;
|
||||
} else if (showSlowmodeError()) {
|
||||
return false;
|
||||
|
@ -1052,7 +1054,9 @@ bool RepliesWidget::sendExistingPhoto(
|
|||
_history->peer,
|
||||
ChatRestriction::f_send_media);
|
||||
if (error) {
|
||||
Ui::show(Box<InformBox>(*error), Ui::LayerOption::KeepOther);
|
||||
controller()->show(
|
||||
Box<InformBox>(*error),
|
||||
Ui::LayerOption::KeepOther);
|
||||
return false;
|
||||
} else if (showSlowmodeError()) {
|
||||
return false;
|
||||
|
@ -1073,7 +1077,7 @@ void RepliesWidget::sendInlineResult(
|
|||
not_null<UserData*> bot) {
|
||||
const auto errorText = result->getErrorOnSend(_history);
|
||||
if (!errorText.isEmpty()) {
|
||||
Ui::show(Box<InformBox>(errorText));
|
||||
controller()->show(Box<InformBox>(errorText));
|
||||
return;
|
||||
}
|
||||
sendInlineResult(result, bot, Api::SendOptions());
|
||||
|
|
|
@ -148,7 +148,7 @@ ScheduledWidget::ScheduledWidget(
|
|||
const auto media = item->media();
|
||||
if (media && !media->webpage()) {
|
||||
if (media->allowsEditCaption()) {
|
||||
Ui::show(Box<EditCaptionBox>(controller, item));
|
||||
controller->show(Box<EditCaptionBox>(controller, item));
|
||||
}
|
||||
} else {
|
||||
_composeControls->editMessage(fullId);
|
||||
|
@ -384,7 +384,7 @@ bool ScheduledWidget::confirmSendingFiles(
|
|||
insertTextOnCancel));
|
||||
|
||||
//ActivateWindow(controller());
|
||||
const auto shown = Ui::show(std::move(box));
|
||||
const auto shown = controller()->show(std::move(box));
|
||||
shown->setCloseByOutsideClick(false);
|
||||
|
||||
return true;
|
||||
|
@ -454,7 +454,7 @@ void ScheduledWidget::uploadFile(
|
|||
action.options = options;
|
||||
session().api().sendFile(fileContent, type, action);
|
||||
};
|
||||
Ui::show(
|
||||
controller()->show(
|
||||
PrepareScheduleBox(this, sendMenuType(), callback),
|
||||
Ui::LayerOption::KeepOther);
|
||||
}
|
||||
|
@ -499,7 +499,7 @@ void ScheduledWidget::send() {
|
|||
return;
|
||||
}
|
||||
const auto callback = [=](Api::SendOptions options) { send(options); };
|
||||
Ui::show(
|
||||
controller()->show(
|
||||
PrepareScheduleBox(this, sendMenuType(), callback),
|
||||
Ui::LayerOption::KeepOther);
|
||||
}
|
||||
|
@ -544,7 +544,7 @@ void ScheduledWidget::sendVoice(
|
|||
const auto callback = [=](Api::SendOptions options) {
|
||||
sendVoice(bytes, waveform, duration, options);
|
||||
};
|
||||
Ui::show(
|
||||
controller()->show(
|
||||
PrepareScheduleBox(this, sendMenuType(), callback),
|
||||
Ui::LayerOption::KeepOther);
|
||||
}
|
||||
|
@ -579,13 +579,13 @@ void ScheduledWidget::edit(
|
|||
|
||||
if (!TextUtilities::CutPart(sending, left, MaxMessageSize)) {
|
||||
if (item) {
|
||||
Ui::show(Box<DeleteMessagesBox>(item, false));
|
||||
controller()->show(Box<DeleteMessagesBox>(item, false));
|
||||
} else {
|
||||
_composeControls->focus();
|
||||
}
|
||||
return;
|
||||
} else if (!left.text.isEmpty()) {
|
||||
Ui::show(Box<InformBox>(tr::lng_edit_too_long(tr::now)));
|
||||
controller()->show(Box<InformBox>(tr::lng_edit_too_long(tr::now)));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -610,13 +610,13 @@ void ScheduledWidget::edit(
|
|||
|
||||
const auto &err = error.type();
|
||||
if (ranges::contains(Api::kDefaultEditMessagesErrors, err)) {
|
||||
Ui::show(Box<InformBox>(tr::lng_edit_error(tr::now)));
|
||||
controller()->show(Box<InformBox>(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 {
|
||||
Ui::show(Box<InformBox>(tr::lng_edit_error(tr::now)));
|
||||
controller()->show(Box<InformBox>(tr::lng_edit_error(tr::now)));
|
||||
}
|
||||
update();
|
||||
return true;
|
||||
|
@ -638,7 +638,7 @@ void ScheduledWidget::sendExistingDocument(
|
|||
const auto callback = [=](Api::SendOptions options) {
|
||||
sendExistingDocument(document, options);
|
||||
};
|
||||
Ui::show(
|
||||
controller()->show(
|
||||
PrepareScheduleBox(this, sendMenuType(), callback),
|
||||
Ui::LayerOption::KeepOther);
|
||||
}
|
||||
|
@ -650,7 +650,9 @@ bool ScheduledWidget::sendExistingDocument(
|
|||
_history->peer,
|
||||
ChatRestriction::f_send_stickers);
|
||||
if (error) {
|
||||
Ui::show(Box<InformBox>(*error), Ui::LayerOption::KeepOther);
|
||||
controller()->show(
|
||||
Box<InformBox>(*error),
|
||||
Ui::LayerOption::KeepOther);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -668,7 +670,7 @@ void ScheduledWidget::sendExistingPhoto(not_null<PhotoData*> photo) {
|
|||
const auto callback = [=](Api::SendOptions options) {
|
||||
sendExistingPhoto(photo, options);
|
||||
};
|
||||
Ui::show(
|
||||
controller()->show(
|
||||
PrepareScheduleBox(this, sendMenuType(), callback),
|
||||
Ui::LayerOption::KeepOther);
|
||||
}
|
||||
|
@ -680,7 +682,9 @@ bool ScheduledWidget::sendExistingPhoto(
|
|||
_history->peer,
|
||||
ChatRestriction::f_send_media);
|
||||
if (error) {
|
||||
Ui::show(Box<InformBox>(*error), Ui::LayerOption::KeepOther);
|
||||
controller()->show(
|
||||
Box<InformBox>(*error),
|
||||
Ui::LayerOption::KeepOther);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -699,13 +703,13 @@ void ScheduledWidget::sendInlineResult(
|
|||
not_null<UserData*> bot) {
|
||||
const auto errorText = result->getErrorOnSend(_history);
|
||||
if (!errorText.isEmpty()) {
|
||||
Ui::show(Box<InformBox>(errorText));
|
||||
controller()->show(Box<InformBox>(errorText));
|
||||
return;
|
||||
}
|
||||
const auto callback = [=](Api::SendOptions options) {
|
||||
sendInlineResult(result, bot, options);
|
||||
};
|
||||
Ui::show(
|
||||
controller()->show(
|
||||
PrepareScheduleBox(this, sendMenuType(), callback),
|
||||
Ui::LayerOption::KeepOther);
|
||||
}
|
||||
|
@ -1174,7 +1178,7 @@ void ScheduledWidget::listSendBotCommand(
|
|||
message.action.options = options;
|
||||
session().api().sendMessage(std::move(message));
|
||||
};
|
||||
Ui::show(
|
||||
controller()->show(
|
||||
PrepareScheduleBox(this, sendMenuType(), callback),
|
||||
Ui::LayerOption::KeepOther);
|
||||
}
|
||||
|
|
|
@ -540,14 +540,15 @@ void TopBar::performDelete() {
|
|||
if (items.empty()) {
|
||||
_cancelSelectionClicks.fire({});
|
||||
} else {
|
||||
const auto box = Ui::show(Box<DeleteMessagesBox>(
|
||||
auto box = Box<DeleteMessagesBox>(
|
||||
&_navigation->session(),
|
||||
std::move(items)));
|
||||
std::move(items));
|
||||
box->setDeleteConfirmedCallback([weak = Ui::MakeWeak(this)] {
|
||||
if (weak) {
|
||||
weak->_cancelSelectionClicks.fire({});
|
||||
}
|
||||
});
|
||||
_navigation->parentController()->show(std::move(box));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1154,7 +1154,8 @@ void MainWindow::createGlobalMenu() {
|
|||
return;
|
||||
}
|
||||
|
||||
Ui::show(PrepareContactsBox(sessionController()));
|
||||
sessionController()->show(
|
||||
PrepareContactsBox(sessionController()));
|
||||
}));
|
||||
|
||||
psAddContact = tools->addAction(
|
||||
|
|
|
@ -723,7 +723,7 @@ void MainWindow::createGlobalMenu() {
|
|||
if (!sessionController()) {
|
||||
return;
|
||||
}
|
||||
Ui::show(PrepareContactsBox(sessionController()));
|
||||
sessionController()->show(PrepareContactsBox(sessionController()));
|
||||
}));
|
||||
{
|
||||
auto callback = [=] {
|
||||
|
|
|
@ -464,7 +464,7 @@ void AppendEmojiPacks(
|
|||
auto callback = [=] {
|
||||
if (document) {
|
||||
if (const auto error = RestrictionToSendStickers(_controller)) {
|
||||
Ui::show(Box<InformBox>(*error));
|
||||
_controller->show(Box<InformBox>(*error));
|
||||
return true;
|
||||
}
|
||||
Api::SendExistingDocument(
|
||||
|
|
|
@ -22,6 +22,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "platform/platform_specific.h"
|
||||
#include "platform/platform_window_title.h"
|
||||
#include "base/platform/base_platform_info.h"
|
||||
#include "window/window_controller.h"
|
||||
#include "window/window_session_controller.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "core/update_checker.h"
|
||||
|
@ -45,6 +46,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
namespace Settings {
|
||||
|
||||
void SetupConnectionType(
|
||||
not_null<Window::Controller*> controller,
|
||||
not_null<Main::Account*> account,
|
||||
not_null<Ui::VerticalLayout*> container) {
|
||||
const auto connectionType = [=] {
|
||||
|
@ -69,7 +71,7 @@ void SetupConnectionType(
|
|||
) | rpl::map(connectionType),
|
||||
st::settingsButton);
|
||||
button->addClickHandler([=] {
|
||||
Ui::show(ProxiesBoxController::CreateOwningBox(account));
|
||||
controller->show(ProxiesBoxController::CreateOwningBox(account));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -304,7 +306,7 @@ void SetupSpellchecker(
|
|||
Spellchecker::ButtonManageDictsState(session),
|
||||
st::settingsButton
|
||||
)->addClickHandler([=] {
|
||||
Ui::show(Box<Ui::ManageDictionariesBox>(controller));
|
||||
controller->show(Box<Ui::ManageDictionariesBox>(controller));
|
||||
});
|
||||
|
||||
button->toggledValue(
|
||||
|
@ -450,7 +452,7 @@ void SetupSystemIntegrationContent(
|
|||
}) | rpl::start_with_next([=](bool checked) {
|
||||
if (controller->session().domain().local().hasLocalPasscode()) {
|
||||
minimized->entity()->setChecked(false);
|
||||
Ui::show(Box<InformBox>(
|
||||
controller->show(Box<InformBox>(
|
||||
tr::lng_error_start_minimized_passcoded(tr::now)));
|
||||
} else {
|
||||
cSetStartMinimized(checked);
|
||||
|
@ -510,7 +512,9 @@ void SetupAnimations(not_null<Ui::VerticalLayout*> container) {
|
|||
}, container->lifetime());
|
||||
}
|
||||
|
||||
void SetupOpenGL(not_null<Ui::VerticalLayout*> container) {
|
||||
void SetupOpenGL(
|
||||
not_null<Window::SessionController*> controller,
|
||||
not_null<Ui::VerticalLayout*> container) {
|
||||
const auto toggles = container->lifetime().make_state<
|
||||
rpl::event_stream<bool>
|
||||
>();
|
||||
|
@ -534,7 +538,7 @@ void SetupOpenGL(not_null<Ui::VerticalLayout*> container) {
|
|||
const auto cancelled = crl::guard(button, [=] {
|
||||
toggles->fire(!enabled);
|
||||
});
|
||||
Ui::show(Box<ConfirmBox>(
|
||||
controller->show(Box<ConfirmBox>(
|
||||
tr::lng_settings_need_restart(tr::now),
|
||||
tr::lng_settings_restart_now(tr::now),
|
||||
confirmed,
|
||||
|
@ -547,7 +551,7 @@ void SetupPerformance(
|
|||
not_null<Ui::VerticalLayout*> container) {
|
||||
SetupAnimations(container);
|
||||
if (!Platform::IsMac()) {
|
||||
SetupOpenGL(container);
|
||||
SetupOpenGL(controller, container);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -606,7 +610,10 @@ void Advanced::setupContent(not_null<Window::SessionController*> controller) {
|
|||
addDivider();
|
||||
AddSkip(content);
|
||||
AddSubsectionTitle(content, tr::lng_settings_network_proxy());
|
||||
SetupConnectionType(&controller->session().account(), content);
|
||||
SetupConnectionType(
|
||||
&controller->window(),
|
||||
&controller->session().account(),
|
||||
content);
|
||||
AddSkip(content);
|
||||
SetupDataStorage(controller, content);
|
||||
SetupAutoDownload(controller, content);
|
||||
|
|
|
@ -13,9 +13,14 @@ namespace Main {
|
|||
class Account;
|
||||
} // namespace Main
|
||||
|
||||
namespace Window {
|
||||
class Controller;
|
||||
} // namespace Window
|
||||
|
||||
namespace Settings {
|
||||
|
||||
void SetupConnectionType(
|
||||
not_null<Window::Controller*> controller,
|
||||
not_null<Main::Account*> account,
|
||||
not_null<Ui::VerticalLayout*> container);
|
||||
bool HasUpdate();
|
||||
|
|
|
@ -125,7 +125,7 @@ void Calls::setupContent() {
|
|||
call->setCurrentVideoDevice(deviceId);
|
||||
}
|
||||
});
|
||||
Ui::show(Box([=](not_null<Ui::GenericBox*> box) {
|
||||
_controller->show(Box([=](not_null<Ui::GenericBox*> box) {
|
||||
SingleChoiceBox(box, {
|
||||
.title = tr::lng_settings_call_camera(),
|
||||
.options = options,
|
||||
|
@ -200,7 +200,7 @@ void Calls::setupContent() {
|
|||
),
|
||||
st::settingsButton
|
||||
)->addClickHandler([=] {
|
||||
Ui::show(ChooseAudioOutputBox(crl::guard(this, [=](
|
||||
_controller->show(ChooseAudioOutputBox(crl::guard(this, [=](
|
||||
const QString &id,
|
||||
const QString &name) {
|
||||
_outputNameStream.fire_copy(name);
|
||||
|
@ -221,7 +221,7 @@ void Calls::setupContent() {
|
|||
),
|
||||
st::settingsButton
|
||||
)->addClickHandler([=] {
|
||||
Ui::show(ChooseAudioInputBox(crl::guard(this, [=](
|
||||
_controller->show(ChooseAudioInputBox(crl::guard(this, [=](
|
||||
const QString &id,
|
||||
const QString &name) {
|
||||
_inputNameStream.fire_copy(name);
|
||||
|
@ -268,11 +268,12 @@ void Calls::setupContent() {
|
|||
content,
|
||||
tr::lng_settings_call_open_system_prefs(),
|
||||
st::settingsButton
|
||||
)->addClickHandler([] {
|
||||
)->addClickHandler([=] {
|
||||
const auto opened = Platform::OpenSystemSettings(
|
||||
Platform::SystemSettingsType::Audio);
|
||||
if (!opened) {
|
||||
Ui::show(Box<InformBox>(tr::lng_linux_no_audio_prefs(tr::now)));
|
||||
_controller->show(
|
||||
Box<InformBox>(tr::lng_linux_no_audio_prefs(tr::now)));
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -304,7 +305,7 @@ void Calls::requestPermissionAndStartTestingMicrophone() {
|
|||
Platform::PermissionType::Microphone);
|
||||
Ui::hideLayer();
|
||||
};
|
||||
Ui::show(Box<ConfirmBox>(
|
||||
_controller->show(Box<ConfirmBox>(
|
||||
tr::lng_no_mic_permission(tr::now),
|
||||
tr::lng_menu_settings(tr::now),
|
||||
showSystemSettings));
|
||||
|
|
|
@ -416,7 +416,7 @@ BackgroundRow::BackgroundRow(
|
|||
updateImage();
|
||||
|
||||
_chooseFromGallery->addClickHandler([=] {
|
||||
Ui::show(Box<BackgroundBox>(controller));
|
||||
controller->show(Box<BackgroundBox>(controller));
|
||||
});
|
||||
_chooseFromFile->addClickHandler([=] {
|
||||
ChooseFromFile(controller, this);
|
||||
|
@ -635,7 +635,7 @@ void ChooseFromFile(
|
|||
auto local = Data::CustomWallPaper();
|
||||
local.setLocalImageAsThumbnail(std::make_shared<Image>(
|
||||
std::move(image)));
|
||||
Ui::show(Box<BackgroundPreviewBox>(controller, local));
|
||||
controller->show(Box<BackgroundPreviewBox>(controller, local));
|
||||
});
|
||||
FileDialog::GetOpenPath(
|
||||
parent.get(),
|
||||
|
@ -725,7 +725,7 @@ void SetupStickersEmoji(
|
|||
&st::settingsIconStickers,
|
||||
st::settingsChatIconLeft
|
||||
)->addClickHandler([=] {
|
||||
Ui::show(
|
||||
controller->show(
|
||||
Box<StickersBox>(controller, StickersBox::Section::Installed));
|
||||
});
|
||||
|
||||
|
@ -736,7 +736,7 @@ void SetupStickersEmoji(
|
|||
&st::settingsIconEmoji,
|
||||
st::settingsChatIconLeft
|
||||
)->addClickHandler([=] {
|
||||
Ui::show(Box<Ui::Emoji::ManageSetsBox>(session));
|
||||
controller->show(Box<Ui::Emoji::ManageSetsBox>(session));
|
||||
});
|
||||
|
||||
AddSkip(container, st::settingsCheckboxesSkip);
|
||||
|
@ -862,7 +862,7 @@ void SetupDataStorage(
|
|||
st::settingsButton,
|
||||
tr::lng_download_path());
|
||||
path->entity()->addClickHandler([=] {
|
||||
Ui::show(Box<DownloadPathBox>(controller));
|
||||
controller->show(Box<DownloadPathBox>(controller));
|
||||
});
|
||||
path->toggleOn(ask->toggledValue() | rpl::map(!_1));
|
||||
#endif // OS_WIN_STORE
|
||||
|
@ -901,7 +901,8 @@ void SetupAutoDownload(
|
|||
std::move(label),
|
||||
st::settingsButton
|
||||
)->addClickHandler([=] {
|
||||
Ui::show(Box<AutoDownloadBox>(&controller->session(), source));
|
||||
controller->show(
|
||||
Box<AutoDownloadBox>(&controller->session(), source));
|
||||
});
|
||||
};
|
||||
add(tr::lng_media_auto_in_private(), Source::User);
|
||||
|
@ -1142,7 +1143,7 @@ void SetupDefaultThemes(
|
|||
// in Window::Theme::Revert which is called by Editor.
|
||||
//
|
||||
// So we check here, before we change the saved accent color.
|
||||
Ui::show(Box<InformBox>(
|
||||
window->show(Box<InformBox>(
|
||||
tr::lng_theme_editor_cant_change_theme(tr::now)));
|
||||
return;
|
||||
}
|
||||
|
@ -1269,7 +1270,9 @@ void SetupCloudThemes(
|
|||
wrap->setDuration(0)->toggleOn(list->empty() | rpl::map(!_1));
|
||||
}
|
||||
|
||||
void SetupAutoNightMode(not_null<Ui::VerticalLayout*> container) {
|
||||
void SetupAutoNightMode(
|
||||
not_null<Window::SessionController*> controller,
|
||||
not_null<Ui::VerticalLayout*> container) {
|
||||
if (!Platform::IsDarkModeSupported()) {
|
||||
return;
|
||||
}
|
||||
|
@ -1294,7 +1297,7 @@ void SetupAutoNightMode(not_null<Ui::VerticalLayout*> container) {
|
|||
}) | rpl::start_with_next([=](bool checked) {
|
||||
if (checked && Window::Theme::Background()->editingTheme()) {
|
||||
autoNight->setChecked(false);
|
||||
Ui::show(Box<InformBox>(
|
||||
controller->show(Box<InformBox>(
|
||||
tr::lng_theme_editor_cant_change_theme(tr::now)));
|
||||
} else {
|
||||
Core::App().settings().setSystemDarkModeEnabled(checked);
|
||||
|
@ -1451,7 +1454,7 @@ void Chat::setupContent(not_null<Window::SessionController*> controller) {
|
|||
const auto content = Ui::CreateChild<Ui::VerticalLayout>(this);
|
||||
|
||||
SetupThemeOptions(controller, content);
|
||||
SetupAutoNightMode(content);
|
||||
SetupAutoNightMode(controller, content);
|
||||
SetupCloudThemes(controller, content);
|
||||
SetupChatBackground(controller, content);
|
||||
SetupStickersEmoji(controller, content);
|
||||
|
|
|
@ -75,18 +75,20 @@ void SetupPhoto(
|
|||
if (image.isNull()
|
||||
|| image.width() > 10 * image.height()
|
||||
|| image.height() > 10 * image.width()) {
|
||||
Ui::show(Box<InformBox>(tr::lng_bad_photo(tr::now)));
|
||||
controller->show(Box<InformBox>(tr::lng_bad_photo(tr::now)));
|
||||
return;
|
||||
}
|
||||
|
||||
const auto box = Ui::show(
|
||||
Box<PhotoCropBox>(image, tr::lng_settings_crop_profile(tr::now)));
|
||||
auto box = Box<PhotoCropBox>(
|
||||
image,
|
||||
tr::lng_settings_crop_profile(tr::now));
|
||||
box->ready(
|
||||
) | rpl::start_with_next([=](QImage &&image) {
|
||||
self->session().api().uploadPeerPhoto(
|
||||
self,
|
||||
std::move(image));
|
||||
}, box->lifetime());
|
||||
controller->show(std::move(box));
|
||||
};
|
||||
FileDialog::GetOpenPath(
|
||||
upload,
|
||||
|
@ -219,6 +221,7 @@ void AddRow(
|
|||
|
||||
void SetupRows(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
not_null<Window::SessionController*> controller,
|
||||
not_null<UserData*> self) {
|
||||
const auto session = &self->session();
|
||||
|
||||
|
@ -229,7 +232,7 @@ void SetupRows(
|
|||
tr::lng_settings_name_label(),
|
||||
Info::Profile::NameValue(self),
|
||||
tr::lng_profile_copy_fullname(tr::now),
|
||||
[=] { Ui::show(Box<EditNameBox>(self)); },
|
||||
[=] { controller->show(Box<EditNameBox>(self)); },
|
||||
st::settingsInfoName);
|
||||
|
||||
AddRow(
|
||||
|
@ -237,7 +240,7 @@ void SetupRows(
|
|||
tr::lng_settings_phone_label(),
|
||||
Info::Profile::PhoneValue(self),
|
||||
tr::lng_profile_copy_phone(tr::now),
|
||||
[=] { Ui::show(Box<ChangePhoneBox>(session)); },
|
||||
[=] { controller->show(Box<ChangePhoneBox>(session)); },
|
||||
st::settingsInfoPhone);
|
||||
|
||||
auto username = Info::Profile::UsernameValue(self);
|
||||
|
@ -272,7 +275,7 @@ void SetupRows(
|
|||
std::move(label),
|
||||
std::move(value),
|
||||
tr::lng_context_copy_mention(tr::now),
|
||||
[=] { Ui::show(Box<UsernameBox>(session)); },
|
||||
[=] { controller->show(Box<UsernameBox>(session)); },
|
||||
st::settingsInfoUsername);
|
||||
|
||||
AddSkip(container, st::settingsInfoAfterSkip);
|
||||
|
@ -439,7 +442,7 @@ void Information::setupContent(
|
|||
|
||||
const auto self = controller->session().user();
|
||||
SetupPhoto(content, controller, self);
|
||||
SetupRows(content, self);
|
||||
SetupRows(content, controller, self);
|
||||
SetupBio(content, self);
|
||||
//auto manager = SetupBio(content, self);
|
||||
//_canSaveChanges = std::move(manager.canSave);
|
||||
|
|
|
@ -65,7 +65,7 @@ object_ptr<Ui::RpWidget> CreateIntroSettings(
|
|||
AddDivider(result);
|
||||
AddSkip(result);
|
||||
SetupLanguageButton(result, false);
|
||||
SetupConnectionType(&window->account(), result);
|
||||
SetupConnectionType(window, &window->account(), result);
|
||||
AddSkip(result);
|
||||
if (HasUpdate()) {
|
||||
AddDivider(result);
|
||||
|
@ -89,7 +89,7 @@ object_ptr<Ui::RpWidget> CreateIntroSettings(
|
|||
}
|
||||
AddDivider(result);
|
||||
AddSkip(result);
|
||||
SetupInterfaceScale(result, false);
|
||||
SetupInterfaceScale(window, result, false);
|
||||
SetupDefaultThemes(window, result);
|
||||
AddSkip(result);
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "apiwrap.h"
|
||||
#include "api/api_sensitive_content.h"
|
||||
#include "api/api_global_privacy.h"
|
||||
#include "window/window_controller.h"
|
||||
#include "window/window_session_controller.h"
|
||||
#include "core/click_handler_types.h"
|
||||
#include "base/call_delayed.h"
|
||||
|
@ -167,6 +168,7 @@ bool HasInterfaceScale() {
|
|||
}
|
||||
|
||||
void SetupInterfaceScale(
|
||||
not_null<Window::Controller*> window,
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
bool icon) {
|
||||
if (!HasInterfaceScale()) {
|
||||
|
@ -234,7 +236,7 @@ void SetupInterfaceScale(
|
|||
button,
|
||||
[=] { repeatSetScale(cConfigScale(), repeatSetScale); });
|
||||
});
|
||||
Ui::show(Box<ConfirmBox>(
|
||||
window->show(Box<ConfirmBox>(
|
||||
tr::lng_settings_need_restart(tr::now),
|
||||
tr::lng_settings_restart_now(tr::now),
|
||||
confirmed,
|
||||
|
@ -332,7 +334,7 @@ void SetupHelp(
|
|||
sure,
|
||||
OpenFaq);
|
||||
box->setStrictCancel(true);
|
||||
Ui::show(std::move(box));
|
||||
controller->show(std::move(box));
|
||||
});
|
||||
|
||||
AddSkip(container);
|
||||
|
@ -368,7 +370,7 @@ void Main::setupContent(not_null<Window::SessionController*> controller) {
|
|||
if (HasInterfaceScale()) {
|
||||
AddDivider(content);
|
||||
AddSkip(content);
|
||||
SetupInterfaceScale(content);
|
||||
SetupInterfaceScale(&controller->window(), content);
|
||||
AddSkip(content);
|
||||
}
|
||||
SetupHelp(controller, content);
|
||||
|
|
|
@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "settings/settings_common.h"
|
||||
|
||||
namespace Window {
|
||||
class Controller;
|
||||
class SessionController;
|
||||
} // namespace Window
|
||||
|
||||
|
@ -24,6 +25,7 @@ void SetupLanguageButton(
|
|||
bool icon = true);
|
||||
bool HasInterfaceScale();
|
||||
void SetupInterfaceScale(
|
||||
not_null<Window::Controller*> window,
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
bool icon = true);
|
||||
void SetupFaq(
|
||||
|
|
|
@ -304,7 +304,7 @@ void BlockedBoxController::BlockNewPeer(
|
|||
});
|
||||
box->addButton(tr::lng_cancel(), [box] { box->closeBox(); });
|
||||
};
|
||||
Ui::show(
|
||||
window->show(
|
||||
Box<PeerListBox>(std::move(controller), std::move(initBox)),
|
||||
Ui::LayerOption::KeepOther);
|
||||
}
|
||||
|
|
|
@ -140,7 +140,7 @@ void SetupPrivacy(
|
|||
BlockedBoxController::BlockNewPeer(controller);
|
||||
});
|
||||
};
|
||||
Ui::show(Box<PeerListBox>(
|
||||
controller->show(Box<PeerListBox>(
|
||||
std::make_unique<BlockedBoxController>(controller),
|
||||
initBox));
|
||||
});
|
||||
|
@ -271,7 +271,7 @@ void SetupLocalPasscode(
|
|||
std::move(text),
|
||||
st::settingsButton)
|
||||
)->addClickHandler([=] {
|
||||
Ui::show(Box<PasscodeBox>(&controller->session(), false));
|
||||
controller->show(Box<PasscodeBox>(&controller->session(), false));
|
||||
});
|
||||
|
||||
const auto wrap = container->add(
|
||||
|
@ -285,7 +285,7 @@ void SetupLocalPasscode(
|
|||
tr::lng_settings_passcode_disable(),
|
||||
st::settingsButton)
|
||||
)->addClickHandler([=] {
|
||||
Ui::show(Box<PasscodeBox>(&controller->session(), true));
|
||||
controller->show(Box<PasscodeBox>(&controller->session(), true));
|
||||
});
|
||||
|
||||
const auto autoLockBoxClosing =
|
||||
|
@ -314,7 +314,8 @@ void SetupLocalPasscode(
|
|||
std::move(value),
|
||||
st::settingsButton
|
||||
)->addClickHandler([=] {
|
||||
const auto box = Ui::show(Box<AutoLockBox>(&controller->session()));
|
||||
const auto box = controller->show(
|
||||
Box<AutoLockBox>(&controller->session()));
|
||||
box->boxClosing(
|
||||
) | rpl::start_to_stream(*autoLockBoxClosing, box->lifetime());
|
||||
});
|
||||
|
@ -409,9 +410,9 @@ void SetupCloudPassword(
|
|||
))->setDuration(0);
|
||||
change->entity()->addClickHandler([=] {
|
||||
if (CheckEditCloudPassword(session)) {
|
||||
Ui::show(EditCloudPasswordBox(session));
|
||||
controller->show(EditCloudPasswordBox(session));
|
||||
} else {
|
||||
Ui::show(CloudPasswordAppOutdatedBox());
|
||||
controller->show(CloudPasswordAppOutdatedBox());
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -448,14 +449,14 @@ void SetupCloudPassword(
|
|||
session->api().clearUnconfirmedPassword();
|
||||
}, validation.box->lifetime());
|
||||
|
||||
Ui::show(std::move(validation.box));
|
||||
controller->show(std::move(validation.box));
|
||||
});
|
||||
|
||||
const auto remove = [=] {
|
||||
if (CheckEditCloudPassword(session)) {
|
||||
RemoveCloudPassword(session);
|
||||
RemoveCloudPassword(controller);
|
||||
} else {
|
||||
Ui::show(CloudPasswordAppOutdatedBox());
|
||||
controller->show(CloudPasswordAppOutdatedBox());
|
||||
}
|
||||
};
|
||||
const auto disable = container->add(
|
||||
|
@ -569,7 +570,7 @@ void SetupSelfDestruction(
|
|||
label(),
|
||||
st::settingsButton
|
||||
)->addClickHandler([=] {
|
||||
Ui::show(Box<SelfDestructionBox>(
|
||||
controller->show(Box<SelfDestructionBox>(
|
||||
session,
|
||||
session->api().selfDestruct().days()));
|
||||
});
|
||||
|
@ -648,7 +649,7 @@ void SetupBotsAndWebsites(
|
|||
tr::lng_settings_clear_payment_info(),
|
||||
st::settingsButton
|
||||
)->addClickHandler([=] {
|
||||
Ui::show(ClearPaymentInfoBox(session));
|
||||
controller->show(ClearPaymentInfoBox(session));
|
||||
});
|
||||
|
||||
AddSkip(container);
|
||||
|
@ -678,7 +679,7 @@ void SetupSessionsList(
|
|||
std::move(count),
|
||||
st::settingsButton
|
||||
)->addClickHandler([=] {
|
||||
Ui::show(Box<SessionsBox>(&controller->session()));
|
||||
controller->show(Box<SessionsBox>(&controller->session()));
|
||||
});
|
||||
AddSkip(container, st::settingsPrivacySecurityPadding);
|
||||
AddDividerText(container, tr::lng_settings_sessions_about());
|
||||
|
@ -734,7 +735,8 @@ object_ptr<Ui::BoxContent> EditCloudPasswordBox(not_null<Main::Session*> session
|
|||
return result;
|
||||
}
|
||||
|
||||
void RemoveCloudPassword(not_null<::Main::Session*> session) {
|
||||
void RemoveCloudPassword(not_null<Window::SessionController*> controller) {
|
||||
const auto session = &controller->session();
|
||||
const auto current = session->api().passwordStateCurrent();
|
||||
Assert(current.has_value());
|
||||
|
||||
|
@ -744,7 +746,7 @@ void RemoveCloudPassword(not_null<::Main::Session*> session) {
|
|||
}
|
||||
auto fields = PasscodeBox::CloudFields::From(*current);
|
||||
fields.turningOff = true;
|
||||
const auto box = Ui::show(Box<PasscodeBox>(session, fields));
|
||||
auto box = Box<PasscodeBox>(session, fields);
|
||||
|
||||
rpl::merge(
|
||||
box->newPasswordSet() | rpl::to_empty,
|
||||
|
@ -757,6 +759,8 @@ void RemoveCloudPassword(not_null<::Main::Session*> session) {
|
|||
) | rpl::start_with_next([=] {
|
||||
session->api().clearUnconfirmedPassword();
|
||||
}, box->lifetime());
|
||||
|
||||
controller->show(std::move(box));
|
||||
}
|
||||
|
||||
object_ptr<Ui::BoxContent> CloudPasswordAppOutdatedBox() {
|
||||
|
@ -789,7 +793,7 @@ void AddPrivacyButton(
|
|||
) | rpl::take(
|
||||
1
|
||||
) | rpl::start_with_next([=](const Privacy &value) {
|
||||
Ui::show(
|
||||
controller->show(
|
||||
Box<EditPrivacyBox>(controller, controllerFactory(), value),
|
||||
Ui::LayerOption::KeepOther);
|
||||
});
|
||||
|
|
|
@ -23,7 +23,7 @@ int ExceptionUsersCount(const std::vector<not_null<PeerData*>> &exceptions);
|
|||
bool CheckEditCloudPassword(not_null<::Main::Session*> session);
|
||||
object_ptr<Ui::BoxContent> EditCloudPasswordBox(
|
||||
not_null<::Main::Session*> session);
|
||||
void RemoveCloudPassword(not_null<::Main::Session*> session);
|
||||
void RemoveCloudPassword(not_null<Window::SessionController*> session);
|
||||
object_ptr<Ui::BoxContent> CloudPasswordAppOutdatedBox();
|
||||
|
||||
void AddPrivacyButton(
|
||||
|
|
|
@ -507,7 +507,7 @@ void Helper::showEditInfoBox(
|
|||
TextUtilities::ConvertTextTagsToEntities(result.tags)
|
||||
}, done);
|
||||
};
|
||||
Ui::show(
|
||||
controller->show(
|
||||
Box<EditInfoBox>(controller, editData, save),
|
||||
Ui::LayerOption::KeepOther);
|
||||
}
|
||||
|
|
|
@ -665,8 +665,8 @@ Editor::Editor(
|
|||
this,
|
||||
[=] { save(); }));
|
||||
|
||||
_inner->setErrorCallback([this] {
|
||||
Ui::show(Box<InformBox>(tr::lng_theme_editor_error(tr::now)));
|
||||
_inner->setErrorCallback([=] {
|
||||
window->show(Box<InformBox>(tr::lng_theme_editor_error(tr::now)));
|
||||
|
||||
// This could be from inner->_context observable notification.
|
||||
// We should not destroy it while iterating in subscribers.
|
||||
|
@ -748,12 +748,14 @@ void Editor::exportTheme() {
|
|||
QFile f(path);
|
||||
if (!f.open(QIODevice::WriteOnly)) {
|
||||
LOG(("Theme Error: could not open zip-ed theme file '%1' for writing").arg(path));
|
||||
Ui::show(Box<InformBox>(tr::lng_theme_editor_error(tr::now)));
|
||||
_window->show(
|
||||
Box<InformBox>(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));
|
||||
Ui::show(Box<InformBox>(tr::lng_theme_editor_error(tr::now)));
|
||||
_window->show(
|
||||
Box<InformBox>(tr::lng_theme_editor_error(tr::now)));
|
||||
return;
|
||||
}
|
||||
Ui::Toast::Show(tr::lng_theme_editor_done(tr::now));
|
||||
|
|
|
@ -126,7 +126,7 @@ void Controller::checkLockByTerms() {
|
|||
return;
|
||||
}
|
||||
Ui::hideSettingsAndLayer(anim::type::instant);
|
||||
const auto box = Ui::show(Box<TermsBox>(
|
||||
const auto box = show(Box<TermsBox>(
|
||||
*data,
|
||||
tr::lng_terms_agree(),
|
||||
tr::lng_terms_decline()));
|
||||
|
@ -161,7 +161,7 @@ void Controller::checkLockByTerms() {
|
|||
}
|
||||
|
||||
void Controller::showTermsDecline() {
|
||||
const auto box = Ui::show(
|
||||
const auto box = show(
|
||||
Box<Window::TermsBox>(
|
||||
TextWithEntities{ tr::lng_terms_update_sorry(tr::now) },
|
||||
tr::lng_terms_decline_and_delete(),
|
||||
|
@ -193,7 +193,7 @@ void Controller::showTermsDelete() {
|
|||
Ui::hideLayer();
|
||||
}
|
||||
};
|
||||
Ui::show(
|
||||
show(
|
||||
Box<ConfirmBox>(
|
||||
tr::lng_terms_delete_warning(tr::now),
|
||||
tr::lng_terms_delete_now(tr::now),
|
||||
|
|
|
@ -131,7 +131,7 @@ void ShowCallsBox(not_null<Window::SessionController*> window) {
|
|||
return true;
|
||||
});
|
||||
};
|
||||
Ui::show(Box<PeerListBox>(std::move(controller), initBox));
|
||||
window->show(Box<PeerListBox>(std::move(controller), initBox));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@ -617,7 +617,11 @@ MainMenu::MainMenu(
|
|||
_telegram->setLinksTrusted();
|
||||
_version->setRichText(textcmdLink(1, tr::lng_settings_current_version(tr::now, lt_version, currentVersionText())) + QChar(' ') + QChar(8211) + QChar(' ') + textcmdLink(2, tr::lng_menu_about(tr::now)));
|
||||
_version->setLink(1, std::make_shared<UrlClickHandler>(Core::App().changelogLink()));
|
||||
_version->setLink(2, std::make_shared<LambdaClickHandler>([] { Ui::show(Box<AboutBox>()); }));
|
||||
_version->setLink(
|
||||
2,
|
||||
std::make_shared<LambdaClickHandler>([=] {
|
||||
controller->show(Box<AboutBox>());
|
||||
}));
|
||||
|
||||
_controller->session().downloaderTaskFinished(
|
||||
) | rpl::start_with_next([=] {
|
||||
|
@ -903,7 +907,7 @@ void MainMenu::refreshMenu() {
|
|||
controller->showNewChannel();
|
||||
}, &st::mainMenuNewChannel, &st::mainMenuNewChannelOver);
|
||||
_menu->addAction(tr::lng_menu_contacts(tr::now), [=] {
|
||||
Ui::show(PrepareContactsBox(controller));
|
||||
controller->show(PrepareContactsBox(controller));
|
||||
}, &st::mainMenuContacts, &st::mainMenuContactsOver);
|
||||
if (_controller->session().serverConfig().phoneCallsEnabled.current()) {
|
||||
_menu->addAction(tr::lng_menu_calls(tr::now), [=] {
|
||||
|
@ -938,7 +942,7 @@ void MainMenu::refreshMenu() {
|
|||
|
||||
auto nightCallback = [=] {
|
||||
if (Window::Theme::Background()->editingTheme()) {
|
||||
Ui::show(Box<InformBox>(
|
||||
controller->show(Box<InformBox>(
|
||||
tr::lng_theme_editor_cant_change_theme(tr::now)));
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -141,7 +141,7 @@ void SessionNavigation::resolveUsername(
|
|||
}).fail([=](const MTP::Error &error) {
|
||||
_resolveRequestId = 0;
|
||||
if (error.code() == 400) {
|
||||
Ui::show(Box<InformBox>(
|
||||
show(Box<InformBox>(
|
||||
tr::lng_username_not_found(tr::now, lt_user, username)));
|
||||
}
|
||||
}).send();
|
||||
|
@ -471,7 +471,7 @@ SessionController::SessionController(
|
|||
) | rpl::start_with_next([=](PeerData *peer) {
|
||||
if (peer == _showEditPeer) {
|
||||
_showEditPeer = nullptr;
|
||||
Ui::show(Box<EditPeerInfoBox>(this, peer));
|
||||
show(Box<EditPeerInfoBox>(this, peer));
|
||||
}
|
||||
}, lifetime());
|
||||
|
||||
|
@ -993,7 +993,7 @@ void SessionController::startOrJoinGroupCall(
|
|||
GroupCallJoinConfirm confirm) {
|
||||
auto &calls = Core::App().calls();
|
||||
const auto askConfirmation = [&](QString text, QString button) {
|
||||
Ui::show(Box<ConfirmBox>(text, button, crl::guard(this, [=] {
|
||||
show(Box<ConfirmBox>(text, button, crl::guard(this, [=] {
|
||||
Ui::hideLayer();
|
||||
startOrJoinGroupCall(peer, joinHash, GroupCallJoinConfirm::None);
|
||||
})));
|
||||
|
@ -1095,7 +1095,7 @@ void SessionController::showJumpToDate(Dialogs::Key chat, QDate requestedDate) {
|
|||
box->setMinDate(minPeerDate(chat));
|
||||
box->setMaxDate(maxPeerDate(chat));
|
||||
box->setBeginningButton(true);
|
||||
Ui::show(std::move(box));
|
||||
show(std::move(box));
|
||||
}
|
||||
|
||||
void SessionController::showPassportForm(const Passport::FormRequest &request) {
|
||||
|
@ -1210,6 +1210,13 @@ Window::Adaptive &SessionController::adaptive() const {
|
|||
return _window->adaptive();
|
||||
}
|
||||
|
||||
QPointer<Ui::BoxContent> SessionController::show(
|
||||
object_ptr<Ui::BoxContent> content,
|
||||
Ui::LayerOptions options,
|
||||
anim::type animated) {
|
||||
return _window->show(std::move(content), options, animated);
|
||||
}
|
||||
|
||||
SessionController::~SessionController() = default;
|
||||
|
||||
} // namespace Window
|
||||
|
|
|
@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "base/timer.h"
|
||||
#include "dialogs/dialogs_key.h"
|
||||
#include "ui/effects/animation_value.h"
|
||||
#include "ui/layers/layer_widget.h"
|
||||
#include "window/window_adaptive.h"
|
||||
|
||||
class PhotoData;
|
||||
|
@ -250,6 +251,11 @@ public:
|
|||
return _selectingPeer;
|
||||
}
|
||||
|
||||
QPointer<Ui::BoxContent> show(
|
||||
object_ptr<Ui::BoxContent> content,
|
||||
Ui::LayerOptions options = Ui::LayerOption::KeepOther,
|
||||
anim::type animated = anim::type::normal);
|
||||
|
||||
[[nodiscard]] auto tabbedSelector() const
|
||||
-> not_null<ChatHelpers::TabbedSelector*>;
|
||||
void takeTabbedSelectorOwnershipFrom(not_null<QWidget*> parent);
|
||||
|
|
Loading…
Add table
Reference in a new issue