improved status display for distant chat

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6437 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2013-06-17 21:58:26 +00:00
parent 8ab9c59a9f
commit b21fae52d0
6 changed files with 20 additions and 4 deletions

View File

@ -2932,7 +2932,7 @@ void p3ChatService::addVirtualPeer(const TurtleFileHash& hash,const TurtleVirtua
}
rsicontrol->getNotify().notifyChatStatus(hash,"tunnel is up again!",true) ;
rsicontrol->getNotify().notifyPeerStatusChanged(hash,RS_STATUS_ONLINE) ;
//rsicontrol->getNotify().notifyPeerStatusChanged(hash,RS_STATUS_ONLINE) ;
}
void p3ChatService::removeVirtualPeer(const TurtleFileHash& hash,const TurtleVirtualPeerId& virtual_peer_id)
@ -3053,6 +3053,8 @@ void p3ChatService::receiveTurtleData( RsTurtleGenericTunnelItem *gitem,const st
// Setup the virtual peer to be the origin, and pass it on.
//
citem->PeerId(hash) ;
//rsicontrol->getNotify().notifyPeerStatusChanged(hash,RS_STATUS_ONLINE) ;
handleIncomingItem(citem) ; // Treats the item, and deletes it
}

View File

@ -306,7 +306,12 @@ bool ChatDialog::hasNewMessages()
return false;
}
void ChatDialog::setPeerStatus(uint32_t status)
{
ChatWidget *cw = getChatWidget();
if (cw)
cw->updateStatus(QString::fromStdString(getPeerId()), status);
}
int ChatDialog::getPeerStatus()
{
ChatWidget *cw = getChatWidget();

View File

@ -60,6 +60,7 @@ public:
void insertChatMsgs();
int getPeerStatus();
void setPeerStatus(uint32_t state);
void focusDialog();

View File

@ -79,12 +79,13 @@ public:
void setDefaultExtraFileFlags(TransferRequestFlags f) ;
void pasteText(const QString&);
public slots:
void updateStatus(const QString &peer_id, int status);
private slots:
void pasteCreateMsgLink() ;
void clearChatHistory();
void deleteChatHistory();
void messageHistory();
void updateStatus(const QString &peer_id, int status);
void resetStatusBar() ;
signals:

View File

@ -23,6 +23,8 @@
#include <QCloseEvent>
#include <QMessageBox>
#include <retroshare/rsstatus.h>
#include "RsAutoUpdatePage.h"
#include "PopupDistantChatDialog.h"
@ -79,6 +81,7 @@ void PopupDistantChatDialog::updateDisplay()
case RS_DISTANT_CHAT_STATUS_UNKNOWN: std::cerr << "Unknown hash. Error!" << std::endl;
_status_label->setPixmap(QPixmap(IMAGE_GRY_LED)) ;
_status_label->setToolTip(QObject::tr("Hash error")) ;
setPeerStatus(RS_STATUS_OFFLINE) ;
break ;
case RS_DISTANT_CHAT_STATUS_REMOTELY_CLOSED: std::cerr << "Chat remotely closed. " << std::endl;
_status_label->setPixmap(QPixmap(IMAGE_RED_LED)) ;
@ -86,18 +89,23 @@ void PopupDistantChatDialog::updateDisplay()
QMessageBox::warning(NULL,tr("Distant chat terminated"),tr("The person you're talking to has deleted the secured chat tunnel. You may remove the chat window now.")) ;
_update_timer->stop() ;
setPeerStatus(RS_STATUS_OFFLINE) ;
break ;
case RS_DISTANT_CHAT_STATUS_TUNNEL_DN: std::cerr << "Tunnel asked. Waiting for reponse. " << std::endl;
_status_label->setPixmap(QPixmap(IMAGE_RED_LED)) ;
_status_label->setToolTip(QObject::tr("Tunnel is pending...")) ;
setPeerStatus(RS_STATUS_OFFLINE) ;
break ;
case RS_DISTANT_CHAT_STATUS_TUNNEL_OK: std::cerr << "Tunnel is ok. " << std::endl;
_status_label->setPixmap(QPixmap(IMAGE_YEL_LED)) ;
_status_label->setToolTip(QObject::tr("Secured tunnel established!")) ;
setPeerStatus(RS_STATUS_ONLINE) ;
break ;
case RS_DISTANT_CHAT_STATUS_CAN_TALK: std::cerr << "Tunnel is ok and data is transmitted." << std::endl;
_status_label->setPixmap(QPixmap(IMAGE_GRN_LED)) ;
_status_label->setToolTip(QObject::tr("Secured tunnel is working")) ;
setPeerStatus(RS_STATUS_ONLINE) ;
break ;
}
}

View File

@ -40,7 +40,6 @@ class PopupDistantChatDialog: public PopupChatDialog
virtual ~PopupDistantChatDialog();
virtual void init(const std::string& _hash, const QString &title);
virtual void updateStatus(int /*status*/) {}
virtual void closeEvent(QCloseEvent *e) ;
protected slots: