From a3a48a38c8dac1d5162fe0cc6e07418d12a06975 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Thu, 15 Dec 2022 22:54:58 +0300 Subject: [PATCH] Replaced callback for box showing with dedicated class in photo editor. --- Telegram/SourceFiles/editor/controllers/controllers.h | 8 ++++---- Telegram/SourceFiles/editor/editor_paint.cpp | 2 +- Telegram/SourceFiles/editor/photo_editor.cpp | 3 ++- Telegram/lib_ui | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Telegram/SourceFiles/editor/controllers/controllers.h b/Telegram/SourceFiles/editor/controllers/controllers.h index 5ca6b49e7..f694fa607 100644 --- a/Telegram/SourceFiles/editor/controllers/controllers.h +++ b/Telegram/SourceFiles/editor/controllers/controllers.h @@ -9,7 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "editor/controllers/stickers_panel_controller.h" #include "editor/controllers/undo_controller.h" -#include "ui/layers/box_content.h" +#include "ui/layers/show.h" namespace Editor { @@ -17,17 +17,17 @@ struct Controllers final { Controllers( std::unique_ptr stickersPanelController, std::unique_ptr undoController, - Fn)> showBox) + std::shared_ptr show) : stickersPanelController(std::move(stickersPanelController)) , undoController(std::move(undoController)) - , showBox(std::move(showBox)) { + , show(std::move(show)) { } ~Controllers() { }; const std::unique_ptr stickersPanelController; const std::unique_ptr undoController; - const Fn)> showBox; + const std::shared_ptr show; }; } // namespace Editor diff --git a/Telegram/SourceFiles/editor/editor_paint.cpp b/Telegram/SourceFiles/editor/editor_paint.cpp index 08125a5b0..b77e9d529 100644 --- a/Telegram/SourceFiles/editor/editor_paint.cpp +++ b/Telegram/SourceFiles/editor/editor_paint.cpp @@ -190,7 +190,7 @@ void Paint::handleMimeData(const QMimeData *data) { return; } if (!Ui::ValidateThumbDimensions(image.width(), image.height())) { - _controllers->showBox( + _controllers->show->showBox( Ui::MakeInformBox(tr::lng_edit_media_invalid_file())); return; } diff --git a/Telegram/SourceFiles/editor/photo_editor.cpp b/Telegram/SourceFiles/editor/photo_editor.cpp index 6032b8176..afaa1af34 100644 --- a/Telegram/SourceFiles/editor/photo_editor.cpp +++ b/Telegram/SourceFiles/editor/photo_editor.cpp @@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "editor/photo_editor_content.h" #include "editor/photo_editor_controls.h" #include "window/window_controller.h" +#include "window/window_session_controller.h" #include "styles/style_editor.h" namespace Editor { @@ -59,7 +60,7 @@ PhotoEditor::PhotoEditor( controller->sessionController()) : nullptr, std::make_unique(), - [=] (object_ptr c) { controller->show(std::move(c)); })) + std::make_shared(controller))) , _content(base::make_unique_q( this, photo, diff --git a/Telegram/lib_ui b/Telegram/lib_ui index 4befce5a2..b178a5d15 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit 4befce5a29d247fb17da3faafebb03578c5a989b +Subproject commit b178a5d15f4e422f4497e9c0334fe340df9d6046