From 6d6798e788914675766d7ace93a0716b4416565e Mon Sep 17 00:00:00 2001 From: defnax Date: Thu, 24 Sep 2009 21:38:40 +0000 Subject: [PATCH] added For Friends Context Menu a Title Widget git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1681 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/PeersDialog.cpp | 27 +++++++++++++++++++++++++- retroshare-gui/src/gui/PeersDialog.h | 7 ++++--- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/retroshare-gui/src/gui/PeersDialog.cpp b/retroshare-gui/src/gui/PeersDialog.cpp index c95aa0528..9119aaa8c 100644 --- a/retroshare-gui/src/gui/PeersDialog.cpp +++ b/retroshare-gui/src/gui/PeersDialog.cpp @@ -169,6 +169,7 @@ PeersDialog::PeersDialog(QWidget *parent) menu->addAction(ui.actionAdd_Friend); menu->addSeparator(); menu->addAction(ui.actionCreate_new_Profile); + //ui.menupushButton->setPopupMode(QToolButton::MenuButtonPopup); ui.menupushButton->setMenu(menu); updateAvatar(); @@ -208,7 +209,31 @@ void PeersDialog::peertreeWidgetCostumPopupMenu( QPoint point ) connect( removefriendAct , SIGNAL( triggered() ), this, SLOT( removefriend() ) ); + QWidget *widget = new QWidget(); + widget->setStyleSheet( ".QWidget{background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,stop:0 #FEFEFE, stop:1 #E8E8E8); border: 1px solid #CCCCCC;}"); + + QHBoxLayout *hbox = new QHBoxLayout(); + hbox->setMargin(0); + hbox->setSpacing(6); + + iconLabel = new QLabel( this ); + iconLabel->setPixmap(QPixmap::QPixmap(":/images/user/friends24.png")); + iconLabel->setMaximumSize( iconLabel->frameSize().height() + 24, 24 ); + hbox->addWidget(iconLabel); + + textLabel = new QLabel( tr("Friends"), this ); + hbox->addWidget(textLabel); + + spacerItem = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); + hbox->addItem(spacerItem); + + widget->setLayout( hbox ); + + QWidgetAction *widgetAction = new QWidgetAction(this); + widgetAction->setDefaultWidget(widget); + contextMnu.clear(); + contextMnu.addAction( widgetAction); contextMnu.addAction( chatAct); contextMnu.addAction( msgAct); contextMnu.addSeparator(); @@ -219,7 +244,7 @@ void PeersDialog::peertreeWidgetCostumPopupMenu( QPoint point ) contextMnu.addAction( exportfriendAct); contextMnu.addAction( removefriendAct); contextMnu.exec( mevent->globalPos() ); - + } diff --git a/retroshare-gui/src/gui/PeersDialog.h b/retroshare-gui/src/gui/PeersDialog.h index 974136ae4..83f63a3d4 100644 --- a/retroshare-gui/src/gui/PeersDialog.h +++ b/retroshare-gui/src/gui/PeersDialog.h @@ -119,6 +119,10 @@ signals: void notifyGroupChat(const QString&,const QString&) ; private: + class QLabel *iconLabel, *textLabel; + class QWidget *widget; + class QWidgetAction *widgetAction; + class QSpacerItem *spacerItem; /* Worker Functions */ /* (1) Update Display */ @@ -126,9 +130,6 @@ private: /* (2) Utility Fns */ QTreeWidgetItem *getCurrentPeer(); - // ChatDialog *chatDialog; - - /** Define the popup menus for the Context menu */ QMenu* contextMnu; /** Defines the actions for the context menu */