Added dummy buttons to PhotoEditorControls.

This commit is contained in:
23rd 2021-02-05 12:24:26 +03:00
parent d8921c7cf5
commit 99deaf6005
5 changed files with 60 additions and 2 deletions

View File

@ -0,0 +1,23 @@
/*
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
*/
using "ui/basic.style";
using "boxes/boxes.style";
using "ui/widgets/widgets.style";
using "ui/chat/chat.style";
photoEditorControlsHeight: 100px;
photoEditorRotateButton: IconButton(historyAttach) {
icon: icon {{ "send_control_attach", historyComposeIconFg }};
iconOver: icon {{ "send_control_attach", historyComposeIconFgOver }};
}
photoEditorFlipButton: IconButton(historyAttach) {
icon: icon {{ "send_control_attach", historyComposeIconFg }};
iconOver: icon {{ "send_control_attach", historyComposeIconFgOver }};
}

View File

@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "editor/photo_editor_content.h"
#include "editor/photo_editor_controls.h"
#include "styles/style_editor.h"
namespace Editor {
@ -20,7 +21,13 @@ PhotoEditor::PhotoEditor(
, _controls(base::make_unique_q<PhotoEditorControls>(this)) {
sizeValue(
) | rpl::start_with_next([=](const QSize &size) {
_content->resize(size);
const auto geometry = QRect(QPoint(), size);
const auto contentRect = geometry
- style::margins(0, 0, 0, st::photoEditorControlsHeight);
_content->setGeometry(contentRect);
const auto controlsRect = geometry
- style::margins(0, contentRect.height(), 0, 0);
_controls->setGeometry(controlsRect);
}, lifetime());
}

View File

@ -8,6 +8,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "editor/photo_editor_controls.h"
#include "ui/cached_round_corners.h"
#include "ui/widgets/buttons.h"
#include "styles/style_editor.h"
namespace Editor {
class HorizontalContainer final : public Ui::RpWidget {
@ -40,10 +43,28 @@ PhotoEditorControls::PhotoEditorControls(
not_null<Ui::RpWidget*> parent,
bool doneControls)
: RpWidget(parent)
, _buttonsContainer(base::make_unique_q<HorizontalContainer>(this)) {
, _buttonsContainer(base::make_unique_q<HorizontalContainer>(this))
, _rotateButton(base::make_unique_q<Ui::IconButton>(
_buttonsContainer,
st::photoEditorRotateButton))
, _flipButton(base::make_unique_q<Ui::IconButton>(
_buttonsContainer,
st::photoEditorFlipButton)) {
_buttonsContainer->updateChildrenPosition();
paintRequest(
) | rpl::start_with_next([=](const QRect &clip) {
Painter p(this);
Ui::FillRoundRect(
p,
_buttonsContainer->geometry(),
st::mediaviewSaveMsgBg,
Ui::MediaviewSaveCorners);
}, lifetime());
sizeValue(
) | rpl::start_with_next([=](const QSize &size) {

View File

@ -9,6 +9,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/rp_widget.h"
namespace Ui {
class IconButton;
} // namespace Ui
namespace Editor {
class HorizontalContainer;
@ -22,6 +26,8 @@ public:
private:
const base::unique_qptr<HorizontalContainer> _buttonsContainer;
const base::unique_qptr<Ui::IconButton> _rotateButton;
const base::unique_qptr<Ui::IconButton> _flipButton;
};

View File

@ -30,6 +30,7 @@ set(style_files
media/view/media_view.style
overview/overview.style
window/window.style
editor/editor.style
)
set(dependent_style_files