1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

refactor(chatlog): Remove unused getRow functions from ChatLine

* The getRow functions would not track correctly since the rows indexes
  cannot be fixed to the view anymore
This commit is contained in:
Mick Sayson 2021-02-27 22:06:52 -08:00 committed by Anthony Bilinski
parent b36a38e716
commit 3757f733cc
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C
5 changed files with 1 additions and 34 deletions

View File

@ -37,14 +37,6 @@ ChatLine::~ChatLine()
}
}
void ChatLine::setRow(int idx)
{
row = idx;
for (int c = 0; c < static_cast<int>(content.size()); ++c)
content[c]->setIndex(row, c);
}
void ChatLine::visibilityChanged(bool visible)
{
if (isVisible != visible) {
@ -55,11 +47,6 @@ void ChatLine::visibilityChanged(bool visible)
isVisible = visible;
}
int ChatLine::getRow() const
{
return row;
}
ChatLineContent* ChatLine::getContent(int col) const
{
if (col < static_cast<int>(content.size()) && col >= 0)
@ -153,6 +140,7 @@ void ChatLine::addColumn(ChatLineContent* item, ColumnFormat fmt)
format.push_back(fmt);
content.push_back(item);
item->setIndex(0, content.size() -1 );
}
void ChatLine::replaceContent(int col, ChatLineContent* lineContent)
@ -262,8 +250,3 @@ bool ChatLine::lessThanBSRectBottom(const ChatLine::Ptr& lhs, const qreal& rhs)
{
return lhs->sceneBoundingRect().bottom() < rhs;
}
bool ChatLine::lessThanRowIndex(const ChatLine::Ptr& lhs, const ChatLine::Ptr& rhs)
{
return lhs->getRow() < rhs->getRow();
}

View File

@ -84,7 +84,6 @@ public:
void reloadTheme();
int getColumnCount();
int getRow() const;
ChatLineContent* getContent(int col) const;
ChatLineContent* getContent(QPointF scenePos) const;
@ -94,7 +93,6 @@ public:
// comparators
static bool lessThanBSRectTop(const ChatLine::Ptr& lhs, const qreal& rhs);
static bool lessThanBSRectBottom(const ChatLine::Ptr& lhs, const qreal& rhs);
static bool lessThanRowIndex(const ChatLine::Ptr& lhs, const ChatLine::Ptr& rhs);
protected:
friend class ChatLog;
@ -103,7 +101,6 @@ protected:
void addColumn(ChatLineContent* item, ColumnFormat fmt);
void updateBBox();
void setRow(int idx);
void visibilityChanged(bool visible);
private:

View File

@ -30,11 +30,6 @@ int ChatLineContent::getColumn() const
return col;
}
int ChatLineContent::getRow() const
{
return row;
}
int ChatLineContent::type() const
{
return GraphicsItemType::ChatLineContentType;

View File

@ -35,7 +35,6 @@ public:
};
int getColumn() const;
int getRow() const;
virtual void setWidth(qreal width) = 0;
int type() const final;

View File

@ -932,13 +932,6 @@ void ChatLog::checkVisibility()
visibleLines = newVisibleLines;
// enforce order
std::sort(visibleLines.begin(), visibleLines.end(), ChatLine::lessThanRowIndex);
// if (!visibleLines.empty())
// qDebug() << "visible from " << visibleLines.first()->getRow() << "to " <<
// visibleLines.last()->getRow() << " total " << visibleLines.size();
if (!visibleLines.isEmpty()) {
emit firstVisibleLineChanged(lastLineBeforeVisible, visibleLines.at(0));
}