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