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:
parent
b36a38e716
commit
3757f733cc
|
@ -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)
|
void ChatLine::visibilityChanged(bool visible)
|
||||||
{
|
{
|
||||||
if (isVisible != visible) {
|
if (isVisible != visible) {
|
||||||
|
@ -55,11 +47,6 @@ void ChatLine::visibilityChanged(bool visible)
|
||||||
isVisible = visible;
|
isVisible = visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ChatLine::getRow() const
|
|
||||||
{
|
|
||||||
return row;
|
|
||||||
}
|
|
||||||
|
|
||||||
ChatLineContent* ChatLine::getContent(int col) const
|
ChatLineContent* ChatLine::getContent(int col) const
|
||||||
{
|
{
|
||||||
if (col < static_cast<int>(content.size()) && col >= 0)
|
if (col < static_cast<int>(content.size()) && col >= 0)
|
||||||
|
@ -153,6 +140,7 @@ void ChatLine::addColumn(ChatLineContent* item, ColumnFormat fmt)
|
||||||
|
|
||||||
format.push_back(fmt);
|
format.push_back(fmt);
|
||||||
content.push_back(item);
|
content.push_back(item);
|
||||||
|
item->setIndex(0, content.size() -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatLine::replaceContent(int col, ChatLineContent* lineContent)
|
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;
|
return lhs->sceneBoundingRect().bottom() < rhs;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ChatLine::lessThanRowIndex(const ChatLine::Ptr& lhs, const ChatLine::Ptr& rhs)
|
|
||||||
{
|
|
||||||
return lhs->getRow() < rhs->getRow();
|
|
||||||
}
|
|
||||||
|
|
|
@ -84,7 +84,6 @@ public:
|
||||||
void reloadTheme();
|
void reloadTheme();
|
||||||
|
|
||||||
int getColumnCount();
|
int getColumnCount();
|
||||||
int getRow() const;
|
|
||||||
|
|
||||||
ChatLineContent* getContent(int col) const;
|
ChatLineContent* getContent(int col) const;
|
||||||
ChatLineContent* getContent(QPointF scenePos) const;
|
ChatLineContent* getContent(QPointF scenePos) const;
|
||||||
|
@ -94,7 +93,6 @@ public:
|
||||||
// comparators
|
// comparators
|
||||||
static bool lessThanBSRectTop(const ChatLine::Ptr& lhs, const qreal& rhs);
|
static bool lessThanBSRectTop(const ChatLine::Ptr& lhs, const qreal& rhs);
|
||||||
static bool lessThanBSRectBottom(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:
|
protected:
|
||||||
friend class ChatLog;
|
friend class ChatLog;
|
||||||
|
@ -103,7 +101,6 @@ protected:
|
||||||
|
|
||||||
void addColumn(ChatLineContent* item, ColumnFormat fmt);
|
void addColumn(ChatLineContent* item, ColumnFormat fmt);
|
||||||
void updateBBox();
|
void updateBBox();
|
||||||
void setRow(int idx);
|
|
||||||
void visibilityChanged(bool visible);
|
void visibilityChanged(bool visible);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -30,11 +30,6 @@ int ChatLineContent::getColumn() const
|
||||||
return col;
|
return col;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ChatLineContent::getRow() const
|
|
||||||
{
|
|
||||||
return row;
|
|
||||||
}
|
|
||||||
|
|
||||||
int ChatLineContent::type() const
|
int ChatLineContent::type() const
|
||||||
{
|
{
|
||||||
return GraphicsItemType::ChatLineContentType;
|
return GraphicsItemType::ChatLineContentType;
|
||||||
|
|
|
@ -35,7 +35,6 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
int getColumn() const;
|
int getColumn() const;
|
||||||
int getRow() const;
|
|
||||||
|
|
||||||
virtual void setWidth(qreal width) = 0;
|
virtual void setWidth(qreal width) = 0;
|
||||||
int type() const final;
|
int type() const final;
|
||||||
|
|
|
@ -932,13 +932,6 @@ void ChatLog::checkVisibility()
|
||||||
|
|
||||||
visibleLines = newVisibleLines;
|
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()) {
|
if (!visibleLines.isEmpty()) {
|
||||||
emit firstVisibleLineChanged(lastLineBeforeVisible, visibleLines.at(0));
|
emit firstVisibleLineChanged(lastLineBeforeVisible, visibleLines.at(0));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user