commited rest of AsamK patch for factoring friend list.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4645 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2011-10-20 21:34:44 +00:00
parent c876925e57
commit 01a93b5f36
7 changed files with 155 additions and 2411 deletions

View File

@ -325,6 +325,7 @@ HEADERS += rshare.h \
gui/common/GroupTreeWidget.h \ gui/common/GroupTreeWidget.h \
gui/common/RSTreeView.h \ gui/common/RSTreeView.h \
gui/common/AvatarWidget.h \ gui/common/AvatarWidget.h \
gui/common/FriendList.h \
gui/style/RSStyle.h \ gui/style/RSStyle.h \
gui/style/StyleDialog.h \ gui/style/StyleDialog.h \
gui/MessagesDialog.h \ gui/MessagesDialog.h \
@ -443,6 +444,7 @@ FORMS += gui/StartDialog.ui \
gui/groups/CreateGroup.ui \ gui/groups/CreateGroup.ui \
gui/common/GroupTreeWidget.ui \ gui/common/GroupTreeWidget.ui \
gui/common/AvatarWidget.ui \ gui/common/AvatarWidget.ui \
gui/common/FriendList.ui \
gui/style/StyleDialog.ui \ gui/style/StyleDialog.ui \
gui/dht/DhtWindow.ui \ gui/dht/DhtWindow.ui \
gui/GetStartedDialog.ui gui/GetStartedDialog.ui
@ -544,6 +546,7 @@ SOURCES += main.cpp \
gui/common/GroupTreeWidget.cpp \ gui/common/GroupTreeWidget.cpp \
gui/common/RSTreeView.cpp \ gui/common/RSTreeView.cpp \
gui/common/AvatarWidget.cpp \ gui/common/AvatarWidget.cpp \
gui/common/FriendList.cpp \
gui/style/RSStyle.cpp \ gui/style/RSStyle.cpp \
gui/style/StyleDialog.cpp \ gui/style/StyleDialog.cpp \
gui/settings/configpage.cpp \ gui/settings/configpage.cpp \

File diff suppressed because it is too large Load Diff

View File

@ -27,16 +27,6 @@
#include "mainpage.h" #include "mainpage.h"
// states for sorting (equal values are possible)
// used in BuildSortString - state + name
#define PEER_STATE_ONLINE 1
#define PEER_STATE_BUSY 2
#define PEER_STATE_AWAY 3
#define PEER_STATE_AVAILABLE 4
#define PEER_STATE_INACTIVE 5
#define PEER_STATE_OFFLINE 6
#define BuildStateSortString(bEnabled,sName,nState) bEnabled ? (QString ("%1").arg(nState) + " " + sName) : sName
#ifndef MINIMAL_RSGUI #ifndef MINIMAL_RSGUI
#include "ui_FriendsDialog.h" #include "ui_FriendsDialog.h"
@ -47,7 +37,6 @@ class QTextEdit;
class QTextCharFormat; class QTextCharFormat;
class ChatDialog; class ChatDialog;
class AttachFileItem; class AttachFileItem;
class RSTreeWidgetItemCompareRole;
class FriendsDialog : public RsAutoUpdatePage class FriendsDialog : public RsAutoUpdatePage
{ {
@ -59,15 +48,10 @@ public:
/** Default Destructor */ /** Default Destructor */
~FriendsDialog (); ~FriendsDialog ();
// void setChatDialog(ChatDialog *cd);
virtual void updateDisplay() ; // overloaded from RsAutoUpdatePage virtual void updateDisplay() ; // overloaded from RsAutoUpdatePage
// replaced by shortcut
// virtual void keyPressEvent(QKeyEvent *) ;
public slots: public slots:
void insertPeers();
void publicChatChanged(int type); void publicChatChanged(int type);
// void toggleSendItem( QTreeWidgetItem *item, int col ); // void toggleSendItem( QTreeWidgetItem *item, int col );
@ -83,8 +67,6 @@ public slots:
// called by notifyQt when another peer is typing (in group chant and private chat) // 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 updatePeerStatusString(const QString& peer_id,const QString& status_string,bool is_private_chat) ;
void groupsChanged(int type);
protected: protected:
virtual void dragEnterEvent(QDragEnterEvent *event); virtual void dragEnterEvent(QDragEnterEvent *event);
virtual void dropEvent(QDropEvent *event); virtual void dropEvent(QDropEvent *event);
@ -99,39 +81,12 @@ private slots:
void on_actionDelete_Chat_History_triggered(); void on_actionDelete_Chat_History_triggered();
void on_actionMessageHistory_triggered(); void on_actionMessageHistory_triggered();
/** Create the context popup menu and it's submenus */
void peertreeWidgetCostumPopupMenu( QPoint point );
void updateStatusString(const QString& peer_id, const QString& statusString) ; // called when a peer is typing in group chat void updateStatusString(const QString& peer_id, const QString& statusString) ; // called when a peer is typing in group chat
void updateStatusTyping() ; // called each time a key is hit void updateStatusTyping() ; // called each time a key is hit
//void updatePeerStatusString(const QString& peer_id,const QString& chat_status) ; //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 addFriend(); void addFriend();
void chatfriend(QTreeWidgetItem* );
void chatfriendproxy();
void msgfriend();
void recommendfriend();
void pastePerson();
void copyLink();
void addToGroup();
void moveToGroup();
void removeFromGroup();
void editGroup();
void removeGroup();
void configurefriend();
#ifdef UNFINISHED
void viewprofile();
#endif
/** RsServer Friend Calls */
void connectfriend();
void setColor(); void setColor();
void insertSendList(); void insertSendList();
@ -158,15 +113,11 @@ private slots:
void setCurrentFileName(const QString &fileName); void setCurrentFileName(const QString &fileName);
void setStateColumn();
void sortPeersAscendingOrder();
void sortPeersDescendingOrder();
void peerSortIndicatorChanged(int,Qt::SortOrder);
void newsFeedChanged(int count); void newsFeedChanged(int count);
void peerSortColumnChanged(bool sortedByState);
signals: signals:
void friendsUpdated() ;
void notifyGroupChat(const QString&,const QString&) ; void notifyGroupChat(const QString&,const QString&) ;
private: private:
@ -176,26 +127,11 @@ private:
void colorChanged(const QColor &c); void colorChanged(const QColor &c);
void fontChanged(const QFont &font); void fontChanged(const QFont &font);
class QLabel *iconLabel, *textLabel;
class QWidget *widget;
class QWidgetAction *widgetAction;
class QSpacerItem *spacerItem;
RSTreeWidgetItemCompareRole *m_compareRole;
void displayMenu(); void displayMenu();
///play the sound when recv a message ///play the sound when recv a message
void playsound(); void playsound();
QString fileName; QString fileName;
bool groupsHasChanged;
std::list<std::string> openGroups;
/* Worker Functions */
/* (1) Update Display */
/* (2) Utility Fns */
QTreeWidgetItem *getCurrentPeer();
ChatStyle style; ChatStyle style;
@ -207,8 +143,6 @@ private:
int newsFeedTabIndex; int newsFeedTabIndex;
QColor newsFeedTabColor; QColor newsFeedTabColor;
QString newsFeedText; QString newsFeedText;
bool wasStatusColumnHidden;
bool correctColumnStatusSize;
/** Qt Designer generated object */ /** Qt Designer generated object */
Ui::FriendsDialog ui; Ui::FriendsDialog ui;

View File

@ -653,7 +653,10 @@ p, li { white-space: pre-wrap; }
</widget> </widget>
</item> </item>
<item row="3" column="0"> <item row="3" column="0">
<widget class="QTreeWidget" name="peertreeWidget"> <widget class="FriendList" name="friendList" native="true">
<property name="styleSheet">
<string notr="true">b{}</string>
</property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -666,73 +669,6 @@ p, li { white-space: pre-wrap; }
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>9</pointsize>
<stylestrategy>PreferAntialias</stylestrategy>
<kerning>true</kerning>
</font>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">QTreeWidget#peertreeWidget{border: 1px solid #CCCCCC;
background: white;}</string>
</property>
<property name="autoScroll">
<bool>false</bool>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="autoExpandDelay">
<number>1</number>
</property>
<property name="indentation">
<number>20</number>
</property>
<property name="itemsExpandable">
<bool>true</bool>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<property name="allColumnsShowFocus">
<bool>true</bool>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
<property name="expandsOnDoubleClick">
<bool>false</bool>
</property>
<attribute name="headerDefaultSectionSize">
<number>200</number>
</attribute>
<column>
<property name="text">
<string>Friends</string>
</property>
</column>
<column>
<property name="text">
<string>Status</string>
</property>
</column>
</widget> </widget>
</item> </item>
</layout> </layout>
@ -1463,6 +1399,30 @@ background: white;}</string>
<string>Save Chat History</string> <string>Save Chat History</string>
</property> </property>
</action> </action>
<action name="actionAdd_Group">
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/user/add_group22.png</normaloff>:/images/user/add_group22.png</iconset>
</property>
<property name="text">
<string>Add a new Group</string>
</property>
<property name="toolTip">
<string>Add a new Group</string>
</property>
</action>
<action name="actionDelete_Chat_History">
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/edit-clear-history.png</normaloff>:/images/edit-clear-history.png</iconset>
</property>
<property name="text">
<string>Delete Chat History</string>
</property>
<property name="toolTip">
<string>Deletes all stored and displayed chat history</string>
</property>
</action>
<action name="action_Hide_Offline_Friends"> <action name="action_Hide_Offline_Friends">
<property name="checkable"> <property name="checkable">
<bool>true</bool> <bool>true</bool>
@ -1494,20 +1454,11 @@ background: white;}</string>
<property name="checkable"> <property name="checkable">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="text"> <property name="enabled">
<string>Hide State</string> <bool>false</bool>
</property>
</action>
<action name="actionAdd_Group">
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/user/add_group22.png</normaloff>:/images/user/add_group22.png</iconset>
</property> </property>
<property name="text"> <property name="text">
<string>Add a new Group</string> <string>Hide State </string>
</property>
<property name="toolTip">
<string>Add a new Group</string>
</property> </property>
</action> </action>
<action name="actionSort_Peers_Descending_Order"> <action name="actionSort_Peers_Descending_Order">
@ -1534,16 +1485,15 @@ background: white;}</string>
<string>Sort Ascending Order</string> <string>Sort Ascending Order</string>
</property> </property>
</action> </action>
<action name="actionDelete_Chat_History"> <action name="action_Hide_Avatar_Column">
<property name="icon"> <property name="checkable">
<iconset resource="images.qrc"> <bool>true</bool>
<normaloff>:/images/edit-clear-history.png</normaloff>:/images/edit-clear-history.png</iconset>
</property> </property>
<property name="text"> <property name="text">
<string>Delete Chat History</string> <string>Hide Avatar Column</string>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string>Deletes all stored and displayed chat history</string> <string>Hide Avatar Column</string>
</property> </property>
</action> </action>
</widget> </widget>
@ -1560,6 +1510,13 @@ background: white;}</string>
<header>gui/common/RSTabWidget.h</header> <header>gui/common/RSTabWidget.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget>
<class>FriendList</class>
<extends>QWidget</extends>
<header>gui/common/FriendList.h</header>
<container>1</container>
</customwidget>
</customwidgets> </customwidgets>
<resources> <resources>
<include location="images.qrc"/> <include location="images.qrc"/>

File diff suppressed because it is too large Load Diff

View File

@ -27,23 +27,17 @@
#include <gui/common/rwindow.h> #include <gui/common/rwindow.h>
class LogoBar; class LogoBar;
class FriendsDialog;
class PopupChatDialog;
class RSTreeWidgetItemCompareRole;
class MessengerWindow : public RWindow class MessengerWindow : public RWindow
{ {
Q_OBJECT Q_OBJECT
public: public:
QPixmap picture;
static void showYourself (); static void showYourself ();
static MessengerWindow* getInstance(); static MessengerWindow* getInstance();
static void releaseInstance(); static void releaseInstance();
public slots: public slots:
void updateMessengerDisplay() ;
#ifndef MINIMAL_RSGUI #ifndef MINIMAL_RSGUI
void loadmystatusmessage(); void loadmystatusmessage();
#endif // MINIMAL_RSGUI #endif // MINIMAL_RSGUI
@ -59,30 +53,9 @@ protected:
void closeEvent (QCloseEvent * event); void closeEvent (QCloseEvent * event);
private slots: private slots:
/** Create the context popup menu and it's submenus */
void messengertreeWidgetCostumPopupMenu( QPoint point );
#ifndef MINIMAL_RSGUI #ifndef MINIMAL_RSGUI
/** Add a new friend */ /** Add a new friend */
void addFriend(); void addFriend();
/** Export friend */
void exportfriend();
/** Remove friend */
void removefriend();
#endif // MINIMAL_RSGUI
/** start to connect to a friend **/
void connectfriend();
#ifndef MINIMAL_RSGUI
/** start a chat with a friend **/
void chatfriend(QTreeWidgetItem *pPeer);
void chatfriendproxy();
/** start Messages Composer **/
void sendMessage();
/** show peers details for each friend **/
void configurefriend();
void recommendfriend();
void pastePerson();
/** Open Shared Manager **/ /** Open Shared Manager **/
void openShareManager(); void openShareManager();
@ -92,15 +65,10 @@ private slots:
void savestatusmessage(); void savestatusmessage();
#endif // MINIMAL_RSGUI #endif // MINIMAL_RSGUI
void on_actionSort_Peers_Descending_Order_activated();
void on_actionSort_Peers_Ascending_Order_activated();
void on_actionRoot_is_decorated_activated();
void filterRegExpChanged(); void filterRegExpChanged();
void clearFilter(); void clearFilter();
signals: signals:
void friendsUpdated() ;
private: private:
static MessengerWindow *_instance; static MessengerWindow *_instance;
@ -109,26 +77,11 @@ private:
void displayMenu(); void displayMenu();
/* Worker Functions */
/* (1) Update Display */
QTimer *timer;
/* (2) Utility Fns */
QTreeWidgetItem *getCurrentPeer();
void insertPeers();
void FilterItems();
bool FilterItem(QTreeWidgetItem *pItem, QString &sPattern);
QTreeView *messengertreeWidget;
LogoBar * _rsLogoBarmessenger; LogoBar * _rsLogoBarmessenger;
QFont itemFont;
QString m_nickName; QString m_nickName;
RSTreeWidgetItemCompareRole *m_compareRole;
/** Qt Designer generated object */ /** Qt Designer generated object */
Ui::MessengerWindow ui; Ui::MessengerWindow ui;
}; };

View File

@ -355,33 +355,13 @@ stop:0 #FEFEFE, stop:1 #E8E8E8);
</property> </property>
<layout class="QGridLayout" name="gridLayout_3"> <layout class="QGridLayout" name="gridLayout_3">
<item row="1" column="0"> <item row="1" column="0">
<widget class="QTreeWidget" name="messengertreeWidget"> <widget class="FriendList" name="friendList" native="true">
<property name="contextMenuPolicy"> <property name="sizePolicy">
<enum>Qt::CustomContextMenu</enum> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
<property name="styleSheet">
<string notr="true">QTreeWidget#messengertreeWidget{
border: 1px solid #CCCCCC;
}</string>
</property>
<property name="iconSize">
<size>
<width>38</width>
<height>38</height>
</size>
</property>
<property name="indentation">
<number>22</number>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<property name="columnCount">
<number>0</number>
</property>
<attribute name="headerShowSortIndicator" stdset="0">
<bool>false</bool>
</attribute>
</widget> </widget>
</item> </item>
</layout> </layout>
@ -458,6 +438,12 @@ border: 1px solid #CCCCCC;
<header>gui/common/AvatarWidget.h</header> <header>gui/common/AvatarWidget.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget>
<class>FriendList</class>
<extends>QWidget</extends>
<header>gui/common/FriendList.h</header>
<container>1</container>
</customwidget>
</customwidgets> </customwidgets>
<resources> <resources>
<include location="images.qrc"/> <include location="images.qrc"/>