mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-04-19 14:55:54 -04:00
Merge ea05dbcd6678119b538bb968ff785cdaf9f40ad4 into 8fcc52b304f35a5c7df95efbe2abdd0574048a15
This commit is contained in:
commit
bb7150f8ae
@ -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/denied-32.png") );
|
||||
} else {
|
||||
ui->typingPixmapLabel->setPixmap(FilesDefs::getPixmapFromQtResourcePath(":icons/png/typing.png") );
|
||||
}
|
||||
|
||||
if (statusString == "is typing...") {
|
||||
typing = true;
|
||||
@ -1943,6 +1948,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;
|
||||
|
@ -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);
|
||||
|
||||
|
@ -26,7 +26,9 @@
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include "gui/notifyqt.h"
|
||||
#include "gui/common/FilesDefs.h"
|
||||
|
||||
#include <retroshare/rsstatus.h>
|
||||
#include <retroshare/rspeers.h>
|
||||
#include <retroshare/rsidentity.h>
|
||||
@ -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) ;
|
||||
@ -118,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." ));
|
||||
@ -129,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) ;
|
||||
@ -144,6 +150,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 +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)
|
||||
{
|
||||
DistantChatPeerInfo tinfo ;
|
||||
|
@ -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 ;
|
||||
|
@ -84,6 +84,7 @@
|
||||
<file>images/closehover.png</file>
|
||||
<file>images/closepressed.png</file>
|
||||
<file>images/denied16.png</file>
|
||||
<file>images/denied-32.png</file>
|
||||
<file>images/filetype-association.png</file>
|
||||
<file>images/foldermail.png</file>
|
||||
<file>images/folderopen.png</file>
|
||||
|
BIN
retroshare-gui/src/gui/images/denied-32.png
Normal file
BIN
retroshare-gui/src/gui/images/denied-32.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
@ -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)
|
||||
|
@ -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 ;
|
||||
|
Loading…
x
Reference in New Issue
Block a user