Improvements to BlogDialog Layout,

Added new blog interface to GUI.
Added ProfileView/Edit to Retroshare.pro



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@589 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2008-06-09 13:23:53 +00:00
parent 9f8f0e46f5
commit 20aa2a031b
5 changed files with 612 additions and 432 deletions

View File

@ -99,6 +99,8 @@ HEADERS += rshare.h \
util/RsAction.h \
util/printpreview.h \
gui/bwgraph/bwgraph.h \
gui/profile/ProfileView.h \
gui/profile/ProfileEdit.h \
gui/chat/PopupChatDialog.h \
gui/connect/ConnectDialog.h \
gui/connect/ConfCertDialog.h \
@ -177,6 +179,8 @@ FORMS += gui/ChatDialog.ui \
gui/MessagesDialog.ui \
gui/HelpDialog.ui \
gui/bwgraph/bwgraph.ui \
gui/profile/ProfileView.ui \
gui/profile/ProfileEdit.ui \
gui/chat/PopupChatDialog.ui \
gui/connect/ConnectDialog.ui \
gui/connect/ConfCertDialog.ui \
@ -263,6 +267,8 @@ SOURCES += main.cpp \
util/RsAction.cpp \
util/printpreview.cpp \
gui/bwgraph/bwgraph.cpp \
gui/profile/ProfileView.cpp \
gui/profile/ProfileEdit.cpp \
gui/chat/PopupChatDialog.cpp \
gui/connect/ConnectDialog.cpp \
gui/connect/ConfCertDialog.cpp \

View File

@ -35,7 +35,7 @@ BlogDialog::BlogDialog(QWidget *parent)
setupUi(this);
connect(sendBtn, SIGNAL(clicked()), this, SLOT(sendBlog()));
connect(statusBtn, SIGNAL(clicked()), this, SLOT(setStatus()));
//connect(statusBtn, SIGNAL(clicked()), this, SLOT(setStatus()));
connect(boldBtn, SIGNAL(clicked()), this, SLOT(setFont()));
connect(underlineBtn, SIGNAL(clicked()), this, SLOT(setFont()));
connect(italicBtn, SIGNAL(clicked()), this, SLOT(setFont()));
@ -171,10 +171,15 @@ void BlogDialog::addUser(const std::string &usr)
void BlogDialog::clear(void)
{
blogText->clear();
userList->clear();
}
void BlogDialog::update(void)
{
updateUserList();
updateBlogs();
}
void BlogDialog::updateBlogs(void)
{
rsQblog->getFilterSwitch();
@ -212,6 +217,8 @@ void BlogDialog::update(void)
/* print usr name and their blogs to screen */
for(std::list<std::string>::iterator it = usrList.begin(); it !=usrList.end(); it++)
{
TempVar = rsPeers->getPeerName(*it).c_str(); // store usr name in temporary
blogText->setTextColor(QColor(255, 0, 0, 255));
blogText->setCurrentFont(mUsrFont); // make bold for username
@ -221,7 +228,6 @@ void BlogDialog::update(void)
/*print blog time-posted/msgs to screen*/
std::multimap<long int, std::string>::reverse_iterator blogIt = blogs[*it].rbegin();
addUser(rsPeers->getPeerName(*it)); // add usr to Qwidget tree
if(blogs[*it].empty())
{
@ -246,5 +252,52 @@ void BlogDialog::update(void)
}
void BlogDialog::updateUserList(void)
{
/* retrieve usr names and populate usr list bar */
std::list<std::string> usrList;
/* get existing list ... */
std::list<std::string> filterList;
std::list<std::string>::iterator it;
if ((!rsPeers) || (!rsQblog))
{
/* not ready yet! */
return;
}
rsPeers->getFriendList(usrList);
usrList.push_back(rsPeers->getOwnId()); // add your id
//rsQblog->getFilterList(filterList);
userList->clear();
/* print usr name and their blogs to screen */
for(it = usrList.begin(); it !=usrList.end(); it++)
{
QTreeWidgetItem *item = new QTreeWidgetItem(userList);
bool active = false;
if (filterList.end() != std::find(filterList.begin(), filterList.end(), *it))
active = true;
item->setText(0, QString::fromStdString(rsPeers->getPeerName(*it))); // add usr to Qwidget tree
item->setText(1, QString::fromStdString(*it)); // add usr id.
if (active)
{
item -> setCheckState(0, Qt::Checked);
}
else
{
item -> setCheckState(0, Qt::Unchecked);
}
}
}

View File

@ -45,6 +45,8 @@ public slots:
void update();
void showprofile(std::string id);
void updateUserList();
void updateBlogs();
private slots:

View File

@ -5,8 +5,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>640</width>
<height>454</height>
<width>687</width>
<height>482</height>
</rect>
</property>
<property name="sizePolicy" >
@ -505,18 +505,21 @@
<iconset/>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" colspan="3" >
<layout class="QGridLayout" >
<property name="topMargin" >
<number>2</number>
</property>
<property name="horizontalSpacing" >
<number>0</number>
</property>
<property name="verticalSpacing" >
<number>0</number>
</property>
<item row="0" column="0" >
<widget class="QSplitter" name="splitter_2" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<widget class="QWidget" name="" >
<layout class="QVBoxLayout" >
<item>
<widget class="QSplitter" name="splitter" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<widget class="QWidget" name="" >
<layout class="QVBoxLayout" >
<item>
<layout class="QGridLayout" >
<property name="leftMargin" >
<number>0</number>
@ -575,7 +578,7 @@
<item row="0" column="1" >
<widget class="QLabel" name="label_12" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -621,7 +624,7 @@
</item>
</layout>
</item>
<item row="1" column="0" >
<item>
<widget class="QTextBrowser" name="blogText" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
@ -636,7 +639,7 @@
</size>
</property>
<property name="contextMenuPolicy" >
<enum>Qt::DefaultContextMenu</enum>
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="undoRedoEnabled" >
<bool>false</bool>
@ -647,8 +650,8 @@
</widget>
</item>
</layout>
</item>
<item rowspan="4" row="0" column="3" >
</widget>
<widget class="QWidget" name="" >
<layout class="QGridLayout" >
<property name="leftMargin" >
<number>0</number>
@ -779,7 +782,7 @@
<item row="1" column="0" >
<widget class="QTreeWidget" name="userList" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
<sizepolicy vsizetype="Expanding" hsizetype="Ignored" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -810,8 +813,71 @@
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="1" column="0" >
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QPushButton" name="expandButton" >
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/add_24x24.png</iconset>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="refreshBtn" >
<property name="sizeIncrement" >
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text" >
<string>Refresh Blog</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="" >
<layout class="QHBoxLayout" >
<item>
<layout class="QVBoxLayout" >
<item>
<layout class="QHBoxLayout" >
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="boldBtn" >
<property name="minimumSize" >
<size>
@ -845,7 +911,7 @@
</property>
</widget>
</item>
<item row="1" column="1" >
<item>
<widget class="QPushButton" name="underlineBtn" >
<property name="minimumSize" >
<size>
@ -879,7 +945,7 @@
</property>
</widget>
</item>
<item row="1" column="2" >
<item>
<widget class="QPushButton" name="italicBtn" >
<property name="minimumSize" >
<size>
@ -913,7 +979,9 @@
</property>
</widget>
</item>
<item row="2" column="0" colspan="3" >
</layout>
</item>
<item>
<widget class="QTextEdit" name="lineEdit" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
@ -941,34 +1009,24 @@
</property>
</widget>
</item>
<item row="3" column="0" colspan="3" >
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QPushButton" name="refreshBtn" >
<property name="sizeIncrement" >
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<widget class="QCheckBox" name="recommendBox" >
<property name="text" >
<string>Refresh Blog</string>
<string>Recommend</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="statusBtn" >
<property name="sizeIncrement" >
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text" >
<string>Set Status</string>
</property>
</widget>
<widget class="QLineEdit" name="recommendLineEdit" />
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" >
<item>
<widget class="QPushButton" name="sendBtn" >
<property name="sizeIncrement" >
@ -978,13 +1036,43 @@
</size>
</property>
<property name="text" >
<string>Send</string>
<string>Post Blog</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="showBtn" >
<property name="sizeIncrement" >
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text" >
<string>Show Profile</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
<action name="actionSend" >
<property name="text" >
<string>Send</string>

View File

@ -31,6 +31,8 @@
#include <list>
#include <map>
#include "rsiface/rstypes.h"
/* delcare interafce for everyone o use */
class RsQblog;
@ -105,6 +107,35 @@ extern RsQblog *rsQblog;
*/
virtual bool getBlogs(std::map< std::string, std::multimap<long int, std:: string> > &blogs) = 0;
/**
* Stuff DrBob Added for Profile View!
*/
/**
* get users Latest Blog Post.
* @param id the usr whose idetails you want to get.
* @param ts Timestamp of the Blog Post.
* @param post the actual Blog Post.
*/
virtual bool getPeerLatestBlog(std::string id, uint32_t &ts, std::wstring &post) = 0;
/**
* get users Profile.
* @param id the user id
* @param entries set of profile information.
*/
virtual bool getPeerProfile(std::string id, std::list< std::pair<std::wstring, std::wstring> > &entries) = 0;
/**
* get users fav files
* @param id the user whose info you want.
* @param favs list of Files
*/
virtual bool getPeerFavourites(std::string id, std::list<FileInfo> &favs) = 0;
};
#endif /*RSQBLOG_H_*/