2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Adding emoji in SendFilesBox and EditCaptionBox.

This commit is contained in:
John Preston
2018-11-22 16:48:50 +04:00
parent 8d3f5820ca
commit 0a754b8982
13 changed files with 226 additions and 22 deletions

View File

@@ -140,9 +140,9 @@ QPoint HistoryDownButton::prepareRippleStartPosition() const {
void HistoryDownButton::paintEvent(QPaintEvent *e) {
Painter p(this);
auto ms = getms();
auto over = isOver();
auto down = isDown();
const auto ms = getms();
const auto over = isOver();
const auto down = isDown();
((over || down) ? _st.iconBelowOver : _st.iconBelow).paint(p, _st.iconPosition, width());
paintRipple(p, _st.rippleAreaPosition.x(), _st.rippleAreaPosition.y(), ms);
((over || down) ? _st.iconAboveOver : _st.iconAbove).paint(p, _st.iconPosition, width());
@@ -190,13 +190,20 @@ void EmojiButton::paintEvent(QPaintEvent *e) {
if (loadingState.shown < 1.) {
p.setOpacity(1. - loadingState.shown);
auto icon = _iconOverride ? _iconOverride : &(over ? _st.iconOver : _st.icon);
icon->paint(p, _st.iconPosition, width());
const auto icon = _iconOverride ? _iconOverride : &(over ? _st.iconOver : _st.icon);
auto position = _st.iconPosition;
if (position.x() < 0) {
position.setX((width() - icon->width()) / 2);
}
if (position.y() < 0) {
position.setY((height() - icon->height()) / 2);
}
icon->paint(p, position, width());
p.setOpacity(1.);
}
QRect inner(QPoint((width() - st::historyEmojiCircle.width()) / 2, st::historyEmojiCircleTop), st::historyEmojiCircle);
QRect inner(QPoint((width() - st::historyEmojiCircle.width()) / 2, (height() - st::historyEmojiCircle.height()) / 2), st::historyEmojiCircle);
const auto color = (_colorOverride
? *_colorOverride
: (over
@@ -261,6 +268,9 @@ void EmojiButton::onStateChanged(State was, StateChangeSource source) {
}
QPoint EmojiButton::prepareRippleStartPosition() const {
if (!_st.rippleAreaSize) {
return DisabledRippleStartPosition();
}
return mapFromGlobal(QCursor::pos()) - _st.rippleAreaPosition;
}