From 85c21ba0e4d600f4d038e7d3ad2d7b96a0f12d64 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Mon, 8 Feb 2021 06:38:07 +0300 Subject: [PATCH] Added ability to open photo editor with saved modifications. --- Telegram/SourceFiles/editor/photo_editor.cpp | 9 +++++++-- Telegram/SourceFiles/editor/photo_editor.h | 3 ++- Telegram/SourceFiles/editor/photo_editor_content.cpp | 6 ++++-- Telegram/SourceFiles/editor/photo_editor_content.h | 3 ++- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Telegram/SourceFiles/editor/photo_editor.cpp b/Telegram/SourceFiles/editor/photo_editor.cpp index 4191c7cdb..f1685f75d 100644 --- a/Telegram/SourceFiles/editor/photo_editor.cpp +++ b/Telegram/SourceFiles/editor/photo_editor.cpp @@ -15,9 +15,14 @@ namespace Editor { PhotoEditor::PhotoEditor( not_null parent, - std::shared_ptr photo) + std::shared_ptr photo, + PhotoModifications modifications) : RpWidget(parent) -, _content(base::make_unique_q(this, photo)) +, _modifications(modifications) +, _content(base::make_unique_q( + this, + photo, + modifications)) , _controls(base::make_unique_q(this)) { sizeValue( ) | rpl::start_with_next([=](const QSize &size) { diff --git a/Telegram/SourceFiles/editor/photo_editor.h b/Telegram/SourceFiles/editor/photo_editor.h index 30efacca7..c9802f966 100644 --- a/Telegram/SourceFiles/editor/photo_editor.h +++ b/Telegram/SourceFiles/editor/photo_editor.h @@ -22,7 +22,8 @@ class PhotoEditor final : public Ui::RpWidget { public: PhotoEditor( not_null parent, - std::shared_ptr photo); + std::shared_ptr photo, + PhotoModifications modifications); void save(); rpl::producer done() const; diff --git a/Telegram/SourceFiles/editor/photo_editor_content.cpp b/Telegram/SourceFiles/editor/photo_editor_content.cpp index 4b6f54bf4..54ca3a780 100644 --- a/Telegram/SourceFiles/editor/photo_editor_content.cpp +++ b/Telegram/SourceFiles/editor/photo_editor_content.cpp @@ -13,8 +13,10 @@ namespace Editor { PhotoEditorContent::PhotoEditorContent( not_null parent, - std::shared_ptr photo) -: RpWidget(parent) { + std::shared_ptr photo, + PhotoModifications modifications) +: RpWidget(parent) +, _modifications(modifications) { rpl::combine( _modifications.value(), diff --git a/Telegram/SourceFiles/editor/photo_editor_content.h b/Telegram/SourceFiles/editor/photo_editor_content.h index e77fb9906..bd87ba868 100644 --- a/Telegram/SourceFiles/editor/photo_editor_content.h +++ b/Telegram/SourceFiles/editor/photo_editor_content.h @@ -17,7 +17,8 @@ class PhotoEditorContent final : public Ui::RpWidget { public: PhotoEditorContent( not_null parent, - std::shared_ptr photo); + std::shared_ptr photo, + PhotoModifications modifications); void applyModifications(PhotoModifications modifications);