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 "rsiface/rspeers.h"
#include "rsiface/rsmsgs.h"
#include "rsiface/rsQblog.h"
#include <sstream>
@ -55,6 +57,7 @@ ProfileView::ProfileView(QWidget *parent)
connect(ui.closeButton, SIGNAL(clicked()), this, SLOT(closeView()));
connect(ui.profileditButton, SIGNAL(clicked()), this, SLOT(profileEdit()));
loadAvatar();
/* Hide platform specific features */
#ifdef Q_WS_WIN
@ -193,11 +196,19 @@ void ProfileView::update()
std::list< std::pair<std::wstring, std::wstring> >::iterator pit;
std::list<FileInfo> files;
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);
ui.idLineEdit->setText(QString::fromStdString(pId));
ui.nameLineEdit->setText(QString::fromStdString("username"));
ui.nameLineEdit->setText(QString::fromStdString(detail.name));
{
std::ostringstream out;
out << PostTs;
@ -293,4 +304,29 @@ void ProfileView::filesClear()
/* 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

@ -38,10 +38,12 @@ public:
ProfileView(QWidget *parent = 0);
/** Default Destructor */
void setPeerId(std::string id);
void setPeerId(std::string id);
void clear();
void update();
void loadAvatar();
void clear();
void update();
public slots:

View File

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