diff --git a/Telegram/SourceFiles/api/api_bot.cpp b/Telegram/SourceFiles/api/api_bot.cpp index 05c0d46928..5eeddb0a18 100644 --- a/Telegram/SourceFiles/api/api_bot.cpp +++ b/Telegram/SourceFiles/api/api_bot.cpp @@ -400,7 +400,7 @@ void ActivateBotCommand(ClickHandlerContext context, int row, int column) { } } const auto replyTo = FullReplyTo(); - const auto suggest = SuggestPostOptions(); + const auto suggest = SuggestOptions(); Window::PeerMenuCreatePoll( controller, item->history()->peer, diff --git a/Telegram/SourceFiles/api/api_common.cpp b/Telegram/SourceFiles/api/api_common.cpp index 55017ade84..9e86c94abf 100644 --- a/Telegram/SourceFiles/api/api_common.cpp +++ b/Telegram/SourceFiles/api/api_common.cpp @@ -14,7 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL namespace Api { -MTPSuggestedPost SuggestToMTP(SuggestPostOptions suggest) { +MTPSuggestedPost SuggestToMTP(SuggestOptions suggest) { using Flag = MTPDsuggestedPost::Flag; return suggest.exists ? MTP_suggestedPost( diff --git a/Telegram/SourceFiles/api/api_common.h b/Telegram/SourceFiles/api/api_common.h index 9435b8bfca..44233354be 100644 --- a/Telegram/SourceFiles/api/api_common.h +++ b/Telegram/SourceFiles/api/api_common.h @@ -19,7 +19,7 @@ namespace Api { inline constexpr auto kScheduledUntilOnlineTimestamp = TimeId(0x7FFFFFFE); -[[nodiscard]] MTPSuggestedPost SuggestToMTP(SuggestPostOptions suggest); +[[nodiscard]] MTPSuggestedPost SuggestToMTP(SuggestOptions suggest); struct SendOptions { uint64 price = 0; @@ -34,7 +34,7 @@ struct SendOptions { bool invertCaption = false; bool hideViaBot = false; crl::time ttlSeconds = 0; - SuggestPostOptions suggest; + SuggestOptions suggest; friend inline bool operator==( const SendOptions &, diff --git a/Telegram/SourceFiles/api/api_suggest_post.cpp b/Telegram/SourceFiles/api/api_suggest_post.cpp index 05d0304452..22bb20492a 100644 --- a/Telegram/SourceFiles/api/api_suggest_post.cpp +++ b/Telegram/SourceFiles/api/api_suggest_post.cpp @@ -365,7 +365,7 @@ void SendSuggest( std::shared_ptr show, not_null item, std::shared_ptr state, - Fn modify, + Fn modify, Fn done = nullptr, int starsApproved = 0) { const auto suggestion = item->Get(); @@ -437,7 +437,7 @@ void SuggestApprovalDate( show, item, state, - [=](SuggestPostOptions &options) { options.date = result; }, + [=](SuggestOptions &options) { options.date = result; }, close); }; using namespace HistoryView; @@ -454,12 +454,12 @@ void SuggestApprovalDate( void SuggestOfferForMessage( std::shared_ptr show, not_null item, - SuggestPostOptions values, + SuggestOptions values, HistoryView::SuggestMode mode) { const auto id = item->fullId(); const auto state = std::make_shared(); const auto weak = std::make_shared>(); - const auto done = [=](SuggestPostOptions result) { + const auto done = [=](SuggestOptions result) { const auto item = show->session().data().message(id); if (!item) { return; @@ -473,7 +473,7 @@ void SuggestOfferForMessage( show, item, state, - [=](SuggestPostOptions &options) { options = result; }, + [=](SuggestOptions &options) { options = result; }, close); }; using namespace HistoryView; @@ -594,7 +594,7 @@ std::shared_ptr SuggestChangesClickHandler( .messageId = FullMsgId(history->peer->id, item->id), .monoforumPeerId = monoforumPeerId, }, - SuggestPostOptions{ + SuggestOptions{ .exists = uint32(1), .priceWhole = uint32(suggestion->price.whole()), .priceNano = uint32(suggestion->price.nano()), diff --git a/Telegram/SourceFiles/boxes/edit_caption_box.cpp b/Telegram/SourceFiles/boxes/edit_caption_box.cpp index cc971734df..24c3ab7d3a 100644 --- a/Telegram/SourceFiles/boxes/edit_caption_box.cpp +++ b/Telegram/SourceFiles/boxes/edit_caption_box.cpp @@ -232,7 +232,7 @@ EditCaptionBox::EditCaptionBox( not_null controller, not_null item, TextWithTags &&text, - SuggestPostOptions suggest, + SuggestOptions suggest, bool spoilered, bool invertCaption, Ui::PreparedList &&list, @@ -273,7 +273,7 @@ void EditCaptionBox::StartMediaReplace( not_null controller, FullMsgId itemId, TextWithTags text, - SuggestPostOptions suggest, + SuggestOptions suggest, bool spoilered, bool invertCaption, Fn saved) { @@ -304,7 +304,7 @@ void EditCaptionBox::StartMediaReplace( FullMsgId itemId, Ui::PreparedList &&list, TextWithTags text, - SuggestPostOptions suggest, + SuggestOptions suggest, bool spoilered, bool invertCaption, Fn saved) { @@ -353,7 +353,7 @@ void EditCaptionBox::StartPhotoEdit( std::shared_ptr media, FullMsgId itemId, TextWithTags text, - SuggestPostOptions suggest, + SuggestOptions suggest, bool spoilered, bool invertCaption, Fn saved) { diff --git a/Telegram/SourceFiles/boxes/edit_caption_box.h b/Telegram/SourceFiles/boxes/edit_caption_box.h index 0b0c5f7f96..569039ad05 100644 --- a/Telegram/SourceFiles/boxes/edit_caption_box.h +++ b/Telegram/SourceFiles/boxes/edit_caption_box.h @@ -39,7 +39,7 @@ public: not_null controller, not_null item, TextWithTags &&text, - SuggestPostOptions suggest, + SuggestOptions suggest, bool spoilered, bool invertCaption, Ui::PreparedList &&list, @@ -50,7 +50,7 @@ public: not_null controller, FullMsgId itemId, TextWithTags text, - SuggestPostOptions suggest, + SuggestOptions suggest, bool spoilered, bool invertCaption, Fn saved); @@ -59,7 +59,7 @@ public: FullMsgId itemId, Ui::PreparedList &&list, TextWithTags text, - SuggestPostOptions suggest, + SuggestOptions suggest, bool spoilered, bool invertCaption, Fn saved); @@ -68,7 +68,7 @@ public: std::shared_ptr media, FullMsgId itemId, TextWithTags text, - SuggestPostOptions suggest, + SuggestOptions suggest, bool spoilered, bool invertCaption, Fn saved); @@ -117,7 +117,7 @@ private: const not_null _controller; const not_null _historyItem; - const SuggestPostOptions _suggest; + const SuggestOptions _suggest; const bool _isAllowedEditMedia; const Ui::AlbumType _albumType; diff --git a/Telegram/SourceFiles/boxes/star_gift_box.cpp b/Telegram/SourceFiles/boxes/star_gift_box.cpp index cb0d327a0d..608464f68d 100644 --- a/Telegram/SourceFiles/boxes/star_gift_box.cpp +++ b/Telegram/SourceFiles/boxes/star_gift_box.cpp @@ -3563,7 +3563,7 @@ void ShowUniqueGiftSellBox( void SendOfferBuyGift( std::shared_ptr show, std::shared_ptr unique, - SuggestPostOptions options, + SuggestOptions options, Fn done) { const auto randomId = base::RandomValue(); const auto owner = show->session().data().peer(unique->ownerId); @@ -3595,7 +3595,7 @@ void ShowOfferBuyBox( Expects(unique->starsMinOffer >= 0); const auto weak = std::make_shared>(); - const auto done = [=](SuggestPostOptions result) { + const auto done = [=](SuggestOptions result) { SendOfferBuyGift(show, unique, result, [=] { if (const auto strong = weak->get()) { strong->closeBox(); @@ -3603,7 +3603,7 @@ void ShowOfferBuyBox( }); }; using namespace HistoryView; - const auto options = SuggestPostOptions{ + const auto options = SuggestOptions{ .exists = 1, .priceWhole = uint32(unique->starsMinOffer), }; diff --git a/Telegram/SourceFiles/data/data_drafts.cpp b/Telegram/SourceFiles/data/data_drafts.cpp index 9aae0e8bb0..86c79f1520 100644 --- a/Telegram/SourceFiles/data/data_drafts.cpp +++ b/Telegram/SourceFiles/data/data_drafts.cpp @@ -45,7 +45,7 @@ WebPageDraft WebPageDraft::FromItem(not_null item) { Draft::Draft( const TextWithTags &textWithTags, FullReplyTo reply, - SuggestPostOptions suggest, + SuggestOptions suggest, const MessageCursor &cursor, WebPageDraft webpage, mtpRequestId saveRequestId) @@ -60,7 +60,7 @@ Draft::Draft( Draft::Draft( not_null field, FullReplyTo reply, - SuggestPostOptions suggest, + SuggestOptions suggest, WebPageDraft webpage, mtpRequestId saveRequestId) : textWithTags(field->getTextWithTags()) @@ -110,7 +110,7 @@ void ApplyPeerCloudDraft( } }, [](const auto &) {}); } - auto suggest = SuggestPostOptions(); + auto suggest = SuggestOptions(); if (!history->suggestDraftAllowed()) { // Don't apply suggest options in unsupported chats. } else if (const auto suggested = draft.vsuggested_post()) { @@ -173,7 +173,7 @@ void SetChatLinkDraft(not_null peer, TextWithEntities draft) { .topicRootId = topicRootId, .monoforumPeerId = monoforumPeerId, }, - SuggestPostOptions(), + SuggestOptions(), cursor, WebPageDraft())); history->clearLocalEditDraft(topicRootId, monoforumPeerId); diff --git a/Telegram/SourceFiles/data/data_drafts.h b/Telegram/SourceFiles/data/data_drafts.h index 683188eadb..63872d1fa6 100644 --- a/Telegram/SourceFiles/data/data_drafts.h +++ b/Telegram/SourceFiles/data/data_drafts.h @@ -52,21 +52,21 @@ struct Draft { Draft( const TextWithTags &textWithTags, FullReplyTo reply, - SuggestPostOptions suggest, + SuggestOptions suggest, const MessageCursor &cursor, WebPageDraft webpage, mtpRequestId saveRequestId = 0); Draft( not_null field, FullReplyTo reply, - SuggestPostOptions suggest, + SuggestOptions suggest, WebPageDraft webpage, mtpRequestId saveRequestId = 0); TimeId date = 0; TextWithTags textWithTags; FullReplyTo reply; // reply.messageId.msg is editMsgId for edit draft. - SuggestPostOptions suggest; + SuggestOptions suggest; MessageCursor cursor; WebPageDraft webpage; mtpRequestId saveRequestId = 0; diff --git a/Telegram/SourceFiles/data/data_msg_id.h b/Telegram/SourceFiles/data/data_msg_id.h index c7ee478618..9ed1d3036a 100644 --- a/Telegram/SourceFiles/data/data_msg_id.h +++ b/Telegram/SourceFiles/data/data_msg_id.h @@ -207,7 +207,7 @@ struct FullReplyTo { friend inline bool operator==(FullReplyTo, FullReplyTo) = default; }; -struct SuggestPostOptions { +struct SuggestOptions { uint32 exists : 1 = 0; uint32 priceWhole : 31 = 0; uint32 priceNano : 31 = 0; @@ -227,11 +227,11 @@ struct SuggestPostOptions { } friend inline auto operator<=>( - SuggestPostOptions, - SuggestPostOptions) = default; + SuggestOptions, + SuggestOptions) = default; friend inline bool operator==( - SuggestPostOptions, - SuggestPostOptions) = default; + SuggestOptions, + SuggestOptions) = default; }; struct GlobalMsgId { diff --git a/Telegram/SourceFiles/dialogs/dialogs_key.h b/Telegram/SourceFiles/dialogs/dialogs_key.h index 41c25beff6..f74fba9815 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_key.h +++ b/Telegram/SourceFiles/dialogs/dialogs_key.h @@ -121,7 +121,7 @@ struct EntryState { Section section = Section::History; FilterId filterId = 0; FullReplyTo currentReplyTo; - SuggestPostOptions currentSuggest; + SuggestOptions currentSuggest; friend inline auto operator<=>( const EntryState&, diff --git a/Telegram/SourceFiles/history/history.cpp b/Telegram/SourceFiles/history/history.cpp index ac29821ab6..1b770cb9c8 100644 --- a/Telegram/SourceFiles/history/history.cpp +++ b/Telegram/SourceFiles/history/history.cpp @@ -244,7 +244,7 @@ void History::createLocalDraftFromCloud( draft->reply.topicRootId = topicRootId; draft->reply.monoforumPeerId = monoforumPeerId; if (!suggestDraftAllowed()) { - draft->suggest = SuggestPostOptions(); + draft->suggest = SuggestOptions(); } auto existing = localDraft(topicRootId, monoforumPeerId); if (Data::DraftIsNull(existing) @@ -334,7 +334,7 @@ Data::Draft *History::createCloudDraft( .topicRootId = topicRootId, .monoforumPeerId = monoforumPeerId, }, - SuggestPostOptions(), + SuggestOptions(), MessageCursor(), Data::WebPageDraft())); cloudDraft(topicRootId, monoforumPeerId)->date = TimeId(0); @@ -362,7 +362,7 @@ Data::Draft *History::createCloudDraft( existing->reply.topicRootId = topicRootId; existing->reply.monoforumPeerId = monoforumPeerId; if (!suggestDraftAllowed()) { - existing->suggest = SuggestPostOptions(); + existing->suggest = SuggestOptions(); } } diff --git a/Telegram/SourceFiles/history/history_item_helpers.cpp b/Telegram/SourceFiles/history/history_item_helpers.cpp index 5ccdc5e4f5..f7097ee0f5 100644 --- a/Telegram/SourceFiles/history/history_item_helpers.cpp +++ b/Telegram/SourceFiles/history/history_item_helpers.cpp @@ -223,7 +223,7 @@ std::optional ComputePaymentDetails( bool SuggestPaymentDataReady( not_null peer, - SuggestPostOptions suggest) { + SuggestOptions suggest) { if (!suggest.exists || !suggest.price() || peer->amMonoforumAdmin()) { return true; } else if (suggest.ton && !peer->session().credits().tonLoaded()) { diff --git a/Telegram/SourceFiles/history/history_item_helpers.h b/Telegram/SourceFiles/history/history_item_helpers.h index f6906136c8..425dccee29 100644 --- a/Telegram/SourceFiles/history/history_item_helpers.h +++ b/Telegram/SourceFiles/history/history_item_helpers.h @@ -151,7 +151,7 @@ struct SendPaymentDetails { [[nodiscard]] bool SuggestPaymentDataReady( not_null peer, - SuggestPostOptions suggest); + SuggestOptions suggest); struct PaidConfirmStyles { const style::FlatLabel *label = nullptr; diff --git a/Telegram/SourceFiles/history/history_item_reply_markup.cpp b/Telegram/SourceFiles/history/history_item_reply_markup.cpp index 8ca15fe623..61e38a56ff 100644 --- a/Telegram/SourceFiles/history/history_item_reply_markup.cpp +++ b/Telegram/SourceFiles/history/history_item_reply_markup.cpp @@ -346,7 +346,7 @@ HistoryMessageSuggestInfo::HistoryMessageSuggestInfo( } HistoryMessageSuggestInfo::HistoryMessageSuggestInfo( - SuggestPostOptions options) { + SuggestOptions options) { if (!options.exists) { return; } diff --git a/Telegram/SourceFiles/history/history_item_reply_markup.h b/Telegram/SourceFiles/history/history_item_reply_markup.h index 03740b1ea6..f180606a35 100644 --- a/Telegram/SourceFiles/history/history_item_reply_markup.h +++ b/Telegram/SourceFiles/history/history_item_reply_markup.h @@ -152,7 +152,7 @@ struct HistoryMessageSuggestInfo { HistoryMessageSuggestInfo() = default; explicit HistoryMessageSuggestInfo(const MTPSuggestedPost *data); explicit HistoryMessageSuggestInfo(const Api::SendOptions &options); - explicit HistoryMessageSuggestInfo(SuggestPostOptions options); + explicit HistoryMessageSuggestInfo(SuggestOptions options); CreditsAmount price; TimeId date = 0; diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index 5ed8ea5964..6ffd509a83 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -3238,12 +3238,12 @@ void HistoryWidget::refreshSendGiftToggle() { } void HistoryWidget::applySuggestOptions( - SuggestPostOptions suggest, + SuggestOptions suggest, HistoryView::SuggestMode mode) { Expects(suggest.exists); using namespace HistoryView; - _suggestOptions = std::make_unique( + _suggestOptions = std::make_unique( controller()->uiShow(), _peer, suggest, @@ -6796,13 +6796,13 @@ FullReplyTo HistoryWidget::replyTo() const { : FullReplyTo(); } -SuggestPostOptions HistoryWidget::suggestOptions( +SuggestOptions HistoryWidget::suggestOptions( bool skipNoAdminCheck) const { const auto checked = skipNoAdminCheck || (_history && _history->suggestDraftAllowed()); return (checked && _suggestOptions) ? _suggestOptions->values() - : SuggestPostOptions(); + : SuggestOptions(); } bool HistoryWidget::hasSavedScroll() const { @@ -8757,12 +8757,12 @@ void HistoryWidget::setReplyFieldsFromProcessing() { if (_editMsgId) { if (const auto localDraft = _history->localDraft({}, {})) { localDraft->reply = id; - localDraft->suggest = SuggestPostOptions(); + localDraft->suggest = SuggestOptions(); } else { _history->setLocalDraft(std::make_unique( TextWithTags(), id, - SuggestPostOptions(), + SuggestOptions(), MessageCursor(), Data::WebPageDraft())); } @@ -8828,7 +8828,7 @@ void HistoryWidget::editMessage( _history->setLocalEditDraft(std::make_unique( editData, FullReplyTo{ item->fullId() }, - SuggestPostOptions(), + SuggestOptions(), cursor, previewDraft)); applyDraft(); diff --git a/Telegram/SourceFiles/history/history_widget.h b/Telegram/SourceFiles/history/history_widget.h index e04cb41f3f..7d2e521564 100644 --- a/Telegram/SourceFiles/history/history_widget.h +++ b/Telegram/SourceFiles/history/history_widget.h @@ -111,7 +111,7 @@ class TranslateBar; class ComposeSearch; class SubsectionTabs; struct SelectedQuote; -class SuggestOptions; +class SuggestOptionsBar; enum class SuggestMode; } // namespace HistoryView @@ -217,7 +217,7 @@ public: not_null peer); [[nodiscard]] FullReplyTo replyTo() const; - [[nodiscard]] SuggestPostOptions suggestOptions( + [[nodiscard]] SuggestOptions suggestOptions( bool skipNoAdminCheck = false) const; bool lastForceReplyReplied(const FullMsgId &replyTo) const; bool lastForceReplyReplied() const; @@ -686,7 +686,7 @@ private: void refreshSendGiftToggle(); void refreshSuggestPostToggle(); void applySuggestOptions( - SuggestPostOptions suggest, + SuggestOptions suggest, HistoryView::SuggestMode mode); void setupSendAsToggle(); void refreshSendAsToggle(); @@ -721,7 +721,7 @@ private: std::unique_ptr _replySpoiler; mutable base::Timer _updateEditTimeLeftDisplay; - std::unique_ptr _suggestOptions; + std::unique_ptr _suggestOptions; object_ptr _fieldBarCancel; 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 2c687a42f0..67a5903847 100644 --- a/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp +++ b/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp @@ -154,7 +154,7 @@ public: void editMessage( FullMsgId id, - SuggestPostOptions suggest, + SuggestOptions suggest, bool photoEditAllowed = false); void replyToMessage(FullReplyTo id); void updateForwarding( @@ -180,7 +180,7 @@ public: [[nodiscard]] SendMenu::Details saveMenuDetails(bool hasSendText) const; [[nodiscard]] FullReplyTo getDraftReply() const; - [[nodiscard]] SuggestPostOptions suggestOptions() const; + [[nodiscard]] SuggestOptions suggestOptions() const; [[nodiscard]] rpl::producer<> editCancelled() const { return _editCancelled.events(); } @@ -213,7 +213,7 @@ private: bool hasPreview() const; - void applySuggestOptions(SuggestPostOptions suggest, SuggestMode mode); + void applySuggestOptions(SuggestOptions suggest, SuggestMode mode); void cancelSuggestPost(); struct Preview { @@ -240,7 +240,7 @@ private: rpl::variable _editMsgId; rpl::variable _replyTo; std::unique_ptr _forwardPanel; - std::unique_ptr _suggestOptions; + std::unique_ptr _suggestOptions; rpl::producer<> _toForwardUpdated; HistoryItem *_shownMessage = nullptr; @@ -773,10 +773,10 @@ FullReplyTo FieldHeader::getDraftReply() const { : _replyTo.current(); } -SuggestPostOptions FieldHeader::suggestOptions() const { +SuggestOptions FieldHeader::suggestOptions() const { return _suggestOptions ? _suggestOptions->values() - : SuggestPostOptions(); + : SuggestOptions(); } void FieldHeader::updateControlsGeometry(QSize size) { @@ -795,7 +795,7 @@ void FieldHeader::updateControlsGeometry(QSize size) { void FieldHeader::editMessage( FullMsgId id, - SuggestPostOptions suggest, + SuggestOptions suggest, bool photoEditAllowed) { _photoEditAllowed = photoEditAllowed; _editMsgId = id; @@ -817,12 +817,12 @@ void FieldHeader::editMessage( } void FieldHeader::applySuggestOptions( - SuggestPostOptions suggest, + SuggestOptions suggest, SuggestMode mode) { Expects(suggest.exists); using namespace HistoryView; - _suggestOptions = std::make_unique( + _suggestOptions = std::make_unique( _show, _history->peer, suggest, @@ -1296,7 +1296,7 @@ void ComposeControls::setCurrentDialogsEntryState( unregisterDraftSources(); state.currentReplyTo.topicRootId = _topicRootId; state.currentReplyTo.monoforumPeerId = _monoforumPeerId; - state.currentSuggest = SuggestPostOptions(); + state.currentSuggest = SuggestOptions(); _currentDialogsEntryState = state; updateForwarding(); registerDraftSource(); @@ -1952,7 +1952,7 @@ void ComposeControls::saveFieldToHistoryLocalDraft() { std::make_unique( _field, id, - SuggestPostOptions(), + SuggestOptions(), _preview->draft())); } else { _history->clearDraft(draftKeyCurrent()); @@ -2067,7 +2067,7 @@ void ComposeControls::init() { const auto topicRootId = _topicRootId; const auto monoforumPeerId = _monoforumPeerId; const auto reply = _header->replyingToMessage(); - const auto suggest = SuggestPostOptions(); + const auto suggest = SuggestOptions(); const auto webpage = _preview->draft(); const auto done = [=]( @@ -2635,7 +2635,7 @@ void ComposeControls::applyDraft(FieldHistoryAction fieldHistoryAction) { : FullMsgId(); const auto editingSuggest = (draft && draft == editDraft) ? draft->suggest - : SuggestPostOptions(); + : SuggestOptions(); InvokeQueued(_autocomplete.get(), [=] { if (_autocomplete) { @@ -2717,7 +2717,7 @@ void ComposeControls::applyDraft(FieldHistoryAction fieldHistoryAction) { } _canReplaceMedia = _canAddMedia = false; _photoEditMedia = nullptr; - _header->editMessage(editingId, SuggestPostOptions(), false); + _header->editMessage(editingId, SuggestOptions(), false); return false; }; if (!resolve()) { @@ -3762,7 +3762,7 @@ void ComposeControls::editMessage(not_null item) { .topicRootId = key.topicRootId(), .monoforumPeerId = key.monoforumPeerId(), }, - SuggestPostOptions(), + SuggestOptions(), cursor, Data::WebPageDraft::FromItem(item))); applyDraft(); @@ -3857,7 +3857,7 @@ void ComposeControls::replyToMessage(FullReplyTo id) { std::make_unique( TextWithTags(), id, - SuggestPostOptions(), + SuggestOptions(), MessageCursor(), Data::WebPageDraft())); } diff --git a/Telegram/SourceFiles/history/view/controls/history_view_draft_options.cpp b/Telegram/SourceFiles/history/view/controls/history_view_draft_options.cpp index 417548f20d..e22cc48204 100644 --- a/Telegram/SourceFiles/history/view/controls/history_view_draft_options.cpp +++ b/Telegram/SourceFiles/history/view/controls/history_view_draft_options.cpp @@ -1387,7 +1387,7 @@ void ShowReplyToChatBox( history->setLocalDraft(std::make_unique( textWithTags, reply, - SuggestPostOptions(), + SuggestOptions(), cursor, Data::WebPageDraft())); history->clearLocalEditDraft(topicRootId, monoforumPeerId); diff --git a/Telegram/SourceFiles/history/view/controls/history_view_forward_panel.cpp b/Telegram/SourceFiles/history/view/controls/history_view_forward_panel.cpp index 5d01148138..82c4c44f0b 100644 --- a/Telegram/SourceFiles/history/view/controls/history_view_forward_panel.cpp +++ b/Telegram/SourceFiles/history/view/controls/history_view_forward_panel.cpp @@ -353,7 +353,7 @@ void ClearDraftReplyTo( .topicRootId = topicRootId, .monoforumPeerId = monoforumPeerId, }; - draft.suggest = SuggestPostOptions(); + draft.suggest = SuggestOptions(); if (Data::DraftIsNull(&draft)) { history->clearLocalDraft(topicRootId, monoforumPeerId); } else { diff --git a/Telegram/SourceFiles/history/view/controls/history_view_suggest_options.cpp b/Telegram/SourceFiles/history/view/controls/history_view_suggest_options.cpp index 680e2f92dd..270c477562 100644 --- a/Telegram/SourceFiles/history/view/controls/history_view_suggest_options.cpp +++ b/Telegram/SourceFiles/history/view/controls/history_view_suggest_options.cpp @@ -933,10 +933,10 @@ void InsufficientTonBox( }, button->lifetime()); } -SuggestOptions::SuggestOptions( +SuggestOptionsBar::SuggestOptionsBar( std::shared_ptr show, not_null peer, - SuggestPostOptions values, + SuggestOptions values, SuggestMode mode) : _show(std::move(show)) , _peer(peer) @@ -945,21 +945,29 @@ SuggestOptions::SuggestOptions( updateTexts(); } -SuggestOptions::~SuggestOptions() = default; +SuggestOptionsBar::~SuggestOptionsBar() = default; -void SuggestOptions::paintIcon(QPainter &p, int x, int y, int outerWidth) { +void SuggestOptionsBar::paintIcon( + QPainter &p, + int x, + int y, + int outerWidth) { st::historySuggestIconActive.paint( p, QPoint(x, y) + st::historySuggestIconPosition, outerWidth); } -void SuggestOptions::paintBar(QPainter &p, int x, int y, int outerWidth) { +void SuggestOptionsBar::paintBar(QPainter &p, int x, int y, int outerWidth) { paintIcon(p, x, y, outerWidth); paintLines(p, x + st::historyReplySkip, y, outerWidth); } -void SuggestOptions::paintLines(QPainter &p, int x, int y, int outerWidth) { +void SuggestOptionsBar::paintLines( + QPainter &p, + int x, + int y, + int outerWidth) { auto available = outerWidth - x - st::historyReplyCancel.width @@ -978,9 +986,9 @@ void SuggestOptions::paintLines(QPainter &p, int x, int y, int outerWidth) { }); } -void SuggestOptions::edit() { +void SuggestOptionsBar::edit() { const auto weak = std::make_shared>(); - const auto apply = [=](SuggestPostOptions values) { + const auto apply = [=](SuggestOptions values) { _values = values; updateTexts(); _updates.fire({}); @@ -996,7 +1004,7 @@ void SuggestOptions::edit() { })); } -void SuggestOptions::updateTexts() { +void SuggestOptionsBar::updateTexts() { _title.setText( st::semiboldTextStyle, ((_mode == SuggestMode::New) @@ -1009,7 +1017,7 @@ void SuggestOptions::updateTexts() { Core::TextContext({ .session = &_peer->session() })); } -TextWithEntities SuggestOptions::composeText() const { +TextWithEntities SuggestOptionsBar::composeText() const { auto helper = Ui::Text::CustomEmojiHelper(); const auto amount = _values.price().ton() ? helper.paletteDependent(Ui::Earn::IconCurrencyEmoji({ @@ -1042,17 +1050,17 @@ TextWithEntities SuggestOptions::composeText() const { ).append(date); } -SuggestPostOptions SuggestOptions::values() const { +SuggestOptions SuggestOptionsBar::values() const { auto result = _values; result.exists = 1; return result; } -rpl::producer<> SuggestOptions::updates() const { +rpl::producer<> SuggestOptionsBar::updates() const { return _updates.events(); } -rpl::lifetime &SuggestOptions::lifetime() { +rpl::lifetime &SuggestOptionsBar::lifetime() { return _lifetime; } diff --git a/Telegram/SourceFiles/history/view/controls/history_view_suggest_options.h b/Telegram/SourceFiles/history/view/controls/history_view_suggest_options.h index d663c46b46..ff04669f2f 100644 --- a/Telegram/SourceFiles/history/view/controls/history_view_suggest_options.h +++ b/Telegram/SourceFiles/history/view/controls/history_view_suggest_options.h @@ -89,8 +89,8 @@ struct StarsTonPriceArgs { struct SuggestPriceBoxArgs { not_null peer; bool updating = false; - Fn done; - SuggestPostOptions value; + Fn done; + SuggestOptions value; SuggestMode mode = SuggestMode::New; QString giftName; }; @@ -114,14 +114,14 @@ void InsufficientTonBox( not_null peer, CreditsAmount required); -class SuggestOptions final { +class SuggestOptionsBar final { public: - SuggestOptions( + SuggestOptionsBar( std::shared_ptr show, not_null peer, - SuggestPostOptions values, + SuggestOptions values, SuggestMode mode); - ~SuggestOptions(); + ~SuggestOptionsBar(); void paintBar(QPainter &p, int x, int y, int outerWidth); void edit(); @@ -129,7 +129,7 @@ public: void paintIcon(QPainter &p, int x, int y, int outerWidth); void paintLines(QPainter &p, int x, int y, int outerWidth); - [[nodiscard]] SuggestPostOptions values() const; + [[nodiscard]] SuggestOptions values() const; [[nodiscard]] rpl::producer<> updates() const; @@ -147,7 +147,7 @@ private: Ui::Text::String _title; Ui::Text::String _text; - SuggestPostOptions _values; + SuggestOptions _values; rpl::event_stream<> _updates; rpl::lifetime _lifetime; diff --git a/Telegram/SourceFiles/history/view/history_view_chat_section.cpp b/Telegram/SourceFiles/history/view/history_view_chat_section.cpp index 04b4b00483..502e5e1cc8 100644 --- a/Telegram/SourceFiles/history/view/history_view_chat_section.cpp +++ b/Telegram/SourceFiles/history/view/history_view_chat_section.cpp @@ -1858,7 +1858,7 @@ void ChatWidget::refreshTopBarActiveChat() { ? EntryState::Section::SavedSublist : EntryState::Section::Replies, .currentReplyTo = replyTo(), - .currentSuggest = SuggestPostOptions(), + .currentSuggest = SuggestOptions(), }; _topBar->setActiveChat(state, _sendAction.get()); _composeControls->setCurrentDialogsEntryState(state); diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index f9ce2d25b9..bebb6f5669 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -606,7 +606,7 @@ bool MainWidget::shareUrl( .topicRootId = topicRootId, .monoforumPeerId = monoforumPeerId, }, - SuggestPostOptions(), + SuggestOptions(), cursor, Data::WebPageDraft())); history->clearLocalEditDraft(topicRootId, monoforumPeerId); diff --git a/Telegram/SourceFiles/settings/business/settings_shortcut_messages.cpp b/Telegram/SourceFiles/settings/business/settings_shortcut_messages.cpp index eb3dc498ed..522d26981e 100644 --- a/Telegram/SourceFiles/settings/business/settings_shortcut_messages.cpp +++ b/Telegram/SourceFiles/settings/business/settings_shortcut_messages.cpp @@ -632,7 +632,7 @@ void ShortcutMessages::setupComposeControls() { .key = Dialogs::Key{ _history }, .section = Dialogs::EntryState::Section::ShortcutMessages, .currentReplyTo = replyTo(), - .currentSuggest = SuggestPostOptions(), + .currentSuggest = SuggestOptions(), }; _composeControls->setCurrentDialogsEntryState(state); diff --git a/Telegram/SourceFiles/storage/storage_account.cpp b/Telegram/SourceFiles/storage/storage_account.cpp index fd3221d346..527382b269 100644 --- a/Telegram/SourceFiles/storage/storage_account.cpp +++ b/Telegram/SourceFiles/storage/storage_account.cpp @@ -138,7 +138,7 @@ auto EmptyMessageDraftSources() } [[nodiscard]] std::pair SerializeSuggest( - SuggestPostOptions options) { + SuggestOptions options) { return { ((quint64(options.exists) << 63) | (quint64(quint32(options.date)))), @@ -148,7 +148,7 @@ auto EmptyMessageDraftSources() }; } -[[nodiscard]] SuggestPostOptions DeserializeSuggest( +[[nodiscard]] SuggestOptions DeserializeSuggest( std::pair suggest) { const auto exists = (suggest.first >> 63) ? 1 : 0; const auto date = TimeId(uint32(suggest.first & 0xFFFF'FFFFULL)); @@ -1314,7 +1314,7 @@ void Account::writeDrafts(not_null history) { const auto sizeCallback = [&]( auto&&, // key const FullReplyTo &reply, - SuggestPostOptions suggest, + SuggestOptions suggest, const TextWithTags &text, const Data::WebPageDraft &webpage, auto&&) { // cursor @@ -1345,7 +1345,7 @@ void Account::writeDrafts(not_null history) { const auto writeCallback = [&]( const Data::DraftKey &key, const FullReplyTo &reply, - SuggestPostOptions suggest, + SuggestOptions suggest, const TextWithTags &text, const Data::WebPageDraft &webpage, auto&&) { // cursor @@ -1719,7 +1719,7 @@ void Account::readDraftsWithCursorsLegacy( std::make_unique( msgData, FullReplyTo{ FullMsgId(peerId, MsgId(msgReplyTo)) }, - SuggestPostOptions(), + SuggestOptions(), MessageCursor(), Data::WebPageDraft{ .removed = (msgPreviewCancelled == 1), @@ -1731,7 +1731,7 @@ void Account::readDraftsWithCursorsLegacy( std::make_unique( editData, FullReplyTo{ FullMsgId(peerId, editMsgId) }, - SuggestPostOptions(), + SuggestOptions(), MessageCursor(), Data::WebPageDraft{ .removed = (editPreviewCancelled == 1), diff --git a/Telegram/SourceFiles/storage/storage_account.h b/Telegram/SourceFiles/storage/storage_account.h index cd845550b5..a35dcacd62 100644 --- a/Telegram/SourceFiles/storage/storage_account.h +++ b/Telegram/SourceFiles/storage/storage_account.h @@ -53,7 +53,7 @@ enum class StartResult : uchar; struct MessageDraft { FullReplyTo reply; - SuggestPostOptions suggest; + SuggestOptions suggest; TextWithTags textWithTags; Data::WebPageDraft webpage; }; diff --git a/Telegram/SourceFiles/support/support_helper.cpp b/Telegram/SourceFiles/support/support_helper.cpp index 4cb3ee2199..aec99b5df0 100644 --- a/Telegram/SourceFiles/support/support_helper.cpp +++ b/Telegram/SourceFiles/support/support_helper.cpp @@ -167,7 +167,7 @@ Data::Draft OccupiedDraft(const QString &normalizedName) { + ";n:" + normalizedName }, FullReplyTo(), - SuggestPostOptions(), + SuggestOptions(), MessageCursor(), Data::WebPageDraft() }; diff --git a/Telegram/SourceFiles/window/notifications_manager.cpp b/Telegram/SourceFiles/window/notifications_manager.cpp index 7147d8317d..0ac6ae4cfd 100644 --- a/Telegram/SourceFiles/window/notifications_manager.cpp +++ b/Telegram/SourceFiles/window/notifications_manager.cpp @@ -1249,7 +1249,7 @@ void Manager::notificationActivated( .topicRootId = topicRootId, .monoforumPeerId = monoforumPeerId, }, - SuggestPostOptions(), + SuggestOptions(), MessageCursor{ length, length, diff --git a/Telegram/SourceFiles/window/window_peer_menu.cpp b/Telegram/SourceFiles/window/window_peer_menu.cpp index 052ac47984..8f355aa290 100644 --- a/Telegram/SourceFiles/window/window_peer_menu.cpp +++ b/Telegram/SourceFiles/window/window_peer_menu.cpp @@ -1967,7 +1967,7 @@ void PeerMenuCreatePoll( not_null controller, not_null peer, FullReplyTo replyTo, - SuggestPostOptions suggest, + SuggestOptions suggest, PollData::Flags chosen, PollData::Flags disabled, Api::SendType sendType, @@ -2081,7 +2081,7 @@ void PeerMenuCreateTodoList( not_null controller, not_null peer, FullReplyTo replyTo, - SuggestPostOptions suggest, + SuggestOptions suggest, Api::SendType sendType, SendMenu::Details sendMenuDetails) { if (!peer->session().premium()) { diff --git a/Telegram/SourceFiles/window/window_peer_menu.h b/Telegram/SourceFiles/window/window_peer_menu.h index 5c5718efdb..d2afbcc4d6 100644 --- a/Telegram/SourceFiles/window/window_peer_menu.h +++ b/Telegram/SourceFiles/window/window_peer_menu.h @@ -115,7 +115,7 @@ void PeerMenuCreatePoll( not_null controller, not_null peer, FullReplyTo replyTo = FullReplyTo(), - SuggestPostOptions suggest = SuggestPostOptions(), + SuggestOptions suggest = SuggestOptions(), PollData::Flags chosen = PollData::Flags(), PollData::Flags disabled = PollData::Flags(), Api::SendType sendType = Api::SendType::Normal, @@ -130,7 +130,7 @@ void PeerMenuCreateTodoList( not_null controller, not_null peer, FullReplyTo replyTo = FullReplyTo(), - SuggestPostOptions suggest = SuggestPostOptions(), + SuggestOptions suggest = SuggestOptions(), Api::SendType sendType = Api::SendType::Normal, SendMenu::Details sendMenuDetails = SendMenu::Details()); void PeerMenuEditTodoList( diff --git a/Telegram/SourceFiles/window/window_session_controller.cpp b/Telegram/SourceFiles/window/window_session_controller.cpp index 7c1bf7cf56..03c62c8c9f 100644 --- a/Telegram/SourceFiles/window/window_session_controller.cpp +++ b/Telegram/SourceFiles/window/window_session_controller.cpp @@ -2239,7 +2239,7 @@ bool SessionController::switchInlineQuery( to.currentReplyTo.messageId.msg = MsgId(); } if (!history->suggestDraftAllowed()) { - to.currentSuggest = SuggestPostOptions(); + to.currentSuggest = SuggestOptions(); } auto draft = std::make_unique( textWithTags,