summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2010-03-29 21:31:25 (GMT)
committerKevin Smith <git@kismith.co.uk>2010-03-29 21:31:25 (GMT)
commit59f2da26c2a27e4ab412bf7654483d0e4fced48c (patch)
tree0be73ab2e773eeb2ce0eea4135ea87565ba57be8
parent19e37bae5767140c6cab6c24c05892c351c8979c (diff)
downloadswift-contrib-59f2da26c2a27e4ab412bf7654483d0e4fced48c.zip
swift-contrib-59f2da26c2a27e4ab412bf7654483d0e4fced48c.tar.bz2
Down to 12 seconds
-rw-r--r--Swift/QtUI/Roster/QtTreeWidgetItem.cpp6
-rw-r--r--Swift/QtUI/Roster/QtTreeWidgetItem.h4
2 files changed, 7 insertions, 3 deletions
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<QtTreeWidgetItem*> shownChildren_;
QtTreeWidgetItem* parent_;
QString displayName_;
+ QString displayNameLower_;
QString statusText_;
QColor textColor_;
QColor backgroundColor_;