feat: better UI

This commit is contained in:
ZavaruKitsu 2023-12-24 21:12:17 +03:00
parent e079a69d7e
commit 032de55103
4 changed files with 32 additions and 19 deletions

View file

@ -98,9 +98,9 @@ forumDialogJumpArrowPosition: point(3px, 3px);
forumDialogJumpPadding: margins(8px, 3px, 8px, 3px);
forumDialogJumpRadius: 11px;
dialogsOnlineBadgeStroke: 2px;
dialogsOnlineBadgeSize: 10px;
dialogsOnlineBadgeSkip: point(0px, 2px);
dialogsOnlineBadgeStroke: 3px;
dialogsOnlineBadgeSize: 12px;
dialogsOnlineBadgeSkip: point(0px, 0px);
dialogsOnlineBadgeDuration: 150;
dialogsCallBadgeSize: 16px;

View file

@ -3260,9 +3260,7 @@ bool Message::unwrapped() const {
return false;
}
const auto media = this->media();
return media
? (!hasVisibleText() && media->unwrapped())
: item->isEmpty();
return media == nullptr && item->isEmpty();
}
int Message::minWidthForMedia() const {

View file

@ -34,6 +34,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "chat_helpers/stickers_lottie.h"
#include "styles/style_chat.h"
// AyuGram includes
#include "history/view/media/history_view_media.h"
#include "ui/chat/message_bubble.h"
namespace HistoryView {
namespace {
@ -271,11 +276,19 @@ void Sticker::paintAnimationFrame(
const auto &image = _lastDiceFrame.isNull()
? frame.image
: _lastDiceFrame;
const auto prepared = (!_lastDiceFrame.isNull() && context.selected())
const auto rounding = Ui::BubbleRounding{
.topLeft = Ui::BubbleCornerRounding::Small,
.topRight = Ui::BubbleCornerRounding::Small,
.bottomLeft = Ui::BubbleCornerRounding::Small,
.bottomRight = Ui::BubbleCornerRounding::Small,
};
auto prepared = (!_lastDiceFrame.isNull() && context.selected())
? Images::Colored(
base::duplicate(image),
context.st->msgStickerOverlay()->c)
: image;
prepared = Images::Round(std::move(prepared), MediaRoundingMask(rounding));
const auto size = prepared.size() / cIntRetinaFactor();
p.drawImage(
QRect(
@ -373,6 +386,7 @@ void Sticker::paintPath(
}
QPixmap Sticker::paintedPixmap(const PaintContext &context) const {
const auto roundOptions = Images::RoundOptions(ImageRoundRadius::Large);
auto helper = std::optional<style::owned_color>();
const auto colored = (customEmojiPart() && _data->emojiUsesTextColor())
? &helper.emplace(ComputeEmojiTextColor(context)).color()
@ -381,7 +395,7 @@ QPixmap Sticker::paintedPixmap(const PaintContext &context) const {
: nullptr;
const auto good = _dataMedia->goodThumbnail();
if (const auto image = _dataMedia->getStickerLarge()) {
return image->pix(_size, { .colored = colored });
return image->pix(_size, { .colored = colored, .options = roundOptions });
//
// Inline thumbnails can't have alpha channel.
//
@ -390,11 +404,11 @@ QPixmap Sticker::paintedPixmap(const PaintContext &context) const {
// _size,
// { .colored = colored, .options = Images::Option::Blur });
} else if (good) {
return good->pix(_size, { .colored = colored });
return good->pix(_size, { .colored = colored, .options = roundOptions });
} else if (const auto thumbnail = _dataMedia->thumbnail()) {
return thumbnail->pix(
_size,
{ .colored = colored, .options = Images::Option::Blur });
{ .colored = colored, .options = Images::Option::Blur | roundOptions });
}
return QPixmap();
}

View file

@ -650,15 +650,16 @@ void Selector::finishExpand() {
}
void Selector::paintBubble(QPainter &p, int innerWidth) {
const auto &bubble = _st.icons.stripBubble;
const auto bubbleRight = std::min(
st::reactStripBubbleRight,
(innerWidth - bubble.width()) / 2);
bubble.paint(
p,
_inner.x() + innerWidth - bubbleRight - bubble.width(),
_inner.y() + _inner.height() - _collapsedTopSkip,
width());
// AyuGram: removed
// const auto &bubble = _st.icons.stripBubble;
// const auto bubbleRight = std::min(
// st::reactStripBubbleRight,
// (innerWidth - bubble.width()) / 2);
// bubble.paint(
// p,
// _inner.x() + innerWidth - bubbleRight - bubble.width(),
// _inner.y() + _inner.height() - _collapsedTopSkip,
// width());
}
void Selector::paintEvent(QPaintEvent *e) {