mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Added to Display Avatar for NewsFeeds PeerItem. little design of PeerItem, removed not used buttons.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3359 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
e046ebd480
commit
c904eb54de
@ -52,8 +52,8 @@ PeerItem::PeerItem(FeedHolder *parent, uint32_t feedId, std::string peerId, uint
|
|||||||
/* specific ones */
|
/* specific ones */
|
||||||
connect( chatButton, SIGNAL( clicked( void ) ), this, SLOT( openChat ( void ) ) );
|
connect( chatButton, SIGNAL( clicked( void ) ), this, SLOT( openChat ( void ) ) );
|
||||||
connect( msgButton, SIGNAL( clicked( void ) ), this, SLOT( sendMsg ( void ) ) );
|
connect( msgButton, SIGNAL( clicked( void ) ), this, SLOT( sendMsg ( void ) ) );
|
||||||
connect( addButton, SIGNAL( clicked( void ) ), this, SLOT( addFriend ( void ) ) );
|
//connect( addButton, SIGNAL( clicked( void ) ), this, SLOT( addFriend ( void ) ) );
|
||||||
connect( removeButton, SIGNAL( clicked( void ) ), this, SLOT( removeFriend ( void ) ) );
|
//connect( removeButton, SIGNAL( clicked( void ) ), this, SLOT( removeFriend ( void ) ) );
|
||||||
|
|
||||||
small();
|
small();
|
||||||
updateItemStatic();
|
updateItemStatic();
|
||||||
@ -84,7 +84,7 @@ void PeerItem::updateItemStatic()
|
|||||||
title = "Friend: ";
|
title = "Friend: ";
|
||||||
break;
|
break;
|
||||||
case PEER_TYPE_CONNECT:
|
case PEER_TYPE_CONNECT:
|
||||||
title = "Friend Connected: ";
|
title = "Friend Connected";
|
||||||
break;
|
break;
|
||||||
case PEER_TYPE_HELLO:
|
case PEER_TYPE_HELLO:
|
||||||
title = "Connect Attempt: ";
|
title = "Connect Attempt: ";
|
||||||
@ -101,7 +101,7 @@ void PeerItem::updateItemStatic()
|
|||||||
|
|
||||||
/* set textcolor for peername */
|
/* set textcolor for peername */
|
||||||
QString nameStr("<span style=\"font-size:14pt; font-weight:500;"
|
QString nameStr("<span style=\"font-size:14pt; font-weight:500;"
|
||||||
"color:white;\">%1</span>");
|
"color:#990033;\">%1</span>");
|
||||||
|
|
||||||
/* set Blog name */
|
/* set Blog name */
|
||||||
QString peername = QString::fromStdString(details.name);
|
QString peername = QString::fromStdString(details.name);
|
||||||
@ -129,8 +129,8 @@ void PeerItem::updateItemStatic()
|
|||||||
lastLabel->setText("Unknown Peer");
|
lastLabel->setText("Unknown Peer");
|
||||||
|
|
||||||
chatButton->setEnabled(false);
|
chatButton->setEnabled(false);
|
||||||
addButton->setEnabled(false);
|
//addButton->setEnabled(false);
|
||||||
removeButton->setEnabled(false);
|
//removeButton->setEnabled(false);
|
||||||
msgButton->setEnabled(false);
|
msgButton->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,6 +143,7 @@ void PeerItem::updateItemStatic()
|
|||||||
/* disable buttons */
|
/* disable buttons */
|
||||||
clearButton->hide();
|
clearButton->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -196,14 +197,14 @@ void PeerItem::updateItem()
|
|||||||
chatButton->setEnabled(details.state & RS_PEER_STATE_CONNECTED);
|
chatButton->setEnabled(details.state & RS_PEER_STATE_CONNECTED);
|
||||||
if (details.state & RS_PEER_STATE_FRIEND)
|
if (details.state & RS_PEER_STATE_FRIEND)
|
||||||
{
|
{
|
||||||
addButton->setEnabled(false);
|
//addButton->setEnabled(false);
|
||||||
removeButton->setEnabled(true);
|
//removeButton->setEnabled(true);
|
||||||
msgButton->setEnabled(true);
|
msgButton->setEnabled(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
addButton->setEnabled(true);
|
//addButton->setEnabled(true);
|
||||||
removeButton->setEnabled(false);
|
//removeButton->setEnabled(false);
|
||||||
msgButton->setEnabled(false);
|
msgButton->setEnabled(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -211,6 +212,8 @@ void PeerItem::updateItem()
|
|||||||
/* slow Tick */
|
/* slow Tick */
|
||||||
int msec_rate = 10129;
|
int msec_rate = 10129;
|
||||||
|
|
||||||
|
loadAvatar();
|
||||||
|
|
||||||
QTimer::singleShot( msec_rate, this, SLOT(updateItem( void ) ));
|
QTimer::singleShot( msec_rate, this, SLOT(updateItem( void ) ));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -317,3 +320,30 @@ void PeerItem::openChat()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PeerItem::loadAvatar()
|
||||||
|
{
|
||||||
|
|
||||||
|
unsigned char *data = NULL;
|
||||||
|
int size = 0 ;
|
||||||
|
|
||||||
|
rsMsgs->getAvatarData(mPeerId,data,size);
|
||||||
|
|
||||||
|
|
||||||
|
if(size != 0)
|
||||||
|
{
|
||||||
|
// set the image
|
||||||
|
QPixmap pix ;
|
||||||
|
pix.loadFromData(data,size,"PNG") ;
|
||||||
|
avatar_label->setPixmap(pix);
|
||||||
|
delete[] data ;
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
avatar_label->setPixmap(QPixmap(":/images/user/personal64.png"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,6 +45,8 @@ public:
|
|||||||
|
|
||||||
void updateItemStatic();
|
void updateItemStatic();
|
||||||
void small();
|
void small();
|
||||||
|
void loadAvatar();
|
||||||
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
/* default stuff */
|
/* default stuff */
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>652</width>
|
<width>652</width>
|
||||||
<height>282</height>
|
<height>305</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -37,16 +37,94 @@ border-radius: 10px}</string>
|
|||||||
<property name="frameShadow">
|
<property name="frameShadow">
|
||||||
<enum>QFrame::Raised</enum>
|
<enum>QFrame::Raised</enum>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout">
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
<property name="topMargin">
|
<item row="0" column="0">
|
||||||
<number>6</number>
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
</property>
|
<item row="0" column="0" rowspan="2">
|
||||||
<property name="bottomMargin">
|
<widget class="QLabel" name="avatar_label">
|
||||||
<number>6</number>
|
<property name="minimumSize">
|
||||||
</property>
|
<size>
|
||||||
<item>
|
<width>70</width>
|
||||||
<layout class="QHBoxLayout">
|
<height>70</height>
|
||||||
<item>
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>70</width>
|
||||||
|
<height>70</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">QLabel#avatar_label{border: 2px solid green;
|
||||||
|
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
|
||||||
|
stop: 0 #BDDF7D, stop: 1 #49881F);
|
||||||
|
}</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="margin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="peernameLabel">
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Peer Name</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="3">
|
||||||
|
<widget class="QLabel" name="label_10">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Last Contact:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="4">
|
||||||
|
<widget class="QLabel" name="lastLabel">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>TextLabel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="6">
|
||||||
|
<widget class="QPushButton" name="expandButton">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Expand</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../images.qrc">
|
||||||
|
<normaloff>:/images/edit_add24.png</normaloff>:/images/edit_add24.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="7">
|
||||||
<widget class="QPushButton" name="clearButton">
|
<widget class="QPushButton" name="clearButton">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
@ -66,7 +144,7 @@ border-radius: 10px}</string>
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="1" column="1">
|
||||||
<widget class="QLabel" name="titleLabel">
|
<widget class="QLabel" name="titleLabel">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||||
@ -84,19 +162,12 @@ border-radius: 10px}</string>
|
|||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Connected</string>
|
<string>Connected</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
<property name="alignment">
|
||||||
</item>
|
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="peernameLabel">
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true"/>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Peer Name</string>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="1" column="2" colspan="6">
|
||||||
<spacer>
|
<spacer>
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
@ -106,61 +177,28 @@ border-radius: 10px}</string>
|
|||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>500</width>
|
<width>388</width>
|
||||||
|
<height>38</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>158</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_10">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<weight>75</weight>
|
|
||||||
<bold>true</bold>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Last Contact:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="lastLabel">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>TextLabel</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="expandButton">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Expand</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="../images.qrc">
|
|
||||||
<normaloff>:/images/add_24x24.png</normaloff>:/images/add_24x24.png</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="1" column="0">
|
||||||
<layout class="QHBoxLayout">
|
<layout class="QHBoxLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="typeLabel">
|
<widget class="QLabel" name="typeLabel">
|
||||||
@ -248,79 +286,7 @@ border-radius: 10px}</string>
|
|||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="addButton">
|
<widget class="QToolButton" name="msgButton">
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Make Friend</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="../images.qrc">
|
|
||||||
<normaloff>:/images/add-friend24.png</normaloff>:/images/add-friend24.png</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer>
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::Fixed</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="removeButton">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Remove Friend</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="../images.qrc">
|
|
||||||
<normaloff>:/images/removefriend16.png</normaloff>:/images/removefriend16.png</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer>
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::Fixed</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>60</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="msgButton">
|
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
@ -331,12 +297,18 @@ border-radius: 10px}</string>
|
|||||||
<string>Send Mail</string>
|
<string>Send Mail</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string>Write Message</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../images.qrc">
|
<iconset resource="../images.qrc">
|
||||||
<normaloff>:/images/mail_send.png</normaloff>:/images/mail_send.png</iconset>
|
<normaloff>:/images/mail_send.png</normaloff>:/images/mail_send.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="toolButtonStyle">
|
||||||
|
<enum>Qt::ToolButtonTextBesideIcon</enum>
|
||||||
|
</property>
|
||||||
|
<property name="autoRaise">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@ -356,7 +328,7 @@ border-radius: 10px}</string>
|
|||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="chatButton">
|
<widget class="QToolButton" name="chatButton">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
@ -367,17 +339,23 @@ border-radius: 10px}</string>
|
|||||||
<string>Chat</string>
|
<string>Chat</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string>Start Chat</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../images.qrc">
|
<iconset resource="../images.qrc">
|
||||||
<normaloff>:/images/chat.png</normaloff>:/images/chat.png</iconset>
|
<normaloff>:/images/chat.png</normaloff>:/images/chat.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="toolButtonStyle">
|
||||||
|
<enum>Qt::ToolButtonTextBesideIcon</enum>
|
||||||
|
</property>
|
||||||
|
<property name="autoRaise">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="2" column="0">
|
||||||
<widget class="QFrame" name="expandFrame">
|
<widget class="QFrame" name="expandFrame">
|
||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
<enum>QFrame::StyledPanel</enum>
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
Loading…
Reference in New Issue
Block a user