mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Make a nice selector for only-recent set.
This commit is contained in:
parent
96805b62b2
commit
610c46e26f
7 changed files with 30 additions and 13 deletions
|
@ -24,6 +24,7 @@ EmojiPan {
|
||||||
iconSkip: pixels;
|
iconSkip: pixels;
|
||||||
iconWidth: pixels;
|
iconWidth: pixels;
|
||||||
iconArea: pixels;
|
iconArea: pixels;
|
||||||
|
bg: color;
|
||||||
overBg: color;
|
overBg: color;
|
||||||
fadeLeft: icon;
|
fadeLeft: icon;
|
||||||
fadeRight: icon;
|
fadeRight: icon;
|
||||||
|
@ -198,6 +199,7 @@ defaultEmojiPan: EmojiPan {
|
||||||
iconSkip: 4px;
|
iconSkip: 4px;
|
||||||
iconWidth: 35px;
|
iconWidth: 35px;
|
||||||
iconArea: 32px;
|
iconArea: 32px;
|
||||||
|
bg: emojiPanBg;
|
||||||
overBg: emojiPanHover;
|
overBg: emojiPanHover;
|
||||||
fadeLeft: icon {{ "fade_horizontal-flip_horizontal", emojiPanCategories }};
|
fadeLeft: icon {{ "fade_horizontal-flip_horizontal", emojiPanCategories }};
|
||||||
fadeRight: icon {{ "fade_horizontal", emojiPanCategories }};
|
fadeRight: icon {{ "fade_horizontal", emojiPanCategories }};
|
||||||
|
|
|
@ -395,7 +395,9 @@ EmojiListWidget::EmojiListWidget(
|
||||||
, _picker(this)
|
, _picker(this)
|
||||||
, _showPickerTimer([=] { showPicker(); }) {
|
, _showPickerTimer([=] { showPicker(); }) {
|
||||||
setMouseTracking(true);
|
setMouseTracking(true);
|
||||||
setAttribute(Qt::WA_OpaquePaintEvent);
|
if (st().bg->c.alpha() > 0) {
|
||||||
|
setAttribute(Qt::WA_OpaquePaintEvent);
|
||||||
|
}
|
||||||
|
|
||||||
_customSingleSize = Data::FrameSizeFromTag(
|
_customSingleSize = Data::FrameSizeFromTag(
|
||||||
Data::CustomEmojiManager::SizeTag::Large
|
Data::CustomEmojiManager::SizeTag::Large
|
||||||
|
@ -778,7 +780,9 @@ void EmojiListWidget::paintEvent(QPaintEvent *e) {
|
||||||
_repaintsScheduled.clear();
|
_repaintsScheduled.clear();
|
||||||
|
|
||||||
const auto clip = e ? e->rect() : rect();
|
const auto clip = e ? e->rect() : rect();
|
||||||
p.fillRect(clip, st::emojiPanBg);
|
if (st().bg->c.alpha() > 0) {
|
||||||
|
p.fillRect(clip, st().bg);
|
||||||
|
}
|
||||||
|
|
||||||
paint(p, {}, clip);
|
paint(p, {}, clip);
|
||||||
}
|
}
|
||||||
|
|
|
@ -181,7 +181,9 @@ int Selector::countWidth(int desiredWidth, int maxWidth) {
|
||||||
(maxWidth - 2 * _skipx) / _size);
|
(maxWidth - 2 * _skipx) / _size);
|
||||||
_columns = std::min(possibleColumns, max);
|
_columns = std::min(possibleColumns, max);
|
||||||
_small = (possibleColumns - _columns > 1);
|
_small = (possibleColumns - _columns > 1);
|
||||||
_recentRows = (_strip.count() + _columns - 1) / _columns;
|
_recentRows = (_reactions.recent.size()
|
||||||
|
+ (_reactions.morePremiumAvailable ? 1 : 0)
|
||||||
|
+ _columns - 1) / _columns;
|
||||||
const auto added = (_columns < max || _reactions.customAllowed)
|
const auto added = (_columns < max || _reactions.customAllowed)
|
||||||
? Strip::AddedButton::Expand
|
? Strip::AddedButton::Expand
|
||||||
: _reactions.morePremiumAvailable
|
: _reactions.morePremiumAvailable
|
||||||
|
@ -207,10 +209,11 @@ int Selector::extendTopForCategories() const {
|
||||||
return _reactions.customAllowed ? st::reactPanelEmojiPan.footer : 0;
|
return _reactions.customAllowed ? st::reactPanelEmojiPan.footer : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Selector::desiredHeight() const {
|
int Selector::minimalHeight() const {
|
||||||
return _reactions.customAllowed
|
return _skipy
|
||||||
? st::emojiPanMaxHeight
|
+ (_recentRows * _size)
|
||||||
: (_skipy + _recentRows * _size + _skipBottom);
|
+ st::roundRadiusSmall
|
||||||
|
+ st::reactPanelEmojiPan.padding.bottom();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Selector::setSpecialExpandTopSkip(int skip) {
|
void Selector::setSpecialExpandTopSkip(int skip) {
|
||||||
|
@ -363,7 +366,9 @@ auto Selector::paintExpandingBg(QPainter &p, float64 progress)
|
||||||
const auto frame = int(base::SafeRound(progress * (kFramesCount - 1)));
|
const auto frame = int(base::SafeRound(progress * (kFramesCount - 1)));
|
||||||
const auto radiusStart = st::reactStripHeight / 2.;
|
const auto radiusStart = st::reactStripHeight / 2.;
|
||||||
const auto radiusEnd = st::roundRadiusSmall;
|
const auto radiusEnd = st::roundRadiusSmall;
|
||||||
const auto radius = radiusStart + progress * (radiusEnd - radiusStart);
|
const auto radius = _reactions.customAllowed
|
||||||
|
? (radiusStart + progress * (radiusEnd - radiusStart))
|
||||||
|
: radiusStart;
|
||||||
const auto extents = extentsForShadow();
|
const auto extents = extentsForShadow();
|
||||||
const auto expanding = anim::easeOutCirc(1., progress);
|
const auto expanding = anim::easeOutCirc(1., progress);
|
||||||
const auto expandUp = anim::interpolate(0, _collapsedTopSkip, expanding);
|
const auto expandUp = anim::interpolate(0, _collapsedTopSkip, expanding);
|
||||||
|
@ -624,6 +629,9 @@ void Selector::createList(not_null<Window::SessionController*> controller) {
|
||||||
const auto st = lifetime().make_state<style::EmojiPan>(
|
const auto st = lifetime().make_state<style::EmojiPan>(
|
||||||
st::reactPanelEmojiPan);
|
st::reactPanelEmojiPan);
|
||||||
st->padding.setTop(_skipy);
|
st->padding.setTop(_skipy);
|
||||||
|
if (!_reactions.customAllowed) {
|
||||||
|
st->bg = st::transparent;
|
||||||
|
}
|
||||||
_list = _scroll->setOwnedWidget(
|
_list = _scroll->setOwnedWidget(
|
||||||
object_ptr<EmojiListWidget>(_scroll, EmojiListDescriptor{
|
object_ptr<EmojiListWidget>(_scroll, EmojiListDescriptor{
|
||||||
.session = &controller->session(),
|
.session = &controller->session(),
|
||||||
|
@ -722,9 +730,7 @@ bool AdjustMenuGeometryForSelector(
|
||||||
const auto height = menu->height();
|
const auto height = menu->height();
|
||||||
const auto fullTop = extents.top() + categoriesTop + extend.top();
|
const auto fullTop = extents.top() + categoriesTop + extend.top();
|
||||||
const auto minimalHeight = extents.top()
|
const auto minimalHeight = extents.top()
|
||||||
+ std::min(
|
+ selector->minimalHeight()
|
||||||
selector->desiredHeight(),
|
|
||||||
categoriesTop + st::emojiPanMinHeight / 2)
|
|
||||||
+ extents.bottom();
|
+ extents.bottom();
|
||||||
const auto willBeHeightWithoutBottomPadding = fullTop
|
const auto willBeHeightWithoutBottomPadding = fullTop
|
||||||
+ height
|
+ height
|
||||||
|
|
|
@ -46,7 +46,7 @@ public:
|
||||||
int countWidth(int desiredWidth, int maxWidth);
|
int countWidth(int desiredWidth, int maxWidth);
|
||||||
[[nodiscard]] QMargins extentsForShadow() const;
|
[[nodiscard]] QMargins extentsForShadow() const;
|
||||||
[[nodiscard]] int extendTopForCategories() const;
|
[[nodiscard]] int extendTopForCategories() const;
|
||||||
[[nodiscard]] int desiredHeight() const;
|
[[nodiscard]] int minimalHeight() const;
|
||||||
void setSpecialExpandTopSkip(int skip);
|
void setSpecialExpandTopSkip(int skip);
|
||||||
void initGeometry(int innerTop);
|
void initGeometry(int innerTop);
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@ constexpr auto kHoverScale = 1.24;
|
||||||
.json = media->bytes(),
|
.json = media->bytes(),
|
||||||
.sizeOverride = QSize(size, size),
|
.sizeOverride = QSize(size, size),
|
||||||
.frame = frame,
|
.frame = frame,
|
||||||
|
.limitFps = true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -268,6 +268,10 @@ LottieIcon CreateLottieIcon(
|
||||||
not_null<QWidget*> parent,
|
not_null<QWidget*> parent,
|
||||||
Lottie::IconDescriptor &&descriptor,
|
Lottie::IconDescriptor &&descriptor,
|
||||||
style::margins padding) {
|
style::margins padding) {
|
||||||
|
Expects(!descriptor.frame); // I'm not sure it considers limitFps.
|
||||||
|
|
||||||
|
descriptor.limitFps = true;
|
||||||
|
|
||||||
auto object = object_ptr<Ui::RpWidget>(parent);
|
auto object = object_ptr<Ui::RpWidget>(parent);
|
||||||
const auto raw = object.data();
|
const auto raw = object.data();
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit f3563bc6b0e042095d4d667d013f62cb8ae62b65
|
Subproject commit d4764ed8bf0ba2309847bca99f7f8b3d58db25b4
|
Loading…
Add table
Reference in a new issue