mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-02 19:26:31 -04:00
fixed exchange of custom strings.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1717 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
96d9f80d6c
commit
798f6026cc
12 changed files with 292 additions and 244 deletions
|
@ -712,6 +712,18 @@ void PeersDialog::updateStatusString(const QString& status_string)
|
|||
QTimer::singleShot(5000,this,SLOT(resetStatusBar())) ;
|
||||
}
|
||||
|
||||
void PeersDialog::updatePeersCustomStateString(const QString& peer_id)
|
||||
{
|
||||
#ifdef JUST_AN_EXAMPLE
|
||||
// This is an example of how to retrieve the custom string.
|
||||
//
|
||||
std::cerr << "PeersDialog: Got notified that state string changed for peer " << peer_id.toStdString() << std::endl ;
|
||||
std::cerr << "New state string for this peer is : " << rsMsgs->getCustomStateString(peer_id.toStdString()) << std::endl ;
|
||||
|
||||
QMessageBox::information(NULL,"Notification",peer_id+" has new custom string: " + QString::fromStdString(rsMsgs->getCustomStateString(peer_id.toStdString()))) ;
|
||||
#endif
|
||||
}
|
||||
|
||||
void PeersDialog::updatePeersAvatar(const QString& peer_id)
|
||||
{
|
||||
std::cerr << "PeersDialog: Got notified of new avatar for peer " << peer_id.toStdString() << std::endl ;
|
||||
|
|
|
@ -39,134 +39,135 @@ class ChatDialog;
|
|||
|
||||
class PeersDialog : public MainPage
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** Default Constructor */
|
||||
PeersDialog(QWidget *parent = 0);
|
||||
/** Default Destructor */
|
||||
|
||||
PopupChatDialog *getPrivateChat(std::string id, std::string name, uint chatflags);
|
||||
void clearOldChats();
|
||||
|
||||
void loadEmoticonsgroupchat();
|
||||
// void setChatDialog(ChatDialog *cd);
|
||||
public:
|
||||
/** Default Constructor */
|
||||
PeersDialog(QWidget *parent = 0);
|
||||
/** Default Destructor */
|
||||
|
||||
QPixmap picture;
|
||||
PopupChatDialog *getPrivateChat(std::string id, std::string name, uint chatflags);
|
||||
void clearOldChats();
|
||||
|
||||
public slots:
|
||||
void loadEmoticonsgroupchat();
|
||||
// void setChatDialog(ChatDialog *cd);
|
||||
|
||||
void insertPeers();
|
||||
void toggleSendItem( QTreeWidgetItem *item, int col );
|
||||
QPixmap picture;
|
||||
|
||||
void insertChat();
|
||||
void setChatInfo(QString info, QColor color=QApplication::palette().color(QPalette::WindowText));
|
||||
void resetStatusBar() ;
|
||||
public slots:
|
||||
|
||||
|
||||
void smileyWidgetgroupchat();
|
||||
void addSmileys();
|
||||
|
||||
void on_actionClearChat_triggered();
|
||||
void displayInfoChatMenu(const QPoint& pos);
|
||||
void insertPeers();
|
||||
void toggleSendItem( QTreeWidgetItem *item, int col );
|
||||
|
||||
// called by notifyQt when another peer is typing (in group chant and private chat)
|
||||
void updatePeerStatusString(const QString& peer_id,const QString& status_string,bool is_private_chat) ;
|
||||
void insertChat();
|
||||
void setChatInfo(QString info, QColor color=QApplication::palette().color(QPalette::WindowText));
|
||||
void resetStatusBar() ;
|
||||
|
||||
void updatePeersAvatar(const QString& peer_id);
|
||||
void updateAvatar(); // called by notifyQt to update the avatar when it gets changed by another component
|
||||
|
||||
private slots:
|
||||
void smileyWidgetgroupchat();
|
||||
void addSmileys();
|
||||
|
||||
/** Create the context popup menu and it's submenus */
|
||||
void peertreeWidgetCostumPopupMenu( QPoint point );
|
||||
void on_actionClearChat_triggered();
|
||||
void displayInfoChatMenu(const QPoint& pos);
|
||||
|
||||
void updateStatusString(const QString& statusString) ; // called when a peer is typing in group chat
|
||||
void updateStatusTyping() ; // called each time a key is hit
|
||||
|
||||
//void updatePeerStatusString(const QString& peer_id,const QString& chat_status) ;
|
||||
// called by notifyQt when another peer is typing (in group chant and private chat)
|
||||
void updatePeerStatusString(const QString& peer_id,const QString& status_string,bool is_private_chat) ;
|
||||
|
||||
/** Export friend in Friends Dialog */
|
||||
void exportfriend();
|
||||
/** Remove friend */
|
||||
void removefriend();
|
||||
/** start a chat with a friend **/
|
||||
void chatfriend();
|
||||
void msgfriend();
|
||||
void updatePeersCustomStateString(const QString& peer_id) ;
|
||||
void updatePeersAvatar(const QString& peer_id);
|
||||
void updateAvatar(); // called by notifyQt to update the avatar when it gets changed by another component
|
||||
|
||||
void configurefriend();
|
||||
void viewprofile();
|
||||
private slots:
|
||||
|
||||
/** RsServer Friend Calls */
|
||||
void allowfriend();
|
||||
void connectfriend();
|
||||
void setaddressfriend();
|
||||
void trustfriend();
|
||||
|
||||
void setColor();
|
||||
void insertSendList();
|
||||
void checkChat();
|
||||
void sendMsg();
|
||||
|
||||
//void privchat();
|
||||
|
||||
void setFont();
|
||||
void getFont();
|
||||
void underline();
|
||||
/** Create the context popup menu and it's submenus */
|
||||
void peertreeWidgetCostumPopupMenu( QPoint point );
|
||||
|
||||
void changeAvatarClicked();
|
||||
void getAvatar();
|
||||
|
||||
void on_actionAdd_Friend_activated();
|
||||
void on_actionCreate_new_Profile_activated();
|
||||
|
||||
void loadmypersonalstatus();
|
||||
void updateStatusString(const QString& statusString) ; // called when a peer is typing in group chat
|
||||
void updateStatusTyping() ; // called each time a key is hit
|
||||
|
||||
//void updatePeerStatusString(const QString& peer_id,const QString& chat_status) ;
|
||||
|
||||
/** Export friend in Friends Dialog */
|
||||
void exportfriend();
|
||||
/** Remove friend */
|
||||
void removefriend();
|
||||
/** start a chat with a friend **/
|
||||
void chatfriend();
|
||||
void msgfriend();
|
||||
|
||||
void configurefriend();
|
||||
void viewprofile();
|
||||
|
||||
/** RsServer Friend Calls */
|
||||
void allowfriend();
|
||||
void connectfriend();
|
||||
void setaddressfriend();
|
||||
void trustfriend();
|
||||
|
||||
void setColor();
|
||||
void insertSendList();
|
||||
void checkChat();
|
||||
void sendMsg();
|
||||
|
||||
//void privchat();
|
||||
|
||||
void setFont();
|
||||
void getFont();
|
||||
void underline();
|
||||
|
||||
void changeAvatarClicked();
|
||||
void getAvatar();
|
||||
|
||||
void on_actionAdd_Friend_activated();
|
||||
void on_actionCreate_new_Profile_activated();
|
||||
|
||||
void loadmypersonalstatus();
|
||||
|
||||
|
||||
signals:
|
||||
void friendsUpdated() ;
|
||||
void notifyGroupChat(const QString&,const QString&) ;
|
||||
|
||||
private:
|
||||
class QLabel *iconLabel, *textLabel;
|
||||
class QWidget *widget;
|
||||
class QWidgetAction *widgetAction;
|
||||
class QSpacerItem *spacerItem;
|
||||
void friendsUpdated() ;
|
||||
void notifyGroupChat(const QString&,const QString&) ;
|
||||
|
||||
/* Worker Functions */
|
||||
/* (1) Update Display */
|
||||
private:
|
||||
class QLabel *iconLabel, *textLabel;
|
||||
class QWidget *widget;
|
||||
class QWidgetAction *widgetAction;
|
||||
class QSpacerItem *spacerItem;
|
||||
|
||||
/* (2) Utility Fns */
|
||||
QTreeWidgetItem *getCurrentPeer();
|
||||
/* Worker Functions */
|
||||
/* (1) Update Display */
|
||||
|
||||
/** Define the popup menus for the Context menu */
|
||||
QMenu* contextMnu;
|
||||
/** Defines the actions for the context menu */
|
||||
QAction* chatAct;
|
||||
QAction* msgAct;
|
||||
QAction* connectfriendAct;
|
||||
QAction* profileviewAct;
|
||||
QAction* configurefriendAct;
|
||||
QAction* exportfriendAct;
|
||||
QAction* removefriendAct;
|
||||
/* (2) Utility Fns */
|
||||
QTreeWidgetItem *getCurrentPeer();
|
||||
|
||||
QTreeWidget *peertreeWidget;
|
||||
/** Define the popup menus for the Context menu */
|
||||
QMenu* contextMnu;
|
||||
/** Defines the actions for the context menu */
|
||||
QAction* chatAct;
|
||||
QAction* msgAct;
|
||||
QAction* connectfriendAct;
|
||||
QAction* profileviewAct;
|
||||
QAction* configurefriendAct;
|
||||
QAction* exportfriendAct;
|
||||
QAction* removefriendAct;
|
||||
|
||||
IMHistoryKeeper historyKeeper;
|
||||
|
||||
QColor _currentColor;
|
||||
bool _underline;
|
||||
time_t last_status_send_time ;
|
||||
QTreeWidget *peertreeWidget;
|
||||
|
||||
QHash<QString, QString> smileys;
|
||||
IMHistoryKeeper historyKeeper;
|
||||
|
||||
std::map<std::string, PopupChatDialog *> chatDialogs;
|
||||
QColor _currentColor;
|
||||
bool _underline;
|
||||
time_t last_status_send_time ;
|
||||
|
||||
QFont mCurrentFont; /* how the text will come out */
|
||||
|
||||
std::map<std::string, PopupChatDialog *> chatDialogs;
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::PeersDialog ui;
|
||||
QFont mCurrentFont; /* how the text will come out */
|
||||
|
||||
/** A RshareSettings object used for saving/loading settings */
|
||||
RshareSettings* _settings;
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::PeersDialog ui;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -50,10 +50,10 @@ void NotifyQt::notifyPeerHasNewAvatar(std::string peer_id)
|
|||
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)
|
||||
{
|
||||
std::cerr << "notifyQt: Received custom status string: " << custom_state_string << std::endl ;
|
||||
emit peerCustomStateStringChanged(QString::fromStdString(peer_id),QString::fromStdString(custom_state_string)) ;
|
||||
std::cerr << "notifyQt: Received custom status string notification" << std::endl ;
|
||||
emit peerHasNewCustomStateString(QString::fromStdString(peer_id)) ;
|
||||
}
|
||||
|
||||
void NotifyQt::notifyChatStatus(const std::string& peer_id,const std::string& status_string,bool is_private)
|
||||
|
|
|
@ -34,7 +34,7 @@ class NotifyQt: public QObject, public NotifyBase
|
|||
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 notifyCustomState(const std::string& peer_id,const std::string& status_string);
|
||||
virtual void notifyCustomState(const std::string& peer_id);
|
||||
virtual void notifyHashingInfo(std::string fileinfo);
|
||||
virtual void notifyTurtleSearchResult(uint32_t search_id,const std::list<TurtleFileInfo>& found_files);
|
||||
virtual void notifyPeerHasNewAvatar(std::string peer_id) ;
|
||||
|
@ -54,7 +54,7 @@ class NotifyQt: public QObject, public NotifyBase
|
|||
void configChanged() const ;
|
||||
void logInfoChanged(const QString&) const ;
|
||||
void chatStatusChanged(const QString&,const QString&,bool) const ;
|
||||
void peerCustomStateStringChanged(const QString&,const QString&) const ;
|
||||
void peerHasNewCustomStateString(const QString&) const ;
|
||||
void gotTurtleSearchResult(qulonglong search_id,FileDetail file) const ;
|
||||
void peerHasNewAvatar(const QString& peer_id) const ;
|
||||
void ownAvatarChanged() const ;
|
||||
|
|
|
@ -201,7 +201,7 @@ class NotifyBase
|
|||
virtual void notifyErrorMsg(int list, int sev, std::string msg) { (void) list; (void) sev; (void) msg; return; }
|
||||
virtual void notifyChat() { return; }
|
||||
virtual void notifyChatStatus(const std::string& peer_id,const std::string& status_string,bool is_private) {}
|
||||
virtual void notifyCustomState(const std::string& peer_id,const std::string& status_string) {}
|
||||
virtual void notifyCustomState(const std::string& peer_id) {}
|
||||
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 notifyPeerHasNewAvatar(std::string peer_id) { (void)peer_id; }
|
||||
|
|
|
@ -136,6 +136,7 @@ virtual void sendGroupChatStatusString(const std::string& status_string) = 0 ;
|
|||
|
||||
virtual void setCustomStateString(const std::string& status_string) = 0 ;
|
||||
virtual std::string getCustomStateString() = 0 ;
|
||||
virtual std::string getCustomStateString(const std::string& peer_id) = 0 ;
|
||||
|
||||
// get avatar data for peer pid
|
||||
virtual void getAvatarData(std::string pid,unsigned char *& data,int& size) = 0 ;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue