Add caller decision controls and colored phone presence on desktop
This commit is contained in:
1 parent
77af45649c
commit
4ccd919ef8
3 files changed
+52
-5
No files matched your search
@@ -148,7 +148,9 @@ void AccountDelegate::paint(QPainter *painter, const QStyleOptionViewItem &optio
|
||||
const QRect radio = actionRect(option.rect, Action::RadioCall);
|
||||
const QColor radioColor = flags & CHAT_MEMBER_FLAG_RADIO ? QColor("#4CAF50") : color;
|
||||
FlagPainter::drawRadio(painter, radio.center().x() - 12, radio.center().y() - 12, 24, radioColor);
|
||||
drawCallButton(painter, actionRect(option.rect, Action::Call), color);
|
||||
const bool known = index.data(MemberListModel::OnlineRole).toBool() && (flags & CHAT_MEMBER_FLAG_PHONE_KNOWN);
|
||||
const QColor phoneColor = known ? QColor(flags & CHAT_MEMBER_FLAG_PHONE_BUSY ? "#E53935" : "#4CAF50") : color;
|
||||
drawCallButton(painter, actionRect(option.rect, Action::Call), phoneColor);
|
||||
}
|
||||
painter->restore();
|
||||
}
|
||||
@@ -200,6 +202,11 @@ bool AccountDelegate::helpEvent(QHelpEvent* event, QAbstractItemView* view, cons
|
||||
QString text = QCoreApplication::translate("ChatGui", action == Action::RadioCall ? "Call by radio" : "Call peer");
|
||||
if (action == Action::RadioCall && (index.data(Qt::UserRole + 3).toInt() & CHAT_MEMBER_FLAG_RADIO))
|
||||
text += QCoreApplication::translate("ChatGui", " · Radio enabled");
|
||||
if (action == Action::Call && index.data(MemberListModel::OnlineRole).toBool()) {
|
||||
const int flags = index.data(Qt::UserRole + 3).toInt();
|
||||
text += " · " + QCoreApplication::translate("ChatGui", !(flags & CHAT_MEMBER_FLAG_PHONE_KNOWN) ? "Phone status unknown" :
|
||||
(flags & CHAT_MEMBER_FLAG_PHONE_BUSY) ? "Busy on a call" : "Phone is free");
|
||||
}
|
||||
if (!index.data(MemberListModel::OnlineRole).toBool()) text += " · " + QCoreApplication::translate("ChatGui", "offline");
|
||||
QToolTip::showText(event->globalPos(), text, view);
|
||||
return true;
|
||||
|
||||
Reference in new issue
Block a user