2021-02-05 08:44:04 +03: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 19:42:47 +03:00
|
|
|
#include "ui/effects/animations.h"
|
2021-03-14 12:39:55 +03:00
|
|
|
#include "editor/photo_editor_common.h"
|
2021-07-07 20:51:13 +03:00
|
|
|
#include "editor/photo_editor_inner_common.h"
|
2021-03-14 12:39:55 +03:00
|
|
|
|
2021-02-05 12:24:26 +03:00
|
|
|
namespace Ui {
|
|
|
|
class IconButton;
|
|
|
|
} // namespace Ui
|
|
|
|
|
2021-02-05 08:44:04 +03:00
|
|
|
namespace Editor {
|
|
|
|
|
2021-02-13 11:23:21 +03:00
|
|
|
class EdgeButton;
|
2021-05-02 12:16:12 +03:00
|
|
|
class ButtonBar;
|
2021-02-23 13:34:12 +03:00
|
|
|
struct Controllers;
|
2021-02-05 11:58:10 +03:00
|
|
|
|
2021-02-05 08:44:04 +03:00
|
|
|
class PhotoEditorControls final : public Ui::RpWidget {
|
|
|
|
public:
|
2021-02-05 11:58:10 +03:00
|
|
|
PhotoEditorControls(
|
|
|
|
not_null<Ui::RpWidget*> parent,
|
2021-02-23 13:34:12 +03:00
|
|
|
std::shared_ptr<Controllers> controllers,
|
2021-02-22 11:14:23 +03:00
|
|
|
const PhotoModifications modifications,
|
2021-02-05 11:58:10 +03:00
|
|
|
bool doneControls = true);
|
2021-02-05 08:44:04 +03:00
|
|
|
|
2021-02-08 02:10:30 +03:00
|
|
|
[[nodiscard]] rpl::producer<int> rotateRequests() const;
|
|
|
|
[[nodiscard]] rpl::producer<> flipRequests() const;
|
2021-02-13 07:29:31 +03:00
|
|
|
[[nodiscard]] rpl::producer<> paintModeRequests() const;
|
2021-03-14 12:39:55 +03:00
|
|
|
[[nodiscard]] rpl::producer<> doneRequests() const;
|
|
|
|
[[nodiscard]] rpl::producer<> cancelRequests() const;
|
2021-05-03 20:04:27 +03:00
|
|
|
[[nodiscard]] rpl::producer<QPoint> colorLinePositionValue() const;
|
2021-05-04 19:42:47 +03:00
|
|
|
[[nodiscard]] rpl::producer<bool> colorLineShownValue() const;
|
2021-03-14 12:39:55 +03:00
|
|
|
|
2021-05-05 01:38:55 +03:00
|
|
|
[[nodiscard]] bool animating() const;
|
|
|
|
|
|
|
|
bool handleKeyPress(not_null<QKeyEvent*> e) const;
|
|
|
|
|
2021-03-14 12:39:55 +03:00
|
|
|
void applyMode(const PhotoEditorMode &mode);
|
2021-02-08 02:10:30 +03:00
|
|
|
|
2021-02-05 08:44:04 +03:00
|
|
|
private:
|
2021-05-04 19:42:47 +03:00
|
|
|
void showAnimated(
|
|
|
|
PhotoEditorMode::Mode mode,
|
|
|
|
anim::type animated = anim::type::normal);
|
|
|
|
|
|
|
|
int bottomButtonsTop() const;
|
2021-02-05 08:44:04 +03:00
|
|
|
|
2021-02-13 11:23:21 +03:00
|
|
|
const style::color &_bg;
|
2021-05-02 12:16:12 +03:00
|
|
|
const int _buttonHeight;
|
|
|
|
const base::unique_qptr<ButtonBar> _transformButtons;
|
2021-05-03 20:04:27 +03:00
|
|
|
const base::unique_qptr<ButtonBar> _paintTopButtons;
|
2021-05-02 12:16:12 +03:00
|
|
|
const base::unique_qptr<ButtonBar> _paintBottomButtons;
|
2021-03-14 12:39:55 +03:00
|
|
|
|
2021-05-02 12:16:12 +03:00
|
|
|
const base::unique_qptr<EdgeButton> _transformCancel;
|
2021-02-05 12:24:26 +03:00
|
|
|
const base::unique_qptr<Ui::IconButton> _rotateButton;
|
|
|
|
const base::unique_qptr<Ui::IconButton> _flipButton;
|
2021-02-13 07:29:31 +03:00
|
|
|
const base::unique_qptr<Ui::IconButton> _paintModeButton;
|
2021-05-02 12:16:12 +03:00
|
|
|
const base::unique_qptr<EdgeButton> _transformDone;
|
2021-03-14 12:39:55 +03:00
|
|
|
|
2021-05-02 12:16:12 +03:00
|
|
|
const base::unique_qptr<EdgeButton> _paintCancel;
|
2021-03-14 12:39:55 +03: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 13:35:23 +03:00
|
|
|
const base::unique_qptr<Ui::IconButton> _stickersButton;
|
2021-05-02 12:16:12 +03:00
|
|
|
const base::unique_qptr<EdgeButton> _paintDone;
|
2021-02-05 11:58:10 +03:00
|
|
|
|
2021-04-03 17:58:49 +03:00
|
|
|
bool _flipped = false;
|
2021-02-22 11:14:23 +03:00
|
|
|
|
2021-05-04 19:42:47 +03:00
|
|
|
Ui::Animations::Simple _toggledBarAnimation;
|
|
|
|
|
2021-03-14 12:39:55 +03:00
|
|
|
rpl::variable<PhotoEditorMode> _mode;
|
2022-01-04 19:48:27 +03:00
|
|
|
rpl::event_stream<not_null<QKeyEvent*>> _keyPresses;
|
2021-03-14 12:39:55 +03:00
|
|
|
|
2021-02-05 08:44:04 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Editor
|