summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Maudsley <richard.maudsley@isode.com>2014-06-27 16:06:49 (GMT)
committerRichard Maudsley <richard.maudsley@isode.com>2014-07-07 10:49:04 (GMT)
commit14fd8e4363241e04b20da85dfc61e5f315e9b28d (patch)
treeb7a5450f73e98dd64c0367702575bb3f52e44ab4 /Swift/QtUI/QtRosterHeader.cpp
parent9179b54ac93ddc88765c3cd984916d7ffd130d20 (diff)
downloadswift-14fd8e4363241e04b20da85dfc61e5f315e9b28d.zip
swift-14fd8e4363241e04b20da85dfc61e5f315e9b28d.tar.bz2
Show own tooltip when hovering over roster header.
Test-Information: Made combinations of presence/vcard/avatar changes and verified that the information in the tooltip was synchronized. Connect two clients and verify that the tooltip presence text reflects the local client presence only. Change-Id: I92af0f58f7045f3a15f2fae2f9cbc6e24a066923
Diffstat (limited to 'Swift/QtUI/QtRosterHeader.cpp')
-rw-r--r--Swift/QtUI/QtRosterHeader.cpp28
1 files changed, 23 insertions, 5 deletions
diff --git a/Swift/QtUI/QtRosterHeader.cpp b/Swift/QtUI/QtRosterHeader.cpp
index 2c8f244..69a0ef6 100644
--- a/Swift/QtUI/QtRosterHeader.cpp
+++ b/Swift/QtUI/QtRosterHeader.cpp
@@ -6,20 +6,23 @@
#include "QtRosterHeader.h"
-#include <QHBoxLayout>
-#include <QVBoxLayout>
+#include <QBitmap>
+#include <qdebug.h>
#include <QFileInfo>
+#include <QHBoxLayout>
+#include <QHelpEvent>
#include <QIcon>
-#include <QSizePolicy>
-#include <qdebug.h>
#include <QMouseEvent>
#include <QPainter>
-#include <QBitmap>
+#include <QSizePolicy>
+#include <QToolTip>
+#include <QVBoxLayout>
#include "QtStatusWidget.h"
#include <Swift/QtUI/QtElidingLabel.h>
#include <Swift/QtUI/QtClickableLabel.h>
#include <Swift/QtUI/QtNameWidget.h>
+#include <Swift/QtUI/Roster/RosterTooltip.h>
#include "QtScaledAvatarCache.h"
namespace Swift {
@@ -89,6 +92,17 @@ void QtRosterHeader::setStreamEncryptionStatus(bool tlsInPlace) {
securityInfoButton_->setVisible(tlsInPlace);
}
+bool QtRosterHeader::event(QEvent* event) {
+ if (event->type() == QEvent::ToolTip) {
+ QHelpEvent *helpEvent = static_cast<QHelpEvent *>(event);
+ QtScaledAvatarCache scaledAvatarCache(avatarSize_);
+ QString text = RosterTooltip::buildDetailedTooltip(contact_.get(), &scaledAvatarCache);
+ QToolTip::showText(helpEvent->globalPos(), text);
+ return true;
+ }
+ return QWidget::event(event);
+}
+
void QtRosterHeader::setAvatar(const QString& path) {
QString scaledAvatarPath = QtScaledAvatarCache(avatarSize_).getScaledAvatarPath(path);
QPixmap avatar;
@@ -105,6 +119,10 @@ void QtRosterHeader::setNick(const QString& nick) {
nameWidget_->setNick(nick);
}
+void QtRosterHeader::setContactRosterItem(boost::shared_ptr<ContactRosterItem> contact) {
+ contact_ = contact;
+}
+
void QtRosterHeader::setJID(const QString& jid) {
nameWidget_->setJID(jid);
}