mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +02:00
Fix media spoiler/caption-above edit in topics/scheduled.
This commit is contained in:
parent
36766e7546
commit
c1b95afd88
2 changed files with 39 additions and 2 deletions
|
@ -139,6 +139,8 @@ public:
|
|||
void previewReady(rpl::producer<Controls::WebpageParsed> parsed);
|
||||
void previewUnregister();
|
||||
|
||||
void mediaEditManagerApply(SendMenu::Action action);
|
||||
|
||||
[[nodiscard]] bool isDisplayed() const;
|
||||
[[nodiscard]] bool isEditingMessage() const;
|
||||
[[nodiscard]] bool readyToForward() const;
|
||||
|
@ -150,6 +152,7 @@ public:
|
|||
[[nodiscard]] rpl::producer<> editPhotoRequests() const;
|
||||
[[nodiscard]] rpl::producer<> editOptionsRequests() const;
|
||||
[[nodiscard]] MessageToEdit queryToEdit();
|
||||
[[nodiscard]] SendMenu::Details saveMenuDetails(bool hasSendText) const;
|
||||
|
||||
[[nodiscard]] FullReplyTo getDraftReply() const;
|
||||
[[nodiscard]] rpl::producer<> editCancelled() const {
|
||||
|
@ -529,6 +532,10 @@ void FieldHeader::previewUnregister() {
|
|||
_previewLifetime.destroy();
|
||||
}
|
||||
|
||||
void FieldHeader::mediaEditManagerApply(SendMenu::Action action) {
|
||||
_mediaEditManager.apply(action);
|
||||
}
|
||||
|
||||
void FieldHeader::paintWebPage(Painter &p, not_null<PeerData*> context) {
|
||||
Expects(!!_preview.parsed);
|
||||
|
||||
|
@ -736,8 +743,12 @@ void FieldHeader::updateControlsGeometry(QSize size) {
|
|||
void FieldHeader::editMessage(FullMsgId id, bool photoEditAllowed) {
|
||||
_photoEditAllowed = photoEditAllowed;
|
||||
_editMsgId = id;
|
||||
if (!photoEditAllowed) {
|
||||
if (!id) {
|
||||
_mediaEditManager.cancel();
|
||||
} else if (const auto item = _show->session().data().message(id)) {
|
||||
_mediaEditManager.start(item);
|
||||
}
|
||||
if (!photoEditAllowed) {
|
||||
_inPhotoEdit = false;
|
||||
_inPhotoEditOver.stop();
|
||||
}
|
||||
|
@ -790,6 +801,12 @@ MessageToEdit FieldHeader::queryToEdit() {
|
|||
};
|
||||
}
|
||||
|
||||
SendMenu::Details FieldHeader::saveMenuDetails(bool hasSendText) const {
|
||||
return isEditingMessage()
|
||||
? _mediaEditManager.sendMenuDetails(hasSendText)
|
||||
: SendMenu::Details();
|
||||
}
|
||||
|
||||
ComposeControls::ComposeControls(
|
||||
not_null<Ui::RpWidget*> parent,
|
||||
ComposeControlsDescriptor descriptor)
|
||||
|
@ -2208,6 +2225,19 @@ void ComposeControls::initSendButton() {
|
|||
_sendCustomRequests.fire(std::move(options));
|
||||
});
|
||||
|
||||
using namespace SendMenu;
|
||||
const auto sendAction = [=](Action action, Details details) {
|
||||
if (action.type == ActionType::CaptionUp
|
||||
|| action.type == ActionType::CaptionDown
|
||||
|| action.type == ActionType::SpoilerOn
|
||||
|| action.type == ActionType::SpoilerOff) {
|
||||
_header->mediaEditManagerApply(action);
|
||||
} else {
|
||||
SendMenu::DefaultCallback(_show, send)(action, details);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
SendMenu::SetupMenuAndShortcuts(
|
||||
_send.get(),
|
||||
_show,
|
||||
|
@ -2529,8 +2559,14 @@ SendMenu::Details ComposeControls::sendMenuDetails() const {
|
|||
return !_history ? SendMenu::Details() : _sendMenuDetails();
|
||||
}
|
||||
|
||||
SendMenu::Details ComposeControls::saveMenuDetails() const {
|
||||
return _header->saveMenuDetails(HasSendText(_field));
|
||||
}
|
||||
|
||||
SendMenu::Details ComposeControls::sendButtonMenuDetails() const {
|
||||
return (computeSendButtonType() == Ui::SendButton::Type::Send)
|
||||
return (computeSendButtonType() == Ui::SendButton::Type::Save)
|
||||
? saveMenuDetails()
|
||||
: (computeSendButtonType() == Ui::SendButton::Type::Send)
|
||||
? sendMenuDetails()
|
||||
: SendMenu::Details();
|
||||
}
|
||||
|
|
|
@ -283,6 +283,7 @@ private:
|
|||
|
||||
[[nodiscard]] auto computeSendButtonType() const;
|
||||
[[nodiscard]] SendMenu::Details sendMenuDetails() const;
|
||||
[[nodiscard]] SendMenu::Details saveMenuDetails() const;
|
||||
[[nodiscard]] SendMenu::Details sendButtonMenuDetails() const;
|
||||
|
||||
[[nodiscard]] auto sendContentRequests(
|
||||
|
|
Loading…
Add table
Reference in a new issue