mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-27 08:25:53 -04:00
added tunnel state light to distant chat popup dialog. Added proper peer name. Changed method for adding widgets in the chat bar
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-GenericTunneling@6337 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
6ddfe35353
commit
cb9f174efa
14 changed files with 56 additions and 26 deletions
|
@ -22,6 +22,11 @@
|
|||
#include <QTimer>
|
||||
#include "PopupDistantChatDialog.h"
|
||||
|
||||
#define IMAGE_RED_LED ":/images/redled.png"
|
||||
#define IMAGE_YEL_LED ":/images/yellowled.png"
|
||||
#define IMAGE_GRN_LED ":/images/greenled.png"
|
||||
#define IMAGE_GRY_LED ":/images/grayled.png"
|
||||
|
||||
PopupDistantChatDialog::~PopupDistantChatDialog()
|
||||
{
|
||||
delete _tunnel_check_timer ;
|
||||
|
@ -36,6 +41,10 @@ PopupDistantChatDialog::PopupDistantChatDialog(QWidget *parent, Qt::WFlags flags
|
|||
QObject::connect(_tunnel_check_timer,SIGNAL(timeout()),this,SLOT(checkTunnel())) ;
|
||||
|
||||
_tunnel_check_timer->start() ;
|
||||
_status_label = new QLabel ;
|
||||
|
||||
addChatBarWidget(_status_label) ;
|
||||
checkTunnel() ;
|
||||
}
|
||||
|
||||
void PopupDistantChatDialog::init(const std::string& hash,const QString & title)
|
||||
|
@ -53,17 +62,27 @@ void PopupDistantChatDialog::checkTunnel()
|
|||
// make sure about the tunnel status
|
||||
//
|
||||
|
||||
uint32_t status = rsMsgs->getDistantChatStatus(_hash) ;
|
||||
uint32_t status= RS_DISTANT_CHAT_STATUS_UNKNOWN;
|
||||
std::string pgp_id ;
|
||||
rsMsgs->getDistantChatStatus(_hash,status,pgp_id) ;
|
||||
|
||||
switch(status)
|
||||
{
|
||||
case RS_DISTANT_CHAT_STATUS_UNKNOWN: std::cerr << "Unknown hash. Error!" << std::endl;
|
||||
_status_label->setPixmap(QPixmap(IMAGE_GRY_LED)) ;
|
||||
_status_label->setText(tr("Hash error")) ;
|
||||
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->setText(tr("Tunnel is broken")) ;
|
||||
break ;
|
||||
case RS_DISTANT_CHAT_STATUS_TUNNEL_OK: std::cerr << "Tunnel is ok. " << std::endl;
|
||||
_status_label->setPixmap(QPixmap(IMAGE_YEL_LED)) ;
|
||||
_status_label->setText(tr("Tunnel established")) ;
|
||||
break ;
|
||||
case RS_DISTANT_CHAT_STATUS_CAN_TALK: std::cerr << "Tunnel is ok and works. You can talk!" << std::endl;
|
||||
_status_label->setPixmap(QPixmap(IMAGE_GRN_LED)) ;
|
||||
_status_label->setText(tr("Tunnel is working")) ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue