From 59f2da26c2a27e4ab412bf7654483d0e4fced48c Mon Sep 17 00:00:00 2001 From: Kevin Smith Date: Mon, 29 Mar 2010 22:31:25 +0100 Subject: Down to 12 seconds diff --git a/Swift/QtUI/Roster/QtTreeWidgetItem.cpp b/Swift/QtUI/Roster/QtTreeWidgetItem.cpp index 1f2964e..0b90c54 100644 --- a/Swift/QtUI/Roster/QtTreeWidgetItem.cpp +++ b/Swift/QtUI/Roster/QtTreeWidgetItem.cpp @@ -12,8 +12,10 @@ QtTreeWidgetItem::QtTreeWidgetItem(QtTreeWidgetItem* parentItem) : QObject(), te expanded_ = true; } + void QtTreeWidgetItem::setText(const String& text) { displayName_ = P2QSTRING(text); + displayNameLower_ = displayName_.toLower(); emit changed(this); } @@ -216,12 +218,12 @@ bool QtTreeWidgetItem::operator<(const QtTreeWidgetItem& item) const { if (!item.isContact()) { return false; } - return getStatusShow() == item.getStatusShow() ? getName().toLower() < item.getName().toLower() : getStatusShow() < item.getStatusShow(); + return getStatusShow() == item.getStatusShow() ? getLowerName() < item.getLowerName() : getStatusShow() < item.getStatusShow(); } else { if (item.isContact()) { return true; } - return getName().toLower() < item.getName().toLower(); + return getLowerName() < item.getLowerName(); } } diff --git a/Swift/QtUI/Roster/QtTreeWidgetItem.h b/Swift/QtUI/Roster/QtTreeWidgetItem.h index 407bc9a..d243115 100644 --- a/Swift/QtUI/Roster/QtTreeWidgetItem.h +++ b/Swift/QtUI/Roster/QtTreeWidgetItem.h @@ -50,7 +50,8 @@ class QtTreeWidgetItem : public QObject, public TreeWidgetItem { bool isShown(); bool isContact() const; bool isExpanded(); - QString getName() const {return displayName_;}; + const QString& getName() const {return displayName_;}; + const QString& getLowerName() const {return displayNameLower_;}; StatusShow::Type getStatusShow() const {return statusShowType_;}; QWidget* getCollapsedRosterWidget(); @@ -67,6 +68,7 @@ class QtTreeWidgetItem : public QObject, public TreeWidgetItem { QList shownChildren_; QtTreeWidgetItem* parent_; QString displayName_; + QString displayNameLower_; QString statusText_; QColor textColor_; QColor backgroundColor_; -- cgit v0.10.2-6-g49f6