Profile View some changes for testing

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2787 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2010-04-26 11:33:16 +00:00
parent 38e06135a4
commit 31fb4ce06a
3 changed files with 202 additions and 157 deletions

View file

@ -23,6 +23,8 @@
#include "gui/profile/ProfileEdit.h" #include "gui/profile/ProfileEdit.h"
#include "rsiface/rspeers.h" #include "rsiface/rspeers.h"
#include "rsiface/rsmsgs.h"
#include "rsiface/rsQblog.h" #include "rsiface/rsQblog.h"
#include <sstream> #include <sstream>
@ -55,6 +57,7 @@ ProfileView::ProfileView(QWidget *parent)
connect(ui.closeButton, SIGNAL(clicked()), this, SLOT(closeView())); connect(ui.closeButton, SIGNAL(clicked()), this, SLOT(closeView()));
connect(ui.profileditButton, SIGNAL(clicked()), this, SLOT(profileEdit())); connect(ui.profileditButton, SIGNAL(clicked()), this, SLOT(profileEdit()));
loadAvatar();
/* Hide platform specific features */ /* Hide platform specific features */
#ifdef Q_WS_WIN #ifdef Q_WS_WIN
@ -194,10 +197,18 @@ void ProfileView::update()
std::list<FileInfo> files; std::list<FileInfo> files;
std::list<FileInfo>::iterator fit; std::list<FileInfo>::iterator fit;
RsPeerDetails detail;
if (!rsPeers->getPeerDetails(pId, detail))
{
QMessageBox::information(this,
tr("RetroShare"),
tr("Error : cannot get peer details."));
}
rsQblog -> getPeerLatestBlog(pId, PostTs, BlogPost); rsQblog -> getPeerLatestBlog(pId, PostTs, BlogPost);
ui.idLineEdit->setText(QString::fromStdString(pId)); ui.idLineEdit->setText(QString::fromStdString(pId));
ui.nameLineEdit->setText(QString::fromStdString("username")); ui.nameLineEdit->setText(QString::fromStdString(detail.name));
{ {
std::ostringstream out; std::ostringstream out;
out << PostTs; out << PostTs;
@ -293,4 +304,29 @@ void ProfileView::filesClear()
/* add must be done from Shared Files */ /* add must be done from Shared Files */
void ProfileView::loadAvatar()
{
unsigned char *data = NULL;
int size = 0 ;
rsMsgs->getAvatarData(pId,data,size);
if(size != 0)
{
// set the image
QPixmap pix ;
pix.loadFromData(data,size,"PNG") ;
ui.photoLabel->setPixmap(pix);
delete[] data ;
}
else
{
ui.photoLabel->setPixmap(QPixmap(":/images/user/personal64.png"));
}
}

View file

@ -42,6 +42,8 @@ void setPeerId(std::string id);
void clear(); void clear();
void update(); void update();
void loadAvatar();
public slots: public slots:

View file

@ -1,121 +1,126 @@
<ui version="4.0" > <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ProfileView</class> <class>ProfileView</class>
<widget class="QWidget" name="ProfileView" > <widget class="QWidget" name="ProfileView">
<property name="geometry" > <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>590</width> <width>590</width>
<height>574</height> <height>464</height>
</rect> </rect>
</property> </property>
<property name="windowTitle" > <property name="windowTitle">
<string>Profile View</string> <string>Profile View</string>
</property> </property>
<property name="layoutDirection" > <property name="windowIcon">
<iconset resource="../images.qrc">
<normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum> <enum>Qt::LeftToRight</enum>
</property> </property>
<layout class="QGridLayout" name="gridLayout_2" > <layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0" colspan="2" > <item row="0" column="0" colspan="2">
<layout class="QGridLayout" > <layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0" colspan="2" > <item row="0" column="0" rowspan="3">
<layout class="QHBoxLayout" > <widget class="QLabel" name="photoLabel">
<item> <property name="minimumSize">
<widget class="QLabel" name="label_2" > <size>
<property name="text" > <width>100</width>
<string>Rs ID</string> <height>100</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>100</height>
</size>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="styleSheet">
<string notr="true">QLabel#photoLabel{
border-image: url(:/images/avatar_background.png);
}</string>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../images.qrc">:/images/user/personal64.png</pixmap>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1">
<layout class="QHBoxLayout">
<item> <item>
<widget class="QLineEdit" name="idLineEdit" > <widget class="QLabel" name="label_3">
<property name="readOnly" > <property name="text">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="2" >
<layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="label_3" >
<property name="text" >
<string>Name</string> <string>Name</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLineEdit" name="nameLineEdit" > <widget class="QLineEdit" name="nameLineEdit">
<property name="readOnly" > <property name="readOnly">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</item> </item>
<item row="1" column="0" > <item row="1" column="1">
<layout class="QVBoxLayout" > <layout class="QHBoxLayout">
<item> <item>
<widget class="QLabel" name="photoLabel" > <widget class="QLabel" name="label_2">
<property name="minimumSize" > <property name="text">
<size> <string>Peer ID</string>
<width>128</width>
<height>128</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>128</width>
<height>128</height>
</size>
</property>
<property name="contextMenuPolicy" >
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="styleSheet" >
<string notr="true" >border-image: url(:/images/avatar_background.png);</string>
</property>
<property name="text" >
<string/>
</property>
<property name="pixmap" >
<pixmap resource="../images.qrc" >:/images/user/personal64.png</pixmap>
</property>
<property name="alignment" >
<set>Qt::AlignCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLineEdit" name="idLineEdit">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="1">
<spacer> <spacer>
<property name="orientation" > <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
<property name="sizeHint" stdset="0" > <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>408</width>
<height>40</height> <height>28</height>
</size> </size>
</property> </property>
</spacer> </spacer>
</item> </item>
</layout> </layout>
</item> </item>
<item row="1" column="1" colspan="2" > <item row="1" column="0" colspan="2">
<layout class="QVBoxLayout" > <layout class="QVBoxLayout">
<item> <item>
<layout class="QHBoxLayout" > <layout class="QHBoxLayout">
<item> <item>
<widget class="QLabel" name="label_4" > <widget class="QLabel" name="label_4">
<property name="text" > <property name="text">
<string>Last Post:</string> <string>Last Post:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLineEdit" name="timeLineEdit" > <widget class="QLineEdit" name="timeLineEdit">
<property name="readOnly" > <property name="readOnly">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
@ -123,8 +128,8 @@
</layout> </layout>
</item> </item>
<item> <item>
<widget class="QTextEdit" name="postTextEdit" > <widget class="QTextEdit" name="postTextEdit">
<property name="maximumSize" > <property name="maximumSize">
<size> <size>
<width>16777215</width> <width>16777215</width>
<height>128</height> <height>128</height>
@ -134,39 +139,37 @@
</item> </item>
</layout> </layout>
</item> </item>
</layout> <item row="2" column="0" colspan="2">
</item> <layout class="QGridLayout" name="gridLayout">
<item row="1" column="0" colspan="2" > <property name="horizontalSpacing">
<layout class="QGridLayout" name="gridLayout" > <number>6</number>
<property name="horizontalSpacing" >
<number>-1</number>
</property> </property>
<property name="verticalSpacing" > <property name="verticalSpacing">
<number>0</number> <number>0</number>
</property> </property>
<item row="0" column="0" > <item row="0" column="0">
<widget class="QLabel" name="label_6" > <widget class="QLabel" name="label_6">
<property name="font" > <property name="font">
<font> <font>
<weight>75</weight> <weight>75</weight>
<bold>true</bold> <bold>true</bold>
</font> </font>
</property> </property>
<property name="text" > <property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css"> &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; } p, li { white-space: pre-wrap; }
&lt;/style>&lt;/head>&lt;body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:600; font-style:normal;"> &lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:600; font-style:normal;&quot;&gt;
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-size:16pt; vertical-align:sub;">Profile&lt;/span>&lt;/p>&lt;/body>&lt;/html></string> &lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:16pt; vertical-align:sub;&quot;&gt;Profile&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1" > <item row="0" column="1">
<spacer name="horizontalSpacer" > <spacer name="horizontalSpacer">
<property name="orientation" > <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="sizeHint" stdset="0" > <property name="sizeHint" stdset="0">
<size> <size>
<width>368</width> <width>368</width>
<height>20</height> <height>20</height>
@ -174,19 +177,19 @@ p, li { white-space: pre-wrap; }
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="0" column="2" > <item row="0" column="2">
<widget class="QToolButton" name="profileditButton" > <widget class="QToolButton" name="profileditButton">
<property name="toolTip" > <property name="toolTip">
<string>Edit Profile</string> <string>Edit Profile</string>
</property> </property>
<property name="text" > <property name="text">
<string/> <string/>
</property> </property>
<property name="icon" > <property name="icon">
<iconset resource="../images.qrc" > <iconset resource="../images.qrc">
<normaloff>:/images/user/kuser24.png</normaloff>:/images/user/kuser24.png</iconset> <normaloff>:/images/user/kuser24.png</normaloff>:/images/user/kuser24.png</iconset>
</property> </property>
<property name="iconSize" > <property name="iconSize">
<size> <size>
<width>24</width> <width>24</width>
<height>24</height> <height>24</height>
@ -194,21 +197,21 @@ p, li { white-space: pre-wrap; }
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0" colspan="3" > <item row="1" column="0" colspan="3">
<widget class="QTreeWidget" name="profileTreeWidget" > <widget class="QTreeWidget" name="profileTreeWidget">
<property name="contextMenuPolicy" > <property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum> <enum>Qt::CustomContextMenu</enum>
</property> </property>
<property name="rootIsDecorated" > <property name="rootIsDecorated">
<bool>false</bool> <bool>false</bool>
</property> </property>
<column> <column>
<property name="text" > <property name="text">
<string>Category</string> <string>Category</string>
</property> </property>
</column> </column>
<column> <column>
<property name="text" > <property name="text">
<string>Thoughts</string> <string>Thoughts</string>
</property> </property>
</column> </column>
@ -216,41 +219,41 @@ p, li { white-space: pre-wrap; }
</item> </item>
</layout> </layout>
</item> </item>
<item row="2" column="0" colspan="2" > <item row="3" column="0" colspan="2">
<layout class="QVBoxLayout" > <layout class="QVBoxLayout">
<property name="spacing" > <property name="spacing">
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="QLabel" name="label_5" > <widget class="QLabel" name="label_5">
<property name="font" > <property name="font">
<font> <font>
<weight>75</weight> <weight>75</weight>
<bold>true</bold> <bold>true</bold>
</font> </font>
</property> </property>
<property name="text" > <property name="text">
<string>Favourite Files</string> <string>Favourite Files</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QTreeWidget" name="fileTreeWidget" > <widget class="QTreeWidget" name="fileTreeWidget">
<property name="contextMenuPolicy" > <property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum> <enum>Qt::CustomContextMenu</enum>
</property> </property>
<column> <column>
<property name="text" > <property name="text">
<string>Name</string> <string>Name</string>
</property> </property>
</column> </column>
<column> <column>
<property name="text" > <property name="text">
<string>Size</string> <string>Size</string>
</property> </property>
</column> </column>
<column> <column>
<property name="text" > <property name="text">
<string>Hash</string> <string>Hash</string>
</property> </property>
</column> </column>
@ -258,12 +261,12 @@ p, li { white-space: pre-wrap; }
</item> </item>
</layout> </layout>
</item> </item>
<item row="3" column="0" > <item row="4" column="0">
<spacer> <spacer>
<property name="orientation" > <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="sizeHint" stdset="0" > <property name="sizeHint" stdset="0">
<size> <size>
<width>241</width> <width>241</width>
<height>28</height> <height>28</height>
@ -271,16 +274,16 @@ p, li { white-space: pre-wrap; }
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="3" column="1" > <item row="4" column="1">
<widget class="QPushButton" name="closeButton" > <widget class="QPushButton" name="closeButton">
<property name="layoutDirection" > <property name="layoutDirection">
<enum>Qt::RightToLeft</enum> <enum>Qt::RightToLeft</enum>
</property> </property>
<property name="text" > <property name="text">
<string>Close Profile</string> <string>Close Profile</string>
</property> </property>
<property name="icon" > <property name="icon">
<iconset resource="../images.qrc" > <iconset resource="../images.qrc">
<normaloff>:/images/close_normal.png</normaloff>:/images/close_normal.png</iconset> <normaloff>:/images/close_normal.png</normaloff>:/images/close_normal.png</iconset>
</property> </property>
</widget> </widget>
@ -288,7 +291,11 @@ p, li { white-space: pre-wrap; }
</layout> </layout>
</widget> </widget>
<resources> <resources>
<include location="../images.qrc" /> <include location="../images.qrc"/>
<include location="../images.qrc"/>
<include location="../images.qrc"/>
<include location="../images.qrc"/>
<include location="../images.qrc"/>
</resources> </resources>
<connections/> <connections/>
</ui> </ui>