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-05-04 16:42:47 +00:00
|
|
|
#include "ui/effects/animations.h"
|
2021-03-14 09:39:55 +00:00
|
|
|
#include "editor/photo_editor_common.h"
|
2021-07-07 17:51:13 +00:00
|
|
|
#include "editor/photo_editor_inner_common.h"
|
2021-03-14 09:39:55 +00:00
|
|
|
|
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-05-02 09:16:12 +00:00
|
|
|
class ButtonBar;
|
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;
|
2021-05-03 17:04:27 +00:00
|
|
|
[[nodiscard]] rpl::producer<QPoint> colorLinePositionValue() const;
|
2021-05-04 16:42:47 +00:00
|
|
|
[[nodiscard]] rpl::producer<bool> colorLineShownValue() const;
|
2021-03-14 09:39:55 +00:00
|
|
|
|
2021-05-04 22:38:55 +00:00
|
|
|
[[nodiscard]] bool animating() const;
|
|
|
|
|
|
|
|
bool handleKeyPress(not_null<QKeyEvent*> e) const;
|
|
|
|
|
2021-03-14 09:39:55 +00:00
|
|
|
void applyMode(const PhotoEditorMode &mode);
|
2021-02-07 23:10:30 +00:00
|
|
|
|
2021-02-05 05:44:04 +00:00
|
|
|
private:
|
2021-05-04 16:42:47 +00:00
|
|
|
void showAnimated(
|
|
|
|
PhotoEditorMode::Mode mode,
|
|
|
|
anim::type animated = anim::type::normal);
|
|
|
|
|
|
|
|
int bottomButtonsTop() const;
|
2021-02-05 05:44:04 +00:00
|
|
|
|
2021-02-13 08:23:21 +00:00
|
|
|
const style::color &_bg;
|
2021-05-02 09:16:12 +00:00
|
|
|
const int _buttonHeight;
|
|
|
|
const base::unique_qptr<ButtonBar> _transformButtons;
|
2021-05-03 17:04:27 +00:00
|
|
|
const base::unique_qptr<ButtonBar> _paintTopButtons;
|
2021-05-02 09:16:12 +00:00
|
|
|
const base::unique_qptr<ButtonBar> _paintBottomButtons;
|
2021-03-14 09:39:55 +00:00
|
|
|
|
2021-05-02 09:16:12 +00:00
|
|
|
const base::unique_qptr<EdgeButton> _transformCancel;
|
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-05-02 09:16:12 +00:00
|
|
|
const base::unique_qptr<EdgeButton> _transformDone;
|
2021-03-14 09:39:55 +00:00
|
|
|
|
2021-05-02 09:16:12 +00:00
|
|
|
const base::unique_qptr<EdgeButton> _paintCancel;
|
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-05-02 09:16:12 +00:00
|
|
|
const base::unique_qptr<EdgeButton> _paintDone;
|
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-05-04 16:42:47 +00:00
|
|
|
Ui::Animations::Simple _toggledBarAnimation;
|
|
|
|
|
2021-03-14 09:39:55 +00:00
|
|
|
rpl::variable<PhotoEditorMode> _mode;
|
2022-01-04 16:48:27 +00:00
|
|
|
rpl::event_stream<not_null<QKeyEvent*>> _keyPresses;
|
2021-03-14 09:39:55 +00:00
|
|
|
|
2021-02-05 05:44:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Editor
|