mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-15 17:37:12 -05:00
added tooltip to show identity ID in distant chat dialog
This commit is contained in:
parent
5eda5a5bcb
commit
57577472fc
@ -311,10 +311,13 @@ bool ChatDialog::hasNewMessages()
|
||||
|
||||
return false;
|
||||
}
|
||||
QString ChatDialog::getPeerName(const ChatId& id) const
|
||||
QString ChatDialog::getPeerName(const ChatId& id, QString& additional_info) const
|
||||
{
|
||||
if(id.isPeerId())
|
||||
{
|
||||
additional_info = QString("Peer ID: ")+QString::fromStdString(id.toPeerId().toStdString());
|
||||
return QString::fromUtf8(rsPeers->getPeerName(id.toPeerId()).c_str()) ;
|
||||
}
|
||||
else
|
||||
return "ChatDialog::getPeerName(): invalid id type passed (RsPeerId is required). This is a bug.";
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ protected:
|
||||
void closeEvent(QCloseEvent *event);
|
||||
virtual bool canClose() { return true; }
|
||||
|
||||
virtual QString getPeerName(const ChatId &sslid) const ; // can be overloaded for chat dialogs that have specific peers
|
||||
virtual QString getPeerName(const ChatId &sslid,QString& additional_info) const ; // can be overloaded for chat dialogs that have specific peers
|
||||
virtual QString getOwnName() const;
|
||||
|
||||
virtual void init(const ChatId &id, const QString &title);
|
||||
|
@ -1702,22 +1702,34 @@ void ChatWidget::updateStatus(const QString &peer_id, int status)
|
||||
{
|
||||
// the peers status has changed
|
||||
|
||||
QString tooltip_info ;
|
||||
QString peerName ;
|
||||
|
||||
if(chatId.isDistantChatId())
|
||||
{
|
||||
DistantChatPeerInfo dcpinfo ;
|
||||
RsIdentityDetails details ;
|
||||
|
||||
if(rsMsgs->getDistantChatStatus(chatId.toDistantChatId(),dcpinfo))
|
||||
{
|
||||
if(rsIdentity->getIdDetails(dcpinfo.to_id,details))
|
||||
peerName = QString::fromUtf8( details.mNickname.c_str() ) ;
|
||||
else
|
||||
peerName = QString::fromStdString(dcpinfo.to_id.toStdString()) ;
|
||||
else
|
||||
peerName = QString::fromStdString(chatId.toDistantChatId().toStdString()) ;
|
||||
|
||||
tooltip_info = QString("Identity Id: ")+QString::fromStdString(dcpinfo.to_id.toStdString());
|
||||
}
|
||||
else
|
||||
{
|
||||
peerName = QString::fromStdString(chatId.toDistantChatId().toStdString()) ;
|
||||
tooltip_info = QString("Identity Id: unknown (bug?)");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
peerName = QString::fromUtf8(rsPeers->getPeerName(chatId.toPeerId()).c_str());
|
||||
tooltip_info = QString("Peer Id: ") + QString::fromStdString(chatId.toPeerId().toStdString());
|
||||
}
|
||||
|
||||
// is scrollbar at the end?
|
||||
QScrollBar *scrollbar = ui->textBrowser->verticalScrollBar();
|
||||
@ -1750,6 +1762,7 @@ void ChatWidget::updateStatus(const QString &peer_id, int status)
|
||||
}
|
||||
|
||||
ui->titleLabel->setText(peerName);
|
||||
ui->titleLabel->setToolTip(tooltip_info);
|
||||
ui->statusLabel->setText(QString("(%1)").arg(StatusDefs::name(status)));
|
||||
|
||||
peerStatus = status;
|
||||
|
@ -118,8 +118,10 @@ void PopupChatDialog::showDialog(uint chatflags)
|
||||
//
|
||||
void PopupChatDialog::chatStatusChanged(const ChatId &chat_id, const QString& statusString)
|
||||
{
|
||||
QString additional_info ;
|
||||
|
||||
if (mChatId.isSameEndpoint(chat_id)) {
|
||||
ui.chatWidget->updateStatusString(getPeerName(chat_id) + " %1", statusString);
|
||||
ui.chatWidget->updateStatusString(getPeerName(chat_id,additional_info) + " %1", statusString);
|
||||
}
|
||||
}
|
||||
|
||||
@ -129,8 +131,9 @@ void PopupChatDialog::addChatMsg(const ChatMessage &msg)
|
||||
if (cw) {
|
||||
QDateTime sendTime = QDateTime::fromTime_t(msg.sendTime);
|
||||
QDateTime recvTime = QDateTime::fromTime_t(msg.recvTime);
|
||||
QString additional_info ;
|
||||
QString message = QString::fromUtf8(msg.msg.c_str());
|
||||
QString name = msg.incoming? getPeerName(msg.chat_id): getOwnName();
|
||||
QString name = msg.incoming? getPeerName(msg.chat_id,additional_info): getOwnName();
|
||||
|
||||
cw->addChatMsg(msg.incoming, name, sendTime, recvTime, message, ChatWidget::MSGTYPE_NORMAL);
|
||||
}
|
||||
|
@ -181,12 +181,14 @@ void PopupDistantChatDialog::closeEvent(QCloseEvent *e)
|
||||
PopupChatDialog::closeEvent(e) ;
|
||||
}
|
||||
|
||||
QString PopupDistantChatDialog::getPeerName(const ChatId& /*id*/) const
|
||||
QString PopupDistantChatDialog::getPeerName(const ChatId& /*id*/, QString& additional_info) const
|
||||
{
|
||||
DistantChatPeerInfo tinfo;
|
||||
|
||||
rsMsgs->getDistantChatStatus(_tunnel_id,tinfo) ;
|
||||
|
||||
additional_info = QString("Identity ID: ") + QString::fromStdString(tinfo.to_id.toStdString());
|
||||
|
||||
RsIdentityDetails details ;
|
||||
if(rsIdentity->getIdDetails(tinfo.to_id,details))
|
||||
return QString::fromUtf8( details.mNickname.c_str() ) ;
|
||||
|
@ -41,7 +41,7 @@ class PopupDistantChatDialog: public PopupChatDialog
|
||||
virtual void init(const ChatId& chat_id, const QString &title);
|
||||
virtual void closeEvent(QCloseEvent *e) ;
|
||||
|
||||
virtual QString getPeerName(const ChatId &id) const ;
|
||||
virtual QString getPeerName(const ChatId &id, QString& additional_info) const ;
|
||||
virtual QString getOwnName() const;
|
||||
|
||||
protected slots:
|
||||
|
Loading…
Reference in New Issue
Block a user