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 */
|
||||
connect( chatButton, SIGNAL( clicked( void ) ), this, SLOT( openChat ( void ) ) );
|
||||
connect( msgButton, SIGNAL( clicked( void ) ), this, SLOT( sendMsg ( void ) ) );
|
||||
connect( addButton, SIGNAL( clicked( void ) ), this, SLOT( addFriend ( void ) ) );
|
||||
connect( removeButton, SIGNAL( clicked( void ) ), this, SLOT( removeFriend ( void ) ) );
|
||||
//connect( addButton, SIGNAL( clicked( void ) ), this, SLOT( addFriend ( void ) ) );
|
||||
//connect( removeButton, SIGNAL( clicked( void ) ), this, SLOT( removeFriend ( void ) ) );
|
||||
|
||||
small();
|
||||
updateItemStatic();
|
||||
@ -84,7 +84,7 @@ void PeerItem::updateItemStatic()
|
||||
title = "Friend: ";
|
||||
break;
|
||||
case PEER_TYPE_CONNECT:
|
||||
title = "Friend Connected: ";
|
||||
title = "Friend Connected";
|
||||
break;
|
||||
case PEER_TYPE_HELLO:
|
||||
title = "Connect Attempt: ";
|
||||
@ -101,7 +101,7 @@ void PeerItem::updateItemStatic()
|
||||
|
||||
/* set textcolor for peername */
|
||||
QString nameStr("<span style=\"font-size:14pt; font-weight:500;"
|
||||
"color:white;\">%1</span>");
|
||||
"color:#990033;\">%1</span>");
|
||||
|
||||
/* set Blog name */
|
||||
QString peername = QString::fromStdString(details.name);
|
||||
@ -129,8 +129,8 @@ void PeerItem::updateItemStatic()
|
||||
lastLabel->setText("Unknown Peer");
|
||||
|
||||
chatButton->setEnabled(false);
|
||||
addButton->setEnabled(false);
|
||||
removeButton->setEnabled(false);
|
||||
//addButton->setEnabled(false);
|
||||
//removeButton->setEnabled(false);
|
||||
msgButton->setEnabled(false);
|
||||
}
|
||||
|
||||
@ -143,6 +143,7 @@ void PeerItem::updateItemStatic()
|
||||
/* disable buttons */
|
||||
clearButton->hide();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -196,20 +197,22 @@ void PeerItem::updateItem()
|
||||
chatButton->setEnabled(details.state & RS_PEER_STATE_CONNECTED);
|
||||
if (details.state & RS_PEER_STATE_FRIEND)
|
||||
{
|
||||
addButton->setEnabled(false);
|
||||
removeButton->setEnabled(true);
|
||||
//addButton->setEnabled(false);
|
||||
//removeButton->setEnabled(true);
|
||||
msgButton->setEnabled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
addButton->setEnabled(true);
|
||||
removeButton->setEnabled(false);
|
||||
//addButton->setEnabled(true);
|
||||
//removeButton->setEnabled(false);
|
||||
msgButton->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
/* slow Tick */
|
||||
int msec_rate = 10129;
|
||||
|
||||
loadAvatar();
|
||||
|
||||
QTimer::singleShot( msec_rate, this, SLOT(updateItem( void ) ));
|
||||
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 small();
|
||||
void loadAvatar();
|
||||
|
||||
|
||||
private slots:
|
||||
/* default stuff */
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>652</width>
|
||||
<height>282</height>
|
||||
<height>305</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -37,16 +37,94 @@ border-radius: 10px}</string>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout">
|
||||
<property name="topMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0" rowspan="2">
|
||||
<widget class="QLabel" name="avatar_label">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>70</width>
|
||||
<height>70</height>
|
||||
</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">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
@ -66,7 +144,7 @@ border-radius: 10px}</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="titleLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
@ -84,19 +162,12 @@ border-radius: 10px}</string>
|
||||
<property name="text">
|
||||
<string>Connected</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="peernameLabel">
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Peer Name</string>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="1" column="2" colspan="6">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@ -106,61 +177,28 @@ border-radius: 10px}</string>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<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>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</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>
|
||||
</item>
|
||||
<item>
|
||||
<item row="1" column="0">
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="typeLabel">
|
||||
@ -248,79 +286,7 @@ border-radius: 10px}</string>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="addButton">
|
||||
<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">
|
||||
<widget class="QToolButton" name="msgButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
@ -331,12 +297,18 @@ border-radius: 10px}</string>
|
||||
<string>Send Mail</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
<string>Write Message</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/mail_send.png</normaloff>:/images/mail_send.png</iconset>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextBesideIcon</enum>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -356,7 +328,7 @@ border-radius: 10px}</string>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="chatButton">
|
||||
<widget class="QToolButton" name="chatButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
@ -367,17 +339,23 @@ border-radius: 10px}</string>
|
||||
<string>Chat</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
<string>Start Chat</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/chat.png</normaloff>:/images/chat.png</iconset>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextBesideIcon</enum>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QFrame" name="expandFrame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
|
Loading…
Reference in New Issue
Block a user