diff --git a/Telegram/SourceFiles/boxes/create_poll_box.cpp b/Telegram/SourceFiles/boxes/create_poll_box.cpp index 37d66216a5..1f5137ebf0 100644 --- a/Telegram/SourceFiles/boxes/create_poll_box.cpp +++ b/Telegram/SourceFiles/boxes/create_poll_box.cpp @@ -1087,7 +1087,7 @@ object_ptr CreatePollBox::setupContent() { Ui::show( HistoryView::PrepareScheduleBox( this, - SendMenuType::Scheduled, + SendMenu::Type::Scheduled, send), Ui::LayerOption::KeepOther); }; @@ -1108,9 +1108,11 @@ object_ptr CreatePollBox::setupContent() { if (_sendType == Api::SendType::Normal) { const auto sendMenuType = [=] { collectError(); - return *error ? SendMenuType::Disabled : SendMenuType::Scheduled; + return *error + ? SendMenu::Type::Disabled + : SendMenu::Type::Scheduled; }; - SetupSendMenuAndShortcuts( + SendMenu::SetupMenuAndShortcuts( submit.data(), sendMenuType, sendSilent, diff --git a/Telegram/SourceFiles/boxes/send_files_box.cpp b/Telegram/SourceFiles/boxes/send_files_box.cpp index 443d77d7e8..ab8c9d7219 100644 --- a/Telegram/SourceFiles/boxes/send_files_box.cpp +++ b/Telegram/SourceFiles/boxes/send_files_box.cpp @@ -1667,7 +1667,7 @@ SendFilesBox::SendFilesBox( CompressConfirm compressed, SendLimit limit, Api::SendType sendType, - SendMenuType sendMenuType) + SendMenu::Type sendMenuType) : _controller(controller) , _sendType(sendType) , _list(std::move(list)) @@ -1837,7 +1837,7 @@ void SendFilesBox::setupShadows( void SendFilesBox::prepare() { _send = addButton(tr::lng_send_button(), [=] { send({}); }); if (_sendType == Api::SendType::Normal) { - SetupSendMenuAndShortcuts( + SendMenu::SetupMenuAndShortcuts( _send, [=] { return _sendMenuType; }, [=] { sendSilent(); }, @@ -2418,7 +2418,7 @@ void SendFilesBox::sendSilent() { void SendFilesBox::sendScheduled() { const auto type = (_sendType == Api::SendType::ScheduledToUser) - ? SendMenuType::ScheduledToUser + ? SendMenu::Type::ScheduledToUser : _sendMenuType; const auto callback = [=](Api::SendOptions options) { send(options); }; Ui::show( diff --git a/Telegram/SourceFiles/boxes/send_files_box.h b/Telegram/SourceFiles/boxes/send_files_box.h index 84fe80ad8e..e7b013071c 100644 --- a/Telegram/SourceFiles/boxes/send_files_box.h +++ b/Telegram/SourceFiles/boxes/send_files_box.h @@ -40,7 +40,9 @@ namespace Window { class SessionController; } // namespace Window -enum class SendMenuType; +namespace SendMenu { +enum class Type; +} // namespace SendMenu enum class SendFilesWay { Album, @@ -62,7 +64,7 @@ public: CompressConfirm compressed, SendLimit limit, Api::SendType sendType, - SendMenuType sendMenuType); + SendMenu::Type sendMenuType); void setConfirmedCallback( Fnselected(); return ranges::all_of(selected, HistoryView::CanScheduleUntilOnline) - ? SendMenuType::ScheduledToUser + ? SendMenu::Type::ScheduledToUser : (selected.size() == 1 && selected.front()->isSelf()) - ? SendMenuType::Reminder - : SendMenuType::Scheduled; + ? SendMenu::Type::Reminder + : SendMenu::Type::Scheduled; } void ShareBox::createButtons() { @@ -424,7 +424,7 @@ void ShareBox::createButtons() { const auto send = addButton(tr::lng_share_confirm(), [=] { submit({}); }); - SetupSendMenuAndShortcuts( + SendMenu::SetupMenuAndShortcuts( send, [=] { return sendMenuType(); }, [=] { submitSilent(); }, diff --git a/Telegram/SourceFiles/boxes/share_box.h b/Telegram/SourceFiles/boxes/share_box.h index 605b68f63c..67e19bff66 100644 --- a/Telegram/SourceFiles/boxes/share_box.h +++ b/Telegram/SourceFiles/boxes/share_box.h @@ -14,7 +14,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/effects/round_checkbox.h" #include "mtproto/sender.h" -enum class SendMenuType; +namespace SendMenu { +enum class Type; +} // namespace SendMenu namespace Window { class SessionNavigation; @@ -82,7 +84,7 @@ private: void copyLink(); bool searchByUsername(bool useCache = false); - SendMenuType sendMenuType() const; + SendMenu::Type sendMenuType() const; void scrollTo(Ui::ScrollToRequest request); void needSearchByUsername(); diff --git a/Telegram/SourceFiles/chat_helpers/field_autocomplete.cpp b/Telegram/SourceFiles/chat_helpers/field_autocomplete.cpp index fe47fe47d0..a290af8cc8 100644 --- a/Telegram/SourceFiles/chat_helpers/field_autocomplete.cpp +++ b/Telegram/SourceFiles/chat_helpers/field_autocomplete.cpp @@ -16,7 +16,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_file_origin.h" #include "data/data_session.h" #include "data/stickers/data_stickers.h" -#include "chat_helpers/send_context_menu.h" // FillSendMenu +#include "chat_helpers/send_context_menu.h" // SendMenu::FillSendMenu #include "chat_helpers/stickers_lottie.h" #include "mainwindow.h" #include "apiwrap.h" @@ -1022,18 +1022,18 @@ void FieldAutocompleteInner::contextMenuEvent(QContextMenuEvent *e) { return; } const auto index = _sel; - const auto type = SendMenuType::Scheduled; + const auto type = SendMenu::Type::Scheduled; const auto method = FieldAutocomplete::ChooseMethod::ByClick; _menu = base::make_unique_q(this); const auto send = [=](Api::SendOptions options) { chooseAtIndex(method, index, options); }; - FillSendMenu( + SendMenu::FillSendMenu( _menu, [&] { return type; }, - DefaultSilentCallback(send), - DefaultScheduleCallback(this, type, send)); + SendMenu::DefaultSilentCallback(send), + SendMenu::DefaultScheduleCallback(this, type, send)); if (!_menu->actions().empty()) { _menu->popup(QCursor::pos()); diff --git a/Telegram/SourceFiles/chat_helpers/gifs_list_widget.cpp b/Telegram/SourceFiles/chat_helpers/gifs_list_widget.cpp index 471b273fa4..1fe231f528 100644 --- a/Telegram/SourceFiles/chat_helpers/gifs_list_widget.cpp +++ b/Telegram/SourceFiles/chat_helpers/gifs_list_widget.cpp @@ -17,7 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_photo_media.h" #include "data/data_document_media.h" #include "data/stickers/data_stickers.h" -#include "chat_helpers/send_context_menu.h" // FillSendMenu +#include "chat_helpers/send_context_menu.h" // SendMenu::FillSendMenu #include "ui/widgets/buttons.h" #include "ui/widgets/input_fields.h" #include "ui/widgets/popup_menu.h" @@ -365,7 +365,7 @@ void GifsListWidget::mousePressEvent(QMouseEvent *e) { void GifsListWidget::fillContextMenu( not_null menu, - SendMenuType type) { + SendMenu::Type type) { if (_selected < 0 || _pressed >= 0) { return; } @@ -375,11 +375,11 @@ void GifsListWidget::fillContextMenu( const auto send = [=](Api::SendOptions options) { selectInlineResult(row, column, options, true); }; - FillSendMenu( + SendMenu::FillSendMenu( menu, [&] { return type; }, - DefaultSilentCallback(send), - DefaultScheduleCallback(this, type, send)); + SendMenu::DefaultSilentCallback(send), + SendMenu::DefaultScheduleCallback(this, type, send)); [&] { const auto row = _selected / MatrixRowShift; diff --git a/Telegram/SourceFiles/chat_helpers/gifs_list_widget.h b/Telegram/SourceFiles/chat_helpers/gifs_list_widget.h index 4a78c147a3..f1235213f1 100644 --- a/Telegram/SourceFiles/chat_helpers/gifs_list_widget.h +++ b/Telegram/SourceFiles/chat_helpers/gifs_list_widget.h @@ -34,7 +34,9 @@ namespace Window { class SessionController; } // namespace Window -enum class SendMenuType; +namespace SendMenu { +enum class Type; +} // namespace SendMenu namespace ChatHelpers { @@ -77,7 +79,7 @@ public: void fillContextMenu( not_null menu, - SendMenuType type) override; + SendMenu::Type type) override; ~GifsListWidget(); diff --git a/Telegram/SourceFiles/chat_helpers/send_context_menu.cpp b/Telegram/SourceFiles/chat_helpers/send_context_menu.cpp index f0a60ddb0e..0f5666dd99 100644 --- a/Telegram/SourceFiles/chat_helpers/send_context_menu.cpp +++ b/Telegram/SourceFiles/chat_helpers/send_context_menu.cpp @@ -17,13 +17,15 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include +namespace SendMenu { + Fn DefaultSilentCallback(Fn send) { return [=] { send({ .silent = true }); }; } Fn DefaultScheduleCallback( not_null parent, - SendMenuType type, + Type type, Fn send) { const auto weak = Ui::MakeWeak(parent); return [=] { @@ -38,24 +40,24 @@ Fn DefaultScheduleCallback( FillMenuResult FillSendMenu( not_null menu, - Fn type, + Fn type, Fn silent, Fn schedule) { if (!silent && !schedule) { return FillMenuResult::None; } const auto now = type(); - if (now == SendMenuType::Disabled - || (!silent && now == SendMenuType::SilentOnly)) { + if (now == Type::Disabled + || (!silent && now == Type::SilentOnly)) { return FillMenuResult::None; } - if (silent && now != SendMenuType::Reminder) { + if (silent && now != Type::Reminder) { menu->addAction(tr::lng_send_silent_message(tr::now), silent); } - if (schedule && now != SendMenuType::SilentOnly) { + if (schedule && now != Type::SilentOnly) { menu->addAction( - (now == SendMenuType::Reminder + (now == Type::Reminder ? tr::lng_reminder_message(tr::now) : tr::lng_schedule_message(tr::now)), schedule); @@ -63,9 +65,9 @@ FillMenuResult FillSendMenu( return FillMenuResult::Success; } -void SetupSendMenuAndShortcuts( +void SetupMenuAndShortcuts( not_null button, - Fn type, + Fn type, Fn silent, Fn schedule) { if (!silent && !schedule) { @@ -93,12 +95,12 @@ void SetupSendMenuAndShortcuts( using Command = Shortcuts::Command; const auto now = type(); - if (now == SendMenuType::Disabled - || (!silent && now == SendMenuType::SilentOnly)) { + if (now == Type::Disabled + || (!silent && now == Type::SilentOnly)) { return; } (silent - && (now != SendMenuType::Reminder) + && (now != Type::Reminder) && request->check(Command::SendSilentMessage) && request->handle([=] { silent(); @@ -106,7 +108,7 @@ void SetupSendMenuAndShortcuts( })) || (schedule - && (now != SendMenuType::SilentOnly) + && (now != Type::SilentOnly) && request->check(Command::ScheduleMessage) && request->handle([=] { schedule(); @@ -130,3 +132,5 @@ void SetupSendMenuAndShortcuts( })); }, button->lifetime()); } + +} // namespace SendMenu diff --git a/Telegram/SourceFiles/chat_helpers/send_context_menu.h b/Telegram/SourceFiles/chat_helpers/send_context_menu.h index 382d5cafab..ec810545ed 100644 --- a/Telegram/SourceFiles/chat_helpers/send_context_menu.h +++ b/Telegram/SourceFiles/chat_helpers/send_context_menu.h @@ -17,7 +17,9 @@ namespace Ui { class PopupMenu; } // namespace Ui -enum class SendMenuType { +namespace SendMenu { + +enum class Type { Disabled, SilentOnly, Scheduled, @@ -33,17 +35,19 @@ enum class FillMenuResult { Fn DefaultSilentCallback(Fn send); Fn DefaultScheduleCallback( not_null parent, - SendMenuType type, + Type type, Fn send); FillMenuResult FillSendMenu( not_null menu, - Fn type, + Fn type, Fn silent, Fn schedule); -void SetupSendMenuAndShortcuts( +void SetupMenuAndShortcuts( not_null button, - Fn type, + Fn type, Fn silent, Fn schedule); + +} // namespace SendMenu diff --git a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp index 7fc2021cb4..6015a7ff5e 100644 --- a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp +++ b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp @@ -14,7 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_file_origin.h" #include "data/data_cloud_file.h" #include "data/data_changes.h" -#include "chat_helpers/send_context_menu.h" // FillSendMenu +#include "chat_helpers/send_context_menu.h" // SendMenu::FillSendMenu #include "chat_helpers/stickers_lottie.h" #include "ui/widgets/buttons.h" #include "ui/widgets/popup_menu.h" @@ -2055,7 +2055,7 @@ void StickersListWidget::showStickerSetBox(not_null document) { void StickersListWidget::fillContextMenu( not_null menu, - SendMenuType type) { + SendMenu::Type type) { auto selected = _selected; auto &sets = shownSets(); if (!selected || _pressed) { @@ -2072,11 +2072,11 @@ void StickersListWidget::fillContextMenu( .document = document, .options = options }); }; - FillSendMenu( + SendMenu::FillSendMenu( menu, [&] { return type; }, - DefaultSilentCallback(send), - DefaultScheduleCallback(this, type, send)); + SendMenu::DefaultSilentCallback(send), + SendMenu::DefaultScheduleCallback(this, type, send)); const auto toggleFavedSticker = [=] { document->session().api().toggleFavedSticker( diff --git a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.h b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.h index a0e6bf21e3..d9d6378cf9 100644 --- a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.h +++ b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.h @@ -85,7 +85,7 @@ public: void fillContextMenu( not_null menu, - SendMenuType type) override; + SendMenu::Type type) override; ~StickersListWidget(); diff --git a/Telegram/SourceFiles/chat_helpers/tabbed_selector.cpp b/Telegram/SourceFiles/chat_helpers/tabbed_selector.cpp index 92323c9ca6..b60304b46f 100644 --- a/Telegram/SourceFiles/chat_helpers/tabbed_selector.cpp +++ b/Telegram/SourceFiles/chat_helpers/tabbed_selector.cpp @@ -880,7 +880,7 @@ void TabbedSelector::contextMenuEvent(QContextMenuEvent *e) { _menu = base::make_unique_q(this); const auto type = _sendMenuType ? _sendMenuType() - : SendMenuType::Disabled; + : SendMenu::Type::Disabled; currentTab()->widget()->fillContextMenu(_menu, type); if (!_menu->actions().empty()) { diff --git a/Telegram/SourceFiles/chat_helpers/tabbed_selector.h b/Telegram/SourceFiles/chat_helpers/tabbed_selector.h index 4b9e61987c..2c1fa9f960 100644 --- a/Telegram/SourceFiles/chat_helpers/tabbed_selector.h +++ b/Telegram/SourceFiles/chat_helpers/tabbed_selector.h @@ -34,7 +34,9 @@ namespace Window { class SessionController; } // namespace Window -enum class SendMenuType; +namespace SendMenu { +enum class Type; +} // namespace SendMenu namespace ChatHelpers { @@ -111,7 +113,7 @@ public: _beforeHidingCallback = std::move(callback); } - void setSendMenuType(Fn callback) { + void setSendMenuType(Fn callback) { _sendMenuType = std::move(callback); } @@ -230,7 +232,7 @@ private: Fn _afterShownCallback; Fn _beforeHidingCallback; - Fn _sendMenuType; + Fn _sendMenuType; rpl::event_stream<> _showRequests; rpl::event_stream<> _slideFinished; @@ -266,7 +268,7 @@ public: } virtual void fillContextMenu( not_null menu, - SendMenuType type) { + SendMenu::Type type) { } rpl::producer scrollToRequests() const; diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index 81bad4bbef..fb1463234e 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -308,7 +308,7 @@ HistoryWidget::HistoryWidget( _fieldBarCancel->addClickHandler([=] { cancelFieldAreaState(); }); _send->addClickHandler([=] { sendButtonClicked(); }); - SetupSendMenuAndShortcuts( + SendMenu::SetupMenuAndShortcuts( _send, [=] { return sendButtonMenuType(); }, [=] { sendSilent(); }, @@ -3169,14 +3169,14 @@ void HistoryWidget::sendScheduled() { Ui::LayerOption::KeepOther); } -SendMenuType HistoryWidget::sendMenuType() const { +SendMenu::Type HistoryWidget::sendMenuType() const { return !_peer - ? SendMenuType::Disabled + ? SendMenu::Type::Disabled : _peer->isSelf() - ? SendMenuType::Reminder + ? SendMenu::Type::Reminder : HistoryView::CanScheduleUntilOnline(_peer) - ? SendMenuType::ScheduledToUser - : SendMenuType::Scheduled; + ? SendMenu::Type::ScheduledToUser + : SendMenu::Type::Scheduled; } auto HistoryWidget::computeSendButtonType() const { @@ -3192,10 +3192,10 @@ auto HistoryWidget::computeSendButtonType() const { return Type::Send; } -SendMenuType HistoryWidget::sendButtonMenuType() const { +SendMenu::Type HistoryWidget::sendButtonMenuType() const { return (computeSendButtonType() == Ui::SendButton::Type::Send) ? sendMenuType() - : SendMenuType::Disabled; + : SendMenu::Type::Disabled; } void HistoryWidget::unblockUser() { diff --git a/Telegram/SourceFiles/history/history_widget.h b/Telegram/SourceFiles/history/history_widget.h index a2d4fd2b93..e945bf72bf 100644 --- a/Telegram/SourceFiles/history/history_widget.h +++ b/Telegram/SourceFiles/history/history_widget.h @@ -26,7 +26,10 @@ struct SendingAlbum; enum class SendMediaType; enum class CompressConfirm; class MessageLinksParser; -enum class SendMenuType; + +namespace SendMenu { +enum class Type; +} // namespace SendMenu namespace Api { struct SendOptions; @@ -371,8 +374,8 @@ private: void sendWithModifiers(Qt::KeyboardModifiers modifiers); void sendSilent(); void sendScheduled(); - [[nodiscard]] SendMenuType sendMenuType() const; - [[nodiscard]] SendMenuType sendButtonMenuType() const; + [[nodiscard]] SendMenu::Type sendMenuType() const; + [[nodiscard]] SendMenu::Type sendButtonMenuType() const; void handlePendingHistoryUpdate(); void fullPeerUpdated(PeerData *peer); void toggleTabbedSelectorMode(); diff --git a/Telegram/SourceFiles/history/view/history_view_context_menu.cpp b/Telegram/SourceFiles/history/view/history_view_context_menu.cpp index 140a065934..14c2fba924 100644 --- a/Telegram/SourceFiles/history/view/history_view_context_menu.cpp +++ b/Telegram/SourceFiles/history/view/history_view_context_menu.cpp @@ -435,12 +435,12 @@ bool AddRescheduleMessageAction( const auto peer = item->history()->peer; const auto sendMenuType = !peer - ? SendMenuType::Disabled + ? SendMenu::Type::Disabled : peer->isSelf() - ? SendMenuType::Reminder + ? SendMenu::Type::Reminder : HistoryView::CanScheduleUntilOnline(peer) - ? SendMenuType::ScheduledToUser - : SendMenuType::Scheduled; + ? SendMenu::Type::ScheduledToUser + : SendMenu::Type::Scheduled; using S = Data::ScheduledMessages; const auto date = (item->date() == S::kScheduledUntilOnlineTimestamp) diff --git a/Telegram/SourceFiles/history/view/history_view_schedule_box.cpp b/Telegram/SourceFiles/history/view/history_view_schedule_box.cpp index 1b27cdee2b..73960991b3 100644 --- a/Telegram/SourceFiles/history/view/history_view_schedule_box.cpp +++ b/Telegram/SourceFiles/history/view/history_view_schedule_box.cpp @@ -603,10 +603,10 @@ bool CanScheduleUntilOnline(not_null peer) { void ScheduleBox( not_null box, - SendMenuType type, + SendMenu::Type type, Fn done, TimeId time) { - box->setTitle((type == SendMenuType::Reminder) + box->setTitle((type == SendMenu::Type::Reminder) ? tr::lng_remind_title() : tr::lng_schedule_title()); box->setWidth(st::boxWideWidth); @@ -742,14 +742,14 @@ void ScheduleBox( const auto submit = box->addButton(tr::lng_schedule_button(), [=] { save(false); }); - SetupSendMenuAndShortcuts( + SendMenu::SetupMenuAndShortcuts( submit.data(), - [=] { return SendMenuType::SilentOnly; }, + [=] { return SendMenu::Type::SilentOnly; }, [=] { save(true); }, nullptr); box->addButton(tr::lng_cancel(), [=] { box->closeBox(); }); - if (type == SendMenuType::ScheduledToUser) { + if (type == SendMenu::Type::ScheduledToUser) { const auto sendUntilOnline = box->addTopButton(st::infoTopBarMenu); FillSendUntilOnlineMenu( sendUntilOnline.data(), diff --git a/Telegram/SourceFiles/history/view/history_view_schedule_box.h b/Telegram/SourceFiles/history/view/history_view_schedule_box.h index 772507639a..da640faaa0 100644 --- a/Telegram/SourceFiles/history/view/history_view_schedule_box.h +++ b/Telegram/SourceFiles/history/view/history_view_schedule_box.h @@ -13,7 +13,9 @@ namespace Api { struct SendOptions; } // namespace Api -enum class SendMenuType; +namespace SendMenu { +enum class Type; +} // namespace SendMenu namespace HistoryView { @@ -21,14 +23,14 @@ namespace HistoryView { [[nodiscard]] bool CanScheduleUntilOnline(not_null peer); void ScheduleBox( not_null box, - SendMenuType type, + SendMenu::Type type, Fn done, TimeId time); template [[nodiscard]] object_ptr PrepareScheduleBox( Guard &&guard, - SendMenuType type, + SendMenu::Type type, Submit &&submit, TimeId scheduleTime = DefaultScheduleTime()) { return Box( diff --git a/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp b/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp index 850d89b059..d922e7bacb 100644 --- a/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp +++ b/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp @@ -14,7 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "history/history.h" #include "history/history_drag_area.h" #include "history/history_item.h" -#include "chat_helpers/send_context_menu.h" // SendMenuType. +#include "chat_helpers/send_context_menu.h" // SendMenu::Type. #include "ui/widgets/scroll_area.h" #include "ui/widgets/shadow.h" #include "ui/layers/generic_box.h" @@ -371,7 +371,7 @@ bool ScheduledWidget::confirmSendingFiles( CanScheduleUntilOnline(_history->peer) ? Api::SendType::ScheduledToUser : Api::SendType::Scheduled, - SendMenuType::Disabled); + SendMenu::Type::Disabled); //_field->setTextWithTags({}); box->setConfirmedCallback(crl::guard(this, [=]( @@ -745,12 +745,12 @@ void ScheduledWidget::sendInlineResult( _composeControls->focus(); } -SendMenuType ScheduledWidget::sendMenuType() const { +SendMenu::Type ScheduledWidget::sendMenuType() const { return _history->peer->isSelf() - ? SendMenuType::Reminder + ? SendMenu::Type::Reminder : HistoryView::CanScheduleUntilOnline(_history->peer) - ? SendMenuType::ScheduledToUser - : SendMenuType::Scheduled; + ? SendMenu::Type::ScheduledToUser + : SendMenu::Type::Scheduled; } void ScheduledWidget::setupScrollDownButton() { diff --git a/Telegram/SourceFiles/history/view/history_view_scheduled_section.h b/Telegram/SourceFiles/history/view/history_view_scheduled_section.h index 57353c9c88..3429d2a6b3 100644 --- a/Telegram/SourceFiles/history/view/history_view_scheduled_section.h +++ b/Telegram/SourceFiles/history/view/history_view_scheduled_section.h @@ -16,7 +16,10 @@ class History; enum class CompressConfirm; enum class SendMediaType; struct SendingAlbum; -enum class SendMenuType; + +namespace SendMenu { +enum class Type; +} // namespace SendMenu namespace Api { struct SendOptions; @@ -149,7 +152,7 @@ private: mtpRequestId *const saveEditMsgRequestId); void highlightSingleNewMessage(const Data::MessagesSlice &slice); void chooseAttach(); - [[nodiscard]] SendMenuType sendMenuType() const; + [[nodiscard]] SendMenu::Type sendMenuType() const; void uploadFile(const QByteArray &fileContent, SendMediaType type); bool confirmSendingFiles( diff --git a/Telegram/SourceFiles/inline_bots/inline_results_widget.cpp b/Telegram/SourceFiles/inline_bots/inline_results_widget.cpp index 73cdca3df2..335ca6cd50 100644 --- a/Telegram/SourceFiles/inline_bots/inline_results_widget.cpp +++ b/Telegram/SourceFiles/inline_bots/inline_results_widget.cpp @@ -8,7 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "inline_bots/inline_results_widget.h" #include "api/api_common.h" -#include "chat_helpers/send_context_menu.h" // FillSendMenu +#include "chat_helpers/send_context_menu.h" // SendMenu::FillSendMenu #include "data/data_photo.h" #include "data/data_document.h" #include "data/data_channel.h" @@ -308,18 +308,18 @@ void Inner::contextMenuEvent(QContextMenuEvent *e) { } const auto row = _selected / MatrixRowShift; const auto column = _selected % MatrixRowShift; - const auto type = SendMenuType::Scheduled; + const auto type = SendMenu::Type::Scheduled; _menu = base::make_unique_q(this); const auto send = [=](Api::SendOptions options) { selectInlineResult(row, column, options); }; - FillSendMenu( + SendMenu::FillSendMenu( _menu, [&] { return type; }, - DefaultSilentCallback(send), - DefaultScheduleCallback(this, type, send)); + SendMenu::DefaultSilentCallback(send), + SendMenu::DefaultScheduleCallback(this, type, send)); if (!_menu->actions().empty()) { _menu->popup(QCursor::pos());