mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
- fixed up avatar exchange between peers
- reverted preceding commit about PNG/JPG in popup chat dialog. This only concerns internal data representation and this string has nothing to do with accepted image formats. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1704 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
c255ec1a21
commit
dee82c5f1b
@ -204,6 +204,7 @@ class NotifyBase
|
|||||||
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) {}
|
||||||
virtual void notifyHashingInfo(std::string fileinfo) { (void)fileinfo; return ; }
|
virtual void notifyHashingInfo(std::string fileinfo) { (void)fileinfo; return ; }
|
||||||
virtual void notifyTurtleSearchResult(uint32_t search_id,const std::list<TurtleFileInfo>& files) { (void)files; }
|
virtual void notifyTurtleSearchResult(uint32_t search_id,const std::list<TurtleFileInfo>& files) { (void)files; }
|
||||||
|
virtual void notifyPeerHasNewAvatar(std::string peer_id) { (void)peer_id; }
|
||||||
};
|
};
|
||||||
|
|
||||||
const int NOTIFY_LIST_NEIGHBOURS = 1;
|
const int NOTIFY_LIST_NEIGHBOURS = 1;
|
||||||
|
@ -168,13 +168,6 @@ void p3Msgs::initRsChatInfo(RsChatMsgItem *c, ChatInfo &i)
|
|||||||
i.chatflags |= RS_CHAT_PUBLIC;
|
i.chatflags |= RS_CHAT_PUBLIC;
|
||||||
//std::cerr << "RsServer::initRsChatInfo() Chat Public!!!";
|
//std::cerr << "RsServer::initRsChatInfo() Chat Public!!!";
|
||||||
}
|
}
|
||||||
//std::cerr << std::endl;
|
|
||||||
|
|
||||||
if(c->chatFlags & RS_CHAT_FLAG_AVATAR_AVAILABLE)
|
|
||||||
{
|
|
||||||
std::cerr << "p3msgs::initRsChatInfo(): new avatar available for peer " << i.rsid << ". Sending above." << std::endl ;
|
|
||||||
i.chatflags |= RS_CHAT_AVATAR_AVAILABLE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void p3Msgs::getOwnAvatarData(unsigned char *& data,int& size)
|
void p3Msgs::getOwnAvatarData(unsigned char *& data,int& size)
|
||||||
|
@ -399,6 +399,12 @@ std::list<RsChatMsgItem *> p3ChatService::getChatQueue()
|
|||||||
if(ca != NULL)
|
if(ca != NULL)
|
||||||
{
|
{
|
||||||
receiveAvatarJpegData(ca) ;
|
receiveAvatarJpegData(ca) ;
|
||||||
|
|
||||||
|
#ifdef CHAT_DEBUG
|
||||||
|
std::cerr << "Received avatar data for peer " << ca->PeerId() << ". Notifying." << std::endl ;
|
||||||
|
#endif
|
||||||
|
rsicontrol->getNotify().notifyPeerHasNewAvatar(ca->PeerId()) ;
|
||||||
|
|
||||||
delete item ;
|
delete item ;
|
||||||
continue ;
|
continue ;
|
||||||
}
|
}
|
||||||
@ -490,7 +496,7 @@ void p3ChatService::getAvatarJpegData(const std::string& peer_id,unsigned char *
|
|||||||
|
|
||||||
std::map<std::string,AvatarInfo *>::const_iterator it = _avatars.find(peer_id) ;
|
std::map<std::string,AvatarInfo *>::const_iterator it = _avatars.find(peer_id) ;
|
||||||
|
|
||||||
std::cerr << "p3chatservice:: avatar requested from above. " << std::endl ;
|
std::cerr << "p3chatservice:: avatar for peer " << peer_id << " requested from above. " << std::endl ;
|
||||||
// has avatar. Return it strait away.
|
// has avatar. Return it strait away.
|
||||||
//
|
//
|
||||||
if(it!=_avatars.end())
|
if(it!=_avatars.end())
|
||||||
|
@ -178,16 +178,7 @@ PeersDialog::PeersDialog(QWidget *parent)
|
|||||||
menu->addAction(ui.actionCreate_new_Profile);
|
menu->addAction(ui.actionCreate_new_Profile);
|
||||||
ui.menupushButton->setMenu(menu);
|
ui.menupushButton->setMenu(menu);
|
||||||
|
|
||||||
QTimer *timerAvatar = new QTimer(this);
|
|
||||||
connect(timerAvatar, SIGNAL(timeout()), this, SLOT(updateAvatar()));
|
|
||||||
timerAvatar->start(1000);
|
|
||||||
|
|
||||||
QTimer *timerstatus= new QTimer(this);
|
|
||||||
connect(timerstatus, SIGNAL(timeout()), this, SLOT(loadmypersonalstatus()));
|
|
||||||
timerstatus->start(1000);
|
|
||||||
|
|
||||||
updateAvatar();
|
updateAvatar();
|
||||||
|
|
||||||
loadmypersonalstatus();
|
loadmypersonalstatus();
|
||||||
|
|
||||||
|
|
||||||
@ -695,6 +686,14 @@ void PeersDialog::configurefriend()
|
|||||||
ConfCertDialog::show(getPeerRsCertId(getCurrentPeer()));
|
ConfCertDialog::show(getPeerRsCertId(getCurrentPeer()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PeersDialog::updatePeersAvatar(const QString& peer_id)
|
||||||
|
{
|
||||||
|
std::cerr << "PeersDialog: Got notified of new avatar for peer " << peer_id.toStdString() << std::endl ;
|
||||||
|
|
||||||
|
PopupChatDialog *pcd = getPrivateChat(peer_id.toStdString(),rsPeers->getPeerName(peer_id.toStdString()), 0);
|
||||||
|
pcd->updatePeerAvatar(peer_id.toStdString());
|
||||||
|
}
|
||||||
|
|
||||||
void PeersDialog::updatePeerStatusString(const QString& peer_id,const QString& status_string,bool is_private_chat)
|
void PeersDialog::updatePeerStatusString(const QString& peer_id,const QString& status_string,bool is_private_chat)
|
||||||
{
|
{
|
||||||
if(is_private_chat)
|
if(is_private_chat)
|
||||||
|
@ -70,6 +70,7 @@ public slots:
|
|||||||
void displayInfoChatMenu(const QPoint& pos);
|
void displayInfoChatMenu(const QPoint& pos);
|
||||||
|
|
||||||
void updatePeerStatusString(const QString& peer_id,const QString& status_string,bool is_private_chat) ;
|
void updatePeerStatusString(const QString& peer_id,const QString& status_string,bool is_private_chat) ;
|
||||||
|
void updatePeersAvatar(const QString& peer_id);
|
||||||
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -304,11 +304,6 @@ std::cout << "PopupChatDialog:addChatMsg message : " << message.toStdString() <<
|
|||||||
qsb -> setValue(oldQsbValue);
|
qsb -> setValue(oldQsbValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ci->chatflags & RS_CHAT_AVATAR_AVAILABLE)
|
|
||||||
{
|
|
||||||
std::cerr << "received msg saying an avatar for peer " << ci->rsid << " is available." << std::endl ;
|
|
||||||
updatePeerAvatar(ci->rsid) ;
|
|
||||||
}
|
|
||||||
/*else
|
/*else
|
||||||
{
|
{
|
||||||
ui.avatarlabel->setPixmap(QPixmap(":/images/user/personal128.png"));
|
ui.avatarlabel->setPixmap(QPixmap(":/images/user/personal128.png"));
|
||||||
@ -648,6 +643,8 @@ void PopupChatDialog::changeStyle()
|
|||||||
|
|
||||||
void PopupChatDialog::updatePeerAvatar(const std::string& peer_id)
|
void PopupChatDialog::updatePeerAvatar(const std::string& peer_id)
|
||||||
{
|
{
|
||||||
|
std::cerr << "popupchatDialog: updating avatar for peer " << peer_id << std::endl ;
|
||||||
|
|
||||||
unsigned char *data = NULL;
|
unsigned char *data = NULL;
|
||||||
int size = 0 ;
|
int size = 0 ;
|
||||||
|
|
||||||
@ -665,7 +662,7 @@ void PopupChatDialog::updatePeerAvatar(const std::string& peer_id)
|
|||||||
|
|
||||||
// set the image
|
// set the image
|
||||||
QPixmap pix ;
|
QPixmap pix ;
|
||||||
pix.loadFromData(data,size,"JPG") ;
|
pix.loadFromData(data,size,"PNG") ;
|
||||||
ui.avatarlabel->setPixmap(pix); // writes image into ba in JPG format
|
ui.avatarlabel->setPixmap(pix); // writes image into ba in JPG format
|
||||||
|
|
||||||
delete[] data ;
|
delete[] data ;
|
||||||
|
@ -52,6 +52,7 @@ public:
|
|||||||
~PopupChatDialog();
|
~PopupChatDialog();
|
||||||
|
|
||||||
void updateChat();
|
void updateChat();
|
||||||
|
void updatePeerAvatar(const std::string&);
|
||||||
void addChatMsg(ChatInfo *ci);
|
void addChatMsg(ChatInfo *ci);
|
||||||
|
|
||||||
void loadEmoticons();
|
void loadEmoticons();
|
||||||
@ -106,7 +107,6 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
void colorChanged(const QColor &c);
|
void colorChanged(const QColor &c);
|
||||||
void updatePeerAvatar(const std::string&);
|
|
||||||
void updateAvatar();
|
void updateAvatar();
|
||||||
void addAttachment(std::string);
|
void addAttachment(std::string);
|
||||||
|
|
||||||
|
@ -19,8 +19,6 @@
|
|||||||
|
|
||||||
#include "MessageToaster.h"
|
#include "MessageToaster.h"
|
||||||
|
|
||||||
#include "tools.h"
|
|
||||||
|
|
||||||
MessageToaster::MessageToaster( QWidget * parent, Qt::WFlags f)
|
MessageToaster::MessageToaster( QWidget * parent, Qt::WFlags f)
|
||||||
: QWidget(parent, f)
|
: QWidget(parent, f)
|
||||||
{
|
{
|
||||||
|
@ -145,12 +145,11 @@ int main(int argc, char *argv[])
|
|||||||
QObject::connect(notify,SIGNAL(configChanged()) ,w->messagesDialog ,SLOT(displayConfig() )) ;
|
QObject::connect(notify,SIGNAL(configChanged()) ,w->messagesDialog ,SLOT(displayConfig() )) ;
|
||||||
|
|
||||||
QObject::connect(notify,SIGNAL(chatStatusChanged(const QString&,const QString&,bool)),w->peersDialog,SLOT(updatePeerStatusString(const QString&,const QString&,bool)));
|
QObject::connect(notify,SIGNAL(chatStatusChanged(const QString&,const QString&,bool)),w->peersDialog,SLOT(updatePeerStatusString(const QString&,const QString&,bool)));
|
||||||
|
QObject::connect(notify,SIGNAL(peerHasNewAvatar(const QString&)),w->peersDialog,SLOT(updatePeersAvatar(const QString&)));
|
||||||
QObject::connect(notify,SIGNAL(logInfoChanged(const QString&)),w->networkDialog,SLOT(setLogInfo(QString))) ;
|
QObject::connect(notify,SIGNAL(logInfoChanged(const QString&)),w->networkDialog,SLOT(setLogInfo(QString))) ;
|
||||||
|
|
||||||
QObject::connect(ConfCertDialog::instance(),SIGNAL(configChanged()),w->networkDialog,SLOT(insertConnect())) ;
|
QObject::connect(ConfCertDialog::instance(),SIGNAL(configChanged()),w->networkDialog,SLOT(insertConnect())) ;
|
||||||
QObject::connect(w->peersDialog,SIGNAL(friendsUpdated()),w->networkDialog,SLOT(insertConnect())) ;
|
QObject::connect(w->peersDialog,SIGNAL(friendsUpdated()),w->networkDialog,SLOT(insertConnect())) ;
|
||||||
|
|
||||||
|
|
||||||
QObject::connect(w->peersDialog,SIGNAL(notifyGroupChat(const QString&,const QString&)),w,SLOT(displaySystrayMsg(const QString&,const QString&))) ;
|
QObject::connect(w->peersDialog,SIGNAL(notifyGroupChat(const QString&,const QString&)),w,SLOT(displaySystrayMsg(const QString&,const QString&))) ;
|
||||||
|
|
||||||
/* only show window, if not startMinimized */
|
/* only show window, if not startMinimized */
|
||||||
|
@ -39,6 +39,12 @@ void NotifyQt::notifyErrorMsg(int list, int type, std::string msg)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NotifyQt::notifyPeerHasNewAvatar(std::string peer_id)
|
||||||
|
{
|
||||||
|
std::cerr << "notifyQt: notification of new avatar." << std::endl ;
|
||||||
|
emit peerHasNewAvatar(QString::fromStdString(peer_id)) ;
|
||||||
|
}
|
||||||
|
|
||||||
void NotifyQt::notifyCustomState(const std::string& peer_id,const std::string& custom_state_string)
|
void NotifyQt::notifyCustomState(const std::string& peer_id,const std::string& custom_state_string)
|
||||||
{
|
{
|
||||||
std::cerr << "notifyQt: Received custom status string: " << custom_state_string << std::endl ;
|
std::cerr << "notifyQt: Received custom status string: " << custom_state_string << std::endl ;
|
||||||
|
@ -37,6 +37,7 @@ class NotifyQt: public QObject, public NotifyBase
|
|||||||
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);
|
||||||
virtual void notifyHashingInfo(std::string fileinfo);
|
virtual void notifyHashingInfo(std::string fileinfo);
|
||||||
virtual void notifyTurtleSearchResult(uint32_t search_id,const std::list<TurtleFileInfo>& found_files);
|
virtual void notifyTurtleSearchResult(uint32_t search_id,const std::list<TurtleFileInfo>& found_files);
|
||||||
|
virtual void notifyPeerHasNewAvatar(std::string peer_id) ;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
// It's beneficial to send info to the GUI using signals, because signals are thread-safe
|
// It's beneficial to send info to the GUI using signals, because signals are thread-safe
|
||||||
@ -54,6 +55,7 @@ class NotifyQt: public QObject, public NotifyBase
|
|||||||
void chatStatusChanged(const QString&,const QString&,bool) const ;
|
void chatStatusChanged(const QString&,const QString&,bool) const ;
|
||||||
void peerCustomStateStringChanged(const QString&,const QString&) const ;
|
void peerCustomStateStringChanged(const QString&,const QString&) const ;
|
||||||
void gotTurtleSearchResult(qulonglong search_id,FileDetail file) const ;
|
void gotTurtleSearchResult(qulonglong search_id,FileDetail file) const ;
|
||||||
|
void peerHasNewAvatar(const QString& peer_id) const ;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
|
@ -204,6 +204,7 @@ class NotifyBase
|
|||||||
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) {}
|
||||||
virtual void notifyHashingInfo(std::string fileinfo) { (void)fileinfo; return ; }
|
virtual void notifyHashingInfo(std::string fileinfo) { (void)fileinfo; return ; }
|
||||||
virtual void notifyTurtleSearchResult(uint32_t search_id,const std::list<TurtleFileInfo>& files) { (void)files; }
|
virtual void notifyTurtleSearchResult(uint32_t search_id,const std::list<TurtleFileInfo>& files) { (void)files; }
|
||||||
|
virtual void notifyPeerHasNewAvatar(std::string peer_id) { (void)peer_id; }
|
||||||
};
|
};
|
||||||
|
|
||||||
const int NOTIFY_LIST_NEIGHBOURS = 1;
|
const int NOTIFY_LIST_NEIGHBOURS = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user