From d2d97a3e479eaeb4a4e92a4e457b1b47c3bfa755 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Wed, 7 Jul 2021 20:51:13 +0300 Subject: [PATCH] Moved to separate file some structs for internal usage in photo editor. --- Telegram/CMakeLists.txt | 1 + Telegram/SourceFiles/editor/color_picker.h | 2 +- Telegram/SourceFiles/editor/editor_paint.h | 1 + Telegram/SourceFiles/editor/photo_editor.h | 1 + .../SourceFiles/editor/photo_editor_common.h | 18 ----------- .../SourceFiles/editor/photo_editor_content.h | 1 + .../editor/photo_editor_controls.h | 1 + .../editor/photo_editor_inner_common.h | 32 +++++++++++++++++++ 8 files changed, 38 insertions(+), 19 deletions(-) create mode 100644 Telegram/SourceFiles/editor/photo_editor_inner_common.h diff --git a/Telegram/CMakeLists.txt b/Telegram/CMakeLists.txt index 65ca3f23b1..e31886e43c 100644 --- a/Telegram/CMakeLists.txt +++ b/Telegram/CMakeLists.txt @@ -525,6 +525,7 @@ PRIVATE editor/photo_editor_content.h editor/photo_editor_controls.cpp editor/photo_editor_controls.h + editor/photo_editor_inner_common.h editor/photo_editor_layer_widget.cpp editor/photo_editor_layer_widget.h editor/scene/scene.cpp diff --git a/Telegram/SourceFiles/editor/color_picker.h b/Telegram/SourceFiles/editor/color_picker.h index 7069908f92..2be30e4c65 100644 --- a/Telegram/SourceFiles/editor/color_picker.h +++ b/Telegram/SourceFiles/editor/color_picker.h @@ -8,7 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #pragma once #include "base/unique_qptr.h" -#include "editor/photo_editor_common.h" +#include "editor/photo_editor_inner_common.h" #include "ui/effects/animations.h" namespace Ui { diff --git a/Telegram/SourceFiles/editor/editor_paint.h b/Telegram/SourceFiles/editor/editor_paint.h index d6d5664126..00bb6c0d4d 100644 --- a/Telegram/SourceFiles/editor/editor_paint.h +++ b/Telegram/SourceFiles/editor/editor_paint.h @@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/rp_widget.h" #include "editor/photo_editor_common.h" +#include "editor/photo_editor_inner_common.h" #include "editor/scene/scene_item_base.h" class QGraphicsItem; diff --git a/Telegram/SourceFiles/editor/photo_editor.h b/Telegram/SourceFiles/editor/photo_editor.h index f16abac323..3cb81a6510 100644 --- a/Telegram/SourceFiles/editor/photo_editor.h +++ b/Telegram/SourceFiles/editor/photo_editor.h @@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "base/unique_qptr.h" #include "editor/photo_editor_common.h" +#include "editor/photo_editor_inner_common.h" #include "ui/image/image.h" namespace Window { diff --git a/Telegram/SourceFiles/editor/photo_editor_common.h b/Telegram/SourceFiles/editor/photo_editor_common.h index 89cb41d228..835819e479 100644 --- a/Telegram/SourceFiles/editor/photo_editor_common.h +++ b/Telegram/SourceFiles/editor/photo_editor_common.h @@ -11,19 +11,6 @@ namespace Editor { class Scene; -struct PhotoEditorMode { - enum class Mode { - Transform, - Paint, - } mode = Mode::Transform; - - enum class Action { - None, - Save, - Discard, - } action = Action::None; -}; - struct PhotoModifications { int angle = 0; bool flipped = false; @@ -46,11 +33,6 @@ struct EditorData { bool keepAspectRatio = false; }; -struct Brush { - float sizeRatio = 0.; - QColor color; -}; - [[nodiscard]] QImage ImageModified( QImage image, const PhotoModifications &mods); diff --git a/Telegram/SourceFiles/editor/photo_editor_content.h b/Telegram/SourceFiles/editor/photo_editor_content.h index b76016ac50..4a9ed7b8ea 100644 --- a/Telegram/SourceFiles/editor/photo_editor_content.h +++ b/Telegram/SourceFiles/editor/photo_editor_content.h @@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/rp_widget.h" #include "editor/photo_editor_common.h" +#include "editor/photo_editor_inner_common.h" #include "ui/image/image.h" namespace Editor { diff --git a/Telegram/SourceFiles/editor/photo_editor_controls.h b/Telegram/SourceFiles/editor/photo_editor_controls.h index 9b018f0c59..6538abce08 100644 --- a/Telegram/SourceFiles/editor/photo_editor_controls.h +++ b/Telegram/SourceFiles/editor/photo_editor_controls.h @@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/effects/animations.h" #include "editor/photo_editor_common.h" +#include "editor/photo_editor_inner_common.h" namespace Ui { class IconButton; diff --git a/Telegram/SourceFiles/editor/photo_editor_inner_common.h b/Telegram/SourceFiles/editor/photo_editor_inner_common.h new file mode 100644 index 0000000000..f3b33b5d59 --- /dev/null +++ b/Telegram/SourceFiles/editor/photo_editor_inner_common.h @@ -0,0 +1,32 @@ +/* +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 + +namespace Editor { + +class Scene; + +struct PhotoEditorMode { + enum class Mode { + Transform, + Paint, + } mode = Mode::Transform; + + enum class Action { + None, + Save, + Discard, + } action = Action::None; +}; + +struct Brush { + float sizeRatio = 0.; + QColor color; +}; + +} // namespace Editor