mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-12-17 09:34:10 -05:00
fixed typing message missing
This commit is contained in:
parent
42f0bd41ae
commit
96fddc9066
6 changed files with 123 additions and 108 deletions
|
|
@ -338,12 +338,7 @@ void ChatDialog::setPeerStatus(RsStatusValue status)
|
|||
// convert to virtual peer id
|
||||
// this is only required for private and distant chat,
|
||||
// because lobby and broadcast does not have a status
|
||||
RsPeerId vpid;
|
||||
if(mChatId.isPeerId())
|
||||
vpid = mChatId.toPeerId();
|
||||
if(mChatId.isDistantChatId())
|
||||
vpid = RsPeerId(mChatId.toDistantChatId());
|
||||
cw->updateStatus(QString::fromStdString(vpid.toStdString()), status);
|
||||
cw->updateStatus(mChatId, status);
|
||||
}
|
||||
}
|
||||
RsStatusValue ChatDialog::getPeerStatus()
|
||||
|
|
|
|||
|
|
@ -176,7 +176,8 @@ ChatWidget::ChatWidget(QWidget *parent)
|
|||
|
||||
//connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(const QString&, int)), this, SLOT(updateStatus(const QString&, int)));
|
||||
|
||||
mEventHandlerId = 0;
|
||||
mEventHandlerId_friends = 0;
|
||||
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e)
|
||||
{
|
||||
RsQThreadUtils::postToObject([=](){
|
||||
|
|
@ -187,7 +188,7 @@ ChatWidget::ChatWidget(QWidget *parent)
|
|||
|
||||
switch(fe->mEventCode)
|
||||
{
|
||||
case RsFriendListEventCode::NODE_STATUS_CHANGED: updateStatus(QString::fromStdString(fe->mSslId.toStdString()),fe->mStatus);
|
||||
case RsFriendListEventCode::NODE_STATUS_CHANGED: updateStatus(ChatId(fe->mSslId),fe->mStatus);
|
||||
break;
|
||||
|
||||
case RsFriendListEventCode::NODE_STATE_STRING_CHANGED: updatePeersCustomStateString(ChatId(fe->mSslId),QString::fromUtf8(fe->mStateString.c_str()));
|
||||
|
|
@ -198,7 +199,7 @@ ChatWidget::ChatWidget(QWidget *parent)
|
|||
}
|
||||
|
||||
}, this );
|
||||
},mEventHandlerId,RsEventType::FRIEND_LIST);
|
||||
},mEventHandlerId_friends,RsEventType::FRIEND_LIST);
|
||||
|
||||
//connect(NotifyQt::getInstance(), SIGNAL(peerHasNewCustomStateString(const QString&, const QString&)), this, SLOT(updatePeersCustomStateString(const QString&, const QString&)));
|
||||
connect(NotifyQt::getInstance(), SIGNAL(chatFontChanged()), this, SLOT(resetFonts()));
|
||||
|
|
@ -282,7 +283,7 @@ ChatWidget::ChatWidget(QWidget *parent)
|
|||
ChatWidget::~ChatWidget()
|
||||
{
|
||||
processSettings(false);
|
||||
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||
rsEvents->unregisterEventsHandler(mEventHandlerId_friends);
|
||||
|
||||
/* Cleanup plugin functions */
|
||||
foreach (ChatWidgetHolder *chatWidgetHolder, mChatWidgetHolder) {
|
||||
|
|
@ -397,7 +398,7 @@ void ChatWidget::init(const ChatId &chat_id, const QString &title)
|
|||
StatusInfo peerStatusInfo;
|
||||
// No check of return value. Non existing status info is handled as offline.
|
||||
rsStatus->getStatus(chatId.toPeerId(), peerStatusInfo);
|
||||
updateStatus(QString::fromStdString(chatId.toPeerId().toStdString()), peerStatusInfo.status);
|
||||
updateStatus(chatId, peerStatusInfo.status);
|
||||
|
||||
// initialize first custom state string
|
||||
QString customStateString = QString::fromUtf8(rsMsgs->getCustomStateString(chatId.toPeerId()).c_str());
|
||||
|
|
@ -1820,110 +1821,106 @@ void ChatWidget::setCurrentFileName(const QString &fileName)
|
|||
setWindowModified(false);
|
||||
}
|
||||
|
||||
void ChatWidget::updateStatus(const QString &peer_id, RsStatusValue status)
|
||||
void ChatWidget::updateStatus(const ChatId& cid, RsStatusValue status)
|
||||
{
|
||||
if (! (chatType() == CHATTYPE_PRIVATE || chatType() == CHATTYPE_DISTANT))
|
||||
{
|
||||
// updateTitle is used
|
||||
return;
|
||||
// updateTitle is used
|
||||
return;
|
||||
}
|
||||
|
||||
// make virtual peer id from gxs id in case of distant chat
|
||||
RsPeerId vpid;
|
||||
// // make virtual peer id from gxs id in case of distant chat
|
||||
// RsPeerId vpid;
|
||||
// if(chatId.isDistantChatId())
|
||||
// vpid = RsPeerId(chatId.toDistantChatId());
|
||||
// else
|
||||
// vpid = chatId.toPeerId();
|
||||
|
||||
/* set font size for status */
|
||||
if (!(cid == chatId))
|
||||
return;
|
||||
|
||||
// the peers status has changed
|
||||
|
||||
QString tooltip_info ;
|
||||
QString peerName ;
|
||||
|
||||
if(chatId.isDistantChatId())
|
||||
vpid = RsPeerId(chatId.toDistantChatId());
|
||||
else
|
||||
vpid = chatId.toPeerId();
|
||||
|
||||
/* set font size for status */
|
||||
if (peer_id.toStdString() == vpid.toStdString())
|
||||
{
|
||||
// the peers status has changed
|
||||
DistantChatPeerInfo dcpinfo ;
|
||||
RsIdentityDetails details ;
|
||||
|
||||
QString tooltip_info ;
|
||||
QString peerName ;
|
||||
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()) ;
|
||||
|
||||
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()) ;
|
||||
|
||||
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();
|
||||
bool atEnd = (scrollbar->value() == scrollbar->maximum());
|
||||
|
||||
switch (status) {
|
||||
default:
|
||||
case RsStatusValue::RS_STATUS_OFFLINE:
|
||||
ui->info_Frame->setVisible(true);
|
||||
ui->infoLabel->setText(peerName + " " + tr("appears to be Offline.") +"\n" + tr("Messages you send will be delivered after Friend is again Online."));
|
||||
break;
|
||||
|
||||
case RsStatusValue::RS_STATUS_INACTIVE:
|
||||
ui->info_Frame->setVisible(true);
|
||||
ui->infoLabel->setText(peerName + " " + tr("is Idle and may not reply"));
|
||||
break;
|
||||
|
||||
case RsStatusValue::RS_STATUS_ONLINE:
|
||||
ui->info_Frame->setVisible(false);
|
||||
break;
|
||||
|
||||
case RsStatusValue::RS_STATUS_AWAY:
|
||||
ui->infoLabel->setText(peerName + " " + tr("is Away and may not reply"));
|
||||
ui->info_Frame->setVisible(true);
|
||||
break;
|
||||
|
||||
case RsStatusValue::RS_STATUS_BUSY:
|
||||
ui->infoLabel->setText(peerName + " " + tr("is Busy and may not reply"));
|
||||
ui->info_Frame->setVisible(true);
|
||||
break;
|
||||
}
|
||||
|
||||
ui->titleLabel->setText(peerName);
|
||||
ui->titleLabel->setToolTip(tooltip_info);
|
||||
#warning inconsistent conversion here
|
||||
ui->statusLabel->setText(QString("(%1)").arg(StatusDefs::name((RsStatusValue)status)));
|
||||
|
||||
peerStatus = status;
|
||||
|
||||
if (atEnd) {
|
||||
// scroll to the end
|
||||
scrollbar->setValue(scrollbar->maximum());
|
||||
}
|
||||
|
||||
emit infoChanged(this);
|
||||
emit statusChanged(status);
|
||||
|
||||
// Notify all ChatWidgetHolder
|
||||
foreach (ChatWidgetHolder *chatWidgetHolder, mChatWidgetHolder) {
|
||||
chatWidgetHolder->updateStatus(status);
|
||||
}
|
||||
|
||||
return;
|
||||
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());
|
||||
}
|
||||
|
||||
// ignore status change
|
||||
// is scrollbar at the end?
|
||||
QScrollBar *scrollbar = ui->textBrowser->verticalScrollBar();
|
||||
bool atEnd = (scrollbar->value() == scrollbar->maximum());
|
||||
|
||||
switch (status) {
|
||||
default:
|
||||
case RsStatusValue::RS_STATUS_OFFLINE:
|
||||
ui->info_Frame->setVisible(true);
|
||||
ui->infoLabel->setText(peerName + " " + tr("appears to be Offline.") +"\n" + tr("Messages you send will be delivered after Friend is again Online."));
|
||||
break;
|
||||
|
||||
case RsStatusValue::RS_STATUS_INACTIVE:
|
||||
ui->info_Frame->setVisible(true);
|
||||
ui->infoLabel->setText(peerName + " " + tr("is Idle and may not reply"));
|
||||
break;
|
||||
|
||||
case RsStatusValue::RS_STATUS_ONLINE:
|
||||
ui->info_Frame->setVisible(false);
|
||||
break;
|
||||
|
||||
case RsStatusValue::RS_STATUS_AWAY:
|
||||
ui->infoLabel->setText(peerName + " " + tr("is Away and may not reply"));
|
||||
ui->info_Frame->setVisible(true);
|
||||
break;
|
||||
|
||||
case RsStatusValue::RS_STATUS_BUSY:
|
||||
ui->infoLabel->setText(peerName + " " + tr("is Busy and may not reply"));
|
||||
ui->info_Frame->setVisible(true);
|
||||
break;
|
||||
}
|
||||
|
||||
ui->titleLabel->setText(peerName);
|
||||
ui->titleLabel->setToolTip(tooltip_info);
|
||||
#warning inconsistent conversion here
|
||||
ui->statusLabel->setText(QString("(%1)").arg(StatusDefs::name((RsStatusValue)status)));
|
||||
|
||||
peerStatus = status;
|
||||
|
||||
if (atEnd) {
|
||||
// scroll to the end
|
||||
scrollbar->setValue(scrollbar->maximum());
|
||||
}
|
||||
|
||||
emit infoChanged(this);
|
||||
emit statusChanged(status);
|
||||
|
||||
// Notify all ChatWidgetHolder
|
||||
foreach (ChatWidgetHolder *chatWidgetHolder, mChatWidgetHolder) {
|
||||
chatWidgetHolder->updateStatus(status);
|
||||
}
|
||||
}
|
||||
|
||||
void ChatWidget::updateTitle()
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ public:
|
|||
const QList<ChatWidgetHolder*> &chatWidgetHolderList() { return mChatWidgetHolder; }
|
||||
|
||||
public slots:
|
||||
void updateStatus(const QString &peer_id, RsStatusValue status);
|
||||
void updateStatus(const ChatId &cid, RsStatusValue status);
|
||||
void setUseCMark(const bool bUseCMark);
|
||||
void updateCMPreview();
|
||||
|
||||
|
|
@ -274,7 +274,8 @@ private:
|
|||
|
||||
Ui::ChatWidget *ui;
|
||||
|
||||
RsEventsHandlerId_t mEventHandlerId ;
|
||||
// RsEventsHandlerId_t mEventHandlerId_chat ;
|
||||
RsEventsHandlerId_t mEventHandlerId_friends ;
|
||||
};
|
||||
|
||||
#endif // CHATWIDGET_H
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
#include "gui/settings/RsharePeerSettings.h"
|
||||
#include "gui/notifyqt.h"
|
||||
#include "util/DateTime.h"
|
||||
#include "util/qtthreadsutils.h"
|
||||
|
||||
#include <retroshare/rspeers.h>
|
||||
#include <retroshare/rsiface.h>
|
||||
|
|
@ -51,6 +52,25 @@ PopupChatDialog::PopupChatDialog(QWidget *parent, Qt::WindowFlags flags)
|
|||
connect(ui.avatarFrameButton, SIGNAL(toggled(bool)), this, SLOT(showAvatarFrame(bool)));
|
||||
connect(ui.actionClearOfflineMessages, SIGNAL(triggered()), this, SLOT(clearOfflineMessages()));
|
||||
//connect(NotifyQt::getInstance(), SIGNAL(chatStatusChanged(ChatId,QString)), this, SLOT(chatStatusChanged(ChatId,QString)));
|
||||
|
||||
mEventHandlerId_chat =0;
|
||||
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e)
|
||||
{
|
||||
RsQThreadUtils::postToObject([=]()
|
||||
{
|
||||
auto fe = dynamic_cast<const RsChatServiceEvent*>(e.get()); if(!fe) return;
|
||||
|
||||
switch(fe->mEventCode)
|
||||
{
|
||||
case RsChatServiceEventCode::CHAT_STATUS_CHANGED: chatStatusChanged(fe->mCid,QString::fromUtf8(fe->mStr.c_str())); break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
, this );
|
||||
}, mEventHandlerId_chat, RsEventType::CHAT_SERVICE );
|
||||
}
|
||||
|
||||
void PopupChatDialog::init(const ChatId &chat_id, const QString &title)
|
||||
|
|
|
|||
|
|
@ -65,6 +65,8 @@ protected:
|
|||
|
||||
/** Qt Designer generated object */
|
||||
Ui::PopupChatDialog ui;
|
||||
|
||||
RsEventsHandlerId_t mEventHandlerId_chat;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@
|
|||
</action>
|
||||
<action name="actionDockTab">
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/images/tab-dock.png</normaloff>:/images/tab-dock.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
|
|
@ -97,7 +97,7 @@
|
|||
</action>
|
||||
<action name="actionUndockTab">
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/images/tab-undock.png</normaloff>:/images/tab-undock.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue