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
|
// convert to virtual peer id
|
||||||
// this is only required for private and distant chat,
|
// this is only required for private and distant chat,
|
||||||
// because lobby and broadcast does not have a status
|
// because lobby and broadcast does not have a status
|
||||||
RsPeerId vpid;
|
cw->updateStatus(mChatId, status);
|
||||||
if(mChatId.isPeerId())
|
|
||||||
vpid = mChatId.toPeerId();
|
|
||||||
if(mChatId.isDistantChatId())
|
|
||||||
vpid = RsPeerId(mChatId.toDistantChatId());
|
|
||||||
cw->updateStatus(QString::fromStdString(vpid.toStdString()), status);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RsStatusValue ChatDialog::getPeerStatus()
|
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)));
|
//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)
|
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e)
|
||||||
{
|
{
|
||||||
RsQThreadUtils::postToObject([=](){
|
RsQThreadUtils::postToObject([=](){
|
||||||
|
|
@ -187,7 +188,7 @@ ChatWidget::ChatWidget(QWidget *parent)
|
||||||
|
|
||||||
switch(fe->mEventCode)
|
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;
|
break;
|
||||||
|
|
||||||
case RsFriendListEventCode::NODE_STATE_STRING_CHANGED: updatePeersCustomStateString(ChatId(fe->mSslId),QString::fromUtf8(fe->mStateString.c_str()));
|
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 );
|
}, 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(peerHasNewCustomStateString(const QString&, const QString&)), this, SLOT(updatePeersCustomStateString(const QString&, const QString&)));
|
||||||
connect(NotifyQt::getInstance(), SIGNAL(chatFontChanged()), this, SLOT(resetFonts()));
|
connect(NotifyQt::getInstance(), SIGNAL(chatFontChanged()), this, SLOT(resetFonts()));
|
||||||
|
|
@ -282,7 +283,7 @@ ChatWidget::ChatWidget(QWidget *parent)
|
||||||
ChatWidget::~ChatWidget()
|
ChatWidget::~ChatWidget()
|
||||||
{
|
{
|
||||||
processSettings(false);
|
processSettings(false);
|
||||||
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
rsEvents->unregisterEventsHandler(mEventHandlerId_friends);
|
||||||
|
|
||||||
/* Cleanup plugin functions */
|
/* Cleanup plugin functions */
|
||||||
foreach (ChatWidgetHolder *chatWidgetHolder, mChatWidgetHolder) {
|
foreach (ChatWidgetHolder *chatWidgetHolder, mChatWidgetHolder) {
|
||||||
|
|
@ -397,7 +398,7 @@ void ChatWidget::init(const ChatId &chat_id, const QString &title)
|
||||||
StatusInfo peerStatusInfo;
|
StatusInfo peerStatusInfo;
|
||||||
// No check of return value. Non existing status info is handled as offline.
|
// No check of return value. Non existing status info is handled as offline.
|
||||||
rsStatus->getStatus(chatId.toPeerId(), peerStatusInfo);
|
rsStatus->getStatus(chatId.toPeerId(), peerStatusInfo);
|
||||||
updateStatus(QString::fromStdString(chatId.toPeerId().toStdString()), peerStatusInfo.status);
|
updateStatus(chatId, peerStatusInfo.status);
|
||||||
|
|
||||||
// initialize first custom state string
|
// initialize first custom state string
|
||||||
QString customStateString = QString::fromUtf8(rsMsgs->getCustomStateString(chatId.toPeerId()).c_str());
|
QString customStateString = QString::fromUtf8(rsMsgs->getCustomStateString(chatId.toPeerId()).c_str());
|
||||||
|
|
@ -1820,7 +1821,7 @@ void ChatWidget::setCurrentFileName(const QString &fileName)
|
||||||
setWindowModified(false);
|
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))
|
if (! (chatType() == CHATTYPE_PRIVATE || chatType() == CHATTYPE_DISTANT))
|
||||||
{
|
{
|
||||||
|
|
@ -1828,16 +1829,17 @@ void ChatWidget::updateStatus(const QString &peer_id, RsStatusValue status)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// make virtual peer id from gxs id in case of distant chat
|
// // make virtual peer id from gxs id in case of distant chat
|
||||||
RsPeerId vpid;
|
// RsPeerId vpid;
|
||||||
if(chatId.isDistantChatId())
|
// if(chatId.isDistantChatId())
|
||||||
vpid = RsPeerId(chatId.toDistantChatId());
|
// vpid = RsPeerId(chatId.toDistantChatId());
|
||||||
else
|
// else
|
||||||
vpid = chatId.toPeerId();
|
// vpid = chatId.toPeerId();
|
||||||
|
|
||||||
/* set font size for status */
|
/* set font size for status */
|
||||||
if (peer_id.toStdString() == vpid.toStdString())
|
if (!(cid == chatId))
|
||||||
{
|
return;
|
||||||
|
|
||||||
// the peers status has changed
|
// the peers status has changed
|
||||||
|
|
||||||
QString tooltip_info ;
|
QString tooltip_info ;
|
||||||
|
|
@ -1919,11 +1921,6 @@ void ChatWidget::updateStatus(const QString &peer_id, RsStatusValue status)
|
||||||
foreach (ChatWidgetHolder *chatWidgetHolder, mChatWidgetHolder) {
|
foreach (ChatWidgetHolder *chatWidgetHolder, mChatWidgetHolder) {
|
||||||
chatWidgetHolder->updateStatus(status);
|
chatWidgetHolder->updateStatus(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ignore status change
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidget::updateTitle()
|
void ChatWidget::updateTitle()
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ public:
|
||||||
const QList<ChatWidgetHolder*> &chatWidgetHolderList() { return mChatWidgetHolder; }
|
const QList<ChatWidgetHolder*> &chatWidgetHolderList() { return mChatWidgetHolder; }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void updateStatus(const QString &peer_id, RsStatusValue status);
|
void updateStatus(const ChatId &cid, RsStatusValue status);
|
||||||
void setUseCMark(const bool bUseCMark);
|
void setUseCMark(const bool bUseCMark);
|
||||||
void updateCMPreview();
|
void updateCMPreview();
|
||||||
|
|
||||||
|
|
@ -274,7 +274,8 @@ private:
|
||||||
|
|
||||||
Ui::ChatWidget *ui;
|
Ui::ChatWidget *ui;
|
||||||
|
|
||||||
RsEventsHandlerId_t mEventHandlerId ;
|
// RsEventsHandlerId_t mEventHandlerId_chat ;
|
||||||
|
RsEventsHandlerId_t mEventHandlerId_friends ;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CHATWIDGET_H
|
#endif // CHATWIDGET_H
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@
|
||||||
#include "gui/settings/RsharePeerSettings.h"
|
#include "gui/settings/RsharePeerSettings.h"
|
||||||
#include "gui/notifyqt.h"
|
#include "gui/notifyqt.h"
|
||||||
#include "util/DateTime.h"
|
#include "util/DateTime.h"
|
||||||
|
#include "util/qtthreadsutils.h"
|
||||||
|
|
||||||
#include <retroshare/rspeers.h>
|
#include <retroshare/rspeers.h>
|
||||||
#include <retroshare/rsiface.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.avatarFrameButton, SIGNAL(toggled(bool)), this, SLOT(showAvatarFrame(bool)));
|
||||||
connect(ui.actionClearOfflineMessages, SIGNAL(triggered()), this, SLOT(clearOfflineMessages()));
|
connect(ui.actionClearOfflineMessages, SIGNAL(triggered()), this, SLOT(clearOfflineMessages()));
|
||||||
//connect(NotifyQt::getInstance(), SIGNAL(chatStatusChanged(ChatId,QString)), this, SLOT(chatStatusChanged(ChatId,QString)));
|
//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)
|
void PopupChatDialog::init(const ChatId &chat_id, const QString &title)
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,8 @@ protected:
|
||||||
|
|
||||||
/** Qt Designer generated object */
|
/** Qt Designer generated object */
|
||||||
Ui::PopupChatDialog ui;
|
Ui::PopupChatDialog ui;
|
||||||
|
|
||||||
|
RsEventsHandlerId_t mEventHandlerId_chat;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@
|
||||||
</action>
|
</action>
|
||||||
<action name="actionDockTab">
|
<action name="actionDockTab">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../images.qrc">
|
<iconset>
|
||||||
<normaloff>:/images/tab-dock.png</normaloff>:/images/tab-dock.png</iconset>
|
<normaloff>:/images/tab-dock.png</normaloff>:/images/tab-dock.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
|
@ -97,7 +97,7 @@
|
||||||
</action>
|
</action>
|
||||||
<action name="actionUndockTab">
|
<action name="actionUndockTab">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../images.qrc">
|
<iconset>
|
||||||
<normaloff>:/images/tab-undock.png</normaloff>:/images/tab-undock.png</iconset>
|
<normaloff>:/images/tab-undock.png</normaloff>:/images/tab-undock.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue