diff options
Diffstat (limited to 'Swift/QtUI')
-rw-r--r-- | Swift/QtUI/QtStatusWidget.cpp | 9 | ||||
-rw-r--r-- | Swift/QtUI/QtStatusWidget.h | 1 | ||||
-rw-r--r-- | Swift/QtUI/Roster/RosterModel.cpp | 13 |
3 files changed, 22 insertions, 1 deletions
diff --git a/Swift/QtUI/QtStatusWidget.cpp b/Swift/QtUI/QtStatusWidget.cpp index 7d39531..d7c0e63 100644 --- a/Swift/QtUI/QtStatusWidget.cpp +++ b/Swift/QtUI/QtStatusWidget.cpp @@ -124,11 +124,15 @@ void QtStatusWidget::generateList() { foreach (StatusShow::Type type, icons_.keys()) { QListWidgetItem* item = new QListWidgetItem(text, menu_); item->setIcon(icons_[type]); + item->setToolTip(P2QSTRING(StatusShow::typeToFriendlyName(type)) + ": " + item->text()); + item->setStatusTip(item->toolTip()); item->setData(Qt::UserRole, QVariant(type)); } foreach (StatusShow::Type type, icons_.keys()) { QListWidgetItem* item = new QListWidgetItem(P2QSTRING(StatusShow::typeToFriendlyName(type)), menu_); item->setIcon(icons_[type]); + item->setToolTip(item->text()); + item->setStatusTip(item->toolTip()); item->setData(Qt::UserRole, QVariant(type)); } } @@ -207,6 +211,9 @@ void QtStatusWidget::handleItemClicked(QListWidgetItem* item) { handleEditComplete(); } +void QtStatusWidget::setNewToolTip() { + statusTextLabel_->setToolTip(P2QSTRING(StatusShow::typeToFriendlyName(selectedStatusType_)) + ": " + statusTextLabel_->text()); +} void QtStatusWidget::setStatusText(const QString& text) { statusText_ = text; @@ -215,11 +222,13 @@ void QtStatusWidget::setStatusText(const QString& text) { escapedText.replace("<","<"); // statusTextLabel_->setText("<i>" + escapedText + "</i>"); statusTextLabel_->setText(escapedText); + setNewToolTip(); } void QtStatusWidget::setStatusType(StatusShow::Type type) { selectedStatusType_ = icons_.contains(type) ? type : StatusShow::Online; statusIcon_->setPixmap(icons_[selectedStatusType_].pixmap(16, 16)); + setNewToolTip(); } } diff --git a/Swift/QtUI/QtStatusWidget.h b/Swift/QtUI/QtStatusWidget.h index 4425b1d..2163d5a 100644 --- a/Swift/QtUI/QtStatusWidget.h +++ b/Swift/QtUI/QtStatusWidget.h @@ -43,6 +43,7 @@ namespace Swift { void handleItemClicked(QListWidgetItem* item); private: void viewMode(); + void setNewToolTip(); //QComboBox *types_; QStackedWidget* stack_; QLabel* statusIcon_; diff --git a/Swift/QtUI/Roster/RosterModel.cpp b/Swift/QtUI/Roster/RosterModel.cpp index e5a938e..a801d3f 100644 --- a/Swift/QtUI/Roster/RosterModel.cpp +++ b/Swift/QtUI/Roster/RosterModel.cpp @@ -115,7 +115,18 @@ QColor RosterModel::getBackgroundColor(RosterItem* item) const { } QString RosterModel::getToolTip(RosterItem* item) const { - return dynamic_cast<ContactRosterItem*>(item) && !getStatusText(item).isEmpty() ? P2QSTRING(item->getDisplayName()) + "\n" + getStatusText(item) : P2QSTRING(item->getDisplayName()); + QString tip(P2QSTRING(item->getDisplayName())); + ContactRosterItem* contact = dynamic_cast<ContactRosterItem*>(item); + if (contact) { + if (contact->getDisplayJID().isValid()) { + tip += "\n" + P2QSTRING(contact->getDisplayJID().toBare().toString()); + } + tip += "\n " + P2QSTRING(StatusShow::typeToFriendlyName(contact->getStatusShow())); + if (!getStatusText(item).isEmpty()) { + tip += ": " + getStatusText(item); + } + } + return tip; } QIcon RosterModel::getAvatar(RosterItem* item) const { |