From a5f32d184fdf8ddbf3aed2de78d1938f6949bc15 Mon Sep 17 00:00:00 2001 From: defnax Date: Sat, 29 Mar 2025 11:39:09 +0100 Subject: [PATCH 1/4] Added own notify for distant chat * Show in Chat when distant Chat is ready to talk * Fixed to shown a better icon when status is: "Tunnel is Pending" --- retroshare-gui/src/gui/chat/ChatWidget.cpp | 5 +++ retroshare-gui/src/gui/chat/ChatWidget.h | 1 + .../src/gui/chat/PopupDistantChatDialog.cpp | 32 +++++++++++++++++++ .../src/gui/chat/PopupDistantChatDialog.h | 3 ++ retroshare-gui/src/gui/notifyqt.cpp | 16 ++++++++++ retroshare-gui/src/gui/notifyqt.h | 2 ++ 6 files changed, 59 insertions(+) diff --git a/retroshare-gui/src/gui/chat/ChatWidget.cpp b/retroshare-gui/src/gui/chat/ChatWidget.cpp index abab8336a..48fa45887 100644 --- a/retroshare-gui/src/gui/chat/ChatWidget.cpp +++ b/retroshare-gui/src/gui/chat/ChatWidget.cpp @@ -1943,6 +1943,11 @@ void ChatWidget::updateStatusString(const QString &statusMask, const QString &st QTimer::singleShot(5000, this, SLOT(resetStatusBar())) ; } +void ChatWidget::updatePixmapLabel(const QPixmap &pixmap) +{ + ui->typingPixmapLabel->setPixmap(pixmap); +} + void ChatWidget::setName(const QString &name) { this->name = name; diff --git a/retroshare-gui/src/gui/chat/ChatWidget.h b/retroshare-gui/src/gui/chat/ChatWidget.h index e42df06fe..470344fa7 100644 --- a/retroshare-gui/src/gui/chat/ChatWidget.h +++ b/retroshare-gui/src/gui/chat/ChatWidget.h @@ -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 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 updatePixmapLabel(const QPixmap &pixmap); void addToolsAction(QAction *action); diff --git a/retroshare-gui/src/gui/chat/PopupDistantChatDialog.cpp b/retroshare-gui/src/gui/chat/PopupDistantChatDialog.cpp index c5ab40cbf..bb9e22fdd 100644 --- a/retroshare-gui/src/gui/chat/PopupDistantChatDialog.cpp +++ b/retroshare-gui/src/gui/chat/PopupDistantChatDialog.cpp @@ -26,7 +26,9 @@ #include +#include "gui/notifyqt.h" #include "gui/common/FilesDefs.h" + #include #include #include @@ -60,6 +62,8 @@ PopupDistantChatDialog::PopupDistantChatDialog(const DistantChatPeerId& tunnel_i _update_timer->setInterval(1000) ; QObject::connect(_update_timer,SIGNAL(timeout()),this,SLOT(updateDisplay())) ; + connect(NotifyQt::getInstance(), SIGNAL(distantchatStatusChanged(ChatId)), this, SLOT(updateDistantChatEvent())); + _update_timer->start() ; getChatWidget()->addTopBarWidget(_status_label) ; @@ -144,6 +148,7 @@ void PopupDistantChatDialog::updateDisplay() _status_label->setToolTip(msg); getChatWidget()->updateStatusString("%1", msg, true); + getChatWidget()->updatePixmapLabel(FilesDefs::getPixmapFromQtResourcePath(":images/quick_restart24.png")); getChatWidget()->blockSending(msg); setPeerStatus(RS_STATUS_OFFLINE); break; @@ -158,6 +163,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("Tunnel 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("Tunnel status"), QDateTime::currentDateTime(), QDateTime::currentDateTime() + , tr("Tunnel is secured. You can talk!"), ChatWidget::MSGTYPE_SYSTEM); + getChatWidget()->unblockSending(); + break; + } + +} + void PopupDistantChatDialog::closeEvent(QCloseEvent *e) { DistantChatPeerInfo tinfo ; diff --git a/retroshare-gui/src/gui/chat/PopupDistantChatDialog.h b/retroshare-gui/src/gui/chat/PopupDistantChatDialog.h index 15a83232f..b9f29d1f2 100644 --- a/retroshare-gui/src/gui/chat/PopupDistantChatDialog.h +++ b/retroshare-gui/src/gui/chat/PopupDistantChatDialog.h @@ -47,6 +47,9 @@ class PopupDistantChatDialog: public PopupChatDialog protected slots: void updateDisplay() ; // overloads RsAutoUpdatePage + private slots: + void updateDistantChatEvent() ; + private: QTimer *_update_timer ; DistantChatPeerId _tunnel_id ; diff --git a/retroshare-gui/src/gui/notifyqt.cpp b/retroshare-gui/src/gui/notifyqt.cpp index d2dee5ac4..ad0b58f63 100644 --- a/retroshare-gui/src/gui/notifyqt.cpp +++ b/retroshare-gui/src/gui/notifyqt.cpp @@ -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 ; #endif 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) diff --git a/retroshare-gui/src/gui/notifyqt.h b/retroshare-gui/src/gui/notifyqt.h index 5782ef5b7..4d4f9a41f 100644 --- a/retroshare-gui/src/gui/notifyqt.h +++ b/retroshare-gui/src/gui/notifyqt.h @@ -65,6 +65,7 @@ class NotifyQt: public QObject, public NotifyClient virtual void notifyErrorMsg(int list, int sev, std::string msg); virtual void notifyChatMessage(const ChatMessage& /* msg */); 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 notifyCustomState(const std::string& peer_id, const std::string& status_string); #ifdef TO_REMOVE @@ -115,6 +116,7 @@ class NotifyQt: public QObject, public NotifyClient void configChanged() const ; void logInfoChanged(const QString&) const ; void chatStatusChanged(const ChatId&,const QString&) const ; + void distantchatStatusChanged(const ChatId&) const ; void chatCleared(const ChatId&) const ; void peerHasNewCustomStateString(const QString& /* peer_id */, const QString& /* status_string */) const ; void peerHasNewAvatar(const QString& peer_id) const ; From ed3e495774bf48c93b137f7807273ea0a7ea7e90 Mon Sep 17 00:00:00 2001 From: defnax Date: Sat, 29 Mar 2025 12:19:25 +0100 Subject: [PATCH 2/4] change pixmap icon when status changed --- retroshare-gui/src/gui/chat/PopupDistantChatDialog.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/retroshare-gui/src/gui/chat/PopupDistantChatDialog.cpp b/retroshare-gui/src/gui/chat/PopupDistantChatDialog.cpp index bb9e22fdd..2afb5bf1b 100644 --- a/retroshare-gui/src/gui/chat/PopupDistantChatDialog.cpp +++ b/retroshare-gui/src/gui/chat/PopupDistantChatDialog.cpp @@ -122,6 +122,7 @@ void PopupDistantChatDialog::updateDisplay() msg = tr("Remote status unknown."); _status_label->setToolTip(msg); getChatWidget()->updateStatusString("%1", msg, true); + getChatWidget()->updatePixmapLabel(FilesDefs::getPixmapFromQtResourcePath(":images/status_unknown.png")); getChatWidget()->blockSending(tr( "Can't send message immediately, " "because there is no tunnel " "available." )); @@ -133,6 +134,7 @@ void PopupDistantChatDialog::updateDisplay() _status_label->setToolTip( QObject::tr("Distant peer has closed the chat") ); 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.")); setPeerStatus(RS_STATUS_OFFLINE) ; From c385c13ef17d869b46b2dc419ba804dbe976cd76 Mon Sep 17 00:00:00 2001 From: defnax Date: Sat, 29 Mar 2025 18:19:49 +0100 Subject: [PATCH 3/4] Fixed to show for "Connexion refused..." different icon --- retroshare-gui/src/gui/chat/ChatWidget.cpp | 7 ++++++- retroshare-gui/src/gui/chat/PopupDistantChatDialog.cpp | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/retroshare-gui/src/gui/chat/ChatWidget.cpp b/retroshare-gui/src/gui/chat/ChatWidget.cpp index 48fa45887..2258504e9 100644 --- a/retroshare-gui/src/gui/chat/ChatWidget.cpp +++ b/retroshare-gui/src/gui/chat/ChatWidget.cpp @@ -1931,7 +1931,12 @@ void ChatWidget::updatePeersCustomStateString(const QString& peer_id, const QStr 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->typingPixmapLabel->setPixmap(FilesDefs::getPixmapFromQtResourcePath(":icons/png/typing.png") ); + + if (statusString.contains("Connexion refused")){ + ui->typingPixmapLabel->setPixmap(FilesDefs::getPixmapFromQtResourcePath(":images/denied16.png") ); + } else { + ui->typingPixmapLabel->setPixmap(FilesDefs::getPixmapFromQtResourcePath(":icons/png/typing.png") ); + } if (statusString == "is typing...") { typing = true; diff --git a/retroshare-gui/src/gui/chat/PopupDistantChatDialog.cpp b/retroshare-gui/src/gui/chat/PopupDistantChatDialog.cpp index 2afb5bf1b..bba3bae3f 100644 --- a/retroshare-gui/src/gui/chat/PopupDistantChatDialog.cpp +++ b/retroshare-gui/src/gui/chat/PopupDistantChatDialog.cpp @@ -178,13 +178,13 @@ void PopupDistantChatDialog::updateDistantChatEvent() case RS_DISTANT_CHAT_STATUS_UNKNOWN: break ; case RS_DISTANT_CHAT_STATUS_REMOTELY_CLOSED: - getChatWidget()->addChatMsg(true, tr("Tunnel status"), QDateTime::currentDateTime(), QDateTime::currentDateTime() + 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("Tunnel status"), QDateTime::currentDateTime(), QDateTime::currentDateTime() + getChatWidget()->addChatMsg(true, tr("Chat status"), QDateTime::currentDateTime(), QDateTime::currentDateTime() , tr("Tunnel is secured. You can talk!"), ChatWidget::MSGTYPE_SYSTEM); getChatWidget()->unblockSending(); break; From ea05dbcd6678119b538bb968ff785cdaf9f40ad4 Mon Sep 17 00:00:00 2001 From: defnax Date: Tue, 1 Apr 2025 17:38:12 +0200 Subject: [PATCH 4/4] update refused icon --- retroshare-gui/src/gui/chat/ChatWidget.cpp | 2 +- retroshare-gui/src/gui/images.qrc | 1 + retroshare-gui/src/gui/images/denied-32.png | Bin 0 -> 2552 bytes 3 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 retroshare-gui/src/gui/images/denied-32.png diff --git a/retroshare-gui/src/gui/chat/ChatWidget.cpp b/retroshare-gui/src/gui/chat/ChatWidget.cpp index 2258504e9..e9128af2a 100644 --- a/retroshare-gui/src/gui/chat/ChatWidget.cpp +++ b/retroshare-gui/src/gui/chat/ChatWidget.cpp @@ -1933,7 +1933,7 @@ void ChatWidget::updateStatusString(const QString &statusMask, const QString &st 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/denied16.png") ); + ui->typingPixmapLabel->setPixmap(FilesDefs::getPixmapFromQtResourcePath(":images/denied-32.png") ); } else { ui->typingPixmapLabel->setPixmap(FilesDefs::getPixmapFromQtResourcePath(":icons/png/typing.png") ); } diff --git a/retroshare-gui/src/gui/images.qrc b/retroshare-gui/src/gui/images.qrc index de468d270..ee13f256f 100644 --- a/retroshare-gui/src/gui/images.qrc +++ b/retroshare-gui/src/gui/images.qrc @@ -84,6 +84,7 @@ images/closehover.png images/closepressed.png images/denied16.png + images/denied-32.png images/filetype-association.png images/foldermail.png images/folderopen.png diff --git a/retroshare-gui/src/gui/images/denied-32.png b/retroshare-gui/src/gui/images/denied-32.png new file mode 100644 index 0000000000000000000000000000000000000000..1b2e691c8a564d007b29d5d7af5a04098b4f56a5 GIT binary patch literal 2552 zcmVd-{Q^ zn06A^J-}ej9bnG?Kj)tFzjM@|^H$S<>0TO$13~xR59A?jV26Q81vvo($|1}~Fg*yh z0?=N6P6)KR>vlJmvjK0T|4x|{1k9-8@z-=(J6;KfRU_rD(b=pX+LiC+8EFU|{ z`BUF%U8=Xf5Wt`L?~s9aB5=c?=HG5Pc>A7-U-}e!awpPg5S1&?2|x*00c){hP_9A6 zJxnHpGA_~b91BnW6DMCdeQ8#CHpo zj|A|{I}sQg>PgQ0{HK4##Jx1dY8g;Cu7e+obK%k@UVr7kxwf=Sy&YCMLM;M8lhvN? z9hjWpmOVFd>(DSB5CPUgHk&1ERQcz}zQSv3ttkhluLHiN3yh=w^}vTeWM~U>3s(>W zZY<8Vj^dT0$C$Y^>(9ei=i%#lxDdb^0G3qFx08FPuiQJh`<4fyz8sCqmk_NHV5wYT zXt0kDA3ns@uO0i3R%mzskU+cZSh(+}ci*sYQ*V~pnHhWqp6AhuB7X4fbDS^NUi`k| z56%gv_PuS}P5_U=#lw#KJ2xhiI21;)|RqR-QTzzdoWUofFsx6o794NuUFRxLA0S`Eghgw8-{ulJaYVGCEp510AKrn4|i@I9o!JCY_?Qy2|-haP(C;ejWUC&U&$2x3)3Q$kdLzudOUXy^7#KXz_OL ztMef@Ag$U0Zn6`ZEqVoTwlD3_$@$TLLX;h3tufQ^U^~8v8%#Ew>8^8TTtP> z*F>YkkV+_YoEm+O8F1Tnn{LCfbsU|FIy8Zf0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