mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-19 07:37:11 +02:00
Added initial implementation of userpic emoji builder.
This commit is contained in:
parent
6c1e9b1387
commit
9bc4c0a551
4 changed files with 116 additions and 0 deletions
|
@ -857,6 +857,8 @@ PRIVATE
|
|||
info/profile/info_profile_widget.h
|
||||
info/settings/info_settings_widget.cpp
|
||||
info/settings/info_settings_widget.h
|
||||
info/userpic/info_userpic_emoji_builder.cpp
|
||||
info/userpic/info_userpic_emoji_builder.h
|
||||
info/userpic/info_userpic_emoji_builder_widget.cpp
|
||||
info/userpic/info_userpic_emoji_builder_widget.h
|
||||
inline_bots/bot_attach_web_view.cpp
|
||||
|
|
|
@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
*/
|
||||
using "ui/basic.style";
|
||||
|
||||
using "boxes/boxes.style";
|
||||
using "ui/widgets/widgets.style";
|
||||
|
||||
userpicBuilderEmojiPreviewPadding: margins(0px, 36px, 0px, 8px);
|
||||
|
@ -22,6 +23,24 @@ userpicBuilderEmojiBubblePalettePadding: margins(12px, 8px, 12px, 8px);
|
|||
|
||||
userpicBuilderEmojiSelectorLeft: 5px;
|
||||
|
||||
userpicBuilderEmojiButton: RoundButton(defaultBoxButton) {
|
||||
textFg: boxTextFg;
|
||||
textFgOver: boxTextFg;
|
||||
textBg: boxDividerBg;
|
||||
textBgOver: boxDividerBg;
|
||||
|
||||
ripple: universalRippleAnimation;
|
||||
}
|
||||
userpicBuilderEmojiBackButton: IconButton(backButton) {
|
||||
icon: icon {{ "box_button_back", boxTextFg }};
|
||||
iconOver: icon {{ "box_button_back", boxTextFg }};
|
||||
|
||||
ripple: universalRippleAnimation;
|
||||
}
|
||||
|
||||
userpicBuilderEmojiBackPosiiton: point(8px, 8px);
|
||||
userpicBuilderEmojiSavePosiiton: point(7px, 12px);
|
||||
|
||||
userpicBuilderEmojiAccentColorSize: 30px;
|
||||
userpicBuilderEmojiBubblePadding: margins(5px, 5px, 5px, 5px);
|
||||
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
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
|
||||
*/
|
||||
#include "info/userpic/info_userpic_emoji_builder.h"
|
||||
|
||||
#include "info/userpic/info_userpic_emoji_builder_layer.h"
|
||||
#include "info/userpic/info_userpic_emoji_builder_widget.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "ui/wrap/vertical_layout.h"
|
||||
#include "window/window_session_controller.h"
|
||||
#include "styles/style_info_userpic_builder.h"
|
||||
|
||||
namespace UserpicBuilder {
|
||||
|
||||
void ShowLayer(
|
||||
not_null<Window::SessionController*> controller,
|
||||
Fn<void(QImage &&image)> &&doneCallback) {
|
||||
auto layer = std::make_unique<LayerWidget>();
|
||||
const auto layerRaw = layer.get();
|
||||
{
|
||||
struct State {
|
||||
rpl::event_stream<> clicks;
|
||||
};
|
||||
const auto state = layer->lifetime().make_state<State>();
|
||||
|
||||
const auto content = CreateUserpicBuilder(
|
||||
layerRaw,
|
||||
controller,
|
||||
BothWayCommunication{
|
||||
.triggers = state->clicks.events(),
|
||||
.result = [=, done = std::move(doneCallback)](QImage &&i) {
|
||||
done(std::move(i));
|
||||
layerRaw->closeLayer();
|
||||
},
|
||||
});
|
||||
const auto save = Ui::CreateChild<Ui::RoundButton>(
|
||||
content.get(),
|
||||
tr::lng_connection_save(),
|
||||
st::userpicBuilderEmojiButton);
|
||||
save->setTextTransform(Ui::RoundButton::TextTransform::NoTransform);
|
||||
content->sizeValue(
|
||||
) | rpl::start_with_next([=] {
|
||||
const auto &p = st::userpicBuilderEmojiSavePosiiton;
|
||||
save->moveToRight(p.x(), p.y());
|
||||
}, save->lifetime());
|
||||
|
||||
save->clicks() | rpl::to_empty | rpl::start_to_stream(
|
||||
state->clicks,
|
||||
save->lifetime());
|
||||
|
||||
const auto back = Ui::CreateChild<Ui::IconButton>(
|
||||
content.get(),
|
||||
st::userpicBuilderEmojiBackButton);
|
||||
back->setClickedCallback([=] {
|
||||
layerRaw->closeLayer();
|
||||
});
|
||||
content->sizeValue(
|
||||
) | rpl::start_with_next([=] {
|
||||
const auto &p = st::userpicBuilderEmojiBackPosiiton;
|
||||
back->moveToLeft(p.x(), p.y());
|
||||
}, back->lifetime());
|
||||
|
||||
layer->setContent(content);
|
||||
}
|
||||
|
||||
controller->showLayer(std::move(layer), Ui::LayerOption::KeepOther);
|
||||
}
|
||||
|
||||
} // namespace UserpicBuilder
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
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 Window {
|
||||
class SessionController;
|
||||
} // namespace Window
|
||||
|
||||
namespace UserpicBuilder {
|
||||
|
||||
void ShowLayer(
|
||||
not_null<Window::SessionController*> controller,
|
||||
Fn<void(QImage &&image)> &&doneCallback);
|
||||
|
||||
} // namespace UserpicBuilder
|
Loading…
Add table
Reference in a new issue