Added ability to open photo editor with saved modifications.

This commit is contained in:
23rd 2021-02-08 06:38:07 +03:00
parent 4d72d20398
commit 85c21ba0e4
4 changed files with 15 additions and 6 deletions

View File

@ -15,9 +15,14 @@ namespace Editor {
PhotoEditor::PhotoEditor(
not_null<Ui::RpWidget*> parent,
std::shared_ptr<QPixmap> photo)
std::shared_ptr<QPixmap> photo,
PhotoModifications modifications)
: RpWidget(parent)
, _content(base::make_unique_q<PhotoEditorContent>(this, photo))
, _modifications(modifications)
, _content(base::make_unique_q<PhotoEditorContent>(
this,
photo,
modifications))
, _controls(base::make_unique_q<PhotoEditorControls>(this)) {
sizeValue(
) | rpl::start_with_next([=](const QSize &size) {

View File

@ -22,7 +22,8 @@ class PhotoEditor final : public Ui::RpWidget {
public:
PhotoEditor(
not_null<Ui::RpWidget*> parent,
std::shared_ptr<QPixmap> photo);
std::shared_ptr<QPixmap> photo,
PhotoModifications modifications);
void save();
rpl::producer<PhotoModifications> done() const;

View File

@ -13,8 +13,10 @@ namespace Editor {
PhotoEditorContent::PhotoEditorContent(
not_null<Ui::RpWidget*> parent,
std::shared_ptr<QPixmap> photo)
: RpWidget(parent) {
std::shared_ptr<QPixmap> photo,
PhotoModifications modifications)
: RpWidget(parent)
, _modifications(modifications) {
rpl::combine(
_modifications.value(),

View File

@ -17,7 +17,8 @@ class PhotoEditorContent final : public Ui::RpWidget {
public:
PhotoEditorContent(
not_null<Ui::RpWidget*> parent,
std::shared_ptr<QPixmap> photo);
std::shared_ptr<QPixmap> photo,
PhotoModifications modifications);
void applyModifications(PhotoModifications modifications);