2021-02-05 05:44:04 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
|
|
|
the official desktop application for the Telegram messaging service.
|
|
|
|
|
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "ui/rp_widget.h"
|
|
|
|
|
2021-02-05 07:08:20 +00:00
|
|
|
#include "base/unique_qptr.h"
|
2021-02-20 04:27:10 +00:00
|
|
|
#include "editor/photo_editor_common.h"
|
2021-07-07 17:51:13 +00:00
|
|
|
#include "editor/photo_editor_inner_common.h"
|
2021-02-20 04:27:10 +00:00
|
|
|
#include "ui/image/image.h"
|
2021-02-05 07:08:20 +00:00
|
|
|
|
2021-02-23 10:34:12 +00:00
|
|
|
namespace Window {
|
|
|
|
class Controller;
|
|
|
|
} // namespace Window
|
|
|
|
|
2021-02-05 05:44:04 +00:00
|
|
|
namespace Editor {
|
|
|
|
|
2021-02-16 03:45:05 +00:00
|
|
|
class ColorPicker;
|
2021-02-05 05:44:04 +00:00
|
|
|
class PhotoEditorContent;
|
|
|
|
class PhotoEditorControls;
|
2021-02-23 10:34:12 +00:00
|
|
|
struct Controllers;
|
2021-02-05 05:44:04 +00:00
|
|
|
|
|
|
|
class PhotoEditor final : public Ui::RpWidget {
|
|
|
|
public:
|
|
|
|
PhotoEditor(
|
|
|
|
not_null<Ui::RpWidget*> parent,
|
2021-02-23 10:34:12 +00:00
|
|
|
not_null<Window::Controller*> controller,
|
2021-02-20 04:27:10 +00:00
|
|
|
std::shared_ptr<Image> photo,
|
2021-02-21 07:28:37 +00:00
|
|
|
PhotoModifications modifications,
|
|
|
|
EditorData data = EditorData());
|
2021-02-05 05:44:04 +00:00
|
|
|
|
2021-02-08 03:13:40 +00:00
|
|
|
void save();
|
2021-02-18 00:06:44 +00:00
|
|
|
rpl::producer<PhotoModifications> doneRequests() const;
|
|
|
|
rpl::producer<> cancelRequests() const;
|
2021-02-08 03:13:40 +00:00
|
|
|
|
2021-05-04 22:38:55 +00:00
|
|
|
void handleKeyPress(not_null<QKeyEvent*> e);
|
|
|
|
|
2021-02-05 05:44:04 +00:00
|
|
|
private:
|
|
|
|
|
2021-02-07 23:10:30 +00:00
|
|
|
PhotoModifications _modifications;
|
|
|
|
|
2021-02-23 10:34:12 +00:00
|
|
|
const std::shared_ptr<Controllers> _controllers;
|
2021-03-14 09:42:18 +00:00
|
|
|
|
2021-02-05 07:08:20 +00:00
|
|
|
base::unique_qptr<PhotoEditorContent> _content;
|
|
|
|
base::unique_qptr<PhotoEditorControls> _controls;
|
2021-02-16 03:45:05 +00:00
|
|
|
const std::unique_ptr<ColorPicker> _colorPicker;
|
2021-02-05 07:08:20 +00:00
|
|
|
|
2021-03-14 09:39:55 +00:00
|
|
|
rpl::variable<PhotoEditorMode> _mode = PhotoEditorMode{
|
|
|
|
.mode = PhotoEditorMode::Mode::Transform,
|
|
|
|
.action = PhotoEditorMode::Action::None,
|
|
|
|
};
|
2021-02-08 03:13:40 +00:00
|
|
|
rpl::event_stream<PhotoModifications> _done;
|
2021-02-18 00:06:44 +00:00
|
|
|
rpl::event_stream<> _cancel;
|
2021-02-08 03:13:40 +00:00
|
|
|
|
2021-02-05 05:44:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Editor
|