mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +02:00
Moved position info from ItemBases to AbstractLayoutItem.
This commit is contained in:
parent
2256482ae0
commit
c82006c6f8
7 changed files with 15 additions and 25 deletions
|
@ -120,7 +120,7 @@ void Gif::initDimensions() {
|
|||
}
|
||||
|
||||
void Gif::setPosition(int32 position) {
|
||||
ItemBase::setPosition(position);
|
||||
AbstractLayoutItem::setPosition(position);
|
||||
if (_position < 0) {
|
||||
_gif.reset();
|
||||
}
|
||||
|
@ -1358,7 +1358,7 @@ void Game::initDimensions() {
|
|||
}
|
||||
|
||||
void Game::setPosition(int32 position) {
|
||||
ItemBase::setPosition(position);
|
||||
AbstractLayoutItem::setPosition(position);
|
||||
if (_position < 0) {
|
||||
_gif.reset();
|
||||
}
|
||||
|
|
|
@ -28,14 +28,6 @@ NeverFreedPointer<DocumentItems> documentItemsMap;
|
|||
|
||||
} // namespace
|
||||
|
||||
void ItemBase::setPosition(int32 position) {
|
||||
_position = position;
|
||||
}
|
||||
|
||||
int32 ItemBase::position() const {
|
||||
return _position;
|
||||
}
|
||||
|
||||
Result *ItemBase::getResult() const {
|
||||
return _result;
|
||||
}
|
||||
|
|
|
@ -77,9 +77,6 @@ public:
|
|||
|
||||
virtual void paint(Painter &p, const QRect &clip, const PaintContext *context) const = 0;
|
||||
|
||||
virtual void setPosition(int32 position);
|
||||
int32 position() const;
|
||||
|
||||
virtual bool isFullLine() const {
|
||||
return true;
|
||||
}
|
||||
|
@ -144,8 +141,6 @@ protected:
|
|||
ClickHandlerPtr _send = ClickHandlerPtr{ new SendClickHandler() };
|
||||
ClickHandlerPtr _open = ClickHandlerPtr{ new OpenFileClickHandler() };
|
||||
|
||||
int _position = 0; // < 0 means removed from layout
|
||||
|
||||
private:
|
||||
not_null<Context*> _context;
|
||||
mutable std::shared_ptr<Data::CloudImageView> _thumbnail;
|
||||
|
|
|
@ -30,6 +30,13 @@ int AbstractLayoutItem::height() const {
|
|||
return _height;
|
||||
}
|
||||
|
||||
void AbstractLayoutItem::setPosition(int position) {
|
||||
_position = position;
|
||||
}
|
||||
int AbstractLayoutItem::position() const {
|
||||
return _position;
|
||||
}
|
||||
|
||||
bool AbstractLayoutItem::hasPoint(QPoint point) const {
|
||||
return QRect(0, 0, width(), height()).contains(point);
|
||||
}
|
||||
|
|
|
@ -27,6 +27,9 @@ public:
|
|||
[[nodiscard]] int width() const;
|
||||
[[nodiscard]] int height() const;
|
||||
|
||||
virtual void setPosition(int position);
|
||||
[[nodiscard]] int position() const;
|
||||
|
||||
[[nodiscard]] bool hasPoint(QPoint point) const;
|
||||
|
||||
virtual ~AbstractLayoutItem();
|
||||
|
@ -36,5 +39,6 @@ protected:
|
|||
int _height = 0;
|
||||
int _maxw = 0;
|
||||
int _minh = 0;
|
||||
int _position = 0; // < 0 means removed from layout
|
||||
|
||||
};
|
||||
|
|
|
@ -2063,7 +2063,7 @@ void Gif::clearHeavyPart() {
|
|||
}
|
||||
|
||||
void Gif::setPosition(int32 position) {
|
||||
ItemBase::setPosition(position);
|
||||
AbstractLayoutItem::setPosition(position);
|
||||
if (position < 0) {
|
||||
_gif.reset();
|
||||
}
|
||||
|
|
|
@ -54,13 +54,6 @@ public:
|
|||
|
||||
QDateTime dateTime() const;
|
||||
|
||||
void setPosition(int position) {
|
||||
_position = position;
|
||||
}
|
||||
int position() const {
|
||||
return _position;
|
||||
}
|
||||
|
||||
HistoryItem *getItem() const {
|
||||
return _parent;
|
||||
}
|
||||
|
@ -94,7 +87,6 @@ private:
|
|||
const not_null<HistoryItem*> _parent;
|
||||
const QDateTime _dateTime;
|
||||
std::unique_ptr<Checkbox> _check;
|
||||
int _position = 0;
|
||||
|
||||
};
|
||||
|
||||
|
@ -225,7 +217,7 @@ public:
|
|||
StateRequest request) const override;
|
||||
|
||||
void clearHeavyPart() override;
|
||||
void setPosition(int32 position);
|
||||
void setPosition(int32 position) override;
|
||||
|
||||
protected:
|
||||
float64 dataProgress() const override;
|
||||
|
|
Loading…
Add table
Reference in a new issue