Fix non-shown group thumb in media viewer.
This commit is contained in:
parent
cad8a85497
commit
df8176d671
|
@ -190,18 +190,19 @@ public:
|
||||||
Data::FileOrigin origin,
|
Data::FileOrigin origin,
|
||||||
Fn<void()> handler);
|
Fn<void()> handler);
|
||||||
|
|
||||||
int leftToUpdate() const;
|
[[nodiscard]] int leftToUpdate() const;
|
||||||
int rightToUpdate() const;
|
[[nodiscard]] int rightToUpdate() const;
|
||||||
|
|
||||||
void animateToLeft(not_null<Thumb*> next);
|
void animateToLeft(not_null<Thumb*> next);
|
||||||
void animateToRight(not_null<Thumb*> prev);
|
void animateToRight(not_null<Thumb*> prev);
|
||||||
|
|
||||||
void setState(State state);
|
void setState(State state);
|
||||||
State state() const;
|
[[nodiscard]] State state() const;
|
||||||
bool removed() const;
|
[[nodiscard]] bool inited() const;
|
||||||
|
[[nodiscard]] bool removed() const;
|
||||||
|
|
||||||
void paint(QPainter &p, int x, int y, int outerWidth, float64 progress);
|
void paint(QPainter &p, int x, int y, int outerWidth, float64 progress);
|
||||||
ClickHandlerPtr getState(QPoint point) const;
|
[[nodiscard]] ClickHandlerPtr getState(QPoint point) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QSize wantedPixSize() const;
|
QSize wantedPixSize() const;
|
||||||
|
@ -400,6 +401,10 @@ auto GroupThumbs::Thumb::state() const -> State {
|
||||||
return _state;
|
return _state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GroupThumbs::Thumb::inited() const {
|
||||||
|
return _fullWidth != 0;
|
||||||
|
}
|
||||||
|
|
||||||
bool GroupThumbs::Thumb::removed() const {
|
bool GroupThumbs::Thumb::removed() const {
|
||||||
return (_state == State::Dying) && _hiding && !_opacity.current();
|
return (_state == State::Dying) && _hiding && !_opacity.current();
|
||||||
}
|
}
|
||||||
|
@ -819,21 +824,27 @@ void GroupThumbs::paint(QPainter &p, int x, int y, int outerWidth) {
|
||||||
: _animation.value(1.);
|
: _animation.value(1.);
|
||||||
x += (_width / 2);
|
x += (_width / 2);
|
||||||
y += st::mediaviewGroupPadding.top();
|
y += st::mediaviewGroupPadding.top();
|
||||||
|
auto initedCurrentIndex = int(_items.size());
|
||||||
for (auto i = _cache.begin(); i != _cache.end();) {
|
for (auto i = _cache.begin(); i != _cache.end();) {
|
||||||
const auto &thumb = i->second;
|
const auto thumb = not_null{ i->second.get() };
|
||||||
|
const auto inited = thumb->inited();
|
||||||
thumb->paint(p, x, y, outerWidth, progress);
|
thumb->paint(p, x, y, outerWidth, progress);
|
||||||
if (thumb->removed()) {
|
if (thumb->removed()) {
|
||||||
_dying.erase(
|
_dying.erase(ranges::remove(_dying, thumb), _dying.end());
|
||||||
ranges::remove(
|
|
||||||
_dying,
|
|
||||||
thumb.get(),
|
|
||||||
[](not_null<Thumb*> thumb) { return thumb.get(); }),
|
|
||||||
_dying.end());
|
|
||||||
i = _cache.erase(i);
|
i = _cache.erase(i);
|
||||||
} else {
|
} else {
|
||||||
|
if (!inited
|
||||||
|
&& thumb->inited()
|
||||||
|
&& thumb->state() == Thumb::State::Current) {
|
||||||
|
initedCurrentIndex = ranges::find(_items, thumb)
|
||||||
|
- begin(_items);
|
||||||
|
}
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (initedCurrentIndex < _items.size()) {
|
||||||
|
animateAliveItems(initedCurrentIndex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ClickHandlerPtr GroupThumbs::getState(QPoint point) const {
|
ClickHandlerPtr GroupThumbs::getState(QPoint point) const {
|
||||||
|
|
Loading…
Reference in New Issue