From 20aa2a031b5b270dc5786a244df50c54ec307175 Mon Sep 17 00:00:00 2001 From: drbob Date: Mon, 9 Jun 2008 13:23:53 +0000 Subject: [PATCH] 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 --- retroshare-gui/src/RetroShare.pro | 6 + retroshare-gui/src/gui/BlogDialog.cpp | 59 +- retroshare-gui/src/gui/BlogDialog.h | 2 + retroshare-gui/src/gui/BlogDialog.ui | 944 ++++++++++++++------------ retroshare-gui/src/rsiface/rsQblog.h | 33 +- 5 files changed, 612 insertions(+), 432 deletions(-) diff --git a/retroshare-gui/src/RetroShare.pro b/retroshare-gui/src/RetroShare.pro index 99e61ffbb..2c6a80b02 100644 --- a/retroshare-gui/src/RetroShare.pro +++ b/retroshare-gui/src/RetroShare.pro @@ -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 \ diff --git a/retroshare-gui/src/gui/BlogDialog.cpp b/retroshare-gui/src/gui/BlogDialog.cpp index 035e75b33..d5a8b5680 100644 --- a/retroshare-gui/src/gui/BlogDialog.cpp +++ b/retroshare-gui/src/gui/BlogDialog.cpp @@ -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::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::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 usrList; + /* get existing list ... */ + std::list filterList; + + std::list::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); + } + } +} + + diff --git a/retroshare-gui/src/gui/BlogDialog.h b/retroshare-gui/src/gui/BlogDialog.h index 15f6c79ac..510413b77 100644 --- a/retroshare-gui/src/gui/BlogDialog.h +++ b/retroshare-gui/src/gui/BlogDialog.h @@ -45,6 +45,8 @@ public slots: void update(); void showprofile(std::string id); + void updateUserList(); + void updateBlogs(); private slots: diff --git a/retroshare-gui/src/gui/BlogDialog.ui b/retroshare-gui/src/gui/BlogDialog.ui index 2b665dcbe..71a7a3d67 100644 --- a/retroshare-gui/src/gui/BlogDialog.ui +++ b/retroshare-gui/src/gui/BlogDialog.ui @@ -5,8 +5,8 @@ 0 0 - 640 - 454 + 687 + 482 @@ -505,59 +505,344 @@ - - - - 2 + + + + Qt::Vertical - - 0 - - - 0 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 6 - - - 6 - - - - - 0 + + + + + + Qt::Horizontal - - 0 - - - 0 - - - 0 - - - 6 - - - 6 - - - + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 6 + + + 6 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 6 + + + 6 + + + + + + 0 + 0 + + + + + + + :/images/chat.png + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 10 + 75 + true + + + + Blog Feed: + + + + + + + + + + 0 + 0 + + + + Qt::Horizontal + + + + 360 + 16 + + + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + Qt::CustomContextMenu + + + false + + + true + + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 6 + + + 6 + + + + + + 0 + 0 + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 41 + 20 + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 6 + + + 6 + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 10 + 75 + true + + + + Users: + + + + + + + + 0 + 0 + + + + + + + :/images/peers_16x16.png + + + + + + + + + + + + 0 + 0 + + + + + 20 + 0 + + + + + 0 + 0 + + + + Qt::CustomContextMenu + + + true + + + + User + + + + + + + + + + + + + + + + + :/images/add_24x24.png + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + 0 @@ -565,199 +850,211 @@ - - - - :/images/chat.png + Refresh Blog - - + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 24 + 24 + + + + + 24 + 24 + + + + + 0 + 0 + + + + Bold + + + + + + :/images/edit-bold.png + + + true + + + + + + + + 24 + 24 + + + + + 24 + 24 + + + + + 0 + 0 + + + + Italic + + + + + + :/images/edit-underline.png + + + true + + + + + + + + 24 + 24 + + + + + 24 + 24 + + + + + 0 + 0 + + + + Underline + + + + + + :/images/edit-italic.png + + + true + + + + + + + 0 - 0 + 5 + + + 16777215 + 100 + + 0 0 - - - 10 - 75 - true - - - - Blog Feed: + + + 0 + 0 + + + + + + + Recommend + + + + + + + + - - - - - 0 - 0 - - - - Qt::Horizontal - - - - 360 - 16 - - - - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - Qt::DefaultContextMenu - - - false - - - true - - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 6 - - - 6 - - - - - - 0 - 0 - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 41 - 20 - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 6 - - - 6 - - - - - - 0 - 0 - - + + + + 0 0 - - - 10 - 75 - true - - - Users: + Post Blog - - + + + + Qt::Vertical + + + + 20 + 40 + + + + + + 0 @@ -765,225 +1062,16 @@ - - - - :/images/peers_16x16.png + Show Profile - - - - - - 0 - 0 - - - - - 20 - 0 - - - - - 0 - 0 - - - - Qt::CustomContextMenu - - - true - - - - User - - - - - - - - - - - 24 - 24 - - - - - 24 - 24 - - - - - 0 - 0 - - - - Bold - - - - - - :/images/edit-bold.png - - - true - + - - - - - 24 - 24 - - - - - 24 - 24 - - - - - 0 - 0 - - - - Italic - - - - - - :/images/edit-underline.png - - - true - - - - - - - - 24 - 24 - - - - - 24 - 24 - - - - - 0 - 0 - - - - Underline - - - - - - :/images/edit-italic.png - - - true - - - - - - - - 0 - 5 - - - - - 16777215 - 100 - - - - - 0 - 0 - - - - - 0 - 0 - - - - - - - - - - - 0 - 0 - - - - Refresh Blog - - - - - - - - 0 - 0 - - - - Set Status - - - - - - - - 0 - 0 - - - - Send - - - - - diff --git a/retroshare-gui/src/rsiface/rsQblog.h b/retroshare-gui/src/rsiface/rsQblog.h index e5f21457e..b19733fc7 100644 --- a/retroshare-gui/src/rsiface/rsQblog.h +++ b/retroshare-gui/src/rsiface/rsQblog.h @@ -30,6 +30,8 @@ #include #include #include + +#include "rsiface/rstypes.h" /* delcare interafce for everyone o use */ @@ -104,7 +106,36 @@ extern RsQblog *rsQblog; * @param blogs contains the blog msgs of usr along with time posted for sorting */ virtual bool getBlogs(std::map< std::string, std::multimap > &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 > &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 &favs) = 0; + + }; #endif /*RSQBLOG_H_*/