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:
thunder2 2011-01-04 23:00:42 +00:00
parent ff57befb1f
commit 13ab90e14b
2 changed files with 1 additions and 45 deletions

View File

@ -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;
}
@ -448,35 +448,3 @@ void GroupTreeWidget::sort()
{
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);
}

View File

@ -108,16 +108,4 @@ private:
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