fixed popup of distant chat dialog, and display of peer names.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7406 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2014-06-12 22:06:43 +00:00
parent 1c00055ea9
commit be82951e2e
8 changed files with 32 additions and 98 deletions

View File

@ -232,6 +232,7 @@ void p3Notify::notifyListChange (int list, int type) { FOR_ALL_NOTIFY_CLIENTS
void p3Notify::notifyErrorMsg (int list, int sev, std::string msg) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyErrorMsg(list,sev,msg) ; }
void p3Notify::notifyChatStatus (const std::string& peer_id , const std::string& status_string ,bool is_private) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyChatStatus(peer_id,status_string,is_private) ; }
void p3Notify::notifyChatShow (const std::string& peer_id) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyChatShow(peer_id) ; }
void p3Notify::notifyChatLobbyTimeShift (int time_shift) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyChatLobbyTimeShift(time_shift) ; }
void p3Notify::notifyCustomState (const std::string& peer_id , const std::string& status_string ) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyCustomState (peer_id,status_string) ; }

View File

@ -99,6 +99,7 @@ class p3Notify: public RsNotify
void notifyListChange (int /* list */, int /* type */) ;
void notifyErrorMsg (int /* list */, int /* sev */, std::string /* msg */) ;
void notifyChatStatus (const std::string& /* peer_id */, const std::string& /* status_string */ ,bool /* is_private */) ;
void notifyChatShow (const std::string& /* peer_id */) ;
void notifyChatLobbyEvent (uint64_t /* lobby id */, uint32_t /* event type */ ,const std::string& /* nickname */,const std::string& /* any string */) ;
void notifyChatLobbyTimeShift (int /* time_shift*/) ;
void notifyCustomState (const std::string& /* peer_id */, const std::string& /* status_string */) ;

View File

@ -183,6 +183,7 @@ class NotifyClient
virtual void notifyListChange (int /* list */, int /* type */) {}
virtual void notifyErrorMsg (int /* list */, int /* sev */, std::string /* msg */) {}
virtual void notifyChatStatus (const std::string& /* peer_id */, const std::string& /* status_string */ ,bool /* is_private */) {}
virtual void notifyChatShow (const std::string& /* peer_id */) {}
virtual void notifyChatLobbyEvent (uint64_t /* lobby id */, uint32_t /* event type */ ,const std::string& /* nickname */,const std::string& /* any string */) {}
virtual void notifyChatLobbyTimeShift (int /* time_shift*/) {}
virtual void notifyCustomState (const std::string& /* peer_id */, const std::string& /* status_string */) {}

View File

@ -3214,19 +3214,18 @@ void p3ChatService::addVirtualPeer(const TurtleFileHash& hash,const TurtleVirtua
info.status = RS_DISTANT_CHAT_STATUS_WAITING_DH ;
}
RsChatMsgItem *item = new RsChatMsgItem;
item->message = std::string("Tunnel is secured") ;
item->PeerId(virtual_peer_id) ;
item->chatFlags = RS_CHAT_FLAG_PRIVATE ;
// RsChatMsgItem *item = new RsChatMsgItem;
// item->message = std::string("Tunnel is secured") ;
// item->PeerId(virtual_peer_id) ;
// item->chatFlags = RS_CHAT_FLAG_PRIVATE ;
//
// privateIncomingList.push_back(item) ;
privateIncomingList.push_back(item) ;
if(dir == RsTurtleGenericTunnelItem::DIRECTION_SERVER)
RsServer::notify()->AddPopupMessage(RS_POPUP_CHAT, virtual_peer_id.toStdString(), "Distant peer", "Conversation starts...");
// Notify the GUI that the tunnel is up.
//
RsServer::notify()->notifyChatStatus(virtual_peer_id.toStdString(),"tunnel is up again!",true) ;
RsServer::notify()->notifyChatShow(virtual_peer_id.toStdString()) ;
}
void p3ChatService::removeVirtualPeer(const TurtleFileHash& hash,const TurtleVirtualPeerId& virtual_peer_id)

View File

@ -149,13 +149,10 @@ QString PopupDistantChatDialog::getPeerName(const DistantChatPeerId &id) const
{
RsIdentityDetails details ;
for(int i=0;i<3;++i)
if(rsIdentity->getIdDetails(gxs_id,details))
return QString::fromUtf8( details.mNickname.c_str() ) ;
else
usleep(500000) ; // sleep for 500 msec.
return QString::fromStdString(id.toStdString()) ;
return QString::fromStdString(gxs_id.toStdString()) ;
}
else
return ChatDialog::getPeerName(id) ;

View File

@ -136,6 +136,8 @@ NotifyQt::NotifyQt() : cDialog(NULL)
QMutexLocker m(&_mutex) ;
_enabled = false ;
}
connect(this,SIGNAL(raiseChatWindow(QString)),this,SLOT(raiseChatWindow_slot(QString)),Qt::QueuedConnection) ;
}
void NotifyQt::notifyErrorMsg(int list, int type, std::string msg)
@ -507,6 +509,11 @@ void NotifyQt::notifyChatLobbyEvent(uint64_t lobby_id,uint32_t event_type,const
emit chatLobbyEvent(lobby_id,event_type,QString::fromUtf8(nickname.c_str()),QString::fromUtf8(str.c_str())) ;
}
void NotifyQt::notifyChatShow(const std::string& peer_id)
{
emit raiseChatWindow(RsPeerId(peer_id)) ;
}
void NotifyQt::notifyChatStatus(const std::string& peer_id,const std::string& status_string,bool is_private)
{
{
@ -521,6 +528,11 @@ void NotifyQt::notifyChatStatus(const std::string& peer_id,const std::string& st
emit chatStatusChanged(QString::fromStdString(peer_id),QString::fromUtf8(status_string.c_str()),is_private) ;
}
void NotifyQt::raiseChatWindow_slot(const RsPeerId& peer_str)
{
ChatDialog::chatFriend(peer_str) ;
}
void NotifyQt::notifyTurtleSearchResult(uint32_t search_id,const std::list<TurtleFileInfo>& files)
{
{
@ -1167,85 +1179,3 @@ void NotifyQt::runningTick()
}
}
//void NotifyQt::displaySearch()
//{
// iface->lockData(); /* Lock Interface */
//
//#ifdef NOTIFY_DEBUG
// std::ostringstream out;
// std::cerr << out.str();
//#endif
//
// iface->unlockData(); /* UnLock Interface */
//}
// void NotifyQt::displayChat()
// {
// iface->lockData(); /* Lock Interface */
//
// #ifdef NOTIFY_DEBUG
// std::ostringstream out;
// std::cerr << out.str();
// #endif
//
// iface->unlockData(); /* UnLock Interface */
//
// if (hDialog)
// hDialog -> insertChat();
// }
//
//
//void NotifyQt::displayChannels()
//{
// iface->lockData(); /* Lock Interface */
//
//#ifdef NOTIFY_DEBUG
// std::ostringstream out;
// std::cerr << out.str();
//#endif
//
// iface->unlockData(); /* UnLock Interface */
//
// if (sDialog)
// sDialog -> insertChannels();
//}
//
//
//void NotifyQt::displayTransfers()
//{
// /* Do the GUI */
// if (tDialog)
// tDialog->insertTransfers();
//}
//
//
//void NotifyQt::preDisplayNeighbours()
//{
//
//}
//
//void NotifyQt::preDisplayFriends()
//{
//
//}
//void NotifyQt::preDisplaySearch()
//{
//
//}
//
//void NotifyQt::preDisplayMessages()
//{
//
//}
//
//void NotifyQt::preDisplayChannels()
//{
//
//}
//
//void NotifyQt::preDisplayTransfers()
//{
//
//
//}

View File

@ -42,6 +42,7 @@ class NotifyQt: public QObject, public NotifyClient
virtual void notifyListChange(int list, int type);
virtual void notifyErrorMsg(int list, int sev, std::string msg);
virtual void notifyChatStatus(const std::string& peer_id,const std::string& status_string,bool is_private);
virtual void notifyChatShow(const std::string& peer_id) ;
virtual void notifyCustomState(const std::string& peer_id, const std::string& status_string);
virtual void notifyHashingInfo(uint32_t type, const std::string& fileinfo);
virtual void notifyTurtleSearchResult(uint32_t search_id,const std::list<TurtleFileInfo>& found_files);
@ -117,6 +118,7 @@ class NotifyQt: public QObject, public NotifyClient
void peerStatusChangedSummary() const;
void publicChatChanged(int type) const ;
void privateChatChanged(int list, int type) const ;
void raiseChatWindow(const RsPeerId&) const ;
void groupsChanged(int type) const ;
void discInfoChanged() const ;
void downloadComplete(const QString& /* fileHash */);
@ -141,6 +143,7 @@ class NotifyQt: public QObject, public NotifyClient
void runningTick();
void handleSignatureEvent() ;
void handleChatLobbyTimeShift(int) ;
void raiseChatWindow_slot(const RsPeerId&) ;
private:
NotifyQt();

View File

@ -373,10 +373,12 @@ int main(int argc, char *argv[])
//
qRegisterMetaType<FileDetail>("FileDetail") ;
qRegisterMetaType<RsPeerId>("RsPeerId") ;
std::cerr << "connecting signals and slots" << std::endl ;
QObject::connect(notify,SIGNAL(gotTurtleSearchResult(qulonglong,FileDetail)),w->transfersDialog->searchDialog ,SLOT(updateFiles(qulonglong,FileDetail))) ;
QObject::connect(notify,SIGNAL(deferredSignatureHandlingRequested()),notify,SLOT(handleSignatureEvent()),Qt::QueuedConnection) ;
QObject::connect(notify,SIGNAL(raiseChatWindow(const RsPeerId&)),notify,SLOT(raiseChatWindow_slot(const RsPeerId&)),Qt::QueuedConnection) ;
QObject::connect(notify,SIGNAL(chatLobbyTimeShift(int)),notify,SLOT(handleChatLobbyTimeShift(int)),Qt::QueuedConnection) ;
QObject::connect(notify,SIGNAL(diskFull(int,int)) ,w ,SLOT(displayDiskSpaceWarning(int,int))) ;
QObject::connect(notify,SIGNAL(filesPostModChanged(bool)) ,w ,SLOT(postModDirectories(bool) )) ;