This commit is contained in:
defnax 2025-07-14 14:10:02 +02:00 committed by GitHub
commit e270e3fbcf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 68 additions and 1 deletions

View file

@ -1931,7 +1931,12 @@ void ChatWidget::updatePeersCustomStateString(const QString& peer_id, const QStr
void ChatWidget::updateStatusString(const QString &statusMask, const QString &statusString, bool permanent) void ChatWidget::updateStatusString(const QString &statusMask, const QString &statusString, bool permanent)
{ {
ui->typingLabel->setText(QString(statusMask).arg(trUtf8(statusString.toUtf8()))); // displays info for 5 secs. ui->typingLabel->setText(QString(statusMask).arg(trUtf8(statusString.toUtf8()))); // displays info for 5 secs.
if (statusString.contains("Connexion refused")){
ui->typingPixmapLabel->setPixmap(FilesDefs::getPixmapFromQtResourcePath(":images/denied-32.png") );
} else {
ui->typingPixmapLabel->setPixmap(FilesDefs::getPixmapFromQtResourcePath(":icons/png/typing.png") ); ui->typingPixmapLabel->setPixmap(FilesDefs::getPixmapFromQtResourcePath(":icons/png/typing.png") );
}
if (statusString == "is typing...") { if (statusString == "is typing...") {
typing = true; typing = true;
@ -1943,6 +1948,11 @@ void ChatWidget::updateStatusString(const QString &statusMask, const QString &st
QTimer::singleShot(5000, this, SLOT(resetStatusBar())) ; QTimer::singleShot(5000, this, SLOT(resetStatusBar())) ;
} }
void ChatWidget::updatePixmapLabel(const QPixmap &pixmap)
{
ui->typingPixmapLabel->setPixmap(pixmap);
}
void ChatWidget::setName(const QString &name) void ChatWidget::setName(const QString &name)
{ {
this->name = name; this->name = name;

View file

@ -101,6 +101,7 @@ public:
void addChatMsg(bool incoming, const QString &name, const QDateTime &sendTime, const QDateTime &recvTime, const QString &message, MsgType chatType); void addChatMsg(bool incoming, const QString &name, const QDateTime &sendTime, const QDateTime &recvTime, const QString &message, MsgType chatType);
void addChatMsg(bool incoming, const QString &name, const RsGxsId gxsId, const QDateTime &sendTime, const QDateTime &recvTime, const QString &message, MsgType chatType); void addChatMsg(bool incoming, const QString &name, const RsGxsId gxsId, const QDateTime &sendTime, const QDateTime &recvTime, const QString &message, MsgType chatType);
void updateStatusString(const QString &statusMask, const QString &statusString, bool permanent = false); void updateStatusString(const QString &statusMask, const QString &statusString, bool permanent = false);
void updatePixmapLabel(const QPixmap &pixmap);
void addToolsAction(QAction *action); void addToolsAction(QAction *action);

View file

@ -26,7 +26,9 @@
#include <unistd.h> #include <unistd.h>
#include "gui/notifyqt.h"
#include "gui/common/FilesDefs.h" #include "gui/common/FilesDefs.h"
#include <retroshare/rsstatus.h> #include <retroshare/rsstatus.h>
#include <retroshare/rspeers.h> #include <retroshare/rspeers.h>
#include <retroshare/rsidentity.h> #include <retroshare/rsidentity.h>
@ -60,6 +62,8 @@ PopupDistantChatDialog::PopupDistantChatDialog(const DistantChatPeerId& tunnel_i
_update_timer->setInterval(1000) ; _update_timer->setInterval(1000) ;
QObject::connect(_update_timer,SIGNAL(timeout()),this,SLOT(updateDisplay())) ; QObject::connect(_update_timer,SIGNAL(timeout()),this,SLOT(updateDisplay())) ;
connect(NotifyQt::getInstance(), SIGNAL(distantchatStatusChanged(ChatId)), this, SLOT(updateDistantChatEvent()));
_update_timer->start() ; _update_timer->start() ;
getChatWidget()->addTopBarWidget(_status_label) ; getChatWidget()->addTopBarWidget(_status_label) ;
@ -118,6 +122,7 @@ void PopupDistantChatDialog::updateDisplay()
msg = tr("Remote status unknown."); msg = tr("Remote status unknown.");
_status_label->setToolTip(msg); _status_label->setToolTip(msg);
getChatWidget()->updateStatusString("%1", msg, true); getChatWidget()->updateStatusString("%1", msg, true);
getChatWidget()->updatePixmapLabel(FilesDefs::getPixmapFromQtResourcePath(":images/status_unknown.png"));
getChatWidget()->blockSending(tr( "Can't send message immediately, " getChatWidget()->blockSending(tr( "Can't send message immediately, "
"because there is no tunnel " "because there is no tunnel "
"available." )); "available." ));
@ -129,6 +134,7 @@ void PopupDistantChatDialog::updateDisplay()
_status_label->setToolTip( QObject::tr("Distant peer has closed the chat") ); _status_label->setToolTip( QObject::tr("Distant peer has closed the chat") );
getChatWidget()->updateStatusString("%1", tr( "Your partner closed the conversation." ), true ); getChatWidget()->updateStatusString("%1", tr( "Your partner closed the conversation." ), true );
getChatWidget()->updatePixmapLabel(FilesDefs::getPixmapFromQtResourcePath(":images/status_unknown.png"));
getChatWidget()->blockSending(tr( "Your partner closed the conversation.")); getChatWidget()->blockSending(tr( "Your partner closed the conversation."));
setPeerStatus(RS_STATUS_OFFLINE) ; setPeerStatus(RS_STATUS_OFFLINE) ;
@ -144,6 +150,7 @@ void PopupDistantChatDialog::updateDisplay()
_status_label->setToolTip(msg); _status_label->setToolTip(msg);
getChatWidget()->updateStatusString("%1", msg, true); getChatWidget()->updateStatusString("%1", msg, true);
getChatWidget()->updatePixmapLabel(FilesDefs::getPixmapFromQtResourcePath(":images/quick_restart24.png"));
getChatWidget()->blockSending(msg); getChatWidget()->blockSending(msg);
setPeerStatus(RS_STATUS_OFFLINE); setPeerStatus(RS_STATUS_OFFLINE);
break; break;
@ -158,6 +165,33 @@ void PopupDistantChatDialog::updateDisplay()
} }
} }
void PopupDistantChatDialog::updateDistantChatEvent()
{
if(RsAutoUpdatePage::eventsLocked())
return ;
DistantChatPeerInfo tinfo;
rsMsgs->getDistantChatStatus(_tunnel_id,tinfo) ;
switch(tinfo.status)
{
case RS_DISTANT_CHAT_STATUS_UNKNOWN:
break ;
case RS_DISTANT_CHAT_STATUS_REMOTELY_CLOSED:
getChatWidget()->addChatMsg(true, tr("Chat status"), QDateTime::currentDateTime(), QDateTime::currentDateTime()
, tr("Your partner closed the conversation."), ChatWidget::MSGTYPE_SYSTEM);
break ;
case RS_DISTANT_CHAT_STATUS_TUNNEL_DN:
break;
case RS_DISTANT_CHAT_STATUS_CAN_TALK:
getChatWidget()->addChatMsg(true, tr("Chat status"), QDateTime::currentDateTime(), QDateTime::currentDateTime()
, tr("Tunnel is secured. You can talk!"), ChatWidget::MSGTYPE_SYSTEM);
getChatWidget()->unblockSending();
break;
}
}
void PopupDistantChatDialog::closeEvent(QCloseEvent *e) void PopupDistantChatDialog::closeEvent(QCloseEvent *e)
{ {
DistantChatPeerInfo tinfo ; DistantChatPeerInfo tinfo ;

View file

@ -47,6 +47,9 @@ class PopupDistantChatDialog: public PopupChatDialog
protected slots: protected slots:
void updateDisplay() ; // overloads RsAutoUpdatePage void updateDisplay() ; // overloads RsAutoUpdatePage
private slots:
void updateDistantChatEvent() ;
private: private:
QTimer *_update_timer ; QTimer *_update_timer ;
DistantChatPeerId _tunnel_id ; DistantChatPeerId _tunnel_id ;

View file

@ -84,6 +84,7 @@
<file>images/closehover.png</file> <file>images/closehover.png</file>
<file>images/closepressed.png</file> <file>images/closepressed.png</file>
<file>images/denied16.png</file> <file>images/denied16.png</file>
<file>images/denied-32.png</file>
<file>images/filetype-association.png</file> <file>images/filetype-association.png</file>
<file>images/foldermail.png</file> <file>images/foldermail.png</file>
<file>images/folderopen.png</file> <file>images/folderopen.png</file>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View file

@ -461,6 +461,22 @@ void NotifyQt::notifyChatStatus(const ChatId& chat_id,const std::string& status_
std::cerr << "notifyQt: Received chat status string: " << status_string << std::endl ; std::cerr << "notifyQt: Received chat status string: " << status_string << std::endl ;
#endif #endif
emit chatStatusChanged(chat_id, QString::fromUtf8(status_string.c_str())); emit chatStatusChanged(chat_id, QString::fromUtf8(status_string.c_str()));
}
void NotifyQt::notifyDistantChatStatus(const ChatId& chat_id)
{
{
QMutexLocker m(&_mutex) ;
if(!_enabled)
return ;
}
#ifdef NOTIFY_DEBUG
std::cerr << "notifyQt: Received distant chat status : " << status_string << std::endl ;
#endif
emit distantchatStatusChanged(chat_id);
} }
void NotifyQt::notifyChatCleared(const ChatId& chat_id) void NotifyQt::notifyChatCleared(const ChatId& chat_id)

View file

@ -65,6 +65,7 @@ class NotifyQt: public QObject, public NotifyClient
virtual void notifyErrorMsg(int list, int sev, std::string msg); virtual void notifyErrorMsg(int list, int sev, std::string msg);
virtual void notifyChatMessage(const ChatMessage& /* msg */); virtual void notifyChatMessage(const ChatMessage& /* msg */);
virtual void notifyChatStatus(const ChatId &chat_id,const std::string& status_string); virtual void notifyChatStatus(const ChatId &chat_id,const std::string& status_string);
virtual void notifyDistantChatStatus(const ChatId &chat_id);
virtual void notifyChatCleared(const ChatId &chat_id); virtual void notifyChatCleared(const ChatId &chat_id);
virtual void notifyCustomState(const std::string& peer_id, const std::string& status_string); virtual void notifyCustomState(const std::string& peer_id, const std::string& status_string);
#ifdef TO_REMOVE #ifdef TO_REMOVE
@ -115,6 +116,7 @@ class NotifyQt: public QObject, public NotifyClient
void configChanged() const ; void configChanged() const ;
void logInfoChanged(const QString&) const ; void logInfoChanged(const QString&) const ;
void chatStatusChanged(const ChatId&,const QString&) const ; void chatStatusChanged(const ChatId&,const QString&) const ;
void distantchatStatusChanged(const ChatId&) const ;
void chatCleared(const ChatId&) const ; void chatCleared(const ChatId&) const ;
void peerHasNewCustomStateString(const QString& /* peer_id */, const QString& /* status_string */) const ; void peerHasNewCustomStateString(const QString& /* peer_id */, const QString& /* status_string */) const ;
void peerHasNewAvatar(const QString& peer_id) const ; void peerHasNewAvatar(const QString& peer_id) const ;