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

renamed get/setRowIndex to get/setRow

This commit is contained in:
krepa098 2015-01-20 10:31:50 +01:00
parent bb29536df1
commit 5d5a0903f7
3 changed files with 19 additions and 19 deletions

View File

@ -40,12 +40,12 @@ ChatLine::~ChatLine()
} }
} }
void ChatLine::setRowIndex(int idx) void ChatLine::setRow(int idx)
{ {
rowIndex = idx; row = idx;
for(int c = 0; c < static_cast<int>(content.size()); ++c) for(int c = 0; c < static_cast<int>(content.size()); ++c)
content[c]->setIndex(rowIndex, c); content[c]->setIndex(row, c);
} }
void ChatLine::visibilityChanged(bool visible) void ChatLine::visibilityChanged(bool visible)
@ -59,9 +59,9 @@ void ChatLine::visibilityChanged(bool visible)
isVisible = visible; isVisible = visible;
} }
int ChatLine::getRowIndex() const int ChatLine::getRow() const
{ {
return rowIndex; return row;
} }
ChatLineContent *ChatLine::getContent(int col) const ChatLineContent *ChatLine::getContent(int col) const
@ -155,7 +155,7 @@ void ChatLine::replaceContent(int col, ChatLineContent *lineContent)
delete content[col]; delete content[col];
content[col] = lineContent; content[col] = lineContent;
lineContent->setIndex(rowIndex, col); lineContent->setIndex(row, col);
if(scene) if(scene)
scene->addItem(content[col]); scene->addItem(content[col]);
@ -261,5 +261,5 @@ bool ChatLine::lessThanBSRectBottom(const ChatLine::Ptr lhs, const qreal rhs)
bool ChatLine::lessThanRowIndex(const ChatLine::Ptr lhs, const ChatLine::Ptr rhs) bool ChatLine::lessThanRowIndex(const ChatLine::Ptr lhs, const ChatLine::Ptr rhs)
{ {
return lhs->getRowIndex() < rhs->getRowIndex(); return lhs->getRow() < rhs->getRow();
} }

View File

@ -72,7 +72,7 @@ public:
void selectionCleared(int col); void selectionCleared(int col);
int getColumnCount(); int getColumnCount();
int getRowIndex() const; int getRow() const;
ChatLineContent* getContent(int col) const; ChatLineContent* getContent(int col) const;
ChatLineContent* getContent(QPointF scenePos) const; ChatLineContent* getContent(QPointF scenePos) const;
@ -89,7 +89,7 @@ protected:
void updateBBox(); void updateBBox();
friend class ChatLog; friend class ChatLog;
void setRowIndex(int idx); void setRow(int idx);
void visibilityChanged(bool visible); void visibilityChanged(bool visible);
//comparators //comparators
@ -98,7 +98,7 @@ protected:
static bool lessThanRowIndex(const ChatLine::Ptr lhs, const ChatLine::Ptr rhs); static bool lessThanRowIndex(const ChatLine::Ptr lhs, const ChatLine::Ptr rhs);
private: private:
int rowIndex = -1; int row = -1;
std::vector<ChatLineContent*> content; // 3 columns std::vector<ChatLineContent*> content; // 3 columns
std::vector<ColumnFormat> format; std::vector<ColumnFormat> format;
qreal width; qreal width;

View File

@ -86,7 +86,7 @@ ChatLog::ChatLog(QWidget* parent)
if(!visibleLines.isEmpty()) if(!visibleLines.isEmpty())
{ {
int firstVisLineIndex = visibleLines.first()->getRowIndex(); int firstVisLineIndex = visibleLines.first()->getRow();
int delta = firstVisLineIndex - workerLastIndex; int delta = firstVisLineIndex - workerLastIndex;
if(delta > 0 && delta < stepSize) if(delta > 0 && delta < stepSize)
{ {
@ -199,8 +199,8 @@ void ChatLog::updateVisibleLines()
repos = 0; repos = 0;
if(!visibleLines.empty()) if(!visibleLines.empty())
{ {
repos = layout(visibleLines.first()->getRowIndex(), visibleLines.last()->getRowIndex(), useableWidth()); repos = layout(visibleLines.first()->getRow(), visibleLines.last()->getRow(), useableWidth());
reposition(visibleLines.last()->getRowIndex()+1, visibleLines.last()->getRowIndex()+10, -repos); reposition(visibleLines.last()->getRow()+1, visibleLines.last()->getRow()+10, -repos);
verticalScrollBar()->setValue(verticalScrollBar()->value() - repos); verticalScrollBar()->setValue(verticalScrollBar()->value() - repos);
} }
@ -292,7 +292,7 @@ void ChatLog::mouseMoveEvent(QMouseEvent* ev)
} }
else if(line.get()) else if(line.get())
{ {
selClickedRow = line->getRowIndex(); selClickedRow = line->getRow();
selFirstRow = selClickedRow; selFirstRow = selClickedRow;
selLastRow = selClickedRow; selLastRow = selClickedRow;
@ -331,7 +331,7 @@ void ChatLog::mouseMoveEvent(QMouseEvent* ev)
} }
else if(line.get()) else if(line.get())
{ {
row = line->getRowIndex(); row = line->getRow();
if(row != selClickedRow) if(row != selClickedRow)
{ {
@ -414,12 +414,12 @@ void ChatLog::insertChatlineAtBottom(ChatLine::Ptr l)
bool stickToBtm = stickToBottom(); bool stickToBtm = stickToBottom();
//insert //insert
l->setRowIndex(lines.size()); l->setRow(lines.size());
l->addToScene(scene); l->addToScene(scene);
lines.append(l); lines.append(l);
//partial refresh //partial refresh
layout(lines.last()->getRowIndex(), lines.size(), useableWidth()); layout(lines.last()->getRow(), lines.size(), useableWidth());
updateSceneRect(); updateSceneRect();
if(stickToBtm) if(stickToBtm)
@ -447,13 +447,13 @@ void ChatLog::insertChatlineOnTop(const QList<ChatLine::Ptr>& newLines)
//move all lines down by n //move all lines down by n
int n = newLines.size(); int n = newLines.size();
for(ChatLine::Ptr l : lines) for(ChatLine::Ptr l : lines)
l->setRowIndex(l->getRowIndex() + n); l->setRow(l->getRow() + n);
//add the new line //add the new line
for(ChatLine::Ptr l : newLines) for(ChatLine::Ptr l : newLines)
{ {
l->addToScene(scene); l->addToScene(scene);
l->setRowIndex(--n); l->setRow(--n);
lines.prepend(l); lines.prepend(l);
} }