mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Added sticker panel to photo editor.
This commit is contained in:
parent
216ffad80e
commit
75367f0488
4 changed files with 37 additions and 0 deletions
|
@ -39,6 +39,10 @@ photoEditorRedoButton: IconButton(historyAttach) {
|
||||||
icon: icon {{ "photo_editor/undo-flip_horizontal", photoEditorButtonIconFg }};
|
icon: icon {{ "photo_editor/undo-flip_horizontal", photoEditorButtonIconFg }};
|
||||||
iconOver: icon {{ "photo_editor/undo-flip_horizontal", photoEditorButtonIconFgOver }};
|
iconOver: icon {{ "photo_editor/undo-flip_horizontal", photoEditorButtonIconFgOver }};
|
||||||
}
|
}
|
||||||
|
photoEditorStickersButton: IconButton(historyAttach) {
|
||||||
|
icon: icon {{ "settings_stickers", photoEditorButtonIconFg }};
|
||||||
|
iconOver: icon {{ "settings_stickers", photoEditorButtonIconFgOver }};
|
||||||
|
}
|
||||||
|
|
||||||
photoEditorUndoButtonInactive: icon {{ "photo_editor/undo", photoEditorButtonIconFgInactive }};
|
photoEditorUndoButtonInactive: icon {{ "photo_editor/undo", photoEditorButtonIconFgInactive }};
|
||||||
photoEditorRedoButtonInactive: icon {{ "photo_editor/undo-flip_horizontal", photoEditorButtonIconFgInactive }};
|
photoEditorRedoButtonInactive: icon {{ "photo_editor/undo-flip_horizontal", photoEditorButtonIconFgInactive }};
|
||||||
|
|
|
@ -95,6 +95,12 @@ Paint::Paint(
|
||||||
.enable = enable,
|
.enable = enable,
|
||||||
};
|
};
|
||||||
})));
|
})));
|
||||||
|
|
||||||
|
if (controllers->stickersPanelController) {
|
||||||
|
controllers->stickersPanelController->setShowRequestChanges(
|
||||||
|
controllers->stickersPanelController->stickerChosen(
|
||||||
|
) | rpl::map_to(std::optional<bool>(false)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Paint::applyTransform(QRect geometry, int angle, bool flipped) {
|
void Paint::applyTransform(QRect geometry, int angle, bool flipped) {
|
||||||
|
|
|
@ -159,6 +159,11 @@ PhotoEditorControls::PhotoEditorControls(
|
||||||
, _paintModeButtonActive(base::make_unique_q<Ui::IconButton>(
|
, _paintModeButtonActive(base::make_unique_q<Ui::IconButton>(
|
||||||
_paintButtons,
|
_paintButtons,
|
||||||
st::photoEditorPaintModeButton))
|
st::photoEditorPaintModeButton))
|
||||||
|
, _stickersButton(controllers->stickersPanelController
|
||||||
|
? base::make_unique_q<Ui::IconButton>(
|
||||||
|
_paintButtons,
|
||||||
|
st::photoEditorStickersButton)
|
||||||
|
: nullptr)
|
||||||
, _cancel(base::make_unique_q<EdgeButton>(
|
, _cancel(base::make_unique_q<EdgeButton>(
|
||||||
this,
|
this,
|
||||||
tr::lng_cancel(tr::now),
|
tr::lng_cancel(tr::now),
|
||||||
|
@ -243,6 +248,27 @@ PhotoEditorControls::PhotoEditorControls(
|
||||||
: &st::photoEditorRedoButtonInactive);
|
: &st::photoEditorRedoButtonInactive);
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
|
|
||||||
|
if (_stickersButton) {
|
||||||
|
controllers->stickersPanelController->setShowRequestChanges(
|
||||||
|
_stickersButton->clicks(
|
||||||
|
) | rpl::map_to(std::optional<bool>(std::nullopt)));
|
||||||
|
|
||||||
|
controllers->stickersPanelController->setMoveRequestChanges(
|
||||||
|
_paintButtons->positionValue(
|
||||||
|
) | rpl::map([=](const QPoint &containerPos) {
|
||||||
|
return QPoint(
|
||||||
|
(x() + width()) / 2,
|
||||||
|
y() + containerPos.y() + _stickersButton->y());
|
||||||
|
}));
|
||||||
|
|
||||||
|
controllers->stickersPanelController->panelShown(
|
||||||
|
) | rpl::start_with_next([=](bool shown) {
|
||||||
|
_stickersButton->setIconOverride(shown
|
||||||
|
? &st::photoEditorStickersButton.iconOver
|
||||||
|
: nullptr);
|
||||||
|
}, _stickersButton->lifetime());
|
||||||
|
}
|
||||||
|
|
||||||
_flipButton->clicks(
|
_flipButton->clicks(
|
||||||
) | rpl::start_with_next([=] {
|
) | rpl::start_with_next([=] {
|
||||||
_flipped = !_flipped;
|
_flipped = !_flipped;
|
||||||
|
|
|
@ -50,6 +50,7 @@ private:
|
||||||
const base::unique_qptr<Ui::IconButton> _undoButton;
|
const base::unique_qptr<Ui::IconButton> _undoButton;
|
||||||
const base::unique_qptr<Ui::IconButton> _redoButton;
|
const base::unique_qptr<Ui::IconButton> _redoButton;
|
||||||
const base::unique_qptr<Ui::IconButton> _paintModeButtonActive;
|
const base::unique_qptr<Ui::IconButton> _paintModeButtonActive;
|
||||||
|
const base::unique_qptr<Ui::IconButton> _stickersButton;
|
||||||
|
|
||||||
const base::unique_qptr<EdgeButton> _cancel;
|
const base::unique_qptr<EdgeButton> _cancel;
|
||||||
const base::unique_qptr<EdgeButton> _done;
|
const base::unique_qptr<EdgeButton> _done;
|
||||||
|
|
Loading…
Add table
Reference in a new issue