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

File diff suppressed because it is too large Load Diff

View File

@ -27,16 +27,6 @@
#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
#include "ui_FriendsDialog.h"
@ -47,7 +37,6 @@ class QTextEdit;
class QTextCharFormat;
class ChatDialog;
class AttachFileItem;
class RSTreeWidgetItemCompareRole;
class FriendsDialog : public RsAutoUpdatePage
{
@ -59,15 +48,10 @@ public:
/** Default Destructor */
~FriendsDialog ();
// void setChatDialog(ChatDialog *cd);
virtual void updateDisplay() ; // overloaded from RsAutoUpdatePage
// replaced by shortcut
// virtual void keyPressEvent(QKeyEvent *) ;
public slots:
void insertPeers();
void publicChatChanged(int type);
// 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)
void updatePeerStatusString(const QString& peer_id,const QString& status_string,bool is_private_chat) ;
void groupsChanged(int type);
protected:
virtual void dragEnterEvent(QDragEnterEvent *event);
virtual void dropEvent(QDropEvent *event);
@ -99,39 +81,12 @@ private slots:
void on_actionDelete_Chat_History_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 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 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 insertSendList();
@ -158,15 +113,11 @@ private slots:
void setCurrentFileName(const QString &fileName);
void setStateColumn();
void sortPeersAscendingOrder();
void sortPeersDescendingOrder();
void peerSortIndicatorChanged(int,Qt::SortOrder);
void newsFeedChanged(int count);
void peerSortColumnChanged(bool sortedByState);
signals:
void friendsUpdated() ;
void notifyGroupChat(const QString&,const QString&) ;
private:
@ -176,26 +127,11 @@ private:
void colorChanged(const QColor &c);
void fontChanged(const QFont &font);
class QLabel *iconLabel, *textLabel;
class QWidget *widget;
class QWidgetAction *widgetAction;
class QSpacerItem *spacerItem;
RSTreeWidgetItemCompareRole *m_compareRole;
void displayMenu();
///play the sound when recv a message
void playsound();
QString fileName;
bool groupsHasChanged;
std::list<std::string> openGroups;
/* Worker Functions */
/* (1) Update Display */
/* (2) Utility Fns */
QTreeWidgetItem *getCurrentPeer();
ChatStyle style;
@ -207,8 +143,6 @@ private:
int newsFeedTabIndex;
QColor newsFeedTabColor;
QString newsFeedText;
bool wasStatusColumnHidden;
bool correctColumnStatusSize;
/** Qt Designer generated object */
Ui::FriendsDialog ui;

View File

@ -653,7 +653,10 @@ p, li { white-space: pre-wrap; }
</widget>
</item>
<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">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
<horstretch>0</horstretch>
@ -666,73 +669,6 @@ p, li { white-space: pre-wrap; }
<height>0</height>
</size>
</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>
</item>
</layout>
@ -1463,6 +1399,30 @@ background: white;}</string>
<string>Save Chat History</string>
</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 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">
<property name="checkable">
<bool>true</bool>
@ -1494,20 +1454,11 @@ background: white;}</string>
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Hide State</string>
</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 name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Add a new Group</string>
</property>
<property name="toolTip">
<string>Add a new Group</string>
<string>Hide State </string>
</property>
</action>
<action name="actionSort_Peers_Descending_Order">
@ -1534,16 +1485,15 @@ background: white;}</string>
<string>Sort Ascending Order</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>
<action name="action_Hide_Avatar_Column">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Delete Chat History</string>
<string>Hide Avatar Column</string>
</property>
<property name="toolTip">
<string>Deletes all stored and displayed chat history</string>
<string>Hide Avatar Column</string>
</property>
</action>
</widget>
@ -1560,6 +1510,13 @@ background: white;}</string>
<header>gui/common/RSTabWidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>FriendList</class>
<extends>QWidget</extends>
<header>gui/common/FriendList.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<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>
class LogoBar;
class FriendsDialog;
class PopupChatDialog;
class RSTreeWidgetItemCompareRole;
class MessengerWindow : public RWindow
{
Q_OBJECT
public:
QPixmap picture;
public:
static void showYourself ();
static MessengerWindow* getInstance();
static void releaseInstance();
public slots:
void updateMessengerDisplay() ;
#ifndef MINIMAL_RSGUI
void loadmystatusmessage();
#endif // MINIMAL_RSGUI
@ -59,30 +53,9 @@ protected:
void closeEvent (QCloseEvent * event);
private slots:
/** Create the context popup menu and it's submenus */
void messengertreeWidgetCostumPopupMenu( QPoint point );
#ifndef MINIMAL_RSGUI
/** Add a new friend */
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 **/
void openShareManager();
@ -92,15 +65,10 @@ private slots:
void savestatusmessage();
#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 clearFilter();
signals:
void friendsUpdated() ;
private:
static MessengerWindow *_instance;
@ -109,26 +77,11 @@ private:
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;
QFont itemFont;
QString m_nickName;
RSTreeWidgetItemCompareRole *m_compareRole;
/** Qt Designer generated object */
Ui::MessengerWindow ui;
};

View File

@ -355,33 +355,13 @@ stop:0 #FEFEFE, stop:1 #E8E8E8);
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="1" column="0">
<widget class="QTreeWidget" name="messengertreeWidget">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
<widget class="FriendList" name="friendList" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</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>
</item>
</layout>
@ -458,6 +438,12 @@ border: 1px solid #CCCCCC;
<header>gui/common/AvatarWidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>FriendList</class>
<extends>QWidget</extends>
<header>gui/common/FriendList.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="images.qrc"/>