summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2009-09-25 19:56:41 (GMT)
committerKevin Smith <git@kismith.co.uk>2009-09-25 19:56:41 (GMT)
commita3b7b09d8cd0395768bfbddae444e2178b765a0b (patch)
treee0c78d3914a32c0e8d9b651de2bfc45139302588 /Swift/QtUI
parent14dfe5712adaaa0a3cbfda9093713c500179c227 (diff)
downloadswift-contrib-a3b7b09d8cd0395768bfbddae444e2178b765a0b.zip
swift-contrib-a3b7b09d8cd0395768bfbddae444e2178b765a0b.tar.bz2
Move roster tooltip string construction to a method.
Diffstat (limited to 'Swift/QtUI')
-rw-r--r--Swift/QtUI/Roster/QtTreeWidgetItem.cpp6
-rw-r--r--Swift/QtUI/Roster/QtTreeWidgetItem.h1
2 files changed, 6 insertions, 1 deletions
diff --git a/Swift/QtUI/Roster/QtTreeWidgetItem.cpp b/Swift/QtUI/Roster/QtTreeWidgetItem.cpp
index 9ba149e..2796c12 100644
--- a/Swift/QtUI/Roster/QtTreeWidgetItem.cpp
+++ b/Swift/QtUI/Roster/QtTreeWidgetItem.cpp
@@ -175,7 +175,7 @@ QVariant QtTreeWidgetItem::data(int role) {
case Qt::DisplayRole: return displayName_;
case Qt::TextColorRole: return textColor_;
case Qt::BackgroundColorRole: return backgroundColor_;
- case Qt::ToolTipRole: return isContact() ? displayName_ + ": " + statusText_ : QVariant();
+ case Qt::ToolTipRole: return isContact() ? toolTipString() : QVariant();
case StatusTextRole: return statusText_;
case AvatarRole: return avatar_;
case PresenceIconRole: return getPresenceIcon();
@@ -183,6 +183,10 @@ QVariant QtTreeWidgetItem::data(int role) {
}
}
+QString QtTreeWidgetItem::toolTipString() {
+ return displayName_ + "\n " + statusText_;
+}
+
QIcon QtTreeWidgetItem::getPresenceIcon() {
QString iconString;
switch (statusShowType_) {
diff --git a/Swift/QtUI/Roster/QtTreeWidgetItem.h b/Swift/QtUI/Roster/QtTreeWidgetItem.h
index 8b69ae2..407bc9a 100644
--- a/Swift/QtUI/Roster/QtTreeWidgetItem.h
+++ b/Swift/QtUI/Roster/QtTreeWidgetItem.h
@@ -62,6 +62,7 @@ class QtTreeWidgetItem : public QObject, public TreeWidgetItem {
private slots:
void handleChanged(QtTreeWidgetItem* item);
private:
+ QString toolTipString();
QList<QtTreeWidgetItem*> children_;
QList<QtTreeWidgetItem*> shownChildren_;
QtTreeWidgetItem* parent_;