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-03-14 09:39:55 +00:00
|
|
|
#include "editor/photo_editor_common.h"
|
|
|
|
|
2021-02-05 09:24:26 +00:00
|
|
|
namespace Ui {
|
|
|
|
class IconButton;
|
|
|
|
} // namespace Ui
|
|
|
|
|
2021-02-05 05:44:04 +00:00
|
|
|
namespace Editor {
|
|
|
|
|
2021-02-13 08:23:21 +00:00
|
|
|
class EdgeButton;
|
2021-02-05 08:58:10 +00:00
|
|
|
class HorizontalContainer;
|
2021-02-23 10:34:12 +00:00
|
|
|
struct Controllers;
|
2021-02-05 08:58:10 +00:00
|
|
|
|
2021-02-05 05:44:04 +00:00
|
|
|
class PhotoEditorControls final : public Ui::RpWidget {
|
|
|
|
public:
|
2021-02-05 08:58:10 +00:00
|
|
|
PhotoEditorControls(
|
|
|
|
not_null<Ui::RpWidget*> parent,
|
2021-02-23 10:34:12 +00:00
|
|
|
std::shared_ptr<Controllers> controllers,
|
2021-02-22 08:14:23 +00:00
|
|
|
const PhotoModifications modifications,
|
2021-02-05 08:58:10 +00:00
|
|
|
bool doneControls = true);
|
2021-02-05 05:44:04 +00:00
|
|
|
|
2021-02-07 23:10:30 +00:00
|
|
|
[[nodiscard]] rpl::producer<int> rotateRequests() const;
|
|
|
|
[[nodiscard]] rpl::producer<> flipRequests() const;
|
2021-02-13 04:29:31 +00:00
|
|
|
[[nodiscard]] rpl::producer<> paintModeRequests() const;
|
2021-03-14 09:39:55 +00:00
|
|
|
[[nodiscard]] rpl::producer<> doneRequests() const;
|
|
|
|
[[nodiscard]] rpl::producer<> cancelRequests() const;
|
|
|
|
|
|
|
|
void applyMode(const PhotoEditorMode &mode);
|
2021-02-07 23:10:30 +00:00
|
|
|
|
2021-02-05 05:44:04 +00:00
|
|
|
private:
|
|
|
|
|
2021-02-13 08:23:21 +00:00
|
|
|
const style::color &_bg;
|
2021-03-14 09:39:55 +00:00
|
|
|
const base::unique_qptr<HorizontalContainer> _transformButtons;
|
|
|
|
const base::unique_qptr<HorizontalContainer> _paintButtons;
|
|
|
|
|
2021-02-05 09:24:26 +00:00
|
|
|
const base::unique_qptr<Ui::IconButton> _rotateButton;
|
|
|
|
const base::unique_qptr<Ui::IconButton> _flipButton;
|
2021-02-13 04:29:31 +00:00
|
|
|
const base::unique_qptr<Ui::IconButton> _paintModeButton;
|
2021-03-14 09:39:55 +00:00
|
|
|
|
|
|
|
const base::unique_qptr<Ui::IconButton> _undoButton;
|
|
|
|
const base::unique_qptr<Ui::IconButton> _redoButton;
|
|
|
|
const base::unique_qptr<Ui::IconButton> _paintModeButtonActive;
|
2021-02-23 10:35:23 +00:00
|
|
|
const base::unique_qptr<Ui::IconButton> _stickersButton;
|
2021-03-14 09:39:55 +00:00
|
|
|
|
2021-02-13 08:23:21 +00:00
|
|
|
const base::unique_qptr<EdgeButton> _cancel;
|
|
|
|
const base::unique_qptr<EdgeButton> _done;
|
2021-02-05 08:58:10 +00:00
|
|
|
|
2021-04-03 14:58:49 +00:00
|
|
|
bool _flipped = false;
|
2021-02-22 08:14:23 +00:00
|
|
|
|
2021-03-14 09:39:55 +00:00
|
|
|
rpl::variable<PhotoEditorMode> _mode;
|
|
|
|
|
2021-02-05 05:44:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Editor
|