mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-08 22:32:34 -04:00
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"
This commit is contained in:
parent
8fcc52b304
commit
a5f32d184f
6 changed files with 59 additions and 0 deletions
|
@ -1943,6 +1943,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;
|
||||||
|
|
|
@ -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);
|
||||||
|
|
||||||
|
|
|
@ -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) ;
|
||||||
|
@ -144,6 +148,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 +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)
|
void PopupDistantChatDialog::closeEvent(QCloseEvent *e)
|
||||||
{
|
{
|
||||||
DistantChatPeerInfo tinfo ;
|
DistantChatPeerInfo tinfo ;
|
||||||
|
|
|
@ -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 ;
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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 ;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue