mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fix small stories thumbnails in profile / my stories.
This commit is contained in:
parent
8a974273b9
commit
91cc5f5284
6 changed files with 29 additions and 20 deletions
|
@ -104,8 +104,6 @@ object_ptr<Ui::BoxContent> PrepareContactsBox(
|
||||||
controller->setStoriesShown(true);
|
controller->setStoriesShown(true);
|
||||||
const auto raw = controller.get();
|
const auto raw = controller.get();
|
||||||
auto init = [=](not_null<PeerListBox*> box) {
|
auto init = [=](not_null<PeerListBox*> box) {
|
||||||
using namespace Dialogs::Stories;
|
|
||||||
|
|
||||||
struct State {
|
struct State {
|
||||||
QPointer<::Ui::IconButton> toggleSort;
|
QPointer<::Ui::IconButton> toggleSort;
|
||||||
rpl::variable<Mode> mode = Mode::Online;
|
rpl::variable<Mode> mode = Mode::Online;
|
||||||
|
|
|
@ -2697,6 +2697,7 @@ void Widget::updateControlsGeometry() {
|
||||||
if (_stories) {
|
if (_stories) {
|
||||||
_stories->setLayoutConstraints(
|
_stories->setLayoutConstraints(
|
||||||
{ filterLeft + filterWidth, filterTop + added },
|
{ filterLeft + filterWidth, filterTop + added },
|
||||||
|
style::al_right,
|
||||||
{ 0, expandedStoriesTop, barw, st::dialogsStoriesFull.height });
|
{ 0, expandedStoriesTop, barw, st::dialogsStoriesFull.height });
|
||||||
}
|
}
|
||||||
if (_forumTopShadow) {
|
if (_forumTopShadow) {
|
||||||
|
|
|
@ -661,8 +661,12 @@ bool List::checkForFullState() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void List::setLayoutConstraints(QPoint topRightSmall, QRect geometryFull) {
|
void List::setLayoutConstraints(
|
||||||
_topRightSmall = topRightSmall;
|
QPoint positionSmall,
|
||||||
|
style::align alignSmall,
|
||||||
|
QRect geometryFull) {
|
||||||
|
_positionSmall = positionSmall;
|
||||||
|
_alignSmall = alignSmall;
|
||||||
_geometryFull = geometryFull;
|
_geometryFull = geometryFull;
|
||||||
updateGeometry();
|
updateGeometry();
|
||||||
update();
|
update();
|
||||||
|
@ -690,9 +694,14 @@ QRect List::countSmallGeometry() const {
|
||||||
+ st.photo + (count - 1) * st.shift
|
+ st.photo + (count - 1) * st.shift
|
||||||
+ st.photoLeft
|
+ st.photoLeft
|
||||||
+ st.left;
|
+ st.left;
|
||||||
|
const auto left = ((_alignSmall & Qt::AlignRight) == Qt::AlignRight)
|
||||||
|
? (_positionSmall.x() - width)
|
||||||
|
: ((_alignSmall & Qt::AlignCenter) == Qt::AlignCenter)
|
||||||
|
? (_positionSmall.x() - (width / 2))
|
||||||
|
: _positionSmall.x();
|
||||||
return QRect(
|
return QRect(
|
||||||
_topRightSmall.x() - width,
|
left,
|
||||||
_topRightSmall.y(),
|
_positionSmall.y(),
|
||||||
width,
|
width,
|
||||||
st.photoTop + st.photo + st.photoTop);
|
st.photoTop + st.photo + st.photoTop);
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,10 @@ public:
|
||||||
rpl::producer<Content> content);
|
rpl::producer<Content> content);
|
||||||
|
|
||||||
void setExpandedHeight(int height, bool momentum = false);
|
void setExpandedHeight(int height, bool momentum = false);
|
||||||
void setLayoutConstraints(QPoint topRightSmall, QRect geometryFull);
|
void setLayoutConstraints(
|
||||||
|
QPoint positionSmall,
|
||||||
|
style::align alignSmall,
|
||||||
|
QRect geometryFull = QRect());
|
||||||
|
|
||||||
[[nodiscard]] bool empty() const {
|
[[nodiscard]] bool empty() const {
|
||||||
return _empty.current();
|
return _empty.current();
|
||||||
|
@ -137,7 +140,8 @@ private:
|
||||||
rpl::event_stream<> _entered;
|
rpl::event_stream<> _entered;
|
||||||
rpl::event_stream<> _loadMoreRequests;
|
rpl::event_stream<> _loadMoreRequests;
|
||||||
|
|
||||||
QPoint _topRightSmall;
|
QPoint _positionSmall;
|
||||||
|
style::align _alignSmall = {};
|
||||||
QRect _geometryFull;
|
QRect _geometryFull;
|
||||||
QRect _changingGeometryFrom;
|
QRect _changingGeometryFrom;
|
||||||
State _state = State::Small;
|
State _state = State::Small;
|
||||||
|
|
|
@ -389,11 +389,10 @@ void TopBar::updateStoriesGeometry(int newWidth) {
|
||||||
}
|
}
|
||||||
const auto left = (_back ? _st.back.width : _st.titlePosition.x())
|
const auto left = (_back ? _st.back.width : _st.titlePosition.x())
|
||||||
- st::dialogsStories.left - st::dialogsStories.photoLeft;
|
- st::dialogsStories.left - st::dialogsStories.photoLeft;
|
||||||
const auto top = st::dialogsStories.height
|
const auto top = (_st.height - st::dialogsStories.height) / 2;
|
||||||
- st::dialogsStoriesFull.height
|
|
||||||
+ (_st.height - st::dialogsStories.height) / 2;
|
|
||||||
_stories->resizeToWidth(newWidth - left - right);
|
_stories->resizeToWidth(newWidth - left - right);
|
||||||
_stories->moveToLeft(left, top, newWidth);
|
_stories->moveToLeft(left, top, newWidth);
|
||||||
|
_stories->entity()->setLayoutConstraints({ 0, 0 }, style::al_left);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TopBar::paintEvent(QPaintEvent *e) {
|
void TopBar::paintEvent(QPaintEvent *e) {
|
||||||
|
|
|
@ -179,19 +179,17 @@ void InnerWidget::createButtons() {
|
||||||
if (content.elements.empty()) {
|
if (content.elements.empty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto width = st::defaultDialogRow.padding.left()
|
|
||||||
+ st::defaultDialogRow.photoSize
|
|
||||||
+ st::defaultDialogRow.padding.left();
|
|
||||||
const auto &small = st::dialogsStories;
|
const auto &small = st::dialogsStories;
|
||||||
const auto count = int(content.elements.size());
|
const auto count = int(content.elements.size());
|
||||||
const auto smallWidth = small.photo + (count - 1) * small.shift;
|
const auto smallWidth = small.photo + (count - 1) * small.shift;
|
||||||
const auto real = smallWidth;
|
const auto real = smallWidth;
|
||||||
const auto top = st::dialogsStories.height
|
const auto height = small.photo + 2 * small.photoTop;
|
||||||
- st::dialogsStoriesFull.height
|
const auto top = (size.height() - height) / 2;
|
||||||
+ (size.height() - st::dialogsStories.height) / 2;
|
const auto right = st::settingsButtonRightSkip
|
||||||
const auto right = st::settingsButtonRightSkip - (width - real) / 2;
|
- small.left
|
||||||
thumbs->resizeToWidth(width);
|
- small.photoLeft;
|
||||||
thumbs->moveToRight(right, top);
|
const auto left = size.width() - right;
|
||||||
|
thumbs->setLayoutConstraints({ left, top }, style::al_right);
|
||||||
}, thumbs->lifetime());
|
}, thumbs->lifetime());
|
||||||
thumbs->setAttribute(Qt::WA_TransparentForMouseEvents);
|
thumbs->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||||
recent->addClickHandler([=] {
|
recent->addClickHandler([=] {
|
||||||
|
|
Loading…
Add table
Reference in a new issue