mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-29 01:16:20 -05:00
Removed not needed class GroupTreeWidgetItem.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3951 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
ff57befb1f
commit
13ab90e14b
@ -372,7 +372,7 @@ void GroupTreeWidget::calculateScore(QTreeWidgetItem *item)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
item->setData(COLUMN_DATA, ROLE_SEARCH_SCORE, score);
|
item->setData(COLUMN_DATA, ROLE_SEARCH_SCORE, -score); // negative for correct sorting
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -448,35 +448,3 @@ void GroupTreeWidget::sort()
|
|||||||
{
|
{
|
||||||
resort(NULL);
|
resort(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
GroupTreeWidgetItem::GroupTreeWidgetItem() : QTreeWidgetItem()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GroupTreeWidgetItem::operator<(const QTreeWidgetItem& other) const
|
|
||||||
{
|
|
||||||
QDateTime otherChanTs = other.data(COLUMN_DATA, ROLE_LASTPOST).toDateTime();
|
|
||||||
QDateTime thisChanTs = this->data(COLUMN_DATA, ROLE_LASTPOST).toDateTime();
|
|
||||||
|
|
||||||
uint32_t otherCount = other.data(COLUMN_DATA, ROLE_SEARCH_SCORE).toUInt();
|
|
||||||
uint32_t thisCount = this->data(COLUMN_DATA, ROLE_SEARCH_SCORE).toUInt();
|
|
||||||
|
|
||||||
/* If counts are equal then determine by who has the most recent post */
|
|
||||||
if (otherCount == thisCount){
|
|
||||||
if (thisChanTs < otherChanTs) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Choose the item where the string occurs the most */
|
|
||||||
if (thisCount < otherCount) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (thisChanTs < otherChanTs) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Compare name */
|
|
||||||
return text(COLUMN_NAME) < other.text(COLUMN_NAME);
|
|
||||||
}
|
|
||||||
|
@ -108,16 +108,4 @@ private:
|
|||||||
Ui::GroupTreeWidget *ui;
|
Ui::GroupTreeWidget *ui;
|
||||||
};
|
};
|
||||||
|
|
||||||
class GroupTreeWidgetItem : public QTreeWidgetItem
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
GroupTreeWidgetItem();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* reimplementing comparison operator so GroupTreeWidgetItem can be ordered in terms
|
|
||||||
* of occurences of property filterText in its data columns
|
|
||||||
*/
|
|
||||||
bool operator<(const QTreeWidgetItem &other) const;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // GROUPTREEWIDGET_H
|
#endif // GROUPTREEWIDGET_H
|
||||||
|
Loading…
Reference in New Issue
Block a user